Skip to contentSkip to conversation

hw/ppc/spapr: Halt CPU when powering off via RTAS call

PATCH Applied Thomas Huth 3 participants 3 messages Feb 17, 2016 – Feb 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/ppc/spapr: Halt CPU when powering off via RTAS call

The LoPAPR specification defines the following for the RTAS power-off call: "On successful operation, does not return". However, the implementation in QEMU currently returns and runs the guest CPU again for some more cycles. This caused some trouble with the new ppc implementation of the kvm-unit-tests recently. So let's make sure that the QEMU implementation follows the spec, thus stop the CPU to make sure that the RTAS call does not return to the guest anymore.

---
 hw/ppc/spapr_rtas.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_rtas.c +1 -0
index 07ad672..b7c5ebd 100644
@@ -113,6 +113,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,
         return;
     }
     qemu_system_shutdown_request();
+    cpu_stop_current();
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Signature · 1 line
1.8.3.1
Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · Thomas Huth

The LoPAPR specification defines the following for the RTAS power-off call: "On successful operation, does not return". However, the implementation in QEMU currently returns and runs the guest CPU again for some more cycles. This caused some trouble with the new ppc implementation of the kvm-unit-tests recently. So let's make sure that the QEMU implementation follows the spec, thus stop the CPU to make sure that the RTAS call does not return to the guest anymore.

(using the new, shiny kvm-unit-tests :-)

Quoted 20 lines
---
 hw/ppc/spapr_rtas.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_rtas.c +1 -0
index 07ad672..b7c5ebd 100644
@@ -113,6 +113,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,
         return;
     }
     qemu_system_shutdown_request();
+    cpu_stop_current();
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Signature · 1 line
1.8.3.1
Applied
#2 lore raw
In reply to Thomas Huth
Quoted 10 lines · Thomas Huth

The LoPAPR specification defines the following for the RTAS power-off call: "On successful operation, does not return". However, the implementation in QEMU currently returns and runs the guest CPU again for some more cycles. This caused some trouble with the new ppc implementation of the kvm-unit-tests recently. So let's make sure that the QEMU implementation follows the spec, thus stop the CPU to make sure that the RTAS call does not return to the guest anymore.

Applied to ppc-for-2.6, thanks.

Quoted 16 lines
---
 hw/ppc/spapr_rtas.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_rtas.c +1 -0
index 07ad672..b7c5ebd 100644
@@ -113,6 +113,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,
         return;
     }
     qemu_system_shutdown_request();
+    cpu_stop_current();
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
 }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson