diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index a56d01dfb6f..740fea5ccf0 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2472,3 +2472,16 @@ anv_device_get_pat_entry(struct anv_device *device, else return &device->info->pat.writecombining; } + +struct intel_pagefault_buffer * +anv_device_alloc_get_vm_faults(struct anv_device *device) +{ + if (!device->physical->can_get_vm_faults) + return NULL; + switch (device->info->kmd_type) { + case INTEL_KMD_TYPE_XE: + return anv_xe_device_alloc_get_vm_faults(device); + default: + return NULL; + } +} diff --git a/src/intel/vulkan/anv_physical_device.c b/src/intel/vulkan/anv_physical_device.c index ece893f3e0a..67ddf75ce08 100644 --- a/src/intel/vulkan/anv_physical_device.c +++ b/src/intel/vulkan/anv_physical_device.c @@ -12,6 +12,7 @@ #include "common/intel_common.h" #include "common/intel_uuid.h" +#include "common/xe/intel_gem.h" #include "common/xe/intel_queue.h" #include "perf/intel_perf.h" @@ -2977,6 +2978,9 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, device->info.ver < 20 || device->info.kmd_type == INTEL_KMD_TYPE_I915 || instance->drirc.features.scratch_page; + device->can_get_vm_faults = + !device->has_scratch_page && xe_gem_supports_get_vm_faults(device->local_fd); + device->compiler = brw_compiler_create(NULL, &device->info); if (device->compiler == NULL) { result = vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index e2255c866bc..0c28072ccd9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -47,6 +47,7 @@ #include "common/intel_l3_config.h" #include "common/intel_measure.h" #include "common/intel_sample_positions.h" +#include "common/intel_pagefault.h" #include "decoder/intel_decoder.h" #include "dev/intel_device_info.h" #include "blorp/blorp.h" @@ -1553,6 +1554,8 @@ struct anv_physical_device { bool has_scratch_page; + bool can_get_vm_faults; + /** Whether the device can support compression control */ bool has_compression_control; /** Whether the device expose support for compression control */ @@ -7150,6 +7153,8 @@ anv_device_utrace_emit_gfx_copy_buffer(struct u_trace_context *utctx, void *ts_from, uint64_t from_offset_B, void *ts_to, uint64_t to_offset_B, uint64_t size_B); +struct intel_pagefault_buffer * +anv_device_alloc_get_vm_faults(struct anv_device *device); void anv_device_update_fault_state(struct anv_device *device, diff --git a/src/intel/vulkan/xe/anv_device.c b/src/intel/vulkan/xe/anv_device.c index c979a530770..f33edd0f4a6 100644 --- a/src/intel/vulkan/xe/anv_device.c +++ b/src/intel/vulkan/xe/anv_device.c @@ -28,6 +28,7 @@ #include "drm-uapi/xe_drm.h" #include "common/xe/intel_device_query.h" +#include "common/xe/intel_gem.h" bool anv_xe_device_destroy_vm(struct anv_device *device) { @@ -227,3 +228,9 @@ anv_xe_device_check_status(struct vk_device *vk_device) return result; } + +struct intel_pagefault_buffer * +anv_xe_device_alloc_get_vm_faults(struct anv_device *device) +{ + return xe_gem_alloc_get_vm_faults(device->fd, device->vm_id); +} diff --git a/src/intel/vulkan/xe/anv_device.h b/src/intel/vulkan/xe/anv_device.h index 5ed069d727d..d662570c471 100644 --- a/src/intel/vulkan/xe/anv_device.h +++ b/src/intel/vulkan/xe/anv_device.h @@ -27,13 +27,16 @@ #include "vulkan/vulkan_core.h" #include "vk_device.h" +#include "common/intel_pagefault.h" + struct anv_device; struct anv_physical_device; bool anv_xe_device_destroy_vm(struct anv_device *device); VkResult anv_xe_device_setup_vm(struct anv_device *device); VkResult anv_xe_device_check_status(struct vk_device *vk_device); - +struct intel_pagefault_buffer * +anv_xe_device_alloc_get_vm_faults(struct anv_device *device); VkResult anv_xe_physical_device_get_parameters(struct anv_physical_device *device); VkResult