]> Git Repo - J-linux.git/commitdiff
Merge tag 'iommu-updates-v5.20-or-v6.0' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <[email protected]>
Sat, 6 Aug 2022 17:42:38 +0000 (10:42 -0700)
committerLinus Torvalds <[email protected]>
Sat, 6 Aug 2022 17:42:38 +0000 (10:42 -0700)
Pull iommu updates from Joerg Roedel:

 - The most intrusive patch is small and changes the default allocation
   policy for DMA addresses.

   Before the change the allocator tried its best to find an address in
   the first 4GB. But that lead to performance problems when that space
   gets exhaused, and since most devices are capable of 64-bit DMA these
   days, we changed it to search in the full DMA-mask range from the
   beginning.

   This change has the potential to uncover bugs elsewhere, in the
   kernel or the hardware. There is a Kconfig option and a command line
   option to restore the old behavior, but none of them is enabled by
   default.

 - Add Robin Murphy as reviewer of IOMMU code and maintainer for the
   dma-iommu and iova code

 - Chaning IOVA magazine size from 1032 to 1024 bytes to save memory

 - Some core code cleanups and dead-code removal

 - Support for ACPI IORT RMR node

 - Support for multiple PCI domains in the AMD-Vi driver

 - ARM SMMU changes from Will Deacon:
      - Add even more Qualcomm device-tree compatible strings
      - Support dumping of IMP DEF Qualcomm registers on TLB sync
        timeout
      - Fix reference count leak on device tree node in Qualcomm driver

 - Intel VT-d driver updates from Lu Baolu:
      - Make intel-iommu.h private
      - Optimize the use of two locks
      - Extend the driver to support large-scale platforms
      - Cleanup some dead code

 - MediaTek IOMMU refactoring and support for TTBR up to 35bit

 - Basic support for Exynos SysMMU v7

 - VirtIO IOMMU driver gets a map/unmap_pages() implementation

 - Other smaller cleanups and fixes

* tag 'iommu-updates-v5.20-or-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (116 commits)
  iommu/amd: Fix compile warning in init code
  iommu/amd: Add support for AVIC when SNP is enabled
  iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement
  ACPI/IORT: Fix build error implicit-function-declaration
  drivers: iommu: fix clang -wformat warning
  iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop
  iommu/arm-smmu-qcom: Add SM6375 SMMU compatible
  dt-bindings: arm-smmu: Add compatible for Qualcomm SM6375
  MAINTAINERS: Add Robin Murphy as IOMMU SUBSYTEM reviewer
  iommu/amd: Do not support IOMMUv2 APIs when SNP is enabled
  iommu/amd: Do not support IOMMU_DOMAIN_IDENTITY after SNP is enabled
  iommu/amd: Set translation valid bit only when IO page tables are in use
  iommu/amd: Introduce function to check and enable SNP
  iommu/amd: Globally detect SNP support
  iommu/amd: Process all IVHDs before enabling IOMMU features
  iommu/amd: Introduce global variable for storing common EFR and EFR2
  iommu/amd: Introduce Support for Extended Feature 2 Register
  iommu/amd: Change macro for IOMMU control register bit shift to decimal value
  iommu/exynos: Enable default VM instance on SysMMU v7
  iommu/exynos: Add SysMMU v7 register set
  ...

1  2 
Documentation/admin-guide/kernel-parameters.txt
MAINTAINERS
arch/x86/kvm/x86.c
drivers/char/agp/intel-gtt.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

index 43c31e9de7c75a06a9e0db745d12c4924c8081eb,9ea3ae8b3893cfedcdccf521def69991c360a4e8..22d7b512718459e939c019d6a111344045b99119
        arm64.nomte     [ARM64] Unconditionally disable Memory Tagging Extension
                        support
  
 +      arm64.nosve     [ARM64] Unconditionally disable Scalable Vector
 +                      Extension support
 +
 +      arm64.nosme     [ARM64] Unconditionally disable Scalable Matrix
 +                      Extension support
 +
        ataflop=        [HW,M68k]
  
        atarimouse=     [HW,MOUSE] Atari Mouse
                        nosocket -- Disable socket memory accounting.
                        nokmem -- Disable kernel memory accounting.
  
 -      checkreqprot    [SELINUX] Set initial checkreqprot flag value.
 +      checkreqprot=   [SELINUX] Set initial checkreqprot flag value.
                        Format: { "0" | "1" }
                        See security/selinux/Kconfig help text.
                        0 -- check protection applied by kernel (includes
                        (in particular on some ATI chipsets).
                        The kernel tries to set a reasonable default.
  
 -      enforcing       [SELINUX] Set initial enforcing status.
 +      enforcing=      [SELINUX] Set initial enforcing status.
                        Format: {"0" | "1"}
                        See security/selinux/Kconfig help text.
                        0 -- permissive (log only, no denials).
                        Built with CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON=y,
                        the default is on.
  
 -                      This is not compatible with memory_hotplug.memmap_on_memory.
 -                      If both parameters are enabled, hugetlb_free_vmemmap takes
 -                      precedence over memory_hotplug.memmap_on_memory.
 +                      Note that the vmemmap pages may be allocated from the added
 +                      memory block itself when memory_hotplug.memmap_on_memory is
 +                      enabled, those vmemmap pages cannot be optimized even if this
 +                      feature is enabled.  Other vmemmap pages not allocated from
 +                      the added memory block itself do not be affected.
  
        hung_task_panic=
                        [KNL] Should the hung task detector generate panics.
  
        ivrs_ioapic     [HW,X86-64]
                        Provide an override to the IOAPIC-ID<->DEVICE-ID
-                       mapping provided in the IVRS ACPI table. For
-                       example, to map IOAPIC-ID decimal 10 to
-                       PCI device 00:14.0 write the parameter as:
+                       mapping provided in the IVRS ACPI table.
+                       By default, PCI segment is 0, and can be omitted.
+                       For example:
+                       * To map IOAPIC-ID decimal 10 to PCI device 00:14.0
+                         write the parameter as:
                                ivrs_ioapic[10]=00:14.0
+                       * To map IOAPIC-ID decimal 10 to PCI segment 0x1 and
+                         PCI device 00:14.0 write the parameter as:
+                               ivrs_ioapic[10]=0001:00:14.0
  
        ivrs_hpet       [HW,X86-64]
                        Provide an override to the HPET-ID<->DEVICE-ID
-                       mapping provided in the IVRS ACPI table. For
-                       example, to map HPET-ID decimal 0 to
-                       PCI device 00:14.0 write the parameter as:
+                       mapping provided in the IVRS ACPI table.
+                       By default, PCI segment is 0, and can be omitted.
+                       For example:
+                       * To map HPET-ID decimal 0 to PCI device 00:14.0
+                         write the parameter as:
                                ivrs_hpet[0]=00:14.0
+                       * To map HPET-ID decimal 10 to PCI segment 0x1 and
+                         PCI device 00:14.0 write the parameter as:
+                               ivrs_ioapic[10]=0001:00:14.0
  
        ivrs_acpihid    [HW,X86-64]
                        Provide an override to the ACPI-HID:UID<->DEVICE-ID
-                       mapping provided in the IVRS ACPI table. For
-                       example, to map UART-HID:UID AMD0020:0 to
-                       PCI device 00:14.5 write the parameter as:
+                       mapping provided in the IVRS ACPI table.
+                       For example, to map UART-HID:UID AMD0020:0 to
+                       PCI segment 0x1 and PCI device ID 00:14.5,
+                       write the parameter as:
+                               ivrs_acpihid[0001:00:14.5]=AMD0020:0
+                       By default, PCI segment is 0, and can be omitted.
+                       For example, PCI device 00:14.5 write the parameter as:
                                ivrs_acpihid[00:14.5]=AMD0020:0
  
        js=             [HW,JOY] Analog joystick
                        the KVM_CLEAR_DIRTY ioctl, and only for the pages being
                        cleared.
  
 -                      Eager page splitting currently only supports splitting
 -                      huge pages mapped by the TDP MMU.
 +                      Eager page splitting is only supported when kvm.tdp_mmu=Y.
  
                        Default is Y (on).
  
                        [KNL,X86,ARM] Boolean flag to enable this feature.
                        Format: {on | off (default)}
                        When enabled, runtime hotplugged memory will
 -                      allocate its internal metadata (struct pages)
 -                      from the hotadded memory which will allow to
 -                      hotadd a lot of memory without requiring
 -                      additional memory to do so.
 +                      allocate its internal metadata (struct pages,
 +                      those vmemmap pages cannot be optimized even
 +                      if hugetlb_free_vmemmap is enabled) from the
 +                      hotadded memory which will allow to hotadd a
 +                      lot of memory without requiring additional
 +                      memory to do so.
                        This feature is disabled by default because it
                        has some implication on large (e.g. GB)
                        allocations in some configurations (e.g. small
                        Note that even when enabled, there are a few cases where
                        the feature is not effective.
  
 -                      This is not compatible with hugetlb_free_vmemmap. If
 -                      both parameters are enabled, hugetlb_free_vmemmap takes
 -                      precedence over memory_hotplug.memmap_on_memory.
 -
        memtest=        [KNL,X86,ARM,M68K,PPC,RISCV] Enable memtest
                        Format: <integer>
                        default : 0 <disable>
                        mem_encrypt=on:         Activate SME
                        mem_encrypt=off:        Do not activate SME
  
 -                      Refer to Documentation/virt/kvm/amd-memory-encryption.rst
 +                      Refer to Documentation/virt/kvm/x86/amd-memory-encryption.rst
                        for details on when memory encryption can be activated.
  
        mem_sleep_default=      [SUSPEND] Default system suspend mode:
                                improves system performance, but it may also
                                expose users to several CPU vulnerabilities.
                                Equivalent to: nopti [X86,PPC]
 -                                             kpti=0 [ARM64]
 +                                             if nokaslr then kpti=0 [ARM64]
                                               nospectre_v1 [X86,PPC]
                                               nobp=0 [S390]
                                               nospectre_v2 [X86,PPC,S390,ARM64]
                                               no_entry_flush [PPC]
                                               no_uaccess_flush [PPC]
                                               mmio_stale_data=off [X86]
 +                                             retbleed=off [X86]
  
                                Exceptions:
                                               This does not have any effect on
                                               mds=full,nosmt [X86]
                                               tsx_async_abort=full,nosmt [X86]
                                               mmio_stale_data=full,nosmt [X86]
 +                                             retbleed=auto,nosmt [X86]
  
        mminit_loglevel=
                        [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
                        just as if they had also been called out in the
                        rcu_nocbs= boot parameter.
  
 +                      Note that this argument takes precedence over
 +                      the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option.
 +
        noiotrap        [SH] Disables trapped I/O port accesses.
  
        noirqdebug      [X86-32] Disables the code which attempts to detect and
        noreplace-smp   [X86-32,SMP] Don't replace SMP instructions
                        with UP alternatives
  
 -      nordrand        [X86] Disable kernel use of the RDRAND and
 -                      RDSEED instructions even if they are supported
 -                      by the processor.  RDRAND and RDSEED are still
 -                      available to user space applications.
 -
        noresume        [SWSUSP] Disables resume and restores original swap
                        space.
  
                        no-callback mode from boot but the mode may be
                        toggled at runtime via cpusets.
  
 +                      Note that this argument takes precedence over
 +                      the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option.
 +
        rcu_nocb_poll   [KNL]
                        Rather than requiring that offloaded CPUs
                        (specified by rcu_nocbs= above) explicitly
                        When RCU_NOCB_CPU is set, also adjust the
                        priority of NOCB callback kthreads.
  
 +      rcutree.rcu_divisor= [KNL]
 +                      Set the shift-right count to use to compute
 +                      the callback-invocation batch limit bl from
 +                      the number of callbacks queued on this CPU.
 +                      The result will be bounded below by the value of
 +                      the rcutree.blimit kernel parameter.  Every bl
 +                      callbacks, the softirq handler will exit in
 +                      order to allow the CPU to do other work.
 +
 +                      Please note that this callback-invocation batch
 +                      limit applies only to non-offloaded callback
 +                      invocation.  Offloaded callbacks are instead
 +                      invoked in the context of an rcuoc kthread, which
 +                      scheduler will preempt as it does any other task.
 +
 +      rcutree.nocb_nobypass_lim_per_jiffy= [KNL]
 +                      On callback-offloaded (rcu_nocbs) CPUs,
 +                      RCU reduces the lock contention that would
 +                      otherwise be caused by callback floods through
 +                      use of the ->nocb_bypass list.  However, in the
 +                      common non-flooded case, RCU queues directly to
 +                      the main ->cblist in order to avoid the extra
 +                      overhead of the ->nocb_bypass list and its lock.
 +                      But if there are too many callbacks queued during
 +                      a single jiffy, RCU pre-queues the callbacks into
 +                      the ->nocb_bypass queue.  The definition of "too
 +                      many" is supplied by this kernel boot parameter.
 +
        rcutree.rcu_nocb_gp_stride= [KNL]
                        Set the number of NOCB callback kthreads in
                        each group, which defaults to the square root
                        cache (risks via metadata attacks are mostly
                        unchanged). Debug options disable merging on their
                        own.
 -                      For more information see Documentation/vm/slub.rst.
 +                      For more information see Documentation/mm/slub.rst.
  
        slab_max_order= [MM, SLAB]
                        Determines the maximum allowed order for slabs.
                        slub_debug can create guard zones around objects and
                        may poison objects when not in use. Also tracks the
                        last alloc / free. For more information see
 -                      Documentation/vm/slub.rst.
 +                      Documentation/mm/slub.rst.
  
        slub_max_order= [MM, SLUB]
                        Determines the maximum allowed order for slabs.
                        A high setting may cause OOMs due to memory
                        fragmentation. For more information see
 -                      Documentation/vm/slub.rst.
 +                      Documentation/mm/slub.rst.
  
        slub_min_objects=       [MM, SLUB]
                        The minimum number of objects per slab. SLUB will
                        the number of objects indicated. The higher the number
                        of objects the smaller the overhead of tracking slabs
                        and the less frequently locks need to be acquired.
 -                      For more information see Documentation/vm/slub.rst.
 +                      For more information see Documentation/mm/slub.rst.
  
        slub_min_order= [MM, SLUB]
                        Determines the minimum page order for slabs. Must be
                        lower than slub_max_order.
 -                      For more information see Documentation/vm/slub.rst.
 +                      For more information see Documentation/mm/slub.rst.
  
        slub_merge      [MM, SLUB]
                        Same with slab_merge.
diff --combined MAINTAINERS
index 89e42cf33c2119f0f8a21015de818d3846155be0,8aa2f0adfda06d25e718f6db05e42cbd09a4d3c5..c8375b652528fd564348b759a74c2e4681b5fb11
@@@ -171,6 -171,7 +171,6 @@@ F: drivers/scsi/53c700
  
  6LOWPAN GENERIC (BTLE/IEEE 802.15.4)
  M:    Alexander Aring <[email protected]>
 -M:    Jukka Rissanen <[email protected]>
  L:    [email protected]
  L:    [email protected]
  S:    Maintained
@@@ -241,11 -242,6 +241,11 @@@ F:       include/trace/events/9p.
  F:    include/uapi/linux/virtio_9p.h
  F:    net/9p/
  
 +A64FX DIAG DRIVER
 +M:    Hitomi Hasegawa <[email protected]>
 +S:    Supported
 +F:    drivers/soc/fujitsu/a64fx-diag.c
 +
  A8293 MEDIA DRIVER
  M:    Antti Palosaari <[email protected]>
  L:    [email protected]
@@@ -284,37 -280,38 +284,37 @@@ S:      Maintaine
  F:    drivers/hwmon/abituguru3.c
  
  ACCES 104-DIO-48E GPIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-104-dio-48e.c
  
  ACCES 104-IDI-48 GPIO DRIVER
 -M:    "William Breathitt Gray" <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-104-idi-48.c
  
  ACCES 104-IDIO-16 GPIO DRIVER
 -M:    "William Breathitt Gray" <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-104-idio-16.c
  
  ACCES 104-QUAD-8 DRIVER
 -M:    William Breathitt Gray <[email protected]>
 -M:    Syed Nayyar Waris <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/counter/104-quad-8.c
  
  ACCES PCI-IDIO-16 GPIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-pci-idio-16.c
  
  ACCES PCIe-IDIO-24 GPIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-pcie-idio-24.c
@@@ -736,14 -733,6 +736,14 @@@ S:       Maintaine
  F:    Documentation/i2c/busses/i2c-ali1563.rst
  F:    drivers/i2c/busses/i2c-ali1563.c
  
 +ALIBABA ELASTIC RDMA DRIVER
 +M:    Cheng Xu <[email protected]>
 +M:    Kai Shen <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/infiniband/hw/erdma
 +F:    include/uapi/rdma/erdma-abi.h
 +
  ALIENWARE WMI DRIVER
  L:    [email protected]
  S:    Maintained
@@@ -773,14 -762,6 +773,14 @@@ T:       git git://linuxtv.org/media_tree.gi
  F:    Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml
  F:    drivers/media/platform/sunxi/sun4i-csi/
  
 +ALLWINNER A31 MIPI CSI-2 BRIDGE DRIVER
 +M:    Paul Kocialkowski <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/allwinner,sun6i-a31-mipi-csi2.yaml
 +F:    drivers/media/platform/sunxi/sun6i-mipi-csi2/
 +
  ALLWINNER CPUFREQ DRIVER
  M:    Yangtao Li <[email protected]>
  L:    [email protected]
@@@ -816,7 -797,7 +816,7 @@@ S: Maintaine
  F:    drivers/staging/media/sunxi/cedrus/
  
  ALPHA PORT
 -M:    Richard Henderson <r[email protected]>
 +M:    Richard Henderson <r[email protected]>
  M:    Ivan Kokshaysky <[email protected]>
  M:    Matt Turner <[email protected]>
  L:    [email protected]
@@@ -1015,7 -996,7 +1015,7 @@@ AMD PMC DRIVE
  M:    Shyam Sundar S K <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    drivers/platform/x86/amd-pmc.*
 +F:    drivers/platform/x86/amd/pmc.c
  
  AMD HSMP DRIVER
  M:    Naveen Krishna Chatradhi <[email protected]>
@@@ -1025,7 -1006,7 +1025,7 @@@ S:      Maintaine
  F:    Documentation/x86/amd_hsmp.rst
  F:    arch/x86/include/asm/amd_hsmp.h
  F:    arch/x86/include/uapi/asm/amd_hsmp.h
 -F:    drivers/platform/x86/amd_hsmp.c
 +F:    drivers/platform/x86/amd/hsmp.c
  
  AMD POWERPLAY AND SWSMU
  M:    Evan Quan <[email protected]>
@@@ -1347,7 -1328,7 +1347,7 @@@ M:      Todd Kjos <[email protected]
  M:    Martijn Coenen <[email protected]>
  M:    Joel Fernandes <[email protected]>
  M:    Christian Brauner <[email protected]>
 -M:    Hridya Valsaraju <hridya@google.com>
 +M:    Carlos Llamas <cmllamas@google.com>
  M:    Suren Baghdasaryan <[email protected]>
  L:    [email protected]
  S:    Supported
@@@ -1374,7 -1355,7 +1374,7 @@@ S:      Maintaine
  F:    sound/aoa/
  
  APEX EMBEDDED SYSTEMS STX104 IIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/iio/adc/stx104.c
@@@ -1488,13 -1469,6 +1488,13 @@@ S:    Supporte
  W:    http://www.aquantia.com
  F:    drivers/net/ethernet/aquantia/atlantic/aq_ptp*
  
 +AR0521 ON SEMICONDUCTOR CAMERA SENSOR DRIVER
 +M:    Krzysztof HaÅ‚asa <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/media/i2c/onnn,ar0521.yaml
 +F:    drivers/media/i2c/ar0521.c
 +
  ARASAN NAND CONTROLLER DRIVER
  M:    Miquel Raynal <[email protected]>
  M:    Naga Sureshkumar Relli <[email protected]>
@@@ -1547,7 -1521,7 +1547,7 @@@ F:      Documentation/devicetree/bindings/ar
  F:    Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml
  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/i2c/arm,i2c-versatile.yaml
  F:    Documentation/devicetree/bindings/interrupt-controller/arm,versatile-fpga-irq.txt
  F:    Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
  F:    arch/arm/boot/dts/arm-realview-*
@@@ -1850,7 -1824,6 +1850,7 @@@ ARM/APPLE MACHINE SUPPOR
  M:    Hector Martin <[email protected]>
  M:    Sven Peter <[email protected]>
  R:    Alyssa Rosenzweig <[email protected]>
 +L:    [email protected]
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  W:    https://asahilinux.org
@@@ -1860,7 -1833,6 +1860,7 @@@ T:      git https://github.com/AsahiLinux/li
  F:    Documentation/devicetree/bindings/arm/apple.yaml
  F:    Documentation/devicetree/bindings/arm/apple/*
  F:    Documentation/devicetree/bindings/clock/apple,nco.yaml
 +F:    Documentation/devicetree/bindings/dma/apple,admac.yaml
  F:    Documentation/devicetree/bindings/i2c/apple,i2c.yaml
  F:    Documentation/devicetree/bindings/interrupt-controller/apple,*
  F:    Documentation/devicetree/bindings/iommu/apple,dart.yaml
@@@ -1874,7 -1846,6 +1874,7 @@@ F:      Documentation/devicetree/bindings/po
  F:    Documentation/devicetree/bindings/watchdog/apple,wdt.yaml
  F:    arch/arm64/boot/dts/apple/
  F:    drivers/clk/clk-apple-nco.c
 +F:    drivers/dma/apple-admac.c
  F:    drivers/i2c/busses/i2c-pasemi-core.c
  F:    drivers/i2c/busses/i2c-pasemi-platform.c
  F:    drivers/iommu/apple-dart.c
@@@ -1923,7 -1894,6 +1923,7 @@@ L:      [email protected] (moder
  S:    Supported
  Q:    https://patchwork.ozlabs.org/project/linux-aspeed/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed.git
 +F:    Documentation/devicetree/bindings/arm/aspeed/
  F:    arch/arm/boot/dts/aspeed-*
  F:    arch/arm/mach-aspeed/
  N:    aspeed
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git
  F:    Documentation/ABI/testing/sysfs-bus-coresight-devices-*
 -F:    Documentation/devicetree/bindings/arm/coresight-cpu-debug.txt
 -F:    Documentation/devicetree/bindings/arm/coresight-cti.yaml
 -F:    Documentation/devicetree/bindings/arm/coresight.txt
 -F:    Documentation/devicetree/bindings/arm/ete.yaml
 -F:    Documentation/devicetree/bindings/arm/trbe.yaml
 +F:    Documentation/devicetree/bindings/arm/arm,coresight-*.yaml
 +F:    Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
 +F:    Documentation/devicetree/bindings/arm/arm,trace-buffer-extension.yaml
  F:    Documentation/trace/coresight/*
  F:    drivers/hwtracing/coresight/*
  F:    include/dt-bindings/arm/coresight-cti-dt.h
@@@ -2169,13 -2141,11 +2169,13 @@@ M:   Jean-Marie Verdun <[email protected]
  M:    Nick Hawkins <[email protected]>
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/hpe,gxp.yaml
 +F:    Documentation/devicetree/bindings/spi/hpe,gxp-spi.yaml
  F:    Documentation/devicetree/bindings/timer/hpe,gxp-timer.yaml
  F:    arch/arm/boot/dts/hpe-bmc*
  F:    arch/arm/boot/dts/hpe-gxp*
  F:    arch/arm/mach-hpe/
  F:    drivers/clocksource/timer-gxp.c
 +F:    drivers/spi/spi-gxp.c
  F:    drivers/watchdog/gxp-wdt.c
  
  ARM/IGEP MACHINE SUPPORT
@@@ -2447,7 -2417,7 +2447,7 @@@ T:      git git://git.kernel.org/pub/scm/lin
  F:    Documentation/devicetree/bindings/arm/ste-*
  F:    Documentation/devicetree/bindings/arm/ux500.yaml
  F:    Documentation/devicetree/bindings/arm/ux500/
 -F:    Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
 +F:    Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml
  F:    arch/arm/boot/dts/ste-*
  F:    arch/arm/mach-nomadik/
  F:    arch/arm/mach-ux500/
@@@ -2479,11 -2449,9 +2479,11 @@@ F:    Documentation/devicetree/bindings/*/
  F:    Documentation/devicetree/bindings/arm/npcm/*
  F:    arch/arm/boot/dts/nuvoton-npcm*
  F:    arch/arm/mach-npcm/
 +F:    arch/arm64/boot/dts/nuvoton/
  F:    drivers/*/*npcm*
  F:    drivers/*/*/*npcm*
  F:    include/dt-bindings/clock/nuvoton,npcm7xx-clock.h
 +F:    include/dt-bindings/clock/nuvoton,npcm845-clk.h
  
  ARM/NUVOTON WPCM450 ARCHITECTURE
  M:    Jonathan Neuschäfer <[email protected]>
@@@ -2620,7 -2588,7 +2620,7 @@@ L:      [email protected] (mo
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/rda.yaml
  F:    Documentation/devicetree/bindings/gpio/gpio-rda.yaml
 -F:    Documentation/devicetree/bindings/interrupt-controller/rda,8810pl-intc.txt
 +F:    Documentation/devicetree/bindings/interrupt-controller/rda,8810pl-intc.yaml
  F:    Documentation/devicetree/bindings/serial/rda,8810pl-uart.yaml
  F:    Documentation/devicetree/bindings/timer/rda,8810pl-timer.yaml
  F:    arch/arm/boot/dts/rda8810pl-*
@@@ -2648,8 -2616,6 +2648,8 @@@ Q:      http://patchwork.kernel.org/project/
  C:    irc://irc.libera.chat/renesas-soc
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next
  F:    Documentation/devicetree/bindings/arm/renesas.yaml
 +F:    Documentation/devicetree/bindings/hwinfo/renesas,prr.yaml
 +F:    Documentation/devicetree/bindings/soc/renesas/
  F:    arch/arm64/boot/dts/renesas/
  F:    drivers/soc/renesas/
  F:    include/linux/soc/renesas/
@@@ -2700,7 -2666,6 +2700,7 @@@ B:      mailto:[email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git
  F:    Documentation/arm/samsung/
  F:    Documentation/devicetree/bindings/arm/samsung/
 +F:    Documentation/devicetree/bindings/hwinfo/samsung,*
  F:    Documentation/devicetree/bindings/power/pd-samsung.yaml
  F:    Documentation/devicetree/bindings/soc/samsung/
  F:    arch/arm/boot/dts/exynos*
@@@ -2750,7 -2715,6 +2750,7 @@@ M:      Sylwester Nawrocki <s.nawrocki@samsu
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected]
  S:    Maintained
 +F:    Documentation/devicetree/bindings/media/samsung,s5pv210-jpeg.yaml
  F:    drivers/media/platform/samsung/s5p-jpeg/
  
  ARM/SAMSUNG S5P SERIES Multi Format Codec (MFC) SUPPORT
@@@ -2770,7 -2734,6 +2770,7 @@@ Q:      http://patchwork.kernel.org/project/
  C:    irc://irc.libera.chat/renesas-soc
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next
  F:    Documentation/devicetree/bindings/arm/renesas.yaml
 +F:    Documentation/devicetree/bindings/soc/renesas/
  F:    arch/arm/boot/dts/emev2*
  F:    arch/arm/boot/dts/gr-peach*
  F:    arch/arm/boot/dts/iwg20d-q7*
@@@ -2860,23 -2823,6 +2860,23 @@@ F:    drivers/clocksource/armv7m_systick.
  N:    stm32
  N:    stm
  
 +ARM/SUNPLUS SP7021 SOC SUPPORT
 +M:    Qin Jian <[email protected]>
 +L:    [email protected] (moderated for mon-subscribers)
 +S:    Maintained
 +W:    https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
 +F:    Documentation/devicetree/bindings/arm/sunplus,sp7021.yaml
 +F:    Documentation/devicetree/bindings/clock/sunplus,sp7021-clkc.yaml
 +F:    Documentation/devicetree/bindings/interrupt-controller/sunplus,sp7021-intc.yaml
 +F:    Documentation/devicetree/bindings/reset/sunplus,reset.yaml
 +F:    arch/arm/boot/dts/sunplus-sp7021*.dts*
 +F:    arch/arm/configs/sp7021_*defconfig
 +F:    arch/arm/mach-sunplus/
 +F:    drivers/irqchip/irq-sp7021-intc.c
 +F:    drivers/reset/reset-sunplus.c
 +F:    include/dt-bindings/clock/sunplus,sp7021-clkc.h
 +F:    include/dt-bindings/reset/sunplus,sp7021-reset.h
 +
  ARM/Synaptics SoC support
  M:    Jisheng Zhang <[email protected]>
  M:    Sebastian Hesselbarth <[email protected]>
@@@ -2953,7 -2899,6 +2953,7 @@@ M:      Tero Kristo <[email protected]
  L:    [email protected] (moderated for non-subscribers)
  S:    Supported
  F:    Documentation/devicetree/bindings/arm/ti/k3.yaml
 +F:    Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml
  F:    arch/arm64/boot/dts/ti/Makefile
  F:    arch/arm64/boot/dts/ti/k3-*
  F:    include/dt-bindings/pinctrl/k3.h
@@@ -3192,13 -3137,6 +3192,13 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/media/aspeed-video.txt
  F:    drivers/media/platform/aspeed/
  
 +ASPEED USB UDC DRIVER
 +M:    Neal Liu <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/usb/aspeed,ast2600-udc.yaml
 +F:    drivers/usb/gadget/udc/aspeed_udc.c
 +
  ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS
  M:    Corentin Chary <[email protected]>
  L:    [email protected]
@@@ -3501,7 -3439,7 +3501,7 @@@ W:      https://wireless.wiki.kernel.org/en/
  F:    drivers/net/wireless/broadcom/b43legacy/
  
  BACKLIGHT CLASS/SUBSYSTEM
 -M:    Lee Jones <lee.jones@linaro.org>
 +M:    Lee Jones <lee@kernel.org>
  M:    Daniel Thompson <[email protected]>
  M:    Jingoo Han <[email protected]>
  L:    [email protected]
@@@ -3937,28 -3875,15 +3937,28 @@@ BROADCOM BCMBCA ARM ARCHITECTUR
  M:    William Zhang <[email protected]>
  M:    Anand Gore <[email protected]>
  M:    Kursad Oney <[email protected]>
 +M:    Florian Fainelli <[email protected]>
  R:    Broadcom internal kernel review list <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  T:    git git://github.com/broadcom/stblinux.git
  F:    Documentation/devicetree/bindings/arm/bcm/brcm,bcmbca.yaml
 -F:    arch/arm/boot/dts/bcm47622.dtsi
 -F:    arch/arm/boot/dts/bcm947622.dts
 +F:    arch/arm64/boot/dts/broadcom/bcmbca/*
  N:    bcmbca
  N:    bcm[9]?47622
 +N:    bcm[9]?4912
 +N:    bcm[9]?63138
 +N:    bcm[9]?63146
 +N:    bcm[9]?63148
 +N:    bcm[9]?63158
 +N:    bcm[9]?63178
 +N:    bcm[9]?6756
 +N:    bcm[9]?6813
 +N:    bcm[9]?6846
 +N:    bcm[9]?6855
 +N:    bcm[9]?6856
 +N:    bcm[9]?6858
 +N:    bcm[9]?6878
  
  BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
  M:    Florian Fainelli <[email protected]>
@@@ -4034,6 -3959,14 +4034,6 @@@ S:     Maintaine
  F:    arch/arm/boot/dts/bcm47189*
  F:    arch/arm/boot/dts/bcm53573*
  
 -BROADCOM BCM63XX ARM ARCHITECTURE
 -M:    Florian Fainelli <[email protected]>
 -R:    Broadcom internal kernel review list <[email protected]>
 -L:    [email protected] (moderated for non-subscribers)
 -S:    Maintained
 -T:    git git://github.com/broadcom/stblinux.git
 -N:    bcm63xx
 -
  BROADCOM BCM63XX/BCM33XX UDC DRIVER
  M:    Kevin Cernekee <[email protected]>
  L:    [email protected]
@@@ -4440,7 -4373,7 +4440,7 @@@ L:      [email protected]
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
 -F:    Documentation/devicetree/bindings/devfreq/exynos-bus.txt
 +F:    Documentation/devicetree/bindings/interconnect/samsung,exynos-bus.yaml
  F:    drivers/devfreq/exynos-bus.c
  
  BUSLOGIC SCSI DRIVER
@@@ -4912,7 -4845,6 +4912,7 @@@ S:      Maintaine
  F:    Documentation/devicetree/bindings/sound/cirrus,cs*
  F:    include/dt-bindings/sound/cs*
  F:    sound/pci/hda/cs*
 +F:    sound/pci/hda/hda_cs_dsp_ctl.*
  F:    sound/soc/codecs/cs*
  
  CIRRUS LOGIC DSP FIRMWARE DRIVER
@@@ -5031,7 -4963,7 +5031,7 @@@ R:      Nick Desaulniers <ndesaulniers@googl
  L:    [email protected]
  S:    Supported
  B:    https://github.com/ClangBuiltLinux/linux/issues
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/clang/features
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
  F:    include/linux/cfi.h
  F:    kernel/cfi.c
  
@@@ -5198,7 -5130,6 +5198,7 @@@ F:      include/linux/console
  
  CONTEXT TRACKING
  M:    Frederic Weisbecker <[email protected]>
 +M:    "Paul E. McKenney" <[email protected]>
  S:    Maintained
  F:    kernel/context_tracking.c
  F:    include/linux/context_tracking*
@@@ -5274,10 -5205,10 +5274,10 @@@ F:   Documentation/hwmon/corsair-psu.rs
  F:    drivers/hwmon/corsair-psu.c
  
  COUNTER SUBSYSTEM
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
 -T:    git [email protected]:vilhelmgray/counter.git
 +T:    git https://git.linaro.org/people/william.gray/counter.git
  F:    Documentation/ABI/testing/sysfs-bus-counter
  F:    Documentation/driver-api/generic-counter.rst
  F:    drivers/counter/
@@@ -5521,7 -5452,7 +5521,7 @@@ W:      http://www.chelsio.co
  F:    drivers/net/ethernet/chelsio/cxgb3/
  
  CXGB3 ISCSI DRIVER (CXGB3I)
 -M:    Karen Xie <kxie@chelsio.com>
 +M:    Varun Prakash <varun@chelsio.com>
  L:    [email protected]
  S:    Supported
  W:    http://www.chelsio.com
@@@ -5553,7 -5484,7 +5553,7 @@@ W:      http://www.chelsio.co
  F:    drivers/net/ethernet/chelsio/cxgb4/
  
  CXGB4 ISCSI DRIVER (CXGB4I)
 -M:    Karen Xie <kxie@chelsio.com>
 +M:    Varun Prakash <varun@chelsio.com>
  L:    [email protected]
  S:    Supported
  W:    http://www.chelsio.com
@@@ -5669,7 -5600,7 +5669,7 @@@ L:      [email protected]
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-kernel-mm-damon
  F:    Documentation/admin-guide/mm/damon/
 -F:    Documentation/vm/damon/
 +F:    Documentation/mm/damon/
  F:    include/linux/damon.h
  F:    include/trace/events/damon.h
  F:    mm/damon/
@@@ -5924,7 -5855,6 +5924,7 @@@ L:      [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
  F:    Documentation/devicetree/bindings/devfreq/
 +F:    Documentation/devicetree/bindings/interconnect/mediatek,cci.yaml
  F:    drivers/devfreq/
  F:    include/linux/devfreq.h
  F:    include/trace/events/devfreq.h
@@@ -5999,7 -5929,6 +5999,7 @@@ W:      http://www.dialog-semiconductor.com/
  F:    Documentation/devicetree/bindings/input/da90??-onkey.txt
  F:    Documentation/devicetree/bindings/input/dlg,da72??.txt
  F:    Documentation/devicetree/bindings/mfd/da90*.txt
 +F:    Documentation/devicetree/bindings/mfd/da90*.yaml
  F:    Documentation/devicetree/bindings/regulator/dlg,da9*.yaml
  F:    Documentation/devicetree/bindings/regulator/da92*.txt
  F:    Documentation/devicetree/bindings/regulator/slg51000.txt
@@@ -6038,7 -5967,7 +6038,7 @@@ F:      include/sound/da[79]*.
  F:    sound/soc/codecs/da[79]*.[ch]
  
  DIAMOND SYSTEMS GPIO-MM GPIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-gpio-mm.c
@@@ -6115,7 -6044,6 +6115,7 @@@ T:      git git://git.kernel.org/pub/scm/lin
  F:    Documentation/devicetree/bindings/dma/
  F:    Documentation/driver-api/dmaengine/
  F:    drivers/dma/
 +F:    include/dt-bindings/dma/
  F:    include/linux/dma/
  F:    include/linux/dmaengine.h
  F:    include/linux/of_dma.h
@@@ -6286,6 -6214,14 +6286,6 @@@ F:     Documentation/networking/device_driv
  F:    drivers/net/ethernet/freescale/dpaa2/dpaa2-switch*
  F:    drivers/net/ethernet/freescale/dpaa2/dpsw*
  
 -DPT_I2O SCSI RAID DRIVER
 -M:    Adaptec OEM Raid Solutions <[email protected]>
 -L:    [email protected]
 -S:    Maintained
 -W:    http://www.adaptec.com/
 -F:    drivers/scsi/dpt*
 -F:    drivers/scsi/dpt/
 -
  DRBD DRIVER
  M:    Philipp Reisner <[email protected]>
  M:    Lars Ellenberg <[email protected]>
@@@ -6381,13 -6317,6 +6381,13 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
  F:    drivers/gpu/drm/bridge/chipone-icn6211.c
  
 +DRM DRIVER FOR EBBG FT8719 PANEL
 +M:    Joel Selvaraj <[email protected]>
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    Documentation/devicetree/bindings/display/panel/ebbg,ft8719.yaml
 +F:    drivers/gpu/drm/panel/panel-ebbg-ft8719.c
 +
  DRM DRIVER FOR FARADAY TVE200 TV ENCODER
  M:    Linus Walleij <[email protected]>
  S:    Maintained
@@@ -6446,12 -6375,6 +6446,12 @@@ S:    Orphan / Obsolet
  F:    drivers/gpu/drm/i810/
  F:    include/uapi/drm/i810_drm.h
  
 +DRM DRIVER FOR LOGICVC DISPLAY CONTROLLER
 +M:    Paul Kocialkowski <[email protected]>
 +S:    Supported
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    drivers/gpu/drm/logicvc/
 +
  DRM DRIVER FOR LVDS PANELS
  M:    Laurent Pinchart <[email protected]>
  L:    [email protected]
@@@ -6628,17 -6551,12 +6628,17 @@@ S:   Orphan / Obsolet
  F:    drivers/gpu/drm/savage/
  F:    include/uapi/drm/savage_drm.h
  
 -DRM DRIVER FOR SIMPLE FRAMEBUFFERS
 +DRM DRIVER FOR FIRMWARE FRAMEBUFFERS
  M:    Thomas Zimmermann <[email protected]>
 +M:    Javier Martinez Canillas <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    drivers/gpu/drm/drm_aperture.c
  F:    drivers/gpu/drm/tiny/simpledrm.c
 +F:    drivers/video/aperture.c
 +F:    include/drm/drm_aperture.h
 +F:    include/linux/aperture.h
  
  DRM DRIVER FOR SIS VIDEO CARDS
  S:    Orphan / Obsolete
@@@ -6676,12 -6594,6 +6676,12 @@@ DRM DRIVER FOR TDFX VIDEO CARD
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/tdfx/
  
 +DRM DRIVER FOR TI DLPC3433 MIPI DSI TO DMD BRIDGE
 +M:    Jagan Teki <[email protected]>
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/display/bridge/ti,dlpc3433.yaml
 +F:    drivers/gpu/drm/bridge/ti-dlpc3433.c
 +
  DRM DRIVER FOR TI SN65DSI86 BRIDGE CHIP
  R:    Douglas Anderson <[email protected]>
  F:    Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml
@@@ -6811,6 -6723,7 +6811,6 @@@ F:      drivers/gpu/drm/bridge
  
  DRM DRIVERS FOR EXYNOS
  M:    Inki Dae <[email protected]>
 -M:    Joonyoung Shim <[email protected]>
  M:    Seung-Woo Kim <[email protected]>
  M:    Kyungmin Park <[email protected]>
  L:    [email protected]
@@@ -6839,16 -6752,6 +6839,16 @@@ F:    Documentation/devicetree/bindings/di
  F:    drivers/gpu/drm/imx/
  F:    drivers/gpu/ipu-v3/
  
 +DRM DRIVERS FOR FREESCALE IMX BRIDGE
 +M:    Liu Ying <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-ldb.yaml
 +F:    Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml
 +F:    Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml
 +F:    Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml
 +F:    drivers/gpu/drm/bridge/imx/
 +
  DRM DRIVERS FOR GMA500 (Poulsbo, Moorestown and derivative chipsets)
  M:    Patrik Jakobsson <[email protected]>
  L:    [email protected]
@@@ -6893,7 -6796,6 +6893,7 @@@ L:      [email protected] (
  S:    Supported
  F:    Documentation/devicetree/bindings/display/mediatek/
  F:    drivers/gpu/drm/mediatek/
 +F:    drivers/phy/mediatek/phy-mtk-dp.c
  F:    drivers/phy/mediatek/phy-mtk-hdmi*
  F:    drivers/phy/mediatek/phy-mtk-mipi*
  
@@@ -6903,7 -6805,7 +6903,7 @@@ L:      [email protected]
  L:    [email protected]
  S:    Supported
  T:    git git://anongit.freedesktop.org/tegra/linux.git
 -F:    Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
 +F:    Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml
  F:    Documentation/devicetree/bindings/gpu/host1x/
  F:    drivers/gpu/drm/tegra/
  F:    drivers/gpu/host1x/
@@@ -6980,7 -6882,6 +6980,7 @@@ F:      drivers/gpu/drm/omapdrm
  
  DRM DRIVERS FOR V3D
  M:    Emma Anholt <[email protected]>
 +M:    Melissa Wen <[email protected]>
  S:    Supported
  T:    git git://anongit.freedesktop.org/drm/drm-misc
  F:    Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml
  S:    Maintained
  F:    drivers/net/ethernet/ibm/ehea/
  
 +ELM327 CAN NETWORK DRIVER
 +M:    Max Staudt <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/networking/device_drivers/can/can327.rst
 +F:    drivers/net/can/can327.c
 +
  EM28XX VIDEO4LINUX DRIVER
  M:    Mauro Carvalho Chehab <[email protected]>
  L:    [email protected]
@@@ -7509,7 -7403,7 +7509,7 @@@ F:      Documentation/admin-guide/media/em28
  F:    drivers/media/usb/em28xx/
  
  EMBEDDED LINUX
 -M:    Matt Mackall <mpm@selenic.com>
 +M:    Olivia Mackall <olivia@selenic.com>
  M:    David Woodhouse <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -7591,8 -7485,6 +7591,8 @@@ F:      include/video/s1d13xxxfb.
  EROFS FILE SYSTEM
  M:    Gao Xiang <[email protected]>
  M:    Chao Yu <[email protected]>
 +R:    Yue Hu <[email protected]>
 +R:    Jeffle Xu <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
@@@ -7606,13 -7498,6 +7606,13 @@@ S:    Maintaine
  F:    include/linux/errseq.h
  F:    lib/errseq.c
  
 +ESD CAN/USB DRIVERS
 +M:    Frank Jungclaus <[email protected]>
 +R:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/can/usb/esd_usb.c
 +
  ET131X NETWORK DRIVER
  M:    Mark Einon <[email protected]>
  S:    Odd Fixes
@@@ -7888,6 -7773,9 +7888,6 @@@ F:      include/linux/fs.
  F:    include/linux/fs_types.h
  F:    include/uapi/linux/fs.h
  F:    include/uapi/linux/openat2.h
 -X:    fs/io-wq.c
 -X:    fs/io-wq.h
 -X:    fs/io_uring.c
  
  FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER
  M:    Riku Voipio <[email protected]>
@@@ -7986,7 -7874,6 +7986,7 @@@ FORTIFY_SOURC
  M:    Kees Cook <[email protected]>
  L:    [email protected]
  S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
  F:    include/linux/fortify-string.h
  F:    lib/test_fortify/*
  F:    scripts/test_fortify.sh
@@@ -8019,21 -7906,6 +8019,21 @@@ F:    Documentation/fpga
  F:    drivers/fpga/
  F:    include/linux/fpga/
  
 +INTEL MAX10 BMC SECURE UPDATES
 +M:    Russ Weight <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-driver-intel-m10-bmc-sec-update
 +F:    drivers/fpga/intel-m10-bmc-sec-update.c
 +
 +MICROCHIP POLARFIRE FPGA DRIVERS
 +M:    Conor Dooley <[email protected]>
 +R:    Ivan Bornyakov <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml
 +F:    drivers/fpga/microchip-spi.c
 +
  FPU EMULATOR
  M:    Bill Metzenthen <[email protected]>
  S:    Maintained
@@@ -8444,7 -8316,6 +8444,7 @@@ GCC PLUGIN
  M:    Kees Cook <[email protected]>
  L:    [email protected]
  S:    Maintained
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
  F:    Documentation/kbuild/gcc-plugins.rst
  F:    scripts/Makefile.gcc-plugins
  F:    scripts/gcc-plugins/
@@@ -8536,7 -8407,6 +8536,7 @@@ Q:      https://patchwork.kernel.org/project
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
  F:    Documentation/devicetree/bindings/phy/
  F:    drivers/phy/
 +F:    include/dt-bindings/phy/
  F:    include/linux/phy/
  
  GENERIC PINCTRL I2C DEMULTIPLEXER DRIVER
@@@ -8890,7 -8760,6 +8890,7 @@@ L:      [email protected]
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml
 +F:    Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
  F:    Documentation/devicetree/bindings/media/rockchip-vpu.yaml
  F:    drivers/staging/media/hantro/
  
@@@ -8917,7 -8786,7 +8917,7 @@@ F:      include/trace/events/hwmon*.
  K:    (devm_)?hwmon_device_(un)?register(|_with_groups|_with_info)
  
  HARDWARE RANDOM NUMBER GENERATOR CORE
 -M:    Matt Mackall <mpm@selenic.com>
 +M:    Olivia Mackall <olivia@selenic.com>
  M:    Herbert Xu <[email protected]>
  L:    [email protected]
  S:    Odd fixes
@@@ -9167,31 -9036,16 +9167,31 @@@ F:   Documentation/admin-guide/perf/hisi-
  F:    Documentation/admin-guide/perf/hisi-pmu.rst
  F:    drivers/perf/hisilicon
  
 -HISILICON QM AND ZIP Controller DRIVER
 +HISILICON HNS3 PMU DRIVER
 +M:    Guangbin Huang <[email protected]>
 +S:    Supported
 +F:    Documentation/admin-guide/perf/hns3-pmu.rst
 +F:    drivers/perf/hisilicon/hns3_pmu.c
 +
 +HISILICON QM DRIVER
 +M:    Weili Qian <[email protected]>
  M:    Zhou Wang <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    Documentation/ABI/testing/debugfs-hisi-zip
 +F:    drivers/crypto/hisilicon/Kconfig
 +F:    drivers/crypto/hisilicon/Makefile
  F:    drivers/crypto/hisilicon/qm.c
  F:    drivers/crypto/hisilicon/sgl.c
 -F:    drivers/crypto/hisilicon/zip/
  F:    include/linux/hisi_acc_qm.h
  
 +HISILICON ZIP Controller DRIVER
 +M:    Yang Shen <[email protected]>
 +M:    Zhou Wang <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/ABI/testing/debugfs-hisi-zip
 +F:    drivers/crypto/hisilicon/zip/
 +
  HISILICON ROCE DRIVER
  M:    Wenpeng Liang <[email protected]>
  M:    Weihang Li <[email protected]>
@@@ -9254,7 -9108,7 +9254,7 @@@ HMM - Heterogeneous Memory Managemen
  M:    Jérôme Glisse <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    Documentation/vm/hmm.rst
 +F:    Documentation/mm/hmm.rst
  F:    include/linux/hmm*
  F:    lib/test_hmm*
  F:    mm/hmm*
@@@ -9352,8 -9206,8 +9352,8 @@@ L:      [email protected]
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-kernel-mm-hugepages
  F:    Documentation/admin-guide/mm/hugetlbpage.rst
 -F:    Documentation/vm/hugetlbfs_reserv.rst
 -F:    Documentation/vm/vmemmap_dedup.rst
 +F:    Documentation/mm/hugetlbfs_reserv.rst
 +F:    Documentation/mm/vmemmap_dedup.rst
  F:    fs/hugetlbfs/
  F:    include/linux/hugetlb.h
  F:    mm/hugetlb.c
@@@ -9419,7 -9273,6 +9419,7 @@@ S:      Supporte
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
  F:    Documentation/ABI/stable/sysfs-bus-vmbus
  F:    Documentation/ABI/testing/debugfs-hyperv
 +F:    Documentation/virt/hyperv
  F:    Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst
  F:    arch/arm64/hyperv
  F:    arch/arm64/include/asm/hyperv-tlfs.h
@@@ -9765,7 -9618,6 +9765,7 @@@ F:      drivers/input/misc/ideapad_slidebar.
  
  IDMAPPED MOUNTS
  M:    Christian Brauner <[email protected]>
 +M:    Seth Forshee <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
@@@ -9858,7 -9710,6 +9858,7 @@@ F:      Documentation/ABI/testing/sysfs-bus-
  F:    Documentation/devicetree/bindings/iio/
  F:    drivers/iio/
  F:    drivers/staging/iio/
 +F:    include/dt-bindings/iio/
  F:    include/linux/iio/
  F:    tools/iio/
  
  S:    Maintained
  F:    drivers/video/fbdev/i810/
  
 +INTEL 8255 GPIO DRIVER
 +M:    William Breathitt Gray <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/gpio/gpio-i8255.c
 +F:    drivers/gpio/gpio-i8255.h
 +
  INTEL ASoC DRIVERS
  M:    Cezary Rojewski <[email protected]>
  M:    Pierre-Louis Bossart <[email protected]>
@@@ -10194,8 -10038,7 +10194,8 @@@ S:   Supporte
  Q:    https://patchwork.kernel.org/project/linux-dmaengine/list/
  F:    drivers/dma/ioat*
  
 -INTEL IADX DRIVER
 +INTEL IDXD DRIVER
 +M:    Fenghua Yu <[email protected]>
  M:    Dave Jiang <[email protected]>
  L:    [email protected]
  S:    Supported
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
  F:    drivers/iommu/intel/
- F:    include/linux/intel-iommu.h
  F:    include/linux/intel-svm.h
  
  INTEL IOP-ADMA DMA DRIVER
@@@ -10389,7 -10231,7 +10388,7 @@@ F:   drivers/gpio/gpio-*cove.
  
  INTEL PMIC MULTIFUNCTION DEVICE DRIVERS
  M:    Andy Shevchenko <[email protected]>
 -S:    Maintained
 +S:    Supported
  F:    drivers/mfd/intel_soc_pmic*
  F:    include/linux/mfd/intel_soc_pmic*
  
@@@ -10605,9 -10447,20 +10604,20 @@@ T: git git://git.kernel.org/pub/scm/fs/
  F:    fs/iomap/
  F:    include/linux/iomap.h
  
- IOMMU DRIVERS
+ IOMMU DMA-API LAYER
+ M:    Robin Murphy <[email protected]>
+ L:    [email protected]
+ S:    Maintained
+ T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
+ F:    drivers/iommu/dma-iommu.c
+ F:    drivers/iommu/iova.c
+ F:    include/linux/dma-iommu.h
+ F:    include/linux/iova.h
+ IOMMU SUBSYSTEM
  M:    Joerg Roedel <[email protected]>
  M:    Will Deacon <[email protected]>
+ R:    Robin Murphy <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
  S:    Maintained
  T:    git git://git.kernel.dk/linux-block
  T:    git git://git.kernel.dk/liburing
 -F:    fs/io-wq.c
 -F:    fs/io-wq.h
 -F:    fs/io_uring.c
 +F:    io_uring/
  F:    include/linux/io_uring.h
  F:    include/uapi/linux/io_uring.h
  F:    tools/io_uring/
@@@ -10702,7 -10557,7 +10712,7 @@@ F:   Documentation/devicetree/bindings/in
  F:    drivers/irqchip/
  
  ISA
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  S:    Maintained
  F:    Documentation/driver-api/isa.rst
  F:    drivers/base/isa.c
@@@ -10993,17 -10848,6 +11003,17 @@@ F: scripts/mk
  F:    scripts/mod/
  F:    scripts/package/
  
 +KERNEL HARDENING (not covered by other areas)
 +M:    Kees Cook <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
 +F:    include/linux/overflow.h
 +F:    include/linux/randomize_kstack.h
 +F:    mm/usercopy.c
 +K:    \b(add|choose)_random_kstack_offset\b
 +K:    \b__check_(object_size|heap_object)\b
 +
  KERNEL JANITORS
  L:    [email protected]
  S:    Odd Fixes
@@@ -11814,7 -11658,7 +11824,7 @@@ F:   drivers/media/usb/dvb-usb-v2/lmedm04
  LOADPIN SECURITY MODULE
  M:    Kees Cook <[email protected]>
  S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git lsm/loadpin
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
  F:    Documentation/admin-guide/LSM/LoadPin.rst
  F:    security/loadpin/
  
@@@ -12402,6 -12246,7 +12412,6 @@@ F:   Documentation/devicetree/bindings/*/
  F:    Documentation/devicetree/bindings/*/maxim,max77693.yaml
  F:    Documentation/devicetree/bindings/*/maxim,max77843.yaml
  F:    Documentation/devicetree/bindings/clock/maxim,max77686.txt
 -F:    Documentation/devicetree/bindings/mfd/max77693.txt
  F:    drivers/*/*max77843.c
  F:    drivers/*/max14577*.c
  F:    drivers/*/max77686*.c
@@@ -12477,7 -12322,7 +12487,7 @@@ F:   drivers/net/ieee802154/mcr20a.
  F:    drivers/net/ieee802154/mcr20a.h
  
  MEASUREMENT COMPUTING CIO-DAC IIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/iio/dac/cio-dac.c
@@@ -12718,7 -12563,6 +12728,7 @@@ F:   Documentation/driver-api/media
  F:    Documentation/userspace-api/media/
  F:    drivers/media/
  F:    drivers/staging/media/
 +F:    include/dt-bindings/media/
  F:    include/linux/platform_data/media/
  F:    include/media/
  F:    include/uapi/linux/dvb/
@@@ -12801,7 -12645,6 +12811,7 @@@ F:   drivers/media/platform/mediatek/vpu
  MEDIATEK MEDIA DRIVER
  M:    Tiffany Lin <[email protected]>
  M:    Andrew-CT Chen <[email protected]>
 +M:    Yunfei Dong <[email protected]>
  S:    Supported
  F:    Documentation/devicetree/bindings/media/mediatek,vcodec*.yaml
  F:    Documentation/devicetree/bindings/media/mediatek-vpu.txt
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
 +F:    Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
  F:    drivers/net/dsa/microchip/*
  F:    include/linux/platform_data/microchip-ksz.h
  F:    net/dsa/tag_ksz.c
@@@ -13396,14 -13238,6 +13406,14 @@@ S: Supporte
  F:    Documentation/devicetree/bindings/mtd/atmel-nand.txt
  F:    drivers/mtd/nand/raw/atmel/*
  
 +MICROCHIP OTPC DRIVER
 +M:    Claudiu Beznea <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Supported
 +F:    Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml
 +F:    drivers/nvmem/microchip-otpc.c
 +F:    include/dt-bindings/nvmem/microchip,sama7g5-otpc.h
 +
  MICROCHIP PWM DRIVER
  M:    Claudiu Beznea <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
@@@ -13480,12 -13314,6 +13490,12 @@@ F: drivers/scsi/smartpqi/smartpqi*.[ch
  F:    include/linux/cciss*.h
  F:    include/uapi/linux/cciss*.h
  
 +MICROSOFT SURFACE AGGREGATOR TABLET-MODE SWITCH
 +M:    Maximilian Luz <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/platform/surface/surface_aggregator_tabletsw.c
 +
  MICROSOFT SURFACE BATTERY AND AC DRIVERS
  M:    Maximilian Luz <[email protected]>
  L:    [email protected]
@@@ -13557,12 -13385,6 +13567,12 @@@ F: include/linux/surface_acpi_notify.
  F:    include/linux/surface_aggregator/
  F:    include/uapi/linux/surface_aggregator/
  
 +MICROSOFT SURFACE SYSTEM AGGREGATOR HUB DRIVER
 +M:    Maximilian Luz <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/platform/surface/surface_aggregator_hub.c
 +
  MICROTEK X6 SCANNER
  M:    Oliver Neukum <[email protected]>
  S:    Maintained
@@@ -13872,7 -13694,7 +13882,7 @@@ F:   Documentation/devicetree/bindings/me
  F:    drivers/media/i2c/mt9v111.c
  
  MULTIFUNCTION DEVICES (MFD)
 -M:    Lee Jones <lee.jones@linaro.org>
 +M:    Lee Jones <lee@kernel.org>
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
  F:    Documentation/devicetree/bindings/mfd/
@@@ -14020,11 -13842,12 +14030,11 @@@ L:        [email protected]
  S:    Maintained
  F:    net/sched/sch_netem.c
  
 -NETERION 10GbE DRIVERS (s2io/vxge)
 +NETERION 10GbE DRIVERS (s2io)
  M:    Jon Mason <[email protected]>
  L:    [email protected]
  S:    Supported
  F:    Documentation/networking/device_drivers/ethernet/neterion/s2io.rst
 -F:    Documentation/networking/device_drivers/ethernet/neterion/vxge.rst
  F:    drivers/net/ethernet/neterion/
  
  NETFILTER
@@@ -14509,8 -14332,7 +14519,8 @@@ S:   Supporte
  W:    http://git.infradead.org/nvme.git
  T:    git://git.infradead.org/nvme.git
  F:    drivers/nvme/host/
 -F:    include/linux/nvme.h
 +F:    drivers/nvme/common/
 +F:    include/linux/nvme*
  F:    include/uapi/linux/nvme_ioctl.h
  
  NVM EXPRESS FC TRANSPORT DRIVERS
@@@ -15026,7 -14848,6 +15036,7 @@@ M:   Daniel Scally <[email protected]
  L:    [email protected]
  S:    Maintained
  T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml
  F:    drivers/media/i2c/ov5693.c
  
  OMNIVISION OV5695 SENSOR DRIVER
@@@ -15101,13 -14922,6 +15111,13 @@@ S: Maintaine
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/i2c/ov9734.c
  
 +ONBOARD USB HUB DRIVER
 +M:    Matthias Kaehlcke <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-hub
 +F:    drivers/usb/misc/onboard_usb_hub.c
 +
  ONENAND FLASH DRIVER
  M:    Kyungmin Park <[email protected]>
  L:    [email protected]
@@@ -15194,7 -15008,7 +15204,7 @@@ M:   Peter Korsgaard <[email protected]
  M:    Andrew Lunn <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    Documentation/devicetree/bindings/i2c/i2c-ocores.txt
 +F:    Documentation/devicetree/bindings/i2c/opencores,i2c-ocores.yaml
  F:    Documentation/i2c/busses/i2c-ocores.rst
  F:    drivers/i2c/busses/i2c-ocores.c
  F:    include/linux/platform_data/i2c-ocores.h
@@@ -15339,7 -15153,7 +15349,7 @@@ M:   Pasha Tatashin <pasha.tatashin@solee
  M:    Andrew Morton <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    Documentation/vm/page_table_check.rst
 +F:    Documentation/mm/page_table_check.rst
  F:    include/linux/page_table_check.h
  F:    mm/page_table_check.c
  
  S:    Maintained
  F:    drivers/pci/controller/dwc/*spear*
  
 +PCI DRIVER FOR XILINX VERSAL CPM
 +M:    Bharat Kumar Gogada <[email protected]>
 +M:    Michal Simek <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml
 +F:    drivers/pci/controller/pcie-xilinx-cpm.c
 +
  PCMCIA SUBSYSTEM
  M:    Dominik Brodowski <[email protected]>
  S:    Odd Fixes
@@@ -16157,6 -15963,14 +16167,6 @@@ S:  Maintaine
  F:    Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml
  F:    drivers/iio/chemical/pms7003.c
  
 -PLATFORM FEATURE INFRASTRUCTURE
 -M:    Juergen Gross <[email protected]>
 -S:    Maintained
 -F:    arch/*/include/asm/platform-feature.h
 -F:    include/asm-generic/platform-feature.h
 -F:    include/linux/platform-feature.h
 -F:    kernel/platform-feature.c
 -
  PLDMFW LIBRARY
  M:    Jacob Keller <[email protected]>
  S:    Maintained
@@@ -16521,17 -16335,17 +16531,17 @@@ F:        drivers/media/rc/pwm-ir-tx.
  PWM SUBSYSTEM
  M:    Thierry Reding <[email protected]>
  R:    Uwe Kleine-König <[email protected]>
 -M:    Lee Jones <[email protected]>
  L:    [email protected]
  S:    Maintained
  Q:    https://patchwork.ozlabs.org/project/linux-pwm/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git
 -F:    Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
 +F:    Documentation/devicetree/bindings/gpio/gpio-mvebu.yaml
  F:    Documentation/devicetree/bindings/pwm/
  F:    Documentation/driver-api/pwm.rst
  F:    drivers/gpio/gpio-mvebu.c
  F:    drivers/pwm/
  F:    drivers/video/backlight/pwm_bl.c
 +F:    include/dt-bindings/pwm/
  F:    include/linux/pwm.h
  F:    include/linux/pwm_backlight.h
  K:    pwm_(config|apply_state|ops)
@@@ -16580,9 -16394,6 +16590,9 @@@ M:   Srinivas Kandagatla <srinivas.kandag
  M:    Banajit Goswami <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Supported
 +F:    include/dt-bindings/sound/qcom,wcd9335.h
 +F:    sound/soc/codecs/lpass-rx-macro.*
 +F:    sound/soc/codecs/lpass-tx-macro.*
  F:    sound/soc/codecs/lpass-va-macro.c
  F:    sound/soc/codecs/lpass-wsa-macro.*
  F:    sound/soc/codecs/msm8916-wcd-analog.c
@@@ -16590,9 -16401,7 +16600,9 @@@ F:   sound/soc/codecs/msm8916-wcd-digital
  F:    sound/soc/codecs/wcd9335.*
  F:    sound/soc/codecs/wcd934x.c
  F:    sound/soc/codecs/wcd-clsh-v2.*
 +F:    sound/soc/codecs/wcd-mbhc-v2.*
  F:    sound/soc/codecs/wsa881x.c
 +F:    sound/soc/codecs/wsa883x.c
  F:    sound/soc/qcom/
  
  QCOM EMBEDDED USB DEBUGGER (EUD)
@@@ -16861,13 -16670,6 +16871,13 @@@ S: Maintaine
  F:    Documentation/devicetree/bindings/i2c/i2c-qcom-cci.txt
  F:    drivers/i2c/busses/i2c-qcom-cci.c
  
 +QUALCOMM INTERCONNECT BWMON DRIVER
 +M:    Krzysztof Kozlowski <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/interconnect/qcom,msm8998-bwmon.yaml
 +F:    drivers/soc/qcom/icc-bwmon.c
 +
  QUALCOMM IOMMU
  M:    Rob Clark <[email protected]>
  L:    [email protected]
@@@ -17383,19 -17185,6 +17393,19 @@@ S: Supporte
  F:    Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
  F:    drivers/iio/adc/rzg2l_adc.c
  
 +RENESAS RZ/N1 A5PSW SWITCH DRIVER
 +M:    Clément Léger <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
 +F:    Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml
 +F:    drivers/net/dsa/rzn1_a5psw*
 +F:    drivers/net/pcs/pcs-rzn1-miic.c
 +F:    include/dt-bindings/net/pcs-rzn1-miic.h
 +F:    include/linux/pcs-rzn1-miic.h
 +F:    net/dsa/tag_rzn1_a5psw.c
 +
  RENESAS RZ/N1 RTC CONTROLLER DRIVER
  M:    Miquel Raynal <[email protected]>
  L:    [email protected]
@@@ -17504,8 -17293,6 +17514,8 @@@ F:   drivers/clk/microchip/clk-mpfs.
  F:    drivers/mailbox/mailbox-mpfs.c
  F:    drivers/pci/controller/pcie-microchip-host.c
  F:    drivers/soc/microchip/
 +F:    drivers/spi/spi-microchip-core.c
 +F:    drivers/usb/musb/mpfs.c
  F:    include/soc/microchip/mpfs.h
  
  RNBD BLOCK DRIVERS
@@@ -17817,7 -17604,6 +17827,7 @@@ M:   Eric Farman <[email protected]
  L:    [email protected]
  L:    [email protected]
  S:    Supported
 +F:    arch/s390/kvm/pci*
  F:    drivers/vfio/pci/vfio_pci_zdev.c
  F:    include/uapi/linux/vfio_zdev.h
  
@@@ -18202,7 -17988,7 +18212,7 @@@ M:   Kees Cook <[email protected]
  R:    Andy Lutomirski <[email protected]>
  R:    Will Drewry <[email protected]>
  S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git seccomp
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/seccomp
  F:    Documentation/userspace-api/seccomp_filter.rst
  F:    include/linux/seccomp.h
  F:    include/uapi/linux/seccomp.h
@@@ -18273,13 -18059,12 +18283,13 @@@ S:        Supporte
  F:    Documentation/admin-guide/security-bugs.rst
  
  SECURITY SUBSYSTEM
 +M:    Paul Moore <[email protected]>
  M:    James Morris <[email protected]>
  M:    "Serge E. Hallyn" <[email protected]>
  L:    [email protected] (suggested Cc:)
  S:    Supported
  W:    http://kernsec.org/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
  F:    security/
  X:    security/selinux/
  
@@@ -18382,7 -18167,6 +18392,7 @@@ SFF/SFP/SFP+ MODULE SUPPOR
  M:    Russell King <[email protected]>
  L:    [email protected]
  S:    Maintained
 +F:    Documentation/devicetree/bindings/net/sff,sfp.yaml
  F:    drivers/net/phy/phylink.c
  F:    drivers/net/phy/sfp*
  F:    include/linux/mdio/mdio-i2c.h
@@@ -18669,12 -18453,6 +18679,12 @@@ T: git git://git.kernel.org/pub/scm/lin
  F:    include/linux/sl?b*.h
  F:    mm/sl?b*
  
 +SLCAN CAN NETWORK DRIVER
 +M:    Dario Binacchi <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/can/slcan/
 +
  SLEEPABLE READ-COPY UPDATE (SRCU)
  M:    Lai Jiangshan <[email protected]>
  M:    "Paul E. McKenney" <[email protected]>
@@@ -18846,7 -18624,6 +18856,7 @@@ SOFTWARE RAID (Multiple Disks) SUPPOR
  M:    Song Liu <[email protected]>
  L:    [email protected]
  S:    Supported
 +Q:    https://patchwork.kernel.org/project/linux-raid/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git
  F:    drivers/md/Kconfig
  F:    drivers/md/Makefile
@@@ -19136,7 -18913,7 +19146,7 @@@ F:   drivers/pinctrl/spear
  
  SPI NOR SUBSYSTEM
  M:    Tudor Ambarus <[email protected]>
 -M:    Pratyush Yadav <p[email protected]>
 +M:    Pratyush Yadav <p[email protected]>
  R:    Michael Walle <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -19296,7 -19073,6 +19306,7 @@@ F:   drivers/staging/olpc_dcon
  STAGING - REALTEK RTL8188EU DRIVERS
  M:    Larry Finger <[email protected]>
  M:    Phillip Potter <[email protected]>
 +R:    Pavel Skripkin <[email protected]>
  S:    Supported
  F:    drivers/staging/r8188eu/
  
@@@ -19689,7 -19465,7 +19699,7 @@@ S:   Maintaine
  F:    drivers/mmc/host/sdhci-pci-dwc-mshc.c
  
  SYSTEM CONFIGURATION (SYSCON)
 -M:    Lee Jones <lee.jones@linaro.org>
 +M:    Lee Jones <lee@kernel.org>
  M:    Arnd Bergmann <[email protected]>
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
@@@ -20007,7 -19783,7 +20017,7 @@@ M:   Sowjanya Komatineni <skomatineni@nvi
  L:    [email protected]
  L:    [email protected]
  S:    Maintained
 -F:    Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
 +F:    Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml
  F:    drivers/staging/media/tegra-video/
  
  TEGRA XUSB PADCTL DRIVER
@@@ -20130,7 -19906,6 +20140,7 @@@ F:   Documentation/ABI/testing/sysfs-clas
  F:    Documentation/devicetree/bindings/thermal/
  F:    Documentation/driver-api/thermal/
  F:    drivers/thermal/
 +F:    include/dt-bindings/thermal/
  F:    include/linux/cpu_cooling.h
  F:    include/linux/thermal.h
  F:    include/uapi/linux/thermal.h
@@@ -20605,7 -20380,7 +20615,7 @@@ F:   tools/tracing/rtla
  
  TRADITIONAL CHINESE DOCUMENTATION
  M:    Hu Haowen <[email protected]>
 -L:    [email protected]
 +L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  W:    https://github.com/srcres258/linux-doc
  T:    git git://github.com/srcres258/linux-doc.git doc-zh-tw
@@@ -20725,13 -20500,6 +20735,13 @@@ F: Documentation/filesystems/ubifs-auth
  F:    Documentation/filesystems/ubifs.rst
  F:    fs/ubifs/
  
 +UBLK USERSPACE BLOCK DRIVER
 +M:    Ming Lei <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/block/ublk_drv.c
 +F:    include/uapi/linux/ublk_cmd.h
 +
  UCLINUX (M68KNOMMU AND COLDFIRE)
  M:    Greg Ungerer <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/ufs/host/ufs-mediatek*
  
 +UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER RENESAS HOOKS
 +M:    Yoshihiro Shimoda <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/ufs/host/ufs-renesas.c
 +
  UNSORTED BLOCK IMAGES (UBI)
  M:    Richard Weinberger <[email protected]>
  L:    [email protected]
@@@ -21442,7 -21203,6 +21452,7 @@@ M:   Jason Wang <[email protected]
  L:    [email protected]
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-bus-vdpa
 +F:    Documentation/ABI/testing/sysfs-class-vduse
  F:    Documentation/devicetree/bindings/virtio/
  F:    drivers/block/virtio_blk.c
  F:    drivers/crypto/virtio/
@@@ -21623,10 -21383,12 +21633,10 @@@ M:        Martyn Welch <[email protected]
  M:    Manohar Vanga <[email protected]>
  M:    Greg Kroah-Hartman <[email protected]>
  L:    [email protected]
 -S:    Maintained
 +S:    Odd fixes
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
  F:    Documentation/driver-api/vme.rst
  F:    drivers/staging/vme_user/
 -F:    drivers/vme/
 -F:    include/linux/vme*
  
  VM SOCKETS (AF_VSOCK)
  M:    Stefano Garzarella <[email protected]>
  S:    Maintained
  F:    drivers/input/tablet/wacom_serial4.c
  
 +WANGXUN ETHERNET DRIVER
 +M:    Jiawen Wu <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/networking/device_drivers/ethernet/wangxun/txgbe.rst
 +F:    drivers/net/ethernet/wangxun/
 +
  WATCHDOG DEVICE DRIVERS
  M:    Wim Van Sebroeck <[email protected]>
  M:    Guenter Roeck <[email protected]>
@@@ -21859,13 -21614,13 +21869,13 @@@ S:        Maintaine
  F:    drivers/media/rc/winbond-cir.c
  
  WINSYSTEMS EBC-C384 WATCHDOG DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/watchdog/ebc-c384_wdt.c
  
  WINSYSTEMS WS16C48 GPIO DRIVER
 -M:    William Breathitt Gray <[email protected]>
 +M:    William Breathitt Gray <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-ws16c48.c
@@@ -22132,7 -21887,8 +22142,7 @@@ F:   include/uapi/linux/if_xdp.
  F:    include/uapi/linux/xdp_diag.h
  F:    include/net/netns/xdp.h
  F:    net/xdp/
 -F:    samples/bpf/xdpsock*
 -F:    tools/lib/bpf/xsk*
 +F:    tools/testing/selftests/bpf/*xsk*
  
  XEN BLOCK SUBSYSTEM
  M:    Roger Pau Monné <[email protected]>
@@@ -22372,7 -22128,7 +22382,7 @@@ F:   include/linux/yam.
  YAMA SECURITY MODULE
  M:    Kees Cook <[email protected]>
  S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
  F:    Documentation/admin-guide/LSM/Yama.rst
  F:    security/yama/
  
@@@ -22486,7 -22242,7 +22496,7 @@@ M:   Nitin Gupta <[email protected]
  R:    Sergey Senozhatsky <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    Documentation/vm/zsmalloc.rst
 +F:    Documentation/mm/zsmalloc.rst
  F:    include/linux/zsmalloc.h
  F:    mm/zsmalloc.c
  
diff --combined arch/x86/kvm/x86.c
index 33560bfa0cac6e9bcdd293dd82569259ceb5038e,1bd8f65dc3e8d91f981dcfe50f6308808564d461..79a8a74b6b2afd694d2e26fdbe6472f7800e11af
@@@ -41,7 -41,6 +41,6 @@@
  #include <linux/mman.h>
  #include <linux/highmem.h>
  #include <linux/iommu.h>
- #include <linux/intel-iommu.h>
  #include <linux/cpufreq.h>
  #include <linux/user-return-notifier.h>
  #include <linux/srcu.h>
  
  #define MAX_IO_MSRS 256
  #define KVM_MAX_MCE_BANKS 32
 -u64 __read_mostly kvm_mce_cap_supported = MCG_CTL_P | MCG_SER_P;
 -EXPORT_SYMBOL_GPL(kvm_mce_cap_supported);
 +
 +struct kvm_caps kvm_caps __read_mostly = {
 +      .supported_mce_cap = MCG_CTL_P | MCG_SER_P,
 +};
 +EXPORT_SYMBOL_GPL(kvm_caps);
  
  #define  ERR_PTR_USR(e)  ((void __user *)ERR_PTR(e))
  
@@@ -154,6 -150,19 +153,6 @@@ module_param(min_timer_period_us, uint
  static bool __read_mostly kvmclock_periodic_sync = true;
  module_param(kvmclock_periodic_sync, bool, S_IRUGO);
  
 -bool __read_mostly kvm_has_tsc_control;
 -EXPORT_SYMBOL_GPL(kvm_has_tsc_control);
 -u32  __read_mostly kvm_max_guest_tsc_khz;
 -EXPORT_SYMBOL_GPL(kvm_max_guest_tsc_khz);
 -u8   __read_mostly kvm_tsc_scaling_ratio_frac_bits;
 -EXPORT_SYMBOL_GPL(kvm_tsc_scaling_ratio_frac_bits);
 -u64  __read_mostly kvm_max_tsc_scaling_ratio;
 -EXPORT_SYMBOL_GPL(kvm_max_tsc_scaling_ratio);
 -u64 __read_mostly kvm_default_tsc_scaling_ratio;
 -EXPORT_SYMBOL_GPL(kvm_default_tsc_scaling_ratio);
 -bool __read_mostly kvm_has_bus_lock_exit;
 -EXPORT_SYMBOL_GPL(kvm_has_bus_lock_exit);
 -
  /* tsc tolerance in parts per million - default to 1/2 of the NTP threshold */
  static u32 __read_mostly tsc_tolerance_ppm = 250;
  module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR);
@@@ -225,6 -234,8 +224,6 @@@ EXPORT_SYMBOL_GPL(enable_apicv)
  
  u64 __read_mostly host_xss;
  EXPORT_SYMBOL_GPL(host_xss);
 -u64 __read_mostly supported_xss;
 -EXPORT_SYMBOL_GPL(supported_xss);
  
  const struct _kvm_stats_desc kvm_vm_stats_desc[] = {
        KVM_GENERIC_VM_STATS(),
@@@ -286,8 -297,7 +285,8 @@@ const struct _kvm_stats_desc kvm_vcpu_s
        STATS_DESC_COUNTER(VCPU, directed_yield_successful),
        STATS_DESC_COUNTER(VCPU, preemption_reported),
        STATS_DESC_COUNTER(VCPU, preemption_other),
 -      STATS_DESC_IBOOLEAN(VCPU, guest_mode)
 +      STATS_DESC_IBOOLEAN(VCPU, guest_mode),
 +      STATS_DESC_COUNTER(VCPU, notify_window_exits),
  };
  
  const struct kvm_stats_header kvm_vcpu_stats_header = {
  };
  
  u64 __read_mostly host_xcr0;
 -u64 __read_mostly supported_xcr0;
 -EXPORT_SYMBOL_GPL(supported_xcr0);
  
  static struct kmem_cache *x86_emulator_cache;
  
@@@ -849,7 -861,7 +848,7 @@@ int load_pdptrs(struct kvm_vcpu *vcpu, 
         */
        real_gpa = kvm_translate_gpa(vcpu, mmu, gfn_to_gpa(pdpt_gfn),
                                     PFERR_USER_MASK | PFERR_WRITE_MASK, NULL);
 -      if (real_gpa == UNMAPPED_GVA)
 +      if (real_gpa == INVALID_GPA)
                return 0;
  
        /* Note the offset, PDPTRs are 32 byte aligned when using PAE paging. */
@@@ -1081,7 -1093,7 +1080,7 @@@ int kvm_emulate_xsetbv(struct kvm_vcpu 
  }
  EXPORT_SYMBOL_GPL(kvm_emulate_xsetbv);
  
 -bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 +bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
  {
        if (cr4 & cr4_reserved_bits)
                return false;
        if (cr4 & vcpu->arch.cr4_guest_rsvd_bits)
                return false;
  
 -      return static_call(kvm_x86_is_valid_cr4)(vcpu, cr4);
 +      return true;
 +}
 +EXPORT_SYMBOL_GPL(__kvm_is_valid_cr4);
 +
 +static bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 +{
 +      return __kvm_is_valid_cr4(vcpu, cr4) &&
 +             static_call(kvm_x86_is_valid_cr4)(vcpu, cr4);
  }
 -EXPORT_SYMBOL_GPL(kvm_is_valid_cr4);
  
  void kvm_post_set_cr4(struct kvm_vcpu *vcpu, unsigned long old_cr4, unsigned long cr4)
  {
@@@ -1443,7 -1449,6 +1442,7 @@@ static const u32 msrs_to_save_all[] = 
        MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13,
        MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15,
        MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17,
 +      MSR_IA32_PEBS_ENABLE, MSR_IA32_DS_AREA, MSR_PEBS_DATA_CFG,
  
        MSR_K7_EVNTSEL0, MSR_K7_EVNTSEL1, MSR_K7_EVNTSEL2, MSR_K7_EVNTSEL3,
        MSR_K7_PERFCTR0, MSR_K7_PERFCTR1, MSR_K7_PERFCTR2, MSR_K7_PERFCTR3,
@@@ -2045,6 -2050,13 +2044,6 @@@ int kvm_emulate_invd(struct kvm_vcpu *v
  }
  EXPORT_SYMBOL_GPL(kvm_emulate_invd);
  
 -int kvm_emulate_mwait(struct kvm_vcpu *vcpu)
 -{
 -      pr_warn_once("kvm: MWAIT instruction emulated as NOP!\n");
 -      return kvm_emulate_as_nop(vcpu);
 -}
 -EXPORT_SYMBOL_GPL(kvm_emulate_mwait);
 -
  int kvm_handle_invalid_op(struct kvm_vcpu *vcpu)
  {
        kvm_queue_exception(vcpu, UD_VECTOR);
  }
  EXPORT_SYMBOL_GPL(kvm_handle_invalid_op);
  
 -int kvm_emulate_monitor(struct kvm_vcpu *vcpu)
 +
 +static int kvm_emulate_monitor_mwait(struct kvm_vcpu *vcpu, const char *insn)
  {
 -      pr_warn_once("kvm: MONITOR instruction emulated as NOP!\n");
 +      if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS) &&
 +          !guest_cpuid_has(vcpu, X86_FEATURE_MWAIT))
 +              return kvm_handle_invalid_op(vcpu);
 +
 +      pr_warn_once("kvm: %s instruction emulated as NOP!\n", insn);
        return kvm_emulate_as_nop(vcpu);
  }
 +int kvm_emulate_mwait(struct kvm_vcpu *vcpu)
 +{
 +      return kvm_emulate_monitor_mwait(vcpu, "MWAIT");
 +}
 +EXPORT_SYMBOL_GPL(kvm_emulate_mwait);
 +
 +int kvm_emulate_monitor(struct kvm_vcpu *vcpu)
 +{
 +      return kvm_emulate_monitor_mwait(vcpu, "MONITOR");
 +}
  EXPORT_SYMBOL_GPL(kvm_emulate_monitor);
  
  static inline bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu)
@@@ -2351,12 -2348,12 +2350,12 @@@ static int set_tsc_khz(struct kvm_vcpu 
  
        /* Guest TSC same frequency as host TSC? */
        if (!scale) {
 -              kvm_vcpu_write_tsc_multiplier(vcpu, kvm_default_tsc_scaling_ratio);
 +              kvm_vcpu_write_tsc_multiplier(vcpu, kvm_caps.default_tsc_scaling_ratio);
                return 0;
        }
  
        /* TSC scaling supported? */
 -      if (!kvm_has_tsc_control) {
 +      if (!kvm_caps.has_tsc_control) {
                if (user_tsc_khz > tsc_khz) {
                        vcpu->arch.tsc_catchup = 1;
                        vcpu->arch.tsc_always_catchup = 1;
        }
  
        /* TSC scaling required  - calculate ratio */
 -      ratio = mul_u64_u32_div(1ULL << kvm_tsc_scaling_ratio_frac_bits,
 +      ratio = mul_u64_u32_div(1ULL << kvm_caps.tsc_scaling_ratio_frac_bits,
                                user_tsc_khz, tsc_khz);
  
 -      if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) {
 +      if (ratio == 0 || ratio >= kvm_caps.max_tsc_scaling_ratio) {
                pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
                                    user_tsc_khz);
                return -1;
@@@ -2389,7 -2386,7 +2388,7 @@@ static int kvm_set_tsc_khz(struct kvm_v
        /* tsc_khz can be zero if TSC calibration fails */
        if (user_tsc_khz == 0) {
                /* set tsc_scaling_ratio to a safe value */
 -              kvm_vcpu_write_tsc_multiplier(vcpu, kvm_default_tsc_scaling_ratio);
 +              kvm_vcpu_write_tsc_multiplier(vcpu, kvm_caps.default_tsc_scaling_ratio);
                return -1;
        }
  
@@@ -2466,18 -2463,18 +2465,18 @@@ static void kvm_track_tsc_matching(stru
   * (frac) represent the fractional part, ie. ratio represents a fixed
   * point number (mult + frac * 2^(-N)).
   *
 - * N equals to kvm_tsc_scaling_ratio_frac_bits.
 + * N equals to kvm_caps.tsc_scaling_ratio_frac_bits.
   */
  static inline u64 __scale_tsc(u64 ratio, u64 tsc)
  {
 -      return mul_u64_u64_shr(tsc, ratio, kvm_tsc_scaling_ratio_frac_bits);
 +      return mul_u64_u64_shr(tsc, ratio, kvm_caps.tsc_scaling_ratio_frac_bits);
  }
  
  u64 kvm_scale_tsc(u64 tsc, u64 ratio)
  {
        u64 _tsc = tsc;
  
 -      if (ratio != kvm_default_tsc_scaling_ratio)
 +      if (ratio != kvm_caps.default_tsc_scaling_ratio)
                _tsc = __scale_tsc(ratio, tsc);
  
        return _tsc;
@@@ -2504,11 -2501,11 +2503,11 @@@ u64 kvm_calc_nested_tsc_offset(u64 l1_o
  {
        u64 nested_offset;
  
 -      if (l2_multiplier == kvm_default_tsc_scaling_ratio)
 +      if (l2_multiplier == kvm_caps.default_tsc_scaling_ratio)
                nested_offset = l1_offset;
        else
                nested_offset = mul_s64_u64_shr((s64) l1_offset, l2_multiplier,
 -                                              kvm_tsc_scaling_ratio_frac_bits);
 +                                              kvm_caps.tsc_scaling_ratio_frac_bits);
  
        nested_offset += l2_offset;
        return nested_offset;
@@@ -2517,9 -2514,9 +2516,9 @@@ EXPORT_SYMBOL_GPL(kvm_calc_nested_tsc_o
  
  u64 kvm_calc_nested_tsc_multiplier(u64 l1_multiplier, u64 l2_multiplier)
  {
 -      if (l2_multiplier != kvm_default_tsc_scaling_ratio)
 +      if (l2_multiplier != kvm_caps.default_tsc_scaling_ratio)
                return mul_u64_u64_shr(l1_multiplier, l2_multiplier,
 -                                     kvm_tsc_scaling_ratio_frac_bits);
 +                                     kvm_caps.tsc_scaling_ratio_frac_bits);
  
        return l1_multiplier;
  }
@@@ -2561,7 -2558,7 +2560,7 @@@ static void kvm_vcpu_write_tsc_multipli
        else
                vcpu->arch.tsc_scaling_ratio = l1_multiplier;
  
 -      if (kvm_has_tsc_control)
 +      if (kvm_caps.has_tsc_control)
                static_call(kvm_x86_write_tsc_multiplier)(
                        vcpu, vcpu->arch.tsc_scaling_ratio);
  }
@@@ -2697,7 -2694,7 +2696,7 @@@ static inline void adjust_tsc_offset_gu
  
  static inline void adjust_tsc_offset_host(struct kvm_vcpu *vcpu, s64 adjustment)
  {
 -      if (vcpu->arch.l1_tsc_scaling_ratio != kvm_default_tsc_scaling_ratio)
 +      if (vcpu->arch.l1_tsc_scaling_ratio != kvm_caps.default_tsc_scaling_ratio)
                WARN_ON(adjustment < 0);
        adjustment = kvm_scale_tsc((u64) adjustment,
                                   vcpu->arch.l1_tsc_scaling_ratio);
@@@ -3110,7 -3107,7 +3109,7 @@@ static int kvm_guest_time_update(struc
  
        /* With all the info we got, fill in the values */
  
 -      if (kvm_has_tsc_control)
 +      if (kvm_caps.has_tsc_control)
                tgt_tsc_khz = kvm_scale_tsc(tgt_tsc_khz,
                                            v->arch.l1_tsc_scaling_ratio);
  
@@@ -3200,16 -3197,6 +3199,16 @@@ static void kvmclock_sync_fn(struct wor
                                        KVMCLOCK_SYNC_PERIOD);
  }
  
 +/* These helpers are safe iff @msr is known to be an MCx bank MSR. */
 +static bool is_mci_control_msr(u32 msr)
 +{
 +      return (msr & 3) == 0;
 +}
 +static bool is_mci_status_msr(u32 msr)
 +{
 +      return (msr & 3) == 1;
 +}
 +
  /*
   * On AMD, HWCR[McStatusWrEn] controls whether setting MCi_STATUS results in #GP.
   */
@@@ -3228,7 -3215,6 +3227,7 @@@ static int set_msr_mce(struct kvm_vcpu 
        unsigned bank_num = mcg_cap & 0xff;
        u32 msr = msr_info->index;
        u64 data = msr_info->data;
 +      u32 offset, last_msr;
  
        switch (msr) {
        case MSR_IA32_MCG_STATUS:
                        return 1;
                vcpu->arch.mcg_ctl = data;
                break;
 -      default:
 -              if (msr >= MSR_IA32_MC0_CTL &&
 -                  msr < MSR_IA32_MCx_CTL(bank_num)) {
 -                      u32 offset = array_index_nospec(
 -                              msr - MSR_IA32_MC0_CTL,
 -                              MSR_IA32_MCx_CTL(bank_num) - MSR_IA32_MC0_CTL);
 -
 -                      /* only 0 or all 1s can be written to IA32_MCi_CTL
 -                       * some Linux kernels though clear bit 10 in bank 4 to
 -                       * workaround a BIOS/GART TBL issue on AMD K8s, ignore
 -                       * this to avoid an uncatched #GP in the guest
 -                       */
 -                      if ((offset & 0x3) == 0 &&
 -                          data != 0 && (data | (1 << 10)) != ~(u64)0)
 -                              return -1;
 -
 -                      /* MCi_STATUS */
 -                      if (!msr_info->host_initiated &&
 -                          (offset & 0x3) == 1 && data != 0) {
 -                              if (!can_set_mci_status(vcpu))
 -                                      return -1;
 -                      }
 +      case MSR_IA32_MC0_CTL2 ... MSR_IA32_MCx_CTL2(KVM_MAX_MCE_BANKS) - 1:
 +              last_msr = MSR_IA32_MCx_CTL2(bank_num) - 1;
 +              if (msr > last_msr)
 +                      return 1;
  
 -                      vcpu->arch.mce_banks[offset] = data;
 -                      break;
 -              }
 +              if (!(mcg_cap & MCG_CMCI_P) && (data || !msr_info->host_initiated))
 +                      return 1;
 +              /* An attempt to write a 1 to a reserved bit raises #GP */
 +              if (data & ~(MCI_CTL2_CMCI_EN | MCI_CTL2_CMCI_THRESHOLD_MASK))
 +                      return 1;
 +              offset = array_index_nospec(msr - MSR_IA32_MC0_CTL2,
 +                                          last_msr + 1 - MSR_IA32_MC0_CTL2);
 +              vcpu->arch.mci_ctl2_banks[offset] = data;
 +              break;
 +      case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
 +              last_msr = MSR_IA32_MCx_CTL(bank_num) - 1;
 +              if (msr > last_msr)
 +                      return 1;
 +
 +              /*
 +               * Only 0 or all 1s can be written to IA32_MCi_CTL, all other
 +               * values are architecturally undefined.  But, some Linux
 +               * kernels clear bit 10 in bank 4 to workaround a BIOS/GART TLB
 +               * issue on AMD K8s, allow bit 10 to be clear when setting all
 +               * other bits in order to avoid an uncaught #GP in the guest.
 +               *
 +               * UNIXWARE clears bit 0 of MC1_CTL to ignore correctable,
 +               * single-bit ECC data errors.
 +               */
 +              if (is_mci_control_msr(msr) &&
 +                  data != 0 && (data | (1 << 10) | 1) != ~(u64)0)
 +                      return 1;
 +
 +              /*
 +               * All CPUs allow writing 0 to MCi_STATUS MSRs to clear the MSR.
 +               * AMD-based CPUs allow non-zero values, but if and only if
 +               * HWCR[McStatusWrEn] is set.
 +               */
 +              if (!msr_info->host_initiated && is_mci_status_msr(msr) &&
 +                  data != 0 && !can_set_mci_status(vcpu))
 +                      return 1;
 +
 +              offset = array_index_nospec(msr - MSR_IA32_MC0_CTL,
 +                                          last_msr + 1 - MSR_IA32_MC0_CTL);
 +              vcpu->arch.mce_banks[offset] = data;
 +              break;
 +      default:
                return 1;
        }
        return 0;
@@@ -3572,8 -3537,7 +3571,8 @@@ int kvm_set_msr_common(struct kvm_vcpu 
                        return 1;
                }
                break;
 -      case 0x200 ... 0x2ff:
 +      case 0x200 ... MSR_IA32_MC0_CTL2 - 1:
 +      case MSR_IA32_MCx_CTL2(KVM_MAX_MCE_BANKS) ... 0x2ff:
                return kvm_mtrr_set_msr(vcpu, msr, data);
        case MSR_IA32_APICBASE:
                return kvm_set_apic_base(vcpu, msr_info);
                        vcpu->arch.ia32_tsc_adjust_msr = data;
                }
                break;
 -      case MSR_IA32_MISC_ENABLE:
 +      case MSR_IA32_MISC_ENABLE: {
 +              u64 old_val = vcpu->arch.ia32_misc_enable_msr;
 +
 +              if (!msr_info->host_initiated) {
 +                      /* RO bits */
 +                      if ((old_val ^ data) & MSR_IA32_MISC_ENABLE_PMU_RO_MASK)
 +                              return 1;
 +
 +                      /* R bits, i.e. writes are ignored, but don't fault. */
 +                      data = data & ~MSR_IA32_MISC_ENABLE_EMON;
 +                      data |= old_val & MSR_IA32_MISC_ENABLE_EMON;
 +              }
 +
                if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT) &&
 -                  ((vcpu->arch.ia32_misc_enable_msr ^ data) & MSR_IA32_MISC_ENABLE_MWAIT)) {
 +                  ((old_val ^ data)  & MSR_IA32_MISC_ENABLE_MWAIT)) {
                        if (!guest_cpuid_has(vcpu, X86_FEATURE_XMM3))
                                return 1;
                        vcpu->arch.ia32_misc_enable_msr = data;
                        vcpu->arch.ia32_misc_enable_msr = data;
                }
                break;
 +      }
        case MSR_IA32_SMBASE:
                if (!msr_info->host_initiated)
                        return 1;
                 * IA32_XSS[bit 8]. Guests have to use RDMSR/WRMSR rather than
                 * XSAVES/XRSTORS to save/restore PT MSRs.
                 */
 -              if (data & ~supported_xss)
 +              if (data & ~kvm_caps.supported_xss)
                        return 1;
                vcpu->arch.ia32_xss = data;
                kvm_update_cpuid_runtime(vcpu);
        case MSR_IA32_MCG_CTL:
        case MSR_IA32_MCG_STATUS:
        case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
 +      case MSR_IA32_MC0_CTL2 ... MSR_IA32_MCx_CTL2(KVM_MAX_MCE_BANKS) - 1:
                return set_msr_mce(vcpu, msr_info);
  
        case MSR_K7_PERFCTR0 ... MSR_K7_PERFCTR3:
                vcpu->arch.guest_fpu.xfd_err = data;
                break;
  #endif
 +      case MSR_IA32_PEBS_ENABLE:
 +      case MSR_IA32_DS_AREA:
 +      case MSR_PEBS_DATA_CFG:
 +      case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5:
 +              if (kvm_pmu_is_valid_msr(vcpu, msr))
 +                      return kvm_pmu_set_msr(vcpu, msr_info);
 +              /*
 +               * Userspace is allowed to write '0' to MSRs that KVM reports
 +               * as to-be-saved, even if an MSRs isn't fully supported.
 +               */
 +              return !msr_info->host_initiated || data;
        default:
                if (kvm_pmu_is_valid_msr(vcpu, msr))
                        return kvm_pmu_set_msr(vcpu, msr_info);
@@@ -3859,7 -3798,6 +3858,7 @@@ static int get_msr_mce(struct kvm_vcpu 
        u64 data;
        u64 mcg_cap = vcpu->arch.mcg_cap;
        unsigned bank_num = mcg_cap & 0xff;
 +      u32 offset, last_msr;
  
        switch (msr) {
        case MSR_IA32_P5_MC_ADDR:
        case MSR_IA32_MCG_STATUS:
                data = vcpu->arch.mcg_status;
                break;
 -      default:
 -              if (msr >= MSR_IA32_MC0_CTL &&
 -                  msr < MSR_IA32_MCx_CTL(bank_num)) {
 -                      u32 offset = array_index_nospec(
 -                              msr - MSR_IA32_MC0_CTL,
 -                              MSR_IA32_MCx_CTL(bank_num) - MSR_IA32_MC0_CTL);
 +      case MSR_IA32_MC0_CTL2 ... MSR_IA32_MCx_CTL2(KVM_MAX_MCE_BANKS) - 1:
 +              last_msr = MSR_IA32_MCx_CTL2(bank_num) - 1;
 +              if (msr > last_msr)
 +                      return 1;
  
 -                      data = vcpu->arch.mce_banks[offset];
 -                      break;
 -              }
 +              if (!(mcg_cap & MCG_CMCI_P) && !host)
 +                      return 1;
 +              offset = array_index_nospec(msr - MSR_IA32_MC0_CTL2,
 +                                          last_msr + 1 - MSR_IA32_MC0_CTL2);
 +              data = vcpu->arch.mci_ctl2_banks[offset];
 +              break;
 +      case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
 +              last_msr = MSR_IA32_MCx_CTL(bank_num) - 1;
 +              if (msr > last_msr)
 +                      return 1;
 +
 +              offset = array_index_nospec(msr - MSR_IA32_MC0_CTL,
 +                                          last_msr + 1 - MSR_IA32_MC0_CTL);
 +              data = vcpu->arch.mce_banks[offset];
 +              break;
 +      default:
                return 1;
        }
        *pdata = data;
@@@ -3937,16 -3864,9 +3936,16 @@@ int kvm_get_msr_common(struct kvm_vcpu 
        case MSR_DRAM_ENERGY_STATUS:    /* DRAM controller */
                msr_info->data = 0;
                break;
 +      case MSR_IA32_PEBS_ENABLE:
 +      case MSR_IA32_DS_AREA:
 +      case MSR_PEBS_DATA_CFG:
        case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5:
                if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
                        return kvm_pmu_get_msr(vcpu, msr_info);
 +              /*
 +               * Userspace is allowed to read MSRs that KVM reports as
 +               * to-be-saved, even if an MSR isn't fully supported.
 +               */
                if (!msr_info->host_initiated)
                        return 1;
                msr_info->data = 0;
                break;
        }
        case MSR_MTRRcap:
 -      case 0x200 ... 0x2ff:
 +      case 0x200 ... MSR_IA32_MC0_CTL2 - 1:
 +      case MSR_IA32_MCx_CTL2(KVM_MAX_MCE_BANKS) ... 0x2ff:
                return kvm_mtrr_get_msr(vcpu, msr_info->index, &msr_info->data);
        case 0xcd: /* fsb frequency */
                msr_info->data = 3;
        case MSR_IA32_MCG_CTL:
        case MSR_IA32_MCG_STATUS:
        case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
 +      case MSR_IA32_MC0_CTL2 ... MSR_IA32_MCx_CTL2(KVM_MAX_MCE_BANKS) - 1:
                return get_msr_mce(vcpu, msr_info->index, &msr_info->data,
                                   msr_info->host_initiated);
        case MSR_IA32_XSS:
@@@ -4361,7 -4279,6 +4360,7 @@@ int kvm_vm_ioctl_check_extension(struc
        case KVM_CAP_GET_MSR_FEATURES:
        case KVM_CAP_MSR_PLATFORM_INFO:
        case KVM_CAP_EXCEPTION_PAYLOAD:
 +      case KVM_CAP_X86_TRIPLE_FAULT_EVENT:
        case KVM_CAP_SET_GUEST_DEBUG:
        case KVM_CAP_LAST_CPU:
        case KVM_CAP_X86_USER_SPACE_MSR:
        case KVM_CAP_SYS_ATTRIBUTES:
        case KVM_CAP_VAPIC:
        case KVM_CAP_ENABLE_CAP:
 +      case KVM_CAP_VM_DISABLE_NX_HUGE_PAGES:
                r = 1;
                break;
        case KVM_CAP_EXIT_HYPERCALL:
                break;
        case KVM_CAP_TSC_CONTROL:
        case KVM_CAP_VM_TSC_CONTROL:
 -              r = kvm_has_tsc_control;
 +              r = kvm_caps.has_tsc_control;
                break;
        case KVM_CAP_X2APIC_API:
                r = KVM_X2APIC_API_VALID_FLAGS;
                r = sched_info_on();
                break;
        case KVM_CAP_X86_BUS_LOCK_EXIT:
 -              if (kvm_has_bus_lock_exit)
 +              if (kvm_caps.has_bus_lock_exit)
                        r = KVM_BUS_LOCK_DETECTION_OFF |
                            KVM_BUS_LOCK_DETECTION_EXIT;
                else
        case KVM_CAP_XSAVE2: {
                u64 guest_perm = xstate_get_guest_group_perm();
  
 -              r = xstate_required_size(supported_xcr0 & guest_perm, false);
 +              r = xstate_required_size(kvm_caps.supported_xcr0 & guest_perm, false);
                if (r < sizeof(struct kvm_xsave))
                        r = sizeof(struct kvm_xsave);
                break;
 +      }
        case KVM_CAP_PMU_CAPABILITY:
                r = enable_pmu ? KVM_CAP_PMU_VALID_MASK : 0;
                break;
 -      }
        case KVM_CAP_DISABLE_QUIRKS2:
                r = KVM_X86_VALID_QUIRKS;
                break;
 +      case KVM_CAP_X86_NOTIFY_VMEXIT:
 +              r = kvm_caps.has_notify_vmexit;
 +              break;
        default:
                break;
        }
@@@ -4512,7 -4425,7 +4511,7 @@@ static int kvm_x86_dev_get_attr(struct 
  
        switch (attr->attr) {
        case KVM_X86_XCOMP_GUEST_SUPP:
 -              if (put_user(supported_xcr0, uaddr))
 +              if (put_user(kvm_caps.supported_xcr0, uaddr))
                        return -EFAULT;
                return 0;
        default:
@@@ -4589,8 -4502,8 +4588,8 @@@ long kvm_arch_dev_ioctl(struct file *fi
        }
        case KVM_X86_GET_MCE_CAP_SUPPORTED:
                r = -EFAULT;
 -              if (copy_to_user(argp, &kvm_mce_cap_supported,
 -                               sizeof(kvm_mce_cap_supported)))
 +              if (copy_to_user(argp, &kvm_caps.supported_mce_cap,
 +                               sizeof(kvm_caps.supported_mce_cap)))
                        goto out;
                r = 0;
                break;
@@@ -4889,63 -4802,22 +4888,63 @@@ static int kvm_vcpu_ioctl_x86_setup_mce
        r = -EINVAL;
        if (!bank_num || bank_num > KVM_MAX_MCE_BANKS)
                goto out;
 -      if (mcg_cap & ~(kvm_mce_cap_supported | 0xff | 0xff0000))
 +      if (mcg_cap & ~(kvm_caps.supported_mce_cap | 0xff | 0xff0000))
                goto out;
        r = 0;
        vcpu->arch.mcg_cap = mcg_cap;
        /* Init IA32_MCG_CTL to all 1s */
        if (mcg_cap & MCG_CTL_P)
                vcpu->arch.mcg_ctl = ~(u64)0;
 -      /* Init IA32_MCi_CTL to all 1s */
 -      for (bank = 0; bank < bank_num; bank++)
 +      /* Init IA32_MCi_CTL to all 1s, IA32_MCi_CTL2 to all 0s */
 +      for (bank = 0; bank < bank_num; bank++) {
                vcpu->arch.mce_banks[bank*4] = ~(u64)0;
 +              if (mcg_cap & MCG_CMCI_P)
 +                      vcpu->arch.mci_ctl2_banks[bank] = 0;
 +      }
 +
 +      kvm_apic_after_set_mcg_cap(vcpu);
  
        static_call(kvm_x86_setup_mce)(vcpu);
  out:
        return r;
  }
  
 +/*
 + * Validate this is an UCNA (uncorrectable no action) error by checking the
 + * MCG_STATUS and MCi_STATUS registers:
 + * - none of the bits for Machine Check Exceptions are set
 + * - both the VAL (valid) and UC (uncorrectable) bits are set
 + * MCI_STATUS_PCC - Processor Context Corrupted
 + * MCI_STATUS_S - Signaled as a Machine Check Exception
 + * MCI_STATUS_AR - Software recoverable Action Required
 + */
 +static bool is_ucna(struct kvm_x86_mce *mce)
 +{
 +      return  !mce->mcg_status &&
 +              !(mce->status & (MCI_STATUS_PCC | MCI_STATUS_S | MCI_STATUS_AR)) &&
 +              (mce->status & MCI_STATUS_VAL) &&
 +              (mce->status & MCI_STATUS_UC);
 +}
 +
 +static int kvm_vcpu_x86_set_ucna(struct kvm_vcpu *vcpu, struct kvm_x86_mce *mce, u64* banks)
 +{
 +      u64 mcg_cap = vcpu->arch.mcg_cap;
 +
 +      banks[1] = mce->status;
 +      banks[2] = mce->addr;
 +      banks[3] = mce->misc;
 +      vcpu->arch.mcg_status = mce->mcg_status;
 +
 +      if (!(mcg_cap & MCG_CMCI_P) ||
 +          !(vcpu->arch.mci_ctl2_banks[mce->bank] & MCI_CTL2_CMCI_EN))
 +              return 0;
 +
 +      if (lapic_in_kernel(vcpu))
 +              kvm_apic_local_deliver(vcpu->arch.apic, APIC_LVTCMCI);
 +
 +      return 0;
 +}
 +
  static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
                                      struct kvm_x86_mce *mce)
  {
  
        if (mce->bank >= bank_num || !(mce->status & MCI_STATUS_VAL))
                return -EINVAL;
 +
 +      banks += array_index_nospec(4 * mce->bank, 4 * bank_num);
 +
 +      if (is_ucna(mce))
 +              return kvm_vcpu_x86_set_ucna(vcpu, mce, banks);
 +
        /*
         * if IA32_MCG_CTL is not all 1s, the uncorrected error
         * reporting is disabled
        if ((mce->status & MCI_STATUS_UC) && (mcg_cap & MCG_CTL_P) &&
            vcpu->arch.mcg_ctl != ~(u64)0)
                return 0;
 -      banks += 4 * mce->bank;
        /*
         * if IA32_MCi_CTL is not all 1s, the uncorrected error
         * reporting is disabled for the bank
@@@ -5073,10 -4940,6 +5072,10 @@@ static void kvm_vcpu_ioctl_x86_get_vcpu
                         | KVM_VCPUEVENT_VALID_SMM);
        if (vcpu->kvm->arch.exception_payload_enabled)
                events->flags |= KVM_VCPUEVENT_VALID_PAYLOAD;
 +      if (vcpu->kvm->arch.triple_fault_event) {
 +              events->triple_fault.pending = kvm_test_request(KVM_REQ_TRIPLE_FAULT, vcpu);
 +              events->flags |= KVM_VCPUEVENT_VALID_TRIPLE_FAULT;
 +      }
  
        memset(&events->reserved, 0, sizeof(events->reserved));
  }
@@@ -5090,8 -4953,7 +5089,8 @@@ static int kvm_vcpu_ioctl_x86_set_vcpu_
                              | KVM_VCPUEVENT_VALID_SIPI_VECTOR
                              | KVM_VCPUEVENT_VALID_SHADOW
                              | KVM_VCPUEVENT_VALID_SMM
 -                            | KVM_VCPUEVENT_VALID_PAYLOAD))
 +                            | KVM_VCPUEVENT_VALID_PAYLOAD
 +                            | KVM_VCPUEVENT_VALID_TRIPLE_FAULT))
                return -EINVAL;
  
        if (events->flags & KVM_VCPUEVENT_VALID_PAYLOAD) {
                }
        }
  
 +      if (events->flags & KVM_VCPUEVENT_VALID_TRIPLE_FAULT) {
 +              if (!vcpu->kvm->arch.triple_fault_event)
 +                      return -EINVAL;
 +              if (events->triple_fault.pending)
 +                      kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
 +              else
 +                      kvm_clear_request(KVM_REQ_TRIPLE_FAULT, vcpu);
 +      }
 +
        kvm_make_request(KVM_REQ_EVENT, vcpu);
  
        return 0;
@@@ -5241,8 -5094,7 +5240,8 @@@ static int kvm_vcpu_ioctl_x86_set_xsave
  
        return fpu_copy_uabi_to_guest_fpstate(&vcpu->arch.guest_fpu,
                                              guest_xsave->region,
 -                                            supported_xcr0, &vcpu->arch.pkru);
 +                                            kvm_caps.supported_xcr0,
 +                                            &vcpu->arch.pkru);
  }
  
  static void kvm_vcpu_ioctl_x86_get_xcrs(struct kvm_vcpu *vcpu,
@@@ -5747,8 -5599,8 +5746,8 @@@ long kvm_arch_vcpu_ioctl(struct file *f
                r = -EINVAL;
                user_tsc_khz = (u32)arg;
  
 -              if (kvm_has_tsc_control &&
 -                  user_tsc_khz >= kvm_max_guest_tsc_khz)
 +              if (kvm_caps.has_tsc_control &&
 +                  user_tsc_khz >= kvm_caps.max_guest_tsc_khz)
                        goto out;
  
                if (user_tsc_khz == 0)
@@@ -6175,10 -6027,6 +6174,10 @@@ split_irqchip_unlock
                kvm->arch.exception_payload_enabled = cap->args[0];
                r = 0;
                break;
 +      case KVM_CAP_X86_TRIPLE_FAULT_EVENT:
 +              kvm->arch.triple_fault_event = cap->args[0];
 +              r = 0;
 +              break;
        case KVM_CAP_X86_USER_SPACE_MSR:
                r = -EINVAL;
                if (cap->args[0] & ~(KVM_MSR_EXIT_REASON_INVAL |
                    (cap->args[0] & KVM_BUS_LOCK_DETECTION_EXIT))
                        break;
  
 -              if (kvm_has_bus_lock_exit &&
 +              if (kvm_caps.has_bus_lock_exit &&
                    cap->args[0] & KVM_BUS_LOCK_DETECTION_EXIT)
                        kvm->arch.bus_lock_detection_enabled = true;
                r = 0;
                }
                mutex_unlock(&kvm->lock);
                break;
 +      case KVM_CAP_MAX_VCPU_ID:
 +              r = -EINVAL;
 +              if (cap->args[0] > KVM_MAX_VCPU_IDS)
 +                      break;
 +
 +              mutex_lock(&kvm->lock);
 +              if (kvm->arch.max_vcpu_ids == cap->args[0]) {
 +                      r = 0;
 +              } else if (!kvm->arch.max_vcpu_ids) {
 +                      kvm->arch.max_vcpu_ids = cap->args[0];
 +                      r = 0;
 +              }
 +              mutex_unlock(&kvm->lock);
 +              break;
 +      case KVM_CAP_X86_NOTIFY_VMEXIT:
 +              r = -EINVAL;
 +              if ((u32)cap->args[0] & ~KVM_X86_NOTIFY_VMEXIT_VALID_BITS)
 +                      break;
 +              if (!kvm_caps.has_notify_vmexit)
 +                      break;
 +              if (!((u32)cap->args[0] & KVM_X86_NOTIFY_VMEXIT_ENABLED))
 +                      break;
 +              mutex_lock(&kvm->lock);
 +              if (!kvm->created_vcpus) {
 +                      kvm->arch.notify_window = cap->args[0] >> 32;
 +                      kvm->arch.notify_vmexit_flags = (u32)cap->args[0];
 +                      r = 0;
 +              }
 +              mutex_unlock(&kvm->lock);
 +              break;
 +      case KVM_CAP_VM_DISABLE_NX_HUGE_PAGES:
 +              r = -EINVAL;
 +
 +              /*
 +               * Since the risk of disabling NX hugepages is a guest crashing
 +               * the system, ensure the userspace process has permission to
 +               * reboot the system.
 +               *
 +               * Note that unlike the reboot() syscall, the process must have
 +               * this capability in the root namespace because exposing
 +               * /dev/kvm into a container does not limit the scope of the
 +               * iTLB multihit bug to that container. In other words,
 +               * this must use capable(), not ns_capable().
 +               */
 +              if (!capable(CAP_SYS_BOOT)) {
 +                      r = -EPERM;
 +                      break;
 +              }
 +
 +              if (cap->args[0])
 +                      break;
 +
 +              mutex_lock(&kvm->lock);
 +              if (!kvm->created_vcpus) {
 +                      kvm->arch.disable_nx_huge_pages = true;
 +                      r = 0;
 +              }
 +              mutex_unlock(&kvm->lock);
 +              break;
        default:
                r = -EINVAL;
                break;
@@@ -6794,8 -6583,8 +6793,8 @@@ set_pit2_out
                r = -EINVAL;
                user_tsc_khz = (u32)arg;
  
 -              if (kvm_has_tsc_control &&
 -                  user_tsc_khz >= kvm_max_guest_tsc_khz)
 +              if (kvm_caps.has_tsc_control &&
 +                  user_tsc_khz >= kvm_caps.max_guest_tsc_khz)
                        goto out;
  
                if (user_tsc_khz == 0)
  
  static void kvm_init_msr_list(void)
  {
 -      struct x86_pmu_capability x86_pmu;
        u32 dummy[2];
        unsigned i;
  
        BUILD_BUG_ON_MSG(KVM_PMC_MAX_FIXED != 3,
                         "Please update the fixed PMCs in msrs_to_saved_all[]");
  
 -      perf_get_x86_pmu_capability(&x86_pmu);
 -
        num_msrs_to_save = 0;
        num_emulated_msrs = 0;
        num_msr_based_features = 0;
                        break;
                case MSR_ARCH_PERFMON_PERFCTR0 ... MSR_ARCH_PERFMON_PERFCTR0 + 17:
                        if (msrs_to_save_all[i] - MSR_ARCH_PERFMON_PERFCTR0 >=
 -                          min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp))
 +                          min(INTEL_PMC_MAX_GENERIC, kvm_pmu_cap.num_counters_gp))
                                continue;
                        break;
                case MSR_ARCH_PERFMON_EVENTSEL0 ... MSR_ARCH_PERFMON_EVENTSEL0 + 17:
                        if (msrs_to_save_all[i] - MSR_ARCH_PERFMON_EVENTSEL0 >=
 -                          min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp))
 +                          min(INTEL_PMC_MAX_GENERIC, kvm_pmu_cap.num_counters_gp))
                                continue;
                        break;
                case MSR_IA32_XFD:
@@@ -7089,7 -6881,7 +7088,7 @@@ static int kvm_read_guest_virt_helper(g
                unsigned toread = min(bytes, (unsigned)PAGE_SIZE - offset);
                int ret;
  
 -              if (gpa == UNMAPPED_GVA)
 +              if (gpa == INVALID_GPA)
                        return X86EMUL_PROPAGATE_FAULT;
                ret = kvm_vcpu_read_guest_page(vcpu, gpa >> PAGE_SHIFT, data,
                                               offset, toread);
@@@ -7120,7 -6912,7 +7119,7 @@@ static int kvm_fetch_guest_virt(struct 
        /* Inline kvm_read_guest_virt_helper for speed.  */
        gpa_t gpa = mmu->gva_to_gpa(vcpu, mmu, addr, access|PFERR_FETCH_MASK,
                                    exception);
 -      if (unlikely(gpa == UNMAPPED_GVA))
 +      if (unlikely(gpa == INVALID_GPA))
                return X86EMUL_PROPAGATE_FAULT;
  
        offset = addr & (PAGE_SIZE-1);
@@@ -7190,7 -6982,7 +7189,7 @@@ static int kvm_write_guest_virt_helper(
                unsigned towrite = min(bytes, (unsigned)PAGE_SIZE - offset);
                int ret;
  
 -              if (gpa == UNMAPPED_GVA)
 +              if (gpa == INVALID_GPA)
                        return X86EMUL_PROPAGATE_FAULT;
                ret = kvm_vcpu_write_guest(vcpu, gpa, data, towrite);
                if (ret < 0) {
@@@ -7301,7 -7093,7 +7300,7 @@@ static int vcpu_mmio_gva_to_gpa(struct 
  
        *gpa = mmu->gva_to_gpa(vcpu, mmu, gva, access, exception);
  
 -      if (*gpa == UNMAPPED_GVA)
 +      if (*gpa == INVALID_GPA)
                return -1;
  
        return vcpu_is_mmio_gpa(vcpu, gva, *gpa, write);
@@@ -7538,7 -7330,7 +7537,7 @@@ static int emulator_cmpxchg_emulated(st
  
        gpa = kvm_mmu_gva_to_gpa_write(vcpu, addr, NULL);
  
 -      if (gpa == UNMAPPED_GVA ||
 +      if (gpa == INVALID_GPA ||
            (gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE)
                goto emul_write;
  
@@@ -7592,47 -7384,36 +7591,47 @@@ emul_write
        return emulator_write_emulated(ctxt, addr, new, bytes, exception);
  }
  
 -static int kernel_pio(struct kvm_vcpu *vcpu, void *pd)
 +static int emulator_pio_in_out(struct kvm_vcpu *vcpu, int size,
 +                             unsigned short port, void *data,
 +                             unsigned int count, bool in)
  {
 -      int r = 0, i;
 +      unsigned i;
 +      int r;
  
 -      for (i = 0; i < vcpu->arch.pio.count; i++) {
 -              if (vcpu->arch.pio.in)
 -                      r = kvm_io_bus_read(vcpu, KVM_PIO_BUS, vcpu->arch.pio.port,
 -                                          vcpu->arch.pio.size, pd);
 +      WARN_ON_ONCE(vcpu->arch.pio.count);
 +      for (i = 0; i < count; i++) {
 +              if (in)
 +                      r = kvm_io_bus_read(vcpu, KVM_PIO_BUS, port, size, data);
                else
 -                      r = kvm_io_bus_write(vcpu, KVM_PIO_BUS,
 -                                           vcpu->arch.pio.port, vcpu->arch.pio.size,
 -                                           pd);
 -              if (r)
 +                      r = kvm_io_bus_write(vcpu, KVM_PIO_BUS, port, size, data);
 +
 +              if (r) {
 +                      if (i == 0)
 +                              goto userspace_io;
 +
 +                      /*
 +                       * Userspace must have unregistered the device while PIO
 +                       * was running.  Drop writes / read as 0.
 +                       */
 +                      if (in)
 +                              memset(data, 0, size * (count - i));
                        break;
 -              pd += vcpu->arch.pio.size;
 +              }
 +
 +              data += size;
        }
 -      return r;
 -}
 +      return 1;
  
 -static int emulator_pio_in_out(struct kvm_vcpu *vcpu, int size,
 -                             unsigned short port,
 -                             unsigned int count, bool in)
 -{
 +userspace_io:
        vcpu->arch.pio.port = port;
        vcpu->arch.pio.in = in;
 -      vcpu->arch.pio.count  = count;
 +      vcpu->arch.pio.count = count;
        vcpu->arch.pio.size = size;
  
 -      if (!kernel_pio(vcpu, vcpu->arch.pio_data))
 -              return 1;
 +      if (in)
 +              memset(vcpu->arch.pio_data, 0, size * count);
 +      else
 +              memcpy(vcpu->arch.pio_data, data, size * count);
  
        vcpu->run->exit_reason = KVM_EXIT_IO;
        vcpu->run->io.direction = in ? KVM_EXIT_IO_IN : KVM_EXIT_IO_OUT;
        vcpu->run->io.data_offset = KVM_PIO_PAGE_OFFSET * PAGE_SIZE;
        vcpu->run->io.count = count;
        vcpu->run->io.port = port;
 -
        return 0;
  }
  
 -static int __emulator_pio_in(struct kvm_vcpu *vcpu, int size,
 -                           unsigned short port, unsigned int count)
 +static int emulator_pio_in(struct kvm_vcpu *vcpu, int size,
 +                                 unsigned short port, void *val, unsigned int count)
  {
 -      WARN_ON(vcpu->arch.pio.count);
 -      memset(vcpu->arch.pio_data, 0, size * count);
 -      return emulator_pio_in_out(vcpu, size, port, count, true);
 +      int r = emulator_pio_in_out(vcpu, size, port, val, count, true);
 +      if (r)
 +              trace_kvm_pio(KVM_PIO_IN, port, size, count, val);
 +
 +      return r;
  }
  
  static void complete_emulator_pio_in(struct kvm_vcpu *vcpu, void *val)
  {
        int size = vcpu->arch.pio.size;
 -      unsigned count = vcpu->arch.pio.count;
 +      unsigned int count = vcpu->arch.pio.count;
        memcpy(val, vcpu->arch.pio_data, size * count);
        trace_kvm_pio(KVM_PIO_IN, vcpu->arch.pio.port, size, count, vcpu->arch.pio_data);
        vcpu->arch.pio.count = 0;
  }
  
 -static int emulator_pio_in(struct kvm_vcpu *vcpu, int size,
 -                         unsigned short port, void *val, unsigned int count)
 +static int emulator_pio_in_emulated(struct x86_emulate_ctxt *ctxt,
 +                                  int size, unsigned short port, void *val,
 +                                  unsigned int count)
  {
 +      struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
        if (vcpu->arch.pio.count) {
                /*
                 * Complete a previous iteration that required userspace I/O.
                 * shenanigans as KVM doesn't support modifying the rep count,
                 * and the emulator ensures @count doesn't overflow the buffer.
                 */
 -      } else {
 -              int r = __emulator_pio_in(vcpu, size, port, count);
 -              if (!r)
 -                      return r;
 -
 -              /* Results already available, fall through.  */
 +              complete_emulator_pio_in(vcpu, val);
 +              return 1;
        }
  
 -      complete_emulator_pio_in(vcpu, val);
 -      return 1;
 -}
 -
 -static int emulator_pio_in_emulated(struct x86_emulate_ctxt *ctxt,
 -                                  int size, unsigned short port, void *val,
 -                                  unsigned int count)
 -{
 -      return emulator_pio_in(emul_to_vcpu(ctxt), size, port, val, count);
 -
 +      return emulator_pio_in(vcpu, size, port, val, count);
  }
  
  static int emulator_pio_out(struct kvm_vcpu *vcpu, int size,
                            unsigned short port, const void *val,
                            unsigned int count)
  {
 -      int ret;
 -
 -      memcpy(vcpu->arch.pio_data, val, size * count);
 -      trace_kvm_pio(KVM_PIO_OUT, port, size, count, vcpu->arch.pio_data);
 -      ret = emulator_pio_in_out(vcpu, size, port, count, false);
 -      if (ret)
 -                vcpu->arch.pio.count = 0;
 -
 -        return ret;
 +      trace_kvm_pio(KVM_PIO_OUT, port, size, count, val);
 +      return emulator_pio_in_out(vcpu, size, port, (void *)val, count, false);
  }
  
  static int emulator_pio_out_emulated(struct x86_emulate_ctxt *ctxt,
@@@ -8069,16 -7867,7 +8068,16 @@@ static int emulator_set_xcr(struct x86_
        return __kvm_set_xcr(emul_to_vcpu(ctxt), index, xcr);
  }
  
 +static void emulator_vm_bugged(struct x86_emulate_ctxt *ctxt)
 +{
 +      struct kvm *kvm = emul_to_vcpu(ctxt)->kvm;
 +
 +      if (!kvm->vm_bugged)
 +              kvm_vm_bugged(kvm);
 +}
 +
  static const struct x86_emulate_ops emulate_ops = {
 +      .vm_bugged           = emulator_vm_bugged,
        .read_gpr            = emulator_read_gpr,
        .write_gpr           = emulator_write_gpr,
        .read_std            = emulator_read_std,
@@@ -8355,7 -8144,7 +8354,7 @@@ static bool reexecute_instruction(struc
                 * If the mapping is invalid in guest, let cpu retry
                 * it to generate fault.
                 */
 -              if (gpa == UNMAPPED_GVA)
 +              if (gpa == INVALID_GPA)
                        return true;
        }
  
@@@ -8882,7 -8671,11 +8881,7 @@@ static int complete_fast_pio_in(struct 
        /* For size less than 4 we merge, else we zero extend */
        val = (vcpu->arch.pio.size < 4) ? kvm_rax_read(vcpu) : 0;
  
 -      /*
 -       * Since vcpu->arch.pio.count == 1 let emulator_pio_in perform
 -       * the copy and tracing
 -       */
 -      emulator_pio_in(vcpu, vcpu->arch.pio.size, vcpu->arch.pio.port, &val, 1);
 +      complete_emulator_pio_in(vcpu, &val);
        kvm_rax_write(vcpu, val);
  
        return kvm_skip_emulated_instruction(vcpu);
@@@ -8957,7 -8750,7 +8956,7 @@@ static void kvm_hyperv_tsc_notifier(voi
        /* TSC frequency always matches when on Hyper-V */
        for_each_present_cpu(cpu)
                per_cpu(cpu_tsc_khz, cpu) = tsc_khz;
 -      kvm_max_guest_tsc_khz = tsc_khz;
 +      kvm_caps.max_guest_tsc_khz = tsc_khz;
  
        list_for_each_entry(kvm, &vm_list, vm_list) {
                __kvm_start_pvclock_update(kvm);
@@@ -9158,23 -8951,25 +9157,23 @@@ static struct notifier_block pvclock_gt
  int kvm_arch_init(void *opaque)
  {
        struct kvm_x86_init_ops *ops = opaque;
 +      u64 host_pat;
        int r;
  
        if (kvm_x86_ops.hardware_enable) {
                pr_err("kvm: already loaded vendor module '%s'\n", kvm_x86_ops.name);
 -              r = -EEXIST;
 -              goto out;
 +              return -EEXIST;
        }
  
        if (!ops->cpu_has_kvm_support()) {
                pr_err_ratelimited("kvm: no hardware support for '%s'\n",
                                   ops->runtime_ops->name);
 -              r = -EOPNOTSUPP;
 -              goto out;
 +              return -EOPNOTSUPP;
        }
        if (ops->disabled_by_bios()) {
                pr_err_ratelimited("kvm: support for '%s' disabled by bios\n",
                                   ops->runtime_ops->name);
 -              r = -EOPNOTSUPP;
 -              goto out;
 +              return -EOPNOTSUPP;
        }
  
        /*
         */
        if (!boot_cpu_has(X86_FEATURE_FPU) || !boot_cpu_has(X86_FEATURE_FXSR)) {
                printk(KERN_ERR "kvm: inadequate fpu\n");
 -              r = -EOPNOTSUPP;
 -              goto out;
 +              return -EOPNOTSUPP;
        }
  
        if (IS_ENABLED(CONFIG_PREEMPT_RT) && !boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
                pr_err("RT requires X86_FEATURE_CONSTANT_TSC\n");
 -              r = -EOPNOTSUPP;
 -              goto out;
 +              return -EOPNOTSUPP;
        }
  
 -      r = -ENOMEM;
 +      /*
 +       * KVM assumes that PAT entry '0' encodes WB memtype and simply zeroes
 +       * the PAT bits in SPTEs.  Bail if PAT[0] is programmed to something
 +       * other than WB.  Note, EPT doesn't utilize the PAT, but don't bother
 +       * with an exception.  PAT[0] is set to WB on RESET and also by the
 +       * kernel, i.e. failure indicates a kernel bug or broken firmware.
 +       */
 +      if (rdmsrl_safe(MSR_IA32_CR_PAT, &host_pat) ||
 +          (host_pat & GENMASK(2, 0)) != 6) {
 +              pr_err("kvm: host PAT[0] is not WB\n");
 +              return -EIO;
 +      }
  
        x86_emulator_cache = kvm_alloc_emulator_cache();
        if (!x86_emulator_cache) {
                pr_err("kvm: failed to allocate cache for x86 emulator\n");
 -              goto out;
 +              return -ENOMEM;
        }
  
        user_return_msrs = alloc_percpu(struct kvm_user_return_msrs);
        if (!user_return_msrs) {
                printk(KERN_ERR "kvm: failed to allocate percpu kvm_user_return_msrs\n");
 +              r = -ENOMEM;
                goto out_free_x86_emulator_cache;
        }
        kvm_nr_uret_msrs = 0;
  
        if (boot_cpu_has(X86_FEATURE_XSAVE)) {
                host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
 -              supported_xcr0 = host_xcr0 & KVM_SUPPORTED_XCR0;
 +              kvm_caps.supported_xcr0 = host_xcr0 & KVM_SUPPORTED_XCR0;
        }
  
        if (pi_inject_timer == -1)
@@@ -9245,6 -9030,7 +9244,6 @@@ out_free_percpu
        free_percpu(user_return_msrs);
  out_free_x86_emulator_cache:
        kmem_cache_destroy(x86_emulator_cache);
 -out:
        return r;
  }
  
@@@ -9619,7 -9405,7 +9618,7 @@@ static void update_cr8_intercept(struc
        if (!lapic_in_kernel(vcpu))
                return;
  
 -      if (vcpu->arch.apicv_active)
 +      if (vcpu->arch.apic->apicv_active)
                return;
  
        if (!vcpu->arch.apic->vapic_addr)
@@@ -9648,11 -9434,6 +9647,11 @@@ int kvm_check_nested_events(struct kvm_
  
  static void kvm_inject_exception(struct kvm_vcpu *vcpu)
  {
 +      trace_kvm_inj_exception(vcpu->arch.exception.nr,
 +                              vcpu->arch.exception.has_error_code,
 +                              vcpu->arch.exception.error_code,
 +                              vcpu->arch.exception.injected);
 +
        if (vcpu->arch.exception.error_code && !is_protmode(vcpu))
                vcpu->arch.exception.error_code = false;
        static_call(kvm_x86_queue_exception)(vcpu);
@@@ -9688,7 -9469,7 +9687,7 @@@ static int inject_pending_event(struct 
                        static_call(kvm_x86_inject_nmi)(vcpu);
                        can_inject = false;
                } else if (vcpu->arch.interrupt.injected) {
 -                      static_call(kvm_x86_inject_irq)(vcpu);
 +                      static_call(kvm_x86_inject_irq)(vcpu, true);
                        can_inject = false;
                }
        }
  
        /* try to inject new event if pending */
        if (vcpu->arch.exception.pending) {
 -              trace_kvm_inj_exception(vcpu->arch.exception.nr,
 -                                      vcpu->arch.exception.has_error_code,
 -                                      vcpu->arch.exception.error_code);
 -
 -              vcpu->arch.exception.pending = false;
 -              vcpu->arch.exception.injected = true;
 -
                if (exception_type(vcpu->arch.exception.nr) == EXCPT_FAULT)
                        __kvm_set_rflags(vcpu, kvm_get_rflags(vcpu) |
                                             X86_EFLAGS_RF);
                }
  
                kvm_inject_exception(vcpu);
 +
 +              vcpu->arch.exception.pending = false;
 +              vcpu->arch.exception.injected = true;
 +
                can_inject = false;
        }
  
                        goto out;
                if (r) {
                        kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu), false);
 -                      static_call(kvm_x86_inject_irq)(vcpu);
 +                      static_call(kvm_x86_inject_irq)(vcpu, false);
                        WARN_ON(static_call(kvm_x86_interrupt_allowed)(vcpu, true) < 0);
                }
                if (kvm_cpu_has_injectable_intr(vcpu))
@@@ -10072,7 -9856,6 +10071,7 @@@ void kvm_make_scan_ioapic_request(struc
  
  void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu)
  {
 +      struct kvm_lapic *apic = vcpu->arch.apic;
        bool activate;
  
        if (!lapic_in_kernel(vcpu))
        down_read(&vcpu->kvm->arch.apicv_update_lock);
        preempt_disable();
  
 -      activate = kvm_vcpu_apicv_activated(vcpu);
 +      /* Do not activate APICV when APIC is disabled */
 +      activate = kvm_vcpu_apicv_activated(vcpu) &&
 +                 (kvm_get_apic_mode(vcpu) != LAPIC_MODE_DISABLED);
  
 -      if (vcpu->arch.apicv_active == activate)
 +      if (apic->apicv_active == activate)
                goto out;
  
 -      vcpu->arch.apicv_active = activate;
 +      apic->apicv_active = activate;
        kvm_apic_update_apicv(vcpu);
        static_call(kvm_x86_refresh_apicv_exec_ctrl)(vcpu);
  
         * still active when the interrupt got accepted. Make sure
         * inject_pending_event() is called to check for that.
         */
 -      if (!vcpu->arch.apicv_active)
 +      if (!apic->apicv_active)
                kvm_make_request(KVM_REQ_EVENT, vcpu);
  
  out:
@@@ -10493,8 -10274,7 +10492,8 @@@ static int vcpu_enter_guest(struct kvm_
                 * per-VM state, and responsing vCPUs must wait for the update
                 * to complete before servicing KVM_REQ_APICV_UPDATE.
                 */
 -              WARN_ON_ONCE(kvm_vcpu_apicv_activated(vcpu) != kvm_vcpu_apicv_active(vcpu));
 +              WARN_ON_ONCE((kvm_vcpu_apicv_activated(vcpu) != kvm_vcpu_apicv_active(vcpu)) &&
 +                           (kvm_get_apic_mode(vcpu) != LAPIC_MODE_DISABLED));
  
                exit_fastpath = static_call(kvm_x86_vcpu_run)(vcpu);
                if (likely(exit_fastpath != EXIT_FASTPATH_REENTER_GUEST))
@@@ -10873,10 -10653,8 +10872,10 @@@ int kvm_arch_vcpu_ioctl_run(struct kvm_
                r = cui(vcpu);
                if (r <= 0)
                        goto out;
 -      } else
 -              WARN_ON(vcpu->arch.pio.count || vcpu->mmio_needed);
 +      } else {
 +              WARN_ON_ONCE(vcpu->arch.pio.count);
 +              WARN_ON_ONCE(vcpu->mmio_needed);
 +      }
  
        if (kvm_run->immediate_exit) {
                r = -EINTR;
@@@ -11404,7 -11182,7 +11403,7 @@@ int kvm_arch_vcpu_ioctl_translate(struc
        gpa = kvm_mmu_gva_to_gpa_system(vcpu, vaddr, NULL);
        srcu_read_unlock(&vcpu->kvm->srcu, idx);
        tr->physical_address = gpa;
 -      tr->valid = gpa != UNMAPPED_GVA;
 +      tr->valid = gpa != INVALID_GPA;
        tr->writeable = 1;
        tr->usermode = 0;
  
@@@ -11497,17 -11275,11 +11496,17 @@@ static int sync_regs(struct kvm_vcpu *v
  
  int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
  {
 -      if (kvm_check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0)
 +      if (kvm_check_tsc_unstable() && kvm->created_vcpus)
                pr_warn_once("kvm: SMP vm created on host with unstable TSC; "
                             "guest TSC will not be reliable\n");
  
 -      return 0;
 +      if (!kvm->arch.max_vcpu_ids)
 +              kvm->arch.max_vcpu_ids = KVM_MAX_VCPU_IDS;
 +
 +      if (id >= kvm->arch.max_vcpu_ids)
 +              return -EINVAL;
 +
 +      return static_call(kvm_x86_vcpu_precreate)(kvm);
  }
  
  int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
                 * will ensure the vCPU gets the correct state before VM-Entry.
                 */
                if (enable_apicv) {
 -                      vcpu->arch.apicv_active = true;
 +                      vcpu->arch.apic->apicv_active = true;
                        kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu);
                }
        } else
                goto fail_free_lapic;
        vcpu->arch.pio_data = page_address(page);
  
 -      vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS * sizeof(u64) * 4,
 +      vcpu->arch.mce_banks = kcalloc(KVM_MAX_MCE_BANKS * 4, sizeof(u64),
                                       GFP_KERNEL_ACCOUNT);
 -      if (!vcpu->arch.mce_banks)
 +      vcpu->arch.mci_ctl2_banks = kcalloc(KVM_MAX_MCE_BANKS, sizeof(u64),
 +                                          GFP_KERNEL_ACCOUNT);
 +      if (!vcpu->arch.mce_banks || !vcpu->arch.mci_ctl2_banks)
                goto fail_free_pio_data;
        vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
  
@@@ -11615,7 -11385,6 +11614,7 @@@ free_wbinvd_dirty_mask
        free_cpumask_var(vcpu->arch.wbinvd_dirty_mask);
  fail_free_mce_banks:
        kfree(vcpu->arch.mce_banks);
 +      kfree(vcpu->arch.mci_ctl2_banks);
  fail_free_pio_data:
        free_page((unsigned long)vcpu->arch.pio_data);
  fail_free_lapic:
@@@ -11661,7 -11430,6 +11660,7 @@@ void kvm_arch_vcpu_destroy(struct kvm_v
        kvm_hv_vcpu_uninit(vcpu);
        kvm_pmu_destroy(vcpu);
        kfree(vcpu->arch.mce_banks);
 +      kfree(vcpu->arch.mci_ctl2_banks);
        kvm_free_lapic(vcpu);
        idx = srcu_read_lock(&vcpu->kvm->srcu);
        kvm_mmu_destroy(vcpu);
@@@ -11741,8 -11509,6 +11740,8 @@@ void kvm_vcpu_reset(struct kvm_vcpu *vc
                vcpu->arch.smbase = 0x30000;
  
                vcpu->arch.msr_misc_features_enables = 0;
 +              vcpu->arch.ia32_misc_enable_msr = MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL |
 +                                                MSR_IA32_MISC_ENABLE_BTS_UNAVAIL;
  
                __kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP);
                __kvm_set_msr(vcpu, MSR_IA32_XSS, 0, true);
         * i.e. it's impossible for kvm_find_cpuid_entry() to find a valid entry
         * on RESET.  But, go through the motions in case that's ever remedied.
         */
 -      cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1, 0);
 +      cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1);
        kvm_rdx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600);
  
        static_call(kvm_x86_vcpu_reset)(vcpu, init_event);
@@@ -11950,8 -11716,6 +11949,8 @@@ int kvm_arch_hardware_setup(void *opaqu
        if (boot_cpu_has(X86_FEATURE_XSAVES))
                rdmsrl(MSR_IA32_XSS, host_xss);
  
 +      kvm_init_pmu_capability();
 +
        r = ops->hardware_setup();
        if (r != 0)
                return r;
        kvm_register_perf_callbacks(ops->handle_intel_pt_intr);
  
        if (!kvm_cpu_cap_has(X86_FEATURE_XSAVES))
 -              supported_xss = 0;
 +              kvm_caps.supported_xss = 0;
  
  #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
        cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
  #undef __kvm_cpu_cap_has
  
 -      if (kvm_has_tsc_control) {
 +      if (kvm_caps.has_tsc_control) {
                /*
                 * Make sure the user can only configure tsc_khz values that
                 * fit into a signed integer.
                 * be 1 on all machines.
                 */
                u64 max = min(0x7fffffffULL,
 -                            __scale_tsc(kvm_max_tsc_scaling_ratio, tsc_khz));
 -              kvm_max_guest_tsc_khz = max;
 +                            __scale_tsc(kvm_caps.max_tsc_scaling_ratio, tsc_khz));
 +              kvm_caps.max_guest_tsc_khz = max;
        }
 -      kvm_default_tsc_scaling_ratio = 1ULL << kvm_tsc_scaling_ratio_frac_bits;
 +      kvm_caps.default_tsc_scaling_ratio = 1ULL << kvm_caps.tsc_scaling_ratio_frac_bits;
        kvm_init_msr_list();
        return 0;
  }
@@@ -12566,8 -12330,7 +12565,8 @@@ int kvm_arch_vcpu_runnable(struct kvm_v
  
  bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu)
  {
 -      if (vcpu->arch.apicv_active && static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu))
 +      if (kvm_vcpu_apicv_active(vcpu) &&
 +          static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu))
                return true;
  
        return false;
@@@ -13009,7 -12772,7 +13008,7 @@@ void kvm_fixup_and_inject_pf_error(stru
                (PFERR_WRITE_MASK | PFERR_FETCH_MASK | PFERR_USER_MASK);
  
        if (!(error_code & PFERR_PRESENT_MASK) ||
 -          mmu->gva_to_gpa(vcpu, mmu, gva, access, &fault) != UNMAPPED_GVA) {
 +          mmu->gva_to_gpa(vcpu, mmu, gva, access, &fault) != INVALID_GPA) {
                /*
                 * If vcpu->arch.walk_mmu->gva_to_gpa succeeded, the page
                 * tables probably do not match the TLB.  Just proceed
@@@ -13234,12 -12997,6 +13233,12 @@@ int kvm_sev_es_mmio_read(struct kvm_vcp
  }
  EXPORT_SYMBOL_GPL(kvm_sev_es_mmio_read);
  
 +static void advance_sev_es_emulated_pio(struct kvm_vcpu *vcpu, unsigned count, int size)
 +{
 +      vcpu->arch.sev_pio_count -= count;
 +      vcpu->arch.sev_pio_data += count * size;
 +}
 +
  static int kvm_sev_es_outs(struct kvm_vcpu *vcpu, unsigned int size,
                           unsigned int port);
  
@@@ -13263,7 -13020,8 +13262,7 @@@ static int kvm_sev_es_outs(struct kvm_v
                int ret = emulator_pio_out(vcpu, size, port, vcpu->arch.sev_pio_data, count);
  
                /* memcpy done already by emulator_pio_out.  */
 -              vcpu->arch.sev_pio_count -= count;
 -              vcpu->arch.sev_pio_data += count * vcpu->arch.pio.size;
 +              advance_sev_es_emulated_pio(vcpu, count, size);
                if (!ret)
                        break;
  
  static int kvm_sev_es_ins(struct kvm_vcpu *vcpu, unsigned int size,
                          unsigned int port);
  
 -static void advance_sev_es_emulated_ins(struct kvm_vcpu *vcpu)
 -{
 -      unsigned count = vcpu->arch.pio.count;
 -      complete_emulator_pio_in(vcpu, vcpu->arch.sev_pio_data);
 -      vcpu->arch.sev_pio_count -= count;
 -      vcpu->arch.sev_pio_data += count * vcpu->arch.pio.size;
 -}
 -
  static int complete_sev_es_emulated_ins(struct kvm_vcpu *vcpu)
  {
 +      unsigned count = vcpu->arch.pio.count;
        int size = vcpu->arch.pio.size;
        int port = vcpu->arch.pio.port;
  
 -      advance_sev_es_emulated_ins(vcpu);
 +      complete_emulator_pio_in(vcpu, vcpu->arch.sev_pio_data);
 +      advance_sev_es_emulated_pio(vcpu, count, size);
        if (vcpu->arch.sev_pio_count)
                return kvm_sev_es_ins(vcpu, size, port);
        return 1;
@@@ -13298,11 -13062,11 +13297,11 @@@ static int kvm_sev_es_ins(struct kvm_vc
        for (;;) {
                unsigned int count =
                        min_t(unsigned int, PAGE_SIZE / size, vcpu->arch.sev_pio_count);
 -              if (!__emulator_pio_in(vcpu, size, port, count))
 +              if (!emulator_pio_in(vcpu, size, port, vcpu->arch.sev_pio_data, count))
                        break;
  
                /* Emulation done by the kernel.  */
 -              advance_sev_es_emulated_ins(vcpu);
 +              advance_sev_es_emulated_pio(vcpu, count, size);
                if (!vcpu->arch.sev_pio_count)
                        return 1;
        }
@@@ -13345,7 -13109,6 +13344,7 @@@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_u
  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_incomplete_ipi);
  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_ga_log);
  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_kick_vcpu_slowpath);
 +EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_doorbell);
  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_apicv_accept_irq);
  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_enter);
  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_exit);
index fe7e2105e7667a530ee20696b111f025729b8f89,cfcb450e9b59adedb859efa8869500cf1d1e988f..bf6716ff863bf54d0ffbb9c95533274ed422cc40
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/kernel.h>
  #include <linux/pagemap.h>
  #include <linux/agp_backend.h>
- #include <linux/intel-iommu.h>
+ #include <linux/iommu.h>
  #include <linux/delay.h>
  #include <asm/smp.h>
  #include "agp.h"
@@@ -573,18 -573,15 +573,15 @@@ static void intel_gtt_cleanup(void
   */
  static inline int needs_ilk_vtd_wa(void)
  {
- #ifdef CONFIG_INTEL_IOMMU
        const unsigned short gpu_devid = intel_private.pcidev->device;
  
-       /* Query intel_iommu to see if we need the workaround. Presumably that
-        * was loaded first.
+       /*
+        * Query iommu subsystem to see if we need the workaround. Presumably
+        * that was loaded first.
         */
-       if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
-            gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
-            intel_iommu_gfx_mapped)
-               return 1;
- #endif
-       return 0;
+       return ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
+                gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
+               device_iommu_mapped(&intel_private.pcidev->dev));
  }
  
  static bool intel_gtt_can_wc(void)
@@@ -744,7 -741,7 +741,7 @@@ static void i830_write_entry(dma_addr_
        writel_relaxed(addr | pte_flags, intel_private.gtt + entry);
  }
  
 -bool intel_enable_gtt(void)
 +bool intel_gmch_enable_gtt(void)
  {
        u8 __iomem *reg;
  
  
        return true;
  }
 -EXPORT_SYMBOL(intel_enable_gtt);
 +EXPORT_SYMBOL(intel_gmch_enable_gtt);
  
  static int i830_setup(void)
  {
@@@ -821,8 -818,8 +818,8 @@@ static int intel_fake_agp_free_gatt_tab
  
  static int intel_fake_agp_configure(void)
  {
 -      if (!intel_enable_gtt())
 -          return -EIO;
 +      if (!intel_gmch_enable_gtt())
 +              return -EIO;
  
        intel_private.clear_fake_agp = true;
        agp_bridge->gart_bus_addr = intel_private.gma_bus_addr;
@@@ -844,20 -841,20 +841,20 @@@ static bool i830_check_flags(unsigned i
        return false;
  }
  
 -void intel_gtt_insert_page(dma_addr_t addr,
 -                         unsigned int pg,
 -                         unsigned int flags)
 +void intel_gmch_gtt_insert_page(dma_addr_t addr,
 +                              unsigned int pg,
 +                              unsigned int flags)
  {
        intel_private.driver->write_entry(addr, pg, flags);
        readl(intel_private.gtt + pg);
        if (intel_private.driver->chipset_flush)
                intel_private.driver->chipset_flush();
  }
 -EXPORT_SYMBOL(intel_gtt_insert_page);
 +EXPORT_SYMBOL(intel_gmch_gtt_insert_page);
  
 -void intel_gtt_insert_sg_entries(struct sg_table *st,
 -                               unsigned int pg_start,
 -                               unsigned int flags)
 +void intel_gmch_gtt_insert_sg_entries(struct sg_table *st,
 +                                    unsigned int pg_start,
 +                                    unsigned int flags)
  {
        struct scatterlist *sg;
        unsigned int len, m;
        if (intel_private.driver->chipset_flush)
                intel_private.driver->chipset_flush();
  }
 -EXPORT_SYMBOL(intel_gtt_insert_sg_entries);
 +EXPORT_SYMBOL(intel_gmch_gtt_insert_sg_entries);
  
  #if IS_ENABLED(CONFIG_AGP_INTEL)
 -static void intel_gtt_insert_pages(unsigned int first_entry,
 -                                 unsigned int num_entries,
 -                                 struct page **pages,
 -                                 unsigned int flags)
 +static void intel_gmch_gtt_insert_pages(unsigned int first_entry,
 +                                      unsigned int num_entries,
 +                                      struct page **pages,
 +                                      unsigned int flags)
  {
        int i, j;
  
@@@ -905,7 -902,7 +902,7 @@@ static int intel_fake_agp_insert_entrie
        if (intel_private.clear_fake_agp) {
                int start = intel_private.stolen_size / PAGE_SIZE;
                int end = intel_private.gtt_mappable_entries;
 -              intel_gtt_clear_range(start, end - start);
 +              intel_gmch_gtt_clear_range(start, end - start);
                intel_private.clear_fake_agp = false;
        }
  
                if (ret != 0)
                        return ret;
  
 -              intel_gtt_insert_sg_entries(&st, pg_start, type);
 +              intel_gmch_gtt_insert_sg_entries(&st, pg_start, type);
                mem->sg_list = st.sgl;
                mem->num_sg = st.nents;
        } else
 -              intel_gtt_insert_pages(pg_start, mem->page_count, mem->pages,
 -                                     type);
 +              intel_gmch_gtt_insert_pages(pg_start, mem->page_count, mem->pages,
 +                                          type);
  
  out:
        ret = 0;
@@@ -949,7 -946,7 +946,7 @@@ out_err
  }
  #endif
  
 -void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
 +void intel_gmch_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
  {
        unsigned int i;
  
        }
        wmb();
  }
 -EXPORT_SYMBOL(intel_gtt_clear_range);
 +EXPORT_SYMBOL(intel_gmch_gtt_clear_range);
  
  #if IS_ENABLED(CONFIG_AGP_INTEL)
  static int intel_fake_agp_remove_entries(struct agp_memory *mem,
        if (mem->page_count == 0)
                return 0;
  
 -      intel_gtt_clear_range(pg_start, mem->page_count);
 +      intel_gmch_gtt_clear_range(pg_start, mem->page_count);
  
        if (intel_private.needs_dmar) {
                intel_gtt_unmap_memory(mem->sg_list, mem->num_sg);
@@@ -1431,22 -1428,22 +1428,22 @@@ int intel_gmch_probe(struct pci_dev *br
  }
  EXPORT_SYMBOL(intel_gmch_probe);
  
 -void intel_gtt_get(u64 *gtt_total,
 -                 phys_addr_t *mappable_base,
 -                 resource_size_t *mappable_end)
 +void intel_gmch_gtt_get(u64 *gtt_total,
 +                      phys_addr_t *mappable_base,
 +                      resource_size_t *mappable_end)
  {
        *gtt_total = intel_private.gtt_total_entries << PAGE_SHIFT;
        *mappable_base = intel_private.gma_bus_addr;
        *mappable_end = intel_private.gtt_mappable_entries << PAGE_SHIFT;
  }
 -EXPORT_SYMBOL(intel_gtt_get);
 +EXPORT_SYMBOL(intel_gmch_gtt_get);
  
 -void intel_gtt_chipset_flush(void)
 +void intel_gmch_gtt_flush(void)
  {
        if (intel_private.driver->chipset_flush)
                intel_private.driver->chipset_flush();
  }
 -EXPORT_SYMBOL(intel_gtt_chipset_flush);
 +EXPORT_SYMBOL(intel_gmch_gtt_flush);
  
  void intel_gmch_remove(void)
  {
index a0f84cbe974fc35d7d35c1f926c261c0edaec735,493421759afa6d6f1d1cc894272f1a48f642e2d8..fc5d94862ef320ae018c51d1583f8aa605b18c21
@@@ -27,7 -27,6 +27,6 @@@
  #include <acpi/video.h>
  #include <linux/i2c.h>
  #include <linux/input.h>
- #include <linux/intel-iommu.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
  #include <linux/dma-resv.h>
@@@ -87,7 -86,6 +86,7 @@@
  #include "intel_cdclk.h"
  #include "intel_color.h"
  #include "intel_crtc.h"
 +#include "intel_crtc_state_dump.h"
  #include "intel_de.h"
  #include "intel_display_types.h"
  #include "intel_dmc.h"
  #include "intel_frontbuffer.h"
  #include "intel_hdcp.h"
  #include "intel_hotplug.h"
 +#include "intel_modeset_verify.h"
 +#include "intel_modeset_setup.h"
  #include "intel_overlay.h"
  #include "intel_panel.h"
  #include "intel_pch_display.h"
  
  static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_state);
  static void intel_set_pipe_src_size(const struct intel_crtc_state *crtc_state);
 -static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state);
 -static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state);
  static void hsw_set_transconf(const struct intel_crtc_state *crtc_state);
  static void bdw_set_pipemisc(const struct intel_crtc_state *crtc_state);
  static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state);
 -static void intel_modeset_setup_hw_state(struct drm_device *dev,
 -                                       struct drm_modeset_acquire_ctx *ctx);
  
  /**
   * intel_update_watermarks - update FIFO watermark values based on current modes
   * We don't use the sprite, so we can ignore that.  And on Crestline we have
   * to set the non-SR watermarks to 8.
   */
 -static void intel_update_watermarks(struct drm_i915_private *dev_priv)
 +void intel_update_watermarks(struct drm_i915_private *dev_priv)
  {
        if (dev_priv->wm_disp->update_wm)
                dev_priv->wm_disp->update_wm(dev_priv);
@@@ -499,9 -499,6 +498,9 @@@ void vlv_wait_port_ready(struct drm_i91
        i915_reg_t dpll_reg;
  
        switch (dig_port->base.port) {
 +      default:
 +              MISSING_CASE(dig_port->base.port);
 +              fallthrough;
        case PORT_B:
                port_mask = DPLL_PORTB_READY_MASK;
                dpll_reg = DPLL(0);
                port_mask = DPLL_PORTD_READY_MASK;
                dpll_reg = DPIO_PHY_STATUS;
                break;
 -      default:
 -              BUG();
        }
  
        if (intel_de_wait_for_register(dev_priv, dpll_reg,
@@@ -730,9 -729,10 +729,9 @@@ u32 intel_plane_fb_max_stride(struct dr
                                 DRM_MODE_ROTATE_0);
  }
  
 -static void
 -intel_set_plane_visible(struct intel_crtc_state *crtc_state,
 -                      struct intel_plane_state *plane_state,
 -                      bool visible)
 +void intel_set_plane_visible(struct intel_crtc_state *crtc_state,
 +                           struct intel_plane_state *plane_state,
 +                           bool visible)
  {
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
  
                crtc_state->uapi.plane_mask &= ~drm_plane_mask(&plane->base);
  }
  
 -static void fixup_plane_bitmasks(struct intel_crtc_state *crtc_state)
 +void intel_plane_fixup_bitmasks(struct intel_crtc_state *crtc_state)
  {
        struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
        struct drm_plane *plane;
@@@ -779,7 -779,7 +778,7 @@@ void intel_plane_disable_noatomic(struc
                    crtc->base.base.id, crtc->base.name);
  
        intel_set_plane_visible(crtc_state, plane_state, false);
 -      fixup_plane_bitmasks(crtc_state);
 +      intel_plane_fixup_bitmasks(crtc_state);
        crtc_state->data_rate[plane->id] = 0;
        crtc_state->data_rate_y[plane->id] = 0;
        crtc_state->rel_data_rate[plane->id] = 0;
@@@ -828,7 -828,7 +827,7 @@@ intel_plane_fence_y_offset(const struc
  }
  
  static int
 -__intel_display_resume(struct drm_device *dev,
 +__intel_display_resume(struct drm_i915_private *i915,
                       struct drm_atomic_state *state,
                       struct drm_modeset_acquire_ctx *ctx)
  {
        struct drm_crtc *crtc;
        int i, ret;
  
 -      intel_modeset_setup_hw_state(dev, ctx);
 -      intel_vga_redisable(to_i915(dev));
 +      intel_modeset_setup_hw_state(i915, ctx);
 +      intel_vga_redisable(i915);
  
        if (!state)
                return 0;
        }
  
        /* ignore any reset values/BIOS leftovers in the WM registers */
 -      if (!HAS_GMCH(to_i915(dev)))
 +      if (!HAS_GMCH(i915))
                to_intel_atomic_state(state)->skip_intermediate_wm = true;
  
        ret = drm_atomic_helper_commit_duplicated_state(state, ctx);
  
 -      drm_WARN_ON(dev, ret == -EDEADLK);
 +      drm_WARN_ON(&i915->drm, ret == -EDEADLK);
 +
        return ret;
  }
  
@@@ -936,55 -935,56 +935,55 @@@ void intel_display_prepare_reset(struc
        state->acquire_ctx = ctx;
  }
  
 -void intel_display_finish_reset(struct drm_i915_private *dev_priv)
 +void intel_display_finish_reset(struct drm_i915_private *i915)
  {
 -      struct drm_device *dev = &dev_priv->drm;
 -      struct drm_modeset_acquire_ctx *ctx = &dev_priv->reset_ctx;
 +      struct drm_modeset_acquire_ctx *ctx = &i915->reset_ctx;
        struct drm_atomic_state *state;
        int ret;
  
 -      if (!HAS_DISPLAY(dev_priv))
 +      if (!HAS_DISPLAY(i915))
                return;
  
        /* reset doesn't touch the display */
 -      if (!test_bit(I915_RESET_MODESET, &to_gt(dev_priv)->reset.flags))
 +      if (!test_bit(I915_RESET_MODESET, &to_gt(i915)->reset.flags))
                return;
  
 -      state = fetch_and_zero(&dev_priv->modeset_restore_state);
 +      state = fetch_and_zero(&i915->modeset_restore_state);
        if (!state)
                goto unlock;
  
        /* reset doesn't touch the display */
 -      if (!gpu_reset_clobbers_display(dev_priv)) {
 +      if (!gpu_reset_clobbers_display(i915)) {
                /* for testing only restore the display */
 -              ret = __intel_display_resume(dev, state, ctx);
 +              ret = __intel_display_resume(i915, state, ctx);
                if (ret)
 -                      drm_err(&dev_priv->drm,
 +                      drm_err(&i915->drm,
                                "Restoring old state failed with %i\n", ret);
        } else {
                /*
                 * The display has been reset as well,
                 * so need a full re-initialization.
                 */
 -              intel_pps_unlock_regs_wa(dev_priv);
 -              intel_modeset_init_hw(dev_priv);
 -              intel_init_clock_gating(dev_priv);
 -              intel_hpd_init(dev_priv);
 +              intel_pps_unlock_regs_wa(i915);
 +              intel_modeset_init_hw(i915);
 +              intel_init_clock_gating(i915);
 +              intel_hpd_init(i915);
  
 -              ret = __intel_display_resume(dev, state, ctx);
 +              ret = __intel_display_resume(i915, state, ctx);
                if (ret)
 -                      drm_err(&dev_priv->drm,
 +                      drm_err(&i915->drm,
                                "Restoring old state failed with %i\n", ret);
  
 -              intel_hpd_poll_disable(dev_priv);
 +              intel_hpd_poll_disable(i915);
        }
  
        drm_atomic_state_put(state);
  unlock:
        drm_modeset_drop_locks(ctx);
        drm_modeset_acquire_fini(ctx);
 -      mutex_unlock(&dev->mode_config.mutex);
 +      mutex_unlock(&i915->drm.mode_config.mutex);
  
 -      clear_bit_unlock(I915_RESET_MODESET, &to_gt(dev_priv)->reset.flags);
 +      clear_bit_unlock(I915_RESET_MODESET, &to_gt(i915)->reset.flags);
  }
  
  static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state)
@@@ -2205,8 -2205,9 +2204,8 @@@ static void get_crtc_power_domains(stru
                set_bit(intel_dsc_power_domain(crtc, cpu_transcoder), mask->bits);
  }
  
 -static void
 -modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 -                             struct intel_power_domain_mask *old_domains)
 +void intel_modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 +                                        struct intel_power_domain_mask *old_domains)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
                                               domain);
  }
  
 -static void modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 -                                         struct intel_power_domain_mask *domains)
 +void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 +                                        struct intel_power_domain_mask *domains)
  {
        intel_display_power_put_mask_in_set(to_i915(crtc->base.dev),
                                            &crtc->enabled_power_domains,
@@@ -2411,6 -2412,89 +2410,6 @@@ static void i9xx_crtc_disable(struct in
                i830_enable_pipe(dev_priv, pipe);
  }
  
 -static void intel_crtc_disable_noatomic(struct intel_crtc *crtc,
 -                                      struct drm_modeset_acquire_ctx *ctx)
 -{
 -      struct intel_encoder *encoder;
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      struct intel_bw_state *bw_state =
 -              to_intel_bw_state(dev_priv->bw_obj.state);
 -      struct intel_cdclk_state *cdclk_state =
 -              to_intel_cdclk_state(dev_priv->cdclk.obj.state);
 -      struct intel_dbuf_state *dbuf_state =
 -              to_intel_dbuf_state(dev_priv->dbuf.obj.state);
 -      struct intel_crtc_state *crtc_state =
 -              to_intel_crtc_state(crtc->base.state);
 -      struct intel_plane *plane;
 -      struct drm_atomic_state *state;
 -      struct intel_crtc_state *temp_crtc_state;
 -      enum pipe pipe = crtc->pipe;
 -      int ret;
 -
 -      if (!crtc_state->hw.active)
 -              return;
 -
 -      for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
 -              const struct intel_plane_state *plane_state =
 -                      to_intel_plane_state(plane->base.state);
 -
 -              if (plane_state->uapi.visible)
 -                      intel_plane_disable_noatomic(crtc, plane);
 -      }
 -
 -      state = drm_atomic_state_alloc(&dev_priv->drm);
 -      if (!state) {
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "failed to disable [CRTC:%d:%s], out of memory",
 -                          crtc->base.base.id, crtc->base.name);
 -              return;
 -      }
 -
 -      state->acquire_ctx = ctx;
 -
 -      /* Everything's already locked, -EDEADLK can't happen. */
 -      temp_crtc_state = intel_atomic_get_crtc_state(state, crtc);
 -      ret = drm_atomic_add_affected_connectors(state, &crtc->base);
 -
 -      drm_WARN_ON(&dev_priv->drm, IS_ERR(temp_crtc_state) || ret);
 -
 -      dev_priv->display->crtc_disable(to_intel_atomic_state(state), crtc);
 -
 -      drm_atomic_state_put(state);
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "[CRTC:%d:%s] hw state adjusted, was enabled, now disabled\n",
 -                  crtc->base.base.id, crtc->base.name);
 -
 -      crtc->active = false;
 -      crtc->base.enabled = false;
 -
 -      drm_WARN_ON(&dev_priv->drm,
 -                  drm_atomic_set_mode_for_crtc(&crtc_state->uapi, NULL) < 0);
 -      crtc_state->uapi.active = false;
 -      crtc_state->uapi.connector_mask = 0;
 -      crtc_state->uapi.encoder_mask = 0;
 -      intel_crtc_free_hw_state(crtc_state);
 -      memset(&crtc_state->hw, 0, sizeof(crtc_state->hw));
 -
 -      for_each_encoder_on_crtc(&dev_priv->drm, &crtc->base, encoder)
 -              encoder->base.crtc = NULL;
 -
 -      intel_fbc_disable(crtc);
 -      intel_update_watermarks(dev_priv);
 -      intel_disable_shared_dpll(crtc_state);
 -
 -      intel_display_power_put_all_in_set(dev_priv, &crtc->enabled_power_domains);
 -
 -      cdclk_state->min_cdclk[pipe] = 0;
 -      cdclk_state->min_voltage_level[pipe] = 0;
 -      cdclk_state->active_pipes &= ~BIT(pipe);
 -
 -      dbuf_state->active_pipes &= ~BIT(pipe);
 -
 -      bw_state->data_rate[pipe] = 0;
 -      bw_state->num_active_planes[pipe] = 0;
 -}
  
  /*
   * turn all crtc's off, but do not adjust state
@@@ -2443,6 -2527,45 +2442,6 @@@ void intel_encoder_destroy(struct drm_e
        kfree(intel_encoder);
  }
  
 -/* Cross check the actual hw state with our own modeset state tracking (and it's
 - * internal consistency). */
 -static void intel_connector_verify_state(struct intel_crtc_state *crtc_state,
 -                                       struct drm_connector_state *conn_state)
 -{
 -      struct intel_connector *connector = to_intel_connector(conn_state->connector);
 -      struct drm_i915_private *i915 = to_i915(connector->base.dev);
 -
 -      drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n",
 -                  connector->base.base.id, connector->base.name);
 -
 -      if (connector->get_hw_state(connector)) {
 -              struct intel_encoder *encoder = intel_attached_encoder(connector);
 -
 -              I915_STATE_WARN(!crtc_state,
 -                       "connector enabled without attached crtc\n");
 -
 -              if (!crtc_state)
 -                      return;
 -
 -              I915_STATE_WARN(!crtc_state->hw.active,
 -                              "connector is active, but attached crtc isn't\n");
 -
 -              if (!encoder || encoder->type == INTEL_OUTPUT_DP_MST)
 -                      return;
 -
 -              I915_STATE_WARN(conn_state->best_encoder != &encoder->base,
 -                      "atomic encoder doesn't match attached encoder\n");
 -
 -              I915_STATE_WARN(conn_state->crtc != encoder->base.crtc,
 -                      "attached encoder crtc differs from connector crtc\n");
 -      } else {
 -              I915_STATE_WARN(crtc_state && crtc_state->hw.active,
 -                              "attached crtc is active, but connector isn't\n");
 -              I915_STATE_WARN(!crtc_state && conn_state->best_encoder,
 -                      "best encoder set without crtc!\n");
 -      }
 -}
 -
  static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
  {
        const struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@@ -2584,8 -2707,8 +2583,8 @@@ static void intel_crtc_readout_derived_
        intel_crtc_compute_pixel_rate(crtc_state);
  }
  
 -static void intel_encoder_get_config(struct intel_encoder *encoder,
 -                                   struct intel_crtc_state *crtc_state)
 +void intel_encoder_get_config(struct intel_encoder *encoder,
 +                            struct intel_crtc_state *crtc_state)
  {
        encoder->get_config(encoder, crtc_state);
  
@@@ -2687,11 -2810,9 +2686,11 @@@ static int intel_crtc_compute_pipe_mode
        return 0;
  }
  
 -static int intel_crtc_compute_config(struct intel_crtc *crtc,
 -                                   struct intel_crtc_state *crtc_state)
 +static int intel_crtc_compute_config(struct intel_atomic_state *state,
 +                                   struct intel_crtc *crtc)
  {
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        int ret;
  
        ret = intel_crtc_compute_pipe_src(crtc_state);
@@@ -3013,18 -3134,14 +3012,18 @@@ static void intel_get_pipe_src_size(str
        intel_bigjoiner_adjust_pipe_src(pipe_config);
  }
  
 -static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state)
 +void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        u32 pipeconf = 0;
  
 -      /* we keep both pipes enabled on 830 */
 -      if (IS_I830(dev_priv))
 +      /*
 +       * - We keep both pipes enabled on 830
 +       * - During modeset the pipe is still disabled and must remain so
 +       * - During fastset the pipe is already enabled and must remain so
 +       */
 +      if (IS_I830(dev_priv) || !intel_crtc_needs_modeset(crtc_state))
                pipeconf |= PIPECONF_ENABLE;
  
        if (crtc_state->double_wide)
                                    PIPECONF_DITHER_TYPE_SP;
  
                switch (crtc_state->pipe_bpp) {
 +              default:
 +                      /* Case prevented by intel_choose_pipe_bpp_dither. */
 +                      MISSING_CASE(crtc_state->pipe_bpp);
 +                      fallthrough;
                case 18:
                        pipeconf |= PIPECONF_BPC_6;
                        break;
                case 30:
                        pipeconf |= PIPECONF_BPC_10;
                        break;
 -              default:
 -                      /* Case prevented by intel_choose_pipe_bpp_dither. */
 -                      BUG();
                }
        }
  
        return ret;
  }
  
 -static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state)
 +void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        enum pipe pipe = crtc->pipe;
 -      u32 val;
 +      u32 val = 0;
  
 -      val = 0;
 +      /*
 +       * - During modeset the pipe is still disabled and must remain so
 +       * - During fastset the pipe is already enabled and must remain so
 +       */
 +      if (!intel_crtc_needs_modeset(crtc_state))
 +              val |= PIPECONF_ENABLE;
  
        switch (crtc_state->pipe_bpp) {
 +      default:
 +              /* Case prevented by intel_choose_pipe_bpp_dither. */
 +              MISSING_CASE(crtc_state->pipe_bpp);
 +              fallthrough;
        case 18:
                val |= PIPECONF_BPC_6;
                break;
        case 36:
                val |= PIPECONF_BPC_12;
                break;
 -      default:
 -              /* Case prevented by intel_choose_pipe_bpp_dither. */
 -              BUG();
        }
  
        if (crtc_state->dither)
@@@ -3408,13 -3518,6 +3407,13 @@@ static void hsw_set_transconf(const str
        enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
        u32 val = 0;
  
 +      /*
 +       * - During modeset the pipe is still disabled and must remain so
 +       * - During fastset the pipe is already enabled and must remain so
 +       */
 +      if (!intel_crtc_needs_modeset(crtc_state))
 +              val |= PIPECONF_ENABLE;
 +
        if (IS_HASWELL(dev_priv) && crtc_state->dither)
                val |= PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP;
  
@@@ -4142,7 -4245,7 +4141,7 @@@ out
        return active;
  }
  
 -static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
 +bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *i915 = to_i915(crtc->base.dev);
@@@ -4876,12 -4979,45 +4875,12 @@@ static int intel_crtc_atomic_check(stru
        return 0;
  }
  
 -static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
 -{
 -      struct intel_connector *connector;
 -      struct drm_connector_list_iter conn_iter;
 -
 -      drm_connector_list_iter_begin(dev, &conn_iter);
 -      for_each_intel_connector_iter(connector, &conn_iter) {
 -              struct drm_connector_state *conn_state = connector->base.state;
 -              struct intel_encoder *encoder =
 -                      to_intel_encoder(connector->base.encoder);
 -
 -              if (conn_state->crtc)
 -                      drm_connector_put(&connector->base);
 -
 -              if (encoder) {
 -                      struct intel_crtc *crtc =
 -                              to_intel_crtc(encoder->base.crtc);
 -                      const struct intel_crtc_state *crtc_state =
 -                              to_intel_crtc_state(crtc->base.state);
 -
 -                      conn_state->best_encoder = &encoder->base;
 -                      conn_state->crtc = &crtc->base;
 -                      conn_state->max_bpc = (crtc_state->pipe_bpp ?: 24) / 3;
 -
 -                      drm_connector_get(&connector->base);
 -              } else {
 -                      conn_state->best_encoder = NULL;
 -                      conn_state->crtc = NULL;
 -              }
 -      }
 -      drm_connector_list_iter_end(&conn_iter);
 -}
 -
  static int
  compute_sink_pipe_bpp(const struct drm_connector_state *conn_state,
 -                    struct intel_crtc_state *pipe_config)
 +                    struct intel_crtc_state *crtc_state)
  {
        struct drm_connector *connector = conn_state->connector;
 -      struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
 +      struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
        const struct drm_display_info *info = &connector->display_info;
        int bpp;
  
                return -EINVAL;
        }
  
 -      if (bpp < pipe_config->pipe_bpp) {
 +      if (bpp < crtc_state->pipe_bpp) {
                drm_dbg_kms(&i915->drm,
 -                          "[CONNECTOR:%d:%s] Limiting display bpp to %d instead of "
 -                          "EDID bpp %d, requested bpp %d, max platform bpp %d\n",
 +                          "[CONNECTOR:%d:%s] Limiting display bpp to %d "
 +                          "(EDID bpp %d, max requested bpp %d, max platform bpp %d)\n",
                            connector->base.id, connector->name,
                            bpp, 3 * info->bpc,
                            3 * conn_state->max_requested_bpc,
 -                          pipe_config->pipe_bpp);
 +                          crtc_state->pipe_bpp);
  
 -              pipe_config->pipe_bpp = bpp;
 +              crtc_state->pipe_bpp = bpp;
        }
  
        return 0;
  }
  
  static int
 -compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 -                        struct intel_crtc_state *pipe_config)
 +compute_baseline_pipe_bpp(struct intel_atomic_state *state,
 +                        struct intel_crtc *crtc)
  {
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      struct drm_atomic_state *state = pipe_config->uapi.state;
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_connector *connector;
        struct drm_connector_state *connector_state;
        int bpp, i;
        else
                bpp = 8*3;
  
 -      pipe_config->pipe_bpp = bpp;
 +      crtc_state->pipe_bpp = bpp;
  
        /* Clamp display bpp to connector max bpp */
 -      for_each_new_connector_in_state(state, connector, connector_state, i) {
 +      for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
                int ret;
  
                if (connector_state->crtc != &crtc->base)
                        continue;
  
 -              ret = compute_sink_pipe_bpp(connector_state, pipe_config);
 +              ret = compute_sink_pipe_bpp(connector_state, crtc_state);
                if (ret)
                        return ret;
        }
        return 0;
  }
  
 -static void intel_dump_crtc_timings(struct drm_i915_private *i915,
 -                                  const struct drm_display_mode *mode)
 -{
 -      drm_dbg_kms(&i915->drm, "crtc timings: %d %d %d %d %d %d %d %d %d, "
 -                  "type: 0x%x flags: 0x%x\n",
 -                  mode->crtc_clock,
 -                  mode->crtc_hdisplay, mode->crtc_hsync_start,
 -                  mode->crtc_hsync_end, mode->crtc_htotal,
 -                  mode->crtc_vdisplay, mode->crtc_vsync_start,
 -                  mode->crtc_vsync_end, mode->crtc_vtotal,
 -                  mode->type, mode->flags);
 -}
 -
 -static void
 -intel_dump_m_n_config(const struct intel_crtc_state *pipe_config,
 -                    const char *id, unsigned int lane_count,
 -                    const struct intel_link_m_n *m_n)
 -{
 -      struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
 -
 -      drm_dbg_kms(&i915->drm,
 -                  "%s: lanes: %i; data_m: %u, data_n: %u, link_m: %u, link_n: %u, tu: %u\n",
 -                  id, lane_count,
 -                  m_n->data_m, m_n->data_n,
 -                  m_n->link_m, m_n->link_n, m_n->tu);
 -}
 -
 -static void
 -intel_dump_infoframe(struct drm_i915_private *dev_priv,
 -                   const union hdmi_infoframe *frame)
 -{
 -      if (!drm_debug_enabled(DRM_UT_KMS))
 -              return;
 -
 -      hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, frame);
 -}
 -
 -static void
 -intel_dump_dp_vsc_sdp(struct drm_i915_private *dev_priv,
 -                    const struct drm_dp_vsc_sdp *vsc)
 -{
 -      if (!drm_debug_enabled(DRM_UT_KMS))
 -              return;
 -
 -      drm_dp_vsc_sdp_log(KERN_DEBUG, dev_priv->drm.dev, vsc);
 -}
 -
 -#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
 -
 -static const char * const output_type_str[] = {
 -      OUTPUT_TYPE(UNUSED),
 -      OUTPUT_TYPE(ANALOG),
 -      OUTPUT_TYPE(DVO),
 -      OUTPUT_TYPE(SDVO),
 -      OUTPUT_TYPE(LVDS),
 -      OUTPUT_TYPE(TVOUT),
 -      OUTPUT_TYPE(HDMI),
 -      OUTPUT_TYPE(DP),
 -      OUTPUT_TYPE(EDP),
 -      OUTPUT_TYPE(DSI),
 -      OUTPUT_TYPE(DDI),
 -      OUTPUT_TYPE(DP_MST),
 -};
 -
 -#undef OUTPUT_TYPE
 -
 -static void snprintf_output_types(char *buf, size_t len,
 -                                unsigned int output_types)
 -{
 -      char *str = buf;
 -      int i;
 -
 -      str[0] = '\0';
 -
 -      for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
 -              int r;
 -
 -              if ((output_types & BIT(i)) == 0)
 -                      continue;
 -
 -              r = snprintf(str, len, "%s%s",
 -                           str != buf ? "," : "", output_type_str[i]);
 -              if (r >= len)
 -                      break;
 -              str += r;
 -              len -= r;
 -
 -              output_types &= ~BIT(i);
 -      }
 -
 -      WARN_ON_ONCE(output_types != 0);
 -}
 -
 -static const char * const output_format_str[] = {
 -      [INTEL_OUTPUT_FORMAT_RGB] = "RGB",
 -      [INTEL_OUTPUT_FORMAT_YCBCR420] = "YCBCR4:2:0",
 -      [INTEL_OUTPUT_FORMAT_YCBCR444] = "YCBCR4:4:4",
 -};
 -
 -static const char *output_formats(enum intel_output_format format)
 -{
 -      if (format >= ARRAY_SIZE(output_format_str))
 -              return "invalid";
 -      return output_format_str[format];
 -}
 -
 -static void intel_dump_plane_state(const struct intel_plane_state *plane_state)
 -{
 -      struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 -      struct drm_i915_private *i915 = to_i915(plane->base.dev);
 -      const struct drm_framebuffer *fb = plane_state->hw.fb;
 -
 -      if (!fb) {
 -              drm_dbg_kms(&i915->drm,
 -                          "[PLANE:%d:%s] fb: [NOFB], visible: %s\n",
 -                          plane->base.base.id, plane->base.name,
 -                          str_yes_no(plane_state->uapi.visible));
 -              return;
 -      }
 -
 -      drm_dbg_kms(&i915->drm,
 -                  "[PLANE:%d:%s] fb: [FB:%d] %ux%u format = %p4cc modifier = 0x%llx, visible: %s\n",
 -                  plane->base.base.id, plane->base.name,
 -                  fb->base.id, fb->width, fb->height, &fb->format->format,
 -                  fb->modifier, str_yes_no(plane_state->uapi.visible));
 -      drm_dbg_kms(&i915->drm, "\trotation: 0x%x, scaler: %d\n",
 -                  plane_state->hw.rotation, plane_state->scaler_id);
 -      if (plane_state->uapi.visible)
 -              drm_dbg_kms(&i915->drm,
 -                          "\tsrc: " DRM_RECT_FP_FMT " dst: " DRM_RECT_FMT "\n",
 -                          DRM_RECT_FP_ARG(&plane_state->uapi.src),
 -                          DRM_RECT_ARG(&plane_state->uapi.dst));
 -}
 -
 -static void intel_dump_pipe_config(const struct intel_crtc_state *pipe_config,
 -                                 struct intel_atomic_state *state,
 -                                 const char *context)
 -{
 -      struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      const struct intel_plane_state *plane_state;
 -      struct intel_plane *plane;
 -      char buf[64];
 -      int i;
 -
 -      drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] enable: %s %s\n",
 -                  crtc->base.base.id, crtc->base.name,
 -                  str_yes_no(pipe_config->hw.enable), context);
 -
 -      if (!pipe_config->hw.enable)
 -              goto dump_planes;
 -
 -      snprintf_output_types(buf, sizeof(buf), pipe_config->output_types);
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "active: %s, output_types: %s (0x%x), output format: %s\n",
 -                  str_yes_no(pipe_config->hw.active),
 -                  buf, pipe_config->output_types,
 -                  output_formats(pipe_config->output_format));
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
 -                  transcoder_name(pipe_config->cpu_transcoder),
 -                  pipe_config->pipe_bpp, pipe_config->dither);
 -
 -      drm_dbg_kms(&dev_priv->drm, "MST master transcoder: %s\n",
 -                  transcoder_name(pipe_config->mst_master_transcoder));
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "port sync: master transcoder: %s, slave transcoder bitmask = 0x%x\n",
 -                  transcoder_name(pipe_config->master_transcoder),
 -                  pipe_config->sync_mode_slaves_mask);
 -
 -      drm_dbg_kms(&dev_priv->drm, "bigjoiner: %s, pipes: 0x%x\n",
 -                  intel_crtc_is_bigjoiner_slave(pipe_config) ? "slave" :
 -                  intel_crtc_is_bigjoiner_master(pipe_config) ? "master" : "no",
 -                  pipe_config->bigjoiner_pipes);
 -
 -      drm_dbg_kms(&dev_priv->drm, "splitter: %s, link count %d, overlap %d\n",
 -                  str_enabled_disabled(pipe_config->splitter.enable),
 -                  pipe_config->splitter.link_count,
 -                  pipe_config->splitter.pixel_overlap);
 -
 -      if (pipe_config->has_pch_encoder)
 -              intel_dump_m_n_config(pipe_config, "fdi",
 -                                    pipe_config->fdi_lanes,
 -                                    &pipe_config->fdi_m_n);
 -
 -      if (intel_crtc_has_dp_encoder(pipe_config)) {
 -              intel_dump_m_n_config(pipe_config, "dp m_n",
 -                                    pipe_config->lane_count,
 -                                    &pipe_config->dp_m_n);
 -              intel_dump_m_n_config(pipe_config, "dp m2_n2",
 -                                    pipe_config->lane_count,
 -                                    &pipe_config->dp_m2_n2);
 -      }
 -
 -      drm_dbg_kms(&dev_priv->drm, "framestart delay: %d, MSA timing delay: %d\n",
 -                  pipe_config->framestart_delay, pipe_config->msa_timing_delay);
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "audio: %i, infoframes: %i, infoframes enabled: 0x%x\n",
 -                  pipe_config->has_audio, pipe_config->has_infoframe,
 -                  pipe_config->infoframes.enable);
 -
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GENERAL_CONTROL))
 -              drm_dbg_kms(&dev_priv->drm, "GCP: 0x%x\n",
 -                          pipe_config->infoframes.gcp);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_AVI))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.avi);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_SPD))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.spd);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_VENDOR))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.hdmi);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.drm);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.drm);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(DP_SDP_VSC))
 -              intel_dump_dp_vsc_sdp(dev_priv, &pipe_config->infoframes.vsc);
 -
 -      drm_dbg_kms(&dev_priv->drm, "vrr: %s, vmin: %d, vmax: %d, pipeline full: %d, guardband: %d flipline: %d, vmin vblank: %d, vmax vblank: %d\n",
 -                  str_yes_no(pipe_config->vrr.enable),
 -                  pipe_config->vrr.vmin, pipe_config->vrr.vmax,
 -                  pipe_config->vrr.pipeline_full, pipe_config->vrr.guardband,
 -                  pipe_config->vrr.flipline,
 -                  intel_vrr_vmin_vblank_start(pipe_config),
 -                  intel_vrr_vmax_vblank_start(pipe_config));
 -
 -      drm_dbg_kms(&dev_priv->drm, "requested mode: " DRM_MODE_FMT "\n",
 -                  DRM_MODE_ARG(&pipe_config->hw.mode));
 -      drm_dbg_kms(&dev_priv->drm, "adjusted mode: " DRM_MODE_FMT "\n",
 -                  DRM_MODE_ARG(&pipe_config->hw.adjusted_mode));
 -      intel_dump_crtc_timings(dev_priv, &pipe_config->hw.adjusted_mode);
 -      drm_dbg_kms(&dev_priv->drm, "pipe mode: " DRM_MODE_FMT "\n",
 -                  DRM_MODE_ARG(&pipe_config->hw.pipe_mode));
 -      intel_dump_crtc_timings(dev_priv, &pipe_config->hw.pipe_mode);
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "port clock: %d, pipe src: " DRM_RECT_FMT ", pixel rate %d\n",
 -                  pipe_config->port_clock, DRM_RECT_ARG(&pipe_config->pipe_src),
 -                  pipe_config->pixel_rate);
 -
 -      drm_dbg_kms(&dev_priv->drm, "linetime: %d, ips linetime: %d\n",
 -                  pipe_config->linetime, pipe_config->ips_linetime);
 -
 -      if (DISPLAY_VER(dev_priv) >= 9)
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "num_scalers: %d, scaler_users: 0x%x, scaler_id: %d\n",
 -                          crtc->num_scalers,
 -                          pipe_config->scaler_state.scaler_users,
 -                          pipe_config->scaler_state.scaler_id);
 -
 -      if (HAS_GMCH(dev_priv))
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n",
 -                          pipe_config->gmch_pfit.control,
 -                          pipe_config->gmch_pfit.pgm_ratios,
 -                          pipe_config->gmch_pfit.lvds_border_bits);
 -      else
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "pch pfit: " DRM_RECT_FMT ", %s, force thru: %s\n",
 -                          DRM_RECT_ARG(&pipe_config->pch_pfit.dst),
 -                          str_enabled_disabled(pipe_config->pch_pfit.enabled),
 -                          str_yes_no(pipe_config->pch_pfit.force_thru));
 -
 -      drm_dbg_kms(&dev_priv->drm, "ips: %i, double wide: %i, drrs: %i\n",
 -                  pipe_config->ips_enabled, pipe_config->double_wide,
 -                  pipe_config->has_drrs);
 -
 -      intel_dpll_dump_hw_state(dev_priv, &pipe_config->dpll_hw_state);
 -
 -      if (IS_CHERRYVIEW(dev_priv))
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "cgm_mode: 0x%x gamma_mode: 0x%x gamma_enable: %d csc_enable: %d\n",
 -                          pipe_config->cgm_mode, pipe_config->gamma_mode,
 -                          pipe_config->gamma_enable, pipe_config->csc_enable);
 -      else
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "csc_mode: 0x%x gamma_mode: 0x%x gamma_enable: %d csc_enable: %d\n",
 -                          pipe_config->csc_mode, pipe_config->gamma_mode,
 -                          pipe_config->gamma_enable, pipe_config->csc_enable);
 -
 -      drm_dbg_kms(&dev_priv->drm, "degamma lut: %d entries, gamma lut: %d entries\n",
 -                  pipe_config->hw.degamma_lut ?
 -                  drm_color_lut_size(pipe_config->hw.degamma_lut) : 0,
 -                  pipe_config->hw.gamma_lut ?
 -                  drm_color_lut_size(pipe_config->hw.gamma_lut) : 0);
 -
 -dump_planes:
 -      if (!state)
 -              return;
 -
 -      for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
 -              if (plane->pipe == crtc->pipe)
 -                      intel_dump_plane_state(plane_state);
 -      }
 -}
 -
  static bool check_digital_port_conflicts(struct intel_atomic_state *state)
  {
        struct drm_device *dev = state->base.dev;
@@@ -5060,6 -5499,27 +5059,6 @@@ intel_crtc_copy_uapi_to_hw_state_modese
        intel_crtc_copy_uapi_to_hw_state_nomodeset(state, crtc);
  }
  
 -static void intel_crtc_copy_hw_to_uapi_state(struct intel_crtc_state *crtc_state)
 -{
 -      if (intel_crtc_is_bigjoiner_slave(crtc_state))
 -              return;
 -
 -      crtc_state->uapi.enable = crtc_state->hw.enable;
 -      crtc_state->uapi.active = crtc_state->hw.active;
 -      drm_WARN_ON(crtc_state->uapi.crtc->dev,
 -                  drm_atomic_set_mode_for_crtc(&crtc_state->uapi, &crtc_state->hw.mode) < 0);
 -
 -      crtc_state->uapi.adjusted_mode = crtc_state->hw.adjusted_mode;
 -      crtc_state->uapi.scaling_filter = crtc_state->hw.scaling_filter;
 -
 -      drm_property_replace_blob(&crtc_state->uapi.degamma_lut,
 -                                crtc_state->hw.degamma_lut);
 -      drm_property_replace_blob(&crtc_state->uapi.gamma_lut,
 -                                crtc_state->hw.gamma_lut);
 -      drm_property_replace_blob(&crtc_state->uapi.ctm,
 -                                crtc_state->hw.ctm);
 -}
 -
  static void
  copy_bigjoiner_crtc_state_nomodeset(struct intel_atomic_state *state,
                                    struct intel_crtc *slave_crtc)
@@@ -5175,39 -5635,40 +5174,39 @@@ intel_crtc_prepare_cleared_state(struc
  
  static int
  intel_modeset_pipe_config(struct intel_atomic_state *state,
 -                        struct intel_crtc_state *pipe_config)
 +                        struct intel_crtc *crtc)
  {
 -      struct drm_crtc *crtc = pipe_config->uapi.crtc;
 -      struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
 +      struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_connector *connector;
        struct drm_connector_state *connector_state;
        int pipe_src_w, pipe_src_h;
        int base_bpp, ret, i;
        bool retry = true;
  
 -      pipe_config->cpu_transcoder =
 -              (enum transcoder) to_intel_crtc(crtc)->pipe;
 +      crtc_state->cpu_transcoder = (enum transcoder) crtc->pipe;
  
 -      pipe_config->framestart_delay = 1;
 +      crtc_state->framestart_delay = 1;
  
        /*
         * Sanitize sync polarity flags based on requested ones. If neither
         * positive or negative polarity is requested, treat this as meaning
         * negative polarity.
         */
 -      if (!(pipe_config->hw.adjusted_mode.flags &
 +      if (!(crtc_state->hw.adjusted_mode.flags &
              (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC)))
 -              pipe_config->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NHSYNC;
 +              crtc_state->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NHSYNC;
  
 -      if (!(pipe_config->hw.adjusted_mode.flags &
 +      if (!(crtc_state->hw.adjusted_mode.flags &
              (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)))
 -              pipe_config->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NVSYNC;
 +              crtc_state->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NVSYNC;
  
 -      ret = compute_baseline_pipe_bpp(to_intel_crtc(crtc),
 -                                      pipe_config);
 +      ret = compute_baseline_pipe_bpp(state, crtc);
        if (ret)
                return ret;
  
 -      base_bpp = pipe_config->pipe_bpp;
 +      base_bpp = crtc_state->pipe_bpp;
  
        /*
         * Determine the real pipe dimensions. Note that stereo modes can
         * computation to clearly distinguish it from the adjusted mode, which
         * can be changed by the connectors in the below retry loop.
         */
 -      drm_mode_get_hv_timing(&pipe_config->hw.mode,
 +      drm_mode_get_hv_timing(&crtc_state->hw.mode,
                               &pipe_src_w, &pipe_src_h);
 -      drm_rect_init(&pipe_config->pipe_src, 0, 0,
 +      drm_rect_init(&crtc_state->pipe_src, 0, 0,
                      pipe_src_w, pipe_src_h);
  
        for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
                struct intel_encoder *encoder =
                        to_intel_encoder(connector_state->best_encoder);
  
 -              if (connector_state->crtc != crtc)
 +              if (connector_state->crtc != &crtc->base)
                        continue;
  
 -              if (!check_single_encoder_cloning(state, to_intel_crtc(crtc), encoder)) {
 +              if (!check_single_encoder_cloning(state, crtc, encoder)) {
                        drm_dbg_kms(&i915->drm,
 -                                  "rejecting invalid cloning configuration\n");
 +                                  "[ENCODER:%d:%s] rejecting invalid cloning configuration\n",
 +                                  encoder->base.base.id, encoder->base.name);
                        return -EINVAL;
                }
  
                 * hooks so that the hooks can use this information safely.
                 */
                if (encoder->compute_output_type)
 -                      pipe_config->output_types |=
 -                              BIT(encoder->compute_output_type(encoder, pipe_config,
 +                      crtc_state->output_types |=
 +                              BIT(encoder->compute_output_type(encoder, crtc_state,
                                                                 connector_state));
                else
 -                      pipe_config->output_types |= BIT(encoder->type);
 +                      crtc_state->output_types |= BIT(encoder->type);
        }
  
  encoder_retry:
        /* Ensure the port clock defaults are reset when retrying. */
 -      pipe_config->port_clock = 0;
 -      pipe_config->pixel_multiplier = 1;
 +      crtc_state->port_clock = 0;
 +      crtc_state->pixel_multiplier = 1;
  
        /* Fill in default crtc timings, allow encoders to overwrite them. */
 -      drm_mode_set_crtcinfo(&pipe_config->hw.adjusted_mode,
 +      drm_mode_set_crtcinfo(&crtc_state->hw.adjusted_mode,
                              CRTC_STEREO_DOUBLE);
  
        /* Pass our mode to the connectors and the CRTC to give them a chance to
                struct intel_encoder *encoder =
                        to_intel_encoder(connector_state->best_encoder);
  
 -              if (connector_state->crtc != crtc)
 +              if (connector_state->crtc != &crtc->base)
                        continue;
  
 -              ret = encoder->compute_config(encoder, pipe_config,
 +              ret = encoder->compute_config(encoder, crtc_state,
                                              connector_state);
                if (ret == -EDEADLK)
                        return ret;
                if (ret < 0) {
 -                      drm_dbg_kms(&i915->drm, "Encoder config failure: %d\n", ret);
 +                      drm_dbg_kms(&i915->drm, "[ENCODER:%d:%s] config failure: %d\n",
 +                                  encoder->base.base.id, encoder->base.name, ret);
                        return ret;
                }
        }
  
        /* Set default port clock if not overwritten by the encoder. Needs to be
         * done afterwards in case the encoder adjusts the mode. */
 -      if (!pipe_config->port_clock)
 -              pipe_config->port_clock = pipe_config->hw.adjusted_mode.crtc_clock
 -                      * pipe_config->pixel_multiplier;
 +      if (!crtc_state->port_clock)
 +              crtc_state->port_clock = crtc_state->hw.adjusted_mode.crtc_clock
 +                      * crtc_state->pixel_multiplier;
  
 -      ret = intel_crtc_compute_config(to_intel_crtc(crtc), pipe_config);
 +      ret = intel_crtc_compute_config(state, crtc);
        if (ret == -EDEADLK)
                return ret;
        if (ret == -EAGAIN) {
                if (drm_WARN(&i915->drm, !retry,
 -                           "loop in pipe configuration computation\n"))
 +                           "[CRTC:%d:%s] loop in pipe configuration computation\n",
 +                           crtc->base.base.id, crtc->base.name))
                        return -EINVAL;
  
 -              drm_dbg_kms(&i915->drm, "CRTC bw constrained, retrying\n");
 +              drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] bw constrained, retrying\n",
 +                          crtc->base.base.id, crtc->base.name);
                retry = false;
                goto encoder_retry;
        }
        if (ret < 0) {
 -              drm_dbg_kms(&i915->drm, "CRTC config failure: %d\n", ret);
 +              drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] config failure: %d\n",
 +                          crtc->base.base.id, crtc->base.name, ret);
                return ret;
        }
  
         * only enable it on 6bpc panels and when its not a compliance
         * test requesting 6bpc video pattern.
         */
 -      pipe_config->dither = (pipe_config->pipe_bpp == 6*3) &&
 -              !pipe_config->dither_force_disable;
 +      crtc_state->dither = (crtc_state->pipe_bpp == 6*3) &&
 +              !crtc_state->dither_force_disable;
        drm_dbg_kms(&i915->drm,
 -                  "hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
 -                  base_bpp, pipe_config->pipe_bpp, pipe_config->dither);
 +                  "[CRTC:%d:%s] hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
 +                  crtc->base.base.id, crtc->base.name,
 +                  base_bpp, crtc_state->pipe_bpp, crtc_state->dither);
  
        return 0;
  }
  
  static int
 -intel_modeset_pipe_config_late(struct intel_crtc_state *crtc_state)
 +intel_modeset_pipe_config_late(struct intel_atomic_state *state,
 +                             struct intel_crtc *crtc)
  {
 -      struct intel_atomic_state *state =
 -              to_intel_atomic_state(crtc_state->uapi.state);
 -      struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_connector_state *conn_state;
        struct drm_connector *connector;
        int i;
@@@ -5515,7 -5970,7 +5514,7 @@@ static bool fastboot_enabled(struct drm
        return false;
  }
  
 -static bool
 +bool
  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
                          const struct intel_crtc_state *pipe_config,
                          bool fastset)
        } \
  } while (0)
  
 +#define PIPE_CONF_CHECK_TIMINGS(name) do { \
 +      PIPE_CONF_CHECK_I(name.crtc_hdisplay); \
 +      PIPE_CONF_CHECK_I(name.crtc_htotal); \
 +      PIPE_CONF_CHECK_I(name.crtc_hblank_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_hblank_end); \
 +      PIPE_CONF_CHECK_I(name.crtc_hsync_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_hsync_end); \
 +      PIPE_CONF_CHECK_I(name.crtc_vdisplay); \
 +      PIPE_CONF_CHECK_I(name.crtc_vtotal); \
 +      PIPE_CONF_CHECK_I(name.crtc_vblank_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_vblank_end); \
 +      PIPE_CONF_CHECK_I(name.crtc_vsync_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_vsync_end); \
 +} while (0)
 +
 +#define PIPE_CONF_CHECK_RECT(name) do { \
 +      PIPE_CONF_CHECK_I(name.x1); \
 +      PIPE_CONF_CHECK_I(name.x2); \
 +      PIPE_CONF_CHECK_I(name.y1); \
 +      PIPE_CONF_CHECK_I(name.y2); \
 +} while (0)
 +
  /* This is required for BDW+ where there is only one set of registers for
   * switching between high and low RR.
   * This macro can be used whenever a comparison has to be made between one
  #define PIPE_CONF_QUIRK(quirk) \
        ((current_config->quirks | pipe_config->quirks) & (quirk))
  
 +      PIPE_CONF_CHECK_I(hw.enable);
 +      PIPE_CONF_CHECK_I(hw.active);
 +
        PIPE_CONF_CHECK_I(cpu_transcoder);
 +      PIPE_CONF_CHECK_I(mst_master_transcoder);
  
        PIPE_CONF_CHECK_BOOL(has_pch_encoder);
        PIPE_CONF_CHECK_I(fdi_lanes);
        PIPE_CONF_CHECK_I(framestart_delay);
        PIPE_CONF_CHECK_I(msa_timing_delay);
  
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hdisplay);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_htotal);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_end);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_end);
 -
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vdisplay);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vtotal);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_end);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_end);
 -
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
 -
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
 +      PIPE_CONF_CHECK_TIMINGS(hw.pipe_mode);
 +      PIPE_CONF_CHECK_TIMINGS(hw.adjusted_mode);
  
        PIPE_CONF_CHECK_I(pixel_multiplier);
  
        PIPE_CONF_CHECK_BOOL(pch_pfit.force_thru);
  
        if (!fastset) {
 -              PIPE_CONF_CHECK_I(pipe_src.x1);
 -              PIPE_CONF_CHECK_I(pipe_src.y1);
 -              PIPE_CONF_CHECK_I(pipe_src.x2);
 -              PIPE_CONF_CHECK_I(pipe_src.y2);
 +              PIPE_CONF_CHECK_RECT(pipe_src);
  
                PIPE_CONF_CHECK_BOOL(pch_pfit.enabled);
 -              if (current_config->pch_pfit.enabled) {
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.x1);
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.y1);
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.x2);
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.y2);
 -              }
 +              PIPE_CONF_CHECK_RECT(pch_pfit.dst);
  
                PIPE_CONF_CHECK_I(scaler_state.scaler_id);
                PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate);
        PIPE_CONF_CHECK_I(splitter.link_count);
        PIPE_CONF_CHECK_I(splitter.pixel_overlap);
  
 -      PIPE_CONF_CHECK_I(mst_master_transcoder);
 -
        PIPE_CONF_CHECK_BOOL(vrr.enable);
        PIPE_CONF_CHECK_I(vrr.vmin);
        PIPE_CONF_CHECK_I(vrr.vmax);
  #undef PIPE_CONF_CHECK_FLAGS
  #undef PIPE_CONF_CHECK_CLOCK_FUZZY
  #undef PIPE_CONF_CHECK_COLOR_LUT
 +#undef PIPE_CONF_CHECK_TIMINGS
 +#undef PIPE_CONF_CHECK_RECT
  #undef PIPE_CONF_QUIRK
  
        return ret;
  }
  
 -static void intel_pipe_config_sanity_check(struct drm_i915_private *dev_priv,
 -                                         const struct intel_crtc_state *pipe_config)
 -{
 -      if (pipe_config->has_pch_encoder) {
 -              int fdi_dotclock = intel_dotclock_calculate(intel_fdi_link_freq(dev_priv, pipe_config),
 -                                                          &pipe_config->fdi_m_n);
 -              int dotclock = pipe_config->hw.adjusted_mode.crtc_clock;
 -
 -              /*
 -               * FDI already provided one idea for the dotclock.
 -               * Yell if the encoder disagrees.
 -               */
 -              drm_WARN(&dev_priv->drm,
 -                       !intel_fuzzy_clock_check(fdi_dotclock, dotclock),
 -                       "FDI dotclock and encoder dotclock mismatch, fdi: %i, encoder: %i\n",
 -                       fdi_dotclock, dotclock);
 -      }
 -}
 -
 -static void verify_wm_state(struct intel_crtc *crtc,
 -                          struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      struct skl_hw_state {
 -              struct skl_ddb_entry ddb[I915_MAX_PLANES];
 -              struct skl_ddb_entry ddb_y[I915_MAX_PLANES];
 -              struct skl_pipe_wm wm;
 -      } *hw;
 -      const struct skl_pipe_wm *sw_wm = &new_crtc_state->wm.skl.optimal;
 -      int level, max_level = ilk_wm_max_level(dev_priv);
 -      struct intel_plane *plane;
 -      u8 hw_enabled_slices;
 -
 -      if (DISPLAY_VER(dev_priv) < 9 || !new_crtc_state->hw.active)
 -              return;
 -
 -      hw = kzalloc(sizeof(*hw), GFP_KERNEL);
 -      if (!hw)
 -              return;
 -
 -      skl_pipe_wm_get_hw_state(crtc, &hw->wm);
 -
 -      skl_pipe_ddb_get_hw_state(crtc, hw->ddb, hw->ddb_y);
 -
 -      hw_enabled_slices = intel_enabled_dbuf_slices_mask(dev_priv);
 -
 -      if (DISPLAY_VER(dev_priv) >= 11 &&
 -          hw_enabled_slices != dev_priv->dbuf.enabled_slices)
 -              drm_err(&dev_priv->drm,
 -                      "mismatch in DBUF Slices (expected 0x%x, got 0x%x)\n",
 -                      dev_priv->dbuf.enabled_slices,
 -                      hw_enabled_slices);
 -
 -      for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
 -              const struct skl_ddb_entry *hw_ddb_entry, *sw_ddb_entry;
 -              const struct skl_wm_level *hw_wm_level, *sw_wm_level;
 -
 -              /* Watermarks */
 -              for (level = 0; level <= max_level; level++) {
 -                      hw_wm_level = &hw->wm.planes[plane->id].wm[level];
 -                      sw_wm_level = skl_plane_wm_level(sw_wm, plane->id, level);
 -
 -                      if (skl_wm_level_equals(hw_wm_level, sw_wm_level))
 -                              continue;
 -
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in WM%d (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name, level,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              hw_wm_level = &hw->wm.planes[plane->id].trans_wm;
 -              sw_wm_level = skl_plane_trans_wm(sw_wm, plane->id);
 -
 -              if (!skl_wm_level_equals(hw_wm_level, sw_wm_level)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in trans WM (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              hw_wm_level = &hw->wm.planes[plane->id].sagv.wm0;
 -              sw_wm_level = &sw_wm->planes[plane->id].sagv.wm0;
 -
 -              if (HAS_HW_SAGV_WM(dev_priv) &&
 -                  !skl_wm_level_equals(hw_wm_level, sw_wm_level)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in SAGV WM (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              hw_wm_level = &hw->wm.planes[plane->id].sagv.trans_wm;
 -              sw_wm_level = &sw_wm->planes[plane->id].sagv.trans_wm;
 -
 -              if (HAS_HW_SAGV_WM(dev_priv) &&
 -                  !skl_wm_level_equals(hw_wm_level, sw_wm_level)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in SAGV trans WM (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              /* DDB */
 -              hw_ddb_entry = &hw->ddb[PLANE_CURSOR];
 -              sw_ddb_entry = &new_crtc_state->wm.skl.plane_ddb[PLANE_CURSOR];
 -
 -              if (!skl_ddb_entry_equal(hw_ddb_entry, sw_ddb_entry)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in DDB (expected (%u,%u), found (%u,%u))\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_ddb_entry->start, sw_ddb_entry->end,
 -                              hw_ddb_entry->start, hw_ddb_entry->end);
 -              }
 -      }
 -
 -      kfree(hw);
 -}
 -
 -static void
 -verify_connector_state(struct intel_atomic_state *state,
 -                     struct intel_crtc *crtc)
 -{
 -      struct drm_connector *connector;
 -      struct drm_connector_state *new_conn_state;
 -      int i;
 -
 -      for_each_new_connector_in_state(&state->base, connector, new_conn_state, i) {
 -              struct drm_encoder *encoder = connector->encoder;
 -              struct intel_crtc_state *crtc_state = NULL;
 -
 -              if (new_conn_state->crtc != &crtc->base)
 -                      continue;
 -
 -              if (crtc)
 -                      crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
 -
 -              intel_connector_verify_state(crtc_state, new_conn_state);
 -
 -              I915_STATE_WARN(new_conn_state->best_encoder != encoder,
 -                   "connector's atomic encoder doesn't match legacy encoder\n");
 -      }
 -}
 -
 -static void
 -verify_encoder_state(struct drm_i915_private *dev_priv, struct intel_atomic_state *state)
 -{
 -      struct intel_encoder *encoder;
 -      struct drm_connector *connector;
 -      struct drm_connector_state *old_conn_state, *new_conn_state;
 -      int i;
 -
 -      for_each_intel_encoder(&dev_priv->drm, encoder) {
 -              bool enabled = false, found = false;
 -              enum pipe pipe;
 -
 -              drm_dbg_kms(&dev_priv->drm, "[ENCODER:%d:%s]\n",
 -                          encoder->base.base.id,
 -                          encoder->base.name);
 -
 -              for_each_oldnew_connector_in_state(&state->base, connector, old_conn_state,
 -                                                 new_conn_state, i) {
 -                      if (old_conn_state->best_encoder == &encoder->base)
 -                              found = true;
 -
 -                      if (new_conn_state->best_encoder != &encoder->base)
 -                              continue;
 -                      found = enabled = true;
 -
 -                      I915_STATE_WARN(new_conn_state->crtc !=
 -                                      encoder->base.crtc,
 -                           "connector's crtc doesn't match encoder crtc\n");
 -              }
 -
 -              if (!found)
 -                      continue;
 -
 -              I915_STATE_WARN(!!encoder->base.crtc != enabled,
 -                   "encoder's enabled state mismatch "
 -                   "(expected %i, found %i)\n",
 -                   !!encoder->base.crtc, enabled);
 -
 -              if (!encoder->base.crtc) {
 -                      bool active;
 -
 -                      active = encoder->get_hw_state(encoder, &pipe);
 -                      I915_STATE_WARN(active,
 -                           "encoder detached but still enabled on pipe %c.\n",
 -                           pipe_name(pipe));
 -              }
 -      }
 -}
 -
 -static void
 -verify_crtc_state(struct intel_crtc *crtc,
 -                struct intel_crtc_state *old_crtc_state,
 -                struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_device *dev = crtc->base.dev;
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_encoder *encoder;
 -      struct intel_crtc_state *pipe_config = old_crtc_state;
 -      struct drm_atomic_state *state = old_crtc_state->uapi.state;
 -      struct intel_crtc *master_crtc;
 -
 -      __drm_atomic_helper_crtc_destroy_state(&old_crtc_state->uapi);
 -      intel_crtc_free_hw_state(old_crtc_state);
 -      intel_crtc_state_reset(old_crtc_state, crtc);
 -      old_crtc_state->uapi.state = state;
 -
 -      drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s]\n", crtc->base.base.id,
 -                  crtc->base.name);
 -
 -      pipe_config->hw.enable = new_crtc_state->hw.enable;
 -
 -      intel_crtc_get_pipe_config(pipe_config);
 -
 -      /* we keep both pipes enabled on 830 */
 -      if (IS_I830(dev_priv) && pipe_config->hw.active)
 -              pipe_config->hw.active = new_crtc_state->hw.active;
 -
 -      I915_STATE_WARN(new_crtc_state->hw.active != pipe_config->hw.active,
 -                      "crtc active state doesn't match with hw state "
 -                      "(expected %i, found %i)\n",
 -                      new_crtc_state->hw.active, pipe_config->hw.active);
 -
 -      I915_STATE_WARN(crtc->active != new_crtc_state->hw.active,
 -                      "transitional active state does not match atomic hw state "
 -                      "(expected %i, found %i)\n",
 -                      new_crtc_state->hw.active, crtc->active);
 -
 -      master_crtc = intel_master_crtc(new_crtc_state);
 -
 -      for_each_encoder_on_crtc(dev, &master_crtc->base, encoder) {
 -              enum pipe pipe;
 -              bool active;
 -
 -              active = encoder->get_hw_state(encoder, &pipe);
 -              I915_STATE_WARN(active != new_crtc_state->hw.active,
 -                              "[ENCODER:%i] active %i with crtc active %i\n",
 -                              encoder->base.base.id, active,
 -                              new_crtc_state->hw.active);
 -
 -              I915_STATE_WARN(active && master_crtc->pipe != pipe,
 -                              "Encoder connected to wrong pipe %c\n",
 -                              pipe_name(pipe));
 -
 -              if (active)
 -                      intel_encoder_get_config(encoder, pipe_config);
 -      }
 -
 -      if (!new_crtc_state->hw.active)
 -              return;
 -
 -      intel_pipe_config_sanity_check(dev_priv, pipe_config);
 -
 -      if (!intel_pipe_config_compare(new_crtc_state,
 -                                     pipe_config, false)) {
 -              I915_STATE_WARN(1, "pipe state doesn't match!\n");
 -              intel_dump_pipe_config(pipe_config, NULL, "[hw state]");
 -              intel_dump_pipe_config(new_crtc_state, NULL, "[sw state]");
 -      }
 -}
 -
  static void
  intel_verify_planes(struct intel_atomic_state *state)
  {
                             plane_state->uapi.visible);
  }
  
 -static void
 -verify_single_dpll_state(struct drm_i915_private *dev_priv,
 -                       struct intel_shared_dpll *pll,
 -                       struct intel_crtc *crtc,
 -                       struct intel_crtc_state *new_crtc_state)
 -{
 -      struct intel_dpll_hw_state dpll_hw_state;
 -      u8 pipe_mask;
 -      bool active;
 -
 -      memset(&dpll_hw_state, 0, sizeof(dpll_hw_state));
 -
 -      drm_dbg_kms(&dev_priv->drm, "%s\n", pll->info->name);
 -
 -      active = intel_dpll_get_hw_state(dev_priv, pll, &dpll_hw_state);
 -
 -      if (!(pll->info->flags & INTEL_DPLL_ALWAYS_ON)) {
 -              I915_STATE_WARN(!pll->on && pll->active_mask,
 -                   "pll in active use but not on in sw tracking\n");
 -              I915_STATE_WARN(pll->on && !pll->active_mask,
 -                   "pll is on but not used by any active pipe\n");
 -              I915_STATE_WARN(pll->on != active,
 -                   "pll on state mismatch (expected %i, found %i)\n",
 -                   pll->on, active);
 -      }
 -
 -      if (!crtc) {
 -              I915_STATE_WARN(pll->active_mask & ~pll->state.pipe_mask,
 -                              "more active pll users than references: 0x%x vs 0x%x\n",
 -                              pll->active_mask, pll->state.pipe_mask);
 -
 -              return;
 -      }
 -
 -      pipe_mask = BIT(crtc->pipe);
 -
 -      if (new_crtc_state->hw.active)
 -              I915_STATE_WARN(!(pll->active_mask & pipe_mask),
 -                              "pll active mismatch (expected pipe %c in active mask 0x%x)\n",
 -                              pipe_name(crtc->pipe), pll->active_mask);
 -      else
 -              I915_STATE_WARN(pll->active_mask & pipe_mask,
 -                              "pll active mismatch (didn't expect pipe %c in active mask 0x%x)\n",
 -                              pipe_name(crtc->pipe), pll->active_mask);
 -
 -      I915_STATE_WARN(!(pll->state.pipe_mask & pipe_mask),
 -                      "pll enabled crtcs mismatch (expected 0x%x in 0x%x)\n",
 -                      pipe_mask, pll->state.pipe_mask);
 -
 -      I915_STATE_WARN(pll->on && memcmp(&pll->state.hw_state,
 -                                        &dpll_hw_state,
 -                                        sizeof(dpll_hw_state)),
 -                      "pll hw state mismatch\n");
 -}
 -
 -static void
 -verify_shared_dpll_state(struct intel_crtc *crtc,
 -                       struct intel_crtc_state *old_crtc_state,
 -                       struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -
 -      if (new_crtc_state->shared_dpll)
 -              verify_single_dpll_state(dev_priv, new_crtc_state->shared_dpll, crtc, new_crtc_state);
 -
 -      if (old_crtc_state->shared_dpll &&
 -          old_crtc_state->shared_dpll != new_crtc_state->shared_dpll) {
 -              u8 pipe_mask = BIT(crtc->pipe);
 -              struct intel_shared_dpll *pll = old_crtc_state->shared_dpll;
 -
 -              I915_STATE_WARN(pll->active_mask & pipe_mask,
 -                              "pll active mismatch (didn't expect pipe %c in active mask (0x%x))\n",
 -                              pipe_name(crtc->pipe), pll->active_mask);
 -              I915_STATE_WARN(pll->state.pipe_mask & pipe_mask,
 -                              "pll enabled crtcs mismatch (found %x in enabled mask (0x%x))\n",
 -                              pipe_name(crtc->pipe), pll->state.pipe_mask);
 -      }
 -}
 -
 -static void
 -verify_mpllb_state(struct intel_atomic_state *state,
 -                 struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_i915_private *i915 = to_i915(state->base.dev);
 -      struct intel_mpllb_state mpllb_hw_state = { 0 };
 -      struct intel_mpllb_state *mpllb_sw_state = &new_crtc_state->mpllb_state;
 -      struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
 -      struct intel_encoder *encoder;
 -
 -      if (!IS_DG2(i915))
 -              return;
 -
 -      if (!new_crtc_state->hw.active)
 -              return;
 -
 -      encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
 -      intel_mpllb_readout_hw_state(encoder, &mpllb_hw_state);
 -
 -#define MPLLB_CHECK(name) do { \
 -      if (mpllb_sw_state->name != mpllb_hw_state.name) { \
 -              pipe_config_mismatch(false, crtc, "MPLLB:" __stringify(name), \
 -                                   "(expected 0x%08x, found 0x%08x)", \
 -                                   mpllb_sw_state->name, \
 -                                   mpllb_hw_state.name); \
 -      } \
 -} while (0)
 -
 -      MPLLB_CHECK(mpllb_cp);
 -      MPLLB_CHECK(mpllb_div);
 -      MPLLB_CHECK(mpllb_div2);
 -      MPLLB_CHECK(mpllb_fracn1);
 -      MPLLB_CHECK(mpllb_fracn2);
 -      MPLLB_CHECK(mpllb_sscen);
 -      MPLLB_CHECK(mpllb_sscstep);
 -
 -      /*
 -       * ref_control is handled by the hardware/firemware and never
 -       * programmed by the software, but the proper values are supplied
 -       * in the bspec for verification purposes.
 -       */
 -      MPLLB_CHECK(ref_control);
 -
 -#undef MPLLB_CHECK
 -}
 -
 -static void
 -intel_modeset_verify_crtc(struct intel_crtc *crtc,
 -                        struct intel_atomic_state *state,
 -                        struct intel_crtc_state *old_crtc_state,
 -                        struct intel_crtc_state *new_crtc_state)
 -{
 -      if (!intel_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->update_pipe)
 -              return;
 -
 -      verify_wm_state(crtc, new_crtc_state);
 -      verify_connector_state(state, crtc);
 -      verify_crtc_state(crtc, old_crtc_state, new_crtc_state);
 -      verify_shared_dpll_state(crtc, old_crtc_state, new_crtc_state);
 -      verify_mpllb_state(state, new_crtc_state);
 -}
 -
 -static void
 -verify_disabled_dpll_state(struct drm_i915_private *dev_priv)
 -{
 -      int i;
 -
 -      for (i = 0; i < dev_priv->dpll.num_shared_dpll; i++)
 -              verify_single_dpll_state(dev_priv,
 -                                       &dev_priv->dpll.shared_dplls[i],
 -                                       NULL, NULL);
 -}
 -
 -static void
 -intel_modeset_verify_disabled(struct drm_i915_private *dev_priv,
 -                            struct intel_atomic_state *state)
 -{
 -      verify_encoder_state(dev_priv, state);
 -      verify_connector_state(state, NULL);
 -      verify_disabled_dpll_state(dev_priv);
 -}
 -
  int intel_modeset_all_pipes(struct intel_atomic_state *state)
  {
        struct drm_i915_private *dev_priv = to_i915(state->base.dev);
        return 0;
  }
  
 -static void
 -intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state)
 +void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@@ -6824,7 -7732,7 +6823,7 @@@ static int intel_atomic_check(struct dr
                if (!new_crtc_state->hw.enable)
                        continue;
  
 -              ret = intel_modeset_pipe_config(state, new_crtc_state);
 +              ret = intel_modeset_pipe_config(state, crtc);
                if (ret)
                        goto fail;
  
                if (!intel_crtc_needs_modeset(new_crtc_state))
                        continue;
  
 -              ret = intel_modeset_pipe_config_late(new_crtc_state);
 +              ret = intel_modeset_pipe_config_late(state, crtc);
                if (ret)
                        goto fail;
  
                    !new_crtc_state->update_pipe)
                        continue;
  
 -              intel_dump_pipe_config(new_crtc_state, state,
 -                                     intel_crtc_needs_modeset(new_crtc_state) ?
 -                                     "[modeset]" : "[fastset]");
 +              intel_crtc_state_dump(new_crtc_state, state,
 +                                    intel_crtc_needs_modeset(new_crtc_state) ?
 +                                    "modeset" : "fastset");
        }
  
        return 0;
         */
        for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
                                            new_crtc_state, i)
 -              intel_dump_pipe_config(new_crtc_state, state, "[failed]");
 +              intel_crtc_state_dump(new_crtc_state, state, "failed");
  
        return ret;
  }
@@@ -7543,7 -8451,7 +7542,7 @@@ static void intel_atomic_commit_tail(st
                                            new_crtc_state, i) {
                if (intel_crtc_needs_modeset(new_crtc_state) ||
                    new_crtc_state->update_pipe) {
 -                      modeset_get_crtc_power_domains(new_crtc_state, &put_domains[crtc->pipe]);
 +                      intel_modeset_get_crtc_power_domains(new_crtc_state, &put_domains[crtc->pipe]);
                }
        }
  
        for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
                intel_post_plane_update(state, crtc);
  
 -              modeset_put_crtc_power_domains(crtc, &put_domains[crtc->pipe]);
 +              intel_modeset_put_crtc_power_domains(crtc, &put_domains[crtc->pipe]);
  
                intel_modeset_verify_crtc(crtc, state, old_crtc_state, new_crtc_state);
  
@@@ -8780,7 -9688,7 +8779,7 @@@ int intel_modeset_init_nogem(struct drm
        intel_setup_outputs(i915);
  
        drm_modeset_lock_all(dev);
 -      intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx);
 +      intel_modeset_setup_hw_state(i915, dev->mode_config.acquire_ctx);
        intel_acpi_assign_connector_fwnodes(i915);
        drm_modeset_unlock_all(dev);
  
@@@ -8933,17 -9841,580 +8932,17 @@@ void i830_disable_pipe(struct drm_i915_
        intel_de_posting_read(dev_priv, DPLL(pipe));
  }
  
 -static void
 -intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv)
 -{
 -      struct intel_crtc *crtc;
 -
 -      if (DISPLAY_VER(dev_priv) >= 4)
 -              return;
 -
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_plane *plane =
 -                      to_intel_plane(crtc->base.primary);
 -              struct intel_crtc *plane_crtc;
 -              enum pipe pipe;
 -
 -              if (!plane->get_hw_state(plane, &pipe))
 -                      continue;
 -
 -              if (pipe == crtc->pipe)
 -                      continue;
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[PLANE:%d:%s] attached to the wrong pipe, disabling plane\n",
 -                          plane->base.base.id, plane->base.name);
 -
 -              plane_crtc = intel_crtc_for_pipe(dev_priv, pipe);
 -              intel_plane_disable_noatomic(plane_crtc, plane);
 -      }
 -}
 -
 -static bool intel_crtc_has_encoders(struct intel_crtc *crtc)
 -{
 -      struct drm_device *dev = crtc->base.dev;
 -      struct intel_encoder *encoder;
 -
 -      for_each_encoder_on_crtc(dev, &crtc->base, encoder)
 -              return true;
 -
 -      return false;
 -}
 -
 -static struct intel_connector *intel_encoder_find_connector(struct intel_encoder *encoder)
 -{
 -      struct drm_device *dev = encoder->base.dev;
 -      struct intel_connector *connector;
 -
 -      for_each_connector_on_encoder(dev, &encoder->base, connector)
 -              return connector;
 -
 -      return NULL;
 -}
 -
 -static void intel_sanitize_crtc(struct intel_crtc *crtc,
 -                              struct drm_modeset_acquire_ctx *ctx)
 -{
 -      struct drm_device *dev = crtc->base.dev;
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_crtc_state *crtc_state = to_intel_crtc_state(crtc->base.state);
 -
 -      if (crtc_state->hw.active) {
 -              struct intel_plane *plane;
 -
 -              /* Disable everything but the primary plane */
 -              for_each_intel_plane_on_crtc(dev, crtc, plane) {
 -                      const struct intel_plane_state *plane_state =
 -                              to_intel_plane_state(plane->base.state);
 -
 -                      if (plane_state->uapi.visible &&
 -                          plane->base.type != DRM_PLANE_TYPE_PRIMARY)
 -                              intel_plane_disable_noatomic(crtc, plane);
 -              }
 -
 -              /* Disable any background color/etc. set by the BIOS */
 -              intel_color_commit_noarm(crtc_state);
 -              intel_color_commit_arm(crtc_state);
 -      }
 -
 -      /* Adjust the state of the output pipe according to whether we
 -       * have active connectors/encoders. */
 -      if (crtc_state->hw.active && !intel_crtc_has_encoders(crtc) &&
 -          !intel_crtc_is_bigjoiner_slave(crtc_state))
 -              intel_crtc_disable_noatomic(crtc, ctx);
 -
 -      if (crtc_state->hw.active || HAS_GMCH(dev_priv)) {
 -              /*
 -               * We start out with underrun reporting disabled to avoid races.
 -               * For correct bookkeeping mark this on active crtcs.
 -               *
 -               * Also on gmch platforms we dont have any hardware bits to
 -               * disable the underrun reporting. Which means we need to start
 -               * out with underrun reporting disabled also on inactive pipes,
 -               * since otherwise we'll complain about the garbage we read when
 -               * e.g. coming up after runtime pm.
 -               *
 -               * No protection against concurrent access is required - at
 -               * worst a fifo underrun happens which also sets this to false.
 -               */
 -              crtc->cpu_fifo_underrun_disabled = true;
 -              /*
 -               * We track the PCH trancoder underrun reporting state
 -               * within the crtc. With crtc for pipe A housing the underrun
 -               * reporting state for PCH transcoder A, crtc for pipe B housing
 -               * it for PCH transcoder B, etc. LPT-H has only PCH transcoder A,
 -               * and marking underrun reporting as disabled for the non-existing
 -               * PCH transcoders B and C would prevent enabling the south
 -               * error interrupt (see cpt_can_enable_serr_int()).
 -               */
 -              if (intel_has_pch_trancoder(dev_priv, crtc->pipe))
 -                      crtc->pch_fifo_underrun_disabled = true;
 -      }
 -}
 -
 -static bool has_bogus_dpll_config(const struct intel_crtc_state *crtc_state)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
 -
 -      /*
 -       * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram
 -       * the hardware when a high res displays plugged in. DPLL P
 -       * divider is zero, and the pipe timings are bonkers. We'll
 -       * try to disable everything in that case.
 -       *
 -       * FIXME would be nice to be able to sanitize this state
 -       * without several WARNs, but for now let's take the easy
 -       * road.
 -       */
 -      return IS_SANDYBRIDGE(dev_priv) &&
 -              crtc_state->hw.active &&
 -              crtc_state->shared_dpll &&
 -              crtc_state->port_clock == 0;
 -}
 -
 -static void intel_sanitize_encoder(struct intel_encoder *encoder)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 -      struct intel_connector *connector;
 -      struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
 -      struct intel_crtc_state *crtc_state = crtc ?
 -              to_intel_crtc_state(crtc->base.state) : NULL;
 -
 -      /* We need to check both for a crtc link (meaning that the
 -       * encoder is active and trying to read from a pipe) and the
 -       * pipe itself being active. */
 -      bool has_active_crtc = crtc_state &&
 -              crtc_state->hw.active;
 -
 -      if (crtc_state && has_bogus_dpll_config(crtc_state)) {
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "BIOS has misprogrammed the hardware. Disabling pipe %c\n",
 -                          pipe_name(crtc->pipe));
 -              has_active_crtc = false;
 -      }
 -
 -      connector = intel_encoder_find_connector(encoder);
 -      if (connector && !has_active_crtc) {
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[ENCODER:%d:%s] has active connectors but no active pipe!\n",
 -                          encoder->base.base.id,
 -                          encoder->base.name);
 -
 -              /* Connector is active, but has no active pipe. This is
 -               * fallout from our resume register restoring. Disable
 -               * the encoder manually again. */
 -              if (crtc_state) {
 -                      struct drm_encoder *best_encoder;
 -
 -                      drm_dbg_kms(&dev_priv->drm,
 -                                  "[ENCODER:%d:%s] manually disabled\n",
 -                                  encoder->base.base.id,
 -                                  encoder->base.name);
 -
 -                      /* avoid oopsing in case the hooks consult best_encoder */
 -                      best_encoder = connector->base.state->best_encoder;
 -                      connector->base.state->best_encoder = &encoder->base;
 -
 -                      /* FIXME NULL atomic state passed! */
 -                      if (encoder->disable)
 -                              encoder->disable(NULL, encoder, crtc_state,
 -                                               connector->base.state);
 -                      if (encoder->post_disable)
 -                              encoder->post_disable(NULL, encoder, crtc_state,
 -                                                    connector->base.state);
 -
 -                      connector->base.state->best_encoder = best_encoder;
 -              }
 -              encoder->base.crtc = NULL;
 -
 -              /* Inconsistent output/port/pipe state happens presumably due to
 -               * a bug in one of the get_hw_state functions. Or someplace else
 -               * in our code, like the register restore mess on resume. Clamp
 -               * things to off as a safer default. */
 -
 -              connector->base.dpms = DRM_MODE_DPMS_OFF;
 -              connector->base.encoder = NULL;
 -      }
 -
 -      /* notify opregion of the sanitized encoder state */
 -      intel_opregion_notify_encoder(encoder, connector && has_active_crtc);
 -
 -      if (HAS_DDI(dev_priv))
 -              intel_ddi_sanitize_encoder_pll_mapping(encoder);
 -}
 -
 -/* FIXME read out full plane state for all planes */
 -static void readout_plane_state(struct drm_i915_private *dev_priv)
 -{
 -      struct intel_plane *plane;
 -      struct intel_crtc *crtc;
 -
 -      for_each_intel_plane(&dev_priv->drm, plane) {
 -              struct intel_plane_state *plane_state =
 -                      to_intel_plane_state(plane->base.state);
 -              struct intel_crtc_state *crtc_state;
 -              enum pipe pipe = PIPE_A;
 -              bool visible;
 -
 -              visible = plane->get_hw_state(plane, &pipe);
 -
 -              crtc = intel_crtc_for_pipe(dev_priv, pipe);
 -              crtc_state = to_intel_crtc_state(crtc->base.state);
 -
 -              intel_set_plane_visible(crtc_state, plane_state, visible);
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[PLANE:%d:%s] hw state readout: %s, pipe %c\n",
 -                          plane->base.base.id, plane->base.name,
 -                          str_enabled_disabled(visible), pipe_name(pipe));
 -      }
 -
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              fixup_plane_bitmasks(crtc_state);
 -      }
 -}
 -
 -static void intel_modeset_readout_hw_state(struct drm_device *dev)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_cdclk_state *cdclk_state =
 -              to_intel_cdclk_state(dev_priv->cdclk.obj.state);
 -      struct intel_dbuf_state *dbuf_state =
 -              to_intel_dbuf_state(dev_priv->dbuf.obj.state);
 -      enum pipe pipe;
 -      struct intel_crtc *crtc;
 -      struct intel_encoder *encoder;
 -      struct intel_connector *connector;
 -      struct drm_connector_list_iter conn_iter;
 -      u8 active_pipes = 0;
 -
 -      for_each_intel_crtc(dev, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              __drm_atomic_helper_crtc_destroy_state(&crtc_state->uapi);
 -              intel_crtc_free_hw_state(crtc_state);
 -              intel_crtc_state_reset(crtc_state, crtc);
 -
 -              intel_crtc_get_pipe_config(crtc_state);
 -
 -              crtc_state->hw.enable = crtc_state->hw.active;
 -
 -              crtc->base.enabled = crtc_state->hw.enable;
 -              crtc->active = crtc_state->hw.active;
 -
 -              if (crtc_state->hw.active)
 -                      active_pipes |= BIT(crtc->pipe);
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[CRTC:%d:%s] hw state readout: %s\n",
 -                          crtc->base.base.id, crtc->base.name,
 -                          str_enabled_disabled(crtc_state->hw.active));
 -      }
 -
 -      cdclk_state->active_pipes = dbuf_state->active_pipes = active_pipes;
 -
 -      readout_plane_state(dev_priv);
 -
 -      for_each_intel_encoder(dev, encoder) {
 -              struct intel_crtc_state *crtc_state = NULL;
 -
 -              pipe = 0;
 -
 -              if (encoder->get_hw_state(encoder, &pipe)) {
 -                      crtc = intel_crtc_for_pipe(dev_priv, pipe);
 -                      crtc_state = to_intel_crtc_state(crtc->base.state);
 -
 -                      encoder->base.crtc = &crtc->base;
 -                      intel_encoder_get_config(encoder, crtc_state);
 -
 -                      /* read out to slave crtc as well for bigjoiner */
 -                      if (crtc_state->bigjoiner_pipes) {
 -                              struct intel_crtc *slave_crtc;
 -
 -                              /* encoder should read be linked to bigjoiner master */
 -                              WARN_ON(intel_crtc_is_bigjoiner_slave(crtc_state));
 -
 -                              for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, slave_crtc,
 -                                                               intel_crtc_bigjoiner_slave_pipes(crtc_state)) {
 -                                      struct intel_crtc_state *slave_crtc_state;
 -
 -                                      slave_crtc_state = to_intel_crtc_state(slave_crtc->base.state);
 -                                      intel_encoder_get_config(encoder, slave_crtc_state);
 -                              }
 -                      }
 -              } else {
 -                      encoder->base.crtc = NULL;
 -              }
 -
 -              if (encoder->sync_state)
 -                      encoder->sync_state(encoder, crtc_state);
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[ENCODER:%d:%s] hw state readout: %s, pipe %c\n",
 -                          encoder->base.base.id, encoder->base.name,
 -                          str_enabled_disabled(encoder->base.crtc),
 -                          pipe_name(pipe));
 -      }
 -
 -      intel_dpll_readout_hw_state(dev_priv);
 -
 -      drm_connector_list_iter_begin(dev, &conn_iter);
 -      for_each_intel_connector_iter(connector, &conn_iter) {
 -              if (connector->get_hw_state(connector)) {
 -                      struct intel_crtc_state *crtc_state;
 -                      struct intel_crtc *crtc;
 -
 -                      connector->base.dpms = DRM_MODE_DPMS_ON;
 -
 -                      encoder = intel_attached_encoder(connector);
 -                      connector->base.encoder = &encoder->base;
 -
 -                      crtc = to_intel_crtc(encoder->base.crtc);
 -                      crtc_state = crtc ? to_intel_crtc_state(crtc->base.state) : NULL;
 -
 -                      if (crtc_state && crtc_state->hw.active) {
 -                              /*
 -                               * This has to be done during hardware readout
 -                               * because anything calling .crtc_disable may
 -                               * rely on the connector_mask being accurate.
 -                               */
 -                              crtc_state->uapi.connector_mask |=
 -                                      drm_connector_mask(&connector->base);
 -                              crtc_state->uapi.encoder_mask |=
 -                                      drm_encoder_mask(&encoder->base);
 -                      }
 -              } else {
 -                      connector->base.dpms = DRM_MODE_DPMS_OFF;
 -                      connector->base.encoder = NULL;
 -              }
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[CONNECTOR:%d:%s] hw state readout: %s\n",
 -                          connector->base.base.id, connector->base.name,
 -                          str_enabled_disabled(connector->base.encoder));
 -      }
 -      drm_connector_list_iter_end(&conn_iter);
 -
 -      for_each_intel_crtc(dev, crtc) {
 -              struct intel_bw_state *bw_state =
 -                      to_intel_bw_state(dev_priv->bw_obj.state);
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -              struct intel_plane *plane;
 -              int min_cdclk = 0;
 -
 -              if (crtc_state->hw.active) {
 -                      /*
 -                       * The initial mode needs to be set in order to keep
 -                       * the atomic core happy. It wants a valid mode if the
 -                       * crtc's enabled, so we do the above call.
 -                       *
 -                       * But we don't set all the derived state fully, hence
 -                       * set a flag to indicate that a full recalculation is
 -                       * needed on the next commit.
 -                       */
 -                      crtc_state->inherited = true;
 -
 -                      intel_crtc_update_active_timings(crtc_state);
 -
 -                      intel_crtc_copy_hw_to_uapi_state(crtc_state);
 -              }
 -
 -              for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
 -                      const struct intel_plane_state *plane_state =
 -                              to_intel_plane_state(plane->base.state);
 -
 -                      /*
 -                       * FIXME don't have the fb yet, so can't
 -                       * use intel_plane_data_rate() :(
 -                       */
 -                      if (plane_state->uapi.visible)
 -                              crtc_state->data_rate[plane->id] =
 -                                      4 * crtc_state->pixel_rate;
 -                      /*
 -                       * FIXME don't have the fb yet, so can't
 -                       * use plane->min_cdclk() :(
 -                       */
 -                      if (plane_state->uapi.visible && plane->min_cdclk) {
 -                              if (crtc_state->double_wide || DISPLAY_VER(dev_priv) >= 10)
 -                                      crtc_state->min_cdclk[plane->id] =
 -                                              DIV_ROUND_UP(crtc_state->pixel_rate, 2);
 -                              else
 -                                      crtc_state->min_cdclk[plane->id] =
 -                                              crtc_state->pixel_rate;
 -                      }
 -                      drm_dbg_kms(&dev_priv->drm,
 -                                  "[PLANE:%d:%s] min_cdclk %d kHz\n",
 -                                  plane->base.base.id, plane->base.name,
 -                                  crtc_state->min_cdclk[plane->id]);
 -              }
 -
 -              if (crtc_state->hw.active) {
 -                      min_cdclk = intel_crtc_compute_min_cdclk(crtc_state);
 -                      if (drm_WARN_ON(dev, min_cdclk < 0))
 -                              min_cdclk = 0;
 -              }
 -
 -              cdclk_state->min_cdclk[crtc->pipe] = min_cdclk;
 -              cdclk_state->min_voltage_level[crtc->pipe] =
 -                      crtc_state->min_voltage_level;
 -
 -              intel_bw_crtc_update(bw_state, crtc_state);
 -
 -              intel_pipe_config_sanity_check(dev_priv, crtc_state);
 -      }
 -}
 -
 -static void
 -get_encoder_power_domains(struct drm_i915_private *dev_priv)
 -{
 -      struct intel_encoder *encoder;
 -
 -      for_each_intel_encoder(&dev_priv->drm, encoder) {
 -              struct intel_crtc_state *crtc_state;
 -
 -              if (!encoder->get_power_domains)
 -                      continue;
 -
 -              /*
 -               * MST-primary and inactive encoders don't have a crtc state
 -               * and neither of these require any power domain references.
 -               */
 -              if (!encoder->base.crtc)
 -                      continue;
 -
 -              crtc_state = to_intel_crtc_state(encoder->base.crtc->state);
 -              encoder->get_power_domains(encoder, crtc_state);
 -      }
 -}
 -
 -static void intel_early_display_was(struct drm_i915_private *dev_priv)
 -{
 -      /*
 -       * Display WA #1185 WaDisableDARBFClkGating:glk,icl,ehl,tgl
 -       * Also known as Wa_14010480278.
 -       */
 -      if (IS_DISPLAY_VER(dev_priv, 10, 12))
 -              intel_de_write(dev_priv, GEN9_CLKGATE_DIS_0,
 -                             intel_de_read(dev_priv, GEN9_CLKGATE_DIS_0) | DARBF_GATING_DIS);
 -
 -      if (IS_HASWELL(dev_priv)) {
 -              /*
 -               * WaRsPkgCStateDisplayPMReq:hsw
 -               * System hang if this isn't done before disabling all planes!
 -               */
 -              intel_de_write(dev_priv, CHICKEN_PAR1_1,
 -                             intel_de_read(dev_priv, CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 -      }
 -
 -      if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) || IS_COMETLAKE(dev_priv)) {
 -              /* Display WA #1142:kbl,cfl,cml */
 -              intel_de_rmw(dev_priv, CHICKEN_PAR1_1,
 -                           KBL_ARB_FILL_SPARE_22, KBL_ARB_FILL_SPARE_22);
 -              intel_de_rmw(dev_priv, CHICKEN_MISC_2,
 -                           KBL_ARB_FILL_SPARE_13 | KBL_ARB_FILL_SPARE_14,
 -                           KBL_ARB_FILL_SPARE_14);
 -      }
 -}
 -
 -
 -/* Scan out the current hw modeset state,
 - * and sanitizes it to the current state
 - */
 -static void
 -intel_modeset_setup_hw_state(struct drm_device *dev,
 -                           struct drm_modeset_acquire_ctx *ctx)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_encoder *encoder;
 -      struct intel_crtc *crtc;
 -      intel_wakeref_t wakeref;
 -
 -      wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_INIT);
 -
 -      intel_early_display_was(dev_priv);
 -      intel_modeset_readout_hw_state(dev);
 -
 -      /* HW state is read out, now we need to sanitize this mess. */
 -      get_encoder_power_domains(dev_priv);
 -
 -      intel_pch_sanitize(dev_priv);
 -
 -      /*
 -       * intel_sanitize_plane_mapping() may need to do vblank
 -       * waits, so we need vblank interrupts restored beforehand.
 -       */
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              drm_crtc_vblank_reset(&crtc->base);
 -
 -              if (crtc_state->hw.active)
 -                      intel_crtc_vblank_on(crtc_state);
 -      }
 -
 -      intel_fbc_sanitize(dev_priv);
 -
 -      intel_sanitize_plane_mapping(dev_priv);
 -
 -      for_each_intel_encoder(dev, encoder)
 -              intel_sanitize_encoder(encoder);
 -
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              intel_sanitize_crtc(crtc, ctx);
 -              intel_dump_pipe_config(crtc_state, NULL, "[setup_hw_state]");
 -      }
 -
 -      intel_modeset_update_connector_atomic_state(dev);
 -
 -      intel_dpll_sanitize_state(dev_priv);
 -
 -      if (IS_G4X(dev_priv)) {
 -              g4x_wm_get_hw_state(dev_priv);
 -              g4x_wm_sanitize(dev_priv);
 -      } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
 -              vlv_wm_get_hw_state(dev_priv);
 -              vlv_wm_sanitize(dev_priv);
 -      } else if (DISPLAY_VER(dev_priv) >= 9) {
 -              skl_wm_get_hw_state(dev_priv);
 -              skl_wm_sanitize(dev_priv);
 -      } else if (HAS_PCH_SPLIT(dev_priv)) {
 -              ilk_wm_get_hw_state(dev_priv);
 -      }
 -
 -      for_each_intel_crtc(dev, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -              struct intel_power_domain_mask put_domains;
 -
 -              modeset_get_crtc_power_domains(crtc_state, &put_domains);
 -              if (drm_WARN_ON(dev, !bitmap_empty(put_domains.bits, POWER_DOMAIN_NUM)))
 -                      modeset_put_crtc_power_domains(crtc, &put_domains);
 -      }
 -
 -      intel_display_power_put(dev_priv, POWER_DOMAIN_INIT, wakeref);
 -
 -      intel_power_domains_sanitize_state(dev_priv);
 -}
 -
  void intel_display_resume(struct drm_device *dev)
  {
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct drm_atomic_state *state = dev_priv->modeset_restore_state;
 +      struct drm_i915_private *i915 = to_i915(dev);
 +      struct drm_atomic_state *state = i915->modeset_restore_state;
        struct drm_modeset_acquire_ctx ctx;
        int ret;
  
 -      if (!HAS_DISPLAY(dev_priv))
 +      if (!HAS_DISPLAY(i915))
                return;
  
 -      dev_priv->modeset_restore_state = NULL;
 +      i915->modeset_restore_state = NULL;
        if (state)
                state->acquire_ctx = &ctx;
  
        }
  
        if (!ret)
 -              ret = __intel_display_resume(dev, state, &ctx);
 +              ret = __intel_display_resume(i915, state, &ctx);
  
 -      intel_enable_ipc(dev_priv);
 +      intel_enable_ipc(i915);
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
  
        if (ret)
 -              drm_err(&dev_priv->drm,
 +              drm_err(&i915->drm,
                        "Restoring old state failed with %i\n", ret);
        if (state)
                drm_atomic_state_put(state);
index b7b2c14fd9e15eeb024384e6c197e3b7b2c379b4,193c7c83c70f9691369c31bf8b94f6409e8f9364..cd75b0ca2555f49dde7b8a80d14e9bd97361700f
@@@ -6,7 -6,6 +6,6 @@@
  
  #include <linux/dma-resv.h>
  #include <linux/highmem.h>
- #include <linux/intel-iommu.h>
  #include <linux/sync_file.h>
  #include <linux/uaccess.h>
  
@@@ -1951,7 -1950,7 +1950,7 @@@ eb_find_first_request_added(struct i915
  #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
  
  /* Stage with GFP_KERNEL allocations before we enter the signaling critical path */
 -static void eb_capture_stage(struct i915_execbuffer *eb)
 +static int eb_capture_stage(struct i915_execbuffer *eb)
  {
        const unsigned int count = eb->buffer_count;
        unsigned int i = count, j;
                if (!(flags & EXEC_OBJECT_CAPTURE))
                        continue;
  
 +              if (i915_gem_context_is_recoverable(eb->gem_context) &&
 +                  (IS_DGFX(eb->i915) || GRAPHICS_VER_FULL(eb->i915) > IP_VER(12, 0)))
 +                      return -EINVAL;
 +
                for_each_batch_create_order(eb, j) {
                        struct i915_capture_list *capture;
  
                        eb->capture_lists[j] = capture;
                }
        }
 +
 +      return 0;
  }
  
  /* Commit once we're in the critical path */
@@@ -2023,9 -2016,8 +2022,9 @@@ static void eb_capture_list_clear(struc
  
  #else
  
 -static void eb_capture_stage(struct i915_execbuffer *eb)
 +static int eb_capture_stage(struct i915_execbuffer *eb)
  {
 +      return 0;
  }
  
  static void eb_capture_commit(struct i915_execbuffer *eb)
@@@ -3417,9 -3409,7 +3416,9 @@@ i915_gem_do_execbuffer(struct drm_devic
        }
  
        ww_acquire_done(&eb.ww.ctx);
 -      eb_capture_stage(&eb);
 +      err = eb_capture_stage(&eb);
 +      if (err)
 +              goto err_vma;
  
        out_fence = eb_requests_create(&eb, in_fence, out_fence_fd);
        if (IS_ERR(out_fence)) {
This page took 0.292527 seconds and 4 git commands to generate.