Enable version info via thunk interface
- Replace HSAuint32 with HSA_ENGINE_ID for EngineId type so it explicitely
presents version information for ucode and GfxIP
- Created a GfxIP lookup table to pass the version information. This lookup
searches for matching device ID.
Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Acked-by: John Bridgman <John.Bridgman@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
[ROCm/ROCR-Runtime commit: a3925a3a19]
This commit is contained in:
committed by
Felix Kuehling
parent
0f0e28cbdb
commit
92e34fcda6
@@ -148,6 +148,17 @@ typedef struct _HsaSystemProperties
|
|||||||
HSAuint32 PlatformRev; // HSA platform revision, reflects Platform Table Revision ID
|
HSAuint32 PlatformRev; // HSA platform revision, reflects Platform Table Revision ID
|
||||||
} HsaSystemProperties;
|
} HsaSystemProperties;
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
HSAuint32 Value;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned int uCode : 10; // ucode packet processor version
|
||||||
|
unsigned int Major : 6; // GFXIP Major engine version
|
||||||
|
unsigned int Minor : 8; // GFXIP Minor engine version
|
||||||
|
unsigned int Stepping : 8; // GFXIP Stepping info
|
||||||
|
};
|
||||||
|
} HSA_ENGINE_ID;
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
@@ -223,7 +234,7 @@ typedef struct _HsaNodeProperties
|
|||||||
HSAuint32 MaxSlotsScratchCU; // Number of temp. memory ("scratch") wave slots available to access,
|
HSAuint32 MaxSlotsScratchCU; // Number of temp. memory ("scratch") wave slots available to access,
|
||||||
// may be 0 if HW has no restrictions
|
// may be 0 if HW has no restrictions
|
||||||
|
|
||||||
HSAuint32 EngineId; // Identifier (rev) of teh GPU uEngine or Firmware, may be 0
|
HSA_ENGINE_ID EngineId; // Identifier (rev) of the GPU uEngine or Firmware, may be 0
|
||||||
|
|
||||||
HSAuint16 VendorId; // GPU vendor id; 0 on latency (= CPU)-only nodes
|
HSAuint16 VendorId; // GPU vendor id; 0 on latency (= CPU)-only nodes
|
||||||
HSAuint16 DeviceId; // GPU device id; 0 on latency (= CPU)-only nodes
|
HSAuint16 DeviceId; // GPU device id; 0 on latency (= CPU)-only nodes
|
||||||
|
|||||||
@@ -52,7 +52,44 @@ static node_t *node = NULL;
|
|||||||
|
|
||||||
static HSAKMT_STATUS topology_take_snapshot(void);
|
static HSAKMT_STATUS topology_take_snapshot(void);
|
||||||
static HSAKMT_STATUS topology_drop_snapshot(void);
|
static HSAKMT_STATUS topology_drop_snapshot(void);
|
||||||
static int get_cpu_stepping(uint16_t* stepping);
|
//static int get_cpu_stepping(uint16_t* stepping);
|
||||||
|
|
||||||
|
static struct hsa_gfxip_table {
|
||||||
|
unsigned short device_id; // Device ID
|
||||||
|
unsigned char major; // GFXIP Major engine version
|
||||||
|
unsigned char minor; // GFXIP Minor engine version
|
||||||
|
unsigned char stepping; // GFXIP Stepping info
|
||||||
|
} gfxip_lookup_table[] = {
|
||||||
|
/* Kaveri Family */
|
||||||
|
{ 0x1304, 7, 0, 0 },
|
||||||
|
{ 0x1305, 7, 0, 0 },
|
||||||
|
{ 0x1306, 7, 0, 0 },
|
||||||
|
{ 0x1307, 7, 0, 0 },
|
||||||
|
{ 0x1309, 7, 0, 0 },
|
||||||
|
{ 0x130A, 7, 0, 0 },
|
||||||
|
{ 0x130B, 7, 0, 0 },
|
||||||
|
{ 0x130C, 7, 0, 0 },
|
||||||
|
{ 0x130D, 7, 0, 0 },
|
||||||
|
{ 0x130E, 7, 0, 0 },
|
||||||
|
{ 0x130F, 7, 0, 0 },
|
||||||
|
{ 0x1310, 7, 0, 0 },
|
||||||
|
{ 0x1311, 7, 0, 0 },
|
||||||
|
{ 0x1312, 7, 0, 0 },
|
||||||
|
{ 0x1313, 7, 0, 0 },
|
||||||
|
{ 0x1315, 7, 0, 0 },
|
||||||
|
{ 0x1316, 7, 0, 0 },
|
||||||
|
{ 0x1317, 7, 0, 0 },
|
||||||
|
{ 0x1318, 7, 0, 0 },
|
||||||
|
{ 0x131B, 7, 0, 0 },
|
||||||
|
{ 0x131C, 7, 0, 0 },
|
||||||
|
{ 0x131D, 7, 0, 0 },
|
||||||
|
/* Carrizo Family */
|
||||||
|
{ 0x9870, 8, 0, 1 },
|
||||||
|
{ 0x9874, 8, 0, 1 },
|
||||||
|
{ 0x9875, 8, 0, 1 },
|
||||||
|
{ 0x9876, 8, 0, 1 },
|
||||||
|
{ 0x9877, 8, 0, 1 }
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_node(node_t *n)
|
free_node(node_t *n)
|
||||||
@@ -192,8 +229,8 @@ topology_sysfs_get_node_props(uint32_t node_id, HsaNodeProperties *props, uint32
|
|||||||
char prop_name[256];
|
char prop_name[256];
|
||||||
char path[256];
|
char path[256];
|
||||||
long long unsigned int prop_val;
|
long long unsigned int prop_val;
|
||||||
uint32_t i, prog;
|
uint32_t i, prog, table_size;
|
||||||
uint16_t stepping = 0, fw_version = 0;
|
uint16_t fw_version = 0;
|
||||||
int read_size;
|
int read_size;
|
||||||
|
|
||||||
HSAKMT_STATUS ret = HSAKMT_STATUS_SUCCESS;
|
HSAKMT_STATUS ret = HSAKMT_STATUS_SUCCESS;
|
||||||
@@ -309,8 +346,22 @@ topology_sysfs_get_node_props(uint32_t node_id, HsaNodeProperties *props, uint32
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_cpu_stepping(&stepping);
|
// get_cpu_stepping(&stepping);
|
||||||
props->EngineId = ((stepping << 16) | fw_version);
|
props->EngineId.uCode = fw_version & 0x3ff;
|
||||||
|
props->EngineId.Major = 0;
|
||||||
|
props->EngineId.Minor = 0;
|
||||||
|
props->EngineId.Stepping = 0;
|
||||||
|
table_size = sizeof(gfxip_lookup_table)/sizeof(struct hsa_gfxip_table);
|
||||||
|
for (i=0; i<table_size; i++) {
|
||||||
|
if(gfxip_lookup_table[i].device_id == props->DeviceId) {
|
||||||
|
props->EngineId.Major = gfxip_lookup_table[i].major & 0x3f;
|
||||||
|
props->EngineId.Minor = gfxip_lookup_table[i].minor;
|
||||||
|
props->EngineId.Stepping = gfxip_lookup_table[i].stepping;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(props->EngineId.Major);
|
||||||
|
//TODO: error handler when Device ID lookup fails
|
||||||
|
|
||||||
err2:
|
err2:
|
||||||
free(read_buf);
|
free(read_buf);
|
||||||
@@ -960,6 +1011,7 @@ uint16_t get_device_id_by_node(HSAuint32 node_id)
|
|||||||
return node[node_id].node.DeviceId;
|
return node[node_id].node.DeviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static int get_cpu_stepping(uint16_t* stepping)
|
static int get_cpu_stepping(uint16_t* stepping)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -997,3 +1049,4 @@ err1:
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user