Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 15 Feb 2018 01:02:15 +0000 (17:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 15 Feb 2018 01:02:15 +0000 (17:02 -0800)
Pull x86 PTI and Spectre related fixes and updates from Ingo Molnar:
 "Here's the latest set of Spectre and PTI related fixes and updates:

  Spectre:
   - Add entry code register clearing to reduce the Spectre attack
     surface
   - Update the Spectre microcode blacklist
   - Inline the KVM Spectre helpers to get close to v4.14 performance
     again.
   - Fix indirect_branch_prediction_barrier()
   - Fix/improve Spectre related kernel messages
   - Fix array_index_nospec_mask() asm constraint
   - KVM: fix two MSR handling bugs

  PTI:
   - Fix a paranoid entry PTI CR3 handling bug
   - Fix comments

  objtool:
   - Fix paranoid_entry() frame pointer warning
   - Annotate WARN()-related UD2 as reachable
   - Various fixes
   - Add Add Peter Zijlstra as objtool co-maintainer

  Misc:
   - Various x86 entry code self-test fixes
   - Improve/simplify entry code stack frame generation and handling
     after recent heavy-handed PTI and Spectre changes. (There's two
     more WIP improvements expected here.)
   - Type fix for cache entries

  There's also some low risk non-fix changes I've included in this
  branch to reduce backporting conflicts:

   - rename a confusing x86_cpu field name
   - de-obfuscate the naming of single-TLB flushing primitives"

* 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (41 commits)
  x86/entry/64: Fix CR3 restore in paranoid_exit()
  x86/cpu: Change type of x86_cache_size variable to unsigned int
  x86/spectre: Fix an error message
  x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping
  selftests/x86/mpx: Fix incorrect bounds with old _sigfault
  x86/mm: Rename flush_tlb_single() and flush_tlb_one() to __flush_tlb_one_[user|kernel]()
  x86/speculation: Add <asm/msr-index.h> dependency
  nospec: Move array_index_nospec() parameter checking into separate macro
  x86/speculation: Fix up array_index_nospec_mask() asm constraint
  x86/debug: Use UD2 for WARN()
  x86/debug, objtool: Annotate WARN()-related UD2 as reachable
  objtool: Fix segfault in ignore_unreachable_insn()
  selftests/x86: Disable tests requiring 32-bit support on pure 64-bit systems
  selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c
  selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c
  selftests/x86: Fix build bug caused by the 5lvl test which has been moved to the VM directory
  selftests/x86/pkeys: Remove unused functions
  selftests/x86: Clean up and document sscanf() usage
  selftests/x86: Fix vDSO selftest segfault for vsyscall=none
  x86/entry/64: Remove the unused 'icebp' macro
  ...

18 files changed:
1  2 
MAINTAINERS
arch/x86/entry/entry_64.S
arch/x86/include/asm/acpi.h
arch/x86/include/asm/processor.h
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/centaur.c
arch/x86/kernel/cpu/intel_rdt.c
arch/x86/kernel/mpparse.c
arch/x86/kvm/mmu.c
arch/x86/kvm/vmx.c
arch/x86/mm/init_64.c
arch/x86/mm/tlb.c
arch/x86/platform/uv/tlb_uv.c
drivers/cpufreq/longhaul.c
drivers/hwmon/coretemp.c
drivers/hwmon/k10temp.c
tools/objtool/check.c
tools/testing/selftests/x86/Makefile

diff --combined MAINTAINERS
index a4dcdd35d9a357d92d6d038cfbdf2b759f8c05dc,98a22cb607731d50ff3240b00bbde2dc2b8c13e1..9a7f76eadae9a51c5b49e5faadf8aa0aef19f15c
@@@ -270,7 -270,6 +270,7 @@@ ACCES 104-QUAD-8 IIO DRIVE
  M:    William Breathitt Gray <vilhelm.gray@gmail.com>
  L:    linux-iio@vger.kernel.org
  S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-bus-iio-counter-104-quad-8
  F:    drivers/iio/counter/104-quad-8.c
  
  ACCES PCI-IDIO-16 GPIO DRIVER
@@@ -279,12 -278,6 +279,12 @@@ L:       linux-gpio@vger.kernel.or
  S:    Maintained
  F:    drivers/gpio/gpio-pci-idio-16.c
  
 +ACCES PCIe-IDIO-24 GPIO DRIVER
 +M:    William Breathitt Gray <vilhelm.gray@gmail.com>
 +L:    linux-gpio@vger.kernel.org
 +S:    Maintained
 +F:    drivers/gpio/gpio-pcie-idio-24.c
 +
  ACENIC DRIVER
  M:    Jes Sorensen <jes@trained-monkey.org>
  L:    linux-acenic@sunsite.dk
@@@ -336,7 -329,7 +336,7 @@@ F: drivers/acpi/apei
  
  ACPI COMPONENT ARCHITECTURE (ACPICA)
  M:    Robert Moore <robert.moore@intel.com>
 -M:    Lv Zheng <lv.zheng@intel.com>
 +M:    Erik Schmauss <erik.schmauss@intel.com>
  M:    "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
  L:    linux-acpi@vger.kernel.org
  L:    devel@acpica.org
@@@ -860,8 -853,6 +860,8 @@@ M: Michael Hennerich <Michael.Hennerich
  W:    http://wiki.analog.com/
  W:    http://ez.analog.com/community/linux-device-drivers
  S:    Supported
 +F:    Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523
 +F:    Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350
  F:    drivers/iio/*/ad*
  F:    drivers/iio/adc/ltc2497*
  X:    drivers/iio/*/adjd*
@@@ -884,12 -875,6 +884,12 @@@ S:       Supporte
  F:    drivers/android/
  F:    drivers/staging/android/
  
 +ANDROID GOLDFISH PIC DRIVER
 +M:    Miodrag Dinic <miodrag.dinic@mips.com>
 +S:    Supported
 +F:    Documentation/devicetree/bindings/interrupt-controller/google,goldfish-pic.txt
 +F:    drivers/irqchip/irq-goldfish-pic.c
 +
  ANDROID GOLDFISH RTC DRIVER
  M:    Miodrag Dinic <miodrag.dinic@mips.com>
  S:    Supported
@@@ -903,6 -888,7 +903,6 @@@ L: devel@driverdev.osuosl.or
  S:    Supported
  F:    drivers/staging/android/ion
  F:    drivers/staging/android/uapi/ion.h
 -F:    drivers/staging/android/uapi/ion_test.h
  
  AOA (Apple Onboard Audio) ALSA DRIVER
  M:    Johannes Berg <johannes@sipsolutions.net>
@@@ -1277,12 -1263,6 +1277,12 @@@ L:    linux-arm-kernel@lists.infradead.or
  S:    Supported
  F:    drivers/net/ethernet/cavium/thunder/
  
 +ARM/CIRRUS LOGIC BK3 MACHINE SUPPORT
 +M:    Lukasz Majewski <lukma@denx.de>
 +L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    arch/arm/mach-ep93xx/ts72xx.c
 +
  ARM/CIRRUS LOGIC CLPS711X ARM ARCHITECTURE
  M:    Alexander Shiyan <shc_work@mail.ru>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@@ -1307,6 -1287,7 +1307,6 @@@ M:      Russell King <linux@armlinux.org.uk
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git clkdev
 -F:    arch/arm/include/asm/clkdev.h
  F:    drivers/clk/clkdev.c
  
  ARM/COMPULAB CM-X270/EM-X270 and CM-X300 MACHINE SUPPORT
@@@ -1340,8 -1321,7 +1340,8 @@@ F:      tools/perf/arch/arm/util/pmu.
  F:    tools/perf/arch/arm/util/auxtrace.c
  F:    tools/perf/arch/arm/util/cs-etm.c
  F:    tools/perf/arch/arm/util/cs-etm.h
 -F:    tools/perf/util/cs-etm.h
 +F:    tools/perf/util/cs-etm.*
 +F:    tools/perf/util/cs-etm-decoder/*
  
  ARM/CORGI MACHINE SUPPORT
  M:    Richard Purdie <rpurdie@rpsys.net>
@@@ -1355,10 -1335,8 +1355,10 @@@ T:    git git://github.com/ulli-kroll/linu
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/gemini.txt
  F:    Documentation/devicetree/bindings/pinctrl/cortina,gemini-pinctrl.txt
 +F:    Documentation/devicetree/bindings/net/cortina,gemini-ethernet.txt
  F:    Documentation/devicetree/bindings/rtc/faraday,ftrtc010.txt
  F:    arch/arm/mach-gemini/
 +F:    drivers/net/ethernet/cortina/
  F:    drivers/pinctrl/pinctrl-gemini.c
  F:    drivers/rtc/rtc-ftrtc010.c
  
@@@ -1613,7 -1591,6 +1613,7 @@@ F:      arch/arm/boot/dts/kirkwood
  F:    arch/arm/configs/mvebu_*_defconfig
  F:    arch/arm/mach-mvebu/
  F:    arch/arm64/boot/dts/marvell/armada*
 +F:    drivers/cpufreq/armada-37xx-cpufreq.c
  F:    drivers/cpufreq/mvebu-cpufreq.c
  F:    drivers/irqchip/irq-armada-370-xp.c
  F:    drivers/irqchip/irq-mvebu-*
@@@ -1666,38 -1643,14 +1666,38 @@@ ARM/NEC MOBILEPRO 900/c MACHINE SUPPOR
  M:    Michael Petchkovsky <mkpetch@internode.on.net>
  S:    Maintained
  
 -ARM/NOMADIK ARCHITECTURE
 -M:    Alessandro Rubini <rubini@unipv.it>
 +ARM/NOMADIK/U300/Ux500 ARCHITECTURES
  M:    Linus Walleij <linus.walleij@linaro.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-nomadik/
 -F:    drivers/pinctrl/nomadik/
 +F:    arch/arm/mach-u300/
 +F:    arch/arm/mach-ux500/
 +F:    arch/arm/boot/dts/ste-*
 +F:    drivers/clk/clk-nomadik.c
 +F:    drivers/clk/clk-u300.c
 +F:    drivers/clocksource/clksrc-dbx500-prcmu.c
 +F:    drivers/clocksource/timer-u300.c
 +F:    drivers/dma/coh901318*
 +F:    drivers/dma/ste_dma40*
 +F:    drivers/hwspinlock/u8500_hsem.c
  F:    drivers/i2c/busses/i2c-nomadik.c
 +F:    drivers/i2c/busses/i2c-stu300.c
 +F:    drivers/mfd/ab3100*
 +F:    drivers/mfd/ab8500*
 +F:    drivers/mfd/abx500*
 +F:    drivers/mfd/dbx500*
 +F:    drivers/mfd/db8500*
 +F:    drivers/pinctrl/nomadik/
 +F:    drivers/pinctrl/pinctrl-coh901*
 +F:    drivers/pinctrl/pinctrl-u300.c
 +F:    drivers/rtc/rtc-ab3100.c
 +F:    drivers/rtc/rtc-ab8500.c
 +F:    drivers/rtc/rtc-coh901331.c
 +F:    drivers/rtc/rtc-pl031.c
 +F:    drivers/watchdog/coh901327_wdt.c
 +F:    Documentation/devicetree/bindings/arm/ste-*
 +F:    Documentation/devicetree/bindings/arm/ux500/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
  
  ARM/NUVOTON W90X900 ARM ARCHITECTURE
@@@ -1735,7 -1688,9 +1735,7 @@@ L:      linux-arm-kernel@lists.infradead.or
  L:    linux-oxnas@lists.tuxfamily.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-oxnas/
 -F:    arch/arm/boot/dts/ox8*.dtsi
 -F:    arch/arm/boot/dts/wd-mbwe.dts
 -F:    arch/arm/boot/dts/cloudengines-pogoplug-series-3.dts
 +F:    arch/arm/boot/dts/ox8*.dts*
  N:    oxnas
  
  ARM/PALM TREO SUPPORT
@@@ -1743,7 -1698,8 +1743,7 @@@ M:      Tomas Cech <sleep_walker@suse.com
  L:    linux-arm-kernel@lists.infradead.org
  W:    http://hackndev.com
  S:    Maintained
 -F:    arch/arm/mach-pxa/include/mach/palmtreo.h
 -F:    arch/arm/mach-pxa/palmtreo.c
 +F:    arch/arm/mach-pxa/palmtreo.*
  
  ARM/PALMTX,PALMT5,PALMLD,PALMTE2,PALMTC SUPPORT
  M:    Marek Vasut <marek.vasut@gmail.com>
@@@ -1752,10 -1708,12 +1752,10 @@@ W:   http://hackndev.co
  S:    Maintained
  F:    arch/arm/mach-pxa/include/mach/palmtx.h
  F:    arch/arm/mach-pxa/palmtx.c
 -F:    arch/arm/mach-pxa/include/mach/palmt5.h
 -F:    arch/arm/mach-pxa/palmt5.c
 +F:    arch/arm/mach-pxa/palmt5.*
  F:    arch/arm/mach-pxa/include/mach/palmld.h
  F:    arch/arm/mach-pxa/palmld.c
 -F:    arch/arm/mach-pxa/include/mach/palmte2.h
 -F:    arch/arm/mach-pxa/palmte2.c
 +F:    arch/arm/mach-pxa/palmte2.*
  F:    arch/arm/mach-pxa/include/mach/palmtc.h
  F:    arch/arm/mach-pxa/palmtc.c
  
@@@ -1764,7 -1722,8 +1764,7 @@@ M:      Sergey Lapin <slapin@ossfans.org
  L:    linux-arm-kernel@lists.infradead.org
  W:    http://hackndev.com
  S:    Maintained
 -F:    arch/arm/mach-pxa/include/mach/palmz72.h
 -F:    arch/arm/mach-pxa/palmz72.c
 +F:    arch/arm/mach-pxa/palmz72.*
  
  ARM/PLEB SUPPORT
  M:    Peter Chubb <pleb@gelato.unsw.edu.au>
@@@ -1793,6 -1752,7 +1793,6 @@@ F:      drivers/clk/qcom
  F:    drivers/dma/qcom/
  F:    drivers/soc/qcom/
  F:    drivers/spi/spi-qup.c
 -F:    drivers/tty/serial/msm_serial.h
  F:    drivers/tty/serial/msm_serial.c
  F:    drivers/*/pm8???-*
  F:    drivers/mfd/ssbi.c
@@@ -2004,10 -1964,9 +2004,10 @@@ N:    stm3
  F:    drivers/clocksource/armv7m_systick.c
  
  ARM/TANGO ARCHITECTURE
 -M:    Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
 +M:    Marc Gonzalez <marc.w.gonzalez@free.fr>
 +M:    Mans Rullgard <mans@mansr.com>
  L:    linux-arm-kernel@lists.infradead.org
 -S:    Maintained
 +S:    Odd Fixes
  N:    tango
  
  ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
@@@ -2071,13 -2030,27 +2071,13 @@@ M:   Dmitry Eremin-Solenikov <dbaryshkov@
  M:    Dirk Opfer <dirk@opfer-online.de>
  S:    Maintained
  
 -ARM/U300 MACHINE SUPPORT
 -M:    Linus Walleij <linus.walleij@linaro.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -S:    Supported
 -F:    arch/arm/mach-u300/
 -F:    drivers/clocksource/timer-u300.c
 -F:    drivers/i2c/busses/i2c-stu300.c
 -F:    drivers/rtc/rtc-coh901331.c
 -F:    drivers/watchdog/coh901327_wdt.c
 -F:    drivers/dma/coh901318*
 -F:    drivers/mfd/ab3100*
 -F:    drivers/rtc/rtc-ab3100.c
 -F:    drivers/rtc/rtc-coh901331.c
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
 -
  ARM/UNIPHIER ARCHITECTURE
  M:    Masahiro Yamada <yamada.masahiro@socionext.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-uniphier.git
  S:    Maintained
  F:    Documentation/devicetree/bindings/gpio/gpio-uniphier.txt
 +F:    Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.txt
  F:    arch/arm/boot/dts/uniphier*
  F:    arch/arm/include/asm/hardware/cache-uniphier.h
  F:    arch/arm/mach-uniphier/
@@@ -2093,6 -2066,24 +2093,6 @@@ F:     drivers/reset/reset-uniphier.
  F:    drivers/tty/serial/8250/8250_uniphier.c
  N:    uniphier
  
 -ARM/Ux500 ARM ARCHITECTURE
 -M:    Linus Walleij <linus.walleij@linaro.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -S:    Maintained
 -F:    arch/arm/mach-ux500/
 -F:    drivers/clocksource/clksrc-dbx500-prcmu.c
 -F:    drivers/dma/ste_dma40*
 -F:    drivers/hwspinlock/u8500_hsem.c
 -F:    drivers/mfd/abx500*
 -F:    drivers/mfd/ab8500*
 -F:    drivers/mfd/dbx500*
 -F:    drivers/mfd/db8500*
 -F:    drivers/pinctrl/nomadik/pinctrl-ab*
 -F:    drivers/pinctrl/nomadik/pinctrl-nomadik*
 -F:    drivers/rtc/rtc-ab8500.c
 -F:    drivers/rtc/rtc-pl031.c
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
 -
  ARM/Ux500 CLOCK FRAMEWORK SUPPORT
  M:    Ulf Hansson <ulf.hansson@linaro.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@@ -2219,6 -2210,14 +2219,6 @@@ L:     linux-leds@vger.kernel.or
  S:    Maintained
  F:    drivers/leds/leds-as3645a.c
  
 -AS3645A LED FLASH CONTROLLER DRIVER
 -M:    Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 -L:    linux-media@vger.kernel.org
 -T:    git git://linuxtv.org/media_tree.git
 -S:    Maintained
 -F:    drivers/media/i2c/as3645a.c
 -F:    include/media/i2c/as3645a.h
 -
  ASAHI KASEI AK8974 DRIVER
  M:    Linus Walleij <linus.walleij@linaro.org>
  L:    linux-iio@vger.kernel.org
@@@ -2271,9 -2270,7 +2271,9 @@@ F:      include/linux/async_tx.
  AT24 EEPROM DRIVER
  M:    Bartosz Golaszewski <brgl@bgdev.pl>
  L:    linux-i2c@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/eeprom/at24.txt
  F:    drivers/misc/eeprom/at24.c
  F:    include/linux/platform_data/at24.h
  
@@@ -2394,6 -2391,13 +2394,6 @@@ F:     Documentation/devicetree/bindings/in
  F:    drivers/input/touchscreen/atmel_mxt_ts.c
  F:    include/linux/platform_data/atmel_mxt_ts.h
  
 -ATMEL NAND DRIVER
 -M:    Wenyou Yang <wenyou.yang@atmel.com>
 -M:    Josh Wu <rainyfeeling@outlook.com>
 -L:    linux-mtd@lists.infradead.org
 -S:    Supported
 -F:    drivers/mtd/nand/atmel/*
 -
  ATMEL SAMA5D2 ADC DRIVER
  M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-iio@vger.kernel.org
@@@ -2505,8 -2509,6 +2505,8 @@@ L:      linux-arm-kernel@lists.infradead.or
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/axentia.txt
  F:    arch/arm/boot/dts/at91-linea.dtsi
 +F:    arch/arm/boot/dts/at91-natte.dtsi
 +F:    arch/arm/boot/dts/at91-nattis-2-natte-2.dts
  F:    arch/arm/boot/dts/at91-tse850-3.dts
  
  AXENTIA ASOC DRIVERS
@@@ -2570,7 -2572,6 +2570,7 @@@ S:      Maintaine
  F:    Documentation/ABI/testing/sysfs-class-net-batman-adv
  F:    Documentation/ABI/testing/sysfs-class-net-mesh
  F:    Documentation/networking/batman-adv.rst
 +F:    include/uapi/linux/batadv_packet.h
  F:    include/uapi/linux/batman_adv.h
  F:    net/batman-adv/
  
@@@ -2694,6 -2695,7 +2694,6 @@@ F:      drivers/mtd/devices/block2mtd.
  
  BLUETOOTH DRIVERS
  M:    Marcel Holtmann <marcel@holtmann.org>
 -M:    Gustavo Padovan <gustavo@padovan.org>
  M:    Johan Hedberg <johan.hedberg@gmail.com>
  L:    linux-bluetooth@vger.kernel.org
  W:    http://www.bluez.org/
@@@ -2704,6 -2706,7 +2704,6 @@@ F:      drivers/bluetooth
  
  BLUETOOTH SUBSYSTEM
  M:    Marcel Holtmann <marcel@holtmann.org>
 -M:    Gustavo Padovan <gustavo@padovan.org>
  M:    Johan Hedberg <johan.hedberg@gmail.com>
  L:    linux-bluetooth@vger.kernel.org
  W:    http://www.bluez.org/
@@@ -2728,16 -2731,12 +2728,16 @@@ M:   Alexei Starovoitov <ast@kernel.org
  M:    Daniel Borkmann <daniel@iogearbox.net>
  L:    netdev@vger.kernel.org
  L:    linux-kernel@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
  S:    Supported
  F:    arch/x86/net/bpf_jit*
  F:    Documentation/networking/filter.txt
  F:    Documentation/bpf/
  F:    include/linux/bpf*
  F:    include/linux/filter.h
 +F:    include/trace/events/bpf.h
 +F:    include/trace/events/xdp.h
  F:    include/uapi/linux/bpf*
  F:    include/uapi/linux/filter.h
  F:    kernel/bpf/
@@@ -2841,8 -2840,6 +2841,8 @@@ S:      Maintaine
  F:    arch/arm/mach-bcm/*brcmstb*
  F:    arch/arm/boot/dts/bcm7*.dts*
  F:    drivers/bus/brcmstb_gisb.c
 +F:    arch/arm/mm/cache-b15-rac.c
 +F:    arch/arm/include/asm/hardware/cache-b15-rac.h
  N:    brcmstb
  
  BROADCOM BMIPS CPUFREQ DRIVER
@@@ -3204,7 -3201,7 +3204,7 @@@ W:      https://github.com/linux-ca
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
  S:    Maintained
 -F:    Documentation/networking/can.txt
 +F:    Documentation/networking/can.rst
  F:    net/can/
  F:    include/linux/can/core.h
  F:    include/uapi/linux/can.h
@@@ -3409,8 -3406,8 +3409,8 @@@ M:      Arnd Bergmann <arnd@arndb.de
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
  S:    Supported
 -F:    drivers/char/*
 -F:    drivers/misc/*
 +F:    drivers/char/
 +F:    drivers/misc/
  F:    include/linux/miscdevice.h
  
  CHECKPATCH
@@@ -3558,7 -3555,7 +3558,7 @@@ F:      drivers/media/platform/coda
  
  COMMON CLK FRAMEWORK
  M:    Michael Turquette <mturquette@baylibre.com>
 -M:    Stephen Boyd <sboyd@codeaurora.org>
 +M:    Stephen Boyd <sboyd@kernel.org>
  L:    linux-clk@vger.kernel.org
  Q:    http://patchwork.kernel.org/project/linux-clk/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
@@@ -4136,7 -4133,6 +4136,7 @@@ DEVANTECH SRF ULTRASONIC RANGER IIO DRI
  M:    Andreas Klinger <ak@it-klinger.de>
  L:    linux-iio@vger.kernel.org
  S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-bus-iio-distance-srf08
  F:    drivers/iio/proximity/srf*.c
  
  DEVICE COREDUMP (DEV_COREDUMP)
@@@ -4346,12 -4342,10 +4346,12 @@@ T:   git git://git.infradead.org/users/hc
  W:    http://git.infradead.org/users/hch/dma-mapping.git
  S:    Supported
  F:    lib/dma-debug.c
 -F:    lib/dma-noop.c
 +F:    lib/dma-direct.c
  F:    lib/dma-virt.c
  F:    drivers/base/dma-mapping.c
  F:    drivers/base/dma-coherent.c
 +F:    include/asm-generic/dma-mapping.h
 +F:    include/linux/dma-direct.h
  F:    include/linux/dma-mapping.h
  
  DME1737 HARDWARE MONITOR DRIVER
@@@ -4474,12 -4468,6 +4474,12 @@@ T:    git git://anongit.freedesktop.org/dr
  S:    Maintained
  F:    drivers/gpu/drm/tve200/
  
 +DRM DRIVER FOR ILITEK ILI9225 PANELS
 +M:    David Lechner <david@lechnology.com>
 +S:    Maintained
 +F:    drivers/gpu/drm/tinydrm/ili9225.c
 +F:    Documentation/devicetree/bindings/display/ili9225.txt
 +
  DRM DRIVER FOR INTEL I810 VIDEO CARDS
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/i810/
@@@ -4566,12 -4554,6 +4566,12 @@@ S:    Maintaine
  F:    drivers/gpu/drm/tinydrm/st7586.c
  F:    Documentation/devicetree/bindings/display/st7586.txt
  
 +DRM DRIVER FOR SITRONIX ST7735R PANELS
 +M:    David Lechner <david@lechnology.com>
 +S:    Maintained
 +F:    drivers/gpu/drm/tinydrm/st7735r.c
 +F:    Documentation/devicetree/bindings/display/st7735r.txt
 +
  DRM DRIVER FOR TDFX VIDEO CARDS
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/tdfx/
@@@ -4611,7 -4593,7 +4611,7 @@@ F:      include/linux/vga
  
  DRM DRIVERS AND MISC GPU PATCHES
  M:    Daniel Vetter <daniel.vetter@intel.com>
 -M:    Jani Nikula <jani.nikula@linux.intel.com>
 +M:    Gustavo Padovan <gustavo@padovan.org>
  M:    Sean Paul <seanpaul@chromium.org>
  W:    https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
  S:    Maintained
@@@ -4740,8 -4722,7 +4740,8 @@@ F:      Documentation/devicetree/bindings/di
  F:    Documentation/devicetree/bindings/display/renesas,du.txt
  
  DRM DRIVERS FOR ROCKCHIP
 -M:    Mark Yao <mark.yao@rock-chips.com>
 +M:    Sandy Huang <hjc@rock-chips.com>
 +M:    Heiko Stübner <heiko@sntech.de>
  L:    dri-devel@lists.freedesktop.org
  S:    Maintained
  F:    drivers/gpu/drm/rockchip/
@@@ -4829,15 -4810,6 +4829,15 @@@ S:    Maintaine
  F:    drivers/gpu/drm/tinydrm/
  F:    include/drm/tinydrm/
  
 +DRM TTM SUBSYSTEM
 +M:    Christian Koenig <christian.koenig@amd.com>
 +M:    Roger He <Hongbo.He@amd.com>
 +T:    git git://people.freedesktop.org/~agd5f/linux
 +S:    Maintained
 +L:    dri-devel@lists.freedesktop.org
 +F:    include/drm/ttm/
 +F:    drivers/gpu/drm/ttm/
 +
  DSBR100 USB FM RADIO DRIVER
  M:    Alexey Klimov <klimov.linux@gmail.com>
  L:    linux-media@vger.kernel.org
@@@ -4975,11 -4947,6 +4975,11 @@@ S:    Maintaine
  F:    lib/dynamic_debug.c
  F:    include/linux/dynamic_debug.h
  
 +DYNAMIC INTERRUPT MODERATION
 +M:    Tal Gilboa <talgi@mellanox.com>
 +S:    Maintained
 +F:    include/linux/net_dim.h
 +
  DZ DECSTATION DZ11 SERIAL DRIVER
  M:    "Maciej W. Rozycki" <macro@linux-mips.org>
  S:    Maintained
@@@ -5180,12 -5147,6 +5180,12 @@@ L:    linux-edac@vger.kernel.or
  S:    Maintained
  F:    drivers/edac/skx_edac.c
  
 +EDAC-TI
 +M:    Tero Kristo <t-kristo@ti.com>
 +L:    linux-edac@vger.kernel.org
 +S:    Maintained
 +F:    drivers/edac/ti_edac.c
 +
  EDIROL UA-101/UA-1000 DRIVER
  M:    Clemens Ladisch <clemens@ladisch.de>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
@@@ -5992,12 -5953,6 +5992,12 @@@ L:    linux-input@vger.kernel.or
  S:    Maintained
  F:    drivers/input/touchscreen/goodix.c
  
 +GPD POCKET FAN DRIVER
 +M:    Hans de Goede <hdegoede@redhat.com>
 +L:    platform-driver-x86@vger.kernel.org
 +S:    Maintained
 +F:    drivers/platform/x86/gpd-pocket-fan.c
 +
  GPIO ACPI SUPPORT
  M:    Mika Westerberg <mika.westerberg@linux.intel.com>
  M:    Andy Shevchenko <andriy.shevchenko@linux.intel.com>
@@@ -6015,7 -5970,6 +6015,7 @@@ F:      drivers/media/rc/gpio-ir-tx.
  
  GPIO MOCKUP DRIVER
  M:    Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
 +R:    Bartosz Golaszewski <brgl@bgdev.pl>
  L:    linux-gpio@vger.kernel.org
  S:    Maintained
  F:    drivers/gpio/gpio-mockup.c
@@@ -6571,12 -6525,6 +6571,12 @@@ F:    drivers/i2c/i2c-mux.
  F:    drivers/i2c/muxes/
  F:    include/linux/i2c-mux.h
  
 +I2C MV64XXX MARVELL AND ALLWINNER DRIVER
 +M:    Gregory CLEMENT <gregory.clement@free-electrons.com>
 +L:    linux-i2c@vger.kernel.org
 +S:    Maintained
 +F:    drivers/i2c/busses/i2c-mv64xxx.c
 +
  I2C OVER PARALLEL PORT
  M:    Jean Delvare <jdelvare@suse.com>
  L:    linux-i2c@vger.kernel.org
@@@ -6876,8 -6824,6 +6876,8 @@@ R:      Peter Meerwald-Stadler <pmeerw@pmeer
  L:    linux-iio@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
  S:    Maintained
 +F:    Documentation/ABI/testing/configfs-iio*
 +F:    Documentation/ABI/testing/sysfs-bus-iio*
  F:    Documentation/devicetree/bindings/iio/
  F:    drivers/iio/
  F:    drivers/staging/iio/
@@@ -6935,9 -6881,9 +6935,9 @@@ INFINIBAND SUBSYSTE
  M:    Doug Ledford <dledford@redhat.com>
  M:    Jason Gunthorpe <jgg@mellanox.com>
  L:    linux-rdma@vger.kernel.org
 -W:    http://www.openfabrics.org/
 +W:    https://github.com/linux-rdma/rdma-core
  Q:    http://patchwork.kernel.org/project/linux-rdma/list/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
  S:    Supported
  F:    Documentation/devicetree/bindings/infiniband/
  F:    Documentation/infiniband/
@@@ -7078,7 -7024,7 +7078,7 @@@ M:      Zhi Wang <zhi.a.wang@intel.com
  L:    intel-gvt-dev@lists.freedesktop.org
  L:    intel-gfx@lists.freedesktop.org
  W:    https://01.org/igvt-g
 -T:    git https://github.com/01org/gvt-linux.git
 +T:    git https://github.com/intel/gvt-linux.git
  S:    Supported
  F:    drivers/gpu/drm/i915/gvt/
  
@@@ -7125,14 -7071,6 +7125,14 @@@ R:    Dan Williams <dan.j.williams@intel.c
  S:    Odd fixes
  F:    drivers/dma/iop-adma.c
  
 +INTEL IPU3 CSI-2 CIO2 DRIVER
 +M:    Yong Zhi <yong.zhi@intel.com>
 +M:    Sakari Ailus <sakari.ailus@linux.intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +F:    drivers/media/pci/intel/ipu3/
 +F:    Documentation/media/uapi/v4l/pixfmt-srggb10-ipu3.rst
 +
  INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT
  M:    Krzysztof Halasa <khalasa@piap.pl>
  S:    Maintained
@@@ -7367,16 -7305,17 +7367,16 @@@ F:   drivers/tty/ipwireless
  
  IPX NETWORK LAYER
  L:    netdev@vger.kernel.org
 -S:    Odd fixes
 -F:    include/net/ipx.h
 +S:    Obsolete
  F:    include/uapi/linux/ipx.h
 -F:    net/ipx/
 +F:    drivers/staging/ipx/
  
  IRDA SUBSYSTEM
  M:    Samuel Ortiz <samuel@sortiz.org>
  L:    irda-users@lists.sourceforge.net (subscribers-only)
  L:    netdev@vger.kernel.org
  W:    http://irda.sourceforge.net/
 -S:    Maintained
 +S:    Obsolete
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git
  F:    Documentation/networking/irda.txt
  F:    drivers/staging/irda/
@@@ -7748,9 -7687,7 +7748,9 @@@ F:      arch/powerpc/kernel/kvm
  
  KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
  M:    Christian Borntraeger <borntraeger@de.ibm.com>
 -M:    Cornelia Huck <cohuck@redhat.com>
 +M:    Janosch Frank <frankja@linux.vnet.ibm.com>
 +R:    David Hildenbrand <david@redhat.com>
 +R:    Cornelia Huck <cohuck@redhat.com>
  L:    linux-s390@vger.kernel.org
  W:    http://www.ibm.com/developerworks/linux/linux390/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
@@@ -7802,7 -7739,6 +7802,7 @@@ F:      include/keys/encrypted-type.
  F:    security/keys/encrypted-keys/
  
  KEYS-TRUSTED
 +M:    James Bottomley <jejb@linux.vnet.ibm.com>
  M:    Mimi Zohar <zohar@linux.vnet.ibm.com>
  L:    linux-integrity@vger.kernel.org
  L:    keyrings@vger.kernel.org
@@@ -8254,7 -8190,6 +8254,7 @@@ F:      arch/*/include/asm/rwsem.
  F:    include/linux/seqlock.h
  F:    lib/locking*.[ch]
  F:    kernel/locking/
 +X:    kernel/locking/locktorture.c
  
  LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks)
  M:    "Richard Russon (FlatCap)" <ldm@flatcap.org>
@@@ -8470,13 -8405,6 +8470,13 @@@ L:    linux-wireless@vger.kernel.or
  S:    Odd Fixes
  F:    drivers/net/wireless/marvell/mwl8k.c
  
 +MARVELL NAND CONTROLLER DRIVER
 +M:    Miquel Raynal <miquel.raynal@free-electrons.com>
 +L:    linux-mtd@lists.infradead.org
 +S:    Maintained
 +F:    drivers/mtd/nand/marvell_nand.c
 +F:    Documentation/devicetree/bindings/mtd/marvell-nand.txt
 +
  MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER
  M:    Nicolas Pitre <nico@fluxnic.net>
  S:    Odd Fixes
@@@ -8748,15 -8676,6 +8748,15 @@@ T:    git git://linuxtv.org/media_tree.gi
  S:    Maintained
  F:    drivers/media/dvb-frontends/stv6111*
  
 +MEDIA DRIVERS FOR NVIDIA TEGRA - VDE
 +M:    Dmitry Osipenko <digetx@gmail.com>
 +L:    linux-media@vger.kernel.org
 +L:    linux-tegra@vger.kernel.org
 +T:    git git://linuxtv.org/media_tree.git
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
 +F:    drivers/staging/media/tegra-vde/
 +
  MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
  M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
  M:    Mauro Carvalho Chehab <mchehab@kernel.org>
@@@ -8800,13 -8719,6 +8800,13 @@@ L:    netdev@vger.kernel.or
  S:    Maintained
  F:    drivers/net/ethernet/mediatek/
  
 +MEDIATEK SWITCH DRIVER
 +M:    Sean Wang <sean.wang@mediatek.com>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/net/dsa/mt7530.*
 +F:    net/dsa/tag_mtk.c
 +
  MEDIATEK JPEG DRIVER
  M:    Rick Chang <rick.chang@mediatek.com>
  M:    Bin Liu <bin.liu@mediatek.com>
@@@ -8938,13 -8850,12 +8938,13 @@@ W:   http://www.mellanox.co
  Q:    http://patchwork.ozlabs.org/project/netdev/list/
  F:    drivers/net/ethernet/mellanox/mlxfw/
  
 -MELLANOX MLX CPLD HOTPLUG DRIVER
 +MELLANOX HARDWARE PLATFORM SUPPORT
 +M:    Andy Shevchenko <andy@infradead.org>
 +M:    Darren Hart <dvhart@infradead.org>
  M:    Vadim Pasternak <vadimp@mellanox.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Supported
 -F:    drivers/platform/x86/mlxcpld-hotplug.c
 -F:    include/linux/platform_data/mlxcpld-hotplug.h
 +F:    drivers/platform/mellanox/
  
  MELLANOX MLX4 core VPI driver
  M:    Tariq Toukan <tariqt@mellanox.com>
@@@ -9018,7 -8929,6 +9018,7 @@@ L:      linux-kernel@vger.kernel.or
  S:    Supported
  F:    kernel/sched/membarrier.c
  F:    include/uapi/linux/membarrier.h
 +F:    arch/powerpc/include/asm/membarrier.h
  
  MEMORY MANAGEMENT
  L:    linux-mm@kvack.org
@@@ -9042,7 -8952,7 +9042,7 @@@ L:      linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git master
 -T:    git git://git.infradead.org/l2-mtd.git master
 +T:    git git://git.infradead.org/linux-mtd.git mtd/next
  S:    Maintained
  F:    Documentation/devicetree/bindings/mtd/
  F:    drivers/mtd/
@@@ -9131,14 -9041,6 +9131,14 @@@ F:    drivers/media/platform/atmel/atmel-i
  F:    drivers/media/platform/atmel/atmel-isc-regs.h
  F:    devicetree/bindings/media/atmel-isc.txt
  
 +MICROCHIP / ATMEL NAND DRIVER
 +M:    Wenyou Yang <wenyou.yang@microchip.com>
 +M:    Josh Wu <rainyfeeling@outlook.com>
 +L:    linux-mtd@lists.infradead.org
 +S:    Supported
 +F:    drivers/mtd/nand/atmel/*
 +F:    Documentation/devicetree/bindings/mtd/atmel-nand.txt
 +
  MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
  M:    Woojung Huh <Woojung.Huh@microchip.com>
  M:    Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
@@@ -9190,7 -9092,6 +9190,7 @@@ S:      Supporte
  F:    Documentation/devicetree/bindings/mips/
  F:    Documentation/mips/
  F:    arch/mips/
 +F:    drivers/platform/mips/
  
  MIPS BOSTON DEVELOPMENT BOARD
  M:    Paul Burton <paul.burton@mips.com>
@@@ -9206,7 -9107,6 +9206,7 @@@ MIPS GENERIC PLATFOR
  M:    Paul Burton <paul.burton@mips.com>
  L:    linux-mips@linux-mips.org
  S:    Supported
 +F:    Documentation/devicetree/bindings/power/mti,mips-cpc.txt
  F:    arch/mips/generic/
  F:    arch/mips/tools/generic-board-config.sh
  
@@@ -9219,25 -9119,6 +9219,25 @@@ F:    arch/mips/include/asm/mach-loongson3
  F:    drivers/*/*loongson1*
  F:    drivers/*/*/*loongson1*
  
 +MIPS/LOONGSON2 ARCHITECTURE
 +M:    Jiaxun Yang <jiaxun.yang@flygoat.com>
 +L:    linux-mips@linux-mips.org
 +S:    Maintained
 +F:    arch/mips/loongson64/*{2e/2f}*
 +F:    arch/mips/include/asm/mach-loongson64/
 +F:    drivers/*/*loongson2*
 +F:    drivers/*/*/*loongson2*
 +
 +MIPS/LOONGSON3 ARCHITECTURE
 +M:    Huacai Chen <chenhc@lemote.com>
 +L:    linux-mips@linux-mips.org
 +S:    Maintained
 +F:    arch/mips/loongson64/
 +F:    arch/mips/include/asm/mach-loongson64/
 +F:    drivers/platform/mips/cpu_hwmon.c
 +F:    drivers/*/*loongson3*
 +F:    drivers/*/*/*loongson3*
 +
  MIPS RINT INSTRUCTION EMULATION
  M:    Aleksandar Markovic <aleksandar.markovic@mips.com>
  L:    linux-mips@linux-mips.org
@@@ -9283,6 -9164,7 +9283,6 @@@ F:      drivers/media/dvb-frontends/mn88473
  
  MODULE SUPPORT
  M:    Jessica Yu <jeyu@kernel.org>
 -M:    Rusty Russell <rusty@rustcorp.com.au>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
  S:    Maintained
  F:    include/linux/module.h
@@@ -9459,7 -9341,7 +9459,7 @@@ L:      linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git nand/fixes
 -T:    git git://git.infradead.org/l2-mtd.git nand/next
 +T:    git git://git.infradead.org/linux-mtd.git nand/next
  S:    Maintained
  F:    drivers/mtd/nand/
  F:    include/linux/mtd/*nand*.h
@@@ -9477,8 -9359,8 +9477,8 @@@ F:      drivers/net/ethernet/natsemi/natsemi
  
  NCP FILESYSTEM
  M:    Petr Vandrovec <petr@vandrovec.name>
 -S:    Odd Fixes
 -F:    fs/ncpfs/
 +S:    Obsolete
 +F:    drivers/staging/ncpfs/
  
  NCR 5380 SCSI DRIVERS
  M:    Finn Thain <fthain@telegraphics.com.au>
@@@ -9714,11 -9596,6 +9714,11 @@@ NETWORKING [WIRELESS
  L:    linux-wireless@vger.kernel.org
  Q:    http://patchwork.kernel.org/project/linux-wireless/list/
  
 +NETDEVSIM
 +M:    Jakub Kicinski <jakub.kicinski@netronome.com>
 +S:    Maintained
 +F:    drivers/net/netdevsim/*
 +
  NETXEN (1/10) GbE SUPPORT
  M:    Manish Chopra <manish.chopra@cavium.com>
  M:    Rahul Verma <rahul.verma@cavium.com>
@@@ -9831,7 -9708,7 +9831,7 @@@ F:      drivers/ntb/hw/amd
  NTB DRIVER CORE
  M:    Jon Mason <jdmason@kudzu.us>
  M:    Dave Jiang <dave.jiang@intel.com>
 -M:    Allen Hubbe <Allen.Hubbe@emc.com>
 +M:    Allen Hubbe <allenbh@gmail.com>
  L:    linux-ntb@googlegroups.com
  S:    Supported
  W:    https://github.com/jonmason/ntb/wiki
@@@ -9865,15 -9742,6 +9865,15 @@@ S:    Supporte
  F:    Documentation/filesystems/ntfs.txt
  F:    fs/ntfs/
  
 +NUBUS SUBSYSTEM
 +M:    Finn Thain <fthain@telegraphics.com.au>
 +L:    linux-m68k@lists.linux-m68k.org
 +S:    Maintained
 +F:    arch/*/include/asm/nubus.h
 +F:    drivers/nubus/
 +F:    include/linux/nubus.h
 +F:    include/uapi/linux/nubus.h
 +
  NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
  M:    Antonino Daplas <adaplas@gmail.com>
  L:    linux-fbdev@vger.kernel.org
@@@ -9934,7 -9802,6 +9934,7 @@@ NXP TFA9879 DRIVE
  M:    Peter Rosin <peda@axentia.se>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
  S:    Maintained
 +F:    Documentation/devicetree/bindings/sound/tfa9879.txt
  F:    sound/soc/codecs/tfa9879*
  
  NXP-NCI NFC DRIVER
@@@ -9946,21 -9813,10 +9946,22 @@@ F:   drivers/nfc/nxp-nc
  
  OBJTOOL
  M:    Josh Poimboeuf <jpoimboe@redhat.com>
+ M:    Peter Zijlstra <peterz@infradead.org>
  S:    Supported
  F:    tools/objtool/
  
 +OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER
 +M:    Frederic Barrat <fbarrat@linux.vnet.ibm.com>
 +M:    Andrew Donnellan <andrew.donnellan@au1.ibm.com>
 +L:    linuxppc-dev@lists.ozlabs.org
 +S:    Supported
 +F:    arch/powerpc/platforms/powernv/ocxl.c
 +F:    arch/powerpc/include/asm/pnv-ocxl.h
 +F:    drivers/misc/ocxl/
 +F:    include/misc/ocxl*
 +F:    include/uapi/misc/ocxl.h
 +F:    Documentation/accelerators/ocxl.txt
 +
  OMAP AUDIO SUPPORT
  M:    Peter Ujfalusi <peter.ujfalusi@ti.com>
  M:    Jarkko Nikula <jarkko.nikula@bitmer.com>
@@@ -10195,14 -10051,6 +10196,14 @@@ S: Maintaine
  F:    drivers/media/i2c/ov7670.c
  F:    Documentation/devicetree/bindings/media/i2c/ov7670.txt
  
 +OMNIVISION OV7740 SENSOR DRIVER
 +M:    Wenyou Yang <wenyou.yang@microchip.com>
 +L:    linux-media@vger.kernel.org
 +T:    git git://linuxtv.org/media_tree.git
 +S:    Maintained
 +F:    drivers/media/i2c/ov7740.c
 +F:    Documentation/devicetree/bindings/media/i2c/ov7740.txt
 +
  ONENAND FLASH DRIVER
  M:    Kyungmin Park <kyungmin.park@samsung.com>
  L:    linux-mtd@lists.infradead.org
@@@ -10297,7 -10145,7 +10298,7 @@@ F:   include/uapi/linux/openvswitch.
  OPERATING PERFORMANCE POINTS (OPP)
  M:    Viresh Kumar <vireshk@kernel.org>
  M:    Nishanth Menon <nm@ti.com>
 -M:    Stephen Boyd <sboyd@codeaurora.org>
 +M:    Stephen Boyd <sboyd@kernel.org>
  L:    linux-pm@vger.kernel.org
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git
@@@ -10334,8 -10182,7 +10335,8 @@@ F:   fs/ocfs2
  
  ORANGEFS FILESYSTEM
  M:    Mike Marshall <hubcap@omnibond.com>
 -L:    pvfs2-developers@beowulf-underground.org (subscribers-only)
 +R:    Martin Brandenburg <martin@omnibond.com>
 +L:    devel@lists.orangefs.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux.git
  S:    Supported
  F:    fs/orangefs/
@@@ -10433,6 -10280,7 +10434,6 @@@ F:   Documentation/parport*.tx
  PARAVIRT_OPS INTERFACE
  M:    Juergen Gross <jgross@suse.com>
  M:    Alok Kataria <akataria@vmware.com>
 -M:    Rusty Russell <rusty@rustcorp.com.au>
  L:    virtualization@lists.linux-foundation.org
  S:    Supported
  F:    Documentation/virtual/paravirt_ops.txt
@@@ -10551,13 -10399,6 +10552,13 @@@ S: Maintaine
  F:    Documentation/devicetree/bindings/pci/pci-armada8k.txt
  F:    drivers/pci/dwc/pcie-armada8k.c
  
 +PCI DRIVER FOR CADENCE PCIE IP
 +M:    Alan Douglas <adouglas@cadence.com>
 +L:    linux-pci@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/pci/cdns,*.txt
 +F:    drivers/pci/cadence/pcie-cadence*
 +
  PCI DRIVER FOR FREESCALE LAYERSCAPE
  M:    Minghuan Lian <minghuan.Lian@freescale.com>
  M:    Mingkai Hu <mingkai.hu@freescale.com>
@@@ -10708,12 -10549,8 +10709,12 @@@ T: git git://git.kernel.org/pub/scm/lin
  S:    Supported
  F:    Documentation/devicetree/bindings/pci/
  F:    Documentation/PCI/
 +F:    drivers/acpi/pci*
  F:    drivers/pci/
 +F:    include/asm-generic/pci*
  F:    include/linux/pci*
 +F:    include/uapi/linux/pci*
 +F:    lib/pci*
  F:    arch/x86/pci/
  F:    arch/x86/kernel/quirks.c
  
@@@ -10803,9 -10640,11 +10804,9 @@@ S:  Maintaine
  F:    drivers/pci/dwc/*spear*
  
  PCMCIA SUBSYSTEM
 -P:    Linux PCMCIA Team
 -L:    linux-pcmcia@lists.infradead.org
 -W:    http://lists.infradead.org/mailman/listinfo/linux-pcmcia
 +M:    Dominik Brodowski <linux@dominikbrodowski.net>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia.git
 -S:    Maintained
 +S:    Odd Fixes
  F:    Documentation/pcmcia/
  F:    tools/pcmcia/
  F:    drivers/pcmcia/
@@@ -10932,16 -10771,6 +10933,16 @@@ M: Heikki Krogerus <heikki.krogerus@lin
  S:    Maintained
  F:    drivers/pinctrl/intel/
  
 +PIN CONTROLLER - MEDIATEK
 +M:    Sean Wang <sean.wang@mediatek.com>
 +L:    linux-mediatek@lists.infradead.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
 +F:    Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt
 +F:    drivers/pinctrl/mediatek/pinctrl-mtk-common.*
 +F:    drivers/pinctrl/mediatek/pinctrl-mt2701.c
 +F:    drivers/pinctrl/mediatek/pinctrl-mt7622.c
 +
  PIN CONTROLLER - QUALCOMM
  M:    Bjorn Andersson <bjorn.andersson@linaro.org>
  S:    Maintained
@@@ -11060,7 -10889,6 +11061,7 @@@ F:   include/linux/pm.
  F:    include/linux/pm_*
  F:    include/linux/powercap.h
  F:    drivers/powercap/
 +F:    kernel/configs/nopm.config
  
  POWER STATE COORDINATION INTERFACE (PSCI)
  M:    Mark Rutland <mark.rutland@arm.com>
@@@ -11355,8 -11183,7 +11356,8 @@@ S:   Maintaine
  F:    drivers/firmware/qemu_fw_cfg.c
  
  QIB DRIVER
 -M:    Mike Marciniszyn <infinipath@intel.com>
 +M:    Dennis Dalessandro <dennis.dalessandro@intel.com>
 +M:    Mike Marciniszyn <mike.marciniszyn@intel.com>
  L:    linux-rdma@vger.kernel.org
  S:    Supported
  F:    drivers/infiniband/hw/qib/
@@@ -11383,6 -11210,7 +11384,6 @@@ F:   include/linux/qed
  F:    drivers/net/ethernet/qlogic/qede/
  
  QLOGIC QL4xxx RDMA DRIVER
 -M:    Ram Amrani <Ram.Amrani@cavium.com>
  M:    Michal Kalderon <Michal.Kalderon@cavium.com>
  M:    Ariel Elior <Ariel.Elior@cavium.com>
  L:    linux-rdma@vger.kernel.org
@@@ -11529,7 -11357,6 +11530,7 @@@ F:   drivers/net/wireless/quantenn
  RADEON and AMDGPU DRM DRIVERS
  M:    Alex Deucher <alexander.deucher@amd.com>
  M:    Christian König <christian.koenig@amd.com>
 +M:    David (ChunMing) Zhou <David1.Zhou@amd.com>
  L:    amd-gfx@lists.freedesktop.org
  T:    git git://people.freedesktop.org/~agd5f/linux
  S:    Supported
@@@ -11606,13 -11433,6 +11607,13 @@@ S: Maintaine
  F:    Documentation/blockdev/ramdisk.txt
  F:    drivers/block/brd.c
  
 +RANCHU VIRTUAL BOARD FOR MIPS
 +M:    Miodrag Dinic <miodrag.dinic@mips.com>
 +L:    linux-mips@linux-mips.org
 +S:    Supported
 +F:    arch/mips/generic/board-ranchu.c
 +F:    arch/mips/configs/generic/board-ranchu.config
 +
  RANDOM NUMBER DRIVER
  M:    "Theodore Ts'o" <tytso@mit.edu>
  S:    Maintained
@@@ -11629,6 -11449,15 +11630,6 @@@ L:  linux-wireless@vger.kernel.or
  S:    Orphan
  F:    drivers/net/wireless/ray*
  
 -RCUTORTURE MODULE
 -M:    Josh Triplett <josh@joshtriplett.org>
 -M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 -L:    linux-kernel@vger.kernel.org
 -S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 -F:    Documentation/RCU/torture.txt
 -F:    kernel/rcu/rcutorture.c
 -
  RCUTORTURE TEST FRAMEWORK
  M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
  M:    Josh Triplett <josh@joshtriplett.org>
@@@ -11652,7 -11481,6 +11653,7 @@@ F:   drivers/net/ethernet/rdc/r6040.
  
  RDMAVT - RDMA verbs software
  M:    Dennis Dalessandro <dennis.dalessandro@intel.com>
 +M:    Mike Marciniszyn <mike.marciniszyn@intel.com>
  L:    linux-rdma@vger.kernel.org
  S:    Supported
  F:    drivers/infiniband/sw/rdmavt
@@@ -11930,13 -11758,15 +11931,13 @@@ T:        git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  F:    drivers/net/wireless/realtek/rtl818x/rtl8187/
  
 -RTL8192CE WIRELESS DRIVER
 -M:    Larry Finger <Larry.Finger@lwfinger.net>
 -M:    Chaoming Li <chaoming_li@realsil.com.cn>
 +REALTEK WIRELESS DRIVER (rtlwifi family)
 +M:    Ping-Ke Shih <pkshih@realtek.com>
  L:    linux-wireless@vger.kernel.org
  W:    http://wireless.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
  S:    Maintained
  F:    drivers/net/wireless/realtek/rtlwifi/
 -F:    drivers/net/wireless/realtek/rtlwifi/rtl8192ce/
  
  RTL8XXXU WIRELESS DRIVER (rtl8xxxu)
  M:    Jes Sorensen <Jes.Sorensen@gmail.com>
@@@ -12029,7 -11859,6 +12030,7 @@@ F:   drivers/pci/hotplug/s390_pci_hpc.
  S390 VFIO-CCW DRIVER
  M:    Cornelia Huck <cohuck@redhat.com>
  M:    Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
 +M:    Halil Pasic <pasic@linux.vnet.ibm.com>
  L:    linux-s390@vger.kernel.org
  L:    kvm@vger.kernel.org
  S:    Supported
@@@ -12101,13 -11930,6 +12102,13 @@@ S: Maintaine
  F:    drivers/crypto/exynos-rng.c
  F:    Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt
  
 +SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER
 +M:    Łukasz Stelmach <l.stelmach@samsung.com>
 +L:    linux-samsung-soc@vger.kernel.org
 +S:    Maintained
 +F:    drivers/char/hw_random/exynos-trng.c
 +F:    Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
 +
  SAMSUNG FRAMEBUFFER DRIVER
  M:    Jingoo Han <jingoohan1@gmail.com>
  L:    linux-fbdev@vger.kernel.org
@@@ -12170,7 -11992,6 +12171,7 @@@ F:   drivers/media/i2c/s5k5baf.
  SAMSUNG S5P Security SubSystem (SSS) DRIVER
  M:    Krzysztof Kozlowski <krzk@kernel.org>
  M:    Vladimir Zapolskiy <vz@mleia.com>
 +M:    Kamil Konieczny <k.konieczny@partner.samsung.com>
  L:    linux-crypto@vger.kernel.org
  L:    linux-samsung-soc@vger.kernel.org
  S:    Maintained
@@@ -12515,14 -12336,6 +12516,14 @@@ T: git git://linuxtv.org/anttip/media_t
  S:    Maintained
  F:    drivers/media/tuners/si2157*
  
 +SI2165 MEDIA DRIVER
 +M:    Matthias Schwarzott <zzam@gentoo.org>
 +L:    linux-media@vger.kernel.org
 +W:    https://linuxtv.org
 +Q:    http://patchwork.linuxtv.org/project/linux-media/list/
 +S:    Maintained
 +F:    drivers/media/dvb-frontends/si2165*
 +
  SI2168 MEDIA DRIVER
  M:    Antti Palosaari <crope@iki.fi>
  L:    linux-media@vger.kernel.org
@@@ -12646,13 -12459,6 +12647,13 @@@ F: lib/siphash.
  F:    lib/test_siphash.c
  F:    include/linux/siphash.h
  
 +SIOX
 +M:    Gavin Schenk <g.schenk@eckelmann.de>
 +M:    Uwe Kleine-König <kernel@pengutronix.de>
 +S:    Supported
 +F:    drivers/siox/*
 +F:    include/trace/events/siox.h
 +
  SIS 190 ETHERNET DRIVER
  M:    Francois Romieu <romieu@fr.zoreil.com>
  L:    netdev@vger.kernel.org
@@@ -12704,14 -12510,6 +12705,14 @@@ T: git git://git.kernel.org/pub/scm/lin
  F:    include/linux/srcu.h
  F:    kernel/rcu/srcu.c
  
 +SERIAL LOW-POWER INTER-CHIP MEDIA BUS (SLIMbus)
 +M:    Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
 +L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    drivers/slimbus/
 +F:    Documentation/devicetree/bindings/slimbus/
 +F:    include/linux/slimbus.h
 +
  SMACK SECURITY MODULE
  M:    Casey Schaufler <casey@schaufler-ca.com>
  L:    linux-security-module@vger.kernel.org
@@@ -12793,12 -12591,6 +12794,12 @@@ F: include/media/soc
  F:    drivers/media/i2c/soc_camera/
  F:    drivers/media/platform/soc_camera/
  
 +SOCIONEXT UNIPHIER SOUND DRIVER
 +M:    Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
 +L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    sound/soc/uniphier/
 +
  SOEKRIS NET48XX LED SUPPORT
  M:    Chris Boot <bootc@bootc.net>
  S:    Maintained
@@@ -12823,15 -12615,6 +12824,15 @@@ L: linux-media@vger.kernel.or
  S:    Supported
  F:    drivers/media/pci/solo6x10/
  
 +SOFTWARE DELEGATED EXCEPTION INTERFACE (SDEI)
 +M:    James Morse <james.morse@arm.com>
 +L:    linux-arm-kernel@lists.infradead.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/arm/firmware/sdei.txt
 +F:    drivers/firmware/arm_sdei.c
 +F:    include/linux/sdei.h
 +F:    include/uapi/linux/sdei.h
 +
  SOFTWARE RAID (Multiple Disks) SUPPORT
  M:    Shaohua Li <shli@kernel.org>
  L:    linux-raid@vger.kernel.org
@@@ -12844,13 -12627,6 +12845,13 @@@ F: drivers/md/raid
  F:    include/linux/raid/
  F:    include/uapi/linux/raid/
  
 +SOCIONEXT (SNI) NETSEC NETWORK DRIVER
 +M:    Jassi Brar <jaswinder.singh@linaro.org>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/net/ethernet/socionext/netsec.c
 +F:    Documentation/devicetree/bindings/net/socionext-netsec.txt
 +
  SONIC NETWORK DRIVER
  M:    Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  L:    netdev@vger.kernel.org
@@@ -12937,16 -12713,6 +12938,16 @@@ F: Documentation/sound/alsa/soc
  F:    sound/soc/
  F:    include/sound/soc*
  
 +SOUNDWIRE SUBSYSTEM
 +M:    Vinod Koul <vinod.koul@intel.com>
 +M:    Sanyog Kale <sanyog.r.kale@intel.com>
 +R:    Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
 +L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
 +S:    Supported
 +F:    Documentation/driver-api/soundwire/
 +F:    drivers/soundwire/
 +F:    include/linux/soundwire/
 +
  SP2 MEDIA DRIVER
  M:    Olli Salonen <olli.salonen@iki.fi>
  L:    linux-media@vger.kernel.org
@@@ -13013,7 -12779,7 +13014,7 @@@ L:   linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git spi-nor/fixes
 -T:    git git://git.infradead.org/l2-mtd.git spi-nor/next
 +T:    git git://git.infradead.org/linux-mtd.git spi-nor/next
  S:    Maintained
  F:    drivers/mtd/spi-nor/
  F:    include/linux/mtd/spi-nor.h
@@@ -13039,7 -12805,7 +13040,7 @@@ F:   Documentation/networking/spider_net.
  F:    drivers/net/ethernet/toshiba/spider_net*
  
  SPMI SUBSYSTEM
 -R:    Stephen Boyd <sboyd@codeaurora.org>
 +R:    Stephen Boyd <sboyd@kernel.org>
  L:    linux-arm-msm@vger.kernel.org
  F:    Documentation/devicetree/bindings/spmi/
  F:    drivers/spmi/
@@@ -13100,6 -12866,12 +13101,6 @@@ S:  Odd Fixe
  F:    Documentation/devicetree/bindings/staging/iio/
  F:    drivers/staging/iio/
  
 -STAGING - LIRC (LINUX INFRARED REMOTE CONTROL) DRIVERS
 -M:    Jarod Wilson <jarod@wilsonet.com>
 -W:    http://www.lirc.org/
 -S:    Odd Fixes
 -F:    drivers/staging/media/lirc/
 -
  STAGING - LUSTRE PARALLEL FILESYSTEM
  M:    Oleg Drokin <oleg.drokin@intel.com>
  M:    Andreas Dilger <andreas.dilger@intel.com>
@@@ -13260,7 -13032,7 +13261,7 @@@ F:   arch/x86/boot/video
  
  SWIOTLB SUBSYSTEM
  M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
 -L:    linux-kernel@vger.kernel.org
 +L:    iommu@lists.linux-foundation.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git
  S:    Supported
  F:    lib/swiotlb.c
@@@ -13325,11 -13097,6 +13326,11 @@@ S: Supporte
  F:    drivers/reset/reset-axs10x.c
  F:    Documentation/devicetree/bindings/reset/snps,axs10x-reset.txt
  
 +SYNOPSYS DESIGNWARE 8250 UART DRIVER
 +R:    Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 +S:    Maintained
 +F:    drivers/tty/serial/8250/8250_dw.c
 +
  SYNOPSYS DESIGNWARE APB GPIO DRIVER
  M:    Hoan Tran <hotran@apm.com>
  L:    linux-gpio@vger.kernel.org
@@@ -13346,6 -13113,7 +13347,6 @@@ F:   include/linux/platform_data/dma-dw.
  F:    drivers/dma/dw/
  
  SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER
 -M:    Jie Deng <jiedeng@synopsys.com>
  M:    Jose Abreu <Jose.Abreu@synopsys.com>
  L:    netdev@vger.kernel.org
  S:    Supported
@@@ -13485,15 -13253,6 +13486,15 @@@ T: git git://linuxtv.org/anttip/media_t
  S:    Maintained
  F:    drivers/media/tuners/tda18218*
  
 +TDA18250 MEDIA DRIVER
 +M:    Olli Salonen <olli.salonen@iki.fi>
 +L:    linux-media@vger.kernel.org
 +W:    https://linuxtv.org
 +Q:    http://patchwork.linuxtv.org/project/linux-media/list/
 +T:    git git://linuxtv.org/media_tree.git
 +S:    Maintained
 +F:    drivers/media/tuners/tda18250*
 +
  TDA18271 MEDIA DRIVER
  M:    Michael Krufky <mkrufky@linuxtv.org>
  L:    linux-media@vger.kernel.org
@@@ -13924,7 -13683,7 +13925,7 @@@ F:   include/linux/usb/tilegx.
  TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
  M:    John Stultz <john.stultz@linaro.org>
  M:    Thomas Gleixner <tglx@linutronix.de>
 -R:    Stephen Boyd <sboyd@codeaurora.org>
 +R:    Stephen Boyd <sboyd@kernel.org>
  L:    linux-kernel@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
  S:    Supported
@@@ -14007,18 -13766,6 +14008,18 @@@ L: platform-driver-x86@vger.kernel.or
  S:    Maintained
  F:    drivers/platform/x86/topstar-laptop.c
  
 +TORTURE-TEST MODULES
 +M:    Davidlohr Bueso <dave@stgolabs.net>
 +M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 +M:    Josh Triplett <josh@joshtriplett.org>
 +L:    linux-kernel@vger.kernel.org
 +S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 +F:    Documentation/RCU/torture.txt
 +F:    kernel/torture.c
 +F:    kernel/rcu/rcutorture.c
 +F:    kernel/locking/locktorture.c
 +
  TOSHIBA ACPI EXTRAS DRIVER
  M:    Azael Avalos <coproscefalo@gmail.com>
  L:    platform-driver-x86@vger.kernel.org
@@@ -14061,10 -13808,9 +14062,10 @@@ F: drivers/platform/x86/toshiba-wmi.
  TPM DEVICE DRIVER
  M:    Peter Huewe <peterhuewe@gmx.de>
  M:    Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
 -R:    Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
 +R:    Jason Gunthorpe <jgg@ziepe.ca>
  L:    linux-integrity@vger.kernel.org
  Q:    https://patchwork.kernel.org/project/linux-integrity/list/
 +W:    https://kernsec.org/wiki/index.php/Linux_Kernel_Integrity
  T:    git git://git.infradead.org/users/jjs/linux-tpmdd.git
  S:    Maintained
  F:    drivers/char/tpm/
@@@ -14103,13 -13849,6 +14104,13 @@@ T: git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  K:    ^Subject:.*(?i)trivial
  
 +TEMPO SEMICONDUCTOR DRIVERS
 +M:    Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
 +S:    Maintained
 +F:    sound/soc/codecs/tscs*.c
 +F:    sound/soc/codecs/tscs*.h
 +F:    Documentation/devicetree/bindings/sound/tscs*.txt
 +
  TTY LAYER
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  M:    Jiri Slaby <jslaby@suse.com>
@@@ -14271,8 -14010,6 +14272,8 @@@ UNISYS S-PAR DRIVER
  M:    David Kershner <david.kershner@unisys.com>
  L:    sparmaintainer@unisys.com (Unisys internal)
  S:    Supported
 +F:    include/linux/visorbus.h
 +F:    drivers/visorbus/
  F:    drivers/staging/unisys/
  
  UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER
@@@ -14819,15 -14556,6 +14820,15 @@@ S: Maintaine
  F:    drivers/virtio/virtio_input.c
  F:    include/uapi/linux/virtio_input.h
  
 +VIRTUAL BOX GUEST DEVICE DRIVER
 +M:    Hans de Goede <hdegoede@redhat.com>
 +M:    Arnd Bergmann <arnd@arndb.de>
 +M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 +S:    Maintained
 +F:    include/linux/vbox_utils.h
 +F:    include/uapi/linux/vbox*.h
 +F:    drivers/virt/vboxguest/
 +
  VIRTUAL SERIO DEVICE DRIVER
  M:    Stephen Chandler Paul <thatslyude@gmail.com>
  S:    Maintained
@@@ -14919,7 -14647,6 +14920,7 @@@ W:   http://www.slimlogic.co.uk/?p=4
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
  S:    Supported
  F:    Documentation/devicetree/bindings/regulator/
 +F:    Documentation/power/regulator/
  F:    drivers/regulator/
  F:    include/dt-bindings/regulator/
  F:    include/linux/regulator/
@@@ -14992,8 -14719,8 +14993,8 @@@ S:   Maintaine
  F:    drivers/input/tablet/wacom_serial4.c
  
  WATCHDOG DEVICE DRIVERS
 -M:    Wim Van Sebroeck <wim@iguana.be>
 -R:    Guenter Roeck <linux@roeck-us.net>
 +M:    Wim Van Sebroeck <wim@linux-watchdog.org>
 +M:    Guenter Roeck <linux@roeck-us.net>
  L:    linux-watchdog@vger.kernel.org
  W:    http://www.linux-watchdog.org/
  T:    git git://www.linux-watchdog.org/linux-watchdog.git
@@@ -15017,9 -14744,9 +15018,9 @@@ S:   Maintaine
  F:    drivers/hid/hid-wiimote*
  
  WILOCITY WIL6210 WIRELESS DRIVER
 -M:    Maya Erez <qca_merez@qca.qualcomm.com>
 +M:    Maya Erez <merez@codeaurora.org>
  L:    linux-wireless@vger.kernel.org
 -L:    wil6210@qca.qualcomm.com
 +L:    wil6210@qti.qualcomm.com
  S:    Supported
  W:    http://wireless.kernel.org/en/users/Drivers/wil6210
  F:    drivers/net/wireless/ath/wil6210/
@@@ -15113,12 -14840,6 +15114,12 @@@ F: include/linux/workqueue.
  F:    kernel/workqueue.c
  F:    Documentation/core-api/workqueue.rst
  
 +X-POWERS AXP288 PMIC DRIVERS
 +M:    Hans de Goede <hdegoede@redhat.com>
 +S:    Maintained
 +N:    axp288
 +F:    drivers/acpi/pmic/intel_pmic_xpower.c
 +
  X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS
  M:    Chen-Yu Tsai <wens@csie.org>
  L:    linux-kernel@vger.kernel.org
@@@ -15160,7 -14881,7 +15161,7 @@@ X86 PLATFORM DRIVER
  M:    Darren Hart <dvhart@infradead.org>
  M:    Andy Shevchenko <andy@infradead.org>
  L:    platform-driver-x86@vger.kernel.org
 -T:    git git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
 +T:    git git://git.infradead.org/linux-platform-drivers-x86.git
  S:    Maintained
  F:    drivers/platform/x86/
  F:    drivers/platform/olpc/
@@@ -15246,7 -14967,6 +15247,7 @@@ F:   include/xen/interface/io/vscsiif.
  XEN SWIOTLB SUBSYSTEM
  M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  L:    xen-devel@lists.xenproject.org (moderated for non-subscribers)
 +L:    iommu@lists.linux-foundation.org
  S:    Supported
  F:    arch/x86/xen/*swiotlb*
  F:    drivers/xen/*swiotlb*
index 30c8c5344c4a5dcfeb96d0711a322e50de33d324,4fd9044e72e7857a549f04894153c386081d783b..8971bd64d515c5bb4a9b95108fd802b8418764f2
@@@ -213,7 -213,7 +213,7 @@@ ENTRY(entry_SYSCALL_64
  
        swapgs
        /*
-        * This path is not taken when PAGE_TABLE_ISOLATION is disabled so it
+        * This path is only taken when PAGE_TABLE_ISOLATION is disabled so it
         * is not required to switch CR3.
         */
        movq    %rsp, PER_CPU_VAR(rsp_scratch)
        pushq   %rcx                            /* pt_regs->ip */
  GLOBAL(entry_SYSCALL_64_after_hwframe)
        pushq   %rax                            /* pt_regs->orig_ax */
-       pushq   %rdi                            /* pt_regs->di */
-       pushq   %rsi                            /* pt_regs->si */
-       pushq   %rdx                            /* pt_regs->dx */
-       pushq   %rcx                            /* pt_regs->cx */
-       pushq   $-ENOSYS                        /* pt_regs->ax */
-       pushq   %r8                             /* pt_regs->r8 */
-       pushq   %r9                             /* pt_regs->r9 */
-       pushq   %r10                            /* pt_regs->r10 */
-       pushq   %r11                            /* pt_regs->r11 */
-       pushq   %rbx                            /* pt_regs->rbx */
-       pushq   %rbp                            /* pt_regs->rbp */
-       pushq   %r12                            /* pt_regs->r12 */
-       pushq   %r13                            /* pt_regs->r13 */
-       pushq   %r14                            /* pt_regs->r14 */
-       pushq   %r15                            /* pt_regs->r15 */
-       UNWIND_HINT_REGS
+       PUSH_AND_CLEAR_REGS rax=$-ENOSYS
  
        TRACE_IRQS_OFF
  
  syscall_return_via_sysret:
        /* rcx and r11 are already restored (see code above) */
        UNWIND_HINT_EMPTY
-       POP_EXTRA_REGS
-       popq    %rsi    /* skip r11 */
-       popq    %r10
-       popq    %r9
-       popq    %r8
-       popq    %rax
-       popq    %rsi    /* skip rcx */
-       popq    %rdx
-       popq    %rsi
+       POP_REGS pop_rdi=0 skip_r11rcx=1
  
        /*
         * Now all regs are restored except RSP and RDI.
@@@ -559,9 -537,7 +537,7 @@@ END(irq_entries_start
        call    switch_to_thread_stack
  1:
  
-       ALLOC_PT_GPREGS_ON_STACK
-       SAVE_C_REGS
-       SAVE_EXTRA_REGS
+       PUSH_AND_CLEAR_REGS
        ENCODE_FRAME_POINTER
  
        testb   $3, CS(%rsp)
@@@ -622,15 -598,7 +598,7 @@@ GLOBAL(swapgs_restore_regs_and_return_t
        ud2
  1:
  #endif
-       POP_EXTRA_REGS
-       popq    %r11
-       popq    %r10
-       popq    %r9
-       popq    %r8
-       popq    %rax
-       popq    %rcx
-       popq    %rdx
-       popq    %rsi
+       POP_REGS pop_rdi=0
  
        /*
         * The stack is now user RDI, orig_ax, RIP, CS, EFLAGS, RSP, SS.
@@@ -688,13 -656,8 +656,12 @@@ GLOBAL(restore_regs_and_return_to_kerne
        ud2
  1:
  #endif
-       POP_EXTRA_REGS
-       POP_C_REGS
+       POP_REGS
        addq    $8, %rsp        /* skip regs->orig_ax */
 +      /*
 +       * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on IRET core serialization
 +       * when returning from IPI handler.
 +       */
        INTERRUPT_RETURN
  
  ENTRY(native_iret)
@@@ -908,7 -871,9 +875,9 @@@ ENTRY(\sym
        pushq   $-1                             /* ORIG_RAX: no syscall to restart */
        .endif
  
-       ALLOC_PT_GPREGS_ON_STACK
+       /* Save all registers in pt_regs */
+       PUSH_AND_CLEAR_REGS
+       ENCODE_FRAME_POINTER
  
        .if \paranoid < 2
        testb   $3, CS(%rsp)                    /* If coming from userspace, switch stacks */
@@@ -1121,9 -1086,7 +1090,7 @@@ ENTRY(xen_failsafe_callback
        addq    $0x30, %rsp
        UNWIND_HINT_IRET_REGS
        pushq   $-1 /* orig_ax = -1 => not a system call */
-       ALLOC_PT_GPREGS_ON_STACK
-       SAVE_C_REGS
-       SAVE_EXTRA_REGS
+       PUSH_AND_CLEAR_REGS
        ENCODE_FRAME_POINTER
        jmp     error_exit
  END(xen_failsafe_callback)
@@@ -1136,9 -1099,6 +1103,9 @@@ apicinterrupt3 HYPERVISOR_CALLBACK_VECT
  #if IS_ENABLED(CONFIG_HYPERV)
  apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
        hyperv_callback_vector hyperv_vector_handler
 +
 +apicinterrupt3 HYPERV_REENLIGHTENMENT_VECTOR \
 +      hyperv_reenlightenment_vector hyperv_reenlightenment_intr
  #endif /* CONFIG_HYPERV */
  
  idtentry debug                        do_debug                has_error_code=0        paranoid=1 shift_ist=DEBUG_STACK
@@@ -1163,16 -1123,13 +1130,13 @@@ idtentry machine_check               do_mce                  has_er
  #endif
  
  /*
-  * Save all registers in pt_regs, and switch gs if needed.
+  * Switch gs if needed.
   * Use slow, but surefire "are we in kernel?" check.
   * Return: ebx=0: need swapgs on exit, ebx=1: otherwise
   */
  ENTRY(paranoid_entry)
        UNWIND_HINT_FUNC
        cld
-       SAVE_C_REGS 8
-       SAVE_EXTRA_REGS 8
-       ENCODE_FRAME_POINTER 8
        movl    $1, %ebx
        movl    $MSR_GS_BASE, %ecx
        rdmsr
@@@ -1211,21 -1168,18 +1175,18 @@@ ENTRY(paranoid_exit
        jmp     .Lparanoid_exit_restore
  .Lparanoid_exit_no_swapgs:
        TRACE_IRQS_IRETQ_DEBUG
+       RESTORE_CR3     scratch_reg=%rbx save_reg=%r14
  .Lparanoid_exit_restore:
        jmp restore_regs_and_return_to_kernel
  END(paranoid_exit)
  
  /*
-  * Save all registers in pt_regs, and switch gs if needed.
+  * Switch gs if needed.
   * Return: EBX=0: came from user mode; EBX=1: otherwise
   */
  ENTRY(error_entry)
-       UNWIND_HINT_FUNC
+       UNWIND_HINT_REGS offset=8
        cld
-       SAVE_C_REGS 8
-       SAVE_EXTRA_REGS 8
-       ENCODE_FRAME_POINTER 8
-       xorl    %ebx, %ebx
        testb   $3, CS+8(%rsp)
        jz      .Lerror_kernelspace
  
@@@ -1406,22 -1360,7 +1367,7 @@@ ENTRY(nmi
        pushq   1*8(%rdx)       /* pt_regs->rip */
        UNWIND_HINT_IRET_REGS
        pushq   $-1             /* pt_regs->orig_ax */
-       pushq   %rdi            /* pt_regs->di */
-       pushq   %rsi            /* pt_regs->si */
-       pushq   (%rdx)          /* pt_regs->dx */
-       pushq   %rcx            /* pt_regs->cx */
-       pushq   %rax            /* pt_regs->ax */
-       pushq   %r8             /* pt_regs->r8 */
-       pushq   %r9             /* pt_regs->r9 */
-       pushq   %r10            /* pt_regs->r10 */
-       pushq   %r11            /* pt_regs->r11 */
-       pushq   %rbx            /* pt_regs->rbx */
-       pushq   %rbp            /* pt_regs->rbp */
-       pushq   %r12            /* pt_regs->r12 */
-       pushq   %r13            /* pt_regs->r13 */
-       pushq   %r14            /* pt_regs->r14 */
-       pushq   %r15            /* pt_regs->r15 */
-       UNWIND_HINT_REGS
+       PUSH_AND_CLEAR_REGS rdx=(%rdx)
        ENCODE_FRAME_POINTER
  
        /*
@@@ -1631,7 -1570,8 +1577,8 @@@ end_repeat_nmi
         * frame to point back to repeat_nmi.
         */
        pushq   $-1                             /* ORIG_RAX: no syscall to restart */
-       ALLOC_PT_GPREGS_ON_STACK
+       PUSH_AND_CLEAR_REGS
+       ENCODE_FRAME_POINTER
  
        /*
         * Use paranoid_entry to handle SWAPGS, but no need to use paranoid_exit
  nmi_swapgs:
        SWAPGS_UNSAFE_STACK
  nmi_restore:
-       POP_EXTRA_REGS
-       POP_C_REGS
+       POP_REGS
  
        /*
         * Skip orig_ax and the "outermost" frame to point RSP at the "iret"
index 44f5d79d51056b036e7ef4536d7bfe340dae9747,f077401869ee2761008465c61b777642fcfb07c2..11881726ed37290128f9bca07b9944aa2d818677
@@@ -49,7 -49,7 +49,7 @@@ extern int acpi_fix_pin2_polarity
  extern int acpi_disable_cmcff;
  
  extern u8 acpi_sci_flags;
 -extern int acpi_sci_override_gsi;
 +extern u32 acpi_sci_override_gsi;
  void acpi_pic_sci_set_trigger(unsigned int, u16);
  
  struct device;
@@@ -94,7 -94,7 +94,7 @@@ static inline unsigned int acpi_process
        if (boot_cpu_data.x86 == 0x0F &&
            boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
            boot_cpu_data.x86_model <= 0x05 &&
-           boot_cpu_data.x86_mask < 0x0A)
+           boot_cpu_data.x86_stepping < 0x0A)
                return 1;
        else if (boot_cpu_has(X86_BUG_AMD_APIC_C1E))
                return 1;
index 793bae7e7ce36bd36e728a8a6fe7f8e17b9920db,44c2c4ec6d60e5daab494026e38a26a6ae7ad538..1bd9ed87606f45f5a22f2510bde9ba34029a0551
@@@ -91,7 -91,7 +91,7 @@@ struct cpuinfo_x86 
        __u8                    x86;            /* CPU family */
        __u8                    x86_vendor;     /* CPU vendor */
        __u8                    x86_model;
-       __u8                    x86_mask;
+       __u8                    x86_stepping;
  #ifdef CONFIG_X86_64
        /* Number of 4K pages in DTLB/ITLB combined(in pages): */
        int                     x86_tlbsize;
        char                    x86_vendor_id[16];
        char                    x86_model_id[64];
        /* in KB - valid for CPUS which support this call: */
-       int                     x86_cache_size;
+       unsigned int            x86_cache_size;
        int                     x86_cache_alignment;    /* In bytes */
        /* Cache QoS architectural values: */
        int                     x86_cache_max_rmid;     /* max index */
@@@ -505,14 -505,6 +505,14 @@@ struct thread_struct 
         */
  };
  
 +/* Whitelist the FPU state from the task_struct for hardened usercopy. */
 +static inline void arch_thread_struct_whitelist(unsigned long *offset,
 +                                              unsigned long *size)
 +{
 +      *offset = offsetof(struct thread_struct, fpu.state);
 +      *size = fpu_kernel_xstate_size;
 +}
 +
  /*
   * Thread-synchronous status.
   *
@@@ -977,7 -969,4 +977,4 @@@ bool xen_set_default_idle(void)
  
  void stop_this_cpu(void *dummy);
  void df_debug(struct pt_regs *regs, long error_code);
- void __ibp_barrier(void);
  #endif /* _ASM_X86_PROCESSOR_H */
index 5bddbdcbc4a3cf722cd960c032e8ec400369e17a,e7d5a7883632caa73b6631c2e203f48d93a9458a..f0e6456ca7d3cd482893a7d1953aec5d79c4caad
@@@ -119,7 -119,7 +119,7 @@@ static void init_amd_k6(struct cpuinfo_
                return;
        }
  
-       if (c->x86_model == 6 && c->x86_mask == 1) {
+       if (c->x86_model == 6 && c->x86_stepping == 1) {
                const int K6_BUG_LOOP = 1000000;
                int n;
                void (*f_vide)(void);
  
        /* K6 with old style WHCR */
        if (c->x86_model < 8 ||
-          (c->x86_model == 8 && c->x86_mask < 8)) {
+          (c->x86_model == 8 && c->x86_stepping < 8)) {
                /* We can only write allocate on the low 508Mb */
                if (mbytes > 508)
                        mbytes = 508;
                return;
        }
  
-       if ((c->x86_model == 8 && c->x86_mask > 7) ||
+       if ((c->x86_model == 8 && c->x86_stepping > 7) ||
             c->x86_model == 9 || c->x86_model == 13) {
                /* The more serious chips .. */
  
@@@ -221,7 -221,7 +221,7 @@@ static void init_amd_k7(struct cpuinfo_
         * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx
         * As per AMD technical note 27212 0.2
         */
-       if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) {
+       if ((c->x86_model == 8 && c->x86_stepping >= 1) || (c->x86_model > 8)) {
                rdmsr(MSR_K7_CLK_CTL, l, h);
                if ((l & 0xfff00000) != 0x20000000) {
                        pr_info("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n",
         * but they are not certified as MP capable.
         */
        /* Athlon 660/661 is valid. */
-       if ((c->x86_model == 6) && ((c->x86_mask == 0) ||
-           (c->x86_mask == 1)))
+       if ((c->x86_model == 6) && ((c->x86_stepping == 0) ||
+           (c->x86_stepping == 1)))
                return;
  
        /* Duron 670 is valid */
-       if ((c->x86_model == 7) && (c->x86_mask == 0))
+       if ((c->x86_model == 7) && (c->x86_stepping == 0))
                return;
  
        /*
         * See http://www.heise.de/newsticker/data/jow-18.10.01-000 for
         * more.
         */
-       if (((c->x86_model == 6) && (c->x86_mask >= 2)) ||
-           ((c->x86_model == 7) && (c->x86_mask >= 1)) ||
+       if (((c->x86_model == 6) && (c->x86_stepping >= 2)) ||
+           ((c->x86_model == 7) && (c->x86_stepping >= 1)) ||
             (c->x86_model > 7))
                if (cpu_has(c, X86_FEATURE_MP))
                        return;
@@@ -556,51 -556,6 +556,51 @@@ static void bsp_init_amd(struct cpuinfo
        }
  }
  
 +static void early_detect_mem_encrypt(struct cpuinfo_x86 *c)
 +{
 +      u64 msr;
 +
 +      /*
 +       * BIOS support is required for SME and SEV.
 +       *   For SME: If BIOS has enabled SME then adjust x86_phys_bits by
 +       *            the SME physical address space reduction value.
 +       *            If BIOS has not enabled SME then don't advertise the
 +       *            SME feature (set in scattered.c).
 +       *   For SEV: If BIOS has not enabled SEV then don't advertise the
 +       *            SEV feature (set in scattered.c).
 +       *
 +       *   In all cases, since support for SME and SEV requires long mode,
 +       *   don't advertise the feature under CONFIG_X86_32.
 +       */
 +      if (cpu_has(c, X86_FEATURE_SME) || cpu_has(c, X86_FEATURE_SEV)) {
 +              /* Check if memory encryption is enabled */
 +              rdmsrl(MSR_K8_SYSCFG, msr);
 +              if (!(msr & MSR_K8_SYSCFG_MEM_ENCRYPT))
 +                      goto clear_all;
 +
 +              /*
 +               * Always adjust physical address bits. Even though this
 +               * will be a value above 32-bits this is still done for
 +               * CONFIG_X86_32 so that accurate values are reported.
 +               */
 +              c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f;
 +
 +              if (IS_ENABLED(CONFIG_X86_32))
 +                      goto clear_all;
 +
 +              rdmsrl(MSR_K7_HWCR, msr);
 +              if (!(msr & MSR_K7_HWCR_SMMLOCK))
 +                      goto clear_sev;
 +
 +              return;
 +
 +clear_all:
 +              clear_cpu_cap(c, X86_FEATURE_SME);
 +clear_sev:
 +              clear_cpu_cap(c, X86_FEATURE_SEV);
 +      }
 +}
 +
  static void early_init_amd(struct cpuinfo_x86 *c)
  {
        u32 dummy;
        /*  Set MTRR capability flag if appropriate */
        if (c->x86 == 5)
                if (c->x86_model == 13 || c->x86_model == 9 ||
-                   (c->x86_model == 8 && c->x86_mask >= 8))
+                   (c->x86_model == 8 && c->x86_stepping >= 8))
                        set_cpu_cap(c, X86_FEATURE_K6_MTRR);
  #endif
  #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_PCI)
        if (cpu_has_amd_erratum(c, amd_erratum_400))
                set_cpu_bug(c, X86_BUG_AMD_E400);
  
 -      /*
 -       * BIOS support is required for SME. If BIOS has enabled SME then
 -       * adjust x86_phys_bits by the SME physical address space reduction
 -       * value. If BIOS has not enabled SME then don't advertise the
 -       * feature (set in scattered.c). Also, since the SME support requires
 -       * long mode, don't advertise the feature under CONFIG_X86_32.
 -       */
 -      if (cpu_has(c, X86_FEATURE_SME)) {
 -              u64 msr;
 -
 -              /* Check if SME is enabled */
 -              rdmsrl(MSR_K8_SYSCFG, msr);
 -              if (msr & MSR_K8_SYSCFG_MEM_ENCRYPT) {
 -                      c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f;
 -                      if (IS_ENABLED(CONFIG_X86_32))
 -                              clear_cpu_cap(c, X86_FEATURE_SME);
 -              } else {
 -                      clear_cpu_cap(c, X86_FEATURE_SME);
 -              }
 -      }
 +      early_detect_mem_encrypt(c);
  }
  
  static void init_amd_k8(struct cpuinfo_x86 *c)
@@@ -795,7 -769,7 +795,7 @@@ static void init_amd_zn(struct cpuinfo_
         * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
         * all up to and including B1.
         */
-       if (c->x86_model <= 1 && c->x86_mask <= 1)
+       if (c->x86_model <= 1 && c->x86_stepping <= 1)
                set_cpu_cap(c, X86_FEATURE_CPB);
  }
  
@@@ -906,11 -880,11 +906,11 @@@ static unsigned int amd_size_cache(stru
        /* AMD errata T13 (order #21922) */
        if ((c->x86 == 6)) {
                /* Duron Rev A0 */
-               if (c->x86_model == 3 && c->x86_mask == 0)
+               if (c->x86_model == 3 && c->x86_stepping == 0)
                        size = 64;
                /* Tbird rev A1/A2 */
                if (c->x86_model == 4 &&
-                       (c->x86_mask == 0 || c->x86_mask == 1))
+                       (c->x86_stepping == 0 || c->x86_stepping == 1))
                        size = 256;
        }
        return size;
@@@ -1047,7 -1021,7 +1047,7 @@@ static bool cpu_has_amd_erratum(struct 
        }
  
        /* OSVW unavailable or ID unknown, match family-model-stepping range */
-       ms = (cpu->x86_model << 4) | cpu->x86_mask;
+       ms = (cpu->x86_model << 4) | cpu->x86_stepping;
        while ((range = *erratum++))
                if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
                    (ms >= AMD_MODEL_RANGE_START(range)) &&
index c578cd29c2d2c47bd8c03268bc8809c28785d43c,595be776727d85068cbe304c33fab0bc273fdb50..e5ec0f11c0de7c06a0975d852822b2033d914185
@@@ -106,10 -106,6 +106,10 @@@ static void early_init_centaur(struct c
  #ifdef CONFIG_X86_64
        set_cpu_cap(c, X86_FEATURE_SYSENTER32);
  #endif
 +      if (c->x86_power & (1 << 8)) {
 +              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 +              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
 +      }
  }
  
  static void init_centaur(struct cpuinfo_x86 *c)
                        clear_cpu_cap(c, X86_FEATURE_TSC);
                        break;
                case 8:
-                       switch (c->x86_mask) {
+                       switch (c->x86_stepping) {
                        default:
                        name = "2";
                                break;
@@@ -215,7 -211,7 +215,7 @@@ centaur_size_cache(struct cpuinfo_x86 *
         *  - Note, it seems this may only be in engineering samples.
         */
        if ((c->x86 == 6) && (c->x86_model == 9) &&
-                               (c->x86_mask == 1) && (size == 65))
+                               (c->x86_stepping == 1) && (size == 65))
                size -= 1;
        return size;
  }
index 410629f10ad377176787b1b93ddb36625de2be36,18dd8f22e353ab339aa32a0553a16ab5451363aa..589b948e6e01f01d7388cca456fbecd6019dbca4
@@@ -135,40 -135,6 +135,40 @@@ struct rdt_resource rdt_resources_all[
                .format_str             = "%d=%0*x",
                .fflags                 = RFTYPE_RES_CACHE,
        },
 +      [RDT_RESOURCE_L2DATA] =
 +      {
 +              .rid                    = RDT_RESOURCE_L2DATA,
 +              .name                   = "L2DATA",
 +              .domains                = domain_init(RDT_RESOURCE_L2DATA),
 +              .msr_base               = IA32_L2_CBM_BASE,
 +              .msr_update             = cat_wrmsr,
 +              .cache_level            = 2,
 +              .cache = {
 +                      .min_cbm_bits   = 1,
 +                      .cbm_idx_mult   = 2,
 +                      .cbm_idx_offset = 0,
 +              },
 +              .parse_ctrlval          = parse_cbm,
 +              .format_str             = "%d=%0*x",
 +              .fflags                 = RFTYPE_RES_CACHE,
 +      },
 +      [RDT_RESOURCE_L2CODE] =
 +      {
 +              .rid                    = RDT_RESOURCE_L2CODE,
 +              .name                   = "L2CODE",
 +              .domains                = domain_init(RDT_RESOURCE_L2CODE),
 +              .msr_base               = IA32_L2_CBM_BASE,
 +              .msr_update             = cat_wrmsr,
 +              .cache_level            = 2,
 +              .cache = {
 +                      .min_cbm_bits   = 1,
 +                      .cbm_idx_mult   = 2,
 +                      .cbm_idx_offset = 1,
 +              },
 +              .parse_ctrlval          = parse_cbm,
 +              .format_str             = "%d=%0*x",
 +              .fflags                 = RFTYPE_RES_CACHE,
 +      },
        [RDT_RESOURCE_MBA] =
        {
                .rid                    = RDT_RESOURCE_MBA,
@@@ -293,15 -259,15 +293,15 @@@ static void rdt_get_cache_alloc_cfg(in
        r->alloc_enabled = true;
  }
  
 -static void rdt_get_cdp_l3_config(int type)
 +static void rdt_get_cdp_config(int level, int type)
  {
 -      struct rdt_resource *r_l3 = &rdt_resources_all[RDT_RESOURCE_L3];
 +      struct rdt_resource *r_l = &rdt_resources_all[level];
        struct rdt_resource *r = &rdt_resources_all[type];
  
 -      r->num_closid = r_l3->num_closid / 2;
 -      r->cache.cbm_len = r_l3->cache.cbm_len;
 -      r->default_ctrl = r_l3->default_ctrl;
 -      r->cache.shareable_bits = r_l3->cache.shareable_bits;
 +      r->num_closid = r_l->num_closid / 2;
 +      r->cache.cbm_len = r_l->cache.cbm_len;
 +      r->default_ctrl = r_l->default_ctrl;
 +      r->cache.shareable_bits = r_l->cache.shareable_bits;
        r->data_width = (r->cache.cbm_len + 3) / 4;
        r->alloc_capable = true;
        /*
        r->alloc_enabled = false;
  }
  
 +static void rdt_get_cdp_l3_config(void)
 +{
 +      rdt_get_cdp_config(RDT_RESOURCE_L3, RDT_RESOURCE_L3DATA);
 +      rdt_get_cdp_config(RDT_RESOURCE_L3, RDT_RESOURCE_L3CODE);
 +}
 +
 +static void rdt_get_cdp_l2_config(void)
 +{
 +      rdt_get_cdp_config(RDT_RESOURCE_L2, RDT_RESOURCE_L2DATA);
 +      rdt_get_cdp_config(RDT_RESOURCE_L2, RDT_RESOURCE_L2CODE);
 +}
 +
  static int get_cache_id(int cpu, int level)
  {
        struct cpu_cacheinfo *ci = get_cpu_cacheinfo(cpu);
@@@ -691,7 -645,6 +691,7 @@@ enum 
        RDT_FLAG_L3_CAT,
        RDT_FLAG_L3_CDP,
        RDT_FLAG_L2_CAT,
 +      RDT_FLAG_L2_CDP,
        RDT_FLAG_MBA,
  };
  
@@@ -714,7 -667,6 +714,7 @@@ static struct rdt_options rdt_options[
        RDT_OPT(RDT_FLAG_L3_CAT,    "l3cat",    X86_FEATURE_CAT_L3),
        RDT_OPT(RDT_FLAG_L3_CDP,    "l3cdp",    X86_FEATURE_CDP_L3),
        RDT_OPT(RDT_FLAG_L2_CAT,    "l2cat",    X86_FEATURE_CAT_L2),
 +      RDT_OPT(RDT_FLAG_L2_CDP,    "l2cdp",    X86_FEATURE_CDP_L2),
        RDT_OPT(RDT_FLAG_MBA,       "mba",      X86_FEATURE_MBA),
  };
  #define NUM_RDT_OPTIONS ARRAY_SIZE(rdt_options)
@@@ -777,15 -729,15 +777,15 @@@ static __init bool get_rdt_alloc_resour
  
        if (rdt_cpu_has(X86_FEATURE_CAT_L3)) {
                rdt_get_cache_alloc_cfg(1, &rdt_resources_all[RDT_RESOURCE_L3]);
 -              if (rdt_cpu_has(X86_FEATURE_CDP_L3)) {
 -                      rdt_get_cdp_l3_config(RDT_RESOURCE_L3DATA);
 -                      rdt_get_cdp_l3_config(RDT_RESOURCE_L3CODE);
 -              }
 +              if (rdt_cpu_has(X86_FEATURE_CDP_L3))
 +                      rdt_get_cdp_l3_config();
                ret = true;
        }
        if (rdt_cpu_has(X86_FEATURE_CAT_L2)) {
                /* CPUID 0x10.2 fields are same format at 0x10.1 */
                rdt_get_cache_alloc_cfg(2, &rdt_resources_all[RDT_RESOURCE_L2]);
 +              if (rdt_cpu_has(X86_FEATURE_CDP_L2))
 +                      rdt_get_cdp_l2_config();
                ret = true;
        }
  
@@@ -819,7 -771,7 +819,7 @@@ static __init void rdt_quirks(void
                        cache_alloc_hsw_probe();
                break;
        case INTEL_FAM6_SKYLAKE_X:
-               if (boot_cpu_data.x86_mask <= 4)
+               if (boot_cpu_data.x86_stepping <= 4)
                        set_rdt_options("!cmt,!mbmtotal,!mbmlocal,!l3cat");
        }
  }
index 27d0a1712663673ac9993a6ddd055cb075b265fa,bc6bc6689e68a7bd602b11849d5d13892b05c982..f1c5eb99d445407a9fc134e76a8010d17a61d780
@@@ -281,7 -281,7 +281,7 @@@ static void __init construct_default_io
        int ELCR_fallback = 0;
  
        intsrc.type = MP_INTSRC;
 -      intsrc.irqflag = 0;     /* conforming */
 +      intsrc.irqflag = MP_IRQTRIG_DEFAULT | MP_IRQPOL_DEFAULT;
        intsrc.srcbus = 0;
        intsrc.dstapic = mpc_ioapic_id(0);
  
                         *  copy that information over to the MP table in the
                         *  irqflag field (level sensitive, active high polarity).
                         */
 -                      if (ELCR_trigger(i))
 -                              intsrc.irqflag = 13;
 -                      else
 -                              intsrc.irqflag = 0;
 +                      if (ELCR_trigger(i)) {
 +                              intsrc.irqflag = MP_IRQTRIG_LEVEL |
 +                                               MP_IRQPOL_ACTIVE_HIGH;
 +                      } else {
 +                              intsrc.irqflag = MP_IRQTRIG_DEFAULT |
 +                                               MP_IRQPOL_DEFAULT;
 +                      }
                }
  
                intsrc.srcbusirq = i;
@@@ -410,7 -407,7 +410,7 @@@ static inline void __init construct_def
        processor.apicver = mpc_default_type > 4 ? 0x10 : 0x01;
        processor.cpuflag = CPU_ENABLED;
        processor.cpufeature = (boot_cpu_data.x86 << 8) |
-           (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
+           (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_stepping;
        processor.featureflag = boot_cpu_data.x86_capability[CPUID_1_EDX];
        processor.reserved[0] = 0;
        processor.reserved[1] = 0;
        construct_ioapic_table(mpc_default_type);
  
        lintsrc.type = MP_LINTSRC;
 -      lintsrc.irqflag = 0;            /* conforming */
 +      lintsrc.irqflag = MP_IRQTRIG_DEFAULT | MP_IRQPOL_DEFAULT;
        lintsrc.srcbusid = 0;
        lintsrc.srcbusirq = 0;
        lintsrc.destapic = MP_APIC_ALL;
@@@ -667,7 -664,7 +667,7 @@@ static int  __init get_MP_intsrc_index(
        if (m->irqtype != mp_INT)
                return 0;
  
 -      if (m->irqflag != 0x0f)
 +      if (m->irqflag != (MP_IRQTRIG_LEVEL | MP_IRQPOL_ACTIVE_LOW))
                return 0;
  
        /* not legacy */
                if (mp_irqs[i].irqtype != mp_INT)
                        continue;
  
 -              if (mp_irqs[i].irqflag != 0x0f)
 +              if (mp_irqs[i].irqflag != (MP_IRQTRIG_LEVEL |
 +                                         MP_IRQPOL_ACTIVE_LOW))
                        continue;
  
                if (mp_irqs[i].srcbus != m->srcbus)
@@@ -788,8 -784,7 +788,8 @@@ static int  __init replace_intsrc_all(s
                if (mp_irqs[i].irqtype != mp_INT)
                        continue;
  
 -              if (mp_irqs[i].irqflag != 0x0f)
 +              if (mp_irqs[i].irqflag != (MP_IRQTRIG_LEVEL |
 +                                         MP_IRQPOL_ACTIVE_LOW))
                        continue;
  
                if (nr_m_spare > 0) {
diff --combined arch/x86/kvm/mmu.c
index 8eca1d04aeb86d309d7242ec2baf6c0153f79068,cc83bdcb65d19937ed879dbfc048ce351facb834..46ff304140c71fad1fa818324c0cda017257d2a5
@@@ -42,7 -42,6 +42,7 @@@
  #include <linux/kern_levels.h>
  
  #include <asm/page.h>
 +#include <asm/pat.h>
  #include <asm/cmpxchg.h>
  #include <asm/io.h>
  #include <asm/vmx.h>
@@@ -382,7 -381,7 +382,7 @@@ void kvm_mmu_set_mask_ptes(u64 user_mas
  }
  EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes);
  
 -void kvm_mmu_clear_all_pte_masks(void)
 +static void kvm_mmu_clear_all_pte_masks(void)
  {
        shadow_user_mask = 0;
        shadow_accessed_mask = 0;
@@@ -2709,18 -2708,7 +2709,18 @@@ static bool mmu_need_write_protect(stru
  static bool kvm_is_mmio_pfn(kvm_pfn_t pfn)
  {
        if (pfn_valid(pfn))
 -              return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn));
 +              return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)) &&
 +                      /*
 +                       * Some reserved pages, such as those from NVDIMM
 +                       * DAX devices, are not for MMIO, and can be mapped
 +                       * with cached memory type for better performance.
 +                       * However, the above check misconceives those pages
 +                       * as MMIO, and results in KVM mapping them with UC
 +                       * memory type, which would hurt the performance.
 +                       * Therefore, we check the host memory type in addition
 +                       * and only treat UC/UC-/WC pages as MMIO.
 +                       */
 +                      (!pat_enabled() || pat_pfn_immune_to_uc_mtrr(pfn));
  
        return true;
  }
@@@ -4963,16 -4951,6 +4963,16 @@@ int kvm_mmu_page_fault(struct kvm_vcpu 
        if (mmio_info_in_cache(vcpu, cr2, direct))
                emulation_type = 0;
  emulate:
 +      /*
 +       * On AMD platforms, under certain conditions insn_len may be zero on #NPF.
 +       * This can happen if a guest gets a page-fault on data access but the HW
 +       * table walker is not able to read the instruction page (e.g instruction
 +       * page is not present in memory). In those cases we simply restart the
 +       * guest.
 +       */
 +      if (unlikely(insn && !insn_len))
 +              return 1;
 +
        er = x86_emulate_instruction(vcpu, cr2, emulation_type, insn, insn_len);
  
        switch (er) {
@@@ -5080,7 -5058,7 +5080,7 @@@ void kvm_mmu_uninit_vm(struct kvm *kvm
  typedef bool (*slot_level_handler) (struct kvm *kvm, struct kvm_rmap_head *rmap_head);
  
  /* The caller should hold mmu-lock before calling this function. */
- static bool
+ static __always_inline bool
  slot_handle_level_range(struct kvm *kvm, struct kvm_memory_slot *memslot,
                        slot_level_handler fn, int start_level, int end_level,
                        gfn_t start_gfn, gfn_t end_gfn, bool lock_flush_tlb)
        return flush;
  }
  
- static bool
+ static __always_inline bool
  slot_handle_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
                  slot_level_handler fn, int start_level, int end_level,
                  bool lock_flush_tlb)
                        lock_flush_tlb);
  }
  
- static bool
+ static __always_inline bool
  slot_handle_all_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
                      slot_level_handler fn, bool lock_flush_tlb)
  {
                                 PT_MAX_HUGEPAGE_LEVEL, lock_flush_tlb);
  }
  
- static bool
+ static __always_inline bool
  slot_handle_large_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
                        slot_level_handler fn, bool lock_flush_tlb)
  {
                                 PT_MAX_HUGEPAGE_LEVEL, lock_flush_tlb);
  }
  
- static bool
+ static __always_inline bool
  slot_handle_leaf(struct kvm *kvm, struct kvm_memory_slot *memslot,
                 slot_level_handler fn, bool lock_flush_tlb)
  {
diff --combined arch/x86/kvm/vmx.c
index f427723dc7db34fab153b4faecbbb767b48f7e06,91e3539cba024b910b4f3d23b726838e6060228f..3dec126aa3022eb11f49d5de695d3658183a48ee
@@@ -418,12 -418,6 +418,12 @@@ struct __packed vmcs12 
   */
  #define VMCS12_SIZE 0x1000
  
 +/*
 + * VMCS12_MAX_FIELD_INDEX is the highest index value used in any
 + * supported VMCS12 field encoding.
 + */
 +#define VMCS12_MAX_FIELD_INDEX 0x17
 +
  /*
   * The nested_vmx structure is part of vcpu_vmx, and holds information we need
   * for correct emulation of VMX (i.e., nested VMX) on this vcpu.
@@@ -447,7 -441,6 +447,7 @@@ struct nested_vmx 
         * data hold by vmcs12
         */
        bool sync_shadow_vmcs;
 +      bool dirty_vmcs12;
  
        bool change_vmcs01_virtual_x2apic_mode;
        /* L2 must run next, and mustn't decide to exit to L1. */
@@@ -671,8 -664,6 +671,8 @@@ struct vcpu_vmx 
  
        u32 host_pkru;
  
 +      unsigned long host_debugctlmsr;
 +
        /*
         * Only bits masked by msr_ia32_feature_control_valid_bits can be set in
         * msr_ia32_feature_control. FEATURE_CONTROL_LOCKED is always included
@@@ -701,24 -692,67 +701,24 @@@ static struct pi_desc *vcpu_to_pi_desc(
        return &(to_vmx(vcpu)->pi_desc);
  }
  
 +#define ROL16(val, n) ((u16)(((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))))
  #define VMCS12_OFFSET(x) offsetof(struct vmcs12, x)
 -#define FIELD(number, name)   [number] = VMCS12_OFFSET(name)
 -#define FIELD64(number, name) [number] = VMCS12_OFFSET(name), \
 -                              [number##_HIGH] = VMCS12_OFFSET(name)+4
 +#define FIELD(number, name)   [ROL16(number, 6)] = VMCS12_OFFSET(name)
 +#define FIELD64(number, name)                                         \
 +      FIELD(number, name),                                            \
 +      [ROL16(number##_HIGH, 6)] = VMCS12_OFFSET(name) + sizeof(u32)
  
  
 -static unsigned long shadow_read_only_fields[] = {
 -      /*
 -       * We do NOT shadow fields that are modified when L0
 -       * traps and emulates any vmx instruction (e.g. VMPTRLD,
 -       * VMXON...) executed by L1.
 -       * For example, VM_INSTRUCTION_ERROR is read
 -       * by L1 if a vmx instruction fails (part of the error path).
 -       * Note the code assumes this logic. If for some reason
 -       * we start shadowing these fields then we need to
 -       * force a shadow sync when L0 emulates vmx instructions
 -       * (e.g. force a sync if VM_INSTRUCTION_ERROR is modified
 -       * by nested_vmx_failValid)
 -       */
 -      VM_EXIT_REASON,
 -      VM_EXIT_INTR_INFO,
 -      VM_EXIT_INSTRUCTION_LEN,
 -      IDT_VECTORING_INFO_FIELD,
 -      IDT_VECTORING_ERROR_CODE,
 -      VM_EXIT_INTR_ERROR_CODE,
 -      EXIT_QUALIFICATION,
 -      GUEST_LINEAR_ADDRESS,
 -      GUEST_PHYSICAL_ADDRESS
 +static u16 shadow_read_only_fields[] = {
 +#define SHADOW_FIELD_RO(x) x,
 +#include "vmx_shadow_fields.h"
  };
  static int max_shadow_read_only_fields =
        ARRAY_SIZE(shadow_read_only_fields);
  
 -static unsigned long shadow_read_write_fields[] = {
 -      TPR_THRESHOLD,
 -      GUEST_RIP,
 -      GUEST_RSP,
 -      GUEST_CR0,
 -      GUEST_CR3,
 -      GUEST_CR4,
 -      GUEST_INTERRUPTIBILITY_INFO,
 -      GUEST_RFLAGS,
 -      GUEST_CS_SELECTOR,
 -      GUEST_CS_AR_BYTES,
 -      GUEST_CS_LIMIT,
 -      GUEST_CS_BASE,
 -      GUEST_ES_BASE,
 -      GUEST_BNDCFGS,
 -      CR0_GUEST_HOST_MASK,
 -      CR0_READ_SHADOW,
 -      CR4_READ_SHADOW,
 -      TSC_OFFSET,
 -      EXCEPTION_BITMAP,
 -      CPU_BASED_VM_EXEC_CONTROL,
 -      VM_ENTRY_EXCEPTION_ERROR_CODE,
 -      VM_ENTRY_INTR_INFO_FIELD,
 -      VM_ENTRY_INSTRUCTION_LEN,
 -      VM_ENTRY_EXCEPTION_ERROR_CODE,
 -      HOST_FS_BASE,
 -      HOST_GS_BASE,
 -      HOST_FS_SELECTOR,
 -      HOST_GS_SELECTOR
 +static u16 shadow_read_write_fields[] = {
 +#define SHADOW_FIELD_RW(x) x,
 +#include "vmx_shadow_fields.h"
  };
  static int max_shadow_read_write_fields =
        ARRAY_SIZE(shadow_read_write_fields);
@@@ -871,17 -905,13 +871,17 @@@ static inline short vmcs_field_to_offse
  {
        const size_t size = ARRAY_SIZE(vmcs_field_to_offset_table);
        unsigned short offset;
 +      unsigned index;
 +
 +      if (field >> 15)
 +              return -ENOENT;
  
 -      BUILD_BUG_ON(size > SHRT_MAX);
 -      if (field >= size)
 +      index = ROL16(field, 6);
 +      if (index >= size)
                return -ENOENT;
  
 -      field = array_index_nospec(field, size);
 -      offset = vmcs_field_to_offset_table[field];
 +      index = array_index_nospec(index, size);
 +      offset = vmcs_field_to_offset_table[index];
        if (offset == 0)
                return -ENOENT;
        return offset;
@@@ -927,6 -957,8 +927,6 @@@ static DEFINE_PER_CPU(struct list_head
  static DEFINE_PER_CPU(spinlock_t, blocked_vcpu_on_cpu_lock);
  
  enum {
 -      VMX_IO_BITMAP_A,
 -      VMX_IO_BITMAP_B,
        VMX_VMREAD_BITMAP,
        VMX_VMWRITE_BITMAP,
        VMX_BITMAP_NR
  
  static unsigned long *vmx_bitmap[VMX_BITMAP_NR];
  
 -#define vmx_io_bitmap_a                      (vmx_bitmap[VMX_IO_BITMAP_A])
 -#define vmx_io_bitmap_b                      (vmx_bitmap[VMX_IO_BITMAP_B])
  #define vmx_vmread_bitmap                    (vmx_bitmap[VMX_VMREAD_BITMAP])
  #define vmx_vmwrite_bitmap                   (vmx_bitmap[VMX_VMWRITE_BITMAP])
  
@@@ -2339,7 -2373,6 +2339,7 @@@ static void vmx_vcpu_load(struct kvm_vc
  
        vmx_vcpu_pi_load(vcpu, cpu);
        vmx->host_pkru = read_pkru();
 +      vmx->host_debugctlmsr = get_debugctlmsr();
  }
  
  static void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu)
@@@ -2897,7 -2930,7 +2897,7 @@@ static void nested_vmx_setup_ctls_msrs(
        rdmsrl(MSR_IA32_VMX_CR4_FIXED1, vmx->nested.nested_vmx_cr4_fixed1);
  
        /* highest index: VMX_PREEMPTION_TIMER_VALUE */
 -      vmx->nested.nested_vmx_vmcs_enum = 0x2e;
 +      vmx->nested.nested_vmx_vmcs_enum = VMCS12_MAX_FIELD_INDEX << 1;
  }
  
  /*
@@@ -3233,7 -3266,6 +3233,7 @@@ static inline bool vmx_feature_control_
   */
  static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
  {
 +      struct vcpu_vmx *vmx = to_vmx(vcpu);
        struct shared_msr_entry *msr;
  
        switch (msr_info->index) {
                msr_info->data = vmcs_readl(GUEST_GS_BASE);
                break;
        case MSR_KERNEL_GS_BASE:
 -              vmx_load_host_state(to_vmx(vcpu));
 -              msr_info->data = to_vmx(vcpu)->msr_guest_kernel_gs_base;
 +              vmx_load_host_state(vmx);
 +              msr_info->data = vmx->msr_guest_kernel_gs_base;
                break;
  #endif
        case MSR_EFER:
                break;
        case MSR_IA32_MCG_EXT_CTL:
                if (!msr_info->host_initiated &&
 -                  !(to_vmx(vcpu)->msr_ia32_feature_control &
 +                  !(vmx->msr_ia32_feature_control &
                      FEATURE_CONTROL_LMCE))
                        return 1;
                msr_info->data = vcpu->arch.mcg_ext_ctl;
                break;
        case MSR_IA32_FEATURE_CONTROL:
 -              msr_info->data = to_vmx(vcpu)->msr_ia32_feature_control;
 +              msr_info->data = vmx->msr_ia32_feature_control;
                break;
        case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC:
                if (!nested_vmx_allowed(vcpu))
                        return 1;
                /* Otherwise falls through */
        default:
 -              msr = find_msr_entry(to_vmx(vcpu), msr_info->index);
 +              msr = find_msr_entry(vmx, msr_info->index);
                if (msr) {
                        msr_info->data = msr->data;
                        break;
@@@ -3695,7 -3727,7 +3695,7 @@@ static __init int setup_vmcs_config(str
  #endif
              CPU_BASED_CR3_LOAD_EXITING |
              CPU_BASED_CR3_STORE_EXITING |
 -            CPU_BASED_USE_IO_BITMAPS |
 +            CPU_BASED_UNCOND_IO_EXITING |
              CPU_BASED_MOV_DR_EXITING |
              CPU_BASED_USE_TSC_OFFSETING |
              CPU_BASED_INVLPG_EXITING |
                        SECONDARY_EXEC_ENABLE_EPT |
                        SECONDARY_EXEC_UNRESTRICTED_GUEST |
                        SECONDARY_EXEC_PAUSE_LOOP_EXITING |
 +                      SECONDARY_EXEC_DESC |
                        SECONDARY_EXEC_RDTSCP |
                        SECONDARY_EXEC_ENABLE_INVPCID |
                        SECONDARY_EXEC_APIC_REGISTER_VIRT |
@@@ -3951,17 -3982,17 +3951,17 @@@ static void free_kvm_area(void
        }
  }
  
 -enum vmcs_field_type {
 -      VMCS_FIELD_TYPE_U16 = 0,
 -      VMCS_FIELD_TYPE_U64 = 1,
 -      VMCS_FIELD_TYPE_U32 = 2,
 -      VMCS_FIELD_TYPE_NATURAL_WIDTH = 3
 +enum vmcs_field_width {
 +      VMCS_FIELD_WIDTH_U16 = 0,
 +      VMCS_FIELD_WIDTH_U64 = 1,
 +      VMCS_FIELD_WIDTH_U32 = 2,
 +      VMCS_FIELD_WIDTH_NATURAL_WIDTH = 3
  };
  
 -static inline int vmcs_field_type(unsigned long field)
 +static inline int vmcs_field_width(unsigned long field)
  {
        if (0x1 & field)        /* the *_HIGH fields are all 32 bit */
 -              return VMCS_FIELD_TYPE_U32;
 +              return VMCS_FIELD_WIDTH_U32;
        return (field >> 13) & 0x3 ;
  }
  
@@@ -3974,66 -4005,43 +3974,66 @@@ static void init_vmcs_shadow_fields(voi
  {
        int i, j;
  
 -      /* No checks for read only fields yet */
 +      for (i = j = 0; i < max_shadow_read_only_fields; i++) {
 +              u16 field = shadow_read_only_fields[i];
 +              if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 &&
 +                  (i + 1 == max_shadow_read_only_fields ||
 +                   shadow_read_only_fields[i + 1] != field + 1))
 +                      pr_err("Missing field from shadow_read_only_field %x\n",
 +                             field + 1);
 +
 +              clear_bit(field, vmx_vmread_bitmap);
 +#ifdef CONFIG_X86_64
 +              if (field & 1)
 +                      continue;
 +#endif
 +              if (j < i)
 +                      shadow_read_only_fields[j] = field;
 +              j++;
 +      }
 +      max_shadow_read_only_fields = j;
  
        for (i = j = 0; i < max_shadow_read_write_fields; i++) {
 -              switch (shadow_read_write_fields[i]) {
 -              case GUEST_BNDCFGS:
 -                      if (!kvm_mpx_supported())
 +              u16 field = shadow_read_write_fields[i];
 +              if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 &&
 +                  (i + 1 == max_shadow_read_write_fields ||
 +                   shadow_read_write_fields[i + 1] != field + 1))
 +                      pr_err("Missing field from shadow_read_write_field %x\n",
 +                             field + 1);
 +
 +              /*
 +               * PML and the preemption timer can be emulated, but the
 +               * processor cannot vmwrite to fields that don't exist
 +               * on bare metal.
 +               */
 +              switch (field) {
 +              case GUEST_PML_INDEX:
 +                      if (!cpu_has_vmx_pml())
 +                              continue;
 +                      break;
 +              case VMX_PREEMPTION_TIMER_VALUE:
 +                      if (!cpu_has_vmx_preemption_timer())
 +                              continue;
 +                      break;
 +              case GUEST_INTR_STATUS:
 +                      if (!cpu_has_vmx_apicv())
                                continue;
                        break;
                default:
                        break;
                }
  
 +              clear_bit(field, vmx_vmwrite_bitmap);
 +              clear_bit(field, vmx_vmread_bitmap);
 +#ifdef CONFIG_X86_64
 +              if (field & 1)
 +                      continue;
 +#endif
                if (j < i)
 -                      shadow_read_write_fields[j] =
 -                              shadow_read_write_fields[i];
 +                      shadow_read_write_fields[j] = field;
                j++;
        }
        max_shadow_read_write_fields = j;
 -
 -      /* shadowed fields guest access without vmexit */
 -      for (i = 0; i < max_shadow_read_write_fields; i++) {
 -              unsigned long field = shadow_read_write_fields[i];
 -
 -              clear_bit(field, vmx_vmwrite_bitmap);
 -              clear_bit(field, vmx_vmread_bitmap);
 -              if (vmcs_field_type(field) == VMCS_FIELD_TYPE_U64) {
 -                      clear_bit(field + 1, vmx_vmwrite_bitmap);
 -                      clear_bit(field + 1, vmx_vmread_bitmap);
 -              }
 -      }
 -      for (i = 0; i < max_shadow_read_only_fields; i++) {
 -              unsigned long field = shadow_read_only_fields[i];
 -
 -              clear_bit(field, vmx_vmread_bitmap);
 -              if (vmcs_field_type(field) == VMCS_FIELD_TYPE_U64)
 -                      clear_bit(field + 1, vmx_vmread_bitmap);
 -      }
  }
  
  static __init int alloc_kvm_area(void)
@@@ -4246,10 -4254,9 +4246,10 @@@ static void exit_lmode(struct kvm_vcpu 
  
  #endif
  
 -static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid)
 +static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid,
 +                              bool invalidate_gpa)
  {
 -      if (enable_ept) {
 +      if (enable_ept && (invalidate_gpa || !enable_vpid)) {
                if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
                        return;
                ept_sync_context(construct_eptp(vcpu, vcpu->arch.mmu.root_hpa));
        }
  }
  
 -static void vmx_flush_tlb(struct kvm_vcpu *vcpu)
 +static void vmx_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa)
  {
 -      __vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid);
 +      __vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid, invalidate_gpa);
  }
  
  static void vmx_flush_tlb_ept_only(struct kvm_vcpu *vcpu)
  {
        if (enable_ept)
 -              vmx_flush_tlb(vcpu);
 +              vmx_flush_tlb(vcpu, true);
  }
  
  static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu)
@@@ -4464,7 -4471,7 +4464,7 @@@ static void vmx_set_cr3(struct kvm_vcp
                ept_load_pdptrs(vcpu);
        }
  
 -      vmx_flush_tlb(vcpu);
 +      vmx_flush_tlb(vcpu, true);
        vmcs_writel(GUEST_CR3, guest_cr3);
  }
  
@@@ -4481,14 -4488,6 +4481,14 @@@ static int vmx_set_cr4(struct kvm_vcpu 
                (to_vmx(vcpu)->rmode.vm86_active ?
                 KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON);
  
 +      if ((cr4 & X86_CR4_UMIP) && !boot_cpu_has(X86_FEATURE_UMIP)) {
 +              vmcs_set_bits(SECONDARY_VM_EXEC_CONTROL,
 +                            SECONDARY_EXEC_DESC);
 +              hw_cr4 &= ~X86_CR4_UMIP;
 +      } else
 +              vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL,
 +                              SECONDARY_EXEC_DESC);
 +
        if (cr4 & X86_CR4_VMXE) {
                /*
                 * To use VMXON (and later other VMX instructions), a guest
@@@ -5120,6 -5119,11 +5120,6 @@@ static void nested_vmx_disable_intercep
  {
        int f = sizeof(unsigned long);
  
 -      if (!cpu_has_vmx_msr_bitmap()) {
 -              WARN_ON(1);
 -              return;
 -      }
 -
        /*
         * See Intel PRM Vol. 3, 20.6.9 (MSR-Bitmap Address). Early manuals
         * have the write-low and read-high bitmap offsets the wrong way round.
@@@ -5259,8 -5263,7 +5259,8 @@@ static void vmx_complete_nested_posted_
        max_irr = find_last_bit((unsigned long *)vmx->nested.pi_desc->pir, 256);
        if (max_irr != 256) {
                vapic_page = kmap(vmx->nested.virtual_apic_page);
 -              __kvm_apic_update_irr(vmx->nested.pi_desc->pir, vapic_page);
 +              __kvm_apic_update_irr(vmx->nested.pi_desc->pir,
 +                      vapic_page, &max_irr);
                kunmap(vmx->nested.virtual_apic_page);
  
                status = vmcs_read16(GUEST_INTR_STATUS);
@@@ -5320,15 -5323,14 +5320,15 @@@ static int vmx_deliver_nested_posted_in
  
        if (is_guest_mode(vcpu) &&
            vector == vmx->nested.posted_intr_nv) {
 -              /* the PIR and ON have been set by L1. */
 -              kvm_vcpu_trigger_posted_interrupt(vcpu, true);
                /*
                 * If a posted intr is not recognized by hardware,
                 * we will accomplish it in the next vmentry.
                 */
                vmx->nested.pi_pending = true;
                kvm_make_request(KVM_REQ_EVENT, vcpu);
 +              /* the PIR and ON have been set by L1. */
 +              if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true))
 +                      kvm_vcpu_kick(vcpu);
                return 0;
        }
        return -1;
@@@ -5507,7 -5509,6 +5507,7 @@@ static void vmx_compute_secondary_exec_
        struct kvm_vcpu *vcpu = &vmx->vcpu;
  
        u32 exec_control = vmcs_config.cpu_based_2nd_exec_ctrl;
 +
        if (!cpu_need_virtualize_apic_accesses(vcpu))
                exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
        if (vmx->vpid == 0)
                exec_control &= ~(SECONDARY_EXEC_APIC_REGISTER_VIRT |
                                  SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);
        exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
 +
 +      /* SECONDARY_EXEC_DESC is enabled/disabled on writes to CR4.UMIP,
 +       * in vmx_set_cr4.  */
 +      exec_control &= ~SECONDARY_EXEC_DESC;
 +
        /* SECONDARY_EXEC_SHADOW_VMCS is enabled when L1 executes VMPTRLD
           (handle_vmptrld).
           We can NOT enable shadow_vmcs here because we don't have yet
@@@ -5650,6 -5646,10 +5650,6 @@@ static void vmx_vcpu_setup(struct vcpu_
  #endif
        int i;
  
 -      /* I/O */
 -      vmcs_write64(IO_BITMAP_A, __pa(vmx_io_bitmap_a));
 -      vmcs_write64(IO_BITMAP_B, __pa(vmx_io_bitmap_b));
 -
        if (enable_shadow_vmcs) {
                vmcs_write64(VMREAD_BITMAP, __pa(vmx_vmread_bitmap));
                vmcs_write64(VMWRITE_BITMAP, __pa(vmx_vmwrite_bitmap));
@@@ -6304,12 -6304,6 +6304,12 @@@ static int handle_set_cr4(struct kvm_vc
                return kvm_set_cr4(vcpu, val);
  }
  
 +static int handle_desc(struct kvm_vcpu *vcpu)
 +{
 +      WARN_ON(!(vcpu->arch.cr4 & X86_CR4_UMIP));
 +      return emulate_instruction(vcpu, 0) == EMULATE_DONE;
 +}
 +
  static int handle_cr(struct kvm_vcpu *vcpu)
  {
        unsigned long exit_qualification, val;
@@@ -6766,21 -6760,7 +6766,21 @@@ static int handle_ept_misconfig(struct 
        if (!is_guest_mode(vcpu) &&
            !kvm_io_bus_write(vcpu, KVM_FAST_MMIO_BUS, gpa, 0, NULL)) {
                trace_kvm_fast_mmio(gpa);
 -              return kvm_skip_emulated_instruction(vcpu);
 +              /*
 +               * Doing kvm_skip_emulated_instruction() depends on undefined
 +               * behavior: Intel's manual doesn't mandate
 +               * VM_EXIT_INSTRUCTION_LEN to be set in VMCS when EPT MISCONFIG
 +               * occurs and while on real hardware it was observed to be set,
 +               * other hypervisors (namely Hyper-V) don't set it, we end up
 +               * advancing IP with some random value. Disable fast mmio when
 +               * running nested and keep it for real hardware in hope that
 +               * VM_EXIT_INSTRUCTION_LEN will always be set correctly.
 +               */
 +              if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
 +                      return kvm_skip_emulated_instruction(vcpu);
 +              else
 +                      return x86_emulate_instruction(vcpu, gpa, EMULTYPE_SKIP,
 +                                                     NULL, 0) == EMULATE_DONE;
        }
  
        ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
@@@ -6977,6 -6957,10 +6977,6 @@@ static __init int hardware_setup(void
        memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE);
        memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE);
  
 -      memset(vmx_io_bitmap_a, 0xff, PAGE_SIZE);
 -
 -      memset(vmx_io_bitmap_b, 0xff, PAGE_SIZE);
 -
        if (setup_vmcs_config(&vmcs_config) < 0) {
                r = -EIO;
                goto out;
                !(cpu_has_vmx_invvpid_single() || cpu_has_vmx_invvpid_global()))
                enable_vpid = 0;
  
 -      if (!cpu_has_vmx_shadow_vmcs())
 -              enable_shadow_vmcs = 0;
 -      if (enable_shadow_vmcs)
 -              init_vmcs_shadow_fields();
 -
        if (!cpu_has_vmx_ept() ||
            !cpu_has_vmx_ept_4levels() ||
            !cpu_has_vmx_ept_mt_wb() ||
                kvm_x86_ops->cancel_hv_timer = NULL;
        }
  
 +      if (!cpu_has_vmx_shadow_vmcs())
 +              enable_shadow_vmcs = 0;
 +      if (enable_shadow_vmcs)
 +              init_vmcs_shadow_fields();
 +
        kvm_set_posted_intr_wakeup_handler(wakeup_handler);
  
        kvm_mce_cap_supported |= MCG_LMCE_P;
@@@ -7609,17 -7593,17 +7609,17 @@@ static inline int vmcs12_read_any(struc
  
        p = ((char *)(get_vmcs12(vcpu))) + offset;
  
 -      switch (vmcs_field_type(field)) {
 -      case VMCS_FIELD_TYPE_NATURAL_WIDTH:
 +      switch (vmcs_field_width(field)) {
 +      case VMCS_FIELD_WIDTH_NATURAL_WIDTH:
                *ret = *((natural_width *)p);
                return 0;
 -      case VMCS_FIELD_TYPE_U16:
 +      case VMCS_FIELD_WIDTH_U16:
                *ret = *((u16 *)p);
                return 0;
 -      case VMCS_FIELD_TYPE_U32:
 +      case VMCS_FIELD_WIDTH_U32:
                *ret = *((u32 *)p);
                return 0;
 -      case VMCS_FIELD_TYPE_U64:
 +      case VMCS_FIELD_WIDTH_U64:
                *ret = *((u64 *)p);
                return 0;
        default:
@@@ -7636,17 -7620,17 +7636,17 @@@ static inline int vmcs12_write_any(stru
        if (offset < 0)
                return offset;
  
 -      switch (vmcs_field_type(field)) {
 -      case VMCS_FIELD_TYPE_U16:
 +      switch (vmcs_field_width(field)) {
 +      case VMCS_FIELD_WIDTH_U16:
                *(u16 *)p = field_value;
                return 0;
 -      case VMCS_FIELD_TYPE_U32:
 +      case VMCS_FIELD_WIDTH_U32:
                *(u32 *)p = field_value;
                return 0;
 -      case VMCS_FIELD_TYPE_U64:
 +      case VMCS_FIELD_WIDTH_U64:
                *(u64 *)p = field_value;
                return 0;
 -      case VMCS_FIELD_TYPE_NATURAL_WIDTH:
 +      case VMCS_FIELD_WIDTH_NATURAL_WIDTH:
                *(natural_width *)p = field_value;
                return 0;
        default:
@@@ -7662,7 -7646,7 +7662,7 @@@ static void copy_shadow_to_vmcs12(struc
        unsigned long field;
        u64 field_value;
        struct vmcs *shadow_vmcs = vmx->vmcs01.shadow_vmcs;
 -      const unsigned long *fields = shadow_read_write_fields;
 +      const u16 *fields = shadow_read_write_fields;
        const int num_fields = max_shadow_read_write_fields;
  
        preempt_disable();
  
        for (i = 0; i < num_fields; i++) {
                field = fields[i];
 -              switch (vmcs_field_type(field)) {
 -              case VMCS_FIELD_TYPE_U16:
 -                      field_value = vmcs_read16(field);
 -                      break;
 -              case VMCS_FIELD_TYPE_U32:
 -                      field_value = vmcs_read32(field);
 -                      break;
 -              case VMCS_FIELD_TYPE_U64:
 -                      field_value = vmcs_read64(field);
 -                      break;
 -              case VMCS_FIELD_TYPE_NATURAL_WIDTH:
 -                      field_value = vmcs_readl(field);
 -                      break;
 -              default:
 -                      WARN_ON(1);
 -                      continue;
 -              }
 +              field_value = __vmcs_readl(field);
                vmcs12_write_any(&vmx->vcpu, field, field_value);
        }
  
  
  static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)
  {
 -      const unsigned long *fields[] = {
 +      const u16 *fields[] = {
                shadow_read_write_fields,
                shadow_read_only_fields
        };
                for (i = 0; i < max_fields[q]; i++) {
                        field = fields[q][i];
                        vmcs12_read_any(&vmx->vcpu, field, &field_value);
 -
 -                      switch (vmcs_field_type(field)) {
 -                      case VMCS_FIELD_TYPE_U16:
 -                              vmcs_write16(field, (u16)field_value);
 -                              break;
 -                      case VMCS_FIELD_TYPE_U32:
 -                              vmcs_write32(field, (u32)field_value);
 -                              break;
 -                      case VMCS_FIELD_TYPE_U64:
 -                              vmcs_write64(field, (u64)field_value);
 -                              break;
 -                      case VMCS_FIELD_TYPE_NATURAL_WIDTH:
 -                              vmcs_writel(field, (long)field_value);
 -                              break;
 -                      default:
 -                              WARN_ON(1);
 -                              break;
 -                      }
 +                      __vmcs_writel(field, field_value);
                }
        }
  
@@@ -7771,10 -7788,8 +7771,10 @@@ static int handle_vmwrite(struct kvm_vc
  {
        unsigned long field;
        gva_t gva;
 +      struct vcpu_vmx *vmx = to_vmx(vcpu);
        unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
        u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
 +
        /* The value to write might be 32 or 64 bits, depending on L1's long
         * mode, and eventually we need to write that into a field of several
         * possible lengths. The code below first zero-extends the value to 64
                return kvm_skip_emulated_instruction(vcpu);
        }
  
 +      switch (field) {
 +#define SHADOW_FIELD_RW(x) case x:
 +#include "vmx_shadow_fields.h"
 +              /*
 +               * The fields that can be updated by L1 without a vmexit are
 +               * always updated in the vmcs02, the others go down the slow
 +               * path of prepare_vmcs02.
 +               */
 +              break;
 +      default:
 +              vmx->nested.dirty_vmcs12 = true;
 +              break;
 +      }
 +
        nested_vmx_succeed(vcpu);
        return kvm_skip_emulated_instruction(vcpu);
  }
@@@ -7845,7 -7846,6 +7845,7 @@@ static void set_current_vmptr(struct vc
                             __pa(vmx->vmcs01.shadow_vmcs));
                vmx->nested.sync_shadow_vmcs = true;
        }
 +      vmx->nested.dirty_vmcs12 = true;
  }
  
  /* Emulate the VMPTRLD instruction */
@@@ -8066,7 -8066,7 +8066,7 @@@ static int handle_invvpid(struct kvm_vc
                return kvm_skip_emulated_instruction(vcpu);
        }
  
 -      __vmx_flush_tlb(vcpu, vmx->nested.vpid02);
 +      __vmx_flush_tlb(vcpu, vmx->nested.vpid02, true);
        nested_vmx_succeed(vcpu);
  
        return kvm_skip_emulated_instruction(vcpu);
@@@ -8260,8 -8260,6 +8260,8 @@@ static int (*const kvm_vmx_exit_handler
        [EXIT_REASON_XSETBV]                  = handle_xsetbv,
        [EXIT_REASON_TASK_SWITCH]             = handle_task_switch,
        [EXIT_REASON_MCE_DURING_VMENTRY]      = handle_machine_check,
 +      [EXIT_REASON_GDTR_IDTR]               = handle_desc,
 +      [EXIT_REASON_LDTR_TR]                 = handle_desc,
        [EXIT_REASON_EPT_VIOLATION]           = handle_ept_violation,
        [EXIT_REASON_EPT_MISCONFIG]           = handle_ept_misconfig,
        [EXIT_REASON_PAUSE_INSTRUCTION]       = handle_pause,
@@@ -9071,23 -9069,36 +9071,23 @@@ static void vmx_set_rvi(int vector
  
  static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
  {
 -      if (!is_guest_mode(vcpu)) {
 -              vmx_set_rvi(max_irr);
 -              return;
 -      }
 -
 -      if (max_irr == -1)
 -              return;
 -
 -      /*
 -       * In guest mode.  If a vmexit is needed, vmx_check_nested_events
 -       * handles it.
 -       */
 -      if (nested_exit_on_intr(vcpu))
 -              return;
 -
        /*
 -       * Else, fall back to pre-APICv interrupt injection since L2
 -       * is run without virtual interrupt delivery.
 +       * When running L2, updating RVI is only relevant when
 +       * vmcs12 virtual-interrupt-delivery enabled.
 +       * However, it can be enabled only when L1 also
 +       * intercepts external-interrupts and in that case
 +       * we should not update vmcs02 RVI but instead intercept
 +       * interrupt. Therefore, do nothing when running L2.
         */
 -      if (!kvm_event_needs_reinjection(vcpu) &&
 -          vmx_interrupt_allowed(vcpu)) {
 -              kvm_queue_interrupt(vcpu, max_irr, false);
 -              vmx_inject_irq(vcpu);
 -      }
 +      if (!is_guest_mode(vcpu))
 +              vmx_set_rvi(max_irr);
  }
  
  static int vmx_sync_pir_to_irr(struct kvm_vcpu *vcpu)
  {
        struct vcpu_vmx *vmx = to_vmx(vcpu);
        int max_irr;
 +      bool max_irr_updated;
  
        WARN_ON(!vcpu->arch.apicv_active);
        if (pi_test_on(&vmx->pi_desc)) {
                 * But on x86 this is just a compiler barrier anyway.
                 */
                smp_mb__after_atomic();
 -              max_irr = kvm_apic_update_irr(vcpu, vmx->pi_desc.pir);
 +              max_irr_updated =
 +                      kvm_apic_update_irr(vcpu, vmx->pi_desc.pir, &max_irr);
 +
 +              /*
 +               * If we are running L2 and L1 has a new pending interrupt
 +               * which can be injected, we should re-evaluate
 +               * what should be done with this new L1 interrupt.
 +               * If L1 intercepts external-interrupts, we should
 +               * exit from L2 to L1. Otherwise, interrupt should be
 +               * delivered directly to L2.
 +               */
 +              if (is_guest_mode(vcpu) && max_irr_updated) {
 +                      if (nested_exit_on_intr(vcpu))
 +                              kvm_vcpu_exiting_guest_mode(vcpu);
 +                      else
 +                              kvm_make_request(KVM_REQ_EVENT, vcpu);
 +              }
        } else {
                max_irr = kvm_lapic_find_highest_irr(vcpu);
        }
@@@ -9228,12 -9223,6 +9228,12 @@@ static bool vmx_xsaves_supported(void
                SECONDARY_EXEC_XSAVES;
  }
  
 +static bool vmx_umip_emulated(void)
 +{
 +      return vmcs_config.cpu_based_2nd_exec_ctrl &
 +              SECONDARY_EXEC_DESC;
 +}
 +
  static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx)
  {
        u32 exit_intr_info;
@@@ -9389,7 -9378,7 +9389,7 @@@ static void vmx_arm_hv_timer(struct kvm
  static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
  {
        struct vcpu_vmx *vmx = to_vmx(vcpu);
 -      unsigned long debugctlmsr, cr3, cr4;
 +      unsigned long cr3, cr4;
  
        /* Record the guest's net vcpu time for enforced NMI injections. */
        if (unlikely(!enable_vnmi &&
                __write_pkru(vcpu->arch.pkru);
  
        atomic_switch_perf_msrs(vmx);
 -      debugctlmsr = get_debugctlmsr();
  
        vmx_arm_hv_timer(vcpu);
  
        vmexit_fill_RSB();
  
        /* MSR_IA32_DEBUGCTLMSR is zeroed on vmexit. Restore it if needed */
 -      if (debugctlmsr)
 -              update_debugctlmsr(debugctlmsr);
 +      if (vmx->host_debugctlmsr)
 +              update_debugctlmsr(vmx->host_debugctlmsr);
  
  #ifndef CONFIG_X86_64
        /*
@@@ -9678,8 -9668,10 +9678,8 @@@ static void vmx_switch_vmcs(struct kvm_
  static void vmx_free_vcpu_nested(struct kvm_vcpu *vcpu)
  {
         struct vcpu_vmx *vmx = to_vmx(vcpu);
 -       int r;
  
 -       r = vcpu_load(vcpu);
 -       BUG_ON(r);
 +       vcpu_load(vcpu);
         vmx_switch_vmcs(vcpu, &vmx->vmcs01);
         free_nested(vmx);
         vcpu_put(vcpu);
@@@ -9879,8 -9871,7 +9879,8 @@@ static void vmcs_set_secondary_exec_con
        u32 mask =
                SECONDARY_EXEC_SHADOW_VMCS |
                SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
 -              SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
 +              SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
 +              SECONDARY_EXEC_DESC;
  
        u32 cur_ctl = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
  
@@@ -10046,8 -10037,8 +10046,8 @@@ static void vmx_inject_page_fault_neste
        }
  }
  
 -static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
 -                                             struct vmcs12 *vmcs12);
 +static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
 +                                               struct vmcs12 *vmcs12);
  
  static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu,
                                        struct vmcs12 *vmcs12)
                        (unsigned long)(vmcs12->posted_intr_desc_addr &
                        (PAGE_SIZE - 1)));
        }
-       if (!nested_vmx_prepare_msr_bitmap(vcpu, vmcs12))
 -      if (cpu_has_vmx_msr_bitmap() &&
 -          nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS) &&
 -          nested_vmx_merge_msr_bitmap(vcpu, vmcs12))
++      if (nested_vmx_prepare_msr_bitmap(vcpu, vmcs12))
+               vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL,
+                             CPU_BASED_USE_MSR_BITMAPS);
+       else
                vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
                                CPU_BASED_USE_MSR_BITMAPS);
  }
@@@ -10204,8 -10200,8 +10207,8 @@@ static int nested_vmx_check_tpr_shadow_
   * Merge L0's and L1's MSR bitmap, return false to indicate that
   * we do not use the hardware.
   */
 -static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
 -                                             struct vmcs12 *vmcs12)
 +static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
 +                                               struct vmcs12 *vmcs12)
  {
        int msr;
        struct page *page;
         *    updated to reflect this when L1 (or its L2s) actually write to
         *    the MSR.
         */
-       bool pred_cmd = msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
-       bool spec_ctrl = msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
+       bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
+       bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
  
 +      /* Nothing to do if the MSR bitmap is not in use.  */
 +      if (!cpu_has_vmx_msr_bitmap() ||
 +          !nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS))
 +              return false;
 +
        if (!nested_cpu_has_virt_x2apic_mode(vmcs12) &&
            !pred_cmd && !spec_ctrl)
                return false;
        page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->msr_bitmap);
        if (is_error_page(page))
                return false;
 -      msr_bitmap_l1 = (unsigned long *)kmap(page);
  
 -      memset(msr_bitmap_l0, 0xff, PAGE_SIZE);
 +      msr_bitmap_l1 = (unsigned long *)kmap(page);
 +      if (nested_cpu_has_apic_reg_virt(vmcs12)) {
 +              /*
 +               * L0 need not intercept reads for MSRs between 0x800 and 0x8ff, it
 +               * just lets the processor take the value from the virtual-APIC page;
 +               * take those 256 bits directly from the L1 bitmap.
 +               */
 +              for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
 +                      unsigned word = msr / BITS_PER_LONG;
 +                      msr_bitmap_l0[word] = msr_bitmap_l1[word];
 +                      msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;
 +              }
 +      } else {
 +              for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
 +                      unsigned word = msr / BITS_PER_LONG;
 +                      msr_bitmap_l0[word] = ~0;
 +                      msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;
 +              }
 +      }
  
 -      if (nested_cpu_has_virt_x2apic_mode(vmcs12)) {
 -              if (nested_cpu_has_apic_reg_virt(vmcs12))
 -                      for (msr = 0x800; msr <= 0x8ff; msr++)
 -                              nested_vmx_disable_intercept_for_msr(
 -                                      msr_bitmap_l1, msr_bitmap_l0,
 -                                      msr, MSR_TYPE_R);
 +      nested_vmx_disable_intercept_for_msr(
 +              msr_bitmap_l1, msr_bitmap_l0,
 +              X2APIC_MSR(APIC_TASKPRI),
 +              MSR_TYPE_W);
  
 +      if (nested_cpu_has_vid(vmcs12)) {
                nested_vmx_disable_intercept_for_msr(
 -                              msr_bitmap_l1, msr_bitmap_l0,
 -                              APIC_BASE_MSR + (APIC_TASKPRI >> 4),
 -                              MSR_TYPE_R | MSR_TYPE_W);
 -
 -              if (nested_cpu_has_vid(vmcs12)) {
 -                      nested_vmx_disable_intercept_for_msr(
 -                              msr_bitmap_l1, msr_bitmap_l0,
 -                              APIC_BASE_MSR + (APIC_EOI >> 4),
 -                              MSR_TYPE_W);
 -                      nested_vmx_disable_intercept_for_msr(
 -                              msr_bitmap_l1, msr_bitmap_l0,
 -                              APIC_BASE_MSR + (APIC_SELF_IPI >> 4),
 -                              MSR_TYPE_W);
 -              }
 +                      msr_bitmap_l1, msr_bitmap_l0,
 +                      X2APIC_MSR(APIC_EOI),
 +                      MSR_TYPE_W);
 +              nested_vmx_disable_intercept_for_msr(
 +                      msr_bitmap_l1, msr_bitmap_l0,
 +                      X2APIC_MSR(APIC_SELF_IPI),
 +                      MSR_TYPE_W);
        }
  
        if (spec_ctrl)
@@@ -10553,12 -10535,25 +10556,12 @@@ static int nested_vmx_load_cr3(struct k
        return 0;
  }
  
 -/*
 - * prepare_vmcs02 is called when the L1 guest hypervisor runs its nested
 - * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it
 - * with L0's requirements for its guest (a.k.a. vmcs01), so we can run the L2
 - * guest in a way that will both be appropriate to L1's requests, and our
 - * needs. In addition to modifying the active vmcs (which is vmcs02), this
 - * function also has additional necessary side-effects, like setting various
 - * vcpu->arch fields.
 - * Returns 0 on success, 1 on failure. Invalid state exit qualification code
 - * is assigned to entry_failure_code on failure.
 - */
 -static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
 -                        bool from_vmentry, u32 *entry_failure_code)
 +static void prepare_vmcs02_full(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
 +                             bool from_vmentry)
  {
        struct vcpu_vmx *vmx = to_vmx(vcpu);
 -      u32 exec_control, vmcs12_exec_ctrl;
  
        vmcs_write16(GUEST_ES_SELECTOR, vmcs12->guest_es_selector);
 -      vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector);
        vmcs_write16(GUEST_SS_SELECTOR, vmcs12->guest_ss_selector);
        vmcs_write16(GUEST_DS_SELECTOR, vmcs12->guest_ds_selector);
        vmcs_write16(GUEST_FS_SELECTOR, vmcs12->guest_fs_selector);
        vmcs_write16(GUEST_LDTR_SELECTOR, vmcs12->guest_ldtr_selector);
        vmcs_write16(GUEST_TR_SELECTOR, vmcs12->guest_tr_selector);
        vmcs_write32(GUEST_ES_LIMIT, vmcs12->guest_es_limit);
 -      vmcs_write32(GUEST_CS_LIMIT, vmcs12->guest_cs_limit);
        vmcs_write32(GUEST_SS_LIMIT, vmcs12->guest_ss_limit);
        vmcs_write32(GUEST_DS_LIMIT, vmcs12->guest_ds_limit);
        vmcs_write32(GUEST_FS_LIMIT, vmcs12->guest_fs_limit);
        vmcs_write32(GUEST_GDTR_LIMIT, vmcs12->guest_gdtr_limit);
        vmcs_write32(GUEST_IDTR_LIMIT, vmcs12->guest_idtr_limit);
        vmcs_write32(GUEST_ES_AR_BYTES, vmcs12->guest_es_ar_bytes);
 -      vmcs_write32(GUEST_CS_AR_BYTES, vmcs12->guest_cs_ar_bytes);
        vmcs_write32(GUEST_SS_AR_BYTES, vmcs12->guest_ss_ar_bytes);
        vmcs_write32(GUEST_DS_AR_BYTES, vmcs12->guest_ds_ar_bytes);
        vmcs_write32(GUEST_FS_AR_BYTES, vmcs12->guest_fs_ar_bytes);
        vmcs_write32(GUEST_GS_AR_BYTES, vmcs12->guest_gs_ar_bytes);
        vmcs_write32(GUEST_LDTR_AR_BYTES, vmcs12->guest_ldtr_ar_bytes);
        vmcs_write32(GUEST_TR_AR_BYTES, vmcs12->guest_tr_ar_bytes);
 -      vmcs_writel(GUEST_ES_BASE, vmcs12->guest_es_base);
 -      vmcs_writel(GUEST_CS_BASE, vmcs12->guest_cs_base);
        vmcs_writel(GUEST_SS_BASE, vmcs12->guest_ss_base);
        vmcs_writel(GUEST_DS_BASE, vmcs12->guest_ds_base);
        vmcs_writel(GUEST_FS_BASE, vmcs12->guest_fs_base);
        vmcs_writel(GUEST_GDTR_BASE, vmcs12->guest_gdtr_base);
        vmcs_writel(GUEST_IDTR_BASE, vmcs12->guest_idtr_base);
  
 +      vmcs_write32(GUEST_SYSENTER_CS, vmcs12->guest_sysenter_cs);
 +      vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS,
 +              vmcs12->guest_pending_dbg_exceptions);
 +      vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->guest_sysenter_esp);
 +      vmcs_writel(GUEST_SYSENTER_EIP, vmcs12->guest_sysenter_eip);
 +
 +      if (nested_cpu_has_xsaves(vmcs12))
 +              vmcs_write64(XSS_EXIT_BITMAP, vmcs12->xss_exit_bitmap);
 +      vmcs_write64(VMCS_LINK_POINTER, -1ull);
 +
 +      if (cpu_has_vmx_posted_intr())
 +              vmcs_write16(POSTED_INTR_NV, POSTED_INTR_NESTED_VECTOR);
 +
 +      /*
 +       * Whether page-faults are trapped is determined by a combination of
 +       * 3 settings: PFEC_MASK, PFEC_MATCH and EXCEPTION_BITMAP.PF.
 +       * If enable_ept, L0 doesn't care about page faults and we should
 +       * set all of these to L1's desires. However, if !enable_ept, L0 does
 +       * care about (at least some) page faults, and because it is not easy
 +       * (if at all possible?) to merge L0 and L1's desires, we simply ask
 +       * to exit on each and every L2 page fault. This is done by setting
 +       * MASK=MATCH=0 and (see below) EB.PF=1.
 +       * Note that below we don't need special code to set EB.PF beyond the
 +       * "or"ing of the EB of vmcs01 and vmcs12, because when enable_ept,
 +       * vmcs01's EB.PF is 0 so the "or" will take vmcs12's value, and when
 +       * !enable_ept, EB.PF is 1, so the "or" will always be 1.
 +       */
 +      vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK,
 +              enable_ept ? vmcs12->page_fault_error_code_mask : 0);
 +      vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH,
 +              enable_ept ? vmcs12->page_fault_error_code_match : 0);
 +
 +      /* All VMFUNCs are currently emulated through L0 vmexits.  */
 +      if (cpu_has_vmx_vmfunc())
 +              vmcs_write64(VM_FUNCTION_CONTROL, 0);
 +
 +      if (cpu_has_vmx_apicv()) {
 +              vmcs_write64(EOI_EXIT_BITMAP0, vmcs12->eoi_exit_bitmap0);
 +              vmcs_write64(EOI_EXIT_BITMAP1, vmcs12->eoi_exit_bitmap1);
 +              vmcs_write64(EOI_EXIT_BITMAP2, vmcs12->eoi_exit_bitmap2);
 +              vmcs_write64(EOI_EXIT_BITMAP3, vmcs12->eoi_exit_bitmap3);
 +      }
 +
 +      /*
 +       * Set host-state according to L0's settings (vmcs12 is irrelevant here)
 +       * Some constant fields are set here by vmx_set_constant_host_state().
 +       * Other fields are different per CPU, and will be set later when
 +       * vmx_vcpu_load() is called, and when vmx_save_host_state() is called.
 +       */
 +      vmx_set_constant_host_state(vmx);
 +
 +      /*
 +       * Set the MSR load/store lists to match L0's settings.
 +       */
 +      vmcs_write32(VM_EXIT_MSR_STORE_COUNT, 0);
 +      vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.nr);
 +      vmcs_write64(VM_EXIT_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.host));
 +      vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.nr);
 +      vmcs_write64(VM_ENTRY_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.guest));
 +
 +      set_cr4_guest_host_mask(vmx);
 +
 +      if (vmx_mpx_supported())
 +              vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);
 +
 +      if (enable_vpid) {
 +              if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
 +                      vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
 +              else
 +                      vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
 +      }
 +
 +      /*
 +       * L1 may access the L2's PDPTR, so save them to construct vmcs12
 +       */
 +      if (enable_ept) {
 +              vmcs_write64(GUEST_PDPTR0, vmcs12->guest_pdptr0);
 +              vmcs_write64(GUEST_PDPTR1, vmcs12->guest_pdptr1);
 +              vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2);
 +              vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3);
 +      }
 +
 +      if (cpu_has_vmx_msr_bitmap())
 +              vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap));
 +}
 +
 +/*
 + * prepare_vmcs02 is called when the L1 guest hypervisor runs its nested
 + * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it
 + * with L0's requirements for its guest (a.k.a. vmcs01), so we can run the L2
 + * guest in a way that will both be appropriate to L1's requests, and our
 + * needs. In addition to modifying the active vmcs (which is vmcs02), this
 + * function also has additional necessary side-effects, like setting various
 + * vcpu->arch fields.
 + * Returns 0 on success, 1 on failure. Invalid state exit qualification code
 + * is assigned to entry_failure_code on failure.
 + */
 +static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
 +                        bool from_vmentry, u32 *entry_failure_code)
 +{
 +      struct vcpu_vmx *vmx = to_vmx(vcpu);
 +      u32 exec_control, vmcs12_exec_ctrl;
 +
 +      /*
 +       * First, the fields that are shadowed.  This must be kept in sync
 +       * with vmx_shadow_fields.h.
 +       */
 +
 +      vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector);
 +      vmcs_write32(GUEST_CS_LIMIT, vmcs12->guest_cs_limit);
 +      vmcs_write32(GUEST_CS_AR_BYTES, vmcs12->guest_cs_ar_bytes);
 +      vmcs_writel(GUEST_ES_BASE, vmcs12->guest_es_base);
 +      vmcs_writel(GUEST_CS_BASE, vmcs12->guest_cs_base);
 +
 +      /*
 +       * Not in vmcs02: GUEST_PML_INDEX, HOST_FS_SELECTOR, HOST_GS_SELECTOR,
 +       * HOST_FS_BASE, HOST_GS_BASE.
 +       */
 +
        if (from_vmentry &&
            (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) {
                kvm_set_dr(vcpu, 7, vmcs12->guest_dr7);
        } else {
                vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0);
        }
 -      vmcs_write32(GUEST_SYSENTER_CS, vmcs12->guest_sysenter_cs);
        vmx_set_rflags(vcpu, vmcs12->guest_rflags);
 -      vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS,
 -              vmcs12->guest_pending_dbg_exceptions);
 -      vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->guest_sysenter_esp);
 -      vmcs_writel(GUEST_SYSENTER_EIP, vmcs12->guest_sysenter_eip);
 -
 -      if (nested_cpu_has_xsaves(vmcs12))
 -              vmcs_write64(XSS_EXIT_BITMAP, vmcs12->xss_exit_bitmap);
 -      vmcs_write64(VMCS_LINK_POINTER, -1ull);
  
        exec_control = vmcs12->pin_based_vm_exec_control;
  
        if (nested_cpu_has_posted_intr(vmcs12)) {
                vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv;
                vmx->nested.pi_pending = false;
 -              vmcs_write16(POSTED_INTR_NV, POSTED_INTR_NESTED_VECTOR);
        } else {
                exec_control &= ~PIN_BASED_POSTED_INTR;
        }
        if (nested_cpu_has_preemption_timer(vmcs12))
                vmx_start_preemption_timer(vcpu);
  
 -      /*
 -       * Whether page-faults are trapped is determined by a combination of
 -       * 3 settings: PFEC_MASK, PFEC_MATCH and EXCEPTION_BITMAP.PF.
 -       * If enable_ept, L0 doesn't care about page faults and we should
 -       * set all of these to L1's desires. However, if !enable_ept, L0 does
 -       * care about (at least some) page faults, and because it is not easy
 -       * (if at all possible?) to merge L0 and L1's desires, we simply ask
 -       * to exit on each and every L2 page fault. This is done by setting
 -       * MASK=MATCH=0 and (see below) EB.PF=1.
 -       * Note that below we don't need special code to set EB.PF beyond the
 -       * "or"ing of the EB of vmcs01 and vmcs12, because when enable_ept,
 -       * vmcs01's EB.PF is 0 so the "or" will take vmcs12's value, and when
 -       * !enable_ept, EB.PF is 1, so the "or" will always be 1.
 -       */
 -      vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK,
 -              enable_ept ? vmcs12->page_fault_error_code_mask : 0);
 -      vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH,
 -              enable_ept ? vmcs12->page_fault_error_code_match : 0);
 -
        if (cpu_has_secondary_exec_ctrls()) {
                exec_control = vmx->secondary_exec_control;
  
                        exec_control |= vmcs12_exec_ctrl;
                }
  
 -              /* All VMFUNCs are currently emulated through L0 vmexits.  */
 -              if (exec_control & SECONDARY_EXEC_ENABLE_VMFUNC)
 -                      vmcs_write64(VM_FUNCTION_CONTROL, 0);
 -
 -              if (exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) {
 -                      vmcs_write64(EOI_EXIT_BITMAP0,
 -                              vmcs12->eoi_exit_bitmap0);
 -                      vmcs_write64(EOI_EXIT_BITMAP1,
 -                              vmcs12->eoi_exit_bitmap1);
 -                      vmcs_write64(EOI_EXIT_BITMAP2,
 -                              vmcs12->eoi_exit_bitmap2);
 -                      vmcs_write64(EOI_EXIT_BITMAP3,
 -                              vmcs12->eoi_exit_bitmap3);
 +              if (exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
                        vmcs_write16(GUEST_INTR_STATUS,
                                vmcs12->guest_intr_status);
 -              }
  
                /*
                 * Write an illegal value to APIC_ACCESS_ADDR. Later,
                vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
        }
  
 -
 -      /*
 -       * Set host-state according to L0's settings (vmcs12 is irrelevant here)
 -       * Some constant fields are set here by vmx_set_constant_host_state().
 -       * Other fields are different per CPU, and will be set later when
 -       * vmx_vcpu_load() is called, and when vmx_save_host_state() is called.
 -       */
 -      vmx_set_constant_host_state(vmx);
 -
 -      /*
 -       * Set the MSR load/store lists to match L0's settings.
 -       */
 -      vmcs_write32(VM_EXIT_MSR_STORE_COUNT, 0);
 -      vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.nr);
 -      vmcs_write64(VM_EXIT_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.host));
 -      vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.nr);
 -      vmcs_write64(VM_ENTRY_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.guest));
 -
        /*
         * HOST_RSP is normally set correctly in vmx_vcpu_run() just before
         * entry, but only if the current (host) sp changed from the value
        }
  
        /*
 -       * Merging of IO bitmap not currently supported.
 -       * Rather, exit every time.
 +       * A vmexit (to either L1 hypervisor or L0 userspace) is always needed
 +       * for I/O port accesses.
         */
        exec_control &= ~CPU_BASED_USE_IO_BITMAPS;
        exec_control |= CPU_BASED_UNCOND_IO_EXITING;
                vmcs_write64(GUEST_IA32_PAT, vmx->vcpu.arch.pat);
        }
  
 -      set_cr4_guest_host_mask(vmx);
 -
 -      if (from_vmentry &&
 -          vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)
 -              vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);
 -
        if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_TSC_OFFSETING)
                vmcs_write64(TSC_OFFSET,
                        vcpu->arch.tsc_offset + vmcs12->tsc_offset);
        if (kvm_has_tsc_control)
                decache_tsc_multiplier(vmx);
  
 -      if (cpu_has_vmx_msr_bitmap())
 -              vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap));
 -
        if (enable_vpid) {
                /*
                 * There is no direct mapping between vpid02 and vpid12, the
                 * even if spawn a lot of nested vCPUs.
                 */
                if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02) {
 -                      vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
                        if (vmcs12->virtual_processor_id != vmx->nested.last_vpid) {
                                vmx->nested.last_vpid = vmcs12->virtual_processor_id;
 -                              __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
 +                              __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02, true);
                        }
                } else {
 -                      vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
 -                      vmx_flush_tlb(vcpu);
 +                      vmx_flush_tlb(vcpu, true);
                }
 -
        }
  
        if (enable_pml) {
        /* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */
        vmx_set_efer(vcpu, vcpu->arch.efer);
  
 +      if (vmx->nested.dirty_vmcs12) {
 +              prepare_vmcs02_full(vcpu, vmcs12, from_vmentry);
 +              vmx->nested.dirty_vmcs12 = false;
 +      }
 +
        /* Shadow page tables on either EPT or shadow page tables. */
        if (nested_vmx_load_cr3(vcpu, vmcs12->guest_cr3, nested_cpu_has_ept(vmcs12),
                                entry_failure_code))
        if (!enable_ept)
                vcpu->arch.walk_mmu->inject_page_fault = vmx_inject_page_fault_nested;
  
 -      /*
 -       * L1 may access the L2's PDPTR, so save them to construct vmcs12
 -       */
 -      if (enable_ept) {
 -              vmcs_write64(GUEST_PDPTR0, vmcs12->guest_pdptr0);
 -              vmcs_write64(GUEST_PDPTR1, vmcs12->guest_pdptr1);
 -              vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2);
 -              vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3);
 -      }
 -
        kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->guest_rsp);
        kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->guest_rip);
        return 0;
@@@ -11298,6 -11255,7 +11301,6 @@@ static int vmx_check_nested_events(stru
                if (block_nested_events)
                        return -EBUSY;
                nested_vmx_inject_exception_vmexit(vcpu, exit_qual);
 -              vcpu->arch.exception.pending = false;
                return 0;
        }
  
@@@ -11578,8 -11536,11 +11581,8 @@@ static void load_vmcs12_host_state(stru
                 * L1's vpid. TODO: move to a more elaborate solution, giving
                 * each L2 its own vpid and exposing the vpid feature to L1.
                 */
 -              vmx_flush_tlb(vcpu);
 +              vmx_flush_tlb(vcpu, true);
        }
 -      /* Restore posted intr vector. */
 -      if (nested_cpu_has_posted_intr(vmcs12))
 -              vmcs_write16(POSTED_INTR_NV, POSTED_INTR_VECTOR);
  
        vmcs_write32(GUEST_SYSENTER_CS, vmcs12->host_ia32_sysenter_cs);
        vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->host_ia32_sysenter_esp);
@@@ -11840,21 -11801,6 +11843,21 @@@ static int vmx_check_intercept(struct k
                               struct x86_instruction_info *info,
                               enum x86_intercept_stage stage)
  {
 +      struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
 +      struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt;
 +
 +      /*
 +       * RDPID causes #UD if disabled through secondary execution controls.
 +       * Because it is marked as EmulateOnUD, we need to intercept it here.
 +       */
 +      if (info->intercept == x86_intercept_rdtscp &&
 +          !nested_cpu_has2(vmcs12, SECONDARY_EXEC_RDTSCP)) {
 +              ctxt->exception.vector = UD_VECTOR;
 +              ctxt->exception.error_code_valid = false;
 +              return X86EMUL_PROPAGATE_FAULT;
 +      }
 +
 +      /* TODO: check more intercepts... */
        return X86EMUL_CONTINUE;
  }
  
@@@ -12368,7 -12314,6 +12371,7 @@@ static struct kvm_x86_ops vmx_x86_ops _
        .handle_external_intr = vmx_handle_external_intr,
        .mpx_supported = vmx_mpx_supported,
        .xsaves_supported = vmx_xsaves_supported,
 +      .umip_emulated = vmx_umip_emulated,
  
        .check_nested_events = vmx_check_nested_events,
  
diff --combined arch/x86/mm/init_64.c
index 1ab42c8520693c9999e4b19d04eb565528404ed7,60ae1fe3609fcf802b9396a568e0d6755ae5b983..fecb0c0a6077e573a7185ebe482be2967e37a1aa
@@@ -256,7 -256,7 +256,7 @@@ static void __set_pte_vaddr(pud_t *pud
         * It's enough to flush this one mapping.
         * (PGE mappings get flushed as well)
         */
-       __flush_tlb_one(vaddr);
+       __flush_tlb_one_kernel(vaddr);
  }
  
  void set_pte_vaddr_p4d(p4d_t *p4d_page, unsigned long vaddr, pte_t new_pte)
@@@ -772,12 -772,12 +772,12 @@@ static void update_end_of_memory_vars(u
        }
  }
  
 -int add_pages(int nid, unsigned long start_pfn,
 -            unsigned long nr_pages, bool want_memblock)
 +int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
 +              struct vmem_altmap *altmap, bool want_memblock)
  {
        int ret;
  
 -      ret = __add_pages(nid, start_pfn, nr_pages, want_memblock);
 +      ret = __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
        WARN_ON_ONCE(ret);
  
        /* update max_pfn, max_low_pfn and high_memory */
        return ret;
  }
  
 -int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
 +int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
 +              bool want_memblock)
  {
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
  
        init_memory_mapping(start, start + size);
  
 -      return add_pages(nid, start_pfn, nr_pages, want_memblock);
 +      return add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
  }
 -EXPORT_SYMBOL_GPL(arch_add_memory);
  
  #define PAGE_INUSE 0xFD
  
 -static void __meminit free_pagetable(struct page *page, int order)
 +static void __meminit free_pagetable(struct page *page, int order,
 +              struct vmem_altmap *altmap)
  {
        unsigned long magic;
        unsigned int nr_pages = 1 << order;
 -      struct vmem_altmap *altmap = to_vmem_altmap((unsigned long) page);
  
        if (altmap) {
                vmem_altmap_free(altmap, nr_pages);
                free_pages((unsigned long)page_address(page), order);
  }
  
 -static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd)
 +static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd,
 +              struct vmem_altmap *altmap)
  {
        pte_t *pte;
        int i;
        }
  
        /* free a pte talbe */
 -      free_pagetable(pmd_page(*pmd), 0);
 +      free_pagetable(pmd_page(*pmd), 0, altmap);
        spin_lock(&init_mm.page_table_lock);
        pmd_clear(pmd);
        spin_unlock(&init_mm.page_table_lock);
  }
  
 -static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
 +static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud,
 +              struct vmem_altmap *altmap)
  {
        pmd_t *pmd;
        int i;
        }
  
        /* free a pmd talbe */
 -      free_pagetable(pud_page(*pud), 0);
 +      free_pagetable(pud_page(*pud), 0, altmap);
        spin_lock(&init_mm.page_table_lock);
        pud_clear(pud);
        spin_unlock(&init_mm.page_table_lock);
  }
  
 -static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
 +static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d,
 +              struct vmem_altmap *altmap)
  {
        pud_t *pud;
        int i;
        }
  
        /* free a pud talbe */
 -      free_pagetable(p4d_page(*p4d), 0);
 +      free_pagetable(p4d_page(*p4d), 0, altmap);
        spin_lock(&init_mm.page_table_lock);
        p4d_clear(p4d);
        spin_unlock(&init_mm.page_table_lock);
  
  static void __meminit
  remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
 -               bool direct)
 +               struct vmem_altmap *altmap, bool direct)
  {
        unsigned long next, pages = 0;
        pte_t *pte;
                         * freed when offlining, or simplely not in use.
                         */
                        if (!direct)
 -                              free_pagetable(pte_page(*pte), 0);
 +                              free_pagetable(pte_page(*pte), 0, altmap);
  
                        spin_lock(&init_mm.page_table_lock);
                        pte_clear(&init_mm, addr, pte);
  
                        page_addr = page_address(pte_page(*pte));
                        if (!memchr_inv(page_addr, PAGE_INUSE, PAGE_SIZE)) {
 -                              free_pagetable(pte_page(*pte), 0);
 +                              free_pagetable(pte_page(*pte), 0, altmap);
  
                                spin_lock(&init_mm.page_table_lock);
                                pte_clear(&init_mm, addr, pte);
  
  static void __meminit
  remove_pmd_table(pmd_t *pmd_start, unsigned long addr, unsigned long end,
 -               bool direct)
 +               bool direct, struct vmem_altmap *altmap)
  {
        unsigned long next, pages = 0;
        pte_t *pte_base;
                            IS_ALIGNED(next, PMD_SIZE)) {
                                if (!direct)
                                        free_pagetable(pmd_page(*pmd),
 -                                                     get_order(PMD_SIZE));
 +                                                     get_order(PMD_SIZE),
 +                                                     altmap);
  
                                spin_lock(&init_mm.page_table_lock);
                                pmd_clear(pmd);
                                if (!memchr_inv(page_addr, PAGE_INUSE,
                                                PMD_SIZE)) {
                                        free_pagetable(pmd_page(*pmd),
 -                                                     get_order(PMD_SIZE));
 +                                                     get_order(PMD_SIZE),
 +                                                     altmap);
  
                                        spin_lock(&init_mm.page_table_lock);
                                        pmd_clear(pmd);
                }
  
                pte_base = (pte_t *)pmd_page_vaddr(*pmd);
 -              remove_pte_table(pte_base, addr, next, direct);
 -              free_pte_table(pte_base, pmd);
 +              remove_pte_table(pte_base, addr, next, altmap, direct);
 +              free_pte_table(pte_base, pmd, altmap);
        }
  
        /* Call free_pmd_table() in remove_pud_table(). */
  
  static void __meminit
  remove_pud_table(pud_t *pud_start, unsigned long addr, unsigned long end,
 -               bool direct)
 +               struct vmem_altmap *altmap, bool direct)
  {
        unsigned long next, pages = 0;
        pmd_t *pmd_base;
                            IS_ALIGNED(next, PUD_SIZE)) {
                                if (!direct)
                                        free_pagetable(pud_page(*pud),
 -                                                     get_order(PUD_SIZE));
 +                                                     get_order(PUD_SIZE),
 +                                                     altmap);
  
                                spin_lock(&init_mm.page_table_lock);
                                pud_clear(pud);
                                if (!memchr_inv(page_addr, PAGE_INUSE,
                                                PUD_SIZE)) {
                                        free_pagetable(pud_page(*pud),
 -                                                     get_order(PUD_SIZE));
 +                                                     get_order(PUD_SIZE),
 +                                                     altmap);
  
                                        spin_lock(&init_mm.page_table_lock);
                                        pud_clear(pud);
                }
  
                pmd_base = pmd_offset(pud, 0);
 -              remove_pmd_table(pmd_base, addr, next, direct);
 -              free_pmd_table(pmd_base, pud);
 +              remove_pmd_table(pmd_base, addr, next, direct, altmap);
 +              free_pmd_table(pmd_base, pud, altmap);
        }
  
        if (direct)
  
  static void __meminit
  remove_p4d_table(p4d_t *p4d_start, unsigned long addr, unsigned long end,
 -               bool direct)
 +               struct vmem_altmap *altmap, bool direct)
  {
        unsigned long next, pages = 0;
        pud_t *pud_base;
                BUILD_BUG_ON(p4d_large(*p4d));
  
                pud_base = pud_offset(p4d, 0);
 -              remove_pud_table(pud_base, addr, next, direct);
 +              remove_pud_table(pud_base, addr, next, altmap, direct);
                /*
                 * For 4-level page tables we do not want to free PUDs, but in the
                 * 5-level case we should free them. This code will have to change
                 * to adapt for boot-time switching between 4 and 5 level page tables.
                 */
                if (CONFIG_PGTABLE_LEVELS == 5)
 -                      free_pud_table(pud_base, p4d);
 +                      free_pud_table(pud_base, p4d, altmap);
        }
  
        if (direct)
  
  /* start and end are both virtual address. */
  static void __meminit
 -remove_pagetable(unsigned long start, unsigned long end, bool direct)
 +remove_pagetable(unsigned long start, unsigned long end, bool direct,
 +              struct vmem_altmap *altmap)
  {
        unsigned long next;
        unsigned long addr;
                        continue;
  
                p4d = p4d_offset(pgd, 0);
 -              remove_p4d_table(p4d, addr, next, direct);
 +              remove_p4d_table(p4d, addr, next, altmap, direct);
        }
  
        flush_tlb_all();
  }
  
 -void __ref vmemmap_free(unsigned long start, unsigned long end)
 +void __ref vmemmap_free(unsigned long start, unsigned long end,
 +              struct vmem_altmap *altmap)
  {
 -      remove_pagetable(start, end, false);
 +      remove_pagetable(start, end, false, altmap);
  }
  
  #ifdef CONFIG_MEMORY_HOTREMOVE
@@@ -1138,22 -1129,24 +1138,22 @@@ kernel_physical_mapping_remove(unsigne
        start = (unsigned long)__va(start);
        end = (unsigned long)__va(end);
  
 -      remove_pagetable(start, end, true);
 +      remove_pagetable(start, end, true, NULL);
  }
  
 -int __ref arch_remove_memory(u64 start, u64 size)
 +int __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
  {
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
        struct page *page = pfn_to_page(start_pfn);
 -      struct vmem_altmap *altmap;
        struct zone *zone;
        int ret;
  
        /* With altmap the first mapped page is offset from @start */
 -      altmap = to_vmem_altmap((unsigned long) page);
        if (altmap)
                page += vmem_altmap_offset(altmap);
        zone = page_zone(page);
 -      ret = __remove_pages(zone, start_pfn, nr_pages);
 +      ret = __remove_pages(zone, start_pfn, nr_pages, altmap);
        WARN_ON_ONCE(ret);
        kernel_physical_mapping_remove(start, start + size);
  
@@@ -1385,10 -1378,7 +1385,10 @@@ static int __meminit vmemmap_populate_h
                if (pmd_none(*pmd)) {
                        void *p;
  
 -                      p = __vmemmap_alloc_block_buf(PMD_SIZE, node, altmap);
 +                      if (altmap)
 +                              p = altmap_alloc_block_buf(PMD_SIZE, altmap);
 +                      else
 +                              p = vmemmap_alloc_block_buf(PMD_SIZE, node);
                        if (p) {
                                pte_t entry;
  
        return 0;
  }
  
 -int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 +int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
 +              struct vmem_altmap *altmap)
  {
 -      struct vmem_altmap *altmap = to_vmem_altmap(start);
        int err;
  
        if (boot_cpu_has(X86_FEATURE_PSE))
diff --combined arch/x86/mm/tlb.c
index 8dcc0607f80584748f92fe43aba9a32685fc6f9b,0c936435ea9398727da162fd76c5ee4dc4a91892..7f1a51399674b1da34cac674b94b66043f11a1ea
@@@ -229,12 -229,6 +229,12 @@@ void switch_mm_irqs_off(struct mm_struc
  #endif
        this_cpu_write(cpu_tlbstate.is_lazy, false);
  
 +      /*
 +       * The membarrier system call requires a full memory barrier and
 +       * core serialization before returning to user-space, after
 +       * storing to rq->curr. Writing to CR3 provides that full
 +       * memory barrier and core serializing instruction.
 +       */
        if (real_prev == next) {
                VM_WARN_ON(this_cpu_read(cpu_tlbstate.ctxs[prev_asid].ctx_id) !=
                           next->context.ctx_id);
@@@ -498,7 -492,7 +498,7 @@@ static void flush_tlb_func_common(cons
         *    flush that changes context.tlb_gen from 2 to 3.  If they get
         *    processed on this CPU in reverse order, we'll see
         *     local_tlb_gen == 1, mm_tlb_gen == 3, and end != TLB_FLUSH_ALL.
-        *    If we were to use __flush_tlb_single() and set local_tlb_gen to
+        *    If we were to use __flush_tlb_one_user() and set local_tlb_gen to
         *    3, we'd be break the invariant: we'd update local_tlb_gen above
         *    1 without the full flush that's needed for tlb_gen 2.
         *
  
                addr = f->start;
                while (addr < f->end) {
-                       __flush_tlb_single(addr);
+                       __flush_tlb_one_user(addr);
                        addr += PAGE_SIZE;
                }
                if (local)
@@@ -666,7 -660,7 +666,7 @@@ static void do_kernel_range_flush(void 
  
        /* flush range by one by one 'invlpg' */
        for (addr = f->start; addr < f->end; addr += PAGE_SIZE)
-               __flush_tlb_one(addr);
+               __flush_tlb_one_kernel(addr);
  }
  
  void flush_tlb_kernel_range(unsigned long start, unsigned long end)
index c2e9285d1bf11539ce7efe9c3a683467368c9cbb,7d5d53f36a7abd90754edd64ce3b8edeb5651382..db77e087adaf874f6556f5f1d0cb5bdcaf54c42f
@@@ -299,7 -299,7 +299,7 @@@ static void bau_process_message(struct 
                local_flush_tlb();
                stat->d_alltlb++;
        } else {
-               __flush_tlb_single(msg->address);
+               __flush_tlb_one_user(msg->address);
                stat->d_onetlb++;
        }
        stat->d_requestee++;
@@@ -1751,8 -1751,7 +1751,8 @@@ static void activation_descriptor_init(
                uv1 = 1;
  
        /* the 14-bit pnode */
 -      write_mmr_descriptor_base(pnode, (n << UV_DESC_PSHIFT | m));
 +      write_mmr_descriptor_base(pnode,
 +              (n << UVH_LB_BAU_SB_DESCRIPTOR_BASE_NODE_ID_SHFT | m));
        /*
         * Initializing all 8 (ITEMS_PER_DESC) descriptors for each
         * cpu even though we only use the first one; one descriptor can
index 942632a27b50fb458f927ed69406eafab99511e3,d5e27bc7585a949d92e76584427b2ce4decd3004..f730b6528c185c8ab94393668afca956ee21eee7
@@@ -600,7 -600,7 +600,7 @@@ static void longhaul_setup_voltagescali
        /* Calculate kHz for one voltage step */
        kHz_step = (highest_speed - min_vid_speed) / numvscales;
  
 -      cpufreq_for_each_entry(freq_pos, longhaul_table) {
 +      cpufreq_for_each_entry_idx(freq_pos, longhaul_table, j) {
                speed = freq_pos->frequency;
                if (speed > min_vid_speed)
                        pos = (speed - min_vid_speed) / kHz_step + minvid.pos;
                freq_pos->driver_data |= mV_vrm_table[pos] << 8;
                vid = vrm_mV_table[mV_vrm_table[pos]];
                pr_info("f: %d kHz, index: %d, vid: %d mV\n",
 -                      speed, (int)(freq_pos - longhaul_table), vid.mV);
 +                      speed, j, vid.mV);
        }
  
        can_scale_voltage = 1;
@@@ -775,7 -775,7 +775,7 @@@ static int longhaul_cpu_init(struct cpu
                break;
  
        case 7:
-               switch (c->x86_mask) {
+               switch (c->x86_stepping) {
                case 0:
                        longhaul_version = TYPE_LONGHAUL_V1;
                        cpu_model = CPU_SAMUEL2;
                        break;
                case 1 ... 15:
                        longhaul_version = TYPE_LONGHAUL_V2;
-                       if (c->x86_mask < 8) {
+                       if (c->x86_stepping < 8) {
                                cpu_model = CPU_SAMUEL2;
                                cpuname = "C3 'Samuel 2' [C5B]";
                        } else {
                numscales = 32;
                memcpy(mults, nehemiah_mults, sizeof(nehemiah_mults));
                memcpy(eblcr, nehemiah_eblcr, sizeof(nehemiah_eblcr));
-               switch (c->x86_mask) {
+               switch (c->x86_stepping) {
                case 0 ... 1:
                        cpu_model = CPU_NEHEMIAH;
                        cpuname = "C3 'Nehemiah A' [C5XLOE]";
        if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0))
                longhaul_setup_voltagescaling();
  
 -      policy->cpuinfo.transition_latency = 200000;    /* nsec */
 +      policy->transition_delay_us = 200000;   /* usec */
  
        return cpufreq_table_validate_and_show(policy, longhaul_table);
  }
diff --combined drivers/hwmon/coretemp.c
index 4bdbf77f7197fc039e240021f9e15d5f4eae76e8,a42744c7665b53c0c776338774b0511e052fc047..72c338eb5fae5a94c5558ebe5aae4530bb649763
@@@ -246,8 -246,7 +246,8 @@@ static int adjust_tjmax(struct cpuinfo_
        int err;
        u32 eax, edx;
        int i;
 -      struct pci_dev *host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
 +      u16 devfn = PCI_DEVFN(0, 0);
 +      struct pci_dev *host_bridge = pci_get_domain_bus_and_slot(0, 0, devfn);
  
        /*
         * Explicit tjmax table entries override heuristics.
        for (i = 0; i < ARRAY_SIZE(tjmax_model_table); i++) {
                const struct tjmax_model *tm = &tjmax_model_table[i];
                if (c->x86_model == tm->model &&
-                   (tm->mask == ANY || c->x86_mask == tm->mask))
+                   (tm->mask == ANY || c->x86_stepping == tm->mask))
                        return tm->tjmax;
        }
  
        /* Early chips have no MSR for TjMax */
  
-       if (c->x86_model == 0xf && c->x86_mask < 4)
+       if (c->x86_model == 0xf && c->x86_stepping < 4)
                usemsr_ee = 0;
  
        if (c->x86_model > 0xe && usemsr_ee) {
@@@ -426,7 -425,7 +426,7 @@@ static int chk_ucode_version(unsigned i
         * Readings might stop update when processor visited too deep sleep,
         * fixed for stepping D0 (6EC).
         */
-       if (c->x86_model == 0xe && c->x86_mask < 0xc && c->microcode < 0x39) {
+       if (c->x86_model == 0xe && c->x86_stepping < 0xc && c->microcode < 0x39) {
                pr_err("Errata AE18 not fixed, update BIOS or microcode of the CPU!\n");
                return -ENODEV;
        }
diff --combined drivers/hwmon/k10temp.c
index 06b4e1c78bd8f175e258041584d546ed8cf5538f,b960015cb073dd974c82f6bb5804024d9e94d9aa..30303632fbb738a5b90607a5c0e1fe829a04e4cc
@@@ -86,7 -86,6 +86,7 @@@ static const struct tctl_offset tctl_of
        { 0x17, "AMD Ryzen 7 1800X", 20000 },
        { 0x17, "AMD Ryzen Threadripper 1950X", 27000 },
        { 0x17, "AMD Ryzen Threadripper 1920X", 27000 },
 +      { 0x17, "AMD Ryzen Threadripper 1900X", 27000 },
        { 0x17, "AMD Ryzen Threadripper 1950", 10000 },
        { 0x17, "AMD Ryzen Threadripper 1920", 10000 },
        { 0x17, "AMD Ryzen Threadripper 1910", 10000 },
@@@ -227,7 -226,7 +227,7 @@@ static bool has_erratum_319(struct pci_
         * and AM3 formats, but that's the best we can do.
         */
        return boot_cpu_data.x86_model < 4 ||
-              (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask <= 2);
+              (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_stepping <= 2);
  }
  
  static int k10temp_probe(struct pci_dev *pdev,
diff --combined tools/objtool/check.c
index b00b1896547e41d12013eeeda60ecc91ee6231ea,c7fb5c2392ee6f39c39a3abdc3105d0efa1e3803..a8cb69a2657658ec41c5877f1b4a47526c8079b0
@@@ -138,7 -138,6 +138,7 @@@ static int __dead_end_function(struct o
                "__reiserfs_panic",
                "lbug_with_loc",
                "fortify_panic",
 +              "usercopy_abort",
        };
  
        if (func->bind == STB_WEAK)
@@@ -852,8 -851,14 +852,14 @@@ static int add_switch_table(struct objt
   *    This is a fairly uncommon pattern which is new for GCC 6.  As of this
   *    writing, there are 11 occurrences of it in the allmodconfig kernel.
   *
+  *    As of GCC 7 there are quite a few more of these and the 'in between' code
+  *    is significant. Esp. with KASAN enabled some of the code between the mov
+  *    and jmpq uses .rodata itself, which can confuse things.
+  *
   *    TODO: Once we have DWARF CFI and smarter instruction decoding logic,
   *    ensure the same register is used in the mov and jump instructions.
+  *
+  *    NOTE: RETPOLINE made it harder still to decode dynamic jumps.
   */
  static struct rela *find_switch_table(struct objtool_file *file,
                                      struct symbol *func,
                                                text_rela->addend + 4);
                if (!rodata_rela)
                        return NULL;
                file->ignore_unreachables = true;
                return rodata_rela;
        }
  
        /* case 3 */
-       func_for_each_insn_continue_reverse(file, func, insn) {
+       /*
+        * Backward search using the @first_jump_src links, these help avoid
+        * much of the 'in between' code. Which avoids us getting confused by
+        * it.
+        */
+       for (insn = list_prev_entry(insn, list);
+            &insn->list != &file->insn_list &&
+            insn->sec == func->sec &&
+            insn->offset >= func->offset;
+            insn = insn->first_jump_src ?: list_prev_entry(insn, list)) {
                if (insn->type == INSN_JUMP_DYNAMIC)
                        break;
  
        return NULL;
  }
  
  static int add_func_switch_tables(struct objtool_file *file,
                                  struct symbol *func)
  {
-       struct instruction *insn, *prev_jump = NULL;
+       struct instruction *insn, *last = NULL, *prev_jump = NULL;
        struct rela *rela, *prev_rela = NULL;
        int ret;
  
        func_for_each_insn(file, func, insn) {
+               if (!last)
+                       last = insn;
+               /*
+                * Store back-pointers for unconditional forward jumps such
+                * that find_switch_table() can back-track using those and
+                * avoid some potentially confusing code.
+                */
+               if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->jump_dest &&
+                   insn->offset > last->offset &&
+                   insn->jump_dest->offset > insn->offset &&
+                   !insn->jump_dest->first_jump_src) {
+                       insn->jump_dest->first_jump_src = insn;
+                       last = insn->jump_dest;
+               }
                if (insn->type != INSN_JUMP_DYNAMIC)
                        continue;
  
@@@ -1899,13 -1935,19 +1936,19 @@@ static bool ignore_unreachable_insn(str
                if (is_kasan_insn(insn) || is_ubsan_insn(insn))
                        return true;
  
-               if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->jump_dest) {
-                       insn = insn->jump_dest;
-                       continue;
+               if (insn->type == INSN_JUMP_UNCONDITIONAL) {
+                       if (insn->jump_dest &&
+                           insn->jump_dest->func == insn->func) {
+                               insn = insn->jump_dest;
+                               continue;
+                       }
+                       break;
                }
  
                if (insn->offset + insn->len >= insn->func->offset + insn->func->len)
                        break;
                insn = list_next_entry(insn, list);
        }
  
index 10ca46df144921ee3bdc60aa6974802dfffa77e8,aa6e2d7f6a1fdc36e397a4cf5d43bc65068b6c13..d744991c0f4f44d56bda208ad3039ad81500f303
@@@ -5,16 -5,26 +5,26 @@@ include ../lib.m
  
  .PHONY: all all_32 all_64 warn_32bit_failure clean
  
- TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall test_mremap_vdso \
-                       check_initial_reg_state sigreturn ldt_gdt iopl mpx-mini-test ioperm \
+ UNAME_M := $(shell uname -m)
+ CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
+ CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
+ TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \
+                       check_initial_reg_state sigreturn iopl mpx-mini-test ioperm \
                        protection_keys test_vdso test_vsyscall
  TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \
                        test_FCMOV test_FCOMI test_FISTTP \
                        vdso_restorer
- TARGETS_C_64BIT_ONLY := fsgsbase sysret_rip 5lvl
+ TARGETS_C_64BIT_ONLY := fsgsbase sysret_rip
+ # Some selftests require 32bit support enabled also on 64bit systems
+ TARGETS_C_32BIT_NEEDED := ldt_gdt ptrace_syscall
  
- TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY)
+ TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY) $(TARGETS_C_32BIT_NEEDED)
  TARGETS_C_64BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_64BIT_ONLY)
+ ifeq ($(CAN_BUILD_I386)$(CAN_BUILD_X86_64),11)
+ TARGETS_C_64BIT_ALL += $(TARGETS_C_32BIT_NEEDED)
+ endif
  BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
  BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
  
@@@ -23,30 -33,16 +33,28 @@@ BINARIES_64 := $(patsubst %,$(OUTPUT)/%
  
  CFLAGS := -O2 -g -std=gnu99 -pthread -Wall -no-pie
  
- UNAME_M := $(shell uname -m)
- CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
- CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
 +define gen-target-rule-32
 +$(1) $(1)_32: $(OUTPUT)/$(1)_32
 +.PHONY: $(1) $(1)_32
 +endef
 +
 +define gen-target-rule-64
 +$(1) $(1)_64: $(OUTPUT)/$(1)_64
 +.PHONY: $(1) $(1)_64
 +endef
 +
  ifeq ($(CAN_BUILD_I386),1)
  all: all_32
  TEST_PROGS += $(BINARIES_32)
+ EXTRA_CFLAGS += -DCAN_BUILD_32
 +$(foreach t,$(TARGETS_C_32BIT_ALL),$(eval $(call gen-target-rule-32,$(t))))
  endif
  
  ifeq ($(CAN_BUILD_X86_64),1)
  all: all_64
  TEST_PROGS += $(BINARIES_64)
+ EXTRA_CFLAGS += -DCAN_BUILD_64
 +$(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t))))
  endif
  
  all_32: $(BINARIES_32)