From patchwork Wed May 12 17:37:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 437510 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.4 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 BE601C43462 for ; Wed, 12 May 2021 19:23:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 737C2613FE for ; Wed, 12 May 2021 19:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243406AbhELTXz (ORCPT ); Wed, 12 May 2021 15:23:55 -0400 Received: from mail-dm6nam12on2138.outbound.protection.outlook.com ([40.107.243.138]:63361 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348916AbhELRjn (ORCPT ); Wed, 12 May 2021 13:39:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g0X4arHEliW0gMUzSuOP2jDYSiQiEFL/XsmdzzBRFv5NzS/52YdFN2gLLW0YwxJVcaZPTzE/eLtrA79M5Exzbouo1wPXv4qF/kuU+5OQrZAo0m5cJJXCYkqZ2Icy6xNftUYnoVwXuHRihEqE80QKOyCVYxcyJjDQi+qZovNvN8LaFhhFgpuwhEW1tQIwCS4XFLdAOZb0ZU0cTBIvNI6xCVFJqhFN1OXfaIT5Nvef6J7i1pPoOpGMG2ORI90ky1JTeWarg98Sx032wGg7TTBBGUpFF/c9+4mfNqTkU6fcnatfZWxaZyds0cpXXWKVwZWu9B4W3gjQo7Ma3jKsOykSnQ== 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=hOFtTvVdAPoQYxAu5wckDjgjGdJnlvSVdvj0HU35bJA=; b=TJkMT4PZYxDDQgCq22T6gYMjAQ3FsxBGa8ddjBA65OVA+HeigrJ6H1CSm4NXL4PEugSePz9NVWmR+vNNbexM6+/Lo62pyayomTwL28INs4V8qu/ktQcajcsfifhpwWIo9VYyd8QMoaXmP2S2DTvhEfraxxRCrMgAEMEO/Wueh1SvfoF0gHGkxN70+Yuhy2OCrDUtnCSzp44u2BOhlsxpqp6DdUDecF3FiICRMZmJ4HTDUqcdDq5b/g6sge+T9At2DWcF9yIskUnzH29z0pvKnx0TIdtv9BT6j4EHw9pgkpoN3CSrVi+qg+J20PMlZIzyLaq0BWAZryUAyDQzfB30dQ== 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=hOFtTvVdAPoQYxAu5wckDjgjGdJnlvSVdvj0HU35bJA=; b=h3jTSynH/zN0vqSpENcurjM6jPIKI4mDj4qyDl/lccj8oqAdsAyBaXJvxhz2P9hRZVMHRQi5CVHI403bE133fnIm2infzjcr6F9763e7Yq2+JqhYi9PrlLzITUfUagm3oEZcuEn+9icSh+GcCkHk+eOQjdSdKXTea6ziMYkAuKI= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:28 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:28 +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 v10 1/7] asm-generic: hyperv: Fix incorrect architecture dependencies Date: Wed, 12 May 2021 10:37:41 -0700 Message-Id: <1620841067-46606-2-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b1c32b8-ba6f-4742-dfac-08d9156cc07d X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jrhoLd9OwqUhFewwQ7VQtApqK/hzbKF8vVjXb0zyHI3asuU/8KZu4FxcuwE531iW9v1nixMG9u0QsGlsYkruxYerPpqHhgteqJHAT0BgkqDY4TIRg1t1BWFfjLGf3upGTfFsSdTopkBxziN0UnUMxhWfU6wJhklWK6vvhu1USoBbv5b+8NwQhYhxdoVI4KM1Z/Nda7PeDDefKZxBCbgFW8tK3N05s2pFKS0OaJeWsPQlhWnHvp4iu9zWSHKIh/AzPyxVxL1AH8oGpM1Dzzc4QzgSrEqqRl2MXotl9/V/6rWY5pWWIHcOIf518Q/pqu464G+KE0AFhR9raGy9YzTubDdj3noSuVzFejsM7pwzcjkmMFQyiI3luu4pxJQTZ57N1Xk/fo5vp1VwVMmO8FpAREYV+u0WpPsZOprLh9QILHcI03vsWZz5cqCKantf7Wnk46olnW6fWZNye+LSDKVJ9J13S7LULeqNFUvjbNpK91Nd2HI4f9A1RjWL+vujphO6QiJKD28GwmBVAnSZ+IVBDex9RkBKCgT6YRTdPsNQbvkFVkcCnCV6dH4r+Xkm0MtyTK0Es5zi22Gi4uMfjOZpyOHvm/84rQgTV4jGRFqBXUbglws7/jaJfNwC2FnriHAUEac/uLARCkAe/ym308q7XdPYdx2EztV8DO8hc3yE2aIvrWJbPXl/14IvYMimyhGE 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: j2X+bKhSzleFXJp757pZ1UpeY2FyW1mmK2VtZ3lwzGEpxrK3PuX5XLODYKyoL6xf1pikyqLCQPlN6oeDlD037HgCBrjAx9jRgoXL9WyjZqVLAPUzd/RM7Exe1WvMPLAKUobLfiN9m6wKUR152zf1LQwqpzCaISUYYx7jMh4NEJEHNh9YSASTOaH0gTjrVuWRcUAV5KRfHu3r2caNmdCJDUMRdocI8WF10kQJ5ywBDyduEYG7Ob0CTBguI3NT/0OAhLLfSmp5VWtLab8+3TXb/Q0RvEXwRZNIGAzGFrogoe6gS4yf3DIoJg4JI12QkBD8bMPnCqyNZAUmTDGWVsANGDgX69MsQyBhk0Y/2O7JCeiU2D7WHhM7i51PIyuObulaerWXxpgQkTadQI+MNaEgt/JFat6uX/cO3r87oflEjj++oqpRa91eHzUxS0MDNvNtpWhNbYynilB1xR2MercrzqMQERYWQt9TMiwcxWVQz0Jtetpk7e4Gl3giL0T2ZAc/NaoKskzfvu245PD5qA5tEc4MA6i/Lv5po4hK0ZpjfaLFaH0rk8CIaPP6R8HB9yxCtWQKG9DC0aMVEqvo8zRVmv5Q7+gXK0qX3lR5EMtwN17CvvrhLj0ZZ9z+u0vynCBzLggrxmQOuyd8zgr/Yx7OWXvDbmMDJIH1UABKuFc67Aywwy70f2WX5/ZlcPzrEXCPZ6W0UGui4Kw+Y7gHDywZ4bY78YqMLlsHyPSNcxPOFFlC5HpXmIaq9EdR52rN54QTEeXIl1M024b5A9L+oMUAPnWzhVkPcJF2ZhYnxebDW+Me8T7tCbf4RECUZHMOcVynMjq0GpAV3Bfe9tej26wir7MFwbV4HSkkfAf10wtjAYjWAGSzm/2Ltej8Bqf8aWApNHOShrIXywfgpOElHi87l3gjNhf5UKuHyN4NAtXWDWVMI+0MZG3jWmbbSt8QsDqTNcPiMeyPVBreN9b543f3Zn2w6eoJHyMfKzVhC02r X-MS-Exchange-AntiSpam-MessageData-1: 5JiYXywbWQMkBk0Hf9gMgTJuaKvDggquAVy68aYG0r849yrjBYiHic93wXXzy8qDgq9aklU1yd9oY+RV7aTSaLNo6IUpooXs1Ggexiw7lGDjnrUqNEtBiJI0KetORl0GpQeivlQpP4vBT/+S2BUjXVQZGwGL17kPLRpFu/fylZ8as7pKEQhti8suPl+d95wg+lOUlDfsq1VmcuvYXzd/H1pi/UIhmGgkGUkeP9VfuTnAm1DG7jQmlv7yFK3CAolQBsxmx7KX/ga/MUpZF5P5vVmBPAC+ub2tHJ+jpllNrYav7SuQakoEjjJLg+OXvTezC958Nazvz3cKGYThGmwpQK1r X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b1c32b8-ba6f-4742-dfac-08d9156cc07d X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:28.1145 (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: f6eTdiZb29W9x2v7+UsXH0Bv/V+7FVEbZDShmbHLvoldQLy/FVh3FzzXqO6mYKUMuwnmn6FDvgw6ZWea1JRhzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Move the declaration of hv_root_partition and hyperv_pcpu_input_arg from the x86-specific mshyperv.h to the arch independent mshyperv.h since they are used by arch independent code. While here, add a missing #include needed to compile correctly on ARM64. Signed-off-by: Michael Kelley --- arch/x86/include/asm/mshyperv.h | 3 --- include/asm-generic/mshyperv.h | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 67ff0d6..45c48b0 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -36,7 +36,6 @@ static inline u64 hv_get_register(unsigned int reg) extern int hyperv_init_cpuhp; extern void *hv_hypercall_pg; -extern void __percpu **hyperv_pcpu_input_arg; extern void __percpu **hyperv_pcpu_output_arg; extern u64 hv_current_partition_id; @@ -170,8 +169,6 @@ int hyperv_fill_flush_guest_mapping_list( struct hv_guest_mapping_flush_list *flush, u64 start_gfn, u64 end_gfn); -extern bool hv_root_partition; - #ifdef CONFIG_X86_64 void hv_apic_init(void); void __init hv_init_spinlocks(void); diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 9a000ba..22c92b8 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -151,6 +152,8 @@ static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) extern int vmbus_interrupt; extern int vmbus_irq; +extern bool hv_root_partition; + #if IS_ENABLED(CONFIG_HYPERV) /* * Hypervisor's notion of virtual processor ID is different from @@ -161,6 +164,8 @@ static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) extern u32 *hv_vp_index; extern u32 hv_max_vp_index; +extern void __percpu **hyperv_pcpu_input_arg; + /* Sentinel value for an uninitialized entry in hv_vp_index array */ #define VP_INVAL U32_MAX From patchwork Wed May 12 17:37:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 435909 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.4 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 8E440C43470 for ; Wed, 12 May 2021 19:23:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56D6361406 for ; Wed, 12 May 2021 19:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359689AbhELTXt (ORCPT ); Wed, 12 May 2021 15:23:49 -0400 Received: from mail-dm6nam12on2136.outbound.protection.outlook.com ([40.107.243.136]:63366 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348917AbhELRjn (ORCPT ); Wed, 12 May 2021 13:39:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kW8g/XJr4/gU6iTCmPPcZSFDyta9tfiAx3B6VfR9w5BmpIO0FrOcjDN1uW9pWK+DzqDNMPB3hJXtRJBRDGI6lzz3Btv197/xWBV5ZpL1hP+gYaJaQoBFLAXPlnOoqbp7JsO1KNOokHAbT0nGnWNA5DRWnv/9vdXXZAf8rj09YFyXTciKgrkI2LCRqkNkORqQQDA2ZHSWcNcDAt9o5X8aqDBb4/4drbmZlrOlJW63UoV0YPKCijxfl9GWJv3ateY88yqpV72qdyCRQV//7LWXvQd+/bGbli9y6vHv7MYiWV4zE1J0opj66XhczjBUMKOmlxCL/Yswxe0gn67rrzxR0g== 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=UqIPv0gxINU3YVrkid8XxqccAzcJvP0FQSOwsZ70UGw=; b=Tp3GLGZcAvxb2p1xtxXmcF5Smpf8SIgBPzntkmyYaiptDDi4H3juS6fhPrJIiiyTxCZgrA3TgVbxItPCTOVNj6/eTJFh2yIu59JjCbwdPc363GVNTWRHFaQ1+8fywTX7GGgENLJOPjMmITeYyu8N38XZ0wxJ+Y4Mx0kwudHN32fHXYWKOrjNupWEMwCOSvR5XiUz2Py+L/+SMnnfq+TTCNISoAcr/jjSZ3+P5m33aMaCYBbxs56+CK9dqijqddDPsOndQvZnmNiGSY9mXr2ueqV+6YH1oIFrtk4iwdEuRPQyezMBYtRN8KbazzslZQVm4b2m4sGHQfO0ZB14WRnKNw== 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=UqIPv0gxINU3YVrkid8XxqccAzcJvP0FQSOwsZ70UGw=; b=I4Wft/UdwXmDFbk4vXIgt8BHcxdzWKAp8/tYZYPZCrkiemMRcQRy/RxJJTjsnxRtlPh7Q+vOC6R1vPK53ti3AAbSLLL0DgrkP6aKwPAkkonEbNf5uHHrPcrnH/f6j7/Lxup/8faPVJ5KP1nL1y8rUP+b/+SReja0NIREMeFQkHo= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:29 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:29 +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 v10 2/7] arm64: hyperv: Add Hyper-V hypercall and register access utilities Date: Wed, 12 May 2021 10:37:42 -0700 Message-Id: <1620841067-46606-3-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdc7830b-c353-4c1c-640a-08d9156cc11d X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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: uhjq8xhvWXrRMOJKqtVKqOo2D8E/kaml8aT7J6T6M0CZO94xJMjAhFVXk5Pv6C7eJEmnwQIVble1GFdoARYzMDJvtluWC7cgfshZKT8xE+jICKq5rkAD6Vve4mCYG/P/6iaNLiF+Wj/3knKZTTyCzjwbWCuClYOET4blY7hkSF3KpjFv9s6xfSkwmt17Z7m8oFHObBLXOkyMQMw8N4Crtb9u2UxgCm3zvNLWqk7ogd+z5LDtbMJuL5mnntowxH1w4KGhGMk/DLX2zbttL7LISCMze1iU+cDN7V7s5OKbk4ox7wnOkjbH4rUmrDaHEaxKc7TtM6ly2fkdq6lzNxBjXcGSLQ6XmXUFHQ+bTSOV73xf3GDxsqfkfTuLzjjFrVSzuuWcssn2On67T64vlw1l9nvIO704EKHRuq5wGLzJPzmtARZmQ73Mt/8ECmH6TlWzuGewDr9B4D3AZ2uZN/Xq3Vx8Q/gakp37oaRLg5iLgpxuQbxnC68ximKBBA/5Yrk4OpumuYEhqkGEXdrGVzW2TGaxQbA/5pOG4/ME+V9HvoV5NGLk+7EnXDJRKkzdcD5QOE3Dmzgm4gYedrFax5cnPhG4VLeOmSDTjLwEZcycNp/ruoeCTmBidJm9ooSCfJsum7SCiDPukmEutoG7c6P0s7d42sHBI49X9M4QhHADR+1/abKVUUfSLZbuSrbt76hvKn1tQnvFN9lmlx98FaKGgFb5FdFNbM3X0hQUauC61pk2yF2sxE0H4B+2wCv12gqkJbyHWOmV5YSXwmuyw+2jL6PKplzTLb+WZ/wDOk7Kjmg= 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(966005)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: RclYAMHG4pCuTftJctqF6EXfOL07avVcoRf0tNCoIFEwJmJPqRJRYna334Fh89hNKAbTzLICJlF75UMMpWm8MUXRNYuKvY8QUt4ahqgVjCOLPR7W1S8ocCTOBDFzR2a/I855nCBanKXQS48DZe2l6C9/cPBJd/t3xMzj3+7ansi9Cnrh4UPz1cH79nsR19QQ0pJN8Fw8aJSDAX84dP9I3pkypbikwaq09N7aodglymym0jQsOB6INl/YsxmqYCnMyImdJY/dddwPAs8e1v3E0A4xJSsCs1M6ju87gX9cYVausL5XlZmgIbZ7cHXE4aE5aAuVYgM8EfUEBGWSrM8nrI8ePOsgyzsyHB19uY4F1bMk5Eu4uCzpZlVsxQuer3JC2d0Bl06FchFlOm59Gr6xaN/+vm/i5mvOs5aVR41wi6qnVkreuR8EzHts3MhX1Dz/dU1CfahtNhpsxsYYSAuH9VFYMqWVrrwT1u2iaEKrnrmRKRc2O+nrGUN3Ky1wZV5yNi2pAgwcVTTbJ0spz93NP7Tt1sHeYO1k90abXT1N7j+gTeLNJA5nEjXr2U5Sfpn8E6Gq0gN85RJYw4yCJxVCSuVFTYJHNmphuF+fl6GRYgQ26azFxrBQi5ZaI3/bd12TwbxZqX40Uz6cAG5Spd6xmCp1Wiv8ugRA0caXYVQt5pNSN63kz6PqeHPVelLMFOF0rIfG7rw0hnTwkFfqe7DN82licirHwc3I0v2tPDfrgzGXMY9AV+GqLs8OI9wC3nelhLMyuHTwL4CWCwnXOIv1uIiJjL7KbJHvR7En0qGA2OwAHcfuOqOQMnVgW5FdpZzQqd6MS3GFEUKhJ55zVNBhK2TyCwYQpKj+jx8O054cWjBSg7d9Vtv3cpTYg2Zu7eN62pdookU84qF23F14j+DjrxNNqsLxLsggLx/gr0GV7B8nG3/EoXmK4itCj8IRAlY59bw41nR3ywss0I/6MsyMf8UBkdCqmCpdHMhzPqHX X-MS-Exchange-AntiSpam-MessageData-1: yR2tV7Bqp1eILeyGXWdcP1wM9acNHMdEGec94nQzBfaJuaLzvOJFZoAMNsFfTb+oply1p1FC7w6T8VYrNw9ChjPh/KfJoDxMd+/YXc5EyxU6FAtZysyzkFb3mP5P7Z3Mb/RhSUPXlz2wdKcPT/pf+HNkSK017plfhHO9ziLHN/QoFDhrbPEfUWyQ09fU3oXDAmwcynCU8shAE59Afb7tE5qRgvRLujkXcHUwHnjR9JCp6ocnjr224vovCKvQbCczr6lw2ZQs/YsaEBCZOWe7mtHN580TSJc8O/isBFjxLXZNqxGPXUU1RnqwnkpU9nKYTfypCV65KplBpjoFOZzD3j64 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdc7830b-c353-4c1c-640a-08d9156cc11d X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:29.1420 (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: 39CWTEqRwDjohgwViYARlOkQxTmaCyKTPIjaGcjIDiBEEe3yZj3/7M/aHEFhMdfAm1rZX0kq8AxFZiAj3lXERg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 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 | 130 +++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/hyperv-tlfs.h | 69 +++++++++++++++++++ arch/arm64/include/asm/mshyperv.h | 54 +++++++++++++++ 6 files changed, 259 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 bd7aff0c..6c650cb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8437,6 +8437,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..34004a5 --- /dev/null +++ b/arch/arm64/hyperv/hv_core.c @@ -0,0 +1,130 @@ +// 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(!hv_result_success(res.a0)); +} +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_1_2_regs args; + struct arm_smccc_1_2_regs res; + + args.a0 = HV_FUNC_ID; + args.a1 = HVCALL_GET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT | + HV_HYPERCALL_REP_COMP_1; + args.a2 = HV_PARTITION_ID_SELF; + args.a3 = HV_VP_INDEX_SELF; + args.a4 = msr; + + /* + * Use the SMCCC 1.2 interface because the results are in registers + * beyond X0-X3. + */ + arm_smccc_1_2_hvc(&args, &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(!hv_result_success(res.a0)); + + result->as64.low = res.a6; + result->as64.high = res.a7; +} +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 Wed May 12 17:37:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 435908 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.4 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 1D721C433B4 for ; Wed, 12 May 2021 19:23:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4E5A6141C for ; Wed, 12 May 2021 19:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244232AbhELTX7 (ORCPT ); Wed, 12 May 2021 15:23:59 -0400 Received: from mail-dm6nam12on2138.outbound.protection.outlook.com ([40.107.243.138]:63361 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348924AbhELRjp (ORCPT ); Wed, 12 May 2021 13:39:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFyErEOTNZ47TXSbuqe+ZQWXlaWppnJnBtOcOjoXazz334fdFso4TcYLVXF527FWoLOjOO+GQSmlThAuO4+1aDmfNwuO1JpktZiTBJG3RRajbXGcE+2v02mgCLZrwomn8OQRBMwdNMbvHqtVEcDWaal/TVNoJrVoAfDYYjKPGl0jrJBERmhhBz6Mfq09zOgk1dJdW8vuua6yKMiY1+r5SI4+0iQvilRWL63LmoXHLw+DIUyiR7wnWeOEgm86tzR7+yHdWi6+MBAgqWD7GGPZDXC0e3ixAgTUgd/9eD9CdO9uw+5itknngZCSFj+rjOvHnKS8+WqgFhcI+z8Lg8CxTg== 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=8eDbNMeS6zC5u6Jeu69d9rdLRidgmO42mzoRJ9nuRUM=; b=cSZXI6IeIqZ6fZnHDMnYWJMcl4IcO1PnwsNM2U+1pZx1LafwPGKZofZxO6w3FVGM1+6/eVqUvR6URTKSqoD+x4SUaws4+8ZAnKIOjfH88BEf0oGSZYRNtsVUISrx32eDk4TS9r9d/Zz9UEg4RNC/ktOv/3aousDXZ9+w2/e83u0Wbsu3sOgaP/NeskNXAdIxCpGtfdE/qSXe6jMBjUb3/K7HgRf34hWmoX+TYpRtbomlSM9NygDttOOD8ybAw938CNeO+1ZKvOCSW6D0L9m55vYuFyGjJ+BMSCg2eFwHpsxnn/qLTiknrYz58JC7tOMlCNAjxFkkgCfPTsEen9FZwQ== 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=8eDbNMeS6zC5u6Jeu69d9rdLRidgmO42mzoRJ9nuRUM=; b=GYTw+wg2kmeqrRYw8tVzU8wEc3PTk36GCMMmU44f7w+FPDzNLnplKmI4dHiMMrTUP/k7Kol9bDAVFX3B+tTwlO0dbuU0USBZ+1ikayf/c3irQ12WssdJkhagoLKigKQBCeuIF91k9qMPiHzFgTfyYIK9GvGS8N3dPDkBw8MMM6M= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:30 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:30 +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 v10 3/7] arm64: hyperv: Add Hyper-V clocksource/clockevent support Date: Wed, 12 May 2021 10:37:43 -0700 Message-Id: <1620841067-46606-4-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e0c636c-b1f8-4b7f-b4ad-08d9156cc1c0 X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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: Ls1Uc0/jDxnBfopMtuk2271YjtZroAcJ1mlB4k4XSeOxysPyOBIcoOgD5MlDx/b8Zbm3YhSqefXr4xXB11u8OO3q1t8o7Z/jyBPwz5jc3bfMNBwxo88sZgP9GgroewTImqJ5Zc42SJM2KTdhuJf6xpdeAT2wLjgbp9MCjgQoR2iJol5/PR2JrSKGDLb7jqEBilJRZawjP90YYXwBukUUExJKlssQO5muvjlt33w1+OzD6Rakql4nn8xmaFPVM1KiP4hOY39f5o+QlAyMIEA2IQ6HyjFGcte2neex/vaOJQt23bqAihqik+1HoHYfl+Et6P0eRHbE7g7sQKUTqKhb76a0jalpS10Xm68miKBk5d6VofwUgPab79lK2MC+mKC/V63fokP8rK/5h8JQO8czqgGfPNWaj4q9dduK8D11YZM8U6ZCwSms3wDFJNwBUx9TGPBf8yC0hUQBR+JzqkrpcfonUCWU1pldah3j9thYz2GM1NM0cIzWTvgTtUTLUMc8LZChXkGHqbkJ1BYf/cmwj1QTR4HY3P0w9ClU8S9Sy8bb8J1FgeZ/Ji3tv5beEEhbSIwkn10MKaA7rHjwhHIuZOvS5to1c0I4tTAGI9TcjkLO6DyRTC+VzwhLA+6JVSlWiv/mTcg+y042N66SOfNDRNJ/8ZzKgOQHPR2RAL1Xx+4= 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: m9BhlIQSejG6scey+/uo7d1VQ7glFSWOyxq1ha80VS/XbYQRSwBTv0FHJp+sKurcuUUYbmsqt4jno/eMKcqkL4vAu6dQyEX8EMNmtoVpUmRtV/R+hXZxc0zrwzhDF/j52s0WrGTvFARGGFRJNnP48i5YxAFvTBBnwzW5FevpnfSQYCmBA3DEVqiSJ52pXRvBOlWiQoIzVCF6LcrprAJQ3Ii1n4oJaqdQK6uGEnYlRiYhKoC9SEItGtyhSWs3vvfD64ARDjym7y7YZZDIG4ddqEQ/OHOnRgxPnExRPejmvicM087p/Z75qlkVL6FWlYcITEsGPcVIHwWoSCTKxrkXxvV+wKq+tem9j/QMyn0/uh6cSrTElFlI+u+lVXsldWxEa1G/yodAYtnmYsB7/n1UriXzLkQrPpXWSfx9K4Gq3Y/sjvMTkE3yxh18z3cqIszXN3hn5CaZKHhsuDmHrWLaL8UKHlm4/lgQ2XoI3AqKZRznNs5nmUijg3eggtXiKMMjYexf/R4pqhtVXxwIG21fSg+Y7PND1CoGIhL7UN+3LQzZmi1CE04bu77QwWtNdeS7V6SIZGJe8hcGVomKtN2+Px9xNk5X9OLSFWXnavFcEzGtV9vrov3CA/WIKxvHoyP3LFrI9wtSrinMiBaV1+hvT2Nb5rfQtzTCEsnGE1GYQj/QXw6z2Fjezi2zbdzzAwfyr3Mt0v25sadQozEmOXYaksX/HG4rzw+9CCvYzI7G2SM50YJR4vcm7SwZQPAklwfCNOqJxQKLIcSkAO+yVITZeiGIN3AB3ou48LFBAMomL85iqi4PRRQKFwM/OdNC06+IQ9pk9KRtfKuPvyPPNjXOxwdexv+zfTL6Ufj6PwWXQlayuXphQOVzuCmhw2ViiEr6eVTHgxkujHWsonseoI9YdXcCT1x1sTetlMCye+RhChXkyLF6C5qnt5qtjHNYCB4Tm/0R0eeKcIqQIOSVGZ+UcSkkY5BS1fhrj+PTGIhY X-MS-Exchange-AntiSpam-MessageData-1: pTtLbH6JMD7zJ38Eywe7hmH8XmgUe/GbR3b8C1SHkhSV/aHEsJL5rvBg1KcH8bGRbCtGXD/hbsgeH9Ss2S0P9hFiFWUmHB2BM4eufbuQHqs5zckMeMWLvMPz8298hxcD9XaSik75WHu8aQkcK9a4JTunIkJwyLiJSfWKdHnPl+o7xqqaFi8s1igrKrzBm5WJ/TamWUHfilzGa+ubDp77Yc5cNqzvOhdITLLhGoGt27yhH6QO4sRYzEMUW6aGc9NHspdVGxydBXkcYBIXl5S4dTqnvlyH8Myg8k2jphM+raVaAsgd9EGGMfeh9CbImkxxagbcO9lCA5PvqjN8nMsyvvM5 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e0c636c-b1f8-4b7f-b4ad-08d9156cc1c0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:30.1884 (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: zBmyLHu2KB0aYvHqVXt9mu41d7tOmRWkuXVib/m3A91hchu1nQUin8kJBF73G3bWmxwPPosaEftlNsdkQOZY/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 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 977fd05..270ad9c 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -569,3 +569,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 Wed May 12 17:37:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 437509 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.4 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 E5B65C433ED for ; Wed, 12 May 2021 19:23:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE636613F7 for ; Wed, 12 May 2021 19:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244154AbhELTX6 (ORCPT ); Wed, 12 May 2021 15:23:58 -0400 Received: from mail-dm6nam12on2136.outbound.protection.outlook.com ([40.107.243.136]:63366 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348925AbhELRjp (ORCPT ); Wed, 12 May 2021 13:39:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bToKpT+CyDTl7eW9pFjgXKUC/aPxsGvRPpds9adEEVz8Av8YiirEtWvnRI1/5Ku9e7lhus57KATEgyHJ5U/G0dWPNIvU+mvbBara9J88CQotaVCQAQKYstj0UQStJkzI6o17LtiSpJtW2xctJBTFiGd1iFbw9IpSu9Fgoynymc1s0S+1sV0r+QwgirZf1QRZyJqQBEeSXHdnymJuYsedjG1ceMCnw/aKtDmP0QUzL30qH99PJlSdB7rYJjoveIv1stR3GvFHaSlbU2BamGgoJcwqjkOwgNxM40G2X3OgeBCdKCbMqrSFgnAZ7XqnuFzEXCAg6iekuobZj3dNZsRzkw== 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=mZkkc3ShRuBnw3rXH50igeHmtPPzARwnJKUOuSILbmw=; b=WZUXvOj8WoUkhbm17OuPN3ekqwsLGB+iXdQHvoGUuGQNjm/Rnli2ZvfkKybAQZejFvdV3pNr/5KETpodmpwe8Y0GOYI9U4wbl287gWu9oZfanFnixws+LqP2i/A10oUkSZADkG76BSPjsH7K+WNDghnemgGNQzlvVN+z1bQAUlJz5HCOiPwbGr39JZrtUuFWA+jyoZqew6mIzlSU3paKoaSf6Ciqlg24aMyZlyaxnmAfuB5AaqSzCu3Ze4Jjw40ajBvj6Jwl4uybAMpvbDWQYMkazhg6u4C87uK80XUZibTEfNiIiXKQaMtPZ3hr5IOaFbtLyoJ2TobsJlahv6QwKw== 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=mZkkc3ShRuBnw3rXH50igeHmtPPzARwnJKUOuSILbmw=; b=HvWgZhyXx0pdWQ5A1iTCsHvN5KiiZ+jn49mzP4uSVFeEdoV2ja5cz797Y7E3qTZnXrNxcHs1/UGSn60ca9g9coeDF8IuDcDn+v/MRfjqdKNzBnBA42ynT/R5ZBFZ1OZjIBDVbQUjTu7IPTcQz46oniRh4j0p0KivR1xKYfA/uZY= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:31 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:31 +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 v10 4/7] arm64: hyperv: Add kexec and panic handlers Date: Wed, 12 May 2021 10:37:44 -0700 Message-Id: <1620841067-46606-5-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30b1a7e7-1e13-454d-0c9f-08d9156cc27a X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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: GeGNaCgXbRONx1hikapsmEevLwZAF3i/0AehavXrQBW/k7n5tmnJz7cVKcmwgsEmwwtZB7ESouQ3rXrKKa0pMeHh98005PBaMYi77mHmAqy2cvnvKUyHbIHwgIUx0l8mySblAmh3i2oCJgD8RPkRiuU17STrc4hNrgJSK6yY+6n5H6IadhGwmM5xrfpyR1ENNhItOlk4Mu1wQQyee1zc8zx2m81L8wMwBMM13fZa0U8QKANyv5CZtyVc0IAVPOa59xDcnCHU+PV2sLlkv3HYt36IZnxWmlCTPO4Fn5YYK9VY+2+7EoGpt/w+m/08aNsRzEAcyos5y/wzGpTjWHO3wkZWw+xF3ST6BnXHOadNn6Vcsmf2bdtQNemJ83ALry7e6qTjwMsFB3fMBMEiv3hgZLPxzczGnt/X1LYXNAYuiBT+WUkOAS92QHZNAI5Tz0RjqMI6pwfmJYsC56weeM0EIX/Gz9g6j7EsHu1vRCdKWGQbT8kwPqpks4dlcLvKsa9eLO2qTt78P6mqUFdFvNwskiMSxAaRCp6cOCJHxc8helk29nXJ+wEyBFqNbEzNReVffFnJJ4+V6emPDPxc2H8+p5jYvIwZLFxAA29X6Th/9rJio5NqHyRdHZBXzFfU06Od7M0wx6f/9FfPzd22x7psCn87aUlXYI8Zx5mWceKsKtA= 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: HhpgZs1KHw1Ib4sApbViVg4x2/cnd+DaGdMil/rsVSD1MXeQL4xeWqnnGJ6o9knptlcpwBwPj7Dtxl7WDoEySAaf6dagZCywXSqC4lpe+pHj1HPQQvXskOXKNTfSTSISL3msUFaPRqqIF3qgoFdThi/w0oHKfpLHcYSNV6TDoWuIaOReAG8BiqDlHsf7oGzklbq7wbuoUlIfD4fdEFnEp4w3s46NTfFuC01UFOgduxijFeZLjNyyrmI911w0b80UF22/rSWDGYgpWV0OkKX3U7vS1B6GmAwCiWKeYvuLKOA7DnE21AL6OZoeeSHVajFs/zjODQALkjOMB8am4O70qVLbUEVUU16EggK8S/XykrbC/C6BaJcc+ftj3wuHxN2IxP1oWVQRlAcenPj9pwcT/smV0aT1Da48evOOJ0ACArrJC1HTLhdF6KerH/5pL/GzUIZ0hgQo0pEVVC4mKYFVcyOeSW2M7VQv/va+zzx8Zo4RB52+5LqzPDttqAmMWrD2c2fSOQtwu5vVY5//45LpOYQJ8M+unLMyAVJDpXDsAUHbqGJGq2AIBQtyWrgiDnFQLj7Ymecmxxmf0weM1rXhl/qY/XLoZwVVASavmcVau5KrBoZmc403KauewpnJOZych+Oimh5oLlHz1ked9JEEOG1u7Bog1uML6JEKY1u07P1gB9YjBicIm0mCOcsnyeUavNEu3fXy81CGR6o3I+6VTg8Ok6mCT9fQNx28cHL8aBQs3KFIWSP0iaQ7VZYjlygYAZvwGL7mzj7wQNE079kfTzeMd1WLMkBv5tPjGTezGPZ+22O8TiFzKv129DEBWfbx12+sLJQX6mJ7mTtgD3AfLdnl5sQdB0nh2UkWttrq+hGXxDUDcLWkHClgTP/sdtO2Znh1URckfCjx6B7+cAvyTqv6aj5nkBCMlU5R5ASogBlYQHBYW1/oF/NCyrDVtXgEcLH5yi0cKBCAc3+Nlad9+vfyVzooodLb+fydWrPy X-MS-Exchange-AntiSpam-MessageData-1: ht+24SeosbWninSLgXvWMFIWXXSmb2iHTov79y31C36/vFNB3rSeMBMwoBk62M3zkpZLvNfsejnvQlPSL4BhQsQxmVLkCvTrZEcp8k1fS7IspiM5k6WoKtjLwbXFFxfd1Z1D55UTynL4NUpcM4fjuLPVy+EN6c1jP+M1vAndgCQGiG8thHc1VReI66QFklRTfvIltSgPAKgSeT+JWsXQwop1dkBakJtE9iOGqs50EiLqRzgjtWgqnmalzaOVpCBRj5/wA/HAuAOqxMdJzQxP7JnmgLWV+KeUi6D7d4wdt0Cw8/gY+jhg7Zug45hKHwbbn+PxnEfbiUZfkk4dgTPHQa0Q X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30b1a7e7-1e13-454d-0c9f-08d9156cc27a X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:31.4340 (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: 0Q44uxFaaa5qBRUzc/4JBU53V3kBmjcG494iJkE4qluCMBMi09EVavxorQLpz8SHqNCWxeHTmMawZNzh4YupEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 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 34004a5..56391f3 100644 --- a/arch/arm64/hyperv/hv_core.c +++ b/arch/arm64/hyperv/hv_core.c @@ -128,3 +128,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 Wed May 12 17:37:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 435907 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.4 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 DFC45C43460 for ; Wed, 12 May 2021 19:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A122B613FE for ; Wed, 12 May 2021 19:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244895AbhELTYA (ORCPT ); Wed, 12 May 2021 15:24:00 -0400 Received: from mail-dm6nam12on2138.outbound.protection.outlook.com ([40.107.243.138]:63361 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348929AbhELRjq (ORCPT ); Wed, 12 May 2021 13:39:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggNPOu94u8GNHuLBEXL2eja/0wZvWgZeB8b8vRVG37h2Au5cKnl3RgDkQ38TyGY2WRSJwZpNsHoG1/OFBKK6SeTG+zwpWwH8X09tjU5hK3vVzN8gatUPvgiadVWB4/KK8RA++XpyJ2j1Z/5VttVgUqWf03UiLbbL5Opoi4ZhiA7x+HFAPn03roaR8kODq9XoTZSNgfdnj9QoIWnF8Mm91Zz1sw0a3/f2nM+1NOyIllE8kjl3DiAJhwbImvmrTfnuhawGgRufcPTTN2sNqvA0+/OZeH7E0uhq+3ztqk1sle13V6uGnc8j8yRGSo/qD9SetaKA1WXq1CqQmfiabPOTVw== 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=pVbzIfoFc54FVJycbFmHMnO1OpLO1BuWWymgC66mou4=; b=iVzIpAY7IrNuF1TOQBKRN1sT+OcVQSK9uPjIxbX3REDDblT5rAFfkjjCmksxWxcwcMBXxDfpqUyVcoEvVyPT+RSX5lNIs6Fx5P3IXlB1goIPaxjzC66jLhPJsaerD7xU89xjnPpdWDkZhCVtZH4NdZNl3K0ZvyDF19u9+KVgsMyvPqAr3Fxvchibo88ZR9o89397Gonw9dmt2tUH6QnpeuM5XNWSTiJyD9eLKNjs3e1xLcDQiUXqzakfQlt93jsok0MOLfjWeD9pWjE9C7hRakxXL5kZqqDaZLRoS8zBHL4LAQw+zD9tVH+uSqCok6DnVRpm3XMrtN+obj8/ZLHGeA== 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=pVbzIfoFc54FVJycbFmHMnO1OpLO1BuWWymgC66mou4=; b=iTjb3R7xPc7QZwREtnN8DMXZg4p0LUBJjn8ck8TgugfacUyPTl7wArxC9D+hrAJPZQ9SfOIPSX6RZN1BaMNwoKGlFgAJIc30agEYwDCqU1opWDw9L1gvh71SAL6vt44jXGocfQIIl/Fk57sCvv60B6jy2wrT1PjMEHL7QzH30QA= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:32 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:32 +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 v10 5/7] arm64: hyperv: Initialize hypervisor on boot Date: Wed, 12 May 2021 10:37:45 -0700 Message-Id: <1620841067-46606-6-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8d4bd25-7a7d-48fc-b7e7-08d9156cc319 X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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:1728; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dv3SPONXEGWZNu5T5KjquyaH0J7No1w5/zFOSt2m4YjUE96KfU4ZkifStcK9BdwD8ZodEffDZfHBQAQhD7X+mqAyfIMm4kdvNV9RpkfI6r28ufUnoGzCUva5aprRsjlEK5NJPnCQ7XgTiJ3rpiGMXn2SPholpiDoD8zlko3wSOFc1umB5zqUpJJ6tIORGF6hm10dA3p+68nvXlym/MeZ7gFSkbD0QPv+UsaljHWCPpmnmcpMJPae6XEMcUsKLwMiStrzzkUdKvl44RU/lGtPWrvtOW4PFi1af1Bvvtj4L1UN214rgyxx+WmmNfO0NvmvB+HEMQJ2mLRLYr/6mmQaS/5uKpoid2bJR9Z9UxFVjMStpgySxqHtS6mqDUUkHWVaRPTfW3fmhhWoZZKn0YPx1CyhCHBrQt6kHciI9dAiIP5i3086oaS80ehk4tRC87z5yGet0OoFRYEs8kDRnNIvxoExjjkGJW3m1pdI6zZpJ1YPUid72bR8gdWGHhmV7wj1OZAo4lVyspupAY1+N+dIeZ8+BrkkbSvKcPLPwftij5U3HBInQzuWMyOj0uW93WXEffLVJ/LJGkPfWXjTnWvEr4D4+kJMMcmjhQ+PduDirRwwj5m+9WMY9nMnxOuE9QVNZryBRoT/WZWR04O1qx2ljYxu2yy1KySWzXjJMBbB1Q0= 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: rlOVFnnOAZcmUNgusZ/3cBr4JOGRd5jL5iEEja4/Xt3viiGlxruiUG0LteCa+I7m1bfq6iijINklz6TNEPQbb198zY1T9JN5c6+3005OZhH4Du9sK4jHlMsIOH3zpSVBtO43eAj3OcXIVGlvyjIDNeZT/NH0uZ7iaxC47hfJqlshgQdLxEixILIP3dbp9a/BrsPKWLnHE2/5u0UrSfHpvrtvUZ2fBpiPTYzN1MC6wpKvBnpl9/AbTKLZ6cF+IgD1JwWvzFD8U5M+4CRvxgFLRGLRmXOVtMEi0UUugNWLggTW1BPSsRPsNrMgIUhNmgNp+7XPTcCjYKI2OvaVMOnhN8ENzkflJ8Z6ia/fwb8J/5q3StVCHq1zI3MQ+2f31i6p17+t63P2JwHRqt1W/Tad4ooOeZnR3TdeYWG2b/8xjGf2ZwAWaCF1XtQI0/REODDaSEvMl072sogj3Fq4Sn15tm5LIaf1t55ZetnB1GMb2y3hr5LNbS5R/LhA0f0i4gWrrUZgk3W3dGhtDXnQH35VXcnGTTB1mTWYqyyRCEx5iJCfrqjULKjwhCceb8UfCHlXVMmYtw9gdCornial0Q2GJAT4gPb5GRcFBaisjPFB4PXNTfmYAo+usRl13XiwqCIZ11nxSg2JQlP0BPBzEtZ9v9AeVBJfK52a/TWO6sOwgE0yE+HR0oW1VrX/xhJnqksCHwCWTciw2g/mOTjPhmJXwi0zArJCFsQ56TX2VsHWiD0sqH81K5VOffH2SR4z+aL7rLTb7tNsT7o935jQl1CUPWj4gezkfi5piDJtpr7c7z8rvul5TnykNsdF5mtn5K7jyyezW2/37C771bFQhkux9QgUWuV2ytmFtLk/ZJjPmd2fx85g5NRJdbIvDJhOZ79HlDiIx6T3fgrMGvphbNI1eDeWDBXJpptI5Fz5DkJAjHXpHhxFcAy+teZuZBnl/Z/rtNjCp87q9NZO7AdSSWNOz1tAxCyIlTyOxpwYhJk2 X-MS-Exchange-AntiSpam-MessageData-1: ZE+cXC0qwDphFxdL/B2+Uex8dhNgcYmjplY0wAsAKt7WlboRW63tm0UKr1jEEnUiDrPKZMzCDhuofqw//5238WvUY91/BRwyd9d3p/mFbE0pqLhcKIBQZiXqHY6L+e8iC0RUe+Hj6VkQMwa0/DOFUO0Bgu0IP2Fk2OPjEVE6GmHzg3E9RQ9PjbH2HmD57MMtnUuIOyrrjZKmQQJ0l8JzaidTKIf2vdrz/Yp6UbsT/6Dck0DjIAaKGwkTZNe6NG99actYxYo6ntqNOHpWuWxx/hVvjkublt5hL7HhmYpZHHHSmgi4GeieMK3up1ob0jMZkvU2KkDqAK3QmZcU1AQc89mm X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8d4bd25-7a7d-48fc-b7e7-08d9156cc319 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:32.4425 (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: 0AQTRJHb0TF75sjxIaDnj3apv/NNR9iEhbt207m2UJXjjr3QdegDcbfnF3vnb9NKM332N/Ac1Kwoh2HFYLHU9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 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 --- arch/arm64/hyperv/mshyperv.c | 152 ++++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/mshyperv.h | 6 ++ arch/arm64/kernel/setup.c | 4 + 3 files changed, 162 insertions(+) diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c index d202b4c..95f7e4e 100644 --- a/arch/arm64/hyperv/mshyperv.c +++ b/arch/arm64/hyperv/mshyperv.c @@ -14,6 +14,158 @@ #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); + +bool hv_root_partition; +EXPORT_SYMBOL_GPL(hv_root_partition); + +u32 *hv_vp_index; +EXPORT_SYMBOL_GPL(hv_vp_index); + +u32 hv_max_vp_index; +EXPORT_SYMBOL_GPL(hv_max_vp_index); + +void __percpu **hyperv_pcpu_input_arg; +EXPORT_SYMBOL_GPL(hyperv_pcpu_input_arg); + +static int hv_cpu_init(unsigned int cpu) +{ + void **input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg); + + hv_vp_index[cpu] = hv_get_vpreg(HV_REGISTER_VP_INDEX); + + *input_arg = kmalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); + if (!(*input_arg)) + return -ENOMEM; + + 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.priv_high = result.as32.b; + 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: privilege flags low 0x%x, high 0x%x, hints 0x%x, misc 0x%x\n", + ms_hyperv.features, ms_hyperv.priv_high, 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, ret; + + hyperv_pcpu_input_arg = alloc_percpu(void *); + if (!hyperv_pcpu_input_arg) + return -ENOMEM; + + /* 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) { + ret = -ENOMEM; + goto free_input_arg; + } + + 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) { + ret = -EINVAL; + goto free_vp_index; + } + + return 0; + +free_vp_index: + kfree(hv_vp_index); + hv_vp_index = NULL; + +free_input_arg: + hv_max_vp_index = 0; + free_percpu(hyperv_pcpu_input_arg); + hyperv_pcpu_input_arg = NULL; + return ret; +} + +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); + +bool hv_is_isolation_supported(void) +{ + return false; +} +EXPORT_SYMBOL_GPL(hv_is_isolation_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 61845c0..7b17d6a 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; @@ -355,6 +356,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 Wed May 12 17:37:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 437508 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.4 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 09808C433ED for ; Wed, 12 May 2021 19:24:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC5696142C for ; Wed, 12 May 2021 19:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231876AbhELTYH (ORCPT ); Wed, 12 May 2021 15:24:07 -0400 Received: from mail-dm6nam12on2136.outbound.protection.outlook.com ([40.107.243.136]:63366 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348934AbhELRjq (ORCPT ); Wed, 12 May 2021 13:39:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ip1J2j39eXS9ABkVN6/OKQjHbbzyTcTL3zHv479K08pv7NotVMdUpTqje2MOD3CGE67NwSnRkvUoD/L2iktKjpNY5WP4bOtg+y9rvJUMUyOygg/YmQ84RQAQOnV61lWKfJBp5gHKchpy3NWdMmjzzcT7x8owDu3uNsjsYMWo6RMYbEOmpGWw83JcYnzqXf0+H+pUHGVMqyuH/kp6UlDvk4dzfnr2I+oTYFArGJ9cKQGziLzKGC+k0ueWsff8+vURsXB87Ikg7X85MdqBAuER8t9UUzIAMe5iAFIk28k3+Sy9dYVECncDwvDqElZqkvK3U3XqjklzSJSdsgSJ8QPr+A== 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=WXfEhK7k7JcqPSKfttbbP3zJODBIGWLu5cLPHn0EK96Q14ihv2/+PO2NBJCVkQwaZDXhJ7DrJnONNbsYek91xjW79RjRpbXfzXUhZXDVpZ6fbTRf+7oRiZXZP77qjZeDttIriwoWGiwcNkOoq3wfZTtXNrxC1/27NaBbtGcEhUt1Mxa4V2kRfC0G9kENz2qts2BlfUK8CY1zEcDzOIPnDu/0N5E8jiUxI6oF8emyHHE90eIIDNlraH9qR0IuSjanIIPwd6eWE1YMXgXqIjb9h45YbDz4BzLWUPVNETmghlF0GgMO8C31vohDWcU6K4qqZy8KlB4axw8DK9g7jxHvEg== 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=cU07z+f/Eg/boEdjcakZRjy7h6E+HzQyABFiUr0h0E0Jl1UUszq/9w3Sx2H+moQC399TEhH4WfICtTZgj0IRMdxIEvH1gj3ezui/RkM7Vn3nHfaA/CPDEL6LDCrOT/o+gsfkmNj85qXOP2LjaoPATND3WIlm8YjciEu3iYgJtzI= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:33 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:33 +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 v10 6/7] arm64: efi: Export screen_info Date: Wed, 12 May 2021 10:37:46 -0700 Message-Id: <1620841067-46606-7-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5b3e410-3a5d-45a9-3562-08d9156cc3af X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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: tngt5jj9o2F2kGYl6+fFZDQZHhvkQE9FBb6tL1P2rpW0/ac4MO9w2YHzk1meJA6ElljRfDwhiGpOFZHOKFf7EdQP1nOr7zEHmfXwrvDUdammDQFPRu2ShPP4NZltjArf060EmgGFYYQbnm5pTQ/+W1t7ODJ9CvTFHceM0aEpORoiW/4P14yZVfT7Y98RCYu7STe9kch6/s+rRhDUlXVkokazOckGw/GaKN1J8f0fwC7sYAtxqdwM3VLxDowTZxgO9DpmArQIk4h9Y12VwaTzmqhFWemBxwJehPcntJauy7rqdirj8wzuta2VgC8Sgso6/yikzz/9wiiSqkhtG/8Cqg9ftKMH1r/Yt9nUsPzx6zuBNcYxihunuK7jHDzSITy8onYR9LSIXbafZ1c9ji3wuraPh3ONgNOnwtilR3JOF1WsSfC6cry9KkQp/Gtyma1i0hubx7Sm+RUtjobh+v+AAL6dK1l7A+2PfXjTG2BcdM8BtwPDM2teWY+18MRXZF4R7TOjh466QHWTPz1KQjLoTCwLe8H0o0xKryCDdyX4wEbRtJ4pJWh17QJuYRI8mnPQqVPvN9O05paacWB4A3GYf/YTB1yN0rXLQ7jhUbHp1ufH2wVatpGzSQM17pglNAaDqPz3vHRaxusVFgpe/wSy0KpwTZnieeqHtGPMwx6elDA= 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(4744005)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: Wokl38XeL4w3jDxW6ca0u0eQxu0AGFh4XRQiU9RYWRQhOfcbha0iWEYUVJ9ayalqhg99vfbcQylQNAo8tOUTikZsXMUZAaNuTfl382AWF8MpzBA84Y1rRi7+ibxpnapwfe+O7Z1CNDOhQOUaR8t8uBs1VJXu9Lg5dPJRzAgfuGCZLzelexDIIWH9dr3L5cPxC8iR24dCq7D78kOIZOm2k/+uWyd9QAKQQfsdjHn6vBEveOQTVa6cC/uqrW9MMhs8DMxE8A3XE9X+c7RnfyQP/DOnbdceKPI/8rkki4t8iRA5nLWeySu0cUPuutdMsi9PMM8gfn5S1DtQ06OzfCevF3E3HfSWQITmypy+hnKadAvmyEXSm8GiUOyWsBTgzxCSSEDjFZibua8ZcPEct2myS5cAmZFnohVhzDiDeQ2qoNdMvwB8xw2WEzGrKuhjxogcx++hf7F3bfsE9VeB3yGKXd8phb/D/E6weP5lIAowhFlWvWibZdmD2uzrEYgVxcWxOSu1XMIdmyDBtQ8hg0yJPRyMbxlfAL9QsER7PTHYTFxlaO3nGNDTNSrYhsMw8gbdhbPDuNyVbxpoY6mIkz6mNAtrc4UcnG+Gr6h8SyOHsf8JfNc5Zgmv0k8SZIvNs2Y5TGcu8ORFDB6qu+Kri9h2z3LiIwMVe1otGV48pjm/YE8zczxFNP+JLSRytyI7ICSWs0JeyaBTM4dRFAlylAjNefZGzrvbEDDOD+cfJATylTHhflkoV4pZhB81RwOebH0MGcqupjFXyldrhRBKZ/Kx4VB2wsVKAoEwrHIUj+zMZRP3do7sN3df+lgi0L4JOMwjRYG8QWg8Ue8vvMZtgQlDqdU4DGQKrK4UM4y2Li8SczRHdnJasMnmHUZtFpuJZeqtMzxxUTHWe8RMLsjUKsU51nW+NZYzqJ8gtLv8RkJ/K4s7XQ9Y6d8vAzqh9x7vzC0hAbZNTlZYwCTE+X4xgoAL7aiZ9ODa3ggBEhGL5Uh/ X-MS-Exchange-AntiSpam-MessageData-1: S1UK2EBYoQwUyDA3kI85kdCT4Brs/7Vbw5rzCIVfbCkGWLPhAvYkJuM9/aROuMUlmk6OHs/GDs2qO4zHSszYEfpsH2Lsiey58tWzAskkJPuE8uwtRbr9D2USMtkRfoeiaTn5o9aUKo6XoVLOvwoiFi9YiS7dYONoCU1R2F3TIKMjpUrolV7U9U23dhxnZ9UfPhUHB9mwJpA5AKzHL0ax9GKX2OuYR358nBF4Ri3bcH0NImz+mvPHysem91iGWSzdHAmcbucN9RQXBsqe0l88NnheltLbZhhSxXvoxLqX6h/WzYL/XL4GhLeC9NC0i8ebYZ+cppyplMX7NdZxIcGjJtHG X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5b3e410-3a5d-45a9-3562-08d9156cc3af X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:33.4621 (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: ZqdVY+B8wJ5o1CsxQKew2fLjn+rOP4LNodVhdmoADEazOlZzEewxMF8q8Sg8EQdozgF020hyy7dOniCgk7+R+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 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 Wed May 12 17:37:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 437507 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.4 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 D2F39C43462 for ; Wed, 12 May 2021 19:24:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9EDBE613FE for ; Wed, 12 May 2021 19:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239633AbhELTYJ (ORCPT ); Wed, 12 May 2021 15:24:09 -0400 Received: from mail-dm6nam12on2138.outbound.protection.outlook.com ([40.107.243.138]:63361 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348935AbhELRjq (ORCPT ); Wed, 12 May 2021 13:39:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xihgg/Pp6FyQarAzURkku8x66cdUvJpeScNSDzd3mUI29HTIpMd1NdLDhngYGOLA3tBFZmVRonhyC4uksyIrGcj0sZpTef7O11Ulg2d7O1N7EneKx3DEUHNLs0Vza+YNiEidNxg82uLIyt+RIbgyKGqTDQKhSp10uMwIf0/XZRpNIW1qIAy0eOVbVjGtBw2v5yN9U5+bxRzmZZJwWCjwtz5SCmxZYlx5hGgSBuzxGghkQWsuHYPGv2d0e9+QcLgvsf6dJjV7qTTc6t/3KyNIx0RgusPL1nHZ2OKgwH08ZpooIyp+UqP1o331NtS8aKL++VndkxuIDX9eH9vOGaRmxg== 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=sT2Ypqct7f4vBCa8b8tJLDx27rUACwUFEiRcKXQ95Sg=; b=D8betxYkfPvnCaivBjDnWZlRqV5YkMuv7zL8ovNekbTrh0t8KX1Hy77o/8EysEaGp6WNZFyRQcD/3QvJIHGTsCvXURMUe1NUHzGkuRo+hmQdcUowR9Wz9XVGpoCIotffe3SrgDcoh04vxztpsU3JN6LtHUlHgpXgqpFPSK9RN4M3QMcyyEefFo65Uxiydmy9ICZvzh/VhnzfCBFidiwEMwucnQwbQfRyt5bkXjV1Z32S2bHyOYG68B8KbYHzpsPLl/LD2KVqcJz65HD0tzw3PZQJGsg21d4LEkF9CUFPeE7LqW5BepPtGknblNvC6Wsm7Y825ta0u64q3PZG8gbPOw== 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=sT2Ypqct7f4vBCa8b8tJLDx27rUACwUFEiRcKXQ95Sg=; b=EEhGfUa5mlVtGp48cdM5OYf4DE5GBRitbYNesxtgaZ9aEhdgQb5BkcibOInnX3Pht1ExzJbX8xtnfc+MMVW/o2kED6jvvykXe5YqBWDEpNo70ZREmYbyHPjYpT3xUOW7ijB0lEmnHLoFmrXrzREdENQEGXWbfKFRT2ScoPVsUco= 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 DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:34 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:34 +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 v10 7/7] Drivers: hv: Enable Hyper-V code to be built on ARM64 Date: Wed, 12 May 2021 10:37:47 -0700 Message-Id: <1620841067-46606-8-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) 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.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23cb3666-cc4b-4657-8290-08d9156cc44d X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: 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: nWBiJmvlLnQ9UJ4cOr9cmUErlbmicZq4SEmnvmAxbsrREWhz2ew45zwZdDYyZUMCP0Y7+4DN48YOT5FO5jp5wfCRzQZneljpKNOOhkgBDDSCEt+GUvE8lE20XKVhLM9NpF/rt6U1UOlhL3lkSVX+o4oAHyxAq7ZJT/RT7ks7I9BYB3Ri6+snGPzd9aXIZoBMPeHKXi1nWYGhjGQDKgIoF1RVAP3ChB3GYPkxYtgUD2F7YolWuIVGqae9LEGMIbL2vHFRGtdHhFLmnIJc3CCy3na3sPXCo31CiFGAqeXpDaiZz0D79jTSYmNtdeNoP3nzHXFPI8/JNe8xkjGhyWJabDihabRIuAjfMJp+n+78t1ei5Fcco9UzW74MTMmxDPU9jsMMVvPmVtQBVZjZezTdyMHYa4cj9ZghGxMXe+ltTeBZ2B+k42YDrJQd4rsJfwZqkxSg9KtiuQrzyHaTv1ZiwH+0gkEjDX/DRe0mM0e84AMxIa9C72UwkYyL1D8mgYiwk7rlXH8uYPvnTTk5i9YBxI6gj7LsI125BVphp45OoY4CZWyLInMAUIzzdO9vAJMnWDu8fWsyxCU1HHXbF0iRHn+5GBsOjuWt1PTJb/bBm2hrxVc0ZDf7t0kzfJ8rhyB3BpPtyAInEpHlCXLwgtAqKQfOw2kmVimXcJO8E1TosRg= 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)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(4744005)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: t4ZwbJ2bGzR/lJ1lXszfSQOFHcAFR9QIQo7wUzCVvUgUu+KIrnk4MCKRGdT22Kq1y07GJId8BOlMlwOmz69fqJP/GBqE06yxi1BkpjMZId+S3//gqFh/gfaHqgwdKH0cpWywWcU4Tb+er5/vnUBJHCW5pPviZPX48BwJCC+zhWt8pavv/jXy2b6Xb4Z46fbc0VLDdz4LD3p8woI1b601RXXAt5xBpnnJIrIg+0k6bwIGhFMpOuuEiciggocCj8vf6sIR57Jlq+fDXQovs+7S8gSnkAmtyHyc0bhI3YriJA6P1xY5P//BBEOrHJqe3Pw172Ts37yp6IctISJevJomNriWyYuH6DHPd7nk+n5ndJ8CwpXnDk6GiBR7B7jCMFO5+aU+UW3wi0PEaw4gsUhFlETiZknZ3iX65a7k8TA15+pyVDQiEwF8a0Vw4SvWkO62oQLdz2uyteh72V9stjDWbkPoURih5pW0enOzCQozpAWObT9I5SkUYrsJwVTGjsoQvKR8Uf84N3UWN55AFG9h6RPjQGBS2tZAiewnxvZxf7wvihTmuK7l0c0ffY4/JJ6Vnc2rYP+TlhxSpoLyNua/LJ86aC83a8stP3Zb7uDMS/KI3MrT4MRQoXG6zb86o+gQGbbJa+vbh7P0Tpo1eWjg21FiTALjoFPH8KjE9LCoWPXlYnuAJyIGOqKqOGDgq/owfHzhw8MuQwYNHV3JJtCA0MHnRG0cApg5ddDRpr1Pswnnj4GlHm2/wkN6D4tATOTE1TVUas2VSwg4L140JusLvbR28KCuLC+qyVcct+DZeqj4blAHPD/AJU/yWJmsP7bRJqSXahm68tCXHlR5Wy/xLCNfupqMG7fHA/FAnWHprojmRHpsnUsNnCLRrViJwccEJA8FspGljIQQmkbR5DLQ1L1A0W2H0EKsbR/SnvWeVCNcEyUHMuoI9IftTQx0dnCrPHHl3OQ+ileBTfDwtjz5qc2jxXk+2EmeZNnOcKzc X-MS-Exchange-AntiSpam-MessageData-1: 5c7qf4XUrlA5F6yEIChdoD9shYKIU35QAhvjQ4ofHdlgCTa17EBOyl1xgb68vJ6XWvW5cRz/OMeWFbunKqQC7w8sZkjBoE23f3WqgBuavVQHIShp6Pt0Ibnm5XyECmtXGEMj96NvKesr2k95lARcHV0ktua/XG+vHdkFhFCTX9aO/Lj0EHiRo9bmlTog10YRZhyR+zQ1jKZfWbXk6ifBHIUSSw1qHo2pIWYGXGvQXbm+oldJQ0dzqMFzP81n2UHpdoINVQeQ5TxfFJj7SCEOOFVkkPODrdVHoW+PlSjJ1GT1ziE45u60DyLLL4ORosYvttLtx2mCniSbWAfNSHSDtFHi X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23cb3666-cc4b-4657-8290-08d9156cc44d X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:34.4925 (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: WVype/z9wW7HClirB3YOJLOf7RzDCalfohQDuk8NWOgi0PRO8AgMUCfcziN+4rF/Rgr8ygCcKPGKV3mywIdf0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 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 66c794d..efb7585 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