Skip to content

Commit 8f8cffd

Browse files
chleroympe
authored andcommitted
powerpc/processor: Move cpu_relax() into asm/vdso/processor.h
cpu_relax() need to be in asm/vdso/processor.h to be used by the C VDSO generic library. Move it there. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8d1eeab commit 8f8cffd

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

arch/powerpc/include/asm/processor.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* Copyright (C) 2001 PPC 64 Team, IBM Corp
77
*/
88

9+
#include <vdso/processor.h>
10+
911
#include <asm/reg.h>
1012

1113
#ifdef CONFIG_VSX
@@ -63,14 +65,6 @@ extern int _chrp_type;
6365

6466
#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
6567

66-
/* Macros for adjusting thread priority (hardware multi-threading) */
67-
#define HMT_very_low() asm volatile("or 31,31,31 # very low priority")
68-
#define HMT_low() asm volatile("or 1,1,1 # low priority")
69-
#define HMT_medium_low() asm volatile("or 6,6,6 # medium low priority")
70-
#define HMT_medium() asm volatile("or 2,2,2 # medium priority")
71-
#define HMT_medium_high() asm volatile("or 5,5,5 # medium high priority")
72-
#define HMT_high() asm volatile("or 3,3,3 # high priority")
73-
7468
#ifdef __KERNEL__
7569

7670
#ifdef CONFIG_PPC64
@@ -344,7 +338,6 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
344338
}
345339

346340
#ifdef CONFIG_PPC64
347-
#define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
348341

349342
#define spin_begin() HMT_low()
350343

@@ -363,8 +356,6 @@ do { \
363356
} \
364357
} while (0)
365358

366-
#else
367-
#define cpu_relax() barrier()
368359
#endif
369360

370361
/* Check that a certain kernel stack pointer is valid in task_struct p */
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
#ifndef _ASM_POWERPC_VDSO_PROCESSOR_H
3+
#define _ASM_POWERPC_VDSO_PROCESSOR_H
4+
5+
#ifndef __ASSEMBLY__
6+
7+
/* Macros for adjusting thread priority (hardware multi-threading) */
8+
#define HMT_very_low() asm volatile("or 31, 31, 31 # very low priority")
9+
#define HMT_low() asm volatile("or 1, 1, 1 # low priority")
10+
#define HMT_medium_low() asm volatile("or 6, 6, 6 # medium low priority")
11+
#define HMT_medium() asm volatile("or 2, 2, 2 # medium priority")
12+
#define HMT_medium_high() asm volatile("or 5, 5, 5 # medium high priority")
13+
#define HMT_high() asm volatile("or 3, 3, 3 # high priority")
14+
15+
#ifdef CONFIG_PPC64
16+
#define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
17+
#else
18+
#define cpu_relax() barrier()
19+
#endif
20+
21+
#endif /* __ASSEMBLY__ */
22+
23+
#endif /* _ASM_POWERPC_VDSO_PROCESSOR_H */

0 commit comments

Comments
 (0)