From 312732aa8a01a2e71f8ff759f6009b6c81c14b88 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Thu, 2 Nov 2023 02:18:40 -0500 Subject: [PATCH] SWDEV-426130 - Fixed Decimal Firmwares & Readme Signed-off-by: Maisam Arif Change-Id: I850105561be91a2c2581106371af9fab1fd8fa98 --- amdsmi_cli/README.md | 40 ++++++++++++++++---------------- amdsmi_cli/amdsmi_commands.py | 8 +++---- amdsmi_cli/amdsmi_helpers.py | 4 ++-- py-interface/README.md | 3 ++- py-interface/amdsmi_interface.py | 20 +++++++++++++--- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/amdsmi_cli/README.md b/amdsmi_cli/README.md index aae5e23f26..0be74e1c29 100644 --- a/amdsmi_cli/README.md +++ b/amdsmi_cli/README.md @@ -120,8 +120,8 @@ GPU with some basic information for each VF. optional arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices Command Modifiers: --json Displays output in JSON format (human readable by default). @@ -143,8 +143,8 @@ If no static argument is provided, all static information will be displayed. Static Arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -a, --asic All asic information -b, --bus All bus information -V, --vbios All video bios information (if available) @@ -175,8 +175,8 @@ If no GPU is specified, return firmware information for all GPUs on the system. Firmware Arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -f, --ucode-list, --fw-list All FW list information Command Modifiers: @@ -197,8 +197,8 @@ If no GPU is specified, return bad page information for all GPUs on the system. Bad Pages Arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -p, --pending Displays all pending retired pages -r, --retired Displays retired pages -u, --un-res Displays unreservable pages @@ -223,8 +223,8 @@ If no metric argument is provided all metric information will be displayed. Metric arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -w, --watch INTERVAL Reprint the command in a loop of INTERVAL seconds -W, --watch_time TIME The total TIME to watch the given command -i, --iterations ITERATIONS Total number of ITERATIONS to loop on the given command @@ -263,8 +263,8 @@ If no process argument is provided all process information will be displayed. Process arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID: 0 | BDF: 0000:23:00.0 | UUID: c4ff73bf-0000-1000-802e-0812b504ed69 - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -w, --watch INTERVAL Reprint the command in a loop of INTERVAL seconds -W, --watch_time TIME The total TIME to watch the given command -i, --iterations ITERATIONS Total number of ITERATIONS to loop on the given command @@ -292,8 +292,8 @@ If no GPU is specified, returns event information for all GPUs on the system. Event Arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices Command Modifiers: --json Displays output in JSON format (human readable by default). @@ -314,8 +314,8 @@ If no topology argument is provided all topology information will be displayed. Topology arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -a, --access Displays link accessibility between GPUs -w, --weight Displays relative weight between GPUs -o, --hops Displays the number of hops between GPUs @@ -343,8 +343,8 @@ A set argument must be provided; Multiple set arguments are accepted Set Arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID: 0 | BDF: 0000:23:00.0 | UUID: c4ff73bf-0000-1000-802e-0812b504ed69 - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -f, --fan % Set GPU fan speed (0-255 or 0-100%) -l, --perf-level LEVEL Set performance level -P, --profile SETPROFILE Set power profile level (#) or a quoted string of custom profile attributes @@ -374,8 +374,8 @@ A reset argument must be provided; Multiple reset arguments are accepted Reset Arguments: -h, --help show this help message and exit -g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices: - ID: 0 | BDF: 0000:23:00.0 | UUID: c4ff73bf-0000-1000-802e-0812b504ed69 - all | Selects all devices + ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff + all | Selects all devices -G, --gpureset Reset the specified GPU -c, --clocks Reset clocks and overdrive to default -f, --fans Reset fans to automatic (driver) control diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 741f78b960..3a8432e2cd 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -1131,8 +1131,8 @@ class AMDSMICommands(): "replay_roll_over_count" : "N/A", "nak_sent_count" : "N/A", "nak_received_count" : "N/A", - "current_bandwith_sent": "N/A", - "current_bandwith_received": "N/A", + "current_bandwidth_sent": "N/A", + "current_bandwidth_received": "N/A", "max_packet_size": "N/A"} try: @@ -1200,8 +1200,8 @@ class AMDSMICommands(): received = f"{received} MB/s" pcie_bw['max_pkt_sz'] = f"{pcie_bw['max_pkt_sz']} B" - pcie_dict['current_bandwith_sent'] = sent - pcie_dict['current_bandwith_received'] = received + pcie_dict['current_bandwidth_sent'] = sent + pcie_dict['current_bandwidth_received'] = received pcie_dict['max_packet_size'] = pcie_bw['max_pkt_sz'] except amdsmi_exception.AmdSmiLibraryException as e: logging.debug("Failed to get pcie bandwidth for gpu %s | %s", gpu_id, e.get_error_info()) diff --git a/amdsmi_cli/amdsmi_helpers.py b/amdsmi_cli/amdsmi_helpers.py index 2efb9a573b..cb5f7cf1bb 100644 --- a/amdsmi_cli/amdsmi_helpers.py +++ b/amdsmi_cli/amdsmi_helpers.py @@ -170,11 +170,11 @@ class AMDSMIHelpers(): id_padding = max_padding else: id_padding = max_padding - int(math.log10(gpu_id)) - gpu_choices_str += f"\tID: {gpu_id}{' ' * id_padding}| BDF: {bdf} | UUID: {uuid}\n" + gpu_choices_str += f"ID: {gpu_id}{' ' * id_padding}| BDF: {bdf} | UUID: {uuid}\n" # Add the all option to the gpu_choices gpu_choices["all"] = "all" - gpu_choices_str += f"\t all{' ' * max_padding}| Selects all devices\n" + gpu_choices_str += f" all{' ' * max_padding}| Selects all devices\n" return (gpu_choices, gpu_choices_str) diff --git a/py-interface/README.md b/py-interface/README.md index 7b254b0f86..8ef3ff222d 100644 --- a/py-interface/README.md +++ b/py-interface/README.md @@ -584,7 +584,8 @@ try: firmware_list = amdsmi_get_fw_info(device)['fw_list'] for firmware_block in firmware_list: print(firmware_block['fw_name']) - print(firmware_block['fw_version']) # String formated hex version ie: 21.00.00.AC + # String formated hex or decimal value ie: 21.00.00.AC or 130 + print(firmware_block['fw_version']) except AmdSmiException as e: print(e) ``` diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index 1e37eb7adf..e7adccfb29 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -1375,12 +1375,26 @@ def amdsmi_get_fw_info( _check_res(amdsmi_wrapper.amdsmi_get_fw_info( processor_handle, ctypes.byref(fw_info))) + hex_format_fw = [AmdSmiFwBlock.FW_ID_SMC, + AmdSmiFwBlock.FW_ID_PSP_SOSDRV, + AmdSmiFwBlock.FW_ID_TA_RAS, + AmdSmiFwBlock.FW_ID_XGMI, + AmdSmiFwBlock.FW_ID_UVD, + AmdSmiFwBlock.FW_ID_VCE, + AmdSmiFwBlock.FW_ID_VCN] + firmwares = [] for i in range(0, fw_info.num_fw_info): - fw_version = hex(fw_info.fw_info_list[i].fw_version) - fw_version_string = ".".join(re.findall('..?', fw_version[2:])) + fw_name = AmdSmiFwBlock(fw_info.fw_info_list[i].fw_id) + fw_version = fw_info.fw_info_list[i].fw_version + + if fw_name in hex_format_fw: + fw_version_string = ".".join(re.findall('..?', hex(fw_version)[2:])) + else: + fw_version_string = str(fw_version) + firmwares.append({ - 'fw_name': AmdSmiFwBlock(fw_info.fw_info_list[i].fw_id), + 'fw_name': fw_name, 'fw_version': fw_version_string.upper(), }) return {