[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] xen/x86: detect support for extended destination ID


  • To: <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 20 Jan 2022 16:25:27 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4VvoRpfnAFYjA56B6n0lZOMr30iQW4q/VSNlk+HRrAg=; b=NBD47KVivOyYrfin8ktorCM0qumgleZcp6JcwQQo8gIwx59pG21S6xqoZen2UVGioB3PHzIhJN+kl+CE8+d5r8zvxJigXKmBpXj9Db9dppJo0DBYwl/luJCxlWz+bX857wzFRou2dtLfjN188ANH4Y4wpSm5Pmywhe4POrF/v6MkAivTRHZaznVWPGndHt+jSsfpSZF/C0sgaTmJjTjuTKYGMob4VFpl5HcLcxi563q6jFGLEBlhXZr/toR0HyraLGA9prsqhUAeuIMX5iyZrSjkHZiIfRNVN/wJGmn7T/W70QwqplWht2sArqYfZwk4N8YmzOYkYfuHyHp0tXg/MA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=COHDNRZ9RXeyuKkGIgUtXcs0sLQncwJX5u4QmFnVYqf0It+wdkfc20emQUCKT9FvGfngU3B7xMDnU+BpBg9VOnDyq7E2ZRehqw1xvSb+8sh/M5BgfiPk4eBMnx32ZIflumhrk/nEsS306a5wFJGxXWF6/1+DmhTgwyQVUKXT/QW0RPITsyJYHC2ilDkV4Gz5QJYUvadlQr1K2uACdw4aJNjU+Ox/1Q09+rS1KtOFjyWy6pNAhjy4v6KB7Oqje2jO0MzTn2fJ1QFPKL/VKXfmse0Fh5OZwruqRzyFODnojMdzFbNTyNstQjUHyHn/ayQDlPG3b49QfwASyhw+2UT9hQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 20 Jan 2022 15:25:56 +0000
  • Ironport-data: A9a23:oWTX4ak9vZfsYTYcglg7Ri3o5gycIERdPkR7XQ2eYbSJt1+Wr1Gzt xJOXGHSOf7cZmume48lbY6+o0tXvMCHzd9nTFdkqSxjFSMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA180IMsdoUg7wbRh29Qw2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 NRPrMeQS1k0AvLVnv0BfjZjPgNPJLITrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBNPsM44F/Glp0BnSDOo8QICFSKLPjTNd9Glq2pgfQa2CD yYfQQtCXC7yTA0IA0UKE58mvdmnnnLtdAQN/Tp5ooJoujOOnWSdyoPFPNPLd5qKTMNOk0Cwo m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xsHEKGuM4okV4No2imYxxW JDXmLCFmfhjiLABDhbzARGARJr98hS8IWSb9Z95D7XbHBEhMMLGXx9m/W2WzNctIJQhdGVNrH9 qlf0oaiSjEkyJCIrvQe/x+Bj
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Xen allows the usage of some previously reserved bits in the IO-APIC
RTE and the MSI address fields in order to store high bits for the
target APIC ID. Such feature is already implemented by QEMU/KVM and
HyperV, so in order to enable it just add the handler that checks for
it's presence.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Must not be applied until the public headers are changed in Xen.
---
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
---
 arch/x86/include/asm/xen/cpuid.h | 7 +++++++
 arch/x86/xen/enlighten_hvm.c     | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/x86/include/asm/xen/cpuid.h b/arch/x86/include/asm/xen/cpuid.h
index a9630104f1c4..78e667a31d6c 100644
--- a/arch/x86/include/asm/xen/cpuid.h
+++ b/arch/x86/include/asm/xen/cpuid.h
@@ -100,6 +100,13 @@
 /* Memory mapped from other domains has valid IOMMU entries */
 #define XEN_HVM_CPUID_IOMMU_MAPPINGS   (1u << 2)
 #define XEN_HVM_CPUID_VCPU_ID_PRESENT  (1u << 3) /* vcpu id is present in EBX 
*/
+#define XEN_HVM_CPUID_DOMID_PRESENT    (1u << 4) /* domid is present in ECX */
+/*
+ * Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be
+ * used to store high bits for the Destination ID. This expands the Destination
+ * ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
+ */
+#define XEN_HVM_CPUID_EXT_DEST_ID      (1u << 5)
 
 /*
  * Leaf 6 (0x40000x05)
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index ab8171cbee23..0c5b0ee3a02a 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -254,6 +254,11 @@ bool __init xen_hvm_need_lapic(void)
        return true;
 }
 
+static bool __init msi_ext_dest_id(void)
+{
+       return cpuid_eax(xen_cpuid_base() + 4) & XEN_HVM_CPUID_EXT_DEST_ID;
+}
+
 static __init void xen_hvm_guest_late_init(void)
 {
 #ifdef CONFIG_XEN_PVH
@@ -316,6 +321,7 @@ struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {
        .init.x2apic_available  = xen_x2apic_para_available,
        .init.init_mem_mapping  = xen_hvm_init_mem_mapping,
        .init.guest_late_init   = xen_hvm_guest_late_init,
+       .init.msi_ext_dest_id   = msi_ext_dest_id,
        .runtime.pin_vcpu       = xen_pin_vcpu,
        .ignore_nopv            = true,
 };
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.