Skip to content

Commit 6da63eb

Browse files
jgross1KAGA-KOKO
authored andcommitted
x86/paravirt: Move the pv_irq_ops under the PARAVIRT_XXL umbrella
All of the paravirt ops defined in pv_irq_ops are for Xen PV guests or VSMP only. Define them only if CONFIG_PARAVIRT_XXL is set. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: xen-devel@lists.xenproject.org Cc: virtualization@lists.linux-foundation.org Cc: akataria@vmware.com Cc: rusty@rustcorp.com.au Cc: boris.ostrovsky@oracle.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/20180828074026.820-14-jgross@suse.com
1 parent 9bad565 commit 6da63eb

File tree

9 files changed

+15
-18
lines changed

9 files changed

+15
-18
lines changed

arch/x86/include/asm/irqflags.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static inline __cpuidle void native_halt(void)
6464

6565
#endif
6666

67-
#ifdef CONFIG_PARAVIRT
67+
#ifdef CONFIG_PARAVIRT_XXL
6868
#include <asm/paravirt.h>
6969
#else
7070
#ifndef __ASSEMBLY__
@@ -126,13 +126,7 @@ static inline notrace unsigned long arch_local_irq_save(void)
126126
#ifdef CONFIG_DEBUG_ENTRY
127127
#define SAVE_FLAGS(x) pushfq; popq %rax
128128
#endif
129-
#endif
130-
#endif /* __ASSEMBLY__ */
131-
#endif /* CONFIG_PARAVIRT */
132129

133-
#ifndef CONFIG_PARAVIRT_XXL
134-
#ifdef __ASSEMBLY__
135-
#ifdef CONFIG_X86_64
136130
#define SWAPGS swapgs
137131
/*
138132
* Currently paravirt can't handle swapgs nicely when we

arch/x86/include/asm/paravirt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static inline void write_cr8(unsigned long x)
9191
PVOP_VCALL1(cpu.write_cr8, x);
9292
}
9393
#endif
94-
#endif
9594

9695
static inline void arch_safe_halt(void)
9796
{
@@ -103,7 +102,6 @@ static inline void halt(void)
103102
PVOP_VCALL0(irq.halt);
104103
}
105104

106-
#ifdef CONFIG_PARAVIRT_XXL
107105
static inline void wbinvd(void)
108106
{
109107
PVOP_VCALL0(cpu.wbinvd);
@@ -770,6 +768,7 @@ bool __raw_callee_save___native_vcpu_is_preempted(long cpu);
770768
#define __PV_IS_CALLEE_SAVE(func) \
771769
((struct paravirt_callee_save) { func })
772770

771+
#ifdef CONFIG_PARAVIRT_XXL
773772
static inline notrace unsigned long arch_local_save_flags(void)
774773
{
775774
return PVOP_CALLEE0(unsigned long, irq.save_fl);
@@ -798,6 +797,7 @@ static inline notrace unsigned long arch_local_irq_save(void)
798797
arch_local_irq_disable();
799798
return f;
800799
}
800+
#endif
801801

802802

803803
/* Make sure as little as possible of this mess escapes. */
@@ -884,7 +884,6 @@ extern void default_banner(void);
884884
PARA_SITE(PARA_PATCH(PV_CPU_iret), \
885885
ANNOTATE_RETPOLINE_SAFE; \
886886
jmp PARA_INDIRECT(pv_ops+PV_CPU_iret);)
887-
#endif
888887

889888
#define DISABLE_INTERRUPTS(clobbers) \
890889
PARA_SITE(PARA_PATCH(PV_IRQ_irq_disable), \
@@ -899,6 +898,7 @@ extern void default_banner(void);
899898
ANNOTATE_RETPOLINE_SAFE; \
900899
call PARA_INDIRECT(pv_ops+PV_IRQ_irq_enable); \
901900
PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
901+
#endif
902902

903903
#ifdef CONFIG_X86_64
904904
#ifdef CONFIG_PARAVIRT_XXL

arch/x86/include/asm/paravirt_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ struct pv_cpu_ops {
184184
} __no_randomize_layout;
185185

186186
struct pv_irq_ops {
187+
#ifdef CONFIG_PARAVIRT_XXL
187188
/*
188189
* Get/set interrupt state. save_fl and restore_fl are only
189190
* expected to use X86_EFLAGS_IF; all other bits
@@ -200,7 +201,7 @@ struct pv_irq_ops {
200201

201202
void (*safe_halt)(void);
202203
void (*halt)(void);
203-
204+
#endif
204205
} __no_randomize_layout;
205206

206207
struct pv_mmu_ops {

arch/x86/kernel/asm-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ void common(void) {
6666

6767
#ifdef CONFIG_PARAVIRT
6868
BLANK();
69+
#ifdef CONFIG_PARAVIRT_XXL
6970
OFFSET(PV_IRQ_irq_disable, paravirt_patch_template, irq.irq_disable);
7071
OFFSET(PV_IRQ_irq_enable, paravirt_patch_template, irq.irq_enable);
71-
#ifdef CONFIG_PARAVIRT_XXL
7272
OFFSET(PV_CPU_iret, paravirt_patch_template, cpu.iret);
7373
#endif
7474
OFFSET(PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);

arch/x86/kernel/asm-offsets_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ int main(void)
2525
OFFSET(PV_CPU_usergs_sysret64, paravirt_patch_template,
2626
cpu.usergs_sysret64);
2727
OFFSET(PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs);
28-
#endif
2928
#ifdef CONFIG_DEBUG_ENTRY
3029
OFFSET(PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);
30+
#endif
3131
#endif
3232
BLANK();
3333
#endif

arch/x86/kernel/paravirt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ struct paravirt_patch_template pv_ops = {
373373

374374
.cpu.start_context_switch = paravirt_nop,
375375
.cpu.end_context_switch = paravirt_nop,
376-
#endif /* CONFIG_PARAVIRT_XXL */
377376

378377
/* Irq ops. */
379378
.irq.save_fl = __PV_IS_CALLEE_SAVE(native_save_fl),
@@ -382,6 +381,7 @@ struct paravirt_patch_template pv_ops = {
382381
.irq.irq_enable = __PV_IS_CALLEE_SAVE(native_irq_enable),
383382
.irq.safe_halt = native_safe_halt,
384383
.irq.halt = native_halt,
384+
#endif /* CONFIG_PARAVIRT_XXL */
385385

386386
/* Mmu ops. */
387387
.mmu.read_cr2 = native_read_cr2,

arch/x86/kernel/paravirt_patch_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <asm/paravirt.h>
33

4+
#ifdef CONFIG_PARAVIRT_XXL
45
DEF_NATIVE(irq, irq_disable, "cli");
56
DEF_NATIVE(irq, irq_enable, "sti");
67
DEF_NATIVE(irq, restore_fl, "push %eax; popf");
78
DEF_NATIVE(irq, save_fl, "pushf; pop %eax");
8-
#ifdef CONFIG_PARAVIRT_XXL
99
DEF_NATIVE(cpu, iret, "iret");
1010
#endif
1111
DEF_NATIVE(mmu, read_cr2, "mov %cr2, %eax");
@@ -43,11 +43,11 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)
4343
end = end_##ops##_##x; \
4444
goto patch_site
4545
switch (type) {
46+
#ifdef CONFIG_PARAVIRT_XXL
4647
PATCH_SITE(irq, irq_disable);
4748
PATCH_SITE(irq, irq_enable);
4849
PATCH_SITE(irq, restore_fl);
4950
PATCH_SITE(irq, save_fl);
50-
#ifdef CONFIG_PARAVIRT_XXL
5151
PATCH_SITE(cpu, iret);
5252
#endif
5353
PATCH_SITE(mmu, read_cr2);

arch/x86/kernel/paravirt_patch_64.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
#include <asm/asm-offsets.h>
44
#include <linux/stringify.h>
55

6+
#ifdef CONFIG_PARAVIRT_XXL
67
DEF_NATIVE(irq, irq_disable, "cli");
78
DEF_NATIVE(irq, irq_enable, "sti");
89
DEF_NATIVE(irq, restore_fl, "pushq %rdi; popfq");
910
DEF_NATIVE(irq, save_fl, "pushfq; popq %rax");
11+
#endif
1012
DEF_NATIVE(mmu, read_cr2, "movq %cr2, %rax");
1113
DEF_NATIVE(mmu, read_cr3, "movq %cr3, %rax");
1214
DEF_NATIVE(mmu, write_cr3, "movq %rdi, %cr3");
@@ -51,11 +53,11 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)
5153
end = end_##ops##_##x; \
5254
goto patch_site
5355
switch(type) {
56+
#ifdef CONFIG_PARAVIRT_XXL
5457
PATCH_SITE(irq, restore_fl);
5558
PATCH_SITE(irq, save_fl);
5659
PATCH_SITE(irq, irq_enable);
5760
PATCH_SITE(irq, irq_disable);
58-
#ifdef CONFIG_PARAVIRT_XXL
5961
PATCH_SITE(cpu, usergs_sysret64);
6062
PATCH_SITE(cpu, swapgs);
6163
PATCH_SITE(cpu, wbinvd);

arch/x86/kernel/vsmp_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#define TOPOLOGY_REGISTER_OFFSET 0x10
2828

29-
#if defined CONFIG_PCI && defined CONFIG_PARAVIRT
29+
#if defined CONFIG_PCI && defined CONFIG_PARAVIRT_XXL
3030
/*
3131
* Interrupt control on vSMPowered systems:
3232
* ~AC is a shadow of IF. If IF is 'on' AC should be 'off'

0 commit comments

Comments
 (0)