[PATCH v2 7/7] drm/xe/uapi: Add a query flag for has_device_atomics_on_smem
Nirmoy Das
nirmoy.das at intel.com
Fri Apr 12 15:16:17 UTC 2024
Hi Jose,
On 4/12/2024 3:37 PM, Souza, Jose wrote:
> On Fri, 2024-04-12 at 11:22 +0200, Nirmoy Das wrote:
>> Add a query flag for xe->info.has_device_atomics_on_smem
>> as this is platform dependent. This flag can be use to inform
>> whether DRM_XE_VM_BIND_FLAG_DEVICE_ATOMICS can be effectively
>> applied for a given platform.
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_query.c | 4 +++-
>> include/uapi/drm/xe_drm.h | 3 +++
>> 2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
>> index df407d73e5f5..b8a606698e38 100644
>> --- a/drivers/gpu/drm/xe/xe_query.c
>> +++ b/drivers/gpu/drm/xe/xe_query.c
>> @@ -312,7 +312,7 @@ static int query_mem_regions(struct xe_device *xe,
>>
>> static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
>> {
>> - const u32 num_params = DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1;
>> + const u32 num_params = DRM_XE_QUERY_CONFIG_SUPP_DEV_ATOMIC_ON_SMEM + 1;
>> size_t size =
>> sizeof(struct drm_xe_query_config) + num_params * sizeof(u64);
>> struct drm_xe_query_config __user *query_ptr =
>> @@ -341,6 +341,8 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
>> config->info[DRM_XE_QUERY_CONFIG_VA_BITS] = xe->info.va_bits;
>> config->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY] =
>> xe_exec_queue_device_get_max_priority(xe);
>> + config->info[DRM_XE_QUERY_CONFIG_SUPP_DEV_ATOMIC_ON_SMEM] =
>> + xe->info.has_device_atomics_on_smem;
>>
>> if (copy_to_user(query_ptr, config, size)) {
>> kfree(config);
>> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
>> index a44c057d4471..4804b8a5d028 100644
>> --- a/include/uapi/drm/xe_drm.h
>> +++ b/include/uapi/drm/xe_drm.h
>> @@ -394,6 +394,8 @@ struct drm_xe_query_mem_regions {
>> * - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
>> * - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
>> * available exec queue priority
>> + * - %DRM_XE_QUERY_CONFIG_SUPP_DEV_ATOMIC_ON_SMEM - Flag is set if the device
>> + * supports device atomics on system memory
>> */
>> struct drm_xe_query_config {
>> /** @num_params: number of parameters returned in info */
>> @@ -408,6 +410,7 @@ struct drm_xe_query_config {
>> #define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT 2
>> #define DRM_XE_QUERY_CONFIG_VA_BITS 3
>> #define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 4
>> +#define DRM_XE_QUERY_CONFIG_SUPP_DEV_ATOMIC_ON_SMEM 5
>> /** @info: array of elements containing the config info */
>> __u64 info[];
> this will use a whole 64bits for just one bit, better add as add as a bit in DRM_XE_QUERY_CONFIG_FLAGS(after DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM)
Good idea. Will do that.
Thanks,
Nirmoy
>
>> };
More information about the Intel-xe
mailing list