Skip to content

Commit f01b4f4

Browse files
jgross1bp3tk0v
authored andcommitted
x86/paravirt: Introduce new paravirt-base.h header
Move the pv_info related definitions and the declarations of the global paravirt function primitives into a new header file paravirt-base.h. Use that header instead of paravirt_types.h in ptrace.h. Additionally, this is a preparation to reduce the include hell with paravirt enabled. [ bp: Massage commit message. ] Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260105110520.21356-14-jgross@suse.com
1 parent 39965af commit f01b4f4

4 files changed

Lines changed: 34 additions & 24 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
#ifndef _ASM_X86_PARAVIRT_BASE_H
4+
#define _ASM_X86_PARAVIRT_BASE_H
5+
6+
/*
7+
* Wrapper type for pointers to code which uses the non-standard
8+
* calling convention. See PV_CALL_SAVE_REGS_THUNK below.
9+
*/
10+
struct paravirt_callee_save {
11+
void *func;
12+
};
13+
14+
struct pv_info {
15+
#ifdef CONFIG_PARAVIRT_XXL
16+
u16 extra_user_64bit_cs; /* __USER_CS if none */
17+
#endif
18+
const char *name;
19+
};
20+
21+
void default_banner(void);
22+
extern struct pv_info pv_info;
23+
unsigned long paravirt_ret0(void);
24+
#ifdef CONFIG_PARAVIRT_XXL
25+
u64 _paravirt_ident_64(u64);
26+
#endif
27+
#define paravirt_nop ((void *)nop_func)
28+
29+
#endif /* _ASM_X86_PARAVIRT_BASE_H */

arch/x86/include/asm/paravirt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
/* Various instructions on x86 need to be replaced for
55
* para-virtualization: those hooks are defined here. */
66

7+
#ifndef __ASSEMBLER__
8+
#include <asm/paravirt-base.h>
9+
#endif
710
#include <asm/paravirt_types.h>
811

912
#ifdef CONFIG_PARAVIRT
@@ -601,7 +604,6 @@ static __always_inline unsigned long arch_local_irq_save(void)
601604
#undef PVOP_VCALL4
602605
#undef PVOP_CALL4
603606

604-
extern void default_banner(void);
605607
void native_pv_lock_init(void) __init;
606608

607609
#else /* __ASSEMBLER__ */

arch/x86/include/asm/paravirt_types.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef __ASSEMBLER__
88
#include <linux/types.h>
99

10+
#include <asm/paravirt-base.h>
1011
#include <asm/desc_defs.h>
1112
#include <asm/pgtable_types.h>
1213
#include <asm/nospec-branch.h>
@@ -18,23 +19,6 @@ struct cpumask;
1819
struct flush_tlb_info;
1920
struct vm_area_struct;
2021

21-
/*
22-
* Wrapper type for pointers to code which uses the non-standard
23-
* calling convention. See PV_CALL_SAVE_REGS_THUNK below.
24-
*/
25-
struct paravirt_callee_save {
26-
void *func;
27-
};
28-
29-
/* general info */
30-
struct pv_info {
31-
#ifdef CONFIG_PARAVIRT_XXL
32-
u16 extra_user_64bit_cs; /* __USER_CS if none */
33-
#endif
34-
35-
const char *name;
36-
};
37-
3822
#ifdef CONFIG_PARAVIRT_XXL
3923
struct pv_lazy_ops {
4024
/* Set deferred update mode, used for batching operations. */
@@ -226,7 +210,6 @@ struct paravirt_patch_template {
226210
struct pv_lock_ops lock;
227211
} __no_randomize_layout;
228212

229-
extern struct pv_info pv_info;
230213
extern struct paravirt_patch_template pv_ops;
231214

232215
#define paravirt_ptr(op) [paravirt_opptr] "m" (pv_ops.op)
@@ -497,17 +480,13 @@ extern struct paravirt_patch_template pv_ops;
497480
__PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2), \
498481
PVOP_CALL_ARG3(arg3), PVOP_CALL_ARG4(arg4))
499482

500-
unsigned long paravirt_ret0(void);
501483
#ifdef CONFIG_PARAVIRT_XXL
502-
u64 _paravirt_ident_64(u64);
503484
unsigned long pv_native_save_fl(void);
504485
void pv_native_irq_disable(void);
505486
void pv_native_irq_enable(void);
506487
unsigned long pv_native_read_cr2(void);
507488
#endif
508489

509-
#define paravirt_nop ((void *)nop_func)
510-
511490
#endif /* __ASSEMBLER__ */
512491

513492
#define ALT_NOT_XEN ALT_NOT(X86_FEATURE_XENPV)

arch/x86/include/asm/ptrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct pt_regs {
172172
#endif /* !__i386__ */
173173

174174
#ifdef CONFIG_PARAVIRT
175-
#include <asm/paravirt_types.h>
175+
#include <asm/paravirt-base.h>
176176
#endif
177177

178178
#include <asm/proto.h>

0 commit comments

Comments
 (0)