hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/arch/powerpc/lib/locks.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Spin and read/write lock operations.
34 *
....@@ -5,11 +6,6 @@
56 * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
67 * Copyright (C) 2002 Dave Engebretsen <engebret@us.ibm.com>, IBM
78 * Rework to support virtual processors
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU General Public License
11
- * as published by the Free Software Foundation; either version
12
- * 2 of the License, or (at your option) any later version.
139 */
1410
1511 #include <linux/kernel.h>
....@@ -22,7 +18,7 @@
2218 #include <asm/hvcall.h>
2319 #include <asm/smp.h>
2420
25
-void __spin_yield(arch_spinlock_t *lock)
21
+void splpar_spin_yield(arch_spinlock_t *lock)
2622 {
2723 unsigned int lock_value, holder_cpu, yield_count;
2824
....@@ -31,23 +27,23 @@
3127 return;
3228 holder_cpu = lock_value & 0xffff;
3329 BUG_ON(holder_cpu >= NR_CPUS);
34
- yield_count = be32_to_cpu(lppaca_of(holder_cpu).yield_count);
30
+
31
+ yield_count = yield_count_of(holder_cpu);
3532 if ((yield_count & 1) == 0)
3633 return; /* virtual cpu is currently running */
3734 rmb();
3835 if (lock->slock != lock_value)
3936 return; /* something has changed */
40
- plpar_hcall_norets(H_CONFER,
41
- get_hard_smp_processor_id(holder_cpu), yield_count);
37
+ yield_to_preempted(holder_cpu, yield_count);
4238 }
43
-EXPORT_SYMBOL_GPL(__spin_yield);
39
+EXPORT_SYMBOL_GPL(splpar_spin_yield);
4440
4541 /*
4642 * Waiting for a read lock or a write lock on a rwlock...
4743 * This turns out to be the same for read and write locks, since
4844 * we only know the holder if it is write-locked.
4945 */
50
-void __rw_yield(arch_rwlock_t *rw)
46
+void splpar_rw_yield(arch_rwlock_t *rw)
5147 {
5248 int lock_value;
5349 unsigned int holder_cpu, yield_count;
....@@ -57,13 +53,13 @@
5753 return; /* no write lock at present */
5854 holder_cpu = lock_value & 0xffff;
5955 BUG_ON(holder_cpu >= NR_CPUS);
60
- yield_count = be32_to_cpu(lppaca_of(holder_cpu).yield_count);
56
+
57
+ yield_count = yield_count_of(holder_cpu);
6158 if ((yield_count & 1) == 0)
6259 return; /* virtual cpu is currently running */
6360 rmb();
6461 if (rw->lock != lock_value)
6562 return; /* something has changed */
66
- plpar_hcall_norets(H_CONFER,
67
- get_hard_smp_processor_id(holder_cpu), yield_count);
63
+ yield_to_preempted(holder_cpu, yield_count);
6864 }
6965 #endif