Skip to content

Commit a27a0a5

Browse files
committed
x86/entry: Cleanup idtentry_enter/exit
Remove the temporary defines and fixup all references. Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent bdcd178 commit a27a0a5

File tree

5 files changed

+26
-31
lines changed

5 files changed

+26
-31
lines changed

arch/x86/entry/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ __visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
248248
{
249249
struct pt_regs *old_regs;
250250
bool inhcall;
251-
idtentry_state_t state;
251+
irqentry_state_t state;
252252

253-
state = idtentry_enter(regs);
253+
state = irqentry_enter(regs);
254254
old_regs = set_irq_regs(regs);
255255

256256
instrumentation_begin();
@@ -266,7 +266,7 @@ __visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
266266
instrumentation_end();
267267
restore_inhcall(inhcall);
268268
} else {
269-
idtentry_exit(regs, state);
269+
irqentry_exit(regs, state);
270270
}
271271
}
272272
#endif /* CONFIG_XEN_PV */

arch/x86/include/asm/idtentry.h

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
#include <asm/irq_stack.h>
1313

14-
/* Temporary defines */
15-
typedef irqentry_state_t idtentry_state_t;
16-
#define idtentry_enter irqentry_enter
17-
#define idtentry_exit irqentry_exit
18-
1914
/**
2015
* DECLARE_IDTENTRY - Declare functions for simple IDT entry points
2116
* No error code pushed by hardware
@@ -45,21 +40,21 @@ typedef irqentry_state_t idtentry_state_t;
4540
* The macro is written so it acts as function definition. Append the
4641
* body with a pair of curly brackets.
4742
*
48-
* idtentry_enter() contains common code which has to be invoked before
49-
* arbitrary code in the body. idtentry_exit() contains common code
43+
* irqentry_enter() contains common code which has to be invoked before
44+
* arbitrary code in the body. irqentry_exit() contains common code
5045
* which has to run before returning to the low level assembly code.
5146
*/
5247
#define DEFINE_IDTENTRY(func) \
5348
static __always_inline void __##func(struct pt_regs *regs); \
5449
\
5550
__visible noinstr void func(struct pt_regs *regs) \
5651
{ \
57-
idtentry_state_t state = idtentry_enter(regs); \
52+
irqentry_state_t state = irqentry_enter(regs); \
5853
\
5954
instrumentation_begin(); \
6055
__##func (regs); \
6156
instrumentation_end(); \
62-
idtentry_exit(regs, state); \
57+
irqentry_exit(regs, state); \
6358
} \
6459
\
6560
static __always_inline void __##func(struct pt_regs *regs)
@@ -101,12 +96,12 @@ static __always_inline void __##func(struct pt_regs *regs, \
10196
__visible noinstr void func(struct pt_regs *regs, \
10297
unsigned long error_code) \
10398
{ \
104-
idtentry_state_t state = idtentry_enter(regs); \
99+
irqentry_state_t state = irqentry_enter(regs); \
105100
\
106101
instrumentation_begin(); \
107102
__##func (regs, error_code); \
108103
instrumentation_end(); \
109-
idtentry_exit(regs, state); \
104+
irqentry_exit(regs, state); \
110105
} \
111106
\
112107
static __always_inline void __##func(struct pt_regs *regs, \
@@ -161,7 +156,7 @@ __visible noinstr void func(struct pt_regs *regs)
161156
* body with a pair of curly brackets.
162157
*
163158
* Contrary to DEFINE_IDTENTRY_ERRORCODE() this does not invoke the
164-
* idtentry_enter/exit() helpers before and after the body invocation. This
159+
* irqentry_enter/exit() helpers before and after the body invocation. This
165160
* needs to be done in the body itself if applicable. Use if extra work
166161
* is required before the enter/exit() helpers are invoked.
167162
*/
@@ -197,15 +192,15 @@ static __always_inline void __##func(struct pt_regs *regs, u8 vector); \
197192
__visible noinstr void func(struct pt_regs *regs, \
198193
unsigned long error_code) \
199194
{ \
200-
idtentry_state_t state = idtentry_enter(regs); \
195+
irqentry_state_t state = irqentry_enter(regs); \
201196
\
202197
instrumentation_begin(); \
203198
irq_enter_rcu(); \
204199
kvm_set_cpu_l1tf_flush_l1d(); \
205200
__##func (regs, (u8)error_code); \
206201
irq_exit_rcu(); \
207202
instrumentation_end(); \
208-
idtentry_exit(regs, state); \
203+
irqentry_exit(regs, state); \
209204
} \
210205
\
211206
static __always_inline void __##func(struct pt_regs *regs, u8 vector)
@@ -229,7 +224,7 @@ static __always_inline void __##func(struct pt_regs *regs, u8 vector)
229224
* DEFINE_IDTENTRY_SYSVEC - Emit code for system vector IDT entry points
230225
* @func: Function name of the entry point
231226
*
232-
* idtentry_enter/exit() and irq_enter/exit_rcu() are invoked before the
227+
* irqentry_enter/exit() and irq_enter/exit_rcu() are invoked before the
233228
* function body. KVM L1D flush request is set.
234229
*
235230
* Runs the function on the interrupt stack if the entry hit kernel mode
@@ -239,15 +234,15 @@ static void __##func(struct pt_regs *regs); \
239234
\
240235
__visible noinstr void func(struct pt_regs *regs) \
241236
{ \
242-
idtentry_state_t state = idtentry_enter(regs); \
237+
irqentry_state_t state = irqentry_enter(regs); \
243238
\
244239
instrumentation_begin(); \
245240
irq_enter_rcu(); \
246241
kvm_set_cpu_l1tf_flush_l1d(); \
247242
run_on_irqstack_cond(__##func, regs, regs); \
248243
irq_exit_rcu(); \
249244
instrumentation_end(); \
250-
idtentry_exit(regs, state); \
245+
irqentry_exit(regs, state); \
251246
} \
252247
\
253248
static noinline void __##func(struct pt_regs *regs)
@@ -268,15 +263,15 @@ static __always_inline void __##func(struct pt_regs *regs); \
268263
\
269264
__visible noinstr void func(struct pt_regs *regs) \
270265
{ \
271-
idtentry_state_t state = idtentry_enter(regs); \
266+
irqentry_state_t state = irqentry_enter(regs); \
272267
\
273268
instrumentation_begin(); \
274269
__irq_enter_raw(); \
275270
kvm_set_cpu_l1tf_flush_l1d(); \
276271
__##func (regs); \
277272
__irq_exit_raw(); \
278273
instrumentation_end(); \
279-
idtentry_exit(regs, state); \
274+
irqentry_exit(regs, state); \
280275
} \
281276
\
282277
static __always_inline void __##func(struct pt_regs *regs)

arch/x86/kernel/kvm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(kvm_read_and_reset_apf_flags);
233233
noinstr bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token)
234234
{
235235
u32 reason = kvm_read_and_reset_apf_flags();
236-
idtentry_state_t state;
236+
irqentry_state_t state;
237237

238238
switch (reason) {
239239
case KVM_PV_REASON_PAGE_NOT_PRESENT:
@@ -243,7 +243,7 @@ noinstr bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token)
243243
return false;
244244
}
245245

246-
state = idtentry_enter(regs);
246+
state = irqentry_enter(regs);
247247
instrumentation_begin();
248248

249249
/*
@@ -264,7 +264,7 @@ noinstr bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token)
264264
}
265265

266266
instrumentation_end();
267-
idtentry_exit(regs, state);
267+
irqentry_exit(regs, state);
268268
return true;
269269
}
270270

arch/x86/kernel/traps.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static noinstr bool handle_bug(struct pt_regs *regs)
245245

246246
DEFINE_IDTENTRY_RAW(exc_invalid_op)
247247
{
248-
idtentry_state_t state;
248+
irqentry_state_t state;
249249

250250
/*
251251
* We use UD2 as a short encoding for 'CALL __WARN', as such
@@ -255,11 +255,11 @@ DEFINE_IDTENTRY_RAW(exc_invalid_op)
255255
if (!user_mode(regs) && handle_bug(regs))
256256
return;
257257

258-
state = idtentry_enter(regs);
258+
state = irqentry_enter(regs);
259259
instrumentation_begin();
260260
handle_invalid_op(regs);
261261
instrumentation_end();
262-
idtentry_exit(regs, state);
262+
irqentry_exit(regs, state);
263263
}
264264

265265
DEFINE_IDTENTRY(exc_coproc_segment_overrun)

arch/x86/mm/fault.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ handle_page_fault(struct pt_regs *regs, unsigned long error_code,
13771377
DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
13781378
{
13791379
unsigned long address = read_cr2();
1380-
idtentry_state_t state;
1380+
irqentry_state_t state;
13811381

13821382
prefetchw(&current->mm->mmap_lock);
13831383

@@ -1412,11 +1412,11 @@ DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
14121412
* code reenabled RCU to avoid subsequent wreckage which helps
14131413
* debugability.
14141414
*/
1415-
state = idtentry_enter(regs);
1415+
state = irqentry_enter(regs);
14161416

14171417
instrumentation_begin();
14181418
handle_page_fault(regs, error_code, address);
14191419
instrumentation_end();
14201420

1421-
idtentry_exit(regs, state);
1421+
irqentry_exit(regs, state);
14221422
}

0 commit comments

Comments
 (0)