SWDEV-374716 - Fixed asic info
Change-Id: I8d806ef09eca4300fcec0ce6a226d13547dfb728 Signed-off-by: Dalibor Stanisavljevic <Dalibor.Stanisavljevic@amd.com>
Этот коммит содержится в:
@@ -65,6 +65,8 @@ class AMDSmiDrm {
|
||||
std::vector<std::string>& get_drm_paths();
|
||||
bool check_if_drm_is_supported();
|
||||
|
||||
uint32_t get_vendor_id();
|
||||
|
||||
amdsmi_status_t amdgpu_query_info(int fd, unsigned info_id,
|
||||
unsigned size, void *value);
|
||||
amdsmi_status_t amdgpu_query_fw(int fd, unsigned info_id, unsigned fw_type,
|
||||
@@ -78,6 +80,7 @@ class AMDSmiDrm {
|
||||
std::vector<int> drm_fds_; // drm file descriptor by gpu_index
|
||||
std::vector<std::string> drm_paths_; // drm path (renderD128 for example)
|
||||
std::vector<amdsmi_bdf_t> drm_bdfs_; // bdf
|
||||
uint32_t vendor_id;
|
||||
|
||||
AMDSmiLibraryLoader lib_loader_; // lazy load libdrm
|
||||
DrmCmdWriteFunc drm_cmd_write_; // drmCommandWrite
|
||||
|
||||
@@ -72,6 +72,7 @@ class AMDSmiGPUDevice: public AMDSmiDevice {
|
||||
std::string& get_gpu_path();
|
||||
amdsmi_bdf_t get_bdf();
|
||||
bool check_if_drm_is_supported() { return drm_.check_if_drm_is_supported(); }
|
||||
uint32_t get_vendor_id();
|
||||
|
||||
amdsmi_status_t amdgpu_query_info(unsigned info_id,
|
||||
unsigned size, void *value) const;
|
||||
@@ -85,6 +86,7 @@ class AMDSmiGPUDevice: public AMDSmiDevice {
|
||||
uint32_t fd_;
|
||||
std::string path_;
|
||||
amdsmi_bdf_t bdf_;
|
||||
uint32_t vendor_id_;
|
||||
AMDSmiDrm& drm_;
|
||||
shared_mutex_t mutex_;
|
||||
};
|
||||
|
||||
@@ -555,7 +555,6 @@ amdsmi_status_t amdsmi_get_fw_info(amdsmi_device_handle device_handle,
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO(bliu) : add other asic info
|
||||
amdsmi_status_t
|
||||
amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *info) {
|
||||
|
||||
@@ -569,6 +568,8 @@ amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *inf
|
||||
struct drm_amdgpu_info_vbios vbios = {};
|
||||
char* name;
|
||||
char *tmp;
|
||||
uint16_t vendor_id = 0;
|
||||
uint16_t subvendor_id = 0;
|
||||
|
||||
amd::smi::AMDSmiGPUDevice* gpu_device = nullptr;
|
||||
amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device);
|
||||
@@ -598,24 +599,24 @@ amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *inf
|
||||
info->device_id = dev_info.device_id;
|
||||
info->family = dev_info.family;
|
||||
info->rev_id = dev_info.pci_rev;
|
||||
info->vendor_id = gpu_device->get_vendor_id();
|
||||
}
|
||||
// For other sysfs related information, get from rocm-smi
|
||||
uint16_t vendor_id = 0;
|
||||
else {
|
||||
status = rsmi_wrapper(rsmi_dev_serial_number_get, device_handle,
|
||||
info->asic_serial, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
|
||||
status = rsmi_wrapper(rsmi_dev_serial_number_get, device_handle,
|
||||
info->asic_serial, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
status = rsmi_wrapper(rsmi_dev_brand_get, device_handle,
|
||||
info->market_name, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
|
||||
status = rsmi_wrapper(rsmi_dev_brand_get, device_handle,
|
||||
info->market_name, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
status = rsmi_wrapper(rsmi_dev_vendor_id_get, device_handle,
|
||||
&vendor_id);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) info->vendor_id = vendor_id;
|
||||
|
||||
status = rsmi_wrapper(rsmi_dev_vendor_id_get, device_handle,
|
||||
&vendor_id);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) info->vendor_id = vendor_id;
|
||||
|
||||
vendor_id = 0;
|
||||
status = rsmi_wrapper(rsmi_dev_subsystem_vendor_id_get, device_handle,
|
||||
&vendor_id);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) info->subvendor_id = vendor_id;
|
||||
status = rsmi_wrapper(rsmi_dev_subsystem_vendor_id_get, device_handle,
|
||||
&subvendor_id);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) info->subvendor_id = subvendor_id;
|
||||
}
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -142,6 +142,8 @@ amdsmi_status_t AMDSmiDrm::init() {
|
||||
bdf.bus_number = device->businfo.pci->bus;
|
||||
bdf.domain_number = device->businfo.pci->domain;
|
||||
|
||||
vendor_id = device->deviceinfo.pci->vendor_id;
|
||||
|
||||
drm_bdfs_.push_back(bdf);
|
||||
drm_free_device(&device);
|
||||
}
|
||||
@@ -261,6 +263,10 @@ std::vector<amdsmi_bdf_t> AMDSmiDrm::get_bdfs() {
|
||||
return drm_bdfs_;
|
||||
}
|
||||
|
||||
uint32_t AMDSmiDrm::get_vendor_id() {
|
||||
return vendor_id;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -63,6 +63,11 @@ std::string& AMDSmiGPUDevice::get_gpu_path() {
|
||||
amdsmi_bdf_t AMDSmiGPUDevice::get_bdf() {
|
||||
return bdf_;
|
||||
}
|
||||
|
||||
uint32_t AMDSmiGPUDevice::get_vendor_id() {
|
||||
return vendor_id_;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiGPUDevice::get_drm_data() {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t fd = 0;
|
||||
@@ -81,6 +86,7 @@ amdsmi_status_t AMDSmiGPUDevice::get_drm_data() {
|
||||
return AMDSMI_STATUS_INIT_ERROR;
|
||||
}
|
||||
bdf_ = bdf, path_ = path, fd_ = fd;
|
||||
vendor_id_ = drm_.get_vendor_id();
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user