mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-06 19:30:46 +00:00
HV: predefine pci vbar's base address for pre-launched VMs in vm_config
For pre-launched VMs, currently we set all vbars to 0s initially in bar emulation code, guest OS will reprogram the bars when it sees the bars are uninited (0s). We consider this is not the right solution, change to populate the vbars (to non zero valid pci hole address) based on the vbar base addresses predefined in vm_config. Store a pointer to acrn_vm_pci_ptdev_config in struct pci_vdev Tracked-On: #3022 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
4cdaa519a0
commit
73cff9ef08
@@ -311,6 +311,7 @@ void init_vdev_pt(struct pci_vdev *vdev)
|
||||
pbar = &vdev->pdev->bar[idx];
|
||||
vbar = &vdev->bar[idx];
|
||||
|
||||
vbar->base = 0UL;
|
||||
if (is_bar_supported(pbar)) {
|
||||
/**
|
||||
* If vbar->base is 0 (unassigned), Linux kernel will reprogram the vbar on
|
||||
@@ -324,6 +325,11 @@ void init_vdev_pt(struct pci_vdev *vdev)
|
||||
* are reported to guest as PCIBAR_MEM32
|
||||
*/
|
||||
vbar->type = PCIBAR_MEM32;
|
||||
|
||||
/* Set the new vbar base */
|
||||
if (vdev->ptdev_config->vbar[idx] != 0UL) {
|
||||
vdev_pt_write_vbar(vdev, pci_bar_offset(idx), 4U, (uint32_t)(vdev->ptdev_config->vbar[idx]));
|
||||
}
|
||||
} else {
|
||||
vbar->size = 0UL;
|
||||
vbar->type = PCIBAR_NONE;
|
||||
|
@@ -415,6 +415,7 @@ static void init_vdev_for_pdev(struct pci_pdev *pdev, const void *vm)
|
||||
|
||||
vdev->vpci = vpci;
|
||||
vdev->pdev = pdev;
|
||||
vdev->ptdev_config = ptdev_config;
|
||||
|
||||
if (ptdev_config != NULL) {
|
||||
/* vbdf is defined in vm_config */
|
||||
@@ -425,10 +426,16 @@ static void init_vdev_for_pdev(struct pci_pdev *pdev, const void *vm)
|
||||
}
|
||||
|
||||
init_vhostbridge(vdev);
|
||||
init_vdev_pt(vdev);
|
||||
init_vmsi(vdev);
|
||||
init_vmsix(vdev);
|
||||
|
||||
/*
|
||||
* Here init_vdev_pt() needs to be called after init_vmsix() for the following reason:
|
||||
* init_vdev_pt() will indirectly call has_msix_cap(), which
|
||||
* requires init_vmsix() to be called first.
|
||||
*/
|
||||
init_vdev_pt(vdev);
|
||||
|
||||
if (has_msix_cap(vdev)) {
|
||||
vdev_pt_remap_msix_table_bar(vdev);
|
||||
}
|
||||
|
Reference in New Issue
Block a user