dm: mmio_dev: add hypercall to support mmio device pass through
Add two hypercalls to support MMIO device pass through. Tracked-On: #5053 Signed-off-by: Li Fei1 <fei1.li@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
baf77a79ad
commit
158f3d17a2
|
@ -572,6 +572,18 @@ vm_deassign_pcidev(struct vmctx *ctx, struct acrn_assign_pcidev *pcidev)
|
|||
return ioctl(ctx->fd, IC_DEASSIGN_PCIDEV, pcidev);
|
||||
}
|
||||
|
||||
int
|
||||
vm_assign_mmiodev(struct vmctx *ctx, struct acrn_mmiodev *mmiodev)
|
||||
{
|
||||
return ioctl(ctx->fd, IC_ASSIGN_MMIODEV, mmiodev);
|
||||
}
|
||||
|
||||
int
|
||||
vm_deassign_mmiodev(struct vmctx *ctx, struct acrn_mmiodev *mmiodev)
|
||||
{
|
||||
return ioctl(ctx->fd, IC_DEASSIGN_MMIODEV, mmiodev);
|
||||
}
|
||||
|
||||
int
|
||||
vm_map_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
|
||||
vm_paddr_t gpa, size_t len, vm_paddr_t hpa)
|
||||
|
|
|
@ -107,6 +107,8 @@
|
|||
#define IC_RESET_PTDEV_INTR_INFO _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x04)
|
||||
#define IC_ASSIGN_PCIDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x05)
|
||||
#define IC_DEASSIGN_PCIDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x06)
|
||||
#define IC_ASSIGN_MMIODEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x07)
|
||||
#define IC_DEASSIGN_MMIODEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x08)
|
||||
|
||||
/* Power management */
|
||||
#define IC_ID_PM_BASE 0x60UL
|
||||
|
@ -182,6 +184,24 @@ struct acrn_assign_pcidev {
|
|||
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* @brief Info to assign or deassign a MMIO device for a VM
|
||||
*/
|
||||
struct acrn_mmiodev {
|
||||
/** the gpa of the MMIO region for the MMIO device */
|
||||
uint64_t base_gpa;
|
||||
|
||||
/** the hpa of the MMIO region for the MMIO device */
|
||||
uint64_t base_hpa;
|
||||
|
||||
/** the size of the MMIO region for the MMIO device */
|
||||
uint64_t size;
|
||||
|
||||
/** reserved for extension */
|
||||
uint64_t reserved[13];
|
||||
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* @brief pass thru device irq data structure
|
||||
*/
|
||||
|
|
|
@ -126,6 +126,8 @@ int vm_lapic_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg);
|
|||
int vm_set_gsi_irq(struct vmctx *ctx, int gsi, uint32_t operation);
|
||||
int vm_assign_pcidev(struct vmctx *ctx, struct acrn_assign_pcidev *pcidev);
|
||||
int vm_deassign_pcidev(struct vmctx *ctx, struct acrn_assign_pcidev *pcidev);
|
||||
int vm_assign_mmiodev(struct vmctx *ctx, struct acrn_mmiodev *mmiodev);
|
||||
int vm_deassign_mmiodev(struct vmctx *ctx, struct acrn_mmiodev *mmiodev);
|
||||
int vm_map_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
|
||||
vm_paddr_t gpa, size_t len, vm_paddr_t hpa);
|
||||
int vm_unmap_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
|
||||
|
|
Loading…
Reference in New Issue