RFC qemu-kvm: MSI layer rework for in-kernel irqchip support
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest45 patches 98 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/45 | msi: Guard msi/msix_write_config with msi_presenthw/ hw/ | +3 | 0 replies | |
| 2/45 | msi: Guard msi_reset with msi_presenthw/ | +3 | 0 replies | |
| 3/45 | msi: Use msi/msix_present more consistentlyhw/ hw/ | +9 | 0 replies | |
| 4/45 | msi: Invoke msi/msix_reset from PCI corehw/ hw/ hw/ +3 more | +10 | 0 replies | |
| 5/45 | msi: Invoke msi/msix_write_config from PCI corehw/ hw/ hw/ +5 more | +4 | 0 replies | |
| 6/45 | msix: Prevent bogus mask updates on MMIO accesseshw/ | +10 | 7 replies | |
| 7/45 | msi: Generalize msix_supported to msi_supportedhw/ hw/ hw/ +2 more | +15 | 0 replies | |
| 8/45 | Introduce MSIMessage structurehw/ qemu-common.h | +6 | 6 replies | |
| 9/45 | msi: Factor out msi_message_from_vectorhw/ | +25 | 0 replies | |
| 10/45 | msix: Factor out msix_message_from_vectorhw/ | +13 | 0 replies | |
| 11/45 | msi: Factor out delivery hookhw/ hw/ hw/ +3 more | +36 | 18 replies | |
| 12/45 | msi: Introduce MSIRoutingCachehw/ hw/ hw/ +5 more | +37 | 11 replies | |
| 13/45 | hpet: Use msi_deliverhw/ | +6 | 0 replies | |
| 14/45 | qemu-kvm: Drop useless kvm_clear_gsi_routesqemu-kvm-x86.c qemu-kvm.c qemu-kvm.h | +0 | 0 replies | |
| 15/45 | qemu-kvm: Drop unused kvm_del_irq_routeqemu-kvm.c qemu-kvm.h | +0 | 0 replies | |
| 16/45 | qemu-kvm: Use MSIMessage and MSIRoutingCachehw/ hw/ hw/ +4 more | +57 | 0 replies | |
| 17/45 | qemu-kvm: Track MSIRoutingCache in KVM routing tablehw/ kvm-all.c qemu-kvm.c +1 more | +23 | 3 replies | |
| 18/45 | qemu-kvm: Hook into MSI delivery at APIC levelhw/ hw/ hw/ | +15 | 0 replies | |
| 19/45 | qemu-kvm: Factor out kvm_msi_irqfd_sethw/ kvm.h qemu-kvm.c | +18 | 0 replies | |
| 20/45 | qemu-kvm: msix: Only invoke msix_handle_mask_update on changeshw/ hw/ hw/ | +23 | 0 replies | |
| 21/45 | qemu-kvm: msix: Don't fire notifier spuriously on set/unsethw/ | +14 | 0 replies | |
| 22/45 | qemu-kvm: msix: Fire mask notifier on global mask changeshw/ | +9 | 5 replies | |
| 23/45 | qemu-kvm: Rework MSI-X mask notifier to generic MSI config notifiershw/ hw/ hw/ +1 more | +102 | 6 replies | |
| 24/45 | qemu-kvm: msix: Don't handle mask updated while disabledhw/ | +1 | 0 replies | |
| 25/45 | qemu-kvm: Update MSI cache on kvm_msi_irqfd_sethw/ kvm.h qemu-kvm.c | +22 | 0 replies | |
| 26/45 | qemu-kvm: Use g_realloc for irq_routes extensionqemu-kvm.c | +1 | 0 replies | |
| 27/45 | qemu-kvm: Lazily update MSI cacheshw/ hw/ hw/ +6 more | +75 | 0 replies | |
| 28/45 | qemu-kvm: msix: Drop tracking of used vectorshw/ hw/ hw/ +2 more | +26 | 33 replies | |
| 29/45 | pci-assign: Drop kvm_assigned_irq::host_irq initializationhw/ | +0 | 0 replies | |
| 30/45 | pci-assign: Rename assign_irq to assign_intxhw/ | +7 | 0 replies | |
| 31/45 | qemu-kvm: Refactor kvm_deassign_irq to kvm_device_irq_deassignhw/ qemu-kvm.c qemu-kvm.h | +35 | 0 replies | |
| 32/45 | pci-assign: Factor out deassign_irqhw/ | +18 | 0 replies | |
| 33/45 | qemu-kvm: Factor out kvm_device_intx_assignhw/ qemu-kvm.c qemu-kvm.h | +29 | 0 replies | |
| 34/45 | qemu-kvm: Factor out kvm_device_msi_assignhw/ qemu-kvm.c qemu-kvm.h | +38 | 0 replies | |
| 35/45 | pci-assign: Polish assigned_dev_update_msix_mmiohw/ | +29 | 0 replies | |
| 36/45 | qemu-kvm: Factor out kvm_device_msix_* serviceshw/ hw/ qemu-kvm.c +1 more | +76 | 0 replies | |
| 37/45 | qemu-kvm: Clean up irqrouting APIkvm-stub.c kvm.h qemu-kvm.c +1 more | +6 | 0 replies | |
| 38/45 | msi: Implement config notifiers for legacy MSIhw/ hw/ hw/ +1 more | +166 | 0 replies | |
| 39/45 | pci-assign: Use generic MSI supporthw/ | +31 | 0 replies | |
| 40/45 | qemu-kvm: msix: Drop check for preexisting cap from msix_add_confighw/ | +33 | 0 replies | |
| 41/45 | msix: Drop unused msix_bar_sizehw/ hw/ hw/ | +0 | 0 replies | |
| 42/45 | msix: Introduce msix_init_simplehw/ hw/ hw/ +2 more | +23 | 6 replies | |
| 43/45 | msix: Allow to customize capability on inithw/ hw/ hw/ | +150 | 0 replies | |
| 44/45 | pci-assign: Use generic MSI-X supporthw/ hw/ | +88 | 0 replies | |
| 45/45 | pci-assign: Fix coding style issueshw/ hw/ | +107 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC][PATCH 00/45] qemu-kvm: MSI layer rework for in-kernel irqchip support
As previously indicated, I was working for quite a while on a major refactoring of the MSI "additions" we have in qemu-kvm to support in-kernel irqchip, vhost and device assignment. This is now the outcome.
I'm quite happy with it, things are still working (apparently), and the invasiveness of KVM hooks into the MSI layer is significantly reduced. Moreover, I was able to port the device assignment code over generic MSI support, reducing the size of that file a bit further.
Some further highlights:
- fix for HPET MSI support with in-kernel irqchip
- fully configurable MSI-X (allows 1:1 mapping for assigned devices)
- refactored KVM core API for device assignment and IRQ routing
I'm sending the whole series in one chunk so that you can see what the result will be. It's RFC as I bet that there are regressions included and maybe still room left for improvements. Once all is fine (can be broken up into multiple chunks for the merge), I would suggest patching qemu-kvm first and then start with porting things over to upstream.
Comments & review welcome.
Jan Kiszka (45):
msi: Guard msi/msix_write_config with msi_present
msi: Guard msi_reset with msi_present
msi: Use msi/msix_present more consistently
msi: Invoke msi/msix_reset from PCI core
msi: Invoke msi/msix_write_config from PCI core
msix: Prevent bogus mask updates on MMIO accesses
msi: Generalize msix_supported to msi_supported
Introduce MSIMessage structure
msi: Factor out msi_message_from_vector
msix: Factor out msix_message_from_vector
msi: Factor out delivery hook
msi: Introduce MSIRoutingCache
hpet: Use msi_deliver
qemu-kvm: Drop useless kvm_clear_gsi_routes
qemu-kvm: Drop unused kvm_del_irq_route
qemu-kvm: Use MSIMessage and MSIRoutingCache
qemu-kvm: Track MSIRoutingCache in KVM routing table
qemu-kvm: Hook into MSI delivery at APIC level
qemu-kvm: Factor out kvm_msi_irqfd_set
qemu-kvm: msix: Only invoke msix_handle_mask_update on changes
qemu-kvm: msix: Don't fire notifier spuriously on set/unset
qemu-kvm: msix: Fire mask notifier on global mask changes
qemu-kvm: Rework MSI-X mask notifier to generic MSI config notifiers
qemu-kvm: msix: Don't handle mask updated while disabled
qemu-kvm: Update MSI cache on kvm_msi_irqfd_set
qemu-kvm: Use g_realloc for irq_routes extension
qemu-kvm: Lazily update MSI caches
qemu-kvm: msix: Drop tracking of used vectors
pci-assign: Drop kvm_assigned_irq::host_irq initialization
pci-assign: Rename assign_irq to assign_intx
qemu-kvm: Refactor kvm_deassign_irq to kvm_device_irq_deassign
pci-assign: Factor out deassign_irq
qemu-kvm: Factor out kvm_device_intx_assign
qemu-kvm: Factor out kvm_device_msi_assign
pci-assign: Polish assigned_dev_update_msix_mmio
qemu-kvm: Factor out kvm_device_msix_* services
qemu-kvm: Clean up irqrouting API
msi: Implement config notifiers for legacy MSI
pci-assign: Use generic MSI support
qemu-kvm: msix: Drop check for preexisting cap from msix_add_config
msix: Drop unused msix_bar_size
msix: Introduce msix_init_simple
msix: Allow to customize capability on init
pci-assign: Use generic MSI-X support
pci-assign: Fix coding style issues
hw/apic.c | 28 ++- hw/apic.h | 1 + hw/device-assignment.c | 751 +++++++++++++++++------------------------------ hw/device-assignment.h | 29 +-- hw/hpet.c | 7 +- hw/ide/ich.c | 8 - hw/intel-hda.c | 12 - hw/ioh3420.c | 3 +- hw/ivshmem.c | 22 +-- hw/msi.c | 329 +++++++++++++--------- hw/msi.h | 30 ++- hw/msix.c | 626 ++++++++++++++++++---------------------- hw/msix.h | 29 +- hw/pc.c | 15 +- hw/pci.c | 9 +- hw/pci.h | 34 ++- hw/pci_bridge.c | 4 + hw/virtio-pci.c | 75 ++--- hw/virtio-pci.h | 1 - hw/xio3130_downstream.c | 3 +- hw/xio3130_upstream.c | 2 - kvm-all.c | 1 + kvm-stub.c | 23 +-- kvm.h | 17 +- qemu-common.h | 2 + qemu-kvm-x86.c | 1 - qemu-kvm.c | 281 ++++++++++++------ qemu-kvm.h | 81 +----- 28 files changed, 1110 insertions(+), 1314 deletions(-)
Signature · 1 line
1.7.3.4