Commit f061fb03 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

powerpc/vdso: augment VDSO32 functions to support 64 bits build



VDSO64 cacheflush.S datapage.S gettimeofday.S and vgettimeofday.c
are very similar to their VDSO32 counterpart.

VDSO32 counterpart is already more complete than the VDSO64 version
as it supports both PPC32 vdso and 32 bits VDSO for PPC64.

Use compat macros wherever necessary in PPC32 files
so that they can also be used to build VDSO64.

vdso64/note.S is already a link to vdso32/note.S so
no change is required.

Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c2cbb8f046b7efc251053521dc39b752795e26b7.1642782130.git.christophe.leroy@csgroup.eu
parent 6836f099
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#define PPC_STLCX	stringify_in_c(stdcx.)
#define PPC_CNTLZL	stringify_in_c(cntlzd)
#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), RS)
#define PPC_SRL		stringify_in_c(srd)
#define PPC_LR_STKOFF	16
#define PPC_MIN_STKFRM	112

@@ -54,6 +55,7 @@
#define PPC_STLCX	stringify_in_c(stwcx.)
#define PPC_CNTLZL	stringify_in_c(cntlzw)
#define PPC_MTOCRF	stringify_in_c(mtcrf)
#define PPC_SRL		stringify_in_c(srw)
#define PPC_LR_STKOFF	4
#define PPC_MIN_STKFRM	16

+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
	add	r8,r8,r5		/* ensure we get enough */
#ifdef CONFIG_PPC64
	lwz	r9,CFG_DCACHE_LOGBLOCKSZ(r10)
	srw.	r8,r8,r9		/* compute line count */
	PPC_SRL.	r8,r8,r9		/* compute line count */
#else
	srwi.	r8, r8, L1_CACHE_SHIFT
	mr	r7, r6
@@ -72,7 +72,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
	subf	r8,r6,r4		/* compute length */
	add	r8,r8,r5
	lwz	r9,CFG_ICACHE_LOGBLOCKSZ(r10)
	srw.	r8,r8,r9		/* compute line count */
	PPC_SRL.	r8,r8,r9		/* compute line count */
	crclr	cr0*4+so
	beqlr				/* nothing to do? */
#endif
+8 −2
Original line number Diff line number Diff line
@@ -30,11 +30,15 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
	mr.	r4,r3
	get_datapage	r3
	mtlr	r12
#ifdef __powerpc64__
	addi	r3,r3,CFG_SYSCALL_MAP64
#else
	addi	r3,r3,CFG_SYSCALL_MAP32
#endif
	crclr	cr0*4+so
	beqlr
	li	r0,NR_syscalls
	stw	r0,0(r4)
	crclr	cr0*4+so
	blr
  .cfi_endproc
V_FUNCTION_END(__kernel_get_syscall_map)
@@ -49,8 +53,10 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
	mflr	r12
  .cfi_register lr,r12
	get_datapage	r3
#ifndef __powerpc64__
	lwz	r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
	lwz	r3,CFG_TB_TICKS_PER_SEC(r3)
#endif
	PPC_LL	r3,CFG_TB_TICKS_PER_SEC(r3)
	mtlr	r12
	crclr	cr0*4+so
	blr
+2 −2
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
V_FUNCTION_BEGIN(__kernel_getcpu)
  .cfi_startproc
	mfspr	r5,SPRN_SPRG_VDSO_READ
	cmpwi	cr0,r3,0
	cmpwi	cr1,r4,0
	PPC_LCMPI	cr0,r3,0
	PPC_LCMPI	cr1,r4,0
	clrlwi  r6,r5,16
	rlwinm  r7,r5,16,31-15,31-0
	beq	cr0,1f
+6 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Userland implementation of gettimeofday() for 32 bits processes in a
 * ppc64 kernel for use in the vDSO
 * Userland implementation of gettimeofday() for processes
 * for use in the vDSO
 *
 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org,
 *                    IBM Corp.
@@ -41,9 +41,11 @@ V_FUNCTION_END(__kernel_clock_gettime)
 * int __kernel_clock_gettime64(clockid_t clock_id, struct __timespec64 *ts);
 *
 */
#ifndef __powerpc64__
V_FUNCTION_BEGIN(__kernel_clock_gettime64)
	cvdso_call __c_kernel_clock_gettime64
V_FUNCTION_END(__kernel_clock_gettime64)
#endif

/*
 * Exact prototype of clock_getres()
@@ -69,6 +71,7 @@ V_FUNCTION_END(__kernel_time)
/* Routines for restoring integer registers, called by the compiler.  */
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the integer restore area.  */
#ifndef __powerpc64__
_GLOBAL(_restgpr_31_x)
_GLOBAL(_rest32gpr_31_x)
	lwz	r0,4(r11)
@@ -76,3 +79,4 @@ _GLOBAL(_rest32gpr_31_x)
	mtlr	r0
	mr	r1,r11
	blr
#endif
Loading