]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/xe/tests: Make cross-device dma-buf BOs CPU-visible on small BAR
authorMarcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Thu, 14 Aug 2025 14:59:50 +0000 (16:59 +0200)
committerMichał Winiarski <michal.winiarski@intel.com>
Thu, 28 Aug 2025 11:21:20 +0000 (13:21 +0200)
Small-BAR systems (e.g., SR-IOV VFs in VMs) expose only a subset of
VRAM via PCI/BAR. Exporting a BO outside that window fails, and the
selftests also do CPU fill/verify.

Set XE_BO_FLAG_NEEDS_CPU_ACCESS for cross-device variants to force
CPU-mappable placement and keep tests reliable. Large-BAR/P2P setups
are unaffected.

Suggested-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://lore.kernel.org/r/20250814145950.430231-1-marcin.bernatowicz@linux.intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
drivers/gpu/drm/xe/tests/xe_dma_buf.c

index cde9530bef8c43c1d1cf6b80374ab902b2d6802e..3c5ad8cc65a04c50d69faa4619c3c47ecbd5bec2 100644 (file)
@@ -204,7 +204,7 @@ static const struct dma_buf_attach_ops nop2p_attach_ops = {
 static const struct dma_buf_test_params test_params[] = {
        {.mem_mask = XE_BO_FLAG_VRAM0,
         .attach_ops = &xe_dma_buf_attach_ops},
-       {.mem_mask = XE_BO_FLAG_VRAM0,
+       {.mem_mask = XE_BO_FLAG_VRAM0 | XE_BO_FLAG_NEEDS_CPU_ACCESS,
         .attach_ops = &xe_dma_buf_attach_ops,
         .force_different_devices = true},
 
@@ -236,7 +236,8 @@ static const struct dma_buf_test_params test_params[] = {
 
        {.mem_mask = XE_BO_FLAG_SYSTEM | XE_BO_FLAG_VRAM0,
         .attach_ops = &xe_dma_buf_attach_ops},
-       {.mem_mask = XE_BO_FLAG_SYSTEM | XE_BO_FLAG_VRAM0,
+       {.mem_mask = XE_BO_FLAG_SYSTEM | XE_BO_FLAG_VRAM0 |
+                    XE_BO_FLAG_NEEDS_CPU_ACCESS,
         .attach_ops = &xe_dma_buf_attach_ops,
         .force_different_devices = true},