x86 fixes
Linus,
Please pull the latest x86-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus
out-of-topic modifications in x86-fixes-for-linus:
--------------------------------------------------drivers/edac/Kconfig # 0d18b2e: x86: EDAC: carve out AMD MCE decodrivers/edac/Makefile # 0d18b2e: x86: EDAC: carve out AMD MCE deco
# f436f8b: x86: EDAC: MCE: Fix MCE decoding
drivers/edac/edac_mce_amd.c # 0d18b2e: x86: EDAC: carve out AMD MCE deco
# f436f8b: x86: EDAC: MCE: Fix MCE decoding include/linux/init.h # 329bd41: initcalls: Add early_initcall() f
( Contains the simplest incarnation of the EDAC/MCE fixes - we plan to
do the followup patches for .33. )
Thanks,
Ingo
------------------>
Arjan van de Ven (1):
x86: Simplify bound checks in the MTRR code
Borislav Petkov (2):
initcalls: Add early_initcall() for modules
x86: EDAC: carve out AMD MCE decoding logic
Ingo Molnar (1):
x86: EDAC: MCE: Fix MCE decoding callback logic
Marin Mitov (1):
x86, pci: Correct spelling in a comment
arch/x86/include/asm/mce.h | 2 + arch/x86/kernel/cpu/mcheck/mce.c | 58 +++++++++++++++++++++++-------------- arch/x86/kernel/cpu/mtrr/if.c | 17 ++++++++--- arch/x86/kernel/pci-dma.c | 2 +- drivers/edac/Kconfig | 14 ++++++++- drivers/edac/Makefile | 5 +-- drivers/edac/edac_mce_amd.c | 32 ++++++++++++++++++++- include/linux/init.h | 1 + 8 files changed, 97 insertions(+), 34 deletions(-)
arch/x86/include/asm/mce.h +2 -0
@@ -133,6 +133,8 @@ static inline void winchip_mcheck_init(struct cpuinfo_x86 *c) {}static inline void enable_p5_mce (void ) {}#endif +extern void (*x86_mce_decode_callback)(struct mce *m); +void mce_setup (struct mce *m);void mce_log (struct mce *m); DECLARE_PER_CPU(struct sys_device, mce_dev);
arch/x86/kernel/cpu/mcheck/mce.c +36 -22
100 lines not on this page · raw message
arch/x86/kernel/cpu/mtrr/if.c +12 -5
@@ -96,17 +96,24 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)unsigned long long base, size;char *ptr;char line[LINE_SIZE ]; +int length;size_t linelen;if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (!len) -return -EINVAL ;memset (line,0 ,LINE_SIZE ); -if (len >LINE_SIZE ) - len =LINE_SIZE ; -if (copy_from_user (line, buf, len -1 )) + + length = len; + length--; + +if (length >LINE_SIZE -1 ) + length =LINE_SIZE -1 ; + +if (length <0 ) +return -EINVAL ; + +if (copy_from_user (line, buf, length))return -EFAULT ; linelen =strlen (line);
arch/x86/kernel/pci-dma.c +1 -1
@@ -35,7 +35,7 @@ int iommu_detected __read_mostly = 0;/* * This variable becomes 1 if iommu=pt is passed on the kernel command line. -* If this variable is 1, IOMMU implementations do no DMA ranslation for +* If this variable is 1, IOMMU implementations do no DMA translation for * devices and allow every device to access to whole physical memory. This is * useful if a user want to use an IOMMU only for KVM device assignment to * guests and not for driver dma translation.
drivers/edac/Kconfig +13 -1
@@ -47,6 +47,18 @@ config EDAC_DEBUG_VERBOSE Source file name and line number where debugging message printed will be added to debugging message. + config EDAC_DECODE_MCE + tristate "Decode MCEs in human-readable form (only on AMD for now)" + depends on CPU_SUP_AMD && X86_MCE + default y + ---help--- + Enable this option if you want to decode Machine Check Exceptions + occuring on your machine in human-readable form. + + You should definitely say Y here in case you want to decode MCEs + which occur really early upon boot, before the module infrastructure + has been initialized. + config EDAC_MM_EDAC tristate "Main Memory EDAC (Error Detection And Correction) reporting" help
@@ -59,7 +71,7 @@ config EDAC_MM_EDAC config EDAC_AMD64 tristate "AMD64 (Opteron, Athlon64) K8, F10h, F11h" - depends on EDAC_MM_EDAC && K8_NB && X86_64 && PCI && CPU_SUP_AMD + depends on EDAC_MM_EDAC && K8_NB && X86_64 && PCI && EDAC_DECODE_MCE help Support for error detection and correction on the AMD 64 Families of Memory Controllers (K8, F10h and F11h)
drivers/edac/Makefile +1 -4
@@ -6,7 +6,6 @@ # GNU General Public License. # - obj-$(CONFIG_EDAC) := edac_stub.o obj-$(CONFIG_EDAC_MM_EDAC) += edac_core.o
@@ -17,9 +16,7 @@ ifdef CONFIG_PCI edac_core-objs += edac_pci.o edac_pci_sysfs.o endif -ifdef CONFIG_CPU_SUP_AMD -edac_core-objs += edac_mce_amd.o -endif +obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o
drivers/edac/edac_mce_amd.c +31 -1
@@ -3,6 +3,7 @@static bool report_gart_errors;static void (*nb_bus_decoder)(int node_id,struct err_regs *regs); +static void (*orig_mce_callback)(struct mce *m);void amd_report_gart_errors (bool v) {
@@ -362,7 +363,7 @@ static inline void amd_decode_err_code(unsigned int ec)pr_warning ("Huh? Unknown MCE error 0x%x\n" , ec); } -void decode_mce (struct mce *m) +static void amd_decode_mce (struct mce *m) {struct err_regs regs;int node, ecc;
@@ -420,3 +421,32 @@ void decode_mce(struct mce *m)amd_decode_err_code (m->status &0xffff ); } + +static int __init mce_amd_init (void ) +{ +/* +* We can decode MCEs for Opteron and later CPUs: +*/ +if ((boot_cpu_data.x86_vendor ==X86_VENDOR_AMD ) && + (boot_cpu_data.x86 >=0xf )) { +/* safe the default decode mce callback */ + orig_mce_callback = x86_mce_decode_callback; + + x86_mce_decode_callback = amd_decode_mce; + } + +return 0 ; +} +early_initcall (mce_amd_init); + +#ifdef MODULE +static void __exit mce_amd_exit(void) +{ + x86_mce_decode_callback = orig_mce_callback; +} + +MODULE_DESCRIPTION ("AMD MCE decoder" ); +MODULE_ALIAS ("edac-mce-amd" ); +MODULE_LICENSE ("GPL" ); +module_exit (mce_amd_exit); +#endif
include/linux/init.h +1 -0
@@ -271,6 +271,7 @@ void __init parse_early_options(char *cmdline);#else /* MODULE */ /* Don't use these in modules, but some people do... */ +#define early_initcall (fn) module_init(fn)#define core_initcall (fn) module_init(fn)#define postcore_initcall (fn) module_init(fn)#define arch_initcall (fn) module_init(fn)