diff mbox

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

Message ID 1455733399-4939-1-git-send-email-thuth@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Huth Feb. 17, 2016, 6:23 p.m. UTC
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.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/ppc/spapr_rtas.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Jones Feb. 17, 2016, 6:52 p.m. UTC | #1
On Wed, Feb 17, 2016 at 07:23:19PM +0100, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Tested-by: Andrew Jones <drjones@redhat.com>

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

> ---
>  hw/ppc/spapr_rtas.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 07ad672..b7c5ebd 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -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);
>  }
>  
> -- 
> 1.8.3.1
> 
>
David Gibson Feb. 18, 2016, 12:08 a.m. UTC | #2
On Wed, Feb 17, 2016 at 07:23:19PM +0100, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Applied to ppc-for-2.6, thanks.

> ---
>  hw/ppc/spapr_rtas.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 07ad672..b7c5ebd 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -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);
>  }
>
diff mbox

Patch

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 07ad672..b7c5ebd 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -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);
 }