2008-07-08 20:01:43

by Cliff Wickman

[permalink] [raw]
Subject: [PATCH] SGI UV: TLB shootdown extended apic mode



From: Cliff Wickman <[email protected]>

Set or clear the UV hub's extended apic mode based on the kernel's setting.
This cannot be done safely in the prom, as the kernel may set the mode.

The kernel's setting of extended apic mode is indicated by global "x2apic".

Diffed against 2.6.26-rc9 (Ingo's tip-latest)

Signed-off-by: Cliff Wickman <[email protected]>
---
arch/x86/kernel/tlb_uv.c | 12 ++++++++++++
include/asm-x86/uv/uv_bau.h | 1 +
include/asm-x86/uv/uv_mmrs.h | 5 +++++
3 files changed, 18 insertions(+)

Index: linux/arch/x86/kernel/tlb_uv.c
===================================================================
--- linux.orig/arch/x86/kernel/tlb_uv.c
+++ linux/arch/x86/kernel/tlb_uv.c
@@ -741,6 +741,18 @@ static int __init uv_init_blade(int blad
uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,
((apicid << 32) | UV_BAU_MESSAGE));
}
+
+ /*
+ * The hub's extended apic mode must agree with the kernel's setting,
+ * which is indicated by global "x2apic".
+ */
+ pa = uv_read_global_mmr64(pnode, UVH_LB_BAU_MISC_CONTROL);
+ if (!x2apic && (pa & UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK))
+ pa &= ~UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK;
+ else if (x2apic && (!(pa & UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK)))
+ pa |= UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK;
+ uv_write_global_mmr64(pnode, UVH_LB_BAU_MISC_CONTROL, pa);
+
return 0;
}

Index: linux/include/asm-x86/uv/uv_bau.h
===================================================================
--- linux.orig/include/asm-x86/uv/uv_bau.h
+++ linux/include/asm-x86/uv/uv_bau.h
@@ -333,5 +333,6 @@ static inline void bau_cpubits_clear(str
extern int uv_flush_tlb_others(cpumask_t *, struct mm_struct *, unsigned long);
extern void uv_bau_message_intr1(void);
extern void uv_bau_timeout_intr1(void);
+extern int x2apic;

#endif /* __ASM_X86_UV_BAU__ */
Index: linux/include/asm-x86/uv/uv_mmrs.h
===================================================================
--- linux.orig/include/asm-x86/uv/uv_mmrs.h
+++ linux/include/asm-x86/uv/uv_mmrs.h
@@ -1291,5 +1291,10 @@ union uvh_si_alias2_overlay_config_u {
} s;
};

+/* ========================================================================= */
+/* UVH_LB_BAU_MISC_CONTROL */
+/* ========================================================================= */
+#define UVH_LB_BAU_MISC_CONTROL 0x320170UL
+#define UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK 0x0000000000000100UL

#endif /* __ASM_X86_UV_MMRS__ */


2008-07-18 16:46:18

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] SGI UV: TLB shootdown extended apic mode


* Cliff Wickman <[email protected]> wrote:

> Set or clear the UV hub's extended apic mode based on the kernel's
> setting. This cannot be done safely in the prom, as the kernel may set
> the mode.
>
> The kernel's setting of extended apic mode is indicated by global
> "x2apic".
>
> Diffed against 2.6.26-rc9 (Ingo's tip-latest)

applied to tip/x86/uv, thanks Cliff.

Ingo

2008-07-18 16:54:05

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] SGI UV: TLB shootdown extended apic mode


* Ingo Molnar <[email protected]> wrote:

> * Cliff Wickman <[email protected]> wrote:
>
> > Set or clear the UV hub's extended apic mode based on the kernel's
> > setting. This cannot be done safely in the prom, as the kernel may
> > set the mode.
> >
> > The kernel's setting of extended apic mode is indicated by global
> > "x2apic".
> >
> > Diffed against 2.6.26-rc9 (Ingo's tip-latest)
>
> applied to tip/x86/uv, thanks Cliff.

fails to build with the attached config:

arch/x86/kernel/built-in.o: In function `uv_bau_init':
tlb_uv.c:(.init.text+0x9982): undefined reference to `x2apic'

so i've not applied it yet.

Ingo


Attachments:
(No filename) (628.00 B)
config (51.94 kB)
Download all attachments