paravirt.h (20d444d06f97504d165b08558678b4737dcefb02) | paravirt.h (20c0e8269e9d515e677670902c7e1cc0209d6ad9) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2#ifndef _ASM_POWERPC_PARAVIRT_H 3#define _ASM_POWERPC_PARAVIRT_H 4 5#include <linux/jump_label.h> 6#include <asm/smp.h> 7#ifdef CONFIG_PPC64 8#include <asm/paca.h> --- 14 unchanged lines hidden (view full) --- 23 __be32 yield_count = READ_ONCE(lppaca_of(cpu).yield_count); 24 return be32_to_cpu(yield_count); 25} 26 27static inline void yield_to_preempted(int cpu, u32 yield_count) 28{ 29 plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(cpu), yield_count); 30} | 1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2#ifndef _ASM_POWERPC_PARAVIRT_H 3#define _ASM_POWERPC_PARAVIRT_H 4 5#include <linux/jump_label.h> 6#include <asm/smp.h> 7#ifdef CONFIG_PPC64 8#include <asm/paca.h> --- 14 unchanged lines hidden (view full) --- 23 __be32 yield_count = READ_ONCE(lppaca_of(cpu).yield_count); 24 return be32_to_cpu(yield_count); 25} 26 27static inline void yield_to_preempted(int cpu, u32 yield_count) 28{ 29 plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(cpu), yield_count); 30} |
31 32static inline void prod_cpu(int cpu) 33{ 34 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu)); 35} 36 37static inline void yield_to_any(void) 38{ 39 plpar_hcall_norets(H_CONFER, -1, 0); 40} |
|
31#else 32static inline bool is_shared_processor(void) 33{ 34 return false; 35} 36 37static inline u32 yield_count_of(int cpu) 38{ 39 return 0; 40} 41 42extern void ___bad_yield_to_preempted(void); 43static inline void yield_to_preempted(int cpu, u32 yield_count) 44{ 45 ___bad_yield_to_preempted(); /* This would be a bug */ 46} | 41#else 42static inline bool is_shared_processor(void) 43{ 44 return false; 45} 46 47static inline u32 yield_count_of(int cpu) 48{ 49 return 0; 50} 51 52extern void ___bad_yield_to_preempted(void); 53static inline void yield_to_preempted(int cpu, u32 yield_count) 54{ 55 ___bad_yield_to_preempted(); /* This would be a bug */ 56} |
57 58extern void ___bad_yield_to_any(void); 59static inline void yield_to_any(void) 60{ 61 ___bad_yield_to_any(); /* This would be a bug */ 62} 63 64extern void ___bad_prod_cpu(void); 65static inline void prod_cpu(int cpu) 66{ 67 ___bad_prod_cpu(); /* This would be a bug */ 68} 69 |
|
47#endif 48 49#define vcpu_is_preempted vcpu_is_preempted 50static inline bool vcpu_is_preempted(int cpu) 51{ 52 if (!is_shared_processor()) 53 return false; 54 if (yield_count_of(cpu) & 1) 55 return true; 56 return false; 57} 58 | 70#endif 71 72#define vcpu_is_preempted vcpu_is_preempted 73static inline bool vcpu_is_preempted(int cpu) 74{ 75 if (!is_shared_processor()) 76 return false; 77 if (yield_count_of(cpu) & 1) 78 return true; 79 return false; 80} 81 |
82static inline bool pv_is_native_spin_unlock(void) 83{ 84 return !is_shared_processor(); 85} 86 |
|
59#endif /* _ASM_POWERPC_PARAVIRT_H */ | 87#endif /* _ASM_POWERPC_PARAVIRT_H */ |