|
|
@ -305,7 +305,7 @@ static void vfio_intx_update(VFIOPCIDevice *vdev, PCIINTxRoute *route) |
|
|
|
|
|
|
|
|
static void vfio_intx_routing_notifier(PCIDevice *pdev) |
|
|
static void vfio_intx_routing_notifier(PCIDevice *pdev) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
PCIINTxRoute route; |
|
|
PCIINTxRoute route; |
|
|
|
|
|
|
|
|
if (vdev->interrupt != VFIO_INT_INTx) { |
|
|
if (vdev->interrupt != VFIO_INT_INTx) { |
|
|
@ -660,7 +660,7 @@ void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr) |
|
|
static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr, |
|
|
static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr, |
|
|
MSIMessage *msg, IOHandler *handler) |
|
|
MSIMessage *msg, IOHandler *handler) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIOMSIVector *vector; |
|
|
VFIOMSIVector *vector; |
|
|
int ret; |
|
|
int ret; |
|
|
bool resizing = !!(vdev->nr_vectors < nr + 1); |
|
|
bool resizing = !!(vdev->nr_vectors < nr + 1); |
|
|
@ -755,7 +755,7 @@ static int vfio_msix_vector_use(PCIDevice *pdev, |
|
|
|
|
|
|
|
|
static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr) |
|
|
static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIOMSIVector *vector = &vdev->msi_vectors[nr]; |
|
|
VFIOMSIVector *vector = &vdev->msi_vectors[nr]; |
|
|
|
|
|
|
|
|
trace_vfio_msix_vector_release(vdev->vbasedev.name, nr); |
|
|
trace_vfio_msix_vector_release(vdev->vbasedev.name, nr); |
|
|
@ -1346,7 +1346,7 @@ static const MemoryRegionOps vfio_vga_ops = { |
|
|
*/ |
|
|
*/ |
|
|
static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar) |
|
|
static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIORegion *region = &vdev->bars[bar].region; |
|
|
VFIORegion *region = &vdev->bars[bar].region; |
|
|
MemoryRegion *mmap_mr, *region_mr, *base_mr; |
|
|
MemoryRegion *mmap_mr, *region_mr, *base_mr; |
|
|
PCIIORegion *r; |
|
|
PCIIORegion *r; |
|
|
@ -1392,7 +1392,7 @@ static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar) |
|
|
*/ |
|
|
*/ |
|
|
uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len) |
|
|
uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
uint32_t emu_bits = 0, emu_val = 0, phys_val = 0, val; |
|
|
uint32_t emu_bits = 0, emu_val = 0, phys_val = 0, val; |
|
|
|
|
|
|
|
|
@ -1426,7 +1426,7 @@ uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len) |
|
|
void vfio_pci_write_config(PCIDevice *pdev, |
|
|
void vfio_pci_write_config(PCIDevice *pdev, |
|
|
uint32_t addr, uint32_t val, int len) |
|
|
uint32_t addr, uint32_t val, int len) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
uint32_t val_le = cpu_to_le32(val); |
|
|
uint32_t val_le = cpu_to_le32(val); |
|
|
int ret; |
|
|
int ret; |
|
|
@ -3392,7 +3392,7 @@ bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Error **errp) |
|
|
static void vfio_pci_realize(PCIDevice *pdev, Error **errp) |
|
|
static void vfio_pci_realize(PCIDevice *pdev, Error **errp) |
|
|
{ |
|
|
{ |
|
|
ERRP_GUARD(); |
|
|
ERRP_GUARD(); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
int i; |
|
|
int i; |
|
|
char uuid[UUID_STR_LEN]; |
|
|
char uuid[UUID_STR_LEN]; |
|
|
@ -3552,14 +3552,14 @@ error: |
|
|
|
|
|
|
|
|
static void vfio_pci_finalize(Object *obj) |
|
|
static void vfio_pci_finalize(Object *obj) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj); |
|
|
|
|
|
|
|
|
vfio_pci_put_device(vdev); |
|
|
vfio_pci_put_device(vdev); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void vfio_exitfn(PCIDevice *pdev) |
|
|
static void vfio_exitfn(PCIDevice *pdev) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev); |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
|
|
|
|
|
|
vfio_unregister_req_notifier(vdev); |
|
|
vfio_unregister_req_notifier(vdev); |
|
|
@ -3583,7 +3583,7 @@ static void vfio_exitfn(PCIDevice *pdev) |
|
|
|
|
|
|
|
|
static void vfio_pci_reset(DeviceState *dev) |
|
|
static void vfio_pci_reset(DeviceState *dev) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(dev); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(dev); |
|
|
|
|
|
|
|
|
/* Do not reset the device during qemu_system_reset prior to cpr load */ |
|
|
/* Do not reset the device during qemu_system_reset prior to cpr load */ |
|
|
if (cpr_is_incoming()) { |
|
|
if (cpr_is_incoming()) { |
|
|
@ -3628,7 +3628,7 @@ post_reset: |
|
|
static void vfio_pci_init(Object *obj) |
|
|
static void vfio_pci_init(Object *obj) |
|
|
{ |
|
|
{ |
|
|
PCIDevice *pci_dev = PCI_DEVICE(obj); |
|
|
PCIDevice *pci_dev = PCI_DEVICE(obj); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj); |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
VFIODevice *vbasedev = &vdev->vbasedev; |
|
|
|
|
|
|
|
|
device_add_bootindex_property(obj, &vdev->bootindex, |
|
|
device_add_bootindex_property(obj, &vdev->bootindex, |
|
|
@ -3669,7 +3669,7 @@ static void vfio_pci_base_dev_class_init(ObjectClass *klass, const void *data) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static const TypeInfo vfio_pci_base_dev_info = { |
|
|
static const TypeInfo vfio_pci_base_dev_info = { |
|
|
.name = TYPE_VFIO_PCI_BASE, |
|
|
.name = TYPE_VFIO_PCI_DEVICE, |
|
|
.parent = TYPE_PCI_DEVICE, |
|
|
.parent = TYPE_PCI_DEVICE, |
|
|
.instance_size = sizeof(VFIOPCIDevice), |
|
|
.instance_size = sizeof(VFIOPCIDevice), |
|
|
.abstract = true, |
|
|
.abstract = true, |
|
|
@ -3758,7 +3758,7 @@ static const Property vfio_pci_dev_properties[] = { |
|
|
#ifdef CONFIG_IOMMUFD |
|
|
#ifdef CONFIG_IOMMUFD |
|
|
static void vfio_pci_set_fd(Object *obj, const char *str, Error **errp) |
|
|
static void vfio_pci_set_fd(Object *obj, const char *str, Error **errp) |
|
|
{ |
|
|
{ |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj); |
|
|
VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj); |
|
|
vfio_device_set_fd(&vdev->vbasedev, str, errp); |
|
|
vfio_device_set_fd(&vdev->vbasedev, str, errp); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
@ -3914,7 +3914,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data) |
|
|
|
|
|
|
|
|
static const TypeInfo vfio_pci_info = { |
|
|
static const TypeInfo vfio_pci_info = { |
|
|
.name = TYPE_VFIO_PCI, |
|
|
.name = TYPE_VFIO_PCI, |
|
|
.parent = TYPE_VFIO_PCI_BASE, |
|
|
.parent = TYPE_VFIO_PCI_DEVICE, |
|
|
.class_init = vfio_pci_class_init, |
|
|
.class_init = vfio_pci_class_init, |
|
|
.instance_init = vfio_pci_init, |
|
|
.instance_init = vfio_pci_init, |
|
|
.instance_finalize = vfio_pci_finalize, |
|
|
.instance_finalize = vfio_pci_finalize, |
|
|
|