From patchwork Thu Jul 27 19:54:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Das Neves X-Patchwork-Id: 127137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1332946vqo; Thu, 27 Jul 2023 12:59:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlG4jlumZLjoEWXL5ToMwwejbcRroPfHRDpQ6qvjz797BGZ8QAD3X3PPdrXqwF2Ilf+yWAOX X-Received: by 2002:a17:906:2202:b0:99b:d1ef:520b with SMTP id s2-20020a170906220200b0099bd1ef520bmr172775ejs.31.1690487991724; Thu, 27 Jul 2023 12:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690487991; cv=none; d=google.com; s=arc-20160816; b=FFRUMOxjpNK3P2LWL2r1pBCQUzh4/9G2ypzgM+GvZhwf7jSeAoXF5zfjnNikIkLRaU IKfOvUhKPeN5QDl4n5aDkNeGLRP8SoePmPulqehNaeNyisrTXyLXoOR6J6nD9NBcs/pe 5h9axPdCUtwGvPszH+zUIC9CsoMbc/1/XCYRF1IQNFKHBYQy32qrU9jTrGymJadx4GOs ruDniFUotBOEW2QUAkio8XDk+y/cmotkpjGcyzmE8kLKjq9j4ky225veqH/AAGs2VNBU IhiGw5Seas8VSeKlFkCntLXidNo9aUttxKsXQLT85afvnQrZGN11xvdV/uXPSe7eaphw iXKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=wGfZhJLEaC76tXaMBUSgR/sQMRomiL0nmnXuuYZ5TlE=; fh=y8tS7hHyMnVm4J/EG8JBk7xmqgMCnIiFB1dTM3zggRY=; b=SETFntKW19mVpTGnXKjU1JNKwiOT4Q0xPXRg81erl1bIxr8KZ/cbnTYQSmafTvGjhe cmuWBrDLijDGDCFdFRLWcQBsBuOq9LbS51daQU3l/AyeCWN7g0UFIQMCXzGaJAymJ6Gs /2NLoivFIuYfiP8C1/iKzHv2SPMeKO0FXWJkzVFN6exIWNmfU1KO7M0uRa3oDPnDs+4/ HD0hjV631SQI4uJZ6sa/ww5JHpb79u1oeM7xGVyiMk3I8Li0ISe2NLI7WlEcsLqzhvYQ VryhXlu6snuMmwffiPW0YqrX0kWM00IopKBYWqZydv8NCJP5LwJdGka/BAfiMbxCiFch L68w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=somuhVoS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga6-20020a170906b84600b00992d26308c0si1525267ejb.538.2023.07.27.12.59.27; Thu, 27 Jul 2023 12:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=somuhVoS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbjG0Tzq (ORCPT + 99 others); Thu, 27 Jul 2023 15:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232185AbjG0TzC (ORCPT ); Thu, 27 Jul 2023 15:55:02 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65EC02D7B; Thu, 27 Jul 2023 12:55:00 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id E17252384267; Thu, 27 Jul 2023 12:54:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E17252384267 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1690487697; bh=wGfZhJLEaC76tXaMBUSgR/sQMRomiL0nmnXuuYZ5TlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=somuhVoSD73dYczAjl0JO509Rh6HViWVDmb6fZwsw5hEFI4CNplqoiStzHQon+Y1W HYr3dJju+K/vr39gLNZxq8d52LU+4Kj7qJV+MfQrd7aNEg33x+432473gRKGTAts3l 9Oif5XkDmhjpPJg5wbTsWo2WQ39W2MQNf0BmcKbo= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Cc: mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com Subject: [PATCH 14/15] asm-generic: hyperv: Use mshv headers conditionally. Add asm-generic/hyperv-defs.h Date: Thu, 27 Jul 2023 12:54:49 -0700 Message-Id: <1690487690-2428-15-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772605136374979735 X-GMAIL-MSGID: 1772605136374979735 In order to keep unstable hyper-v interfaces independent of hyperv-tlfs.h, hvhdk.h must replace hyperv-tlfs.h eveywhere it will be used in the mshv driver. Add hyperv-defs.h to replace some inclusions of hyperv-tlfs.h. It includes hyperv-tlfs.h or hvhdk.h depending on a compile-time constant HV_HYPERV_DEFS which will be defined in the mshv driver. Signed-off-by: Nuno Das Neves --- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/mshyperv.h | 3 +-- drivers/hv/hyperv_vmbus.h | 1 - include/asm-generic/hyperv-defs.h | 26 ++++++++++++++++++++++++++ include/asm-generic/mshyperv.h | 2 +- include/linux/hyperv.h | 2 +- 6 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/asm-generic/hyperv-defs.h diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h index 20070a847304..8ec14caf3d4f 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 1a0655a93672..d4fa6e46e7e2 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -6,10 +6,9 @@ #include #include #include -#include #include #include -#include +#include /* * Hyper-V always provides a single IO-APIC at this MMIO address. diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 85f3c08bb42b..49529f0b8b99 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/include/asm-generic/hyperv-defs.h b/include/asm-generic/hyperv-defs.h new file mode 100644 index 000000000000..ac6fcba35c8c --- /dev/null +++ b/include/asm-generic/hyperv-defs.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_HYPERV_DEFS_H +#define _ASM_GENERIC_HYPERV_DEFS_H + +/* + * There are cases where Microsoft Hypervisor ABIs are needed which may not be + * stable or present in the Hyper-V TLFS document. E.g. the mshv_root driver. + * + * As these interfaces are unstable and may differ from hyperv-tlfs.h, they + * must be kept separate and independent. + * + * However, code from files that depend on hyperv-tlfs.h (such as mshyperv.h) + * is still needed, so work around the issue by conditionally including the + * correct definitions. + * + * Note: Since they are independent of each other, there are many definitions + * duplicated in both hyperv-tlfs.h and uapi/hyperv/hv*.h files. + */ +#ifdef HV_HYPERV_DEFS +#include +#else +#include +#endif + +#endif /* _ASM_GENERIC_HYPERV_DEFS_H */ + diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 2b20994d809e..e86b6f51fb64 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/linux/hyperv.h b/include/linux/hyperv.h index f90de5abcd50..66ed8b3e5d89 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #define MAX_PAGE_BUFFER_COUNT 32 #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */