ACRN:DM:PCI: Load rom_file and map it into PCI ROMbar

PCI ROM is the firmware specific to PCI device and it is provided by
the device vendor. The PCI rom resides in 0x30 offset of PCI config space.
This can be used to check whether the PCI rom exists. And when it exists,
it can load the firmware from the addr that is obtained from ROM bar addr.

For the user-vm, it will try to load the rom_file for the given PCI device and
enable the VM to access the firmware that is defined in rom_file.

BTW: The emulated rom_file is converted from efi image by using EfiRom. It has
no dependency on the ROM bar of physical PCI devices. Of course if the physical
PCI devices supports the ROM bar, the rom_file can also be dumped from the PCI
rom.

Now this is limited to PCI display device.

V2->V3: Add the function of pci_load_rombar/pci_release_rombar to handle the
	rombar in course of passthrough_init/deinit.

Tracked-On: #8175
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
This commit is contained in:
Zhao Yakui
2022-09-21 13:13:14 +08:00
committed by acrnsi-robot
parent 270aaf82d8
commit 64ecf193e4
2 changed files with 127 additions and 1 deletions

View File

@@ -16,7 +16,7 @@
struct passthru_dev {
struct pci_vdev *dev;
struct pcibar bar[PCI_BARMAX + 1];
struct pcibar bar[PCI_BARMAX + 2];
struct {
int capoff;
} msi;
@@ -36,6 +36,8 @@ struct passthru_dev {
*/
bool need_reset;
bool d3hot_reset;
bool need_rombar;
char *rom_buffer;
bool (*has_virt_pcicfg_regs)(int offset);
};