Commit 9d6fa9c7 authored by Graham Sider's avatar Graham Sider Committed by Alex Deucher

drm/amdkfd: Expose GFXIP engine version to sysfs

Add u32 gfx_target_version field to kfd_node_properties and
kfd_device_info. 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: default avatarGraham Sider <Graham.Sider@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a204ea8c
...@@ -91,6 +91,7 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = { ...@@ -91,6 +91,7 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = {
static const struct kfd_device_info kaveri_device_info = { static const struct kfd_device_info kaveri_device_info = {
.asic_family = CHIP_KAVERI, .asic_family = CHIP_KAVERI,
.asic_name = "kaveri", .asic_name = "kaveri",
.gfx_target_version = 70000,
.max_pasid_bits = 16, .max_pasid_bits = 16,
/* max num of queues for KV.TODO should be a dynamic value */ /* max num of queues for KV.TODO should be a dynamic value */
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
...@@ -110,6 +111,7 @@ static const struct kfd_device_info kaveri_device_info = { ...@@ -110,6 +111,7 @@ static const struct kfd_device_info kaveri_device_info = {
static const struct kfd_device_info carrizo_device_info = { static const struct kfd_device_info carrizo_device_info = {
.asic_family = CHIP_CARRIZO, .asic_family = CHIP_CARRIZO,
.asic_name = "carrizo", .asic_name = "carrizo",
.gfx_target_version = 80001,
.max_pasid_bits = 16, .max_pasid_bits = 16,
/* max num of queues for CZ.TODO should be a dynamic value */ /* max num of queues for CZ.TODO should be a dynamic value */
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
...@@ -130,6 +132,7 @@ static const struct kfd_device_info carrizo_device_info = { ...@@ -130,6 +132,7 @@ static const struct kfd_device_info carrizo_device_info = {
static const struct kfd_device_info raven_device_info = { static const struct kfd_device_info raven_device_info = {
.asic_family = CHIP_RAVEN, .asic_family = CHIP_RAVEN,
.asic_name = "raven", .asic_name = "raven",
.gfx_target_version = 90002,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -148,6 +151,7 @@ static const struct kfd_device_info raven_device_info = { ...@@ -148,6 +151,7 @@ static const struct kfd_device_info raven_device_info = {
static const struct kfd_device_info hawaii_device_info = { static const struct kfd_device_info hawaii_device_info = {
.asic_family = CHIP_HAWAII, .asic_family = CHIP_HAWAII,
.asic_name = "hawaii", .asic_name = "hawaii",
.gfx_target_version = 70001,
.max_pasid_bits = 16, .max_pasid_bits = 16,
/* max num of queues for KV.TODO should be a dynamic value */ /* max num of queues for KV.TODO should be a dynamic value */
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
...@@ -167,6 +171,7 @@ static const struct kfd_device_info hawaii_device_info = { ...@@ -167,6 +171,7 @@ static const struct kfd_device_info hawaii_device_info = {
static const struct kfd_device_info tonga_device_info = { static const struct kfd_device_info tonga_device_info = {
.asic_family = CHIP_TONGA, .asic_family = CHIP_TONGA,
.asic_name = "tonga", .asic_name = "tonga",
.gfx_target_version = 80002,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -185,6 +190,7 @@ static const struct kfd_device_info tonga_device_info = { ...@@ -185,6 +190,7 @@ static const struct kfd_device_info tonga_device_info = {
static const struct kfd_device_info fiji_device_info = { static const struct kfd_device_info fiji_device_info = {
.asic_family = CHIP_FIJI, .asic_family = CHIP_FIJI,
.asic_name = "fiji", .asic_name = "fiji",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -203,6 +209,7 @@ static const struct kfd_device_info fiji_device_info = { ...@@ -203,6 +209,7 @@ static const struct kfd_device_info fiji_device_info = {
static const struct kfd_device_info fiji_vf_device_info = { static const struct kfd_device_info fiji_vf_device_info = {
.asic_family = CHIP_FIJI, .asic_family = CHIP_FIJI,
.asic_name = "fiji", .asic_name = "fiji",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -222,6 +229,7 @@ static const struct kfd_device_info fiji_vf_device_info = { ...@@ -222,6 +229,7 @@ static const struct kfd_device_info fiji_vf_device_info = {
static const struct kfd_device_info polaris10_device_info = { static const struct kfd_device_info polaris10_device_info = {
.asic_family = CHIP_POLARIS10, .asic_family = CHIP_POLARIS10,
.asic_name = "polaris10", .asic_name = "polaris10",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -240,6 +248,7 @@ static const struct kfd_device_info polaris10_device_info = { ...@@ -240,6 +248,7 @@ static const struct kfd_device_info polaris10_device_info = {
static const struct kfd_device_info polaris10_vf_device_info = { static const struct kfd_device_info polaris10_vf_device_info = {
.asic_family = CHIP_POLARIS10, .asic_family = CHIP_POLARIS10,
.asic_name = "polaris10", .asic_name = "polaris10",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -258,6 +267,7 @@ static const struct kfd_device_info polaris10_vf_device_info = { ...@@ -258,6 +267,7 @@ static const struct kfd_device_info polaris10_vf_device_info = {
static const struct kfd_device_info polaris11_device_info = { static const struct kfd_device_info polaris11_device_info = {
.asic_family = CHIP_POLARIS11, .asic_family = CHIP_POLARIS11,
.asic_name = "polaris11", .asic_name = "polaris11",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -276,6 +286,7 @@ static const struct kfd_device_info polaris11_device_info = { ...@@ -276,6 +286,7 @@ static const struct kfd_device_info polaris11_device_info = {
static const struct kfd_device_info polaris12_device_info = { static const struct kfd_device_info polaris12_device_info = {
.asic_family = CHIP_POLARIS12, .asic_family = CHIP_POLARIS12,
.asic_name = "polaris12", .asic_name = "polaris12",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -294,6 +305,7 @@ static const struct kfd_device_info polaris12_device_info = { ...@@ -294,6 +305,7 @@ static const struct kfd_device_info polaris12_device_info = {
static const struct kfd_device_info vegam_device_info = { static const struct kfd_device_info vegam_device_info = {
.asic_family = CHIP_VEGAM, .asic_family = CHIP_VEGAM,
.asic_name = "vegam", .asic_name = "vegam",
.gfx_target_version = 80003,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 4, .doorbell_size = 4,
...@@ -312,6 +324,7 @@ static const struct kfd_device_info vegam_device_info = { ...@@ -312,6 +324,7 @@ static const struct kfd_device_info vegam_device_info = {
static const struct kfd_device_info vega10_device_info = { static const struct kfd_device_info vega10_device_info = {
.asic_family = CHIP_VEGA10, .asic_family = CHIP_VEGA10,
.asic_name = "vega10", .asic_name = "vega10",
.gfx_target_version = 90000,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -330,6 +343,7 @@ static const struct kfd_device_info vega10_device_info = { ...@@ -330,6 +343,7 @@ static const struct kfd_device_info vega10_device_info = {
static const struct kfd_device_info vega10_vf_device_info = { static const struct kfd_device_info vega10_vf_device_info = {
.asic_family = CHIP_VEGA10, .asic_family = CHIP_VEGA10,
.asic_name = "vega10", .asic_name = "vega10",
.gfx_target_version = 90000,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -348,6 +362,7 @@ static const struct kfd_device_info vega10_vf_device_info = { ...@@ -348,6 +362,7 @@ static const struct kfd_device_info vega10_vf_device_info = {
static const struct kfd_device_info vega12_device_info = { static const struct kfd_device_info vega12_device_info = {
.asic_family = CHIP_VEGA12, .asic_family = CHIP_VEGA12,
.asic_name = "vega12", .asic_name = "vega12",
.gfx_target_version = 90004,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -366,6 +381,7 @@ static const struct kfd_device_info vega12_device_info = { ...@@ -366,6 +381,7 @@ static const struct kfd_device_info vega12_device_info = {
static const struct kfd_device_info vega20_device_info = { static const struct kfd_device_info vega20_device_info = {
.asic_family = CHIP_VEGA20, .asic_family = CHIP_VEGA20,
.asic_name = "vega20", .asic_name = "vega20",
.gfx_target_version = 90006,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -384,6 +400,7 @@ static const struct kfd_device_info vega20_device_info = { ...@@ -384,6 +400,7 @@ static const struct kfd_device_info vega20_device_info = {
static const struct kfd_device_info arcturus_device_info = { static const struct kfd_device_info arcturus_device_info = {
.asic_family = CHIP_ARCTURUS, .asic_family = CHIP_ARCTURUS,
.asic_name = "arcturus", .asic_name = "arcturus",
.gfx_target_version = 90008,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -402,6 +419,7 @@ static const struct kfd_device_info arcturus_device_info = { ...@@ -402,6 +419,7 @@ static const struct kfd_device_info arcturus_device_info = {
static const struct kfd_device_info aldebaran_device_info = { static const struct kfd_device_info aldebaran_device_info = {
.asic_family = CHIP_ALDEBARAN, .asic_family = CHIP_ALDEBARAN,
.asic_name = "aldebaran", .asic_name = "aldebaran",
.gfx_target_version = 90010,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -420,6 +438,7 @@ static const struct kfd_device_info aldebaran_device_info = { ...@@ -420,6 +438,7 @@ static const struct kfd_device_info aldebaran_device_info = {
static const struct kfd_device_info renoir_device_info = { static const struct kfd_device_info renoir_device_info = {
.asic_family = CHIP_RENOIR, .asic_family = CHIP_RENOIR,
.asic_name = "renoir", .asic_name = "renoir",
.gfx_target_version = 90002,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -438,6 +457,7 @@ static const struct kfd_device_info renoir_device_info = { ...@@ -438,6 +457,7 @@ static const struct kfd_device_info renoir_device_info = {
static const struct kfd_device_info navi10_device_info = { static const struct kfd_device_info navi10_device_info = {
.asic_family = CHIP_NAVI10, .asic_family = CHIP_NAVI10,
.asic_name = "navi10", .asic_name = "navi10",
.gfx_target_version = 100100,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -456,6 +476,7 @@ static const struct kfd_device_info navi10_device_info = { ...@@ -456,6 +476,7 @@ static const struct kfd_device_info navi10_device_info = {
static const struct kfd_device_info navi12_device_info = { static const struct kfd_device_info navi12_device_info = {
.asic_family = CHIP_NAVI12, .asic_family = CHIP_NAVI12,
.asic_name = "navi12", .asic_name = "navi12",
.gfx_target_version = 100101,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -474,6 +495,7 @@ static const struct kfd_device_info navi12_device_info = { ...@@ -474,6 +495,7 @@ static const struct kfd_device_info navi12_device_info = {
static const struct kfd_device_info navi14_device_info = { static const struct kfd_device_info navi14_device_info = {
.asic_family = CHIP_NAVI14, .asic_family = CHIP_NAVI14,
.asic_name = "navi14", .asic_name = "navi14",
.gfx_target_version = 100102,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -492,6 +514,7 @@ static const struct kfd_device_info navi14_device_info = { ...@@ -492,6 +514,7 @@ static const struct kfd_device_info navi14_device_info = {
static const struct kfd_device_info sienna_cichlid_device_info = { static const struct kfd_device_info sienna_cichlid_device_info = {
.asic_family = CHIP_SIENNA_CICHLID, .asic_family = CHIP_SIENNA_CICHLID,
.asic_name = "sienna_cichlid", .asic_name = "sienna_cichlid",
.gfx_target_version = 100300,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -510,6 +533,7 @@ static const struct kfd_device_info sienna_cichlid_device_info = { ...@@ -510,6 +533,7 @@ static const struct kfd_device_info sienna_cichlid_device_info = {
static const struct kfd_device_info navy_flounder_device_info = { static const struct kfd_device_info navy_flounder_device_info = {
.asic_family = CHIP_NAVY_FLOUNDER, .asic_family = CHIP_NAVY_FLOUNDER,
.asic_name = "navy_flounder", .asic_name = "navy_flounder",
.gfx_target_version = 100301,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -528,6 +552,7 @@ static const struct kfd_device_info navy_flounder_device_info = { ...@@ -528,6 +552,7 @@ static const struct kfd_device_info navy_flounder_device_info = {
static const struct kfd_device_info vangogh_device_info = { static const struct kfd_device_info vangogh_device_info = {
.asic_family = CHIP_VANGOGH, .asic_family = CHIP_VANGOGH,
.asic_name = "vangogh", .asic_name = "vangogh",
.gfx_target_version = 100303,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -546,6 +571,7 @@ static const struct kfd_device_info vangogh_device_info = { ...@@ -546,6 +571,7 @@ static const struct kfd_device_info vangogh_device_info = {
static const struct kfd_device_info dimgrey_cavefish_device_info = { static const struct kfd_device_info dimgrey_cavefish_device_info = {
.asic_family = CHIP_DIMGREY_CAVEFISH, .asic_family = CHIP_DIMGREY_CAVEFISH,
.asic_name = "dimgrey_cavefish", .asic_name = "dimgrey_cavefish",
.gfx_target_version = 100302,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -564,6 +590,7 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = { ...@@ -564,6 +590,7 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = {
static const struct kfd_device_info beige_goby_device_info = { static const struct kfd_device_info beige_goby_device_info = {
.asic_family = CHIP_BEIGE_GOBY, .asic_family = CHIP_BEIGE_GOBY,
.asic_name = "beige_goby", .asic_name = "beige_goby",
.gfx_target_version = 100304,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -582,6 +609,7 @@ static const struct kfd_device_info beige_goby_device_info = { ...@@ -582,6 +609,7 @@ static const struct kfd_device_info beige_goby_device_info = {
static const struct kfd_device_info yellow_carp_device_info = { static const struct kfd_device_info yellow_carp_device_info = {
.asic_family = CHIP_YELLOW_CARP, .asic_family = CHIP_YELLOW_CARP,
.asic_name = "yellow_carp", .asic_name = "yellow_carp",
.gfx_target_version = 100305,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
...@@ -600,6 +628,7 @@ static const struct kfd_device_info yellow_carp_device_info = { ...@@ -600,6 +628,7 @@ static const struct kfd_device_info yellow_carp_device_info = {
static const struct kfd_device_info cyan_skillfish_device_info = { static const struct kfd_device_info cyan_skillfish_device_info = {
.asic_family = CHIP_CYAN_SKILLFISH, .asic_family = CHIP_CYAN_SKILLFISH,
.asic_name = "cyan_skillfish", .asic_name = "cyan_skillfish",
.gfx_target_version = 100103,
.max_pasid_bits = 16, .max_pasid_bits = 16,
.max_no_of_hqd = 24, .max_no_of_hqd = 24,
.doorbell_size = 8, .doorbell_size = 8,
......
...@@ -196,6 +196,7 @@ struct kfd_event_interrupt_class { ...@@ -196,6 +196,7 @@ struct kfd_event_interrupt_class {
struct kfd_device_info { struct kfd_device_info {
enum amd_asic_type asic_family; enum amd_asic_type asic_family;
const char *asic_name; const char *asic_name;
uint32_t gfx_target_version;
const struct kfd_event_interrupt_class *event_interrupt_class; const struct kfd_event_interrupt_class *event_interrupt_class;
unsigned int max_pasid_bits; unsigned int max_pasid_bits;
unsigned int max_no_of_hqd; unsigned int max_no_of_hqd;
......
...@@ -478,6 +478,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, ...@@ -478,6 +478,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
dev->node_props.simd_per_cu); dev->node_props.simd_per_cu);
sysfs_show_32bit_prop(buffer, offs, "max_slots_scratch_cu", sysfs_show_32bit_prop(buffer, offs, "max_slots_scratch_cu",
dev->node_props.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", sysfs_show_32bit_prop(buffer, offs, "vendor_id",
dev->node_props.vendor_id); dev->node_props.vendor_id);
sysfs_show_32bit_prop(buffer, offs, "device_id", sysfs_show_32bit_prop(buffer, offs, "device_id",
...@@ -1360,6 +1362,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) ...@@ -1360,6 +1362,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
dev->node_props.simd_arrays_per_engine = dev->node_props.simd_arrays_per_engine =
cu_info.num_shader_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.vendor_id = gpu->pdev->vendor;
dev->node_props.device_id = gpu->pdev->device; dev->node_props.device_id = gpu->pdev->device;
dev->node_props.capability |= dev->node_props.capability |=
......
...@@ -78,6 +78,7 @@ struct kfd_node_properties { ...@@ -78,6 +78,7 @@ struct kfd_node_properties {
uint32_t simd_per_cu; uint32_t simd_per_cu;
uint32_t max_slots_scratch_cu; uint32_t max_slots_scratch_cu;
uint32_t engine_id; uint32_t engine_id;
uint32_t gfx_target_version;
uint32_t vendor_id; uint32_t vendor_id;
uint32_t device_id; uint32_t device_id;
uint32_t location_id; uint32_t location_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment