Skip to content

Commit

Permalink
Merge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/tip/tip

Pull RAS changes from Ingo Molnar:
 "The main system reliability related changes were from x86, but also
  some generic RAS changes:

   - AMD MCE error injection subsystem enhancements.  (Aravind
     Gopalakrishnan)

   - Fix MCE and CPU hotplug interaction bug.  (Ashok Raj)

   - kcrash bootup robustness fix.  (Baoquan He)

   - kcrash cleanups.  (Borislav Petkov)

   - x86 microcode driver rework: simplify it by unmodularizing it and
     other cleanups.  (Borislav Petkov)"

* 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  x86/mce: Add a default case to the switch in __mcheck_cpu_ancient_init()
  x86/mce: Add a Scalable MCA vendor flags bit
  MAINTAINERS: Unify the microcode driver section
  x86/microcode/intel: Move #ifdef DEBUG inside the function
  x86/microcode/amd: Remove maintainers from comments
  x86/microcode: Remove modularization leftovers
  x86/microcode: Merge the early microcode loader
  x86/microcode: Unmodularize the microcode driver
  x86/mce: Fix thermal throttling reporting after kexec
  kexec/crash: Say which char is the unrecognized
  x86/setup/crash: Check memblock_reserve() retval
  x86/setup/crash: Cleanup some more
  x86/setup/crash: Remove alignment variable
  x86/setup: Cleanup crashkernel reservation functions
  x86/amd_nb, EDAC: Rename amd_get_node_id()
  x86/setup: Do not reserve crashkernel high memory if low reservation failed
  x86/microcode/amd: Do not overwrite final patch levels
  x86/microcode/amd: Extract current patch level read to a function
  x86/ras/mce_amd_inj: Inject bank 4 errors on the NBC
  x86/ras/mce_amd_inj: Trigger deferred and thresholding errors interrupts
  ...
  • Loading branch information
torvalds committed Nov 4, 2015
2 parents b02ac6b + dc34bdd commit b831ef2
Show file tree
Hide file tree
Showing 25 changed files with 1,678 additions and 1,661 deletions.
16 changes: 5 additions & 11 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,6 @@ F: drivers/gpu/drm/radeon/radeon_kfd.c
F: drivers/gpu/drm/radeon/radeon_kfd.h
F: include/uapi/linux/kfd_ioctl.h

AMD MICROCODE UPDATE SUPPORT
M: Borislav Petkov <[email protected]>
S: Maintained
F: arch/x86/kernel/cpu/microcode/amd*

AMD XGBE DRIVER
M: Tom Lendacky <[email protected]>
L: [email protected]
Expand Down Expand Up @@ -5468,12 +5463,6 @@ W: https://01.org/linux-acpi
S: Supported
F: drivers/platform/x86/intel_menlow.c

INTEL IA32 MICROCODE UPDATE SUPPORT
M: Borislav Petkov <[email protected]>
S: Maintained
F: arch/x86/kernel/cpu/microcode/core*
F: arch/x86/kernel/cpu/microcode/intel*

INTEL I/OAT DMA DRIVER
M: Dave Jiang <[email protected]>
R: Dan Williams <[email protected]>
Expand Down Expand Up @@ -11505,6 +11494,11 @@ L: [email protected]
S: Maintained
F: arch/x86/kernel/cpu/mcheck/*

X86 MICROCODE UPDATE SUPPORT
M: Borislav Petkov <[email protected]>
S: Maintained
F: arch/x86/kernel/cpu/microcode/*

X86 VDSO
M: Andy Lutomirski <[email protected]>
L: [email protected]
Expand Down
22 changes: 3 additions & 19 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,10 @@ config X86_REBOOTFIXUPS
Say N otherwise.

config MICROCODE
tristate "CPU microcode loading support"
bool "CPU microcode loading support"
default y
depends on CPU_SUP_AMD || CPU_SUP_INTEL
depends on BLK_DEV_INITRD
select FW_LOADER
---help---

Expand Down Expand Up @@ -1166,24 +1168,6 @@ config MICROCODE_OLD_INTERFACE
def_bool y
depends on MICROCODE

config MICROCODE_INTEL_EARLY
bool

config MICROCODE_AMD_EARLY
bool

config MICROCODE_EARLY
bool "Early load microcode"
depends on MICROCODE=y && BLK_DEV_INITRD
select MICROCODE_INTEL_EARLY if MICROCODE_INTEL
select MICROCODE_AMD_EARLY if MICROCODE_AMD
default y
help
This option provides functionality to read additional microcode data
at the beginning of initrd image. The data tells kernel to load
microcode to CPU's as early as possible. No functional change if no
microcode data is glued to the initrd, therefore it's safe to say Y.

config X86_MSR
tristate "/dev/cpu/*/msr - Model-specific register support"
---help---
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/amd_nb.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static inline struct amd_northbridge *node_to_amd_nb(int node)
return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL;
}

static inline u16 amd_get_node_id(struct pci_dev *pdev)
static inline u16 amd_pci_dev_to_node_id(struct pci_dev *pdev)
{
struct pci_dev *misc;
int i;
Expand Down
34 changes: 21 additions & 13 deletions arch/x86/include/asm/mce.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,27 @@ struct mca_config {
};

struct mce_vendor_flags {
/*
* overflow recovery cpuid bit indicates that overflow
* conditions are not fatal
*/
__u64 overflow_recov : 1,

/*
* SUCCOR stands for S/W UnCorrectable error COntainment
* and Recovery. It indicates support for data poisoning
* in HW and deferred error interrupts.
*/
succor : 1,
__reserved_0 : 62;
/*
* Indicates that overflow conditions are not fatal, when set.
*/
__u64 overflow_recov : 1,

/*
* (AMD) SUCCOR stands for S/W UnCorrectable error COntainment and
* Recovery. It indicates support for data poisoning in HW and deferred
* error interrupts.
*/
succor : 1,

/*
* (AMD) SMCA: This bit indicates support for Scalable MCA which expands
* the register space for each MCA bank and also increases number of
* banks. Also, to accommodate the new banks and registers, the MCA
* register space is moved to a new MSR range.
*/
smca : 1,

__reserved_0 : 61;
};
extern struct mce_vendor_flags mce_flags;

Expand Down
26 changes: 13 additions & 13 deletions arch/x86/include/asm/microcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct cpu_signature {
struct device;

enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
extern bool dis_ucode_ldr;

struct microcode_ops {
enum ucode_state (*request_microcode_user) (int cpu,
Expand Down Expand Up @@ -55,6 +54,12 @@ struct ucode_cpu_info {
};
extern struct ucode_cpu_info ucode_cpu_info[];

#ifdef CONFIG_MICROCODE
int __init microcode_init(void);
#else
static inline int __init microcode_init(void) { return 0; };
#endif

#ifdef CONFIG_MICROCODE_INTEL
extern struct microcode_ops * __init init_intel_microcode(void);
#else
Expand All @@ -75,7 +80,6 @@ static inline struct microcode_ops * __init init_amd_microcode(void)
static inline void __exit exit_amd_microcode(void) {}
#endif

#ifdef CONFIG_MICROCODE_EARLY
#define MAX_UCODE_COUNT 128

#define QCHAR(a, b, c, d) ((a) + ((b) << 8) + ((c) << 16) + ((d) << 24))
Expand Down Expand Up @@ -150,22 +154,18 @@ static inline unsigned int x86_model(unsigned int sig)
return model;
}

#ifdef CONFIG_MICROCODE
extern void __init load_ucode_bsp(void);
extern void load_ucode_ap(void);
extern int __init save_microcode_in_initrd(void);
void reload_early_microcode(void);
extern bool get_builtin_firmware(struct cpio_data *cd, const char *name);
#else
static inline void __init load_ucode_bsp(void) {}
static inline void load_ucode_ap(void) {}
static inline int __init save_microcode_in_initrd(void)
{
return 0;
}
static inline void reload_early_microcode(void) {}
static inline bool get_builtin_firmware(struct cpio_data *cd, const char *name)
{
return false;
}
static inline void __init load_ucode_bsp(void) { }
static inline void load_ucode_ap(void) { }
static inline int __init save_microcode_in_initrd(void) { return 0; }
static inline void reload_early_microcode(void) { }
static inline bool
get_builtin_firmware(struct cpio_data *cd, const char *name) { return false; }
#endif
#endif /* _ASM_X86_MICROCODE_H */
3 changes: 2 additions & 1 deletion arch/x86/include/asm/microcode_amd.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, s
#define PATCH_MAX_SIZE PAGE_SIZE
extern u8 amd_ucode_patch[PATCH_MAX_SIZE];

#ifdef CONFIG_MICROCODE_AMD_EARLY
#ifdef CONFIG_MICROCODE_AMD
extern void __init load_ucode_amd_bsp(unsigned int family);
extern void load_ucode_amd_ap(void);
extern int __init save_microcode_in_initrd_amd(void);
Expand All @@ -76,4 +76,5 @@ static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; }
void reload_ucode_amd(void) {}
#endif

extern bool check_current_patch_level(u32 *rev, bool early);
#endif /* _ASM_X86_MICROCODE_AMD_H */
10 changes: 3 additions & 7 deletions arch/x86/include/asm/microcode_intel.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern int has_newer_microcode(void *mc, unsigned int csig, int cpf, int rev);
extern int microcode_sanity_check(void *mc, int print_err);
extern int find_matching_signature(void *mc, unsigned int csig, int cpf);

#ifdef CONFIG_MICROCODE_INTEL_EARLY
#ifdef CONFIG_MICROCODE_INTEL
extern void __init load_ucode_intel_bsp(void);
extern void load_ucode_intel_ap(void);
extern void show_ucode_info_early(void);
Expand All @@ -71,13 +71,9 @@ static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL;
static inline void reload_ucode_intel(void) {}
#endif

#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU)
#ifdef CONFIG_HOTPLUG_CPU
extern int save_mc_for_early(u8 *mc);
#else
static inline int save_mc_for_early(u8 *mc)
{
return 0;
}
static inline int save_mc_for_early(u8 *mc) { return 0; }
#endif

#endif /* _ASM_X86_MICROCODE_INTEL_H */
2 changes: 1 addition & 1 deletion arch/x86/include/uapi/asm/mce.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _UAPI_ASM_X86_MCE_H

#include <linux/types.h>
#include <asm/ioctls.h>
#include <linux/ioctl.h>

/* Fields are zero when not available */
struct mce {
Expand Down
34 changes: 24 additions & 10 deletions arch/x86/kernel/cpu/mcheck/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,8 @@ static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
winchip_mcheck_init(c);
return 1;
break;
default:
return 0;
}

return 0;
Expand All @@ -1605,6 +1607,8 @@ static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
mce_amd_feature_init(c);
mce_flags.overflow_recov = !!(ebx & BIT(0));
mce_flags.succor = !!(ebx & BIT(1));
mce_flags.smca = !!(ebx & BIT(3));

break;
}

Expand Down Expand Up @@ -2042,7 +2046,7 @@ int __init mcheck_init(void)
* Disable machine checks on suspend and shutdown. We can't really handle
* them later.
*/
static int mce_disable_error_reporting(void)
static void mce_disable_error_reporting(void)
{
int i;

Expand All @@ -2052,17 +2056,32 @@ static int mce_disable_error_reporting(void)
if (b->init)
wrmsrl(MSR_IA32_MCx_CTL(i), 0);
}
return 0;
return;
}

static void vendor_disable_error_reporting(void)
{
/*
* Don't clear on Intel CPUs. Some of these MSRs are socket-wide.
* Disabling them for just a single offlined CPU is bad, since it will
* inhibit reporting for all shared resources on the socket like the
* last level cache (LLC), the integrated memory controller (iMC), etc.
*/
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
return;

mce_disable_error_reporting();
}

static int mce_syscore_suspend(void)
{
return mce_disable_error_reporting();
vendor_disable_error_reporting();
return 0;
}

static void mce_syscore_shutdown(void)
{
mce_disable_error_reporting();
vendor_disable_error_reporting();
}

/*
Expand Down Expand Up @@ -2342,19 +2361,14 @@ static void mce_device_remove(unsigned int cpu)
static void mce_disable_cpu(void *h)
{
unsigned long action = *(unsigned long *)h;
int i;

if (!mce_available(raw_cpu_ptr(&cpu_info)))
return;

if (!(action & CPU_TASKS_FROZEN))
cmci_clear();
for (i = 0; i < mca_cfg.banks; i++) {
struct mce_bank *b = &mce_banks[i];

if (b->init)
wrmsrl(MSR_IA32_MCx_CTL(i), 0);
}
vendor_disable_error_reporting();
}

static void mce_reenable_cpu(void *h)
Expand Down
8 changes: 0 additions & 8 deletions arch/x86/kernel/cpu/mcheck/therm_throt.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,6 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
return;
}

/* Check whether a vector already exists */
if (h & APIC_VECTOR_MASK) {
printk(KERN_DEBUG
"CPU%d: Thermal LVT vector (%#x) already installed\n",
cpu, (h & APIC_VECTOR_MASK));
return;
}

/* early Pentium M models use different method for enabling TM2 */
if (cpu_has(c, X86_FEATURE_TM2)) {
if (c->x86 == 6 && (c->x86_model == 9 || c->x86_model == 13)) {
Expand Down
3 changes: 0 additions & 3 deletions arch/x86/kernel/cpu/microcode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ microcode-y := core.o
obj-$(CONFIG_MICROCODE) += microcode.o
microcode-$(CONFIG_MICROCODE_INTEL) += intel.o intel_lib.o
microcode-$(CONFIG_MICROCODE_AMD) += amd.o
obj-$(CONFIG_MICROCODE_EARLY) += core_early.o
obj-$(CONFIG_MICROCODE_INTEL_EARLY) += intel_early.o
obj-$(CONFIG_MICROCODE_AMD_EARLY) += amd_early.o
Loading

0 comments on commit b831ef2

Please sign in to comment.