virtio: do not require IOMMU to be created in advance
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
miss the list, cced.
Quoted 62 lines · Jason Wang
Quoted 52 lines · Peter Xu
Quoted 13 lines · Jason Wang
Quoted 11 lines · Jason Wang
After commit
96a8821d2141("virtio: unbreak virtio-pci with IOMMU after caching ring translations"), IOMMU was required to be created in advance. This is because we can only get the correctdma_asafter pci IOMMU (e.gintel_iommu) was initialized. This is suboptimal and inconvenient for user. This patch releases this by:- introduce a
bus_master_readymethod for PCIDeviceClass and trigger this duringpci_init_bus_master
- implement virtio-pci method and 1) reset thedma_as2) re-register the memory listener to the newdma_asQuoted 5 lines
Quoted 2 lines
Cc Paolo Bonzini<[email protected]>Signed-off-by Jason Wang<[email protected]>This patch breaks hotplug by calling
reset_dma_as()when virtio is not initialized. Will post V2 to callbus_master_ready()only atpcibus_machine_done().A tiny issue with above fix would be:
bus_master_ready()will not be called when do device hot-plug. If we want that interface to be a general one for the whole PCI framework, then imho we'd better call it as well for hot-plug devices. So instead, do you like below fix?--------8<--------
hw/pci/pci.c +3
-3@@ -995,9 +995,6 @@ static PCIDevice *do_pci_register_device (PCIDevice *pci_dev, PCIBus *bus, pci_dev->devfn = devfn; pci_dev->requester_id_cache =pci_req_id_cache_get (pci_dev); - if (qdev_hotplug) { -pci_init_bus_master (pci_dev); - }pstrcpy (pci_dev->name,sizeof (pci_dev->name), name); pci_dev->irq_state =0 ;pci_config_alloc (pci_dev);@@ -1967,6 +1964,10 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) } } + if (qdev_hotplug) { +pci_init_bus_master (pci_dev); + } +/* rom loading */ is_default_rom = false;if (pci_dev->romfile ==NULL && pc->romfile !=NULL ) { -------->8--------Quoted 3 lines
Thanks,
-- peterx
I like this, will post V3.
Thanks