Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Oct 2018 00:49:53 +0000 (17:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Oct 2018 00:49:53 +0000 (17:49 -0700)
Pull drm updates from Dave Airlie:
 "This is going to rebuild more than drm as it adds a new helper to
  list.h for doing bulk updates. Seemed like a reasonable addition to
  me.

  Otherwise the usual merge window stuff lots of i915 and amdgpu, not so
  much nouveau, and piles of everything else.

  Core:
   - Adds a new list.h helper for doing bulk list updates for TTM.
   - Don't leak fb address in smem_start to userspace (comes with EXPORT
     workaround for people using mali out of tree hacks)
   - udmabuf device to turn memfd regions into dma-buf
   - Per-plane blend mode property
   - ref/unref replacements with get/put
   - fbdev conflicting framebuffers code cleaned up
   - host-endian format variants
   - panel orientation quirk for Acer One 10

  bridge:
   - TI SN65DSI86 chip support

  vkms:
   - GEM support.
   - Cursor support

  amdgpu:
   - Merge amdkfd and amdgpu into one module
   - CEC over DP AUX support
   - Picasso APU support + VCN dynamic powergating
   - Raven2 APU support
   - Vega20 enablement + kfd support
   - ACP powergating improvements
   - ABGR/XBGR display support
   - VCN jpeg support
   - xGMI support
   - DC i2c/aux cleanup
   - Ycbcr 4:2:0 support
   - GPUVM improvements
   - Powerplay and powerplay endian fixes
   - Display underflow fixes

  vmwgfx:
   - Move vmwgfx specific TTM code to vmwgfx
   - Split out vmwgfx buffer/resource validation code
   - Atomic operation rework

  bochs:
   - use more helpers
   - format/byteorder improvements

  qxl:
   - use more helpers

  i915:
   - GGTT coherency getparam
   - Turn off resource streamer API
   - More Icelake enablement + DMC firmware
   - Full PPGTT for Ivybridge, Haswell and Valleyview
   - DDB distribution based on resolution
   - Limited range DP display support

  nouveau:
   - CEC over DP AUX support
   - Initial HDMI 2.0 support

  virtio-gpu:
   - vmap support for PRIME objects

  tegra:
   - Initial Tegra194 support
   - DMA/IOMMU integration fixes

  msm:
   - a6xx perf improvements + clock prefix
   - GPU preemption optimisations
   - a6xx devfreq support
   - cursor support

  rockchip:
   - PX30 support
   - rgb output interface support

  mediatek:
   - HDMI output support on mt2701 and mt7623

  rcar-du:
   - Interlaced modes on Gen3
   - LVDS on R8A77980
   - D3 and E3 SoC support

  hisilicon:
   - misc fixes

  mxsfb:
   - runtime pm support

  sun4i:
   - R40 TCON support
   - Allwinner A64 support
   - R40 HDMI support

  omapdrm:
   - Driver rework changing display pipeline ordering to use common code
   - DMM memory barrier and irq fixes
   - Errata workarounds

  exynos:
   - out-bridge support for LVDS bridge driver
   - Samsung 16x16 tiled format support
   - Plane alpha and pixel blend mode support

  tilcdc:
   - suspend/resume update

  mali-dp:
   - misc updates"

* tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm: (1382 commits)
  firmware/dmc/icl: Add missing MODULE_FIRMWARE() for Icelake.
  drm/i915/icl: Fix signal_levels
  drm/i915/icl: Fix DDI/TC port clk_off bits
  drm/i915/icl: create function to identify combophy port
  drm/i915/gen9+: Fix initial readout for Y tiled framebuffers
  drm/i915: Large page offsets for pread/pwrite
  drm/i915/selftests: Disable shrinker across mmap-exhaustion
  drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode
  drm/i915: Fix intel_dp_mst_best_encoder()
  drm/i915: Skip vcpi allocation for MSTB ports that are gone
  drm/i915: Don't unset intel_connector->mst_port
  drm/i915: Only reset seqno if actually idle
  drm/i915: Use the correct crtc when sanitizing plane mapping
  drm/i915: Restore vblank interrupts earlier
  drm/i915: Check fb stride against plane max stride
  drm/amdgpu/vcn:Fix uninitialized symbol error
  drm: panel-orientation-quirks: Add quirk for Acer One 10 (S1003)
  drm/amd/amdgpu: Fix debugfs error handling
  drm/amdgpu: Update gc_9_0 golden settings.
  drm/amd/powerplay: update PPtable with DC BTC and Tvr SocLimit fields
  ...

15 files changed:
1  2 
Documentation/ioctl/ioctl-number.txt
MAINTAINERS
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_client.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_fb_cma_helper.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/drm_lease.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/mediatek/mtk_hdmi.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
include/drm/drm_atomic.h

@@@ -201,7 -201,7 +201,7 @@@ Code  Seq#(hex)    Include File            Comment
  'X'   01      linux/pktcdvd.h         conflict!
  'Y'   all     linux/cyclades.h
  'Z'   14-15   drivers/message/fusion/mptctl.h
 -'['   00-07   linux/usb/tmc.h         USB Test and Measurement Devices
 +'['   00-3F   linux/usb/tmc.h         USB Test and Measurement Devices
                                        <mailto:gregkh@linuxfoundation.org>
  'a'   all     linux/atm*.h, linux/sonet.h     ATM on linux
                                        <http://lrcwww.epfl.ch/>
  't'   90-91   linux/toshiba.h         toshiba and toshiba_acpi SMM
  'u'   00-1F   linux/smb_fs.h          gone
  'u'   20-3F   linux/uvcvideo.h        USB video class host driver
+ 'u'   40-4f   linux/udmabuf.h         userspace dma-buf misc device
  'v'   00-1F   linux/ext2_fs.h         conflict!
  'v'   00-1F   linux/fs.h              conflict!
  'v'   00-0F   linux/sonypi.h          conflict!
diff --combined MAINTAINERS
@@@ -324,6 -324,7 +324,6 @@@ F: Documentation/ABI/testing/sysfs-bus-
  F:    Documentation/ABI/testing/configfs-acpi
  F:    drivers/pci/*acpi*
  F:    drivers/pci/*/*acpi*
 -F:    drivers/pci/*/*/*acpi*
  F:    tools/power/acpi/
  
  ACPI APEI
@@@ -535,7 -536,7 +535,7 @@@ F: Documentation/hwmon/adt747
  F:    drivers/hwmon/adt7475.c
  
  ADVANSYS SCSI DRIVER
 -M:    Matthew Wilcox <matthew@wil.cx>
 +M:    Matthew Wilcox <willy@infradead.org>
  M:    Hannes Reinecke <hare@suse.com>
  L:    linux-scsi@vger.kernel.org
  S:    Maintained
@@@ -839,7 -840,7 +839,7 @@@ ANALOG DEVICES INC ADGS1408 DRIVE
  M:    Mircea Caprioru <mircea.caprioru@analog.com>
  S:    Supported
  F:    drivers/mux/adgs1408.c
 -F:    Documentation/devicetree/bindings/mux/adgs1408.txt
 +F:    Documentation/devicetree/bindings/mux/adi,adgs1408.txt
  
  ANALOG DEVICES INC ADP5061 DRIVER
  M:    Stefan Popa <stefan.popa@analog.com>
@@@ -932,7 -933,6 +932,7 @@@ M: Greg Kroah-Hartman <gregkh@linuxfoun
  M:    Arve Hjønnevåg <arve@android.com>
  M:    Todd Kjos <tkjos@android.com>
  M:    Martijn Coenen <maco@android.com>
 +M:    Joel Fernandes <joel@joelfernandes.org>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
  L:    devel@driverdev.osuosl.org
  S:    Supported
@@@ -1181,7 -1181,7 +1181,7 @@@ N:      ow
  F:    arch/arm/mach-actions/
  F:    arch/arm/boot/dts/owl-*
  F:    arch/arm64/boot/dts/actions/
 -F:    drivers/clocksource/owl-*
 +F:    drivers/clocksource/timer-owl*
  F:    drivers/pinctrl/actions/*
  F:    drivers/soc/actions/
  F:    include/dt-bindings/power/owl-*
@@@ -1251,7 -1251,7 +1251,7 @@@ N:      meso
  
  ARM/Annapurna Labs ALPINE ARCHITECTURE
  M:    Tsahee Zidenberg <tsahee@annapurnalabs.com>
 -M:    Antoine Tenart <antoine.tenart@free-electrons.com>
 +M:    Antoine Tenart <antoine.tenart@bootlin.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-alpine/
@@@ -1604,7 -1604,7 +1604,7 @@@ L:      linux-arm-kernel@lists.infradead.or
  S:    Maintained
  F:    arch/arm/boot/dts/lpc43*
  F:    drivers/clk/nxp/clk-lpc18xx*
 -F:    drivers/clocksource/time-lpc32xx.c
 +F:    drivers/clocksource/timer-lpc32xx.c
  F:    drivers/i2c/busses/i2c-lpc2k.c
  F:    drivers/memory/pl172.c
  F:    drivers/mtd/spi-nor/nxp-spifi.c
@@@ -2196,7 -2196,6 +2196,7 @@@ F:      drivers/clk/uniphier
  F:    drivers/gpio/gpio-uniphier.c
  F:    drivers/i2c/busses/i2c-uniphier*
  F:    drivers/irqchip/irq-uniphier-aidet.c
 +F:    drivers/mmc/host/uniphier-sd.c
  F:    drivers/pinctrl/uniphier/
  F:    drivers/reset/reset-uniphier.c
  F:    drivers/tty/serial/8250/8250_uniphier.c
@@@ -2221,7 -2220,7 +2221,7 @@@ F:      arch/arm/mach-vexpress
  F:    */*/vexpress*
  F:    */*/*/vexpress*
  F:    drivers/clk/versatile/clk-vexpress-osc.c
 -F:    drivers/clocksource/versatile.c
 +F:    drivers/clocksource/timer-versatile.c
  N:    mps2
  
  ARM/VFP SUPPORT
@@@ -2243,7 -2242,7 +2243,7 @@@ M:      Tony Prisk <linux@prisktech.co.nz
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-vt8500/
 -F:    drivers/clocksource/vt8500_timer.c
 +F:    drivers/clocksource/timer-vt8500.c
  F:    drivers/i2c/busses/i2c-wmt.c
  F:    drivers/mmc/host/wmt-sdmmc.c
  F:    drivers/pwm/pwm-vt8500.c
@@@ -2308,7 -2307,7 +2308,7 @@@ F:      drivers/cpuidle/cpuidle-zynq.
  F:    drivers/block/xsysace.c
  N:    zynq
  N:    xilinx
 -F:    drivers/clocksource/cadence_ttc_timer.c
 +F:    drivers/clocksource/timer-cadence-ttc.c
  F:    drivers/i2c/busses/i2c-cadence.c
  F:    drivers/mmc/host/sdhci-of-arasan.c
  F:    drivers/edac/synopsys_edac.c
@@@ -2957,6 -2956,7 +2957,6 @@@ F:      include/linux/bcm963xx_tag.
  
  BROADCOM BNX2 GIGABIT ETHERNET DRIVER
  M:    Rasesh Mody <rasesh.mody@cavium.com>
 -M:    Harish Patil <harish.patil@cavium.com>
  M:    Dept-GELinuxNICDev@cavium.com
  L:    netdev@vger.kernel.org
  S:    Supported
@@@ -2977,7 -2977,6 +2977,7 @@@ F:      drivers/scsi/bnx2i
  
  BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
  M:    Ariel Elior <ariel.elior@cavium.com>
 +M:    Sudarsana Kalluru <sudarsana.kalluru@cavium.com>
  M:    everest-linux-l2@cavium.com
  L:    netdev@vger.kernel.org
  S:    Supported
@@@ -3008,14 -3007,6 +3008,14 @@@ S:    Supporte
  F:    drivers/gpio/gpio-brcmstb.c
  F:    Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt
  
 +BROADCOM BRCMSTB I2C DRIVER
 +M:    Kamal Dasu <kdasu.kdev@gmail.com>
 +L:    linux-i2c@vger.kernel.org
 +L:    bcm-kernel-feedback-list@broadcom.com
 +S:    Supported
 +F:    drivers/i2c/busses/i2c-brcmstb.c
 +F:    Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt
 +
  BROADCOM BRCMSTB USB2 and USB3 PHY DRIVER
  M:    Al Cooper <alcooperx@gmail.com>
  L:    linux-kernel@vger.kernel.org
@@@ -3123,15 -3114,6 +3123,15 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.txt
  F:    drivers/memory/brcmstb_dpfe.c
  
 +BROADCOM SPI DRIVER
 +M:    Kamal Dasu <kdasu.kdev@gmail.com>
 +M:    bcm-kernel-feedback-list@broadcom.com
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.txt
 +F:    drivers/spi/spi-bcm-qspi.*
 +F:    drivers/spi/spi-brcmstb-qspi.c
 +F:    drivers/spi/spi-iproc-qspi.c
 +
  BROADCOM SYSTEMPORT ETHERNET DRIVER
  M:    Florian Fainelli <f.fainelli@gmail.com>
  L:    netdev@vger.kernel.org
@@@ -3692,12 -3674,6 +3692,12 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/media/coda.txt
  F:    drivers/media/platform/coda/
  
 +CODE OF CONDUCT
 +M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 +S:    Supported
 +F:    Documentation/process/code-of-conduct.rst
 +F:    Documentation/process/code-of-conduct-interpretation.rst
 +
  COMMON CLK FRAMEWORK
  M:    Michael Turquette <mturquette@baylibre.com>
  M:    Stephen Boyd <sboyd@kernel.org>
@@@ -4056,7 -4032,7 +4056,7 @@@ M:      Uma Krishnan <ukrishn@linux.vnet.ibm
  L:    linux-scsi@vger.kernel.org
  S:    Supported
  F:    drivers/scsi/cxlflash/
 -F:    include/uapi/scsi/cxlflash_ioctls.h
 +F:    include/uapi/scsi/cxlflash_ioctl.h
  F:    Documentation/powerpc/cxlflash.txt
  
  CYBERPRO FB DRIVER
@@@ -4099,7 -4075,7 +4099,7 @@@ D-LINK DIR-685 TOUCHKEYS DRIVE
  M:    Linus Walleij <linus.walleij@linaro.org>
  L:    linux-input@vger.kernel.org
  S:    Supported
 -F:    drivers/input/dlink-dir685-touchkeys.c
 +F:    drivers/input/keyboard/dlink-dir685-touchkeys.c
  
  DALLAS/MAXIM DS1685-FAMILY REAL TIME CLOCK
  M:    Joshua Kinard <kumba@gentoo.org>
@@@ -4195,11 -4171,6 +4195,11 @@@ S:    Maintaine
  F:    drivers/platform/x86/dell-smbios-wmi.c
  F:    tools/wmi/dell-smbios-example.c
  
 +DEFZA FDDI NETWORK DRIVER
 +M:    "Maciej W. Rozycki" <macro@linux-mips.org>
 +S:    Maintained
 +F:    drivers/net/fddi/defza.*
 +
  DELL LAPTOP DRIVER
  M:    Matthew Garrett <mjg59@srcf.ucam.org>
  M:    Pali Rohár <pali.rohar@gmail.com>
@@@ -4393,7 -4364,7 +4393,7 @@@ S:      Maintaine
  F:    drivers/i2c/busses/i2c-diolan-u2c.c
  
  FILESYSTEM DIRECT ACCESS (DAX)
 -M:    Matthew Wilcox <mawilcox@microsoft.com>
 +M:    Matthew Wilcox <willy@infradead.org>
  M:    Ross Zwisler <zwisler@kernel.org>
  M:    Jan Kara <jack@suse.cz>
  L:    linux-fsdevel@vger.kernel.org
@@@ -4515,12 -4486,11 +4515,12 @@@ S:   Maintaine
  F:    Documentation/
  F:    scripts/kernel-doc
  X:    Documentation/ABI/
 +X:    Documentation/acpi/
  X:    Documentation/devicetree/
 -X:    Documentation/acpi
 -X:    Documentation/power
 -X:    Documentation/spi
 -X:    Documentation/media
 +X:    Documentation/i2c/
 +X:    Documentation/media/
 +X:    Documentation/power/
 +X:    Documentation/spi/
  T:    git git://git.lwn.net/linux.git docs-next
  
  DOCUMENTATION/ITALIAN
@@@ -4558,13 -4528,9 +4558,13 @@@ F:    drivers/soc/fsl/dpi
  
  DPAA2 ETHERNET DRIVER
  M:    Ioana Radulescu <ruxandra.radulescu@nxp.com>
 -L:    linux-kernel@vger.kernel.org
 +L:    netdev@vger.kernel.org
  S:    Maintained
 -F:    drivers/staging/fsl-dpaa2/ethernet
 +F:    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth*
 +F:    drivers/net/ethernet/freescale/dpaa2/dpni*
 +F:    drivers/net/ethernet/freescale/dpaa2/dpkg.h
 +F:    drivers/net/ethernet/freescale/dpaa2/Makefile
 +F:    drivers/net/ethernet/freescale/dpaa2/Kconfig
  
  DPAA2 ETHERNET SWITCH DRIVER
  M:    Ioana Radulescu <ruxandra.radulescu@nxp.com>
@@@ -4575,10 -4541,9 +4575,10 @@@ F:    drivers/staging/fsl-dpaa2/eths
  
  DPAA2 PTP CLOCK DRIVER
  M:    Yangbo Lu <yangbo.lu@nxp.com>
 -L:    linux-kernel@vger.kernel.org
 +L:    netdev@vger.kernel.org
  S:    Maintained
 -F:    drivers/staging/fsl-dpaa2/rtc
 +F:    drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp*
 +F:    drivers/net/ethernet/freescale/dpaa2/dprtc*
  
  DPT_I2O SCSI RAID DRIVER
  M:    Adaptec OEM Raid Solutions <aacraid@microsemi.com>
@@@ -4756,8 -4721,11 +4756,11 @@@ F:    drivers/gpu/drm/tdfx
  
  DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS
  M:    Dave Airlie <airlied@redhat.com>
+ R:    Sean Paul <sean@poorly.run>
+ L:    dri-devel@lists.freedesktop.org
  S:    Odd Fixes
  F:    drivers/gpu/drm/udl/
+ T:    git git://anongit.freedesktop.org/drm/drm-misc
  
  DRM DRIVER FOR VMWARE VIRTUAL GPU
  M:    "VMware Graphics" <linux-graphics-maintainer@vmware.com>
@@@ -4787,8 -4755,8 +4790,8 @@@ F:      include/uapi/drm
  F:    include/linux/vga*
  
  DRM DRIVERS AND MISC GPU PATCHES
- M:    Gustavo Padovan <gustavo@padovan.org>
  M:    Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+ M:    Maxime Ripard <maxime.ripard@bootlin.com>
  M:    Sean Paul <sean@poorly.run>
  W:    https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
  S:    Maintained
@@@ -4857,6 -4825,7 +4860,7 @@@ F:      drivers/gpu/drm/fsl-dcu
  F:    Documentation/devicetree/bindings/display/fsl,dcu.txt
  F:    Documentation/devicetree/bindings/display/fsl,tcon.txt
  F:    Documentation/devicetree/bindings/display/panel/nec,nl4827hc19-05b.txt
+ T:    git git://anongit.freedesktop.org/drm/drm-misc
  
  DRM DRIVERS FOR FREESCALE IMX
  M:    Philipp Zabel <p.zabel@pengutronix.de>
@@@ -4906,9 -4875,10 +4910,10 @@@ F:    Documentation/devicetree/bindings/di
  
  DRM DRIVERS FOR RENESAS
  M:    Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ M:    Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
  L:    dri-devel@lists.freedesktop.org
  L:    linux-renesas-soc@vger.kernel.org
- T:    git git://linuxtv.org/pinchartl/fbdev
+ T:    git git://linuxtv.org/pinchartl/media drm/du/next
  S:    Supported
  F:    drivers/gpu/drm/rcar-du/
  F:    drivers/gpu/drm/shmobile/
@@@ -5365,8 -5335,7 +5370,8 @@@ S:      Maintaine
  F:    drivers/edac/r82600_edac.c
  
  EDAC-SBRIDGE
 -M:    Mauro Carvalho Chehab <mchehab@kernel.org>
 +M:    Tony Luck <tony.luck@intel.com>
 +R:    Qiuxu Zhuo <qiuxu.zhuo@intel.com>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
  F:    drivers/edac/sb_edac.c
@@@ -5506,8 -5475,7 +5511,8 @@@ S:      Odd Fixe
  F:    drivers/net/ethernet/agere/
  
  ETHERNET BRIDGE
 -M:    Stephen Hemminger <stephen@networkplumber.org>
 +M:    Roopa Prabhu <roopa@cumulusnetworks.com>
 +M:    Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
  L:    bridge@lists.linux-foundation.org (moderated for non-subscribers)
  L:    netdev@vger.kernel.org
  W:    http://www.linuxfoundation.org/en/Net:Bridge
@@@ -5551,7 -5519,7 +5556,7 @@@ W:      http://ext4.wiki.kernel.or
  Q:    http://patchwork.ozlabs.org/project/linux-ext4/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
  S:    Maintained
 -F:    Documentation/filesystems/ext4.txt
 +F:    Documentation/filesystems/ext4/ext4.rst
  F:    fs/ext4/
  
  Extended Verification Module (EVM)
@@@ -6491,7 -6459,6 +6496,7 @@@ F:      Documentation/devicetree/bindings/hw
  F:    Documentation/hwmon/
  F:    drivers/hwmon/
  F:    include/linux/hwmon*.h
 +F:    include/trace/events/hwmon*.h
  
  HARDWARE RANDOM NUMBER GENERATOR CORE
  M:    Matt Mackall <mpm@selenic.com>
@@@ -6800,12 -6767,6 +6805,12 @@@ S:    Maintaine
  F:    mm/memory-failure.c
  F:    mm/hwpoison-inject.c
  
 +HYGON PROCESSOR SUPPORT
 +M:    Pu Wen <puwen@hygon.cn>
 +L:    linux-kernel@vger.kernel.org
 +S:    Maintained
 +F:    arch/x86/kernel/cpu/hygon.c
 +
  Hyper-V CORE AND DRIVERS
  M:    "K. Y. Srinivasan" <kys@microsoft.com>
  M:    Haiyang Zhang <haiyangz@microsoft.com>
@@@ -7385,16 -7346,15 +7390,16 @@@ T:   git git://git.kernel.org/pub/scm/lin
  S:    Supported
  F:    Documentation/networking/e100.rst
  F:    Documentation/networking/e1000.rst
 -F:    Documentation/networking/e1000e.txt
 -F:    Documentation/networking/igb.txt
 -F:    Documentation/networking/igbvf.txt
 -F:    Documentation/networking/ixgb.txt
 -F:    Documentation/networking/ixgbe.txt
 -F:    Documentation/networking/ixgbevf.txt
 -F:    Documentation/networking/i40e.txt
 -F:    Documentation/networking/i40evf.txt
 -F:    Documentation/networking/ice.txt
 +F:    Documentation/networking/e1000e.rst
 +F:    Documentation/networking/fm10k.rst
 +F:    Documentation/networking/igb.rst
 +F:    Documentation/networking/igbvf.rst
 +F:    Documentation/networking/ixgb.rst
 +F:    Documentation/networking/ixgbe.rst
 +F:    Documentation/networking/ixgbevf.rst
 +F:    Documentation/networking/i40e.rst
 +F:    Documentation/networking/iavf.rst
 +F:    Documentation/networking/ice.rst
  F:    drivers/net/ethernet/intel/
  F:    drivers/net/ethernet/intel/*/
  F:    include/linux/avf/virtchnl.h
@@@ -7416,12 -7376,6 +7421,12 @@@ T:    git https://github.com/intel/gvt-lin
  S:    Supported
  F:    drivers/gpu/drm/i915/gvt/
  
 +INTEL PMIC GPIO DRIVER
 +R:    Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 +S:    Maintained
 +F:    drivers/gpio/gpio-*cove.c
 +F:    drivers/gpio/gpio-msic.c
 +
  INTEL HID EVENT DRIVER
  M:    Alex Hung <alex.hung@canonical.com>
  L:    platform-driver-x86@vger.kernel.org
@@@ -7548,14 -7502,6 +7553,14 @@@ F:    drivers/platform/x86/intel_punit_ipc
  F:    arch/x86/include/asm/intel_pmc_ipc.h
  F:    arch/x86/include/asm/intel_punit_ipc.h
  
 +INTEL MULTIFUNCTION PMIC DEVICE DRIVERS
 +R:    Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 +S:    Maintained
 +F:    drivers/mfd/intel_msic.c
 +F:    drivers/mfd/intel_soc_pmic*
 +F:    include/linux/mfd/intel_msic.h
 +F:    include/linux/mfd/intel_soc_pmic*
 +
  INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
  M:    Stanislav Yakovlev <stas.yakovlev@gmail.com>
  L:    linux-wireless@vger.kernel.org
@@@ -7579,6 -7525,14 +7584,6 @@@ S:     Supporte
  F:    drivers/infiniband/hw/i40iw/
  F:    include/uapi/rdma/i40iw-abi.h
  
 -INTEL SHA MULTIBUFFER DRIVER
 -M:    Megha Dey <megha.dey@linux.intel.com>
 -R:    Tim Chen <tim.c.chen@linux.intel.com>
 -L:    linux-crypto@vger.kernel.org
 -S:    Supported
 -F:    arch/x86/crypto/sha*-mb/
 -F:    crypto/mcryptd.c
 -
  INTEL TELEMETRY DRIVER
  M:    Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
  L:    platform-driver-x86@vger.kernel.org
@@@ -7686,7 -7640,6 +7691,7 @@@ M:      Corey Minyard <minyard@acm.org
  L:    openipmi-developer@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://openipmi.sourceforge.net/
  S:    Supported
 +F:    Documentation/devicetree/bindings/ipmi/
  F:    Documentation/IPMI.txt
  F:    drivers/char/ipmi/
  F:    include/linux/ipmi*
@@@ -8158,7 -8111,6 +8163,7 @@@ F:      security/keys/encrypted-keys
  
  KEYS-TRUSTED
  M:    James Bottomley <jejb@linux.vnet.ibm.com>
 +M:      Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
  M:    Mimi Zohar <zohar@linux.vnet.ibm.com>
  L:    linux-integrity@vger.kernel.org
  L:    keyrings@vger.kernel.org
@@@ -8236,25 -8188,6 +8241,25 @@@ S:    Maintaine
  F:    net/l3mdev
  F:    include/net/l3mdev.h
  
 +L7 BPF FRAMEWORK
 +M:    John Fastabend <john.fastabend@gmail.com>
 +M:    Daniel Borkmann <daniel@iogearbox.net>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    include/linux/skmsg.h
 +F:    net/core/skmsg.c
 +F:    net/core/sock_map.c
 +F:    net/ipv4/tcp_bpf.c
 +
 +LANTIQ / INTEL Ethernet drivers
 +M:    Hauke Mehrtens <hauke@hauke-m.de>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    net/dsa/tag_gswip.c
 +F:    drivers/net/ethernet/lantiq_xrx200.c
 +F:    drivers/net/dsa/lantiq_pce.h
 +F:    drivers/net/dsa/lantiq_gswip.c
 +
  LANTIQ MIPS ARCHITECTURE
  M:    John Crispin <john@phrozen.org>
  L:    linux-mips@linux-mips.org
@@@ -8670,6 -8603,7 +8675,6 @@@ F:      include/linux/spinlock*.
  F:    arch/*/include/asm/spinlock*.h
  F:    include/linux/rwlock*.h
  F:    include/linux/mutex*.h
 -F:    arch/*/include/asm/mutex*.h
  F:    include/linux/rwsem*.h
  F:    arch/*/include/asm/rwsem.h
  F:    include/linux/seqlock.h
@@@ -8697,7 -8631,7 +8702,7 @@@ F:      drivers/message/fusion
  F:    drivers/scsi/mpt3sas/
  
  LSILOGIC/SYMBIOS/NCR 53C8XX and 53C1010 PCI-SCSI drivers
 -M:    Matthew Wilcox <matthew@wil.cx>
 +M:    Matthew Wilcox <willy@infradead.org>
  L:    linux-scsi@vger.kernel.org
  S:    Maintained
  F:    drivers/scsi/sym53c8xx_2/
@@@ -8815,7 -8749,7 +8820,7 @@@ M:      Vivien Didelot <vivien.didelot@savoi
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/dsa/mv88e6xxx/
 -F:    linux/platform_data/mv88e6xxx.h
 +F:    include/linux/platform_data/mv88e6xxx.h
  F:    Documentation/devicetree/bindings/net/dsa/marvell.txt
  
  MARVELL ARMADA DRM SUPPORT
@@@ -8905,15 -8839,6 +8910,15 @@@ S:    Supporte
  F:    drivers/mmc/host/sdhci-xenon*
  F:    Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt
  
 +MARVELL OCTEONTX2 RVU ADMIN FUNCTION DRIVER
 +M:    Sunil Goutham <sgoutham@marvell.com>
 +M:    Linu Cherian <lcherian@marvell.com>
 +M:    Geetha sowjanya <gakula@marvell.com>
 +M:    Jerin Jacob <jerinj@marvell.com>
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +F:    drivers/net/ethernet/marvell/octeontx2/af/
 +
  MATROX FRAMEBUFFER DRIVER
  L:    linux-fbdev@vger.kernel.org
  S:    Orphan
@@@ -8927,6 -8852,13 +8932,6 @@@ S:     Maintaine
  F:    Documentation/hwmon/max16065
  F:    drivers/hwmon/max16065.c
  
 -MAX20751 HARDWARE MONITOR DRIVER
 -M:    Guenter Roeck <linux@roeck-us.net>
 -L:    linux-hwmon@vger.kernel.org
 -S:    Maintained
 -F:    Documentation/hwmon/max20751
 -F:    drivers/hwmon/max20751.c
 -
  MAX2175 SDR TUNER DRIVER
  M:    Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
  L:    linux-media@vger.kernel.org
@@@ -9568,7 -9500,7 +9573,7 @@@ MEN Z069 WATCHDOG DRIVE
  M:    Johannes Thumshirn <jth@kernel.org>
  L:    linux-watchdog@vger.kernel.org
  S:    Maintained
 -F:    drivers/watchdog/menz069_wdt.c
 +F:    drivers/watchdog/menz69_wdt.c
  
  MESON AO CEC DRIVER FOR AMLOGIC SOCS
  M:    Neil Armstrong <narmstrong@baylibre.com>
@@@ -9592,7 -9524,6 +9597,7 @@@ M:      Richard Genoud <richard.genoud@gmail
  S:    Maintained
  F:    drivers/tty/serial/atmel_serial.c
  F:    drivers/tty/serial/atmel_serial.h
 +F:    Documentation/devicetree/bindings/mfd/atmel-usart.txt
  
  MICROCHIP / ATMEL DMA DRIVER
  M:    Ludovic Desroches <ludovic.desroches@microchip.com>
@@@ -9624,21 -9555,6 +9629,21 @@@ S:    Supporte
  F:    drivers/mtd/nand/raw/atmel/*
  F:    Documentation/devicetree/bindings/mtd/atmel-nand.txt
  
 +MICROCHIP AT91 USART MFD DRIVER
 +M:    Radu Pirea <radu_nicolae.pirea@upb.ro>
 +L:    linux-kernel@vger.kernel.org
 +S:    Supported
 +F:    drivers/mfd/at91-usart.c
 +F:    include/dt-bindings/mfd/at91-usart.h
 +F:    Documentation/devicetree/bindings/mfd/atmel-usart.txt
 +
 +MICROCHIP AT91 USART SPI DRIVER
 +M:    Radu Pirea <radu_nicolae.pirea@upb.ro>
 +L:    linux-spi@vger.kernel.org
 +S:    Supported
 +F:    drivers/spi/spi-at91-usart.c
 +F:    Documentation/devicetree/bindings/mfd/atmel-usart.txt
 +
  MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
  M:    Woojung Huh <Woojung.Huh@microchip.com>
  M:    Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
@@@ -9747,8 -9663,7 +9752,8 @@@ MIPS/LOONGSON2 ARCHITECTUR
  M:    Jiaxun Yang <jiaxun.yang@flygoat.com>
  L:    linux-mips@linux-mips.org
  S:    Maintained
 -F:    arch/mips/loongson64/*{2e/2f}*
 +F:    arch/mips/loongson64/fuloong-2e/
 +F:    arch/mips/loongson64/lemote-2f/
  F:    arch/mips/include/asm/mach-loongson64/
  F:    drivers/*/*loongson2*
  F:    drivers/*/*/*loongson2*
@@@ -9788,19 -9703,6 +9793,19 @@@ S:    Maintaine
  F:    arch/arm/boot/dts/mmp*
  F:    arch/arm/mach-mmp/
  
 +MMU GATHER AND TLB INVALIDATION
 +M:    Will Deacon <will.deacon@arm.com>
 +M:    "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
 +M:    Andrew Morton <akpm@linux-foundation.org>
 +M:    Nick Piggin <npiggin@gmail.com>
 +M:    Peter Zijlstra <peterz@infradead.org>
 +L:    linux-arch@vger.kernel.org
 +L:    linux-mm@kvack.org
 +S:    Maintained
 +F:    arch/*/include/asm/tlb.h
 +F:    include/asm-generic/tlb.h
 +F:    mm/mmu_gather.c
 +
  MN88472 MEDIA DRIVER
  M:    Antti Palosaari <crope@iki.fi>
  L:    linux-media@vger.kernel.org
@@@ -9968,7 -9870,7 +9973,7 @@@ M:      Peter Rosin <peda@axentia.se
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-class-mux*
  F:    Documentation/devicetree/bindings/mux/
 -F:    include/linux/dt-bindings/mux/
 +F:    include/dt-bindings/mux/
  F:    include/linux/mux/
  F:    drivers/mux/
  
@@@ -10001,17 -9903,13 +10006,20 @@@ F: drivers/media/tuners/mxl5007t.
  
  MXSFB DRM DRIVER
  M:    Marek Vasut <marex@denx.de>
+ M:    Stefan Agner <stefan@agner.ch>
+ L:    dri-devel@lists.freedesktop.org
  S:    Supported
  F:    drivers/gpu/drm/mxsfb/
  F:    Documentation/devicetree/bindings/display/mxsfb.txt
+ T:    git git://anongit.freedesktop.org/drm/drm-misc
  
 +MYLEX DAC960 PCI RAID Controller
 +M:    Hannes Reinecke <hare@kernel.org>
 +L:    linux-scsi@vger.kernel.org
 +S:    Supported
 +F:    drivers/scsi/myrb.*
 +F:    drivers/scsi/myrs.*
 +
  MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
  M:    Chris Lee <christopher.lee@cspi.com>
  L:    netdev@vger.kernel.org
@@@ -10232,6 -10130,7 +10240,6 @@@ L:   netdev@vger.kernel.or
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
  S:    Maintained
 -F:    net/core/flow.c
  F:    net/xfrm/
  F:    net/key/
  F:    net/ipv4/xfrm*
@@@ -10294,8 -10193,6 +10302,8 @@@ NETWORKING [TLS
  M:    Boris Pismenny <borisp@mellanox.com>
  M:    Aviad Yehezkel <aviadye@mellanox.com>
  M:    Dave Watson <davejwatson@fb.com>
 +M:    John Fastabend <john.fastabend@gmail.com>
 +M:    Daniel Borkmann <daniel@iogearbox.net>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    net/tls/*
@@@ -11300,7 -11197,7 +11308,7 @@@ M:   Murali Karicheri <m-karicheri2@ti.co
  L:    linux-pci@vger.kernel.org
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    drivers/pci/controller/dwc/*keystone*
 +F:    drivers/pci/controller/dwc/pci-keystone.c
  
  PCI ENDPOINT SUBSYSTEM
  M:    Kishon Vijay Abraham I <kishon@ti.com>
@@@ -11600,12 -11497,15 +11608,12 @@@ S:        Maintaine
  F:    drivers/pinctrl/intel/
  
  PIN CONTROLLER - MEDIATEK
 -M:    Sean Wang <sean.wang@mediatek.com>
 +M:    Sean Wang <sean.wang@kernel.org>
  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/mtk-eint.*
 -F:    drivers/pinctrl/mediatek/pinctrl-mtk-common.*
 -F:    drivers/pinctrl/mediatek/pinctrl-mt2701.c
 -F:    drivers/pinctrl/mediatek/pinctrl-mt7622.c
 +F:    drivers/pinctrl/mediatek/
  
  PIN CONTROLLER - QUALCOMM
  M:    Bjorn Andersson <bjorn.andersson@linaro.org>
@@@ -11683,26 -11583,7 +11691,26 @@@ W: http://hwmon.wiki.kernel.org
  W:    http://www.roeck-us.net/linux/drivers/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt
 +F:    Documentation/devicetree/bindings/hwmon/max31785.txt
 +F:    Documentation/devicetree/bindings/hwmon/ltc2978.txt
 +F:    Documentation/hwmon/adm1275
 +F:    Documentation/hwmon/ibm-cffps
 +F:    Documentation/hwmon/ir35221
 +F:    Documentation/hwmon/lm25066
 +F:    Documentation/hwmon/ltc2978
 +F:    Documentation/hwmon/ltc3815
 +F:    Documentation/hwmon/max16064
 +F:    Documentation/hwmon/max20751
 +F:    Documentation/hwmon/max31785
 +F:    Documentation/hwmon/max34440
 +F:    Documentation/hwmon/max8688
  F:    Documentation/hwmon/pmbus
 +F:    Documentation/hwmon/pmbus-core
 +F:    Documentation/hwmon/tps40422
 +F:    Documentation/hwmon/ucd9000
 +F:    Documentation/hwmon/ucd9200
 +F:    Documentation/hwmon/zl6100
  F:    drivers/hwmon/pmbus/
  F:    include/linux/pmbus.h
  
@@@ -12106,7 -11987,7 +12114,7 @@@ F:   Documentation/scsi/LICENSE.qla4xx
  F:    drivers/scsi/qla4xxx/
  
  QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER
 -M:    Harish Patil <harish.patil@cavium.com>
 +M:    Shahed Shaikh <Shahed.Shaikh@cavium.com>
  M:    Manish Chopra <manish.chopra@cavium.com>
  M:    Dept-GELinuxNICDev@cavium.com
  L:    netdev@vger.kernel.org
@@@ -12114,6 -11995,7 +12122,6 @@@ S:   Supporte
  F:    drivers/net/ethernet/qlogic/qlcnic/
  
  QLOGIC QLGE 10Gb ETHERNET DRIVER
 -M:    Harish Patil <harish.patil@cavium.com>
  M:    Manish Chopra <manish.chopra@cavium.com>
  M:    Dept-GELinuxNICDev@cavium.com
  L:    netdev@vger.kernel.org
@@@ -12801,18 -12683,6 +12809,18 @@@ W: http://www.ibm.com/developerworks/li
  S:    Supported
  F:    drivers/s390/crypto/
  
 +S390 VFIO AP DRIVER
 +M:    Tony Krowiak <akrowiak@linux.ibm.com>
 +M:    Pierre Morel <pmorel@linux.ibm.com>
 +M:    Halil Pasic <pasic@linux.ibm.com>
 +L:    linux-s390@vger.kernel.org
 +W:    http://www.ibm.com/developerworks/linux/linux390/
 +S:    Supported
 +F:    drivers/s390/crypto/vfio_ap_drv.c
 +F:    drivers/s390/crypto/vfio_ap_private.h
 +F:    drivers/s390/crypto/vfio_ap_ops.c
 +F:    Documentation/s390/vfio-ap.txt
 +
  S390 ZFCP DRIVER
  M:    Steffen Maier <maier@linux.ibm.com>
  M:    Benjamin Block <bblock@linux.ibm.com>
@@@ -13201,7 -13071,7 +13209,7 @@@ SELINUX SECURITY MODUL
  M:    Paul Moore <paul@paul-moore.com>
  M:    Stephen Smalley <sds@tycho.nsa.gov>
  M:    Eric Paris <eparis@parisplace.org>
 -L:    selinux@tycho.nsa.gov (moderated for non-subscribers)
 +L:    selinux@vger.kernel.org
  W:    https://selinuxproject.org
  W:    https://github.com/SELinuxProject
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git
@@@ -13445,7 -13315,6 +13453,7 @@@ M:   Uwe Kleine-König <u.kleine-koenig@p
  R:    Pengutronix Kernel Team <kernel@pengutronix.de>
  S:    Supported
  F:    drivers/siox/*
 +F:    drivers/gpio/gpio-siox.c
  F:    include/trace/events/siox.h
  
  SIS 190 ETHERNET DRIVER
@@@ -13629,8 -13498,8 +13637,8 @@@ L:   linux-arm-kernel@lists.infradead.or
  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
 +F:    include/linux/arm_sdei.h
 +F:    include/uapi/linux/arm_sdei.h
  
  SOFTWARE RAID (Multiple Disks) SUPPORT
  M:    Shaohua Li <shli@kernel.org>
@@@ -13758,7 -13627,7 +13766,7 @@@ F:   sound/soc
  F:    include/sound/soc*
  
  SOUNDWIRE SUBSYSTEM
 -M:    Vinod Koul <vinod.koul@intel.com>
 +M:    Vinod Koul <vkoul@kernel.org>
  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)
@@@ -14173,12 -14042,6 +14181,12 @@@ S: Supporte
  F:    drivers/reset/reset-axs10x.c
  F:    Documentation/devicetree/bindings/reset/snps,axs10x-reset.txt
  
 +SYNOPSYS CREG GPIO DRIVER
 +M:    Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
 +S:    Maintained
 +F:    drivers/gpio/gpio-creg-snps.c
 +F:    Documentation/devicetree/bindings/gpio/snps,creg-gpio.txt
 +
  SYNOPSYS DESIGNWARE 8250 UART DRIVER
  R:    Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  S:    Maintained
@@@ -14765,13 -14628,6 +14773,13 @@@ L: netdev@vger.kernel.or
  S:    Maintained
  F:    drivers/net/ethernet/ti/netcp*
  
 +TI PCM3060 ASoC CODEC DRIVER
 +M:    Kirill Marinushkin <kmarinushkin@birdec.tech>
 +L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/sound/pcm3060.txt
 +F:    sound/soc/codecs/pcm3060*
 +
  TI TAS571X FAMILY ASoC CODEC DRIVER
  M:    Kevin Cernekee <cernekee@chromium.org>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
@@@ -15444,12 -15300,6 +15452,12 @@@ F: Documentation/driver-api/usb/typec_b
  F:    drivers/usb/typec/altmodes/
  F:    include/linux/usb/typec_altmode.h
  
 +USB TYPEC PORT CONTROLLER DRIVERS
 +M:    Guenter Roeck <linux@roeck-us.net>
 +L:    linux-usb@vger.kernel.org
 +S:    Maintained
 +F:    drivers/usb/typec/tcpm/
 +
  USB UHCI DRIVER
  M:    Alan Stern <stern@rowland.harvard.edu>
  L:    linux-usb@vger.kernel.org
@@@ -15524,19 -15374,21 +15532,27 @@@ F:        arch/x86/um
  F:    fs/hostfs/
  F:    fs/hppfs/
  
 +USERSPACE COPYIN/COPYOUT (UIOVEC)
 +M:    Alexander Viro <viro@zeniv.linux.org.uk>
 +S:    Maintained
 +F:    lib/iov_iter.c
 +F:    include/linux/uio.h
 +
+ USERSPACE DMA BUFFER DRIVER
+ M:    Gerd Hoffmann <kraxel@redhat.com>
+ S:    Maintained
+ L:    dri-devel@lists.freedesktop.org
+ F:    drivers/dma-buf/udmabuf.c
+ F:    include/uapi/linux/udmabuf.h
+ T:    git git://anongit.freedesktop.org/drm/drm-misc
  USERSPACE I/O (UIO)
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
  F:    Documentation/driver-api/uio-howto.rst
  F:    drivers/uio/
 -F:    include/linux/uio*.h
 +F:    include/linux/uio_driver.h
  
  UTIL-LINUX PACKAGE
  M:    Karel Zak <kzak@redhat.com>
@@@ -15559,7 -15411,7 +15575,7 @@@ S:   Maintaine
  UVESAFB DRIVER
  M:    Michal Januszewski <spock@gentoo.org>
  L:    linux-fbdev@vger.kernel.org
 -W:    http://dev.gentoo.org/~spock/projects/uvesafb/
 +W:    https://github.com/mjanusz/v86d
  S:    Maintained
  F:    Documentation/fb/uvesafb.txt
  F:    drivers/video/fbdev/uvesafb.*
@@@ -15872,7 -15724,7 +15888,7 @@@ F:   include/linux/regulator
  
  VRF
  M:    David Ahern <dsa@cumulusnetworks.com>
 -M:    Shrijeet Mukherjee <shm@cumulusnetworks.com>
 +M:    Shrijeet Mukherjee <shrijeet@gmail.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/vrf.c
@@@ -16137,17 -15989,6 +16153,17 @@@ T: git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  F:    arch/x86/entry/vdso/
  
 +XARRAY
 +M:    Matthew Wilcox <willy@infradead.org>
 +L:    linux-fsdevel@vger.kernel.org
 +S:    Supported
 +F:    Documentation/core-api/xarray.rst
 +F:    lib/idr.c
 +F:    lib/xarray.c
 +F:    include/linux/idr.h
 +F:    include/linux/xarray.h
 +F:    tools/testing/radix-tree
 +
  XC2028/3028 TUNER DRIVER
  M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
@@@ -28,6 -28,7 +28,7 @@@
  
  #include <drm/drmP.h>
  #include <drm/drm_atomic.h>
+ #include <drm/drm_atomic_uapi.h>
  #include <drm/drm_mode.h>
  #include <drm/drm_print.h>
  #include <drm/drm_writeback.h>
@@@ -174,11 -175,6 +175,11 @@@ void drm_atomic_state_default_clear(str
                state->crtcs[i].state = NULL;
                state->crtcs[i].old_state = NULL;
                state->crtcs[i].new_state = NULL;
 +
 +              if (state->crtcs[i].commit) {
 +                      drm_crtc_commit_put(state->crtcs[i].commit);
 +                      state->crtcs[i].commit = NULL;
 +              }
        }
  
        for (i = 0; i < config->num_total_plane; i++) {
@@@ -314,350 -310,6 +315,6 @@@ drm_atomic_get_crtc_state(struct drm_at
  }
  EXPORT_SYMBOL(drm_atomic_get_crtc_state);
  
- static void set_out_fence_for_crtc(struct drm_atomic_state *state,
-                                  struct drm_crtc *crtc, s32 __user *fence_ptr)
- {
-       state->crtcs[drm_crtc_index(crtc)].out_fence_ptr = fence_ptr;
- }
- static s32 __user *get_out_fence_for_crtc(struct drm_atomic_state *state,
-                                         struct drm_crtc *crtc)
- {
-       s32 __user *fence_ptr;
-       fence_ptr = state->crtcs[drm_crtc_index(crtc)].out_fence_ptr;
-       state->crtcs[drm_crtc_index(crtc)].out_fence_ptr = NULL;
-       return fence_ptr;
- }
- static int set_out_fence_for_connector(struct drm_atomic_state *state,
-                                       struct drm_connector *connector,
-                                       s32 __user *fence_ptr)
- {
-       unsigned int index = drm_connector_index(connector);
-       if (!fence_ptr)
-               return 0;
-       if (put_user(-1, fence_ptr))
-               return -EFAULT;
-       state->connectors[index].out_fence_ptr = fence_ptr;
-       return 0;
- }
- static s32 __user *get_out_fence_for_connector(struct drm_atomic_state *state,
-                                              struct drm_connector *connector)
- {
-       unsigned int index = drm_connector_index(connector);
-       s32 __user *fence_ptr;
-       fence_ptr = state->connectors[index].out_fence_ptr;
-       state->connectors[index].out_fence_ptr = NULL;
-       return fence_ptr;
- }
- /**
-  * drm_atomic_set_mode_for_crtc - set mode for CRTC
-  * @state: the CRTC whose incoming state to update
-  * @mode: kernel-internal mode to use for the CRTC, or NULL to disable
-  *
-  * Set a mode (originating from the kernel) on the desired CRTC state and update
-  * the enable property.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure. Cannot return -EDEADLK.
-  */
- int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
-                                const struct drm_display_mode *mode)
- {
-       struct drm_crtc *crtc = state->crtc;
-       struct drm_mode_modeinfo umode;
-       /* Early return for no change. */
-       if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
-               return 0;
-       drm_property_blob_put(state->mode_blob);
-       state->mode_blob = NULL;
-       if (mode) {
-               drm_mode_convert_to_umode(&umode, mode);
-               state->mode_blob =
-                       drm_property_create_blob(state->crtc->dev,
-                                                sizeof(umode),
-                                                &umode);
-               if (IS_ERR(state->mode_blob))
-                       return PTR_ERR(state->mode_blob);
-               drm_mode_copy(&state->mode, mode);
-               state->enable = true;
-               DRM_DEBUG_ATOMIC("Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
-                                mode->name, crtc->base.id, crtc->name, state);
-       } else {
-               memset(&state->mode, 0, sizeof(state->mode));
-               state->enable = false;
-               DRM_DEBUG_ATOMIC("Set [NOMODE] for [CRTC:%d:%s] state %p\n",
-                                crtc->base.id, crtc->name, state);
-       }
-       return 0;
- }
- EXPORT_SYMBOL(drm_atomic_set_mode_for_crtc);
- /**
-  * drm_atomic_set_mode_prop_for_crtc - set mode for CRTC
-  * @state: the CRTC whose incoming state to update
-  * @blob: pointer to blob property to use for mode
-  *
-  * Set a mode (originating from a blob property) on the desired CRTC state.
-  * This function will take a reference on the blob property for the CRTC state,
-  * and release the reference held on the state's existing mode property, if any
-  * was set.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure. Cannot return -EDEADLK.
-  */
- int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
-                                       struct drm_property_blob *blob)
- {
-       struct drm_crtc *crtc = state->crtc;
-       if (blob == state->mode_blob)
-               return 0;
-       drm_property_blob_put(state->mode_blob);
-       state->mode_blob = NULL;
-       memset(&state->mode, 0, sizeof(state->mode));
-       if (blob) {
-               int ret;
-               if (blob->length != sizeof(struct drm_mode_modeinfo)) {
-                       DRM_DEBUG_ATOMIC("[CRTC:%d:%s] bad mode blob length: %zu\n",
-                                        crtc->base.id, crtc->name,
-                                        blob->length);
-                       return -EINVAL;
-               }
-               ret = drm_mode_convert_umode(crtc->dev,
-                                            &state->mode, blob->data);
-               if (ret) {
-                       DRM_DEBUG_ATOMIC("[CRTC:%d:%s] invalid mode (ret=%d, status=%s):\n",
-                                        crtc->base.id, crtc->name,
-                                        ret, drm_get_mode_status_name(state->mode.status));
-                       drm_mode_debug_printmodeline(&state->mode);
-                       return -EINVAL;
-               }
-               state->mode_blob = drm_property_blob_get(blob);
-               state->enable = true;
-               DRM_DEBUG_ATOMIC("Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
-                                state->mode.name, crtc->base.id, crtc->name,
-                                state);
-       } else {
-               state->enable = false;
-               DRM_DEBUG_ATOMIC("Set [NOMODE] for [CRTC:%d:%s] state %p\n",
-                                crtc->base.id, crtc->name, state);
-       }
-       return 0;
- }
- EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
- /**
-  * drm_atomic_replace_property_blob_from_id - lookup the new blob and replace the old one with it
-  * @dev: DRM device
-  * @blob: a pointer to the member blob to be replaced
-  * @blob_id: ID of the new blob
-  * @expected_size: total expected size of the blob data (in bytes)
-  * @expected_elem_size: expected element size of the blob data (in bytes)
-  * @replaced: did the blob get replaced?
-  *
-  * Replace @blob with another blob with the ID @blob_id. If @blob_id is zero
-  * @blob becomes NULL.
-  *
-  * If @expected_size is positive the new blob length is expected to be equal
-  * to @expected_size bytes. If @expected_elem_size is positive the new blob
-  * length is expected to be a multiple of @expected_elem_size bytes. Otherwise
-  * an error is returned.
-  *
-  * @replaced will indicate to the caller whether the blob was replaced or not.
-  * If the old and new blobs were in fact the same blob @replaced will be false
-  * otherwise it will be true.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure.
-  */
- static int
- drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
-                                        struct drm_property_blob **blob,
-                                        uint64_t blob_id,
-                                        ssize_t expected_size,
-                                        ssize_t expected_elem_size,
-                                        bool *replaced)
- {
-       struct drm_property_blob *new_blob = NULL;
-       if (blob_id != 0) {
-               new_blob = drm_property_lookup_blob(dev, blob_id);
-               if (new_blob == NULL)
-                       return -EINVAL;
-               if (expected_size > 0 &&
-                   new_blob->length != expected_size) {
-                       drm_property_blob_put(new_blob);
-                       return -EINVAL;
-               }
-               if (expected_elem_size > 0 &&
-                   new_blob->length % expected_elem_size != 0) {
-                       drm_property_blob_put(new_blob);
-                       return -EINVAL;
-               }
-       }
-       *replaced |= drm_property_replace_blob(blob, new_blob);
-       drm_property_blob_put(new_blob);
-       return 0;
- }
- /**
-  * drm_atomic_crtc_set_property - set property on CRTC
-  * @crtc: the drm CRTC to set a property on
-  * @state: the state object to update with the new property value
-  * @property: the property to set
-  * @val: the new property value
-  *
-  * This function handles generic/core properties and calls out to driver's
-  * &drm_crtc_funcs.atomic_set_property for driver properties. To ensure
-  * consistent behavior you must call this function rather than the driver hook
-  * directly.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
- int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
-               struct drm_crtc_state *state, struct drm_property *property,
-               uint64_t val)
- {
-       struct drm_device *dev = crtc->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-       bool replaced = false;
-       int ret;
-       if (property == config->prop_active)
-               state->active = val;
-       else if (property == config->prop_mode_id) {
-               struct drm_property_blob *mode =
-                       drm_property_lookup_blob(dev, val);
-               ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
-               drm_property_blob_put(mode);
-               return ret;
-       } else if (property == config->degamma_lut_property) {
-               ret = drm_atomic_replace_property_blob_from_id(dev,
-                                       &state->degamma_lut,
-                                       val,
-                                       -1, sizeof(struct drm_color_lut),
-                                       &replaced);
-               state->color_mgmt_changed |= replaced;
-               return ret;
-       } else if (property == config->ctm_property) {
-               ret = drm_atomic_replace_property_blob_from_id(dev,
-                                       &state->ctm,
-                                       val,
-                                       sizeof(struct drm_color_ctm), -1,
-                                       &replaced);
-               state->color_mgmt_changed |= replaced;
-               return ret;
-       } else if (property == config->gamma_lut_property) {
-               ret = drm_atomic_replace_property_blob_from_id(dev,
-                                       &state->gamma_lut,
-                                       val,
-                                       -1, sizeof(struct drm_color_lut),
-                                       &replaced);
-               state->color_mgmt_changed |= replaced;
-               return ret;
-       } else if (property == config->prop_out_fence_ptr) {
-               s32 __user *fence_ptr = u64_to_user_ptr(val);
-               if (!fence_ptr)
-                       return 0;
-               if (put_user(-1, fence_ptr))
-                       return -EFAULT;
-               set_out_fence_for_crtc(state->state, crtc, fence_ptr);
-       } else if (crtc->funcs->atomic_set_property) {
-               return crtc->funcs->atomic_set_property(crtc, state, property, val);
-       } else {
-               DRM_DEBUG_ATOMIC("[CRTC:%d:%s] unknown property [PROP:%d:%s]]\n",
-                                crtc->base.id, crtc->name,
-                                property->base.id, property->name);
-               return -EINVAL;
-       }
-       return 0;
- }
- EXPORT_SYMBOL(drm_atomic_crtc_set_property);
- /**
-  * drm_atomic_crtc_get_property - get property value from CRTC state
-  * @crtc: the drm CRTC to set a property on
-  * @state: the state object to get the property value from
-  * @property: the property to set
-  * @val: return location for the property value
-  *
-  * This function handles generic/core properties and calls out to driver's
-  * &drm_crtc_funcs.atomic_get_property for driver properties. To ensure
-  * consistent behavior you must call this function rather than the driver hook
-  * directly.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
- static int
- drm_atomic_crtc_get_property(struct drm_crtc *crtc,
-               const struct drm_crtc_state *state,
-               struct drm_property *property, uint64_t *val)
- {
-       struct drm_device *dev = crtc->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-       if (property == config->prop_active)
-               *val = state->active;
-       else if (property == config->prop_mode_id)
-               *val = (state->mode_blob) ? state->mode_blob->base.id : 0;
-       else if (property == config->degamma_lut_property)
-               *val = (state->degamma_lut) ? state->degamma_lut->base.id : 0;
-       else if (property == config->ctm_property)
-               *val = (state->ctm) ? state->ctm->base.id : 0;
-       else if (property == config->gamma_lut_property)
-               *val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
-       else if (property == config->prop_out_fence_ptr)
-               *val = 0;
-       else if (crtc->funcs->atomic_get_property)
-               return crtc->funcs->atomic_get_property(crtc, state, property, val);
-       else
-               return -EINVAL;
-       return 0;
- }
- /**
-  * drm_atomic_crtc_check - check crtc state
-  * @crtc: crtc to check
-  * @state: crtc state to check
-  *
-  * Provides core sanity checks for crtc state.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
  static int drm_atomic_crtc_check(struct drm_crtc *crtc,
                struct drm_crtc_state *state)
  {
@@@ -733,16 -385,6 +390,6 @@@ static void drm_atomic_crtc_print_state
                crtc->funcs->atomic_print_state(p, state);
  }
  
- /**
-  * drm_atomic_connector_check - check connector state
-  * @connector: connector to check
-  * @state: connector state to check
-  *
-  * Provides core sanity checks for connector state.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
  static int drm_atomic_connector_check(struct drm_connector *connector,
                struct drm_connector_state *state)
  {
@@@ -841,155 -483,6 +488,6 @@@ drm_atomic_get_plane_state(struct drm_a
  }
  EXPORT_SYMBOL(drm_atomic_get_plane_state);
  
- /**
-  * drm_atomic_plane_set_property - set property on plane
-  * @plane: the drm plane to set a property on
-  * @state: the state object to update with the new property value
-  * @property: the property to set
-  * @val: the new property value
-  *
-  * This function handles generic/core properties and calls out to driver's
-  * &drm_plane_funcs.atomic_set_property for driver properties.  To ensure
-  * consistent behavior you must call this function rather than the driver hook
-  * directly.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
- static int drm_atomic_plane_set_property(struct drm_plane *plane,
-               struct drm_plane_state *state, struct drm_property *property,
-               uint64_t val)
- {
-       struct drm_device *dev = plane->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-       if (property == config->prop_fb_id) {
-               struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val);
-               drm_atomic_set_fb_for_plane(state, fb);
-               if (fb)
-                       drm_framebuffer_put(fb);
-       } else if (property == config->prop_in_fence_fd) {
-               if (state->fence)
-                       return -EINVAL;
-               if (U642I64(val) == -1)
-                       return 0;
-               state->fence = sync_file_get_fence(val);
-               if (!state->fence)
-                       return -EINVAL;
-       } else if (property == config->prop_crtc_id) {
-               struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val);
-               return drm_atomic_set_crtc_for_plane(state, crtc);
-       } else if (property == config->prop_crtc_x) {
-               state->crtc_x = U642I64(val);
-       } else if (property == config->prop_crtc_y) {
-               state->crtc_y = U642I64(val);
-       } else if (property == config->prop_crtc_w) {
-               state->crtc_w = val;
-       } else if (property == config->prop_crtc_h) {
-               state->crtc_h = val;
-       } else if (property == config->prop_src_x) {
-               state->src_x = val;
-       } else if (property == config->prop_src_y) {
-               state->src_y = val;
-       } else if (property == config->prop_src_w) {
-               state->src_w = val;
-       } else if (property == config->prop_src_h) {
-               state->src_h = val;
-       } else if (property == plane->alpha_property) {
-               state->alpha = val;
-       } else if (property == plane->rotation_property) {
-               if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) {
-                       DRM_DEBUG_ATOMIC("[PLANE:%d:%s] bad rotation bitmask: 0x%llx\n",
-                                        plane->base.id, plane->name, val);
-                       return -EINVAL;
-               }
-               state->rotation = val;
-       } else if (property == plane->zpos_property) {
-               state->zpos = val;
-       } else if (property == plane->color_encoding_property) {
-               state->color_encoding = val;
-       } else if (property == plane->color_range_property) {
-               state->color_range = val;
-       } else if (plane->funcs->atomic_set_property) {
-               return plane->funcs->atomic_set_property(plane, state,
-                               property, val);
-       } else {
-               DRM_DEBUG_ATOMIC("[PLANE:%d:%s] unknown property [PROP:%d:%s]]\n",
-                                plane->base.id, plane->name,
-                                property->base.id, property->name);
-               return -EINVAL;
-       }
-       return 0;
- }
- /**
-  * drm_atomic_plane_get_property - get property value from plane state
-  * @plane: the drm plane to set a property on
-  * @state: the state object to get the property value from
-  * @property: the property to set
-  * @val: return location for the property value
-  *
-  * This function handles generic/core properties and calls out to driver's
-  * &drm_plane_funcs.atomic_get_property for driver properties.  To ensure
-  * consistent behavior you must call this function rather than the driver hook
-  * directly.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
- static int
- drm_atomic_plane_get_property(struct drm_plane *plane,
-               const struct drm_plane_state *state,
-               struct drm_property *property, uint64_t *val)
- {
-       struct drm_device *dev = plane->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-       if (property == config->prop_fb_id) {
-               *val = (state->fb) ? state->fb->base.id : 0;
-       } else if (property == config->prop_in_fence_fd) {
-               *val = -1;
-       } else if (property == config->prop_crtc_id) {
-               *val = (state->crtc) ? state->crtc->base.id : 0;
-       } else if (property == config->prop_crtc_x) {
-               *val = I642U64(state->crtc_x);
-       } else if (property == config->prop_crtc_y) {
-               *val = I642U64(state->crtc_y);
-       } else if (property == config->prop_crtc_w) {
-               *val = state->crtc_w;
-       } else if (property == config->prop_crtc_h) {
-               *val = state->crtc_h;
-       } else if (property == config->prop_src_x) {
-               *val = state->src_x;
-       } else if (property == config->prop_src_y) {
-               *val = state->src_y;
-       } else if (property == config->prop_src_w) {
-               *val = state->src_w;
-       } else if (property == config->prop_src_h) {
-               *val = state->src_h;
-       } else if (property == plane->alpha_property) {
-               *val = state->alpha;
-       } else if (property == plane->rotation_property) {
-               *val = state->rotation;
-       } else if (property == plane->zpos_property) {
-               *val = state->zpos;
-       } else if (property == plane->color_encoding_property) {
-               *val = state->color_encoding;
-       } else if (property == plane->color_range_property) {
-               *val = state->color_range;
-       } else if (plane->funcs->atomic_get_property) {
-               return plane->funcs->atomic_get_property(plane, state, property, val);
-       } else {
-               return -EINVAL;
-       }
-       return 0;
- }
  static bool
  plane_switching_crtc(struct drm_atomic_state *state,
                     struct drm_plane *plane,
@@@ -1329,111 -822,6 +827,6 @@@ drm_atomic_get_connector_state(struct d
  }
  EXPORT_SYMBOL(drm_atomic_get_connector_state);
  
- /**
-  * drm_atomic_connector_set_property - set property on connector.
-  * @connector: the drm connector to set a property on
-  * @state: the state object to update with the new property value
-  * @property: the property to set
-  * @val: the new property value
-  *
-  * This function handles generic/core properties and calls out to driver's
-  * &drm_connector_funcs.atomic_set_property for driver properties.  To ensure
-  * consistent behavior you must call this function rather than the driver hook
-  * directly.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
- static int drm_atomic_connector_set_property(struct drm_connector *connector,
-               struct drm_connector_state *state, struct drm_property *property,
-               uint64_t val)
- {
-       struct drm_device *dev = connector->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-       if (property == config->prop_crtc_id) {
-               struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val);
-               return drm_atomic_set_crtc_for_connector(state, crtc);
-       } else if (property == config->dpms_property) {
-               /* setting DPMS property requires special handling, which
-                * is done in legacy setprop path for us.  Disallow (for
-                * now?) atomic writes to DPMS property:
-                */
-               return -EINVAL;
-       } else if (property == config->tv_select_subconnector_property) {
-               state->tv.subconnector = val;
-       } else if (property == config->tv_left_margin_property) {
-               state->tv.margins.left = val;
-       } else if (property == config->tv_right_margin_property) {
-               state->tv.margins.right = val;
-       } else if (property == config->tv_top_margin_property) {
-               state->tv.margins.top = val;
-       } else if (property == config->tv_bottom_margin_property) {
-               state->tv.margins.bottom = val;
-       } else if (property == config->tv_mode_property) {
-               state->tv.mode = val;
-       } else if (property == config->tv_brightness_property) {
-               state->tv.brightness = val;
-       } else if (property == config->tv_contrast_property) {
-               state->tv.contrast = val;
-       } else if (property == config->tv_flicker_reduction_property) {
-               state->tv.flicker_reduction = val;
-       } else if (property == config->tv_overscan_property) {
-               state->tv.overscan = val;
-       } else if (property == config->tv_saturation_property) {
-               state->tv.saturation = val;
-       } else if (property == config->tv_hue_property) {
-               state->tv.hue = val;
-       } else if (property == config->link_status_property) {
-               /* Never downgrade from GOOD to BAD on userspace's request here,
-                * only hw issues can do that.
-                *
-                * For an atomic property the userspace doesn't need to be able
-                * to understand all the properties, but needs to be able to
-                * restore the state it wants on VT switch. So if the userspace
-                * tries to change the link_status from GOOD to BAD, driver
-                * silently rejects it and returns a 0. This prevents userspace
-                * from accidently breaking  the display when it restores the
-                * state.
-                */
-               if (state->link_status != DRM_LINK_STATUS_GOOD)
-                       state->link_status = val;
-       } else if (property == config->aspect_ratio_property) {
-               state->picture_aspect_ratio = val;
-       } else if (property == config->content_type_property) {
-               state->content_type = val;
-       } else if (property == connector->scaling_mode_property) {
-               state->scaling_mode = val;
-       } else if (property == connector->content_protection_property) {
-               if (val == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
-                       DRM_DEBUG_KMS("only drivers can set CP Enabled\n");
-                       return -EINVAL;
-               }
-               state->content_protection = val;
-       } else if (property == config->writeback_fb_id_property) {
-               struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val);
-               int ret = drm_atomic_set_writeback_fb_for_connector(state, fb);
-               if (fb)
-                       drm_framebuffer_put(fb);
-               return ret;
-       } else if (property == config->writeback_out_fence_ptr_property) {
-               s32 __user *fence_ptr = u64_to_user_ptr(val);
-               return set_out_fence_for_connector(state->state, connector,
-                                                  fence_ptr);
-       } else if (connector->funcs->atomic_set_property) {
-               return connector->funcs->atomic_set_property(connector,
-                               state, property, val);
-       } else {
-               DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] unknown property [PROP:%d:%s]]\n",
-                                connector->base.id, connector->name,
-                                property->base.id, property->name);
-               return -EINVAL;
-       }
-       return 0;
- }
  static void drm_atomic_connector_print_state(struct drm_printer *p,
                const struct drm_connector_state *state)
  {
  }
  
  /**
-  * drm_atomic_connector_get_property - get property value from connector state
-  * @connector: the drm connector to set a property on
-  * @state: the state object to get the property value from
-  * @property: the property to set
-  * @val: return location for the property value
-  *
-  * This function handles generic/core properties and calls out to driver's
-  * &drm_connector_funcs.atomic_get_property for driver properties.  To ensure
-  * consistent behavior you must call this function rather than the driver hook
-  * directly.
-  *
-  * RETURNS:
-  * Zero on success, error code on failure
-  */
- static int
- drm_atomic_connector_get_property(struct drm_connector *connector,
-               const struct drm_connector_state *state,
-               struct drm_property *property, uint64_t *val)
- {
-       struct drm_device *dev = connector->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-       if (property == config->prop_crtc_id) {
-               *val = (state->crtc) ? state->crtc->base.id : 0;
-       } else if (property == config->dpms_property) {
-               *val = connector->dpms;
-       } else if (property == config->tv_select_subconnector_property) {
-               *val = state->tv.subconnector;
-       } else if (property == config->tv_left_margin_property) {
-               *val = state->tv.margins.left;
-       } else if (property == config->tv_right_margin_property) {
-               *val = state->tv.margins.right;
-       } else if (property == config->tv_top_margin_property) {
-               *val = state->tv.margins.top;
-       } else if (property == config->tv_bottom_margin_property) {
-               *val = state->tv.margins.bottom;
-       } else if (property == config->tv_mode_property) {
-               *val = state->tv.mode;
-       } else if (property == config->tv_brightness_property) {
-               *val = state->tv.brightness;
-       } else if (property == config->tv_contrast_property) {
-               *val = state->tv.contrast;
-       } else if (property == config->tv_flicker_reduction_property) {
-               *val = state->tv.flicker_reduction;
-       } else if (property == config->tv_overscan_property) {
-               *val = state->tv.overscan;
-       } else if (property == config->tv_saturation_property) {
-               *val = state->tv.saturation;
-       } else if (property == config->tv_hue_property) {
-               *val = state->tv.hue;
-       } else if (property == config->link_status_property) {
-               *val = state->link_status;
-       } else if (property == config->aspect_ratio_property) {
-               *val = state->picture_aspect_ratio;
-       } else if (property == config->content_type_property) {
-               *val = state->content_type;
-       } else if (property == connector->scaling_mode_property) {
-               *val = state->scaling_mode;
-       } else if (property == connector->content_protection_property) {
-               *val = state->content_protection;
-       } else if (property == config->writeback_fb_id_property) {
-               /* Writeback framebuffer is one-shot, write and forget */
-               *val = 0;
-       } else if (property == config->writeback_out_fence_ptr_property) {
-               *val = 0;
-       } else if (connector->funcs->atomic_get_property) {
-               return connector->funcs->atomic_get_property(connector,
-                               state, property, val);
-       } else {
-               return -EINVAL;
-       }
-       return 0;
- }
- int drm_atomic_get_property(struct drm_mode_object *obj,
-               struct drm_property *property, uint64_t *val)
- {
-       struct drm_device *dev = property->dev;
-       int ret;
-       switch (obj->type) {
-       case DRM_MODE_OBJECT_CONNECTOR: {
-               struct drm_connector *connector = obj_to_connector(obj);
-               WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
-               ret = drm_atomic_connector_get_property(connector,
-                               connector->state, property, val);
-               break;
-       }
-       case DRM_MODE_OBJECT_CRTC: {
-               struct drm_crtc *crtc = obj_to_crtc(obj);
-               WARN_ON(!drm_modeset_is_locked(&crtc->mutex));
-               ret = drm_atomic_crtc_get_property(crtc,
-                               crtc->state, property, val);
-               break;
-       }
-       case DRM_MODE_OBJECT_PLANE: {
-               struct drm_plane *plane = obj_to_plane(obj);
-               WARN_ON(!drm_modeset_is_locked(&plane->mutex));
-               ret = drm_atomic_plane_get_property(plane,
-                               plane->state, property, val);
-               break;
-       }
-       default:
-               ret = -EINVAL;
-               break;
-       }
-       return ret;
- }
- /**
-  * drm_atomic_set_crtc_for_plane - set crtc for plane
-  * @plane_state: the plane whose incoming state to update
-  * @crtc: crtc to use for the plane
-  *
-  * Changing the assigned crtc for a plane requires us to grab the lock and state
-  * for the new crtc, as needed. This function takes care of all these details
-  * besides updating the pointer in the state object itself.
-  *
-  * Returns:
-  * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
-  * then the w/w mutex code has detected a deadlock and the entire atomic
-  * sequence must be restarted. All other errors are fatal.
-  */
- int
- drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
-                             struct drm_crtc *crtc)
- {
-       struct drm_plane *plane = plane_state->plane;
-       struct drm_crtc_state *crtc_state;
-       /* Nothing to do for same crtc*/
-       if (plane_state->crtc == crtc)
-               return 0;
-       if (plane_state->crtc) {
-               crtc_state = drm_atomic_get_crtc_state(plane_state->state,
-                                                      plane_state->crtc);
-               if (WARN_ON(IS_ERR(crtc_state)))
-                       return PTR_ERR(crtc_state);
-               crtc_state->plane_mask &= ~drm_plane_mask(plane);
-       }
-       plane_state->crtc = crtc;
-       if (crtc) {
-               crtc_state = drm_atomic_get_crtc_state(plane_state->state,
-                                                      crtc);
-               if (IS_ERR(crtc_state))
-                       return PTR_ERR(crtc_state);
-               crtc_state->plane_mask |= drm_plane_mask(plane);
-       }
-       if (crtc)
-               DRM_DEBUG_ATOMIC("Link [PLANE:%d:%s] state %p to [CRTC:%d:%s]\n",
-                                plane->base.id, plane->name, plane_state,
-                                crtc->base.id, crtc->name);
-       else
-               DRM_DEBUG_ATOMIC("Link [PLANE:%d:%s] state %p to [NOCRTC]\n",
-                                plane->base.id, plane->name, plane_state);
-       return 0;
- }
- EXPORT_SYMBOL(drm_atomic_set_crtc_for_plane);
- /**
-  * drm_atomic_set_fb_for_plane - set framebuffer for plane
-  * @plane_state: atomic state object for the plane
-  * @fb: fb to use for the plane
-  *
-  * Changing the assigned framebuffer for a plane requires us to grab a reference
-  * to the new fb and drop the reference to the old fb, if there is one. This
-  * function takes care of all these details besides updating the pointer in the
-  * state object itself.
-  */
- void
- drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
-                           struct drm_framebuffer *fb)
- {
-       struct drm_plane *plane = plane_state->plane;
-       if (fb)
-               DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state %p\n",
-                                fb->base.id, plane->base.id, plane->name,
-                                plane_state);
-       else
-               DRM_DEBUG_ATOMIC("Set [NOFB] for [PLANE:%d:%s] state %p\n",
-                                plane->base.id, plane->name, plane_state);
-       drm_framebuffer_assign(&plane_state->fb, fb);
- }
- EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
- /**
-  * drm_atomic_set_fence_for_plane - set fence for plane
-  * @plane_state: atomic state object for the plane
-  * @fence: dma_fence to use for the plane
-  *
-  * Helper to setup the plane_state fence in case it is not set yet.
-  * By using this drivers doesn't need to worry if the user choose
-  * implicit or explicit fencing.
-  *
-  * This function will not set the fence to the state if it was set
-  * via explicit fencing interfaces on the atomic ioctl. In that case it will
-  * drop the reference to the fence as we are not storing it anywhere.
-  * Otherwise, if &drm_plane_state.fence is not set this function we just set it
-  * with the received implicit fence. In both cases this function consumes a
-  * reference for @fence.
-  *
-  * This way explicit fencing can be used to overrule implicit fencing, which is
-  * important to make explicit fencing use-cases work: One example is using one
-  * buffer for 2 screens with different refresh rates. Implicit fencing will
-  * clamp rendering to the refresh rate of the slower screen, whereas explicit
-  * fence allows 2 independent render and display loops on a single buffer. If a
-  * driver allows obeys both implicit and explicit fences for plane updates, then
-  * it will break all the benefits of explicit fencing.
-  */
- void
- drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
-                              struct dma_fence *fence)
- {
-       if (plane_state->fence) {
-               dma_fence_put(fence);
-               return;
-       }
-       plane_state->fence = fence;
- }
- EXPORT_SYMBOL(drm_atomic_set_fence_for_plane);
- /**
-  * drm_atomic_set_crtc_for_connector - set crtc for connector
-  * @conn_state: atomic state object for the connector
-  * @crtc: crtc to use for the connector
-  *
-  * Changing the assigned crtc for a connector requires us to grab the lock and
-  * state for the new crtc, as needed. This function takes care of all these
-  * details besides updating the pointer in the state object itself.
-  *
-  * Returns:
-  * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
-  * then the w/w mutex code has detected a deadlock and the entire atomic
-  * sequence must be restarted. All other errors are fatal.
-  */
- int
- drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
-                                 struct drm_crtc *crtc)
- {
-       struct drm_connector *connector = conn_state->connector;
-       struct drm_crtc_state *crtc_state;
-       if (conn_state->crtc == crtc)
-               return 0;
-       if (conn_state->crtc) {
-               crtc_state = drm_atomic_get_new_crtc_state(conn_state->state,
-                                                          conn_state->crtc);
-               crtc_state->connector_mask &=
-                       ~drm_connector_mask(conn_state->connector);
-               drm_connector_put(conn_state->connector);
-               conn_state->crtc = NULL;
-       }
-       if (crtc) {
-               crtc_state = drm_atomic_get_crtc_state(conn_state->state, crtc);
-               if (IS_ERR(crtc_state))
-                       return PTR_ERR(crtc_state);
-               crtc_state->connector_mask |=
-                       drm_connector_mask(conn_state->connector);
-               drm_connector_get(conn_state->connector);
-               conn_state->crtc = crtc;
-               DRM_DEBUG_ATOMIC("Link [CONNECTOR:%d:%s] state %p to [CRTC:%d:%s]\n",
-                                connector->base.id, connector->name,
-                                conn_state, crtc->base.id, crtc->name);
-       } else {
-               DRM_DEBUG_ATOMIC("Link [CONNECTOR:%d:%s] state %p to [NOCRTC]\n",
-                                connector->base.id, connector->name,
-                                conn_state);
-       }
-       return 0;
- }
- EXPORT_SYMBOL(drm_atomic_set_crtc_for_connector);
- /*
-  * drm_atomic_get_writeback_job - return or allocate a writeback job
-  * @conn_state: Connector state to get the job for
-  *
-  * Writeback jobs have a different lifetime to the atomic state they are
-  * associated with. This convenience function takes care of allocating a job
-  * if there isn't yet one associated with the connector state, otherwise
-  * it just returns the existing job.
-  *
-  * Returns: The writeback job for the given connector state
-  */
- static struct drm_writeback_job *
- drm_atomic_get_writeback_job(struct drm_connector_state *conn_state)
- {
-       WARN_ON(conn_state->connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK);
-       if (!conn_state->writeback_job)
-               conn_state->writeback_job =
-                       kzalloc(sizeof(*conn_state->writeback_job), GFP_KERNEL);
-       return conn_state->writeback_job;
- }
- /**
-  * drm_atomic_set_writeback_fb_for_connector - set writeback framebuffer
-  * @conn_state: atomic state object for the connector
-  * @fb: fb to use for the connector
-  *
-  * This is used to set the framebuffer for a writeback connector, which outputs
-  * to a buffer instead of an actual physical connector.
-  * Changing the assigned framebuffer requires us to grab a reference to the new
-  * fb and drop the reference to the old fb, if there is one. This function
-  * takes care of all these details besides updating the pointer in the
-  * state object itself.
-  *
-  * Note: The only way conn_state can already have an fb set is if the commit
-  * sets the property more than once.
-  *
-  * See also: drm_writeback_connector_init()
-  *
-  * Returns: 0 on success
-  */
- int drm_atomic_set_writeback_fb_for_connector(
-               struct drm_connector_state *conn_state,
-               struct drm_framebuffer *fb)
- {
-       struct drm_writeback_job *job =
-               drm_atomic_get_writeback_job(conn_state);
-       if (!job)
-               return -ENOMEM;
-       drm_framebuffer_assign(&job->fb, fb);
-       if (fb)
-               DRM_DEBUG_ATOMIC("Set [FB:%d] for connector state %p\n",
-                                fb->base.id, conn_state);
-       else
-               DRM_DEBUG_ATOMIC("Set [NOFB] for connector state %p\n",
-                                conn_state);
-       return 0;
- }
- EXPORT_SYMBOL(drm_atomic_set_writeback_fb_for_connector);
- /**
   * drm_atomic_add_affected_connectors - add connectors for crtc
   * @state: atomic state
   * @crtc: DRM crtc
@@@ -2040,7 -1074,7 +1079,7 @@@ int drm_atomic_nonblocking_commit(struc
  }
  EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
  
static void drm_atomic_print_state(const struct drm_atomic_state *state)
+ void drm_atomic_print_state(const struct drm_atomic_state *state)
  {
        struct drm_printer p = drm_info_printer(state->dev->dev);
        struct drm_plane *plane;
@@@ -2147,544 -1181,3 +1186,3 @@@ int drm_atomic_debugfs_init(struct drm_
  }
  #endif
  
- /*
-  * The big monster ioctl
-  */
- static struct drm_pending_vblank_event *create_vblank_event(
-               struct drm_crtc *crtc, uint64_t user_data)
- {
-       struct drm_pending_vblank_event *e = NULL;
-       e = kzalloc(sizeof *e, GFP_KERNEL);
-       if (!e)
-               return NULL;
-       e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
-       e->event.base.length = sizeof(e->event);
-       e->event.vbl.crtc_id = crtc->base.id;
-       e->event.vbl.user_data = user_data;
-       return e;
- }
- int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
-                                    struct drm_connector *connector,
-                                    int mode)
- {
-       struct drm_connector *tmp_connector;
-       struct drm_connector_state *new_conn_state;
-       struct drm_crtc *crtc;
-       struct drm_crtc_state *crtc_state;
-       int i, ret, old_mode = connector->dpms;
-       bool active = false;
-       ret = drm_modeset_lock(&state->dev->mode_config.connection_mutex,
-                              state->acquire_ctx);
-       if (ret)
-               return ret;
-       if (mode != DRM_MODE_DPMS_ON)
-               mode = DRM_MODE_DPMS_OFF;
-       connector->dpms = mode;
-       crtc = connector->state->crtc;
-       if (!crtc)
-               goto out;
-       ret = drm_atomic_add_affected_connectors(state, crtc);
-       if (ret)
-               goto out;
-       crtc_state = drm_atomic_get_crtc_state(state, crtc);
-       if (IS_ERR(crtc_state)) {
-               ret = PTR_ERR(crtc_state);
-               goto out;
-       }
-       for_each_new_connector_in_state(state, tmp_connector, new_conn_state, i) {
-               if (new_conn_state->crtc != crtc)
-                       continue;
-               if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
-                       active = true;
-                       break;
-               }
-       }
-       crtc_state->active = active;
-       ret = drm_atomic_commit(state);
- out:
-       if (ret != 0)
-               connector->dpms = old_mode;
-       return ret;
- }
- int drm_atomic_set_property(struct drm_atomic_state *state,
-                           struct drm_mode_object *obj,
-                           struct drm_property *prop,
-                           uint64_t prop_value)
- {
-       struct drm_mode_object *ref;
-       int ret;
-       if (!drm_property_change_valid_get(prop, prop_value, &ref))
-               return -EINVAL;
-       switch (obj->type) {
-       case DRM_MODE_OBJECT_CONNECTOR: {
-               struct drm_connector *connector = obj_to_connector(obj);
-               struct drm_connector_state *connector_state;
-               connector_state = drm_atomic_get_connector_state(state, connector);
-               if (IS_ERR(connector_state)) {
-                       ret = PTR_ERR(connector_state);
-                       break;
-               }
-               ret = drm_atomic_connector_set_property(connector,
-                               connector_state, prop, prop_value);
-               break;
-       }
-       case DRM_MODE_OBJECT_CRTC: {
-               struct drm_crtc *crtc = obj_to_crtc(obj);
-               struct drm_crtc_state *crtc_state;
-               crtc_state = drm_atomic_get_crtc_state(state, crtc);
-               if (IS_ERR(crtc_state)) {
-                       ret = PTR_ERR(crtc_state);
-                       break;
-               }
-               ret = drm_atomic_crtc_set_property(crtc,
-                               crtc_state, prop, prop_value);
-               break;
-       }
-       case DRM_MODE_OBJECT_PLANE: {
-               struct drm_plane *plane = obj_to_plane(obj);
-               struct drm_plane_state *plane_state;
-               plane_state = drm_atomic_get_plane_state(state, plane);
-               if (IS_ERR(plane_state)) {
-                       ret = PTR_ERR(plane_state);
-                       break;
-               }
-               ret = drm_atomic_plane_set_property(plane,
-                               plane_state, prop, prop_value);
-               break;
-       }
-       default:
-               ret = -EINVAL;
-               break;
-       }
-       drm_property_change_valid_put(prop, ref);
-       return ret;
- }
- /**
-  * DOC: explicit fencing properties
-  *
-  * Explicit fencing allows userspace to control the buffer synchronization
-  * between devices. A Fence or a group of fences are transfered to/from
-  * userspace using Sync File fds and there are two DRM properties for that.
-  * IN_FENCE_FD on each DRM Plane to send fences to the kernel and
-  * OUT_FENCE_PTR on each DRM CRTC to receive fences from the kernel.
-  *
-  * As a contrast, with implicit fencing the kernel keeps track of any
-  * ongoing rendering, and automatically ensures that the atomic update waits
-  * for any pending rendering to complete. For shared buffers represented with
-  * a &struct dma_buf this is tracked in &struct reservation_object.
-  * Implicit syncing is how Linux traditionally worked (e.g. DRI2/3 on X.org),
-  * whereas explicit fencing is what Android wants.
-  *
-  * "IN_FENCE_FD”:
-  *    Use this property to pass a fence that DRM should wait on before
-  *    proceeding with the Atomic Commit request and show the framebuffer for
-  *    the plane on the screen. The fence can be either a normal fence or a
-  *    merged one, the sync_file framework will handle both cases and use a
-  *    fence_array if a merged fence is received. Passing -1 here means no
-  *    fences to wait on.
-  *
-  *    If the Atomic Commit request has the DRM_MODE_ATOMIC_TEST_ONLY flag
-  *    it will only check if the Sync File is a valid one.
-  *
-  *    On the driver side the fence is stored on the @fence parameter of
-  *    &struct drm_plane_state. Drivers which also support implicit fencing
-  *    should set the implicit fence using drm_atomic_set_fence_for_plane(),
-  *    to make sure there's consistent behaviour between drivers in precedence
-  *    of implicit vs. explicit fencing.
-  *
-  * "OUT_FENCE_PTR”:
-  *    Use this property to pass a file descriptor pointer to DRM. Once the
-  *    Atomic Commit request call returns OUT_FENCE_PTR will be filled with
-  *    the file descriptor number of a Sync File. This Sync File contains the
-  *    CRTC fence that will be signaled when all framebuffers present on the
-  *    Atomic Commit * request for that given CRTC are scanned out on the
-  *    screen.
-  *
-  *    The Atomic Commit request fails if a invalid pointer is passed. If the
-  *    Atomic Commit request fails for any other reason the out fence fd
-  *    returned will be -1. On a Atomic Commit with the
-  *    DRM_MODE_ATOMIC_TEST_ONLY flag the out fence will also be set to -1.
-  *
-  *    Note that out-fences don't have a special interface to drivers and are
-  *    internally represented by a &struct drm_pending_vblank_event in struct
-  *    &drm_crtc_state, which is also used by the nonblocking atomic commit
-  *    helpers and for the DRM event handling for existing userspace.
-  */
- struct drm_out_fence_state {
-       s32 __user *out_fence_ptr;
-       struct sync_file *sync_file;
-       int fd;
- };
- static int setup_out_fence(struct drm_out_fence_state *fence_state,
-                          struct dma_fence *fence)
- {
-       fence_state->fd = get_unused_fd_flags(O_CLOEXEC);
-       if (fence_state->fd < 0)
-               return fence_state->fd;
-       if (put_user(fence_state->fd, fence_state->out_fence_ptr))
-               return -EFAULT;
-       fence_state->sync_file = sync_file_create(fence);
-       if (!fence_state->sync_file)
-               return -ENOMEM;
-       return 0;
- }
- static int prepare_signaling(struct drm_device *dev,
-                                 struct drm_atomic_state *state,
-                                 struct drm_mode_atomic *arg,
-                                 struct drm_file *file_priv,
-                                 struct drm_out_fence_state **fence_state,
-                                 unsigned int *num_fences)
- {
-       struct drm_crtc *crtc;
-       struct drm_crtc_state *crtc_state;
-       struct drm_connector *conn;
-       struct drm_connector_state *conn_state;
-       int i, c = 0, ret;
-       if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
-               return 0;
-       for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
-               s32 __user *fence_ptr;
-               fence_ptr = get_out_fence_for_crtc(crtc_state->state, crtc);
-               if (arg->flags & DRM_MODE_PAGE_FLIP_EVENT || fence_ptr) {
-                       struct drm_pending_vblank_event *e;
-                       e = create_vblank_event(crtc, arg->user_data);
-                       if (!e)
-                               return -ENOMEM;
-                       crtc_state->event = e;
-               }
-               if (arg->flags & DRM_MODE_PAGE_FLIP_EVENT) {
-                       struct drm_pending_vblank_event *e = crtc_state->event;
-                       if (!file_priv)
-                               continue;
-                       ret = drm_event_reserve_init(dev, file_priv, &e->base,
-                                                    &e->event.base);
-                       if (ret) {
-                               kfree(e);
-                               crtc_state->event = NULL;
-                               return ret;
-                       }
-               }
-               if (fence_ptr) {
-                       struct dma_fence *fence;
-                       struct drm_out_fence_state *f;
-                       f = krealloc(*fence_state, sizeof(**fence_state) *
-                                    (*num_fences + 1), GFP_KERNEL);
-                       if (!f)
-                               return -ENOMEM;
-                       memset(&f[*num_fences], 0, sizeof(*f));
-                       f[*num_fences].out_fence_ptr = fence_ptr;
-                       *fence_state = f;
-                       fence = drm_crtc_create_fence(crtc);
-                       if (!fence)
-                               return -ENOMEM;
-                       ret = setup_out_fence(&f[(*num_fences)++], fence);
-                       if (ret) {
-                               dma_fence_put(fence);
-                               return ret;
-                       }
-                       crtc_state->event->base.fence = fence;
-               }
-               c++;
-       }
-       for_each_new_connector_in_state(state, conn, conn_state, i) {
-               struct drm_writeback_connector *wb_conn;
-               struct drm_writeback_job *job;
-               struct drm_out_fence_state *f;
-               struct dma_fence *fence;
-               s32 __user *fence_ptr;
-               fence_ptr = get_out_fence_for_connector(state, conn);
-               if (!fence_ptr)
-                       continue;
-               job = drm_atomic_get_writeback_job(conn_state);
-               if (!job)
-                       return -ENOMEM;
-               f = krealloc(*fence_state, sizeof(**fence_state) *
-                            (*num_fences + 1), GFP_KERNEL);
-               if (!f)
-                       return -ENOMEM;
-               memset(&f[*num_fences], 0, sizeof(*f));
-               f[*num_fences].out_fence_ptr = fence_ptr;
-               *fence_state = f;
-               wb_conn = drm_connector_to_writeback(conn);
-               fence = drm_writeback_get_out_fence(wb_conn);
-               if (!fence)
-                       return -ENOMEM;
-               ret = setup_out_fence(&f[(*num_fences)++], fence);
-               if (ret) {
-                       dma_fence_put(fence);
-                       return ret;
-               }
-               job->out_fence = fence;
-       }
-       /*
-        * Having this flag means user mode pends on event which will never
-        * reach due to lack of at least one CRTC for signaling
-        */
-       if (c == 0 && (arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
-               return -EINVAL;
-       return 0;
- }
- static void complete_signaling(struct drm_device *dev,
-                              struct drm_atomic_state *state,
-                              struct drm_out_fence_state *fence_state,
-                              unsigned int num_fences,
-                              bool install_fds)
- {
-       struct drm_crtc *crtc;
-       struct drm_crtc_state *crtc_state;
-       int i;
-       if (install_fds) {
-               for (i = 0; i < num_fences; i++)
-                       fd_install(fence_state[i].fd,
-                                  fence_state[i].sync_file->file);
-               kfree(fence_state);
-               return;
-       }
-       for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
-               struct drm_pending_vblank_event *event = crtc_state->event;
-               /*
-                * Free the allocated event. drm_atomic_helper_setup_commit
-                * can allocate an event too, so only free it if it's ours
-                * to prevent a double free in drm_atomic_state_clear.
-                */
-               if (event && (event->base.fence || event->base.file_priv)) {
-                       drm_event_cancel_free(dev, &event->base);
-                       crtc_state->event = NULL;
-               }
-       }
-       if (!fence_state)
-               return;
-       for (i = 0; i < num_fences; i++) {
-               if (fence_state[i].sync_file)
-                       fput(fence_state[i].sync_file->file);
-               if (fence_state[i].fd >= 0)
-                       put_unused_fd(fence_state[i].fd);
-               /* If this fails log error to the user */
-               if (fence_state[i].out_fence_ptr &&
-                   put_user(-1, fence_state[i].out_fence_ptr))
-                       DRM_DEBUG_ATOMIC("Couldn't clear out_fence_ptr\n");
-       }
-       kfree(fence_state);
- }
- int drm_mode_atomic_ioctl(struct drm_device *dev,
-                         void *data, struct drm_file *file_priv)
- {
-       struct drm_mode_atomic *arg = data;
-       uint32_t __user *objs_ptr = (uint32_t __user *)(unsigned long)(arg->objs_ptr);
-       uint32_t __user *count_props_ptr = (uint32_t __user *)(unsigned long)(arg->count_props_ptr);
-       uint32_t __user *props_ptr = (uint32_t __user *)(unsigned long)(arg->props_ptr);
-       uint64_t __user *prop_values_ptr = (uint64_t __user *)(unsigned long)(arg->prop_values_ptr);
-       unsigned int copied_objs, copied_props;
-       struct drm_atomic_state *state;
-       struct drm_modeset_acquire_ctx ctx;
-       struct drm_out_fence_state *fence_state;
-       int ret = 0;
-       unsigned int i, j, num_fences;
-       /* disallow for drivers not supporting atomic: */
-       if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
-               return -EINVAL;
-       /* disallow for userspace that has not enabled atomic cap (even
-        * though this may be a bit overkill, since legacy userspace
-        * wouldn't know how to call this ioctl)
-        */
-       if (!file_priv->atomic)
-               return -EINVAL;
-       if (arg->flags & ~DRM_MODE_ATOMIC_FLAGS)
-               return -EINVAL;
-       if (arg->reserved)
-               return -EINVAL;
-       if ((arg->flags & DRM_MODE_PAGE_FLIP_ASYNC) &&
-                       !dev->mode_config.async_page_flip)
-               return -EINVAL;
-       /* can't test and expect an event at the same time. */
-       if ((arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) &&
-                       (arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
-               return -EINVAL;
-       drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
-       state = drm_atomic_state_alloc(dev);
-       if (!state)
-               return -ENOMEM;
-       state->acquire_ctx = &ctx;
-       state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
- retry:
-       copied_objs = 0;
-       copied_props = 0;
-       fence_state = NULL;
-       num_fences = 0;
-       for (i = 0; i < arg->count_objs; i++) {
-               uint32_t obj_id, count_props;
-               struct drm_mode_object *obj;
-               if (get_user(obj_id, objs_ptr + copied_objs)) {
-                       ret = -EFAULT;
-                       goto out;
-               }
-               obj = drm_mode_object_find(dev, file_priv, obj_id, DRM_MODE_OBJECT_ANY);
-               if (!obj) {
-                       ret = -ENOENT;
-                       goto out;
-               }
-               if (!obj->properties) {
-                       drm_mode_object_put(obj);
-                       ret = -ENOENT;
-                       goto out;
-               }
-               if (get_user(count_props, count_props_ptr + copied_objs)) {
-                       drm_mode_object_put(obj);
-                       ret = -EFAULT;
-                       goto out;
-               }
-               copied_objs++;
-               for (j = 0; j < count_props; j++) {
-                       uint32_t prop_id;
-                       uint64_t prop_value;
-                       struct drm_property *prop;
-                       if (get_user(prop_id, props_ptr + copied_props)) {
-                               drm_mode_object_put(obj);
-                               ret = -EFAULT;
-                               goto out;
-                       }
-                       prop = drm_mode_obj_find_prop_id(obj, prop_id);
-                       if (!prop) {
-                               drm_mode_object_put(obj);
-                               ret = -ENOENT;
-                               goto out;
-                       }
-                       if (copy_from_user(&prop_value,
-                                          prop_values_ptr + copied_props,
-                                          sizeof(prop_value))) {
-                               drm_mode_object_put(obj);
-                               ret = -EFAULT;
-                               goto out;
-                       }
-                       ret = drm_atomic_set_property(state, obj, prop,
-                                                     prop_value);
-                       if (ret) {
-                               drm_mode_object_put(obj);
-                               goto out;
-                       }
-                       copied_props++;
-               }
-               drm_mode_object_put(obj);
-       }
-       ret = prepare_signaling(dev, state, arg, file_priv, &fence_state,
-                               &num_fences);
-       if (ret)
-               goto out;
-       if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) {
-               ret = drm_atomic_check_only(state);
-       } else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
-               ret = drm_atomic_nonblocking_commit(state);
-       } else {
-               if (unlikely(drm_debug & DRM_UT_STATE))
-                       drm_atomic_print_state(state);
-               ret = drm_atomic_commit(state);
-       }
- out:
-       complete_signaling(dev, state, fence_state, num_fences, !ret);
-       if (ret == -EDEADLK) {
-               drm_atomic_state_clear(state);
-               ret = drm_modeset_backoff(&ctx);
-               if (!ret)
-                       goto retry;
-       }
-       drm_atomic_state_put(state);
-       drm_modeset_drop_locks(&ctx);
-       drm_modeset_acquire_fini(&ctx);
-       return ret;
- }
@@@ -27,6 -27,7 +27,7 @@@
  
  #include <drm/drmP.h>
  #include <drm/drm_atomic.h>
+ #include <drm/drm_atomic_uapi.h>
  #include <drm/drm_plane_helper.h>
  #include <drm/drm_crtc_helper.h>
  #include <drm/drm_atomic_helper.h>
@@@ -1408,16 -1409,15 +1409,16 @@@ EXPORT_SYMBOL(drm_atomic_helper_wait_fo
  void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
                                          struct drm_atomic_state *old_state)
  {
 -      struct drm_crtc_state *new_crtc_state;
        struct drm_crtc *crtc;
        int i;
  
 -      for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
 -              struct drm_crtc_commit *commit = new_crtc_state->commit;
 +      for (i = 0; i < dev->mode_config.num_crtc; i++) {
 +              struct drm_crtc_commit *commit = old_state->crtcs[i].commit;
                int ret;
  
 -              if (!commit)
 +              crtc = old_state->crtcs[i].ptr;
 +
 +              if (!crtc || !commit)
                        continue;
  
                ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ);
@@@ -1935,9 -1935,6 +1936,9 @@@ int drm_atomic_helper_setup_commit(stru
                drm_crtc_commit_get(commit);
  
                commit->abort_completion = true;
 +
 +              state->crtcs[i].commit = commit;
 +              drm_crtc_commit_get(commit);
        }
  
        for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {
@@@ -3559,6 -3556,27 +3560,27 @@@ void drm_atomic_helper_crtc_destroy_sta
  EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
  
  /**
+  * __drm_atomic_helper_plane_reset - resets planes state to default values
+  * @plane: plane object, must not be NULL
+  * @state: atomic plane state, must not be NULL
+  *
+  * Initializes plane state to default. This is useful for drivers that subclass
+  * the plane state.
+  */
+ void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
+                                    struct drm_plane_state *state)
+ {
+       state->plane = plane;
+       state->rotation = DRM_MODE_ROTATE_0;
+       state->alpha = DRM_BLEND_ALPHA_OPAQUE;
+       state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+       plane->state = state;
+ }
+ EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
+ /**
   * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for planes
   * @plane: drm plane
   *
@@@ -3572,15 -3590,8 +3594,8 @@@ void drm_atomic_helper_plane_reset(stru
  
        kfree(plane->state);
        plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
-       if (plane->state) {
-               plane->state->plane = plane;
-               plane->state->rotation = DRM_MODE_ROTATE_0;
-               /* Reset the alpha value to fully opaque if it matters */
-               if (plane->alpha_property)
-                       plane->state->alpha = plane->alpha_property->values[1];
-       }
+       if (plane->state)
+               __drm_atomic_helper_plane_reset(plane, plane->state);
  }
  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
  
@@@ -63,27 -63,26 +63,27 @@@ static void drm_client_close(struct drm
  EXPORT_SYMBOL(drm_client_close);
  
  /**
 - * drm_client_new - Create a DRM client
 + * drm_client_init - Initialise a DRM client
   * @dev: DRM device
   * @client: DRM client
   * @name: Client name
   * @funcs: DRM client functions (optional)
   *
 + * This initialises the client and opens a &drm_file. Use drm_client_add() to complete the process.
   * The caller needs to hold a reference on @dev before calling this function.
   * The client is freed when the &drm_device is unregistered. See drm_client_release().
   *
   * Returns:
   * Zero on success or negative error code on failure.
   */
 -int drm_client_new(struct drm_device *dev, struct drm_client_dev *client,
 -                 const char *name, const struct drm_client_funcs *funcs)
 +int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
 +                  const char *name, const struct drm_client_funcs *funcs)
  {
        int ret;
  
        if (!drm_core_check_feature(dev, DRIVER_MODESET) ||
            !dev->driver->dumb_create || !dev->driver->gem_prime_vmap)
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
  
        if (funcs && !try_module_get(funcs->owner))
                return -ENODEV;
        if (ret)
                goto err_put_module;
  
 -      mutex_lock(&dev->clientlist_mutex);
 -      list_add(&client->list, &dev->clientlist);
 -      mutex_unlock(&dev->clientlist_mutex);
 -
        drm_dev_get(dev);
  
        return 0;
@@@ -106,33 -109,13 +106,33 @@@ err_put_module
  
        return ret;
  }
 -EXPORT_SYMBOL(drm_client_new);
 +EXPORT_SYMBOL(drm_client_init);
 +
 +/**
 + * drm_client_add - Add client to the device list
 + * @client: DRM client
 + *
 + * Add the client to the &drm_device client list to activate its callbacks.
 + * @client must be initialized by a call to drm_client_init(). After
 + * drm_client_add() it is no longer permissible to call drm_client_release()
 + * directly (outside the unregister callback), instead cleanup will happen
 + * automatically on driver unload.
 + */
 +void drm_client_add(struct drm_client_dev *client)
 +{
 +      struct drm_device *dev = client->dev;
 +
 +      mutex_lock(&dev->clientlist_mutex);
 +      list_add(&client->list, &dev->clientlist);
 +      mutex_unlock(&dev->clientlist_mutex);
 +}
 +EXPORT_SYMBOL(drm_client_add);
  
  /**
   * drm_client_release - Release DRM client resources
   * @client: DRM client
   *
 - * Releases resources by closing the &drm_file that was opened by drm_client_new().
 + * Releases resources by closing the &drm_file that was opened by drm_client_init().
   * It is called automatically if the &drm_client_funcs.unregister callback is _not_ set.
   *
   * This function should only be called from the unregister callback. An exception
@@@ -34,7 -34,7 +34,7 @@@
  #include <linux/slab.h>
  #include <linux/export.h>
  #include <linux/dma-fence.h>
- #include <drm/drmP.h>
+ #include <linux/uaccess.h>
  #include <drm/drm_crtc.h>
  #include <drm/drm_edid.h>
  #include <drm/drm_fourcc.h>
@@@ -42,6 -42,9 +42,9 @@@
  #include <drm/drm_atomic.h>
  #include <drm/drm_auth.h>
  #include <drm/drm_debugfs_crc.h>
+ #include <drm/drm_drv.h>
+ #include <drm/drm_print.h>
+ #include <drm/drm_file.h>
  
  #include "drm_crtc_internal.h"
  #include "drm_internal.h"
@@@ -402,7 -405,7 +405,7 @@@ int drm_mode_getcrtc(struct drm_device 
        struct drm_plane *plane;
  
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return -EOPNOTSUPP;
  
        crtc = drm_crtc_find(dev, file_priv, crtc_resp->crtc_id);
        if (!crtc)
@@@ -567,9 -570,9 +570,9 @@@ int drm_mode_setcrtc(struct drm_device 
        struct drm_mode_crtc *crtc_req = data;
        struct drm_crtc *crtc;
        struct drm_plane *plane;
 -      struct drm_connector **connector_set = NULL, *connector;
 -      struct drm_framebuffer *fb = NULL;
 -      struct drm_display_mode *mode = NULL;
 +      struct drm_connector **connector_set, *connector;
 +      struct drm_framebuffer *fb;
 +      struct drm_display_mode *mode;
        struct drm_mode_set set;
        uint32_t __user *set_connectors_ptr;
        struct drm_modeset_acquire_ctx ctx;
        int i;
  
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return -EOPNOTSUPP;
  
        /*
         * Universal plane src offsets are only 16.16, prevent havoc for
        mutex_lock(&crtc->dev->mode_config.mutex);
        drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
  retry:
 +      connector_set = NULL;
 +      fb = NULL;
 +      mode = NULL;
 +
        ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
        if (ret)
                goto out;
@@@ -86,14 -86,21 +86,21 @@@ dma_addr_t drm_fb_cma_get_gem_addr(stru
  {
        struct drm_gem_cma_object *obj;
        dma_addr_t paddr;
+       u8 h_div = 1, v_div = 1;
  
        obj = drm_fb_cma_get_gem_obj(fb, plane);
        if (!obj)
                return 0;
  
        paddr = obj->paddr + fb->offsets[plane];
-       paddr += fb->format->cpp[plane] * (state->src_x >> 16);
-       paddr += fb->pitches[plane] * (state->src_y >> 16);
+       if (plane > 0) {
+               h_div = fb->format->hsub;
+               v_div = fb->format->vsub;
+       }
+       paddr += (fb->format->cpp[plane] * (state->src_x >> 16)) / h_div;
+       paddr += (fb->pitches[plane] * (state->src_y >> 16)) / v_div;
  
        return paddr;
  }
@@@ -160,7 -167,7 +167,7 @@@ struct drm_fbdev_cma *drm_fbdev_cma_ini
  
        fb_helper = &fbdev_cma->fb_helper;
  
 -      ret = drm_client_new(dev, &fb_helper->client, "fbdev", NULL);
 +      ret = drm_client_init(dev, &fb_helper->client, "fbdev", NULL);
        if (ret)
                goto err_free;
  
        if (ret)
                goto err_client_put;
  
 +      drm_client_add(&fb_helper->client);
 +
        return fbdev_cma;
  
  err_client_put:
@@@ -221,21 -226,6 +228,6 @@@ void drm_fbdev_cma_hotplug_event(struc
  EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
  
  /**
-  * drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend
-  * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
-  * @state: desired state, zero to resume, non-zero to suspend
-  *
-  * Calls drm_fb_helper_set_suspend, which is a wrapper around
-  * fb_set_suspend implemented by fbdev core.
-  */
- void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
- {
-       if (fbdev_cma)
-               drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
- }
- EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
- /**
   * drm_fbdev_cma_set_suspend_unlocked - wrapper around
   *                                      drm_fb_helper_set_suspend_unlocked
   * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
@@@ -56,6 -56,25 +56,25 @@@ MODULE_PARM_DESC(drm_fbdev_overalloc
                 "Overallocation of the fbdev buffer (%) [default="
                 __MODULE_STRING(CONFIG_DRM_FBDEV_OVERALLOC) "]");
  
+ /*
+  * In order to keep user-space compatibility, we want in certain use-cases
+  * to keep leaking the fbdev physical address to the user-space program
+  * handling the fbdev buffer.
+  * This is a bad habit essentially kept into closed source opengl driver
+  * that should really be moved into open-source upstream projects instead
+  * of using legacy physical addresses in user space to communicate with
+  * other out-of-tree kernel modules.
+  *
+  * This module_param *should* be removed as soon as possible and be
+  * considered as a broken and legacy behaviour from a modern fbdev device.
+  */
+ #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
+ static bool drm_leak_fbdev_smem = false;
+ module_param_unsafe(drm_leak_fbdev_smem, bool, 0600);
+ MODULE_PARM_DESC(fbdev_emulation,
+                "Allow unsafe leaking fbdev physical smem address [default=false]");
+ #endif
  static LIST_HEAD(kernel_fb_helper_list);
  static DEFINE_MUTEX(kernel_fb_helper_lock);
  
@@@ -1580,25 -1599,6 +1599,25 @@@ unlock
  }
  EXPORT_SYMBOL(drm_fb_helper_ioctl);
  
 +static bool drm_fb_pixel_format_equal(const struct fb_var_screeninfo *var_1,
 +                                    const struct fb_var_screeninfo *var_2)
 +{
 +      return var_1->bits_per_pixel == var_2->bits_per_pixel &&
 +             var_1->grayscale == var_2->grayscale &&
 +             var_1->red.offset == var_2->red.offset &&
 +             var_1->red.length == var_2->red.length &&
 +             var_1->red.msb_right == var_2->red.msb_right &&
 +             var_1->green.offset == var_2->green.offset &&
 +             var_1->green.length == var_2->green.length &&
 +             var_1->green.msb_right == var_2->green.msb_right &&
 +             var_1->blue.offset == var_2->blue.offset &&
 +             var_1->blue.length == var_2->blue.length &&
 +             var_1->blue.msb_right == var_2->blue.msb_right &&
 +             var_1->transp.offset == var_2->transp.offset &&
 +             var_1->transp.length == var_2->transp.length &&
 +             var_1->transp.msb_right == var_2->transp.msb_right;
 +}
 +
  /**
   * drm_fb_helper_check_var - implementation for &fb_ops.fb_check_var
   * @var: screeninfo to check
@@@ -1609,6 -1609,7 +1628,6 @@@ int drm_fb_helper_check_var(struct fb_v
  {
        struct drm_fb_helper *fb_helper = info->par;
        struct drm_framebuffer *fb = fb_helper->fb;
 -      int depth;
  
        if (var->pixclock != 0 || in_dbg_master())
                return -EINVAL;
                return -EINVAL;
        }
  
 -      switch (var->bits_per_pixel) {
 -      case 16:
 -              depth = (var->green.length == 6) ? 16 : 15;
 -              break;
 -      case 32:
 -              depth = (var->transp.length > 0) ? 32 : 24;
 -              break;
 -      default:
 -              depth = var->bits_per_pixel;
 -              break;
 -      }
 -
 -      switch (depth) {
 -      case 8:
 -              var->red.offset = 0;
 -              var->green.offset = 0;
 -              var->blue.offset = 0;
 -              var->red.length = 8;
 -              var->green.length = 8;
 -              var->blue.length = 8;
 -              var->transp.length = 0;
 -              var->transp.offset = 0;
 -              break;
 -      case 15:
 -              var->red.offset = 10;
 -              var->green.offset = 5;
 -              var->blue.offset = 0;
 -              var->red.length = 5;
 -              var->green.length = 5;
 -              var->blue.length = 5;
 -              var->transp.length = 1;
 -              var->transp.offset = 15;
 -              break;
 -      case 16:
 -              var->red.offset = 11;
 -              var->green.offset = 5;
 -              var->blue.offset = 0;
 -              var->red.length = 5;
 -              var->green.length = 6;
 -              var->blue.length = 5;
 -              var->transp.length = 0;
 -              var->transp.offset = 0;
 -              break;
 -      case 24:
 -              var->red.offset = 16;
 -              var->green.offset = 8;
 -              var->blue.offset = 0;
 -              var->red.length = 8;
 -              var->green.length = 8;
 -              var->blue.length = 8;
 -              var->transp.length = 0;
 -              var->transp.offset = 0;
 -              break;
 -      case 32:
 -              var->red.offset = 16;
 -              var->green.offset = 8;
 -              var->blue.offset = 0;
 -              var->red.length = 8;
 -              var->green.length = 8;
 -              var->blue.length = 8;
 -              var->transp.length = 8;
 -              var->transp.offset = 24;
 -              break;
 -      default:
 +      /*
 +       * drm fbdev emulation doesn't support changing the pixel format at all,
 +       * so reject all pixel format changing requests.
 +       */
 +      if (!drm_fb_pixel_format_equal(var, &info->var)) {
 +              DRM_DEBUG("fbdev emulation doesn't support changing the pixel format\n");
                return -EINVAL;
        }
 +
        return 0;
  }
  EXPORT_SYMBOL(drm_fb_helper_check_var);
@@@ -2631,6 -2689,12 +2650,12 @@@ __drm_fb_helper_initial_config_and_unlo
  
        info = fb_helper->fbdev;
        info->var.pixclock = 0;
+       /* Shamelessly allow physical address leaking to userspace */
+ #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
+       if (!drm_leak_fbdev_smem)
+ #endif
+               /* don't leak any physical addresses to userspace */
+               info->flags |= FBINFO_HIDE_SMEM_START;
  
        /* Need to drop locks to avoid recursive deadlock in
         * register_framebuffer. This is ok because the only thing left to do is
@@@ -2779,7 -2843,9 +2804,9 @@@ EXPORT_SYMBOL(drm_fb_helper_hotplug_eve
   * The caller must to provide a &drm_fb_helper_funcs->fb_probe callback
   * function.
   *
-  * See also: drm_fb_helper_initial_config()
+  * Use drm_fb_helper_fbdev_teardown() to destroy the fbdev.
+  *
+  * See also: drm_fb_helper_initial_config(), drm_fbdev_generic_setup().
   *
   * Returns:
   * Zero on success or negative error code on failure.
@@@ -2800,7 -2866,7 +2827,7 @@@ int drm_fb_helper_fbdev_setup(struct dr
        if (!max_conn_count)
                max_conn_count = dev->mode_config.num_connector;
        if (!max_conn_count) {
-               DRM_DEV_ERROR(dev->dev, "No connectors\n");
+               DRM_DEV_ERROR(dev->dev, "fbdev: No connectors\n");
                return -EINVAL;
        }
  
  
        ret = drm_fb_helper_init(dev, fb_helper, max_conn_count);
        if (ret < 0) {
-               DRM_DEV_ERROR(dev->dev, "Failed to initialize fbdev helper\n");
+               DRM_DEV_ERROR(dev->dev, "fbdev: Failed to initialize (ret=%d)\n", ret);
                return ret;
        }
  
        ret = drm_fb_helper_single_add_all_connectors(fb_helper);
        if (ret < 0) {
-               DRM_DEV_ERROR(dev->dev, "Failed to add connectors\n");
+               DRM_DEV_ERROR(dev->dev, "fbdev: Failed to add connectors (ret=%d)\n", ret);
                goto err_drm_fb_helper_fini;
        }
  
  
        ret = drm_fb_helper_initial_config(fb_helper, preferred_bpp);
        if (ret < 0) {
-               DRM_DEV_ERROR(dev->dev, "Failed to set fbdev configuration\n");
+               DRM_DEV_ERROR(dev->dev, "fbdev: Failed to set configuration (ret=%d)\n", ret);
                goto err_drm_fb_helper_fini;
        }
  
@@@ -2995,7 -3061,7 +3022,7 @@@ static struct fb_deferred_io drm_fbdev_
   * @fb_helper: fbdev helper structure
   * @sizes: describes fbdev size and scanout surface size
   *
-  * This function uses the client API to crate a framebuffer backed by a dumb buffer.
+  * This function uses the client API to create a framebuffer backed by a dumb buffer.
   *
   * The _sys_ versions are used for &fb_ops.fb_read, fb_write, fb_fillrect,
   * fb_copyarea, fb_imageblit.
@@@ -3038,6 -3104,12 +3065,12 @@@ int drm_fb_helper_generic_probe(struct 
        fbi->screen_size = fb->height * fb->pitches[0];
        fbi->fix.smem_len = fbi->screen_size;
        fbi->screen_buffer = buffer->vaddr;
+       /* Shamelessly leak the physical address to user-space */
+ #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
+       if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0)
+               fbi->fix.smem_start =
+                       page_to_phys(virt_to_page(fbi->screen_buffer));
+ #endif
        strcpy(fbi->fix.id, "DRM emulated");
  
        drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth);
@@@ -3123,8 -3195,10 +3156,10 @@@ static int drm_fbdev_client_hotplug(str
        if (dev->fb_helper)
                return drm_fb_helper_hotplug_event(dev->fb_helper);
  
-       if (!dev->mode_config.num_connector)
+       if (!dev->mode_config.num_connector) {
+               DRM_DEV_DEBUG(dev->dev, "No connectors found, will not create framebuffer!\n");
                return 0;
+       }
  
        ret = drm_fb_helper_fbdev_setup(dev, fb_helper, &drm_fb_helper_generic_funcs,
                                        fb_helper->preferred_bpp, 0);
@@@ -3145,13 -3219,14 +3180,14 @@@ static const struct drm_client_funcs dr
  };
  
  /**
-  * drm_fb_helper_generic_fbdev_setup() - Setup generic fbdev emulation
+  * drm_fbdev_generic_setup() - Setup generic fbdev emulation
   * @dev: DRM device
   * @preferred_bpp: Preferred bits per pixel for the device.
   *                 @dev->mode_config.preferred_depth is used if this is zero.
   *
   * This function sets up generic fbdev emulation for drivers that supports
-  * dumb buffers with a virtual address and that can be mmap'ed.
+  * dumb buffers with a virtual address and that can be mmap'ed. If the driver
+  * does not support these functions, it could use drm_fb_helper_fbdev_setup().
   *
   * Restore, hotplug events and teardown are all taken care of. Drivers that do
   * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
   * This function is safe to call even when there are no connectors present.
   * Setup will be retried on the next hotplug event.
   *
+  * The fbdev is destroyed by drm_dev_unregister().
+  *
   * Returns:
   * Zero on success or negative error code on failure.
   */
@@@ -3172,6 -3249,8 +3210,8 @@@ int drm_fbdev_generic_setup(struct drm_
        struct drm_fb_helper *fb_helper;
        int ret;
  
+       WARN(dev->fb_helper, "fb_helper is already set!\n");
        if (!drm_fbdev_emulation)
                return 0;
  
        if (!fb_helper)
                return -ENOMEM;
  
 -      ret = drm_client_new(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
 +      ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
        if (ret) {
                kfree(fb_helper);
+               DRM_DEV_ERROR(dev->dev, "Failed to register client: %d\n", ret);
                return ret;
        }
  
 +      drm_client_add(&fb_helper->client);
 +
        fb_helper->preferred_bpp = preferred_bpp;
  
-       drm_fbdev_client_hotplug(&fb_helper->client);
+       ret = drm_fbdev_client_hotplug(&fb_helper->client);
+       if (ret)
+               DRM_DEV_DEBUG(dev->dev, "client hotplug ret=%d\n", ret);
  
        return 0;
  }
@@@ -506,7 -506,7 +506,7 @@@ int drm_mode_create_lease_ioctl(struct 
  
        /* Can't lease without MODESET */
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return -EOPNOTSUPP;
  
        /* Do not allow sub-leases */
        if (lessor->lessor)
        lessee_priv->is_master = 1;
        lessee_priv->authenticated = 1;
  
 -      /* Hook up the fd */
 -      fd_install(fd, lessee_file);
 -
        /* Pass fd back to userspace */
        DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id);
        cl->fd = fd;
        cl->lessee_id = lessee->lessee_id;
  
 +      /* Hook up the fd */
 +      fd_install(fd, lessee_file);
 +
        DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");
        return 0;
  
@@@ -615,7 -615,7 +615,7 @@@ int drm_mode_list_lessees_ioctl(struct 
  
        /* Can't lease without MODESET */
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return -EOPNOTSUPP;
  
        DRM_DEBUG_LEASE("List lessees for %d\n", lessor->lessee_id);
  
@@@ -671,7 -671,7 +671,7 @@@ int drm_mode_get_lease_ioctl(struct drm
  
        /* Can't lease without MODESET */
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return -EOPNOTSUPP;
  
        DRM_DEBUG_LEASE("get lease for %d\n", lessee->lessee_id);
  
@@@ -726,7 -726,7 +726,7 @@@ int drm_mode_revoke_lease_ioctl(struct 
  
        /* Can't lease without MODESET */
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return -EOPNOTSUPP;
  
        mutex_lock(&dev->mode_config.idr_mutex);
  
@@@ -802,6 -802,11 +802,11 @@@ void i915_gem_flush_ggtt_writes(struct 
         * that was!).
         */
  
+       wmb();
+       if (INTEL_INFO(dev_priv)->has_coherent_ggtt)
+               return;
        i915_gem_chipset_flush(dev_priv);
  
        intel_runtime_pm_get(dev_priv);
@@@ -1122,11 -1127,7 +1127,7 @@@ i915_gem_shmem_pread(struct drm_i915_ge
        offset = offset_in_page(args->offset);
        for (idx = args->offset >> PAGE_SHIFT; remain; idx++) {
                struct page *page = i915_gem_object_get_page(obj, idx);
-               int length;
-               length = remain;
-               if (offset + length > PAGE_SIZE)
-                       length = PAGE_SIZE - offset;
+               unsigned int length = min_t(u64, remain, PAGE_SIZE - offset);
  
                ret = shmem_pread(page, offset, length, user_data,
                                  page_to_phys(page) & obj_do_bit17_swizzling,
@@@ -1570,11 -1571,7 +1571,7 @@@ i915_gem_shmem_pwrite(struct drm_i915_g
        offset = offset_in_page(args->offset);
        for (idx = args->offset >> PAGE_SHIFT; remain; idx++) {
                struct page *page = i915_gem_object_get_page(obj, idx);
-               int length;
-               length = remain;
-               if (offset + length > PAGE_SIZE)
-                       length = PAGE_SIZE - offset;
+               unsigned int length = min_t(u64, remain, PAGE_SIZE - offset);
  
                ret = shmem_pwrite(page, offset, length, user_data,
                                   page_to_phys(page) & obj_do_bit17_swizzling,
@@@ -1906,7 -1903,7 +1903,7 @@@ i915_gem_mmap_ioctl(struct drm_device *
        return 0;
  }
  
- static unsigned int tile_row_pages(struct drm_i915_gem_object *obj)
+ static unsigned int tile_row_pages(const struct drm_i915_gem_object *obj)
  {
        return i915_gem_object_get_tile_row_size(obj) >> PAGE_SHIFT;
  }
@@@ -1965,7 -1962,7 +1962,7 @@@ int i915_gem_mmap_gtt_version(void
  }
  
  static inline struct i915_ggtt_view
- compute_partial_view(struct drm_i915_gem_object *obj,
+ compute_partial_view(const struct drm_i915_gem_object *obj,
                     pgoff_t page_offset,
                     unsigned int chunk)
  {
@@@ -2013,7 -2010,7 +2010,7 @@@ vm_fault_t i915_gem_fault(struct vm_fau
        struct drm_device *dev = obj->base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct i915_ggtt *ggtt = &dev_priv->ggtt;
-       bool write = !!(vmf->flags & FAULT_FLAG_WRITE);
+       bool write = area->vm_flags & VM_WRITE;
        struct i915_vma *vma;
        pgoff_t page_offset;
        int ret;
@@@ -2501,7 -2498,9 +2498,9 @@@ static bool i915_sg_trim(struct sg_tabl
        new_sg = new_st.sgl;
        for_each_sg(orig_st->sgl, sg, orig_st->nents, i) {
                sg_set_page(new_sg, sg_page(sg), sg->length, 0);
-               /* called before being DMA mapped, no need to copy sg->dma_* */
+               sg_dma_address(new_sg) = sg_dma_address(sg);
+               sg_dma_len(new_sg) = sg_dma_len(sg);
                new_sg = sg_next(new_sg);
        }
        GEM_BUG_ON(new_sg); /* Should walk exactly nents and hit the end */
@@@ -2528,13 -2527,21 +2527,21 @@@ static int i915_gem_object_get_pages_gt
        gfp_t noreclaim;
        int ret;
  
-       /* Assert that the object is not currently in any GPU domain. As it
+       /*
+        * Assert that the object is not currently in any GPU domain. As it
         * wasn't in the GTT, there shouldn't be any way it could have been in
         * a GPU cache
         */
        GEM_BUG_ON(obj->read_domains & I915_GEM_GPU_DOMAINS);
        GEM_BUG_ON(obj->write_domain & I915_GEM_GPU_DOMAINS);
  
+       /*
+        * If there's no chance of allocating enough pages for the whole
+        * object, bail early.
+        */
+       if (page_count > totalram_pages)
+               return -ENOMEM;
        st = kmalloc(sizeof(*st), GFP_KERNEL);
        if (st == NULL)
                return -ENOMEM;
@@@ -2545,7 -2552,8 +2552,8 @@@ rebuild_st
                return -ENOMEM;
        }
  
-       /* Get the list of pages out of our struct file.  They'll be pinned
+       /*
+        * Get the list of pages out of our struct file.  They'll be pinned
         * at this point until we release them.
         *
         * Fail silently without starting the shrinker
                        i915_gem_shrink(dev_priv, 2 * page_count, NULL, *s++);
                        cond_resched();
  
-                       /* We've tried hard to allocate the memory by reaping
+                       /*
+                        * We've tried hard to allocate the memory by reaping
                         * our own buffer, now let the real VM do its job and
                         * go down in flames if truly OOM.
                         *
                                /* reclaim and warn, but no oom */
                                gfp = mapping_gfp_mask(mapping);
  
-                               /* Our bo are always dirty and so we require
+                               /*
+                                * Our bo are always dirty and so we require
                                 * kswapd to reclaim our pages (direct reclaim
                                 * does not effectively begin pageout of our
                                 * buffers on its own). However, direct reclaim
  
        ret = i915_gem_gtt_prepare_pages(obj, st);
        if (ret) {
-               /* DMA remapping failed? One possible cause is that
+               /*
+                * DMA remapping failed? One possible cause is that
                 * it could not reserve enough large entries, asking
                 * for PAGE_SIZE chunks instead may be helpful.
                 */
@@@ -2667,7 -2678,8 +2678,8 @@@ err_pages
        sg_free_table(st);
        kfree(st);
  
-       /* shmemfs first checks if there is enough memory to allocate the page
+       /*
+        * shmemfs first checks if there is enough memory to allocate the page
         * and reports ENOSPC should there be insufficient, along with the usual
         * ENOMEM for a genuine allocation failure.
         *
@@@ -3307,8 -3319,8 +3319,8 @@@ void i915_gem_set_wedged(struct drm_i91
                        intel_engine_dump(engine, &p, "%s\n", engine->name);
        }
  
-       set_bit(I915_WEDGED, &i915->gpu_error.flags);
-       smp_mb__after_atomic();
+       if (test_and_set_bit(I915_WEDGED, &i915->gpu_error.flags))
+               goto out;
  
        /*
         * First, stop submission to hw, but do not yet complete requests by
        i915->caps.scheduler = 0;
  
        /* Even if the GPU reset fails, it should still stop the engines */
-       intel_gpu_reset(i915, ALL_ENGINES);
+       if (INTEL_GEN(i915) >= 5)
+               intel_gpu_reset(i915, ALL_ENGINES);
  
        /*
         * Make sure no one is running the old callback before we proceed with
                i915_gem_reset_finish_engine(engine);
        }
  
+ out:
        GEM_TRACE("end\n");
  
        wake_up_all(&i915->gpu_error.reset_queue);
@@@ -3418,6 -3432,9 +3432,9 @@@ bool i915_gem_unset_wedged(struct drm_i
        i915_retire_requests(i915);
        GEM_BUG_ON(i915->gt.active_requests);
  
+       if (!intel_gpu_reset(i915, ALL_ENGINES))
+               intel_engines_sanitize(i915);
        /*
         * Undo nop_submit_request. We prevent all new i915 requests from
         * being queued (by disallowing execbuf whilst wedged) so having
@@@ -3816,6 -3833,12 +3833,12 @@@ int i915_gem_wait_for_idle(struct drm_i
                        if (timeout < 0)
                                return timeout;
                }
+               if (GEM_SHOW_DEBUG() && !timeout) {
+                       /* Presume that timeout was non-zero to begin with! */
+                       dev_warn(&i915->drm.pdev->dev,
+                                "Missed idle-completion interrupt!\n");
+                       GEM_TRACE_DUMP();
+               }
  
                err = wait_for_engines(i915);
                if (err)
@@@ -5388,8 -5411,19 +5411,19 @@@ static int __intel_engines_record_defau
  
        assert_kernel_context_is_current(i915);
  
+       /*
+        * Immediately park the GPU so that we enable powersaving and
+        * treat it as idle. The next time we issue a request, we will
+        * unpark and start using the engine->pinned_default_state, otherwise
+        * it is in limbo and an early reset may fail.
+        */
+       __i915_gem_park(i915);
        for_each_engine(engine, i915, id) {
                struct i915_vma *state;
+               void *vaddr;
+               GEM_BUG_ON(to_intel_context(ctx, engine)->pin_count);
  
                state = to_intel_context(ctx, engine)->state;
                if (!state)
                        goto err_active;
  
                engine->default_state = i915_gem_object_get(state->obj);
+               /* Check we can acquire the image of the context state */
+               vaddr = i915_gem_object_pin_map(engine->default_state,
+                                               I915_MAP_FORCE_WB);
+               if (IS_ERR(vaddr)) {
+                       err = PTR_ERR(vaddr);
+                       goto err_active;
+               }
+               i915_gem_object_unpin_map(engine->default_state);
        }
  
        if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) {
@@@ -5592,6 -5636,8 +5636,8 @@@ err_uc_misc
                i915_gem_cleanup_userptr(dev_priv);
  
        if (ret == -EIO) {
+               mutex_lock(&dev_priv->drm.struct_mutex);
                /*
                 * Allow engine initialisation to fail by marking the GPU as
                 * wedged. But we only want to do this where the GPU is angry,
                                        "Failed to initialize GPU, declaring it wedged!\n");
                        i915_gem_set_wedged(dev_priv);
                }
-               ret = 0;
+               /* Minimal basic recovery for KMS */
+               ret = i915_ggtt_enable_hw(dev_priv);
+               i915_gem_restore_gtt_mappings(dev_priv);
+               i915_gem_restore_fences(dev_priv);
+               intel_init_clock_gating(dev_priv);
+               mutex_unlock(&dev_priv->drm.struct_mutex);
        }
  
        i915_gem_drain_freed_objects(dev_priv);
  void i915_gem_fini(struct drm_i915_private *dev_priv)
  {
        i915_gem_suspend_late(dev_priv);
+       intel_disable_gt_powersave(dev_priv);
  
        /* Flush any outstanding unpin_work. */
        i915_gem_drain_workqueue(dev_priv);
        i915_gem_contexts_fini(dev_priv);
        mutex_unlock(&dev_priv->drm.struct_mutex);
  
+       intel_cleanup_gt_powersave(dev_priv);
        intel_uc_fini_misc(dev_priv);
        i915_gem_cleanup_userptr(dev_priv);
  
@@@ -5996,8 -6052,7 +6052,8 @@@ i915_gem_object_get_sg(struct drm_i915_
        count = __sg_page_count(sg);
  
        while (idx + count <= n) {
 -              unsigned long exception, i;
 +              void *entry;
 +              unsigned long i;
                int ret;
  
                /* If we cannot allocate and insert this entry, or the
                if (ret && ret != -EEXIST)
                        goto scan;
  
 -              exception =
 -                      RADIX_TREE_EXCEPTIONAL_ENTRY |
 -                      idx << RADIX_TREE_EXCEPTIONAL_SHIFT;
 +              entry = xa_mk_value(idx);
                for (i = 1; i < count; i++) {
 -                      ret = radix_tree_insert(&iter->radix, idx + i,
 -                                              (void *)exception);
 +                      ret = radix_tree_insert(&iter->radix, idx + i, entry);
                        if (ret && ret != -EEXIST)
                                goto scan;
                }
@@@ -6052,14 -6110,15 +6108,14 @@@ lookup
        GEM_BUG_ON(!sg);
  
        /* If this index is in the middle of multi-page sg entry,
 -       * the radixtree will contain an exceptional entry that points
 +       * the radix tree will contain a value entry that points
         * to the start of that range. We will return the pointer to
         * the base page and the offset of this page within the
         * sg entry's range.
         */
        *offset = 0;
 -      if (unlikely(radix_tree_exception(sg))) {
 -              unsigned long base =
 -                      (unsigned long)sg >> RADIX_TREE_EXCEPTIONAL_SHIFT;
 +      if (unlikely(xa_is_value(sg))) {
 +              unsigned long base = xa_to_value(sg);
  
                sg = radix_tree_lookup(&iter->radix, base);
                GEM_BUG_ON(!sg);
@@@ -6179,4 -6238,5 +6235,5 @@@ err_unlock
  #include "selftests/huge_pages.c"
  #include "selftests/i915_gem_object.c"
  #include "selftests/i915_gem_coherency.c"
+ #include "selftests/i915_gem.c"
  #endif
@@@ -232,20 -232,6 +232,20 @@@ static bool compress_init(struct compre
        return true;
  }
  
 +static void *compress_next_page(struct drm_i915_error_object *dst)
 +{
 +      unsigned long page;
 +
 +      if (dst->page_count >= dst->num_pages)
 +              return ERR_PTR(-ENOSPC);
 +
 +      page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN);
 +      if (!page)
 +              return ERR_PTR(-ENOMEM);
 +
 +      return dst->pages[dst->page_count++] = (void *)page;
 +}
 +
  static int compress_page(struct compress *c,
                         void *src,
                         struct drm_i915_error_object *dst)
  
        do {
                if (zstream->avail_out == 0) {
 -                      unsigned long page;
 -
 -                      page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN);
 -                      if (!page)
 -                              return -ENOMEM;
 +                      zstream->next_out = compress_next_page(dst);
 +                      if (IS_ERR(zstream->next_out))
 +                              return PTR_ERR(zstream->next_out);
  
 -                      dst->pages[dst->page_count++] = (void *)page;
 -
 -                      zstream->next_out = (void *)page;
                        zstream->avail_out = PAGE_SIZE;
                }
  
 -              if (zlib_deflate(zstream, Z_SYNC_FLUSH) != Z_OK)
 +              if (zlib_deflate(zstream, Z_NO_FLUSH) != Z_OK)
                        return -EIO;
        } while (zstream->avail_in);
  
        return 0;
  }
  
 -static void compress_fini(struct compress *c,
 +static int compress_flush(struct compress *c,
                          struct drm_i915_error_object *dst)
  {
        struct z_stream_s *zstream = &c->zstream;
  
 -      if (dst) {
 -              zlib_deflate(zstream, Z_FINISH);
 -              dst->unused = zstream->avail_out;
 -      }
 +      do {
 +              switch (zlib_deflate(zstream, Z_FINISH)) {
 +              case Z_OK: /* more space requested */
 +                      zstream->next_out = compress_next_page(dst);
 +                      if (IS_ERR(zstream->next_out))
 +                              return PTR_ERR(zstream->next_out);
 +
 +                      zstream->avail_out = PAGE_SIZE;
 +                      break;
 +
 +              case Z_STREAM_END:
 +                      goto end;
 +
 +              default: /* any error */
 +                      return -EIO;
 +              }
 +      } while (1);
 +
 +end:
 +      memset(zstream->next_out, 0, zstream->avail_out);
 +      dst->unused = zstream->avail_out;
 +      return 0;
 +}
 +
 +static void compress_fini(struct compress *c,
 +                        struct drm_i915_error_object *dst)
 +{
 +      struct z_stream_s *zstream = &c->zstream;
  
        zlib_deflateEnd(zstream);
        kfree(zstream->workspace);
 -
        if (c->tmp)
                free_page((unsigned long)c->tmp);
  }
@@@ -351,12 -319,6 +351,12 @@@ static int compress_page(struct compres
        return 0;
  }
  
 +static int compress_flush(struct compress *c,
 +                        struct drm_i915_error_object *dst)
 +{
 +      return 0;
 +}
 +
  static void compress_fini(struct compress *c,
                          struct drm_i915_error_object *dst)
  {
@@@ -955,7 -917,6 +955,7 @@@ i915_error_object_create(struct drm_i91
        unsigned long num_pages;
        struct sgt_iter iter;
        dma_addr_t dma;
 +      int ret;
  
        if (!vma)
                return NULL;
  
        dst->gtt_offset = vma->node.start;
        dst->gtt_size = vma->node.size;
 +      dst->num_pages = num_pages;
        dst->page_count = 0;
        dst->unused = 0;
  
                return NULL;
        }
  
 +      ret = -EINVAL;
        for_each_sgt_dma(dma, iter, vma->pages) {
                void __iomem *s;
 -              int ret;
  
                ggtt->vm.insert_page(&ggtt->vm, dma, slot, I915_CACHE_NONE, 0);
  
                s = io_mapping_map_atomic_wc(&ggtt->iomap, slot);
                ret = compress_page(&compress, (void  __force *)s, dst);
                io_mapping_unmap_atomic(s);
 -
                if (ret)
 -                      goto unwind;
 +                      break;
        }
 -      goto out;
  
 -unwind:
 -      while (dst->page_count--)
 -              free_page((unsigned long)dst->pages[dst->page_count]);
 -      kfree(dst);
 -      dst = NULL;
 +      if (ret || compress_flush(&compress, dst)) {
 +              while (dst->page_count--)
 +                      free_page((unsigned long)dst->pages[dst->page_count]);
 +              kfree(dst);
 +              dst = NULL;
 +      }
  
 -out:
        compress_fini(&compress, dst);
        ggtt->vm.clear_range(&ggtt->vm, slot, PAGE_SIZE);
        return dst;
@@@ -1403,15 -1365,20 +1403,20 @@@ static void request_record_user_bo(stru
  {
        struct i915_capture_list *c;
        struct drm_i915_error_object **bo;
-       long count;
+       long count, max;
  
-       count = 0;
+       max = 0;
        for (c = request->capture_list; c; c = c->next)
-               count++;
+               max++;
+       if (!max)
+               return;
  
-       bo = NULL;
-       if (count)
-               bo = kcalloc(count, sizeof(*bo), GFP_ATOMIC);
+       bo = kmalloc_array(max, sizeof(*bo), GFP_ATOMIC);
+       if (!bo) {
+               /* If we can't capture everything, try to capture something. */
+               max = min_t(long, max, PAGE_SIZE / sizeof(*bo));
+               bo = kmalloc_array(max, sizeof(*bo), GFP_ATOMIC);
+       }
        if (!bo)
                return;
  
                bo[count] = i915_error_object_create(request->i915, c->vma);
                if (!bo[count])
                        break;
-               count++;
+               if (++count == max)
+                       break;
        }
  
        ee->user_bo = bo;
@@@ -478,7 -478,7 +478,7 @@@ void gen11_reset_rps_interrupts(struct 
  void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv)
  {
        spin_lock_irq(&dev_priv->irq_lock);
-       gen6_reset_pm_iir(dev_priv, dev_priv->pm_rps_events);
+       gen6_reset_pm_iir(dev_priv, GEN6_PM_RPS_EVENTS);
        dev_priv->gt_pm.rps.pm_iir = 0;
        spin_unlock_irq(&dev_priv->irq_lock);
  }
@@@ -516,7 -516,7 +516,7 @@@ void gen6_disable_rps_interrupts(struc
  
        I915_WRITE(GEN6_PMINTRMSK, gen6_sanitize_rps_pm_mask(dev_priv, ~0u));
  
-       gen6_disable_pm_irq(dev_priv, dev_priv->pm_rps_events);
+       gen6_disable_pm_irq(dev_priv, GEN6_PM_RPS_EVENTS);
  
        spin_unlock_irq(&dev_priv->irq_lock);
        synchronize_irq(dev_priv->drm.irq);
@@@ -1534,11 -1534,8 +1534,8 @@@ static void gen8_gt_irq_ack(struct drm_
  
        if (master_ctl & (GEN8_GT_PM_IRQ | GEN8_GT_GUC_IRQ)) {
                gt_iir[2] = raw_reg_read(regs, GEN8_GT_IIR(2));
-               if (likely(gt_iir[2] & (i915->pm_rps_events |
-                                       i915->pm_guc_events)))
-                       raw_reg_write(regs, GEN8_GT_IIR(2),
-                                     gt_iir[2] & (i915->pm_rps_events |
-                                                  i915->pm_guc_events));
+               if (likely(gt_iir[2]))
+                       raw_reg_write(regs, GEN8_GT_IIR(2), gt_iir[2]);
        }
  
        if (master_ctl & GEN8_GT_VECS_IRQ) {
@@@ -3091,27 -3088,36 +3088,27 @@@ gen11_gt_irq_handler(struct drm_i915_pr
        spin_unlock(&i915->irq_lock);
  }
  
 -static void
 -gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl,
 -                    u32 *iir)
 +static u32
 +gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl)
  {
        void __iomem * const regs = dev_priv->regs;
 +      u32 iir;
  
        if (!(master_ctl & GEN11_GU_MISC_IRQ))
 -              return;
 +              return 0;
 +
 +      iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
 +      if (likely(iir))
 +              raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
  
 -      *iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
 -      if (likely(*iir))
 -              raw_reg_write(regs, GEN11_GU_MISC_IIR, *iir);
 +      return iir;
  }
  
  static void
 -gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
 -                        const u32 master_ctl, const u32 iir)
 +gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, const u32 iir)
  {
 -      if (!(master_ctl & GEN11_GU_MISC_IRQ))
 -              return;
 -
 -      if (unlikely(!iir)) {
 -              DRM_ERROR("GU_MISC iir blank!\n");
 -              return;
 -      }
 -
        if (iir & GEN11_GU_MISC_GSE)
                intel_opregion_asle_intr(dev_priv);
 -      else
 -              DRM_ERROR("Unexpected GU_MISC interrupt 0x%x\n", iir);
  }
  
  static irqreturn_t gen11_irq_handler(int irq, void *arg)
                enable_rpm_wakeref_asserts(i915);
        }
  
 -      gen11_gu_misc_irq_ack(i915, master_ctl, &gu_misc_iir);
 +      gu_misc_iir = gen11_gu_misc_irq_ack(i915, master_ctl);
  
        /* Acknowledge and enable interrupts. */
        raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
  
 -      gen11_gu_misc_irq_handler(i915, master_ctl, gu_misc_iir);
 +      gen11_gu_misc_irq_handler(i915, gu_misc_iir);
  
        return IRQ_HANDLED;
  }
@@@ -3209,7 -3215,7 +3206,7 @@@ static void i915_reset_device(struct dr
                kobject_uevent_env(kobj, KOBJ_CHANGE, reset_done_event);
  }
  
static void i915_clear_error_registers(struct drm_i915_private *dev_priv)
+ void i915_clear_error_registers(struct drm_i915_private *dev_priv)
  {
        u32 eir;
  
                I915_WRITE(EMR, I915_READ(EMR) | eir);
                I915_WRITE(IIR, I915_MASTER_ERROR_INTERRUPT);
        }
+       if (INTEL_GEN(dev_priv) >= 8) {
+               I915_WRITE(GEN8_RING_FAULT_REG,
+                          I915_READ(GEN8_RING_FAULT_REG) & ~RING_FAULT_VALID);
+               POSTING_READ(GEN8_RING_FAULT_REG);
+       } else if (INTEL_GEN(dev_priv) >= 6) {
+               struct intel_engine_cs *engine;
+               enum intel_engine_id id;
+               for_each_engine(engine, dev_priv, id) {
+                       I915_WRITE(RING_FAULT_REG(engine),
+                                  I915_READ(RING_FAULT_REG(engine)) &
+                                  ~RING_FAULT_VALID);
+               }
+               POSTING_READ(RING_FAULT_REG(dev_priv->engine[RCS]));
+       }
  }
  
  /**
@@@ -3287,7 -3309,8 +3300,8 @@@ void i915_handle_error(struct drm_i915_
         * Try engine reset when available. We fall back to full reset if
         * single reset fails.
         */
-       if (intel_has_reset_engine(dev_priv)) {
+       if (intel_has_reset_engine(dev_priv) &&
+           !i915_terminally_wedged(&dev_priv->gpu_error)) {
                for_each_engine_masked(engine, dev_priv, engine_mask, tmp) {
                        BUILD_BUG_ON(I915_RESET_MODESET >= I915_RESET_ENGINE);
                        if (test_and_set_bit(I915_RESET_ENGINE + engine->id,
@@@ -4772,7 -4795,9 +4786,9 @@@ void intel_irq_init(struct drm_i915_pri
                /* WaGsvRC0ResidencyMethod:vlv */
                dev_priv->pm_rps_events = GEN6_PM_RP_UP_EI_EXPIRED;
        else
-               dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
+               dev_priv->pm_rps_events = (GEN6_PM_RP_UP_THRESHOLD |
+                                          GEN6_PM_RP_DOWN_THRESHOLD |
+                                          GEN6_PM_RP_DOWN_TIMEOUT);
  
        rps->pm_intrmsk_mbz = 0;
  
@@@ -233,6 -233,7 +233,7 @@@ static void mtk_hdmi_hw_vid_black(struc
  static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
  {
        struct arm_smccc_res res;
+       struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
  
        /*
         * MT8173 HDMI hardware has an output control bit to enable/disable HDMI
         * The ARM trusted firmware provides an API for the HDMI driver to set
         * this control bit to enable HDMI output in supervisor mode.
         */
-       arm_smccc_smc(MTK_SIP_SET_AUTHORIZED_SECURE_REG, 0x14000904, 0x80000000,
-                     0, 0, 0, 0, 0, &res);
+       if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
+               regmap_update_bits(hdmi->sys_regmap,
+                                  hdmi->sys_offset + HDMI_SYS_CFG20,
+                                  0x80008005, enable ? 0x80000005 : 0x8000);
+       else
+               arm_smccc_smc(MTK_SIP_SET_AUTHORIZED_SECURE_REG, 0x14000904,
+                             0x80000000, 0, 0, 0, 0, 0, &res);
  
        regmap_update_bits(hdmi->sys_regmap, hdmi->sys_offset + HDMI_SYS_CFG20,
                           HDMI_PCLK_FREE_RUN, enable ? HDMI_PCLK_FREE_RUN : 0);
@@@ -1446,7 -1452,8 +1452,7 @@@ static int mtk_hdmi_dt_parse_pdata(stru
        }
  
        /* The CEC module handles HDMI hotplug detection */
 -      cec_np = of_find_compatible_node(np->parent, NULL,
 -                                       "mediatek,mt8173-cec");
 +      cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
        if (!cec_np) {
                dev_err(dev, "Failed to find CEC node\n");
                return -EINVAL;
        if (!cec_pdev) {
                dev_err(hdmi->dev, "Waiting for CEC device %pOF\n",
                        cec_np);
 +              of_node_put(cec_np);
                return -EPROBE_DEFER;
        }
 +      of_node_put(cec_np);
        hdmi->cec_dev = &cec_pdev->dev;
  
        /*
@@@ -1576,6 -1581,11 +1582,11 @@@ static int mtk_hdmi_audio_hw_params(str
                hdmi_params.aud_i2s_fmt = HDMI_I2S_MODE_I2S_24BIT;
                hdmi_params.aud_mclk = HDMI_AUD_MCLK_128FS;
                break;
+       case HDMI_SPDIF:
+               hdmi_params.aud_codec = HDMI_AUDIO_CODING_TYPE_PCM;
+               hdmi_params.aud_sampe_size = HDMI_AUDIO_SAMPLE_SIZE_16;
+               hdmi_params.aud_input_type = HDMI_AUD_INPUT_SPDIF;
+               break;
        default:
                dev_err(hdmi->dev, "%s: Invalid DAI format %d\n", __func__,
                        daifmt->fmt);
@@@ -36,6 -36,7 +36,7 @@@
  #include <drm/drm_dp_helper.h>
  #include <drm/drm_fb_helper.h>
  #include <drm/drm_plane_helper.h>
+ #include <drm/drm_scdc_helper.h>
  #include <drm/drm_edid.h>
  
  #include <nvif/class.h>
@@@ -531,6 -532,7 +532,7 @@@ nv50_hdmi_disable(struct drm_encoder *e
  static void
  nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
  {
+       struct nouveau_drm *drm = nouveau_drm(encoder->dev);
        struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
        struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
        struct nv50_disp *disp = nv50_disp(encoder->dev);
                .pwr.rekey = 56, /* binary driver, and tegra, constant */
        };
        struct nouveau_connector *nv_connector;
+       struct drm_hdmi_info *hdmi;
        u32 max_ac_packet;
        union hdmi_infoframe avi_frame;
        union hdmi_infoframe vendor_frame;
+       bool scdc_supported, high_tmds_clock_ratio = false, scrambling = false;
+       u8 config;
        int ret;
        int size;
  
        if (!drm_detect_hdmi_monitor(nv_connector->edid))
                return;
  
+       hdmi = &nv_connector->base.display_info.hdmi;
+       scdc_supported = hdmi->scdc.supported;
        ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode,
-                                                      false);
+                                                      scdc_supported);
        if (!ret) {
                /* We have an AVI InfoFrame, populate it to the display */
                args.pwr.avi_infoframe_length
        max_ac_packet -= 18; /* constant from tegra */
        args.pwr.max_ac_packet = max_ac_packet / 32;
  
+       if (hdmi->scdc.scrambling.supported) {
+               high_tmds_clock_ratio = mode->clock > 340000;
+               scrambling = high_tmds_clock_ratio ||
+                       hdmi->scdc.scrambling.low_rates;
+       }
+       args.pwr.scdc =
+               NV50_DISP_SOR_HDMI_PWR_V0_SCDC_SCRAMBLE * scrambling |
+               NV50_DISP_SOR_HDMI_PWR_V0_SCDC_DIV_BY_4 * high_tmds_clock_ratio;
        size = sizeof(args.base)
                + sizeof(args.pwr)
                + args.pwr.avi_infoframe_length
                + args.pwr.vendor_infoframe_length;
        nvif_mthd(&disp->disp->object, 0, &args, size);
        nv50_audio_enable(encoder, mode);
+       /* If SCDC is supported by the downstream monitor, update
+        * divider / scrambling settings to what we programmed above.
+        */
+       if (!hdmi->scdc.scrambling.supported)
+               return;
+       ret = drm_scdc_readb(nv_encoder->i2c, SCDC_TMDS_CONFIG, &config);
+       if (ret < 0) {
+               NV_ERROR(drm, "Failure to read SCDC_TMDS_CONFIG: %d\n", ret);
+               return;
+       }
+       config &= ~(SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 | SCDC_SCRAMBLING_ENABLE);
+       config |= SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 * high_tmds_clock_ratio;
+       config |= SCDC_SCRAMBLING_ENABLE * scrambling;
+       ret = drm_scdc_writeb(nv_encoder->i2c, SCDC_TMDS_CONFIG, config);
+       if (ret < 0)
+               NV_ERROR(drm, "Failure to write SCDC_TMDS_CONFIG = 0x%02x: %d\n",
+                        config, ret);
  }
  
  /******************************************************************************
@@@ -900,22 -938,9 +938,22 @@@ static enum drm_connector_statu
  nv50_mstc_detect(struct drm_connector *connector, bool force)
  {
        struct nv50_mstc *mstc = nv50_mstc(connector);
 +      enum drm_connector_status conn_status;
 +      int ret;
 +
        if (!mstc->port)
                return connector_status_disconnected;
 -      return drm_dp_mst_detect_port(connector, mstc->port->mgr, mstc->port);
 +
 +      ret = pm_runtime_get_sync(connector->dev->dev);
 +      if (ret < 0 && ret != -EACCES)
 +              return connector_status_disconnected;
 +
 +      conn_status = drm_dp_mst_detect_port(connector, mstc->port->mgr,
 +                                           mstc->port);
 +
 +      pm_runtime_mark_last_busy(connector->dev->dev);
 +      pm_runtime_put_autosuspend(connector->dev->dev);
 +      return conn_status;
  }
  
  static void
@@@ -2218,7 -2243,7 +2256,7 @@@ nv50_display_create(struct drm_device *
        nouveau_display(dev)->fini = nv50_display_fini;
        disp->disp = &nouveau_display(dev)->disp;
        dev->mode_config.funcs = &nv50_disp_func;
-       dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
+       dev->mode_config.quirk_addfb_prefer_xbgr_30bpp = true;
  
        /* small shared memory area we use for notifiers and semaphores */
        ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM,
diff --combined include/drm/drm_atomic.h
@@@ -29,6 -29,7 +29,7 @@@
  #define DRM_ATOMIC_H_
  
  #include <drm/drm_crtc.h>
+ #include <drm/drm_util.h>
  
  /**
   * struct drm_crtc_commit - track modeset commits on a CRTC
@@@ -153,17 -154,6 +154,17 @@@ struct __drm_planes_state 
  struct __drm_crtcs_state {
        struct drm_crtc *ptr;
        struct drm_crtc_state *state, *old_state, *new_state;
 +
 +      /**
 +       * @commit:
 +       *
 +       * A reference to the CRTC commit object that is kept for use by
 +       * drm_atomic_helper_wait_for_flip_done() after
 +       * drm_atomic_helper_commit_hw_done() is called. This ensures that a
 +       * concurrent commit won't free a commit object that is still in use.
 +       */
 +      struct drm_crtc_commit *commit;
 +
        s32 __user *out_fence_ptr;
        u64 last_vblank_count;
  };
@@@ -384,9 -374,6 +385,6 @@@ void drm_atomic_state_default_release(s
  struct drm_crtc_state * __must_check
  drm_atomic_get_crtc_state(struct drm_atomic_state *state,
                          struct drm_crtc *crtc);
- int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
-               struct drm_crtc_state *state, struct drm_property *property,
-               uint64_t val);
  struct drm_plane_state * __must_check
  drm_atomic_get_plane_state(struct drm_atomic_state *state,
                           struct drm_plane *plane);
@@@ -598,25 -585,6 +596,6 @@@ __drm_atomic_get_current_plane_state(st
  }
  
  int __must_check
- drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
-                            const struct drm_display_mode *mode);
- int __must_check
- drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
-                                 struct drm_property_blob *blob);
- int __must_check
- drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
-                             struct drm_crtc *crtc);
- void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
-                                struct drm_framebuffer *fb);
- void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
-                                   struct dma_fence *fence);
- int __must_check
- drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
-                                 struct drm_crtc *crtc);
- int drm_atomic_set_writeback_fb_for_connector(
-               struct drm_connector_state *conn_state,
-               struct drm_framebuffer *fb);
- int __must_check
  drm_atomic_add_affected_connectors(struct drm_atomic_state *state,
                                   struct drm_crtc *crtc);
  int __must_check