| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Spin and read/write lock operations. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM |
|---|
| 6 | 7 | * Copyright (C) 2002 Dave Engebretsen <engebret@us.ibm.com>, IBM |
|---|
| 7 | 8 | * 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. |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 22 | 18 | #include <asm/hvcall.h> |
|---|
| 23 | 19 | #include <asm/smp.h> |
|---|
| 24 | 20 | |
|---|
| 25 | | -void __spin_yield(arch_spinlock_t *lock) |
|---|
| 21 | +void splpar_spin_yield(arch_spinlock_t *lock) |
|---|
| 26 | 22 | { |
|---|
| 27 | 23 | unsigned int lock_value, holder_cpu, yield_count; |
|---|
| 28 | 24 | |
|---|
| .. | .. |
|---|
| 31 | 27 | return; |
|---|
| 32 | 28 | holder_cpu = lock_value & 0xffff; |
|---|
| 33 | 29 | 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); |
|---|
| 35 | 32 | if ((yield_count & 1) == 0) |
|---|
| 36 | 33 | return; /* virtual cpu is currently running */ |
|---|
| 37 | 34 | rmb(); |
|---|
| 38 | 35 | if (lock->slock != lock_value) |
|---|
| 39 | 36 | 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); |
|---|
| 42 | 38 | } |
|---|
| 43 | | -EXPORT_SYMBOL_GPL(__spin_yield); |
|---|
| 39 | +EXPORT_SYMBOL_GPL(splpar_spin_yield); |
|---|
| 44 | 40 | |
|---|
| 45 | 41 | /* |
|---|
| 46 | 42 | * Waiting for a read lock or a write lock on a rwlock... |
|---|
| 47 | 43 | * This turns out to be the same for read and write locks, since |
|---|
| 48 | 44 | * we only know the holder if it is write-locked. |
|---|
| 49 | 45 | */ |
|---|
| 50 | | -void __rw_yield(arch_rwlock_t *rw) |
|---|
| 46 | +void splpar_rw_yield(arch_rwlock_t *rw) |
|---|
| 51 | 47 | { |
|---|
| 52 | 48 | int lock_value; |
|---|
| 53 | 49 | unsigned int holder_cpu, yield_count; |
|---|
| .. | .. |
|---|
| 57 | 53 | return; /* no write lock at present */ |
|---|
| 58 | 54 | holder_cpu = lock_value & 0xffff; |
|---|
| 59 | 55 | 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); |
|---|
| 61 | 58 | if ((yield_count & 1) == 0) |
|---|
| 62 | 59 | return; /* virtual cpu is currently running */ |
|---|
| 63 | 60 | rmb(); |
|---|
| 64 | 61 | if (rw->lock != lock_value) |
|---|
| 65 | 62 | 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); |
|---|
| 68 | 64 | } |
|---|
| 69 | 65 | #endif |
|---|