From 49e9fdd741301a891493caf0d3936249504e7fdc Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 13 Mar 2019 14:17:27 +1100 Subject: spapr: Correctly set LPCR[GTSE] in H_REGISTER_PROCESS_TABLE 176dccee "target/ppc/spapr: Clear partition table entry when allocating hash table" reworked the H_REGISTER_PROCESS_TABLE hypercall, but unfortunately due to a small error no longer correctly sets the LPCR[GTSE] bit which allows the guest to directly execute (some types of) tlbie (TLB flush) instructions without involving the hypervisor. We got away with this, initially, because POWER9 did not have hypervisor mode enabled in its msr_mask, which meant we didn't actually run hypervisor privilege checks in TCG at all. However, da874d90 "target/ppc: add HV support for POWER9" turned on HV support on POWER9 for the benefit of the powernv machine type. This exposed the earlier bug in H_REGISTER_PROCESS_TABLE, and causes guests which rely on LPCR[GTSE] (i.e. basically all of them) to crash during early boot when their first tlbie instruction causes an unexpected trap. Fixes: 176dccee target/ppc/spapr: Clear partition table entry when allocating hash table Signed-off-by: David Gibson Reviewed-by: Cédric Le Goater Reviewed-by: Greg Kurz Tested-by: Cleber Rosa --- hw/ppc/spapr_hcall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 0761e10142..8a736797b9 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1400,7 +1400,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, else if (flags & FLAG_HASH_PROC_TBL) /* Hash with process tables */ update_lpcr |= LPCR_UPRT; if (flags & FLAG_GTSE) /* Guest translation shootdown enable */ - update_lpcr |= FLAG_GTSE; + update_lpcr |= LPCR_GTSE; + spapr_set_all_lpcrs(update_lpcr, LPCR_UPRT | LPCR_HR | LPCR_GTSE); if (kvm_enabled()) { -- cgit v1.2.3-55-g7522 From 1a7c00bb3aa4cf5501343fe041e93227ec33e66f Mon Sep 17 00:00:00 2001 From: Cédric Le Goater Date: Sun, 10 Mar 2019 18:53:37 +0100 Subject: ppc/pnv: update skiboot to commit 261ca8e779e5. It includes better support for POWER9 processor and the QEMU platform. DD1.0 workarounds have been removed which simplifies a bit the XIVE PowerNV model. Built from submodule. Signed-off-by: Cédric Le Goater Message-Id: <20190310175338.22266-1-clg@kaod.org> Signed-off-by: David Gibson --- pc-bios/skiboot.lid | Bin 1302336 -> 1591384 bytes roms/skiboot | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/skiboot.lid b/pc-bios/skiboot.lid index 70612962c6..6d5966c3ae 100644 Binary files a/pc-bios/skiboot.lid and b/pc-bios/skiboot.lid differ diff --git a/roms/skiboot b/roms/skiboot index e0ee24c27a..261ca8e779 160000 --- a/roms/skiboot +++ b/roms/skiboot @@ -1 +1 @@ -Subproject commit e0ee24c27a172bcf482f6f2bc905e6211c134bcc +Subproject commit 261ca8e779e5138869a45f174caa49be6a274501 -- cgit v1.2.3-55-g7522 From 1af82d4f287332862f340f4daed2d8ffd99ad657 Mon Sep 17 00:00:00 2001 From: Cédric Le Goater Date: Wed, 13 Mar 2019 17:24:23 +0100 Subject: MAINTAINERS: PPC: add a PowerNV machine entry and declare David and myself as maintainers of the PPC PowerNV (Non-Virtualized) machine using the OPAL (skiboot) firmware. Signed-off-by: Cédric Le Goater Reviewed-by: Greg Kurz Message-Id: <20190313162423.22081-1-clg@kaod.org> Signed-off-by: David Gibson --- MAINTAINERS | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0e7baa9aa2..85d7d764e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1061,7 +1061,6 @@ F: include/hw/*/xics* F: pc-bios/spapr-rtas/* F: pc-bios/spapr-rtas.bin F: pc-bios/slof.bin -F: pc-bios/skiboot.lid F: docs/specs/ppc-spapr-hcalls.txt F: docs/specs/ppc-spapr-hotplug.txt F: tests/spapr* @@ -1069,6 +1068,18 @@ F: tests/libqos/*spapr* F: tests/rtas* F: tests/libqos/rtas* +PowerNV (Non-Virtualized) +M: Cédric Le Goater +M: David Gibson +L: qemu-ppc@nongnu.org +S: Maintained +F: hw/ppc/pnv* +F: hw/intc/pnv* +F: hw/intc/xics_pnv.c +F: include/hw/ppc/pnv* +F: pc-bios/skiboot.lid +F: tests/pnv* + virtex_ml507 M: Edgar E. Iglesias L: qemu-ppc@nongnu.org -- cgit v1.2.3-55-g7522 From 26aa5b1eeb086a67efc859933e04137e79aeac78 Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Wed, 13 Mar 2019 15:54:01 +0100 Subject: ppc/pnv: Use local_err variable in pnv_chip_power9_intc_create() Detected by Coverity: CID 1399702 Signed-off-by: Greg Kurz Message-Id: <155248884129.893204.2293309859485638162.stgit@bahia.lan> Reviewed-by: Cédric Le Goater Signed-off-by: David Gibson --- hw/ppc/pnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 8be4d4cbf7..dfb4ea5742 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -755,7 +755,7 @@ static void pnv_chip_power9_intc_create(PnvChip *chip, PowerPCCPU *cpu, * controller object is initialized afterwards. Hopefully, it's * only used at runtime. */ - obj = xive_tctx_create(OBJECT(cpu), XIVE_ROUTER(&chip9->xive), errp); + obj = xive_tctx_create(OBJECT(cpu), XIVE_ROUTER(&chip9->xive), &local_err); if (local_err) { error_propagate(errp, local_err); return; -- cgit v1.2.3-55-g7522 From f3e971ac9b64067ec94aab11653f92f74ca084aa Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Wed, 13 Mar 2019 15:54:06 +0100 Subject: ppc/pnv: Fix variable size in pnv_psi_power9_irq_set() PSI registers are 64-bit. Spotted by Coverity: CID 1399704 Signed-off-by: Greg Kurz Message-Id: <155248884690.893204.5428179144527749023.stgit@bahia.lan> Reviewed-by: Cédric Le Goater Signed-off-by: David Gibson --- hw/ppc/pnv_psi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c index 5a923e4151..5345c8389e 100644 --- a/hw/ppc/pnv_psi.c +++ b/hw/ppc/pnv_psi.c @@ -786,7 +786,7 @@ static const MemoryRegionOps pnv_psi_p9_xscom_ops = { static void pnv_psi_power9_irq_set(PnvPsi *psi, int irq, bool state) { - uint32_t irq_method = psi->regs[PSIHB_REG(PSIHB9_INTERRUPT_CONTROL)]; + uint64_t irq_method = psi->regs[PSIHB_REG(PSIHB9_INTERRUPT_CONTROL)]; if (irq > PSIHB9_NUM_IRQS) { qemu_log_mask(LOG_GUEST_ERROR, "PSI: Unsupported irq %d\n", irq); -- cgit v1.2.3-55-g7522 From ebc184be647259ad1f684da8205afb405834b421 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Thu, 14 Mar 2019 07:38:55 +0100 Subject: ppc/xics/spapr: Fix H_IPOLL implementation H_IPOLL takes the CPU# of the processor to poll as an argument, it doesn't operate on self. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Cédric Le Goater Message-Id: <20190314063855.27890-1-clg@kaod.org> Reviewed-by: Greg Kurz Signed-off-by: David Gibson --- hw/intc/xics_spapr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 607e1c167b..9d2b8adef7 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -95,8 +95,15 @@ static target_ulong h_eoi(PowerPCCPU *cpu, SpaprMachineState *spapr, static target_ulong h_ipoll(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, target_ulong *args) { + ICPState *icp = xics_icp_get(XICS_FABRIC(spapr), args[0]); uint32_t mfrr; - uint32_t xirr = icp_ipoll(spapr_cpu_state(cpu)->icp, &mfrr); + uint32_t xirr; + + if (!icp) { + return H_PARAMETER; + } + + xirr = icp_ipoll(icp, &mfrr); args[0] = xirr; args[1] = mfrr; -- cgit v1.2.3-55-g7522 From e366d181ceb96109b3f4fc6f8356bea644117f9a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 18 Mar 2019 20:01:48 +0100 Subject: spapr: Remove NULL checks on error_propagate() calls Patch created mechanically by rerunning: $ spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \ --macro-file scripts/cocci-macro-file.h \ --dir . --in-place Signed-off-by: Markus Armbruster Message-Id: <20190318190148.18283-1-armbru@redhat.com> Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 20915d2b3c..b63ed9d8da 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1488,9 +1488,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler, } out: - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); } static void spapr_pci_unplug(HotplugHandler *plug_handler, -- cgit v1.2.3-55-g7522