summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_mmio.c
diff options
context:
space:
mode:
authorKoby Elbaz <kelbaz@habana.ai>2023-10-29 20:53:26 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:43:34 +0300
commit37d1eaab34ab9cdd6022a188ce6b77a88f81c7e2 (patch)
tree87f7000a1f42469490264c8f0be4df3e0940aedb /drivers/gpu/drm/xe/xe_mmio.c
parent04dfef5b41afc85e8de7b0397050cdb51db35eda (diff)
downloadlinux-37d1eaab34ab9cdd6022a188ce6b77a88f81c7e2.tar.xz
drm/xe: move the lmem verification code into a separate function
If lmem (VRAM) is not fully initialized, the punit will power down the GT, which will prevent register access from the driver side. That code moved into a corresponding function (xe_verify_lmem_ready) to make the code clearer. Signed-off-by: Koby Elbaz <kelbaz@habana.ai> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/20231029175326.626745-1-kelbaz@habana.ai Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_mmio.c')
-rw-r--r--drivers/gpu/drm/xe/xe_mmio.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
index 0da4f75c07bf..d8f9fabf715e 100644
--- a/drivers/gpu/drm/xe/xe_mmio.c
+++ b/drivers/gpu/drm/xe/xe_mmio.c
@@ -381,10 +381,27 @@ static void mmio_fini(struct drm_device *drm, void *arg)
iounmap(xe->mem.vram.mapping);
}
+static int xe_verify_lmem_ready(struct xe_device *xe)
+{
+ struct xe_gt *gt = xe_root_mmio_gt(xe);
+
+ /*
+ * The boot firmware initializes local memory and assesses its health.
+ * If memory training fails, the punit will have been instructed to
+ * keep the GT powered down; we won't be able to communicate with it
+ * and we should not continue with driver initialization.
+ */
+ if (IS_DGFX(xe) && !(xe_mmio_read32(gt, GU_CNTL) & LMEM_INIT)) {
+ drm_err(&xe->drm, "VRAM not initialized by firmware\n");
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
int xe_mmio_init(struct xe_device *xe)
{
struct xe_tile *root_tile = xe_device_get_root_tile(xe);
- struct xe_gt *gt = xe_root_mmio_gt(xe);
const int mmio_bar = 0;
int err;
@@ -409,16 +426,9 @@ int xe_mmio_init(struct xe_device *xe)
root_tile->mmio.size = xe->mmio.size;
root_tile->mmio.regs = xe->mmio.regs;
- /*
- * The boot firmware initializes local memory and assesses its health.
- * If memory training fails, the punit will have been instructed to
- * keep the GT powered down; we won't be able to communicate with it
- * and we should not continue with driver initialization.
- */
- if (IS_DGFX(xe) && !(xe_mmio_read32(gt, GU_CNTL) & LMEM_INIT)) {
- drm_err(&xe->drm, "VRAM not initialized by firmware\n");
- return -ENODEV;
- }
+ err = xe_verify_lmem_ready(xe);
+ if (err)
+ return err;
err = xe_set_dma_info(xe);
if (err)