mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
Vfio: Ignore vfio device's multifunction flag
PciRoot doesn't support multifunciion which forward pci config r/w from function > 0 to function 0, so if the vfio device have multifunction flag, guest will find the existence of all the other functions, actually it is from the function 0. In order to fix these extra functions, this patch clear the multifunction flag, so guest won't probe the other functions. BUG=chromium:992270 TEST=pass through a device with multifunction into guest Change-Id: I395636411e0d7d2a3729de16e638d7f6b2dde552 Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1954221 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
5c6bf3e32d
commit
3ec8cc4f52
1 changed files with 6 additions and 0 deletions
|
@ -27,6 +27,8 @@ const INTEL_VENDOR_ID: u16 = 0x8086;
|
||||||
const PCI_COMMAND: u32 = 0x4;
|
const PCI_COMMAND: u32 = 0x4;
|
||||||
const PCI_COMMAND_MEMORY: u8 = 0x2;
|
const PCI_COMMAND_MEMORY: u8 = 0x2;
|
||||||
const PCI_BASE_CLASS_CODE: u32 = 0x0B;
|
const PCI_BASE_CLASS_CODE: u32 = 0x0B;
|
||||||
|
const PCI_HEADER_TYPE: usize = 0x0E;
|
||||||
|
const PCI_MULTI_FLAG: u32 = 0x0080_0000;
|
||||||
|
|
||||||
const PCI_INTERRUPT_PIN: u32 = 0x3D;
|
const PCI_INTERRUPT_PIN: u32 = 0x3D;
|
||||||
|
|
||||||
|
@ -753,6 +755,10 @@ impl PciDevice for VfioPciDevice {
|
||||||
config = 0;
|
config = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if reg_idx == PCI_HEADER_TYPE / 4 {
|
||||||
|
// Clear multifunction flags as pci_root doesn't
|
||||||
|
// support multifunction.
|
||||||
|
config &= !PCI_MULTI_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quirk for intel graphic, set stolen memory size to 0 in pci_cfg[0x51]
|
// Quirk for intel graphic, set stolen memory size to 0 in pci_cfg[0x51]
|
||||||
|
|
Loading…
Reference in a new issue