File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,11 @@ pub struct Iommu {
3030static IOMMUS : [ Once < Iommu > ; 8 ] = [ Once :: INIT ; 8 ] ;
3131
3232// Identifiers from the QEMU RFC implementation.
33- const IOMMU_VENDOR_ID : u16 = 0x1efd ;
34- const IOMMU_DEVICE_ID : u16 = 0xedf1 ;
33+ const IOMMU_PCI_ID_TABLE : [ ( u16 , u16 ) ; 3 ] = [
34+ ( 0x1b36 , 0x0014 ) , // vanilla qemu IOMMU model
35+ ( 0x1efd , 0xedf1 ) , // Rivos qemu IOMMU model
36+ ( 0x1efd , 0x0008 ) , // Rivos hardware IOMMU
37+ ] ;
3538
3639// Suppress clippy warning about common suffix in favor or matching mode names as per IOMMU spec.
3740#[ allow( clippy:: enum_variant_names) ]
@@ -72,9 +75,8 @@ impl Iommu {
7275 ) -> Result < & ' static Iommu > {
7376 let mut dev = dev. lock ( ) ;
7477
75- if dev. info ( ) . vendor_id ( ) . bits ( ) != IOMMU_VENDOR_ID
76- || dev. info ( ) . device_id ( ) . bits ( ) != IOMMU_DEVICE_ID
77- {
78+ let pci_ids = ( dev. info ( ) . vendor_id ( ) . bits ( ) , dev. info ( ) . device_id ( ) . bits ( ) ) ;
79+ if !IOMMU_PCI_ID_TABLE . contains ( & pci_ids) {
7880 return Err ( Error :: NotAnIommu ) ;
7981 }
8082
You can’t perform that action at this time.
0 commit comments