From 58177acb0b818b681fdb0e2b3e94597b49354897 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Thu, 30 May 2024 04:03:15 -0500 Subject: [PATCH] SWDEV-461038 - Enabled Passthrough as BM for CLI Commands Signed-off-by: Maisam Arif Change-Id: I1ae6a065f10ce580b45b79c0a8588853f5f304f7 [ROCm/amdsmi commit: 80eeff3dd41d3cfe5c341ffba93156c012b9f920] --- projects/amdsmi/CHANGELOG.md | 5 ++++- projects/amdsmi/amdsmi_cli/amdsmi_helpers.py | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/projects/amdsmi/CHANGELOG.md b/projects/amdsmi/CHANGELOG.md index 1169674e4e..7ab37a950b 100644 --- a/projects/amdsmi/CHANGELOG.md +++ b/projects/amdsmi/CHANGELOG.md @@ -4,10 +4,13 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr ***All information listed below is for reference and subject to change.*** -## amd_smi_lib for ROCm 6.1.2 +## amd_smi_lib for ROCm 6.2.0 ### Additions +- **Addedd Handling to detect VMs with passthrough configurations in CLI Tool**. +CLI Tool had only allowed a restricted set of options for Virtual Machines with passthrough GPUs. Now we offer an expanded set of functions availble to passthrough configured GPUs. + - **Added macros that were in `amdsmi.h` to the amdsmi Python library `amdsmi_interface.py`**. Added macros to reference max size limitations for certain amdsmi functions such as max dpm policies and max fanspeed. diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py index fc19194727..f1bc229e21 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py @@ -49,6 +49,7 @@ class AMDSMIHelpers(): self._is_hypervisor = False self._is_virtual_os = False self._is_baremetal = False + self._is_passthrough = False self._is_linux = False self._is_windows = False @@ -63,6 +64,14 @@ class AMDSMIHelpers(): else: self._is_virtual_os = True + # Check for passthrough system filtering by device id + output = run(["lspci", "-nn"], stdout=PIPE, stderr=STDOUT, encoding="UTF-8").stdout + passthrough_device_ids = ["7460", "73c8", "74a0", "74a1", "74a2"] + if any(device_id in output for device_id in passthrough_device_ids): + self._is_baremetal = True + self._is_virtual_os = False + self._is_passthrough = True + def os_info(self, string_format=True): """Return operating_system and type information ex. (Linux, Baremetal) @@ -89,6 +98,10 @@ class AMDSMIHelpers(): else: operating_system_type = "Unknown" + # Passthrough Override + if self._is_passthrough: + operating_system_type = "Guest (Passthrough)" + if string_format: return f"{operating_system} {operating_system_type}" else: