mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-24 18:59:33 +00:00
hypervisor/ivshmem: Fix ivshmem ivposition loss issue
ACRN sets the ivposition to the VM_ID in ivshmem_server_bind_peer(). This value should be saved in the ivshmem_device until unbind. It is wrong to clear ivs_dev->mmio in the ivshmem_vbar_map(), Instead, it should clear the ivshmem_device structure in the create_ivshmem_device to ensure the same initial states after VM reboot case. Tracked-On: #8485 Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Junjie Mao <Junjie.mao@intel.com>
This commit is contained in:
parent
7f2fd0b5fd
commit
c9c0d2167b
@ -180,6 +180,11 @@ static void create_ivshmem_device(struct pci_vdev *vdev)
|
||||
}
|
||||
spinlock_release(&ivshmem_dev_lock);
|
||||
ASSERT((i < IVSHMEM_DEV_NUM), "failed to find and set ivshmem device");
|
||||
/*
|
||||
* Clear ivshmem_device mmio to ensure the same initial
|
||||
* states after VM reboot.
|
||||
*/
|
||||
memset(&ivshmem_dev[i].mmio, 0U, sizeof(uint32_t) * 4);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -248,13 +253,11 @@ static void ivshmem_vbar_map(struct pci_vdev *vdev, uint32_t idx)
|
||||
{
|
||||
struct acrn_vm *vm = vpci2vm(vdev->vpci);
|
||||
struct pci_vbar *vbar = &vdev->vbars[idx];
|
||||
struct ivshmem_device *ivs_dev = (struct ivshmem_device *) vdev->priv_data;
|
||||
|
||||
if ((idx == IVSHMEM_SHM_BAR) && (vbar->base_hpa != INVALID_HPA) && (vbar->base_gpa != 0UL)) {
|
||||
ept_add_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp, vbar->base_hpa,
|
||||
vbar->base_gpa, vbar->size, EPT_RD | EPT_WR | EPT_WB | EPT_IGNORE_PAT);
|
||||
} else if ((idx == IVSHMEM_MMIO_BAR) && (vbar->base_gpa != 0UL)) {
|
||||
(void)memset(&ivs_dev->mmio, 0U, sizeof(ivs_dev->mmio));
|
||||
register_mmio_emulation_handler(vm, ivshmem_mmio_handler, vbar->base_gpa,
|
||||
(vbar->base_gpa + vbar->size), vdev, false);
|
||||
ept_del_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp, vbar->base_gpa, round_page_up(vbar->size));
|
||||
|
Loading…
Reference in New Issue
Block a user