|
|
023288 |
From: David Gibson <david@gibson.dropbear.id.au>
|
|
|
023288 |
Date: Fri, 18 Oct 2019 15:19:31 +1100
|
|
|
023288 |
Subject: [PATCH] spapr: Don't trigger a CAS reboot for XICS/XIVE mode
|
|
|
023288 |
changeover
|
|
|
023288 |
|
|
|
023288 |
PAPR allows the interrupt controller used on a POWER9 machine (XICS or
|
|
|
023288 |
XIVE) to be selected by the guest operating system, by using the
|
|
|
023288 |
ibm,client-architecture-support (CAS) feature negotiation call.
|
|
|
023288 |
|
|
|
023288 |
Currently, if the guest selects an interrupt controller different from the
|
|
|
023288 |
one selected at initial boot, this causes the system to be reset with the
|
|
|
023288 |
new model and the boot starts again. This means we run through the SLOF
|
|
|
023288 |
boot process twice, as well as any other bootloader (e.g. grub) in use
|
|
|
023288 |
before the OS calls CAS. This can be confusing and/or inconvenient for
|
|
|
023288 |
users.
|
|
|
023288 |
|
|
|
023288 |
Thanks to two fairly recent changes, we no longer need this reboot. 1) we
|
|
|
023288 |
now completely regenerate the device tree when CAS is called (meaning we
|
|
|
023288 |
don't need special case updates for all the device tree changes caused by
|
|
|
023288 |
the interrupt controller mode change), 2) we now have explicit code paths
|
|
|
023288 |
to activate and deactivate the different interrupt controllers, rather than
|
|
|
023288 |
just implicitly calling those at machine reset time.
|
|
|
023288 |
|
|
|
023288 |
We can therefore eliminate the reboot for changing irq mode, simply by
|
|
|
023288 |
putting a call to spapr_irq_update_active_intc() before we call
|
|
|
023288 |
spapr_h_cas_compose_response() (which gives the updated device tree to
|
|
|
023288 |
the guest firmware and OS).
|
|
|
023288 |
|
|
|
023288 |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
023288 |
Reviewed-by: Cedric Le Goater <clg@fr.ibm.com>
|
|
|
023288 |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
023288 |
(cherry picked from commit 8deb8019d696c75e6ecaee7545026b62aba2f1bb)
|
|
|
023288 |
---
|
|
|
023288 |
hw/ppc/spapr_hcall.c | 33 +++++++++++++--------------------
|
|
|
023288 |
1 file changed, 13 insertions(+), 20 deletions(-)
|
|
|
023288 |
|
|
|
023288 |
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
|
|
|
023288 |
index 140f05c1c6..05a7ca275b 100644
|
|
|
023288 |
--- a/hw/ppc/spapr_hcall.c
|
|
|
023288 |
+++ b/hw/ppc/spapr_hcall.c
|
|
|
023288 |
@@ -1767,21 +1767,10 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
|
|
|
023288 |
}
|
|
|
023288 |
spapr->cas_pre_isa3_guest = !spapr_ovec_test(ov1_guest, OV1_PPC_3_00);
|
|
|
023288 |
spapr_ovec_cleanup(ov1_guest);
|
|
|
023288 |
- if (!spapr->cas_reboot) {
|
|
|
023288 |
- /* If spapr_machine_reset() did not set up a HPT but one is necessary
|
|
|
023288 |
- * (because the guest isn't going to use radix) then set it up here. */
|
|
|
023288 |
- if ((spapr->patb_entry & PATE1_GR) && !guest_radix) {
|
|
|
023288 |
- /* legacy hash or new hash: */
|
|
|
023288 |
- spapr_setup_hpt_and_vrma(spapr);
|
|
|
023288 |
- }
|
|
|
023288 |
- spapr->cas_reboot =
|
|
|
023288 |
- (spapr_h_cas_compose_response(spapr, args[1], args[2],
|
|
|
023288 |
- ov5_updates) != 0);
|
|
|
023288 |
- }
|
|
|
023288 |
|
|
|
023288 |
/*
|
|
|
023288 |
- * Ensure the guest asks for an interrupt mode we support; otherwise
|
|
|
023288 |
- * terminate the boot.
|
|
|
023288 |
+ * Ensure the guest asks for an interrupt mode we support;
|
|
|
023288 |
+ * otherwise terminate the boot.
|
|
|
023288 |
*/
|
|
|
023288 |
if (guest_xive) {
|
|
|
023288 |
if (!spapr->irq->xive) {
|
|
|
023288 |
@@ -1797,14 +1786,18 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
|
|
|
023288 |
}
|
|
|
023288 |
}
|
|
|
023288 |
|
|
|
023288 |
- /*
|
|
|
023288 |
- * Generate a machine reset when we have an update of the
|
|
|
023288 |
- * interrupt mode. Only required when the machine supports both
|
|
|
023288 |
- * modes.
|
|
|
023288 |
- */
|
|
|
023288 |
+ spapr_irq_update_active_intc(spapr);
|
|
|
023288 |
+
|
|
|
023288 |
if (!spapr->cas_reboot) {
|
|
|
023288 |
- spapr->cas_reboot = spapr_ovec_test(ov5_updates, OV5_XIVE_EXPLOIT)
|
|
|
023288 |
- && spapr->irq->xics && spapr->irq->xive;
|
|
|
023288 |
+ /* If spapr_machine_reset() did not set up a HPT but one is necessary
|
|
|
023288 |
+ * (because the guest isn't going to use radix) then set it up here. */
|
|
|
023288 |
+ if ((spapr->patb_entry & PATE1_GR) && !guest_radix) {
|
|
|
023288 |
+ /* legacy hash or new hash: */
|
|
|
023288 |
+ spapr_setup_hpt_and_vrma(spapr);
|
|
|
023288 |
+ }
|
|
|
023288 |
+ spapr->cas_reboot =
|
|
|
023288 |
+ (spapr_h_cas_compose_response(spapr, args[1], args[2],
|
|
|
023288 |
+ ov5_updates) != 0);
|
|
|
023288 |
}
|
|
|
023288 |
|
|
|
023288 |
spapr_ovec_cleanup(ov5_updates);
|