drm/i915/mtl: Fix dram info readout
authorRadhakrishna Sripada <radhakrishna.sripada@intel.com>
Thu, 17 Nov 2022 21:30:14 +0000 (13:30 -0800)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 29 Nov 2022 08:49:14 +0000 (08:49 +0000)
MEM_SS_INFO_GLOBAL Register info read from the hardware is cached in val. However
the variable is being modified when determining the DRAM type thereby clearing out
the channels and qgv info extracted later in the function xelpdp_get_dram_info. Preserve
the register value and use extracted fields in the switch statement.

Fixes: 825477e77912 ("drm/i915/mtl: Obtain SAGV values from MMIO instead of GT pcode mailbox")
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221117213015.584417-1-radhakrishna.sripada@intel.com
(cherry picked from commit ec35c41d91052a3a15dd3767075620af448b8030)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
drivers/gpu/drm/i915/intel_dram.c

index 2403ccd52c74a123edfa28013434f5326c0763fe..bba8cb6e8ae42e18fa69f0889d3bb483ce25bc5f 100644 (file)
@@ -471,8 +471,7 @@ static int xelpdp_get_dram_info(struct drm_i915_private *i915)
        u32 val = intel_uncore_read(&i915->uncore, MTL_MEM_SS_INFO_GLOBAL);
        struct dram_info *dram_info = &i915->dram_info;
 
-       val = REG_FIELD_GET(MTL_DDR_TYPE_MASK, val);
-       switch (val) {
+       switch (REG_FIELD_GET(MTL_DDR_TYPE_MASK, val)) {
        case 0:
                dram_info->type = INTEL_DRAM_DDR4;
                break;