From patchwork Mon Aug 24 16:46:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 254258 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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP,SIGNED_OFF_BY,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 CC0E2C433E1 for ; Mon, 24 Aug 2020 16:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B0B62067C for ; Mon, 24 Aug 2020 16:53:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b="Ehe3dkeg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728899AbgHXQxn (ORCPT ); Mon, 24 Aug 2020 12:53:43 -0400 Received: from mail-dm6nam12on2118.outbound.protection.outlook.com ([40.107.243.118]:61408 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728745AbgHXQsI (ORCPT ); Mon, 24 Aug 2020 12:48:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXtdlGIc60rR9Dgw12ZJsRetmU8/hyJ9roe+2QIT1KvxXjFA1cNqzVjctUB865P6Hn1Wuvq4tc8vCyVHjVRz32m7+UCRN0LedKcGWGOYikf4vyY1Ru2Y6s3fj66pulbFCUEF88vG19AoA1p2KqaXCaxAcp/ymRSKoqLaOt9+aoTxyQUYGbC3Clo6Me8HX2wAEqPPPqgNvB5smjhm57UopYovrNUDJOebit2Un0URKo0BLClh9pooalO6bwQzjVAwgUm20/PFu4g597FpALkDZfKsCmNH6ylokqPgJSwSu/+n0K+gE2hosTHxISns/yDAX/10SlZVJdtfW7n9HoBcjA== 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=PcCR/WoCm5Jo6xIeBKedm97HiNYcdoR2x1QnnxGq4IM=; b=dYa0o4d7Pj4+Z0GmtWWFLbF7AKEEMFlcp9BT8K4jmdSQxrIDMax/d/q3keaMYPNeRyUtwjTG6K3o71OMSI/elPmn1Dzc3vBNqET4IbHo440lAgQvZ0/gBvlBVsFNVRY7xVcamKcpS7q/6Ka6ohrk44twOpgwEpX/6tbBHdExac621OP70JzvPURTDf6Ub1yBBNfCFRtcxx86PzEzszPfBwzKq6zptYP7+m6bWldP/jl6M2SeYzYCA5y6jhU7MH0gdvPE7T4jm2Y7ICUzpgR5KL69y5tGCx8EMHZaNJIW2KKa1JHtrvo8lpYe9LIc4r0386edUMpD1wJDAf/PKnZNlQ== 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=PcCR/WoCm5Jo6xIeBKedm97HiNYcdoR2x1QnnxGq4IM=; b=Ehe3dkegZLKCfDM00R+zIxx5VxEIR2nm8ObiVn06n+r6BpijshxbtTJ7fdhKxC+Qgy/yELOXQk9acvK8TRXMMR9+6lU7YowwUwvzLbQgSXshFSYj6SNphqVhdy2fTgBsMD1XVkJzLVI4U9GPBADh3yMtSnWqwlNHiYaCk9pZX5E= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) by BN6PR21MB0753.namprd21.prod.outlook.com (2603:10b6:404:9c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.4; Mon, 24 Aug 2020 16:47:45 +0000 Received: from BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615]) by BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615%3]) with mapi id 15.20.3326.012; Mon, 24 Aug 2020 16:47:45 +0000 From: Michael Kelley To: will@kernel.org, ardb@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, wei.liu@kernel.org, vkuznets@redhat.com, kys@microsoft.com Cc: mikelley@microsoft.com, sunilmut@microsoft.com, boqun.feng@gmail.com Subject: [PATCH v7 02/10] arm64: hyperv: Add core Hyper-V include files Date: Mon, 24 Aug 2020 09:46:15 -0700 Message-Id: <1598287583-71762-3-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> References: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) To BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Mon, 24 Aug 2020 16:47:43 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [131.107.159.16] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d8658d2c-1323-418f-5f7e-08d8484d6ce1 X-MS-TrafficTypeDiagnostic: BN6PR21MB0753: 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: LaTUmnHsLYcuM241Bk0CtarUyCJ7NxqX+UwP2q4CQ3YdBzJoKlOKVhaQM1Yk68ap4gpVsl4zxEP5IY7s/xKuisNQgZxH8y19OSId1kQ3/T3RFzc4O/O9XQv0CirDwDLgNi/wdDmUaRCaHpWKz+Vj37cSk05fjU3dHgC2JszXAE7Lw7GLN7V5E2E731TkrUVW9b9ssPWLcEyM0GMDc6h6JVr87cNo24GuGue9ahwAx8J9BYsUy9qIua2A5RJuLv7hypmFCZCC+asKnk4eaZ7Jh20ZgeXv9bHvv5WCG6eT7xvVOgagwyP4RRfYbwOvyRSUdsTEJnH/2QdGY0n7TufEkNzUkzjSgiK5YcF9a8TxNKKX3ei2DUhEikmRneK4Oh6eWvFxYhsMvWRfjW54JNvML+LKsnLIJzii4QyMw4BOmODGmxT5f32sSYaqta8LIKm+gbbUK1MMHyWRjRLNAKW0FA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR21MB1281.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(8676002)(86362001)(2616005)(956004)(2906002)(6486002)(8936002)(52116002)(10290500003)(5660300002)(66946007)(16576012)(66556008)(4326008)(6636002)(316002)(36756003)(186003)(82950400001)(478600001)(26005)(6666004)(66476007)(82960400001)(83380400001)(7416002)(966005)(921003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: tPggJf7ehwhRHGhkYrFFhZbQ0rsYLoEzozKz5mZEMoJANKb6ImKztAXNKAroq+xqeVeWxqJaovba+IO7vcj8Dl8iKSbW1qp5Nut1mtUKoDWeYt0B+ZRqQujH8kXugVgVzYwgqvQfePN8q051cjPoBcI/cGK7xcX97TAk7Jk0OdBnGvsdiN3x64cnmFHEffxvX7Z8E4EqhTnYJc217A60sIRtwfAhpEaiO6yB+HpMmRPQsrZ7ORbQiITDI80JAULp0L2c/zpI/mz9dZJW5Atro2KhpJs6oum/vQasCflwIeMz+NIjTLcwDL4bcL4NoKTA1tL9PdB+QZsg1qikYLUuoEkMwPPw333Nq0Y5kiQaR9s05i2Sxr89/+VAiLnISx7x2r8FOVWBXYfwurMpTAu/q+98+4Z71DbUZnHNZrwzxPF3PDT0DyNJRdHI1ks6NXLbLX04g+srlyiU9fRkSpliU+SUsXK0x/6AxxKeuzfbcJm6LCHqms6xeSmM6CZomSbfiB/oTxV5dwV9INCla6DL2ryZ6wEwfFTdxNGw8kVrXZWWTAQaFiCz6SUmo+8Bfdo8LbAQiQF0nr2eRNM9kSxW14XBOUIm5M3FPb8p7eUhg1g5gQ97nF7Ed+B/QWgzlNjXgiBHjCN0eLwZ2OOF9cNa1Q== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8658d2c-1323-418f-5f7e-08d8484d6ce1 X-MS-Exchange-CrossTenant-AuthSource: BN8PR21MB1281.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2020 16:47:45.0605 (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: ryetExZqn4dJUxrljnL0fXmIS4ck29PSy2ThmW5LZrwIyaTSPlN39z7Eyi6nM4aJx5VmU4UV47+y4AyybPrXZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0753 Sender: linux-efi-owner@vger.kernel.org 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. Signed-off-by: Michael Kelley --- MAINTAINERS | 2 + arch/arm64/include/asm/hyperv-tlfs.h | 94 ++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/mshyperv.h | 76 +++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+) 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 4179dfa..803bade 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8054,6 +8054,8 @@ 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/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/include/asm/hyperv-tlfs.h b/arch/arm64/include/asm/hyperv-tlfs.h new file mode 100644 index 0000000..09f5228 --- /dev/null +++ b/arch/arm64/include/asm/hyperv-tlfs.h @@ -0,0 +1,94 @@ +/* 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) 2019, 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_VPINDEX 0x00090003 +#define HV_REGISTER_TIME_REFCOUNT 0x00090004 +#define HV_REGISTER_REFERENCE_TSC 0x00090017 + +#define HV_REGISTER_SINT0 0x000A0000 +#define HV_REGISTER_SCONTROL 0x000A0010 +#define HV_REGISTER_SIFP 0x000A0012 +#define HV_REGISTER_SIPP 0x000A0013 +#define HV_REGISTER_EOM 0x000A0014 + +#define HV_REGISTER_STIMER0_CONFIG 0x000B0000 +#define HV_REGISTER_STIMER0_COUNT 0x000B0001 + +/* + * Define hypervisor message types. These must be + * included in the architecture specific hyperv-tlfs.h + * because there are processor specific values on the + * x86 side. + */ +enum hv_message_type { + HVMSG_NONE = 0x00000000, + + /* Memory access messages. */ + HVMSG_UNMAPPED_GPA = 0x80000000, + HVMSG_GPA_INTERCEPT = 0x80000001, + + /* Timer notification messages. */ + HVMSG_TIMER_EXPIRED = 0x80000010, + + /* Error messages. */ + HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020, + HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021, + HVMSG_UNSUPPORTED_FEATURE = 0x80000022, + + /* Trace buffer complete messages. */ + HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040, +}; + +#include + +#endif diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h new file mode 100644 index 0000000..6b1f26c --- /dev/null +++ b/arch/arm64/include/asm/mshyperv.h @@ -0,0 +1,76 @@ +/* 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) 2019, Microsoft, Inc. + * + * Author : Michael Kelley + */ + +#ifndef _ASM_MSHYPERV_H +#define _ASM_MSHYPERV_H + +#include +#include +#include +#include +#include +#include +#include + +/* Access various Hyper-V synthetic registers */ +static inline void hv_set_simp(u64 val) +{ + hv_set_vpreg(HV_REGISTER_SIPP, val); +} + +#define hv_get_simp(val) (val = hv_get_vpreg(HV_REGISTER_SIPP)) + +static inline void hv_set_siefp(u64 val) +{ + hv_set_vpreg(HV_REGISTER_SIFP, val); +} + +#define hv_get_siefp(val) (val = hv_get_vpreg(HV_REGISTER_SIFP)) + +static inline void hv_set_synic_state(u64 val) +{ + hv_set_vpreg(HV_REGISTER_SCONTROL, val); +} + +#define hv_get_synic_state(val) (val = hv_get_vpreg(HV_REGISTER_SCONTROL)) + +static inline bool hv_recommend_using_aeoi(void) +{ + return false; +} + +static inline void hv_signal_eom(void) +{ + hv_set_vpreg(HV_REGISTER_EOM, 0); +} + +/* + * Hyper-V SINT registers are numbered sequentially, so we can just + * add the SINT number to the register number of SINT0 + */ + +static inline void hv_set_synint_state(u32 sint_num, u64 val) +{ + hv_set_vpreg(HV_REGISTER_SINT0 + sint_num, val); +} + +#define hv_get_synint_state(sint_num, val) \ + (val = hv_get_vpreg(HV_REGISTER_SINT0 + sint_num)) + +#include + +#endif From patchwork Mon Aug 24 16:46:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 254259 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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 1C923C433E1 for ; Mon, 24 Aug 2020 16:52:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E596E20578 for ; Mon, 24 Aug 2020 16:52:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b="Crej1C1g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728881AbgHXQwH (ORCPT ); Mon, 24 Aug 2020 12:52:07 -0400 Received: from mail-dm6nam12on2104.outbound.protection.outlook.com ([40.107.243.104]:1074 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728848AbgHXQsm (ORCPT ); Mon, 24 Aug 2020 12:48:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WApy1dXTtbRFJVTg0PKD+APQCw295emjOQ99J2SdlmlL+KmzZpTtMiZHDjm3bFtMGPvKRB04hrAjy7SBlABDa9K4bv+DvSaCgIIuVZmX82R7Ge7mIKuET5dVmuDPBWY4XdHa7Sd7X4W3zFtKwCFB3Eh7/LYK+Uo0wdl+PBmC9WBpFhCmiE0PmOgiYbl1BJ0bcZIl6ChaL+NGG3wjmPhjedD/qjQkkZy8Br8EUAMyMvpDUp8e/g9nh3CIqgntf33WPb43dIPg1t8VlgDAcf9Tkj8O2sNQwwyMoeHaNjWoCmlGlNWsKBcpRKdkv20oyAfbQoKm6p1pdiNoift7mwKJhg== 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=h90iRs2LNed01ztjCMOd97VyD/Aapry8OrQ+KqoQZhw=; b=jHfSVzQa6cStXXqNzi6oDOidexrNLDH8Goge4z7UBoJsXLcw0jjJxNevFhrdFSSg4X96TDGT1Tf/jYCHDli7yp4gkHDQMbdIPJ1KjagWRRgvEDog0hFtQUJJPAFjEohh+IXE5xD+BKYNPGedjG2yTJwWj1ZQgZ82wJKEPziMoyPRUFwcuEtdM0rHxoXwY8de/Hi3YEF8Jx6io37kBelov/3PW44bwxjBwOLbddVkk6zlJyvDHU/P7oCl48PLi8ucv7kPNuZHsrV/kvfE9KfDlZUF2qDDa+Qm73I/HNUsqfXdQiMCNRM+QCV9dVv/XQqXu9o9ysBPsSO4aIUYB1nfhA== 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=h90iRs2LNed01ztjCMOd97VyD/Aapry8OrQ+KqoQZhw=; b=Crej1C1g+f6+rcJy/W/WdqFLKdiZWE0jGNvKctAiksBjRz4MliBM5uvJ1nUa3kF3naA6FBTgevlulrGwbjjkNuU8zl6A405BZFCZNnZNgBTsGsnLvI9Fe/+kAsrJFaKd0IhLBu2gjFTTDO/8AQNBg23e2/S8G0lVlaeZFmrlaRk= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) by BN6PR21MB0753.namprd21.prod.outlook.com (2603:10b6:404:9c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.4; Mon, 24 Aug 2020 16:47:48 +0000 Received: from BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615]) by BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615%3]) with mapi id 15.20.3326.012; Mon, 24 Aug 2020 16:47:48 +0000 From: Michael Kelley To: will@kernel.org, ardb@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, wei.liu@kernel.org, vkuznets@redhat.com, kys@microsoft.com Cc: mikelley@microsoft.com, sunilmut@microsoft.com, boqun.feng@gmail.com Subject: [PATCH v7 04/10] arm64: hyperv: Add memory alloc/free functions for Hyper-V size pages Date: Mon, 24 Aug 2020 09:46:17 -0700 Message-Id: <1598287583-71762-5-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> References: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) To BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Mon, 24 Aug 2020 16:47:47 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [131.107.159.16] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6ffa684e-4fd2-4676-1901-08d8484d6f14 X-MS-TrafficTypeDiagnostic: BN6PR21MB0753: 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:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HXac9jyTZg9XHgzTC+Ls8xLP/V9eUrl7yqI/53PFWuNgOqJw27gtnh6frOuxOueq2Az4v0xj7CJfLK744+kQwyUkPVq3yHxRgQl6uQqq/c1bEBaXVDyQG60b7tY3rfbPqkykjyV1MnMFGKO1jiISI5nyA8Q0djZAjM79XfBOJ7y8K2A7PX+rB4KfMMlqakFoPAMO9L3hdLOxhhyy/FXqI3IuSnWE4xFd7u+bjSsbT/cVkhvvEWX12pO0mIyht9BxJ+He3XPrMCx2uxefoWPFYEOj6V17GX56FeLS5HgYbrraNDZG8LbMH+7GdAUq+o6+UbVt9zzDCfUAZuSD+OH+hF3oZYE3666qlS/0pNMyCmoB5OUhLT6lpWbQ0oSpBe9o X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR21MB1281.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(8676002)(86362001)(2616005)(956004)(2906002)(6486002)(8936002)(52116002)(10290500003)(5660300002)(66946007)(16576012)(66556008)(4326008)(6636002)(316002)(36756003)(186003)(82950400001)(478600001)(26005)(6666004)(66476007)(82960400001)(83380400001)(7416002)(921003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: zZd8Q1zNASL8UTDW3/iQ+qv7P9P8HzW1+mzfW8JKblJtAKPc46qGHd30ABZq5adVNeO9fhG1CdKLQJcMV9uTcFQroPABqxfFpWOD/1W9neNqrIbZUQ85jLHYytCLzMO9G+wX57hAPWgIFENsQkGe9wml+wRrrbMkzoUu/uOmYwFWtFJc3ScYlcE6DkiQCxt24Va+MeIsZ8udxOGEevbLZiboqi3Cd3EnwYrtin6iAy49baf3qJgb9bJcHNMHxZ3IntyHJU2rVPIjSgMefOUDmBfdM/7qU0a6d707ymcXckBRSttg6bKdDQKztA4iwFERLF9bDBtnTrjb/m55qcgL/qEicw/ZWjdXipOOxohuvS+B9iDMc3Qf/Jho0KOmO572n8ggVLVPKKoTpfQz+pgnqMUVUKtbFrY2EeyukI1LtujcqEr/XfMbRNM0N3M6BX8mfmqufaxOZpqwAGNFuBcd/GzoKU41TcOUPpn+lKSA5CIhPuBxSBYCAEMwYNZj6t72SSxe7q5ipnhWOlcDWRxDx47nkyHmy+lXgHAttxF7P20YV5lBVaDvOJHECdxeiyHhUZ7HRHtVUKgd5rDgboCqstQPCxgkzv+vuzwlIOMkssFoxa/COB2PuqBiH8mV+ySWqy/M/mMiquHKfM2l/u/LWw== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ffa684e-4fd2-4676-1901-08d8484d6f14 X-MS-Exchange-CrossTenant-AuthSource: BN8PR21MB1281.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2020 16:47:48.7434 (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: ajUFDDZHRXatKiOSPQdQ9+ZNfTGLLw5Qqp2+qWXtgEoZ4/YofhMrDGRPrcLfaa0tgkgEWQNaz0BAkZ6r3r/E3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0753 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Add ARM64-specific code to allocate memory with HV_HYP_PAGE_SIZE size and alignment. These are for use when pages need to be shared with Hyper-V. Separate functions are needed as the page size used by Hyper-V may not be the same as the guest page size. This code is built only when CONFIG_HYPERV is enabled. Signed-off-by: Michael Kelley --- arch/arm64/hyperv/hv_core.c | 43 ++++++++++++++++++++++++++++++++++++++++++ include/asm-generic/mshyperv.h | 5 +++++ 2 files changed, 48 insertions(+) diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c index 9b35011..14e41b7 100644 --- a/arch/arm64/hyperv/hv_core.c +++ b/arch/arm64/hyperv/hv_core.c @@ -24,6 +24,49 @@ /* + * Functions for allocating and freeing memory with size and + * alignment HV_HYP_PAGE_SIZE. These functions are needed because + * the guest page size may not be the same as the Hyper-V page + * size. We depend upon kmalloc() aligning power-of-two size + * allocations to the allocation size boundary, so that the + * allocated memory appears to Hyper-V as a page of the size + * it expects. + * + * These functions are used by arm64 specific code as well as + * arch independent Hyper-V drivers. + */ + +void *hv_alloc_hyperv_page(void) +{ + BUILD_BUG_ON(PAGE_SIZE < HV_HYP_PAGE_SIZE); + + if (PAGE_SIZE == HV_HYP_PAGE_SIZE) + return (void *)__get_free_page(GFP_KERNEL); + else + return kmalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); +} +EXPORT_SYMBOL_GPL(hv_alloc_hyperv_page); + +void *hv_alloc_hyperv_zeroed_page(void) +{ + if (PAGE_SIZE == HV_HYP_PAGE_SIZE) + return (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); + else + return kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); +} +EXPORT_SYMBOL_GPL(hv_alloc_hyperv_zeroed_page); + +void hv_free_hyperv_page(unsigned long addr) +{ + if (PAGE_SIZE == HV_HYP_PAGE_SIZE) + free_page(addr); + else + kfree((void *)addr); +} +EXPORT_SYMBOL_GPL(hv_free_hyperv_page); + + +/* * hv_do_hypercall- Invoke the specified hypercall */ u64 hv_do_hypercall(u64 control, void *input, void *output) diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index c577996..d345a59 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -101,6 +101,11 @@ static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) extern int vmbus_interrupt; +void *hv_alloc_hyperv_page(void); +void *hv_alloc_hyperv_zeroed_page(void); +void hv_free_hyperv_page(unsigned long addr); + + #if IS_ENABLED(CONFIG_HYPERV) /* * Hypervisor's notion of virtual processor ID is different from From patchwork Mon Aug 24 16:46:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 254260 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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 7FC0CC433E3 for ; Mon, 24 Aug 2020 16:51:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C31020578 for ; Mon, 24 Aug 2020 16:51:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b="KxgBBWRB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725780AbgHXQup (ORCPT ); Mon, 24 Aug 2020 12:50:45 -0400 Received: from mail-dm6nam12on2118.outbound.protection.outlook.com ([40.107.243.118]:61408 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728630AbgHXQtX (ORCPT ); Mon, 24 Aug 2020 12:49:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kCxo/bzpKT91/2jx3+/kQkOPSWfMyWtJaV+/ZapYJ3pp4Hdlr/k1HyVe78j3O0szABfyb4Wrz+lFZlhO/OIcbgUCw5FYNIJLpJw6oqyyuxW8M/mm2jsCRoQi5X3Fie5wo+W8Hy74jZUJ8invYYhzX2XA0lGF2y+20kNpYv/ZEPCFlHB1ja9nJgSNDQqZH2/TyF+5QFsZLWwVtA/3Lrw/jh54x6hvbRnd4VgORMd/zKsXu+86NDRa+bWZyWqIAHrmJNzTJFT3Jr/bnObxeDvGjSseFM+qKb22MRiD8jIlcBAu0JspTPKaQUJUcEI4slBd5VlTBkv+ZwrRcYXlfUGv5g== 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=4tbvHCr+PAkwKsxjK8X5LwxiM17npNhS/8Ql+bo2GO4=; b=OMnulliczjm7xTWzVOnSz5MvvTgwJK8HEtYuHLAZvSsHC0Q7tgy1fbnSyZeudbLMkqrX7v+MCk9+hq6NpAbsh7edmPV2zAPT6RpolZYrong+IHVppoa0i4AxQF/yVHHicj/YE8DncNgZeHnN53+XGLFhHaYS6xmMpw8cPezagsQwIxYOZEvX5Qw5yGufcX1FaQbQu41GuvdzuqzVLUFRL4v9wxUVJ4u3aotKe6sQ+kr2GEnnGcjVMTP1W31lLnm1AeaMcbH7xtULVLI0FTrfzJvAvdSgacnxYL5ShMw7H4cZxr80em2VekjVhP6bN2K7WsLDfNNGYgMdD2x28MQrdQ== 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=4tbvHCr+PAkwKsxjK8X5LwxiM17npNhS/8Ql+bo2GO4=; b=KxgBBWRBFAebvyidGNz7DUXoGHByx7PXRiM2slgp/anB9ojMW4bMIYT1PIvdlIOO3DeYsggaTxWH8c7KR0ISmQOu9r483StcUieYpAfK2vXOKkQyNfZV0yO0MN1rxy6PK4J+gVHBbcALZky7rkNsYCbElGSSh2ei/gggm1ssmVQ= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) by BN6PR21MB0753.namprd21.prod.outlook.com (2603:10b6:404:9c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.4; Mon, 24 Aug 2020 16:48:03 +0000 Received: from BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615]) by BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615%3]) with mapi id 15.20.3326.012; Mon, 24 Aug 2020 16:48:03 +0000 From: Michael Kelley To: will@kernel.org, ardb@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, wei.liu@kernel.org, vkuznets@redhat.com, kys@microsoft.com Cc: mikelley@microsoft.com, sunilmut@microsoft.com, boqun.feng@gmail.com Subject: [PATCH v7 08/10] Drivers: hv: vmbus: Add hooks for per-CPU IRQ Date: Mon, 24 Aug 2020 09:46:21 -0700 Message-Id: <1598287583-71762-9-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> References: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) To BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Mon, 24 Aug 2020 16:47:55 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [131.107.159.16] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e14e6266-aa11-41b3-ec99-08d8484d73e2 X-MS-TrafficTypeDiagnostic: BN6PR21MB0753: 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:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hOjspxDxFRdsXNAyPUaaVwIdLAEE/ETylCxtVn/iK8JfijR8B5u4O2cNMuzGoOTt8r469W3FtUMJ+elgM5+/PnccG2wQhNISmDKWqc/YebbKrMIRKd8yFo7/j5TFAQ/YPQjE22kCljOtHWznO32tBRUtScEohoc2q3bBqMj7TgxUVO4W7iU/h9Pr1wt1Xvsef6WOpNancEQGZVeXSgW8fSGDPNsVsARPZTJF63+42WD44EVlNPncFRZBSQhmIbsQqxO5RlMz8n+OPMVYQcCmUTRgy/9XZvN9InsCo+hcWUyfhiUtjyEzMViNPYqfTWurPqoLzBbve6D26bnNaDDtJBZt888PLHsDWXAmHINBSnazhM80GOH9qO/7jZ7TgJQq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR21MB1281.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(8676002)(86362001)(2616005)(956004)(2906002)(6486002)(8936002)(52116002)(10290500003)(5660300002)(66946007)(16576012)(66556008)(4326008)(6636002)(316002)(36756003)(186003)(82950400001)(478600001)(26005)(6666004)(66476007)(82960400001)(83380400001)(7416002)(921003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 6cgaDNz1sdQaU+LQYgB6hSBciD/nXCPQIUHlV7RIMsi75+/wvTsCC2QAJTPOVWkfs4i8aM9Ad09cgJ+supsDkR6PR9rFiVjUDDlPU+TqVdeoQVmTCqCk/NSiOkkZa21IRs6hrq7njrQ82g/tKO0+AvAWatnp0+Ebiti78w8kxFc+dvuWRMFp4QL32O+PpD7YI0olDmkjsS1IDCN0BFIjVdjJ1zXD5R+RRyPNzaNIFtk39fj6P1RBgQNGoJgyHtmxnVnr+oE1ithzhZ5yx2c7r+uXUxlBAdGpHXzfchk/mo/re2scgo+AbeLiQqzNd9hpc1egfE9jJo6RbMxqM1diEVhgDb93BY4pqu7CjmTsc6ceE5Sl4FGa7wlwWANvguvkHpREJIUNYz85GZzS/q+o5H5diM4ft+f1FBbnE4kGS0eM/JZutIb9VAVfB6P6d4JxHyTh31bT2CSjDOEfH0tNwhxE2e/iLKOML01bw+N9No01jEEpGOaSN/45IuOy2WEXOyAPGoWG7NuqJtxqreoF9rc9oMxjxv7Sc81MmckobtOdXxhl230dABqFEDJTu/gwaPAqs1oCB9l2gsVD5c/9XZnn9HhWygO+0hy+jbK8L3gQCqq0HYLGrC4o3HURG3KwHD3z2OOvCGMzlqAB0CgfYw== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e14e6266-aa11-41b3-ec99-08d8484d73e2 X-MS-Exchange-CrossTenant-AuthSource: BN8PR21MB1281.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2020 16:47:57.0956 (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: T7eQKxiWmlDdNZ348lZpCFOXXLma/0PIvjEa0yMqskPwf5Ew6lCb+FhNGEcW5rdIblB5ZvZsgzBnh0a2qXb7rA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0753 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Add hooks to enable/disable a per-CPU IRQ for VMbus. These hooks are in the architecture independent setup and shutdown paths for Hyper-V, and are needed by Linux guests on Hyper-V on ARM64. The x86/x64 implementation is null because VMbus interrupts on x86/x64 don't use an IRQ. Signed-off-by: Michael Kelley --- arch/x86/include/asm/mshyperv.h | 4 ++++ drivers/hv/hv.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index ffc2899..dd1365c 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -56,6 +56,10 @@ typedef int (*hyperv_fill_flush_list_func)( #define hv_get_raw_timer() rdtsc_ordered() #define hv_get_vector() HYPERVISOR_CALLBACK_VECTOR +/* On x86/x64, there isn't a real IRQ to be enabled/disable */ +static inline void hv_enable_vmbus_irq(void) {} +static inline void hv_disable_vmbus_irq(void) {} + /* * Reference to pv_ops must be inline so objtool * detection of noinstr violations can work correctly. diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 2bd44fd..7499079 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -178,6 +178,7 @@ void hv_synic_enable_regs(unsigned int cpu) hv_set_siefp(siefp.as_uint64); /* Setup the shared SINT. */ + hv_enable_vmbus_irq(); hv_get_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64); shared_sint.vector = hv_get_vector(); @@ -235,6 +236,8 @@ void hv_synic_disable_regs(unsigned int cpu) hv_get_synic_state(sctrl.as_uint64); sctrl.enable = 0; hv_set_synic_state(sctrl.as_uint64); + + hv_disable_vmbus_irq(); } int hv_synic_cleanup(unsigned int cpu) From patchwork Mon Aug 24 16:46:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 254261 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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 32893C433E3 for ; Mon, 24 Aug 2020 16:50:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E8E12067C for ; Mon, 24 Aug 2020 16:50:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b="dgxFO3qZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728803AbgHXQts (ORCPT ); Mon, 24 Aug 2020 12:49:48 -0400 Received: from mail-dm6nam12on2120.outbound.protection.outlook.com ([40.107.243.120]:2560 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728692AbgHXQtY (ORCPT ); Mon, 24 Aug 2020 12:49:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cmh7zPrpkdtYYlbf7EZ2TZykptLuxgUehTkwenJFZGVw/PO8P7lFFjOCpFtXEv4ZY1zO6pTQBoKLT+Z8XcrPgZZhgKJfqIwPL/XoDCtcyChmewoWwaDsBoqSf+ZMpYzmZZA2FVtdngaC9SUAFQS20hZL5V+JZKwWG5UaLxmhKJ4sFHYFnXXd93WFLb2jvnp5aRq1KHxtbk2ooUcHG8sLlIFeMnYN01i7Ke2m+qnMdT5kgxI+VEZA06P6B8qwtQeTGtJH0Gkh0bQq+K9gRy/YP+8rXWw5Kq6JQuEsacScrO7rliRWdpq1VHgTg/E4T0RprTIX7y/juGkexHB+3r1OIw== 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=zEGJ2pGVOoA/475BwOAc1zBZDs85myo5tbrBv9fk6gs=; b=VmYf1PcqSh9FP5C559ZNJVI5gWRxdZIBUt0LxuCVa/1WLVhmYUfjveXaBAKrHPG8u5fnd0dAusInPG9gBltlH8M25rtfdt/MGZh969ZKl5rMVAs22Q7xrmCV/bcRApKbbYTa4qSHEslqvITo2UPwPiIxoSggYUJ2Shyg4scrvqvMIh5TrItTxzcnz0lju7cEeg/I/pA+BZ7p876uGHlvXVq7nXOjLeFPyl0dCMusChfcg5jog7difoBHf+FjJegEOlTWZ60YCS8QH28Hvz7P4nA0BqGRo9uB4C8fPj0KzZCaL0tKlmi27dkxYxdSinj7EMuoknN2do9/Fbyc6Ce1gQ== 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=zEGJ2pGVOoA/475BwOAc1zBZDs85myo5tbrBv9fk6gs=; b=dgxFO3qZBPgZZjoKrqnRciGdmAtMRC05wxJtH9DHVnXdCAcB949fuoFDBrVYRRfIzrt6yaAo1inHz10sxDn0YMKXze0t9qmLbGzFs2TN7SqKzWmUJQCFHbF54a60VDSaMUpiuGjMzyLDqLw4OV4+pkDUgO06TdA7VmepnYDsFEU= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) by BN6PR21MB0753.namprd21.prod.outlook.com (2603:10b6:404:9c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.4; Mon, 24 Aug 2020 16:48:03 +0000 Received: from BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615]) by BN8PR21MB1281.namprd21.prod.outlook.com ([fe80::e0c9:2634:6fb1:5615%3]) with mapi id 15.20.3326.012; Mon, 24 Aug 2020 16:48:03 +0000 From: Michael Kelley To: will@kernel.org, ardb@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, wei.liu@kernel.org, vkuznets@redhat.com, kys@microsoft.com Cc: mikelley@microsoft.com, sunilmut@microsoft.com, boqun.feng@gmail.com Subject: [PATCH v7 09/10] arm64: efi: Export screen_info Date: Mon, 24 Aug 2020 09:46:22 -0700 Message-Id: <1598287583-71762-10-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> References: <1598287583-71762-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) To BN8PR21MB1281.namprd21.prod.outlook.com (2603:10b6:408:a2::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by CO2PR04CA0145.namprd04.prod.outlook.com (2603:10b6:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Mon, 24 Aug 2020 16:47:57 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [131.107.159.16] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b944ed7e-ea53-431e-239d-08d8484d7527 X-MS-TrafficTypeDiagnostic: BN6PR21MB0753: 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: 5eypPP52A/ERruzShY38nJwOGXshoQyh8Jc4vvaZkEItLPdEKiyzPIbzBRK+TO7t4nesnrxq2mlkmY+lKkuZPv5xBqdOPhgsrhvIllh3VBnXRmqm4uEAfmXao7AKbLCnhb4zr3OH+fzTWbton5HZESgoj8TKucWhO0j8+6Pf8LrI+cvh51TWFx3uTzsr2HT6SmicYbbfRb1bnZ0M2Qrz4VWr/CbUKatJ6f2VTbYUtsEOauBfvwbKp46ANTj2tU8djOVkpx0F2p9a/jNjSsk2bwA03aUrH5v+bWdlrjldwb6Re/TVhIqXZnTNJSPwY5dPZpCH8GuxxALBSb7uF6VlJ4gJkdYrex2Hlc5HOvX1Q2WWOrLJs5X4Rv4EgYqEkuDS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR21MB1281.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(8676002)(86362001)(2616005)(956004)(2906002)(6486002)(8936002)(52116002)(10290500003)(5660300002)(66946007)(16576012)(66556008)(4326008)(6636002)(316002)(4744005)(36756003)(186003)(82950400001)(478600001)(26005)(6666004)(66476007)(82960400001)(83380400001)(7416002)(921003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: FjG9xMA2M72cJ656kgx19qu0AmSurrEi3ZkaAVZc+o8Vzdgtd4xWEnNDCmr4nxIvVl5SpipqsCfC0DZLAIoB6EroilhaRRNjzuKG7XZacB6zBu4fW+SIN5wjfUTgvNfY78E6i9op/tW+j9BfOYwmR3OnvHzusnCxMpliWkzu3alXlsiImnWtqnbf7yY1wQw8yG+LVxyGLJLhrtumj1vcp/sU0FOJ21vfJJZXM4ect6+J5p6Nk64shZVPlvdDEIWbxKnSsTDJvr8M1tAjabilr6Odiw9fLjxQiAcr4SqmPjTMeQI7w7HI1iyZDpXNSX9wmZY9S80imUWn2+bw1jumZOsXL5dUa12b186VF2UjlTHGw3m1fRDMt9o1cyE3M6qhMwXm5Z8asPdSnrnFKjsNO4qjl4HjPXLu7tQwg8w9mwGPN1ZZ2TPibSCqaVahc7SrmtNKQGZWsv/fwx/I1At1onwk0WmQ0uBKzQkFBd9CkyOF0BiRIc3tKKxUMvHNleAwuXYF573o+VCuGv8YmULi+kx3aaBV5J4w+4hKJl8tg50Ppri923xAue+8N0nJmYvVKGAjplwyfL7HLylygDHxKIewsW6PobOZBdYN6tV1WzA1Vp9tHITotOcqn2P9zKyNHq+m9YbkTIusv8AzN+BkNQ== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b944ed7e-ea53-431e-239d-08d8484d7527 X-MS-Exchange-CrossTenant-AuthSource: BN8PR21MB1281.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2020 16:47:59.0084 (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: svTdflFckd3ap9GnsidBAs11dw5dvVb8g2CuGtZcnn7a5A9Gty0n8stKeESmdxVmiZQ7jcGvY3TaX8y/NjwW2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0753 Sender: linux-efi-owner@vger.kernel.org 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 --- 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 d0cf596..8ff557a 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) {