[PATCH v2 for-5.2 0/5] papr: Cleanups for XIVE and PHB

Greg Kurz posted 5 patches 3 years, 8 months ago
Test docker-quick@centos7 failed
Test docker-mingw@fedora failed
Test checkpatch failed
Test FreeBSD failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/159673295739.766512.2950380687630225803.stgit@bahia.lan
Maintainers: David Gibson <david@gibson.dropbear.id.au>, "Cédric Le Goater" <clg@kaod.org>
hw/intc/spapr_xive.c     |   53 ++++++++++++++++++++++++++++++++++------------
hw/intc/spapr_xive_kvm.c |   49 ++++++++++++-------------------------------
hw/intc/xive.c           |   28 ++++++++++++++++++------
hw/ppc/spapr_pci.c       |   16 ++++++--------
include/hw/ppc/xive.h    |    2 ++
5 files changed, 83 insertions(+), 65 deletions(-)
[PATCH v2 for-5.2 0/5] papr: Cleanups for XIVE and PHB
Posted by Greg Kurz 3 years, 8 months ago
Recent cleanup patch "spapr: Simplify error handling in spapr_phb_realize"
had to be dropped from ppc-for-5.2 because it would cause QEMU to crash
at init time on some POWER9 setups (eg. Boston systems), as reported by
Daniel.

The crash was happening because the kvmppc_xive_source_reset_one() function
would get called at some point (eg. initializing the LSI table of PHB0) and
fail (because XIVE KVM isn't supported on Bostons) without calling
error_setg(), which the caller doesn't expect when the patch above is applied.

The issue isn't really about a missing call to error_setg() but why do
we end up trying to claim an IRQ number in a XIVE KVM device that doesn't
exist ? The root cause for this is that we guard calls to the XIVE KVM
code with kvm_irqchip_in_kernel(), which might return true when the XICS
KVM device is active, even though the XIVE one is not. This series
upgrade the guarding code to also check if the device is actually open.

A similar cleanup could be performed on XICS.

v2: - patch 1 and 2 already applied but not yet visible on github
    - new approach with abstract methods in the base XIVE classes

---

Greg Kurz (5):
      spapr/xive: Fix xive->fd if kvm_create_device() fails
      spapr/xive: Simplify kvmppc_xive_disconnect()
      ppc/xive: Introduce dedicated kvm_irqchip_in_kernel() wrappers
      spapr/xive: Convert KVM device fd checks to assert()
      spapr: Simplify error handling in spapr_phb_realize()


 hw/intc/spapr_xive.c     |   53 ++++++++++++++++++++++++++++++++++------------
 hw/intc/spapr_xive_kvm.c |   49 ++++++++++++-------------------------------
 hw/intc/xive.c           |   28 ++++++++++++++++++------
 hw/ppc/spapr_pci.c       |   16 ++++++--------
 include/hw/ppc/xive.h    |    2 ++
 5 files changed, 83 insertions(+), 65 deletions(-)

--
Greg