dm: pio_region: add support for pio device pass through

Add two vmmapi vm_assign_pio_region and vm_deassign_pio_region to
support PIO device pass through.

Tracked-On: #8635
Signed-off-by: Yichong Tang <yichong.tang@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
yichongt 2024-06-28 11:08:00 +08:00 committed by wenlingz
parent ff4948cf7d
commit 3b35a673e6
3 changed files with 28 additions and 0 deletions

View File

@ -592,6 +592,28 @@ vm_deassign_mmiodev(struct vmctx *ctx, struct acrn_mmiodev *mmiodev)
return error;
}
int
vm_assign_pio_region(struct vmctx *ctx, struct acrn_pio_region *pio_region)
{
int error;
error = ioctl(ctx->fd, ACRN_IOCTL_ASSIGN_PIO_REGION, pio_region);
if (error) {
pr_err("ACRN_IOCTL_ASSIGN_PIO_REGION ioctl() returned an error: %s\n", errormsg(errno));
}
return error;
}
int
vm_deassign_pio_region(struct vmctx *ctx, struct acrn_pio_region *pio_region)
{
int error;
error = ioctl(ctx->fd, ACRN_IOCTL_DEASSIGN_PIO_REGION, pio_region);
if (error) {
pr_err("ACRN_IOCTL_DEASSIGN_PIO_REGION ioctl() returned an error: %s\n", errormsg(errno));
}
return error;
}
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)

View File

@ -125,6 +125,10 @@
_IOW(ACRN_IOCTL_TYPE, 0x59, struct acrn_vdev)
#define ACRN_IOCTL_DESTROY_VDEV \
_IOW(ACRN_IOCTL_TYPE, 0x5A, struct acrn_vdev)
#define ACRN_IOCTL_ASSIGN_PIO_REGION \
_IOW(ACRN_IOCTL_TYPE, 0x5B, struct acrn_pio_region)
#define ACRN_IOCTL_DEASSIGN_PIO_REGION \
_IOW(ACRN_IOCTL_TYPE, 0x5C, struct acrn_pio_region)
/* Power management */
#define ACRN_IOCTL_PM_GET_CPU_STATE \

View File

@ -137,6 +137,8 @@ int vm_assign_pcidev(struct vmctx *ctx, struct acrn_pcidev *pcidev);
int vm_deassign_pcidev(struct vmctx *ctx, struct acrn_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_assign_pio_region(struct vmctx *ctx, struct acrn_pio_region *pio_region);
int vm_deassign_pio_region(struct vmctx *ctx, struct acrn_pio_region *pio_region);
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,