[SWDEV-462952] Options enabled for GPU passthrough scenarios

Added Dynamic Passthrough detection

Signed-off-by: Pham, Gabriel <Gabriel.Pham@amd.com>
Signed-off-by: Arif, Maisam <Maisam.Arif@amd.com>
Co-authored-by: Arif, Maisam <Maisam.Arif@amd.com>
此提交包含在:
Pham, Gabriel
2025-01-30 19:12:03 -05:00
提交者 GitHub
父節點 5b2c271eff
當前提交 0f79efac78
共有 6 個檔案被更改,包括 137 行新增11 行删除
+20 -6
查看文件
@@ -57,6 +57,7 @@ class AMDSMIHelpers():
self._is_windows = False
self._count_of_sets_called = 0
# Check if the system is a virtual OS
if self.operating_system.startswith("Linux"):
self._is_linux = True
logging.debug(f"AMDSMIHelpers: Platform is linux:{self._is_linux}")
@@ -70,14 +71,27 @@ class AMDSMIHelpers():
self._is_baremetal = not self._is_virtual_os
# Check for passthrough system filtering by device id
if self._is_virtual_os:
#If hard coded passthrough device ids exist on Virtual OS,
# then it is a passthrough system
output = self.get_pci_device_ids()
passthrough_device_ids = ["7460", "73c8", "74a0", "74a1", "74a2"]
if any(('0x' + device_id) in output for device_id in passthrough_device_ids):
if self._is_virtual_os:
self._is_baremetal = True
self._is_virtual_os = False
self._is_passthrough = True
self._is_baremetal = True
self._is_virtual_os = False
self._is_passthrough = True
# Check for passthrough system dynamically via drm querying id_flags
if self.is_amdgpu_initialized() and not self._is_passthrough:
device_handles = amdsmi_interface.amdsmi_get_processor_handles()
for dev in device_handles:
passthrough_info = amdsmi_interface.amdsmi_get_gpu_passthrough_info(dev)
# isolate the relevant bits and then shift them over to get the correct values
ids_flags = (passthrough_info['ids_flags'] & amdsmi_interface.AmdSmiPassthroughInfoFlags.MASK) >> amdsmi_interface.AmdSmiPassthroughInfoFlags.SHIFT
if ids_flags & amdsmi_interface.AmdSmiPassthroughInfoFlags.PT == 0x2:
self._is_baremetal = True
self._is_virtual_os = False
self._is_passthrough = True
def increment_set_count(self):
self._count_of_sets_called += 1
@@ -693,7 +707,7 @@ class AMDSMIHelpers():
accelerator_partition_profiles['profile_indices'].append(str(profile['profiles'][p]['profile_index']))
accelerator_partition_profiles['profile_types'].append(profile['profiles'][p]['profile_type'])
accelerator_partition_profiles['memory_caps'].append(profile['profiles'][p]['memory_caps'])
break # Only need to get the profiles for one device
break # Only need to get the profiles for one device
except amdsmi_interface.AmdSmiLibraryException as e:
break
return accelerator_partition_profiles