[SWDEV-478807] Fix incorrect firmware versions and names

- Fix updates API to have correct enum names (PM->SMU)
 - Python API/CLI now reports correct versions and names for
    SMC/TA_XGMI/TA_RAS

Change-Id: Icbe115b3070b9f252ef15b09b781b9b3f5861e50
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
このコミットが含まれているのは:
Charis Poag
2024-08-22 23:50:19 -05:00
committed by Maisam Arif
コミット d7c583d422
2個のファイルの変更37行の追加7行の削除
+9 -1
ファイルの表示
@@ -8,7 +8,11 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
### Additions
- N/A
- **Removed `amd-smi metric --ecc` & `amd-smi metric --ecc-blocks` on Guest VMs**.
Guest VMs do not support getting current ECC counts from the Host cards.
- **Added `amd-smi static --ras`on Guest VMs**.
Guest VMs can view enabled/disabled ras features that are on Host cards.
### Optimizations
@@ -20,6 +24,10 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
- **Updated CLI error strings to handle empty and invalid GPU/CPU inputs**.
- **Fixed Guest VM showing passthrough options**.
- **Fixed firmware formatting where leading 0s were missing**.
### Known Issues
- N/A
+28 -6
ファイルの表示
@@ -2175,8 +2175,16 @@ def amdsmi_get_fw_info(
raise AmdSmiParameterException(
processor_handle, amdsmi_wrapper.amdsmi_processor_handle)
fw_info = amdsmi_wrapper.amdsmi_fw_info_t()
_check_res(amdsmi_wrapper.amdsmi_get_fw_info(
processor_handle, ctypes.byref(fw_info)))
_check_res(
amdsmi_wrapper.amdsmi_get_fw_info(
processor_handle, ctypes.byref(fw_info)
)
)
# Certain FW blocks are padded with 0s in the front intentionally
# But the C library converts the hex to an integer which trims the leading 0s
# Nor do we have a flag that defines the expected format for each FW block
# We can expect the following blocks to have a padded value and a specified format
hex_format_fw = [AmdSmiFwBlock.AMDSMI_FW_ID_PSP_SOSDRV,
AmdSmiFwBlock.AMDSMI_FW_ID_TA_RAS,
@@ -2185,20 +2193,34 @@ def amdsmi_get_fw_info(
AmdSmiFwBlock.AMDSMI_FW_ID_VCE,
AmdSmiFwBlock.AMDSMI_FW_ID_VCN]
# PM(AKA: SMC) firmware's hex value looks like 0x12345678
# However, they are parsed as: int(0x12).int(0x34).int(0x56).int(0x78)
# Which results in the following: 12.34.56.78
dec_format_fw = [AmdSmiFwBlock.AMDSMI_FW_ID_PM]
firmwares = []
for i in range(0, fw_info.num_fw_info):
fw_name = AmdSmiFwBlock(fw_info.fw_info_list[i].fw_id)
fw_version = fw_info.fw_info_list[i].fw_version
fw_version = fw_info.fw_info_list[i].fw_version # This is in int format (base 10)
if fw_name in hex_format_fw:
fw_version_string = ".".join(re.findall('..?', hex(fw_version)[2:]))
# Convert the fw_version from a int to a hex string padded leading 0s
fw_version_string = hex(fw_version)[2:].zfill(8)
# Join every two hex digits with a dot
fw_version_string = ".".join(re.findall('..?', fw_version_string))
elif fw_name in dec_format_fw:
# Convert the fw_version from a int to a hex string padded leading 0s
fw_version_string = hex(fw_version)[2:].zfill(8)
print(fw_version_string)
# Convert every two hex digits to decimal and join them with a dot
dec_version_string = ''
for ver1,ver2 in zip(hex(fw_version)[2::2], hex(fw_version)[3::2]):
dec_version_string += str(int(f"0x{ver1}{ver2}", 0)) + "."
for index, _ in enumerate(fw_version_string):
if index % 2 != 0:
continue
hex_digits = f"0x{fw_version_string[index:index+2]}"
dec_version_string += str(int(hex_digits, 16)).zfill(2) + "."
fw_version_string = dec_version_string.strip('.')
else:
fw_version_string = str(fw_version)