Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932197AbdHYIiT (ORCPT ); Fri, 25 Aug 2017 04:38:19 -0400 Received: from mail-db5eur01on0042.outbound.protection.outlook.com ([104.47.2.42]:44352 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754961AbdHYIcS (ORCPT ); Fri, 25 Aug 2017 04:32:18 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Florent.Revest@arm.com; From: Florent Revest To: linux-arm-kernel@lists.infradead.org Cc: matt@codeblueprint.co.uk, ard.biesheuvel@linaro.org, pbonzini@redhat.com, rkrcmar@redhat.com, christoffer.dall@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, marc.zyngier@arm.com, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, leif.lindholm@arm.com, revestflo@gmail.com, Florent Revest Subject: [RFC 01/11] arm64: Add an SMCCC function IDs header Date: Fri, 25 Aug 2017 09:31:31 +0100 Message-Id: <1503649901-5834-2-git-send-email-florent.revest@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503649901-5834-1-git-send-email-florent.revest@arm.com> References: <1503649901-5834-1-git-send-email-florent.revest@arm.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: HE1PR09CA0051.eurprd09.prod.outlook.com (2603:10a6:7:3c::19) To HE1PR08MB0812.eurprd08.prod.outlook.com (2a01:111:e400:59b1::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 61a78ae4-7ca5-4fd2-245d-08d4eb93c7f2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:HE1PR08MB0812; X-Microsoft-Exchange-Diagnostics: 1;HE1PR08MB0812;3:WMPqGNTj6dkD2t3HcgBs6+4Dl65ltkndUes/4qqAVNCC/S/9vh+7UwSTz5RrGEEI18kNr/nw0FIu7g2VU9eOcynEdZ4o+jswOVIll3FnW4LPT2KdR+jsmubZgpGWx7tm+x40P8hZ/cdrbk15WDVpzvvhFO3VXV6WncQ6RiKLFiLP9Iq6Af9lsey1+D7/EaqSgxSU0itqHiMDLT4S5T2QxFd4GzzKm3hk4EZWDYC+XbeH1jWjblfTKzgUg6rlRis4;25:ZjLJ3e076Jq0OZrZ7FLjBCahzQ0o3vryEosmWileNXwES+5EdOT0sRf/ObhDS9ehWHhoBirEPSieMR2DqWN1vURTlo5ZKPXwJjz4R7K5A2JsTVuBA08ulgip+E0JY201Txb0fdNDe5nKQzYTAwXfRnyFWRWkDln9s+N/QH9xqlf44pOBTwtfWHocmjIe/wFPTiEsYVE7MG8nKHFOS+VHKdQVyKfx5l48/LNYoGtVSrUSGuqcNyUDPG3WkkX7/DJDA1ZdF5vhgpafs8THxu3j1VLVRbcc9/kAmfZYHLg53JOuE0hoz4j/gcUrQ2nreQ9iM9a0ObfN/9QD9jSpIUoI6w==;31:Z+A+hvUSBpMPJyrPvNwuq6+s/5T4kTs05iV6b60JE3pBNlDslCUNqotY1NwOawe7ZOGBs8Wvv0AAdnw9DZRqAl3SM39uJW+OS7U95Q4CGpX4XB6c6SQUzwWdlAgo2oQODMHUTUcJlhVameVofrScX19ef5ZZR0B3Nsq8QqMcIDT6crKLgW/V2JjV1ERw2GxBXVToySTe0L3D8LXn2+HH+XqhJ5Zzg5lbjuPGhXXR6Ic= X-MS-TrafficTypeDiagnostic: HE1PR08MB0812: X-Microsoft-Exchange-Diagnostics: 1;HE1PR08MB0812;20:U+Zd19Wb+9JEhxC/e78kbaZBnbuGQarkzcZqRyv7IA8Qt5ZA8puVUw57/WhPyFgiSJaaImnyQYMpDwHsujbdJv743dYcceyDPDzM8ySKKDDCdFJx5klSvCnpy2fV5pS2cinLYexCZ62qpB1a34w3/K9CrMzjd4Yk0DVF/9fDATwu37ud+2o+aAXtp7uH7LHL2WLFE3xFXM+yeyaaOYvJp6AIGfF4lacrTIdD8cBEvJTPK44bKxa8bljlHZgez/VjhBuumfI3lemgtPTNWACPXp+Ljipy4MjAJL3ak/Zz8+fdoZJTosxjHphzPnrBWJ7eWS45NV3YlT8ytMbAFUjUOJ4wMaOIydZJep11Nf0NaDed9qD6Bj1P0aNc8t0+OV2UhWU9uBPHuK1xe3Nf18jV+VYaGddojSXbSap6qabbKNHBhawD/STX/psNgTlQoKLMevYeQV2n5lwWqPyqinaKSLURv5BBEmJgiZlWITELGTnJxNaSPaG44dvJFtnhFiIX;4:SnVoknls8Vu/S1Z3BjfefNFYVL57n2ufmXW9pjJRBD3NcIaB9UY4MADvtYNjigBIJWB2YOnev7/n8f4Hd7BwujQ1WqyQVbJVXfxHwjTJi3SxfFKGRFz2xRJ5kDcR/PR3Hzo+sSLceP65HG4aSwWqEptl5OWRj3RGQXk6qBXdZcmsU9xbTzFrKTiu3EFITiw/7GuiNous2PoAr5zVD4WLx5fttxIeDD5cr43KlCD7OtZDWnCcDdGkkirGIq0f0kDTEbDVRGFmnDGApr4HRIpiCt98CEXERNWGzeZ1wPhMwfc= X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR08MB0812;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR08MB0812; X-Forefront-PRVS: 041032FF37 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(979002)(6009001)(39860400002)(199003)(40434004)(189002)(478600001)(68736007)(76176999)(25786009)(5660300001)(97736004)(36756003)(6486002)(50226002)(47776003)(50986999)(50466002)(4326008)(48376002)(7350300001)(110136004)(66066001)(7416002)(8676002)(189998001)(305945005)(5890100001)(6916009)(2351001)(105586002)(42186005)(6116002)(2361001)(8746002)(3846002)(86362001)(2906002)(72206003)(81156014)(81166006)(2950100002)(106356001)(6666003)(7736002)(33646002)(101416001)(5003940100001)(53936002)(2004002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR08MB0812;H:e106757-lin.cambridge.arm.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR08MB0812;23:qyuRixiXiukV5bj2RMRBHX6lWewaVuzVxxhw7FCyt?= =?us-ascii?Q?IgaZpm2yYKnIVuDrtw15ndhpfwAWv6PsYBxgXGt0yGja6g3vMXKCHcGYcKnc?= =?us-ascii?Q?WYoHAf8caTOFBnaGG0xVXvN7pb22kXglicWXtKAS1a2IfKc6Z+aJgl1hqqE7?= =?us-ascii?Q?tq/IxrW+ezcnqM+C4xRDxkAw/xoFtLFLwMoY7ovdylNQbpVSlUSb1NOALgwO?= =?us-ascii?Q?f3zXkbWt3QNQHXA3AeiosZmGQKxIbrUr7Ovw4/lawh9ooRyCFpsDmZy09htz?= =?us-ascii?Q?rKlYWhhPILdfippPOzghhJUBn8f6jBhQaq/gvdvHNCTbfYbx+f4zLXDxLNH6?= =?us-ascii?Q?n8K+GWRDnhDI+cVVEffrj6hSx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t24rz2G5TJrQtYuzXOPvTLvPW1JZdO1+5lZKO/FnfBn6dE73si?= =?us-ascii?Q?YnzbV692R9YPnOHBeSe/mFFO0kgX/jteNZ9n4BIx49+?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR08MB0812;6:trHaklISeYGCLaGljYo5faUmSPBEUghIntGN5WFOKEtDmsLhiFQ6rPf9lqxmUkSvhC5JJ8I8wJs1drQ4bv/B/tuBcUM8M19Svqf/N3zEmaP+STJZ1TuALs0KyZQgWtybNMji7+fYTbCQ1REDG4QPPSsEPhmg2giUNkKMU/Kv22wAGd8tnBiuM8ghGxzzVS9/HmhiCG61rxIkWuQqRdLLmEe7T74+/WGi6qcyFzF704dliIko0ypgclNX/vzgcbFY1BQkEblyi72AUwgqczzMsLaPb6OYM+lOcMTvI55ybmuxu7OkYBHzmeievXiKnJxIGWQsNvQpiNJe43h/MoO+Jg==;5:UE1FlAkdygmN855wAwIK/Qu8I8x7e68mnogTPtX1gBSuY4GKqbblXSitfQBW1qNFJTPYoR94Qv6/It9BCbOu47nYVpFlSjPswLN7nWY4ctX9CW3TV9pSUiw1wlgkHMuZtwRtLcd5PemxvA1YM/kxww==;24:caa99iepHZTIPU4H9/xAafDWd3end4I/Pb2FY5HInTIbF/BPhj7uR03zB/95I+TLC298EERFX71KHw/1qeIni54YOjccgLhrqw7HviLdBxY=;7:53XxnM3uOEpSJnzGU/aysxsnaaT+wlEv1f3qE+9r60tvvKy5l4wyKAqpkJEBBULDpbZVeWkSw/8ACulnp3fJVlmD0l2qLNyemfWo21gOcWgAKzTFFkKDl1Bkxw5bvG2SHFFfahNVEDWE/IbRenJA3t/oel2uRY0sl2PdoVglCruODrq1iqBsiJmsgB0vm+RN6oU5X4UrJGGxDaGUsnFTa9N0lJXikjvuPpcnjhv2uL4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2017 08:32:10.2555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB0812 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v7P8cSTR010039 Content-Length: 2991 Lines: 84 The ARM SMC Calling Convention (DEN 0028B) introduces function IDs for hypercalls, given in the x0 register during an SMC or HVC from a guest. The document defines ranges of function IDs targeting different kinds of hypervisors or supervisors. Two ID ranges are of particular interest for the kernel: - Standard hypervisor service calls - Vendor specific hypervisor service calls This patch introduces a couple of useful macros when working with SMCCC. They provide defines of those ID ranges to be used by HVC handling (KVM) or calling. (e.g: to leverage paravirtualized services) The document also defines standard return values to be written into x0 after a hypercall handling. Once again, those macros can potentially be used from both the hypervisor or the guest. Signed-off-by: Florent Revest --- include/linux/smccc_fn.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 include/linux/smccc_fn.h diff --git a/include/linux/smccc_fn.h b/include/linux/smccc_fn.h new file mode 100644 index 0000000..f08145d --- /dev/null +++ b/include/linux/smccc_fn.h @@ -0,0 +1,50 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Copyright (C) 2017 ARM Limited + */ + +#ifndef __LINUX_SMCCC_FN_H +#define __LINUX_SMCCC_FN_H + +/* + * Standard return values + */ + +#define SMCCC_STD_RET_SUCCESS 0 +#define SMCCC_STD_RET_UNKNOWN_ID -1 + + +/* + * SMC32 + */ + +/* Standard hypervisor services interface */ +#define SMCCC32_STD_HYP_FN_BASE 0x85000000 +#define SMCCC32_STD_HYP_FN(n) (SMCCC32_STD_HYP_FN_BASE + (n)) + +/* Vendor specific hypervisor services interface */ +#define SMCCC32_VDR_HYP_FN_BASE 0x86000000 +#define SMCCC32_VDR_HYP_FN(n) (SMCCC32_VDR_HYP_FN_BASE + (n)) + + +/* + * SMC64 + */ + +/* Standard hypervisor services interface */ +#define SMCCC64_STD_HYP_FN_BASE 0xc5000000 +#define SMCCC64_STD_HYP_FN(n) (SMCCC64_STD_HYP_FN_BASE + (n)) + +/* Vendor specific hypervisor services interface */ +#define SMCCC64_VDR_HYP_FN_BASE 0xc6000000 +#define SMCCC64_VDR_HYP_FN(n) (SMCCC64_VDR_HYP_FN_BASE + (n)) + +#endif /* __LINUX_SMCCC_FN_H */ -- 1.9.1 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.