amdgpu: add support for querying VM faults information

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
main
Samuel Pitoiset 2023-02-24 10:01:53 +01:00
parent 22b698a599
commit 8d8357dc64
3 changed files with 31 additions and 0 deletions

View File

@ -63,6 +63,7 @@ amdgpu_query_crtc_from_id
amdgpu_query_firmware_version amdgpu_query_firmware_version
amdgpu_query_gds_info amdgpu_query_gds_info
amdgpu_query_gpu_info amdgpu_query_gpu_info
amdgpu_query_gpuvm_fault_info
amdgpu_query_heap_info amdgpu_query_heap_info
amdgpu_query_hw_ip_count amdgpu_query_hw_ip_count
amdgpu_query_hw_ip_info amdgpu_query_hw_ip_info

View File

@ -1282,6 +1282,22 @@ int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned sensor_type,
int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned cap_type, int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned cap_type,
unsigned size, void *value); unsigned size, void *value);
/**
* Query information about VM faults
*
* The return sizeof(struct drm_amdgpu_info_gpuvm_fault)
*
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
* \param size - \c [in] Size of the returned value.
* \param value - \c [out] Pointer to the return value.
*
* \return 0 on success\n
* <0 - Negative POSIX Error code
*
*/
int amdgpu_query_gpuvm_fault_info(amdgpu_device_handle dev, unsigned size,
void *value);
/** /**
* Read a set of consecutive memory-mapped registers. * Read a set of consecutive memory-mapped registers.
* Not all registers are allowed to be read by userspace. * Not all registers are allowed to be read by userspace.

View File

@ -346,3 +346,17 @@ drm_public int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned c
return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request, return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
sizeof(struct drm_amdgpu_info)); sizeof(struct drm_amdgpu_info));
} }
drm_public int amdgpu_query_gpuvm_fault_info(amdgpu_device_handle dev,
unsigned size, void *value)
{
struct drm_amdgpu_info request;
memset(&request, 0, sizeof(request));
request.return_pointer = (uintptr_t)value;
request.return_size = size;
request.query = AMDGPU_INFO_GPUVM_FAULT;
return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
sizeof(struct drm_amdgpu_info));
}