drm/xe/xe2: Determine bios enablement for flat ccs on igfx
authorHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Tue, 12 Dec 2023 18:25:24 +0000 (23:55 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:46:09 +0000 (11:46 -0500)
If bios disables flat ccs on igfx make has_flat_ccs as 0 and notify
via drm_dbg.

Bspec:59255

v2:
 - Release forcewake.
 - Add registers in order.
 - drop dgfx condition and only add it back in the future
when the support for an Xe2 dgpu will be added.
- Use drm_dbg instead of drm_info. (Matt)

v3:
 - Address nit(Matt)

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/regs/xe_gt_regs.h
drivers/gpu/drm/xe/xe_device.c

index 5f5a72e9d0d89b7e82aaf6c20aa07a5f71a6f4be..f5bf4c6d1761e2cd52980d494ddf57cb9c6f018f 100644 (file)
 #define XEHP_SQCM                              XE_REG_MCR(0x8724)
 #define   EN_32B_ACCESS                                REG_BIT(30)
 
+#define XE2_FLAT_CCS_BASE_RANGE_LOWER          XE_REG_MCR(0x8800)
+#define   XE2_FLAT_CCS_ENABLE                  REG_BIT(0)
+
 #define GSCPSMI_BASE                           XE_REG(0x880c)
 
 #define        MIRROR_FUSE3                            XE_REG(0x9118)
index 2e0b2e40d8f3b3c2bfe6db4510d69f57d98533f4..82e3705b88cd916e7456d47e0bb106df8f748ca3 100644 (file)
@@ -15,6 +15,7 @@
 #include <drm/drm_print.h>
 #include <drm/xe_drm.h>
 
+#include "regs/xe_gt_regs.h"
 #include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_debugfs.h"
@@ -26,6 +27,7 @@
 #include "xe_exec.h"
 #include "xe_ggtt.h"
 #include "xe_gt.h"
+#include "xe_gt_mcr.h"
 #include "xe_irq.h"
 #include "xe_mmio.h"
 #include "xe_module.h"
@@ -401,6 +403,30 @@ int xe_device_probe_early(struct xe_device *xe)
        return 0;
 }
 
+static int xe_device_set_has_flat_ccs(struct  xe_device *xe)
+{
+       u32 reg;
+       int err;
+
+       if (GRAPHICS_VER(xe) < 20 || !xe->info.has_flat_ccs)
+               return 0;
+
+       struct xe_gt *gt = xe_root_mmio_gt(xe);
+
+       err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+       if (err)
+               return err;
+
+       reg = xe_gt_mcr_unicast_read_any(gt, XE2_FLAT_CCS_BASE_RANGE_LOWER);
+       xe->info.has_flat_ccs = (reg & XE2_FLAT_CCS_ENABLE);
+
+       if (!xe->info.has_flat_ccs)
+               drm_dbg(&xe->drm,
+                       "Flat CCS has been disabled in bios, May lead to performance impact");
+
+       return xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
+}
+
 int xe_device_probe(struct xe_device *xe)
 {
        struct xe_tile *tile;
@@ -456,6 +482,10 @@ int xe_device_probe(struct xe_device *xe)
                        goto err_irq_shutdown;
        }
 
+       err = xe_device_set_has_flat_ccs(xe);
+       if (err)
+               return err;
+
        err = xe_mmio_probe_vram(xe);
        if (err)
                goto err_irq_shutdown;