~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/spec-ctrl.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/include/asm/spec-ctrl.h (Architecture m68k) and /arch/alpha/include/asm-alpha/spec-ctrl.h (Architecture alpha)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _ASM_X86_SPECCTRL_H_                      
  3 #define _ASM_X86_SPECCTRL_H_                      
  4                                                   
  5 #include <linux/thread_info.h>                    
  6 #include <asm/nospec-branch.h>                    
  7 #include <asm/msr.h>                              
  8                                                   
  9 /*                                                
 10  * On VMENTER we must preserve whatever view o    
 11  * the guest has, while on VMEXIT we restore t    
 12  * would be easier if SPEC_CTRL were architect    
 13  * shadowable for guests but this is not (curr    
 14  * Takes the guest view of SPEC_CTRL MSR as a     
 15  * the guest's version of VIRT_SPEC_CTRL, if e    
 16  */                                               
 17 extern void x86_virt_spec_ctrl(u64 guest_virt_    
 18                                                   
 19 /**                                               
 20  * x86_spec_ctrl_set_guest - Set speculation c    
 21  * @guest_spec_ctrl:            The guest cont    
 22  * @guest_virt_spec_ctrl:       The guest cont    
 23  *                              (may get trans    
 24  *                                                
 25  * Avoids writing to the MSR if the content/bi    
 26  */                                               
 27 static inline                                     
 28 void x86_spec_ctrl_set_guest(u64 guest_virt_sp    
 29 {                                                 
 30         x86_virt_spec_ctrl(guest_virt_spec_ctr    
 31 }                                                 
 32                                                   
 33 /**                                               
 34  * x86_spec_ctrl_restore_host - Restore host s    
 35  * @guest_spec_ctrl:            The guest cont    
 36  * @guest_virt_spec_ctrl:       The guest cont    
 37  *                              (may get trans    
 38  *                                                
 39  * Avoids writing to the MSR if the content/bi    
 40  */                                               
 41 static inline                                     
 42 void x86_spec_ctrl_restore_host(u64 guest_virt    
 43 {                                                 
 44         x86_virt_spec_ctrl(guest_virt_spec_ctr    
 45 }                                                 
 46                                                   
 47 /* AMD specific Speculative Store Bypass MSR d    
 48 extern u64 x86_amd_ls_cfg_base;                   
 49 extern u64 x86_amd_ls_cfg_ssbd_mask;              
 50                                                   
 51 static inline u64 ssbd_tif_to_spec_ctrl(u64 ti    
 52 {                                                 
 53         BUILD_BUG_ON(TIF_SSBD < SPEC_CTRL_SSBD    
 54         return (tifn & _TIF_SSBD) >> (TIF_SSBD    
 55 }                                                 
 56                                                   
 57 static inline u64 stibp_tif_to_spec_ctrl(u64 t    
 58 {                                                 
 59         BUILD_BUG_ON(TIF_SPEC_IB < SPEC_CTRL_S    
 60         return (tifn & _TIF_SPEC_IB) >> (TIF_S    
 61 }                                                 
 62                                                   
 63 static inline unsigned long ssbd_spec_ctrl_to_    
 64 {                                                 
 65         BUILD_BUG_ON(TIF_SSBD < SPEC_CTRL_SSBD    
 66         return (spec_ctrl & SPEC_CTRL_SSBD) <<    
 67 }                                                 
 68                                                   
 69 static inline unsigned long stibp_spec_ctrl_to    
 70 {                                                 
 71         BUILD_BUG_ON(TIF_SPEC_IB < SPEC_CTRL_S    
 72         return (spec_ctrl & SPEC_CTRL_STIBP) <    
 73 }                                                 
 74                                                   
 75 static inline u64 ssbd_tif_to_amd_ls_cfg(u64 t    
 76 {                                                 
 77         return (tifn & _TIF_SSBD) ? x86_amd_ls    
 78 }                                                 
 79                                                   
 80 /*                                                
 81  * This can be used in noinstr functions & sho    
 82  * metal context.                                 
 83  */                                               
 84 static __always_inline void __update_spec_ctrl    
 85 {                                                 
 86         __this_cpu_write(x86_spec_ctrl_current    
 87         native_wrmsrl(MSR_IA32_SPEC_CTRL, val)    
 88 }                                                 
 89                                                   
 90 #ifdef CONFIG_SMP                                 
 91 extern void speculative_store_bypass_ht_init(v    
 92 #else                                             
 93 static inline void speculative_store_bypass_ht    
 94 #endif                                            
 95                                                   
 96 extern void speculation_ctrl_update(unsigned l    
 97 extern void speculation_ctrl_update_current(vo    
 98                                                   
 99 extern bool itlb_multihit_kvm_mitigation;         
100                                                   
101 #endif                                            
102                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php