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 <jian.jun.chen@intel.com>
This commit is contained in:
Jian Jun Chen 2020-09-14 10:40:26 +08:00 committed by wenlingz
parent a4832a0566
commit ce2a82479b

View File

@ -11,6 +11,7 @@
#include <vtd.h>
#include <board.h>
#include "vpci_priv.h"
#include <logmsg.h>
#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.