[PATCH] drm/xe/tests: Make cross-device dma-buf BOs CPU-visible on small BAR
Matthew Auld
matthew.auld at intel.com
Thu Aug 14 15:37:31 UTC 2025
On 14/08/2025 15:59, Marcin Bernatowicz wrote:
> 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 at intel.com>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> ---
> drivers/gpu/drm/xe/tests/xe_dma_buf.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/tests/xe_dma_buf.c b/drivers/gpu/drm/xe/tests/xe_dma_buf.c
> index c53f67ce4b0a..4c3b16835c93 100644
> --- a/drivers/gpu/drm/xe/tests/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/tests/xe_dma_buf.c
> @@ -206,7 +206,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},
>
> @@ -238,7 +238,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,
An alternative might to always apply this unconditionally when calling
create_user(), just to ensure that the failure cases like with nop2p are
failing for the right reasons, and not because we didn't supply
CPU_ACCESS or something.
Anyway, assuming it all passes now,
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
> .attach_ops = &xe_dma_buf_attach_ops,
> .force_different_devices = true},
>
More information about the Intel-xe
mailing list