dm: not register/unregister gvt bar memory

AcrnGT traps and intercepts the memory region defined by PCI bar in
service OS kernel driver. No need to register the bar associated region
in dm. By the way, some OS changes BAR start address and there is no
mechanism to reflect the gvt changes back to dm. It causes problem that
other devices may register new region which falls in GVT `old` region,
and leads to hypervisor crash.

v4: Add FIXME tag. It's a short term solution before migrated to OVMF
v3: rewording the comments
v2: removed unnecessary braces and use printf to log (Peter)

Tracked-On: #2976

Reviewed-by: He, Min <min.he@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Liu Xinyun <xinyun.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Liu Xinyun 2019-02-26 16:49:50 +08:00 committed by ACRN System Integration
parent a581f50600
commit d9e6cdb593

View File

@ -128,6 +128,15 @@ CFGREAD(struct pci_vdev *dev, int coff, int bytes)
return pci_get_cfgdata32(dev, coff); 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 * I/O access
*/ */
@ -494,6 +503,20 @@ modify_bar_registration(struct pci_vdev *dev, int idx, int registration)
struct inout_port iop; struct inout_port iop;
struct mem_range mr; 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) { switch (dev->bar[idx].type) {
case PCIBAR_IO: case PCIBAR_IO:
bzero(&iop, sizeof(struct inout_port)); bzero(&iop, sizeof(struct inout_port));