[PATCH] drm/amdgpu: Add flags to distinguish vf/pf/pt mode
Christian König
ckoenig.leichtzumerken at gmail.com
Tue May 28 13:51:45 UTC 2024
Am 27.05.24 um 18:28 schrieb Asad Kamal:
> Add extra flag definition for ids_flag field to distinguish
> between vf/pf/pt modes
>
> v2: Updated kms driver minor version & removed pf check as default is 0
>
> Signed-off-by: Asad Kamal <asad.kamal at amd.com>
> Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>
Acked-by: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 9 +++++++++
> include/uapi/drm/amdgpu_drm.h | 10 ++++++++++
> 3 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 2da76fadf6ea..60d5758939ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -116,9 +116,10 @@
> * - 3.55.0 - Add AMDGPU_INFO_GPUVM_FAULT query
> * - 3.56.0 - Update IB start address and size alignment for decode and encode
> * - 3.57.0 - Compute tunneling on GFX10+
> + * - 3.58.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT
> */
> #define KMS_DRIVER_MAJOR 3
> -#define KMS_DRIVER_MINOR 57
> +#define KMS_DRIVER_MINOR 58
> #define KMS_DRIVER_PATCHLEVEL 0
>
> /*
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 66782be5917b..260cd0ad286d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -869,6 +869,15 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> if (adev->gfx.config.ta_cntl2_truncate_coord_mode)
> dev_info->ids_flags |= AMDGPU_IDS_FLAGS_CONFORMANT_TRUNC_COORD;
>
> + if (amdgpu_passthrough(adev))
> + dev_info->ids_flags |= (AMDGPU_IDS_FLAGS_MODE_PT <<
> + AMDGPU_IDS_FLAGS_MODE_SHIFT) &
> + AMDGPU_IDS_FLAGS_MODE_MASK;
> + else if (amdgpu_sriov_vf(adev))
> + dev_info->ids_flags |= (AMDGPU_IDS_FLAGS_MODE_VF <<
> + AMDGPU_IDS_FLAGS_MODE_SHIFT) &
> + AMDGPU_IDS_FLAGS_MODE_MASK;
> +
> vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
> vm_size -= AMDGPU_VA_RESERVED_TOP;
>
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index 5b6c0055cfcf..ae3f4e275f20 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -754,6 +754,16 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {
> #define AMDGPU_IDS_FLAGS_TMZ 0x4
> #define AMDGPU_IDS_FLAGS_CONFORMANT_TRUNC_COORD 0x8
>
> +/*
> + * Query h/w info: Flag identifying VF/PF/PT mode
> + *
> + */
> +#define AMDGPU_IDS_FLAGS_MODE_MASK 0x300
> +#define AMDGPU_IDS_FLAGS_MODE_SHIFT 0x8
> +#define AMDGPU_IDS_FLAGS_MODE_PF 0x0
> +#define AMDGPU_IDS_FLAGS_MODE_VF 0x1
> +#define AMDGPU_IDS_FLAGS_MODE_PT 0x2
> +
> /* indicate if acceleration can be working */
> #define AMDGPU_INFO_ACCEL_WORKING 0x00
> /* get the crtc_id from the mode object id? */
More information about the amd-gfx
mailing list