hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/x86/include/asm/irqflags.h
....@@ -9,7 +9,7 @@
99 #include <asm/nospec-branch.h>
1010
1111 /* Provide __cpuidle; we can't safely include <linux/cpu.h> */
12
-#define __cpuidle __attribute__((__section__(".cpuidle.text")))
12
+#define __cpuidle __section(".cpuidle.text")
1313
1414 /*
1515 * Interrupt control:
....@@ -17,7 +17,7 @@
1717
1818 /* Declaration required for gcc < 4.9 to prevent -Werror=missing-prototypes */
1919 extern inline unsigned long native_save_fl(void);
20
-extern inline unsigned long native_save_fl(void)
20
+extern __always_inline unsigned long native_save_fl(void)
2121 {
2222 unsigned long flags;
2323
....@@ -44,12 +44,12 @@
4444 :"memory", "cc");
4545 }
4646
47
-static inline void native_irq_disable(void)
47
+static __always_inline void native_irq_disable(void)
4848 {
4949 asm volatile("cli": : :"memory");
5050 }
5151
52
-static inline void native_irq_enable(void)
52
+static __always_inline void native_irq_enable(void)
5353 {
5454 asm volatile("sti": : :"memory");
5555 }
....@@ -68,28 +68,28 @@
6868
6969 #endif
7070
71
-#ifdef CONFIG_PARAVIRT
71
+#ifdef CONFIG_PARAVIRT_XXL
7272 #include <asm/paravirt.h>
7373 #else
7474 #ifndef __ASSEMBLY__
7575 #include <linux/types.h>
7676
77
-static inline notrace unsigned long arch_local_save_flags(void)
77
+static __always_inline unsigned long arch_local_save_flags(void)
7878 {
7979 return native_save_fl();
8080 }
8181
82
-static inline notrace void arch_local_irq_restore(unsigned long flags)
82
+static __always_inline void arch_local_irq_restore(unsigned long flags)
8383 {
8484 native_restore_fl(flags);
8585 }
8686
87
-static inline notrace void arch_local_irq_disable(void)
87
+static __always_inline void arch_local_irq_disable(void)
8888 {
8989 native_irq_disable();
9090 }
9191
92
-static inline notrace void arch_local_irq_enable(void)
92
+static __always_inline void arch_local_irq_enable(void)
9393 {
9494 native_irq_enable();
9595 }
....@@ -115,7 +115,7 @@
115115 /*
116116 * For spinlocks, etc:
117117 */
118
-static inline notrace unsigned long arch_local_irq_save(void)
118
+static __always_inline unsigned long arch_local_irq_save(void)
119119 {
120120 unsigned long flags = arch_local_save_flags();
121121 arch_local_irq_disable();
....@@ -127,19 +127,9 @@
127127 #define DISABLE_INTERRUPTS(x) cli
128128
129129 #ifdef CONFIG_X86_64
130
-#define SWAPGS swapgs
131
-/*
132
- * Currently paravirt can't handle swapgs nicely when we
133
- * don't have a stack we can rely on (such as a user space
134
- * stack). So we either find a way around these or just fault
135
- * and emulate if a guest tries to call swapgs directly.
136
- *
137
- * Either way, this is a good way to document that we don't
138
- * have a reliable stack. x86_64 only.
139
- */
140
-#define SWAPGS_UNSAFE_STACK swapgs
141
-
142
-#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */
130
+#ifdef CONFIG_DEBUG_ENTRY
131
+#define SAVE_FLAGS(x) pushfq; popq %rax
132
+#endif
143133
144134 #define INTERRUPT_RETURN jmp native_iret
145135 #define USERGS_SYSRET64 \
....@@ -149,65 +139,33 @@
149139 swapgs; \
150140 sysretl
151141
152
-#ifdef CONFIG_DEBUG_ENTRY
153
-#define SAVE_FLAGS(x) pushfq; popq %rax
154
-#endif
155142 #else
156143 #define INTERRUPT_RETURN iret
157
-#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
158
-#define GET_CR0_INTO_EAX movl %cr0, %eax
159144 #endif
160145
161
-
162146 #endif /* __ASSEMBLY__ */
163
-#endif /* CONFIG_PARAVIRT */
147
+#endif /* CONFIG_PARAVIRT_XXL */
164148
165149 #ifndef __ASSEMBLY__
166
-static inline int arch_irqs_disabled_flags(unsigned long flags)
150
+static __always_inline int arch_irqs_disabled_flags(unsigned long flags)
167151 {
168152 return !(flags & X86_EFLAGS_IF);
169153 }
170154
171
-static inline int arch_irqs_disabled(void)
155
+static __always_inline int arch_irqs_disabled(void)
172156 {
173157 unsigned long flags = arch_local_save_flags();
174158
175159 return arch_irqs_disabled_flags(flags);
176160 }
161
+#else
162
+#ifdef CONFIG_X86_64
163
+#ifdef CONFIG_XEN_PV
164
+#define SWAPGS ALTERNATIVE "swapgs", "", X86_FEATURE_XENPV
165
+#else
166
+#define SWAPGS swapgs
167
+#endif
168
+#endif
177169 #endif /* !__ASSEMBLY__ */
178
-
179
-#ifdef __ASSEMBLY__
180
-#ifdef CONFIG_TRACE_IRQFLAGS
181
-# define TRACE_IRQS_ON call trace_hardirqs_on_thunk;
182
-# define TRACE_IRQS_OFF call trace_hardirqs_off_thunk;
183
-#else
184
-# define TRACE_IRQS_ON
185
-# define TRACE_IRQS_OFF
186
-#endif
187
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
188
-# ifdef CONFIG_X86_64
189
-# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk
190
-# define LOCKDEP_SYS_EXIT_IRQ \
191
- TRACE_IRQS_ON; \
192
- sti; \
193
- call lockdep_sys_exit_thunk; \
194
- cli; \
195
- TRACE_IRQS_OFF;
196
-# else
197
-# define LOCKDEP_SYS_EXIT \
198
- pushl %eax; \
199
- pushl %ecx; \
200
- pushl %edx; \
201
- call lockdep_sys_exit; \
202
- popl %edx; \
203
- popl %ecx; \
204
- popl %eax;
205
-# define LOCKDEP_SYS_EXIT_IRQ
206
-# endif
207
-#else
208
-# define LOCKDEP_SYS_EXIT
209
-# define LOCKDEP_SYS_EXIT_IRQ
210
-#endif
211
-#endif /* __ASSEMBLY__ */
212170
213171 #endif