From 79a5d7a787ea8923ba9859b1f1f88ad252796d49 Mon Sep 17 00:00:00 2001 From: "Liu,Junming" Date: Fri, 15 Oct 2021 14:22:46 +0000 Subject: [PATCH] hv: initialize IGD offset 0xfc of CFG space for Service VM For the IGD device the opregion addr is returned by reading the 0xFC config of 0:02.0 bdf. And the opregion addr is required by GPU driver. The opregion_addr should be the GPA addr. When the IGD is assigned to pre-launched VM, the value in 0xFC of igd_vdev is programmed into with new GPA addr. In such case the prelaunched VM reads the value from 0xFC of 0:02.0 vdev. But for the Service VM, the IGD is initialized by using the same policy as other PCI devices. We only initialize the vdev_head_conf(0x0-0x3F) by checking the corresponding pbdf. The remaining pci_config_space will be read by leveraging the corresponding pdev. But as the above code doesn't handle the scenario for Service VM, it causes that the Service VM fails to read the 0xFC config_space for IGD vdev. Then the i915 GPU driver in SOS has some issues because of incorrect 0xFC pci_conf_space. This patch initializes offset 0xfc of CFG space of IGD for Service VM, it is simple and can cover post-launched VM too. Tracked-On: #6387 Signed-off-by: Liu,Junming Acked-by: Eddie Dong --- hypervisor/dm/vpci/pci_pt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hypervisor/dm/vpci/pci_pt.c b/hypervisor/dm/vpci/pci_pt.c index ab3c9ed68..27890b819 100644 --- a/hypervisor/dm/vpci/pci_pt.c +++ b/hypervisor/dm/vpci/pci_pt.c @@ -540,6 +540,9 @@ void init_vdev_pt(struct pci_vdev *vdev, bool is_pf_vdev) if (vdev->phyfun == NULL) { init_bars(vdev, is_pf_vdev); init_vmsix_on_msi(vdev); + if (is_sos_vm(vpci2vm(vdev->vpci)) && (vdev->pdev->bdf.value == CONFIG_GPU_SBDF)) { + pci_vdev_write_vcfg(vdev, PCIR_ASLS_CTL, 4U, pci_pdev_read_cfg(vdev->pdev->bdf, PCIR_ASLS_CTL, 4U)); + } if (is_prelaunched_vm(vpci2vm(vdev->vpci)) && (!is_pf_vdev)) { pci_command = (uint16_t)pci_pdev_read_cfg(vdev->pdev->bdf, PCIR_COMMAND, 2U);