Add support for reading GPU's unique ID
Add support and testing for reading the Unique ID associated with a specific GPU. This ID will persist across reboots, even if the GPU is moved to a different machine. Note that this is per-GPU, not per-card, as some cards have multiple GPUs, and each GPU will get a unique identifier Change-Id: Idce50c6febc2ceb1a4c1200d2489ec8b9d8fe174
This commit is contained in:
@@ -97,6 +97,7 @@ static const char *kDevMemUsedGTTFName = "mem_info_gtt_used";
|
||||
static const char *kDevMemUsedVisVRAMFName = "mem_info_vis_vram_used";
|
||||
static const char *kDevMemUsedVRAMFName = "mem_info_vram_used";
|
||||
static const char *kDevPCIEReplayCountFName = "pcie_replay_count";
|
||||
static const char *kDevUniqueIdFName = "unique_id";
|
||||
|
||||
// Strings that are found within sysfs files
|
||||
static const char *kDevPerfLevelAutoStr = "auto";
|
||||
@@ -138,6 +139,7 @@ static const std::map<DevInfoTypes, const char *> kDevAttribNameMap = {
|
||||
{kDevMemUsedVisVRAM, kDevMemUsedVisVRAMFName},
|
||||
{kDevMemUsedVRAM, kDevMemUsedVRAMFName},
|
||||
{kDevPCIEReplayCount, kDevPCIEReplayCountFName},
|
||||
{kDevUniqueId, kDevUniqueIdFName},
|
||||
};
|
||||
|
||||
static const std::map<rsmi_dev_perf_level, const char *> kDevPerfLvlMap = {
|
||||
@@ -374,6 +376,11 @@ int Device::readDevInfo(DevInfoTypes type, uint64_t *val) {
|
||||
RET_IF_NONZERO(ret);
|
||||
*val = std::stoul(tempStr, 0);
|
||||
break;
|
||||
case kDevUniqueId:
|
||||
ret = readDevInfoStr(type, &tempStr);
|
||||
RET_IF_NONZERO(ret);
|
||||
*val = std::stoul(tempStr, 0, 16);
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user