在 2017/8/28 下午11:04, Cornelia Huck 写道:
On Mon, 28 Aug 2017 10:04:45 +0200
Yi Min Zhao <zyi...@linux.vnet.ibm.com> wrote:
PCIDevcie pointer has been a parameter of kvm_arch_fixup_msi_route().
s/PCIDevcie/PCIDevice
Thanks!
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 <zyi...@linux.vnet.ibm.com>
---
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);
You need to replace the stub for s390_pci_find_dev_by_idx() with a stub
for s390_pci_find_dev_by_target() in s390-pci-stubs.c (on my s390-next
branch), so that it compiles without CONFIG_PCI.
OK. Got it.
if (!pbdev) {
DPRINTF("add_msi_route no dev\n");
return -ENODEV;