x86 fixes
Linus,
Please pull the latest x86-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
# HEAD: f2853308b6409b97799b0beceacd9da43a82fe43 x86/build/x86_64_defconfig: Enable CONFIG_R8169
Misc fixes and minor updates all over the place:
- An SGI/UV fix,
- a defconfig update,
- a build warning fix,
- move the boot_params file to the arch location in debugfs,
- a pkeys fix,
- selftests fix,
- boot message fixes,
- sparse fixes,
- a resume warning fix,
- ioapic hotplug fixes,
- reboot quirks,
- ... plus various minor cleanups.
out-of-topic modifications in x86-urgent-for-linus:
-----------------------------------------------------
drivers/acpi/internal.h # f2ae5da72617: x86/ioapic: Split IOAPIC hot drivers/acpi/ioapic.c # f2ae5da72617: x86/ioapic: Split IOAPIC hot drivers/acpi/pci_root.c # f2ae5da72617: x86/ioapic: Split IOAPIC hot
tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c# 940b2f2fd963: x86/events: Remove last remn tools/testing/selftests/x86/fsgsbase.c# 2a4d0c627f53: x86/selftests: Add clobbers tools/testing/selftests/x86/ldt_gdt.c# 2a4d0c627f53: x86/selftests: Add clobbers tools/testing/selftests/x86/ptrace_syscall.c# 2a4d0c627f53: x86/selftests: Add clobbers tools/testing/selftests/x86/single_step_syscall.c# 2a4d0c627f53: x86/selftests: Add clobbers
Thanks,
Ingo
------------------>
Andrew Banman (1):
x86/platform/uv/BAU: Fix HUB errors by remove initial write to sw-ack register
Andy Shevchenko (1):
x86/build/x86_64_defconfig: Enable CONFIG_R8169
Arnd Bergmann (1):
x86/hyperv: Hide unused label
Borislav Petkov (3):
x86/kdebugfs: Move boot params hierarchy under (debugfs)/x86/ x86/events: Remove last remnants of old filenames x86/boot: Correct setup_header.start_sys name
Dave Hansen (1):
x86/pkeys: Check against max pkey to avoid overflows
Dmitry Safonov (1):
x86/selftests: Add clobbers for int80 on x86_64
Dou Liyang (2):
x86/apic: Fix a warning message in logical CPU IDs allocation x86/apic: Simplify enable_IR_x2apic(), remove try_to_enable_IR()
Masanari Iida (2):
x86/vmware: Remove duplicate inclusion of asm/timer.h x86/intel_rdt: Remove duplicate inclusion of linux/cpu.h
Matjaz Hegedic (2):
x86/reboot/quirks: Add ASUS EeeBook X205TA reboot quirk x86/reboot/quirks: Add ASUS EeeBook X205TA/W reboot quirk
Rui Wang (2):
x86/PCI: Implement pcibios_release_device to release IRQ from IOAPIC x86/ioapic: Split IOAPIC hot-removal into two steps
Thomas Gleixner (1):
x86/hpet: Prevent might sleep splat on resume
Tobin C. Harding (2):
x86/purgatory: Make functions and variables static x86/purgatory: Fix sparse warning, symbol not declared
arch/x86/configs/x86_64_defconfig | 1 + arch/x86/events/amd/core.c | 2 +- arch/x86/events/intel/cstate.c | 2 +- arch/x86/events/intel/rapl.c | 2 +- arch/x86/events/intel/uncore.h | 6 +++--- arch/x86/hyperv/hv_init.c | 2 +- arch/x86/include/asm/pkeys.h | 15 ++++++++------ arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/kernel/apic/apic.c | 23 +++++++--------------- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 1 - arch/x86/kernel/cpu/vmware.c | 1 - arch/x86/kernel/hpet.c | 2 +- arch/x86/kernel/kdebugfs.c | 2 +- arch/x86/kernel/reboot.c | 16 +++++++++++++++ arch/x86/pci/common.c | 9 +++++++++ arch/x86/platform/uv/tlb_uv.c | 1 - arch/x86/purgatory/purgatory.c | 11 ++++++----- arch/x86/purgatory/purgatory.h | 8 ++++++++ arch/x86/purgatory/setup-x86_64.S | 1 + drivers/acpi/internal.h | 2 ++ drivers/acpi/ioapic.c | 22 +++++++++++++++------ drivers/acpi/pci_root.c | 4 ++-- .../util/intel-pt-decoder/intel-pt-insn-decoder.c | 2 +- tools/testing/selftests/x86/fsgsbase.c | 2 +- tools/testing/selftests/x86/ldt_gdt.c | 16 ++++++++++----- tools/testing/selftests/x86/ptrace_syscall.c | 3 ++- tools/testing/selftests/x86/single_step_syscall.c | 5 ++++- 27 files changed, 106 insertions(+), 57 deletions(-) create mode 100644 arch/x86/purgatory/purgatory.h
arch/x86/configs/x86_64_defconfig +1 -0
@@ -176,6 +176,7 @@ CONFIG_E1000E=y CONFIG_SKY2=y CONFIG_FORCEDETH=y CONFIG_8139TOO=y +CONFIG_R8169=y CONFIG_FDDI=y CONFIG_INPUT_POLLDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
arch/x86/events/amd/core.c +1 -1
@@ -604,7 +604,7 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, int idx,return &amd_f15_PMC20; }case AMD_EVENT_NB : -/* moved to perf_event_amd_uncore.c */ +/* moved to uncore.c */ return &emptyconstraint;default :return &emptyconstraint;
arch/x86/events/intel/cstate.c +1 -1
@@ -1,5 +1,5 @@/* -* perf_event_intel_cstate.c: support cstate residency counters +* Support cstate residency counters * * Copyright (C) 2015, Intel Corp. * Author: Kan Liang ([email protected])
arch/x86/events/intel/rapl.c +1 -1
@@ -1,5 +1,5 @@/* -* perf_event_intel_rapl.c: support Intel RAPL energy consumption counters +* Support Intel RAPL energy consumption counters * Copyright (C) 2013 Google, Inc., Stephane Eranian * * Intel RAPL interface is specified in the IA-32 Manual Vol3b
arch/x86/events/intel/uncore.h +3 -3
@@ -360,7 +360,7 @@ extern struct list_head pci2phy_map_head;extern struct pci_extra_dev *uncore_extra_pci_dev;extern struct event_constraint uncore_constraint_empty; -/* perf_event_intel_uncore_snb.c */ +/* uncore_snb.c */ int snb_uncore_pci_init (void );int ivb_uncore_pci_init (void );int hsw_uncore_pci_init (void );
@@ -371,7 +371,7 @@ void nhm_uncore_cpu_init(void);void skl_uncore_cpu_init (void );int snb_pci2phy_map_init (int devid); -/* perf_event_intel_uncore_snbep.c */ +/* uncore_snbep.c */ int snbep_uncore_pci_init (void );void snbep_uncore_cpu_init (void );int ivbep_uncore_pci_init (void );
@@ -385,5 +385,5 @@ void knl_uncore_cpu_init(void);int skx_uncore_pci_init (void );void skx_uncore_cpu_init (void ); -/* perf_event_intel_uncore_nhmex.c */ +/* uncore_nhmex.c */ void nhmex_uncore_cpu_init (void );
arch/x86/hyperv/hv_init.c +1 -1
@@ -158,13 +158,13 @@ void hyperv_init(void)clocksource_register_hz (&hyperv_cs_tsc,NSEC_PER_SEC /100 );return ; } +register_msr_cs:#endif /* * For 32 bit guests just use the MSR based mechanism for reading * the partition counter. */ -register_msr_cs: hyperv_cs = &hyperv_cs_msr;if (ms_hyperv.features &HV_X64_MSR_TIME_REF_COUNT_AVAILABLE )clocksource_register_hz (&hyperv_cs_msr,NSEC_PER_SEC /100 );
arch/x86/include/asm/pkeys.h +9 -6
@@ -46,6 +46,15 @@ extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,static inline bool mm_pkey_is_allocated (struct mm_struct *mm,int pkey) { +/* +* "Allocated" pkeys are those that have been returned +* from pkey_alloc(). pkey 0 is special, and never +* returned from pkey_alloc(). +*/ +if (pkey <=0 ) +return false; +if (pkey >=arch_max_pkey ()) +return false;return mm_pkey_allocation_map (mm) & (1U << pkey); }
@@ -82,12 +91,6 @@ int mm_pkey_alloc(struct mm_struct *mm)static inline int mm_pkey_free (struct mm_struct *mm,int pkey) { -/* -* pkey 0 is special, always allocated and can never -* be freed. -*/ -if (!pkey) -return -EINVAL ;if (!mm_pkey_is_allocated (mm, pkey))return -EINVAL ;
arch/x86/include/uapi/asm/bootparam.h +1 -1
@@ -58,7 +58,7 @@ struct setup_header {__u32 header;__u16 version;__u32 realmode_swtch; -__u16 start_sys; +__u16 start_sys_seg;__u16 kernel_version;__u8 type_of_loader;__u8 loadflags;
arch/x86/kernel/apic/apic.c +7 -16
@@ -1610,24 +1610,15 @@ static inline void try_to_enable_x2apic(int remap_mode) { }static inline void __x2apic_enable (void ) { }#endif /* !CONFIG_X86_X2APIC */ -static int __init try_to_enable_IR (void ) -{ -#ifdef CONFIG_X86_IO_APIC -if (!x2apic_enabled () && skip_ioapic_setup) { -pr_info ("Not enabling interrupt remapping due to skipped IO-APIC setup\n" ); -return -1 ; - } -#endif -return irq_remapping_enable (); -} -void __init enable_IR_x2apic (void ) {unsigned long flags;int ret, ir_stat; -if (skip_ioapic_setup) +if (skip_ioapic_setup) { +pr_info ("Not enabling interrupt remapping due to skipped IO-APIC setup\n" );return ; + } ir_stat =irq_remapping_prepare ();if (ir_stat <0 && !x2apic_supported ())
@@ -1645,7 +1636,7 @@ void __init enable_IR_x2apic(void)/* If irq_remapping_prepare() succeeded, try to enable it */ if (ir_stat >=0 ) - ir_stat =try_to_enable_IR (); + ir_stat =irq_remapping_enable ();/* ir_stat contains the remap mode or an error code */ try_to_enable_x2apic (ir_stat);
@@ -2062,10 +2053,10 @@ static int allocate_logical_cpuid(int apicid)/* Allocate a new cpuid. */ if (nr_logical_cpuids >= nr_cpu_ids) { -WARN_ONCE (1 ,"Only %d processors supported." +WARN_ONCE (1 ,"APIC: NR_CPUS/possible_cpus limit of %i reached. " "Processor %d/0x%x and the rest are ignored.\n" , - nr_cpu_ids -1 , nr_logical_cpuids, apicid); -return -1 ; + nr_cpu_ids, nr_logical_cpuids, apicid); +return -EINVAL ; } cpuid_to_apicid[nr_logical_cpuids] = apicid;
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +0 -1
@@ -27,7 +27,6 @@#include <linux/seq_file.h> #include <linux/sched.h> #include <linux/slab.h> -#include <linux/cpu.h> #include <linux/task_work.h> #include <uapi/linux/magic.h>
arch/x86/kernel/cpu/vmware.c +0 -1
@@ -30,7 +30,6 @@#include <asm/hypervisor.h> #include <asm/timer.h> #include <asm/apic.h> -#include <asm/timer.h> #undef pr_fmt#define pr_fmt (fmt) "vmware: " fmt
arch/x86/kernel/hpet.c +1 -1
@@ -354,7 +354,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer)irq_domain_deactivate_irq (irq_get_irq_data (hdev->irq));irq_domain_activate_irq (irq_get_irq_data (hdev->irq)); -disable_irq (hdev->irq); +disable_hardirq (hdev->irq);irq_set_affinity (hdev->irq,cpumask_of (hdev->cpu));enable_irq (hdev->irq); }
arch/x86/kernel/kdebugfs.c +1 -1
@@ -167,7 +167,7 @@ static int __init boot_params_kdebugfs_init(void)struct dentry *dbp, *version, *data;int error = -ENOMEM ; - dbp =debugfs_create_dir ("boot_params" ,NULL ); + dbp =debugfs_create_dir ("boot_params" , arch_debugfs_dir);if (!dbp)return -ENOMEM ;
arch/x86/kernel/reboot.c +16 -0
@@ -223,6 +223,22 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { DMI_MATCH(DMI_BOARD_NAME, "P4S800"), }, }, + { /* Handle problems with rebooting on ASUS EeeBook X205TA */ + .callback = set_acpi_reboot, + .ident = "ASUS EeeBook X205TA", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "X205TAW"), + }, + }, + { /* Handle problems with rebooting on ASUS EeeBook X205TAW */ + .callback = set_acpi_reboot, + .ident = "ASUS EeeBook X205TAW", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "X205TAW"), + }, + }, /* Certec */ { /* Handle problems with rebooting on Certec BPC600 */
arch/x86/pci/common.c +9 -0
@@ -735,6 +735,15 @@ void pcibios_disable_device (struct pci_dev *dev)pcibios_disable_irq (dev); } +#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC +void pcibios_release_device (struct pci_dev *dev) +{ +if (atomic_dec_return (&dev->enable_cnt) >=0 ) +pcibios_disable_device (dev); + +} +#endif +int pci_ext_cfg_avail (void ) {if (raw_pci_ext_ops)
arch/x86/platform/uv/tlb_uv.c +0 -1
@@ -1847,7 +1847,6 @@ static void pq_init(int node, int pnode) ops.write_payload_first (pnode, first); ops.write_payload_last (pnode, last); - ops.write_g_sw_ack (pnode,0xffffUL );/* in effect, all msg_type's are set to MSG_NOOP */ memset (pqp,0 ,sizeof (struct bau_pq_entry ) *DEST_Q_SIZE );
arch/x86/purgatory/purgatory.c +6 -5
@@ -11,6 +11,7 @@*/ #include "sha256.h" +#include "purgatory.h" #include "../boot/string.h" struct sha_region {
@@ -18,11 +19,11 @@ struct sha_region {unsigned long len; }; -unsigned long backup_dest =0 ; -unsigned long backup_src =0 ; -unsigned long backup_sz =0 ; +static unsigned long backup_dest; +static unsigned long backup_src; +static unsigned long backup_sz; -u8 sha256_digest[SHA256_DIGEST_SIZE ] = {0 }; +static u8 sha256_digest[SHA256_DIGEST_SIZE ] = {0 };struct sha_region sha_regions[16 ] = {};
@@ -39,7 +40,7 @@ static int copy_backup_region(void)return 0 ; } -int verify_sha256_digest (void ) +static int verify_sha256_digest (void ) {struct sha_region *ptr, *end;u8 digest[SHA256_DIGEST_SIZE ];
arch/x86/purgatory/purgatory.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef PURGATORY_H +#define PURGATORY_H + +#ifndef __ASSEMBLY__ +extern void purgatory (void ); +#endif /* __ASSEMBLY__ */ + +#endif /* PURGATORY_H */
arch/x86/purgatory/setup-x86_64.S +1 -0
@@ -9,6 +9,7 @@ * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ +#include "purgatory.h" .text .globl purgatory_start
drivers/acpi/internal.h +2 -0
@@ -41,8 +41,10 @@ void acpi_gpe_apply_masked_gpes(void);void acpi_container_init (void );void acpi_memory_hotplug_init (void );#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC +void pci_ioapic_remove (struct acpi_pci_root *root);int acpi_ioapic_remove (struct acpi_pci_root *root);#else +static inline void pci_ioapic_remove (struct acpi_pci_root *root) {return ; }static inline int acpi_ioapic_remove (struct acpi_pci_root *root) {return 0 ; }#endif #ifdef CONFIG_ACPI_DOCK
drivers/acpi/ioapic.c +16 -6
@@ -206,24 +206,34 @@ int acpi_ioapic_add(acpi_handle root_handle)return ACPI_SUCCESS (status) &&ACPI_SUCCESS (retval) ?0 : -ENODEV ; } -int acpi_ioapic_remove (struct acpi_pci_root *root) +void pci_ioapic_remove (struct acpi_pci_root *root) { -int retval =0 ;struct acpi_pci_ioapic *ioapic, *tmp;mutex_lock (&ioapic_list_lock);list_for_each_entry_safe (ioapic, tmp, &ioapic_list, list) {if (root->device->handle != ioapic->root_handle)continue ; - -if (acpi_unregister_ioapic (ioapic->handle, ioapic->gsi_base)) - retval = -EBUSY ; -if (ioapic->pdev) {pci_release_region (ioapic->pdev,0 );pci_disable_device (ioapic->pdev);pci_dev_put (ioapic->pdev); } + } +mutex_unlock (&ioapic_list_lock); +} + +int acpi_ioapic_remove (struct acpi_pci_root *root) +{ +int retval =0 ; +struct acpi_pci_ioapic *ioapic, *tmp; + +mutex_lock (&ioapic_list_lock); +list_for_each_entry_safe (ioapic, tmp, &ioapic_list, list) { +if (root->device->handle != ioapic->root_handle) +continue ; +if (acpi_unregister_ioapic (ioapic->handle, ioapic->gsi_base)) + retval = -EBUSY ;if (ioapic->res.flags && ioapic->res.parent)release_resource (&ioapic->res);list_del (&ioapic->list);
drivers/acpi/pci_root.c +2 -2
@@ -648,12 +648,12 @@ static void acpi_pci_root_remove(struct acpi_device *device)pci_stop_root_bus (root->bus); -WARN_ON (acpi_ioapic_remove (root)); - +pci_ioapic_remove (root);device_set_run_wake (root->bus->bridge, false);pci_acpi_remove_bus_pm_notifier (device);pci_remove_root_bus (root->bus); +WARN_ON (acpi_ioapic_remove (root));dmar_device_remove (device->handle);
tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c +1 -1
@@ -31,7 +31,7 @@#error Instruction buffer size too small#endif -/* Based on branch_type() from perf_event_intel_lbr.c */ +/* Based on branch_type() from arch/x86/events/intel/lbr.c */ static void intel_pt_insn_decoder (struct insn *insn,struct intel_pt_insn *intel_pt_insn) {
tools/testing/selftests/x86/fsgsbase.c +1 -1
@@ -245,7 +245,7 @@ void do_unexpected_base(void)long ret; asmvolatile ("int $0x80" :"=a" (ret) :"a" (243 ),"b" (low_desc) - :"flags" ); + :"r8" ,"r9" ,"r10" ,"r11" );memcpy (&desc, low_desc,sizeof (desc));munmap (low_desc,sizeof (desc));
tools/testing/selftests/x86/ldt_gdt.c +11 -5
@@ -45,6 +45,12 @@#define AR_DB (1 << 22)#define AR_G (1 << 23) +#ifdef __x86_64__ +# define INT80_CLOBBERS "r8", "r9", "r10", "r11" +#else +# define INT80_CLOBBERS +#endif +static int nerrs;/* Points to an array of 1024 ints, each holding its own index. */
@@ -588,7 +594,7 @@ static int invoke_set_thread_area(void) asmvolatile ("int $0x80" :"=a" (ret),"+m" (low_user_desc) :"a" (243 ),"b" (low_user_desc) - :"flags" ); + : INT80_CLOBBERS);return ret; }
@@ -657,7 +663,7 @@ static void test_gdt_invalidation(void) "+a" (eax) : "m" (low_user_desc_clear), [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) - : "flags"); + : INT80_CLOBBERS);if (sel !=0 ) { result ="FAIL" ;
@@ -688,7 +694,7 @@ static void test_gdt_invalidation(void) "+a" (eax) : "m" (low_user_desc_clear), [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) - : "flags"); + : INT80_CLOBBERS);if (sel !=0 ) { result ="FAIL" ;
@@ -721,7 +727,7 @@ static void test_gdt_invalidation(void) "+a" (eax) : "m" (low_user_desc_clear), [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) - : "flags"); + : INT80_CLOBBERS);#ifdef __x86_64__syscall (SYS_arch_prctl,ARCH_GET_FS , &new_base);
@@ -774,7 +780,7 @@ static void test_gdt_invalidation(void) "+a" (eax) : "m" (low_user_desc_clear), [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) - : "flags"); + : INT80_CLOBBERS);#ifdef __x86_64__syscall (SYS_arch_prctl,ARCH_GET_GS , &new_base);
tools/testing/selftests/x86/ptrace_syscall.c +2 -1
@@ -58,7 +58,8 @@ static void do_full_int80(struct syscall_args32 *args) asmvolatile ("int $0x80" :"+a" (args->nr),"+b" (args->arg0),"+c" (args->arg1),"+d" (args->arg2), -"+S" (args->arg3),"+D" (args->arg4),"+r" (bp)); +"+S" (args->arg3),"+D" (args->arg4),"+r" (bp) + : :"r8" ,"r9" ,"r10" ,"r11" ); args->arg5 = bp;#else sys32_helper (args, int80_and_ret);
tools/testing/selftests/x86/single_step_syscall.c +4 -1
@@ -56,9 +56,11 @@ static volatile sig_atomic_t sig_traps;#ifdef __x86_64__# define REG_IP REG_RIP# define WIDTH "q" +# define INT80_CLOBBERS "r8", "r9", "r10", "r11"#else # define REG_IP REG_EIP# define WIDTH "l" +# define INT80_CLOBBERS #endif static unsigned long get_eflags (void )
@@ -140,7 +142,8 @@ int main()printf ("[RUN]\tSet TF and check int80\n" );set_eflags (get_eflags () |X86_EFLAGS_TF ); - asmvolatile ("int $0x80" :"=a" (tmp) :"a" (SYS_getpid)); + asmvolatile ("int $0x80" :"=a" (tmp) :"a" (SYS_getpid) + : INT80_CLOBBERS);check_result ();/*