From patchwork Thu Oct 3 19:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Das Neves X-Patchwork-Id: 13821489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDA43CF34C3 for ; Thu, 3 Oct 2024 19:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JiDb5otwBlZ2fSTUj+3NhEfBnILv57r/Yi/wQf7ZOB8=; b=V4xet1TVxnkvXrFmvCv7dtwIuB Ecnh4ICRQBhyb7ly2jxcChcTFOrBRnUoxKQmDmUJk+WUz31xtgs2cP2DQskpebfrrueHZg+FOdwMP 5L7H/uXyeYFHBRhS08AHZ0tkbt/s0jIkQDQkh8DySDOgHXSfZt/NRXh6Q5ugLXSV56CdO38/bIaBr dPJsSYZkmRq7pCjmln0+OoM7BWlP9HtKKwjFvqAm3UkNFWbfaoSjfncFg/J1wqg2DW78lz+28m1R6 wN2jl6XTuJx0AcGSRiMedsEaVsK2M+E1c+6bqi4ykBUB4OsMDvDKLL0xeOcez9BgF2YBAg0NjKpOc gH5MFvbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swRuq-0000000AF7B-15cG; Thu, 03 Oct 2024 19:55:12 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swRqx-0000000AE8s-2tHJ for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2024 19:51:14 +0000 Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 56EE220DB361; Thu, 3 Oct 2024 12:51:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 56EE220DB361 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1727985070; bh=JiDb5otwBlZ2fSTUj+3NhEfBnILv57r/Yi/wQf7ZOB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fuaXyXJoJB29GRcwocoVii/RsZUekk3IOmJWWzJE0tudoe3goRw4VnswdQI/zl3qP 1IIKQQZPEQvpjKzVZ4jMCSlOMaz4s0qNs1eUme/pNK7lCdhymqr3sa1hgaq3EWwMF5 FcZkxopIwM2dQFq1esrekalvhUR4/XEDSc4K5wO8= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, iommu@lists.linux.dev, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, virtualization@lists.linux.dev Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com, peterz@infradead.org, daniel.lezcano@linaro.org, joro@8bytes.org, robin.murphy@arm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, arnd@arndb.de, sgarzare@redhat.com, jinankjain@linux.microsoft.com, muminulrussell@gmail.com, skinsburskii@linux.microsoft.com, mukeshrathor@microsoft.com Subject: [PATCH 4/5] hyperv: Add hv_defs.h to conditionally include hyperv-tlfs.h or hvhdk.h Date: Thu, 3 Oct 2024 12:51:03 -0700 Message-Id: <1727985064-18362-5-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1727985064-18362-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1727985064-18362-1-git-send-email-nunodasneves@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241003_125111_864087_9CFEC496 X-CRM114-Status: GOOD ( 17.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Include one or the other depending on whether HYPERV_NONTLFS_HEADERS is defined. This will allow Hyper-V code to use the new headers while other code can continue using hyperv-tlfs.h which is only for Hyper-V guests. Replace hyperv-tlfs.h in shared headers with hv_defs.h These headers are shared between Hyper-V code and non-Hyper-V code (KVM for example). This will allow switching to the new headers in Hyper-V code only. Signed-off-by: Nuno Das Neves --- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/svm.h | 2 +- include/asm-generic/mshyperv.h | 2 +- include/clocksource/hyperv_timer.h | 2 +- include/hyperv/hv_defs.h | 29 +++++++++++++++++++++++++++++ 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 include/hyperv/hv_defs.h diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h index a975e1a689dd..13b2b2218d85 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -20,7 +20,7 @@ #include #include -#include +#include /* * Declare calls to get and set Hyper-V VP register values on ARM64, which diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 47ca48062547..dc8587f02850 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -6,9 +6,9 @@ #include #include #include -#include #include #include +#include /* * Hyper-V always provides a single IO-APIC at this MMIO address. diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index f0dea3750ca9..c682fc080310 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -5,7 +5,7 @@ #include #include -#include +#include /* * 32-bit intercept words in the VMCB Control Area, starting diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 8fe7aaab2599..8bd308ae1056 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #define VTPM_BASE_ADDRESS 0xfed40000 diff --git a/include/clocksource/hyperv_timer.h b/include/clocksource/hyperv_timer.h index 6cdc873ac907..068ca1934c23 100644 --- a/include/clocksource/hyperv_timer.h +++ b/include/clocksource/hyperv_timer.h @@ -15,7 +15,7 @@ #include #include -#include +#include #define HV_MAX_MAX_DELTA_TICKS 0xffffffff #define HV_MIN_DELTA_TICKS 1 diff --git a/include/hyperv/hv_defs.h b/include/hyperv/hv_defs.h new file mode 100644 index 000000000000..eed500288499 --- /dev/null +++ b/include/hyperv/hv_defs.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This file includes Microsoft Hypervisor definitions from hyperv-tlfs.h, or + * hvhdk.h when HYPERV_NONTLFS_HEADERS is defined. + */ +/* + * NOTE: + * The typical #ifdef guard to prevent redefinition errors is intentionally + * omitted. This makes compiler error (either via #error or redefinition) in + * the case where hyperv-tlfs.h is accidentally included, followed by + * definition of HYPERV_NON_TLFS_HEADERS and inclusion of this file. + * If this file could only be included once, the compiler would ignore the + * attempt to use HYPERV_NONTLFS_HEADERS to include hvhdk.h. + */ + +#ifdef HYPERV_NONTLFS_HEADERS + +#ifdef HYPERV_TLFS_HEADERS_INCLUDED +#error "hyperv-tlfs.h was already included before HYPERV_NONTLFS_HEADERS was defined" +#else +#include +#endif + +#else /* HYPERV_NONTLFS_HEADERS */ + +#include +#define HYPERV_TLFS_HEADERS_INCLUDED + +#endif /* !HYPERV_NONTLFS_HEADERS */