[PATCH i-g-t v2 1/2] tests/intel/xe_*: Use NEEDS_VISIBLE_VRAM flag where it's missing
Laguna, Lukasz
lukasz.laguna at intel.com
Mon Jun 16 14:26:24 UTC 2025
On 6/16/2025 11:31, Matthew Auld wrote:
> On 16/06/2025 09:54, Lukasz Laguna wrote:
>> Set DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM flag when creating BOs
>> that will be CPU-mapped, to ensure that the corresponding VRAM
>> allocation will use the CPU accessible part of VRAM.
>>
>> This is essential for small-bar systems, where omitting the flag may
>> cause failures or SIGBUS crashes due to the CPU accessing non-visible
>> VRAM.
>>
>> Suggested-by: Matthew Auld <matthew.auld at intel.com>
>> Signed-off-by: Lukasz Laguna <lukasz.laguna at intel.com>
>
> Reviewed-by: Matthew Auld <matthew.auld at intel.com>
>
Thanks for review. It turned out that few other tests need the same fix,
so I've sent another version. If you have a minute, please take a look:
https://patchwork.freedesktop.org/series/150313/#rev2
>> ---
>> tests/intel/xe_pat.c | 3 ++-
>> tests/intel/xe_spin_batch.c | 3 ++-
>> 2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
>> index 88d8de9dd..8bb0ac167 100644
>> --- a/tests/intel/xe_pat.c
>> +++ b/tests/intel/xe_pat.c
>> @@ -582,7 +582,8 @@ static void prime_self_import_coh(void)
>> fd1 = drm_open_driver(DRIVER_XE);
>> fd2 = drm_open_driver(DRIVER_XE);
>> - dst_handle = xe_bo_create_caching(fd1, 0, size,
>> all_memory_regions(fd1), 0,
>> + dst_handle = xe_bo_create_caching(fd1, 0, size,
>> all_memory_regions(fd1),
>> + DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM,
>> DRM_XE_GEM_CPU_CACHING_WC);
>> dma_buf_fd = prime_handle_to_fd(fd1, dst_handle);
>> diff --git a/tests/intel/xe_spin_batch.c b/tests/intel/xe_spin_batch.c
>> index 21b08ba06..48a888e35 100644
>> --- a/tests/intel/xe_spin_batch.c
>> +++ b/tests/intel/xe_spin_batch.c
>> @@ -442,7 +442,8 @@ static void exec_store(int fd, struct
>> drm_xe_engine_class_instance *eci,
>> vm = xe_vm_create(fd, 0, 0);
>> exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
>> bb_size = xe_bb_size(fd, sizeof(*data));
>> - bb = xe_bo_create(fd, vm, bb_size, vram_if_possible(fd,
>> eci->gt_id), 0);
>> + bb = xe_bo_create(fd, vm, bb_size, vram_if_possible(fd,
>> eci->gt_id),
>> + DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
>> bb_addr = intel_allocator_alloc_with_strategy(ahnd, bb,
>> bb_size, 0,
>> ALLOC_STRATEGY_LOW_TO_HIGH);
>> data = xe_bo_map(fd, bb, bb_size);
>
More information about the igt-dev
mailing list