Loading arch/powerpc/include/asm/exception-64s.h +2 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ .globl label##_pSeries; \ label##_pSeries: \ HMT_MEDIUM; \ DO_KVM n; \ mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) Loading @@ -170,6 +171,7 @@ label##_pSeries: \ .globl label##_pSeries; \ label##_pSeries: \ HMT_MEDIUM; \ DO_KVM n; \ mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ Loading arch/powerpc/include/asm/kvm.h +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ struct kvm_regs { }; struct kvm_sregs { __u32 pvr; char pad[1020]; }; struct kvm_fpu { Loading arch/powerpc/include/asm/kvm_asm.h +39 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,45 @@ #define BOOKE_INTERRUPT_SPE_FP_ROUND 34 #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 /* book3s */ #define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100 #define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200 #define BOOK3S_INTERRUPT_DATA_STORAGE 0x300 #define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380 #define BOOK3S_INTERRUPT_INST_STORAGE 0x400 #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480 #define BOOK3S_INTERRUPT_EXTERNAL 0x500 #define BOOK3S_INTERRUPT_ALIGNMENT 0x600 #define BOOK3S_INTERRUPT_PROGRAM 0x700 #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800 #define BOOK3S_INTERRUPT_DECREMENTER 0x900 #define BOOK3S_INTERRUPT_SYSCALL 0xc00 #define BOOK3S_INTERRUPT_TRACE 0xd00 #define BOOK3S_INTERRUPT_PERFMON 0xf00 #define BOOK3S_INTERRUPT_ALTIVEC 0xf20 #define BOOK3S_INTERRUPT_VSX 0xf40 #define BOOK3S_IRQPRIO_SYSTEM_RESET 0 #define BOOK3S_IRQPRIO_DATA_SEGMENT 1 #define BOOK3S_IRQPRIO_INST_SEGMENT 2 #define BOOK3S_IRQPRIO_DATA_STORAGE 3 #define BOOK3S_IRQPRIO_INST_STORAGE 4 #define BOOK3S_IRQPRIO_ALIGNMENT 5 #define BOOK3S_IRQPRIO_PROGRAM 6 #define BOOK3S_IRQPRIO_FP_UNAVAIL 7 #define BOOK3S_IRQPRIO_ALTIVEC 8 #define BOOK3S_IRQPRIO_VSX 9 #define BOOK3S_IRQPRIO_SYSCALL 10 #define BOOK3S_IRQPRIO_MACHINE_CHECK 11 #define BOOK3S_IRQPRIO_DEBUG 12 #define BOOK3S_IRQPRIO_EXTERNAL 13 #define BOOK3S_IRQPRIO_DECREMENTER 14 #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15 #define BOOK3S_IRQPRIO_MAX 16 #define BOOK3S_HFLAG_DCBZ32 0x1 #define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ #define RESUME_FLAG_HOST (1<<1) /* Resume host? */ Loading arch/powerpc/include/asm/kvm_book3s.h 0 → 100644 +136 −0 Original line number Diff line number Diff line /* * 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 2009 * * Authors: Alexander Graf <agraf@suse.de> */ #ifndef __ASM_KVM_BOOK3S_H__ #define __ASM_KVM_BOOK3S_H__ #include <linux/types.h> #include <linux/kvm_host.h> #include <asm/kvm_ppc.h> struct kvmppc_slb { u64 esid; u64 vsid; u64 orige; u64 origv; bool valid; bool Ks; bool Kp; bool nx; bool large; bool class; }; struct kvmppc_sr { u32 raw; u32 vsid; bool Ks; bool Kp; bool nx; }; struct kvmppc_bat { u32 bepi; u32 bepi_mask; bool vs; bool vp; u32 brpn; u8 wimg; u8 pp; }; struct kvmppc_sid_map { u64 guest_vsid; u64 guest_esid; u64 host_vsid; bool valid; }; #define SID_MAP_BITS 9 #define SID_MAP_NUM (1 << SID_MAP_BITS) #define SID_MAP_MASK (SID_MAP_NUM - 1) struct kvmppc_vcpu_book3s { struct kvm_vcpu vcpu; struct kvmppc_sid_map sid_map[SID_MAP_NUM]; struct kvmppc_slb slb[64]; struct { u64 esid; u64 vsid; } slb_shadow[64]; u8 slb_shadow_max; struct kvmppc_sr sr[16]; struct kvmppc_bat ibat[8]; struct kvmppc_bat dbat[8]; u64 hid[6]; int slb_nr; u64 sdr1; u64 dsisr; u64 hior; u64 msr_mask; u64 vsid_first; u64 vsid_next; u64 vsid_max; int context_id; }; #define CONTEXT_HOST 0 #define CONTEXT_GUEST 1 #define CONTEXT_GUEST_END 2 #define VSID_REAL 0xfffffffffff00000 #define VSID_REAL_DR 0xffffffffffe00000 #define VSID_REAL_IR 0xffffffffffd00000 #define VSID_BAT 0xffffffffffc00000 #define VSID_PR 0x8000000000000000 extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 ea, u64 ea_mask); extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end); extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data); extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr, bool data); extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr); extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); extern u32 kvmppc_trampoline_lowmem; extern u32 kvmppc_trampoline_enter; static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu) { return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu); } static inline ulong dsisr(void) { ulong r; asm ( "mfdsisr %0 " : "=r" (r) ); return r; } extern void kvm_return_point(void); #define INS_DCBZ 0x7c0007ec #endif /* __ASM_KVM_BOOK3S_H__ */ arch/powerpc/include/asm/kvm_book3s_64_asm.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * 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 2009 * * Authors: Alexander Graf <agraf@suse.de> */ #ifndef __ASM_KVM_BOOK3S_ASM_H__ #define __ASM_KVM_BOOK3S_ASM_H__ #ifdef CONFIG_KVM_BOOK3S_64_HANDLER #include <asm/kvm_asm.h> .macro DO_KVM intno .if (\intno == BOOK3S_INTERRUPT_SYSTEM_RESET) || \ (\intno == BOOK3S_INTERRUPT_MACHINE_CHECK) || \ (\intno == BOOK3S_INTERRUPT_DATA_STORAGE) || \ (\intno == BOOK3S_INTERRUPT_INST_STORAGE) || \ (\intno == BOOK3S_INTERRUPT_DATA_SEGMENT) || \ (\intno == BOOK3S_INTERRUPT_INST_SEGMENT) || \ (\intno == BOOK3S_INTERRUPT_EXTERNAL) || \ (\intno == BOOK3S_INTERRUPT_ALIGNMENT) || \ (\intno == BOOK3S_INTERRUPT_PROGRAM) || \ (\intno == BOOK3S_INTERRUPT_FP_UNAVAIL) || \ (\intno == BOOK3S_INTERRUPT_DECREMENTER) || \ (\intno == BOOK3S_INTERRUPT_SYSCALL) || \ (\intno == BOOK3S_INTERRUPT_TRACE) || \ (\intno == BOOK3S_INTERRUPT_PERFMON) || \ (\intno == BOOK3S_INTERRUPT_ALTIVEC) || \ (\intno == BOOK3S_INTERRUPT_VSX) b kvmppc_trampoline_\intno kvmppc_resume_\intno: .endif .endm #else .macro DO_KVM intno .endm #endif /* CONFIG_KVM_BOOK3S_64_HANDLER */ #endif /* __ASM_KVM_BOOK3S_ASM_H__ */ Loading
arch/powerpc/include/asm/exception-64s.h +2 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ .globl label##_pSeries; \ label##_pSeries: \ HMT_MEDIUM; \ DO_KVM n; \ mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) Loading @@ -170,6 +171,7 @@ label##_pSeries: \ .globl label##_pSeries; \ label##_pSeries: \ HMT_MEDIUM; \ DO_KVM n; \ mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ Loading
arch/powerpc/include/asm/kvm.h +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ struct kvm_regs { }; struct kvm_sregs { __u32 pvr; char pad[1020]; }; struct kvm_fpu { Loading
arch/powerpc/include/asm/kvm_asm.h +39 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,45 @@ #define BOOKE_INTERRUPT_SPE_FP_ROUND 34 #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 /* book3s */ #define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100 #define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200 #define BOOK3S_INTERRUPT_DATA_STORAGE 0x300 #define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380 #define BOOK3S_INTERRUPT_INST_STORAGE 0x400 #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480 #define BOOK3S_INTERRUPT_EXTERNAL 0x500 #define BOOK3S_INTERRUPT_ALIGNMENT 0x600 #define BOOK3S_INTERRUPT_PROGRAM 0x700 #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800 #define BOOK3S_INTERRUPT_DECREMENTER 0x900 #define BOOK3S_INTERRUPT_SYSCALL 0xc00 #define BOOK3S_INTERRUPT_TRACE 0xd00 #define BOOK3S_INTERRUPT_PERFMON 0xf00 #define BOOK3S_INTERRUPT_ALTIVEC 0xf20 #define BOOK3S_INTERRUPT_VSX 0xf40 #define BOOK3S_IRQPRIO_SYSTEM_RESET 0 #define BOOK3S_IRQPRIO_DATA_SEGMENT 1 #define BOOK3S_IRQPRIO_INST_SEGMENT 2 #define BOOK3S_IRQPRIO_DATA_STORAGE 3 #define BOOK3S_IRQPRIO_INST_STORAGE 4 #define BOOK3S_IRQPRIO_ALIGNMENT 5 #define BOOK3S_IRQPRIO_PROGRAM 6 #define BOOK3S_IRQPRIO_FP_UNAVAIL 7 #define BOOK3S_IRQPRIO_ALTIVEC 8 #define BOOK3S_IRQPRIO_VSX 9 #define BOOK3S_IRQPRIO_SYSCALL 10 #define BOOK3S_IRQPRIO_MACHINE_CHECK 11 #define BOOK3S_IRQPRIO_DEBUG 12 #define BOOK3S_IRQPRIO_EXTERNAL 13 #define BOOK3S_IRQPRIO_DECREMENTER 14 #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15 #define BOOK3S_IRQPRIO_MAX 16 #define BOOK3S_HFLAG_DCBZ32 0x1 #define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ #define RESUME_FLAG_HOST (1<<1) /* Resume host? */ Loading
arch/powerpc/include/asm/kvm_book3s.h 0 → 100644 +136 −0 Original line number Diff line number Diff line /* * 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 2009 * * Authors: Alexander Graf <agraf@suse.de> */ #ifndef __ASM_KVM_BOOK3S_H__ #define __ASM_KVM_BOOK3S_H__ #include <linux/types.h> #include <linux/kvm_host.h> #include <asm/kvm_ppc.h> struct kvmppc_slb { u64 esid; u64 vsid; u64 orige; u64 origv; bool valid; bool Ks; bool Kp; bool nx; bool large; bool class; }; struct kvmppc_sr { u32 raw; u32 vsid; bool Ks; bool Kp; bool nx; }; struct kvmppc_bat { u32 bepi; u32 bepi_mask; bool vs; bool vp; u32 brpn; u8 wimg; u8 pp; }; struct kvmppc_sid_map { u64 guest_vsid; u64 guest_esid; u64 host_vsid; bool valid; }; #define SID_MAP_BITS 9 #define SID_MAP_NUM (1 << SID_MAP_BITS) #define SID_MAP_MASK (SID_MAP_NUM - 1) struct kvmppc_vcpu_book3s { struct kvm_vcpu vcpu; struct kvmppc_sid_map sid_map[SID_MAP_NUM]; struct kvmppc_slb slb[64]; struct { u64 esid; u64 vsid; } slb_shadow[64]; u8 slb_shadow_max; struct kvmppc_sr sr[16]; struct kvmppc_bat ibat[8]; struct kvmppc_bat dbat[8]; u64 hid[6]; int slb_nr; u64 sdr1; u64 dsisr; u64 hior; u64 msr_mask; u64 vsid_first; u64 vsid_next; u64 vsid_max; int context_id; }; #define CONTEXT_HOST 0 #define CONTEXT_GUEST 1 #define CONTEXT_GUEST_END 2 #define VSID_REAL 0xfffffffffff00000 #define VSID_REAL_DR 0xffffffffffe00000 #define VSID_REAL_IR 0xffffffffffd00000 #define VSID_BAT 0xffffffffffc00000 #define VSID_PR 0x8000000000000000 extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 ea, u64 ea_mask); extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end); extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data); extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr, bool data); extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr); extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); extern u32 kvmppc_trampoline_lowmem; extern u32 kvmppc_trampoline_enter; static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu) { return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu); } static inline ulong dsisr(void) { ulong r; asm ( "mfdsisr %0 " : "=r" (r) ); return r; } extern void kvm_return_point(void); #define INS_DCBZ 0x7c0007ec #endif /* __ASM_KVM_BOOK3S_H__ */
arch/powerpc/include/asm/kvm_book3s_64_asm.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * 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 2009 * * Authors: Alexander Graf <agraf@suse.de> */ #ifndef __ASM_KVM_BOOK3S_ASM_H__ #define __ASM_KVM_BOOK3S_ASM_H__ #ifdef CONFIG_KVM_BOOK3S_64_HANDLER #include <asm/kvm_asm.h> .macro DO_KVM intno .if (\intno == BOOK3S_INTERRUPT_SYSTEM_RESET) || \ (\intno == BOOK3S_INTERRUPT_MACHINE_CHECK) || \ (\intno == BOOK3S_INTERRUPT_DATA_STORAGE) || \ (\intno == BOOK3S_INTERRUPT_INST_STORAGE) || \ (\intno == BOOK3S_INTERRUPT_DATA_SEGMENT) || \ (\intno == BOOK3S_INTERRUPT_INST_SEGMENT) || \ (\intno == BOOK3S_INTERRUPT_EXTERNAL) || \ (\intno == BOOK3S_INTERRUPT_ALIGNMENT) || \ (\intno == BOOK3S_INTERRUPT_PROGRAM) || \ (\intno == BOOK3S_INTERRUPT_FP_UNAVAIL) || \ (\intno == BOOK3S_INTERRUPT_DECREMENTER) || \ (\intno == BOOK3S_INTERRUPT_SYSCALL) || \ (\intno == BOOK3S_INTERRUPT_TRACE) || \ (\intno == BOOK3S_INTERRUPT_PERFMON) || \ (\intno == BOOK3S_INTERRUPT_ALTIVEC) || \ (\intno == BOOK3S_INTERRUPT_VSX) b kvmppc_trampoline_\intno kvmppc_resume_\intno: .endif .endm #else .macro DO_KVM intno .endm #endif /* CONFIG_KVM_BOOK3S_64_HANDLER */ #endif /* __ASM_KVM_BOOK3S_ASM_H__ */