dm: Use new ptdev interrupt management ioctls
IC_SET_PTDEV_INTR_INFO -> ACRN_IOCTL_SET_PTDEV_INTR IC_RESET_PTDEV_INTR_INFO -> ACRN_IOCTL_RESET_PTDEV_INTR struct ic_ptdev_irq -> struct acrn_ptdev_irq IRQ_INTX -> ACRN_PTDEV_IRQ_INTX IRQ_MSI -> ACRN_PTDEV_IRQ_MSI Tracked-On: #6282 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
parent
7e01d90b87
commit
9d67745037
|
@ -611,33 +611,33 @@ int
|
|||
vm_set_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf, uint16_t phys_bdf,
|
||||
int virt_pin, int phys_pin, bool pic_pin)
|
||||
{
|
||||
struct ic_ptdev_irq ptirq;
|
||||
struct acrn_ptdev_irq ptirq;
|
||||
|
||||
bzero(&ptirq, sizeof(ptirq));
|
||||
ptirq.type = IRQ_INTX;
|
||||
ptirq.type = ACRN_PTDEV_IRQ_INTX;
|
||||
ptirq.virt_bdf = virt_bdf;
|
||||
ptirq.phys_bdf = phys_bdf;
|
||||
ptirq.intx.virt_pin = virt_pin;
|
||||
ptirq.intx.phys_pin = phys_pin;
|
||||
ptirq.intx.is_pic_pin = pic_pin;
|
||||
|
||||
return ioctl(ctx->fd, IC_SET_PTDEV_INTR_INFO, &ptirq);
|
||||
return ioctl(ctx->fd, ACRN_IOCTL_SET_PTDEV_INTR, &ptirq);
|
||||
}
|
||||
|
||||
int
|
||||
vm_reset_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf, uint16_t phys_bdf,
|
||||
int virt_pin, bool pic_pin)
|
||||
{
|
||||
struct ic_ptdev_irq ptirq;
|
||||
struct acrn_ptdev_irq ptirq;
|
||||
|
||||
bzero(&ptirq, sizeof(ptirq));
|
||||
ptirq.type = IRQ_INTX;
|
||||
ptirq.type = ACRN_PTDEV_IRQ_INTX;
|
||||
ptirq.intx.virt_pin = virt_pin;
|
||||
ptirq.intx.is_pic_pin = pic_pin;
|
||||
ptirq.virt_bdf = virt_bdf;
|
||||
ptirq.phys_bdf = phys_bdf;
|
||||
|
||||
return ioctl(ctx->fd, IC_RESET_PTDEV_INTR_INFO, &ptirq);
|
||||
return ioctl(ctx->fd, ACRN_IOCTL_RESET_PTDEV_INTR, &ptirq);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -286,14 +286,14 @@ cfginitbar(struct vmctx *ctx, struct passthru_dev *ptdev)
|
|||
* return value:
|
||||
* -1 : fail
|
||||
* >=0: succeed
|
||||
* IRQ_INTX(0): phy dev has no MSI support
|
||||
* IRQ_MSI(1): phy dev has MSI support
|
||||
* ACRN_PTDEV_IRQ_INTX(0): phy dev has no MSI support
|
||||
* ACRN_PTDEV_IRQ_MSI(1): phy dev has MSI support
|
||||
*/
|
||||
static int
|
||||
cfginit(struct vmctx *ctx, struct passthru_dev *ptdev, int bus,
|
||||
int slot, int func)
|
||||
{
|
||||
int irq_type = IRQ_MSI;
|
||||
int irq_type = ACRN_PTDEV_IRQ_MSI;
|
||||
char reset_path[60];
|
||||
int fd;
|
||||
|
||||
|
@ -312,7 +312,7 @@ cfginit(struct vmctx *ctx, struct passthru_dev *ptdev, int bus,
|
|||
if (ptdev->msi.capoff == 0 && ptdev->msix.capoff == 0) {
|
||||
pr_dbg("MSI not supported for PCI %x/%x/%x",
|
||||
bus, slot, func);
|
||||
irq_type = IRQ_INTX;
|
||||
irq_type = ACRN_PTDEV_IRQ_INTX;
|
||||
}
|
||||
|
||||
/* If SOS kernel provides 'reset' entry in sysfs, related dev has some
|
||||
|
@ -671,7 +671,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||
error = pci_emul_alloc_pbar(dev, vmsix_on_msi_bar_id, 0, PCIBAR_MEM32, 4096);
|
||||
if (error < 0)
|
||||
goto done;
|
||||
error = IRQ_MSI;
|
||||
error = ACRN_PTDEV_IRQ_MSI;
|
||||
}
|
||||
|
||||
if (ptdev->phys_bdf == PCI_BDF_GPU)
|
||||
|
@ -687,7 +687,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||
* Forge Guest to use MSI/MSIX in this case to mitigate IRQ sharing
|
||||
* issue
|
||||
*/
|
||||
if (error != IRQ_MSI || keep_gsi) {
|
||||
if (error != ACRN_PTDEV_IRQ_MSI || keep_gsi) {
|
||||
/* Allocates the virq if ptdev only support INTx */
|
||||
pci_lintr_request(dev);
|
||||
|
||||
|
|
|
@ -113,10 +113,10 @@
|
|||
|
||||
/* PCI assignment*/
|
||||
#define IC_ID_PCI_BASE 0x50UL
|
||||
#define IC_ASSIGN_PTDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x00)
|
||||
#define IC_DEASSIGN_PTDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x01)
|
||||
#define IC_VM_PCI_MSIX_REMAP _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x02)
|
||||
#define IC_SET_PTDEV_INTR_INFO _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x03)
|
||||
#define ACRN_IOCTL_SET_PTDEV_INTR \
|
||||
_IOW(ACRN_IOCTL_TYPE, 0x53, struct acrn_ptdev_irq)
|
||||
#define ACRN_IOCTL_RESET_PTDEV_INTR \
|
||||
_IOW(ACRN_IOCTL_TYPE, 0x54, struct acrn_ptdev_irq)
|
||||
#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)
|
||||
|
@ -273,13 +273,15 @@ struct acrn_emul_dev {
|
|||
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/* Type of interrupt of a passthrough device */
|
||||
#define ACRN_PTDEV_IRQ_INTX 0
|
||||
#define ACRN_PTDEV_IRQ_MSI 1
|
||||
#define ACRN_PTDEV_IRQ_MSIX 2
|
||||
|
||||
/**
|
||||
* @brief pass thru device irq data structure
|
||||
*/
|
||||
struct ic_ptdev_irq {
|
||||
#define IRQ_INTX 0
|
||||
#define IRQ_MSI 1
|
||||
#define IRQ_MSIX 2
|
||||
struct acrn_ptdev_irq {
|
||||
/** irq type */
|
||||
uint32_t type;
|
||||
/** virtual bdf description of pass thru device */
|
||||
|
|
Loading…
Reference in New Issue