Merge tag 'iommu-updates-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Sep 2021 17:44:35 +0000 (10:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Sep 2021 17:44:35 +0000 (10:44 -0700)
Pull iommu updates from Joerg Roedel:

 - New DART IOMMU driver for Apple Silicon M1 chips

 - Optimizations for iommu_[map/unmap] performance

 - Selective TLB flush support for the AMD IOMMU driver to make it more
   efficient on emulated IOMMUs

 - Rework IOVA setup and default domain type setting to move more code
   out of IOMMU drivers and to support runtime switching between certain
   types of default domains

 - VT-d Updates from Lu Baolu:
      - Update the virtual command related registers
      - Enable Intel IOMMU scalable mode by default
      - Preset A/D bits for user space DMA usage
      - Allow devices to have more than 32 outstanding PRs
      - Various cleanups

 - ARM SMMU Updates from Will Deacon:
      SMMUv3:
       - Minor optimisation to avoid zeroing struct members on CMD submission
       - Increased use of batched commands to reduce submission latency
       - Refactoring in preparation for ECMDQ support
      SMMUv2:
       - Fix races when probing devices with identical StreamIDs
       - Optimise walk cache flushing for Qualcomm implementations
       - Allow deep sleep states for some Qualcomm SoCs with shared clocks

 - Various smaller optimizations, cleanups, and fixes

* tag 'iommu-updates-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (85 commits)
  iommu/io-pgtable: Abstract iommu_iotlb_gather access
  iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
  iommu/vt-d: Add present bit check in pasid entry setup helpers
  iommu/vt-d: Use pasid_pte_is_present() helper function
  iommu/vt-d: Drop the kernel doc annotation
  iommu/vt-d: Allow devices to have more than 32 outstanding PRs
  iommu/vt-d: Preset A/D bits for user space DMA usage
  iommu/vt-d: Enable Intel IOMMU scalable mode by default
  iommu/vt-d: Refactor Kconfig a bit
  iommu/vt-d: Remove unnecessary oom message
  iommu/vt-d: Update the virtual command related registers
  iommu: Allow enabling non-strict mode dynamically
  iommu: Merge strictness and domain type configs
  iommu: Only log strictness for DMA domains
  iommu: Expose DMA domain strictness via sysfs
  iommu: Express DMA strictness via the domain type
  iommu/vt-d: Prepare for multiple DMA domain types
  iommu/arm-smmu: Prepare for multiple DMA domain types
  iommu/amd: Prepare for multiple DMA domain types
  iommu: Introduce explicit type for non-strict DMA domains
  ...

1  2 
Documentation/admin-guide/kernel-parameters.txt
MAINTAINERS
drivers/iommu/Kconfig
drivers/iommu/dma-iommu.c
drivers/iommu/iommu.c
include/linux/iommu.h

                        do not want to use tracing_snapshot_alloc() as it needs
                        to be done where GFP_KERNEL allocations are allowed.
  
 +      allow_mismatched_32bit_el0 [ARM64]
 +                      Allow execve() of 32-bit applications and setting of the
 +                      PER_LINUX32 personality on systems where only a strict
 +                      subset of the CPUs support 32-bit EL0. When this
 +                      parameter is present, the set of CPUs supporting 32-bit
 +                      EL0 is indicated by /sys/devices/system/cpu/aarch32_el0
 +                      and hot-unplug operations may be restricted.
 +
 +                      See Documentation/arm64/asymmetric-32bit.rst for more
 +                      information.
 +
        amd_iommu=      [HW,X86-64]
                        Pass parameters to the AMD IOMMU driver in the system.
                        Possible values are:
-                       fullflush - enable flushing of IO/TLB entries when
-                                   they are unmapped. Otherwise they are
-                                   flushed before they will be reused, which
-                                   is a lot of faster
+                       fullflush - Deprecated, equivalent to iommu.strict=1
                        off       - do not initialize any AMD IOMMU found in
                                    the system
                        force_isolation - Force device isolation for all
        arm64.nopauth   [ARM64] Unconditionally disable Pointer Authentication
                        support
  
 +      arm64.nomte     [ARM64] Unconditionally disable Memory Tagging Extension
 +                      support
 +
        ataflop=        [HW,M68k]
  
        atarimouse=     [HW,MOUSE] Atari Mouse
                        this case, gfx device will use physical address for
                        DMA.
                strict [Default Off]
-                       With this option on every unmap_single operation will
-                       result in a hardware IOTLB flush operation as opposed
-                       to batching them for performance.
+                       Deprecated, equivalent to iommu.strict=1.
                sp_off [Default Off]
                        By default, super page will be supported if Intel IOMMU
                        has the capability. With this option, super page will
                        not be supported.
-               sm_on [Default Off]
-                       By default, scalable mode will be disabled even if the
-                       hardware advertises that it has support for the scalable
-                       mode translation. With this option set, scalable mode
-                       will be used on hardware which claims to support it.
+               sm_on
+                       Enable the Intel IOMMU scalable mode if the hardware
+                       advertises that it has support for the scalable mode
+                       translation.
+               sm_off
+                       Disallow use of the Intel IOMMU scalable mode.
                tboot_noforce [Default Off]
                        Do not force the Intel IOMMU enabled under tboot.
                        By default, tboot will force Intel IOMMU on, which
                          throughput at the cost of reduced device isolation.
                          Will fall back to strict mode if not supported by
                          the relevant IOMMU driver.
-                       1 - Strict mode (default).
+                       1 - Strict mode.
                          DMA unmap operations invalidate IOMMU hardware TLBs
                          synchronously.
-                       Note: on x86, the default behaviour depends on the
-                       equivalent driver-specific parameters, but a strict
-                       mode explicitly specified by either method takes
-                       precedence.
+                       unset - Use value of CONFIG_IOMMU_DEFAULT_DMA_{LAZY,STRICT}.
+                       Note: on x86, strict mode specified via one of the
+                       legacy driver-specific options takes precedence.
  
        iommu.passthrough=
                        [ARM64, X86] Configure DMA to bypass the IOMMU by default.
                        feature (tagged TLBs) on capable Intel chips.
                        Default is 1 (enabled)
  
 +      l1d_flush=      [X86,INTEL]
 +                      Control mitigation for L1D based snooping vulnerability.
 +
 +                      Certain CPUs are vulnerable to an exploit against CPU
 +                      internal buffers which can forward information to a
 +                      disclosure gadget under certain conditions.
 +
 +                      In vulnerable processors, the speculatively
 +                      forwarded data can be used in a cache side channel
 +                      attack, to access data to which the attacker does
 +                      not have direct access.
 +
 +                      This parameter controls the mitigation. The
 +                      options are:
 +
 +                      on         - enable the interface for the mitigation
 +
        l1tf=           [X86] Control mitigation of the L1TF vulnerability on
                              affected CPUs
  
                        Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
                        default: disabled
  
 +      printk.console_no_auto_verbose=
 +                      Disable console loglevel raise on oops, panic
 +                      or lockdep-detected issues (only if lock debug is on).
 +                      With an exception to setups with low baudrate on
 +                      serial console, keeping this 0 is a good choice
 +                      in order to provide more debug information.
 +                      Format: <bool>
 +                      default: 0 (auto_verbose is enabled)
 +
        printk.devkmsg={on,off,ratelimit}
                        Control writing to /dev/kmsg.
                        on - unlimited logging to /dev/kmsg from userspace
  
        reboot=         [KNL]
                        Format (x86 or x86_64):
 -                              [w[arm] | c[old] | h[ard] | s[oft] | g[pio]] \
 +                              [w[arm] | c[old] | h[ard] | s[oft] | g[pio]] | d[efault] \
                                [[,]s[mp]#### \
                                [[,]b[ios] | a[cpi] | k[bd] | t[riple] | e[fi] | p[ci]] \
                                [[,]f[orce]
        sa1100ir        [NET]
                        See drivers/net/irda/sa1100_ir.c.
  
 -      sbni=           [NET] Granch SBNI12 leased line adapter
 -
        sched_verbose   [KNL] Enables verbose scheduler debug messages.
  
        schedstats=     [KNL,X86] Enable or disable scheduled statistics.
diff --combined MAINTAINERS
@@@ -459,12 -459,6 +459,12 @@@ S:       Maintaine
  W:    https://parisc.wiki.kernel.org/index.php/AD1889
  F:    sound/pci/ad1889.*
  
 +AD5110 ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER
 +M:    Mugilraj Dhavachelvan <dmugil2000@gmail.com>
 +L:    linux-iio@vger.kernel.org
 +S:    Supported
 +F:    drivers/iio/potentiometer/ad5110.c
 +
  AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER
  M:    Michael Hennerich <michael.hennerich@analog.com>
  S:    Supported
@@@ -798,7 -792,7 +798,7 @@@ F: Documentation/devicetree/bindings/i2
  F:    drivers/i2c/busses/i2c-altera.c
  
  ALTERA MAILBOX DRIVER
 -M:    Ley Foon Tan <ley.foon.tan@intel.com>
 +M:    Joyce Ooi <joyce.ooi@intel.com>
  S:    Maintained
  F:    drivers/mailbox/mailbox-altera.c
  
@@@ -1268,6 -1262,13 +1268,13 @@@ L:    linux-input@vger.kernel.or
  S:    Odd fixes
  F:    drivers/input/mouse/bcm5974.c
  
+ APPLE DART IOMMU DRIVER
+ M:    Sven Peter <sven@svenpeter.dev>
+ L:    iommu@lists.linux-foundation.org
+ S:    Maintained
+ F:    Documentation/devicetree/bindings/iommu/apple,dart.yaml
+ F:    drivers/iommu/apple-dart.c
  APPLE SMC DRIVER
  M:    Henrik Rydberg <rydberg@bitmath.org>
  L:    linux-hwmon@vger.kernel.org
@@@ -1322,13 -1323,6 +1329,13 @@@ L:    linux-media@vger.kernel.or
  S:    Maintained
  F:    drivers/media/i2c/aptina-pll.*
  
 +AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER
 +M:    Aleksa Savic <savicaleksa83@gmail.com>
 +L:    linux-hwmon@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/hwmon/aquacomputer_d5next.rst
 +F:    drivers/hwmon/aquacomputer_d5next.c
 +
  AQUANTIA ETHERNET DRIVER (atlantic)
  M:    Igor Russkikh <irusskikh@marvell.com>
  L:    netdev@vger.kernel.org
@@@ -1395,7 -1389,7 +1402,7 @@@ F:      Documentation/devicetree/bindings/ar
  F:    Documentation/devicetree/bindings/arm/arm,realview.yaml
  F:    Documentation/devicetree/bindings/arm/arm,versatile.yaml
  F:    Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml
 -F:    Documentation/devicetree/bindings/auxdisplay/arm-charlcd.txt
 +F:    Documentation/devicetree/bindings/auxdisplay/arm,versatile-lcd.yaml
  F:    Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
  F:    Documentation/devicetree/bindings/i2c/i2c-versatile.txt
  F:    Documentation/devicetree/bindings/interrupt-controller/arm,versatile-fpga-irq.txt
@@@ -1501,7 -1495,7 +1508,7 @@@ M:      Miquel Raynal <miquel.raynal@bootlin
  M:    Naga Sureshkumar Relli <nagasure@xilinx.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/mtd/arm,pl353-smc.yaml
 +F:    Documentation/devicetree/bindings/memory-controllers/arm,pl353-smc.yaml
  F:    drivers/memory/pl353-smc.c
  
  ARM PRIMECELL CLCD PL110 DRIVER
@@@ -1703,7 -1697,7 +1710,7 @@@ L:      linux-arm-kernel@lists.infradead.or
  S:    Maintained
  W:    https://asahilinux.org
  B:    https://github.com/AsahiLinux/linux/issues
 -C:    irc://chat.freenode.net/asahi-dev
 +C:    irc://irc.oftc.net/asahi-dev
  T:    git https://github.com/AsahiLinux/linux.git
  F:    Documentation/devicetree/bindings/arm/apple.yaml
  F:    Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
@@@ -2023,12 -2017,10 +2030,12 @@@ M:   Krzysztof Halasa <khalasa@piap.pl
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
 +F:    Documentation/devicetree/bindings/bus/intel,ixp4xx-expansion-bus-controller.yaml
  F:    Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
  F:    Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
  F:    Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
  F:    arch/arm/mach-ixp4xx/
 +F:    drivers/bus/intel-ixp4xx-eb.c
  F:    drivers/clocksource/timer-ixp4xx.c
  F:    drivers/crypto/ixp4xx_crypto.c
  F:    drivers/gpio/gpio-ixp4xx.c
@@@ -2857,7 -2849,7 +2864,7 @@@ AS3645A LED FLASH CONTROLLER DRIVE
  M:    Sakari Ailus <sakari.ailus@iki.fi>
  L:    linux-leds@vger.kernel.org
  S:    Maintained
 -F:    drivers/leds/leds-as3645a.c
 +F:    drivers/leds/flash/leds-as3645a.c
  
  ASAHI KASEI AK7375 LENS VOICE COIL DRIVER
  M:    Tianshu Qiu <tian.shu.qiu@intel.com>
@@@ -3212,7 -3204,7 +3219,7 @@@ S:      Maintaine
  W:    https://www.open-mesh.org/
  Q:    https://patchwork.open-mesh.org/project/batman/list/
  B:    https://www.open-mesh.org/projects/batman-adv/issues
 -C:    irc://chat.freenode.net/batman
 +C:    ircs://irc.hackint.org/batadv
  T:    git https://git.open-mesh.org/linux-merge.git
  F:    Documentation/networking/batman-adv.rst
  F:    include/uapi/linux/batadv_packet.h
@@@ -3424,6 -3416,7 +3431,6 @@@ F:      drivers/net/ethernet/netronome/nfp/b
  
  BPF JIT for POWERPC (32-BIT AND 64-BIT)
  M:    Naveen N. Rao <naveen.n.rao@linux.ibm.com>
 -M:    Sandipan Das <sandipan@linux.ibm.com>
  L:    netdev@vger.kernel.org
  L:    bpf@vger.kernel.org
  S:    Maintained
@@@ -3869,7 -3862,7 +3876,7 @@@ M:      Markus Mayer <mmayer@broadcom.com
  M:    bcm-kernel-feedback-list@broadcom.com
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.txt
 +F:    Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml
  F:    drivers/memory/brcmstb_dpfe.c
  
  BROADCOM STB NAND FLASH DRIVER
@@@ -3880,16 -3873,6 +3887,16 @@@ L:    bcm-kernel-feedback-list@broadcom.co
  S:    Maintained
  F:    drivers/mtd/nand/raw/brcmnand/
  
 +BROADCOM STB PCIE DRIVER
 +M:    Jim Quinlan <jim2101024@gmail.com>
 +M:    Nicolas Saenz Julienne <nsaenz@kernel.org>
 +M:    Florian Fainelli <f.fainelli@gmail.com>
 +M:    bcm-kernel-feedback-list@broadcom.com
 +L:    linux-pci@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
 +F:    drivers/pci/controller/pcie-brcmstb.c
 +
  BROADCOM SYSTEMPORT ETHERNET DRIVER
  M:    Florian Fainelli <f.fainelli@gmail.com>
  L:    bcm-kernel-feedback-list@broadcom.com
@@@ -4522,7 -4505,7 +4529,7 @@@ L:      clang-built-linux@googlegroups.co
  S:    Supported
  W:    https://clangbuiltlinux.github.io/
  B:    https://github.com/ClangBuiltLinux/linux/issues
 -C:    irc://chat.freenode.net/clangbuiltlinux
 +C:    irc://irc.libera.chat/clangbuiltlinux
  F:    Documentation/kbuild/llvm.rst
  F:    include/linux/compiler-clang.h
  F:    scripts/clang-tools/
@@@ -4634,7 -4617,7 +4641,7 @@@ F:      include/linux/clk
  F:    include/linux/of_clk.h
  X:    drivers/clk/clkdev.c
  
 -COMMON INTERNET FILE SYSTEM (CIFS)
 +COMMON INTERNET FILE SYSTEM CLIENT (CIFS)
  M:    Steve French <sfrench@samba.org>
  L:    linux-cifs@vger.kernel.org
  L:    samba-technical@lists.samba.org (moderated for non-subscribers)
@@@ -4643,7 -4626,6 +4650,7 @@@ W:      http://linux-cifs.samba.org
  T:    git git://git.samba.org/sfrench/cifs-2.6.git
  F:    Documentation/admin-guide/cifs/
  F:    fs/cifs/
 +F:    fs/cifs_common/
  
  COMPACTPCI HOTPLUG CORE
  M:    Scott Murray <scott@spiteful.org>
@@@ -5595,7 -5577,7 +5602,7 @@@ M:      Lukasz Luba <lukasz.luba@arm.com
  L:    linux-pm@vger.kernel.org
  L:    linux-samsung-soc@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/memory-controllers/exynos5422-dmc.txt
 +F:    Documentation/devicetree/bindings/memory-controllers/samsung,exynos5422-dmc.yaml
  F:    drivers/memory/samsung/exynos5422-dmc.c
  
  DME1737 HARDWARE MONITOR DRIVER
@@@ -5709,7 -5691,6 +5716,7 @@@ DPAA2 ETHERNET SWITCH DRIVE
  M:    Ioana Ciornei <ioana.ciornei@nxp.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
 +F:    Documentation/networking/device_drivers/ethernet/freescale/dpaa2/switch-driver.rst
  F:    drivers/net/ethernet/freescale/dpaa2/dpaa2-switch*
  F:    drivers/net/ethernet/freescale/dpaa2/dpsw*
  
@@@ -5733,11 -5714,6 +5740,11 @@@ F:    Documentation/admin-guide/blockdev
  F:    drivers/block/drbd/
  F:    lib/lru_cache.c
  
 +DRIVER COMPONENT FRAMEWORK
 +L:    dri-devel@lists.freedesktop.org
 +F:    drivers/base/component.c
 +F:    include/linux/component.h
 +
  DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  R:    "Rafael J. Wysocki" <rafael@kernel.org>
@@@ -5801,7 -5777,7 +5808,7 @@@ M:      Gerd Hoffmann <kraxel@redhat.com
  L:    virtualization@lists.linux-foundation.org
  S:    Maintained
  T:    git git://anongit.freedesktop.org/drm/drm-misc
 -F:    drivers/gpu/drm/bochs/
 +F:    drivers/gpu/drm/tiny/bochs.c
  
  DRM DRIVER FOR BOE HIMAX8279D PANELS
  M:    Jerry Han <hanxu5@huaqin.corp-partner.google.com>
@@@ -5986,13 -5962,6 +5993,13 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml
  F:    drivers/gpu/drm/panel/panel-raydium-rm67191.c
  
 +DRM DRIVER FOR SAMSUNG DB7430 PANELS
 +M:    Linus Walleij <linus.walleij@linaro.org>
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
 +F:    drivers/gpu/drm/panel/panel-samsung-db7430.c
 +
  DRM DRIVER FOR SITRONIX ST7703 PANELS
  M:    Guido Günther <agx@sigxcpu.org>
  R:    Purism Kernel Team <kernel@puri.sm>
@@@ -6091,27 -6060,21 +6098,27 @@@ F:   drivers/gpu/drm/vboxvideo
  
  DRM DRIVER FOR VMWARE VIRTUAL GPU
  M:    "VMware Graphics" <linux-graphics-maintainer@vmware.com>
 -M:    Roland Scheidegger <sroland@vmware.com>
  M:    Zack Rusin <zackr@vmware.com>
  L:    dri-devel@lists.freedesktop.org
  S:    Supported
 -T:    git git://people.freedesktop.org/~sroland/linux
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
  F:    drivers/gpu/drm/vmwgfx/
  F:    include/uapi/drm/vmwgfx_drm.h
  
 +DRM DRIVER FOR WIDECHIPS WS2401 PANELS
 +M:    Linus Walleij <linus.walleij@linaro.org>
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
 +F:    drivers/gpu/drm/panel/panel-widechips-ws2401.c
 +
  DRM DRIVERS
  M:    David Airlie <airlied@linux.ie>
  M:    Daniel Vetter <daniel@ffwll.ch>
  L:    dri-devel@lists.freedesktop.org
  S:    Maintained
  B:    https://gitlab.freedesktop.org/drm
 -C:    irc://chat.freenode.net/dri-devel
 +C:    irc://irc.oftc.net/dri-devel
  T:    git git://anongit.freedesktop.org/drm/drm
  F:    Documentation/devicetree/bindings/display/
  F:    Documentation/devicetree/bindings/gpu/
@@@ -6604,7 -6567,6 +6611,7 @@@ EDAC-ARMAD
  M:    Jan Luebbe <jlu@pengutronix.de>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
 +F:    Documentation/devicetree/bindings/memory-controllers/marvell,mvebu-sdram-controller.yaml
  F:    drivers/edac/armada_xp_*
  
  EDAC-AST2500
@@@ -6949,12 -6911,6 +6956,12 @@@ M:    Mark Einon <mark.einon@gmail.com
  S:    Odd Fixes
  F:    drivers/net/ethernet/agere/
  
 +ETAS ES58X CAN/USB DRIVER
 +M:    Vincent Mailhol <mailhol.vincent@wanadoo.fr>
 +L:    linux-can@vger.kernel.org
 +S:    Maintained
 +F:    drivers/net/can/usb/etas_es58x/
 +
  ETHERNET BRIDGE
  M:    Roopa Prabhu <roopa@nvidia.com>
  M:    Nikolay Aleksandrov <nikolay@nvidia.com>
@@@ -6996,7 -6952,7 +7003,7 @@@ F:      include/uapi/linux/mdio.
  F:    include/uapi/linux/mii.h
  
  EXFAT FILE SYSTEM
 -M:    Namjae Jeon <namjae.jeon@samsung.com>
 +M:    Namjae Jeon <linkinjeon@kernel.org>
  M:    Sungjong Seo <sj1557.seo@samsung.com>
  L:    linux-fsdevel@vger.kernel.org
  S:    Maintained
@@@ -8446,7 -8402,7 +8453,7 @@@ F:      drivers/crypto/hisilicon/sgl.
  F:    drivers/crypto/hisilicon/zip/
  
  HISILICON ROCE DRIVER
 -M:    Lijun Ou <oulijun@huawei.com>
 +M:    Wenpeng Liang <liangwenpeng@huawei.com>
  M:    Weihang Li <liweihang@huawei.com>
  L:    linux-rdma@vger.kernel.org
  S:    Maintained
@@@ -8484,12 -8440,10 +8491,12 @@@ S:   Maintaine
  F:    Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml
  F:    drivers/spmi/hisi-spmi-controller.c
  
 -HISILICON STAGING DRIVERS FOR HIKEY 960/970
 +HISILICON SPMI PMIC DRIVER FOR HIKEY 6421v600
  M:    Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
 +L:    linux-kernel@vger.kernel.org
  S:    Maintained
 -F:    drivers/staging/hikey9xx/
 +F:    Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml
 +F:    drivers/mfd/hi6421-spmi-pmic.c
  
  HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT
  M:    Zaibo Xu <xuzaibo@huawei.com>
@@@ -8648,9 -8602,6 +8655,9 @@@ T:      git git://git.kernel.org/pub/scm/lin
  F:    Documentation/ABI/stable/sysfs-bus-vmbus
  F:    Documentation/ABI/testing/debugfs-hyperv
  F:    Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst
 +F:    arch/arm64/hyperv
 +F:    arch/arm64/include/asm/hyperv-tlfs.h
 +F:    arch/arm64/include/asm/mshyperv.h
  F:    arch/x86/hyperv
  F:    arch/x86/include/asm/hyperv-tlfs.h
  F:    arch/x86/include/asm/mshyperv.h
@@@ -9097,7 -9048,7 +9104,7 @@@ F:      drivers/usb/atm/ueagle-atm.
  IMGTEC ASCII LCD DRIVER
  M:    Paul Burton <paulburton@kernel.org>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
 +F:    Documentation/devicetree/bindings/auxdisplay/img,ascii-lcd.yaml
  F:    drivers/auxdisplay/img-ascii-lcd.c
  
  IMGTEC IR DECODER DRIVER
@@@ -9269,20 -9220,13 +9276,20 @@@ INTEL ATOMISP2 DUMMY / POWER-MANAGEMEN
  M:    Hans de Goede <hdegoede@redhat.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel_atomisp2_pm.c
 +F:    drivers/platform/x86/intel/atomisp2/pm.c
  
  INTEL ATOMISP2 LED DRIVER
  M:    Hans de Goede <hdegoede@redhat.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel_atomisp2_led.c
 +F:    drivers/platform/x86/intel/atomisp2/led.c
 +
 +INTEL BIOS SAR INT1092 DRIVER
 +M:    Shravan S <s.shravan@intel.com>
 +M:    Intel Corporation <linuxwwan@intel.com>
 +L:    platform-driver-x86@vger.kernel.org
 +S:    Maintained
 +F:    drivers/platform/x86/intel/int1092/
  
  INTEL BROXTON PMC DRIVER
  M:    Mika Westerberg <mika.westerberg@linux.intel.com>
@@@ -9314,7 -9258,7 +9321,7 @@@ S:      Supporte
  W:    https://01.org/linuxgraphics/
  Q:    http://patchwork.freedesktop.org/project/intel-gfx/
  B:    https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs
 -C:    irc://chat.freenode.net/intel-gfx
 +C:    irc://irc.oftc.net/intel-gfx
  T:    git git://anongit.freedesktop.org/drm-intel
  F:    Documentation/gpu/i915.rst
  F:    drivers/gpu/drm/i915/
@@@ -9378,7 -9322,7 +9385,7 @@@ INTEL HID EVENT DRIVE
  M:    Alex Hung <alex.hung@canonical.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel-hid.c
 +F:    drivers/platform/x86/intel/hid.c
  
  INTEL I/OAT DMA DRIVER
  M:    Dave Jiang <dave.jiang@intel.com>
@@@ -9522,17 -9466,17 +9529,17 @@@ F:   include/linux/mfd/intel-m10-bmc.
  
  INTEL MENLOW THERMAL DRIVER
  M:    Sujith Thomas <sujith.thomas@intel.com>
 -L:    platform-driver-x86@vger.kernel.org
 +L:    linux-pm@vger.kernel.org
  S:    Supported
  W:    https://01.org/linux-acpi
 -F:    drivers/platform/x86/intel_menlow.c
 +F:    drivers/thermal/intel/intel_menlow.c
  
  INTEL P-Unit IPC DRIVER
  M:    Zha Qipeng <qipeng.zha@intel.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    arch/x86/include/asm/intel_punit_ipc.h
 -F:    drivers/platform/x86/intel_punit_ipc.c
 +F:    drivers/platform/x86/intel/punit_ipc.c
  
  INTEL PMC CORE DRIVER
  M:    Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
@@@ -9540,7 -9484,7 +9547,7 @@@ M:      David E Box <david.e.box@intel.com
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-platform-intel-pmc
 -F:    drivers/platform/x86/intel_pmc_core*
 +F:    drivers/platform/x86/intel/pmc/
  
  INTEL PMIC GPIO DRIVERS
  M:    Andy Shevchenko <andy@kernel.org>
@@@ -9558,7 -9502,7 +9565,7 @@@ INTEL PMT DRIVE
  M:    "David E. Box" <david.e.box@linux.intel.com>
  S:    Maintained
  F:    drivers/mfd/intel_pmt.c
 -F:    drivers/platform/x86/intel_pmt_*
 +F:    drivers/platform/x86/intel/pmt/
  
  INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
  M:    Stanislav Yakovlev <stas.yakovlev@gmail.com>
@@@ -9595,7 -9539,7 +9602,7 @@@ INTEL SPEED SELECT TECHNOLOG
  M:    Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel_speed_select_if/
 +F:    drivers/platform/x86/intel/speed_select_if/
  F:    include/uapi/linux/isst_if.h
  F:    tools/power/x86/intel-speed-select/
  
@@@ -9616,19 -9560,19 +9623,19 @@@ M:   "David E. Box" <david.e.box@linux.in
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    arch/x86/include/asm/intel_telemetry.h
 -F:    drivers/platform/x86/intel_telemetry*
 +F:    drivers/platform/x86/intel/telemetry/
  
  INTEL UNCORE FREQUENCY CONTROL
  M:    Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel-uncore-frequency.c
 +F:    drivers/platform/x86/intel/uncore-frequency.c
  
  INTEL VIRTUAL BUTTON DRIVER
  M:    AceLan Kao <acelan.kao@canonical.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel-vbtn.c
 +F:    drivers/platform/x86/intel/vbtn.c
  
  INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy)
  M:    Stanislaw Gruszka <stf_xl@wp.pl>
@@@ -9649,12 -9593,12 +9656,12 @@@ M:   Jithu Joseph <jithu.joseph@intel.com
  R:    Maurice Ma <maurice.ma@intel.com>
  S:    Maintained
  W:    https://slimbootloader.github.io/security/firmware-update.html
 -F:    drivers/platform/x86/intel-wmi-sbl-fw-update.c
 +F:    drivers/platform/x86/intel/wmi/sbl-fw-update.c
  
  INTEL WMI THUNDERBOLT FORCE POWER DRIVER
  L:    Dell.Client.Kernel@dell.com
  S:    Maintained
 -F:    drivers/platform/x86/intel-wmi-thunderbolt.c
 +F:    drivers/platform/x86/intel/wmi/thunderbolt.c
  
  INTEL WWAN IOSM DRIVER
  M:    M Chetan Kumar <m.chetan.kumar@intel.com>
@@@ -9812,6 -9756,11 +9819,6 @@@ M:     David Sterba <dsterba@suse.com
  S:    Odd Fixes
  F:    drivers/tty/ipwireless/
  
 -IPX NETWORK LAYER
 -L:    netdev@vger.kernel.org
 -S:    Obsolete
 -F:    include/uapi/linux/ipx.h
 -
  IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
  M:    Marc Zyngier <maz@kernel.org>
  S:    Maintained
@@@ -10161,17 -10110,6 +10168,17 @@@ T: git git://git.kernel.org/pub/scm/lin
  F:    Documentation/dev-tools/kselftest*
  F:    tools/testing/selftests/
  
 +KERNEL SMB3 SERVER (KSMBD)
 +M:    Namjae Jeon <linkinjeon@kernel.org>
 +M:    Sergey Senozhatsky <senozhatsky@chromium.org>
 +M:    Steve French <sfrench@samba.org>
 +M:    Hyunchul Lee <hyc.lee@gmail.com>
 +L:    linux-cifs@vger.kernel.org
 +S:    Maintained
 +T:    git git://git.samba.org/ksmbd.git
 +F:    fs/cifs_common/
 +F:    fs/ksmbd/
 +
  KERNEL UNIT TESTING FRAMEWORK (KUnit)
  M:    Brendan Higgins <brendanhiggins@google.com>
  L:    linux-kselftest@vger.kernel.org
@@@ -10457,7 -10395,6 +10464,7 @@@ F:   net/core/skmsg.
  F:    net/core/sock_map.c
  F:    net/ipv4/tcp_bpf.c
  F:    net/ipv4/udp_bpf.c
 +F:    net/unix/unix_bpf.c
  
  LANDLOCK SECURITY MODULE
  M:    Mickaël Salaün <mic@digikod.net>
@@@ -10679,6 -10616,15 +10686,6 @@@ F:  LICENSES
  F:    scripts/spdxcheck-test.sh
  F:    scripts/spdxcheck.py
  
 -LIGHTNVM PLATFORM SUPPORT
 -M:    Matias Bjorling <mb@lightnvm.io>
 -L:    linux-block@vger.kernel.org
 -S:    Maintained
 -W:    http://github/OpenChannelSSD
 -F:    drivers/lightnvm/
 -F:    include/linux/lightnvm.h
 -F:    include/uapi/linux/lightnvm.h
 -
  LINEAR RANGES HELPERS
  M:    Mark Brown <broonie@kernel.org>
  R:    Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
@@@ -11091,18 -11037,6 +11098,18 @@@ F: drivers/mailbox/arm_mhuv2.
  F:    include/linux/mailbox/arm_mhuv2_message.h
  F:    Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
  
 +MANAGEMENT COMPONENT TRANSPORT PROTOCOL (MCTP)
 +M:    Jeremy Kerr <jk@codeconstruct.com.au>
 +M:    Matt Johnston <matt@codeconstruct.com.au>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/networking/mctp.rst
 +F:    drivers/net/mctp/
 +F:    include/net/mctp.h
 +F:    include/net/mctpdevice.h
 +F:    include/net/netns/mctp.h
 +F:    net/mctp/
 +
  MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
  M:    Michael Kerrisk <mtk.manpages@gmail.com>
  L:    linux-man@vger.kernel.org
@@@ -11400,12 -11334,6 +11407,12 @@@ W: https://linuxtv.or
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/radio/radio-maxiradio*
  
 +MAXLINEAR ETHERNET PHY DRIVER
 +M:    Xu Liang <lxu@maxlinear.com>
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +F:    drivers/net/phy/mxl-gpy.c
 +
  MCBA MICROCHIP CAN BUS ANALYZER TOOL DRIVER
  R:    Yasushi SHOJI <yashi@spacecubics.com>
  L:    linux-can@vger.kernel.org
@@@ -13859,15 -13787,6 +13866,15 @@@ T: git git://linuxtv.org/media_tree.gi
  F:    Documentation/devicetree/bindings/media/i2c/ov8856.yaml
  F:    drivers/media/i2c/ov8856.c
  
 +OMNIVISION OV9282 SENSOR DRIVER
 +M:    Paul J. Murphy <paul.j.murphy@intel.com>
 +M:    Daniele Alessandrelli <daniele.alessandrelli@intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml
 +F:    drivers/media/i2c/ov9282.c
 +
  OMNIVISION OV9640 SENSOR DRIVER
  M:    Petr Cvek <petrcvekcz@gmail.com>
  L:    linux-media@vger.kernel.org
@@@ -13958,12 -13877,6 +13965,12 @@@ F: Documentation/devicetree
  F:    arch/*/boot/dts/
  F:    include/dt-bindings/
  
 +OPENCOMPUTE PTP CLOCK DRIVER
 +M:    Jonathan Lemon <jonathan.lemon@gmail.com>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/ptp/ptp_ocp.c
 +
  OPENCORES I2C BUS DRIVER
  M:    Peter Korsgaard <peter@korsgaard.com>
  M:    Andrew Lunn <andrew@lunn.ch>
@@@ -14289,7 -14202,7 +14296,7 @@@ M:   Lucas Stach <l.stach@pengutronix.de
  L:    linux-pci@vger.kernel.org
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
 +F:    Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
  F:    drivers/pci/controller/dwc/*imx6*
  
  PCI DRIVER FOR FU740
@@@ -14377,8 -14290,7 +14384,8 @@@ M:   Jingoo Han <jingoohan1@gmail.com
  M:    Gustavo Pimentel <gustavo.pimentel@synopsys.com>
  L:    linux-pci@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pci/designware-pcie.txt
 +F:    Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml
 +F:    Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml
  F:    drivers/pci/controller/dwc/*designware*
  
  PCI DRIVER FOR TI DRA7XX/J721E
@@@ -14515,7 -14427,7 +14522,7 @@@ M:   Xiaowei Song <songxiaowei@hisilicon.
  M:    Binghui Wang <wangbinghui@hisilicon.com>
  L:    linux-pci@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pci/kirin-pcie.txt
 +F:    Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml
  F:    drivers/pci/controller/dwc/pcie-kirin.c
  
  PCIE DRIVER FOR HISILICON STB
@@@ -14525,13 -14437,6 +14532,13 @@@ S: Maintaine
  F:    Documentation/devicetree/bindings/pci/hisilicon-histb-pcie.txt
  F:    drivers/pci/controller/dwc/pcie-histb.c
  
 +PCIE DRIVER FOR INTEL LGM GW SOC
 +M:    Rahul Tanwar <rtanwar@maxlinear.com>
 +L:    linux-pci@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml
 +F:    drivers/pci/controller/dwc/pcie-intel-gw.c
 +
  PCIE DRIVER FOR MEDIATEK
  M:    Ryder Lee <ryder.lee@mediatek.com>
  M:    Jianjun Wang <jianjun.wang@mediatek.com>
@@@ -14727,12 -14632,6 +14734,12 @@@ F: Documentation/driver-api/pin-control
  F:    drivers/pinctrl/
  F:    include/linux/pinctrl/
  
 +PIN CONTROLLER - AMD
 +M:    Basavaraj Natikar <Basavaraj.Natikar@amd.com>
 +M:    Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
 +S:    Maintained
 +F:    drivers/pinctrl/pinctrl-amd.c
 +
  PIN CONTROLLER - FREESCALE
  M:    Dong Aisheng <aisheng.dong@nxp.com>
  M:    Fabio Estevam <festevam@gmail.com>
@@@ -14751,19 -14650,12 +14758,19 @@@ S:        Maintaine
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git
  F:    drivers/pinctrl/intel/
  
 +PIN CONTROLLER - KEEMBAY
 +M:    Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>
 +S:    Supported
 +F:    drivers/pinctrl/pinctrl-keembay*
 +
  PIN CONTROLLER - MEDIATEK
  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:    Documentation/devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt6797-pinctrl.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt8183-pinctrl.yaml
  F:    drivers/pinctrl/mediatek/
  
  PIN CONTROLLER - MICROCHIP AT91
@@@ -15041,10 -14933,12 +15048,10 @@@ S:        Maintaine
  F:    include/linux/printk.h
  F:    kernel/printk/
  
 -PRISM54 WIRELESS DRIVER
 -M:    Luis Chamberlain <mcgrof@kernel.org>
 -L:    linux-wireless@vger.kernel.org
 -S:    Obsolete
 -W:    https://wireless.wiki.kernel.org/en/users/Drivers/p54
 -F:    drivers/net/wireless/intersil/prism54/
 +PRINTK INDEXING
 +R:    Chris Down <chris@chrisdown.name>
 +S:    Maintained
 +F:    kernel/printk/index.c
  
  PROC FILESYSTEM
  L:    linux-kernel@vger.kernel.org
@@@ -15961,14 -15855,6 +15968,14 @@@ L: linux-renesas-soc@vger.kernel.or
  S:    Maintained
  F:    drivers/phy/renesas/phy-rcar-gen3-usb*.c
  
 +RENESAS RZ/G2L A/D DRIVER
 +M:    Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
 +L:    linux-iio@vger.kernel.org
 +L:    linux-renesas-soc@vger.kernel.org
 +S:    Supported
 +F:    Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
 +F:    drivers/iio/adc/rzg2l_adc.c
 +
  RESET CONTROLLER FRAMEWORK
  M:    Philipp Zabel <p.zabel@pengutronix.de>
  S:    Maintained
@@@ -16439,7 -16325,7 +16446,7 @@@ SAMSUNG EXYNOS TRUE RANDOM NUMBER GENER
  M:    Łukasz Stelmach <l.stelmach@samsung.com>
  L:    linux-samsung-soc@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
 +F:    Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
  F:    drivers/char/hw_random/exynos-trng.c
  
  SAMSUNG FRAMEBUFFER DRIVER
@@@ -16532,14 -16418,10 +16539,14 @@@ L:        linux-samsung-soc@vger.kernel.or
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk.git
  F:    Documentation/devicetree/bindings/clock/exynos*.txt
 +F:    Documentation/devicetree/bindings/clock/samsung,*.yaml
  F:    Documentation/devicetree/bindings/clock/samsung,s3c*
  F:    Documentation/devicetree/bindings/clock/samsung,s5p*
  F:    drivers/clk/samsung/
  F:    include/dt-bindings/clock/exynos*.h
 +F:    include/dt-bindings/clock/s3c*.h
 +F:    include/dt-bindings/clock/s5p*.h
 +F:    include/dt-bindings/clock/samsung,*.h
  F:    include/linux/clk/samsung.h
  F:    include/linux/platform_data/clk-s3c2410.h
  
@@@ -16581,12 -16463,6 +16588,12 @@@ F: drivers/phy/samsung/phy-s5pv210-usb2
  F:    drivers/phy/samsung/phy-samsung-usb2.c
  F:    drivers/phy/samsung/phy-samsung-usb2.h
  
 +SANCLOUD BEAGLEBONE ENHANCED DEVICE TREE
 +M:    Paul Barker <paul.barker@sancloud.com>
 +R:    Marc Murphy <marc.murphy@sancloud.com>
 +S:    Supported
 +F:    arch/arm/boot/dts/am335x-sancloud*
 +
  SC1200 WDT DRIVER
  M:    Zwane Mwaikambo <zwanem@gmail.com>
  S:    Maintained
@@@ -16846,12 -16722,6 +16853,12 @@@ F: drivers/iio/chemical/scd30_core.
  F:    drivers/iio/chemical/scd30_i2c.c
  F:    drivers/iio/chemical/scd30_serial.c
  
 +SENSIRION SGP40 GAS SENSOR DRIVER
 +M:    Andreas Klinger <ak@it-klinger.de>
 +S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-bus-iio-chemical-sgp40
 +F:    drivers/iio/chemical/sgp40.c
 +
  SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER
  M:    Tomasz Duszynski <tduszyns@gmail.com>
  S:    Maintained
@@@ -17430,15 -17300,6 +17437,15 @@@ T: git git://linuxtv.org/media_tree.gi
  F:    Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
  F:    drivers/media/i2c/imx334.c
  
 +SONY IMX335 SENSOR DRIVER
 +M:    Paul J. Murphy <paul.j.murphy@intel.com>
 +M:    Daniele Alessandrelli <daniele.alessandrelli@intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml
 +F:    drivers/media/i2c/imx335.c
 +
  SONY IMX355 SENSOR DRIVER
  M:    Tianshu Qiu <tian.shu.qiu@intel.com>
  L:    linux-media@vger.kernel.org
@@@ -17446,15 -17307,6 +17453,15 @@@ S: Maintaine
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/i2c/imx355.c
  
 +SONY IMX412 SENSOR DRIVER
 +M:    Paul J. Murphy <paul.j.murphy@intel.com>
 +M:    Daniele Alessandrelli <daniele.alessandrelli@intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml
 +F:    drivers/media/i2c/imx412.c
 +
  SONY MEMORYSTICK SUBSYSTEM
  M:    Maxim Levitsky <maximlevitsky@gmail.com>
  M:    Alex Dubov <oakad@yahoo.com>
@@@ -17774,9 -17626,8 +17781,9 @@@ F:   drivers/staging/olpc_dcon
  
  STAGING - REALTEK RTL8188EU DRIVERS
  M:    Larry Finger <Larry.Finger@lwfinger.net>
 -S:    Odd Fixes
 -F:    drivers/staging/rtl8188eu/
 +M:    Phillip Potter <phil@philpotter.co.uk>
 +S:    Supported
 +F:    drivers/staging/r8188eu/
  
  STAGING - REALTEK RTL8712U DRIVERS
  M:    Larry Finger <Larry.Finger@lwfinger.net>
@@@ -18113,7 -17964,6 +18120,7 @@@ F:   drivers/regulator/scmi-regulator.
  F:    drivers/reset/reset-scmi.c
  F:    include/linux/sc[mp]i_protocol.h
  F:    include/trace/events/scmi.h
 +F:    include/uapi/linux/virtio_scmi.h
  
  SYSTEM RESET/SHUTDOWN DRIVERS
  M:    Sebastian Reichel <sre@kernel.org>
@@@ -18964,14 -18814,6 +18971,14 @@@ F: arch/x86/mm/testmmiotrace.
  F:    include/linux/mmiotrace.h
  F:    kernel/trace/trace_mmiotrace.c
  
 +TRADITIONAL CHINESE DOCUMENTATION
 +M:    Hu Haowen <src.res@email.cn>
 +L:    linux-doc-tw-discuss@lists.sourceforge.net
 +S:    Maintained
 +W:    https://github.com/srcres258/linux-doc
 +T:    git git://github.com/srcres258/linux-doc.git doc-zh-tw
 +F:    Documentation/translations/zh_TW/
 +
  TRIVIAL PATCHES
  M:    Jiri Kosina <trivial@kernel.org>
  S:    Maintained
@@@ -19631,7 -19473,6 +19638,7 @@@ T:   git git://github.com/awilliam/linux-
  F:    Documentation/driver-api/vfio.rst
  F:    drivers/vfio/
  F:    include/linux/vfio.h
 +F:    include/linux/vfio_pci_core.h
  F:    include/uapi/linux/vfio.h
  
  VFIO FSL-MC DRIVER
@@@ -19882,15 -19723,6 +19889,15 @@@ S: Maintaine
  F:    include/uapi/linux/virtio_snd.h
  F:    sound/virtio/*
  
 +VIRTIO I2C DRIVER
 +M:    Jie Deng <jie.deng@intel.com>
 +M:    Viresh Kumar <viresh.kumar@linaro.org>
 +L:    linux-i2c@vger.kernel.org
 +L:    virtualization@lists.linux-foundation.org
 +S:    Maintained
 +F:    drivers/i2c/busses/i2c-virtio.c
 +F:    include/uapi/linux/virtio_i2c.h
 +
  VIRTUAL BOX GUEST DEVICE DRIVER
  M:    Hans de Goede <hdegoede@redhat.com>
  M:    Arnd Bergmann <arnd@arndb.de>
diff --combined drivers/iommu/Kconfig
@@@ -79,16 -79,57 +79,57 @@@ config IOMMU_DEBUGF
          debug/iommu directory, and then populate a subdirectory with
          entries as required.
  
- config IOMMU_DEFAULT_PASSTHROUGH
-       bool "IOMMU passthrough by default"
+ choice
+       prompt "IOMMU default domain type"
        depends on IOMMU_API
+       default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU
+       default IOMMU_DEFAULT_DMA_STRICT
        help
-         Enable passthrough by default, removing the need to pass in
-         iommu.passthrough=on or iommu=pt through command line. If this
-         is enabled, you can still disable with iommu.passthrough=off
-         or iommu=nopt depending on the architecture.
+         Choose the type of IOMMU domain used to manage DMA API usage by
+         device drivers. The options here typically represent different
+         levels of tradeoff between robustness/security and performance,
+         depending on the IOMMU driver. Not all IOMMUs support all options.
+         This choice can be overridden at boot via the command line, and for
+         some devices also at runtime via sysfs.
  
-         If unsure, say N here.
+         If unsure, keep the default.
+ config IOMMU_DEFAULT_DMA_STRICT
+       bool "Translated - Strict"
+       help
+         Trusted devices use translation to restrict their access to only
+         DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
+         to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
+         Untrusted devices always use this mode, with an additional layer of
+         bounce-buffering such that they cannot gain access to any unrelated
+         data within a mapped page.
+ config IOMMU_DEFAULT_DMA_LAZY
+       bool "Translated - Lazy"
+       help
+         Trusted devices use translation to restrict their access to only
+         DMA-mapped pages, but with "lazy" batched TLB invalidation. This
+         mode allows higher performance with some IOMMUs due to reduced TLB
+         flushing, but at the cost of reduced isolation since devices may be
+         able to access memory for some time after it has been unmapped.
+         Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the
+         command line.
+         If this mode is not supported by the IOMMU driver, the effective
+         runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
+ config IOMMU_DEFAULT_PASSTHROUGH
+       bool "Passthrough"
+       help
+         Trusted devices are identity-mapped, giving them unrestricted access
+         to memory with minimal performance overhead. Equivalent to passing
+         "iommu.passthrough=1" (historically "iommu=pt") on the command line.
+         If this mode is not supported by the IOMMU driver, the effective
+         runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
+ endchoice
  
  config OF_IOMMU
        def_bool y
@@@ -249,11 -290,24 +290,25 @@@ config SPAPR_TCE_IOMM
          Enables bits of IOMMU API required by VFIO. The iommu_ops
          is not implemented as it is not necessary for VFIO.
  
+ config APPLE_DART
+       tristate "Apple DART IOMMU Support"
+       depends on ARCH_APPLE || (COMPILE_TEST && !GENERIC_ATOMIC64)
+       select IOMMU_API
+       select IOMMU_IO_PGTABLE_LPAE
+       default ARCH_APPLE
+       help
+         Support for Apple DART (Device Address Resolution Table) IOMMUs
+         found in Apple ARM SoCs like the M1.
+         This IOMMU is required for most peripherals using DMA to access
+         the main memory.
+         Say Y here if you are using an Apple SoC.
  # ARM IOMMU support
  config ARM_SMMU
        tristate "ARM Ltd. System MMU (SMMU) Support"
        depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
 +      depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
        select IOMMU_API
        select IOMMU_IO_PGTABLE_LPAE
        select ARM_DMA_USE_IOMMU if ARM
@@@ -383,7 -437,6 +438,7 @@@ config QCOM_IOMM
        # Note: iommu drivers cannot (yet?) be built as modules
        bool "Qualcomm IOMMU Support"
        depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
 +      depends on QCOM_SCM=y
        select IOMMU_API
        select IOMMU_IO_PGTABLE_LPAE
        select ARM_DMA_USE_IOMMU
@@@ -317,6 -317,30 +317,30 @@@ static bool dev_is_untrusted(struct dev
        return dev_is_pci(dev) && to_pci_dev(dev)->untrusted;
  }
  
+ /* sysfs updates are serialised by the mutex of the group owning @domain */
+ int iommu_dma_init_fq(struct iommu_domain *domain)
+ {
+       struct iommu_dma_cookie *cookie = domain->iova_cookie;
+       int ret;
+       if (cookie->fq_domain)
+               return 0;
+       ret = init_iova_flush_queue(&cookie->iovad, iommu_dma_flush_iotlb_all,
+                                   iommu_dma_entry_dtor);
+       if (ret) {
+               pr_warn("iova flush queue initialization failed\n");
+               return ret;
+       }
+       /*
+        * Prevent incomplete iovad->fq being observable. Pairs with path from
+        * __iommu_dma_unmap() through iommu_dma_free_iova() to queue_iova()
+        */
+       smp_wmb();
+       WRITE_ONCE(cookie->fq_domain, domain);
+       return 0;
+ }
  /**
   * iommu_dma_init_domain - Initialise a DMA mapping domain
   * @domain: IOMMU domain previously prepared by iommu_get_dma_cookie()
@@@ -370,17 -394,9 +394,9 @@@ static int iommu_dma_init_domain(struc
  
        init_iova_domain(iovad, 1UL << order, base_pfn);
  
-       if (!cookie->fq_domain && (!dev || !dev_is_untrusted(dev)) &&
-           domain->ops->flush_iotlb_all && !iommu_get_dma_strict(domain)) {
-               if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
-                                         iommu_dma_entry_dtor))
-                       pr_warn("iova flush queue initialization failed\n");
-               else
-                       cookie->fq_domain = domain;
-       }
-       if (!dev)
-               return 0;
+       /* If the FQ fails we can simply fall back to strict mode */
+       if (domain->type == IOMMU_DOMAIN_DMA_FQ && iommu_dma_init_fq(domain))
+               domain->type = IOMMU_DOMAIN_DMA;
  
        return iova_reserve_iommu_regions(dev, domain);
  }
@@@ -455,17 -471,17 +471,17 @@@ static dma_addr_t iommu_dma_alloc_iova(
  }
  
  static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie,
-               dma_addr_t iova, size_t size, struct page *freelist)
+               dma_addr_t iova, size_t size, struct iommu_iotlb_gather *gather)
  {
        struct iova_domain *iovad = &cookie->iovad;
  
        /* The MSI case is only ever cleaning up its most recent allocation */
        if (cookie->type == IOMMU_DMA_MSI_COOKIE)
                cookie->msi_iova -= size;
-       else if (cookie->fq_domain)     /* non-strict mode */
+       else if (gather && gather->queued)
                queue_iova(iovad, iova_pfn(iovad, iova),
                                size >> iova_shift(iovad),
-                               (unsigned long)freelist);
+                               (unsigned long)gather->freelist);
        else
                free_iova_fast(iovad, iova_pfn(iovad, iova),
                                size >> iova_shift(iovad));
@@@ -484,13 -500,14 +500,14 @@@ static void __iommu_dma_unmap(struct de
        dma_addr -= iova_off;
        size = iova_align(iovad, size + iova_off);
        iommu_iotlb_gather_init(&iotlb_gather);
+       iotlb_gather.queued = READ_ONCE(cookie->fq_domain);
  
        unmapped = iommu_unmap_fast(domain, dma_addr, size, &iotlb_gather);
        WARN_ON(unmapped != size);
  
-       if (!cookie->fq_domain)
+       if (!iotlb_gather.queued)
                iommu_iotlb_sync(domain, &iotlb_gather);
-       iommu_dma_free_iova(cookie, dma_addr, size, iotlb_gather.freelist);
+       iommu_dma_free_iova(cookie, dma_addr, size, &iotlb_gather);
  }
  
  static void __iommu_dma_unmap_swiotlb(struct device *dev, dma_addr_t dma_addr,
  
        __iommu_dma_unmap(dev, dma_addr, size);
  
 -      if (unlikely(is_swiotlb_buffer(phys)))
 +      if (unlikely(is_swiotlb_buffer(dev, phys)))
                swiotlb_tbl_unmap_single(dev, phys, size, dir, attrs);
  }
  
@@@ -577,7 -594,7 +594,7 @@@ static dma_addr_t __iommu_dma_map_swiot
        }
  
        iova = __iommu_dma_map(dev, phys, aligned_size, prot, dma_mask);
 -      if (iova == DMA_MAPPING_ERROR && is_swiotlb_buffer(phys))
 +      if (iova == DMA_MAPPING_ERROR && is_swiotlb_buffer(dev, phys))
                swiotlb_tbl_unmap_single(dev, phys, org_size, dir, attrs);
        return iova;
  }
@@@ -784,7 -801,7 +801,7 @@@ static void iommu_dma_sync_single_for_c
        if (!dev_is_dma_coherent(dev))
                arch_sync_dma_for_cpu(phys, size, dir);
  
 -      if (is_swiotlb_buffer(phys))
 +      if (is_swiotlb_buffer(dev, phys))
                swiotlb_sync_single_for_cpu(dev, phys, size, dir);
  }
  
@@@ -797,7 -814,7 +814,7 @@@ static void iommu_dma_sync_single_for_d
                return;
  
        phys = iommu_iova_to_phys(iommu_get_dma_domain(dev), dma_handle);
 -      if (is_swiotlb_buffer(phys))
 +      if (is_swiotlb_buffer(dev, phys))
                swiotlb_sync_single_for_device(dev, phys, size, dir);
  
        if (!dev_is_dma_coherent(dev))
@@@ -818,7 -835,7 +835,7 @@@ static void iommu_dma_sync_sg_for_cpu(s
                if (!dev_is_dma_coherent(dev))
                        arch_sync_dma_for_cpu(sg_phys(sg), sg->length, dir);
  
 -              if (is_swiotlb_buffer(sg_phys(sg)))
 +              if (is_swiotlb_buffer(dev, sg_phys(sg)))
                        swiotlb_sync_single_for_cpu(dev, sg_phys(sg),
                                                    sg->length, dir);
        }
@@@ -835,7 -852,7 +852,7 @@@ static void iommu_dma_sync_sg_for_devic
                return;
  
        for_each_sg(sgl, sg, nelems, i) {
 -              if (is_swiotlb_buffer(sg_phys(sg)))
 +              if (is_swiotlb_buffer(dev, sg_phys(sg)))
                        swiotlb_sync_single_for_device(dev, sg_phys(sg),
                                                       sg->length, dir);
  
@@@ -973,7 -990,7 +990,7 @@@ static int iommu_dma_map_sg_swiotlb(str
  
  out_unmap:
        iommu_dma_unmap_sg_swiotlb(dev, sg, i, dir, attrs | DMA_ATTR_SKIP_CPU_SYNC);
 -      return 0;
 +      return -EIO;
  }
  
  /*
@@@ -994,13 -1011,11 +1011,13 @@@ static int iommu_dma_map_sg(struct devi
        dma_addr_t iova;
        size_t iova_len = 0;
        unsigned long mask = dma_get_seg_boundary(dev);
 +      ssize_t ret;
        int i;
  
 -      if (static_branch_unlikely(&iommu_deferred_attach_enabled) &&
 -          iommu_deferred_attach(dev, domain))
 -              return 0;
 +      if (static_branch_unlikely(&iommu_deferred_attach_enabled)) {
 +              ret = iommu_deferred_attach(dev, domain);
 +              goto out;
 +      }
  
        if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
                iommu_dma_sync_sg_for_device(dev, sg, nents, dir);
        }
  
        iova = iommu_dma_alloc_iova(domain, iova_len, dma_get_mask(dev), dev);
 -      if (!iova)
 +      if (!iova) {
 +              ret = -ENOMEM;
                goto out_restore_sg;
 +      }
  
        /*
         * We'll leave any physical concatenation to the IOMMU driver's
         * implementation - it knows better than we do.
         */
 -      if (iommu_map_sg_atomic(domain, iova, sg, nents, prot) < iova_len)
 +      ret = iommu_map_sg_atomic(domain, iova, sg, nents, prot);
 +      if (ret < iova_len)
                goto out_free_iova;
  
        return __finalise_sg(dev, sg, nents, iova);
@@@ -1067,10 -1079,7 +1084,10 @@@ out_free_iova
        iommu_dma_free_iova(cookie, iova, iova_len, NULL);
  out_restore_sg:
        __invalidate_sg(sg, nents);
 -      return 0;
 +out:
 +      if (ret != -ENOMEM)
 +              return -EINVAL;
 +      return ret;
  }
  
  static void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
@@@ -1330,7 -1339,7 +1347,7 @@@ void iommu_setup_dma_ops(struct device 
         * The IOMMU core code allocates the default DMA domain, which the
         * underlying IOMMU driver needs to support via the dma-iommu layer.
         */
-       if (domain->type == IOMMU_DOMAIN_DMA) {
+       if (iommu_is_dma_domain(domain)) {
                if (iommu_dma_init_domain(domain, dma_base, dma_limit, dev))
                        goto out_err;
                dev->dma_ops = &iommu_dma_ops;
diff --combined drivers/iommu/iommu.c
@@@ -7,7 -7,9 +7,9 @@@
  #define pr_fmt(fmt)    "iommu: " fmt
  
  #include <linux/device.h>
+ #include <linux/dma-iommu.h>
  #include <linux/kernel.h>
+ #include <linux/bits.h>
  #include <linux/bug.h>
  #include <linux/types.h>
  #include <linux/init.h>
@@@ -29,7 -31,7 +31,7 @@@ static struct kset *iommu_group_kset
  static DEFINE_IDA(iommu_group_ida);
  
  static unsigned int iommu_def_domain_type __read_mostly;
- static bool iommu_dma_strict __read_mostly = true;
+ static bool iommu_dma_strict __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_DMA_STRICT);
  static u32 iommu_cmd_line __read_mostly;
  
  struct iommu_group {
@@@ -113,6 -115,7 +115,7 @@@ static const char *iommu_domain_type_st
        case IOMMU_DOMAIN_UNMANAGED:
                return "Unmanaged";
        case IOMMU_DOMAIN_DMA:
+       case IOMMU_DOMAIN_DMA_FQ:
                return "Translated";
        default:
                return "Unknown";
@@@ -133,11 -136,20 +136,20 @@@ static int __init iommu_subsys_init(voi
                }
        }
  
+       if (!iommu_default_passthrough() && !iommu_dma_strict)
+               iommu_def_domain_type = IOMMU_DOMAIN_DMA_FQ;
        pr_info("Default domain type: %s %s\n",
                iommu_domain_type_str(iommu_def_domain_type),
                (iommu_cmd_line & IOMMU_CMD_LINE_DMA_API) ?
                        "(set via kernel command line)" : "");
  
+       if (!iommu_default_passthrough())
+               pr_info("DMA domain TLB invalidation policy: %s mode %s\n",
+                       iommu_dma_strict ? "strict" : "lazy",
+                       (iommu_cmd_line & IOMMU_CMD_LINE_STRICT) ?
+                               "(set via kernel command line)" : "");
        return 0;
  }
  subsys_initcall(iommu_subsys_init);
@@@ -273,7 -285,9 +285,9 @@@ int iommu_probe_device(struct device *d
         * support default domains, so the return value is not yet
         * checked.
         */
+       mutex_lock(&group->mutex);
        iommu_alloc_default_domain(group, dev);
+       mutex_unlock(&group->mutex);
  
        if (group->default_domain) {
                ret = __iommu_attach_device(group->default_domain, dev);
@@@ -344,21 -358,13 +358,13 @@@ static int __init iommu_dma_setup(char 
  }
  early_param("iommu.strict", iommu_dma_setup);
  
- void iommu_set_dma_strict(bool strict)
+ void iommu_set_dma_strict(void)
  {
-       if (strict || !(iommu_cmd_line & IOMMU_CMD_LINE_STRICT))
-               iommu_dma_strict = strict;
+       iommu_dma_strict = true;
+       if (iommu_def_domain_type == IOMMU_DOMAIN_DMA_FQ)
+               iommu_def_domain_type = IOMMU_DOMAIN_DMA;
  }
  
- bool iommu_get_dma_strict(struct iommu_domain *domain)
- {
-       /* only allow lazy flushing for DMA domains */
-       if (domain->type == IOMMU_DOMAIN_DMA)
-               return iommu_dma_strict;
-       return true;
- }
- EXPORT_SYMBOL_GPL(iommu_get_dma_strict);
  static ssize_t iommu_group_attr_show(struct kobject *kobj,
                                     struct attribute *__attr, char *buf)
  {
@@@ -546,6 -552,9 +552,9 @@@ static ssize_t iommu_group_show_type(st
                case IOMMU_DOMAIN_DMA:
                        type = "DMA\n";
                        break;
+               case IOMMU_DOMAIN_DMA_FQ:
+                       type = "DMA-FQ\n";
+                       break;
                }
        }
        mutex_unlock(&group->mutex);
@@@ -759,7 -768,7 +768,7 @@@ static int iommu_create_device_direct_m
        unsigned long pg_size;
        int ret = 0;
  
-       if (!domain || domain->type != IOMMU_DOMAIN_DMA)
+       if (!domain || !iommu_is_dma_domain(domain))
                return 0;
  
        BUG_ON(!domain->pgsize_bitmap);
@@@ -1944,6 -1953,11 +1953,11 @@@ static struct iommu_domain *__iommu_dom
        /* Assume all sizes by default; the driver may override this later */
        domain->pgsize_bitmap  = bus->iommu_ops->pgsize_bitmap;
  
+       /* Temporarily avoid -EEXIST while drivers still get their own cookies */
+       if (iommu_is_dma_domain(domain) && !domain->iova_cookie && iommu_get_dma_cookie(domain)) {
+               iommu_domain_free(domain);
+               domain = NULL;
+       }
        return domain;
  }
  
@@@ -1955,6 -1969,7 +1969,7 @@@ EXPORT_SYMBOL_GPL(iommu_domain_alloc)
  
  void iommu_domain_free(struct iommu_domain *domain)
  {
+       iommu_put_dma_cookie(domain);
        domain->ops->domain_free(domain);
  }
  EXPORT_SYMBOL_GPL(iommu_domain_free);
@@@ -2370,45 -2385,94 +2385,94 @@@ EXPORT_SYMBOL_GPL(iommu_detach_group)
  
  phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
  {
-       if (unlikely(domain->ops->iova_to_phys == NULL))
+       if (domain->type == IOMMU_DOMAIN_IDENTITY)
+               return iova;
+       if (domain->type == IOMMU_DOMAIN_BLOCKED)
                return 0;
  
        return domain->ops->iova_to_phys(domain, iova);
  }
  EXPORT_SYMBOL_GPL(iommu_iova_to_phys);
  
- static size_t iommu_pgsize(struct iommu_domain *domain,
-                          unsigned long addr_merge, size_t size)
+ static size_t iommu_pgsize(struct iommu_domain *domain, unsigned long iova,
+                          phys_addr_t paddr, size_t size, size_t *count)
  {
-       unsigned int pgsize_idx;
-       size_t pgsize;
+       unsigned int pgsize_idx, pgsize_idx_next;
+       unsigned long pgsizes;
+       size_t offset, pgsize, pgsize_next;
+       unsigned long addr_merge = paddr | iova;
  
-       /* Max page size that still fits into 'size' */
-       pgsize_idx = __fls(size);
+       /* Page sizes supported by the hardware and small enough for @size */
+       pgsizes = domain->pgsize_bitmap & GENMASK(__fls(size), 0);
  
-       /* need to consider alignment requirements ? */
-       if (likely(addr_merge)) {
-               /* Max page size allowed by address */
-               unsigned int align_pgsize_idx = __ffs(addr_merge);
-               pgsize_idx = min(pgsize_idx, align_pgsize_idx);
-       }
+       /* Constrain the page sizes further based on the maximum alignment */
+       if (likely(addr_merge))
+               pgsizes &= GENMASK(__ffs(addr_merge), 0);
  
-       /* build a mask of acceptable page sizes */
-       pgsize = (1UL << (pgsize_idx + 1)) - 1;
+       /* Make sure we have at least one suitable page size */
+       BUG_ON(!pgsizes);
  
-       /* throw away page sizes not supported by the hardware */
-       pgsize &= domain->pgsize_bitmap;
+       /* Pick the biggest page size remaining */
+       pgsize_idx = __fls(pgsizes);
+       pgsize = BIT(pgsize_idx);
+       if (!count)
+               return pgsize;
  
-       /* make sure we're still sane */
-       BUG_ON(!pgsize);
+       /* Find the next biggest support page size, if it exists */
+       pgsizes = domain->pgsize_bitmap & ~GENMASK(pgsize_idx, 0);
+       if (!pgsizes)
+               goto out_set_count;
  
-       /* pick the biggest page */
-       pgsize_idx = __fls(pgsize);
-       pgsize = 1UL << pgsize_idx;
+       pgsize_idx_next = __ffs(pgsizes);
+       pgsize_next = BIT(pgsize_idx_next);
  
+       /*
+        * There's no point trying a bigger page size unless the virtual
+        * and physical addresses are similarly offset within the larger page.
+        */
+       if ((iova ^ paddr) & (pgsize_next - 1))
+               goto out_set_count;
+       /* Calculate the offset to the next page size alignment boundary */
+       offset = pgsize_next - (addr_merge & (pgsize_next - 1));
+       /*
+        * If size is big enough to accommodate the larger page, reduce
+        * the number of smaller pages.
+        */
+       if (offset + pgsize_next <= size)
+               size = offset;
+ out_set_count:
+       *count = size >> pgsize_idx;
        return pgsize;
  }
  
+ static int __iommu_map_pages(struct iommu_domain *domain, unsigned long iova,
+                            phys_addr_t paddr, size_t size, int prot,
+                            gfp_t gfp, size_t *mapped)
+ {
+       const struct iommu_ops *ops = domain->ops;
+       size_t pgsize, count;
+       int ret;
+       pgsize = iommu_pgsize(domain, iova, paddr, size, &count);
+       pr_debug("mapping: iova 0x%lx pa %pa pgsize 0x%zx count %zu\n",
+                iova, &paddr, pgsize, count);
+       if (ops->map_pages) {
+               ret = ops->map_pages(domain, iova, paddr, pgsize, count, prot,
+                                    gfp, mapped);
+       } else {
+               ret = ops->map(domain, iova, paddr, pgsize, prot, gfp);
+               *mapped = ret ? 0 : pgsize;
+       }
+       return ret;
+ }
  static int __iommu_map(struct iommu_domain *domain, unsigned long iova,
                       phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
  {
        phys_addr_t orig_paddr = paddr;
        int ret = 0;
  
-       if (unlikely(ops->map == NULL ||
+       if (unlikely(!(ops->map || ops->map_pages) ||
                     domain->pgsize_bitmap == 0UL))
                return -ENODEV;
  
        pr_debug("map: iova 0x%lx pa %pa size 0x%zx\n", iova, &paddr, size);
  
        while (size) {
-               size_t pgsize = iommu_pgsize(domain, iova | paddr, size);
+               size_t mapped = 0;
  
-               pr_debug("mapping: iova 0x%lx pa %pa pgsize 0x%zx\n",
-                        iova, &paddr, pgsize);
-               ret = ops->map(domain, iova, paddr, pgsize, prot, gfp);
+               ret = __iommu_map_pages(domain, iova, paddr, size, prot, gfp,
+                                       &mapped);
+               /*
+                * Some pages may have been mapped, even if an error occurred,
+                * so we should account for those so they can be unmapped.
+                */
+               size -= mapped;
  
                if (ret)
                        break;
  
-               iova += pgsize;
-               paddr += pgsize;
-               size -= pgsize;
+               iova += mapped;
+               paddr += mapped;
        }
  
        /* unroll mapping in case something went wrong */
@@@ -2494,6 -2561,19 +2561,19 @@@ int iommu_map_atomic(struct iommu_domai
  }
  EXPORT_SYMBOL_GPL(iommu_map_atomic);
  
+ static size_t __iommu_unmap_pages(struct iommu_domain *domain,
+                                 unsigned long iova, size_t size,
+                                 struct iommu_iotlb_gather *iotlb_gather)
+ {
+       const struct iommu_ops *ops = domain->ops;
+       size_t pgsize, count;
+       pgsize = iommu_pgsize(domain, iova, iova, size, &count);
+       return ops->unmap_pages ?
+              ops->unmap_pages(domain, iova, pgsize, count, iotlb_gather) :
+              ops->unmap(domain, iova, pgsize, iotlb_gather);
+ }
  static size_t __iommu_unmap(struct iommu_domain *domain,
                            unsigned long iova, size_t size,
                            struct iommu_iotlb_gather *iotlb_gather)
        unsigned long orig_iova = iova;
        unsigned int min_pagesz;
  
-       if (unlikely(ops->unmap == NULL ||
+       if (unlikely(!(ops->unmap || ops->unmap_pages) ||
                     domain->pgsize_bitmap == 0UL))
                return 0;
  
         * or we hit an area that isn't mapped.
         */
        while (unmapped < size) {
-               size_t pgsize = iommu_pgsize(domain, iova, size - unmapped);
-               unmapped_page = ops->unmap(domain, iova, pgsize, iotlb_gather);
+               unmapped_page = __iommu_unmap_pages(domain, iova,
+                                                   size - unmapped,
+                                                   iotlb_gather);
                if (!unmapped_page)
                        break;
  
@@@ -2570,9 -2650,9 +2650,9 @@@ size_t iommu_unmap_fast(struct iommu_do
  }
  EXPORT_SYMBOL_GPL(iommu_unmap_fast);
  
 -static size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
 -                           struct scatterlist *sg, unsigned int nents, int prot,
 -                           gfp_t gfp)
 +static ssize_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
 +              struct scatterlist *sg, unsigned int nents, int prot,
 +              gfp_t gfp)
  {
        const struct iommu_ops *ops = domain->ops;
        size_t len = 0, mapped = 0;
@@@ -2613,18 -2693,19 +2693,18 @@@ out_err
        /* undo mappings already done */
        iommu_unmap(domain, iova, mapped);
  
 -      return 0;
 -
 +      return ret;
  }
  
 -size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
 -                  struct scatterlist *sg, unsigned int nents, int prot)
 +ssize_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
 +                   struct scatterlist *sg, unsigned int nents, int prot)
  {
        might_sleep();
        return __iommu_map_sg(domain, iova, sg, nents, prot, GFP_KERNEL);
  }
  EXPORT_SYMBOL_GPL(iommu_map_sg);
  
 -size_t iommu_map_sg_atomic(struct iommu_domain *domain, unsigned long iova,
 +ssize_t iommu_map_sg_atomic(struct iommu_domain *domain, unsigned long iova,
                    struct scatterlist *sg, unsigned int nents, int prot)
  {
        return __iommu_map_sg(domain, iova, sg, nents, prot, GFP_ATOMIC);
@@@ -3128,6 -3209,14 +3208,14 @@@ static int iommu_change_dev_def_domain(
                goto out;
        }
  
+       /* We can bring up a flush queue without tearing down the domain */
+       if (type == IOMMU_DOMAIN_DMA_FQ && prev_dom->type == IOMMU_DOMAIN_DMA) {
+               ret = iommu_dma_init_fq(prev_dom);
+               if (!ret)
+                       prev_dom->type = IOMMU_DOMAIN_DMA_FQ;
+               goto out;
+       }
        /* Sets group->default_domain to the newly allocated domain */
        ret = iommu_group_alloc_default_domain(dev->bus, group, type);
        if (ret)
@@@ -3168,9 -3257,9 +3256,9 @@@ out
  }
  
  /*
-  * Changing the default domain through sysfs requires the users to ubind the
-  * drivers from the devices in the iommu group. Return failure if this doesn't
-  * meet.
+  * Changing the default domain through sysfs requires the users to unbind the
+  * drivers from the devices in the iommu group, except for a DMA -> DMA-FQ
+  * transition. Return failure if this isn't met.
   *
   * We need to consider the race between this and the device release path.
   * device_lock(dev) is used here to guarantee that the device release path
@@@ -3193,6 -3282,8 +3281,8 @@@ static ssize_t iommu_group_store_type(s
                req_type = IOMMU_DOMAIN_IDENTITY;
        else if (sysfs_streq(buf, "DMA"))
                req_type = IOMMU_DOMAIN_DMA;
+       else if (sysfs_streq(buf, "DMA-FQ"))
+               req_type = IOMMU_DOMAIN_DMA_FQ;
        else if (sysfs_streq(buf, "auto"))
                req_type = 0;
        else
  
        /* Check if the device in the group still has a driver bound to it */
        device_lock(dev);
-       if (device_is_bound(dev)) {
+       if (device_is_bound(dev) && !(req_type == IOMMU_DOMAIN_DMA_FQ &&
+           group->default_domain->type == IOMMU_DOMAIN_DMA)) {
                pr_err_ratelimited("Device is still bound to driver\n");
                ret = -EBUSY;
                goto out;
diff --combined include/linux/iommu.h
@@@ -40,6 -40,7 +40,7 @@@ struct iommu_domain
  struct notifier_block;
  struct iommu_sva;
  struct iommu_fault_event;
+ struct iommu_dma_cookie;
  
  /* iommu fault flags */
  #define IOMMU_FAULT_READ      0x0
@@@ -60,6 -61,7 +61,7 @@@ struct iommu_domain_geometry 
  #define __IOMMU_DOMAIN_DMA_API        (1U << 1)  /* Domain for use in DMA-API
                                              implementation              */
  #define __IOMMU_DOMAIN_PT     (1U << 2)  /* Domain is identity mapped   */
+ #define __IOMMU_DOMAIN_DMA_FQ (1U << 3)  /* DMA-API uses flush queue    */
  
  /*
   * This are the possible domain-types
   *    IOMMU_DOMAIN_DMA        - Internally used for DMA-API implementations.
   *                              This flag allows IOMMU drivers to implement
   *                              certain optimizations for these domains
+  *    IOMMU_DOMAIN_DMA_FQ     - As above, but definitely using batched TLB
+  *                              invalidation.
   */
  #define IOMMU_DOMAIN_BLOCKED  (0U)
  #define IOMMU_DOMAIN_IDENTITY (__IOMMU_DOMAIN_PT)
  #define IOMMU_DOMAIN_UNMANAGED        (__IOMMU_DOMAIN_PAGING)
  #define IOMMU_DOMAIN_DMA      (__IOMMU_DOMAIN_PAGING |        \
                                 __IOMMU_DOMAIN_DMA_API)
+ #define IOMMU_DOMAIN_DMA_FQ   (__IOMMU_DOMAIN_PAGING |        \
+                                __IOMMU_DOMAIN_DMA_API |       \
+                                __IOMMU_DOMAIN_DMA_FQ)
  
  struct iommu_domain {
        unsigned type;
        iommu_fault_handler_t handler;
        void *handler_token;
        struct iommu_domain_geometry geometry;
-       void *iova_cookie;
+       struct iommu_dma_cookie *iova_cookie;
  };
  
+ static inline bool iommu_is_dma_domain(struct iommu_domain *domain)
+ {
+       return domain->type & __IOMMU_DOMAIN_DMA_API;
+ }
  enum iommu_cap {
        IOMMU_CAP_CACHE_COHERENCY,      /* IOMMU can enforce cache coherent DMA
                                           transactions */
@@@ -160,16 -172,22 +172,22 @@@ enum iommu_dev_features 
   * @start: IOVA representing the start of the range to be flushed
   * @end: IOVA representing the end of the range to be flushed (inclusive)
   * @pgsize: The interval at which to perform the flush
+  * @freelist: Removed pages to free after sync
+  * @queued: Indicates that the flush will be queued
   *
   * This structure is intended to be updated by multiple calls to the
   * ->unmap() function in struct iommu_ops before eventually being passed
-  * into ->iotlb_sync().
+  * into ->iotlb_sync(). Drivers can add pages to @freelist to be freed after
+  * ->iotlb_sync() or ->iotlb_flush_all() have cleared all cached references to
+  * them. @queued is set to indicate when ->iotlb_flush_all() will be called
+  * later instead of ->iotlb_sync(), so drivers may optimise accordingly.
   */
  struct iommu_iotlb_gather {
        unsigned long           start;
        unsigned long           end;
        size_t                  pgsize;
        struct page             *freelist;
+       bool                    queued;
  };
  
  /**
   * @attach_dev: attach device to an iommu domain
   * @detach_dev: detach device from an iommu domain
   * @map: map a physically contiguous memory region to an iommu domain
+  * @map_pages: map a physically contiguous set of pages of the same size to
+  *             an iommu domain.
   * @unmap: unmap a physically contiguous memory region from an iommu domain
+  * @unmap_pages: unmap a number of pages of the same size from an iommu domain
   * @flush_iotlb_all: Synchronously flush all hardware TLBs for this domain
   * @iotlb_sync_map: Sync mappings created recently using @map to the hardware
   * @iotlb_sync: Flush all queued ranges from the hardware TLBs and empty flush
@@@ -229,8 -250,14 +250,14 @@@ struct iommu_ops 
        void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
        int (*map)(struct iommu_domain *domain, unsigned long iova,
                   phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
+       int (*map_pages)(struct iommu_domain *domain, unsigned long iova,
+                        phys_addr_t paddr, size_t pgsize, size_t pgcount,
+                        int prot, gfp_t gfp, size_t *mapped);
        size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
                     size_t size, struct iommu_iotlb_gather *iotlb_gather);
+       size_t (*unmap_pages)(struct iommu_domain *domain, unsigned long iova,
+                             size_t pgsize, size_t pgcount,
+                             struct iommu_iotlb_gather *iotlb_gather);
        void (*flush_iotlb_all)(struct iommu_domain *domain);
        void (*iotlb_sync_map)(struct iommu_domain *domain, unsigned long iova,
                               size_t size);
@@@ -414,11 -441,11 +441,11 @@@ extern size_t iommu_unmap(struct iommu_
  extern size_t iommu_unmap_fast(struct iommu_domain *domain,
                               unsigned long iova, size_t size,
                               struct iommu_iotlb_gather *iotlb_gather);
 -extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
 -                         struct scatterlist *sg,unsigned int nents, int prot);
 -extern size_t iommu_map_sg_atomic(struct iommu_domain *domain,
 -                                unsigned long iova, struct scatterlist *sg,
 -                                unsigned int nents, int prot);
 +extern ssize_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
 +              struct scatterlist *sg, unsigned int nents, int prot);
 +extern ssize_t iommu_map_sg_atomic(struct iommu_domain *domain,
 +                                 unsigned long iova, struct scatterlist *sg,
 +                                 unsigned int nents, int prot);
  extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
  extern void iommu_set_fault_handler(struct iommu_domain *domain,
                        iommu_fault_handler_t handler, void *token);
@@@ -476,8 -503,7 +503,7 @@@ int iommu_enable_nesting(struct iommu_d
  int iommu_set_pgtable_quirks(struct iommu_domain *domain,
                unsigned long quirks);
  
- void iommu_set_dma_strict(bool val);
- bool iommu_get_dma_strict(struct iommu_domain *domain);
+ void iommu_set_dma_strict(void);
  
  extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
                              unsigned long iova, int flags);
@@@ -497,29 -523,80 +523,80 @@@ static inline void iommu_iotlb_sync(str
        iommu_iotlb_gather_init(iotlb_gather);
  }
  
+ /**
+  * iommu_iotlb_gather_is_disjoint - Checks whether a new range is disjoint
+  *
+  * @gather: TLB gather data
+  * @iova: start of page to invalidate
+  * @size: size of page to invalidate
+  *
+  * Helper for IOMMU drivers to check whether a new range and the gathered range
+  * are disjoint. For many IOMMUs, flushing the IOMMU in this case is better
+  * than merging the two, which might lead to unnecessary invalidations.
+  */
+ static inline
+ bool iommu_iotlb_gather_is_disjoint(struct iommu_iotlb_gather *gather,
+                                   unsigned long iova, size_t size)
+ {
+       unsigned long start = iova, end = start + size - 1;
+       return gather->end != 0 &&
+               (end + 1 < gather->start || start > gather->end + 1);
+ }
+ /**
+  * iommu_iotlb_gather_add_range - Gather for address-based TLB invalidation
+  * @gather: TLB gather data
+  * @iova: start of page to invalidate
+  * @size: size of page to invalidate
+  *
+  * Helper for IOMMU drivers to build arbitrarily-sized invalidation commands
+  * where only the address range matters, and simply minimising intermediate
+  * syncs is preferred.
+  */
+ static inline void iommu_iotlb_gather_add_range(struct iommu_iotlb_gather *gather,
+                                               unsigned long iova, size_t size)
+ {
+       unsigned long end = iova + size - 1;
+       if (gather->start > iova)
+               gather->start = iova;
+       if (gather->end < end)
+               gather->end = end;
+ }
+ /**
+  * iommu_iotlb_gather_add_page - Gather for page-based TLB invalidation
+  * @domain: IOMMU domain to be invalidated
+  * @gather: TLB gather data
+  * @iova: start of page to invalidate
+  * @size: size of page to invalidate
+  *
+  * Helper for IOMMU drivers to build invalidation commands based on individual
+  * pages, or with page size/table level hints which cannot be gathered if they
+  * differ.
+  */
  static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain,
                                               struct iommu_iotlb_gather *gather,
                                               unsigned long iova, size_t size)
  {
-       unsigned long start = iova, end = start + size - 1;
        /*
         * If the new page is disjoint from the current range or is mapped at
         * a different granularity, then sync the TLB so that the gather
         * structure can be rewritten.
         */
-       if (gather->pgsize != size ||
-           end + 1 < gather->start || start > gather->end + 1) {
-               if (gather->pgsize)
-                       iommu_iotlb_sync(domain, gather);
-               gather->pgsize = size;
-       }
+       if ((gather->pgsize && gather->pgsize != size) ||
+           iommu_iotlb_gather_is_disjoint(gather, iova, size))
+               iommu_iotlb_sync(domain, gather);
  
-       if (gather->end < end)
-               gather->end = end;
+       gather->pgsize = size;
+       iommu_iotlb_gather_add_range(gather, iova, size);
+ }
  
-       if (gather->start > start)
-               gather->start = start;
+ static inline bool iommu_iotlb_gather_queued(struct iommu_iotlb_gather *gather)
+ {
+       return gather && gather->queued;
  }
  
  /* PCI device grouping function */
@@@ -679,18 -756,18 +756,18 @@@ static inline size_t iommu_unmap_fast(s
        return 0;
  }
  
 -static inline size_t iommu_map_sg(struct iommu_domain *domain,
 -                                unsigned long iova, struct scatterlist *sg,
 -                                unsigned int nents, int prot)
 +static inline ssize_t iommu_map_sg(struct iommu_domain *domain,
 +                                 unsigned long iova, struct scatterlist *sg,
 +                                 unsigned int nents, int prot)
  {
 -      return 0;
 +      return -ENODEV;
  }
  
 -static inline size_t iommu_map_sg_atomic(struct iommu_domain *domain,
 +static inline ssize_t iommu_map_sg_atomic(struct iommu_domain *domain,
                                  unsigned long iova, struct scatterlist *sg,
                                  unsigned int nents, int prot)
  {
 -      return 0;
 +      return -ENODEV;
  }
  
  static inline void iommu_flush_iotlb_all(struct iommu_domain *domain)
@@@ -870,6 -947,11 +947,11 @@@ static inline void iommu_iotlb_gather_a
  {
  }
  
+ static inline bool iommu_iotlb_gather_queued(struct iommu_iotlb_gather *gather)
+ {
+       return false;
+ }
  static inline void iommu_device_unregister(struct iommu_device *iommu)
  {
  }