]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Merge tag 'drm-next-2025-07-30' of https://gitlab.freedesktop.org/drm/kernel
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 31 Jul 2025 02:26:49 +0000 (19:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 31 Jul 2025 02:26:49 +0000 (19:26 -0700)
Pull drm updates from Dave Airlie:
 "Highlights:

   - Intel xe enable Panthor Lake, started adding WildCat Lake

   - amdgpu has a bunch of reset improvments along with the usual IP
     updates

   - msm got VM_BIND support which is important for vulkan sparse memory

   - more drm_panic users

   - gpusvm common code to handle a bunch of core SVM work outside
     drivers.

  Detail summary:

  Changes outside drm subdirectory:
   - 'shrink_shmem_memory()' for better shmem/hibernate interaction
   - Rust support infrastructure:
      - make ETIMEDOUT available
      - add size constants up to SZ_2G
      - add DMA coherent allocation bindings
   - mtd driver for Intel GPU non-volatile storage
   - i2c designware quirk for Intel xe

  core:
   - atomic helpers: tune enable/disable sequences
   - add task info to wedge API
   - refactor EDID quirks
   - connector: move HDR sink to drm_display_info
   - fourcc: half-float and 32-bit float formats
   - mode_config: pass format info to simplify

  dma-buf:
   - heaps: Give CMA heap a stable name

  ci:
   - add device tree validation and kunit

  displayport:
   - change AUX DPCD access probe address
   - add quirk for DPCD probe
   - add panel replay definitions
   - backlight control helpers

  fbdev:
   - make CONFIG_FIRMWARE_EDID available on all arches

  fence:
   - fix UAF issues

  format-helper:
   - improve tests

  gpusvm:
   - introduce devmem only flag for allocation
   - add timeslicing support to GPU SVM

  ttm:
   - improve eviction

  sched:
   - tracing improvements
   - kunit improvements
   - memory leak fixes
   - reset handling improvements

  color mgmt:
   - add hardware gamma LUT handling helpers

  bridge:
   - add destroy hook
   - switch to reference counted drm_bridge allocations
   - tc358767: convert to devm_drm_bridge_alloc
   - improve CEC handling

  panel:
   - switch to reference counter drm_panel allocations
   - fwnode panel lookup
   - Huiling hl055fhv028c support
   - Raspberry Pi 7" 720x1280 support
   - edp: KDC KD116N3730A05, N160JCE-ELL CMN, N116BCJ-EAK
   - simple: AUO P238HAN01
   - st7701: Winstar wf40eswaa6mnn0
   - visionox: rm69299-shift
   - Renesas R61307, Renesas R69328 support
   - DJN HX83112B

  hdmi:
   - add CEC handling
   - YUV420 output support

  xe:
   - WildCat Lake support
   - Enable PanthorLake by default
   - mark BMG as SRIOV capable
   - update firmware recommendations
   - Expose media OA units
   - aux-bux support for non-volatile memory
   - MTD intel-dg driver for non-volatile memory
   - Expose fan control and voltage regulator in sysfs
   - restructure migration for multi-device
   - Restore GuC submit UAF fix
   - make GEM shrinker drm managed
   - SRIOV VF Post-migration recovery of GGTT nodes
   - W/A additions/reworks
   - Prefetch support for svm ranges
   - Don't allocate managed BO for each policy change
   - HWMON fixes for BMG
   - Create LRC BO without VM
   - PCI ID updates
   - make SLPC debugfs files optional
   - rework eviction rejection of bound external BOs
   - consolidate PAT programming logic for pre/post Xe2
   - init changes for flicker-free boot
   - Enable GuC Dynamic Inhibit Context switch

  i915:
   - drm_panic support for i915/xe
   - initial flip queue off by default for LNL/PNL
   - Wildcat Lake Display support
   - Support for DSC fractional link bpp
   - Support for simultaneous Panel Replay and Adaptive sync
   - Support for PTL+ double buffer LUT
   - initial PIPEDMC event handling
   - drm_panel_follower support
   - DPLL interface renames
   - allocate struct intel_display dynamically
   - flip queue preperation
   - abstract DRAM detection better
   - avoid GuC scheduling stalls
   - remove DG1 force probe requirement
   - fix MEI interrupt handler on RT kernels
   - use backlight control helpers for eDP
   - more shared display code refactoring

  amdgpu:
   - add userq slot to INFO ioctl
   - SR-IOV hibernation support
   - Suspend improvements
   - Backlight improvements
   - Use scaling for non-native eDP modes
   - cleaner shader updates for GC 9.x
   - Remove fence slab
   - SDMA fw checks for userq support
   - RAS updates
   - DMCUB updates
   - DP tunneling fixes
   - Display idle D3 support
   - Per queue reset improvements
   - initial smartmux support

  amdkfd:
   - enable KFD on loongarch
   - mtype fix for ext coherent system memory

  radeon:
   - CS validation additional GL extensions
   - drop console lock during suspend/resume
   - bump driver version

  msm:
   - VM BIND support
   - CI: infrastructure updates
   - UBWC single source of truth
   - decouple GPU and KMS support
   - DP: rework I/O accessors
   - DPU: SM8750 support
   - DSI: SM8750 support
   - GPU: X1-45 support and speedbin support for X1-85
   - MDSS: SM8750 support

  nova:
   - register! macro improvements
   - DMA object abstraction
   - VBIOS parser + fwsec lookup
   - sysmem flush page support
   - falcon: generic falcon boot code and HAL
   - FWSEC-FRTS: fb setup and load/execute

  ivpu:
   - Add Wildcat Lake support
   - Add turbo flag

  ast:
   - improve hardware generations implementation

  imx:
   - IMX8qxq Display Controller support

  lima:
   - Rockchip RK3528 GPU support

  nouveau:
   - fence handling cleanup

  panfrost:
   - MT8370 support
   - bo labeling
   - 64-bit register access

  qaic:
   - add RAS support

  rockchip:
   - convert inno_hdmi to a bridge

  rz-du:
   - add RZ/V2H(P) support
   - MIPI-DSI DCS support

  sitronix:
   - ST7567 support

  sun4i:
   - add H616 support

  tidss:
   - add TI AM62L support
   - AM65x OLDI bridge support

  bochs:
   - drm panic support

  vkms:
   - YUV and R* format support
   - use faux device

  vmwgfx:
   - fence improvements

  hyperv:
   - move out of simple
   - add drm_panic support"

* tag 'drm-next-2025-07-30' of https://gitlab.freedesktop.org/drm/kernel: (1479 commits)
  drm/tidss: oldi: convert to devm_drm_bridge_alloc() API
  drm/tidss: encoder: convert to devm_drm_bridge_alloc()
  drm/amdgpu: move reset support type checks into the caller
  drm/amdgpu/sdma7: re-emit unprocessed state on ring reset
  drm/amdgpu/sdma6: re-emit unprocessed state on ring reset
  drm/amdgpu/sdma5.2: re-emit unprocessed state on ring reset
  drm/amdgpu/sdma5: re-emit unprocessed state on ring reset
  drm/amdgpu/gfx12: re-emit unprocessed state on ring reset
  drm/amdgpu/gfx11: re-emit unprocessed state on ring reset
  drm/amdgpu/gfx10: re-emit unprocessed state on ring reset
  drm/amdgpu/gfx9.4.3: re-emit unprocessed state on kcq reset
  drm/amdgpu/gfx9: re-emit unprocessed state on kcq reset
  drm/amdgpu: Add WARN_ON to the resource clear function
  drm/amd/pm: Use cached metrics data on SMUv13.0.6
  drm/amd/pm: Use cached data for min/max clocks
  gpu: nova-core: fix bounds check in PmuLookupTableEntry::new
  drm/amdgpu: Replace HQD terminology with slots naming
  drm/amdgpu: Add user queue instance count in HW IP info
  drm/amd/amdgpu: Add helper functions for isp buffers
  drm/amd/amdgpu: Initialize swnode for ISP MFD device
  ...

56 files changed:
1  2 
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
Documentation/devicetree/bindings/vendor-prefixes.yaml
MAINTAINERS
drivers/Kconfig
drivers/base/power/main.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c
drivers/gpu/drm/ast/ast_mode.c
drivers/gpu/drm/bridge/aux-hpd-bridge.c
drivers/gpu/drm/bridge/panel.c
drivers/gpu/drm/bridge/samsung-dsim.c
drivers/gpu/drm/bridge/ti-sn65dsi86.c
drivers/gpu/drm/display/drm_bridge_connector.c
drivers/gpu/drm/display/drm_dp_aux_bus.c
drivers/gpu/drm/display/drm_dp_helper.c
drivers/gpu/drm/display/drm_dp_tunnel.c
drivers/gpu/drm/drm_buddy.c
drivers/gpu/drm/drm_framebuffer.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_gem_framebuffer_helper.c
drivers/gpu/drm/drm_gem_shmem_helper.c
drivers/gpu/drm/drm_internal.h
drivers/gpu/drm/drm_mipi_dsi.c
drivers/gpu/drm/drm_prime.c
drivers/gpu/drm/drm_writeback.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/imagination/pvr_power.c
drivers/gpu/drm/mediatek/mtk_dpi.c
drivers/gpu/drm/nouveau/nouveau_backlight.c
drivers/gpu/drm/panel/panel-simple.c
drivers/gpu/drm/panfrost/panfrost_job.c
drivers/gpu/drm/scheduler/sched_entity.c
drivers/gpu/drm/sysfb/vesadrm.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/v3d/v3d_sched.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
drivers/gpu/drm/xe/xe_gt.h
drivers/gpu/drm/xe/xe_vsec.c
drivers/gpu/drm/xlnx/zynqmp_dp.c
drivers/gpu/nova-core/driver.rs
drivers/gpu/nova-core/gpu.rs
include/drm/drm_file.h
include/drm/drm_mipi_dsi.h
include/linux/suspend.h
kernel/power/hibernate.c
rust/kernel/dma.rs
rust/kernel/drm/device.rs
samples/rust/rust_dma.rs

index aa19f8819231a66aa456c59ef14873d2609044f4,7e947016dee9dca6aa57cf191502e25d5252a25e..be198182dbfe0dba61176f7205b08be131f4845c
@@@ -40,9 -40,9 +40,10 @@@ properties
            - const: arm,mali-valhall-jm # Mali Valhall GPU model/revision is fully discoverable
        - items:
            - enum:
 +              - allwinner,sun55i-a523-mali
                - mediatek,mt8188-mali
                - mediatek,mt8192-mali
+               - mediatek,mt8370-mali
            - const: arm,mali-valhall-jm # Mali Valhall GPU model/revision is fully discoverable
  
    reg:
diff --cc MAINTAINERS
index 25f051bda214df703ba02d55da29f7f4d709cba5,e6cd3db64c12d25db9c821db75223531823c99bc..4f03e230f3c5ecfb1577e8728ef578a5374d4902
@@@ -8422,8 -8339,28 +8443,28 @@@ F:    drivers/gpu/drm/drm_panel.
  F:    drivers/gpu/drm/panel/
  F:    include/drm/drm_panel.h
  
+ DRM PANIC
+ M:    Jocelyn Falempe <jfalempe@redhat.com>
+ M:    Javier Martinez Canillas <javierm@redhat.com>
+ L:    dri-devel@lists.freedesktop.org
+ S:    Supported
+ T:    git https://gitlab.freedesktop.org/drm/misc/kernel.git
+ F:    drivers/gpu/drm/drm_draw.c
+ F:    drivers/gpu/drm/drm_draw_internal.h
+ F:    drivers/gpu/drm/drm_panic*.c
+ F:    include/drm/drm_panic*
+ DRM PANIC QR CODE
+ M:    Jocelyn Falempe <jfalempe@redhat.com>
+ M:    Javier Martinez Canillas <javierm@redhat.com>
+ L:    dri-devel@lists.freedesktop.org
+ L:    rust-for-linux@vger.kernel.org
+ S:    Supported
+ T:    git https://gitlab.freedesktop.org/drm/misc/kernel.git
+ F:    drivers/gpu/drm/drm_panic_qr.rs
  DRM PRIVACY-SCREEN CLASS
 -M:    Hans de Goede <hdegoede@redhat.com>
 +M:    Hans de Goede <hansg@kernel.org>
  L:    dri-devel@lists.freedesktop.org
  S:    Maintained
  T:    git https://gitlab.freedesktop.org/drm/misc/kernel.git
diff --cc drivers/Kconfig
Simple merge
Simple merge
index aa32df7e2fb2f34eac405eba5c560a1156d3c9be,a43ce34048495192c1a0e652dd05ef8092c2b237..6f93473436beda0f70c3ea954bb16f55d1fe1ae3
@@@ -5193,12 -5311,10 +5311,12 @@@ exit
                dev->dev->power.disable_depth--;
  #endif
        }
 +
 +      amdgpu_vram_mgr_clear_reset_blocks(adev);
        adev->in_suspend = false;
  
-       if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D0))
-               DRM_WARN("smart shift update failed\n");
+       if (amdgpu_acpi_smart_shift_update(adev, AMDGPU_SS_DEV_D0))
+               dev_warn(adev->dev, "smart shift update failed\n");
  
        return 0;
  }
index e01aa2f2e13ee3e44a3170884a74c3f3ac59ad88,1d1a002f6d54f14026bafbd331d6da34f1bfee76..8475c6eec547b589daa70f175212477f91883ca2
@@@ -1893,10 -1895,11 +1895,14 @@@ static bool dcn35_resource_construct
        dc->caps.color.mpc.ogam_rom_caps.pq = 0;
        dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
        dc->caps.color.mpc.ocsc = 1;
+       dc->caps.color.mpc.preblend = true;
+       dc->caps.num_of_host_routers = 2;
+       dc->caps.num_of_dpias_per_host_router = 2;
  
 +      dc->caps.num_of_host_routers = 2;
 +      dc->caps.num_of_dpias_per_host_router = 2;
 +
        /* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
         * to provide some margin.
         * It's expected for furture ASIC to have equal or higher value, in order to
index 4ebe4e00a4f8b49f63d3eadf45bf09db0c1184fd,47912e0861a2b8a3bd46e51b20ceb3ca9ed71fdc..0971c0f74186559889cc1bcb6d3412d7bddb481f
@@@ -1865,10 -1867,11 +1867,14 @@@ static bool dcn351_resource_construct
        dc->caps.color.mpc.ogam_rom_caps.pq = 0;
        dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
        dc->caps.color.mpc.ocsc = 1;
+       dc->caps.color.mpc.preblend = true;
+       dc->caps.num_of_host_routers = 2;
+       dc->caps.num_of_dpias_per_host_router = 2;
  
 +      dc->caps.num_of_host_routers = 2;
 +      dc->caps.num_of_dpias_per_host_router = 2;
 +
        /* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
         * to provide some margin.
         * It's expected for furture ASIC to have equal or higher value, in order to
index db36b8f9ce6531e61fb3693f838442450d942e5a,9ba91e214ddaae1e2b528da4f1f62ef928fc79d9..8bae7fcedc22d3cc9515bdbe572fa0dfb375de20
@@@ -1866,10 -1868,11 +1868,14 @@@ static bool dcn36_resource_construct
        dc->caps.color.mpc.ogam_rom_caps.pq = 0;
        dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
        dc->caps.color.mpc.ocsc = 1;
+       dc->caps.color.mpc.preblend = true;
+       dc->caps.num_of_host_routers = 2;
+       dc->caps.num_of_dpias_per_host_router = 2;
  
 +      dc->caps.num_of_host_routers = 2;
 +      dc->caps.num_of_dpias_per_host_router = 2;
 +
        /* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
         * to provide some margin.
         * It's expected for furture ASIC to have equal or higher value, in order to
Simple merge
Simple merge
Simple merge
Simple merge
index ea78c6c8ca7a635b4b0c9d1dec6c8bf3f8790b16,1c3920297906b8229c18723807a2afd0dea5b767..1ecc3df7e3167d13636e194c4aab44ee8979aa11
@@@ -712,20 -741,8 +741,8 @@@ ssize_t drm_dp_dpcd_read(struct drm_dp_
  {
        int ret;
  
-       /*
-        * HP ZR24w corrupts the first DPCD access after entering power save
-        * mode. Eg. on a read, the entire buffer will be filled with the same
-        * byte. Do a throw away read to avoid corrupting anything we care
-        * about. Afterwards things will work correctly until the monitor
-        * gets woken up and subsequently re-enters power save mode.
-        *
-        * The user pressing any button on the monitor is enough to wake it
-        * up, so there is no particularly good place to do the workaround.
-        * We just have to do it before any DPCD access and hope that the
-        * monitor doesn't power down exactly after the throw away read.
-        */
-       if (!aux->is_remote) {
+       if (dpcd_access_needs_probe(aux)) {
 -              ret = drm_dp_dpcd_probe(aux, DP_LANE0_1_STATUS);
 +              ret = drm_dp_dpcd_probe(aux, DP_TRAINING_PATTERN_SET);
                if (ret < 0)
                        return ret;
        }
Simple merge
Simple merge
Simple merge
index a5dbee6974ab643d2b6ff3ad25c49425945e73f3,8ac0b1fa5287a0fb70d81559cd49a49ab5d343d6..5d1349c34afd3dee612d0f93bd3eea8b90dc3045
@@@ -348,8 -348,10 +348,10 @@@ int drm_gem_shmem_vmap_locked(struct dr
        struct drm_gem_object *obj = &shmem->base;
        int ret = 0;
  
+       dma_resv_assert_held(obj->resv);
        if (drm_gem_is_imported(obj)) {
 -              ret = dma_buf_vmap(obj->dma_buf, map);
 +              ret = dma_buf_vmap(obj->import_attach->dmabuf, map);
        } else {
                pgprot_t prot = PAGE_KERNEL;
  
@@@ -408,8 -410,10 +410,10 @@@ void drm_gem_shmem_vunmap_locked(struc
  {
        struct drm_gem_object *obj = &shmem->base;
  
+       dma_resv_assert_held(obj->resv);
        if (drm_gem_is_imported(obj)) {
 -              dma_buf_vunmap(obj->dma_buf, map);
 +              dma_buf_vunmap(obj->import_attach->dmabuf, map);
        } else {
                dma_resv_assert_held(shmem->base.resv);
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index f7532db3831fe3eb8b48d1a121abb834d12da281,2b107958942cf909fad1ef7cb507046fe4abdca8..90615e9ac86b1cac38dedc90e867be69786727f0
@@@ -362,22 -334,17 +334,22 @@@ static struct vesadrm_device *vesadrm_d
  
        if (!__screen_info_vbe_mode_nonvga(si)) {
                vesa->cmap_write = vesadrm_vga_cmap_write;
 -#if defined(CONFIG_X86_32)
        } else {
 +#if defined(CONFIG_X86_32)
                phys_addr_t pmi_base = __screen_info_vesapm_info_base(si);
 -              const u16 *pmi_addr = phys_to_virt(pmi_base);
  
 -              vesa->pmi.PrimaryPalette = (u8 *)pmi_addr + pmi_addr[2];
 -              vesa->cmap_write = vesadrm_pmi_cmap_write;
 +              if (pmi_base) {
 +                      const u16 *pmi_addr = phys_to_virt(pmi_base);
 +
 +                      vesa->pmi.PrimaryPalette = (u8 *)pmi_addr + pmi_addr[2];
 +                      vesa->cmap_write = vesadrm_pmi_cmap_write;
 +              } else
  #endif
 +              if (format->is_color_indexed)
 +                      drm_warn(dev, "hardware palette is unchangeable, colors may be incorrect\n");
        }
  
- #ifdef CONFIG_X86
+ #if defined(CONFIG_FIRMWARE_EDID)
        if (drm_edid_header_is_valid(edid_info.dummy) == 8)
                sysfb->edid = edid_info.dummy;
  #endif
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 110f2b355db4fd2fc998b4f3bf89c5a0204d2693,518ef8739550fd0b63b5a4aa98cd1fd814770725..cb68d0bc1e63b87c3eb941539e37aabeb31a9c68
@@@ -1,6 -1,6 +1,6 @@@
  // SPDX-License-Identifier: GPL-2.0
  
- use kernel::{auxiliary, bindings, c_str, device::Core, pci, prelude::*, sync::Arc};
 -use kernel::{auxiliary, bindings, c_str, device::Core, pci, prelude::*, sizes::SZ_16M};
++use kernel::{auxiliary, bindings, c_str, device::Core, pci, prelude::*, sync::Arc, sizes::SZ_16M};
  
  use crate::gpu::Gpu;
  
index 47653c14838b128fc2968e0a2a7a0f6a9db8b8eb,72d40b0124f0c1a2a381484172c289af523511df..b5c9786619a9d4164f49b4e171bed626ca117503
@@@ -1,11 -1,17 +1,17 @@@
  // SPDX-License-Identifier: GPL-2.0
  
 -use kernel::{device, devres::Devres, error::code::*, pci, prelude::*};
 +use kernel::{device, devres::Devres, error::code::*, pci, prelude::*, sync::Arc};
  
  use crate::driver::Bar0;
+ use crate::falcon::{gsp::Gsp, sec2::Sec2, Falcon};
+ use crate::fb::FbLayout;
+ use crate::fb::SysmemFlush;
+ use crate::firmware::fwsec::{FwsecCommand, FwsecFirmware};
  use crate::firmware::{Firmware, FIRMWARE_VERSION};
+ use crate::gfw;
  use crate::regs;
  use crate::util;
+ use crate::vbios::Vbios;
  use core::fmt;
  
  macro_rules! define_chipset {
@@@ -161,14 -167,105 +167,105 @@@ impl Spec 
  pub(crate) struct Gpu {
      spec: Spec,
      /// MMIO mapping of PCI BAR 0
 -    bar: Devres<Bar0>,
 +    bar: Arc<Devres<Bar0>>,
      fw: Firmware,
+     /// System memory page required for flushing all pending GPU-side memory writes done through
+     /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
+     sysmem_flush: SysmemFlush,
+ }
+ #[pinned_drop]
+ impl PinnedDrop for Gpu {
+     fn drop(self: Pin<&mut Self>) {
+         // Unregister the sysmem flush page before we release it.
+         self.bar
+             .try_access_with(|b| self.sysmem_flush.unregister(b));
+     }
  }
  
  impl Gpu {
+     /// Helper function to load and run the FWSEC-FRTS firmware and confirm that it has properly
+     /// created the WPR2 region.
+     ///
+     /// TODO: this needs to be moved into a larger type responsible for booting the whole GSP
+     /// (`GspBooter`?).
+     fn run_fwsec_frts(
+         dev: &device::Device<device::Bound>,
+         falcon: &Falcon<Gsp>,
+         bar: &Bar0,
+         bios: &Vbios,
+         fb_layout: &FbLayout,
+     ) -> Result<()> {
+         // Check that the WPR2 region does not already exists - if it does, we cannot run
+         // FWSEC-FRTS until the GPU is reset.
+         if regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI::read(bar).higher_bound() != 0 {
+             dev_err!(
+                 dev,
+                 "WPR2 region already exists - GPU needs to be reset to proceed\n"
+             );
+             return Err(EBUSY);
+         }
+         let fwsec_frts = FwsecFirmware::new(
+             dev,
+             falcon,
+             bar,
+             bios,
+             FwsecCommand::Frts {
+                 frts_addr: fb_layout.frts.start,
+                 frts_size: fb_layout.frts.end - fb_layout.frts.start,
+             },
+         )?;
+         // Run FWSEC-FRTS to create the WPR2 region.
+         fwsec_frts.run(dev, falcon, bar)?;
+         // SCRATCH_E contains the error code for FWSEC-FRTS.
+         let frts_status = regs::NV_PBUS_SW_SCRATCH_0E::read(bar).frts_err_code();
+         if frts_status != 0 {
+             dev_err!(
+                 dev,
+                 "FWSEC-FRTS returned with error code {:#x}",
+                 frts_status
+             );
+             return Err(EIO);
+         }
+         // Check that the WPR2 region has been created as we requested.
+         let (wpr2_lo, wpr2_hi) = (
+             regs::NV_PFB_PRI_MMU_WPR2_ADDR_LO::read(bar).lower_bound(),
+             regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI::read(bar).higher_bound(),
+         );
+         match (wpr2_lo, wpr2_hi) {
+             (_, 0) => {
+                 dev_err!(dev, "WPR2 region not created after running FWSEC-FRTS\n");
+                 Err(EIO)
+             }
+             (wpr2_lo, _) if wpr2_lo != fb_layout.frts.start => {
+                 dev_err!(
+                     dev,
+                     "WPR2 region created at unexpected address {:#x}; expected {:#x}\n",
+                     wpr2_lo,
+                     fb_layout.frts.start,
+                 );
+                 Err(EIO)
+             }
+             (wpr2_lo, wpr2_hi) => {
+                 dev_dbg!(dev, "WPR2: {:#x}-{:#x}\n", wpr2_lo, wpr2_hi);
+                 dev_dbg!(dev, "GPU instance built\n");
+                 Ok(())
+             }
+         }
+     }
      pub(crate) fn new(
          pdev: &pci::Device<device::Bound>,
 -        devres_bar: Devres<Bar0>,
 +        devres_bar: Arc<Devres<Bar0>>,
      ) -> Result<impl PinInit<Self>> {
          let bar = devres_bar.access(pdev.as_ref())?;
          let spec = Spec::new(bar)?;
Simple merge
Simple merge
Simple merge
index 9216e3b91d3b3bfdabdbf161da10ee7d6ec74c46,e526237a8c0f3eb7e578f44f329ab20c6e312700..1f1f30cca5732d62280d4bb16e61fe697c634a20
@@@ -422,7 -439,17 +439,16 @@@ int hibernation_snapshot(int platform_m
                goto Thaw;
        }
  
+       /*
+        * Device drivers may move lots of data to shmem in dpm_prepare(). The shmem
+        * pages will use lots of system memory, causing hibernation image creation
+        * fail due to insufficient free memory.
+        * This call is to force flush the shmem pages to swap disk and reclaim
+        * the system memory so that image creation can succeed.
+        */
+       shrink_shmem_memory();
        console_suspend_all();
 -      pm_restrict_gfp_mask();
  
        error = dpm_suspend(PMSG_FREEZE);
  
Simple merge
Simple merge
Simple merge