hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/x86/include/asm/irqflags.h
....@@ -35,8 +35,13 @@
3535 return flags;
3636 }
3737
38
+static inline unsigned long native_save_flags(void)
39
+{
40
+ return native_save_fl();
41
+}
42
+
3843 extern inline void native_restore_fl(unsigned long flags);
39
-extern inline void native_restore_fl(unsigned long flags)
44
+extern __always_inline void native_restore_fl(unsigned long flags)
4045 {
4146 asm volatile("push %0 ; popf"
4247 : /* no output */
....@@ -52,6 +57,38 @@
5257 static __always_inline void native_irq_enable(void)
5358 {
5459 asm volatile("sti": : :"memory");
60
+}
61
+
62
+static __always_inline void native_irq_sync(void)
63
+{
64
+ asm volatile("sti ; nop ; cli": : :"memory");
65
+}
66
+
67
+static __always_inline unsigned long native_irq_save(void)
68
+{
69
+ unsigned long flags;
70
+
71
+ flags = native_save_flags();
72
+
73
+ native_irq_disable();
74
+
75
+ return flags;
76
+}
77
+
78
+static __always_inline void native_irq_restore(unsigned long flags)
79
+{
80
+ return native_restore_fl(flags);
81
+}
82
+
83
+static __always_inline int native_irqs_disabled_flags(unsigned long flags)
84
+{
85
+ return !(flags & X86_EFLAGS_IF);
86
+}
87
+
88
+static __always_inline bool native_irqs_disabled(void)
89
+{
90
+ unsigned long flags = native_save_flags();
91
+ return native_irqs_disabled_flags(flags);
5592 }
5693
5794 static inline __cpuidle void native_safe_halt(void)
....@@ -73,26 +110,7 @@
73110 #else
74111 #ifndef __ASSEMBLY__
75112 #include <linux/types.h>
76
-
77
-static __always_inline unsigned long arch_local_save_flags(void)
78
-{
79
- return native_save_fl();
80
-}
81
-
82
-static __always_inline void arch_local_irq_restore(unsigned long flags)
83
-{
84
- native_restore_fl(flags);
85
-}
86
-
87
-static __always_inline void arch_local_irq_disable(void)
88
-{
89
- native_irq_disable();
90
-}
91
-
92
-static __always_inline void arch_local_irq_enable(void)
93
-{
94
- native_irq_enable();
95
-}
113
+#include <asm/irq_pipeline.h>
96114
97115 /*
98116 * Used in the idle loop; sti takes one instruction cycle
....@@ -112,15 +130,6 @@
112130 native_halt();
113131 }
114132
115
-/*
116
- * For spinlocks, etc:
117
- */
118
-static __always_inline unsigned long arch_local_irq_save(void)
119
-{
120
- unsigned long flags = arch_local_save_flags();
121
- arch_local_irq_disable();
122
- return flags;
123
-}
124133 #else
125134
126135 #define ENABLE_INTERRUPTS(x) sti
....@@ -149,7 +158,7 @@
149158 #ifndef __ASSEMBLY__
150159 static __always_inline int arch_irqs_disabled_flags(unsigned long flags)
151160 {
152
- return !(flags & X86_EFLAGS_IF);
161
+ return native_irqs_disabled_flags(flags);
153162 }
154163
155164 static __always_inline int arch_irqs_disabled(void)