mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-01 09:42:10 +00:00
dm: passthrough opregion to uos gpu
This commit is contained in:
parent
3a0f83ed73
commit
e5b21a2e90
@ -298,6 +298,10 @@ acrn_prepare_zeropage(struct vmctx *ctx, int setup_size)
|
|||||||
|
|
||||||
/* Create/add e820 table entries in zeropage */
|
/* Create/add e820 table entries in zeropage */
|
||||||
zeropage->e820_nentries = acrn_create_e820_table(ctx, zeropage->e820);
|
zeropage->e820_nentries = acrn_create_e820_table(ctx, zeropage->e820);
|
||||||
|
if (opregion_start != 0) {
|
||||||
|
zeropage->e820_nentries = add_e820_entry(zeropage->e820, zeropage->e820_nentries,
|
||||||
|
opregion_start, OPREGION_SIZE, E820_TYPE_RESERVED);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,8 @@ struct mmio_map {
|
|||||||
size_t size;
|
size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint32_t opregion_start = 0;
|
||||||
|
|
||||||
struct passthru_dev {
|
struct passthru_dev {
|
||||||
struct pci_vdev *dev;
|
struct pci_vdev *dev;
|
||||||
struct pcibar bar[PCI_BARMAX + 1];
|
struct pcibar bar[PCI_BARMAX + 1];
|
||||||
@ -848,6 +850,12 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
if (ptdev->phys_bdf == PCI_BDF_GPU) {
|
||||||
|
opregion_start = read_config(ptdev->phys_dev, PCIR_ASLS_CTL, 4);
|
||||||
|
printf("Opregion start=%x\n", opregion_start);
|
||||||
|
opregion_start = ALIGN_DOWN(opregion_start, 4096);
|
||||||
|
}
|
||||||
|
|
||||||
/* If ptdev support MSI/MSIX, stop here to skip virtual INTx setup.
|
/* If ptdev support MSI/MSIX, stop here to skip virtual INTx setup.
|
||||||
* Forge Guest to use MSI/MSIX in this case to mitigate IRQ sharing
|
* Forge Guest to use MSI/MSIX in this case to mitigate IRQ sharing
|
||||||
* issue
|
* issue
|
||||||
@ -1000,6 +1008,13 @@ passthru_cfgread(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
|
|||||||
*rv &= ~PCIM_GMCH_CTL_GMS;
|
*rv &= ~PCIM_GMCH_CTL_GMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((PCI_BDF(dev->bus, dev->slot, dev->func) == PCI_BDF_GPU)
|
||||||
|
&& (coff == PCIR_ASLS_CTL)) {
|
||||||
|
printf("passthrough opregion = %x\n", ptdev->phys_bdf);
|
||||||
|
vm_unmap_ptdev_mmio(ctx, 0, 2, 0, opregion_start, OPREGION_SIZE, opregion_start);
|
||||||
|
vm_map_ptdev_mmio(ctx, 0, 2, 0, opregion_start, OPREGION_SIZE, opregion_start);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,4 +143,9 @@ void vm_reset_watchdog(struct vmctx *ctx);
|
|||||||
|
|
||||||
int vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args);
|
int vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args);
|
||||||
int vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args);
|
int vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args);
|
||||||
|
|
||||||
|
extern uint32_t opregion_start;
|
||||||
|
#define OPREGION_SIZE 0x3000
|
||||||
|
#define PCIR_ASLS_CTL 0xFC
|
||||||
|
|
||||||
#endif /* _VMMAPI_H_ */
|
#endif /* _VMMAPI_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user