Skip to content

Commit a48777f

Browse files
Eial CzerwackiKAGA-KOKO
authored andcommitted
x86/vsmp: Remove dependency on pv_irq_ops
vSMP dependency on pv_irq_ops has been removed some years ago, but the code still deals with pv_irq_ops. In short, "cap & ctl & (1 << 4)" is always returning 0, so all PARAVIRT/PARAVIRT_XXL code related to that can be removed. However, the rest of the code depends on CONFIG_PCI, so fix it accordingly. Rename set_vsmp_pv_ops to set_vsmp_ctl as the original name does not make sense anymore. Signed-off-by: Eial Czerwacki <eial@scalemp.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Shai Fultheim <shai@scalemp.com> Cc: Juergen Gross <jgross@suse.com> Link: https://lkml.kernel.org/r/1541439114-28297-1-git-send-email-eial@scalemp.com
1 parent b082f2d commit a48777f

File tree

2 files changed

+7
-78
lines changed

2 files changed

+7
-78
lines changed

arch/x86/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ config X86_VSMP
525525
bool "ScaleMP vSMP"
526526
select HYPERVISOR_GUEST
527527
select PARAVIRT
528-
select PARAVIRT_XXL
529528
depends on X86_64 && PCI
530529
depends on X86_EXTENDED_PLATFORM
531530
depends on SMP

arch/x86/kernel/vsmp_64.c

Lines changed: 7 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -26,65 +26,8 @@
2626

2727
#define TOPOLOGY_REGISTER_OFFSET 0x10
2828

29-
#if defined CONFIG_PCI && defined CONFIG_PARAVIRT_XXL
30-
/*
31-
* Interrupt control on vSMPowered systems:
32-
* ~AC is a shadow of IF. If IF is 'on' AC should be 'off'
33-
* and vice versa.
34-
*/
35-
36-
asmlinkage __visible unsigned long vsmp_save_fl(void)
37-
{
38-
unsigned long flags = native_save_fl();
39-
40-
if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))
41-
flags &= ~X86_EFLAGS_IF;
42-
return flags;
43-
}
44-
PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
45-
46-
__visible void vsmp_restore_fl(unsigned long flags)
47-
{
48-
if (flags & X86_EFLAGS_IF)
49-
flags &= ~X86_EFLAGS_AC;
50-
else
51-
flags |= X86_EFLAGS_AC;
52-
native_restore_fl(flags);
53-
}
54-
PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
55-
56-
asmlinkage __visible void vsmp_irq_disable(void)
57-
{
58-
unsigned long flags = native_save_fl();
59-
60-
native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
61-
}
62-
PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
63-
64-
asmlinkage __visible void vsmp_irq_enable(void)
65-
{
66-
unsigned long flags = native_save_fl();
67-
68-
native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
69-
}
70-
PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);
71-
72-
static unsigned __init vsmp_patch(u8 type, void *ibuf,
73-
unsigned long addr, unsigned len)
74-
{
75-
switch (type) {
76-
case PARAVIRT_PATCH(irq.irq_enable):
77-
case PARAVIRT_PATCH(irq.irq_disable):
78-
case PARAVIRT_PATCH(irq.save_fl):
79-
case PARAVIRT_PATCH(irq.restore_fl):
80-
return paravirt_patch_default(type, ibuf, addr, len);
81-
default:
82-
return native_patch(type, ibuf, addr, len);
83-
}
84-
85-
}
86-
87-
static void __init set_vsmp_pv_ops(void)
29+
#ifdef CONFIG_PCI
30+
static void __init set_vsmp_ctl(void)
8831
{
8932
void __iomem *address;
9033
unsigned int cap, ctl, cfg;
@@ -109,28 +52,12 @@ static void __init set_vsmp_pv_ops(void)
10952
}
11053
#endif
11154

112-
if (cap & ctl & (1 << 4)) {
113-
/* Setup irq ops and turn on vSMP IRQ fastpath handling */
114-
pv_ops.irq.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable);
115-
pv_ops.irq.irq_enable = PV_CALLEE_SAVE(vsmp_irq_enable);
116-
pv_ops.irq.save_fl = PV_CALLEE_SAVE(vsmp_save_fl);
117-
pv_ops.irq.restore_fl = PV_CALLEE_SAVE(vsmp_restore_fl);
118-
pv_ops.init.patch = vsmp_patch;
119-
ctl &= ~(1 << 4);
120-
}
12155
writel(ctl, address + 4);
12256
ctl = readl(address + 4);
12357
pr_info("vSMP CTL: control set to:0x%08x\n", ctl);
12458

12559
early_iounmap(address, 8);
12660
}
127-
#else
128-
static void __init set_vsmp_pv_ops(void)
129-
{
130-
}
131-
#endif
132-
133-
#ifdef CONFIG_PCI
13461
static int is_vsmp = -1;
13562

13663
static void __init detect_vsmp_box(void)
@@ -164,11 +91,14 @@ static int is_vsmp_box(void)
16491
{
16592
return 0;
16693
}
94+
static void __init set_vsmp_ctl(void)
95+
{
96+
}
16797
#endif
16898

16999
static void __init vsmp_cap_cpus(void)
170100
{
171-
#if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP)
101+
#if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
172102
void __iomem *address;
173103
unsigned int cfg, topology, node_shift, maxcpus;
174104

@@ -221,6 +151,6 @@ void __init vsmp_init(void)
221151

222152
vsmp_cap_cpus();
223153

224-
set_vsmp_pv_ops();
154+
set_vsmp_ctl();
225155
return;
226156
}

0 commit comments

Comments
 (0)