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

Felix Kuehling felix.kuehling at amd.com
Thu Aug 5 15:33:13 UTC 2021


Am 2021-08-04 um 2:17 p.m. schrieb Graham Sider:
> Add u32 gfx_version field to kfd_node_properties and kfd_device_info.

Update this description with the new property name. With that fixed, the
patch is

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


> Populate <asic>_device_info structs accordingly and expose to sysfs.
>
> This allows eliminating device-ID-based lookup tables in user mode for
> future ASICs.
>
> 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..16a57b70cc1a 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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_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_target_version = 100304,
>  	.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_target_version = 100305,
>  	.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_target_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..ab83b0de6b22 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_target_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..98cca5f2b27f 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_target_version",
> +			      dev->node_props.gfx_target_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_target_version = gpu->device_info->gfx_target_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..a8db017c9b8e 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_target_version;
>  	uint32_t vendor_id;
>  	uint32_t device_id;
>  	uint32_t location_id;


More information about the amd-gfx mailing list