linux/arch/powerpc/kvm
Paul Mackerras 56548fc0e8 powerpc/powernv: Return to cpu offline loop when finished in KVM guest
When a secondary hardware thread has finished running a KVM guest, we
currently put that thread into nap mode using a nap instruction in
the KVM code.  This changes the code so that instead of doing a nap
instruction directly, we instead cause the call to power7_nap() that
put the thread into nap mode to return.  The reason for doing this is
to avoid having the KVM code having to know what low-power mode to
put the thread into.

In the case of a secondary thread used to run a KVM guest, the thread
will be offline from the point of view of the host kernel, and the
relevant power7_nap() call is the one in pnv_smp_cpu_disable().
In this case we don't want to clear pending IPIs in the offline loop
in that function, since that might cause us to miss the wakeup for
the next time the thread needs to run a guest.  To tell whether or
not to clear the interrupt, we use the SRR1 value returned from
power7_nap(), and check if it indicates an external interrupt.  We
arrange that the return from power7_nap() when we have finished running
a guest returns 0, so pending interrupts don't get flushed in that
case.

Note that it is important a secondary thread that has finished
executing in the guest, or that didn't have a guest to run, should
not return to power7_nap's caller while the kvm_hstate.hwthread_req
flag in the PACA is non-zero, because the return from power7_nap
will reenable the MMU, and the MMU might still be in guest context.
In this situation we spin at low priority in real mode waiting for
hwthread_req to become zero.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2014-12-08 13:16:31 +11:00
..
book3s_32_mmu_host.c KVM: PPC: Book3S: Make magic page properly 4k mappable 2014-07-28 15:23:11 +02:00
book3s_32_mmu.c KVM: PPC: Book3S: Stop PTE lookup on write errors 2014-07-28 15:23:10 +02:00
book3s_32_sr.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
book3s_64_mmu_host.c KVM: PPC: Book3S: Make magic page properly 4k mappable 2014-07-28 15:23:11 +02:00
book3s_64_mmu_hv.c Fixes and features for 3.18. 2014-10-08 05:27:39 -04:00
book3s_64_mmu.c KVM: PPC: Disable NX for old magic page using guests 2014-05-30 14:26:24 +02:00
book3s_64_slb.S KVM: PPC: Book3S PR: Rework SLB switching code 2014-05-30 14:26:30 +02:00
book3s_64_vio_hv.c KVM: PPC: Book3S: Introduce hypervisor call H_GET_TCE 2014-03-26 23:34:27 +11:00
book3s_64_vio.c ppc: kvm: use anon_inode_getfd() with O_CLOEXEC flag 2013-08-26 13:19:56 +03:00
book3s_emulate.c KVM: PPC: PR: Handle FSCR feature deselects 2014-07-31 10:23:46 +02:00
book3s_exports.c KVM: PPC: Make shared struct aka magic page guest endian 2014-05-30 14:26:21 +02:00
book3s_hv_builtin.c powerpc: Remove superfluous bootmem includes 2014-11-10 09:59:26 +11:00
book3s_hv_interrupts.S powerpc/kvm: Remove redundant save of SIER AND MMCR2 2014-07-11 12:55:07 +10:00
book3s_hv_ras.c KVM: PPC: Book3S HV: Access guest VPA in BE 2014-07-28 15:22:22 +02:00
book3s_hv_rm_mmu.c Patch queue for ppc - 2014-08-01 2014-08-05 09:58:11 +02:00
book3s_hv_rm_xics.c KVM: PPC: Enable IRQFD support for the XICS interrupt controller 2014-08-05 14:26:33 +02:00
book3s_hv_rmhandlers.S powerpc/powernv: Return to cpu offline loop when finished in KVM guest 2014-12-08 13:16:31 +11:00
book3s_hv.c powerpc/kvm: support to handle sw breakpoint 2014-09-22 10:11:35 +02:00
book3s_interrupts.S KVM: PPC: Book3S PR: Fix ABIv2 on LE 2014-07-28 15:22:15 +02:00
book3s_mmu_hpte.c kvm: powerpc: book3s: pr: move PR related tracepoints to a separate header 2013-10-17 15:36:22 +02:00
book3s_paired_singles.c KVM: PPC: Allow kvmppc_get_last_inst() to fail 2014-07-28 15:23:14 +02:00
book3s_pr_papr.c KVM: PPC: Book3S PR: Take SRCU read lock around RTAS kvm_read_guest() call 2014-07-28 15:23:16 +02:00
book3s_pr.c Patch queue for ppc - 2014-09-24 2014-09-24 23:19:45 +02:00
book3s_rmhandlers.S KVM: PPC: Book3S PR: Fix ABIv2 on LE 2014-07-28 15:22:15 +02:00
book3s_rtas.c KVM: PPC: RTAS: Do byte swaps explicitly 2014-07-07 23:17:20 +02:00
book3s_segment.S KVM: PPC: Book3S PR: Handle Facility interrupt and FSCR 2014-05-30 14:26:22 +02:00
book3s_xics.c KVM: PPC: Enable IRQFD support for the XICS interrupt controller 2014-08-05 14:26:33 +02:00
book3s_xics.h KVM: PPC: Enable IRQFD support for the XICS interrupt controller 2014-08-05 14:26:33 +02:00
book3s.c Patch queue for ppc - 2014-09-24 2014-09-24 23:19:45 +02:00
book3s.h kvm: Fix page ageing bugs 2014-09-24 14:07:58 +02:00
booke_emulate.c KVM: PPC: BOOKE: Emulate debug registers and exception 2014-09-22 10:11:33 +02:00
booke_interrupts.S KVM: PPC: Remove 440 support 2014-07-28 15:23:15 +02:00
booke.c KVM: PPC: Pass enum to kvmppc_get_last_inst 2014-09-22 10:11:36 +02:00
booke.h KVM: PPC: Book3e: Add AltiVec support 2014-09-22 10:11:32 +02:00
bookehv_interrupts.S powerpc/kvm: common sw breakpoint instr across ppc 2014-09-22 10:11:36 +02:00
e500_emulate.c KVM: PPC: Book3e: Add AltiVec support 2014-09-22 10:11:32 +02:00
e500_mmu_host.c Patch queue for ppc - 2014-09-24 2014-09-24 23:19:45 +02:00
e500_mmu_host.h KVM: PPC: E500: Make clear_tlb_refs and clear_tlb1_bitmap static 2013-01-24 19:23:33 +01:00
e500_mmu.c KVM: PPC: e500: Fix bad address type in deliver_tlb_misss() 2014-01-27 16:00:54 +01:00
e500.c powerpc: Replace __get_cpu_var uses 2014-11-03 12:12:32 +11:00
e500.h KVM: PPC: e500mc: Add support for single threaded vcpus on e6500 core 2014-09-22 10:11:35 +02:00
e500mc.c powerpc: Replace __get_cpu_var uses 2014-11-03 12:12:32 +11:00
emulate_loadstore.c KVM: PPC: Pass enum to kvmppc_get_last_inst 2014-09-22 10:11:36 +02:00
emulate.c KVM: PPC: Pass enum to kvmppc_get_last_inst 2014-09-22 10:11:36 +02:00
fpu.S powerpc: Remove fpscr use from [kvm_]cvt_{fd,df} 2010-09-02 14:07:32 +10:00
irq.h KVM: PPC: Book3S: Add API for in-kernel XICS emulation 2013-05-02 15:28:36 +02:00
Kconfig KVM: PPC: Enable IRQFD support for the XICS interrupt controller 2014-08-05 14:26:33 +02:00
Makefile Here are the PPC and ARM changes for KVM, which I separated because 2014-08-07 11:35:30 -07:00
mpic.c KVM: irqchip: Provide and use accessors for irq routing table 2014-08-05 14:26:16 +02:00
powerpc.c KVM: PPC: Pass enum to kvmppc_get_last_inst 2014-09-22 10:11:36 +02:00
timing.c KVM: PPC: Remove DCR handling 2014-07-28 19:29:15 +02:00
timing.h KVM: PPC: Remove DCR handling 2014-07-28 19:29:15 +02:00
trace_booke.h kvm: powerpc: booke: Move booke related tracepoints to separate header 2013-10-17 15:37:16 +02:00
trace_pr.h KVM: PPC: drop duplicate tracepoint 2014-08-05 14:23:41 +02:00
trace.h kvm: powerpc: booke: Move booke related tracepoints to separate header 2013-10-17 15:37:16 +02:00