[PATCH] drm/amdkfd: Expose GFXIP engine version to sysfs

Felix Kuehling felix.kuehling at amd.com
Fri Jul 30 15:14:40 UTC 2021


Am 2021-07-29 um 4:25 p.m. schrieb Graham Sider:
> Add u32 gfx_version field to kfd_node_properties and kfd_device_info.
> Populate <asic>_device_info structs accordingly and expose to sysfs.

Please describe the reason for this change:

    This allows eliminating device-ID based lookup tables in user mode
    for future ASICs.

See also two corrections inline. With those fixed, this patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


>
> Signed-off-by: Graham Sider <Graham.Sider at amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device.c   | 29 +++++++++++++++++++++++
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h     |  1 +
>  drivers/gpu/drm/amd/amdkfd/kfd_topology.c |  3 +++
>  drivers/gpu/drm/amd/amdkfd/kfd_topology.h |  1 +
>  4 files changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index b551dd675085..1699f1adff9d 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -91,6 +91,7 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = {
>  static const struct kfd_device_info kaveri_device_info = {
>  	.asic_family = CHIP_KAVERI,
>  	.asic_name = "kaveri",
> +	.gfx_version = 70000,
>  	.max_pasid_bits = 16,
>  	/* max num of queues for KV.TODO should be a dynamic value */
>  	.max_no_of_hqd	= 24,
> @@ -110,6 +111,7 @@ static const struct kfd_device_info kaveri_device_info = {
>  static const struct kfd_device_info carrizo_device_info = {
>  	.asic_family = CHIP_CARRIZO,
>  	.asic_name = "carrizo",
> +	.gfx_version = 80001,
>  	.max_pasid_bits = 16,
>  	/* max num of queues for CZ.TODO should be a dynamic value */
>  	.max_no_of_hqd	= 24,
> @@ -130,6 +132,7 @@ static const struct kfd_device_info carrizo_device_info = {
>  static const struct kfd_device_info raven_device_info = {
>  	.asic_family = CHIP_RAVEN,
>  	.asic_name = "raven",
> +	.gfx_version = 90002,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -148,6 +151,7 @@ static const struct kfd_device_info raven_device_info = {
>  static const struct kfd_device_info hawaii_device_info = {
>  	.asic_family = CHIP_HAWAII,
>  	.asic_name = "hawaii",
> +	.gfx_version = 70001,
>  	.max_pasid_bits = 16,
>  	/* max num of queues for KV.TODO should be a dynamic value */
>  	.max_no_of_hqd	= 24,
> @@ -167,6 +171,7 @@ static const struct kfd_device_info hawaii_device_info = {
>  static const struct kfd_device_info tonga_device_info = {
>  	.asic_family = CHIP_TONGA,
>  	.asic_name = "tonga",
> +	.gfx_version = 80002,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -185,6 +190,7 @@ static const struct kfd_device_info tonga_device_info = {
>  static const struct kfd_device_info fiji_device_info = {
>  	.asic_family = CHIP_FIJI,
>  	.asic_name = "fiji",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -203,6 +209,7 @@ static const struct kfd_device_info fiji_device_info = {
>  static const struct kfd_device_info fiji_vf_device_info = {
>  	.asic_family = CHIP_FIJI,
>  	.asic_name = "fiji",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -222,6 +229,7 @@ static const struct kfd_device_info fiji_vf_device_info = {
>  static const struct kfd_device_info polaris10_device_info = {
>  	.asic_family = CHIP_POLARIS10,
>  	.asic_name = "polaris10",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -240,6 +248,7 @@ static const struct kfd_device_info polaris10_device_info = {
>  static const struct kfd_device_info polaris10_vf_device_info = {
>  	.asic_family = CHIP_POLARIS10,
>  	.asic_name = "polaris10",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -258,6 +267,7 @@ static const struct kfd_device_info polaris10_vf_device_info = {
>  static const struct kfd_device_info polaris11_device_info = {
>  	.asic_family = CHIP_POLARIS11,
>  	.asic_name = "polaris11",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -276,6 +286,7 @@ static const struct kfd_device_info polaris11_device_info = {
>  static const struct kfd_device_info polaris12_device_info = {
>  	.asic_family = CHIP_POLARIS12,
>  	.asic_name = "polaris12",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -294,6 +305,7 @@ static const struct kfd_device_info polaris12_device_info = {
>  static const struct kfd_device_info vegam_device_info = {
>  	.asic_family = CHIP_VEGAM,
>  	.asic_name = "vegam",
> +	.gfx_version = 80003,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 4,
> @@ -312,6 +324,7 @@ static const struct kfd_device_info vegam_device_info = {
>  static const struct kfd_device_info vega10_device_info = {
>  	.asic_family = CHIP_VEGA10,
>  	.asic_name = "vega10",
> +	.gfx_version = 90000,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -330,6 +343,7 @@ static const struct kfd_device_info vega10_device_info = {
>  static const struct kfd_device_info vega10_vf_device_info = {
>  	.asic_family = CHIP_VEGA10,
>  	.asic_name = "vega10",
> +	.gfx_version = 90000,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -348,6 +362,7 @@ static const struct kfd_device_info vega10_vf_device_info = {
>  static const struct kfd_device_info vega12_device_info = {
>  	.asic_family = CHIP_VEGA12,
>  	.asic_name = "vega12",
> +	.gfx_version = 90004,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -366,6 +381,7 @@ static const struct kfd_device_info vega12_device_info = {
>  static const struct kfd_device_info vega20_device_info = {
>  	.asic_family = CHIP_VEGA20,
>  	.asic_name = "vega20",
> +	.gfx_version = 90006,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd	= 24,
>  	.doorbell_size	= 8,
> @@ -384,6 +400,7 @@ static const struct kfd_device_info vega20_device_info = {
>  static const struct kfd_device_info arcturus_device_info = {
>  	.asic_family = CHIP_ARCTURUS,
>  	.asic_name = "arcturus",
> +	.gfx_version = 90008,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd	= 24,
>  	.doorbell_size	= 8,
> @@ -402,6 +419,7 @@ static const struct kfd_device_info arcturus_device_info = {
>  static const struct kfd_device_info aldebaran_device_info = {
>  	.asic_family = CHIP_ALDEBARAN,
>  	.asic_name = "aldebaran",
> +	.gfx_version = 90010,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd	= 24,
>  	.doorbell_size	= 8,
> @@ -420,6 +438,7 @@ static const struct kfd_device_info aldebaran_device_info = {
>  static const struct kfd_device_info renoir_device_info = {
>  	.asic_family = CHIP_RENOIR,
>  	.asic_name = "renoir",
> +	.gfx_version = 90002,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -438,6 +457,7 @@ static const struct kfd_device_info renoir_device_info = {
>  static const struct kfd_device_info navi10_device_info = {
>  	.asic_family = CHIP_NAVI10,
>  	.asic_name = "navi10",
> +	.gfx_version = 100100,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -456,6 +476,7 @@ static const struct kfd_device_info navi10_device_info = {
>  static const struct kfd_device_info navi12_device_info = {
>  	.asic_family = CHIP_NAVI12,
>  	.asic_name = "navi12",
> +	.gfx_version = 100101,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -474,6 +495,7 @@ static const struct kfd_device_info navi12_device_info = {
>  static const struct kfd_device_info navi14_device_info = {
>  	.asic_family = CHIP_NAVI14,
>  	.asic_name = "navi14",
> +	.gfx_version = 100102,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -492,6 +514,7 @@ static const struct kfd_device_info navi14_device_info = {
>  static const struct kfd_device_info sienna_cichlid_device_info = {
>  	.asic_family = CHIP_SIENNA_CICHLID,
>  	.asic_name = "sienna_cichlid",
> +	.gfx_version = 100300,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -510,6 +533,7 @@ static const struct kfd_device_info sienna_cichlid_device_info = {
>  static const struct kfd_device_info navy_flounder_device_info = {
>  	.asic_family = CHIP_NAVY_FLOUNDER,
>  	.asic_name = "navy_flounder",
> +	.gfx_version = 100301,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -528,6 +552,7 @@ static const struct kfd_device_info navy_flounder_device_info = {
>  static const struct kfd_device_info vangogh_device_info = {
>  	.asic_family = CHIP_VANGOGH,
>  	.asic_name = "vangogh",
> +	.gfx_version = 100303,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -546,6 +571,7 @@ static const struct kfd_device_info vangogh_device_info = {
>  static const struct kfd_device_info dimgrey_cavefish_device_info = {
>  	.asic_family = CHIP_DIMGREY_CAVEFISH,
>  	.asic_name = "dimgrey_cavefish",
> +	.gfx_version = 100302,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -564,6 +590,7 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = {
>  static const struct kfd_device_info beige_goby_device_info = {
>  	.asic_family = CHIP_BEIGE_GOBY,
>  	.asic_name = "beige_goby",
> +	.gfx_version = 100305,

I don't see Beige Goby in the Thunk's gfxip_lookup_table. I think it
should be 10.3.4. Please check (I'll provide some useful internal links
offline).


>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -582,6 +609,7 @@ static const struct kfd_device_info beige_goby_device_info = {
>  static const struct kfd_device_info yellow_carp_device_info = {
>  	.asic_family = CHIP_YELLOW_CARP,
>  	.asic_name = "yellow_carp",
> +	.gfx_version = 100303,

In the thunk I see 10.3.5 for Yellow Carp.

Regards,
  Felix


>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> @@ -600,6 +628,7 @@ static const struct kfd_device_info yellow_carp_device_info = {
>  static const struct kfd_device_info cyan_skillfish_device_info = {
>  	.asic_family = CHIP_CYAN_SKILLFISH,
>  	.asic_name = "cyan_skillfish",
> +	.gfx_version = 100103,
>  	.max_pasid_bits = 16,
>  	.max_no_of_hqd  = 24,
>  	.doorbell_size  = 8,
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index 8a5dfda224bf..eb4eab9a18e3 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -196,6 +196,7 @@ struct kfd_event_interrupt_class {
>  struct kfd_device_info {
>  	enum amd_asic_type asic_family;
>  	const char *asic_name;
> +	uint32_t gfx_version;
>  	const struct kfd_event_interrupt_class *event_interrupt_class;
>  	unsigned int max_pasid_bits;
>  	unsigned int max_no_of_hqd;
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> index ef992dd2da3a..6043b6e7b390 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> @@ -478,6 +478,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
>  			      dev->node_props.simd_per_cu);
>  	sysfs_show_32bit_prop(buffer, offs, "max_slots_scratch_cu",
>  			      dev->node_props.max_slots_scratch_cu);
> +	sysfs_show_32bit_prop(buffer, offs, "gfx_version",
> +			      dev->node_props.gfx_version);
>  	sysfs_show_32bit_prop(buffer, offs, "vendor_id",
>  			      dev->node_props.vendor_id);
>  	sysfs_show_32bit_prop(buffer, offs, "device_id",
> @@ -1360,6 +1362,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
>  	dev->node_props.simd_arrays_per_engine =
>  		cu_info.num_shader_arrays_per_engine;
>  
> +	dev->node_props.gfx_version = gpu->device_info->gfx_version;
>  	dev->node_props.vendor_id = gpu->pdev->vendor;
>  	dev->node_props.device_id = gpu->pdev->device;
>  	dev->node_props.capability |=
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> index 8b48c6692007..073567a2e0d2 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> @@ -78,6 +78,7 @@ struct kfd_node_properties {
>  	uint32_t simd_per_cu;
>  	uint32_t max_slots_scratch_cu;
>  	uint32_t engine_id;
> +	uint32_t gfx_version;
>  	uint32_t vendor_id;
>  	uint32_t device_id;
>  	uint32_t location_id;


More information about the amd-gfx mailing list