2010-04-16 06:11:35 +08:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License, version 2, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Copyright SUSE Linux Products GmbH 2010
|
|
|
|
*
|
|
|
|
* Authors: Alexander Graf <agraf@suse.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Real mode helpers */
|
|
|
|
|
|
|
|
#if defined(CONFIG_PPC_BOOK3S_64)
|
|
|
|
|
|
|
|
#define GET_SHADOW_VCPU(reg) \
|
2011-06-29 08:20:58 +08:00
|
|
|
mr reg, r13
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
#elif defined(CONFIG_PPC_BOOK3S_32)
|
|
|
|
|
|
|
|
#define GET_SHADOW_VCPU(reg) \
|
|
|
|
tophys(reg, r2); \
|
|
|
|
lwz reg, (THREAD + THREAD_KVM_SVCPU)(reg); \
|
|
|
|
tophys(reg, reg)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Disable for nested KVM */
|
|
|
|
#define USE_QUICK_LAST_INST
|
|
|
|
|
|
|
|
|
|
|
|
/* Get helper functions for subarch specific functionality */
|
|
|
|
|
|
|
|
#if defined(CONFIG_PPC_BOOK3S_64)
|
|
|
|
#include "book3s_64_slb.S"
|
|
|
|
#elif defined(CONFIG_PPC_BOOK3S_32)
|
|
|
|
#include "book3s_32_sr.S"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* *
|
|
|
|
* Entry code *
|
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
.global kvmppc_handler_trampoline_enter
|
|
|
|
kvmppc_handler_trampoline_enter:
|
|
|
|
|
|
|
|
/* Required state:
|
|
|
|
*
|
|
|
|
* MSR = ~IR|DR
|
|
|
|
* R1 = host R1
|
|
|
|
* R2 = host R2
|
2011-07-23 15:41:44 +08:00
|
|
|
* R4 = guest shadow MSR
|
|
|
|
* R5 = normal host MSR
|
|
|
|
* R6 = current host MSR (EE, IR, DR off)
|
|
|
|
* LR = highmem guest exit code
|
2010-04-16 06:11:35 +08:00
|
|
|
* all other volatile GPRS = free
|
|
|
|
* SVCPU[CR] = guest CR
|
|
|
|
* SVCPU[XER] = guest XER
|
|
|
|
* SVCPU[CTR] = guest CTR
|
|
|
|
* SVCPU[LR] = guest LR
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* r3 = shadow vcpu */
|
|
|
|
GET_SHADOW_VCPU(r3)
|
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
/* Save guest exit handler address and MSR */
|
|
|
|
mflr r0
|
|
|
|
PPC_STL r0, HSTATE_VMHANDLER(r3)
|
|
|
|
PPC_STL r5, HSTATE_HOST_MSR(r3)
|
|
|
|
|
2011-06-29 08:20:58 +08:00
|
|
|
/* Save R1/R2 in the PACA (64-bit) or shadow_vcpu (32-bit) */
|
|
|
|
PPC_STL r1, HSTATE_HOST_R1(r3)
|
|
|
|
PPC_STL r2, HSTATE_HOST_R2(r3)
|
|
|
|
|
2010-04-16 06:11:35 +08:00
|
|
|
/* Activate guest mode, so faults get handled by KVM */
|
|
|
|
li r11, KVM_GUEST_MODE_GUEST
|
2011-06-29 08:20:58 +08:00
|
|
|
stb r11, HSTATE_IN_GUEST(r3)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* Switch to guest segment. This is subarch specific. */
|
|
|
|
LOAD_GUEST_SEGMENTS
|
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
#ifdef CONFIG_PPC_BOOK3S_64
|
|
|
|
/* Some guests may need to have dcbz set to 32 byte length.
|
|
|
|
*
|
|
|
|
* Usually we ensure that by patching the guest's instructions
|
|
|
|
* to trap on dcbz and emulate it in the hypervisor.
|
|
|
|
*
|
|
|
|
* If we can, we should tell the CPU to use 32 byte dcbz though,
|
|
|
|
* because that's a lot faster.
|
|
|
|
*/
|
|
|
|
lbz r0, HSTATE_RESTORE_HID5(r3)
|
|
|
|
cmpwi r0, 0
|
|
|
|
beq no_dcbz32_on
|
|
|
|
|
|
|
|
mfspr r0,SPRN_HID5
|
|
|
|
ori r0, r0, 0x80 /* XXX HID5_dcbz32 = 0x80 */
|
|
|
|
mtspr SPRN_HID5,r0
|
|
|
|
no_dcbz32_on:
|
|
|
|
|
|
|
|
#endif /* CONFIG_PPC_BOOK3S_64 */
|
|
|
|
|
2010-04-16 06:11:35 +08:00
|
|
|
/* Enter guest */
|
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
PPC_LL r8, SVCPU_CTR(r3)
|
|
|
|
PPC_LL r9, SVCPU_LR(r3)
|
|
|
|
lwz r10, SVCPU_CR(r3)
|
|
|
|
lwz r11, SVCPU_XER(r3)
|
|
|
|
|
|
|
|
mtctr r8
|
|
|
|
mtlr r9
|
|
|
|
mtcr r10
|
|
|
|
mtxer r11
|
2010-04-16 06:11:35 +08:00
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
/* Move SRR0 and SRR1 into the respective regs */
|
|
|
|
PPC_LL r9, SVCPU_PC(r3)
|
|
|
|
/* First clear RI in our current MSR value */
|
|
|
|
li r0, MSR_RI
|
|
|
|
andc r6, r6, r0
|
2010-04-16 06:11:35 +08:00
|
|
|
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
PPC_LL r0, SVCPU_R0(r3)
|
|
|
|
PPC_LL r1, SVCPU_R1(r3)
|
|
|
|
PPC_LL r2, SVCPU_R2(r3)
|
|
|
|
PPC_LL r5, SVCPU_R5(r3)
|
|
|
|
PPC_LL r7, SVCPU_R7(r3)
|
|
|
|
PPC_LL r8, SVCPU_R8(r3)
|
|
|
|
PPC_LL r10, SVCPU_R10(r3)
|
|
|
|
PPC_LL r11, SVCPU_R11(r3)
|
|
|
|
PPC_LL r12, SVCPU_R12(r3)
|
|
|
|
PPC_LL r13, SVCPU_R13(r3)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
2012-04-25 20:28:23 +08:00
|
|
|
MTMSR_EERI(r6)
|
|
|
|
mtsrr0 r9
|
|
|
|
mtsrr1 r4
|
|
|
|
|
|
|
|
PPC_LL r4, SVCPU_R4(r3)
|
|
|
|
PPC_LL r6, SVCPU_R6(r3)
|
|
|
|
PPC_LL r9, SVCPU_R9(r3)
|
2010-04-16 06:11:35 +08:00
|
|
|
PPC_LL r3, (SVCPU_R3)(r3)
|
|
|
|
|
|
|
|
RFI
|
|
|
|
kvmppc_handler_trampoline_enter_end:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* *
|
|
|
|
* Exit code *
|
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
.global kvmppc_handler_trampoline_exit
|
|
|
|
kvmppc_handler_trampoline_exit:
|
|
|
|
|
2013-10-08 00:47:55 +08:00
|
|
|
.global kvmppc_interrupt_pr
|
|
|
|
kvmppc_interrupt_pr:
|
2011-06-29 08:18:26 +08:00
|
|
|
|
2010-04-16 06:11:35 +08:00
|
|
|
/* Register usage at this point:
|
|
|
|
*
|
|
|
|
* SPRG_SCRATCH0 = guest R13
|
|
|
|
* R12 = exit handler id
|
2011-06-29 08:20:58 +08:00
|
|
|
* R13 = shadow vcpu (32-bit) or PACA (64-bit)
|
|
|
|
* HSTATE.SCRATCH0 = guest R12
|
|
|
|
* HSTATE.SCRATCH1 = guest CR
|
2010-04-16 06:11:35 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Save registers */
|
|
|
|
|
2011-06-29 08:20:58 +08:00
|
|
|
PPC_STL r0, SVCPU_R0(r13)
|
|
|
|
PPC_STL r1, SVCPU_R1(r13)
|
|
|
|
PPC_STL r2, SVCPU_R2(r13)
|
|
|
|
PPC_STL r3, SVCPU_R3(r13)
|
|
|
|
PPC_STL r4, SVCPU_R4(r13)
|
|
|
|
PPC_STL r5, SVCPU_R5(r13)
|
|
|
|
PPC_STL r6, SVCPU_R6(r13)
|
|
|
|
PPC_STL r7, SVCPU_R7(r13)
|
|
|
|
PPC_STL r8, SVCPU_R8(r13)
|
|
|
|
PPC_STL r9, SVCPU_R9(r13)
|
|
|
|
PPC_STL r10, SVCPU_R10(r13)
|
|
|
|
PPC_STL r11, SVCPU_R11(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* Restore R1/R2 so we can handle faults */
|
2011-06-29 08:20:58 +08:00
|
|
|
PPC_LL r1, HSTATE_HOST_R1(r13)
|
|
|
|
PPC_LL r2, HSTATE_HOST_R2(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* Save guest PC and MSR */
|
2011-06-29 08:18:26 +08:00
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
BEGIN_FTR_SECTION
|
2012-05-10 09:58:50 +08:00
|
|
|
andi. r0, r12, 0x2
|
|
|
|
cmpwi cr1, r0, 0
|
2011-04-05 12:20:31 +08:00
|
|
|
beq 1f
|
|
|
|
mfspr r3,SPRN_HSRR0
|
|
|
|
mfspr r4,SPRN_HSRR1
|
|
|
|
andi. r12,r12,0x3ffd
|
|
|
|
b 2f
|
powerpc, KVM: Split HVMODE_206 cpu feature bit into separate HV and architecture bits
This replaces the single CPU_FTR_HVMODE_206 bit with two bits, one to
indicate that we have a usable hypervisor mode, and another to indicate
that the processor conforms to PowerISA version 2.06. We also add
another bit to indicate that the processor conforms to ISA version 2.01
and set that for PPC970 and derivatives.
Some PPC970 chips (specifically those in Apple machines) have a
hypervisor mode in that MSR[HV] is always 1, but the hypervisor mode
is not useful in the sense that there is no way to run any code in
supervisor mode (HV=0 PR=0). On these processors, the LPES0 and LPES1
bits in HID4 are always 0, and we use that as a way of detecting that
hypervisor mode is not useful.
Where we have a feature section in assembly code around code that
only applies on POWER7 in hypervisor mode, we use a construct like
END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
The definition of END_FTR_SECTION_IFSET is such that the code will
be enabled (not overwritten with nops) only if all bits in the
provided mask are set.
Note that the CPU feature check in __tlbie() only needs to check the
ARCH_206 bit, not the HVMODE bit, because __tlbie() can only get called
if we are running bare-metal, i.e. in hypervisor mode.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:26:11 +08:00
|
|
|
END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
|
2011-06-29 08:18:26 +08:00
|
|
|
#endif
|
2011-04-05 12:20:31 +08:00
|
|
|
1: mfsrr0 r3
|
2010-04-16 06:11:35 +08:00
|
|
|
mfsrr1 r4
|
2011-04-05 12:20:31 +08:00
|
|
|
2:
|
2011-06-29 08:20:58 +08:00
|
|
|
PPC_STL r3, SVCPU_PC(r13)
|
|
|
|
PPC_STL r4, SVCPU_SHADOW_SRR1(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* Get scratch'ed off registers */
|
2011-04-05 11:59:58 +08:00
|
|
|
GET_SCRATCH0(r9)
|
2011-06-29 08:20:58 +08:00
|
|
|
PPC_LL r8, HSTATE_SCRATCH0(r13)
|
|
|
|
lwz r7, HSTATE_SCRATCH1(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
2011-06-29 08:20:58 +08:00
|
|
|
PPC_STL r9, SVCPU_R13(r13)
|
|
|
|
PPC_STL r8, SVCPU_R12(r13)
|
|
|
|
stw r7, SVCPU_CR(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* Save more register state */
|
|
|
|
|
|
|
|
mfxer r5
|
|
|
|
mfdar r6
|
|
|
|
mfdsisr r7
|
|
|
|
mfctr r8
|
|
|
|
mflr r9
|
|
|
|
|
2011-06-29 08:20:58 +08:00
|
|
|
stw r5, SVCPU_XER(r13)
|
|
|
|
PPC_STL r6, SVCPU_FAULT_DAR(r13)
|
|
|
|
stw r7, SVCPU_FAULT_DSISR(r13)
|
|
|
|
PPC_STL r8, SVCPU_CTR(r13)
|
|
|
|
PPC_STL r9, SVCPU_LR(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In order for us to easily get the last instruction,
|
|
|
|
* we got the #vmexit at, we exploit the fact that the
|
|
|
|
* virtual layout is still the same here, so we can just
|
|
|
|
* ld from the guest's PC address
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* We only load the last instruction when it's safe */
|
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_DATA_STORAGE
|
|
|
|
beq ld_last_inst
|
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_PROGRAM
|
|
|
|
beq ld_last_inst
|
2011-08-08 22:11:36 +08:00
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_SYSCALL
|
|
|
|
beq ld_last_prev_inst
|
2010-04-20 08:49:49 +08:00
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_ALIGNMENT
|
|
|
|
beq- ld_last_inst
|
2012-05-10 09:54:58 +08:00
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
BEGIN_FTR_SECTION
|
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_H_EMUL_ASSIST
|
|
|
|
beq- ld_last_inst
|
|
|
|
END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
|
|
|
|
#endif
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
b no_ld_last_inst
|
|
|
|
|
2011-08-08 22:11:36 +08:00
|
|
|
ld_last_prev_inst:
|
|
|
|
addi r3, r3, -4
|
|
|
|
|
2010-04-16 06:11:35 +08:00
|
|
|
ld_last_inst:
|
|
|
|
/* Save off the guest instruction we're at */
|
|
|
|
|
|
|
|
/* In case lwz faults */
|
|
|
|
li r0, KVM_INST_FETCH_FAILED
|
|
|
|
|
|
|
|
#ifdef USE_QUICK_LAST_INST
|
|
|
|
|
|
|
|
/* Set guest mode to 'jump over instruction' so if lwz faults
|
|
|
|
* we'll just continue at the next IP. */
|
|
|
|
li r9, KVM_GUEST_MODE_SKIP
|
2011-06-29 08:20:58 +08:00
|
|
|
stb r9, HSTATE_IN_GUEST(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* 1) enable paging for data */
|
|
|
|
mfmsr r9
|
|
|
|
ori r11, r9, MSR_DR /* Enable paging for data */
|
|
|
|
mtmsr r11
|
|
|
|
sync
|
|
|
|
/* 2) fetch the instruction */
|
|
|
|
lwz r0, 0(r3)
|
|
|
|
/* 3) disable paging again */
|
|
|
|
mtmsr r9
|
|
|
|
sync
|
|
|
|
|
|
|
|
#endif
|
2011-06-29 08:20:58 +08:00
|
|
|
stw r0, SVCPU_LAST_INST(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
no_ld_last_inst:
|
|
|
|
|
|
|
|
/* Unset guest mode */
|
|
|
|
li r9, KVM_GUEST_MODE_NONE
|
2011-06-29 08:20:58 +08:00
|
|
|
stb r9, HSTATE_IN_GUEST(r13)
|
2010-04-16 06:11:35 +08:00
|
|
|
|
|
|
|
/* Switch back to host MMU */
|
|
|
|
LOAD_HOST_SEGMENTS
|
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
#ifdef CONFIG_PPC_BOOK3S_64
|
|
|
|
|
|
|
|
lbz r5, HSTATE_RESTORE_HID5(r13)
|
|
|
|
cmpwi r5, 0
|
|
|
|
beq no_dcbz32_off
|
|
|
|
|
|
|
|
li r4, 0
|
|
|
|
mfspr r5,SPRN_HID5
|
|
|
|
rldimi r5,r4,6,56
|
|
|
|
mtspr SPRN_HID5,r5
|
|
|
|
|
|
|
|
no_dcbz32_off:
|
|
|
|
|
|
|
|
#endif /* CONFIG_PPC_BOOK3S_64 */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For some interrupts, we need to call the real Linux
|
|
|
|
* handler, so it can do work for us. This has to happen
|
|
|
|
* as if the interrupt arrived from the kernel though,
|
|
|
|
* so let's fake it here where most state is restored.
|
|
|
|
*
|
|
|
|
* Having set up SRR0/1 with the address where we want
|
|
|
|
* to continue with relocation on (potentially in module
|
|
|
|
* space), we either just go straight there with rfi[d],
|
2012-04-27 22:33:35 +08:00
|
|
|
* or we jump to an interrupt handler if there is an
|
|
|
|
* interrupt to be handled first. In the latter case,
|
|
|
|
* the rfi[d] at the end of the interrupt handler will
|
|
|
|
* get us back to where we want to continue.
|
2011-07-23 15:41:44 +08:00
|
|
|
*/
|
|
|
|
|
2010-04-16 06:11:35 +08:00
|
|
|
/* Register usage at this point:
|
|
|
|
*
|
|
|
|
* R1 = host R1
|
|
|
|
* R2 = host R2
|
2012-04-27 22:33:35 +08:00
|
|
|
* R10 = raw exit handler id
|
2010-04-16 06:11:35 +08:00
|
|
|
* R12 = exit handler id
|
2011-06-29 08:20:58 +08:00
|
|
|
* R13 = shadow vcpu (32-bit) or PACA (64-bit)
|
2010-04-16 06:11:35 +08:00
|
|
|
* SVCPU.* = guest *
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
PPC_LL r6, HSTATE_HOST_MSR(r13)
|
2011-06-29 08:20:58 +08:00
|
|
|
PPC_LL r8, HSTATE_VMHANDLER(r13)
|
2011-07-23 15:41:44 +08:00
|
|
|
|
2012-04-27 22:33:35 +08:00
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
BEGIN_FTR_SECTION
|
2012-05-10 09:58:50 +08:00
|
|
|
beq cr1, 1f
|
2012-04-27 22:33:35 +08:00
|
|
|
mtspr SPRN_HSRR1, r6
|
|
|
|
mtspr SPRN_HSRR0, r8
|
|
|
|
END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
|
|
|
|
#endif
|
|
|
|
1: /* Restore host msr -> SRR1 */
|
2011-07-23 15:41:44 +08:00
|
|
|
mtsrr1 r6
|
|
|
|
/* Load highmem handler address */
|
2010-04-16 06:11:35 +08:00
|
|
|
mtsrr0 r8
|
|
|
|
|
2011-07-23 15:41:44 +08:00
|
|
|
/* RFI into the highmem handler, or jump to interrupt handler */
|
2012-04-27 22:33:35 +08:00
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
|
|
|
|
beqa BOOK3S_INTERRUPT_EXTERNAL
|
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_DECREMENTER
|
|
|
|
beqa BOOK3S_INTERRUPT_DECREMENTER
|
|
|
|
cmpwi r12, BOOK3S_INTERRUPT_PERFMON
|
|
|
|
beqa BOOK3S_INTERRUPT_PERFMON
|
|
|
|
|
2010-04-16 06:11:35 +08:00
|
|
|
RFI
|
|
|
|
kvmppc_handler_trampoline_exit_end:
|