mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs
@ 2026-10-20 17:37 Pavel Popov
  2026-10-20 17:37 ` [PATCH v4 1/2] PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma() Pavel Popov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Popov @ 2026-10-20 17:37 UTC (permalink / raw)
  To: Bjorn Helgaas, Logan Gunthorpe
  Cc: Pavel Popov, Leon Romanovsky, Lukas Wunner, Jim Chow,
	Radu Rugina, Alexey Makhalov, Wei Liu, Michael Kelley,
	Nathan Ciobanu, bcm-kernel-feedback-list, virtualization,
	linux-hyperv, linux-pci, linux-kernel

VMware and Hyper-V expose passthrough devices to guest VMs without an
explicit host bridge device. Consequently, host_bridge_whitelist()
cannot automatically identify the underlying host bridge structure,
causing Peer-to-Peer DMA (P2PDMA) requests to be rejected unless the
device IDs are explicitly listed in pci_p2pdma_whitelist[]. To enable
P2PDMA on Intel hosts, this series extends cpu_supports_p2pdma(), which
so far covers AMD Zen and newer, with an explicit list of Intel Xeon
server generations.

Patch 1 moves the CONFIG_X86 #ifdef out of cpu_supports_p2pdma().
Patch 2 is the v3 patch rebased on it, with Logan's Reviewed-by carried
over; the Xeon list and the check are unchanged.

Changes in v4:
- Add 1/2, moving the CONFIG_X86 #ifdef out of cpu_supports_p2pdma()
  (Logan Gunthorpe, Leon Romanovsky)
- Keep the #ifdef around the asm/ includes, as these headers exist
  only on x86 (Bjorn Helgaas)

Changes in v3:
- Drop the hypervisor check and move the Xeon list into
  cpu_supports_p2pdma(), next to the AMD check, as suggested by Logan
  Gunthorpe and Leon Romanovsky [1]
- Fold the VMware and Hyper-V patches into one, as the check no longer
  depends on the hypervisor

Changes in v2:
- Replace the Skylake-and-newer threshold with an explicit list of Intel
  Xeon server generations, from Skylake-SP to Diamond Rapids (Logan
  Gunthorpe)
- Move the CONFIG_X86 #ifdef out of hypervisor_supports_p2pdma()
  (Logan Gunthorpe)
- Rebased on current mainline

[1] https://lore.kernel.org/r/20261016153147.GC219304@unreal

v3: https://lore.kernel.org/r/20261020151305.65218-1-pavel.e.popov@intel.com
v2: https://lore.kernel.org/r/20261016223402.19991-1-pavel.e.popov@intel.com
v1: https://lore.kernel.org/r/20261009154034.82321-1-pavel.e.popov@intel.com

Pavel Popov (2):
  PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma()
  PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs

 drivers/pci/p2pdma.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)


base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 1/2] PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma()
  2026-10-20 17:37 [PATCH v4 0/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
@ 2026-10-20 17:37 ` Pavel Popov
  2026-10-20 17:37 ` [PATCH v4 2/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
  2026-10-20 18:40 ` [PATCH v4 0/2] " Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Popov @ 2026-10-20 17:37 UTC (permalink / raw)
  To: Bjorn Helgaas, Logan Gunthorpe
  Cc: Pavel Popov, Leon Romanovsky, Lukas Wunner, Jim Chow,
	Radu Rugina, Alexey Makhalov, Wei Liu, Michael Kelley,
	Nathan Ciobanu, bcm-kernel-feedback-list, virtualization,
	linux-hyperv, linux-pci, linux-kernel

cpu_supports_p2pdma() has an #ifdef CONFIG_X86 block inside the
function body. Put the whole function under #ifdef CONFIG_X86 instead,
with a stub returning false for !CONFIG_X86.

No functional change.

Suggested-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Pavel Popov <pavel.e.popov@intel.com>
---
 drivers/pci/p2pdma.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 9334eb314663..6b4f0843b404 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -519,18 +519,23 @@ static void seq_buf_print_bus_devfn(struct seq_buf *buf, struct pci_dev *pdev)
 	seq_buf_printf(buf, "%s;", pci_name(pdev));
 }
 
+#ifdef CONFIG_X86
 static bool cpu_supports_p2pdma(void)
 {
-#ifdef CONFIG_X86
 	struct cpuinfo_x86 *c = &cpu_data(0);
 
 	/* Any AMD CPU whose family ID is Zen or newer supports p2pdma */
 	if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17)
 		return true;
-#endif
 
 	return false;
 }
+#else /* !CONFIG_X86 */
+static bool cpu_supports_p2pdma(void)
+{
+	return false;
+}
+#endif /* CONFIG_X86 */
 
 static const struct pci_p2pdma_whitelist_entry {
 	unsigned short vendor;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 2/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs
  2026-10-20 17:37 [PATCH v4 0/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
  2026-10-20 17:37 ` [PATCH v4 1/2] PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma() Pavel Popov
@ 2026-10-20 17:37 ` Pavel Popov
  2026-10-20 18:40 ` [PATCH v4 0/2] " Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Popov @ 2026-10-20 17:37 UTC (permalink / raw)
  To: Bjorn Helgaas, Logan Gunthorpe
  Cc: Pavel Popov, Leon Romanovsky, Lukas Wunner, Jim Chow,
	Radu Rugina, Alexey Makhalov, Wei Liu, Michael Kelley,
	Nathan Ciobanu, bcm-kernel-feedback-list, virtualization,
	linux-hyperv, linux-pci, linux-kernel

Peer-to-Peer DMA (P2PDMA) between two devices requires either a shared
upstream bridge or a host bridge matching pci_p2pdma_whitelist[]. In
VMware guests, passthrough devices appear directly on virtual root
buses without host bridge devices. In Hyper-V guests, each passthrough
device appears in a PCI domain of its own without a host bridge
device. Consequently, P2PDMA checks evaluate endpoint Device IDs
against the host bridge whitelist, causing P2PDMA requests to fail
regardless of host support.

This affects discrete devices such as GPUs, NICs and NVMe drives.

Add an explicit list of the Intel Xeon server generations from
Skylake-SP to Diamond Rapids to cpu_supports_p2pdma(). These are the
CPUs whose host bridges are in pci_p2pdma_whitelist[] without
restrictions. AMD Zen and newer are already covered by
cpu_supports_p2pdma(), so only Intel entries are needed.

Tested with the Intel Level Zero P2P benchmark (ze_peer) on Arc Pro B60
cards in a Linux guest on VMware ESXi 9.0 (Emerald Rapids host).

Signed-off-by: Pavel Popov <pavel.e.popov@intel.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/pci/p2pdma.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 6b4f0843b404..cb9084fb0990 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -21,6 +21,11 @@
 #include <linux/seq_buf.h>
 #include <linux/xarray.h>
 
+#ifdef CONFIG_X86
+#include <asm/cpu_device_id.h>
+#include <asm/intel-family.h>
+#endif
+
 struct pci_p2pdma {
 	struct gen_pool *pool;
 	bool p2pmem_published;
@@ -520,6 +525,21 @@ static void seq_buf_print_bus_devfn(struct seq_buf *buf, struct pci_dev *pdev)
 }
 
 #ifdef CONFIG_X86
+/* Intel Xeon CPUs whose host bridges support p2pdma */
+static const struct x86_cpu_id p2pdma_intel_cpu_ids[] = {
+	X86_MATCH_VFM(INTEL_SKYLAKE_X, NULL),
+	X86_MATCH_VFM(INTEL_ICELAKE_X, NULL),
+	X86_MATCH_VFM(INTEL_ICELAKE_D, NULL),
+	X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X, NULL),
+	X86_MATCH_VFM(INTEL_EMERALDRAPIDS_X, NULL),
+	X86_MATCH_VFM(INTEL_GRANITERAPIDS_X, NULL),
+	X86_MATCH_VFM(INTEL_GRANITERAPIDS_D, NULL),
+	X86_MATCH_VFM(INTEL_ATOM_CRESTMONT_X, NULL),
+	X86_MATCH_VFM(INTEL_ATOM_DARKMONT_X, NULL),
+	X86_MATCH_VFM(INTEL_DIAMONDRAPIDS_X, NULL),
+	{}
+};
+
 static bool cpu_supports_p2pdma(void)
 {
 	struct cpuinfo_x86 *c = &cpu_data(0);
@@ -528,6 +548,10 @@ static bool cpu_supports_p2pdma(void)
 	if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17)
 		return true;
 
+	/* Listed Intel Xeon CPUs support p2pdma */
+	if (x86_match_cpu(p2pdma_intel_cpu_ids))
+		return true;
+
 	return false;
 }
 #else /* !CONFIG_X86 */
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4 0/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs
  2026-10-20 17:37 [PATCH v4 0/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
  2026-10-20 17:37 ` [PATCH v4 1/2] PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma() Pavel Popov
  2026-10-20 17:37 ` [PATCH v4 2/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
@ 2026-10-20 18:40 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2026-10-20 18:40 UTC (permalink / raw)
  To: Pavel Popov
  Cc: Bjorn Helgaas, Logan Gunthorpe, Lukas Wunner, Jim Chow,
	Radu Rugina, Alexey Makhalov, Wei Liu, Michael Kelley,
	Nathan Ciobanu, bcm-kernel-feedback-list, virtualization,
	linux-hyperv, linux-pci, linux-kernel

On Tue, Oct 20, 2026 at 10:37:34AM -0700, Pavel Popov wrote:
> VMware and Hyper-V expose passthrough devices to guest VMs without an
> explicit host bridge device. Consequently, host_bridge_whitelist()
> cannot automatically identify the underlying host bridge structure,
> causing Peer-to-Peer DMA (P2PDMA) requests to be rejected unless the
> device IDs are explicitly listed in pci_p2pdma_whitelist[]. To enable
> P2PDMA on Intel hosts, this series extends cpu_supports_p2pdma(), which
> so far covers AMD Zen and newer, with an explicit list of Intel Xeon
> server generations.
> 
> Patch 1 moves the CONFIG_X86 #ifdef out of cpu_supports_p2pdma().
> Patch 2 is the v3 patch rebased on it, with Logan's Reviewed-by carried
> over; the Xeon list and the check are unchanged.
> 
> Changes in v4:
> - Add 1/2, moving the CONFIG_X86 #ifdef out of cpu_supports_p2pdma()
>   (Logan Gunthorpe, Leon Romanovsky)
> - Keep the #ifdef around the asm/ includes, as these headers exist
>   only on x86 (Bjorn Helgaas)

I'm confident that this is wrong usage of asm headers.

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-20 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 17:37 [PATCH v4 0/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
2026-10-20 17:37 ` [PATCH v4 1/2] PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma() Pavel Popov
2026-10-20 17:37 ` [PATCH v4 2/2] PCI/P2PDMA: Allow P2PDMA on Intel Xeon server CPUs Pavel Popov
2026-10-20 18:40 ` [PATCH v4 0/2] " Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®