diff --git a/CHANGELOG.md b/CHANGELOG.md index 2163e9013b..a24f62244d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -187,18 +187,33 @@ GPU: 0 ### Changed - **Changed `amd-smi static --vbios` to `amd-smi static --ifwi`**. - - `amd-smi static --vbios` can still be used but will not show up in help output. Users should now use `amd-smi static --ifwi` instead. - - `amd-smi static --ifwi` output also includes the build number as a new displayed field: + - VBIOS naming is replaced with IFWI (Integrated Firmware Image) for improved clarity and consistency. + - Mi300+ series devices now use a new version format with enhanced build information. + - Legacy command `amd-smi static --vbios` remains functional for backward compatibility, but displays updated IFWI heading. + - The Python, C & Rust API for `amdsmi_get_gpu_vbios_version` will now have a new field called `boot_firmware` which will return the legacy vbios version number which is also known as the Unified BootLoader Version (UBL version) - ```console + ```shell $ amd-smi static --ifwi GPU: 0 - IFWI: - NAME: AMD MI300X_HW_SRIOV_CVS_1VF - BUILD_DATE: 2025/03/11 17:15 - PART_NUMBER: 113-M3000100-103 - VERSION: 022.040.003.043.000001 - BUILD_NUMBER: 00143181 + IFWI: + NAME: XXXXXXXXXXXXXXXXXX + BUILD_DATE: 2020/10/29 13:30 + PART_NUMBER: 113-XXXXXXXX-111 + VERSION: 000.000.000.000.000000 (Legacy format) + ... + ``` + + **New format (Mi300+ series and IFWI systems):** + + ```shell + $ amd-smi static --ifwi + GPU: 0 + IFWI: + NAME: XXXXXXXXXXXXXXXXXX + BUILD_DATE: 2020/10/29 13:30 + PART_NUMBER: 113-XXXXXXXX-111 + VERSION: 00111111 (New format) + ... ``` ### Removed diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 7db577dddb..6a3c68ffbe 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -583,10 +583,12 @@ class AMDSMICommands(): if isinstance(value, str): if value.strip() == '': vbios_info[key] = "N/A" - static_dict['vbios'] = vbios_info + static_dict['ifwi'] = vbios_info + # Remove boot_firmware since it's not used + del static_dict['ifwi']['boot_firmware'] except amdsmi_exception.AmdSmiLibraryException as e: - static_dict['vbios'] = "N/A" - logging.debug("Failed to get vbios info for gpu %s | %s", gpu_id, e.get_error_info()) + static_dict['ifwi'] = "N/A" + logging.debug("Failed to get vbios/ifwi info for gpu %s | %s", gpu_id, e.get_error_info()) if 'limit' in current_platform_args: if args.limit: # Power limits diff --git a/amdsmi_cli/amdsmi_parser.py b/amdsmi_cli/amdsmi_parser.py index f65ae5f9ea..f6d2459043 100644 --- a/amdsmi_cli/amdsmi_parser.py +++ b/amdsmi_cli/amdsmi_parser.py @@ -771,7 +771,7 @@ class AMDSMIParser(argparse.ArgumentParser): # Optional arguments help text asic_help = "All asic information" bus_help = "All bus information" - vbios_help = "All video bios information (if available)" + vbios_help = "All video bios/IFWI information (if available)" limit_help = "All limit metric values (i.e. power and thermal limits)" driver_help = "Displays driver version" vram_help = "All vram information" @@ -813,7 +813,9 @@ class AMDSMIParser(argparse.ArgumentParser): if self.helpers.is_amdgpu_initialized(): static_parser.add_argument('-a', '--asic', action='store_true', required=False, help=asic_help) static_parser.add_argument('-b', '--bus', action='store_true', required=False, help=bus_help) - static_parser.add_argument('-V', '--vbios', action='store_true', required=False, help=vbios_help) + # Accept vbios args without displaying them + static_parser.add_argument('-V', '--vbios', dest='vbios', action='store_true', required=False, help=argparse.SUPPRESS) + static_parser.add_argument('-I', '--ifwi', dest='vbios', action='store_true', required=False, help=vbios_help) static_parser.add_argument('-d', '--driver', action='store_true', required=False, help=driver_help) static_parser.add_argument('-v', '--vram', action='store_true', required=False, help=vram_help) static_parser.add_argument('-c', '--cache', action='store_true', required=False, help=cache_help) diff --git a/docs/how-to/amdsmi-cli-tool.md b/docs/how-to/amdsmi-cli-tool.md index 9540f172e2..dd90a457ab 100644 --- a/docs/how-to/amdsmi-cli-tool.md +++ b/docs/how-to/amdsmi-cli-tool.md @@ -159,7 +159,7 @@ Static Arguments: -h, --help show this help message and exit -a, --asic All asic information -b, --bus All bus information - -V, --vbios All video bios information (if available) + -I, --ifwi All video bios\IFWI information (if available) -d, --driver Displays driver version -v, --vram All vram information -c, --cache All cache information @@ -913,7 +913,7 @@ GPU: 0 MAX_PCIE_SPEED: 32 GT/s PCIE_INTERFACE_VERSION: Gen 5 SLOT_TYPE: PCIE - VBIOS: + IFWI: NAME: N/A BUILD_DATE: N/A PART_NUMBER: N/A diff --git a/docs/reference/amdsmi-py-api.md b/docs/reference/amdsmi-py-api.md index cbfe9ebe27..24504886cf 100644 --- a/docs/reference/amdsmi-py-api.md +++ b/docs/reference/amdsmi-py-api.md @@ -647,7 +647,7 @@ except AmdSmiException as e: ### amdsmi_get_gpu_vbios_info -Description: Returns the static information for the VBIOS on the device. +Description: Returns the static information for the VBIOS/IFWI on the device. Input parameters: @@ -657,10 +657,11 @@ Output: Dictionary with fields Field | Description ---|--- -`name` | vbios name -`build_date` | vbios build date -`part_number` | vbios part number -`version` | vbios version string +`name` | VBIOS/IFWI name +`build_date` | VBIOS/IFWI build date +`part_number` | VBIOS/IFWI part number +`version` | VBIOS/IFWI version string +`boot_firmware` | Unified BootLoader version if available; N/A otherwise Exceptions that can be thrown by `amdsmi_get_gpu_vbios_info` function: @@ -682,6 +683,7 @@ try: print(vbios_info['build_date']) print(vbios_info['part_number']) print(vbios_info['version']) + print(vbios_info['boot_firmware']) except AmdSmiException as e: print(e) ``` diff --git a/example/amd_smi_drm_example.cc b/example/amd_smi_drm_example.cc index 210852747d..55db8b9c7d 100644 --- a/example/amd_smi_drm_example.cc +++ b/example/amd_smi_drm_example.cc @@ -1101,11 +1101,11 @@ int main() { ret = amdsmi_get_gpu_vbios_info(processor_handles[device_index], &vbios_info); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_gpu_vbios_info:\n"); - printf("\tVBios Name: %s\n", vbios_info.name); - printf("\tBuild Date: %s\n", vbios_info.build_date); - printf("\tPart Number: %s\n", vbios_info.part_number); - printf("\tVBios Version String: %s\n\n", - vbios_info.version); + printf("\tVBIOS/IFWI Name: %s\n", vbios_info.name); + printf("\tVBIOS/IFWI Build Date: %s\n", vbios_info.build_date); + printf("\tVBIOS/IFWI Part Number: %s\n", vbios_info.part_number); + printf("\tVBIOS/IFWI Version String: %s\n\n", vbios_info.version); + printf("\tVBIOS/IFWI Boot Firmware: %s\n\n", vbios_info.boot_firmware); // Get Cache info amdsmi_gpu_cache_info_t cache_info = {}; diff --git a/example/amd_smi_nodrm_example.cc b/example/amd_smi_nodrm_example.cc index 3b0024e73d..973fb7a6b2 100644 --- a/example/amd_smi_nodrm_example.cc +++ b/example/amd_smi_nodrm_example.cc @@ -139,11 +139,11 @@ int main() { ret = amdsmi_get_gpu_vbios_info(processor_handles[j], &vbios_info); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_gpu_vbios_info:\n"); - printf("\tVBios Name: %s\n", vbios_info.name); - printf("\tBuild Date: %s\n", vbios_info.build_date); - printf("\tPart Number: %s\n", vbios_info.part_number); - printf("\tVBios Version String: %s\n\n", - vbios_info.version); + printf("\tVBIOS/IFWI Name: %s\n", vbios_info.name); + printf("\tVBIOS/IFWI Build Date: %s\n", vbios_info.build_date); + printf("\tVBIOS/IFWI Part Number: %s\n", vbios_info.part_number); + printf("\tVBIOS/IFWI Version String: %s\n\n", vbios_info.version); + printf("\tVBIOS/IFWI Boot Firmware: %s\n\n", vbios_info.boot_firmware); // Get engine usage info amdsmi_engine_usage_t engine_usage = {}; diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index fb22a02eb1..cbe7f90d08 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -842,7 +842,8 @@ typedef struct { char build_date[AMDSMI_MAX_STRING_LENGTH]; char part_number[AMDSMI_MAX_STRING_LENGTH]; char version[AMDSMI_MAX_STRING_LENGTH]; - uint64_t reserved[68]; + char boot_firmware[AMDSMI_MAX_STRING_LENGTH]; // UBL (Unified BootLoader) Version information + uint64_t reserved[36]; } amdsmi_vbios_info_t; /** @@ -2360,7 +2361,8 @@ typedef struct { * @platform{guest_mvf} @platform{guest_windows} * * @details This function initializes the library and the internal data structures, - * including those corresponding to sources of information that SMI provides. + * including those corresponding to sources of information that SMI provides. + * Singleton Design, requires the same number of inits as shutdowns. * * The @p init_flags decides which type of processor * can be discovered by ::amdsmi_get_socket_handles(). AMDSMI_INIT_AMD_GPUS returns @@ -2385,7 +2387,8 @@ amdsmi_status_t amdsmi_init(uint64_t init_flags); * @platform{guest_mvf} @platform{guest_windows} * * @details This function shuts down the library and internal data structures and - * performs any necessary clean ups. + * performs any necessary clean ups. Singleton Design, requires the same number + * of inits as shutdowns. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ @@ -4874,7 +4877,8 @@ amdsmi_get_gpu_cper_entries(amdsmi_processor_handle processor_handle, uint32_t s * * @details A utility function which retrieves the AFIDs from the CPER record. * - * @param[in] cper_buffer a pointer to the buffer with one CPER record. The caller must make sure the whole CPER record is loaded into the buffer. + * @param[in] cper_buffer a pointer to the buffer with one CPER record. + * The caller must make sure the whole CPER record is loaded into the buffer. * * @param[in] buf_size is the size of the cper_buffer. * diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index fb94bde1f3..49e2a729f5 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -2310,11 +2310,16 @@ def amdsmi_get_gpu_vbios_info( processor_handle, ctypes.byref(vbios_info)) ) + boot_firmware = vbios_info.boot_firmware.decode("utf-8") + if boot_firmware == "": + boot_firmware = "N/A" + return { "name": vbios_info.name.decode("utf-8"), "build_date": vbios_info.build_date.decode("utf-8"), "part_number": vbios_info.part_number.decode("utf-8"), "version": vbios_info.version.decode("utf-8"), + "boot_firmware": boot_firmware, } diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index 285a0e5bda..e4cc8e78d4 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -1028,7 +1028,8 @@ struct_amdsmi_vbios_info_t._fields_ = [ ('build_date', ctypes.c_char * 256), ('part_number', ctypes.c_char * 256), ('version', ctypes.c_char * 256), - ('reserved', ctypes.c_uint64 * 68), + ('boot_firmware', ctypes.c_char * 256), + ('reserved', ctypes.c_uint64 * 36), ] amdsmi_vbios_info_t = struct_amdsmi_vbios_info_t diff --git a/rocm_smi/include/rocm_smi/rocm_smi.h b/rocm_smi/include/rocm_smi/rocm_smi.h index 2f83bd418d..862c97ee40 100644 --- a/rocm_smi/include/rocm_smi/rocm_smi.h +++ b/rocm_smi/include/rocm_smi/rocm_smi.h @@ -3923,6 +3923,35 @@ rsmi_version_str_get(rsmi_sw_component_t component, char *ver_str, rsmi_status_t rsmi_dev_vbios_version_get(uint32_t dv_ind, char *vbios, uint32_t len); +/** + * @brief Get the VBIOS Build string + * + * @details Given a device ID @p dv_ind, and a pointer to a char buffer, + * @p vbios, this function will write the VBIOS Build string (up to @p len + * characters) for device @p dv_ind to @p vbios. The caller must ensure that + * it is safe to write at least @p len characters to @p vbios. + * + * @param[in] dv_ind a device index + * + * @param[inout] vbios_build_number A pointer to a buffer of char's to which the VBIOS + * Build will be written + * If this parameter is nullptr, this function will return + * ::RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, + * arguments and ::RSMI_STATUS_NOT_SUPPORTED if it is not supported with the + * provided arguments. + * + * @param[in] len The number of char's pointed to by @p vbios which can safely + * be written to by this function. + * + * @retval ::RSMI_STATUS_SUCCESS call was successful + * @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not + * support this function with the given arguments + * @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid + * + */ +rsmi_status_t +rsmi_dev_vbios_build_number_get(uint32_t dv_ind, char *vbios_build_number, uint32_t len); + /** * @brief Get the firmware versions for a device * diff --git a/rocm_smi/include/rocm_smi/rocm_smi_device.h b/rocm_smi/include/rocm_smi/rocm_smi_device.h index 91680a436f..64b1b763ba 100644 --- a/rocm_smi/include/rocm_smi/rocm_smi_device.h +++ b/rocm_smi/include/rocm_smi/rocm_smi_device.h @@ -104,6 +104,7 @@ enum DevInfoTypes { kDevUsage, kDevPowerODVoltage, kDevVBiosVer, + kDevVBiosBuild, kDevPCIEThruPut, kDevErrCntSDMA, kDevErrCntUMC, diff --git a/rocm_smi/src/rocm_smi.cc b/rocm_smi/src/rocm_smi.cc index 32d813b76f..0a163e8267 100644 --- a/rocm_smi/src/rocm_smi.cc +++ b/rocm_smi/src/rocm_smi.cc @@ -4658,7 +4658,7 @@ rsmi_dev_vbios_version_get(uint32_t dv_ind, char *vbios, uint32_t len) { DEVICE_MUTEX int ret = dev->readDevInfo(amd::smi::kDevVBiosVer, &val_str); - if (ret != 0) { + if (ret != RSMI_STATUS_SUCCESS) { return amd::smi::ErrnoToRsmiStatus(ret); } @@ -4674,6 +4674,39 @@ rsmi_dev_vbios_version_get(uint32_t dv_ind, char *vbios, uint32_t len) { CATCH } +rsmi_status_t +rsmi_dev_vbios_build_number_get(uint32_t dv_ind, char *vbios_build, uint32_t len) { + TRY + std::ostringstream ss; + ss << __PRETTY_FUNCTION__ << "| ======= start ======="; + LOG_TRACE(ss); + CHK_SUPPORT_NAME_ONLY(vbios_build) + + if (len == 0) { + return RSMI_STATUS_INVALID_ARGS; + } + + std::string val_str; + + DEVICE_MUTEX + int ret = dev->readDevInfo(amd::smi::kDevVBiosBuild, &val_str); + + if (ret != RSMI_STATUS_SUCCESS) { + return amd::smi::ErrnoToRsmiStatus(ret); + } + + uint32_t ln = static_cast(val_str.copy(vbios_build, len)); + + vbios_build[std::min(len - 1, ln)] = '\0'; + + if (len < (val_str.size() + 1)) { + return RSMI_STATUS_INSUFFICIENT_SIZE; + } + return RSMI_STATUS_SUCCESS; + + CATCH +} + rsmi_status_t rsmi_version_get(rsmi_version_t *version) { TRY diff --git a/rocm_smi/src/rocm_smi_device.cc b/rocm_smi/src/rocm_smi_device.cc index 84a738c822..2630dc03e6 100755 --- a/rocm_smi/src/rocm_smi_device.cc +++ b/rocm_smi/src/rocm_smi_device.cc @@ -86,6 +86,7 @@ static const char *kDevPowerProfileModeFName = "pp_power_profile_mode"; static const char *kDevPowerODVoltageFName = "pp_od_clk_voltage"; static const char *kDevUsageFName = "gpu_busy_percent"; static const char *kDevVBiosVerFName = "vbios_version"; +static const char *kDevVBiosBuildFName = "vbios_build"; static const char *kDevPCIEThruPutFName = "pcie_bw"; static const char *kDevErrCntSDMAFName = "ras/sdma_err_count"; static const char *kDevErrCntUMCFName = "ras/umc_err_count"; @@ -268,6 +269,7 @@ static const std::map kDevAttribNameMap = { {kDevUsage, kDevUsageFName}, {kDevPowerODVoltage, kDevPowerODVoltageFName}, {kDevVBiosVer, kDevVBiosVerFName}, + {kDevVBiosBuild, kDevVBiosBuildFName}, {kDevPCIEThruPut, kDevPCIEThruPutFName}, {kDevErrCntSDMA, kDevErrCntSDMAFName}, {kDevErrCntUMC, kDevErrCntUMCFName}, @@ -444,6 +446,7 @@ Device::devInfoTypesStrings = { {kDevUsage, "kDevUsage"}, {kDevPowerODVoltage, "kDevPowerODVoltage"}, {kDevVBiosVer, "kDevVBiosVer"}, + {kDevVBiosBuild, "kDevVBiosBuild"}, {kDevPCIEThruPut, "kDevPCIEThruPut"}, {kDevErrCntSDMA, "kDevErrCntSDMA"}, {kDevErrCntUMC, "kDevErrCntUMC"}, @@ -569,20 +572,21 @@ static const std::map kDevFuncDependsMap = { {"rsmi_dev_soc_pstate_get", {{kDevSocPstateFName}, {}}}, {"rsmi_dev_xgmi_plpd_set", {{kDevXgmiPlpdFName}, {}}}, {"rsmi_dev_xgmi_plpd_get", {{kDevXgmiPlpdFName}, {}}}, - {"rsmi_dev_process_isolation_set", {{kDevProcessIsolationFName}, {}}}, - {"rsmi_dev_process_isolation_get", {{kDevProcessIsolationFName}, {}}}, - {"rsmi_dev_gpu_shader_clean", {{kDevShaderCleanFName}, {}}}, + {"rsmi_dev_process_isolation_set", {{kDevProcessIsolationFName}, {}}}, + {"rsmi_dev_process_isolation_get", {{kDevProcessIsolationFName}, {}}}, + {"rsmi_dev_gpu_shader_clean", {{kDevShaderCleanFName}, {}}}, {"rsmi_perf_determinism_mode_set", {{kDevPerfLevelFName, kDevPowerODVoltageFName}, {}}}, {"rsmi_dev_overdrive_level_set", {{kDevOverDriveLevelFName}, {}}}, {"rsmi_dev_vbios_version_get", {{kDevVBiosVerFName}, {}}}, + {"rsmi_dev_vbios_build_number_get", {{kDevVBiosBuildFName}, {}}}, {"rsmi_dev_od_volt_info_get", {{kDevPowerODVoltageFName}, {}}}, {"rsmi_dev_od_volt_info_set", {{kDevPowerODVoltageFName, kDevPerfLevelFName}, {}}}, {"rsmi_dev_od_volt_curve_regions_get", {{kDevPowerODVoltageFName}, {}}}, {"rsmi_dev_ecc_enabled_get", {{kDevErrCntFeaturesFName}, {}}}, {"rsmi_dev_ecc_status_get", {{kDevErrCntFeaturesFName}, {}}}, - {"rsmi_ras_feature_info_get", {{kDevErrRASSchemaFName, + {"rsmi_ras_feature_info_get", {{kDevErrRASSchemaFName, kDevErrTableVersionFName}, {}}}, {"rsmi_dev_counter_group_supported", {{}, {}}}, {"rsmi_dev_counter_create", {{}, {}}}, @@ -1472,6 +1476,7 @@ int Device::readDevInfo(DevInfoTypes type, std::string *val) { case kDevPCieVendorID: case kDevVramVendor: case kDevVBiosVer: + case kDevVBiosBuild: case kDevPCIEThruPut: case kDevSerialNumber: case kDevAvailableComputePartition: diff --git a/rust-interface/src/amdsmi_wrapper.rs b/rust-interface/src/amdsmi_wrapper.rs index dde08b2acf..56d735bcce 100644 --- a/rust-interface/src/amdsmi_wrapper.rs +++ b/rust-interface/src/amdsmi_wrapper.rs @@ -972,7 +972,8 @@ pub struct AmdsmiVbiosInfoT { pub build_date: [::std::os::raw::c_char; 256usize], pub part_number: [::std::os::raw::c_char; 256usize], pub version: [::std::os::raw::c_char; 256usize], - pub reserved: [u64; 68usize], + pub boot_firmware: [::std::os::raw::c_char; 256usize], + pub reserved: [u64; 36usize], } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { @@ -986,8 +987,10 @@ const _: () = { [::std::mem::offset_of!(AmdsmiVbiosInfoT, part_number) - 512usize]; ["Offset of field: AmdsmiVbiosInfoT::version"] [::std::mem::offset_of!(AmdsmiVbiosInfoT, version) - 768usize]; + ["Offset of field: AmdsmiVbiosInfoT::boot_firmware"] + [::std::mem::offset_of!(AmdsmiVbiosInfoT, boot_firmware) - 1024usize]; ["Offset of field: AmdsmiVbiosInfoT::reserved"] - [::std::mem::offset_of!(AmdsmiVbiosInfoT, reserved) - 1024usize]; + [::std::mem::offset_of!(AmdsmiVbiosInfoT, reserved) - 1280usize]; }; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/rust-interface/src/utils.rs b/rust-interface/src/utils.rs index 789e50ebe4..21807df3b5 100644 --- a/rust-interface/src/utils.rs +++ b/rust-interface/src/utils.rs @@ -156,7 +156,7 @@ impl AmdsmiBdfT { } // Implement the getters for the C string fields in AmdsmiVbiosInfoT -impl_cstr_getters!(AmdsmiVbiosInfoT, name, build_date, part_number, version); +impl_cstr_getters!(AmdsmiVbiosInfoT, name, build_date, part_number, version, boot_firmware); // Implement the getters for the C string fields in AmdsmiAsicInfoT impl_cstr_getters!(AmdsmiAsicInfoT, market_name, vendor_name, asic_serial); diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index b5cdd0de6d..2ea773175e 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -3931,28 +3931,42 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios info->build_date[AMDSMI_MAX_STRING_LENGTH - 1] = '\0'; strncpy(info->part_number, reinterpret_cast(vbios.vbios_pn), AMDSMI_MAX_STRING_LENGTH); + // Navi devices still interpret vbios version from drm vbios_ver_str strncpy(info->version, reinterpret_cast(vbios.vbios_ver_str), AMDSMI_MAX_STRING_LENGTH); } else { - // get vbios version string from rocm_smi + // get sysfs vbios_version string which is known as the part number char vbios_version[AMDSMI_MAX_STRING_LENGTH]; status = rsmi_wrapper(rsmi_dev_vbios_version_get, processor_handle, 0, - vbios_version, - AMDSMI_MAX_STRING_LENGTH); + vbios_version, AMDSMI_MAX_STRING_LENGTH); - // ignore the errors so that it can populate as many fields as possible. + // fail if cannot get vbios version from sysfs if (status == AMDSMI_STATUS_SUCCESS) { - strncpy(info->version, - vbios_version, AMDSMI_MAX_STRING_LENGTH); + strncpy(info->part_number, vbios_version, AMDSMI_MAX_STRING_LENGTH); } } libdrm.unload(); + + // get vbios build string from rocm_smi which translates to ifwi version + char vbios_build_number[AMDSMI_MAX_STRING_LENGTH]; + amdsmi_status_t build_status; + build_status = rsmi_wrapper(rsmi_dev_vbios_build_number_get, processor_handle, 0, + vbios_build_number, AMDSMI_MAX_STRING_LENGTH); + + // Continue if sysfs doesn't exist + if (build_status == AMDSMI_STATUS_SUCCESS) { + // This device has an ifwi version so swap the version and boot_firmware + strncpy(info->boot_firmware, info->version, AMDSMI_MAX_STRING_LENGTH); + strncpy(info->version, vbios_build_number, AMDSMI_MAX_STRING_LENGTH); + } + ss << __PRETTY_FUNCTION__ << " | drmCommandWrite returned: " << strerror(errno) << "\n" << " | vbios name: " << info->name << "\n" << " | vbios build date: " << info->build_date << "\n" << " | vbios part number: " << info->part_number << "\n" << " | vbios version: " << info->version << "\n" + << " | vbios boot_firmware: " << info->boot_firmware<< "\n" << " | Returning: " << smi_amdgpu_get_status_string(status, false); LOG_INFO(ss); return status; diff --git a/tests/amd_smi_test/functional/sys_info_read.cc b/tests/amd_smi_test/functional/sys_info_read.cc index 9344855ebd..6ebcd35a79 100644 --- a/tests/amd_smi_test/functional/sys_info_read.cc +++ b/tests/amd_smi_test/functional/sys_info_read.cc @@ -79,8 +79,8 @@ void TestSysInfoRead::Run(void) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { PrintDeviceHeader(processor_handles_[i]); - amdsmi_vbios_info_t info; - err = amdsmi_get_gpu_vbios_info(processor_handles_[i], &info); + amdsmi_vbios_info_t vbios_info; + err = amdsmi_get_gpu_vbios_info(processor_handles_[i], &vbios_info); if (err != AMDSMI_STATUS_SUCCESS) { if ((err == AMDSMI_STATUS_FILE_ERROR) || (err == AMDSMI_STATUS_NOT_SUPPORTED)) { @@ -101,7 +101,7 @@ void TestSysInfoRead::Run(void) { } else { IF_VERB(STANDARD) { std::cout << "\t**VBIOS Version: " - << info.version << std::endl; + << vbios_info.version << std::endl; } } diff --git a/tests/python_unittest/README.md b/tests/python_unittest/README.md index 721842db80..583079f1f6 100644 --- a/tests/python_unittest/README.md +++ b/tests/python_unittest/README.md @@ -122,6 +122,7 @@ test_bdf_device_id (__main__.TestAmdSmiPythonInterface) ... vbios_info['build_date'] is: 2021/03/28 21:35 vbios_info['version'] is: 020.001.000.060.000000 vbios_info['name'] is: 113-MSITV395MH.132 + vbios_info['boot_firmware'] is: 01234567 ###Test amdsmi_get_gpu_device_uuid @@ -474,6 +475,7 @@ test_vbios_info (__main__.TestAmdSmiPythonInterface) ... vbios_info['build_date'] is: 2021/03/28 21:35 vbios_info['name'] is: 113-MSITV395MH.132 vbios_info['version'] is: 020.001.000.060.000000 + vbios_info['boot_firmware'] is: 01234567 ok test_vendor_name (__main__.TestAmdSmiPythonInterface) ... @@ -544,6 +546,7 @@ test_walkthrough (__main__.TestAmdSmiPythonInterface) ... vbios_info['build_date'] is: 2021/03/28 21:35 vbios_info['name'] is: 113-MSITV395MH.132 vbios_info['version'] is: 020.001.000.060.000000 + vbios_info['boot_firmware'] is: 01234567 diff --git a/tests/python_unittest/integration_test.py b/tests/python_unittest/integration_test.py index a7f379bd29..89ae688319 100755 --- a/tests/python_unittest/integration_test.py +++ b/tests/python_unittest/integration_test.py @@ -60,6 +60,17 @@ class TestAmdSmiPythonInterface(unittest.TestCase): def tearDown(self): amdsmi.amdsmi_shut_down() + def _print_vbios_info(self, vbios_info): + print(f" vbios_info['part_number'] is: {vbios_info['part_number']}") + print(f" vbios_info['build_date'] is: {vbios_info['build_date']}") + print(f" vbios_info['name'] is: {vbios_info['name']}") + print(f" vbios_info['version'] is: {vbios_info['version']}") + if 'boot_firmware' in vbios_info: + print(f" vbios_info['boot_firmware'] is: {vbios_info['boot_firmware']}") + else: + print(" vbios_info['boot_firmware'] is: N/A") + return + def test_asic_kfd_info(self): processors = amdsmi.amdsmi_get_processor_handles() self.assertGreaterEqual(len(processors), 1) @@ -251,14 +262,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase): except amdsmi.AmdSmiLibraryException as e: self._check_exception(e) continue - print(" vbios_info['part_number'] is: {}".format( - vbios_info['part_number'])) - print(" vbios_info['build_date'] is: {}".format( - vbios_info['build_date'])) - print(" vbios_info['version'] is: {}".format( - vbios_info['version'])) - print(" vbios_info['name'] is: {}".format( - vbios_info['name'])) + self._print_vbios_info(vbios_info) try: print("\n###Test amdsmi_get_gpu_device_uuid \n") uuid = amdsmi.amdsmi_get_gpu_device_uuid(processor) @@ -1001,7 +1005,6 @@ class TestAmdSmiPythonInterface(unittest.TestCase): print(" Utilization count for {} is: {}".format( utilization_count[3]['type'], utilization_count[3]['value'])) print("\n") - def test_vbios_info(self): @@ -1017,16 +1020,8 @@ class TestAmdSmiPythonInterface(unittest.TestCase): except amdsmi.AmdSmiLibraryException as e: self._check_exception(e) continue - print(" vbios_info['part_number'] is: {}".format( - vbios_info['part_number'])) - print(" vbios_info['build_date'] is: {}".format( - vbios_info['build_date'])) - print(" vbios_info['name'] is: {}".format( - vbios_info['name'])) - print(" vbios_info['version'] is: {}".format( - vbios_info['version'])) + self._print_vbios_info(vbios_info) print("\n") - def test_vendor_name(self): @@ -1044,7 +1039,6 @@ class TestAmdSmiPythonInterface(unittest.TestCase): continue print(" Vendor name is: {}".format(vendor_name)) print("\n") - # @unittest.SkipTest def test_accelerator_partition_profile(self):