From patchwork Mon Mar 8 19:57:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 395695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41541C433E9 for ; Mon, 8 Mar 2021 19:58:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1552E65238 for ; Mon, 8 Mar 2021 19:58:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbhCHT6O (ORCPT ); Mon, 8 Mar 2021 14:58:14 -0500 Received: from mail-dm6nam12on2099.outbound.protection.outlook.com ([40.107.243.99]:39904 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231408AbhCHT6G (ORCPT ); Mon, 8 Mar 2021 14:58:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PAZrS1ZNjS4oxPspd0k5k9Fff/nIsqbAaYIhW+n47AfJarAJfSVV8JI/rvRntq3f4aoGQXgKF4mfwSpwvSrMv/gnPHgzaSzW0yzIHgtThAnMK2fLj93jaSHn9B8cZwGohosuUJ22zHhmyjfQ+2OcoVRXvUR9R9g0yTgV0yfPkGnEFMsjOJJEq6YDsOhA92UTNz63maYWrRpp+/KMr9ZivEl6oLuHXv7877Ap7JzrUAnd6qZxyACzwRO72VnN+SqSNhsblXwU11LLnus43Mab76tTJ9xxXi+8IbRGHjnmLln7IzXAjS5njJnnakJfJnjKHZH30Ik/yrPdtSA1wJ7XkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LjnVlCjdirzLfOmUZU1miEK/c6Tg7S9zHT0pUjJUFto=; b=asmb36HWDtfsXFm0Dy0mLiy4PpRGv7GeZ7i+HM5dLpU2w82OfQpfXiAv8AGoZCHpp44RhD3cqt2L++GJb6G/9kUFUMfzn6Hb3E5UUIxjDalmBDg7O/mQu5JKuNN738rd2Eb9rucQqXKVGS9Bkx2ZVsDjtx6BjPQHsF0PwR14rmi5hDEJGcwdgiD+7E/SfcBZEfJvs9kWkP3LOG4odK18k4+WDnXtqRB4M3GF8OM4XBDE1lACTDKzjMmeiGyCaGuDNSpCrXYSzlj+cbYuRupzBS5sDh4dRj59nERtQuYLwZdRE5oPxT5912lrvoUVMtKha+PwmV4rrRnC91W7QNSmHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LjnVlCjdirzLfOmUZU1miEK/c6Tg7S9zHT0pUjJUFto=; b=SscZyWqH7HxfPn090PcO4IWKPEQIzGlNb79sWhFtGvpdorigFB50G1OkGB5INePzU584YU1vYSc/l8EiBnkaVDb8bv+fM62W+7kiMHgXYl+qBdbEetZusBA/EQtSpSlFewVC6PMFseWJGzogmDdIxDKJZbUwlRiO4o2XAYYk8GQ= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:05 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:05 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 1/7] smccc: Add HVC call variant with result registers other than 0 thru 3 Date: Mon, 8 Mar 2021 11:57:13 -0800 Message-Id: <1615233439-23346-2-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d1e17fc7-c5ed-4021-7ebf-08d8e26c7cb1 X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J1wHuCgkhNrVTdgMOV3+uRfRH5IKuU0O9j0wr6rFJ008WZjVO+9JI9Z+8MgPw5i5RpWDsNSEXRAHsqR44h1SFFO6bHfHFIGJcUw4W64Wk02Y+bl3HvTia6MOG9Z+FL2DtJjHCcAmEPgnNMJSWIBH02MLIv6kwX8hhkY8+opuH41Zlob5iqWTT/WAfL8vm/crEcajTQyyl9+inHwWqIkQvjXMI64KOqJDwhyOi9kJp9KAKQBH/b4ThxYKjDZzEmAs2sIPJDKO/fnj07mp9E54X+83T6PjYPLt66kD8lE12TmTLtcKoy+xxmSE/bjOQdIA+qfl+4rSG7Ms8Aa9A+StNahojdnb4FPjF9QK8CGuUmM2QlZc4Yg9O6rcsS3Gnhxqng9YZo2mfwhijgOpqZDz99WEHy0wAhfZp0Q85G/aGVUJSLknmMVh8djA4eVMyArjhXZjuQUr5xO/j0PRMPUnMzKECiRcX1uZ46RYHOCKjcSUmtMUiO1dtnw4OCG2nPetxQtiKcyUqLHSTbJkZH44cjPqdTHIsXvQhjyqiNhKBJoS9ErZdFVkCr9/TapAP5tHqpqHZjV/pFn1hf2J123VLzWShlVTCr04C0vfhS1r91A= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(5660300002)(2906002)(36756003)(8936002)(6666004)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: /C+px/mHLxAZ5FYB/7sfOOFhnoHGSjl/onbftkIopi6FnhnmeEzaRa/typeuolbSRSio7Lp6hhguvvaf/2OGW0Xarf6xeC/6ERdKaEVKdzZPpwGzP7ZbLPmr2vd5yHoc+LNA3TKqpnl52dmdIQhpbYpuBSyDvAM+ws2/NYtVELG8u4XetRui2GRqu3a9HRyBBDMg8Di4NP6uTZxafe68E2ms+HhtkXwlPWCXHs3vfj5AWyFH85qx/8MIpjzWFZU3xAIfpB+XIs2o9SW5I2hNmow+DDj6Ix9+YbGeTFQjr1+UbLM2vvUi01JgxUefHwJcNS6oZM2iA6GouYGz1Z+2Nv2wPHGQI2k+NvxPU2U28RJfp4SxHImVUqL3CJ27Dlzs2FNSmJQK15XpNIR6aYCFLD4kFI4f3Usmzn6CTL9KakKWIjiyAUXzKCllrBGVnpZUk4w8Wm5t/ZAyN38w2kVh58AwSeFTw8o+4DTVOJA4MshYCPs8LC8/FR+2igpmjCqWRijHvNAbjkHNw2+7/ytxCYQcgG+SfQ09t0RtGzVm+r3rdUJ3qFY+88Y8m2HJouDIvsFZY9tWBuDPcusUbdj1PBX4LlzllSRonU0+Qbd6FxlJCeQc0TJjjEymXr1c0iTsnxqwp5ZuV2ZDbj1VOEpBytze5ZrjwmAiJIJJ3TV+1/0K1BISd8IIMOq7osGAl5sX6QP1zbODEnfB9XTWK7Y9uajj4GgF/ro1/Gpr+xqQwxfy22Mm2pYcS5kcb81Km+1scA8IRrs61O7k8yfO5Wrah8BljvaD36kslvivdm0fwgAi/4l0XwQDkeDcSf2WNy8cfBsNfDkrchmhubjJqsmAs/ocwRWe7w4SsJ/dOXVIk9c++pNywJb3Q6tIc5mcZ7gpbM5Yr1MpCL9zbVdMaF2WouCETQWlmMrbFAUJWWVSqrUvDgBAfnywi413Ne+VA0UlxcPUx7SpUV8dVwLBfs69bYoRQ/vledhlaolkZ6/AuOr4RrRMT+VMqiPALIkXhKvY/Cx1jfN0VHOEhH9S9RXFA2NJJFXcjcDr7VaqwizZH8fEIM69GlcaADA5Vq+LpwUDwGCpOR8fDkwRtGCjyLUJCtHVwVd/sw7KMPp5RLF/dnANSgjQPF+s03+hENSXUEtPvJVVrZ7K6h4bPnvNycUOIiki6tBseQDQyT8A7cchl7bJW5qL5QuXy61qNnccUqdDY4tkyNoXMlbknCIpDNASRrJmEjxb+oxdhG2C+oo/V51d5vCGFQOa1wfeyetglIa6kV0/Hi/95U27TIzqpagVFcjqkLr47RKv8cRBLslu2zNn+Ue/1qSQnFh/C6bG12Gt X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1e17fc7-c5ed-4021-7ebf-08d8e26c7cb1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:05.0830 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VtNYgB6AWEQvxXiXBKnOgHKq/OXlzj9+80fPrdWr4970yczchR64WItTJfGRDD9MIkwfImgAWbSTNCRBDWJ+dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Hypercalls to Hyper-V on ARM64 may return results in registers other than X0 thru X3, as permitted by the SMCCC spec version 1.2 and later. Accommodate this by adding a variant of arm_smccc_1_1_hvc that allows the caller to specify which 3 registers are returned in addition to X0. Signed-off-by: Michael Kelley --- There are several ways to support returning results from registers other than X0 thru X3, and Hyper-V usage should be compatible with whatever the maintainers prefer. What's implemented in this patch may be the most flexible, but it has the downside of not being a true function interface in that args 0 thru 2 must be fixed strings, and not general "C" expressions. Other alternatives include: * Create a variant that hard codes to return X5 thru X7, though in the future there may be Hyper-V hypercalls that need a different hard-coded variant. * Return all of X0 thru X7 in a larger result structure. That approach may execute more memory stores, but performance is unlikely to be an issue for the Hyper-V hypercalls that would use it. However, it's possible in the future that Hyper-V results might be beyond X7, as allowed by the SMCCC v1.3 spec. * The macro __arm_smccc_1_1() could be cloned in Hyper-V specific code and modified to meet Hyper-V specific needs, but this seems undesirable since Hyper-V is operating within the v1.2 spec. In any of these cases, the call might be renamed from "_1_1_" to "_1_2_" to reflect conformance to the later spec version. include/linux/arm-smccc.h | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h index f860645..acda958 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -300,12 +300,12 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, * entitled to optimise the whole sequence away. "volatile" is what * makes it stick. */ -#define __arm_smccc_1_1(inst, ...) \ +#define __arm_smccc_1_1(inst, reg1, reg2, reg3, ...) \ do { \ register unsigned long r0 asm("r0"); \ - register unsigned long r1 asm("r1"); \ - register unsigned long r2 asm("r2"); \ - register unsigned long r3 asm("r3"); \ + register unsigned long r1 asm(reg1); \ + register unsigned long r2 asm(reg2); \ + register unsigned long r3 asm(reg3); \ __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \ asm volatile(inst "\n" : \ "=r" (r0), "=r" (r1), "=r" (r2), "=r" (r3) \ @@ -328,7 +328,8 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, * to the SMC instruction. The return values are updated with the content * from register 0 to 3 on return from the SMC instruction if not NULL. */ -#define arm_smccc_1_1_smc(...) __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__) +#define arm_smccc_1_1_smc(...)\ + __arm_smccc_1_1(SMCCC_SMC_INST, "r1", "r2", "r3", __VA_ARGS__) /* * arm_smccc_1_1_hvc() - make an SMCCC v1.1 compliant HVC call @@ -344,7 +345,23 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, * to the HVC instruction. The return values are updated with the content * from register 0 to 3 on return from the HVC instruction if not NULL. */ -#define arm_smccc_1_1_hvc(...) __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__) +#define arm_smccc_1_1_hvc(...) \ + __arm_smccc_1_1(SMCCC_HVC_INST, "r1", "r2", "r3", __VA_ARGS__) + +/* + * arm_smccc_1_1_hvc_reg() - make an SMCCC v1.1 compliant HVC call + * specifying output registers + * + * This is a variant of arm_smccc_1_1_hvc() that allows specifying + * three registers from which result values will be returned in + * addition to r0. + * + * @a0-a2: register specifications for 3 return registers (e.g., "r5") + * @a3-a10: arguments passed in registers 0 to 7 + * @res: result values from register 0 and the three registers specified + * in a0-a2. + */ +#define arm_smccc_1_1_hvc_reg(...) __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__) /* * Like arm_smccc_1_1* but always returns SMCCC_RET_NOT_SUPPORTED. From patchwork Mon Mar 8 19:57:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 396317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-24.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD03BC4332D for ; Mon, 8 Mar 2021 19:58:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E13165260 for ; Mon, 8 Mar 2021 19:58:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbhCHT6Q (ORCPT ); Mon, 8 Mar 2021 14:58:16 -0500 Received: from mail-eopbgr770104.outbound.protection.outlook.com ([40.107.77.104]:16005 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231424AbhCHT6I (ORCPT ); Mon, 8 Mar 2021 14:58:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZkZ6K2tLLSDXWteDAKOOHaI0s20ea3t3zYbO4TBTAjzjb5yOo6grD5FE4pS3XvirbdKmXOBXB5N3uWOrDk1MZ/eaqBWObvSfYUF5iVd7weuxlTYOpzSFgSKKtZlo1a9GpJWDhX/SjIUQOFTTWsoV53AGnEos9g1W3f5W2y6ybISpOavibb4YjNP6v1YMz4TSVNPPB0Y+xKtfkWwAJjPaDN9bgkd7ns+9Ryy5hE6lyxZvJE+6rtwpMhHaiYmN/qypX3IyMXssrTksm3Rxa3S4SupfbNzPHdRJRj13EosftB0gl34qliiXpigvchpf0iU1JTb/LXM/D+JsSjQv+dmDdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p6oClYZdvvXUdvZ/mfIwOcXb0EgRKwM9SJL8rZlT3uo=; b=cr3suDDgIqM1ty3zZRg10mQtJ2kwZuJ0JxPMY6M9sAUmpn2O0E9YTnzzMoAJt/toFKdJ0fiBzw96kcGXWeGvOINb2W0VNMahYxEcOrqQoQWspNnkbbuctEJpF8WVszMmYfImsbZM3MneEaWF557jZAP1hdwr3KAIuONxlhxFhAsTiL4929279M5kyk9BCW5Wb+WNd6f4DKNZ49u/p9L86m22YR8iOBCcd/j9Zdu/n95Q1PyGDnj72CCMR52ZiqoPSHc6CzeFoHE0q6NCW3AfD8qwyE44ldjFpDTw7wqX2hhfUxH9aAs1lKsEOXLilh1IAWmomro9TQBm4m3Ed1lUoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p6oClYZdvvXUdvZ/mfIwOcXb0EgRKwM9SJL8rZlT3uo=; b=j4N6vPcOnCmkKypXDdBZCyxlNpWr5dfChpRw7maEfmxYuDdRwDyayl1qNAys1QStPsFxjz6QCZG3LJWY+zpfn06P/iZxrJLufsXgV7wupF6zoa6xsUTM5d/UDhAaAE94os/lGtHRbEEnhreAtO1+QhPc6RmLByi4y4W0LUsVKZg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:06 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:06 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 2/7] arm64: hyperv: Add Hyper-V hypercall and register access utilities Date: Mon, 8 Mar 2021 11:57:14 -0800 Message-Id: <1615233439-23346-3-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c529c428-0e12-45b3-208f-08d8e26c7d5a X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j+F5R+ac2AZpNa5AnL4CIPdKzoHOzxU4zqnXsHOvnNtT8OExOZwMMrlWR0b7U7nZXhF20kixxxlyXga3Zr+ImuOaftYEuvj3BTgloBgJicvDujNTUH4MlcEE5/y+o9G0Fh0cHcA13ibGJW6QKT31Eye86+1byhPp6c23V9FJ4YHhZoNp1MNdE+qT85tyfIkjjX+DeewttTgVJWjpIu9IzJQ/OpNRlb52B0obGMHskyRS9p2woMyWPfv53j4H+IIE65Cr29k7gmgZZEJKjR3kvmoiwzP1HzvrYa+IpYNj7iifsijwvzgHwdL0rVt+TsyA/W8kLD7OUBtQ6ZAV5e3XO9+23fC5u78wOtyRJT+reb250rFGQbE+7layfXE7j2bNuGw8GFsxTE51BgpvjEP3nuAO3nYI3LSsIHyIOWIYgCiylFgP73CNwgLAMnnGczw+lsNhxxJs+5gFn0OrbpgeEqtbYlEfInfT64PoD7TS2Ji1zGWuZ8wlRyAdR19CZLSjJnvPJRTG7JbrYDtJy7TjGiSpq2xozxqScUMjHbzIitWFprH3AF5pSegva7v00PjbKhctX59a09qL4hTxLt3mA7qxu92MZ/P5PIQT4UkQQLcFJPQ/KZswfTVYbnTUS+hhn4nCRUaAE2O0500jxzXrhH57VAZoUwPhf1hN3gP5BWbyzXd4O/SZKih3y/5rDNeq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(966005)(5660300002)(2906002)(36756003)(8936002)(6666004)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PFVC4Q48rQMYA+XVyJlyQcyTunTYn5Dtu9Zk8DDUQfXA/CUhpaTqMVheHuVkrxZxAkaEqcLkb9NdRRIXxDzXbxL67Ar1kJlD5EW/AA1Hz01qcLsHsRn1LgAud7CBP14vD9n6rfJBKbtbNxjc3RuZGiVCdMD7/BLqi7BP7xM/GxbxFMRtf2yXJnftRya7wKnjq8Tm12afB5H4NtuGXShs1rgUUnjzYJR0HQZ5L7tBdG0+sAEMPDBXD+F7jR6tJL5MbVA9jX6vxwWWDELkeM7b3nI+fbHD0Ng0qtZya1rXADW2bCiH7mt/NqX5SP2VhVhCnnAaE98H1U23RbOCFSTC2+vHVYdz4xilxqn5uo7KGAAOWGia4kXftLLOaDO43KlZzrMHR6bXiOXyEK2RPmjITBmWtAyp+RLW1oxhHei//XJRlKnCCsi4B0mo0d5KXEFZq4gA6VEQ50memJ7cISDbKdIwcI6tjy+c87532AXKHcHPrCuBQB3hVPEHUp42ptBpVGdJ3okXoZjhZezKyEzRJgSgMog6WXMkfee7vCO4IklnAWr9o+125xfAvGLE8JLPr/V3WnyK1j9XPwEQoLwekamsQMcPgFGzViGLrB7crBZYVansf9wnHPkECf88EPvJOiniPvL+CTsx5OGCzkA+GarE/Q7L9RKZdZn+JJat3kf8N9kg4Hg8HQMbvlcsGsV4JBxNSwRKUujRBSc3Q6Yp0EQNZ7Im9rPvkH1u7mA4zYNGQ+WBOqgfnH82z6HGHV63lw5jQYrZIX/0eu0sPRbmRekLtiv+3nutbyfN1O48CqCNKIfnNq3G5F0QLviRUJx+lF83me/WOA06McaqUtNjiIgtvE3P6FMBbqaxdJtqN/+2mGWme9SQDYObT3rEPFjvTqRW7hLBKCvO6apgC1Wfq6mRi7vzOIaaUOo66o5JyvLwgREMh8b9nPrJ2iQGJmNdT0iNulcC+8nCG6E3OzmjZyXBYvlUHB2b6uS+BGtwIxCX0ggq333U4RRZBuaktjI3wgOZlPDP/K4NFZ+OuQhO9fYgBQTntqaPQvNx/fiz2Wd3uJHG5Ccm+z/jzcBE5CwhTaBztv2vkiXbAhf6R5u/LLGB85QsKOLN7Ny2AjIxF3eOZPhdkoB1Ge/5waacBuoLXu2jRiYCsh8+CRF018AIhQqBHu/H1F74Yak485CDKy6s3JODTi3Gx985fudsRQ/rkcgBnipveghqJxheBUi5WxHg8TPgCskg0B4H91qrQZzo+nL/PlWoc4WKmotNs1nYkVxQCaTOHZjqWZAXDYLuOHNQddmPMkrfnZYGbD1b5pfFgR5Uk98bd2DRROutU2WB X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c529c428-0e12-45b3-208f-08d8e26c7d5a X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:06.1543 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mU/5doOYawQIGk6c1Vl6/fizOMEAlMgj+REUFacruqggDUxgTzXPc+gfVr3F7kOsypbBjNYbcWWU/1N1QvtRpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org hyperv-tlfs.h defines Hyper-V interfaces from the Hyper-V Top Level Functional Spec (TLFS), and #includes the architecture-independent part of hyperv-tlfs.h in include/asm-generic. The published TLFS is distinctly oriented to x86/x64, so the ARM64-specific hyperv-tlfs.h includes information for ARM64 that is not yet formally published. The TLFS is available here: docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs mshyperv.h defines Linux-specific structures and routines for interacting with Hyper-V on ARM64, and #includes the architecture- independent part of mshyperv.h in include/asm-generic. Use these definitions to provide utility functions to make Hyper-V hypercalls and to get and set Hyper-V provided registers associated with a virtual processor. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy --- MAINTAINERS | 3 + arch/arm64/Kbuild | 1 + arch/arm64/hyperv/Makefile | 2 + arch/arm64/hyperv/hv_core.c | 126 +++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/hyperv-tlfs.h | 69 +++++++++++++++++++ arch/arm64/include/asm/mshyperv.h | 54 +++++++++++++++ 6 files changed, 255 insertions(+) create mode 100644 arch/arm64/hyperv/Makefile create mode 100644 arch/arm64/hyperv/hv_core.c create mode 100644 arch/arm64/include/asm/hyperv-tlfs.h create mode 100644 arch/arm64/include/asm/mshyperv.h diff --git a/MAINTAINERS b/MAINTAINERS index bfc1b86..7a47a90 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8232,6 +8232,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git F: Documentation/ABI/stable/sysfs-bus-vmbus F: Documentation/ABI/testing/debugfs-hyperv F: Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst +F: arch/arm64/hyperv +F: arch/arm64/include/asm/hyperv-tlfs.h +F: arch/arm64/include/asm/mshyperv.h F: arch/x86/hyperv F: arch/x86/include/asm/hyperv-tlfs.h F: arch/x86/include/asm/mshyperv.h diff --git a/arch/arm64/Kbuild b/arch/arm64/Kbuild index d646582..7a37608 100644 --- a/arch/arm64/Kbuild +++ b/arch/arm64/Kbuild @@ -3,4 +3,5 @@ obj-y += kernel/ mm/ obj-$(CONFIG_NET) += net/ obj-$(CONFIG_KVM) += kvm/ obj-$(CONFIG_XEN) += xen/ +obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/ obj-$(CONFIG_CRYPTO) += crypto/ diff --git a/arch/arm64/hyperv/Makefile b/arch/arm64/hyperv/Makefile new file mode 100644 index 0000000..1697d30 --- /dev/null +++ b/arch/arm64/hyperv/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-y := hv_core.o diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c new file mode 100644 index 0000000..d5a8a6e --- /dev/null +++ b/arch/arm64/hyperv/hv_core.c @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Low level utility routines for interacting with Hyper-V. + * + * Copyright (C) 2021, Microsoft, Inc. + * + * Author : Michael Kelley + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * hv_do_hypercall- Invoke the specified hypercall + */ +u64 hv_do_hypercall(u64 control, void *input, void *output) +{ + struct arm_smccc_res res; + u64 input_address; + u64 output_address; + + input_address = input ? virt_to_phys(input) : 0; + output_address = output ? virt_to_phys(output) : 0; + + arm_smccc_1_1_hvc(HV_FUNC_ID, control, + input_address, output_address, &res); + return res.a0; +} +EXPORT_SYMBOL_GPL(hv_do_hypercall); + +/* + * hv_do_fast_hypercall8 -- Invoke the specified hypercall + * with arguments in registers instead of physical memory. + * Avoids the overhead of virt_to_phys for simple hypercalls. + */ + +u64 hv_do_fast_hypercall8(u16 code, u64 input) +{ + struct arm_smccc_res res; + u64 control; + + control = (u64)code | HV_HYPERCALL_FAST_BIT; + + arm_smccc_1_1_hvc(HV_FUNC_ID, control, input, &res); + return res.a0; +} +EXPORT_SYMBOL_GPL(hv_do_fast_hypercall8); + +/* + * Set a single VP register to a 64-bit value. + */ +void hv_set_vpreg(u32 msr, u64 value) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc( + HV_FUNC_ID, + HVCALL_SET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT | + HV_HYPERCALL_REP_COMP_1, + HV_PARTITION_ID_SELF, + HV_VP_INDEX_SELF, + msr, + 0, + value, + 0, + &res); + + /* + * Something is fundamentally broken in the hypervisor if + * setting a VP register fails. There's really no way to + * continue as a guest VM, so panic. + */ + BUG_ON((res.a0 & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS); +} +EXPORT_SYMBOL_GPL(hv_set_vpreg); + +/* + * Get the value of a single VP register. One version + * returns just 64 bits and another returns the full 128 bits. + * The two versions are separate to avoid complicating the + * calling sequence for the more frequently used 64 bit version. + */ + +void hv_get_vpreg_128(u32 msr, struct hv_get_vp_registers_output *result) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc_reg("r5", "r6", "r7", + HV_FUNC_ID, + HVCALL_GET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT | + HV_HYPERCALL_REP_COMP_1, + HV_PARTITION_ID_SELF, + HV_VP_INDEX_SELF, + msr, + 0, + &res); + + /* + * Something is fundamentally broken in the hypervisor if + * getting a VP register fails. There's really no way to + * continue as a guest VM, so panic. + */ + BUG_ON((res.a0 & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS); + + result->as64.low = res.a2; /* r6 */ + result->as64.high = res.a3; /* r7 */ +} +EXPORT_SYMBOL_GPL(hv_get_vpreg_128); + +u64 hv_get_vpreg(u32 msr) +{ + struct hv_get_vp_registers_output output; + + hv_get_vpreg_128(msr, &output); + + return output.as64.low; +} +EXPORT_SYMBOL_GPL(hv_get_vpreg); diff --git a/arch/arm64/include/asm/hyperv-tlfs.h b/arch/arm64/include/asm/hyperv-tlfs.h new file mode 100644 index 0000000..4d964a7 --- /dev/null +++ b/arch/arm64/include/asm/hyperv-tlfs.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * This file contains definitions from the Hyper-V Hypervisor Top-Level + * Functional Specification (TLFS): + * https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs + * + * Copyright (C) 2021, Microsoft, Inc. + * + * Author : Michael Kelley + */ + +#ifndef _ASM_HYPERV_TLFS_H +#define _ASM_HYPERV_TLFS_H + +#include + +/* + * All data structures defined in the TLFS that are shared between Hyper-V + * and a guest VM use Little Endian byte ordering. This matches the default + * byte ordering of Linux running on ARM64, so no special handling is required. + */ + +/* + * These Hyper-V registers provide information equivalent to the CPUID + * instruction on x86/x64. + */ +#define HV_REGISTER_HYPERVISOR_VERSION 0x00000100 /*CPUID 0x40000002 */ +#define HV_REGISTER_FEATURES 0x00000200 /*CPUID 0x40000003 */ +#define HV_REGISTER_ENLIGHTENMENTS 0x00000201 /*CPUID 0x40000004 */ + +/* + * Group C Features. See the asm-generic version of hyperv-tlfs.h + * for a description of Feature Groups. + */ + +/* Crash MSRs available */ +#define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE BIT(8) + +/* STIMER direct mode is available */ +#define HV_STIMER_DIRECT_MODE_AVAILABLE BIT(13) + +/* + * Synthetic register definitions equivalent to MSRs on x86/x64 + */ +#define HV_REGISTER_CRASH_P0 0x00000210 +#define HV_REGISTER_CRASH_P1 0x00000211 +#define HV_REGISTER_CRASH_P2 0x00000212 +#define HV_REGISTER_CRASH_P3 0x00000213 +#define HV_REGISTER_CRASH_P4 0x00000214 +#define HV_REGISTER_CRASH_CTL 0x00000215 + +#define HV_REGISTER_GUEST_OSID 0x00090002 +#define HV_REGISTER_VP_INDEX 0x00090003 +#define HV_REGISTER_TIME_REF_COUNT 0x00090004 +#define HV_REGISTER_REFERENCE_TSC 0x00090017 + +#define HV_REGISTER_SINT0 0x000A0000 +#define HV_REGISTER_SCONTROL 0x000A0010 +#define HV_REGISTER_SIEFP 0x000A0012 +#define HV_REGISTER_SIMP 0x000A0013 +#define HV_REGISTER_EOM 0x000A0014 + +#define HV_REGISTER_STIMER0_CONFIG 0x000B0000 +#define HV_REGISTER_STIMER0_COUNT 0x000B0001 + +#include + +#endif diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h new file mode 100644 index 0000000..c448704 --- /dev/null +++ b/arch/arm64/include/asm/mshyperv.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * Linux-specific definitions for managing interactions with Microsoft's + * Hyper-V hypervisor. The definitions in this file are specific to + * the ARM64 architecture. See include/asm-generic/mshyperv.h for + * definitions are that architecture independent. + * + * Definitions that are specified in the Hyper-V Top Level Functional + * Spec (TLFS) should not go in this file, but should instead go in + * hyperv-tlfs.h. + * + * Copyright (C) 2021, Microsoft, Inc. + * + * Author : Michael Kelley + */ + +#ifndef _ASM_MSHYPERV_H +#define _ASM_MSHYPERV_H + +#include +#include +#include + +/* + * Declare calls to get and set Hyper-V VP register values on ARM64, which + * requires a hypercall. + */ + +extern void hv_set_vpreg(u32 reg, u64 value); +extern u64 hv_get_vpreg(u32 reg); +extern void hv_get_vpreg_128(u32 reg, struct hv_get_vp_registers_output *result); + +static inline void hv_set_register(unsigned int reg, u64 value) +{ + hv_set_vpreg(reg, value); +} + +static inline u64 hv_get_register(unsigned int reg) +{ + return hv_get_vpreg(reg); +} + +/* SMCCC hypercall parameters */ +#define HV_SMCCC_FUNC_NUMBER 1 +#define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \ + ARM_SMCCC_STD_CALL, \ + ARM_SMCCC_SMC_64, \ + ARM_SMCCC_OWNER_VENDOR_HYP, \ + HV_SMCCC_FUNC_NUMBER) + +#include + +#endif From patchwork Mon Mar 8 19:57:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 396314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EA6C4360C for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE06A64F11 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231601AbhCHT6P (ORCPT ); Mon, 8 Mar 2021 14:58:15 -0500 Received: from mail-eopbgr770104.outbound.protection.outlook.com ([40.107.77.104]:16005 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231426AbhCHT6I (ORCPT ); Mon, 8 Mar 2021 14:58:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MCRG2uirGe7S/gNTEQ0OOd2WFNBPkBgbR1ASPsA28Iq7uFI/1vrI9R5VoNk+8tZGfmbeIhtLLORA2v/zPoKBtQ+oc6s70Mn0OSSykyLp6pVEWabh5Y1r+j80xV/e0K9bwGxJIvb5poIlCXul4AqQ5obfqCqTpCqaeDEmFan1VjnQ5XGN9aXOF6lKU+DopKAzybM7IO0uEfn3giyQnyaQon0Y+w84vbQUpq43OVz+p99pry/E4onFyA12QBp/0Ueb6T7XQy7NNlHhHQ6X8lJnxviqpQs3wEcJPI9z4iFk9vYK+8IvKh+2s8sLvGfkvB9/2efV0MLNbVVurhX5whMQrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCG5xM+5O5U6ElTpsDEpitVcsMEGRiRbkxdc/A2ZuUk=; b=m14ulpM5k/vKgegSbIbE7sH7ItCHwkd7sEg3GRmo1vWlJjUNKm+tb/cY36Nf1s4OAzzXlzH/jOGTHIJCvt8seuFvUWPqdpagqOGjwPyUvHVr8rK01G2Rvt0Hfpqk1sJfifkqW2OLcV71eQccZ1Ztjxp3DGJy6J4gH0CohZi4CiYpvvaxdAIx47uQuC0F47vJyb+3m5fnFuryMM3dRa0+v9OlChon9oIL2mbekPLgcwKNrPEL0ViF4bilXUkpS7LmcNmevHjKQKB3VB+a4nSWYKT+rS7XI497vtIubFzZS0/Cf/qWlkmdYPM9hEcWeT9PYIXJpRvAQmrAWAai974GVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCG5xM+5O5U6ElTpsDEpitVcsMEGRiRbkxdc/A2ZuUk=; b=ZFjHdZqT684+Fi1YAAo+eYaYcJ2U+SX14vL/DoW5B9cTjqR5fqP5Z9SCJXq1KU6rILTpJ+ZK6rqC3FQ9Yuu0H84Wd/YdKsJwPdqfkI+1DiliF4UnquayuhtBVDCVnkDEHIUMOJtzplKb8pITLTq9jY0L/tiS8ZR3BjCwUltYbUU= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:07 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:07 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 3/7] arm64: hyperv: Add Hyper-V clocksource/clockevent support Date: Mon, 8 Mar 2021 11:57:15 -0800 Message-Id: <1615233439-23346-4-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 05a609fc-31ed-44c6-9e7a-08d8e26c7dfb X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4lGttC8fd2g683PJqwJLO986AuQ7hDHgjRnu5l9cOY7RSV3iPZWBUM9hc2NjFmcroGtAE3WzNmu2ZkLen+BgELSzUNi/AxujUG2MzDxv1fR70oTck05RMFrIdr+fbApzmxOljji6Eo3ABApH2iEuOEgWdP2uquDL79qt5ODhvAXF9lYRIbrRLz6xVTnoSMbko92C86rj11md67Y62OwO3get+oCzNwDsLHaoxaPgDdJo8feWEHNJj/aAFRyrDSJ1F7DtKwyDUB/cuPxbnYF9buwwmGz8qv9A4/Gna3+6RivgfzQdureu9lOwQyNzpAYOVLlLHO3sOR5ulmFYCkPg0ovnretrLmRjrEWhjsJ+phSmupfcDEvQWGdoI4tsxkLMmkf5MuJYJiuqEHUzZjAmNu32YKIwzuL6pf1PZCLdbw6gJcAPg++Ru3CrnmI43LCu8wEjt6+6aQ6ImmHcAZuV4TCb1vNnB/f8z3YeDMoxw/6ZT82rvbhfV3+JgSJo9S5HlQcXGGdSEGYFW2lSSlRc9zQ3tKNhvDZX/Ff5CL4LmVRCTGNjnlK9xaRBs4yAlpSF1+WHK5G6j8hy7/GgGDiwMPhus3qvyKmJBA/vQC+awsk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(5660300002)(2906002)(36756003)(8936002)(6666004)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: gFxi+rMkDE6Ra5XqfdIVlsPl+OyA6hYWeDCaXBsyh30HyTo/z8wxNX4XxGUo5tql64OBtdUlKaZarrm3HzUlaVNdsDJiNweqDax+O/09FFGJVW0npBQyAIjXB3UczMAOPKkAyLA/KIsJFfauF1XDG5Mc2cPz+5TqqEt75xM1PY7c8FBj4ZnNYScWhdzC5Il8NNXd9UjHK+XU230QlRgqDRdXHWpV0ckcRJRaOW5LtMJqot3DqmMokTghHFKoIcUxiOoojXmFbtnTot62zFia1Aymtk5BswvzdjJ3bGmdXtGBP+2RWokoFV28Mnh/we/gVFJf51yzbiVda7MLyXEKg/u55dnczxtgqZ570Rg2Ym160ZJWByadpzKvkVq07DULyusyBD3CR9A/drD9hhJepDV2Pigl3s9NhXqp26i5g745DwSUAN3D+e+R79KG7lll/+zG8FNT48aFEQ7RNHDrQ0cFvYku6XdSeZeSVyaZsYW2HJG4qWR83BdVw+nGIbVtZZ1j2fCqGiIep9+ODb8IFfbqEJQ1Zo20Axdb2ckf2nW3rLevAt3ApXmdC8WsFXYpwg8W+0IicZqFZngKMtKuLGQ8d51/pb/FDsu5yrLkhU7NTdF/RCEXRuU0B4slYZ1Nky3ItzQT/1gzsA88eG3Soz6IzuaPyNSrLsxIXaORZk7viDcjKhv4VItOxhLLBseHI1VlAK7qbOn58s/4q13sTte+Z84CpI6ZSDWzyXkwo7nW7M6eOFtyYiMDZI00qyg7x9QIWu+2ERGHVbNbE4WAWqMc1NEqnQpOtdjfSMQDSsY/hPwOAmbvHoFIqx23Na/+qLAx5Qdwmh7YhHhce8T7uRn3IAU0pLVa5HSyvQOKRHYHKWe+5jX8dUwQlX3rzg90oRfJbCf+bkps9xkxrj9Iv3NB/Lhvm3XWcwkK3IArE4TJ9Le7kcdglkV0Bs8tPyj9ahbJqEBrLbj7T1MIvkpnIHAB/GrDMVLeizoe9nIsB1uwted7UiNsdXZTinqTSzYfBkarMXrQZUYkc4ghpWZ2LRvrtuXoCBhH9nj2J3/NEoJG8FHqXBeO94fKpfqgX75dahjK938zxsM8trPpjOxw9VqGUwXCBjKMpmGXVgaz+7p+IB58d/Bs39lVO7juFTFR6X2kx7wsYCJzxym9cfc8BCatlEd5xc6O6/JX3NElq7RmnxdYOs+UMqBrpZx2wLXWDrOCwfBmvCCZM4NvQ5knSnu4trObAsK2QhRo4XD2477s8pfIRzz2vfBYNUZEX6YabQiwmiP2S1NyRPW0jHrc489+lbWZaZXow6D6QIWMEjvM6ibPLLb/CrqSqiyKQQsd X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05a609fc-31ed-44c6-9e7a-08d8e26c7dfb X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:07.2684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IOdVW/kFrWbjQjFde2HICkE+KbUrQdkqG5kEKVRfb1XRbUdFWuwNfytAuZRda8AtCC+0rgn2MVX/F9Pvz6pUcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Add architecture specific definitions and functions needed by the architecture independent Hyper-V clocksource driver. Update the Hyper-V clocksource driver to be initialized on ARM64. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy --- arch/arm64/include/asm/mshyperv.h | 12 ++++++++++++ drivers/clocksource/hyperv_timer.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h index c448704..b17299c 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -21,6 +21,7 @@ #include #include #include +#include /* * Declare calls to get and set Hyper-V VP register values on ARM64, which @@ -41,6 +42,17 @@ static inline u64 hv_get_register(unsigned int reg) return hv_get_vpreg(reg); } +/* Define the interrupt ID used by STIMER0 Direct Mode interrupts. This + * value can't come from ACPI tables because it is needed before the + * Linux ACPI subsystem is initialized. + */ +#define HYPERV_STIMER0_VECTOR 31 + +static inline u64 hv_get_raw_timer(void) +{ + return arch_timer_read_counter(); +} + /* SMCCC hypercall parameters */ #define HV_SMCCC_FUNC_NUMBER 1 #define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \ diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index ba04cb3..044efb1 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -473,3 +473,17 @@ void __init hv_init_clocksource(void) hv_setup_sched_clock(read_hv_sched_clock_msr); } EXPORT_SYMBOL_GPL(hv_init_clocksource); + +/* Initialize everything on ARM64 */ +static int __init hyperv_timer_init(struct acpi_table_header *table) +{ + if (!hv_is_hyperv_initialized()) + return -EINVAL; + + hv_init_clocksource(); + if (hv_stimer_alloc(true)) + return -EINVAL; + + return 0; +} +TIMER_ACPI_DECLARE(hyperv, ACPI_SIG_GTDT, hyperv_timer_init); From patchwork Mon Mar 8 19:57:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 395694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CC5CC43332 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EC6665268 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbhCHT6R (ORCPT ); Mon, 8 Mar 2021 14:58:17 -0500 Received: from mail-dm6nam10on2117.outbound.protection.outlook.com ([40.107.93.117]:24800 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231219AbhCHT6K (ORCPT ); Mon, 8 Mar 2021 14:58:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JCTeN6EIpqlaFXGM4hizM6n2lIaxQg9+JEjLdadlJQFwlhrBnhcqiWkUGmO0RKadLBpeab07HF2fxlk8PRsSAU65LwLqZS4nwUMomICB9MWZ9SXzGw9r6HRqE8mMwbz+k5Dm2s2KAmNnJ2v0RL4hDia0iNnH9xZP8eJOp8BIRMs1dZE3HzPuZSuVYYIRGBEAeisaVKnGRgdNAeZoS632V8vPxSWZ3qMukJZQXLLLmWM+tGi6yvRMgwNKUJZJKmNo/77MWa3ATD3GknOP9NHR4o9VHscrIsV9/W6McJcaAOD0nHy9eu27rFUZOiABmV8o8K8SeNzAjKHk+aycTZatjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NOTRZKeezOSyoE7f1kaPTj/KCAP7M5mHx1IFtayI1FU=; b=IPuU8FULYH7jaLbzF80fITqaI/1HNUFk7pfDhBcQ8IIotNMN7nCGv2/oe5+NkJGLGUygkv4HD75NgZKwp8qBphFKtEa7mLUVPE49qMFJozeVVKeLSxjyrHsoL4V5gzk4sGVaavJOgXAF7lBYn7q+004Cq8aeEICLKCBO605H9tSZKq0/ENg0PlzQr4qLCZpahsTvZt6AgupL9cK8VPt56ZFsQw2+Viqglw37s9zpvoisjlo18KLYfx6iMqmUKhYIJ6Mq/xX+1e1Gy2NsCShK4by5MrhpPZzVW7ydyHiOskMK//S2cYEep9EtwAlrWLdpw8WgIfMMFaNJCzM8fRCe6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NOTRZKeezOSyoE7f1kaPTj/KCAP7M5mHx1IFtayI1FU=; b=XdgC2gnAb3ZDNE9LibTXLhFcnCPWOlOR86bBrKMIZpm99LPUKkzt2CVeASvuZwkrc5NajWk11ZxcRr7GOULah39IOTNcKGkGV9bqLAiOmVvtAliPt2Czlsa6OiYG9Zf+1JAF7P6mnbMXfTMbCwCFSiblfvblFN99WseXCadsMkk= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:08 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:08 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 4/7] arm64: hyperv: Add kexec and panic handlers Date: Mon, 8 Mar 2021 11:57:16 -0800 Message-Id: <1615233439-23346-5-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d411b56c-53e9-482d-776f-08d8e26c7ea5 X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 36qZscnykHtJamseO5x3ony9vRO700KO5cNyXbC74eBgstO9pcd9iJLGK/D0gh8/Pi7PxiAurCpmsDtNP6HqfkYrOq6eh6rl6Jv0c3pP2Bn/OV/U5U6RjSQgE6exZODQdYgzBH8/IrKZQ5gRLrVrwHX2TPPJLywsfxSddWfb3XZD6xouOrpYC5HbK+Xu1AueJBw+6+H5zW0pt9uA7W9HxJfKWURfZoACVW/zXk6JIBhAHvYGKEyhGBM0HndJi7hNLnjvSyJFQU/eRpKUDcxyWKhYKMGTeXwEPlw5fvHieglZBe9s4whXilqWNXwCrrPAMSMjGoOBWa0Sld4yO0ONgEsCs7C1OVP7VqzPTvgm5klTAfXxKRt12TP2Lq8miHFhLL289HqTT5euSr1iQOoRNoTEOC9xlocoyC0n+I+YHzk99GmHH1jTvmNaUF53wv3+gmwsoa4/iZHZH4SMCseHi5yEtqUC1ohZMz5pDHbqaVw+4aJILhvvxCzdVdqazdrZZpt7bmlg3lB+32+X3XZFUHADWyGam80MaNk3Pyt9AFbKhDxAQ0pHgv42kxjqCEiUGFWA7+zUqGdU7kUwYOpzz5k5R223bVukZ4c7QZlueLA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(5660300002)(2906002)(36756003)(8936002)(6666004)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: fVgdin+l5WTBLyWWvRs8DVdo1ELueacbbSzb0j4rx8GXSFMd5hWGhpkNGuMnP3h8t3hUghr5nbQQYPhXN5x9fEvCPv9neLjj/qtkqCNuvHWQSHG4NZtvZ5BBU8mGhWAzwv2uH+4rt0Qrj3mosywim80rbVL99xlqsMiu0Abc50aMm0poRbn4ahfrwCixk7Hl8zFnjaGF6dIK9MFIAIomBo/1udKoseyX1+sYD+jFLwNLLLgkjI0sgpIuYlGCUK3V5+vG3cn/6O0z3D44//RMg0h71AhYvyPioU3vqdIAJSm+L84sfV1O5yQCmfQbop27MF3eQAjmiiG9ocCpZ5V3+0Q6SjX9jZs+du5TVkVzkJEGs+sNGfh/s4U2yTQO9jF0u6qtrAf3par9z6WpgZ1bdKhklUmqxGuuUGKPTlHHZS3UeLyB2p84zvVei/tvEGYC1iwF01e/IFjJPgA2U0xtpEXU2sGhCKSfkf9lc2gZfkKDNPxnRdzpwa7CRu13DHuksVRXl/Z5R63XKlRPsHIx5chQIAxBZuVrAERyHk+CaFqnl86mNO/anaRJshrHXQd91grVjRYCGoZojKkdw1ov2lCiOHxz67x3A+CxSAb3C7z3U7s/hFSAV6YT85uTjN+0B1qLMU7YvfXFXK2MjkmDvjoA2+FmZAR8kjAqJtXA3JRj4u76SV7W1GBYNwktRlbb+N4Oa93ZGIqPb7GU8szkocXMhXpsZIN/bYeJ2YV5vqwRfsob2uPs0Hpw+3EAffBZaBM66yPVlTvTU58IBBD446Fvmsj626Ft6n7Rqc0gl8Um/73F3d8knja7gJseONYOIdcFPIlYkmbMgKPUHQzeEZpaPhRyj7+Gf+5AdGKtAoq4FLLURa3tocu2BtxEaaUYBz+QjI820x9Xuqmxm2RoghS3K4BgFNmURHDfSmo/SzzpDkLKEFH1reeSeDbYqIXESY96gNJqUYhAIvO9U95+5Uo1KowKKJvwIjASIEwj6gKbaqwvqlLMdmVt5v4Xh4Qr8uUgW28HK2S/T3NXoitx17Nw2Zc5P1OkD+/Colx1QflIEps2FazIQ8MGfueDpMTxsGW1/zh/M6hRDWGS2F9xBpIqDgWZGSCK5X9MxVoCMSKMkQsshNw7n0BKipqa4wOj7SoKZrUx23dSKwOjLkYzyVd0lSbPyef/la4DXAPslT2pn2cC908pM/BKQnzeVZ0+sGwXQ8VuLQVyVq80LxFmVR4WSnLr6zAz9dAekK9yWWMSTbAoQDZkekE2XOuwyoHoFn8LkSFp7gJnVctoe8fnfcwIe6mgtFLUjKT0JUrqH9lL5amhaxhV62wZZoqQNzj4 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d411b56c-53e9-482d-776f-08d8e26c7ea5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:08.3626 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BPeumcPW86sIb9r5ykrGXCX2wvkVuhGk3cfBoS8N2eHAsLIuXFOmeULClOydHdGUV0BVUbuHAJ3wxZtdmYSF6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Add function to inform Hyper-V about a guest panic. Also add functions to set up and remove kexec and panic handlers, which are currently unused on ARM64 but are called from architecture independent code in the VMbus driver. This code is built only when CONFIG_HYPERV is enabled. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy --- arch/arm64/hyperv/Makefile | 2 +- arch/arm64/hyperv/hv_core.c | 52 ++++++++++++++++++++++++++++++++++++++++++ arch/arm64/hyperv/mshyperv.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/hyperv/mshyperv.c diff --git a/arch/arm64/hyperv/Makefile b/arch/arm64/hyperv/Makefile index 1697d30..87c31c0 100644 --- a/arch/arm64/hyperv/Makefile +++ b/arch/arm64/hyperv/Makefile @@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y := hv_core.o +obj-y := hv_core.o mshyperv.o diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c index d5a8a6e..fdcd69f 100644 --- a/arch/arm64/hyperv/hv_core.c +++ b/arch/arm64/hyperv/hv_core.c @@ -124,3 +124,55 @@ u64 hv_get_vpreg(u32 msr) return output.as64.low; } EXPORT_SYMBOL_GPL(hv_get_vpreg); + +/* + * hyperv_report_panic - report a panic to Hyper-V. This function uses + * the older version of the Hyper-V interface that admittedly doesn't + * pass enough information to be useful beyond just recording the + * occurrence of a panic. The parallel hv_kmsg_dump() uses the + * new interface that allows reporting 4 Kbytes of data, which is much + * more useful. Hyper-V on ARM64 always supports the newer interface, but + * we retain support for the older version because the sysadmin is allowed + * to disable the newer version via sysctl in case of information security + * concerns about the more verbose version. + */ +void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die) +{ + static bool panic_reported; + u64 guest_id; + + /* Don't report a panic to Hyper-V if we're not going to panic */ + if (in_die && !panic_on_oops) + return; + + /* + * We prefer to report panic on 'die' chain as we have proper + * registers to report, but if we miss it (e.g. on BUG()) we need + * to report it on 'panic'. + * + * Calling code in the 'die' and 'panic' paths ensures that only + * one CPU is running this code, so no atomicity is needed. + */ + if (panic_reported) + return; + panic_reported = true; + + guest_id = hv_get_vpreg(HV_REGISTER_GUEST_OSID); + + /* + * Hyper-V provides the ability to store only 5 values. + * Pick the passed in error value, the guest_id, and the PC. + * The first two general registers are added arbitrarily. + */ + hv_set_vpreg(HV_REGISTER_CRASH_P0, err); + hv_set_vpreg(HV_REGISTER_CRASH_P1, guest_id); + hv_set_vpreg(HV_REGISTER_CRASH_P2, regs->pc); + hv_set_vpreg(HV_REGISTER_CRASH_P3, regs->regs[0]); + hv_set_vpreg(HV_REGISTER_CRASH_P4, regs->regs[1]); + + /* + * Let Hyper-V know there is crash data available + */ + hv_set_vpreg(HV_REGISTER_CRASH_CTL, HV_CRASH_CTL_CRASH_NOTIFY); +} +EXPORT_SYMBOL_GPL(hyperv_report_panic); diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c new file mode 100644 index 0000000..d202b4c --- /dev/null +++ b/arch/arm64/hyperv/mshyperv.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Core routines for interacting with Microsoft's Hyper-V hypervisor. + * Includes hypervisor initialization, and handling of crashes and + * kexecs through a set of static "handler" variables set by the + * architecture independent VMbus driver. + * + * Copyright (C) 2021, Microsoft, Inc. + * + * Author : Michael Kelley + */ + +#include +#include +#include + +/* + * The VMbus handler functions are no-ops on ARM64 because + * VMbus interrupts are handled as percpu IRQs. + */ +void hv_setup_vmbus_handler(void (*handler)(void)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_vmbus_handler); + +void hv_remove_vmbus_handler(void) +{ +} +EXPORT_SYMBOL_GPL(hv_remove_vmbus_handler); + +/* + * The kexec and crash handler functions are + * currently no-ops on ARM64. + */ +void hv_setup_kexec_handler(void (*handler)(void)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_kexec_handler); + +void hv_remove_kexec_handler(void) +{ +} +EXPORT_SYMBOL_GPL(hv_remove_kexec_handler); + +void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_crash_handler); + +void hv_remove_crash_handler(void) +{ +} +EXPORT_SYMBOL_GPL(hv_remove_crash_handler); From patchwork Mon Mar 8 19:57:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 396316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CD50C43603 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88DB065290 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231683AbhCHT6R (ORCPT ); Mon, 8 Mar 2021 14:58:17 -0500 Received: from mail-dm6nam10on2100.outbound.protection.outlook.com ([40.107.93.100]:11264 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231464AbhCHT6L (ORCPT ); Mon, 8 Mar 2021 14:58:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGWKSf3lhmDMhmmQTEpTrT4t33r+P/Zy0zWlb30EflDDrBVqsye2Oao7uMUsLXV0FQF2ruigBO8pmcLwmYPINgvtGZQNzDOIpEbi7daa8c+BffHyXz3+cpqRKQYVX0YA9pf6TJ66Grb5R4YtTQ2jH0aKMIElIAvbwKLKCrJNSsq43Gc6ud782mXssMISimYa+idApFSsr8gFFFUhVYHlF1fPTX/Dk35pYx+vLhO6HjiP6yRXmJ82XeMljH/wko0nPVaStJTLZ69r1dP8ycjOk89nN3KCqROCbKILTj9nQo2aUu+PnSd0HKT3vUil2sMaZsISN3wirpxpcW3GjN3uYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MZsD270131MXJLcltQca+mvW6iQTGDJWJ9XrTuht4A=; b=coXqrLLIxeRupwjUG+e5v3Myuh0c3lkzfFIR3zd5cLlSeof79LWnhriFwSrIIT+9Jz3PWKDUfACQLdZI5v01oVadwnn4NTmW9psdSBXo8Anqe1hl8HvIIuD2Sy6C/buS1CXMIsYcRcCsxAidKZCetOoPd71tDnUzi5MRNtGZhmhhMiUi2eaieDrYEAkd77lOX+SdMcNUvStc34MidwsOdlWqQRLiTDFxV+6l6mLf8LjocAyD4lihphgBnJkMElfkGgx7tUBKHkrJ0mntBRDkxfkLZ9AYOUMc+GHwHQ4ij8JoxZi0sMj2TwZYQsag9OBI9LH8ERTysepkeE6cRoKh3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MZsD270131MXJLcltQca+mvW6iQTGDJWJ9XrTuht4A=; b=JNkY3NfKfpgIrmUNrzy/uURYFAfyfenGiSDcqgbddq2I5n2+Mmab0GoBovkRSaF/lFVYCp0MymwWcJJ5bzXQD/Aacn2gjbm02i5rSioOx7uAqGg2ky5Pq0s5L69+xi9+AmQUfVv37qzTiKkvOjWZ5qmPhUC13yJPS/He90ghk3k= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:09 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:09 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 5/7] arm64: hyperv: Initialize hypervisor on boot Date: Mon, 8 Mar 2021 11:57:17 -0800 Message-Id: <1615233439-23346-6-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c538f858-612d-4c08-ff29-08d8e26c7f49 X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1332; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DUJA3smbWnWW9+jJydbopFkqTKqPa7hJ5JTwywfD5PRsXvKjoi83Rkit3Px0WTCsN5pjkKZFZmVZvB2KlqeICZxidDiTPMwhMennb6li5D1aOpyEuEjOGLOYry8J7Wiaf1rsAfmgtRULiI+tRYgcbS1YBB3IzdKOHudRfvF/0u8sCdzYpudqNWzwFsrJaQiYMaKo8bhXusduOQpHTgL0sXwnzrECl0U4XtwMA85x6yxlE9oaummDL6mzVVLrF+6sw3cF69ZWltxdMYYl5iHCDltOqsowTBtiSZIPY3Faa46l4ffPOX0tnw6i32bCZtSEEl/K3RC/BMHxcm6AKPwhaqf9ZI3Kj1RY7TZwSe91kH4/1ysAc8qZOEMGBiCTtJSRBmjBibHIifdu52uFu8sVJfyCcw+QgtKpfV16z5pOFTPHLueicVLih5Cc9uZ4mPyoUVrks0Xd4UOJ4sfQFCdeo9jG/Lx7cfkk6Ta2LuXuFBPn4AOXetYhA+FHNCwXJx+WxkQ+jifF1oCsN0UA1zkEPFRl+1LzygFgsJxXT4QHILMh8R95lgQVeWZTmAG2JH6am9/6ZyrJUdU9M9ClC6QOR7lejlr/UVfJYikl1uvUg98= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(5660300002)(2906002)(36756003)(8936002)(6666004)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 2zTmMK6VjIZi8I2pX1DGz2X3JLhI5CJ3TJ1f5m3DQFWroIXhRlwK7zc/q9YC/CiytX9Pfif/uBpokTpXIskO14nYF+aeESGQFfocEIVOrkxX8UHkV14rEVm/xd6Gogse/ekUuTW33lSTwEeAc24+0Kf8q4DlNXLMxvq/SOFS1sOZ6eipd870ni4sCvyZf8GT7RT3i2qKT5Iqd5MIBS23Rrv+R7ajRb+MbNFUNXXG9xGXwWSJV6sVP7CyHFr2y0iaJs6+wDYIcPLHsPq8QeoDgSmvhCedHZ51pvIT9GgXjhaO2CHaucbJ+QQRj+I1ozhoW60zRIBde8wPUNraf+lmcmHlFIYTJX51jwTrOG7I40B+vmR36ch8LHi9n+EEL/w1jilKBMd/y5V5Vg0ebBxA6YlxjSCBXIwE7Jae2spq/9ziTw266bL437cKmuR0syvziX4DpLvgMQQODbBUbuhUwtko3Tt/8RpqF0irUS1lMFsh5Sv5/AKQA9TYBv2IH2TrJKe+E8UeGMAv+doLi0FOMEar5ixdlt5KdrinOLqB3dGtUuMFQOaQ/9WJeOUZgkZvBlIMmlNAXsh5d7AmLgbnYJM9apQXxcMkGPVzaz9r4oyiSNtfqctU9K6Vt2bEatykuLz3js9d2P+k/i9VfriC6oXdyxUQtMVoRtAZ2QllRxjDzynH4peXCxLq3vBxo6Qd/Ol7TMzPyzb2tWDZZ2YVtgjcPXiYCZrQx5ha7b3i/NWWl+SxrKdqocq/5sTItYaLy/4i1Ovlt+2uAan50GuKGpGvxbQW+wfCNEBfDTFz6dU+peajXaBKbLktBd7rVJ39T86JvWXEKXxyQMYSPqJ35I9PyzMOOXsetY/TK46L1e8XLYkOUID5NWdbqXbGX/TlRk1qCqr+ooov6d3qxrP6kCA960NavBFTn0A7tpXJmAK4Njjg+WGLkhNT5d/iG2eAWV+8Af7ZG8rypomDLuwRRKBEzBJO2yJ6Ar3dqXZfmMBlDfGV8i6pUI10Bq+2at9g2kK5Awya8NDMqWc2GMWjxXELQRUj7KINN1SKEXdKc0GawGH+h4AfqoXRd5xhdCwFdBWBdys56JExsVBhGRhtGRZkbQ0BxrjhAuALmf0qHs/ES4QgeJvJidKSCyLbhdwCbT5XXD6lHgS6zLNsCiYO9usVIhvgs36Rk5SPNGWeTTb0/tXWG+bfLQ4Tq6xv9dF7lQAdvc6yL4CR/kbeO2KHu1ciQ7/49CIlipzdNp/FTpe1ftsmBcAljIOL+8a0fnInYeHOl0pXJ0/pz60DrHjfVdBvgLWDQWO+XsUDKDxUM4vkKld5l2xjZRMFZ3+fVXjJ X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c538f858-612d-4c08-ff29-08d8e26c7f49 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:09.4021 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W5vo5rAmKKUAbw8XmtP6y77IaJGzu8pig3xkKPkoFrHKltmAng0nS9EauGl1FHfv+tPfFiUcfW7jex94hx9D0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Add ARM64-specific code to initialize the Hyper-V hypervisor when booting as a guest VM. Provide functions and data structures indicating hypervisor status that are needed by VMbus driver. This code is built only when CONFIG_HYPERV is enabled. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy --- arch/arm64/hyperv/mshyperv.c | 119 ++++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/mshyperv.h | 6 ++ arch/arm64/kernel/setup.c | 4 ++ 3 files changed, 129 insertions(+) diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c index d202b4c..125e83e 100644 --- a/arch/arm64/hyperv/mshyperv.c +++ b/arch/arm64/hyperv/mshyperv.c @@ -14,6 +14,125 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include + +static bool hyperv_initialized; +struct ms_hyperv_info ms_hyperv __ro_after_init; +EXPORT_SYMBOL_GPL(ms_hyperv); + +u32 *hv_vp_index; +EXPORT_SYMBOL_GPL(hv_vp_index); + +u32 hv_max_vp_index; +EXPORT_SYMBOL_GPL(hv_max_vp_index); + +static int hv_cpu_init(unsigned int cpu) +{ + hv_vp_index[cpu] = hv_get_vpreg(HV_REGISTER_VP_INDEX); + return 0; +} + +void __init hyperv_early_init(void) +{ + struct hv_get_vp_registers_output result; + u32 a, b, c, d; + u64 guest_id; + + /* + * If we're in a VM on Hyper-V, the ACPI hypervisor_id field will + * have the string "MsHyperV". + */ + if (strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8)) + return; + + /* Setup the guest ID */ + guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0); + hv_set_vpreg(HV_REGISTER_GUEST_OSID, guest_id); + + /* Get the features and hints from Hyper-V */ + hv_get_vpreg_128(HV_REGISTER_FEATURES, &result); + ms_hyperv.features = result.as32.a; + ms_hyperv.misc_features = result.as32.c; + + hv_get_vpreg_128(HV_REGISTER_ENLIGHTENMENTS, &result); + ms_hyperv.hints = result.as32.a; + + pr_info("Hyper-V: Features 0x%x, hints 0x%x, misc 0x%x\n", + ms_hyperv.features, ms_hyperv.hints, ms_hyperv.misc_features); + + /* + * If Hyper-V has crash notifications, set crash_kexec_post_notifiers + * so that we will report the panic to Hyper-V before running kdump. + */ + if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) + crash_kexec_post_notifiers = true; + + /* Get information about the Hyper-V host version */ + hv_get_vpreg_128(HV_REGISTER_HYPERVISOR_VERSION, &result); + a = result.as32.a; + b = result.as32.b; + c = result.as32.c; + d = result.as32.d; + pr_info("Hyper-V: Host Build %d.%d.%d.%d-%d-%d\n", + b >> 16, b & 0xFFFF, a, d & 0xFFFFFF, c, d >> 24); + + hyperv_initialized = true; +} + +static int __init hyperv_init(void) +{ + int i; + + /* Allocate and initialize percpu VP index array */ + hv_max_vp_index = num_possible_cpus(); + hv_vp_index = kmalloc_array(hv_max_vp_index, sizeof(*hv_vp_index), + GFP_KERNEL); + if (!hv_vp_index) { + hv_max_vp_index = 0; + return -ENOMEM; + } + + for (i = 0; i < hv_max_vp_index; i++) + hv_vp_index[i] = VP_INVAL; + + if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "arm64/hyperv_init:online", + hv_cpu_init, NULL) < 0) { + hv_max_vp_index = 0; + kfree(hv_vp_index); + hv_vp_index = NULL; + return -EINVAL; + } + + return 0; +} + +early_initcall(hyperv_init); + +/* This routine is called before kexec/kdump. It does required cleanup. */ +void hyperv_cleanup(void) +{ + hv_set_vpreg(HV_REGISTER_GUEST_OSID, 0); + +} +EXPORT_SYMBOL_GPL(hyperv_cleanup); + +bool hv_is_hyperv_initialized(void) +{ + return hyperv_initialized; +} +EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized); + +bool hv_is_hibernation_supported(void) +{ + return false; +} +EXPORT_SYMBOL_GPL(hv_is_hibernation_supported); /* * The VMbus handler functions are no-ops on ARM64 because diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h index b17299c..86ca5c5 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -23,6 +23,12 @@ #include #include +#if IS_ENABLED(CONFIG_HYPERV) +void __init hyperv_early_init(void); +#else +static inline void hyperv_early_init(void) {}; +#endif + /* * Declare calls to get and set Hyper-V VP register values on ARM64, which * requires a hypercall. diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index c18aacd..1df8285 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -49,6 +49,7 @@ #include #include #include +#include #include static int num_standard_resources; @@ -340,6 +341,9 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) if (acpi_disabled) unflatten_device_tree(); + /* Do after acpi_boot_table_init() so local FADT is available */ + hyperv_early_init(); + bootmem_init(); kasan_init(); From patchwork Mon Mar 8 19:57:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 395693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A2FFC43333 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7859964F11 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbhCHT6S (ORCPT ); Mon, 8 Mar 2021 14:58:18 -0500 Received: from mail-eopbgr770137.outbound.protection.outlook.com ([40.107.77.137]:37480 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231472AbhCHT6M (ORCPT ); Mon, 8 Mar 2021 14:58:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aP5qCxLMoJCvvsz+X8WVsjs4+W61jHtYGLmOeWhJ1xZcWZdT5y/oe7hkewUhJOba8GkxiIsKxMOBDVk3tjzOGwUsffDaUPHQpmiLqD7RwrPKmR8nX/H0Q9lUhE3LsRkgK5dLaDlTNBhtcuXtuhcluYwTPBCcNqS7eWJ0FflEpNpPvuilPsQod5HdlJsH/olM+skbrwu7RpvlyNkcztSP/zruWg+ym3+p05mGEcZZ6GXDi6CvP9LqIwfXlbfI3pGn+KTz2mnQDLN0v/e0QBlnzqs4uxi2E4mgwpd0kynA3/47r81GUYbiLHpRrY4Tn+T16/LMitqWinPy3KK2U32jpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pSKE7KsZhel89WAklbG+zH0DgO9IbVC7ODkZQ2KYEmI=; b=mbNo0bh70ct/X1jebPRgWQAerx8Z7nv8ZmqOJ8g9tyi4zhVMSzxPbt5O7tUKMDlX1QlEu4Mzkw55VQjAfsScV0ExejX6+9BRHcn8PEKsBPkCh//RGip4GyjF7VJMRb8WSR4TjAoXScWwpsWaIRRms+LZwN6PqiYOHuxjk6iBBt7EcX+G3jFX724Gt85d0aiADLuALN+u7eKowN0CnLHpnr9q7zU+0uMsDjBPZC8E4CZCw9T9MHWJIQZRM5rYRQbtClZMbDx2UQ4Cso53DNe80BLeilv7vTydKu5WP65IzSrAF+8fm3wkG9Yw0resHUJWS2DeKq5fwCYjgBGtrXx2qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pSKE7KsZhel89WAklbG+zH0DgO9IbVC7ODkZQ2KYEmI=; b=j42D40XGvM0coX6wm2DnomZfXC1uZ6pYwJCIF5Yz5kiRXx8JWb2gXw84N8HdtVPj5JpSUT0RQWCsz2sbhSKPM0co/gxYrhhFbtRSB0La/0v7SRW9uAIQGZ/SdQLRDh89UU6DT0k5/J3LmGrOGRiTX5e+YiKVHqq2frohI9hH5fo= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:10 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:10 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 6/7] arm64: efi: Export screen_info Date: Mon, 8 Mar 2021 11:57:18 -0800 Message-Id: <1615233439-23346-7-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d05628d3-caec-40be-153b-08d8e26c7fe7 X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d5kaJbesTgMkCnUuTWOiZ9+ajUReswBBEEvBxqo5ZmHndqWg663/ADF2/g72bAzqHUjaaLjJUM8XXsgTxsreo24EhYuVGiSJzG7g5qRBQWT8q+z0VrZ5LamFTho+fJ9rwRHefTO4XhiiEusSUen5NVt3hz7Fs5anq8K86NAo59I+zIRFeyUFQaT2zR9/BYij3NiMe8uaINsoPOacRtRiFpYS0D+lLefz+md01iABMZEMSbpne/UMY1prot8zjlgMHrT8NOoOOMpSI7qjgi5IJ2+/3B/g2vBoIvhVAsf/rEt25jQ9qQvDq2fHLBOqVQWHUkj9apQC1SfLDAr71ojQPtl1AjmiATFsu7MQjfWvbOfrUeO5PFgQa4jCF+lcyekcRrM01SebanR98v1MU5sM2bvzq+NKaxyzj2cMJKQWem4/ulvsxn7NPTZUJjUuTii41DYhI8T9ZqWqxM2wIKBlPRQfT+TxPPqmrCPGyrSiKK9rHRXhjoF4mn1qBvxxN15JLL65zvRQW4pUV+T3j45x5UHG+9wEamnT2vcRJ821JPTH8n3vhKpH+zjXuSd22taRvQZTYt4JZGF51XopxUe2JjqAT9PJRbjU3ddKR60Du78= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(4744005)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(5660300002)(2906002)(36756003)(8936002)(6666004)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: DpPsTYMHyMN8hjk7E1mR7utdclQLg63eRE7D4jrMMvYUd2OnwCfoIqHEOAUhm/K0rRQgieVimBRShHuFLy4lTpSC8DSCk7HwOiyCUuoniWanhiVM4TeMVkAZFttHJbdDUd+T4ahmGridqaKdGYo2oodjNxQd1+yni6HrNh7NeJW7lAy8q7KH45wcB976dUPcB2DC49G4v58EarV7J2xMcE9o4L9ddWI8HDPNHoGTiDVAtDKJf7L88MF6xgk70LSqTFyrOUQ+2A9RLX0r9QGVDX3XuIo5wwVABVs6jRazAjazrHynjencfubS5/tQigvx7/MKkBWySBS/R1d59vntkIuSw6eHsGOCm3TDbs1pxHmbwRFczX8O2f488uIJ/b2ZZKoDa/7f3+nVvEdNQRwUJLNno7a+X/YjLa4Cnc37cdwhqV7EeBvPsFKMC4fgKfHPoHkHgDYJ441BkKdegAr19lVGIRicW5QECkYj5SBI/41tAM9TbemrFClXK5nyANLMe1cOtP/ue0j2xisNSmRZry/2af9qYyEWpDKXfqRDUdJa79KBt7d9IbbhxNOR4HXqJmQg8zbwXm7hvbB2U/LERErxU9zot3NBY1GBGArdhBMp7U5WBqkZaR3GOAcrIJxEXtRPsJqu2fXWz2hNjRd58KsQb2q3gA8eRzObOLYPzEwXK/2PfjXqrlt8W99bIqRscnuRXkIjenrSNNLJPteLVeWhTa1ImckQ+CcpdzqSyTt4+cHROu3Z/RkGmuzfmbQqbqr4C3qtLM9XB6CbVskd3Sw4lv+eMvxxU5ADzrtlL3sMW6oKew3puSrug8vJ5bFp/D5K1BBu+NSecB7CSn0RgpXDBm+UAuqDYXdmgWVmhPazdXUwQlx0Jq53r85pVyUVWv1rHMVnXnMbOpGbRE5K0qqlkZh3ly5wByyYnwez8OBJ+85O3WpG4nBrXCn7lAIh53Nzn5AzH3p8PVoqgA55sgFfOo5BUS34SwiOvBFZJj9fvo/UOEqPcNR4lYReIbhUDSq5ZvgdEI0BKjhYaLKhV2BYJDRzyVYjJl2AsH19vg9YwWYxcVEW9GpNl3YtIWYKnQ356z99axan6d+cJzMtPTbPNdWvY/f0Me5Up+CDgwLOo+R6tRO1ZaRRhdFfQpUXLu5h21vyUISf5Lj9rBv8y6yPfNHbndkCdl0tdlnK5Q0+sUx+A/Iw/Clm3IEpGlDc8jJASW5DeTgAcNDAuWDinHLTiOxeJtbdBZsXP2kE/eZ4peOYA5D9hd1MDKOpt0Z/AGiIXXetLn9Dlm3i4aRlpPq6q9z2jne6tg6imKYssPoO99SPcdqLHixLIGHGsIvH X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d05628d3-caec-40be-153b-08d8e26c7fe7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:10.4684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qYHlpoEJy0gr1VRgF9OZkLENPyaoRxpoXtlGX4mGfvvQ8DaDCHaYIU6YfWyBHPxYMWawrwbHo+8jankXOr/hVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The Hyper-V frame buffer driver may be built as a module, and it needs access to screen_info. So export screen_info. Signed-off-by: Michael Kelley Acked-by: Ard Biesheuvel --- arch/arm64/kernel/efi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index fa02efb..e1be6c4 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -55,6 +55,7 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md) /* we will fill this structure from the stub, so don't put it in .bss */ struct screen_info screen_info __section(".data"); +EXPORT_SYMBOL(screen_info); int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) { From patchwork Mon Mar 8 19:57:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 395692 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A48C43619 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE37365260 for ; Mon, 8 Mar 2021 19:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231709AbhCHT6S (ORCPT ); Mon, 8 Mar 2021 14:58:18 -0500 Received: from mail-bn8nam12on2092.outbound.protection.outlook.com ([40.107.237.92]:46817 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231486AbhCHT6N (ORCPT ); Mon, 8 Mar 2021 14:58:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C368pA6WkRSVkEFU2OflGPf72IjljJSPmZd8blNjIUiCuQEA62/8VQDmIAaXz0Ltc4a/Renvm0YfptgipXmVLY79qM82UDbeSA7LuB5ljY3TXwPElUZGzTprYPBkzYLGgsn3kLQia+XendeQQqguWjWabr/SbS2JFkDkIBEmX2zcyczzzGKG8evcgqSOUKr3ZmreQTPqvoXPd/ASDaEPoIOQ3At37a/BmI2+mXgo1+utaCyf+VeLEOwjLtzJBMoZNWjRmMYMoosg71eWsJsEf4BmqhovoYmGIx+heQNPHZzXmqUvr34FPx7cIYKQRD/USPqmukwpMqBkWshT4IfoNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HOt6quckwKZHyyyERwRobYF7Kwt1TbHjEmKP8+rLMm4=; b=AwYH46UKaSavWm2YboRcrApczw3m0NozPvV85vpjC5+K2sTGydLhZ+jMmizWa3KMfC8ja/kB1DSsmcWhu0y+ztPwT7z1qPaEm7CS1h/j/oAPjG5vSQOJFl5HomZ9xSgFhyLCxpgylcXGBjmXqI2ay51fSTF0JXF3AiBGNoBbyaRxxr7yPyeUp9UmlfCHV1jUIzqCcx++gYKQIXTdTf5TZhGhHePBpW14ae77zNrRemF5YLFFUbthiuWs+jF5rRlcMu9dKSpUI7idRCag1J740oDekcHQO2iVp/kNVoUqndTD/Mp120DbTb3yROdQPAyhAZ+TccLO77JPNmBpWFkBJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HOt6quckwKZHyyyERwRobYF7Kwt1TbHjEmKP8+rLMm4=; b=JfrTHniY4e4a8Yf7U+4cXhW77TtZLkib8qIcuPg06kZgCIOHDgSPHWgl79bMaOBlGV0d9Cmq1QuMs7CVjFJpO4OqxS8r+VFYQsG7c80sP0C3DN4EY6q08ED/GZRKbaeQdn9iaJH+ust8PZReSMjuYIFfa2Z5lZzKnZfBuR+WCFI= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR21MB1797.namprd21.prod.outlook.com (2603:10b6:4:aa::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.4; Mon, 8 Mar 2021 19:58:11 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::1c32:e52a:6a36:3ff%4]) with mapi id 15.20.3933.025; Mon, 8 Mar 2021 19:58:11 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v9 7/7] Drivers: hv: Enable Hyper-V code to be built on ARM64 Date: Mon, 8 Mar 2021 11:57:19 -0800 Message-Id: <1615233439-23346-8-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> References: <1615233439-23346-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.174.144] X-ClientProxiedBy: MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.174.144) by MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 19:58:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 449ccb24-94ee-47af-65e2-08d8e26c808a X-MS-TrafficTypeDiagnostic: DM5PR21MB1797: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:466; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XVi6PpRcbTykATeQuHoKvRrd5r+uGtGuPEJRi+nV9DAnbS7BJo1+kDscMz1w/VepfK80KTpJIeUYc1bYF1oL3HDOWK9rDekNJun6eGg1+WoFqPjD0+Ys2p4Hk7AP4XDWsq1uiFkdl3Ty3FtNvsB3pb24hEOn0YeGrWKOHx/bLXUI5Z0VPvKw0eoB7Gt+fcaAYf37O7mP+/B0R0gJWywNqxHK4/ft7XUXb0RCGmXzrYbHwP7IJBe8PZFJ0kSOQFdpWdW/Klk45+gws2HrjwoPR7zS9CDTRq7NCqxoz4e0yZgLwSDq8i1kQZrs7TJqiai5BiygQa13tpy3jxwWUnY/Ji6RLa+FeL4IW5UZzSSwa9KuW3X6EvemZAxbu09e9lkJfliIDBaUJjc6ASwPgcwxC51GQsrcZuC0otiXQ2aUiiEs+GWVZ5aEgyDO9mSbFEumCotZTwxtUKlih6HuMoNJQZ/rFGUUhVXgXt7y+boQBb0K/XYhMTcyQB4FkeZw7trmowpvtfSSv7cUrqka+tcTIsxXi0baNqkJBcI2Gg8lUn7wjBdLmY85lvoXY7BaR8DIpa+0nLKlhULeQMJIJIck58ogdOvoETeVlR6uz2dJgaw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(366004)(4744005)(66556008)(186003)(52116002)(66476007)(66946007)(10290500003)(478600001)(26005)(16526019)(5660300002)(2906002)(36756003)(8936002)(316002)(7696005)(8676002)(6486002)(2616005)(82960400001)(4326008)(6636002)(107886003)(82950400001)(7416002)(921005)(956004)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: w5OJP256vXShaPfDTF94Z4+EUqFwdsNOWIi1qhY053LDQjRcyxAbVTcA5ttUCp9e/G9/zYsLQsNJ47x5IckaL+gV/8Z0tHlV0hXRBk0wWJb3v7gFvRq9TRR99iBrtpBP/SRaZnEyfxykukP5SphzNDx2itZ0Hcp4O4pgkoomx2Zw5r5zDnGljiQrvdXIbwE1VzKB6LdDmQeoGm5BaFSM4m5R4+ULjwSxY+fAMtbPqZZEMk5MmYeS71n99cfq4XkxZKvnr0Tiu50ENvPWsV4QUIIGUgKA3QrvsGd2I8+294NNlCVMKsVkJKTzEDhlwJ2/RpkBJsDxlgov/WNShbM5qJbHAeUW0t7x951Ic0FCa5Hd+/Gnh8nfgEDwEjZON5DDGSz33N9S8Hso3ng46TnSjAlanEuTk2HT+sbqxl/S+J/efc4ciYlbieef58kHaDQz1XUn7uFLwpgqv+BaOU1woR6/9MzNsfBixHS3UCqFuwm3aTBRBXuwxVTIzkmD+B9J1s15a17GZRU2MT/FoGr7YQFMG1oXQDLA2B69qX6vLrNOIX3L5fHBR6dn4WxLxuFEm/qDB5NKNqk/UBFbtP9Fk/f2Ja3ZYGwxhZDOEMUKKbGHLrs74NQb4zv++Lfqi96G/Jdh8utHhtaKsX8bwTQTTMk69h6Ou2V8gtaJsls5cD58RH6JCsnLwIdvUOBFALRmZMwtsE9AfolNoNLvp6KxSWInyMFTuGnom20R6CtScAcnaJ7/iAvWFmmw3ud0nUyURfp1m+BvDvgZEOh0OuncMweA9UH/KHZ0M9Gt5KgqzoEvzvDhGOjWaWaTRJq3kVMLnx9UWFQdAKlHVMZHXw69Ce8vmI9fQ/FXxktrq18/ZWgnrnr+OXlBWKFjVOVbVfsdTJoMIJHdNW8yer4SMZJaDuBJNzzJbbO30yIvmcAgmPptABbtGtlKzLmgtYyqnp/redDaS5nWL0HZ0j0ZlMGEJnGcUmdnMrxAkWjVEZx4yh0JT1u6VOqCgPG8usOYu697YPGaPm7XvQpamoFovAeflrJAMxcPJl6QWCrsGNYwYDpD/eM1euVzVoukuUXbx79sCXlJctt1a/NIG9BdyyGquDQl5F9sJY5TxtNj5X9UWiKBQptwP9AHTFsIJR8IuxAteKgy9vMqJ/6NyD7vztFc76DESUaERn8dPvCsOilTrMqYknaP1Ue4OZH7oJBbmChexDJj21I7Lep+f3O2m3e77BYe2TBDayXi0VW3iTluPmBrC6mrrYsuBpBjUz6Z7SwFWO2vRcDqq+srNpnKoDBHUoSG353Y7RJidr8X3j1SppIw8ZBMPQ3B294oeWm/lMgd X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 449ccb24-94ee-47af-65e2-08d8e26c808a X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 19:58:11.5357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lS9jvMDihAFs+17+esu40S282jQVVdzAyeM7YxwCS7LaCwT9YvExtCTfg8upYBH94/ijDRdyTMqasr+nWWCh1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB1797 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Update drivers/hv/Kconfig so CONFIG_HYPERV can be selected on ARM64, causing the Hyper-V specific code to be built. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy --- drivers/hv/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 79e5356..d492682 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -4,7 +4,8 @@ menu "Microsoft Hyper-V guest support" config HYPERV tristate "Microsoft Hyper-V client drivers" - depends on X86 && ACPI && X86_LOCAL_APIC && HYPERVISOR_GUEST + depends on ACPI && ((X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \ + || (ARM64 && !CPU_BIG_ENDIAN)) select PARAVIRT select X86_HV_CALLBACK_VECTOR help