From patchwork Wed Aug 4 15:52:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 491908 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, URIBL_BLOCKED, 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 C9D5AC4320A for ; Wed, 4 Aug 2021 15:53:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A726D60F25 for ; Wed, 4 Aug 2021 15:53:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239633AbhHDPx2 (ORCPT ); Wed, 4 Aug 2021 11:53:28 -0400 Received: from mail-bn8nam08on2132.outbound.protection.outlook.com ([40.107.100.132]:57601 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239206AbhHDPx2 (ORCPT ); Wed, 4 Aug 2021 11:53:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UnJVA7qMPt0Z5YkUwUfEm9wccedyf57eIoGhdVcU2O93K0xFgPdD+01bRvHU8aIC14k+cUezCdU9+Pe6nJH4rOBGCHkV3+YctWSMYn5HPteBjTEs5EO8KL/V5w6fWAhefLwb44sfKiI8HefnW+OtpFHJ6fqU9X311o2/0LOtpdi78Njz6TYEC2pc1EUeGjBTBdbcmOZRF6ZDYvjbs++On0t9dWea7Hy4eSXV8msnKhfsWg3O68oeo4nPwT/nuBrLu7+Ia/physMSW6qhZMPXakBBtjYBH1XdtShE1sqbvxDhRxqx9u5E9CdggvHFI9ekwdNAiyNBT59C5REHxnGAgg== 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=xvNCojoRZoE+wNtnejsTm8UK5OmTGOwqzFoxNWA7a7Q=; b=D6rb+S41sgsgCTWTy8q4q75Ubet2cYME0DtBPOGKvjccrw8vJ0kgUf84WG8mjbEmIsSDpaW+711OBkvQp/cGmQGTRU23kqr83njGAXZE7gyNYZ+XlBqoJc+Pt+yMz8BNihm4xfiZT9VvELbPPql9nTlxyxQOqOf00hpol0qQMh5j2N+IqY5MOLyPTgNWSvBOzjR/Yjeg9aukfuh/+iqr2Ngp7zshBatjURgI7xRDr0XZB5YIVNTP/cbOgkM7NyPPuLxPNQpJVo6Aner9aLb5ODmczraHWRU0VexqhSNrTieW1NpTfco1MI48k5AlpiQE+EBBeHehK/IMAc1Jy6UlOA== 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=xvNCojoRZoE+wNtnejsTm8UK5OmTGOwqzFoxNWA7a7Q=; b=joITtJiMaXadnfOQ1yX3DPXYSrdVESr3yb+C6WQ78g0gqA/lUsGMxs9gkJHqUiiYVIOSH8hpCvynAbd26BgrJziET4DEHWDaVvg8paUA5D0zd+H2ldlK98VBvBeWeHyQu1udN20I1t3MoyL448LGcHKdAkcGiLi1LF8rmQKgWgI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR2101MB1094.namprd21.prod.outlook.com (2603:10b6:4:a2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.1; Wed, 4 Aug 2021 15:53:10 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::b170:236f:1f2:5670]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::b170:236f:1f2:5670%9]) with mapi id 15.20.4415.005; Wed, 4 Aug 2021 15:53:10 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, wei.liu@kernel.org, kys@microsoft.com, sthemmin@microsoft.com, ardb@kernel.org Cc: mikelley@microsoft.com Subject: [PATCH v12 1/5] arm64: hyperv: Add Hyper-V hypercall and register access utilities Date: Wed, 4 Aug 2021 08:52:35 -0700 Message-Id: <1628092359-61351-2-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628092359-61351-1-git-send-email-mikelley@microsoft.com> References: <1628092359-61351-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0175.namprd04.prod.outlook.com (2603:10b6:104:4::29) 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 (167.220.2.16) by CO2PR04CA0175.namprd04.prod.outlook.com (2603:10b6:104:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Wed, 4 Aug 2021 15:53:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b15b44c-28ab-4f23-83f6-08d9575ff5c0 X-MS-TrafficTypeDiagnostic: DM5PR2101MB1094: 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-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jc7IyzLfv7eqMnAqPGzQQRBZx32krDM7OcGnUMitG8IcXWoXuEglgpsF2xC3PHORln6qko9iGq900Qd8KK5gw3uT5cwpqiCyW3R/YZm7peEe+EBQcbuGhpqTkYJuk40undgT6NB3lp+WaQznqmhbXZQDfznaldat7waY3UF1Iq3C3zzK0yan/q5RM5QOcVbevy9B7bi4+7LzmpyO41f+UYyrEdi2ZgC/psD2LpabyyR7UdIS9rZeFb6D7Ky3xOi+OPyAKVwj+0mE3AycM3/qDcnBu/J211p0bAMnHdktl5GbAG/8mY1In+BfGfq/7PGnzuQglirl2AXbX4EayokF4MnkFFxVzykBRqGh7tntPejCweLoTd3TdC1hRSjG8sc7ZVyHdG++uEBtKUNJfkB4r8+qJdWFtRCyIvqUnBZ4VOQ0Vjz+5Oli1fsYCtsK+EVQLtVG4CbWwvsYIxw/jn1Piv8J2FtQHvLHy+eMG4+1YBYzAHSQDRSgX0VeuMKcsQ1OIvN5xEOtyOsXK/iXPXwNpNxCF4anLPFCThivCFznop9pPgnbFzkDqFEsn2FCYJUVjzRXAf+JTQH+zWPfMLRbgqpmbeVrCwU25K4fewRQQEZZSWNECS8HuG/8ObAOoUFUxFZ4/kjmozDoanCWuFHsP4ifzAIc/WLxA2QuFdZR6c8XCntDZRJBY9K59XC/lIuxrPmn71NgSEW4CBxFk0nrsP7dhTxKgsx4aofbCdBulkZfGRvUTBN6utm6G7LXMjBckQFjKbXQrIOdsRVjXYOc0qbZE8Lf8Ood8MjmMEWqR3p9pFNaNv4GSw8EJ41ft6pI 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)(5660300002)(26005)(52116002)(6666004)(186003)(7696005)(86362001)(82950400001)(82960400001)(508600001)(10290500003)(921005)(38100700002)(38350700002)(83380400001)(2906002)(66476007)(36756003)(2616005)(66556008)(107886003)(8676002)(66946007)(956004)(966005)(4326008)(8936002)(316002)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XgYnihePhWfXosJG2UZtvuNXrUG/l0ADXmHABKyedQf2TJ2jSzw6drtGcBN9upn1Cfm2eKY2yyr18prn79uOLYZo8611qAAklJTgZFLK1RLjaU0ogql8pdYNNX4yo7l/VBR4vB0lbBh8TBKI87zSeIdG9UIRYxQbjSL+1QaAuqW/nAs46ppUoPwwnoljRzBWuxBfBMOU/m8PR9EzWaanxlcfnup89pNw2frlvom21eVqDEFDB2ZJY/SgdS6ikDvYwjXDeQwDCcW/So8PD0Fer4jGQtn0AMiSjWLzH6WSbyYYRkOlTVSlcJL94CFM6kGSnUmUTvtJEbj71/GEe2el+lHX2s/gEbUyP+cC0jBTU41Pp5qcFN2EsLFhOCO8pCWB7ezvoD4fsey49hvRkGAT2GT5cQjOkhoi1bdoY0LF/uHwPGHjOSs2fYmyJMnxRVdSs3M0gZHJrduV1/o0RRCmXxGpyh+/qgtVilNSnAoffYEX925lLbipO0aBNvfTqeQ7SmXhi1tw1gLqwE1wHEU1KiEOE+VActfcsJugOeonWoaYFCyf738kAY7RvvUQcAwUJMsI4pOlF0uJKjKwKmUBS3kA08Y8+o+8QFkeab78a2sqxgFG0ibRrudTn3Qo3duFhMiLdKOfN54ob2Y+SRtV54NaCTNVnVch/ddIUWSOuusLu/oPu44wWZ5+6W2TIbhIsUwaGw5nagF+Tb/PHRKyv7zf+kafVM9z9nByFXg0YYujTz4aZB3T8KiHVSLiOQ/ysVNNzD1auMu3Nkelxit5owZt0kKDwBN6BmoncXZaPl/Q9YvNio9qJvcfSH5YY/QFtnVVLjOgzleFoHdEqRzteTp8ELgZkt50bIJEi++eSOBxkbLu8jtfg2pfLWUDGDQ2YHL8llHx+c1VHPthp/qXcUFNFlqhyX5dKn0SfDhmlI8g/1sUXvQ6mTU4lL2JvJitLPkAmMhLUn1b0CspmoVdYZdXPqauNPom+SkGjwWRJKo3G4vMijPzrqdXLry4Sors2WHbed7KIuODsNixoEct/i0pL1NSEYT9QAJOPEV4NAO/h1za1afnNWG6N8bY1ulZqf/zvGnzLdWdqwhDtjr8F0T3R4dz+1iPFwxd1w1xNN9qZ6XoFJF3L69PSxXMWi04Bhyt2iViU/2+dBLCQMhJgX8eb4yh00IweEjSN+v4zpOQJeuHqIqVcJKqYUYuIf5o6TjlR+/xBK/tdM/Co3iraNwDtAW4KUD6JgBTgqcmZi3gX063a793M3NKFIloVmko7SWo6bgrTLnz0zdcnWjuLZ+EDVYs5zA8vDngm4ab32Xq4cKARjhadte0CMGq9iIe X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b15b44c-28ab-4f23-83f6-08d9575ff5c0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2021 15:53:10.7315 (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: QhQspp8D1nZWrY5pZnOkXf43grDQTlGX5gAvIAsgxSjZTCpaXpDDleLs1skms4o1gHL9EcCaRxY1Q3azFHGk8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1094 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 Acked-by: Marc Zyngier Acked-by: Mark Rutland --- MAINTAINERS | 3 + arch/arm64/Kbuild | 1 + arch/arm64/hyperv/Makefile | 2 + arch/arm64/hyperv/hv_core.c | 129 +++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/hyperv-tlfs.h | 69 +++++++++++++++++++ arch/arm64/include/asm/mshyperv.h | 54 +++++++++++++++ 6 files changed, 258 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 6993219..8f6f429 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8608,6 +8608,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 7b393cf..ea7ab4c 100644 --- a/arch/arm64/Kbuild +++ b/arch/arm64/Kbuild @@ -2,4 +2,5 @@ obj-y += kernel/ mm/ 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..4c5dc0f --- /dev/null +++ b/arch/arm64/hyperv/hv_core.c @@ -0,0 +1,129 @@ +// 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..20070a8 --- /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. + */ + +void hv_set_vpreg(u32 reg, u64 value); +u64 hv_get_vpreg(u32 reg); +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 Aug 4 15:52:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 491907 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, URIBL_BLOCKED, 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 21729C4320A for ; Wed, 4 Aug 2021 15:53:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECED261002 for ; Wed, 4 Aug 2021 15:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239650AbhHDPxc (ORCPT ); Wed, 4 Aug 2021 11:53:32 -0400 Received: from mail-bn8nam08on2132.outbound.protection.outlook.com ([40.107.100.132]:57601 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239634AbhHDPxa (ORCPT ); Wed, 4 Aug 2021 11:53:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2bBPvskEeFNF/1cCWhMBCAfgs63EQ9EWkTmwyU8TE2FppiuonprjX/EmGzWCxVc5hokW+85n1uCUITr8o5PEypvIEol1ExBMNGPam6JkPjS5ubrIbAVF+rXPsPnXkcE9pcaoEMCjOpQB7hNlz7O3rQf61HDuqBWZ+STQdoCggl2lr5LBoiGUyklBPGKIHEMWUvetil9gEK6Sqesr0FfM7L48WKKD/8E/IlpH9PJsfzyQyOPdsjZ9XLpdHl6htA2/UOJkxeTvqrM3WziEhPE27hnSiZI94oY8+eebHbrvBEd26sYoLQkbKPGp6rxHK/JWoPD4byMBp0+yOyuO54o7A== 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=yeanwBBvMjpPwyFziZQ6X0gIeTmIfa8OzqXPTMw7nko=; b=gOuX2ZO7iZcaS4vKGkrbAJGAi6sMkb6vlTUwz9qx/RLIQd8w2rEKlZyy5QhQDP22Z3uxM717NNncIs6RUcxmtjU79tF5JEmdfJ9+V/ARdXGJ/g1/5cu9bTzMGS/H3kCHdt6lgKFGePw0ev7lJev6vSx0N9I6Js2x5yoeRsr+FGEaV6wMz/VIxwjUl5kBldyMcwYGp7vm9yOTY+JFwT3X6C6/Tg+y3VPZogqt6LMXmAvLaIGhUJxg+iSTtSNbPpw7o/HTlJPa1Qyom5dUNGvXBQt9DwJvlueJlyx8Q6TeClNA+s1Cv9mM74AM3muurmPUb/Iof5cCdjGESCB2NeLYjQ== 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=yeanwBBvMjpPwyFziZQ6X0gIeTmIfa8OzqXPTMw7nko=; b=VWoMKbhX6eUVzyZvj3vRP3X8mgVXpnCJK64R1kL2MwmhPSlpcj2VxD0bkaTErV3u+dxEZ7UB8gfD72D+UjOjOrWtj4aDTlK0vuDDxvqstr4nMfuPw5zp1YnYBYz4S5fKIbvyIrZhvbR/UdVpoiAN/CRlgivYk3KSWZUYIuy6H2g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR2101MB1094.namprd21.prod.outlook.com (2603:10b6:4:a2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.1; Wed, 4 Aug 2021 15:53:12 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::b170:236f:1f2:5670]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::b170:236f:1f2:5670%9]) with mapi id 15.20.4415.005; Wed, 4 Aug 2021 15:53:12 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, wei.liu@kernel.org, kys@microsoft.com, sthemmin@microsoft.com, ardb@kernel.org Cc: mikelley@microsoft.com Subject: [PATCH v12 3/5] arm64: hyperv: Initialize hypervisor on boot Date: Wed, 4 Aug 2021 08:52:37 -0700 Message-Id: <1628092359-61351-4-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628092359-61351-1-git-send-email-mikelley@microsoft.com> References: <1628092359-61351-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0175.namprd04.prod.outlook.com (2603:10b6:104:4::29) 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 (167.220.2.16) by CO2PR04CA0175.namprd04.prod.outlook.com (2603:10b6:104:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Wed, 4 Aug 2021 15:53:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06bfa1dd-7411-4de2-a5a0-08d9575ff6df X-MS-TrafficTypeDiagnostic: DM5PR2101MB1094: 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-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kUwOJtW5POJ6voInjPZhXeJIR502rKZAyfqkg5vZcbD26dDyiuyaZlSPqkjoV6Xx3+xTwi+dX7kHAl981/c2VkPNnYMhIyaBqiHWm25a+B54frYa2rHK6ZsvH1NFYikuIhADCJJUkMOHFtM6/XGqtoUgKT87enRQvDn32hPiLUF7NtL20k4lHovfqeBs95kGqe3QdwewspdWaPJYR1+SMCMP9k3LVoWSjvQsmLw/vTzvf1x9mZ9oR/Vd0LMi+CaVfw1eMnJcxp1YjELycYrSL4XmvwWhLZygHF448NHhQoAb9demwy+NhBelwqKdAWaGli7FAN8JRKdg1nzaGbVe2l0LExLGyUR5xq9/ZjzdE+24QmejWZIQUZFFaVgIgiGxDDLTSddhytc/245o9L99V6SxAUcRscPk2vtON4tW3P0rieVZRu022kS2OyHjKtW5ajualjIGb2UO1MOKWphs+k/ocNPSLrlkmSIqm9KUUtIHE7c/4xg9nafFxay+sdw1eXI3A8sN8RzApFKpDaYoKguJg/hYWIQPhXpLKXDTh78W/bboCTATYg8eJpKOpgyS8Pe/0VpaVyp6WRUMnkXU5eG4zAxO76BleLOrv+5HfezgDEqXqj+MnZ05ysSEJC9nvvs6rNrC95t2KS5Fgq1wPZtZ329J420K8MDmhbpwqkQwUC+AkNHlLupOLZlOQ+gbMluA8/qQcBoM6iUs6DPvwwzcH8JsK2dg7kshAAUkDgg= 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)(5660300002)(26005)(52116002)(6666004)(186003)(7696005)(86362001)(82950400001)(82960400001)(508600001)(10290500003)(921005)(38100700002)(38350700002)(83380400001)(2906002)(66476007)(36756003)(2616005)(66556008)(107886003)(8676002)(66946007)(956004)(4326008)(8936002)(316002)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: me1juUWTE+FUgtC0M2jZFM+CAZsQ7vGO0YrPdmzq3K2Z6ZUd1+ikuqqLHMrmYlyisKR0C/wCnAHWAWoL/sUExqtlqlXVhhx/A5/KXHsc2+oJk9fgXzoOFOPU+OBArRgex2xlXcawbzD9mpW7jrycugjGKgrS0Thqai85x/tsHZ+6SA3OY1xwfmGZEk1Ncum/0zVBad+WMmb6B9GVD/FysahHlwJAfbJMZpdQ/ucJLON+4lVNJRzW4DHF0cKjo4jrvZ/29+luTtWxWhb0tGn9IoBJFJRM0t1t+p+Ly8ntP9GCheb6OHHj4rjMN3oJD0nA9T9Bs84PhHtHU3jn38StnzMyUzYhY4e3GbbhcFmpF7oG9JO+L1qy074RrmJn1NBWAfnoqBf1J0u6i7g8Qya7vaRg+oq1iW1iyMQGu4McTHaig5D+GG3988V7cIuSS4+yXJ5foPP9fQdMCRo/dla3/r8X+JdqVL0TBcR20UAqZ2pZ3/6i+g+aad2+0eJtBgSAAFiOEMP2F47mJIysIBwluhz1KUxUJqtBwnxLBCp/rrTx/DWqN9BeCaFyETSJK5UpHiItSf17MI/s2DnWDA3yksxSoyAqIN704TPHuNMgxfuYCObzFd+bQ94bo/xAZTQ7uPjnnnIgqJ/vW8v+UmDJW33N1Y16o6rcdlaHXAykQSyx9ArBmakKKKauS4im+DhrfMOPgQiBXBKVf8Lu34EVe26qCC+/cShnZSXRW21mYmS45bOsHnc+eRxkitOSkDAkp8RYWPnoLQs7tVi2R9AyFT74hm4cOpLgDl+/SucyJm2feMFXSHECDfvgV/npAUFP7kKvcGieDct5p8V8nJr8YIs/WyNl62FinS/sBdYMfBDcoii4IEmh+xyY+zD3gVUMUAFfMEp+1YmzBvI4qjyuo6wpVfEvwXjR1CG98e6wNJYCPj/KPJYyOUq/9j8eXSyS/dwQXqnBEO22eRjRgizhVf5VSfEMCm5EfUnYPDqog+XsyrlmgOEhFjXqG1k8tYfSikZSYgL6sbwPHYBcnmJOuXPG6baVG0X6Hfp6sToVHXg4MQvd6aUIEDZGZ2kJb6tZ7Tq7xcpLkXyyLWOjZ0CPgQSbFThYR7WWVZZfZlzCrBcEtdPTqtswNw0kqaMelqwG2TXqLIQsRsH4CWGLTQ9Q5fidGfm28Vftsh8AlV00iXldBTjkXapwcFhZa82CT0Tq4J1d9OWlRA3HJBBq/xlkc2IhkmOkk01Afv2Z08qrYNhqs0jjKCxDmt0G2/Mdov7Imgzx8sfCbshk6I/Un3KD6hekRcro2S8VvhF3l9FgNeFo1rUPfVs0bS6gjZTG2G0B X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06bfa1dd-7411-4de2-a5a0-08d9575ff6df X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2021 15:53:12.6321 (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: r6Ta/Np1fJbcqdLyJdRuwx0ioL7idD4l1v7a/LfPglVaq543w66COsuTQ7XD7Wf2mv2WfsmiJFkVI4pBdbmpqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1094 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. This code is built only when CONFIG_HYPERV is enabled. Signed-off-by: Michael Kelley Acked-by: Marc Zyngier Acked-by: Mark Rutland --- arch/arm64/hyperv/Makefile | 2 +- arch/arm64/hyperv/mshyperv.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 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/mshyperv.c b/arch/arm64/hyperv/mshyperv.c new file mode 100644 index 0000000..bbbe351 --- /dev/null +++ b/arch/arm64/hyperv/mshyperv.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Core routines for interacting with Microsoft's Hyper-V hypervisor, + * including hypervisor initialization. + * + * Copyright (C) 2021, Microsoft, Inc. + * + * Author : Michael Kelley + */ + +#include +#include +#include +#include +#include +#include +#include + +static bool hyperv_initialized; + +static int __init hyperv_init(void) +{ + struct hv_get_vp_registers_output result; + u32 a, b, c, d; + u64 guest_id; + int ret; + + /* + * Allow for a kernel built with CONFIG_HYPERV to be running in + * a non-Hyper-V environment, including on DT instead of ACPI. + * In such cases, do nothing and return success. + */ + if (acpi_disabled) + return 0; + + if (strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8)) + return 0; + + /* 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); + + /* 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); + + ret = hv_common_init(); + if (ret) + return ret; + + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "arm64/hyperv_init:online", + hv_common_cpu_init, hv_common_cpu_die); + if (ret < 0) { + hv_common_free(); + return ret; + } + + hyperv_initialized = true; + return 0; +} + +early_initcall(hyperv_init); + +bool hv_is_hyperv_initialized(void) +{ + return hyperv_initialized; +} +EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized); From patchwork Wed Aug 4 15:52:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 491906 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, URIBL_BLOCKED, 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 E6138C4320A for ; Wed, 4 Aug 2021 15:53:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA62160F94 for ; Wed, 4 Aug 2021 15:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239629AbhHDPxo (ORCPT ); Wed, 4 Aug 2021 11:53:44 -0400 Received: from mail-bn8nam08on2132.outbound.protection.outlook.com ([40.107.100.132]:57601 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239693AbhHDPxh (ORCPT ); Wed, 4 Aug 2021 11:53:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nnpQUdBZtzaiC4ln3vlHDkC0r1S8fXw2Iy+udUDTDmc+teLF1Y+QLi9MzNtuK2STx13dKR1Q4CuA3dpaBM3h4zobKhwAQA8tSGYuipNQZRAzepYk0auY2+P05IHxMGvytEM0vzgLX8kKagMLOANcUvoMAvjZQ99yexQ6bR6OAS2y3+nRloc3LAOb6TjAYIEANjGswRq46EaF0te4WITISma2TziMuwVE6EqVE5eZhmTv+z9ThzfrpMawFUIuUKAk6ljJERvP2L4qEgczuWFGZnyLEw8YAHWQhXT8tPQ6uPTElcXswgEFwF+xRFMofY8cwvGuaHMRz5TV63nUbrBevw== 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=/5c8TFRJoxKgaZcY7eK1KPeB8RnRqqNBzVRmNevhv9U=; b=AvKofbai+qB+72exFRhkHz8V0O6NQsskb21v7zS/g//s7TZHJfPIgXeHsZPNcb563mnyRbnZd6HqF4K8r2L7SevYhFpWwadJZgGqiE587OA3kyjqtuTdaQBkJWpm/lqJT0C4QUg0nVzE2nIrsxPUQVS7VB8Sq1KKzUAbavvlI+SgASgd0U7d/BGPRmdbKI6zQmh1nl+1K8xsdwvyfVwez74e2YofYEjgI3y4UVYvrZk3CY30gJvc2vBR9G6e11xxG3LdXYDfOWsq2h9KEG/2B2J1DKXKHtXwwvGtDbE052ZlAIoaXkXK7Xgi4Xg1WmPu8rp/Tf37DP4F+I+rqohDkA== 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=/5c8TFRJoxKgaZcY7eK1KPeB8RnRqqNBzVRmNevhv9U=; b=fqyuJv2msX4KcoEfk08FiP73pD+DblrFKinXGni/NLUPimM8kMK23/0zNb8HgOx4BqdYGMRmr9kimG40h7dKSoxmhqZvRzzhVhGQHkhySEaflkzqUMwEmKPtU75La40ra1PW6Wu7KWk5XztQF0pVuV2Tpyme5vDhwhzLqR+jeW0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM5PR2101MB1094.namprd21.prod.outlook.com (2603:10b6:4:a2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.1; Wed, 4 Aug 2021 15:53:13 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::b170:236f:1f2:5670]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::b170:236f:1f2:5670%9]) with mapi id 15.20.4415.005; Wed, 4 Aug 2021 15:53:13 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, wei.liu@kernel.org, kys@microsoft.com, sthemmin@microsoft.com, ardb@kernel.org Cc: mikelley@microsoft.com Subject: [PATCH v12 4/5] arm64: efi: Export screen_info Date: Wed, 4 Aug 2021 08:52:38 -0700 Message-Id: <1628092359-61351-5-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628092359-61351-1-git-send-email-mikelley@microsoft.com> References: <1628092359-61351-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0175.namprd04.prod.outlook.com (2603:10b6:104:4::29) 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 (167.220.2.16) by CO2PR04CA0175.namprd04.prod.outlook.com (2603:10b6:104:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Wed, 4 Aug 2021 15:53:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a3ebf57-d84d-4f01-4d2a-08d9575ff76e X-MS-TrafficTypeDiagnostic: DM5PR2101MB1094: 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-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AMvG73IEz4sIWY50MSLj0XDb7tVTlJyeSBiZavjeMp82RhovjoBn/dI351IlN2MHQejph8B4SF4CuymZ76XJJnTsfiAtz/8n48inhw5H4g0O7OCw+C1521wasTkVKHJsv64MllcpTHF2BOjxU5fX19IgBTBK9XcfHpjp7liHKW3d4JrZHURZy19m8ZPj9Zj6iS3vzHqv57x8qt3fEbDyiV4EXcUCtg8X2Nv31pueqvfY866/MB7Fx8hzIS/Lnius39+RPShNCMWTTVagYyOtK/6aKZcuKpm+zUPJEWMiU+zIfACOVKe3+2HQW+bxd9WvA1be9/0nYYbIjFNRJncePG73KDJQ0owc0fs+qW7Ym6CynoWrkwZvXwh2nM4+p6PTn88UBGpQ+wnamZa3d1vfm/IZrb0TPGFtotPiiXDqvHIttsoDbaGVU47LBJxbaHOiuKEiV+G2MiHYF9KuTJrv+ipMgf70mQ+0TCCi4cSydrkjGRSSNyr3Pk+6OsUPwAcO64aElM5Xrsbt8+zl3ID0GS5Pqnh2sIBAwXiJgz24QykNXhOV3oYK2pTMxQPjlkOvBY0RJIyVeQ5tC8hWrVyLYaVhtezluxJwnPYPop80Zk67Al6PAPNkI3R5KBCsBOdeL/ykOV6t7QtEIl9NjUOOGTzdxHfFCNIiqSzldfsD0ZduOHvfTZNq9FWDYA4KficrEz2fg4jem8nmshZw56eBeQqBVPehXMDIuBnuDXej4HE= 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)(5660300002)(26005)(52116002)(6666004)(186003)(7696005)(4744005)(86362001)(82950400001)(82960400001)(508600001)(10290500003)(921005)(38100700002)(38350700002)(83380400001)(2906002)(66476007)(36756003)(2616005)(66556008)(107886003)(8676002)(66946007)(956004)(4326008)(8936002)(316002)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y693cCRMzWM2+N61+BDaKSkHRB0LvOO5nEtAZek8Uxt3hIh9rOvZqN3InOdCbjiisPWk5Y/Xbk0hDcbGdKLakHl802zzf2ssDNf4mRGHEwG1NUl/pOaangIx9yG4dl058lkzFVHHFmOZB1fcYOuaIEkOPQqBOagbovyveldvm8hJ7Cu4KyxezUnnKSgj0C38te80Xwx+iOk+MTXej2x9V+EtzCltthCfN5O1ypDbQt7/aMspBAO4B2IVFkaEU6aHkyvS2HxvH43vNETa+NqD0C6gB34X40fvZJJUgdQdzaXqEH1pntcAu+3Mlmt6fmGdSp5FtaP0GjyNFXlErFKb4IZO0Uj3RF+2+HoXHcL/gmB3/09SQ757LxBvarq8D3ayufKHNT/CaMQ4rnDj/mc2swjcJW+zarqzMapX2ZdGXsDAr//N5iC5gOvQGULNuc1W6q9NG1T5c041iptLfsWq3mHpzrUaBT0lwQcCQswSW5dJ5YoAw35Uo+n1zXJK+MIuyHZt1AspIxKiiEwFHSBj3/fjhbLEtxhFn9WYlwGPairQfn3TYdSOT2ZX9z2PTesw/0c1HCiKm66m7qUdYp2wdC6Dw5prvsZemrdnxhD4n+CN9VjpgH+PGcEc7XNVecZLJcIfiVVjv4EsurSJZevHS2Yd/RC1e6+3idA1vffjEqIJPaZpyMB9BExWv8sVroAphXtCG74x6WnwlGJDPOnU+NKYjXX1aAqwElSuxquHTVEB2lWcC3tGcaEjPpAdctfV3Qwlpr5m1lQUkjX9weUKQMVOz6wBS0PjosG0ABOfOq7ug61W24qQVSC8S2ZBvK4uiFGSyPkkn/uZmqDUenly9HuOUC5+diJL3gvkukSNfsKjlW0pXcVjzqBRxZsmavYvsYwkb0X/2V7kGlFH41YRmGJloPmdwhwgbcMcwMEtgegMd8wcSqxDyq+uxUZJgCnVPTI4BqxErMMVcwEYJ84Y5ELdkGNZOWYpEnVagy4j5V0DXeBVqUWHKe0aXTOO3d9Jr7zGhAh1zH4G/TcjHgKVXFsUdFFh7J8ihwy3gowJUnki1Ov4XV2MJTb1ClI2dpaMW5DpmCA0V7clKShAasyD9Fbf7N46b5L39zvbvFjRJFZwHT29VkZYI9yeimIy0wfvyFkWTfSEPv4C6o7VFINtYp5hKUgh/vfK3LG6ZxSH/4I4kUHHYPjhHmUQBtkqKrUoS6w8Df41k2IHnZAtW/plu/JKYIDxDZDsWbOvPx6OpCQX8ZTXp4jWRbGvMWPglAlmOCAWxkTZtuEKtA6h7fgZBMkwM6EM4QqKhl7ExTp73lVPHfYUdZhMVrcVVcwNWbUJ X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a3ebf57-d84d-4f01-4d2a-08d9575ff76e X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2021 15:53:13.5730 (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: ZudPyQPQyQIOrr6IhywZ+fXrTKOuw/JDFDpGo8MvchuZBTDfS5XdxMMGYUBWVeDE730qBD4f5Tt3ShkY9/BkuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1094 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 Acked-by: Marc Zyngier Acked-by: Mark Rutland --- 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) {