From ac8e0d6d10c57c7c0afa9cbb6ac68e00faed597d Mon Sep 17 00:00:00 2001 From: Jian Jun Chen Date: Thu, 29 Oct 2020 08:52:55 +0800 Subject: [PATCH] hv: add BAR GPA for vmsix over msi in pre-launched vm In pre-launched VM the GPA of vmsix BAR which is used for vmsix over msi is calculated/allocated by acrn-config tool. The GPA needs to be assigned to vdev when vdev is initialized. The assignment is only needed for pre-launched VM. For SOS kernel will reprogram the Bar base when startup. For post-launched VM the Bar GPA will be assigned by device model via hypercall. Tracked-On: #5316 Signed-off-by: Jian Jun Chen Acked-by: Eddie Dong --- hypervisor/dm/vpci/vmsix_on_msi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hypervisor/dm/vpci/vmsix_on_msi.c b/hypervisor/dm/vpci/vmsix_on_msi.c index 4fb2b9cda..9f63ecc12 100644 --- a/hypervisor/dm/vpci/vmsix_on_msi.c +++ b/hypervisor/dm/vpci/vmsix_on_msi.c @@ -117,9 +117,12 @@ void init_vmsix_on_msi(struct pci_vdev *vdev) * - For Service VM: when first time init, it is programmed as 0, then OS will program * the value later. * - For Post-launched VM: The GPA is assigned by device model. - * - For Pre-launched VM: Not supported yet. + * - For Pre-launched VM: The GPA is assigned by acrn-config tool. */ - pci_vdev_write_vbar(vdev, i, (uint32_t)vdev->vbars[i].base_gpa); + if (is_prelaunched_vm(vpci2vm(vdev->vpci))) { + vdev->vbars[i].base_gpa = vdev->pci_dev_config->vbar_base[i]; + pci_vdev_write_vbar(vdev, i, (uint32_t)vdev->vbars[i].base_gpa); + } } } }