summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-11-19 10:36:53 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-11-19 10:36:53 +0000
commitff85db769ffd431f86d263d5e954e809a83be92f (patch)
tree75d41b69bc370adc1c1b102fb23bc11e09d676e6 /hw
parent3d275bd17c7bdf5acd4e4f58fa7b8b9114bb7484 (diff)
parenta4e2fff1b104f2b235ea2673968d0b0383f541dc (diff)
downloadqemu-ff85db769ffd431f86d263d5e954e809a83be92f.zip
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20201119' into staging
s390x fixes: - fix propagation and reset for the new diag318 call - fix hot-unplug for vfio-pci devices - fix endianness issues in zPCI (regression fix) # gpg: Signature made Thu 19 Nov 2020 10:15:58 GMT # gpg: using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF # gpg: issuer "cohuck@redhat.com" # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown] # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full] # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full] # gpg: aka "Cornelia Huck <cohuck@kernel.org>" [unknown] # gpg: aka "Cornelia Huck <cohuck@redhat.com>" [unknown] # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20201119: s390x/pci: fix endianness issues s390x/pci: Unregister listeners before destroying IOMMU address space s390/kvm: fix diag318 propagation and reset functionality Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/s390x/s390-pci-bus.c17
-rw-r--r--hw/s390x/s390-pci-inst.c16
-rw-r--r--hw/s390x/s390-pci-vfio.c12
-rw-r--r--hw/s390x/s390-virtio-ccw.c4
4 files changed, 36 insertions, 13 deletions
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 48a3be802f..05f7460aec 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -732,6 +732,13 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
table->iommu[PCI_SLOT(devfn)] = NULL;
g_hash_table_destroy(iommu->iotlb);
+ /*
+ * An attached PCI device may have memory listeners, eg. VFIO PCI.
+ * The associated subregion will already have been unmapped in
+ * s390_pci_iommu_disable in response to the guest deconfigure request.
+ * Remove the listeners now before destroying the address space.
+ */
+ address_space_remove_listeners(&iommu->as);
address_space_destroy(&iommu->as);
object_unparent(OBJECT(&iommu->mr));
object_unparent(OBJECT(iommu));
@@ -770,11 +777,11 @@ static void s390_pci_init_default_group(void)
group = s390_group_create(ZPCI_DEFAULT_FN_GRP);
resgrp = &group->zpci_group;
resgrp->fr = 1;
- stq_p(&resgrp->dasm, 0);
- stq_p(&resgrp->msia, ZPCI_MSI_ADDR);
- stw_p(&resgrp->mui, DEFAULT_MUI);
- stw_p(&resgrp->i, 128);
- stw_p(&resgrp->maxstbl, 128);
+ resgrp->dasm = 0;
+ resgrp->msia = ZPCI_MSI_ADDR;
+ resgrp->mui = DEFAULT_MUI;
+ resgrp->i = 128;
+ resgrp->maxstbl = 128;
resgrp->version = 0;
}
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 58cd041d17..70bfd91bf7 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -281,7 +281,13 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
goto out;
}
- memcpy(resquery, &pbdev->zpci_fn, sizeof(*resquery));
+ stq_p(&resquery->sdma, pbdev->zpci_fn.sdma);
+ stq_p(&resquery->edma, pbdev->zpci_fn.edma);
+ stw_p(&resquery->pchid, pbdev->zpci_fn.pchid);
+ resquery->flags = pbdev->zpci_fn.flags;
+ resquery->pfgid = pbdev->zpci_fn.pfgid;
+ stl_p(&resquery->fid, pbdev->zpci_fn.fid);
+ stl_p(&resquery->uid, pbdev->zpci_fn.uid);
for (i = 0; i < PCI_BAR_COUNT; i++) {
uint32_t data = pci_get_long(pbdev->pdev->config +
@@ -312,7 +318,13 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
stw_p(&resgrp->hdr.rsp, CLP_RC_QUERYPCIFG_PFGID);
goto out;
}
- memcpy(resgrp, &group->zpci_group, sizeof(ClpRspQueryPciGrp));
+ resgrp->fr = group->zpci_group.fr;
+ stq_p(&resgrp->dasm, group->zpci_group.dasm);
+ stq_p(&resgrp->msia, group->zpci_group.msia);
+ stw_p(&resgrp->mui, group->zpci_group.mui);
+ stw_p(&resgrp->i, group->zpci_group.i);
+ stw_p(&resgrp->maxstbl, group->zpci_group.maxstbl);
+ resgrp->version = group->zpci_group.version;
stw_p(&resgrp->hdr.rsp, CLP_RC_OK);
break;
}
diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
index d5c78063b5..9296e1bb6e 100644
--- a/hw/s390x/s390-pci-vfio.c
+++ b/hw/s390x/s390-pci-vfio.c
@@ -156,12 +156,12 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
if (cap->flags & VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH) {
resgrp->fr = 1;
}
- stq_p(&resgrp->dasm, cap->dasm);
- stq_p(&resgrp->msia, cap->msi_addr);
- stw_p(&resgrp->mui, cap->mui);
- stw_p(&resgrp->i, cap->noi);
- stw_p(&resgrp->maxstbl, cap->maxstbl);
- stb_p(&resgrp->version, cap->version);
+ resgrp->dasm = cap->dasm;
+ resgrp->msia = cap->msi_addr;
+ resgrp->mui = cap->mui;
+ resgrp->i = cap->noi;
+ resgrp->maxstbl = cap->maxstbl;
+ resgrp->version = cap->version;
}
}
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 22222c4fd5..4e140bbead 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -486,6 +486,10 @@ static void s390_machine_reset(MachineState *machine)
default:
g_assert_not_reached();
}
+
+ CPU_FOREACH(t) {
+ run_on_cpu(t, s390_do_cpu_set_diag318, RUN_ON_CPU_HOST_ULONG(0));
+ }
s390_ipl_clear_reset_request();
}