DM NPK: unmap the MMIO in pci_npk_deinit

Otherwise, after UOS crashes, the PTE for the MMIO may be added
again.

Tracked-On: #1745
Signed-off-by: Zhi Jin <zhi.jin@intel.com>
This commit is contained in:
Zhi Jin 2018-11-07 14:57:11 +08:00 committed by wenlingz
parent ef974d1adf
commit 36aaaa1cfd
1 changed files with 3 additions and 1 deletions

View File

@ -140,6 +140,7 @@ static struct npk_reg_default_val regs_default_val[] = {
sizeof(struct npk_reg_default_val))
static int npk_in_use;
static uint64_t sw_bar_base;
/* get the pointer to the register based on the offset */
static inline uint32_t *offset2reg(uint64_t offset)
@ -183,7 +184,6 @@ static int pci_npk_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
char name[PATH_MAX];
uint8_t h_cfg[PCI_REGMAX + 1];
uint32_t m_off, m_num;
uint64_t sw_bar_base;
struct npk_reg_default_val *d;
if (npk_in_use) {
@ -314,6 +314,8 @@ static int pci_npk_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
static void pci_npk_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
{
vm_unmap_ptdev_mmio(ctx, dev->bus, dev->slot, dev->func,
dev->bar[2].addr, dev->bar[2].size, sw_bar_base);
npk_in_use = 0;
}