1. 20 Dec, 2016 3 commits
    • Borislav Petkov's avatar
      x86/alternatives: Do not use sync_core() to serialize I$ · 34bfab0e
      Borislav Petkov authored
      We use sync_core() in the alternatives code to stop speculative
      execution of prefetched instructions because we are potentially changing
      them and don't want to execute stale bytes.
      
      What it does on most machines is call CPUID which is a serializing
      instruction. And that's expensive.
      
      However, the instruction cache is serialized when we're on the local CPU
      and are changing the data through the same virtual address. So then, we
      don't need the serializing CPUID but a simple control flow change. Last
      being accomplished with a CALL/RET which the noinline causes.
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Andrew Cooper <andrew.cooper3@citrix.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
      Cc: Matthew Whitehead <tedheadster@gmail.com>
      Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20161203150258.vwr5zzco7ctgc4pe@pd.tnicSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      34bfab0e
    • Borislav Petkov's avatar
      x86/topology: Document cpu_llc_id · a268b5f1
      Borislav Petkov authored
      It means different things on Intel and AMD so write it down so that
      there's no confusion.
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yazen Ghannam <yazen.ghannam@amd.com>
      Link: http://lkml.kernel.org/r/20161117094557.jm6hwzdd52h7iwnj@pd.tnicSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a268b5f1
    • Vitaly Kuznetsov's avatar
      x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic · 59107e2f
      Vitaly Kuznetsov authored
      There is a feature in Hyper-V ('Debug-VM --InjectNonMaskableInterrupt')
      which injects NMI to the guest. We may want to crash the guest and do kdump
      on this NMI by enabling unknown_nmi_panic. To make kdump succeed we need to
      allow the kdump kernel to re-establish VMBus connection so it will see
      VMBus devices (storage, network,..).
      
      To properly unload VMBus making it possible to start over during kdump we
      need to do the following:
      
       - Send an 'unload' message to the hypervisor. This can be done on any CPU
         so we do this the crashing CPU.
      
       - Receive the 'unload finished' reply message. WS2012R2 delivers this
         message to the CPU which was used to establish VMBus connection during
         module load and this CPU may differ from the CPU sending 'unload'.
      
      Receiving a VMBus message means the following:
      
       - There is a per-CPU slot in memory for one message. This slot can in
         theory be accessed by any CPU.
      
       - We get an interrupt on the CPU when a message was placed into the slot.
      
       - When we read the message we need to clear the slot and signal the fact
         to the hypervisor. In case there are more messages to this CPU pending
         the hypervisor will deliver the next message. The signaling is done by
         writing to an MSR so this can only be done on the appropriate CPU.
      
      To avoid doing cross-CPU work on crash we have vmbus_wait_for_unload()
      function which checks message slots for all CPUs in a loop waiting for the
      'unload finished' messages. However, there is an issue which arises when
      these conditions are met:
      
       - We're crashing on a CPU which is different from the one which was used
         to initially contact the hypervisor.
      
       - The CPU which was used for the initial contact is blocked with interrupts
         disabled and there is a message pending in the message slot.
      
      In this case we won't be able to read the 'unload finished' message on the
      crashing CPU. This is reproducible when we receive unknown NMIs on all CPUs
      simultaneously: the first CPU entering panic() will proceed to crash and
      all other CPUs will stop themselves with interrupts disabled.
      
      The suggested solution is to handle unknown NMIs for Hyper-V guests on the
      first CPU which gets them only. This will allow us to rely on VMBus
      interrupt handler being able to receive the 'unload finish' message in
      case it is delivered to a different CPU.
      
      The issue is not reproducible on WS2016 as Debug-VM delivers NMI to the
      boot CPU only, WS2012R2 and earlier Hyper-V versions are affected.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Acked-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Cc: devel@linuxdriverproject.org
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Link: http://lkml.kernel.org/r/20161202100720.28121-1-vkuznets@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      59107e2f
  2. 19 Dec, 2016 17 commits
  3. 18 Dec, 2016 20 commits
    • Emil Bartczak's avatar
      rtc: mcp795: Fix whitespace and indentation. · d3e59259
      Emil Bartczak authored
      Fix whitespace and indentation errors and the following
      checkpatch warnings:
      - line 15: Block comments use a trailing */ on a separate line
      - line 256: Line over 80 characters
      No code change.
      Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      d3e59259
    • Emil Bartczak's avatar
      rtc: mcp795: Prefer using the BIT() macro. · a2b42997
      Emil Bartczak authored
      This patch doesn't change the code but replaces all bitmask values
      with the BIT(x) macro.
      Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      a2b42997
    • Emil Bartczak's avatar
      rtc: mcp795: fix month write resetting date to 1. · 43d0b10f
      Emil Bartczak authored
      According to Microchip errata some combinations of date and month
      values may result in the date being reset to 1, even if the date
      is also written with the month (for example 31-07 or 31-08).
      As a workaround avoid writing date and month values within the same
      Write command. Instead, terminate the Write command after loading
      the date and begin a new command to write the month. In addition,
      disable the oscillator before loading the new values. This is done
      by ensuring both the ST and EXTOSC bits are cleared and waiting for
      the OSCON bit to clear.
      Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      43d0b10f
    • Emil Bartczak's avatar
      rtc: mcp795: fix time range difference between linux and RTC chip. · 26eeefd5
      Emil Bartczak authored
      In linux rtc_time struct, tm_mon range is 0~11, while in RTC HW REG,
      month range is 1~12. This patch adjusts difference of them.
      Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      26eeefd5
    • Emil Bartczak's avatar
      rtc: mcp795: fix bitmask value for leap year (LP). · e72765c6
      Emil Bartczak authored
      According the datasheet the leap year is a fifth bit in month register.
      Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      e72765c6
    • Emil Bartczak's avatar
      rtc: mcp795: use bcd2bin/bin2bcd. · bcf18d88
      Emil Bartczak authored
      Change rtc-mcp795.c to use the bcd2bin/bin2bcd functions.
      This change fixes the wrong conversion of month value
      from binary to BCD (missing right shift operation for 10 month).
      Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      bcf18d88
    • Akinobu Mita's avatar
      rtc: add support for EPSON TOYOCOM RTC-7301SF/DG · 0b6a8f5c
      Akinobu Mita authored
      This adds support for EPSON TOYOCOM RTC-7301SF/DG which has parallel
      interface compatible with SRAM.
      
      This driver supports basic clock, calendar and alarm functionality.
      
      Tested with Microblaze linux running on Artix7 FPGA board with my own
      custom IP for RTC-7301.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      0b6a8f5c
    • Tin Huynh's avatar
      rtc: ds1307: Add ACPI support · 9c19b893
      Tin Huynh authored
      This patch enables ACPI support for rtc-ds1307 driver.
      Signed-off-by: default avatarTin Huynh <tnhuynh@apm.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      9c19b893
    • Linus Torvalds's avatar
      Merge tag 'libnvdimm-for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · 3be134e5
      Linus Torvalds authored
      Pull libnvdimm updates from Dan Williams:
       "The libnvdimm pull request is relatively small this time around due to
        some development topics being deferred to 4.11.
      
        As for this pull request the bulk of it has been in -next for several
        releases leading to one late fix being added (commit 868f036f
        ("libnvdimm: fix mishandled nvdimm_clear_poison() return value")). It
        has received a build success notification from the 0day-kbuild robot
        and passes the latest libnvdimm unit tests.
      
        Summary:
      
         - Dynamic label support: To date namespace label support has been
           limited to disambiguating cases where PMEM (direct load/store) and
           BLK (mmio aperture) accessed-capacity alias on the same DIMM. Since
           4.9 added support for multiple namespaces per PMEM-region there is
           value to support namespace labels even in the non-aliasing case.
           The presence of a valid namespace index block force-enables label
           support when the kernel would otherwise rely on region boundaries,
           and permits the region to be sub-divided.
      
         - Handle media errors in namespace metadata: Complement the error
           handling for media errors in namespace data areas with support for
           clearing errors on writes, and downgrading potential machine-check
           exceptions to simple i/o errors on read.
      
         - Device-DAX region attributes: Add 'align', 'id', and 'size' as
           attributes for device-dax regions. In particular this enables
           userspace tooling to generically size memory mapping and i/o
           operations. Prevent userspace from growing assumptions /
           dependencies about the parent device topology for a dax region. A
           libnvdimm namespace may not always be the parent device of a dax
           region.
      
         - Various cleanups and small fixes"
      
      * tag 'libnvdimm-for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        dax: add region 'id', 'size', and 'align' attributes
        libnvdimm: fix mishandled nvdimm_clear_poison() return value
        libnvdimm: replace mutex_is_locked() warnings with lockdep_assert_held
        libnvdimm, pfn: fix align attribute
        libnvdimm, e820: use module_platform_driver
        libnvdimm, namespace: use octal for permissions
        libnvdimm, namespace: avoid multiple sector calculations
        libnvdimm: remove else after return in nsio_rw_bytes()
        libnvdimm, namespace: fix the type of name variable
        libnvdimm: use consistent naming for request_mem_region()
        nvdimm: use the right length of "pmem"
        libnvdimm: check and clear poison before writing to pmem
        tools/testing/nvdimm: dynamic label support
        libnvdimm: allow a platform to force enable label support
        libnvdimm: use generic iostat interfaces
      3be134e5
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v4.10-2' of... · 8421c604
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v4.10-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
      
      Pull more x86 platform driver updates from Darren Hart:
       "Move and add registration for the mlx-platform driver. Introduce
        button and lid drivers for the surface3 (different from the
        surface3-pro). Add BXT PMIC TMU support. Add Y700 to existing
        ideapad-laptop quirk.
      
        Summary:
      
        ideapad-laptop:
         - Add Y700 15-ACZ to no_hw_rfkill DMI list
      
        surface3_button:
         - Introduce button support for the Surface 3
      
        surface3-wmi:
         - Add custom surface3 platform device for controlling LID
         - Balance locking on error path
      
        mlx-platform:
         - Add mlxcpld-hotplug driver registration
         - Fix semicolon.cocci warnings
         - Move module from arch/x86
      
        platform/x86:
         - Add Whiskey Cove PMIC TMU support"
      
      * tag 'platform-drivers-x86-v4.10-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
        platform/x86: surface3-wmi: Balance locking on error path
        platform/x86: Add Whiskey Cove PMIC TMU support
        platform/x86: ideapad-laptop: Add Y700 15-ACZ to no_hw_rfkill DMI list
        platform/x86: Introduce button support for the Surface 3
        platform/x86: Add custom surface3 platform device for controlling LID
        platform/x86: mlx-platform: Add mlxcpld-hotplug driver registration
        platform/x86: mlx-platform: Fix semicolon.cocci warnings
        platform/x86: mlx-platform: Move module from arch/x86
      8421c604
    • Andy Shevchenko's avatar
      platform/x86: surface3-wmi: Balance locking on error path · 83da6b59
      Andy Shevchenko authored
      There is a possibility that lock will be left acquired.
      Consolidate error path under out_free_unlock label.
      Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
      Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      83da6b59
    • Nilesh Bacchewar's avatar
      platform/x86: Add Whiskey Cove PMIC TMU support · 957ae509
      Nilesh Bacchewar authored
      This adds TMU (Time Management Unit) support for Intel BXT platform.
      It enables the alarm wake-up functionality in the TMU unit of Whiskey Cove
      PMIC.
      Signed-off-by: default avatarNilesh Bacchewar <nilesh.bacchewar@intel.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      [andy: resolve merge conflict in Kconfig]
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      957ae509
    • Linus Torvalds's avatar
      Merge branch 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f7dd3b17
      Linus Torvalds authored
      Pull timer updates from Thomas Gleixner:
       "This is the last functional update from the tip tree for 4.10. It got
        delayed due to a newly reported and anlyzed variant of BIOS bug and
        the resulting wreckage:
      
         - Seperation of TSC being marked realiable and the fact that the
           platform provides the TSC frequency via CPUID/MSRs and making use
           for it for GOLDMONT.
      
         - TSC adjust MSR validation and sanitizing:
      
           The TSC adjust MSR contains the offset to the hardware counter. The
           sum of the adjust MSR and the counter is the TSC value which is
           read via RDTSC.
      
           On at least two machines from different vendors the BIOS sets the
           TSC adjust MSR to negative values. This happens on cold and warm
           boot. While on cold boot the offset is a few milliseconds, on warm
           boot it basically compensates the power on time of the system. The
           BIOSes are not even using the adjust MSR to set all CPUs in the
           package to the same offset. The offsets are different which renders
           the TSC unusable,
      
           What's worse is that the TSC deadline timer has a HW feature^Wbug.
           It malfunctions when the TSC adjust value is negative or greater
           equal 0x80000000 resulting in silent boot failures, hard lockups or
           non firing timers. This looks like some hardware internal 32/64bit
           issue with a sign extension problem. Intel has been silent so far
           on the issue.
      
           The update contains sanity checks and keeps the adjust register
           within working limits and in sync on the package.
      
           As it looks like this disease is spreading via BIOS crapware, we
           need to address this urgently as the boot failures are hard to
           debug for users"
      
      * 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/tsc: Limit the adjust value further
        x86/tsc: Annotate printouts as firmware bug
        x86/tsc: Force TSC_ADJUST register to value >= zero
        x86/tsc: Validate TSC_ADJUST after resume
        x86/tsc: Validate cpumask pointer before accessing it
        x86/tsc: Fix broken CONFIG_X86_TSC=n build
        x86/tsc: Try to adjust TSC if sync test fails
        x86/tsc: Prepare warp test for TSC adjustment
        x86/tsc: Move sync cleanup to a safe place
        x86/tsc: Sync test only for the first cpu in a package
        x86/tsc: Verify TSC_ADJUST from idle
        x86/tsc: Store and check TSC ADJUST MSR
        x86/tsc: Detect random warps
        x86/tsc: Use X86_FEATURE_TSC_ADJUST in detect_art()
        x86/tsc: Finalize the split of the TSC_RELIABLE flag
        x86/tsc: Set TSC_KNOWN_FREQ and TSC_RELIABLE flags on Intel Atom SoCs
        x86/tsc: Mark Intel ATOM_GOLDMONT TSC reliable
        x86/tsc: Mark TSC frequency determined by CPUID as known
        x86/tsc: Add X86_FEATURE_TSC_KNOWN_FREQ flag
      f7dd3b17
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1bbb05f5
      Linus Torvalds authored
      Pull x86 fixes and cleanups from Thomas Gleixner:
       "This set of updates contains:
      
         - Robustification for the logical package managment. Cures the AMD
           and virtualization issues.
      
         - Put the correct start_cpu() return address on the stack of the idle
           task.
      
         - Fixups for the fallout of the nodeid <-> cpuid persistent mapping
           modifciations
      
         - Move the x86/MPX specific mm_struct member to the arch specific
           mm_context where it belongs
      
         - Cleanups for C89 struct initializers and useless function
           arguments"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/floppy: Use designated initializers
        x86/mpx: Move bd_addr to mm_context_t
        x86/mm: Drop unused argument 'removed' from sync_global_pgds()
        ACPI/NUMA: Do not map pxm to node when NUMA is turned off
        x86/acpi: Use proper macro for invalid node
        x86/smpboot: Prevent false positive out of bounds cpumask access warning
        x86/boot/64: Push correct start_cpu() return address
        x86/boot/64: Use 'push' instead of 'call' in start_cpu()
        x86/smpboot: Make logical package management more robust
      1bbb05f5
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 451bb1a6
      Linus Torvalds authored
      Pull timer fix from Thomas Gleixner:
       "Prevent NULL pointer dereferencing in the tick broadcast code. Old
        bug, which got unearthed by the hotplug ordering problem"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        tick/broadcast: Prevent NULL pointer dereference
      451bb1a6
    • Linus Torvalds's avatar
      Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 98da295b
      Linus Torvalds authored
      Pull SMP hotplug fixes from Thomas Gleixner:
       "Two fixlets for cpu hotplug:
      
         - Fix a subtle ordering problem with the dummy timer. This happened
           to work before the conversion by chance due to initcall ordering.
      
         - Fix the function comment for __cpuhp_setup_state()"
      
      * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpu/hotplug: Clarify description of __cpuhp_setup_state() return value
        clocksource/dummy_timer: Move hotplug callback after the real timers
      98da295b
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · eb3a3c07
      Linus Torvalds authored
      Pull irq fix from Thomas Gleixner:
       "A fix for the irq affinity spread algorithm so it handles non linear
        node numbering nicely"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq/affinity: Fix node generation from cpumask
      eb3a3c07
    • Thomas Gleixner's avatar
      x86/tsc: Limit the adjust value further · 8c9b9d87
      Thomas Gleixner authored
      Adjust value 0x80000000 and other values larger than that render the TSC
      deadline timer disfunctional.
      
      We have not yet any information about this from Intel, but experimentation
      clearly proves that this is a 32/64 bit and sign extension issue.
      
      If adjust values larger than that are actually required, which might be the
      case for physical CPU hotplug, then we need to disable the deadline timer
      on the affected package/CPUs and use the local APIC timer instead.
      
      That requires some surgery in the APIC setup code, so we just limit the
      ADJUST register value into the known to work range for now and revisit this
      when Intel comes forth with proper information.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Roland Scheidegger <rscheidegger_lists@hispeed.ch>
      Cc: Bruce Schlobohm <bruce.schlobohm@intel.com>
      Cc: Kevin Stanton <kevin.b.stanton@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      8c9b9d87
    • Thomas Gleixner's avatar
      x86/tsc: Annotate printouts as firmware bug · 16588f65
      Thomas Gleixner authored
      Make it more obvious that the BIOS is screwed up.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Roland Scheidegger <rscheidegger_lists@hispeed.ch>
      Cc: Bruce Schlobohm <bruce.schlobohm@intel.com>
      Cc: Kevin Stanton <kevin.b.stanton@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      16588f65
    • Kees Cook's avatar
      x86/floppy: Use designated initializers · ffc7dc8d
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20161217213705.GA1248@beastSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ffc7dc8d