DM: unmap ptdev BAR when deinit

Unmap ptdev BAR when deinit to comply with native system, who zap out
all pre-allocated BARs.

Tracked-On: #1146

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Edwin Zhai
2018-08-29 14:42:35 +08:00
committed by lijinxia
parent 1b334ec08f
commit 30b77aba5d
4 changed files with 36 additions and 1 deletions

View File

@@ -549,6 +549,22 @@ vm_map_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
return ioctl(ctx->fd, IC_SET_MEMSEG, &memmap);
}
int
vm_unmap_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
vm_paddr_t gpa, size_t len, vm_paddr_t hpa)
{
struct vm_memmap memmap;
bzero(&memmap, sizeof(struct vm_memmap));
memmap.type = VM_MMIO;
memmap.len = len;
memmap.gpa = gpa;
memmap.hpa = hpa;
memmap.prot = PROT_ALL;
return ioctl(ctx->fd, IC_UNSET_MEMSEG, &memmap);
}
int
vm_setup_ptdev_msi(struct vmctx *ctx, struct acrn_vm_pci_msix_remap *msi_remap)
{