Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/platform/uv: Save OEM_ID from ACPI MADT probe

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>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Hedi Berriche <hedi.berriche@hpe.com>
Cc: Justin Ernst <justin.ernst@hpe.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russ Anderson <russ.anderson@hpe.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190910145839.732237241@stormcage.eag.rdlabs.hpecorp.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Mike Travis and committed by
Ingo Molnar
61e5ddca da0c9ea1

+15 -1
+15 -1
arch/x86/kernel/apic/x2apic_uv_x.c
··· 14 14 #include <linux/memory.h> 15 15 #include <linux/export.h> 16 16 #include <linux/pci.h> 17 + #include <linux/acpi.h> 17 18 18 19 #include <asm/e820/api.h> 19 20 #include <asm/uv/uv_mmrs.h> ··· 31 30 static u64 gru_dist_base, gru_first_node_paddr = -1LL, gru_last_node_paddr; 32 31 static u64 gru_dist_lmask, gru_dist_umask; 33 32 static union uvh_apicid uvh_apicid; 33 + 34 + /* Unpack OEM/TABLE ID's to be NULL terminated strings */ 35 + static u8 oem_id[ACPI_OEM_ID_SIZE + 1]; 36 + static u8 oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; 34 37 35 38 /* Information derived from CPUID: */ 36 39 static struct { ··· 253 248 } 254 249 } 255 250 256 - static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) 251 + static void __init uv_stringify(int len, char *to, char *from) 252 + { 253 + /* Relies on 'to' being NULL chars so result will be NULL terminated */ 254 + strncpy(to, from, len-1); 255 + } 256 + 257 + static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id) 257 258 { 258 259 int pnodeid; 259 260 int uv_apic; 261 + 262 + uv_stringify(sizeof(oem_id), oem_id, _oem_id); 263 + uv_stringify(sizeof(oem_table_id), oem_table_id, _oem_table_id); 260 264 261 265 if (strncmp(oem_id, "SGI", 3) != 0) { 262 266 if (strncmp(oem_id, "NSGI", 4) == 0) {