diff --git a/devicemodel/hw/pci/core.c b/devicemodel/hw/pci/core.c index ed30fa101..190e1ecc6 100644 --- a/devicemodel/hw/pci/core.c +++ b/devicemodel/hw/pci/core.c @@ -128,6 +128,15 @@ CFGREAD(struct pci_vdev *dev, int coff, int bytes) return pci_get_cfgdata32(dev, coff); } +static inline int +is_pci_gvt(struct pci_vdev *dev) +{ + if (dev == NULL || strncmp(dev->dev_ops->class_name, "pci-gvt",7)) + return 0; + else + return 1; +} + /* * I/O access */ @@ -494,6 +503,20 @@ modify_bar_registration(struct pci_vdev *dev, int idx, int registration) struct inout_port iop; struct mem_range mr; + if (is_pci_gvt(dev)) { + /* GVT device is the only one who traps the pci bar access and + * intercepts the corresponding contents in kernel. It needs + * register pci resource only, but no need to register the + * region. + * + * FIXME: This is a short term solution. This patch will be + * obsoleted with the migration of using OVMF to do bar + * addressing and generate ACPI PCI resource from using + * acrn-dm. + */ + printf("modify_bar_registration: bypass for pci-gvt\n"); + return; + } switch (dev->bar[idx].type) { case PCIBAR_IO: bzero(&iop, sizeof(struct inout_port));