Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3356bb9f authored by David Gibson's avatar David Gibson Committed by Paul Mackerras
Browse files

[PATCH] powerpc: Remove lppaca structure from the PACA



At present the lppaca - the structure shared with the iSeries
hypervisor and phyp - is contained within the PACA, our own low-level
per-cpu structure.  This doesn't have to be so, the patch below
removes it, making a separate array of lppaca structures.

This saves approximately 500*NR_CPUS bytes of image size and kernel
memory, because we don't need aligning gap between the Linux and
hypervisor portions of every PACA.  On the other hand it means an
extra level of dereference in many accesses to the lppaca.

The patch also gets rid of several places where we assign the paca
address to a local variable for no particular reason.

Signed-off-by: default avatarDavid Gibson <dwg@au1.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent e58c3495
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ int main(void)
	DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc));
	DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb));
	DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
	DEFINE(PACALPPACA, offsetof(struct paca_struct, lppaca));
	DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
	DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));

	DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
+2 −1
Original line number Diff line number Diff line
@@ -511,7 +511,8 @@ restore:
	cmpdi	0,r5,0
	beq	4f
	/* Check for pending interrupts (iSeries) */
	ld	r3,PACALPPACA+LPPACAANYINT(r13)
	ld	r3,PACALPPACAPTR(r13)
	ld	r3,LPPACAANYINT(r3)
	cmpdi	r3,0
	beq+	4f			/* skip do_IRQ if no interrupts */

+16 −9
Original line number Diff line number Diff line
@@ -255,8 +255,9 @@ exception_marker:

#define EXCEPTION_PROLOG_ISERIES_2					\
	mfmsr	r10;							\
	ld	r11,PACALPPACA+LPPACASRR0(r13);				\
	ld	r12,PACALPPACA+LPPACASRR1(r13);				\
	ld	r12,PACALPPACAPTR(r13);					\
	ld	r11,LPPACASRR0(r12);					\
	ld	r12,LPPACASRR1(r12);					\
	ori	r10,r10,MSR_RI;						\
	mtmsrd	r10,1

@@ -635,7 +636,8 @@ data_access_slb_iSeries:
	std	r12,PACA_EXSLB+EX_R12(r13)
	mfspr	r10,SPRN_SPRG1
	std	r10,PACA_EXSLB+EX_R13(r13)
	ld	r12,PACALPPACA+LPPACASRR1(r13);
	ld	r12,PACALPPACAPTR(r13)
	ld	r12,LPPACASRR1(r12)
	b	.slb_miss_realmode

	STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN)
@@ -645,7 +647,8 @@ instruction_access_slb_iSeries:
	mtspr	SPRN_SPRG1,r13		/* save r13 */
	mfspr	r13,SPRN_SPRG3		/* get paca address into r13 */
	std	r3,PACA_EXSLB+EX_R3(r13)
	ld	r3,PACALPPACA+LPPACASRR0(r13)	/* get SRR0 value */
	ld	r3,PACALPPACAPTR(r13)
	ld	r3,LPPACASRR0(r3)	/* get SRR0 value */
	std	r9,PACA_EXSLB+EX_R9(r13)
	mfcr	r9
#ifdef __DISABLED__
@@ -657,7 +660,8 @@ instruction_access_slb_iSeries:
	std	r12,PACA_EXSLB+EX_R12(r13)
	mfspr	r10,SPRN_SPRG1
	std	r10,PACA_EXSLB+EX_R13(r13)
	ld	r12,PACALPPACA+LPPACASRR1(r13);
	ld	r12,PACALPPACAPTR(r13)
	ld	r12,LPPACASRR1(r12)
	b	.slb_miss_realmode

#ifdef __DISABLED__
@@ -746,7 +750,8 @@ iSeries_secondary_smp_loop:
	.globl decrementer_iSeries_masked
decrementer_iSeries_masked:
	li	r11,1
	stb	r11,PACALPPACA+LPPACADECRINT(r13)
	ld	r12,PACALPPACAPTR(r13)
	stb	r11,LPPACADECRINT(r12)
	LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy)
	lwz	r12,ADDROFF(tb_ticks_per_jiffy)(r12)
	mtspr	SPRN_DEC,r12
@@ -755,8 +760,9 @@ decrementer_iSeries_masked:
	.globl hardware_interrupt_iSeries_masked
hardware_interrupt_iSeries_masked:
	mtcrf	0x80,r9		/* Restore regs */
	ld	r11,PACALPPACA+LPPACASRR0(r13)
	ld	r12,PACALPPACA+LPPACASRR1(r13)
	ld	r12,PACALPPACAPTR(r13)
	ld	r11,LPPACASRR0(r12)
	ld	r12,LPPACASRR1(r12)
	mtspr	SPRN_SRR0,r11
	mtspr	SPRN_SRR1,r12
	ld	r9,PACA_EXGEN+EX_R9(r13)
@@ -995,7 +1001,8 @@ _GLOBAL(slb_miss_realmode)
	ld	r3,PACA_EXSLB+EX_R3(r13)
	lwz	r9,PACA_EXSLB+EX_CCR(r13)	/* get saved CR */
#ifdef CONFIG_PPC_ISERIES
	ld	r11,PACALPPACA+LPPACASRR0(r13)	/* get SRR0 value */
	ld	r11,PACALPPACAPTR(r13)
	ld	r11,LPPACASRR0(r11)		/* get SRR0 value */
#endif /* CONFIG_PPC_ISERIES */

	mtlr	r10
+4 −8
Original line number Diff line number Diff line
@@ -238,15 +238,11 @@ void do_IRQ(struct pt_regs *regs)
        irq_exit();

#ifdef CONFIG_PPC_ISERIES
	{
		struct paca_struct *lpaca = get_paca();

		if (lpaca->lppaca.int_dword.fields.decr_int) {
			lpaca->lppaca.int_dword.fields.decr_int = 0;
	if (get_lppaca()->int_dword.fields.decr_int) {
		get_lppaca()->int_dword.fields.decr_int = 0;
		/* Signal a fake decrementer interrupt */
		timer_interrupt(regs);
	}
	}
#endif
}

+5 −8
Original line number Diff line number Diff line
@@ -55,15 +55,13 @@ static unsigned long get_purr(void)
{
	unsigned long sum_purr = 0;
	int cpu;
	struct paca_struct *lpaca;

	for_each_cpu(cpu) {
		lpaca = paca + cpu;
		sum_purr += lpaca->lppaca.emulated_time_base;
		sum_purr += lppaca[cpu].emulated_time_base;

#ifdef PURR_DEBUG
		printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n",
			cpu, lpaca->lppaca.emulated_time_base);
			cpu, lppaca[cpu].emulated_time_base);
#endif
	}
	return sum_purr;
@@ -79,12 +77,11 @@ static int lparcfg_data(struct seq_file *m, void *v)
	unsigned long pool_id, lp_index;
	int shared, entitled_capacity, max_entitled_capacity;
	int processors, max_processors;
	struct paca_struct *lpaca = get_paca();
	unsigned long purr = get_purr();

	seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);

	shared = (int)(lpaca->lppaca_ptr->shared_proc);
	shared = (int)(get_lppaca()->shared_proc);
	seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
		   e2a(xItExtVpdPanel.mfgID[2]),
		   e2a(xItExtVpdPanel.mfgID[3]),
@@ -402,7 +399,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
			   (h_resource >> 0 * 8) & 0xffff);

		/* pool related entries are apropriate for shared configs */
		if (paca[0].lppaca.shared_proc) {
		if (lppaca[0].shared_proc) {

			h_pic(&pool_idle_time, &pool_procs);

@@ -451,7 +448,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
	seq_printf(m, "partition_potential_processors=%d\n",
		   partition_potential_processors);

	seq_printf(m, "shared_processor_mode=%d\n", paca[0].lppaca.shared_proc);
	seq_printf(m, "shared_processor_mode=%d\n", lppaca[0].shared_proc);

	return 0;
}
Loading