]> Git Repo - J-linux.git/commitdiff
Merge tag 'iommu-updates-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Wed, 14 Oct 2020 19:08:34 +0000 (12:08 -0700)
committerLinus Torvalds <[email protected]>
Wed, 14 Oct 2020 19:08:34 +0000 (12:08 -0700)
Pull iommu updates from Joerg Roedel:

 - ARM-SMMU Updates from Will:

      - Continued SVM enablement, where page-table is shared with CPU

      - Groundwork to support integrated SMMU with Adreno GPU

      - Allow disabling of MSI-based polling on the kernel command-line

      - Minor driver fixes and cleanups (octal permissions, error
        messages, ...)

 - Secure Nested Paging Support for AMD IOMMU. The IOMMU will fault when
   a device tries DMA on memory owned by a guest. This needs new
   fault-types as well as a rewrite of the IOMMU memory semaphore for
   command completions.

 - Allow broken Intel IOMMUs (wrong address widths reported) to still be
   used for interrupt remapping.

 - IOMMU UAPI updates for supporting vSVA, where the IOMMU can access
   address spaces of processes running in a VM.

 - Support for the MT8167 IOMMU in the Mediatek IOMMU driver.

 - Device-tree updates for the Renesas driver to support r8a7742.

 - Several smaller fixes and cleanups all over the place.

* tag 'iommu-updates-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (57 commits)
  iommu/vt-d: Gracefully handle DMAR units with no supported address widths
  iommu/vt-d: Check UAPI data processed by IOMMU core
  iommu/uapi: Handle data and argsz filled by users
  iommu/uapi: Rename uapi functions
  iommu/uapi: Use named union for user data
  iommu/uapi: Add argsz for user filled data
  docs: IOMMU user API
  iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  iommu/arm-smmu-v3: Add SVA device feature
  iommu/arm-smmu-v3: Check for SVA features
  iommu/arm-smmu-v3: Seize private ASID
  iommu/arm-smmu-v3: Share process page tables
  iommu/arm-smmu-v3: Move definitions to a header
  iommu/io-pgtable-arm: Move some definitions to a header
  iommu/arm-smmu-v3: Ensure queue is read after updating prod pointer
  iommu/amd: Re-purpose Exclusion range registers to support SNP CWWB
  iommu/amd: Add support for RMP_PAGE_FAULT and RMP_HW_ERR
  iommu/amd: Use 4K page for completion wait write-back semaphore
  iommu/tegra-smmu: Allow to group clients in same swgroup
  iommu/tegra-smmu: Fix iova->phys translation
  ...

1  2 
MAINTAINERS
drivers/iommu/amd/amd_iommu.h
drivers/iommu/amd/iommu.c
drivers/iommu/intel/dmar.c
drivers/iommu/intel/iommu.c
drivers/iommu/intel/svm.c
drivers/iommu/iommu.c
include/linux/intel-iommu.h
include/linux/iommu.h

diff --combined MAINTAINERS
index c65750cfe3dda7883c73d3375091ca5b006fe8f3,e08940b29f45632748389fc1de63938427a82b3d..0c98c6fcd6de00633843a1ec35b5a5d4fd41af83
@@@ -405,7 -405,7 +405,7 @@@ F: drivers/platform/x86/i2c-multi-insta
  ACPI PMIC DRIVERS
  M:    "Rafael J. Wysocki" <[email protected]>
  M:    Len Brown <[email protected]>
 -R:    Andy Shevchenko <and[email protected]>
 +R:    Andy Shevchenko <and[email protected]>
  R:    Mika Westerberg <[email protected]>
  L:    [email protected]
  S:    Supported
@@@ -802,13 -802,6 +802,13 @@@ S:       Maintaine
  F:    Documentation/devicetree/bindings/interrupt-controller/amazon,al-fic.txt
  F:    drivers/irqchip/irq-al-fic.c
  
 +AMAZON ANNAPURNA LABS MEMORY CONTROLLER EDAC
 +M:    Talel Shenhar <[email protected]>
 +M:    Talel Shenhar <[email protected]>
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml
 +F:    drivers/edac/al_mc_edac.c
 +
  AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER
  M:    Talel Shenhar <[email protected]>
  S:    Maintained
@@@ -1467,11 -1460,6 +1467,11 @@@ S:    Odd Fixe
  F:    drivers/amba/
  F:    include/linux/amba/bus.h
  
 +ARM PRIMECELL CLCD PL110 DRIVER
 +M:    Russell King <[email protected]>
 +S:    Odd Fixes
 +F:    drivers/video/fbdev/amba-clcd.*
 +
  ARM PRIMECELL KMI PL050 DRIVER
  M:    Russell King <[email protected]>
  S:    Odd Fixes
@@@ -1518,8 -1506,7 +1518,7 @@@ L:      [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/iommu/arm,smmu*
  F:    drivers/iommu/arm/
- F:    drivers/iommu/io-pgtable-arm-v7s.c
- F:    drivers/iommu/io-pgtable-arm.c
+ F:    drivers/iommu/io-pgtable-arm*
  
  ARM SUB-ARCHITECTURES
  L:    [email protected] (moderated for non-subscribers)
@@@ -1537,7 -1524,6 +1536,7 @@@ F:      Documentation/devicetree/bindings/ar
  F:    Documentation/devicetree/bindings/clock/actions,owl-cmu.txt
  F:    Documentation/devicetree/bindings/dma/owl-dma.txt
  F:    Documentation/devicetree/bindings/i2c/i2c-owl.txt
 +F:    Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml
  F:    Documentation/devicetree/bindings/mmc/owl-mmc.yaml
  F:    Documentation/devicetree/bindings/pinctrl/actions,s900-pinctrl.txt
  F:    Documentation/devicetree/bindings/power/actions,owl-sps.txt
@@@ -1549,7 -1535,6 +1548,7 @@@ F:      drivers/clk/actions
  F:    drivers/clocksource/timer-owl*
  F:    drivers/dma/owl-dma.c
  F:    drivers/i2c/busses/i2c-owl.c
 +F:    drivers/irqchip/irq-owl-sirq.c
  F:    drivers/mmc/host/owl-mmc.c
  F:    drivers/pinctrl/actions/*
  F:    drivers/soc/actions/
@@@ -1637,7 -1622,7 +1636,7 @@@ N:      meso
  
  ARM/Annapurna Labs ALPINE ARCHITECTURE
  M:    Tsahee Zidenberg <[email protected]>
 -M:    Antoine Tenart <a[email protected]>
 +M:    Antoine Tenart <a[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/boot/dts/alpine*
@@@ -2459,7 -2444,7 +2458,7 @@@ L:      [email protected] (m
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/media/s5p-cec.txt
 -F:    drivers/media/platform/s5p-cec/
 +F:    drivers/media/cec/platform/s5p/
  
  ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT
  M:    Andrzej Pietrasiewicz <[email protected]>
@@@ -2518,7 -2503,7 +2517,7 @@@ S:      Maintaine
  F:    drivers/clk/socfpga/
  
  ARM/SOCFPGA EDAC SUPPORT
 -M:    Thor Thayer <[email protected]>
 +M:    Dinh Nguyen <[email protected]>
  S:    Maintained
  F:    drivers/edac/altera_edac.
  
@@@ -2604,7 -2589,7 +2603,7 @@@ L:      [email protected]
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/media/tegra-cec.txt
 -F:    drivers/media/platform/tegra-cec/
 +F:    drivers/media/cec/platform/tegra/
  
  ARM/TETON BGA MACHINE SUPPORT
  M:    "Mark F. Brown" <[email protected]>
@@@ -4044,7 -4029,7 +4043,7 @@@ S:      Supporte
  W:    http://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
  F:    Documentation/devicetree/bindings/media/cec-gpio.txt
 -F:    drivers/media/platform/cec-gpio/
 +F:    drivers/media/cec/platform/cec-gpio/
  
  CELL BROADBAND ENGINE ARCHITECTURE
  M:    Arnd Bergmann <[email protected]>
@@@ -5388,6 -5373,7 +5387,6 @@@ F:      include/linux/kobj
  F:    lib/kobj*
  
  DRIVERS FOR ADAPTIVE VOLTAGE SCALING (AVS)
 -M:    Kevin Hilman <[email protected]>
  M:    Nishanth Menon <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -6192,7 -6178,7 +6191,7 @@@ S:      Supporte
  F:    drivers/edac/bluefield_edac.c
  
  EDAC-CALXEDA
 -M:    Robert Richter <[email protected]>
 +M:    Andre Przywara <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/edac/highbank*
@@@ -7248,7 -7234,7 +7247,7 @@@ F:      drivers/staging/gasket
  GCC PLUGINS
  M:    Kees Cook <[email protected]>
  R:    Emese Revfy <[email protected]>
 -L:    [email protected]
 +L:    [email protected]
  S:    Maintained
  F:    Documentation/kbuild/gcc-plugins.rst
  F:    scripts/Makefile.gcc-plugins
@@@ -8686,7 -8672,7 +8685,7 @@@ F:      drivers/input/input-mt.
  K:    \b(ABS|SYN)_MT_
  
  INSIDE SECURE CRYPTO DRIVER
 -M:    Antoine Tenart <a[email protected]>
 +M:    Antoine Tenart <a[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/crypto/inside-secure/
@@@ -8765,8 -8751,7 +8764,8 @@@ F:      include/drm/i915
  F:    include/uapi/drm/i915_drm.h
  
  INTEL ETHERNET DRIVERS
 -M:    Jeff Kirsher <[email protected]>
 +M:    Jesse Brandeburg <[email protected]>
 +M:    Tony Nguyen <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Supported
  W:    http://www.intel.com/support/feedback.htm
@@@ -8865,7 -8850,7 +8864,7 @@@ INTEL IPU3 CSI-2 CIO2 DRIVE
  M:    Yong Zhi <[email protected]>
  M:    Sakari Ailus <[email protected]>
  M:    Bingbu Cao <[email protected]>
 -R:    Tian Shu Qiu <[email protected]>
 +R:    Tianshu Qiu <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/userspace-api/media/v4l/pixfmt-srggb10-ipu3.rst
@@@ -8874,7 -8859,7 +8873,7 @@@ F:      drivers/media/pci/intel/ipu3
  INTEL IPU3 CSI-2 IMGU DRIVER
  M:    Sakari Ailus <[email protected]>
  R:    Bingbu Cao <[email protected]>
 -R:    Tian Shu Qiu <[email protected]>
 +R:    Tianshu Qiu <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/admin-guide/media/ipu3.rst
@@@ -8939,8 -8924,8 +8938,8 @@@ F:      arch/x86/include/asm/intel_punit_ipc
  F:    drivers/platform/x86/intel_punit_ipc.c
  
  INTEL PMC CORE DRIVER
 -M:    Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
 -M:    Vishwanath Somayaji <vishwanath.somayaji@intel.com>
 +M:    Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
 +M:    David E Box <david.e.box@intel.com>
  L:    [email protected]
  S:    Maintained
  F:    drivers/platform/x86/intel_pmc_core*
@@@ -8953,7 -8938,7 +8952,7 @@@ F:      drivers/gpio/gpio-*cove.
  F:    drivers/gpio/gpio-msic.c
  
  INTEL PMIC MULTIFUNCTION DEVICE DRIVERS
 -R:    Andy Shevchenko <[email protected]>
 +M:    Andy Shevchenko <[email protected]>
  S:    Maintained
  F:    drivers/mfd/intel_msic.c
  F:    drivers/mfd/intel_soc_pmic*
@@@ -9134,6 -9119,7 +9133,7 @@@ L:      [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
  F:    Documentation/devicetree/bindings/iommu/
+ F:    Documentation/userspace-api/iommu.rst
  F:    drivers/iommu/
  F:    include/linux/iommu.h
  F:    include/linux/iova.h
@@@ -9726,8 -9712,8 +9726,8 @@@ M:      Catalin Marinas <catalin.marinas@arm
  S:    Maintained
  F:    Documentation/dev-tools/kmemleak.rst
  F:    include/linux/kmemleak.h
 -F:    mm/kmemleak-test.c
  F:    mm/kmemleak.c
 +F:    samples/kmemleak/kmemleak-test.c
  
  KMOD KERNEL MODULE LOADER - USERMODE HELPER
  M:    Luis Chamberlain <[email protected]>
@@@ -9810,7 -9796,7 +9810,7 @@@ F:      drivers/scsi/53c700
  LEAKING_ADDRESSES
  M:    Tobin C. Harding <[email protected]>
  M:    Tycho Andersen <[email protected]>
 -L:    [email protected]
 +L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git
  F:    scripts/leaking_addresses.pl
@@@ -9881,6 -9867,15 +9881,6 @@@ T:     git git://git.kernel.org/pub/scm/lin
  F:    drivers/ata/pata_arasan_cf.c
  F:    include/linux/pata_arasan_cf_data.h
  
 -LIBATA PATA DRIVERS
 -M:    Bartlomiej Zolnierkiewicz <[email protected]>
 -M:    Jens Axboe <[email protected]>
 -L:    [email protected]
 -S:    Maintained
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
 -F:    drivers/ata/ata_generic.c
 -F:    drivers/ata/pata_*.c
 -
  LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS
  M:    Linus Walleij <[email protected]>
  L:    [email protected]
@@@ -11318,8 -11313,8 +11318,8 @@@ S:   Supporte
  W:    http://linux-meson.com/
  T:    git git://linuxtv.org/media_tree.git
  F:    Documentation/devicetree/bindings/media/amlogic,meson-gx-ao-cec.yaml
 -F:    drivers/media/platform/meson/ao-cec-g12a.c
 -F:    drivers/media/platform/meson/ao-cec.c
 +F:    drivers/media/cec/platform/meson/ao-cec-g12a.c
 +F:    drivers/media/cec/platform/meson/ao-cec.c
  
  MESON NAND CONTROLLER DRIVER FOR AMLOGIC SOCS
  M:    Liang Yang <[email protected]>
@@@ -11329,6 -11324,7 +11329,6 @@@ F:   Documentation/devicetree/bindings/mt
  F:    drivers/mtd/nand/raw/meson_*
  
  MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS
 -M:    Maxime Jourdan <[email protected]>
  M:    Neil Armstrong <[email protected]>
  L:    [email protected]
  L:    [email protected]
@@@ -11779,13 -11775,6 +11779,13 @@@ Q: http://patchwork.linuxtv.org/project
  T:    git git://linuxtv.org/anttip/media_tree.git
  F:    drivers/media/usb/msi2500/
  
 +MSTAR INTERRUPT CONTROLLER DRIVER
 +M:    Mark-PK Tsai <[email protected]>
 +M:    Daniel Palmer <[email protected]>
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/interrupt-controller/mstar,mst-intc.yaml
 +F:    drivers/irqchip/irq-mst-intc.c
 +
  MSYSTEMS DISKONCHIP G3 MTD DRIVER
  M:    Robert Jarzmik <[email protected]>
  L:    [email protected]
@@@ -12088,7 -12077,6 +12088,7 @@@ NETWORKING [DSA
  M:    Andrew Lunn <[email protected]>
  M:    Vivien Didelot <[email protected]>
  M:    Florian Fainelli <[email protected]>
 +M:    Vladimir Oltean <[email protected]>
  S:    Maintained
  F:    Documentation/devicetree/bindings/net/dsa/
  F:    drivers/net/dsa/
@@@ -12514,7 -12502,6 +12514,7 @@@ M:   Josh Poimboeuf <[email protected]
  M:    Peter Zijlstra <[email protected]>
  S:    Supported
  F:    tools/objtool/
 +F:    include/linux/objtool.h
  
  OCELOT ETHERNET SWITCH DRIVER
  M:    Microchip Linux Driver Support <[email protected]>
@@@ -12776,7 -12763,7 +12776,7 @@@ T:   git git://linuxtv.org/media_tree.gi
  F:    drivers/media/i2c/ov2685.c
  
  OMNIVISION OV2740 SENSOR DRIVER
 -M:    Tianshu Qiu <tian.shu.qiua@intel.com>
 +M:    Tianshu Qiu <[email protected]>
  R:    Shawn Tu <[email protected]>
  R:    Bingbu Cao <[email protected]>
  L:    [email protected]
@@@ -12792,12 -12779,10 +12792,12 @@@ T:        git git://linuxtv.org/media_tree.gi
  F:    drivers/media/i2c/ov5640.c
  
  OMNIVISION OV5647 SENSOR DRIVER
 -M:    Luis Oliveira <[email protected]>
 +M:    Dave Stevenson <[email protected]>
 +M:    Jacopo Mondi <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/ov5647.yaml
  F:    drivers/media/i2c/ov5647.c
  
  OMNIVISION OV5670 SENSOR DRIVER
@@@ -13060,9 -13045,7 +13060,9 @@@ F:   lib/packing.
  
  PADATA PARALLEL EXECUTION MECHANISM
  M:    Steffen Klassert <[email protected]>
 +M:    Daniel Jordan <[email protected]>
  L:    [email protected]
 +L:    [email protected]
  S:    Maintained
  F:    Documentation/core-api/padata.rst
  F:    include/linux/padata.h
@@@ -13970,7 -13953,6 +13970,7 @@@ PRINT
  M:    Petr Mladek <[email protected]>
  M:    Sergey Senozhatsky <[email protected]>
  R:    Steven Rostedt <[email protected]>
 +R:    John Ogness <[email protected]>
  S:    Maintained
  F:    include/linux/printk.h
  F:    kernel/printk/
@@@ -14254,7 -14236,7 +14254,7 @@@ QLOGIC QLA3XXX NETWORK DRIVE
  M:    [email protected]
  L:    [email protected]
  S:    Supported
 -F:    Documentation/networking/device_drivers/ethernet/qlogic/LICENSE.qla3xxx
 +F:    Documentation/networking/device_drivers/qlogic/LICENSE.qla3xxx
  F:    drivers/net/ethernet/qlogic/qla3xxx.*
  
  QLOGIC QLA4XXX iSCSI DRIVER
@@@ -14609,9 -14591,9 +14609,9 @@@ M:   Niklas Söderlund <niklas.soderlund+
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/media/i2c/imi,rdacm2x-gmsl.yaml
 -F:    drivers/media/i2c/rdacm20.c
  F:    drivers/media/i2c/max9271.c
  F:    drivers/media/i2c/max9271.h
 +F:    drivers/media/i2c/rdacm20.c
  
  RDC R-321X SoC
  M:    Florian Fainelli <[email protected]>
@@@ -14905,11 -14887,8 +14905,11 @@@ F: include/linux/hid-roccat
  
  ROCKCHIP ISP V1 DRIVER
  M:    Helen Koike <[email protected]>
 +M:    Dafna Hirschfeld <[email protected]>
  L:    [email protected]
  S:    Maintained
 +F:    Documentation/admin-guide/media/rkisp1.rst
 +F:    Documentation/userspace-api/media/v4l/pixfmt-meta-rkisp1.rst
  F:    drivers/staging/media/rkisp1/
  
  ROCKCHIP RASTER 2D GRAPHIC ACCELERATION UNIT DRIVER
@@@ -15405,7 -15384,6 +15405,7 @@@ R:   Dietmar Eggemann <dietmar.eggemann@a
  R:    Steven Rostedt <[email protected]> (SCHED_FIFO/SCHED_RR)
  R:    Ben Segall <[email protected]> (CONFIG_CFS_BANDWIDTH)
  R:    Mel Gorman <[email protected]> (CONFIG_NUMA_BALANCING)
 +R:    Daniel Bristot de Oliveira <[email protected]> (SCHED_DEADLINE)
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
@@@ -15527,8 -15505,8 +15527,8 @@@ F:   drivers/mmc/host/sdricoh_cs.
  SECO BOARDS CEC DRIVER
  M:    Ettore Chimenti <[email protected]>
  S:    Maintained
 -F:    drivers/media/platform/seco-cec/seco-cec.c
 -F:    drivers/media/platform/seco-cec/seco-cec.h
 +F:    drivers/media/cec/platform/seco/seco-cec.c
 +F:    drivers/media/cec/platform/seco/seco-cec.h
  
  SECURE COMPUTING
  M:    Kees Cook <[email protected]>
@@@ -15621,7 -15599,6 +15621,7 @@@ T:   git git://git.kernel.org/pub/scm/lin
  F:    Documentation/ABI/obsolete/sysfs-selinux-checkreqprot
  F:    Documentation/ABI/obsolete/sysfs-selinux-disable
  F:    Documentation/admin-guide/LSM/SELinux.rst
 +F:    include/trace/events/avc.h
  F:    include/uapi/linux/selinux_netlink.h
  F:    scripts/selinux/
  F:    security/selinux/
@@@ -16096,6 -16073,7 +16096,6 @@@ F:   include/uapi/rdma/rdma_user_rxe.
  SOFTLOGIC 6x10 MPEG CODEC
  M:    Bluecherry Maintainers <[email protected]>
  M:    Anton Sviridenko <[email protected]>
 -M:    Andrey Utkin <[email protected]>
  M:    Andrey Utkin <[email protected]>
  M:    Ismael Luceno <[email protected]>
  L:    [email protected]
@@@ -16563,7 -16541,7 +16563,7 @@@ STI CEC DRIVE
  M:    Benjamin Gaignard <[email protected]>
  S:    Maintained
  F:    Documentation/devicetree/bindings/media/stih-cec.txt
 -F:    drivers/media/platform/sti/cec/
 +F:    drivers/media/cec/platform/sti/
  
  STK1160 USB VIDEO CAPTURE DRIVER
  M:    Ezequiel Garcia <[email protected]>
@@@ -16747,13 -16725,6 +16747,13 @@@ S: Maintaine
  F:    Documentation/devicetree/bindings/gpio/snps,dw-apb-gpio.yaml
  F:    drivers/gpio/gpio-dwapb.c
  
 +SYNOPSYS DESIGNWARE APB SSI DRIVER
 +M:    Serge Semin <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
 +F:    drivers/spi/spi-dw*
 +
  SYNOPSYS DESIGNWARE AXI DMAC DRIVER
  M:    Eugeniy Paltsev <[email protected]>
  S:    Maintained
  S:    Maintained
  W:    https://kernsec.org/wiki/index.php/Linux_Kernel_Integrity
  Q:    https://patchwork.kernel.org/project/linux-integrity/list/
 -T:    git git://git.infradead.org/users/jjs/linux-tpmdd.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git
  F:    drivers/char/tpm/
  
  TRACING
@@@ -17757,7 -17728,6 +17757,7 @@@ S:   Supporte
  W:    http://www.linux-mtd.infradead.org/doc/ubifs.html
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git next
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git fixes
 +F:    Documentation/filesystems/ubifs-authentication.rst
  F:    Documentation/filesystems/ubifs.rst
  F:    fs/ubifs/
  
@@@ -18151,6 -18121,14 +18151,6 @@@ T:  git git://linuxtv.org/media_tree.gi
  F:    drivers/media/usb/uvc/
  F:    include/uapi/linux/uvcvideo.h
  
 -USB VISION DRIVER
 -M:    Hans Verkuil <[email protected]>
 -L:    [email protected]
 -S:    Odd Fixes
 -W:    https://linuxtv.org
 -T:    git git://linuxtv.org/media_tree.git
 -F:    drivers/staging/media/usbvision/
 -
  USB WEBCAM GADGET
  M:    Laurent Pinchart <[email protected]>
  L:    [email protected]
@@@ -18304,8 -18282,7 +18304,8 @@@ F:   drivers/gpu/vga/vga_switcheroo.
  F:    include/linux/vga_switcheroo.h
  
  VIA RHINE NETWORK DRIVER
 -S:    Orphan
 +S:    Maintained
 +M:    Kevin Brace <[email protected]>
  F:    drivers/net/ethernet/via/via-rhine.c
  
  VIA SD/MMC CARD CONTROLLER DRIVER
@@@ -18350,8 -18327,10 +18350,8 @@@ S:  Maintaine
  F:    drivers/media/platform/video-mux.c
  
  VIDEOBUF2 FRAMEWORK
 -M:    Pawel Osciak <[email protected]>
 +M:    Tomasz Figa <[email protected]>
  M:    Marek Szyprowski <[email protected]>
 -M:    Kyungmin Park <[email protected]>
 -R:    Tomasz Figa <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/media/common/videobuf2/*
@@@ -18541,14 -18520,6 +18541,14 @@@ W: https://linuxtv.or
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/test-drivers/vivid/*
  
 +VIDTV VIRTUAL DIGITAL TV DRIVER
 +M:    Daniel W. S. Almeida <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +W:    https://linuxtv.org
 +T:    git git://linuxtv.org/media_tree.git
 +F:    drivers/media/test-drivers/vidtv/*
 +
  VLYNQ BUS
  M:    Florian Fainelli <[email protected]>
  L:    [email protected] (subscribers-only)
@@@ -18916,11 -18887,11 +18916,11 @@@ T:        git git://git.kernel.org/pub/scm/lin
  F:    arch/x86/mm/
  
  X86 PLATFORM DRIVERS
 -M:    Darren Hart <[email protected]>
 -M:    Andy Shevchenko <[email protected]>
 +M:    Hans de Goede <[email protected]>
 +M:    Mark Gross <[email protected]>
  L:    [email protected]
 -S:    Odd Fixes
 -T:    git git://git.infradead.org/linux-platform-drivers-x86.git
 +S:    Maintained
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
  F:    drivers/platform/olpc/
  F:    drivers/platform/x86/
  
@@@ -19269,16 -19240,6 +19269,16 @@@ T: git git://git.kernel.org/pub/scm/lin
  F:    Documentation/filesystems/zonefs.rst
  F:    fs/zonefs/
  
 +ZR36067 VIDEO FOR LINUX DRIVER
 +M:    Corentin Labbe <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +W:    http://mjpeg.sourceforge.net/driver-zoran/
 +Q:    https://patchwork.linuxtv.org/project/linux-media/list/
 +F:    Documentation/driver-api/media/drivers/zoran.rst
 +F:    drivers/staging/media/zoran/
 +
  ZPOOL COMPRESSED PAGE STORAGE API
  M:    Dan Streetman <[email protected]>
  L:    [email protected]
index 030ee90197a14729031aa04f74b9150e4f9afacc,0781b71124676bca71900c4fa7a584fb1ed2b4db..6b8cbdf7171407bfbe8f6114cf7cc40a8b02b897
@@@ -41,16 -41,25 +41,25 @@@ extern int amd_iommu_guest_ir
  struct iommu_domain;
  
  extern bool amd_iommu_v2_supported(void);
+ extern struct amd_iommu *get_amd_iommu(unsigned int idx);
+ extern u8 amd_iommu_pc_get_max_banks(unsigned int idx);
+ extern bool amd_iommu_pc_supported(void);
+ extern u8 amd_iommu_pc_get_max_counters(unsigned int idx);
+ extern int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
+                               u8 fxn, u64 *value);
+ extern int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
+                               u8 fxn, u64 *value);
  extern int amd_iommu_register_ppr_notifier(struct notifier_block *nb);
  extern int amd_iommu_unregister_ppr_notifier(struct notifier_block *nb);
  extern void amd_iommu_domain_direct_map(struct iommu_domain *dom);
  extern int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids);
 -extern int amd_iommu_flush_page(struct iommu_domain *dom, int pasid,
 +extern int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
                                u64 address);
 -extern int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid);
 -extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid,
 +extern int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid);
 +extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, u32 pasid,
                                     unsigned long cr3);
 -extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid);
 +extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, u32 pasid);
  extern struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev);
  
  #ifdef CONFIG_IRQ_REMAP
@@@ -66,7 -75,7 +75,7 @@@ static inline int amd_iommu_create_irq_
  #define PPR_INVALID                   0x1
  #define PPR_FAILURE                   0xf
  
 -extern int amd_iommu_complete_ppr(struct pci_dev *pdev, int pasid,
 +extern int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid,
                                  int status, int tag);
  
  static inline bool is_rd890_iommu(struct pci_dev *pdev)
index 9e231caa5012210420f4daf76fc7c39b7bb7a5d6,ea64fa8a941815d00f7ff8e487dd38559e0e902f..4b1b02c80f556d1a84fbed9bd8e53e7cd375d56a
@@@ -486,6 -486,67 +486,67 @@@ static void dump_command(unsigned long 
                pr_err("CMD[%d]: %08x\n", i, cmd->data[i]);
  }
  
+ static void amd_iommu_report_rmp_hw_error(volatile u32 *event)
+ {
+       struct iommu_dev_data *dev_data = NULL;
+       int devid, vmg_tag, flags;
+       struct pci_dev *pdev;
+       u64 spa;
+       devid   = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
+       vmg_tag = (event[1]) & 0xFFFF;
+       flags   = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
+       spa     = ((u64)event[3] << 32) | (event[2] & 0xFFFFFFF8);
+       pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
+                                          devid & 0xff);
+       if (pdev)
+               dev_data = dev_iommu_priv_get(&pdev->dev);
+       if (dev_data && __ratelimit(&dev_data->rs)) {
+               pci_err(pdev, "Event logged [RMP_HW_ERROR vmg_tag=0x%04x, spa=0x%llx, flags=0x%04x]\n",
+                       vmg_tag, spa, flags);
+       } else {
+               pr_err_ratelimited("Event logged [RMP_HW_ERROR device=%02x:%02x.%x, vmg_tag=0x%04x, spa=0x%llx, flags=0x%04x]\n",
+                       PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
+                       vmg_tag, spa, flags);
+       }
+       if (pdev)
+               pci_dev_put(pdev);
+ }
+ static void amd_iommu_report_rmp_fault(volatile u32 *event)
+ {
+       struct iommu_dev_data *dev_data = NULL;
+       int devid, flags_rmp, vmg_tag, flags;
+       struct pci_dev *pdev;
+       u64 gpa;
+       devid     = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
+       flags_rmp = (event[0] >> EVENT_FLAGS_SHIFT) & 0xFF;
+       vmg_tag   = (event[1]) & 0xFFFF;
+       flags     = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
+       gpa       = ((u64)event[3] << 32) | event[2];
+       pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
+                                          devid & 0xff);
+       if (pdev)
+               dev_data = dev_iommu_priv_get(&pdev->dev);
+       if (dev_data && __ratelimit(&dev_data->rs)) {
+               pci_err(pdev, "Event logged [RMP_PAGE_FAULT vmg_tag=0x%04x, gpa=0x%llx, flags_rmp=0x%04x, flags=0x%04x]\n",
+                       vmg_tag, gpa, flags_rmp, flags);
+       } else {
+               pr_err_ratelimited("Event logged [RMP_PAGE_FAULT device=%02x:%02x.%x, vmg_tag=0x%04x, gpa=0x%llx, flags_rmp=0x%04x, flags=0x%04x]\n",
+                       PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
+                       vmg_tag, gpa, flags_rmp, flags);
+       }
+       if (pdev)
+               pci_dev_put(pdev);
+ }
  static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
                                        u64 address, int flags)
  {
  static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
  {
        struct device *dev = iommu->iommu.dev;
 -      int type, devid, pasid, flags, tag;
 +      int type, devid, flags, tag;
        volatile u32 *event = __evt;
        int count = 0;
        u64 address;
 +      u32 pasid;
  
  retry:
        type    = (event[1] >> EVENT_TYPE_SHIFT)  & EVENT_TYPE_MASK;
                        PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
                        pasid, address, flags);
                break;
+       case EVENT_TYPE_RMP_FAULT:
+               amd_iommu_report_rmp_fault(event);
+               break;
+       case EVENT_TYPE_RMP_HW_ERR:
+               amd_iommu_report_rmp_hw_error(event);
+               break;
        case EVENT_TYPE_INV_PPR_REQ:
                pasid = PPR_PASID(*((u64 *)__evt));
                tag = event[1] & 0x03FF;
@@@ -730,21 -796,7 +797,21 @@@ static void iommu_poll_ga_log(struct am
                }
        }
  }
 -#endif /* CONFIG_IRQ_REMAP */
 +
 +static void
 +amd_iommu_set_pci_msi_domain(struct device *dev, struct amd_iommu *iommu)
 +{
 +      if (!irq_remapping_enabled || !dev_is_pci(dev) ||
 +          pci_dev_has_special_msi_domain(to_pci_dev(dev)))
 +              return;
 +
 +      dev_set_msi_domain(dev, iommu->msi_domain);
 +}
 +
 +#else /* CONFIG_IRQ_REMAP */
 +static inline void
 +amd_iommu_set_pci_msi_domain(struct device *dev, struct amd_iommu *iommu) { }
 +#endif /* !CONFIG_IRQ_REMAP */
  
  #define AMD_IOMMU_INT_MASK    \
        (MMIO_STATUS_EVT_INT_MASK | \
@@@ -807,11 -859,11 +874,11 @@@ irqreturn_t amd_iommu_int_handler(int i
   *
   ****************************************************************************/
  
- static int wait_on_sem(volatile u64 *sem)
+ static int wait_on_sem(struct amd_iommu *iommu, u64 data)
  {
        int i = 0;
  
-       while (*sem == 0 && i < LOOP_TIMEOUT) {
+       while (*iommu->cmd_sem != data && i < LOOP_TIMEOUT) {
                udelay(1);
                i += 1;
        }
@@@ -842,16 -894,16 +909,16 @@@ static void copy_cmd_to_buffer(struct a
        writel(tail, iommu->mmio_base + MMIO_CMD_TAIL_OFFSET);
  }
  
- static void build_completion_wait(struct iommu_cmd *cmd, u64 address)
+ static void build_completion_wait(struct iommu_cmd *cmd,
+                                 struct amd_iommu *iommu,
+                                 u64 data)
  {
-       u64 paddr = iommu_virt_to_phys((void *)address);
-       WARN_ON(address & 0x7ULL);
+       u64 paddr = iommu_virt_to_phys((void *)iommu->cmd_sem);
  
        memset(cmd, 0, sizeof(*cmd));
        cmd->data[0] = lower_32_bits(paddr) | CMD_COMPL_WAIT_STORE_MASK;
        cmd->data[1] = upper_32_bits(paddr);
-       cmd->data[2] = 1;
+       cmd->data[2] = data;
        CMD_SET_TYPE(cmd, CMD_COMPL_WAIT);
  }
  
@@@ -924,7 -976,7 +991,7 @@@ static void build_inv_iotlb_pages(struc
                cmd->data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK;
  }
  
 -static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, int pasid,
 +static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, u32 pasid,
                                  u64 address, bool size)
  {
        memset(cmd, 0, sizeof(*cmd));
        CMD_SET_TYPE(cmd, CMD_INV_IOMMU_PAGES);
  }
  
 -static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid,
 +static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, u32 pasid,
                                  int qdep, u64 address, bool size)
  {
        memset(cmd, 0, sizeof(*cmd));
        CMD_SET_TYPE(cmd, CMD_INV_IOTLB_PAGES);
  }
  
 -static void build_complete_ppr(struct iommu_cmd *cmd, u16 devid, int pasid,
 +static void build_complete_ppr(struct iommu_cmd *cmd, u16 devid, u32 pasid,
                               int status, int tag, bool gn)
  {
        memset(cmd, 0, sizeof(*cmd));
@@@ -1060,22 -1112,21 +1127,21 @@@ static int iommu_completion_wait(struc
        struct iommu_cmd cmd;
        unsigned long flags;
        int ret;
+       u64 data;
  
        if (!iommu->need_sync)
                return 0;
  
-       build_completion_wait(&cmd, (u64)&iommu->cmd_sem);
        raw_spin_lock_irqsave(&iommu->lock, flags);
  
-       iommu->cmd_sem = 0;
+       data = ++iommu->cmd_sem_val;
+       build_completion_wait(&cmd, iommu, data);
  
        ret = __iommu_queue_command_sync(iommu, &cmd, false);
        if (ret)
                goto out_unlock;
  
-       ret = wait_on_sem(&iommu->cmd_sem);
+       ret = wait_on_sem(iommu, data);
  
  out_unlock:
        raw_spin_unlock_irqrestore(&iommu->lock, flags);
@@@ -2172,7 -2223,6 +2238,7 @@@ static struct iommu_device *amd_iommu_p
                iommu_dev = ERR_PTR(ret);
                iommu_ignore_device(dev);
        } else {
 +              amd_iommu_set_pci_msi_domain(dev, iommu);
                iommu_dev = &iommu->iommu;
        }
  
@@@ -2802,7 -2852,7 +2868,7 @@@ out
  }
  EXPORT_SYMBOL(amd_iommu_domain_enable_v2);
  
 -static int __flush_pasid(struct protection_domain *domain, int pasid,
 +static int __flush_pasid(struct protection_domain *domain, u32 pasid,
                         u64 address, bool size)
  {
        struct iommu_dev_data *dev_data;
        return ret;
  }
  
 -static int __amd_iommu_flush_page(struct protection_domain *domain, int pasid,
 +static int __amd_iommu_flush_page(struct protection_domain *domain, u32 pasid,
                                  u64 address)
  {
        return __flush_pasid(domain, pasid, address, false);
  }
  
 -int amd_iommu_flush_page(struct iommu_domain *dom, int pasid,
 +int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
                         u64 address)
  {
        struct protection_domain *domain = to_pdomain(dom);
  }
  EXPORT_SYMBOL(amd_iommu_flush_page);
  
 -static int __amd_iommu_flush_tlb(struct protection_domain *domain, int pasid)
 +static int __amd_iommu_flush_tlb(struct protection_domain *domain, u32 pasid)
  {
        return __flush_pasid(domain, pasid, CMD_INV_IOMMU_ALL_PAGES_ADDRESS,
                             true);
  }
  
 -int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid)
 +int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid)
  {
        struct protection_domain *domain = to_pdomain(dom);
        unsigned long flags;
  }
  EXPORT_SYMBOL(amd_iommu_flush_tlb);
  
 -static u64 *__get_gcr3_pte(u64 *root, int level, int pasid, bool alloc)
 +static u64 *__get_gcr3_pte(u64 *root, int level, u32 pasid, bool alloc)
  {
        int index;
        u64 *pte;
        return pte;
  }
  
 -static int __set_gcr3(struct protection_domain *domain, int pasid,
 +static int __set_gcr3(struct protection_domain *domain, u32 pasid,
                      unsigned long cr3)
  {
        struct domain_pgtable pgtable;
        return __amd_iommu_flush_tlb(domain, pasid);
  }
  
 -static int __clear_gcr3(struct protection_domain *domain, int pasid)
 +static int __clear_gcr3(struct protection_domain *domain, u32 pasid)
  {
        struct domain_pgtable pgtable;
        u64 *pte;
        return __amd_iommu_flush_tlb(domain, pasid);
  }
  
 -int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid,
 +int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, u32 pasid,
                              unsigned long cr3)
  {
        struct protection_domain *domain = to_pdomain(dom);
  }
  EXPORT_SYMBOL(amd_iommu_domain_set_gcr3);
  
 -int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid)
 +int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, u32 pasid)
  {
        struct protection_domain *domain = to_pdomain(dom);
        unsigned long flags;
  }
  EXPORT_SYMBOL(amd_iommu_domain_clear_gcr3);
  
 -int amd_iommu_complete_ppr(struct pci_dev *pdev, int pasid,
 +int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid,
                           int status, int tag)
  {
        struct iommu_dev_data *dev_data;
@@@ -3535,51 -3585,69 +3601,51 @@@ static void irte_ga_clear_allocated(str
  
  static int get_devid(struct irq_alloc_info *info)
  {
 -      int devid = -1;
 -
        switch (info->type) {
        case X86_IRQ_ALLOC_TYPE_IOAPIC:
 -              devid     = get_ioapic_devid(info->ioapic_id);
 -              break;
 +      case X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT:
 +              return get_ioapic_devid(info->devid);
        case X86_IRQ_ALLOC_TYPE_HPET:
 -              devid     = get_hpet_devid(info->hpet_id);
 -              break;
 -      case X86_IRQ_ALLOC_TYPE_MSI:
 -      case X86_IRQ_ALLOC_TYPE_MSIX:
 -              devid = get_device_id(&info->msi_dev->dev);
 -              break;
 +      case X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT:
 +              return get_hpet_devid(info->devid);
 +      case X86_IRQ_ALLOC_TYPE_PCI_MSI:
 +      case X86_IRQ_ALLOC_TYPE_PCI_MSIX:
 +              return get_device_id(msi_desc_to_dev(info->desc));
        default:
 -              BUG_ON(1);
 -              break;
 +              WARN_ON_ONCE(1);
 +              return -1;
        }
 -
 -      return devid;
  }
  
 -static struct irq_domain *get_ir_irq_domain(struct irq_alloc_info *info)
 +static struct irq_domain *get_irq_domain_for_devid(struct irq_alloc_info *info,
 +                                                 int devid)
  {
 -      struct amd_iommu *iommu;
 -      int devid;
 +      struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
  
 -      if (!info)
 +      if (!iommu)
                return NULL;
  
 -      devid = get_devid(info);
 -      if (devid >= 0) {
 -              iommu = amd_iommu_rlookup_table[devid];
 -              if (iommu)
 -                      return iommu->ir_domain;
 +      switch (info->type) {
 +      case X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT:
 +      case X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT:
 +              return iommu->ir_domain;
 +      default:
 +              WARN_ON_ONCE(1);
 +              return NULL;
        }
 -
 -      return NULL;
  }
  
  static struct irq_domain *get_irq_domain(struct irq_alloc_info *info)
  {
 -      struct amd_iommu *iommu;
        int devid;
  
        if (!info)
                return NULL;
  
 -      switch (info->type) {
 -      case X86_IRQ_ALLOC_TYPE_MSI:
 -      case X86_IRQ_ALLOC_TYPE_MSIX:
 -              devid = get_device_id(&info->msi_dev->dev);
 -              if (devid < 0)
 -                      return NULL;
 -
 -              iommu = amd_iommu_rlookup_table[devid];
 -              if (iommu)
 -                      return iommu->msi_domain;
 -              break;
 -      default:
 -              break;
 -      }
 -
 -      return NULL;
 +      devid = get_devid(info);
 +      if (devid < 0)
 +              return NULL;
 +      return get_irq_domain_for_devid(info, devid);
  }
  
  struct irq_remap_ops amd_iommu_irq_ops = {
        .disable                = amd_iommu_disable,
        .reenable               = amd_iommu_reenable,
        .enable_faulting        = amd_iommu_enable_faulting,
 -      .get_ir_irq_domain      = get_ir_irq_domain,
        .get_irq_domain         = get_irq_domain,
  };
  
@@@ -3613,21 -3682,21 +3679,21 @@@ static void irq_remapping_prepare_irte(
        switch (info->type) {
        case X86_IRQ_ALLOC_TYPE_IOAPIC:
                /* Setup IOAPIC entry */
 -              entry = info->ioapic_entry;
 -              info->ioapic_entry = NULL;
 +              entry = info->ioapic.entry;
 +              info->ioapic.entry = NULL;
                memset(entry, 0, sizeof(*entry));
                entry->vector        = index;
                entry->mask          = 0;
 -              entry->trigger       = info->ioapic_trigger;
 -              entry->polarity      = info->ioapic_polarity;
 +              entry->trigger       = info->ioapic.trigger;
 +              entry->polarity      = info->ioapic.polarity;
                /* Mask level triggered irqs. */
 -              if (info->ioapic_trigger)
 +              if (info->ioapic.trigger)
                        entry->mask = 1;
                break;
  
        case X86_IRQ_ALLOC_TYPE_HPET:
 -      case X86_IRQ_ALLOC_TYPE_MSI:
 -      case X86_IRQ_ALLOC_TYPE_MSIX:
 +      case X86_IRQ_ALLOC_TYPE_PCI_MSI:
 +      case X86_IRQ_ALLOC_TYPE_PCI_MSIX:
                msg->address_hi = MSI_ADDR_BASE_HI;
                msg->address_lo = MSI_ADDR_BASE_LO;
                msg->data = irte_info->index;
@@@ -3671,15 -3740,15 +3737,15 @@@ static int irq_remapping_alloc(struct i
  
        if (!info)
                return -EINVAL;
 -      if (nr_irqs > 1 && info->type != X86_IRQ_ALLOC_TYPE_MSI &&
 -          info->type != X86_IRQ_ALLOC_TYPE_MSIX)
 +      if (nr_irqs > 1 && info->type != X86_IRQ_ALLOC_TYPE_PCI_MSI &&
 +          info->type != X86_IRQ_ALLOC_TYPE_PCI_MSIX)
                return -EINVAL;
  
        /*
         * With IRQ remapping enabled, don't need contiguous CPU vectors
         * to support multiple MSI interrupts.
         */
 -      if (info->type == X86_IRQ_ALLOC_TYPE_MSI)
 +      if (info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI)
                info->flags &= ~X86_IRQ_ALLOC_CONTIGUOUS_VECTORS;
  
        devid = get_devid(info);
                                        iommu->irte_ops->set_allocated(table, i);
                        }
                        WARN_ON(table->min_index != 32);
 -                      index = info->ioapic_pin;
 +                      index = info->ioapic.pin;
                } else {
                        index = -ENOMEM;
                }
 -      } else if (info->type == X86_IRQ_ALLOC_TYPE_MSI ||
 -                 info->type == X86_IRQ_ALLOC_TYPE_MSIX) {
 -              bool align = (info->type == X86_IRQ_ALLOC_TYPE_MSI);
 +      } else if (info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI ||
 +                 info->type == X86_IRQ_ALLOC_TYPE_PCI_MSIX) {
 +              bool align = (info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI);
  
 -              index = alloc_irq_index(devid, nr_irqs, align, info->msi_dev);
 +              index = alloc_irq_index(devid, nr_irqs, align,
 +                                      msi_desc_to_pci_dev(info->desc));
        } else {
                index = alloc_irq_index(devid, nr_irqs, false, NULL);
        }
  
        for (i = 0; i < nr_irqs; i++) {
                irq_data = irq_domain_get_irq_data(domain, virq + i);
 -              cfg = irqd_cfg(irq_data);
 -              if (!irq_data || !cfg) {
 +              cfg = irq_data ? irqd_cfg(irq_data) : NULL;
 +              if (!cfg) {
                        ret = -EINVAL;
                        goto out_free_data;
                }
index df50a00ccfe84107c0a34f9c05f905e520df4bde,54d790f75824779b3abf6d84398d29afd8b06e80..2d70d56d8e0da72f748b7cef2de2178a147acbf7
@@@ -316,9 -316,6 +316,9 @@@ static int dmar_pci_bus_add_dev(struct 
        if (ret < 0 && dmar_dev_scope_status == 0)
                dmar_dev_scope_status = ret;
  
 +      if (ret >= 0)
 +              intel_irq_remap_add_device(info);
 +
        return ret;
  }
  
@@@ -383,7 -380,7 +383,7 @@@ dmar_find_dmaru(struct acpi_dmar_hardwa
        return NULL;
  }
  
- /**
+ /*
   * dmar_parse_one_drhd - parses exactly one DMA remapping hardware definition
   * structure which uniquely represent one DMA remapping hardware unit
   * present in the platform
@@@ -476,7 -473,7 +476,7 @@@ static int dmar_parse_one_rhsa(struct a
        rhsa = (struct acpi_dmar_rhsa *)header;
        for_each_drhd_unit(drhd) {
                if (drhd->reg_base_addr == rhsa->base_address) {
 -                      int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
 +                      int node = pxm_to_node(rhsa->proximity_domain);
  
                        if (!node_online(node))
                                node = NUMA_NO_NODE;
@@@ -1027,8 -1024,8 +1027,8 @@@ static int alloc_iommu(struct dmar_drhd
  {
        struct intel_iommu *iommu;
        u32 ver, sts;
-       int agaw = 0;
-       int msagaw = 0;
+       int agaw = -1;
+       int msagaw = -1;
        int err;
  
        if (!drhd->reg_base_addr) {
        }
  
        err = -EINVAL;
-       agaw = iommu_calculate_agaw(iommu);
-       if (agaw < 0) {
-               pr_err("Cannot get a valid agaw for iommu (seq_id = %d)\n",
-                       iommu->seq_id);
-               goto err_unmap;
+       if (cap_sagaw(iommu->cap) == 0) {
+               pr_info("%s: No supported address widths. Not attempting DMA translation.\n",
+                       iommu->name);
+               drhd->ignored = 1;
+       }
+       if (!drhd->ignored) {
+               agaw = iommu_calculate_agaw(iommu);
+               if (agaw < 0) {
+                       pr_err("Cannot get a valid agaw for iommu (seq_id = %d)\n",
+                              iommu->seq_id);
+                       drhd->ignored = 1;
+               }
        }
-       msagaw = iommu_calculate_max_sagaw(iommu);
-       if (msagaw < 0) {
-               pr_err("Cannot get a valid max agaw for iommu (seq_id = %d)\n",
-                       iommu->seq_id);
-               goto err_unmap;
+       if (!drhd->ignored) {
+               msagaw = iommu_calculate_max_sagaw(iommu);
+               if (msagaw < 0) {
+                       pr_err("Cannot get a valid max agaw for iommu (seq_id = %d)\n",
+                              iommu->seq_id);
+                       drhd->ignored = 1;
+                       agaw = -1;
+               }
        }
        iommu->agaw = agaw;
        iommu->msagaw = msagaw;
  
        raw_spin_lock_init(&iommu->register_lock);
  
-       if (intel_iommu_enabled) {
+       /*
+        * This is only for hotplug; at boot time intel_iommu_enabled won't
+        * be set yet. When intel_iommu_init() runs, it registers the units
+        * present at boot time, then sets intel_iommu_enabled.
+        */
+       if (intel_iommu_enabled && !drhd->ignored) {
                err = iommu_device_sysfs_add(&iommu->iommu, NULL,
                                             intel_iommu_groups,
                                             "%s", iommu->name);
@@@ -1120,7 -1133,7 +1136,7 @@@ error
  
  static void free_iommu(struct intel_iommu *iommu)
  {
-       if (intel_iommu_enabled) {
+       if (intel_iommu_enabled && iommu->iommu.ops) {
                iommu_device_unregister(&iommu->iommu);
                iommu_device_sysfs_remove(&iommu->iommu);
        }
@@@ -1485,7 -1498,7 +1501,7 @@@ void qi_flush_dev_iotlb_pasid(struct in
  }
  
  void qi_flush_pasid_cache(struct intel_iommu *iommu, u16 did,
 -                        u64 granu, int pasid)
 +                        u64 granu, u32 pasid)
  {
        struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0};
  
@@@ -1799,7 -1812,7 +1815,7 @@@ void dmar_msi_read(int irq, struct msi_
  }
  
  static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
 -              u8 fault_reason, int pasid, u16 source_id,
 +              u8 fault_reason, u32 pasid, u16 source_id,
                unsigned long long addr)
  {
        const char *reason;
@@@ -1849,8 -1862,7 +1865,8 @@@ irqreturn_t dmar_fault(int irq, void *d
                u8 fault_reason;
                u16 source_id;
                u64 guest_addr;
 -              int type, pasid;
 +              u32 pasid;
 +              int type;
                u32 data;
                bool pasid_present;
  
index 342e42e9c9773d2230be0ce2c7ab69e9be2e7ada,2485441445cfecd7771966bd728ace1aa5512e92..2e2ba294bb152c1c08aeebd1731eae96d2553e55
@@@ -698,12 -698,47 +698,47 @@@ static int domain_update_iommu_superpag
        return fls(mask);
  }
  
+ static int domain_update_device_node(struct dmar_domain *domain)
+ {
+       struct device_domain_info *info;
+       int nid = NUMA_NO_NODE;
+       assert_spin_locked(&device_domain_lock);
+       if (list_empty(&domain->devices))
+               return NUMA_NO_NODE;
+       list_for_each_entry(info, &domain->devices, link) {
+               if (!info->dev)
+                       continue;
+               /*
+                * There could possibly be multiple device numa nodes as devices
+                * within the same domain may sit behind different IOMMUs. There
+                * isn't perfect answer in such situation, so we select first
+                * come first served policy.
+                */
+               nid = dev_to_node(info->dev);
+               if (nid != NUMA_NO_NODE)
+                       break;
+       }
+       return nid;
+ }
  /* Some capabilities may be different across iommus */
  static void domain_update_iommu_cap(struct dmar_domain *domain)
  {
        domain_update_iommu_coherency(domain);
        domain->iommu_snooping = domain_update_iommu_snooping(NULL);
        domain->iommu_superpage = domain_update_iommu_superpage(domain, NULL);
+       /*
+        * If RHSA is missing, we should default to the device numa domain
+        * as fall back.
+        */
+       if (domain->nid == NUMA_NO_NODE)
+               domain->nid = domain_update_device_node(domain);
  }
  
  struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
@@@ -2527,7 -2562,7 +2562,7 @@@ dmar_search_domain_by_dev_info(int segm
  static int domain_setup_first_level(struct intel_iommu *iommu,
                                    struct dmar_domain *domain,
                                    struct device *dev,
 -                                  int pasid)
 +                                  u32 pasid)
  {
        int flags = PASID_FLAG_SUPERVISOR_MODE;
        struct dma_pte *pgd = domain->pgd;
@@@ -5095,8 -5130,6 +5130,6 @@@ static struct iommu_domain *intel_iommu
                if (type == IOMMU_DOMAIN_DMA)
                        intel_init_iova_domain(dmar_domain);
  
-               domain_update_iommu_cap(dmar_domain);
                domain = &dmar_domain->domain;
                domain->geometry.aperture_start = 0;
                domain->geometry.aperture_end   =
@@@ -5173,7 -5206,7 +5206,7 @@@ static int aux_domain_add_dev(struct dm
                return -ENODEV;
  
        if (domain->default_pasid <= 0) {
 -              int pasid;
 +              u32 pasid;
  
                /* No private data needed for the default pasid */
                pasid = ioasid_alloc(NULL, PASID_MIN,
@@@ -5408,8 -5441,7 +5441,7 @@@ intel_iommu_sva_invalidate(struct iommu
        int ret = 0;
        u64 size = 0;
  
-       if (!inv_info || !dmar_domain ||
-           inv_info->version != IOMMU_CACHE_INVALIDATE_INFO_VERSION_1)
+       if (!inv_info || !dmar_domain)
                return -EINVAL;
  
        if (!dev || !dev_is_pci(dev))
  
        /* Size is only valid in address selective invalidation */
        if (inv_info->granularity == IOMMU_INV_GRANU_ADDR)
-               size = to_vtd_size(inv_info->addr_info.granule_size,
-                                  inv_info->addr_info.nb_granules);
+               size = to_vtd_size(inv_info->granu.addr_info.granule_size,
+                                  inv_info->granu.addr_info.nb_granules);
  
        for_each_set_bit(cache_type,
                         (unsigned long *)&inv_info->cache,
                 * granularity.
                 */
                if (inv_info->granularity == IOMMU_INV_GRANU_PASID &&
-                   (inv_info->pasid_info.flags & IOMMU_INV_PASID_FLAGS_PASID))
-                       pasid = inv_info->pasid_info.pasid;
+                   (inv_info->granu.pasid_info.flags & IOMMU_INV_PASID_FLAGS_PASID))
+                       pasid = inv_info->granu.pasid_info.pasid;
                else if (inv_info->granularity == IOMMU_INV_GRANU_ADDR &&
-                        (inv_info->addr_info.flags & IOMMU_INV_ADDR_FLAGS_PASID))
-                       pasid = inv_info->addr_info.pasid;
+                        (inv_info->granu.addr_info.flags & IOMMU_INV_ADDR_FLAGS_PASID))
+                       pasid = inv_info->granu.addr_info.pasid;
  
                switch (BIT(cache_type)) {
                case IOMMU_CACHE_INV_TYPE_IOTLB:
                        /* HW will ignore LSB bits based on address mask */
                        if (inv_info->granularity == IOMMU_INV_GRANU_ADDR &&
                            size &&
-                           (inv_info->addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) {
+                           (inv_info->granu.addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) {
                                pr_err_ratelimited("User address not aligned, 0x%llx, size order %llu\n",
-                                                  inv_info->addr_info.addr, size);
+                                                  inv_info->granu.addr_info.addr, size);
                        }
  
                        /*
                         * We use npages = -1 to indicate that.
                         */
                        qi_flush_piotlb(iommu, did, pasid,
-                                       mm_to_dma_pfn(inv_info->addr_info.addr),
+                                       mm_to_dma_pfn(inv_info->granu.addr_info.addr),
                                        (granu == QI_GRAN_NONG_PASID) ? -1 : 1 << size,
-                                       inv_info->addr_info.flags & IOMMU_INV_ADDR_FLAGS_LEAF);
+                                       inv_info->granu.addr_info.flags & IOMMU_INV_ADDR_FLAGS_LEAF);
  
                        if (!info->ats_enabled)
                                break;
                                size = 64 - VTD_PAGE_SHIFT;
                                addr = 0;
                        } else if (inv_info->granularity == IOMMU_INV_GRANU_ADDR) {
-                               addr = inv_info->addr_info.addr;
+                               addr = inv_info->granu.addr_info.addr;
                        }
  
                        if (info->ats_enabled)
index 60ffe083b6d6344b58a4bedff967adbc15cc45b0,0cb9a15f1112794b2348fce05c6903f4da60f052..f1861fa3d0e4a4091454938ba788bd33c12cc285
  #include <linux/mm_types.h>
  #include <linux/ioasid.h>
  #include <asm/page.h>
 +#include <asm/fpu/api.h>
  
  #include "pasid.h"
  
  static irqreturn_t prq_event_thread(int irq, void *d);
 -static void intel_svm_drain_prq(struct device *dev, int pasid);
 +static void intel_svm_drain_prq(struct device *dev, u32 pasid);
  
  #define PRQ_ORDER 0
  
@@@ -285,8 -284,15 +285,15 @@@ int intel_svm_bind_gpasid(struct iommu_
        if (WARN_ON(!iommu) || !data)
                return -EINVAL;
  
-       if (data->version != IOMMU_GPASID_BIND_VERSION_1 ||
-           data->format != IOMMU_PASID_FORMAT_INTEL_VTD)
+       if (data->format != IOMMU_PASID_FORMAT_INTEL_VTD)
+               return -EINVAL;
+       /* IOMMU core ensures argsz is more than the start of the union */
+       if (data->argsz < offsetofend(struct iommu_gpasid_bind_data, vendor.vtd))
+               return -EINVAL;
+       /* Make sure no undefined flags are used in vendor data */
+       if (data->vendor.vtd.flags & ~(IOMMU_SVA_VTD_GPASID_LAST - 1))
                return -EINVAL;
  
        if (!dev_is_pci(dev))
        spin_lock(&iommu->lock);
        ret = intel_pasid_setup_nested(iommu, dev,
                                       (pgd_t *)(uintptr_t)data->gpgd,
-                                      data->hpasid, &data->vtd, dmar_domain,
+                                      data->hpasid, &data->vendor.vtd, dmar_domain,
                                       data->addr_width);
        spin_unlock(&iommu->lock);
        if (ret) {
        return ret;
  }
  
 -int intel_svm_unbind_gpasid(struct device *dev, int pasid)
 +int intel_svm_unbind_gpasid(struct device *dev, u32 pasid)
  {
        struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
        struct intel_svm_dev *sdev;
@@@ -445,28 -451,9 +452,28 @@@ out
        return ret;
  }
  
 +static void _load_pasid(void *unused)
 +{
 +      update_pasid();
 +}
 +
 +static void load_pasid(struct mm_struct *mm, u32 pasid)
 +{
 +      mutex_lock(&mm->context.lock);
 +
 +      /* Synchronize with READ_ONCE in update_pasid(). */
 +      smp_store_release(&mm->pasid, pasid);
 +
 +      /* Update PASID MSR on all CPUs running the mm's tasks. */
 +      on_each_cpu_mask(mm_cpumask(mm), _load_pasid, NULL, true);
 +
 +      mutex_unlock(&mm->context.lock);
 +}
 +
  /* Caller must hold pasid_mutex, mm reference */
  static int
 -intel_svm_bind_mm(struct device *dev, int flags, struct svm_dev_ops *ops,
 +intel_svm_bind_mm(struct device *dev, unsigned int flags,
 +                struct svm_dev_ops *ops,
                  struct mm_struct *mm, struct intel_svm_dev **sd)
  {
        struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
                }
  
                list_add_tail(&svm->list, &global_svm_list);
 +              if (mm) {
 +                      /* The newly allocated pasid is loaded to the mm. */
 +                      load_pasid(mm, svm->pasid);
 +              }
        } else {
                /*
                 * Binding a new device with existing PASID, need to setup
@@@ -644,7 -627,7 +651,7 @@@ out
  }
  
  /* Caller must hold pasid_mutex */
 -static int intel_svm_unbind_mm(struct device *dev, int pasid)
 +static int intel_svm_unbind_mm(struct device *dev, u32 pasid)
  {
        struct intel_svm_dev *sdev;
        struct intel_iommu *iommu;
  
                        if (list_empty(&svm->devs)) {
                                ioasid_free(svm->pasid);
 -                              if (svm->mm)
 +                              if (svm->mm) {
                                        mmu_notifier_unregister(&svm->notifier, svm->mm);
 +                                      /* Clear mm's pasid. */
 +                                      load_pasid(svm->mm, PASID_DISABLED);
 +                              }
                                list_del(&svm->list);
                                /* We mandate that no page faults may be outstanding
                                 * for the PASID when intel_svm_unbind_mm() is called.
@@@ -766,7 -746,7 +773,7 @@@ static bool is_canonical_address(u64 ad
   * described in VT-d spec CH7.10 to drain all page requests and page
   * responses pending in the hardware.
   */
 -static void intel_svm_drain_prq(struct device *dev, int pasid)
 +static void intel_svm_drain_prq(struct device *dev, u32 pasid)
  {
        struct device_domain_info *info;
        struct dmar_domain *domain;
@@@ -1060,7 -1040,7 +1067,7 @@@ intel_svm_bind(struct device *dev, stru
  {
        struct iommu_sva *sva = ERR_PTR(-EINVAL);
        struct intel_svm_dev *sdev = NULL;
 -      int flags = 0;
 +      unsigned int flags = 0;
        int ret;
  
        /*
         * and intel_svm etc.
         */
        if (drvdata)
 -              flags = *(int *)drvdata;
 +              flags = *(unsigned int *)drvdata;
        mutex_lock(&pasid_mutex);
        ret = intel_svm_bind_mm(dev, flags, NULL, mm, &sdev);
        if (ret)
@@@ -1094,10 -1074,10 +1101,10 @@@ void intel_svm_unbind(struct iommu_sva 
        mutex_unlock(&pasid_mutex);
  }
  
 -int intel_svm_get_pasid(struct iommu_sva *sva)
 +u32 intel_svm_get_pasid(struct iommu_sva *sva)
  {
        struct intel_svm_dev *sdev;
 -      int pasid;
 +      u32 pasid;
  
        mutex_lock(&pasid_mutex);
        sdev = to_intel_svm_dev(sva);
diff --combined drivers/iommu/iommu.c
index 0e4fbdc0f5e588657e432ab9c0d24d95709ef215,6d847027d35eafb5edcb0175b7764f59696309dd..8c470f451a323e590293309c0331af3db10bebaf
@@@ -762,7 -762,7 +762,7 @@@ static int iommu_create_device_direct_m
  
        }
  
-       iommu_flush_tlb_all(domain);
+       iommu_flush_iotlb_all(domain);
  
  out:
        iommu_put_resv_regions(dev, &mappings);
@@@ -1961,25 -1961,188 +1961,188 @@@ out_unlock
  }
  EXPORT_SYMBOL_GPL(iommu_attach_device);
  
- int iommu_cache_invalidate(struct iommu_domain *domain, struct device *dev,
-                          struct iommu_cache_invalidate_info *inv_info)
+ /*
+  * Check flags and other user provided data for valid combinations. We also
+  * make sure no reserved fields or unused flags are set. This is to ensure
+  * not breaking userspace in the future when these fields or flags are used.
+  */
+ static int iommu_check_cache_invl_data(struct iommu_cache_invalidate_info *info)
+ {
+       u32 mask;
+       int i;
+       if (info->version != IOMMU_CACHE_INVALIDATE_INFO_VERSION_1)
+               return -EINVAL;
+       mask = (1 << IOMMU_CACHE_INV_TYPE_NR) - 1;
+       if (info->cache & ~mask)
+               return -EINVAL;
+       if (info->granularity >= IOMMU_INV_GRANU_NR)
+               return -EINVAL;
+       switch (info->granularity) {
+       case IOMMU_INV_GRANU_ADDR:
+               if (info->cache & IOMMU_CACHE_INV_TYPE_PASID)
+                       return -EINVAL;
+               mask = IOMMU_INV_ADDR_FLAGS_PASID |
+                       IOMMU_INV_ADDR_FLAGS_ARCHID |
+                       IOMMU_INV_ADDR_FLAGS_LEAF;
+               if (info->granu.addr_info.flags & ~mask)
+                       return -EINVAL;
+               break;
+       case IOMMU_INV_GRANU_PASID:
+               mask = IOMMU_INV_PASID_FLAGS_PASID |
+                       IOMMU_INV_PASID_FLAGS_ARCHID;
+               if (info->granu.pasid_info.flags & ~mask)
+                       return -EINVAL;
+               break;
+       case IOMMU_INV_GRANU_DOMAIN:
+               if (info->cache & IOMMU_CACHE_INV_TYPE_DEV_IOTLB)
+                       return -EINVAL;
+               break;
+       default:
+               return -EINVAL;
+       }
+       /* Check reserved padding fields */
+       for (i = 0; i < sizeof(info->padding); i++) {
+               if (info->padding[i])
+                       return -EINVAL;
+       }
+       return 0;
+ }
+ int iommu_uapi_cache_invalidate(struct iommu_domain *domain, struct device *dev,
+                               void __user *uinfo)
  {
+       struct iommu_cache_invalidate_info inv_info = { 0 };
+       u32 minsz;
+       int ret;
        if (unlikely(!domain->ops->cache_invalidate))
                return -ENODEV;
  
-       return domain->ops->cache_invalidate(domain, dev, inv_info);
+       /*
+        * No new spaces can be added before the variable sized union, the
+        * minimum size is the offset to the union.
+        */
+       minsz = offsetof(struct iommu_cache_invalidate_info, granu);
+       /* Copy minsz from user to get flags and argsz */
+       if (copy_from_user(&inv_info, uinfo, minsz))
+               return -EFAULT;
+       /* Fields before the variable size union are mandatory */
+       if (inv_info.argsz < minsz)
+               return -EINVAL;
+       /* PASID and address granu require additional info beyond minsz */
+       if (inv_info.granularity == IOMMU_INV_GRANU_PASID &&
+           inv_info.argsz < offsetofend(struct iommu_cache_invalidate_info, granu.pasid_info))
+               return -EINVAL;
+       if (inv_info.granularity == IOMMU_INV_GRANU_ADDR &&
+           inv_info.argsz < offsetofend(struct iommu_cache_invalidate_info, granu.addr_info))
+               return -EINVAL;
+       /*
+        * User might be using a newer UAPI header which has a larger data
+        * size, we shall support the existing flags within the current
+        * size. Copy the remaining user data _after_ minsz but not more
+        * than the current kernel supported size.
+        */
+       if (copy_from_user((void *)&inv_info + minsz, uinfo + minsz,
+                          min_t(u32, inv_info.argsz, sizeof(inv_info)) - minsz))
+               return -EFAULT;
+       /* Now the argsz is validated, check the content */
+       ret = iommu_check_cache_invl_data(&inv_info);
+       if (ret)
+               return ret;
+       return domain->ops->cache_invalidate(domain, dev, &inv_info);
+ }
+ EXPORT_SYMBOL_GPL(iommu_uapi_cache_invalidate);
+ static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data)
+ {
+       u32 mask;
+       int i;
+       if (data->version != IOMMU_GPASID_BIND_VERSION_1)
+               return -EINVAL;
+       /* Check the range of supported formats */
+       if (data->format >= IOMMU_PASID_FORMAT_LAST)
+               return -EINVAL;
+       /* Check all flags */
+       mask = IOMMU_SVA_GPASID_VAL;
+       if (data->flags & ~mask)
+               return -EINVAL;
+       /* Check reserved padding fields */
+       for (i = 0; i < sizeof(data->padding); i++) {
+               if (data->padding[i])
+                       return -EINVAL;
+       }
+       return 0;
+ }
+ static int iommu_sva_prepare_bind_data(void __user *udata,
+                                      struct iommu_gpasid_bind_data *data)
+ {
+       u32 minsz;
+       /*
+        * No new spaces can be added before the variable sized union, the
+        * minimum size is the offset to the union.
+        */
+       minsz = offsetof(struct iommu_gpasid_bind_data, vendor);
+       /* Copy minsz from user to get flags and argsz */
+       if (copy_from_user(data, udata, minsz))
+               return -EFAULT;
+       /* Fields before the variable size union are mandatory */
+       if (data->argsz < minsz)
+               return -EINVAL;
+       /*
+        * User might be using a newer UAPI header, we shall let IOMMU vendor
+        * driver decide on what size it needs. Since the guest PASID bind data
+        * can be vendor specific, larger argsz could be the result of extension
+        * for one vendor but it should not affect another vendor.
+        * Copy the remaining user data _after_ minsz
+        */
+       if (copy_from_user((void *)data + minsz, udata + minsz,
+                          min_t(u32, data->argsz, sizeof(*data)) - minsz))
+               return -EFAULT;
+       return iommu_check_bind_data(data);
  }
- EXPORT_SYMBOL_GPL(iommu_cache_invalidate);
  
- int iommu_sva_bind_gpasid(struct iommu_domain *domain,
-                          struct device *dev, struct iommu_gpasid_bind_data *data)
+ int iommu_uapi_sva_bind_gpasid(struct iommu_domain *domain, struct device *dev,
+                              void __user *udata)
  {
+       struct iommu_gpasid_bind_data data = { 0 };
+       int ret;
        if (unlikely(!domain->ops->sva_bind_gpasid))
                return -ENODEV;
  
-       return domain->ops->sva_bind_gpasid(domain, dev, data);
+       ret = iommu_sva_prepare_bind_data(udata, &data);
+       if (ret)
+               return ret;
+       return domain->ops->sva_bind_gpasid(domain, dev, &data);
  }
- EXPORT_SYMBOL_GPL(iommu_sva_bind_gpasid);
+ EXPORT_SYMBOL_GPL(iommu_uapi_sva_bind_gpasid);
  
  int iommu_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev,
                             ioasid_t pasid)
  }
  EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid);
  
+ int iommu_uapi_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev,
+                                void __user *udata)
+ {
+       struct iommu_gpasid_bind_data data = { 0 };
+       int ret;
+       if (unlikely(!domain->ops->sva_bind_gpasid))
+               return -ENODEV;
+       ret = iommu_sva_prepare_bind_data(udata, &data);
+       if (ret)
+               return ret;
+       return iommu_sva_unbind_gpasid(domain, dev, data.hpasid);
+ }
+ EXPORT_SYMBOL_GPL(iommu_uapi_sva_unbind_gpasid);
  static void __iommu_detach_device(struct iommu_domain *domain,
                                  struct device *dev)
  {
@@@ -2316,7 -2496,7 +2496,7 @@@ size_t iommu_unmap(struct iommu_domain 
  
        iommu_iotlb_gather_init(&iotlb_gather);
        ret = __iommu_unmap(domain, iova, size, &iotlb_gather);
-       iommu_tlb_sync(domain, &iotlb_gather);
+       iommu_iotlb_sync(domain, &iotlb_gather);
  
        return ret;
  }
@@@ -2839,7 -3019,7 +3019,7 @@@ void iommu_sva_unbind_device(struct iom
  }
  EXPORT_SYMBOL_GPL(iommu_sva_unbind_device);
  
 -int iommu_sva_get_pasid(struct iommu_sva *handle)
 +u32 iommu_sva_get_pasid(struct iommu_sva *handle)
  {
        const struct iommu_ops *ops = handle->dev->bus->iommu_ops;
  
index 473b24e0311f0e61cab710b49bee55698270bd33,6a3ddaabf3f506895ac2b9c6ac32afc890327688..fbf5b3e7707eb2de652f4848dc7f2fa07b9f593e
@@@ -425,8 -425,6 +425,8 @@@ struct q_inval 
        int             free_cnt;
  };
  
 +struct dmar_pci_notify_info;
 +
  #ifdef CONFIG_IRQ_REMAP
  /* 1MB - maximum possible interrupt remapping table size */
  #define INTR_REMAP_PAGE_ORDER 8
@@@ -441,11 -439,6 +441,11 @@@ struct ir_table 
        struct irte *base;
        unsigned long *bitmap;
  };
 +
 +void intel_irq_remap_add_device(struct dmar_pci_notify_info *info);
 +#else
 +static inline void
 +intel_irq_remap_add_device(struct dmar_pci_notify_info *info) { }
  #endif
  
  struct iommu_flush {
@@@ -556,7 -549,7 +556,7 @@@ struct dmar_domain 
                                           2 == 1GiB, 3 == 512GiB, 4 == 1TiB */
        u64             max_addr;       /* maximum mapped address */
  
 -      int             default_pasid;  /*
 +      u32             default_pasid;  /*
                                         * The default pasid used for non-SVM
                                         * traffic on mediated devices.
                                         */
@@@ -715,7 -708,7 +715,7 @@@ void qi_flush_dev_iotlb_pasid(struct in
                              u32 pasid, u16 qdep, u64 addr,
                              unsigned int size_order);
  void qi_flush_pasid_cache(struct intel_iommu *iommu, u16 did, u64 granu,
 -                        int pasid);
 +                        u32 pasid);
  
  int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc,
                   unsigned int count, unsigned long options);
@@@ -744,11 -737,11 +744,11 @@@ extern int intel_svm_enable_prq(struct 
  extern int intel_svm_finish_prq(struct intel_iommu *iommu);
  int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
                          struct iommu_gpasid_bind_data *data);
 -int intel_svm_unbind_gpasid(struct device *dev, int pasid);
 +int intel_svm_unbind_gpasid(struct device *dev, u32 pasid);
  struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm,
                                 void *drvdata);
  void intel_svm_unbind(struct iommu_sva *handle);
 -int intel_svm_get_pasid(struct iommu_sva *handle);
 +u32 intel_svm_get_pasid(struct iommu_sva *handle);
  int intel_svm_page_response(struct device *dev, struct iommu_fault_event *evt,
                            struct iommu_page_response *msg);
  
@@@ -760,7 -753,7 +760,7 @@@ struct intel_svm_dev 
        struct device *dev;
        struct svm_dev_ops *ops;
        struct iommu_sva sva;
 -      int pasid;
 +      u32 pasid;
        int users;
        u16 did;
        u16 dev_iotlb:1;
@@@ -772,8 -765,8 +772,8 @@@ struct intel_svm 
        struct mm_struct *mm;
  
        struct intel_iommu *iommu;
 -      int flags;
 -      int pasid;
 +      unsigned int flags;
 +      u32 pasid;
        int gpasid; /* In case that guest PASID is different from host PASID */
        struct list_head devs;
        struct list_head list;
@@@ -799,6 -792,7 +799,7 @@@ extern int iommu_calculate_max_sagaw(st
  extern int dmar_disabled;
  extern int intel_iommu_enabled;
  extern int intel_iommu_tboot_noforce;
+ extern int intel_iommu_gfx_mapped;
  #else
  static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
  {
diff --combined include/linux/iommu.h
index e57e819aaf2e76c7285e64bc76e1dee747ce59a4,82876f6823672473f0086278cc75152dea9a1d1e..b95a6f8db6ff99f114eec6db93a0294fc81adf8b
@@@ -286,7 -286,7 +286,7 @@@ struct iommu_ops 
        struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm,
                                      void *drvdata);
        void (*sva_unbind)(struct iommu_sva *handle);
 -      int (*sva_get_pasid)(struct iommu_sva *handle);
 +      u32 (*sva_get_pasid)(struct iommu_sva *handle);
  
        int (*page_response)(struct device *dev,
                             struct iommu_fault_event *evt,
        int (*sva_bind_gpasid)(struct iommu_domain *domain,
                        struct device *dev, struct iommu_gpasid_bind_data *data);
  
 -      int (*sva_unbind_gpasid)(struct device *dev, int pasid);
 +      int (*sva_unbind_gpasid)(struct device *dev, u32 pasid);
  
        int (*def_domain_type)(struct device *dev);
  
@@@ -424,13 -424,16 +424,16 @@@ extern int iommu_attach_device(struct i
                               struct device *dev);
  extern void iommu_detach_device(struct iommu_domain *domain,
                                struct device *dev);
- extern int iommu_cache_invalidate(struct iommu_domain *domain,
-                                 struct device *dev,
-                                 struct iommu_cache_invalidate_info *inv_info);
- extern int iommu_sva_bind_gpasid(struct iommu_domain *domain,
-               struct device *dev, struct iommu_gpasid_bind_data *data);
+ extern int iommu_uapi_cache_invalidate(struct iommu_domain *domain,
+                                      struct device *dev,
+                                      void __user *uinfo);
+ extern int iommu_uapi_sva_bind_gpasid(struct iommu_domain *domain,
+                                     struct device *dev, void __user *udata);
+ extern int iommu_uapi_sva_unbind_gpasid(struct iommu_domain *domain,
+                                       struct device *dev, void __user *udata);
  extern int iommu_sva_unbind_gpasid(struct iommu_domain *domain,
-                               struct device *dev, ioasid_t pasid);
+                                  struct device *dev, ioasid_t pasid);
  extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev);
  extern struct iommu_domain *iommu_get_dma_domain(struct device *dev);
  extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
@@@ -514,13 -517,13 +517,13 @@@ extern void iommu_domain_window_disable
  extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
                              unsigned long iova, int flags);
  
- static inline void iommu_flush_tlb_all(struct iommu_domain *domain)
+ static inline void iommu_flush_iotlb_all(struct iommu_domain *domain)
  {
        if (domain->ops->flush_iotlb_all)
                domain->ops->flush_iotlb_all(domain);
  }
  
- static inline void iommu_tlb_sync(struct iommu_domain *domain,
+ static inline void iommu_iotlb_sync(struct iommu_domain *domain,
                                  struct iommu_iotlb_gather *iotlb_gather)
  {
        if (domain->ops->iotlb_sync)
@@@ -543,7 -546,7 +546,7 @@@ static inline void iommu_iotlb_gather_a
        if (gather->pgsize != size ||
            end < gather->start || start > gather->end) {
                if (gather->pgsize)
-                       iommu_tlb_sync(domain, gather);
+                       iommu_iotlb_sync(domain, gather);
                gather->pgsize = size;
        }
  
@@@ -634,7 -637,7 +637,7 @@@ struct iommu_sva *iommu_sva_bind_device
                                        struct mm_struct *mm,
                                        void *drvdata);
  void iommu_sva_unbind_device(struct iommu_sva *handle);
 -int iommu_sva_get_pasid(struct iommu_sva *handle);
 +u32 iommu_sva_get_pasid(struct iommu_sva *handle);
  
  #else /* CONFIG_IOMMU_API */
  
@@@ -725,11 -728,11 +728,11 @@@ static inline size_t iommu_map_sg_atomi
        return 0;
  }
  
- static inline void iommu_flush_tlb_all(struct iommu_domain *domain)
+ static inline void iommu_flush_iotlb_all(struct iommu_domain *domain)
  {
  }
  
- static inline void iommu_tlb_sync(struct iommu_domain *domain,
+ static inline void iommu_iotlb_sync(struct iommu_domain *domain,
                                  struct iommu_iotlb_gather *iotlb_gather)
  {
  }
@@@ -1027,26 -1030,34 +1030,34 @@@ static inline void iommu_sva_unbind_dev
  {
  }
  
 -static inline int iommu_sva_get_pasid(struct iommu_sva *handle)
 +static inline u32 iommu_sva_get_pasid(struct iommu_sva *handle)
  {
        return IOMMU_PASID_INVALID;
  }
  
  static inline int
- iommu_cache_invalidate(struct iommu_domain *domain,
-                      struct device *dev,
-                      struct iommu_cache_invalidate_info *inv_info)
+ iommu_uapi_cache_invalidate(struct iommu_domain *domain,
+                           struct device *dev,
+                           struct iommu_cache_invalidate_info *inv_info)
  {
        return -ENODEV;
  }
- static inline int iommu_sva_bind_gpasid(struct iommu_domain *domain,
-                               struct device *dev, struct iommu_gpasid_bind_data *data)
+ static inline int iommu_uapi_sva_bind_gpasid(struct iommu_domain *domain,
+                                            struct device *dev, void __user *udata)
+ {
+       return -ENODEV;
+ }
+ static inline int iommu_uapi_sva_unbind_gpasid(struct iommu_domain *domain,
+                                              struct device *dev, void __user *udata)
  {
        return -ENODEV;
  }
  
  static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain,
-                                          struct device *dev, u32 pasid)
+                                         struct device *dev,
+                                         ioasid_t pasid)
  {
        return -ENODEV;
  }
This page took 0.210542 seconds and 4 git commands to generate.