dm: Disable stolen memory for passthru graphics

When enabling GPU passthru for guest, stolen memory needs to be
disabled. This change disables stolen memory in passthru mode.

Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
Reviewed-by: Gong Zhipeng <zhipeng.gong@intel.com>
This commit is contained in:
Anitha Chrisanthus 2018-06-21 08:16:33 -07:00 committed by Xie, nanlin
parent 8d50d40ff8
commit 359e5cf794
2 changed files with 14 additions and 0 deletions

View File

@ -70,6 +70,8 @@
#define PCI_BDF(bus, dev, func) (((bus & 0xFF)<<8) | ((dev & 0x1F)<<3) \
| ((func & 0x7)))
#define PCI_BDF_GPU 0x00000010 /* 00:02.0 */
/* Some audio driver get topology data from ACPI NHLT table, thus need copy host
* NHLT to guest. Default audio driver doesn't require this, so make it off by
* default to avoid unexpected failure.
@ -1159,6 +1161,15 @@ passthru_cfgread(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
/* Everything else just read from the device's config space */
*rv = read_config(ptdev->phys_dev, coff, bytes);
/*
* return zero for graphics stolen memory since acrn does not have
* support for RMRR
*/
if ((PCI_BDF(dev->bus, dev->slot, dev->func) == PCI_BDF_GPU)
&& (coff == PCIR_GMCH_CTL)) {
*rv &= ~PCIM_GMCH_CTL_GMS;
}
return 0;
}

View File

@ -1065,4 +1065,7 @@
#define PCIM_OSC_CTL_PCIE_AER 0x08 /* PCIe Advanced Error Reporting */
#define PCIM_OSC_CTL_PCIE_CAP_STRUCT 0x10 /* Various Capability Structures */
/* Graphics definitions */
#define PCIR_GMCH_CTL 0x50 /*GMCH grpahics control register */
#define PCIM_GMCH_CTL_GMS 0xFF00 /*GMS - stolen memory bits 15:8 */
#endif