diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 66111446624b..e4654388d794 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu @@ -300,10 +300,6 @@ menuconfig PROCESSOR_SELECT This lets you choose what x86 vendor support code your kernel will include. -config BROADCAST_TLB_FLUSH - def_bool y - depends on CPU_SUP_AMD && 64BIT - config CPU_SUP_INTEL default y bool "Support Intel processors" if PROCESSOR_SELECT @@ -410,3 +406,7 @@ config CPU_SUP_VORTEX_32 makes the kernel a tiny bit smaller. If unsure, say N. + +config BROADCAST_TLB_FLUSH + def_bool y + depends on CPU_SUP_AMD && 64BIT diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 3b0948ad449f..8e4bf5365ac6 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -219,7 +219,8 @@ static void parse_gb_huge_pages(char *param, char *val) if (!strcmp(param, "hugepages") && gbpage_sz) { p = val; - max_gb_huge_pages = simple_strtoull(p, &p, 0); + if (boot_kstrtoul(p, 0, &max_gb_huge_pages)) + warn("Failed to parse hugepages= boot parameter\n"); return; } } diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index b25c6a9303b7..ac0f900ebc47 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c @@ -289,6 +289,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) unsigned long long _res; unsigned int rv; + if (s[0] == '+') + s++; + s = _parse_integer_fixup_radix(s, &base); rv = _parse_integer(s, base, &_res); if (rv & KSTRTOX_OVERFLOW) @@ -304,35 +307,12 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) return 0; } -/** - * kstrtoull - convert a string to an unsigned long long - * @s: The start of the string. The string must be null-terminated, and may also - * include a single newline before its terminating null. The first character - * may also be a plus sign, but not a minus sign. - * @base: The number base to use. The maximum supported base is 16. If base is - * given as 0, then the base of the string is automatically detected with the - * conventional semantics - If it begins with 0x the number will be parsed as a - * hexadecimal (case insensitive), if it otherwise begins with 0, it will be - * parsed as an octal number. Otherwise it will be parsed as a decimal. - * @res: Where to write the result of the conversion on success. - * - * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. - * Used as a replacement for the obsolete simple_strtoull. Return code must - * be checked. - */ -int kstrtoull(const char *s, unsigned int base, unsigned long long *res) -{ - if (s[0] == '+') - s++; - return _kstrtoull(s, base, res); -} - static int _kstrtoul(const char *s, unsigned int base, unsigned long *res) { unsigned long long tmp; int rv; - rv = kstrtoull(s, base, &tmp); + rv = _kstrtoull(s, base, &tmp); if (rv < 0) return rv; if (tmp != (unsigned long)tmp) @@ -364,7 +344,7 @@ int boot_kstrtoul(const char *s, unsigned int base, unsigned long *res) */ if (sizeof(unsigned long) == sizeof(unsigned long long) && __alignof__(unsigned long) == __alignof__(unsigned long long)) - return kstrtoull(s, base, (unsigned long long *)res); + return _kstrtoull(s, base, (unsigned long long *)res); else return _kstrtoul(s, base, res); } diff --git a/arch/x86/boot/string.h b/arch/x86/boot/string.h index a5b05ebc037d..4092bf2ed1ee 100644 --- a/arch/x86/boot/string.h +++ b/arch/x86/boot/string.h @@ -28,6 +28,5 @@ extern unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base); long simple_strtol(const char *cp, char **endp, unsigned int base); -int kstrtoull(const char *s, unsigned int base, unsigned long long *res); int boot_kstrtoul(const char *s, unsigned int base, unsigned long *res); #endif /* BOOT_STRING_H */ diff --git a/arch/x86/include/asm/purgatory.h b/arch/x86/include/asm/purgatory.h index 2fee5e9f1ccc..56a9e81edb15 100644 --- a/arch/x86/include/asm/purgatory.h +++ b/arch/x86/include/asm/purgatory.h @@ -8,4 +8,4 @@ extern void purgatory(void); #endif /* __ASSEMBLER__ */ -#endif /* _ASM_PURGATORY_H */ +#endif /* _ASM_X86_PURGATORY_H */ diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h index 5c7a3a71191a..dca2d5845e42 100644 --- a/arch/x86/kernel/cpu/cpu.h +++ b/arch/x86/kernel/cpu/cpu.h @@ -75,7 +75,6 @@ static inline struct amd_northbridge *amd_init_l3_cache(int index) } #endif -unsigned int aperfmperf_get_khz(int cpu); void cpu_select_mitigations(void); extern void x86_spec_ctrl_setup_ap(void); diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c index 23154d24b117..04fb221716ff 100644 --- a/arch/x86/kernel/pmem.c +++ b/arch/x86/kernel/pmem.c @@ -27,6 +27,8 @@ static __init int register_e820_pmem(void) * simply here to trigger the module to load on demand. */ pdev = platform_device_alloc("e820_pmem", -1); + if (!pdev) + return -ENOMEM; rc = platform_device_add(pdev); if (rc) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 4c045f844492..1023acadd8f8 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -1769,7 +1769,7 @@ bool nmi_uaccess_okay(void) } static ssize_t tlbflush_read_file(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { char buf[32]; unsigned int len; @@ -1778,20 +1778,15 @@ static ssize_t tlbflush_read_file(struct file *file, char __user *user_buf, return simple_read_from_buffer(user_buf, count, ppos, buf, len); } -static ssize_t tlbflush_write_file(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) +static ssize_t tlbflush_write_file(struct file *file, const char __user *user_buf, + size_t count, loff_t *ppos) { - char buf[32]; - ssize_t len; int ceiling; + int err; - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtoint(buf, 0, &ceiling)) - return -EINVAL; + err = kstrtoint_from_user(user_buf, count, 0, &ceiling); + if (err) + return err; if (ceiling < 0) return -EINVAL; diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c index 5c50e550ab63..565ab43fa6b4 100644 --- a/arch/x86/platform/uv/uv_nmi.c +++ b/arch/x86/platform/uv/uv_nmi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -340,7 +341,7 @@ static void uv_nmi_setup_hubless_intr(void) uv_pch_intr_now_enabled ? GPIROUTNMI : 0); nmi_debug("UV:NMI: GPP_D_0 interrupt %s\n", - uv_pch_intr_now_enabled ? "enabled" : "disabled"); + str_enabled_disabled(uv_pch_intr_now_enabled)); } static struct init_nmi {