From ce2a82479b0f47834bbd14883ca3d7383e41eba1 Mon Sep 17 00:00:00 2001 From: Jian Jun Chen Date: Mon, 14 Sep 2020 10:40:26 +0800 Subject: [PATCH] hv: vmsi: add default BAR GPA for vmsi over msi No GPA is specified for the vmsi BAR in the case of vmsi over msi. This patch hard coded the GPA as 0x80000000 which is the base addr of 32bit PCI hole in the predefined e820 table of pre-launched VM. This is a workaround and the final solution is to enhance acrn-config tool to come up with the GPA for these BARs. Tracked-On: #5316 Signed-off-by: Jian Jun Chen --- hypervisor/dm/vpci/vmsix_on_msi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hypervisor/dm/vpci/vmsix_on_msi.c b/hypervisor/dm/vpci/vmsix_on_msi.c index 5fa14a813..ecafe4778 100644 --- a/hypervisor/dm/vpci/vmsix_on_msi.c +++ b/hypervisor/dm/vpci/vmsix_on_msi.c @@ -11,6 +11,7 @@ #include #include #include "vpci_priv.h" +#include #define PER_VECTOR_MASK_CAP 0x0100U @@ -113,6 +114,19 @@ void init_vmsix_on_msi(struct pci_vdev *vdev) /* fixed for memory, 32bit, non-prefetchable */ vdev->vbars[i].fixed = 0U; + if (vdev->vbars[i].base_gpa == 0UL) { + if (is_prelaunched_vm(vpci2vm(vdev->vpci))) { + /* + * we have predefined e820 table for pre-launched VM, + * 0x80000000UL is the base addr of 32bit PCI hole + */ + vdev->vbars[i].base_gpa = 0x80000000UL; + pr_acrnlog("%s: vm_id = %d, vbdf = %d:%d.%d", + __func__, vpci2vm(vdev->vpci)->vm_id, + vdev->bdf.bits.b, vdev->bdf.bits.d, vdev->bdf.bits.f); + } + } + /* About MSI-x bar GPA: * - For Service VM: when first time init, it is programmed as 0, then OS will program * the value later and the value is stored in vdev->vbars[MSI-X_BAR_ID].base_gpa.