mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-16 00:16:12 +00:00
HV: add get_vbar_base() to get vbar base address in 64-bit
vbar base can be built by using the base address fields stored in struct pci_bar's reg member. get_vbar_base: return vbar's base address in 64-bit. For 64-bit MMIO bar, its lower 32-bits base address and upper 32-bits base are combined into one 64-bit base address And changed related code to use get_vbar_base to get vbar base address in 64-bit. Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
7a2f52441b
commit
65ca6ae498
@ -103,6 +103,17 @@ static uint64_t pci_bar_2_bar_base(const struct pci_bar *pbars, uint32_t nr_bars
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get vbar's full base address in 64-bit
|
||||
* For 64-bit MMIO bar, its lower 32-bits base address and upper 32-bits base are combined
|
||||
* into one 64-bit base address
|
||||
* @pre vdev != NULL
|
||||
*/
|
||||
static uint64_t get_vbar_base(const struct pci_vdev *vdev, uint32_t idx)
|
||||
{
|
||||
return pci_bar_2_bar_base(&vdev->bar[0], vdev->nr_bars, idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get pbar's full address in 64-bit
|
||||
* For 64-bit MMIO bar, its lower 32-bits base address and upper 32-bits base are combined
|
||||
@ -158,9 +169,10 @@ void vdev_pt_remap_msix_table_bar(struct pci_vdev *vdev)
|
||||
pbar = &pdev->bar[msix->table_bar];
|
||||
if (pbar != NULL) {
|
||||
uint64_t pbar_base = get_pbar_base(pdev, msix->table_bar); /* pbar (hpa) */
|
||||
|
||||
msix->mmio_hpa = pbar_base;
|
||||
if (is_prelaunched_vm(vdev->vpci->vm)) {
|
||||
msix->mmio_gpa = vdev->bar[msix->table_bar].base;
|
||||
msix->mmio_gpa = get_vbar_base(vdev, msix->table_bar);
|
||||
} else {
|
||||
msix->mmio_gpa = sos_vm_hpa2gpa(pbar_base);
|
||||
}
|
||||
@ -250,9 +262,10 @@ static void vdev_pt_remap_generic_mem_vbar(const struct pci_vdev *vdev, uint32_t
|
||||
{
|
||||
struct acrn_vm *vm = vdev->vpci->vm;
|
||||
|
||||
/* If the old vbar is mapped before, unmap it first */
|
||||
if (vdev->bar[idx].base != 0UL) {
|
||||
ept_del_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp,
|
||||
vdev->bar[idx].base,
|
||||
vdev->bar[idx].base, /* GPA (old vbar) */
|
||||
vdev->bar[idx].size);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user