[POWERPC] Implement SLB shadow buffer
This adds a shadow buffer for the SLBs and regsiters it with PHYP. Only the bolted SLB entries (top 3) are shadowed. The SLB shadow buffer tells the hypervisor what the kernel needs to have in the SLB for the kernel to be able to function. The hypervisor can use this information to speed up partition context switches. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:

committed by
Paul Mackerras

parent
452b5e2121
commit
2f6093c847
@@ -135,11 +135,13 @@ int main(void)
|
||||
DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
|
||||
DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
|
||||
DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
|
||||
DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
|
||||
|
||||
DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
|
||||
DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1));
|
||||
DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int));
|
||||
DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int));
|
||||
DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area));
|
||||
#endif /* CONFIG_PPC64 */
|
||||
|
||||
/* RTAS */
|
||||
|
@@ -323,6 +323,11 @@ _GLOBAL(ret_from_fork)
|
||||
* The code which creates the new task context is in 'copy_thread'
|
||||
* in arch/powerpc/kernel/process.c
|
||||
*/
|
||||
#define SHADOW_SLB_BOLTED_STACK_ESID \
|
||||
(SLBSHADOW_SAVEAREA + 0x10*(SLB_NUM_BOLTED-1))
|
||||
#define SHADOW_SLB_BOLTED_STACK_VSID \
|
||||
(SLBSHADOW_SAVEAREA + 0x10*(SLB_NUM_BOLTED-1) + 8)
|
||||
|
||||
.align 7
|
||||
_GLOBAL(_switch)
|
||||
mflr r0
|
||||
@@ -375,6 +380,14 @@ BEGIN_FTR_SECTION
|
||||
ld r7,KSP_VSID(r4) /* Get new stack's VSID */
|
||||
oris r0,r6,(SLB_ESID_V)@h
|
||||
ori r0,r0,(SLB_NUM_BOLTED-1)@l
|
||||
|
||||
/* Update the last bolted SLB */
|
||||
ld r9,PACA_SLBSHADOWPTR(r13)
|
||||
li r12,0
|
||||
std r12,SHADOW_SLB_BOLTED_STACK_ESID(r9) /* Clear ESID */
|
||||
std r7,SHADOW_SLB_BOLTED_STACK_VSID(r9) /* Save VSID */
|
||||
std r0,SHADOW_SLB_BOLTED_STACK_ESID(r9) /* Save ESID */
|
||||
|
||||
slbie r6
|
||||
slbie r6 /* Workaround POWER5 < DD2.1 issue */
|
||||
slbmte r7,r0
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <asm/lppaca.h>
|
||||
#include <asm/iseries/it_lp_reg_save.h>
|
||||
#include <asm/paca.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
|
||||
/* This symbol is provided by the linker - let it fill in the paca
|
||||
@@ -45,6 +46,17 @@ struct lppaca lppaca[] = {
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* 3 persistent SLBs are registered here. The buffer will be zero
|
||||
* initially, hence will all be invaild until we actually write them.
|
||||
*/
|
||||
struct slb_shadow slb_shadow[] __cacheline_aligned = {
|
||||
[0 ... (NR_CPUS-1)] = {
|
||||
.persistent = SLB_NUM_BOLTED,
|
||||
.buffer_length = sizeof(struct slb_shadow),
|
||||
},
|
||||
};
|
||||
|
||||
/* The Paca is an array with one entry per processor. Each contains an
|
||||
* lppaca, which contains the information shared between the
|
||||
* hypervisor and Linux.
|
||||
@@ -59,7 +71,8 @@ struct lppaca lppaca[] = {
|
||||
.lock_token = 0x8000, \
|
||||
.paca_index = (number), /* Paca Index */ \
|
||||
.kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
|
||||
.hw_cpu_id = 0xffff,
|
||||
.hw_cpu_id = 0xffff, \
|
||||
.slb_shadow_ptr = &slb_shadow[number],
|
||||
|
||||
#ifdef CONFIG_PPC_ISERIES
|
||||
#define PACA_INIT_ISERIES(number) \
|
||||
|
Reference in New Issue
Block a user