diff options
author | Scott Wood <scottwood@freescale.com> | 2014-03-10 18:29:38 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-03-19 20:57:14 -0400 |
commit | 9d378dfac885f72b8b369d08fc61bef36e2f2dd1 (patch) | |
tree | 8790aa68cd0944e031b35eb63f5be14ec678be2d /arch/powerpc/include/asm/reg.h | |
parent | 82d86de25b9c99db546e17c6f7ebf9a691da557e (diff) |
powerpc/booke64: Use SPRG7 for VDSO
Previously SPRG3 was marked for use by both VDSO and critical
interrupts (though critical interrupts were not fully implemented).
In commit 8b64a9dfb091f1eca8b7e58da82f1e7d1d5fe0ad ("powerpc/booke64:
Use SPRG0/3 scratch for bolted TLB miss & crit int"), Mihai Caraman
made an attempt to resolve this conflict by restoring the VDSO value
early in the critical interrupt, but this has some issues:
- It's incompatible with EXCEPTION_COMMON which restores r13 from the
by-then-overwritten scratch (this cost me some debugging time).
- It forces critical exceptions to be a special case handled
differently from even machine check and debug level exceptions.
- It didn't occur to me that it was possible to make this work at all
(by doing a final "ld r13, PACA_EXCRIT+EX_R13(r13)") until after
I made (most of) this patch. :-)
It might be worth investigating using a load rather than SPRG on return
from all exceptions (except TLB misses where the scratch never leaves
the SPRG) -- it could save a few cycles. Until then, let's stick with
SPRG for all exceptions.
Since we cannot use SPRG4-7 for scratch without corrupting the state of
a KVM guest, move VDSO to SPRG7 on book3e. Since neither SPRG4-7 nor
critical interrupts exist on book3s, SPRG3 is still used for VDSO
there.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: kvm-ppc@vger.kernel.org
Diffstat (limited to 'arch/powerpc/include/asm/reg.h')
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index bf0fb4db0855..f7251c2dc049 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -577,9 +577,13 @@ | |||
577 | #define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */ | 577 | #define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */ |
578 | #define SPRN_USPRG3 0x103 /* SPRG3 userspace read */ | 578 | #define SPRN_USPRG3 0x103 /* SPRG3 userspace read */ |
579 | #define SPRN_SPRG4 0x114 /* Special Purpose Register General 4 */ | 579 | #define SPRN_SPRG4 0x114 /* Special Purpose Register General 4 */ |
580 | #define SPRN_USPRG4 0x104 /* SPRG4 userspace read */ | ||
580 | #define SPRN_SPRG5 0x115 /* Special Purpose Register General 5 */ | 581 | #define SPRN_SPRG5 0x115 /* Special Purpose Register General 5 */ |
582 | #define SPRN_USPRG5 0x105 /* SPRG5 userspace read */ | ||
581 | #define SPRN_SPRG6 0x116 /* Special Purpose Register General 6 */ | 583 | #define SPRN_SPRG6 0x116 /* Special Purpose Register General 6 */ |
584 | #define SPRN_USPRG6 0x106 /* SPRG6 userspace read */ | ||
582 | #define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */ | 585 | #define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */ |
586 | #define SPRN_USPRG7 0x107 /* SPRG7 userspace read */ | ||
583 | #define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ | 587 | #define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ |
584 | #define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ | 588 | #define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ |
585 | #define SRR1_ISI_NOPT 0x40000000 /* ISI: Not found in hash */ | 589 | #define SRR1_ISI_NOPT 0x40000000 /* ISI: Not found in hash */ |
@@ -879,11 +883,10 @@ | |||
879 | * 64-bit embedded | 883 | * 64-bit embedded |
880 | * - SPRG0 generic exception scratch | 884 | * - SPRG0 generic exception scratch |
881 | * - SPRG2 TLB exception stack | 885 | * - SPRG2 TLB exception stack |
882 | * - SPRG3 critical exception scratch and | 886 | * - SPRG3 critical exception scratch (user visible, sorry!) |
883 | * CPU and NUMA node for VDSO getcpu (user visible) | ||
884 | * - SPRG4 unused (user visible) | 887 | * - SPRG4 unused (user visible) |
885 | * - SPRG6 TLB miss scratch (user visible, sorry !) | 888 | * - SPRG6 TLB miss scratch (user visible, sorry !) |
886 | * - SPRG7 critical exception scratch | 889 | * - SPRG7 CPU and NUMA node for VDSO getcpu (user visible) |
887 | * - SPRG8 machine check exception scratch | 890 | * - SPRG8 machine check exception scratch |
888 | * - SPRG9 debug exception scratch | 891 | * - SPRG9 debug exception scratch |
889 | * | 892 | * |
@@ -940,6 +943,8 @@ | |||
940 | #define SPRN_SPRG_SCRATCH0 SPRN_SPRG2 | 943 | #define SPRN_SPRG_SCRATCH0 SPRN_SPRG2 |
941 | #define SPRN_SPRG_HPACA SPRN_HSPRG0 | 944 | #define SPRN_SPRG_HPACA SPRN_HSPRG0 |
942 | #define SPRN_SPRG_HSCRATCH0 SPRN_HSPRG1 | 945 | #define SPRN_SPRG_HSCRATCH0 SPRN_HSPRG1 |
946 | #define SPRN_SPRG_VDSO_READ SPRN_USPRG3 | ||
947 | #define SPRN_SPRG_VDSO_WRITE SPRN_SPRG3 | ||
943 | 948 | ||
944 | #define GET_PACA(rX) \ | 949 | #define GET_PACA(rX) \ |
945 | BEGIN_FTR_SECTION_NESTED(66); \ | 950 | BEGIN_FTR_SECTION_NESTED(66); \ |
@@ -983,6 +988,8 @@ | |||
983 | #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 | 988 | #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 |
984 | #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 | 989 | #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 |
985 | #define SPRN_SPRG_GDBELL_SCRATCH SPRN_SPRG_GEN_SCRATCH | 990 | #define SPRN_SPRG_GDBELL_SCRATCH SPRN_SPRG_GEN_SCRATCH |
991 | #define SPRN_SPRG_VDSO_READ SPRN_USPRG7 | ||
992 | #define SPRN_SPRG_VDSO_WRITE SPRN_SPRG7 | ||
986 | 993 | ||
987 | #define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX | 994 | #define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX |
988 | #define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA | 995 | #define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA |