From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Logan Gunthorpe <logang@deltatee.com>,
linux-pci@vger.kernel.org
Subject: [PATCH v3 1/5] PCI/P2PDMA: Don't enforce ACS check for device functions of Intel GPUs
Date: Wed, 3 Sep 2025 15:30:54 -0700 [thread overview]
Message-ID: <20250903223403.1261824-2-vivek.kasireddy@intel.com> (raw)
In-Reply-To: <20250903223403.1261824-1-vivek.kasireddy@intel.com>
Typically, functions of the same PCI device (such as a PF and a VF)
share the same bus and have a common root port and the PF provisions
resources for the VF. Given this model, they can be considered
compatible as far as P2PDMA access is considered.
Currently, although the distance (2) is correctly calculated for
functions of the same device, an ACS check failure prevents P2P DMA
access between them. Therefore, introduce a small function named
pci_devfns_support_p2pdma() to determine if the provider and client
belong to the same device and facilitate P2PDMA between them by
not enforcing the ACS check.
However, since it is hard to determine if the device functions of
any given PCI device are P2PDMA compatible, we only relax the ACS
check enforcement for device functions of Intel GPUs, specifically
the case where the provider is an Intel GPU VF and the client is
an Intel GPU PF. This is because the P2PDMA communication between
the PF and VF of Intel GPUs is handled internally and does not
typically involve the PCIe fabric.
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: <linux-pci@vger.kernel.org>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
v1 -> v2:
- Relax the enforcment of ACS check only for Intel GPU functions
as they are P2PDMA compatible given the way the PF provisions
the resources among multiple VFs.
v2 -> v3:
- s/pci_devs_are_p2pdma_compatible/pci_devfns_support_p2pdma
- Improve the commit message to explain the reasoning behind
relaxing the ACS check enforcement only for Intel GPU functions.
---
drivers/pci/p2pdma.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index da5657a02007..9484991c4765 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -544,6 +544,18 @@ static unsigned long map_types_idx(struct pci_dev *client)
return (pci_domain_nr(client->bus) << 16) | pci_dev_id(client);
}
+static bool pci_devfns_support_p2pdma(struct pci_dev *provider,
+ struct pci_dev *client)
+{
+ if (provider->vendor == PCI_VENDOR_ID_INTEL) {
+ if ((pci_is_vga(provider) && pci_is_vga(client)) ||
+ (pci_is_display(provider) && pci_is_display(client)))
+ return pci_physfn(provider) == pci_physfn(client);
+ }
+
+ return false;
+}
+
/*
* Calculate the P2PDMA mapping type and distance between two PCI devices.
*
@@ -643,7 +655,7 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client,
*dist = dist_a + dist_b;
- if (!acs_cnt) {
+ if (!acs_cnt || pci_devfns_support_p2pdma(provider, client)) {
map_type = PCI_P2PDMA_MAP_BUS_ADDR;
goto done;
}
@@ -705,7 +717,9 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,
return -1;
for (i = 0; i < num_clients; i++) {
- pci_client = find_parent_pci_dev(clients[i]);
+ pci_client = dev_is_pf(clients[i]) ?
+ pci_dev_get(to_pci_dev(clients[i])) :
+ find_parent_pci_dev(clients[i]);
if (!pci_client) {
if (verbose)
dev_warn(clients[i],
--
2.50.1
next prev parent reply other threads:[~2025-09-03 22:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 22:30 [PATCH v3 0/5] drm/xe/sriov: Don't migrate dmabuf BO to System RAM while running in VM Vivek Kasireddy
2025-09-03 22:30 ` Vivek Kasireddy [this message]
2025-09-04 15:15 ` [PATCH v3 1/5] PCI/P2PDMA: Don't enforce ACS check for device functions of Intel GPUs Logan Gunthorpe
2025-09-05 4:42 ` Kasireddy, Vivek
2025-09-03 22:30 ` [PATCH v3 2/5] drm/xe/dmabuf: Don't migrate BO to System RAM while running in VF mode Vivek Kasireddy
2025-09-03 22:30 ` [PATCH v3 3/5] drm/xe/pf: Add a helper function to get a VF's backing object in LMEM Vivek Kasireddy
2025-09-03 22:52 ` Michal Wajdeczko
2025-09-03 22:30 ` [PATCH v3 4/5] drm/xe/bo: Create new dma_addr array for dmabuf BOs associated with VFs Vivek Kasireddy
2025-09-16 20:25 ` Thomas Hellström
2025-09-17 2:45 ` Matthew Brost
2025-09-03 22:30 ` [PATCH v3 5/5] drm/xe/pt: Add an additional check for dmabuf BOs while doing bind Vivek Kasireddy
2025-09-03 23:18 ` ✗ CI.checkpatch: warning for drm/xe/sriov: Don't migrate dmabuf BO to System RAM while running in VM (rev3) Patchwork
2025-09-03 23:19 ` ✓ CI.KUnit: success " Patchwork
2025-09-04 0:04 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-04 8:56 ` ✗ Xe.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250903223403.1261824-2-vivek.kasireddy@intel.com \
--to=vivek.kasireddy@intel.com \
--cc=bhelgaas@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox