MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / is_gpu_class

Function is_gpu_class

crates/openshell-vfio/src/gpu.rs:13–24  ·  view source on GitHub ↗
(class_str: &str)

Source from the content-addressed store, hash-verified

11const GPU_CLASS_DISPLAY_3D: u32 = 0x0302;
12
13fn is_gpu_class(class_str: &str) -> bool {
14 if class_str == GPU_CLASS_DISPLAY_VGA {
15 return true;
16 }
17 // 3D controller: 0x0302xx
18 if let Some(hex) = class_str.strip_prefix("0x")
19 && let Ok(val) = u32::from_str_radix(hex, 16)
20 {
21 return (val >> 8) == GPU_CLASS_DISPLAY_3D;
22 }
23 false
24}
25
26/// Scan sysfs for NVIDIA GPUs eligible for VFIO passthrough.
27pub fn probe_host_nvidia_vfio_readiness(sysfs: &SysfsRoot) -> Vec<PciInfo> {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected