x86 fixes for v3.9
Subsystems (5)
Hi Linus,
Three groups of fixes:
1. Make sure we don't execute the early microcode patching if family < 6, since it would touch MSRs which don't exist on those families, causing crashes.
2. The Xen partial emulation of HyperV can be dealt with more gracefully than just disabling the driver.
3. More EFI variable space magic. In particular, variables hidden from runtime code need to be taken into account too.
The following changes since commit 26564600c9e88c6572a5e6ef5ae9121907edfb7f:
x86/mm: Flush lazy MMU when DEBUG_PAGEALLOC is set (2013-04-12 07:19:19 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
for you to fetch changes up to c0a9f451e4e7ecd2ad1a6c27ea5c31d0226bdddf:
Merge remote-tracking branch 'efi/urgent' into x86/urgent (2013-04-19 17:09:03 -0700)
----------------------------------------------------------------
H. Peter Anvin (2):
x86, microcode: Verify the family before dispatching microcode patching Merge remote-tracking branch 'efi/urgent' into x86/urgent
K. Y. Srinivasan (1):
x86, hyperv: Handle Xen emulation of Hyper-V more gracefully
Matt Fleming (1):
x86, efivars: firmware bug workarounds should be in platform code
Matthew Garrett (3):
Move utf16 functions to kernel core and rename
efi: Pass boot services variable info to runtime code
efi: Distinguish between "remaining space" and actually used space
Richard Weinberger (2):
x86,efi: Check max_size only if it is non-zero. x86,efi: Implement efi_no_storage_paranoia parameter
Sergey Vlasov (2):
x86/Kconfig: Make EFI select UCS2_STRING
efi: Export efi_query_variable_store() for efivars.ko
Documentation/kernel-parameters.txt | 6 ++ arch/x86/Kconfig | 1 + arch/x86/boot/compressed/eboot.c | 47 +++++++++ arch/x86/include/asm/efi.h | 7 ++ arch/x86/include/uapi/asm/bootparam.h | 1 + arch/x86/kernel/cpu/mshyperv.c | 18 +--- arch/x86/kernel/microcode_core_early.c | 38 ++++++-- arch/x86/platform/efi/efi.c | 168 ++++++++++++++++++++++++++++++++- drivers/firmware/Kconfig | 1 + drivers/firmware/efivars.c | 98 +++++-------------- include/linux/efi.h | 9 +- include/linux/ucs2_string.h | 14 +++ lib/Kconfig | 3 + lib/Makefile | 2 + lib/ucs2_string.c | 51 ++++++++++ 15 files changed, 361 insertions(+), 103 deletions(-) create mode 100644 include/linux/ucs2_string.h create mode 100644 lib/ucs2_string.c
Documentation/kernel-parameters.txt +6 -0
@@ -788,6 +788,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. edd= [EDD] Format: {"off" | "on" | "skip[mbr]"} + efi_no_storage_paranoia [EFI; X86] + Using this parameter you can use more than 50% of + your efi variable storage. Use this parameter only if + you are really sure that your UEFI does sane gc and + fulfills the spec otherwise your board may brick. + eisa_irq_edge= [PARISC,HW] See header of drivers/parisc/eisa.c.
arch/x86/Kconfig +1 -0
@@ -1549,6 +1549,7 @@ config X86_SMAP config EFI bool "EFI runtime service support" depends on ACPI + select UCS2_STRING ---help--- This enables the kernel to use EFI runtime services that are available (such as the EFI variable services).
arch/x86/boot/compressed/eboot.c +47 -0
59 lines not on this page · raw message
arch/x86/include/asm/efi.h +7 -0
@@ -102,6 +102,13 @@ extern void efi_call_phys_epilog(void);extern void efi_unmap_memmap (void );extern void efi_memory_uc (u64 addr,unsigned long size); +struct efi_var_bootdata { +struct setup_data data; +u64 store_size; +u64 remaining_size; +u64 max_var_size; +}; +#ifdef CONFIG_EFI static inline bool efi_is_native (void )
arch/x86/include/uapi/asm/bootparam.h +1 -0
@@ -6,6 +6,7 @@#define SETUP_E820_EXT 1#define SETUP_DTB 2#define SETUP_PCI 3 +#define SETUP_EFI_VARS 4/* ram_size flags */ #define RAMDISK_IMAGE_START_MASK 0x07FF
arch/x86/kernel/cpu/mshyperv.c +5 -13
@@ -35,13 +35,6 @@ static bool __init ms_hyperv_platform(void)if (!boot_cpu_has (X86_FEATURE_HYPERVISOR ))return false; -/* -* Xen emulates Hyper-V to support enlightened Windows. -* Check to see first if we are on a Xen Hypervisor. -*/ -if (xen_cpuid_base ()) -return false; -cpuid (HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS , &eax, &hyp_signature[0 ], &hyp_signature[1 ], &hyp_signature[2 ]);
@@ -82,12 +75,6 @@ static void __init ms_hyperv_init_platform(void)if (ms_hyperv.features &HV_X64_MSR_TIME_REF_COUNT_AVAILABLE )clocksource_register_hz (&hyperv_cs,NSEC_PER_SEC /100 ); -#if IS_ENABLED (CONFIG_HYPERV ) -/* -* Setup the IDT for hypervisor callback. -*/ -alloc_intr_gate (HYPERVISOR_CALLBACK_VECTOR , hyperv_callback_vector); -#endif }const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
@@ -103,6 +90,11 @@ static irq_handler_t vmbus_isr;void hv_register_vmbus_handler (int irq,irq_handler_t handler) { +/* +* Setup the IDT for hypervisor callback. +*/ +alloc_intr_gate (HYPERVISOR_CALLBACK_VECTOR , hyperv_callback_vector); + vmbus_irq = irq; vmbus_isr = handler; }
arch/x86/kernel/microcode_core_early.c +31 -7
@@ -45,9 +45,6 @@ static int __cpuinit x86_vendor(void)u32 eax =0x00000000 ;u32 ebx, ecx =0 , edx; -if (!have_cpuid_p ()) -return X86_VENDOR_UNKNOWN ; -native_cpuid (&eax, &ebx, &ecx, &edx);if (CPUID_IS (CPUID_INTEL1 ,CPUID_INTEL2 ,CPUID_INTEL3 , ebx, ecx, edx))
@@ -59,18 +56,45 @@ static int __cpuinit x86_vendor(void)return X86_VENDOR_UNKNOWN ; } +static int __cpuinit x86_family (void ) +{ +u32 eax =0x00000001 ; +u32 ebx, ecx =0 , edx; +int x86; + +native_cpuid (&eax, &ebx, &ecx, &edx); + + x86 = (eax >>8 ) &0xf ; +if (x86 ==15 ) + x86 += (eax >>20 ) &0xff ; + +return x86; +} +void __init load_ucode_bsp (void ) { -int vendor =x86_vendor (); +int vendor, x86; + +if (!have_cpuid_p ()) +return ; -if (vendor ==X86_VENDOR_INTEL ) + vendor =x86_vendor (); + x86 =x86_family (); + +if (vendor ==X86_VENDOR_INTEL && x86 >=6 )load_ucode_intel_bsp (); }void __cpuinit load_ucode_ap (void ) { -int vendor =x86_vendor (); +int vendor, x86; + +if (!have_cpuid_p ()) +return ; + + vendor =x86_vendor (); + x86 =x86_family (); -if (vendor ==X86_VENDOR_INTEL ) +if (vendor ==X86_VENDOR_INTEL && x86 >=6 )load_ucode_intel_ap (); }
arch/x86/platform/efi/efi.c +163 -5
219 lines not on this page · raw message
drivers/firmware/Kconfig +1 -0
@@ -39,6 +39,7 @@ config FIRMWARE_MEMMAP config EFI_VARS tristate "EFI Variable Support via sysfs" depends on EFI + select UCS2_STRING default n help If you say Y here, you are able to get EFI (Extensible Firmware
drivers/firmware/efivars.c +21 -77
199 lines not on this page · raw message
include/linux/efi.h +8 -1
@@ -333,6 +333,7 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,unsigned long count, u64 *max_size, int *reset_type); +typedef efi_status_t efi_query_variable_store_t (u32 attributes,unsigned long size);/* * EFI Configuration Table and GUID definitions
@@ -575,9 +576,15 @@ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if pos#ifdef CONFIG_X86 extern void efi_late_init (void );extern void efi_free_boot_services (void ); +extern efi_status_t efi_query_variable_store (u32 attributes,unsigned long size);#else static inline void efi_late_init (void ) {}static inline void efi_free_boot_services (void ) {} + +static inline efi_status_t efi_query_variable_store (u32 attributes,unsigned long size) +{ +return EFI_SUCCESS ; +}#endif extern void __iomem *efi_lookup_mapped_addr (u64 phys_addr);extern u64 efi_get_iobase (void );
@@ -731,7 +738,7 @@ struct efivar_operations {efi_get_variable_t *get_variable;efi_get_next_variable_t *get_next_variable;efi_set_variable_t *set_variable; -efi_query_variable_info_t *query_variable_info; +efi_query_variable_store_t *query_variable_store; };struct efivars {
include/linux/ucs2_string.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _LINUX_UCS2_STRING_H_ +#define _LINUX_UCS2_STRING_H_ + +#include <linux/types.h> /* for size_t */ +#include <linux/stddef.h> /* for NULL */ + +typedef u16 ucs2_char_t ; + +unsigned long ucs2_strnlen (const ucs2_char_t *s,size_t maxlength); +unsigned long ucs2_strlen (const ucs2_char_t *s); +unsigned long ucs2_strsize (const ucs2_char_t *data,unsigned long maxlength); +int ucs2_strncmp (const ucs2_char_t *a,const ucs2_char_t *b,size_t len); + +#endif /* _LINUX_UCS2_STRING_H_ */
lib/Kconfig +3 -0
@@ -404,4 +404,7 @@ config OID_REGISTRY help Enable fast lookup object identifier registry. +config UCS2_STRING + tristate + endmenu
lib/Makefile +2 -0
@@ -174,3 +174,5 @@ quiet_cmd_build_OID_registry = GEN $@ cmd_build_OID_registry = perl $(srctree)/$(src)/build_OID_registry $< $@ clean-files += oid_registry_data.c + +obj-$(CONFIG_UCS2_STRING) += ucs2_string.o
lib/ucs2_string.c new file +51 -0
51 lines not on this page · raw message