aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/reg.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-01-20 01:50:21 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-19 21:03:22 -0400
commit2dd60d79e0202628a47af9812a84d502cc63628c (patch)
tree03a114dcb4a8c3b75ec689d372abd331aff5a555 /arch/powerpc/include/asm/reg.h
parent24cc67de62eebbda3ce0c46bdd56582c00dccd03 (diff)
powerpc: In HV mode, use HSPRG0 for PACA
When running in Hypervisor mode (arch 2.06 or later), we store the PACA in HSPRG0 instead of SPRG1. The architecture specifies that SPRGs may be lost during a "nap" power management operation (though they aren't currently on POWER7) and this enables use of SPRG1 by KVM guests. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/reg.h')
-rw-r--r--arch/powerpc/include/asm/reg.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 6eb1d77edb4b..13429a0eba09 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -715,12 +715,15 @@
715 * SPRG usage: 715 * SPRG usage:
716 * 716 *
717 * All 64-bit: 717 * All 64-bit:
718 * - SPRG1 stores PACA pointer 718 * - SPRG1 stores PACA pointer except 64-bit server in
719 * HV mode in which case it is HSPRG0
719 * 720 *
720 * 64-bit server: 721 * 64-bit server:
721 * - SPRG0 unused (reserved for HV on Power4) 722 * - SPRG0 unused (reserved for HV on Power4)
722 * - SPRG2 scratch for exception vectors 723 * - SPRG2 scratch for exception vectors
723 * - SPRG3 unused (user visible) 724 * - SPRG3 unused (user visible)
725 * - HSPRG0 stores PACA in HV mode
726 * - HSPRG1 scratch for "HV" exceptions
724 * 727 *
725 * 64-bit embedded 728 * 64-bit embedded
726 * - SPRG0 generic exception scratch 729 * - SPRG0 generic exception scratch
@@ -783,6 +786,22 @@
783 786
784#ifdef CONFIG_PPC_BOOK3S_64 787#ifdef CONFIG_PPC_BOOK3S_64
785#define SPRN_SPRG_SCRATCH0 SPRN_SPRG2 788#define SPRN_SPRG_SCRATCH0 SPRN_SPRG2
789#define SPRN_SPRG_HPACA SPRN_HSPRG0
790#define SPRN_SPRG_HSCRATCH0 SPRN_HSPRG1
791
792#define GET_PACA(rX) \
793 BEGIN_FTR_SECTION_NESTED(66); \
794 mfspr rX,SPRN_SPRG_PACA; \
795 FTR_SECTION_ELSE_NESTED(66); \
796 mfspr rX,SPRN_SPRG_HPACA; \
797 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
798
799#define SET_PACA(rX) \
800 BEGIN_FTR_SECTION_NESTED(66); \
801 mtspr SPRN_SPRG_PACA,rX; \
802 FTR_SECTION_ELSE_NESTED(66); \
803 mtspr SPRN_SPRG_HPACA,rX; \
804 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
786#endif 805#endif
787 806
788#ifdef CONFIG_PPC_BOOK3E_64 807#ifdef CONFIG_PPC_BOOK3E_64
@@ -792,6 +811,10 @@
792#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 811#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2
793#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 812#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6
794#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 813#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0
814
815#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX
816#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA
817
795#endif 818#endif
796 819
797#ifdef CONFIG_PPC_BOOK3S_32 820#ifdef CONFIG_PPC_BOOK3S_32
@@ -842,6 +865,8 @@
842#define SPRN_SPRG_SCRATCH1 SPRN_SPRG1 865#define SPRN_SPRG_SCRATCH1 SPRN_SPRG1
843#endif 866#endif
844 867
868
869
845/* 870/*
846 * An mtfsf instruction with the L bit set. On CPUs that support this a 871 * An mtfsf instruction with the L bit set. On CPUs that support this a
847 * full 64bits of FPSCR is restored and on other CPUs the L bit is ignored. 872 * full 64bits of FPSCR is restored and on other CPUs the L bit is ignored.