On 29.08.2013, at 11:04, Alexey Kardashevskiy wrote: > On 08/28/2013 09:42 PM, David Gibson wrote: >> On Wed, Aug 28, 2013 at 07:32:51PM +1000, Alexey Kardashevskiy wrote: >>> PAPR+ requires two RTAS calls to be supported by the hypervisor in >>> order to allow hotplugging VCPUs from the guest. The "start-cpu" RTAS >>> call was already there but "stop-self" was not. >>> >>> This adds the "stop-self" RTAS call. >>> >>> Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> >>> --- >>> Changes: >>> v2: >>> * exit_request flag change replaced with more correct cpu_exit() call >>> * fixed commit message, "spapr: support CPU hotplug" >>> --- >>> hw/ppc/spapr_rtas.c | 12 ++++++++++++ >>> 1 file changed, 12 insertions(+) >>> >>> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c >>> index 394ce05..b906294 100644 >>> --- a/hw/ppc/spapr_rtas.c >>> +++ b/hw/ppc/spapr_rtas.c >>> @@ -202,6 +202,17 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, >>> sPAPREnvironment *spapr, >>> rtas_st(rets, 0, -3); >>> } >>> >>> +static void rtas_stop_self(PowerPCCPU *cpu, sPAPREnvironment *spapr, >>> + uint32_t token, uint32_t nargs, >>> + target_ulong args, >>> + uint32_t nret, target_ulong rets) >>> +{ >>> + CPUState *cs = CPU(cpu); >>> + >>> + cs->halted = 1; >> >> Uh.. I think you still need the msr = 0, or an interrupt could wake >> the cpu up again. > > > Tried with KVM and TCG - nothing wakes up the stopped CPU :-/ > After a CPU stopped, the guest calls H_CPPR and disables interrupts on the > specific CPU (or "server") on the XICS level. And decrementer interrupt > does not wake up the CPU.
Why not? With TCG it should :). Alex