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

Commit e311a92d authored by Thiago Jung Bauermann's avatar Thiago Jung Bauermann Committed by Michael Ellerman
Browse files

powerpc/pseries: Add and use LPPACA_SIZE constant



Helps document what the hard-coded number means.

Also take the opportunity to fix an #endif comment.

Suggested-by: default avatarAlexey Kardashevskiy <aik@linux.ibm.com>
Signed-off-by: default avatarThiago Jung Bauermann <bauerman@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190820021326.6884-8-bauerman@linux.ibm.com
parent 7f70c381
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -52,6 +52,8 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,


#ifdef CONFIG_PPC_PSERIES
#ifdef CONFIG_PPC_PSERIES


#define LPPACA_SIZE 0x400

/*
/*
 * See asm/lppaca.h for more detail.
 * See asm/lppaca.h for more detail.
 *
 *
@@ -65,7 +67,7 @@ static inline void init_lppaca(struct lppaca *lppaca)


	*lppaca = (struct lppaca) {
	*lppaca = (struct lppaca) {
		.desc = cpu_to_be32(0xd397d781),	/* "LpPa" */
		.desc = cpu_to_be32(0xd397d781),	/* "LpPa" */
		.size = cpu_to_be16(0x400),
		.size = cpu_to_be16(LPPACA_SIZE),
		.fpregs_in_use = 1,
		.fpregs_in_use = 1,
		.slb_count = cpu_to_be16(64),
		.slb_count = cpu_to_be16(64),
		.vmxregs_in_use = 0,
		.vmxregs_in_use = 0,
@@ -75,19 +77,18 @@ static inline void init_lppaca(struct lppaca *lppaca)
static struct lppaca * __init new_lppaca(int cpu, unsigned long limit)
static struct lppaca * __init new_lppaca(int cpu, unsigned long limit)
{
{
	struct lppaca *lp;
	struct lppaca *lp;
	size_t size = 0x400;


	BUILD_BUG_ON(size < sizeof(struct lppaca));
	BUILD_BUG_ON(sizeof(struct lppaca) > LPPACA_SIZE);


	if (early_cpu_has_feature(CPU_FTR_HVMODE))
	if (early_cpu_has_feature(CPU_FTR_HVMODE))
		return NULL;
		return NULL;


	lp = alloc_paca_data(size, 0x400, limit, cpu);
	lp = alloc_paca_data(LPPACA_SIZE, 0x400, limit, cpu);
	init_lppaca(lp);
	init_lppaca(lp);


	return lp;
	return lp;
}
}
#endif /* CONFIG_PPC_BOOK3S */
#endif /* CONFIG_PPC_PSERIES */


#ifdef CONFIG_PPC_BOOK3S_64
#ifdef CONFIG_PPC_BOOK3S_64