Skip to content

Commit c4891a3

Browse files
committed
powerpc/vdso: augment VDSO32 functions to support 64 bits build
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Christophe Leroy <christophe.leroy@csgroup.eu> commit f061fb0 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: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/c2cbb8f046b7efc251053521dc39b752795e26b7.1642782130.git.christophe.leroy@csgroup.eu (cherry picked from commit f061fb0) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 332fe51 commit c4891a3

File tree

6 files changed

+39
-12
lines changed

6 files changed

+39
-12
lines changed

arch/powerpc/include/asm/asm-compat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define PPC_STLCX stringify_in_c(stdcx.)
2222
#define PPC_CNTLZL stringify_in_c(cntlzd)
2323
#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), RS)
24+
#define PPC_SRL stringify_in_c(srd)
2425
#define PPC_LR_STKOFF 16
2526
#define PPC_MIN_STKFRM 112
2627

@@ -54,6 +55,7 @@
5455
#define PPC_STLCX stringify_in_c(stwcx.)
5556
#define PPC_CNTLZL stringify_in_c(cntlzw)
5657
#define PPC_MTOCRF stringify_in_c(mtcrf)
58+
#define PPC_SRL stringify_in_c(srw)
5759
#define PPC_LR_STKOFF 4
5860
#define PPC_MIN_STKFRM 16
5961

arch/powerpc/kernel/vdso32/cacheflush.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
4646
add r8,r8,r5 /* ensure we get enough */
4747
#ifdef CONFIG_PPC64
4848
lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
49-
srw. r8,r8,r9 /* compute line count */
49+
PPC_SRL. r8,r8,r9 /* compute line count */
5050
#else
5151
srwi. r8, r8, L1_CACHE_SHIFT
5252
mr r7, r6
@@ -72,7 +72,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
7272
subf r8,r6,r4 /* compute length */
7373
add r8,r8,r5
7474
lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
75-
srw. r8,r8,r9 /* compute line count */
75+
PPC_SRL. r8,r8,r9 /* compute line count */
7676
crclr cr0*4+so
7777
beqlr /* nothing to do? */
7878
#endif

arch/powerpc/kernel/vdso32/datapage.S

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
3030
mr. r4,r3
3131
get_datapage r3
3232
mtlr r12
33+
#ifdef __powerpc64__
34+
addi r3,r3,CFG_SYSCALL_MAP64
35+
#else
3336
addi r3,r3,CFG_SYSCALL_MAP32
37+
#endif
38+
crclr cr0*4+so
3439
beqlr
3540
li r0,NR_syscalls
3641
stw r0,0(r4)
37-
crclr cr0*4+so
3842
blr
3943
.cfi_endproc
4044
V_FUNCTION_END(__kernel_get_syscall_map)
@@ -49,8 +53,10 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
4953
mflr r12
5054
.cfi_register lr,r12
5155
get_datapage r3
56+
#ifndef __powerpc64__
5257
lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
53-
lwz r3,CFG_TB_TICKS_PER_SEC(r3)
58+
#endif
59+
PPC_LL r3,CFG_TB_TICKS_PER_SEC(r3)
5460
mtlr r12
5561
crclr cr0*4+so
5662
blr

arch/powerpc/kernel/vdso32/getcpu.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
V_FUNCTION_BEGIN(__kernel_getcpu)
2020
.cfi_startproc
2121
mfspr r5,SPRN_SPRG_VDSO_READ
22-
cmpwi cr0,r3,0
23-
cmpwi cr1,r4,0
22+
PPC_LCMPI cr0,r3,0
23+
PPC_LCMPI cr1,r4,0
2424
clrlwi r6,r5,16
2525
rlwinm r7,r5,16,31-15,31-0
2626
beq cr0,1f

arch/powerpc/kernel/vdso32/gettimeofday.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0-or-later */
22
/*
3-
* Userland implementation of gettimeofday() for 32 bits processes in a
4-
* ppc64 kernel for use in the vDSO
3+
* Userland implementation of gettimeofday() for processes
4+
* for use in the vDSO
55
*
66
* Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org,
77
* IBM Corp.
@@ -41,9 +41,11 @@ V_FUNCTION_END(__kernel_clock_gettime)
4141
* int __kernel_clock_gettime64(clockid_t clock_id, struct __timespec64 *ts);
4242
*
4343
*/
44+
#ifndef __powerpc64__
4445
V_FUNCTION_BEGIN(__kernel_clock_gettime64)
4546
cvdso_call __c_kernel_clock_gettime64
4647
V_FUNCTION_END(__kernel_clock_gettime64)
48+
#endif
4749

4850
/*
4951
* Exact prototype of clock_getres()
@@ -69,10 +71,12 @@ V_FUNCTION_END(__kernel_time)
6971
/* Routines for restoring integer registers, called by the compiler. */
7072
/* Called with r11 pointing to the stack header word of the caller of the */
7173
/* function, just beyond the end of the integer restore area. */
74+
#ifndef __powerpc64__
7275
_GLOBAL(_restgpr_31_x)
7376
_GLOBAL(_rest32gpr_31_x)
7477
lwz r0,4(r11)
7578
lwz r31,-4(r11)
7679
mtlr r0
7780
mr r1,r11
7881
blr
82+
#endif

arch/powerpc/kernel/vdso32/vgettimeofday.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@
22
/*
33
* Powerpc userspace implementations of gettimeofday() and similar.
44
*/
5+
#include <linux/time.h>
56
#include <linux/types.h>
67

8+
#ifdef __powerpc64__
9+
int __c_kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts,
10+
const struct vdso_data *vd)
11+
{
12+
return __cvdso_clock_gettime_data(vd, clock, ts);
13+
}
14+
15+
int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res,
16+
const struct vdso_data *vd)
17+
{
18+
return __cvdso_clock_getres_data(vd, clock_id, res);
19+
}
20+
#else
721
int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts,
822
const struct vdso_data *vd)
923
{
@@ -16,16 +30,17 @@ int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts,
1630
return __cvdso_clock_gettime_data(vd, clock, ts);
1731
}
1832

19-
int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz,
33+
int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res,
2034
const struct vdso_data *vd)
2135
{
22-
return __cvdso_gettimeofday_data(vd, tv, tz);
36+
return __cvdso_clock_getres_time32_data(vd, clock_id, res);
2337
}
38+
#endif
2439

25-
int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res,
40+
int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz,
2641
const struct vdso_data *vd)
2742
{
28-
return __cvdso_clock_getres_time32_data(vd, clock_id, res);
43+
return __cvdso_gettimeofday_data(vd, tv, tz);
2944
}
3045

3146
__kernel_old_time_t __c_kernel_time(__kernel_old_time_t *time, const struct vdso_data *vd)

0 commit comments

Comments
 (0)