So we don't need to store zpci idx in msix message data to find out the
specific zpci device. Instead, we could use pci device id to find its
corresponding zpci device.
Signed-off-by: Yi Min Zhao <address@hidden>
---
hw/s390x/s390-pci-bus.c | 16 +++++-----------
hw/s390x/s390-pci-bus.h | 2 ++
hw/s390x/s390-pci-inst.c | 24 ------------------------
target/s390x/kvm.c | 7 +++++--
4 files changed, 12 insertions(+), 37 deletions(-)
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 1c68c36663..e348bfb7cc 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -2503,10 +2503,13 @@ int kvm_arch_fixup_msi_route(struct
kvm_irq_routing_entry *route,
uint64_t address, uint32_t data, PCIDevice *dev)
{
S390PCIBusDevice *pbdev;
- uint32_t idx = data >> ZPCI_MSI_VEC_BITS;
uint32_t vec = data & ZPCI_MSI_VEC_MASK;
- pbdev = s390_pci_find_dev_by_idx(s390_get_phb(), idx);
+ if (!dev) {
+ return -ENODEV;
+ }
+
+ pbdev = s390_pci_find_dev_by_target(s390_get_phb(), DEVICE(dev)->id);