From 294b2df38f843518c08f3bb7c488a8f1a1c06dc3 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Mon, 31 Jul 2023 06:59:13 -0500 Subject: [PATCH] ASIC serial updates Corrected asic serial fallback to use rsmi's unique id Removed product serial due to duplication Change-Id: Ib4e9ac00d2bf31ccbc35060bc84f7e79e5332d37 Signed-off-by: Maisam Arif [ROCm/amdsmi commit: d705801adfdd8d863e31dd53c00cfcc626595c90] --- projects/amdsmi/amdsmi_cli/amdsmi_commands.py | 3 ++- projects/amdsmi/include/amd_smi/amdsmi.h | 2 +- projects/amdsmi/src/amd_smi/amd_smi.cc | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index eb119f8b5f..509da4bf18 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -259,9 +259,10 @@ class AMDSMICommands(): board_info = amdsmi_interface.amdsmi_get_gpu_board_info(args.gpu) board_info['serial_number'] = hex(board_info['serial_number']) board_info['model_number'] = board_info['model_number'].strip() - board_info['product_serial'] = '0x' + board_info['product_serial'] board_info['product_name'] = board_info['product_name'].strip() board_info['manufacturer_name'] = board_info['manufacturer_name'].strip() + board_info.pop('product_serial') + board_info.pop('manufacturer_name') static_dict['board'] = board_info except amdsmi_exception.AmdSmiLibraryException as e: diff --git a/projects/amdsmi/include/amd_smi/amdsmi.h b/projects/amdsmi/include/amd_smi/amdsmi.h index 529c795fa8..38a1741dae 100644 --- a/projects/amdsmi/include/amd_smi/amdsmi.h +++ b/projects/amdsmi/include/amd_smi/amdsmi.h @@ -392,7 +392,7 @@ typedef struct { char market_name[AMDSMI_MAX_STRING_LENGTH]; uint32_t vendor_id; //< Use 32 bit to be compatible with other platform. uint32_t subvendor_id; //< The subsystem vendor id - uint64_t device_id; //< The unique id of a GPU + uint64_t device_id; //< The device id of a GPU uint32_t rev_id; char asic_serial[AMDSMI_NORMAL_STRING_LENGTH]; uint32_t reserved[3]; diff --git a/projects/amdsmi/src/amd_smi/amd_smi.cc b/projects/amdsmi/src/amd_smi/amd_smi.cc index b534b106b7..b366da4095 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi.cc @@ -668,8 +668,9 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i } // For other sysfs related information, get from rocm-smi else { - status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle, - info->asic_serial, AMDSMI_NORMAL_STRING_LENGTH); + uint64_t dv_uid = 0; + status = rsmi_wrapper(rsmi_dev_unique_id_get, processor_handle, &dv_uid); + if (status == AMDSMI_STATUS_SUCCESS) snprintf(info->asic_serial, sizeof(info->asic_serial), "%d", dv_uid); status = rsmi_wrapper(rsmi_dev_brand_get, processor_handle, info->market_name, AMDSMI_NORMAL_STRING_LENGTH);