linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected
@ 2018-11-01 18:27 Eial Czerwacki
  2018-11-02  7:13 ` Juergen Gross
  2018-11-04 21:05 ` Thomas Gleixner
  0 siblings, 2 replies; 4+ messages in thread
From: Eial Czerwacki @ 2018-11-01 18:27 UTC (permalink / raw)
  To: LKML
  Cc: Juergen Gross, Thomas Gleixner, Randy Dunlap,
	Shai Fultheim (Shai@ScaleMP.com),
	Andrew Morton, broonie, mhocko, Stephen Rothwell, linux-next,
	linux-fsdevel, linux-mm, mm-commits, X86 ML, Oren Twaig

vsmp dependency on pv_irq_ops removed some years ago, so now let's clean
it up from vsmp_64.c.

In short, "cap & ctl & (1 << 4)" was always returning 0, as such we can
remove all the PARAVIRT/PARAVIRT_XXL code handling that.

However, the rest of the code depends on CONFIG_PCI, so fix it accordingly.
in addition, rename set_vsmp_pv_ops to set_vsmp_ctl.

Signed-off-by: Eial Czerwacki <eial@scalemp.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
---
 arch/x86/Kconfig          |  1 -
 arch/x86/kernel/vsmp_64.c | 84
++++-------------------------------------------
 2 files changed, 7 insertions(+), 78 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c51c989..4b187ca 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -524,7 +524,6 @@ config X86_VSMP
        bool "ScaleMP vSMP"
        select HYPERVISOR_GUEST
        select PARAVIRT
-       select PARAVIRT_XXL
        depends on X86_64 && PCI
        depends on X86_EXTENDED_PLATFORM
        depends on SMP
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 1eae5af..4862576 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -26,65 +26,8 @@

 #define TOPOLOGY_REGISTER_OFFSET 0x10

-#if defined CONFIG_PCI && defined CONFIG_PARAVIRT_XXL
-/*
- * Interrupt control on vSMPowered systems:
- * ~AC is a shadow of IF.  If IF is 'on' AC should be 'off'
- * and vice versa.
- */
-
-asmlinkage __visible unsigned long vsmp_save_fl(void)
-{
-       unsigned long flags = native_save_fl();
-
-       if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))
-               flags &= ~X86_EFLAGS_IF;
-       return flags;
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
-
-__visible void vsmp_restore_fl(unsigned long flags)
-{
-       if (flags & X86_EFLAGS_IF)
-               flags &= ~X86_EFLAGS_AC;
-       else
-               flags |= X86_EFLAGS_AC;
-       native_restore_fl(flags);
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
-
-asmlinkage __visible void vsmp_irq_disable(void)
-{
-       unsigned long flags = native_save_fl();
-
-       native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
-
-asmlinkage __visible void vsmp_irq_enable(void)
-{
-       unsigned long flags = native_save_fl();
-
-       native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);
-
-static unsigned __init vsmp_patch(u8 type, void *ibuf,
-                                 unsigned long addr, unsigned len)
-{
-       switch (type) {
-       case PARAVIRT_PATCH(irq.irq_enable):
-       case PARAVIRT_PATCH(irq.irq_disable):
-       case PARAVIRT_PATCH(irq.save_fl):
-       case PARAVIRT_PATCH(irq.restore_fl):
-               return paravirt_patch_default(type, ibuf, addr, len);
-       default:
-               return native_patch(type, ibuf, addr, len);
-       }
-
-}
-
-static void __init set_vsmp_pv_ops(void)
+#if defined CONFIG_PCI
+static void __init set_vsmp_ctl(void)
 {
        void __iomem *address;
        unsigned int cap, ctl, cfg;
@@ -109,28 +52,12 @@ static void __init set_vsmp_pv_ops(void)
        }
 #endif

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

        early_iounmap(address, 8);
 }
-#else
-static void __init set_vsmp_pv_ops(void)
-{
-}
-#endif
-
-#ifdef CONFIG_PCI
 static int is_vsmp = -1;

 static void __init detect_vsmp_box(void)
@@ -164,11 +91,14 @@ static int is_vsmp_box(void)
 {
        return 0;
 }
+static void __init set_vsmp_ctl(void)
+{
+}
 #endif

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

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

        vsmp_cap_cpus();

-       set_vsmp_pv_ops();
+       set_vsmp_ctl();
        return;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected
  2018-11-01 18:27 [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected Eial Czerwacki
@ 2018-11-02  7:13 ` Juergen Gross
  2018-11-04 21:05 ` Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2018-11-02  7:13 UTC (permalink / raw)
  To: Eial Czerwacki, LKML
  Cc: Thomas Gleixner, Randy Dunlap, Shai Fultheim (Shai@ScaleMP.com),
	Andrew Morton, broonie, mhocko, Stephen Rothwell, linux-next,
	linux-fsdevel, linux-mm, mm-commits, X86 ML, Oren Twaig

On 01/11/2018 19:27, Eial Czerwacki wrote:
> vsmp dependency on pv_irq_ops removed some years ago, so now let's clean
> it up from vsmp_64.c.
> 
> In short, "cap & ctl & (1 << 4)" was always returning 0, as such we can
> remove all the PARAVIRT/PARAVIRT_XXL code handling that.
> 
> However, the rest of the code depends on CONFIG_PCI, so fix it accordingly.
> in addition, rename set_vsmp_pv_ops to set_vsmp_ctl.
> 
> Signed-off-by: Eial Czerwacki <eial@scalemp.com>
> Acked-by: Shai Fultheim <shai@scalemp.com>

While I'm still thinking selection of HYPERVISOR_GUEST and PARAVIRT
is a little bit strange, you can add:

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected
  2018-11-01 18:27 [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected Eial Czerwacki
  2018-11-02  7:13 ` Juergen Gross
@ 2018-11-04 21:05 ` Thomas Gleixner
  2018-11-05  6:39   ` Eial Czerwacki
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2018-11-04 21:05 UTC (permalink / raw)
  To: Eial Czerwacki
  Cc: LKML, Juergen Gross, Randy Dunlap,
	Shai Fultheim (Shai@ScaleMP.com),
	Andrew Morton, broonie, mhocko, Stephen Rothwell, linux-next,
	linux-fsdevel, linux-mm, mm-commits, X86 ML, Oren Twaig

Eial,

On Thu, 1 Nov 2018, Eial Czerwacki wrote:

> Subject: x86/build: Build VSMP support only if CONFIG_PCI is selected

That's not what the patch does, right?

> vsmp dependency on pv_irq_ops removed some years ago, so now let's clean
> it up from vsmp_64.c.
> 
> In short, "cap & ctl & (1 << 4)" was always returning 0, as such we can
> remove all the PARAVIRT/PARAVIRT_XXL code handling that.
> 
> However, the rest of the code depends on CONFIG_PCI, so fix it accordingly.
> in addition, rename set_vsmp_pv_ops to set_vsmp_ctl.
> 
> Signed-off-by: Eial Czerwacki <eial@scalemp.com>
> Acked-by: Shai Fultheim <shai@scalemp.com>

Unfortunately that patch does not apply. It's white space damaged, i.e. all
tabs are converted to spaces.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected
  2018-11-04 21:05 ` Thomas Gleixner
@ 2018-11-05  6:39   ` Eial Czerwacki
  0 siblings, 0 replies; 4+ messages in thread
From: Eial Czerwacki @ 2018-11-05  6:39 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Juergen Gross, Randy Dunlap,
	Shai Fultheim (Shai@ScaleMP.com),
	Andrew Morton, broonie, mhocko, Stephen Rothwell, linux-next,
	linux-fsdevel, linux-mm, mm-commits, X86 ML, Oren Twaig

Greetings Thomas,

On 11/04/2018 11:05 PM, Thomas Gleixner wrote:
> Eial,
> 
> On Thu, 1 Nov 2018, Eial Czerwacki wrote:
> 
>> Subject: x86/build: Build VSMP support only if CONFIG_PCI is selected
> 
> That's not what the patch does, right?
> 
you are correct, I'll resend it with a more appropriate subject.

>> vsmp dependency on pv_irq_ops removed some years ago, so now let's clean
>> it up from vsmp_64.c.
>>
>> In short, "cap & ctl & (1 << 4)" was always returning 0, as such we can
>> remove all the PARAVIRT/PARAVIRT_XXL code handling that.
>>
>> However, the rest of the code depends on CONFIG_PCI, so fix it accordingly.
>> in addition, rename set_vsmp_pv_ops to set_vsmp_ctl.
>>
>> Signed-off-by: Eial Czerwacki <eial@scalemp.com>
>> Acked-by: Shai Fultheim <shai@scalemp.com>
> 
> Unfortunately that patch does not apply. It's white space damaged, i.e. all
> tabs are converted to spaces.
> 
> Thanks,
> 
> 	tglx
> 

weird, it got applied without any issues on latest git, I'll verify it
applies well.

Eial.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-05  6:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 18:27 [PATCH v2] x86/build: Build VSMP support only if CONFIG_PCI is selected Eial Czerwacki
2018-11-02  7:13 ` Juergen Gross
2018-11-04 21:05 ` Thomas Gleixner
2018-11-05  6:39   ` Eial Czerwacki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).