These patches support upcoming UV systems that do not have a UV HUB.
* Save OEM_ID from ACPI MADT probe * Return UV Hubless System Type * Add return code to UV BIOS Init function * Setup UV functions for Hubless UV Systems * Add UV Hubbed/Hubless Proc FS Files * Decode UVsystab Info * Account for UV Hubless in is_uvX_hub Ops
--
Save the OEM_ID and OEM_TABLE_ID passed to the apic driver probe function for later use. Also, convert the char list arg passed from the kernel to a true null-terminated string.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- arch/x86/kernel/apic/x2apic_uv_x.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -14,6 +14,7 @@ #include <linux/memory.h> #include <linux/export.h> #include <linux/pci.h> +#include <linux/acpi.h>
#include <asm/e820/api.h> #include <asm/uv/uv_mmrs.h> @@ -31,6 +32,10 @@ static u64 gru_dist_base, gru_first_no static u64 gru_dist_lmask, gru_dist_umask; static union uvh_apicid uvh_apicid;
+/* Unpack OEM/TABLE ID's to be NULL terminated strings */ +static u8 oem_id[ACPI_OEM_ID_SIZE + 1]; +static u8 oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; + /* Information derived from CPUID: */ static struct { unsigned int apicid_shift; @@ -248,11 +253,20 @@ static void __init uv_set_apicid_hibit(v } }
-static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static void __init uv_stringify(int len, char *to, char *from) +{ + /* Relies on 'to' being NULL chars so result will be NULL terminated */ + strncpy(to, from, len-1); +} + +static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id) { int pnodeid; int uv_apic;
+ uv_stringify(sizeof(oem_id), oem_id, _oem_id); + uv_stringify(sizeof(oem_table_id), oem_table_id, _oem_table_id); + if (strncmp(oem_id, "SGI", 3) != 0) { if (strncmp(oem_id, "NSGI", 4) == 0) { uv_hubless_system = true;
--
Return the type of UV hubless system for UV specific code that depends on that. Use a define to indicate the change in arg type for this function in uv.h. Add a function to convert UV system type to bit pattern needed for is_uv_hubless().
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- v2: remove is_uv_hubless define; remove leading '_' from _is_uv_hubless --- arch/x86/include/asm/uv/uv.h | 12 ++++++++++-- arch/x86/kernel/apic/x2apic_uv_x.c | 27 ++++++++++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-)
--- linux.orig/arch/x86/include/asm/uv/uv.h +++ linux/arch/x86/include/asm/uv/uv.h @@ -12,6 +12,14 @@ struct mm_struct; #ifdef CONFIG_X86_UV #include <linux/efi.h>
+static inline int uv(int uvtype) +{ + /* uv(0) is "any" */ + if (uvtype >= 0 && uvtype <= 30) + return 1 << uvtype; + return 1; +} + extern unsigned long uv_systab_phys;
extern enum uv_system_type get_uv_system_type(void); @@ -20,7 +28,7 @@ static inline bool is_early_uv_system(vo return uv_systab_phys && uv_systab_phys != EFI_INVALID_TABLE_ADDR; } extern int is_uv_system(void); -extern int is_uv_hubless(void); +extern int is_uv_hubless(int uvtype); extern void uv_cpu_init(void); extern void uv_nmi_init(void); extern void uv_system_init(void); @@ -32,7 +40,7 @@ extern const struct cpumask *uv_flush_tl static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; } static inline bool is_early_uv_system(void) { return 0; } static inline int is_uv_system(void) { return 0; } -static inline int is_uv_hubless(void) { return 0; } +static inline int is_uv_hubless(int uv) { return 0; } static inline void uv_cpu_init(void) { } static inline void uv_system_init(void) { } static inline const struct cpumask * --- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -26,7 +26,7 @@ static DEFINE_PER_CPU(int, x2apic_extra_bits);
static enum uv_system_type uv_system_type; -static bool uv_hubless_system; +static int uv_hubless_system; static u64 gru_start_paddr, gru_end_paddr; static u64 gru_dist_base, gru_first_node_paddr = -1LL, gru_last_node_paddr; static u64 gru_dist_lmask, gru_dist_umask; @@ -268,11 +268,20 @@ static int __init uv_acpi_madt_oem_check uv_stringify(sizeof(oem_table_id), oem_table_id, _oem_table_id);
if (strncmp(oem_id, "SGI", 3) != 0) { - if (strncmp(oem_id, "NSGI", 4) == 0) { - uv_hubless_system = true; - pr_info("UV: OEM IDs %s/%s, HUBLESS\n", - oem_id, oem_table_id); - } + if (strncmp(oem_id, "NSGI", 4) != 0) + return 0; + + /* UV4 Hubless, CH, (0x11:UV4+Any) */ + if (strncmp(oem_id, "NSGI4", 5) == 0) + uv_hubless_system = 0x11; + + /* UV3 Hubless, UV300/MC990X w/o hub (0x9:UV3+Any) */ + else + uv_hubless_system = 0x9; + + pr_info("UV: OEM IDs %s/%s, HUBLESS(0x%x)\n", + oem_id, oem_table_id, uv_hubless_system); + return 0; }
@@ -350,9 +359,9 @@ int is_uv_system(void) } EXPORT_SYMBOL_GPL(is_uv_system);
-int is_uv_hubless(void) +int is_uv_hubless(int uvtype) { - return uv_hubless_system; + return (uv_hubless_system & uvtype); } EXPORT_SYMBOL_GPL(is_uv_hubless);
@@ -1592,7 +1601,7 @@ static void __init uv_system_init_hub(vo */ void __init uv_system_init(void) { - if (likely(!is_uv_system() && !is_uv_hubless())) + if (likely(!is_uv_system() && !is_uv_hubless(1))) return;
if (is_uv_system())
--
Add a return code to the UV BIOS init function that indicates the successful initialization of the kernel/BIOS callback interface.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- arch/x86/include/asm/uv/bios.h | 2 +- arch/x86/platform/uv/bios_uv.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
--- linux.orig/arch/x86/include/asm/uv/bios.h +++ linux/arch/x86/include/asm/uv/bios.h @@ -138,7 +138,7 @@ extern s64 uv_bios_change_memprotect(u64 extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *); extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus);
-extern void uv_bios_init(void); +extern int uv_bios_init(void);
extern unsigned long sn_rtc_cycles_per_second; extern int uv_type; --- linux.orig/arch/x86/platform/uv/bios_uv.c +++ linux/arch/x86/platform/uv/bios_uv.c @@ -184,20 +184,20 @@ int uv_bios_set_legacy_vga_target(bool d } EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target);
-void uv_bios_init(void) +int uv_bios_init(void) { uv_systab = NULL; if ((uv_systab_phys == EFI_INVALID_TABLE_ADDR) || !uv_systab_phys || efi_runtime_disabled()) { pr_crit("UV: UVsystab: missing\n"); - return; + return -EEXIST; }
uv_systab = ioremap(uv_systab_phys, sizeof(struct uv_systab)); if (!uv_systab || strncmp(uv_systab->signature, UV_SYSTAB_SIG, 4)) { pr_err("UV: UVsystab: bad signature!\n"); iounmap(uv_systab); - return; + return -EINVAL; }
/* Starting with UV4 the UV systab size is variable */ @@ -208,8 +208,9 @@ void uv_bios_init(void) uv_systab = ioremap(uv_systab_phys, size); if (!uv_systab) { pr_err("UV: UVsystab: ioremap(%d) failed!\n", size); - return; + return -EFAULT; } } pr_info("UV: UVsystab: Revision:%x\n", uv_systab->revision); + return 0; }
--
Add more support for UV systems that do not contain a UV Hub (AKA "hubless"). This update adds support for additional functions required:
Use PCH NMI handler instead of a UV Hub NMI handler.
Initialize the UV BIOS callback interface used to support specific UV functions.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- arch/x86/kernel/apic/x2apic_uv_x.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1457,6 +1457,20 @@ static void __init build_socket_tables(v } }
+/* Initialize UV hubless systems */ +static __init int uv_system_init_hubless(void) +{ + int rc; + + /* Setup PCH NMI handler */ + uv_nmi_setup_hubless(); + + /* Init kernel/BIOS interface */ + rc = uv_bios_init(); + + return rc; +} + static void __init uv_system_init_hub(void) { struct uv_hub_info_s hub_info = {0}; @@ -1596,8 +1610,8 @@ static void __init uv_system_init_hub(vo }
/* - * There is a small amount of UV specific code needed to initialize a - * UV system that does not have a "UV HUB" (referred to as "hubless"). + * There is a different code path needed to initialize a UV system that does + * not have a "UV HUB" (referred to as "hubless"). */ void __init uv_system_init(void) { @@ -1607,7 +1621,7 @@ void __init uv_system_init(void) if (is_uv_system()) uv_system_init_hub(); else - uv_nmi_setup_hubless(); + uv_system_init_hubless(); }
apic_driver(apic_x2apic_uv_x);
--
Indicate to UV user utilities that UV hubless support is available on this system via the existing /proc infterface. The current interface is maintained with the addition of new /proc leaves ("hubbed" and "hubless") that contain the specific type of UV arch this one is.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- v2: remove is_uv_hubbed define; remove leading '_' from _is_uv_hubbed --- arch/x86/include/asm/uv/uv.h | 4 + arch/x86/kernel/apic/x2apic_uv_x.c | 93 ++++++++++++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 1 deletion(-)
--- linux.orig/arch/x86/include/asm/uv/uv.h +++ linux/arch/x86/include/asm/uv/uv.h @@ -12,6 +12,8 @@ struct mm_struct; #ifdef CONFIG_X86_UV #include <linux/efi.h>
+#define UV_PROC_NODE "sgi_uv" + static inline int uv(int uvtype) { /* uv(0) is "any" */ @@ -28,6 +30,7 @@ static inline bool is_early_uv_system(vo return uv_systab_phys && uv_systab_phys != EFI_INVALID_TABLE_ADDR; } extern int is_uv_system(void); +extern int is_uv_hubbed(int uvtype); extern int is_uv_hubless(int uvtype); extern void uv_cpu_init(void); extern void uv_nmi_init(void); @@ -40,6 +43,7 @@ extern const struct cpumask *uv_flush_tl static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; } static inline bool is_early_uv_system(void) { return 0; } static inline int is_uv_system(void) { return 0; } +static inline int is_uv_hubbed(int uv) { return 0; } static inline int is_uv_hubless(int uv) { return 0; } static inline void uv_cpu_init(void) { } static inline void uv_system_init(void) { } --- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -26,6 +26,7 @@ static DEFINE_PER_CPU(int, x2apic_extra_bits);
static enum uv_system_type uv_system_type; +static int uv_hubbed_system; static int uv_hubless_system; static u64 gru_start_paddr, gru_end_paddr; static u64 gru_dist_base, gru_first_node_paddr = -1LL, gru_last_node_paddr; @@ -309,6 +310,24 @@ static int __init uv_acpi_madt_oem_check if (uv_hub_info->hub_revision == 0) goto badbios;
+ switch (uv_hub_info->hub_revision) { + case UV4_HUB_REVISION_BASE: + uv_hubbed_system = 0x11; + break; + + case UV3_HUB_REVISION_BASE: + uv_hubbed_system = 0x9; + break; + + case UV2_HUB_REVISION_BASE: + uv_hubbed_system = 0x5; + break; + + case UV1_HUB_REVISION_BASE: + uv_hubbed_system = 0x3; + break; + } + pnodeid = early_get_pnodeid(); early_get_apic_socketid_shift();
@@ -359,6 +378,12 @@ int is_uv_system(void) } EXPORT_SYMBOL_GPL(is_uv_system);
+int is_uv_hubbed(int uvtype) +{ + return (uv_hubbed_system & uvtype); +} +EXPORT_SYMBOL_GPL(is_uv_hubbed); + int is_uv_hubless(int uvtype) { return (uv_hubless_system & uvtype); @@ -1457,6 +1482,68 @@ static void __init build_socket_tables(v } }
+/* Setup user proc fs files */ +static int proc_hubbed_show(struct seq_file *file, void *data) +{ + seq_printf(file, "0x%x\n", uv_hubbed_system); + return 0; +} + +static int proc_hubless_show(struct seq_file *file, void *data) +{ + seq_printf(file, "0x%x\n", uv_hubless_system); + return 0; +} + +static int proc_oemid_show(struct seq_file *file, void *data) +{ + seq_printf(file, "%s/%s\n", oem_id, oem_table_id); + return 0; +} + +static int proc_hubbed_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_hubbed_show, (void *)NULL); +} + +static int proc_hubless_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_hubless_show, (void *)NULL); +} + +static int proc_oemid_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_oemid_show, (void *)NULL); +} + +/* (struct is "non-const" as open function is set at runtime) */ +static struct file_operations proc_version_fops = { + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_oemid_fops = { + .open = proc_oemid_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static __init void uv_setup_proc_files(int hubless) +{ + struct proc_dir_entry *pde; + char *name = hubless ? "hubless" : "hubbed"; + + pde = proc_mkdir(UV_PROC_NODE, NULL); + proc_create("oemid", 0, pde, &proc_oemid_fops); + proc_create(name, 0, pde, &proc_version_fops); + if (hubless) + proc_version_fops.open = proc_hubless_open; + else + proc_version_fops.open = proc_hubbed_open; +} + /* Initialize UV hubless systems */ static __init int uv_system_init_hubless(void) { @@ -1468,6 +1555,10 @@ static __init int uv_system_init_hubless /* Init kernel/BIOS interface */ rc = uv_bios_init();
+ /* Create user access node if UVsystab available */ + if (rc >= 0) + uv_setup_proc_files(1); + return rc; }
@@ -1596,7 +1687,7 @@ static void __init uv_system_init_hub(vo uv_nmi_setup(); uv_cpu_init(); uv_scir_register_cpu_notifier(); - proc_mkdir("sgi_uv", NULL); + uv_setup_proc_files(0);
/* Register Legacy VGA I/O redirection handler: */ pci_register_set_vga_state(uv_set_vga_state);
--
Decode the hubless UVsystab passed from BIOS to the kernel saving pertinent info in a similar manner that hubbed UVsystabs are decoded.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- arch/x86/kernel/apic/x2apic_uv_x.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i;
- if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE) + /* Select only UV4 (hubbed or hubless) and higher */ + if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4)) return 0; /* No extended UVsystab required */
st = uv_systab; @@ -1554,8 +1555,19 @@ static __init int uv_system_init_hubless
/* Init kernel/BIOS interface */ rc = uv_bios_init(); + if (rc < 0) { + pr_err("UV: BIOS init error:%d\n", rc); + return rc; + } + + /* Process UVsystab */ + rc = decode_uv_systab(); + if (rc < 0) { + pr_err("UV: UVsystab decode error:%d\n", rc); + return rc; + }
- /* Create user access node if UVsystab available */ + /* Create user access node */ if (rc >= 0) uv_setup_proc_files(1);
--
On Thu, Sep 05, 2019 at 08:02:58AM -0500, Mike Travis wrote:
Decode the hubless UVsystab passed from BIOS to the kernel saving pertinent info in a similar manner that hubbed UVsystabs are decoded.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org
arch/x86/kernel/apic/x2apic_uv_x.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
If you are trying to get one of my automated "WTF: patch XXXX was seriously submitted to be applied to the stable tree?" emails, you are on track for it...
Please go read the documentation link I sent you last time and figure out how you can justify any of this patch series for a stable kernel tree.
Also, nit:
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i;
- if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE)
- /* Select only UV4 (hubbed or hubless) and higher */
- if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4)) return 0; /* No extended UVsystab required */
st = uv_systab; @@ -1554,8 +1555,19 @@ static __init int uv_system_init_hubless /* Init kernel/BIOS interface */ rc = uv_bios_init();
- if (rc < 0) {
pr_err("UV: BIOS init error:%d\n", rc);
Why isn't that function printing an error?
return rc;
- }
- /* Process UVsystab */
- rc = decode_uv_systab();
- if (rc < 0) {
pr_err("UV: UVsystab decode error:%d\n", rc);
Same here, have the function itself print the error, makes this type of stuff much cleaner.
greg k-h
On 9/5/2019 7:16 AM, Greg KH wrote:
On Thu, Sep 05, 2019 at 08:02:58AM -0500, Mike Travis wrote:
Decode the hubless UVsystab passed from BIOS to the kernel saving pertinent info in a similar manner that hubbed UVsystabs are decoded.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org
arch/x86/kernel/apic/x2apic_uv_x.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
If you are trying to get one of my automated "WTF: patch XXXX was seriously submitted to be applied to the stable tree?" emails, you are on track for it...
Please go read the documentation link I sent you last time and figure out how you can justify any of this patch series for a stable kernel tree.
Is it because it has fixes for new hardware? If so, then I'll quit submitting them to stable (we've had requests from distros for all updates be in the stable tree for acceptance). Otherwise I thought it does comply with:
" - To have the patch automatically included in the stable tree, add the tag Cc: stable@vger.kernel.org in the sign-off area. Once the patch is merged it will be applied to the stable tree without anything else needing to be done by the author or subsystem maintainer."
Or is there some other reason that I'm not understanding?
Also, nit:
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i;
- if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE)
- /* Select only UV4 (hubbed or hubless) and higher */
- if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4)) return 0; /* No extended UVsystab required */
st = uv_systab; @@ -1554,8 +1555,19 @@ static __init int uv_system_init_hubless /* Init kernel/BIOS interface */ rc = uv_bios_init();
- if (rc < 0) {
pr_err("UV: BIOS init error:%d\n", rc);
Why isn't that function printing an error?
return rc;
- }
- /* Process UVsystab */
- rc = decode_uv_systab();
- if (rc < 0) {
pr_err("UV: UVsystab decode error:%d\n", rc);
Same here, have the function itself print the error, makes this type of stuff much cleaner.
You're right this would be much cleaner. Mostly this was done because of the rarity of an error here, and the specifics (BIOS failures) usually cannot be dealt with by users. The system log is captured as part of the error and packaged with other fault details that are analyzed internally.
But I will make the changes you are suggesting. And thanks.
greg k-h
On 9/5/2019 7:47 AM, Mike Travis wrote:
Also, nit:
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i; - if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE) + /* Select only UV4 (hubbed or hubless) and higher */ + if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4)) return 0; /* No extended UVsystab required */ st = uv_systab; @@ -1554,8 +1555,19 @@ static __init int uv_system_init_hubless /* Init kernel/BIOS interface */ rc = uv_bios_init(); + if (rc < 0) { + pr_err("UV: BIOS init error:%d\n", rc);
Why isn't that function printing an error?
+ return rc; + }
+ /* Process UVsystab */ + rc = decode_uv_systab(); + if (rc < 0) { + pr_err("UV: UVsystab decode error:%d\n", rc);
Same here, have the function itself print the error, makes this type of stuff much cleaner.
Turns out both functions already print an error message for each instance of an error. The only redundancy is the caller also printing an error with just the numeric error code. Shall I remove that?
On Thu, Sep 05, 2019 at 09:43:57AM -0700, Mike Travis wrote:
On 9/5/2019 7:47 AM, Mike Travis wrote:
Also, nit:
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i; - if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE) + /* Select only UV4 (hubbed or hubless) and higher */ + if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4)) return 0; /* No extended UVsystab required */ st = uv_systab; @@ -1554,8 +1555,19 @@ static __init int uv_system_init_hubless /* Init kernel/BIOS interface */ rc = uv_bios_init(); + if (rc < 0) { + pr_err("UV: BIOS init error:%d\n", rc);
Why isn't that function printing an error?
+ return rc; + }
+ /* Process UVsystab */ + rc = decode_uv_systab(); + if (rc < 0) { + pr_err("UV: UVsystab decode error:%d\n", rc);
Same here, have the function itself print the error, makes this type of stuff much cleaner.
Turns out both functions already print an error message for each instance of an error. The only redundancy is the caller also printing an error with just the numeric error code. Shall I remove that?
Of course you should, why would you want to see multiple error messages for the same single error?
greg k-h
On Thu, Sep 05, 2019 at 07:47:34AM -0700, Mike Travis wrote:
On 9/5/2019 7:16 AM, Greg KH wrote:
On Thu, Sep 05, 2019 at 08:02:58AM -0500, Mike Travis wrote:
Decode the hubless UVsystab passed from BIOS to the kernel saving pertinent info in a similar manner that hubbed UVsystabs are decoded.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org
arch/x86/kernel/apic/x2apic_uv_x.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
If you are trying to get one of my automated "WTF: patch XXXX was seriously submitted to be applied to the stable tree?" emails, you are on track for it...
Please go read the documentation link I sent you last time and figure out how you can justify any of this patch series for a stable kernel tree.
Is it because it has fixes for new hardware? If so, then I'll quit submitting them to stable (we've had requests from distros for all updates be in the stable tree for acceptance). Otherwise I thought it does comply with:
" - To have the patch automatically included in the stable tree, add the tag Cc: stable@vger.kernel.org in the sign-off area. Once the patch is merged it will be applied to the stable tree without anything else needing to be done by the author or subsystem maintainer."
Or is there some other reason that I'm not understanding?
Yes, that's how you get a patch applied, but how in the world does all of the patches in this series actually meet the requirements of a patch that should be applied to the stable kernel tree?
I see no regression fixes, no new device ids, no bug fixes. Only support for new hardware, i.e. a new feature to the kernel for something that never worked in the first place.
And yes, distros do request bugfixes to get added to stable trees, that's great, but I fail to understand how any of these patches are "bug fixes". Maybe you need to work on your changelog texts...
good luck!
greg k-h
On Thu, Sep 05, 2019 at 04:16:34PM +0200, Greg KH wrote:
On Thu, Sep 05, 2019 at 08:02:58AM -0500, Mike Travis wrote:
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i;
- if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE)
- /* Select only UV4 (hubbed or hubless) and higher */
- if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4))
For someone not too familiar with the code, this is completely unreadable. There must be a nicer way to do this.
-- Thanks, Sasha
On 9/5/2019 2:40 PM, Sasha Levin wrote:
On Thu, Sep 05, 2019 at 04:16:34PM +0200, Greg KH wrote:
On Thu, Sep 05, 2019 at 08:02:58AM -0500, Mike Travis wrote:
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1303,7 +1303,8 @@ static int __init decode_uv_systab(void) struct uv_systab *st; int i;
- if (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE) + /* Select only UV4 (hubbed or hubless) and higher */ + if (is_uv_hubbed(-2) < uv(4) && is_uv_hubless(-2) < uv(4))
For someone not too familiar with the code, this is completely unreadable. There must be a nicer way to do this.
-- Thanks, Sasha
Hi Sasha,
I can put in further explanation but first the uv() function returns 1 left shifted by the UV #:
static inline int uv(int uvtype) { /* uv(0) is "any" */ if (uvtype >= 0 && uvtype <= 30) return 1 << uvtype; return 1; }
The "is_uv_hubbed(x)" and "is_uv_hubless(x)" AND's the incoming arg with the actual uv type:
int is_uv_hubbed(int uvtype) { return (uv_hubbed_system & uvtype); }
The uv_hub{bed,less}_system is set to 1 left shifted by the UV # plus in bit 0 is a '1' to indicate "any" UV (as in "is_uv_hubbed(1)" is any UV hubbed system). Hubbed indicates a hubbed system, and hubless indicates a hubless system, it cannot be both but can be neither.
/* UV4 Hubless, (0x11:UV4+Any) */ if (strncmp(oem_id, "NSGI4", 5) == 0) uv_hubless_system = 0x11; /* UV3 Hubless, UV300/MC990X w/o hub (0x9:UV3+Any) */ else uv_hubless_system = 0x9;
(There are only hubbed versions of UV1 and UV2.)
Lastly (-2) translates to 0xffff...fffe (note bit 0 is clear to avoid the "any" bit. So it is looking for a a hubbed or hubless UV system that is less than UV4 meaning only UV4,5,6...qualify, hence this comment:
- /* Select only UV4 (hubbed or hubless) and higher */
if (UV is less than UV4 either hubbed or hubless) return; /* does not have an extended UVsystab */
Have you a suggestion on what would make it more clear? Perhaps instead of -2 I should use a hex mask?
Thanks, Mike
Change to checking for EFI Boot type from previous check on if this is a KDUMP kernel. This allows for KDUMP kernels that can handle EFI reboots.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- arch/x86/kernel/apic/x2apic_uv_x.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -15,6 +15,7 @@ #include <linux/export.h> #include <linux/pci.h> #include <linux/acpi.h> +#include <linux/efi.h>
#include <asm/e820/api.h> #include <asm/uv/uv_mmrs.h> @@ -1483,6 +1484,14 @@ static void __init build_socket_tables(v } }
+/* Check which reboot to use */ +static void check_efi_reboot(void) +{ + /* If EFI reboot not available, use ACPI reboot */ + if (!efi_enabled(EFI_BOOT)) + reboot_type = BOOT_ACPI; +} + /* Setup user proc fs files */ static int proc_hubbed_show(struct seq_file *file, void *data) { @@ -1571,6 +1580,8 @@ static __init int uv_system_init_hubless if (rc >= 0) uv_setup_proc_files(1);
+ check_efi_reboot(); + return rc; }
@@ -1704,12 +1715,7 @@ static void __init uv_system_init_hub(vo /* Register Legacy VGA I/O redirection handler: */ pci_register_set_vga_state(uv_set_vga_state);
- /* - * For a kdump kernel the reset must be BOOT_ACPI, not BOOT_EFI, as - * EFI is not enabled in the kdump kernel: - */ - if (is_kdump_kernel()) - reboot_type = BOOT_ACPI; + check_efi_reboot(); }
/*
--
The references in the is_uvX_hub() function uses the hub_info pointer which will be NULL when the system is hubless. This change avoids that NULL dereference. It is also an optimization in performance.
Signed-off-by: Mike Travis mike.travis@hpe.com Reviewed-by: Steve Wahl steve.wahl@hpe.com Reviewed-by: Dimitri Sivanich dimitri.sivanich@hpe.com To: Thomas Gleixner tglx@linutronix.de To: Ingo Molnar mingo@redhat.com To: H. Peter Anvin hpa@zytor.com To: Andrew Morton akpm@linux-foundation.org To: Borislav Petkov bp@alien8.de To: Christoph Hellwig hch@infradead.org Cc: Dimitri Sivanich dimitri.sivanich@hpe.com Cc: Russ Anderson russ.anderson@hpe.com Cc: Hedi Berriche hedi.berriche@hpe.com Cc: Steve Wahl steve.wahl@hpe.com Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org --- v2: Add WARNING that the is UVx supported defines will be removed. --- arch/x86/include/asm/uv/.uv_hub.h.swp |binary arch/x86/include/asm/uv/uv_hub.h | 61 ++++++++++++--------------------------- 1 file changed, 20 insertions(+), 41 deletions(-)
Binary files linux.orig/arch/x86/include/asm/uv/.uv_hub.h.swp and linux/arch/x86/include/asm/uv/.uv_hub.h.swp differ --- linux.orig/arch/x86/include/asm/uv/uv_hub.h +++ linux/arch/x86/include/asm/uv/uv_hub.h @@ -19,6 +19,7 @@ #include <linux/topology.h> #include <asm/types.h> #include <asm/percpu.h> +#include <asm/uv/uv.h> #include <asm/uv/uv_mmrs.h> #include <asm/uv/bios.h> #include <asm/irq_vectors.h> @@ -243,83 +244,61 @@ static inline int uv_hub_info_check(int #define UV4_HUB_REVISION_BASE 7 #define UV4A_HUB_REVISION_BASE 8 /* UV4 (fixed) rev 2 */
-#ifdef UV1_HUB_IS_SUPPORTED +/* WARNING: UVx_HUB_IS_SUPPORTED defines are deprecated and will be removed */ static inline int is_uv1_hub(void) { - return uv_hub_info->hub_revision < UV2_HUB_REVISION_BASE; -} +#ifdef UV1_HUB_IS_SUPPORTED + return is_uv_hubbed(uv(1)); #else -static inline int is_uv1_hub(void) -{ return 0; -} #endif +}
-#ifdef UV2_HUB_IS_SUPPORTED static inline int is_uv2_hub(void) { - return ((uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE) && - (uv_hub_info->hub_revision < UV3_HUB_REVISION_BASE)); -} +#ifdef UV2_HUB_IS_SUPPORTED + return is_uv_hubbed(uv(2)); #else -static inline int is_uv2_hub(void) -{ return 0; -} #endif +}
-#ifdef UV3_HUB_IS_SUPPORTED static inline int is_uv3_hub(void) { - return ((uv_hub_info->hub_revision >= UV3_HUB_REVISION_BASE) && - (uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE)); -} +#ifdef UV3_HUB_IS_SUPPORTED + return is_uv_hubbed(uv(3)); #else -static inline int is_uv3_hub(void) -{ return 0; -} #endif +}
/* First test "is UV4A", then "is UV4" */ -#ifdef UV4A_HUB_IS_SUPPORTED -static inline int is_uv4a_hub(void) -{ - return (uv_hub_info->hub_revision >= UV4A_HUB_REVISION_BASE); -} -#else static inline int is_uv4a_hub(void) { +#ifdef UV4A_HUB_IS_SUPPORTED + if (is_uv_hubbed(uv(4))) + return (uv_hub_info->hub_revision == UV4A_HUB_REVISION_BASE); +#endif return 0; } -#endif
-#ifdef UV4_HUB_IS_SUPPORTED static inline int is_uv4_hub(void) { - return uv_hub_info->hub_revision >= UV4_HUB_REVISION_BASE; -} +#ifdef UV4_HUB_IS_SUPPORTED + return is_uv_hubbed(uv(4)); #else -static inline int is_uv4_hub(void) -{ return 0; -} #endif +}
static inline int is_uvx_hub(void) { - if (uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE) - return uv_hub_info->hub_revision; - - return 0; + return (is_uv_hubbed(-2) >= uv(2)); }
static inline int is_uv_hub(void) { -#ifdef UV1_HUB_IS_SUPPORTED - return uv_hub_info->hub_revision; -#endif - return is_uvx_hub(); + return is_uv1_hub() || is_uvx_hub(); }
union uvh_apicid {
--
On Thu, Sep 5, 2019 at 3:50 PM Mike Travis mike.travis@hpe.com wrote:
These patches support upcoming UV systems that do not have a UV HUB.
Please send patches as plain text without attachments. See:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#no-mi...
for details.
Cheers, Miguel
On 9/10/2019 5:07 AM, Miguel Ojeda wrote:
On Thu, Sep 5, 2019 at 3:50 PM Mike Travis mike.travis@hpe.com wrote:
These patches support upcoming UV systems that do not have a UV HUB.
Please send patches as plain text without attachments. See:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#no-mi...
for details.
Cheers, Miguel
Hi, I'm not conscientiously adding any attachments. I think what is happening is some email readers mistake the '---' to signify an attachment follows. I see the "staple" symbol on some indicating an attachment, but not usually all of the email I send. Thanks, Mike
On Tue, Sep 10, 2019 at 08:34:44AM -0700, Mike Travis wrote:
Hi, I'm not conscientiously adding any attachments. I think what is happening is some email readers mistake the '---' to signify an attachment follows. I see the "staple" symbol on some indicating an attachment, but not usually all of the email I send. Thanks, Mike
Btw, is there anyway to fix your mail setup and not flood with your patchset?
I have received your V2 patchset 5(!) times yesterday and today. All separate submissions!
;-(
On 9/10/2019 9:40 AM, Borislav Petkov wrote:
On Tue, Sep 10, 2019 at 08:34:44AM -0700, Mike Travis wrote:
Hi, I'm not conscientiously adding any attachments. I think what is happening is some email readers mistake the '---' to signify an attachment follows. I see the "staple" symbol on some indicating an attachment, but not usually all of the email I send. Thanks, Mike
Btw, is there anyway to fix your mail setup and not flood with your patchset?
I have received your V2 patchset 5(!) times yesterday and today. All separate submissions!
;-(
Sorry, I've been testing them and monitoring LKML to check for leakages. I certainly did not intend for any of those test sends to get out. And I don't understand right now how they did. I am using sendmail in it's basic form and you or anyone else was not on the recipient list.
(Honestly, if I had known they got out, I would have stopped testing... :) But the latest ones are obviously the "official" submissions, since those are the copies that I also have.) If you accept them upstream, I'll quit sending them, I promise... :)
linux-stable-mirror@lists.linaro.org