Skip to contentSkip to conversation

Initial Xe driver submission

RFC PATCH In review Matthew Brost 14 participants 87 messages Dec 22, 2022 – Mar 9, 2023 Page 2 of 2

Subsystems (13)
lore
Share & tools
lore
#61 lore raw

Re: [Intel-gfx] [RFC PATCH 11/20] drm/i915: Remove gem and overlay frontbuffer tracking

In reply to Matthew Brost
Quoted 4 lines · Matthew Brost

From: Maarten Lankhorst <[email protected]>

Frontbuffer update handling should be done explicitly by using dirtyfb calls only.

A bit terse - questions around if this breaks something, and if it does what and why it is okay, were left hanging in the air in the previous thread ([email protected]). Can that be discussed please?

Plus, this does not appear to be either DRM core or Xe work so maybe doesn't need to be in this series to start with?!

Regards,

Tvrtko

Quoted 413 lines
---
  drivers/gpu/drm/i915/display/i9xx_plane.c     |  1 +
  drivers/gpu/drm/i915/display/intel_drrs.c     |  1 +
  drivers/gpu/drm/i915/display/intel_fb.c       |  1 +
  drivers/gpu/drm/i915/display/intel_overlay.c  | 14 -----------
  .../drm/i915/display/intel_plane_initial.c    |  1 +
  drivers/gpu/drm/i915/display/intel_psr.c      |  1 +
  .../drm/i915/display/skl_universal_plane.c    |  1 +
  drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |  4 ---
  drivers/gpu/drm/i915/gem/i915_gem_domain.c    |  7 ------
  .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |  2 --
  drivers/gpu/drm/i915/gem/i915_gem_object.c    | 25 -------------------
  drivers/gpu/drm/i915/gem/i915_gem_object.h    | 22 ----------------
  drivers/gpu/drm/i915/gem/i915_gem_phys.c      |  4 ---
  drivers/gpu/drm/i915/i915_driver.c            |  1 +
  drivers/gpu/drm/i915/i915_gem.c               |  8 ------
  drivers/gpu/drm/i915/i915_gem_gtt.c           |  1 -
  drivers/gpu/drm/i915/i915_vma.c               | 12 ---------
  17 files changed, 7 insertions(+), 99 deletions(-)
drivers/gpu/drm/i915/display/i9xx_plane.c +1 -0
index ecaeb7dc196b..633e462d96a0 100644
@@ -17,6 +17,7 @@
  #include "intel_display_types.h"
  #include "intel_fb.h"
  #include "intel_fbc.h"
+#include "intel_frontbuffer.h"
  #include "intel_sprite.h"
 
  /* Primary plane formats for gen <= 3 */
drivers/gpu/drm/i915/display/intel_drrs.c +1 -0
index 5b9e44443814..3503d112387d 100644
@@ -9,6 +9,7 @@
  #include "intel_de.h"
  #include "intel_display_types.h"
  #include "intel_drrs.h"
+#include "intel_frontbuffer.h"
  #include "intel_panel.h"
 
  /**
drivers/gpu/drm/i915/display/intel_fb.c +1 -0
index 63137ae5ab21..7cf31c87884c 100644
@@ -12,6 +12,7 @@
  #include "intel_display_types.h"
  #include "intel_dpt.h"
  #include "intel_fb.h"
+#include "intel_frontbuffer.h"
 
  #define check_array_bounds(i915, a, i) drm_WARN_ON(&(i915)->drm, (i) >= ARRAY_SIZE(a))
 
drivers/gpu/drm/i915/display/intel_overlay.c +0 -14
index c12bdca8da9b..5b86563ce577 100644
@@ -186,7 +186,6 @@ struct intel_overlay {
  	struct intel_crtc *crtc;
  	struct i915_vma *vma;
  	struct i915_vma *old_vma;
-	struct intel_frontbuffer *frontbuffer;
  	bool active;
  	bool pfit_active;
  	u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */
@@ -287,20 +286,9 @@ static void intel_overlay_flip_prepare(struct intel_overlay *overlay,
  				       struct i915_vma *vma)
  {
  	enum pipe pipe = overlay->crtc->pipe;
-	struct intel_frontbuffer *frontbuffer = NULL;
 
  	drm_WARN_ON(&overlay->i915->drm, overlay->old_vma);
 
-	if (vma)
-		frontbuffer = intel_frontbuffer_get(vma->obj);
-
-	intel_frontbuffer_track(overlay->frontbuffer, frontbuffer,
-				INTEL_FRONTBUFFER_OVERLAY(pipe));
-
-	if (overlay->frontbuffer)
-		intel_frontbuffer_put(overlay->frontbuffer);
-	overlay->frontbuffer = frontbuffer;
-
  	intel_frontbuffer_flip_prepare(overlay->i915,
  				       INTEL_FRONTBUFFER_OVERLAY(pipe));
 
@@ -810,8 +798,6 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
  		goto out_pin_section;
  	}
 
-	i915_gem_object_flush_frontbuffer(new_bo, ORIGIN_DIRTYFB);
-
  	if (!overlay->active) {
  		const struct intel_crtc_state *crtc_state =
  			overlay->crtc->config;
drivers/gpu/drm/i915/display/intel_plane_initial.c +1 -0
index 76be796df255..cad9c8884af3 100644
@@ -9,6 +9,7 @@
  #include "intel_display.h"
  #include "intel_display_types.h"
  #include "intel_fb.h"
+#include "intel_frontbuffer.h"
  #include "intel_plane_initial.h"
 
  static bool
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index 9820e5fdd087..bc998b526d88 100644
@@ -33,6 +33,7 @@
  #include "intel_de.h"
  #include "intel_display_types.h"
  #include "intel_dp_aux.h"
+#include "intel_frontbuffer.h"
  #include "intel_hdmi.h"
  #include "intel_psr.h"
  #include "intel_snps_phy.h"
drivers/gpu/drm/i915/display/skl_universal_plane.c +1 -0
index 4b79c2d2d617..2f5524f380b0 100644
@@ -16,6 +16,7 @@
  #include "intel_display_types.h"
  #include "intel_fb.h"
  #include "intel_fbc.h"
+#include "intel_frontbuffer.h"
  #include "intel_psr.h"
  #include "intel_sprite.h"
  #include "skl_scaler.h"
drivers/gpu/drm/i915/gem/i915_gem_clflush.c +0 -4
index b3b398fe689c..df2db78b10ca 100644
@@ -6,8 +6,6 @@
 
  #include <drm/drm_cache.h>
 
-#include "display/intel_frontbuffer.h"
-
  #include "i915_drv.h"
  #include "i915_gem_clflush.h"
  #include "i915_sw_fence_work.h"
@@ -22,8 +20,6 @@ static void __do_clflush(struct drm_i915_gem_object *obj)
  {
  	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
  	drm_clflush_sg(obj->mm.pages);
-
-	i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
  }
 
  static void clflush_work(struct dma_fence_work *base)
drivers/gpu/drm/i915/gem/i915_gem_domain.c +0 -7
index 9969e687ad85..cd5505da4884 100644
@@ -4,7 +4,6 @@
   * Copyright © 2014-2016 Intel Corporation
   */
 
-#include "display/intel_frontbuffer.h"
  #include "gt/intel_gt.h"
 
  #include "i915_drv.h"
@@ -65,8 +64,6 @@ flush_write_domain(struct drm_i915_gem_object *obj, unsigned int flush_domains)
  				intel_gt_flush_ggtt_writes(vma->vm->gt);
  		}
  		spin_unlock(&obj->vma.lock);
-
-		i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
  		break;
 
  	case I915_GEM_DOMAIN_WC:
@@ -629,9 +626,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
  out_unlock:
  	i915_gem_object_unlock(obj);
 
-	if (!err && write_domain)
-		i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
-
  out:
  	i915_gem_object_put(obj);
  	return err;
@@ -742,7 +736,6 @@ int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj,
  	}
 
  out:
-	i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
  	obj->mm.dirty = true;
  	/* return with the pages pinned */
  	return 0;
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +0 -2
index f98600ca7557..08f84d4f4f92 100644
@@ -11,8 +11,6 @@
 
  #include <drm/drm_syncobj.h>
 
-#include "display/intel_frontbuffer.h"
-
  #include "gem/i915_gem_ioctls.h"
  #include "gt/intel_context.h"
  #include "gt/intel_gpu_commands.h"
drivers/gpu/drm/i915/gem/i915_gem_object.c +0 -25
index 1a0886b8aaa1..d2fef38cd12e 100644
@@ -27,7 +27,6 @@
 
  #include <drm/drm_cache.h>
 
-#include "display/intel_frontbuffer.h"
  #include "pxp/intel_pxp.h"
 
  #include "i915_drv.h"
@@ -400,30 +399,6 @@ static void i915_gem_free_object(struct drm_gem_object *gem_obj)
  		queue_work(i915->wq, &i915->mm.free_work);
  }
 
-void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
-					 enum fb_op_origin origin)
-{
-	struct intel_frontbuffer *front;
-
-	front = __intel_frontbuffer_get(obj);
-	if (front) {
-		intel_frontbuffer_flush(front, origin);
-		intel_frontbuffer_put(front);
-	}
-}
-
-void __i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
-					      enum fb_op_origin origin)
-{
-	struct intel_frontbuffer *front;
-
-	front = __intel_frontbuffer_get(obj);
-	if (front) {
-		intel_frontbuffer_invalidate(front, origin);
-		intel_frontbuffer_put(front);
-	}
-}
-
  static void
  i915_gem_object_read_from_page_kmap(struct drm_i915_gem_object *obj, u64 offset, void *dst, int size)
  {
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -22
index 3db53769864c..90dba761889c 100644
@@ -11,7 +11,6 @@
  #include <drm/drm_file.h>
  #include <drm/drm_device.h>
 
-#include "display/intel_frontbuffer.h"
  #include "intel_memory_region.h"
  #include "i915_gem_object_types.h"
  #include "i915_gem_gtt.h"
@@ -573,27 +572,6 @@ int i915_gem_object_wait_priority(struct drm_i915_gem_object *obj,
  				  unsigned int flags,
  				  const struct i915_sched_attr *attr);
 
-void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
-					 enum fb_op_origin origin);
-void __i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
-					      enum fb_op_origin origin);
-
-static inline void
-i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
-				  enum fb_op_origin origin)
-{
-	if (unlikely(rcu_access_pointer(obj->frontbuffer)))
-		__i915_gem_object_flush_frontbuffer(obj, origin);
-}
-
-static inline void
-i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
-				       enum fb_op_origin origin)
-{
-	if (unlikely(rcu_access_pointer(obj->frontbuffer)))
-		__i915_gem_object_invalidate_frontbuffer(obj, origin);
-}
-
  int i915_gem_object_read_from_page(struct drm_i915_gem_object *obj, u64 offset, void *dst, int size);
 
  bool i915_gem_object_is_shmem(const struct drm_i915_gem_object *obj);
drivers/gpu/drm/i915/gem/i915_gem_phys.c +0 -4
index 68453572275b..4cf57676e180 100644
@@ -156,15 +156,11 @@ int i915_gem_object_pwrite_phys(struct drm_i915_gem_object *obj,
  	 * We manually control the domain here and pretend that it
  	 * remains coherent i.e. in the GTT domain, like shmem_pwrite.
  	 */
-	i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
-
  	if (copy_from_user(vaddr, user_data, args->size))
  		return -EFAULT;
 
  	drm_clflush_virt_range(vaddr, args->size);
  	intel_gt_chipset_flush(to_gt(i915));
-
-	i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
  	return 0;
  }
 
drivers/gpu/drm/i915/i915_driver.c +1 -0
index c1e427ba57ae..f4201f9c5f84 100644
@@ -346,6 +346,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
 
  	spin_lock_init(&dev_priv->irq_lock);
  	spin_lock_init(&dev_priv->gpu_error.lock);
+	spin_lock_init(&dev_priv->display.fb_tracking.lock);
  	mutex_init(&dev_priv->display.backlight.lock);
 
  	mutex_init(&dev_priv->sb_lock);
drivers/gpu/drm/i915/i915_gem.c +0 -8
index 969581e7106f..594891291735 100644
@@ -40,7 +40,6 @@
  #include <drm/drm_vma_manager.h>
 
  #include "display/intel_display.h"
-#include "display/intel_frontbuffer.h"
 
  #include "gem/i915_gem_clflush.h"
  #include "gem/i915_gem_context.h"
@@ -569,8 +568,6 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,
  		goto out_rpm;
  	}
 
-	i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
-
  	user_data = u64_to_user_ptr(args->data_ptr);
  	offset = args->offset;
  	remain = args->size;
@@ -613,7 +610,6 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,
  	}
 
  	intel_gt_flush_ggtt_writes(ggtt->vm.gt);
-	i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
 
  	i915_gem_gtt_cleanup(obj, &node, vma);
  out_rpm:
@@ -700,8 +696,6 @@ i915_gem_shmem_pwrite(struct drm_i915_gem_object *obj,
  		offset = 0;
  	}
 
-	i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
-
  	i915_gem_object_unpin_pages(obj);
  	return ret;
 
@@ -1272,8 +1266,6 @@ void i915_gem_init_early(struct drm_i915_private *dev_priv)
  {
  	i915_gem_init__mm(dev_priv);
  	i915_gem_init__contexts(dev_priv);
-
-	spin_lock_init(&dev_priv->display.fb_tracking.lock);
  }
 
  void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -1
index 7bd1861ddbdf..a9662cc6ed1e 100644
@@ -15,7 +15,6 @@
  #include <asm/set_memory.h>
  #include <asm/smp.h>
 
-#include "display/intel_frontbuffer.h"
  #include "gt/intel_gt.h"
  #include "gt/intel_gt_requests.h"
 
drivers/gpu/drm/i915/i915_vma.c +0 -12
index 7d044888ac33..e3b73175805b 100644
@@ -26,7 +26,6 @@
  #include <linux/dma-fence-array.h>
  #include <drm/drm_gem.h>
 
-#include "display/intel_frontbuffer.h"
  #include "gem/i915_gem_lmem.h"
  #include "gem/i915_gem_tiling.h"
  #include "gt/intel_engine.h"
@@ -1901,17 +1900,6 @@ int _i915_vma_move_to_active(struct i915_vma *vma,
  			return err;
  	}
 
-	if (flags & EXEC_OBJECT_WRITE) {
-		struct intel_frontbuffer *front;
-
-		front = __intel_frontbuffer_get(obj);
-		if (unlikely(front)) {
-			if (intel_frontbuffer_invalidate(front, ORIGIN_CS))
-				i915_active_add_request(&front->write, rq);
-			intel_frontbuffer_put(front);
-		}
-	}
-
  	if (fence) {
  		struct dma_fence *curr;
  		enum dma_resv_usage usage;
author maintainer
#62 lore raw

RFC PATCH 12/20 drm/i915/display: Neuter frontbuffer tracking harder

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

Remove intel_frontbuffer type, and use fb->bits.

---
 drivers/gpu/drm/i915/display/intel_cursor.c   |   6 +-
 drivers/gpu/drm/i915/display/intel_display.c  |   4 +-
 .../drm/i915/display/intel_display_types.h    |   8 +-
 drivers/gpu/drm/i915/display/intel_fb.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
 drivers/gpu/drm/i915/display/intel_fbdev.c    |   7 +-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 ++----------------
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +++---------
 .../drm/i915/display/intel_plane_initial.c    |   2 +-
 9 files changed, 32 insertions(+), 182 deletions(-)
drivers/gpu/drm/i915/display/intel_cursor.c +3 -3
index d190fa0d393b..371009f8e194 100644
@@ -692,10 +692,10 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 	if (ret)
 		goto out_free;
 
-	intel_frontbuffer_flush(to_intel_frontbuffer(new_plane_state->hw.fb),
+	intel_frontbuffer_flush(to_intel_framebuffer(new_plane_state->hw.fb),
 				ORIGIN_CURSOR_UPDATE);
-	intel_frontbuffer_track(to_intel_frontbuffer(old_plane_state->hw.fb),
-				to_intel_frontbuffer(new_plane_state->hw.fb),
+	intel_frontbuffer_track(to_intel_framebuffer(old_plane_state->hw.fb),
+				to_intel_framebuffer(new_plane_state->hw.fb),
 				plane->frontbuffer_bit);
 
 	/* Swap plane state */
drivers/gpu/drm/i915/display/intel_display.c +2 -2
index e75b9b2a0e01..7a6191cad52a 100644
@@ -7663,8 +7663,8 @@ static void intel_atomic_track_fbs(struct intel_atomic_state *state)
 
 	for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
 					     new_plane_state, i)
-		intel_frontbuffer_track(to_intel_frontbuffer(old_plane_state->hw.fb),
-					to_intel_frontbuffer(new_plane_state->hw.fb),
+		intel_frontbuffer_track(to_intel_framebuffer(old_plane_state->hw.fb),
+					to_intel_framebuffer(new_plane_state->hw.fb),
 					plane->frontbuffer_bit);
 }
 
drivers/gpu/drm/i915/display/intel_display_types.h +1 -7
index 32e8b2fc3cc6..34250a9cf3e1 100644
@@ -132,7 +132,7 @@ struct intel_fb_view {
 
 struct intel_framebuffer {
 	struct drm_framebuffer base;
-	struct intel_frontbuffer *frontbuffer;
+	atomic_t bits;
 
 	/* Params to remap the FB pages and program the plane registers in each view. */
 	struct intel_fb_view normal_view;
@@ -2056,10 +2056,4 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_
 	return i915_ggtt_offset(plane_state->ggtt_vma);
 }
 
-static inline struct intel_frontbuffer *
-to_intel_frontbuffer(struct drm_framebuffer *fb)
-{
-	return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
-}
-
 #endif /*  __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_fb.c +3 -8
index 7cf31c87884c..56cdacf33db2 100644
@@ -1833,8 +1833,7 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	if (intel_fb_uses_dpt(fb))
 		intel_dpt_destroy(intel_fb->dpt_vm);
 
-	intel_frontbuffer_put(intel_fb->frontbuffer);
-
+	drm_gem_object_put(fb->obj[0]);
 	kfree(intel_fb);
 }
 
@@ -1863,7 +1862,7 @@ static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb,
 	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 
 	i915_gem_object_flush_if_display(obj);
-	intel_frontbuffer_flush(to_intel_frontbuffer(fb), ORIGIN_DIRTYFB);
+	intel_frontbuffer_flush(to_intel_framebuffer(fb), ORIGIN_DIRTYFB);
 
 	return 0;
 }
@@ -1885,10 +1884,6 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 	int ret = -EINVAL;
 	int i;
 
-	intel_fb->frontbuffer = intel_frontbuffer_get(obj);
-	if (!intel_fb->frontbuffer)
-		return -ENOMEM;
-
 	i915_gem_object_lock(obj, NULL);
 	tiling = i915_gem_object_get_tiling(obj);
 	stride = i915_gem_object_get_stride(obj);
@@ -2021,10 +2016,10 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 		goto err;
 	}
 
+	drm_gem_object_get(fb->obj[0]);
 	return 0;
 
 err:
-	intel_frontbuffer_put(intel_fb->frontbuffer);
 	return ret;
 }
 
drivers/gpu/drm/i915/display/intel_fb_pin.c +0 -6
index 1aca7552a85d..70bce1a99a53 100644
@@ -37,9 +37,6 @@ intel_pin_fb_obj_dpt(struct drm_framebuffer *fb,
 	 */
 	GEM_WARN_ON(vm->bind_async_flags);
 
-	if (WARN_ON(!i915_gem_object_is_framebuffer(obj)))
-		return ERR_PTR(-EINVAL);
-
 	alignment = 4096 * 512;
 
 	atomic_inc(&dev_priv->gpu_error.pending_fb_pin);
@@ -119,9 +116,6 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
 	u32 alignment;
 	int ret;
 
-	if (drm_WARN_ON(dev, !i915_gem_object_is_framebuffer(obj)))
-		return ERR_PTR(-EINVAL);
-
 	if (phys_cursor)
 		alignment = intel_cursor_alignment(dev_priv);
 	else
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -6
index 03ed4607a46d..8ccdf1a964ff 100644
@@ -67,14 +67,9 @@ struct intel_fbdev {
 	struct mutex hpd_lock;
 };
 
-static struct intel_frontbuffer *to_frontbuffer(struct intel_fbdev *ifbdev)
-{
-	return ifbdev->fb->frontbuffer;
-}
-
 static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
 {
-	intel_frontbuffer_invalidate(to_frontbuffer(ifbdev), ORIGIN_CPU);
+	intel_frontbuffer_invalidate(ifbdev->fb, ORIGIN_CPU);
 }
 
 static int intel_fbdev_set_par(struct fb_info *info)
drivers/gpu/drm/i915/display/intel_frontbuffer.c +8 -95

144 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_frontbuffer.h +13 -54

120 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_plane_initial.c +1 -1
index cad9c8884af3..82a54152d731 100644
@@ -281,7 +281,7 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,
 	plane_state->uapi.crtc = &crtc->base;
 	intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc);
 
-	atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits);
+	atomic_or(plane->frontbuffer_bit, &to_intel_framebuffer(fb)->bits);
 }
 
 static void plane_config_fini(struct intel_initial_plane_config *plane_config)
Signature · 1 line
2.37.3
author maintainer
#63 lore raw

RFC PATCH 13/20 drm/i915/display: Add more macros to remove all direct calls to uncore

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

---
 drivers/gpu/drm/i915/display/intel_de.h | 38 +++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
drivers/gpu/drm/i915/display/intel_de.h +38 -0
index 3dbd76fdabd6..3394044d281c 100644
@@ -9,6 +9,7 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "intel_uncore.h"
+#include "intel_pcode.h"
 
 static inline u32
 intel_de_read(struct drm_i915_private *i915, i915_reg_t reg)
@@ -116,4 +117,41 @@ intel_de_write_notrace(struct drm_i915_private *i915, i915_reg_t reg, u32 val)
 	intel_uncore_write_notrace(&i915->uncore, reg, val);
 }
 
+static inline void
+intel_de_write_samevalue(struct drm_i915_private *i915, i915_reg_t reg)
+{
+	spin_lock_irq(&i915->uncore.lock);
+	intel_de_write_fw(i915, reg, intel_de_read_fw(i915, reg));
+	spin_unlock_irq(&i915->uncore.lock);
+}
+
+static inline int
+intel_de_pcode_write_timeout(struct drm_i915_private *i915, u32 mbox, u32 val,
+			    int fast_timeout_us, int slow_timeout_ms)
+{
+	return snb_pcode_write_timeout(&i915->uncore, mbox, val,
+				       fast_timeout_us, slow_timeout_ms);
+}
+
+static inline int
+intel_de_pcode_write(struct drm_i915_private *i915, u32 mbox, u32 val)
+{
+
+	return snb_pcode_write(&i915->uncore, mbox, val);
+}
+
+static inline int
+intel_de_pcode_read(struct drm_i915_private *i915, u32 mbox, u32 *val, u32 *val1)
+{
+	return snb_pcode_read(&i915->uncore, mbox, val, val1);
+}
+
+static inline int intel_de_pcode_request(struct drm_i915_private *i915, u32 mbox,
+					 u32 request, u32 reply_mask, u32 reply,
+					 int timeout_base_ms)
+{
+	return skl_pcode_request(&i915->uncore, mbox, request, reply_mask, reply,
+				 timeout_base_ms);
+}
+
 #endif /* __INTEL_DE_H__ */
Signature · 1 line
2.37.3
author maintainer
#64 lore raw

RFC PATCH 14/20 drm/i915/display: Remove all uncore mmio accesses in favor of intel_de

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

---
 drivers/gpu/drm/i915/display/hsw_ips.c        |  7 ++-
 drivers/gpu/drm/i915/display/intel_bios.c     | 25 ++++++-----
 drivers/gpu/drm/i915/display/intel_bw.c       | 34 +++++++-------
 drivers/gpu/drm/i915/display/intel_cdclk.c    | 45 +++++++++----------
 drivers/gpu/drm/i915/display/intel_display.c  |  1 -
 .../drm/i915/display/intel_display_power.c    |  3 +-
 .../i915/display/intel_display_power_well.c   |  7 ++-
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |  9 ++--
 drivers/gpu/drm/i915/display/intel_hdcp.c     |  9 ++--
 drivers/gpu/drm/i915/display/intel_hdmi.c     |  1 -
 drivers/gpu/drm/i915/display/skl_watermark.c  | 23 +++++-----
 11 files changed, 78 insertions(+), 86 deletions(-)
drivers/gpu/drm/i915/display/hsw_ips.c +3 -4
index 83aa3800245f..b2253f7cfc00 100644
@@ -8,7 +8,6 @@
 #include "i915_reg.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
-#include "intel_pcode.h"
 
 static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
 {
@@ -28,8 +27,8 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
 
 	if (IS_BROADWELL(i915)) {
 		drm_WARN_ON(&i915->drm,
-			    snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL,
-					    IPS_ENABLE | IPS_PCODE_CONTROL));
+			    intel_de_pcode_write(i915, DISPLAY_IPS_CONTROL,
+						 IPS_ENABLE | IPS_PCODE_CONTROL));
 		/*
 		 * Quoting Art Runyan: "its not safe to expect any particular
 		 * value in IPS_CTL bit 31 after enabling IPS through the
@@ -62,7 +61,7 @@ bool hsw_ips_disable(const struct intel_crtc_state *crtc_state)
 
 	if (IS_BROADWELL(i915)) {
 		drm_WARN_ON(&i915->drm,
-			    snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL, 0));
+			    intel_de_pcode_write(i915, DISPLAY_IPS_CONTROL, 0));
 		/*
 		 * Wait for PCODE to finish disabling IPS. The BSpec specified
 		 * 42ms timeout value leads to occasional timeouts so use 100ms
drivers/gpu/drm/i915/display/intel_bios.c +13 -12
index 55544d484318..755e56f9db6c 100644
@@ -29,9 +29,10 @@
 #include <drm/display/drm_dp_helper.h>
 #include <drm/display/drm_dsc_helper.h>
 
-#include "display/intel_display.h"
-#include "display/intel_display_types.h"
-#include "display/intel_gmbus.h"
+#include "intel_de.h"
+#include "intel_display.h"
+#include "intel_display_types.h"
+#include "intel_gmbus.h"
 
 #include "i915_drv.h"
 #include "i915_reg.h"
@@ -3001,16 +3002,16 @@ static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
 	u16 vbt_size;
 	u32 *vbt;
 
-	static_region = intel_uncore_read(&i915->uncore, SPI_STATIC_REGIONS);
+	static_region = intel_de_read(i915, SPI_STATIC_REGIONS);
 	static_region &= OPTIONROM_SPI_REGIONID_MASK;
-	intel_uncore_write(&i915->uncore, PRIMARY_SPI_REGIONID, static_region);
+	intel_de_write(i915, PRIMARY_SPI_REGIONID, static_region);
 
-	oprom_offset = intel_uncore_read(&i915->uncore, OROM_OFFSET);
+	oprom_offset = intel_de_read(i915, OROM_OFFSET);
 	oprom_offset &= OROM_OFFSET_MASK;
 
 	for (count = 0; count < oprom_size; count += 4) {
-		intel_uncore_write(&i915->uncore, PRIMARY_SPI_ADDRESS, oprom_offset + count);
-		data = intel_uncore_read(&i915->uncore, PRIMARY_SPI_TRIGGER);
+		intel_de_write(i915, PRIMARY_SPI_ADDRESS, oprom_offset + count);
+		data = intel_de_read(i915, PRIMARY_SPI_TRIGGER);
 
 		if (data == *((const u32 *)"$VBT")) {
 			found = oprom_offset + count;
@@ -3022,9 +3023,9 @@ static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
 		goto err_not_found;
 
 	/* Get VBT size and allocate space for the VBT */
-	intel_uncore_write(&i915->uncore, PRIMARY_SPI_ADDRESS, found +
+	intel_de_write(i915, PRIMARY_SPI_ADDRESS, found +
 		   offsetof(struct vbt_header, vbt_size));
-	vbt_size = intel_uncore_read(&i915->uncore, PRIMARY_SPI_TRIGGER);
+	vbt_size = intel_de_read(i915, PRIMARY_SPI_TRIGGER);
 	vbt_size &= 0xffff;
 
 	vbt = kzalloc(round_up(vbt_size, 4), GFP_KERNEL);
@@ -3032,8 +3033,8 @@ static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
 		goto err_not_found;
 
 	for (count = 0; count < vbt_size; count += 4) {
-		intel_uncore_write(&i915->uncore, PRIMARY_SPI_ADDRESS, found + count);
-		data = intel_uncore_read(&i915->uncore, PRIMARY_SPI_TRIGGER);
+		intel_de_write(i915, PRIMARY_SPI_ADDRESS, found + count);
+		data = intel_de_read(i915, PRIMARY_SPI_TRIGGER);
 		*(vbt + store++) = data;
 	}
 
drivers/gpu/drm/i915/display/intel_bw.c +17 -17
index 1c236f02b380..54e03a3eaa0f 100644
@@ -11,11 +11,11 @@
 #include "intel_atomic.h"
 #include "intel_bw.h"
 #include "intel_cdclk.h"
+#include "intel_de.h"
 #include "intel_display_core.h"
 #include "intel_display_types.h"
 #include "skl_watermark.h"
 #include "intel_mchbar_regs.h"
-#include "intel_pcode.h"
 
 /* Parameters for Qclk Geyserville (QGV) */
 struct intel_qgv_point {
@@ -44,7 +44,7 @@ static int dg1_mchbar_read_qgv_point_info(struct drm_i915_private *dev_priv,
 	u32 dclk_ratio, dclk_reference;
 	u32 val;
 
-	val = intel_uncore_read(&dev_priv->uncore, SA_PERF_STATUS_0_0_0_MCHBAR_PC);
+	val = intel_de_read(dev_priv, SA_PERF_STATUS_0_0_0_MCHBAR_PC);
 	dclk_ratio = REG_FIELD_GET(DG1_QCLK_RATIO_MASK, val);
 	if (val & DG1_QCLK_REFERENCE)
 		dclk_reference = 6; /* 6 * 16.666 MHz = 100 MHz */
@@ -52,18 +52,18 @@ static int dg1_mchbar_read_qgv_point_info(struct drm_i915_private *dev_priv,
 		dclk_reference = 8; /* 8 * 16.666 MHz = 133 MHz */
 	sp->dclk = DIV_ROUND_UP((16667 * dclk_ratio * dclk_reference) + 500, 1000);
 
-	val = intel_uncore_read(&dev_priv->uncore, SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
+	val = intel_de_read(dev_priv, SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
 	if (val & DG1_GEAR_TYPE)
 		sp->dclk *= 2;
 
 	if (sp->dclk == 0)
 		return -EINVAL;
 
-	val = intel_uncore_read(&dev_priv->uncore, MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR);
+	val = intel_de_read(dev_priv, MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR);
 	sp->t_rp = REG_FIELD_GET(DG1_DRAM_T_RP_MASK, val);
 	sp->t_rdpre = REG_FIELD_GET(DG1_DRAM_T_RDPRE_MASK, val);
 
-	val = intel_uncore_read(&dev_priv->uncore, MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR_HIGH);
+	val = intel_de_read(dev_priv, MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR_HIGH);
 	sp->t_rcd = REG_FIELD_GET(DG1_DRAM_T_RCD_MASK, val);
 	sp->t_ras = REG_FIELD_GET(DG1_DRAM_T_RAS_MASK, val);
 
@@ -80,9 +80,9 @@ static int icl_pcode_read_qgv_point_info(struct drm_i915_private *dev_priv,
 	u16 dclk;
 	int ret;
 
-	ret = snb_pcode_read(&dev_priv->uncore, ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
-			     ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO(point),
-			     &val, &val2);
+	ret = intel_de_pcode_read(dev_priv, ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
+				  ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO(point),
+				  &val, &val2);
 	if (ret)
 		return ret;
 
@@ -106,8 +106,8 @@ static int adls_pcode_read_psf_gv_point_info(struct drm_i915_private *dev_priv,
 	int ret;
 	int i;
 
-	ret = snb_pcode_read(&dev_priv->uncore, ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
-			     ADL_PCODE_MEM_SS_READ_PSF_GV_INFO, &val, NULL);
+	ret = intel_de_pcode_read(dev_priv, ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
+				  ADL_PCODE_MEM_SS_READ_PSF_GV_INFO, &val, NULL);
 	if (ret)
 		return ret;
 
@@ -125,11 +125,11 @@ int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv,
 	int ret;
 
 	/* bspec says to keep retrying for at least 1 ms */
-	ret = skl_pcode_request(&dev_priv->uncore, ICL_PCODE_SAGV_DE_MEM_SS_CONFIG,
-				points_mask,
-				ICL_PCODE_REP_QGV_MASK | ADLS_PCODE_REP_PSF_MASK,
-				ICL_PCODE_REP_QGV_SAFE | ADLS_PCODE_REP_PSF_SAFE,
-				1);
+	ret = intel_de_pcode_request(dev_priv, ICL_PCODE_SAGV_DE_MEM_SS_CONFIG,
+				     points_mask,
+				     ICL_PCODE_REP_QGV_MASK | ADLS_PCODE_REP_PSF_MASK,
+				     ICL_PCODE_REP_QGV_SAFE | ADLS_PCODE_REP_PSF_SAFE,
+				     1);
 
 	if (ret < 0) {
 		drm_err(&dev_priv->drm, "Failed to disable qgv points (%d) points: 0x%x\n", ret, points_mask);
@@ -145,9 +145,9 @@ static int mtl_read_qgv_point_info(struct drm_i915_private *dev_priv,
 	u32 val, val2;
 	u16 dclk;
 
-	val = intel_uncore_read(&dev_priv->uncore,
+	val = intel_de_read(dev_priv,
 				MTL_MEM_SS_INFO_QGV_POINT_LOW(point));
-	val2 = intel_uncore_read(&dev_priv->uncore,
+	val2 = intel_de_read(dev_priv,
 				 MTL_MEM_SS_INFO_QGV_POINT_HIGH(point));
 	dclk = REG_FIELD_GET(MTL_DCLK_MASK, val);
 	sp->dclk = DIV_ROUND_UP((16667 * dclk), 1000);
drivers/gpu/drm/i915/display/intel_cdclk.c +22 -23

98 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_display.c +0 -1
index 7a6191cad52a..ef9bab4043ee 100644
@@ -105,7 +105,6 @@
 #include "intel_panel.h"
 #include "intel_pch_display.h"
 #include "intel_pch_refclk.h"
-#include "intel_pcode.h"
 #include "intel_pipe_crc.h"
 #include "intel_plane_initial.h"
 #include "intel_pm.h"
drivers/gpu/drm/i915/display/intel_display_power.c +1 -2
index 1a23ecd4623a..fd0fedb65e42 100644
@@ -18,7 +18,6 @@
 #include "intel_dmc.h"
 #include "intel_mchbar_regs.h"
 #include "intel_pch_refclk.h"
-#include "intel_pcode.h"
 #include "intel_snps_phy.h"
 #include "skl_watermark.h"
 #include "vlv_sideband.h"
@@ -1206,7 +1205,7 @@ static u32 hsw_read_dcomp(struct drm_i915_private *dev_priv)
 static void hsw_write_dcomp(struct drm_i915_private *dev_priv, u32 val)
 {
 	if (IS_HASWELL(dev_priv)) {
-		if (snb_pcode_write(&dev_priv->uncore, GEN6_PCODE_WRITE_D_COMP, val))
+		if (intel_de_pcode_write(dev_priv, GEN6_PCODE_WRITE_D_COMP, val))
 			drm_dbg_kms(&dev_priv->drm,
 				    "Failed to write to D_COMP\n");
 	} else {
drivers/gpu/drm/i915/display/intel_display_power_well.c +3 -4
index 8710dd41ffd4..a1d75956ae97 100644
@@ -18,7 +18,6 @@
 #include "intel_dpio_phy.h"
 #include "intel_dpll.h"
 #include "intel_hotplug.h"
-#include "intel_pcode.h"
 #include "intel_pps.h"
 #include "intel_tc.h"
 #include "intel_vga.h"
@@ -477,8 +476,8 @@ static void icl_tc_cold_exit(struct drm_i915_private *i915)
 	int ret, tries = 0;
 
 	while (1) {
-		ret = snb_pcode_write_timeout(&i915->uncore, ICL_PCODE_EXIT_TCCOLD, 0,
-					      250, 1);
+		ret = intel_de_pcode_write_timeout(i915, ICL_PCODE_EXIT_TCCOLD, 0,
+						   250, 1);
 		if (ret != -EAGAIN || ++tries == 3)
 			break;
 		msleep(1);
@@ -1740,7 +1739,7 @@ tgl_tc_cold_request(struct drm_i915_private *i915, bool block)
 		 * Spec states that we should timeout the request after 200us
 		 * but the function below will timeout after 500us
 		 */
-		ret = snb_pcode_read(&i915->uncore, TGL_PCODE_TCCOLD, &low_val, &high_val);
+		ret = intel_de_pcode_read(i915, TGL_PCODE_TCCOLD, &low_val, &high_val);
 		if (ret == 0) {
 			if (block &&
 			    (low_val & TGL_PCODE_EXIT_TCCOLD_DATA_L_EXIT_FAILED))
drivers/gpu/drm/i915/display/intel_dpio_phy.c +4 -5
index 7eb7440b3180..25bea6d2da67 100644
@@ -401,11 +401,10 @@ static void _bxt_ddi_phy_init(struct drm_i915_private *dev_priv,
 	 * The flag should get set in 100us according to the HW team, but
 	 * use 1ms due to occasional timeouts observed with that.
 	 */
-	if (intel_wait_for_register_fw(&dev_priv->uncore,
-				       BXT_PORT_CL1CM_DW0(phy),
-				       PHY_RESERVED | PHY_POWER_GOOD,
-				       PHY_POWER_GOOD,
-				       1))
+	if (intel_de_wait_for_register_fw(dev_priv,
+					  BXT_PORT_CL1CM_DW0(phy),
+					  PHY_RESERVED | PHY_POWER_GOOD,
+					  PHY_POWER_GOOD, 1))
 		drm_err(&dev_priv->drm, "timeout during PHY%d power on\n",
 			phy);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -5
index 6406fd487ee5..e62f64dd481f 100644
@@ -24,7 +24,6 @@
 #include "intel_display_types.h"
 #include "intel_hdcp.h"
 #include "intel_hdcp_regs.h"
-#include "intel_pcode.h"
 
 #define KEY_LOAD_TRIES	5
 #define HDCP2_LC_RETRY_CNT			3
@@ -321,7 +320,7 @@ static int intel_hdcp_load_keys(struct drm_i915_private *dev_priv)
 	 * Mailbox interface.
 	 */
 	if (DISPLAY_VER(dev_priv) == 9 && !IS_BROXTON(dev_priv)) {
-		ret = snb_pcode_write(&dev_priv->uncore, SKL_PCODE_LOAD_HDCP_KEYS, 1);
+		ret = intel_de_pcode_write(dev_priv, SKL_PCODE_LOAD_HDCP_KEYS, 1);
 		if (ret) {
 			drm_err(&dev_priv->drm,
 				"Failed to initiate HDCP key load (%d)\n",
@@ -333,9 +332,9 @@ static int intel_hdcp_load_keys(struct drm_i915_private *dev_priv)
 	}
 
 	/* Wait for the keys to load (500us) */
-	ret = __intel_wait_for_register(&dev_priv->uncore, HDCP_KEY_STATUS,
-					HDCP_KEY_LOAD_DONE, HDCP_KEY_LOAD_DONE,
-					10, 1, &val);
+	ret = __intel_de_wait_for_register(dev_priv, HDCP_KEY_STATUS,
+					   HDCP_KEY_LOAD_DONE, HDCP_KEY_LOAD_DONE,
+					   10, 1, &val);
 	if (ret)
 		return ret;
 	else if (!(val & HDCP_KEY_LOAD_STATUS))
drivers/gpu/drm/i915/display/intel_hdmi.c +0 -1
index efa2da080f62..6d097a11f939 100644
@@ -40,7 +40,6 @@
 #include <drm/drm_edid.h>
 #include <drm/intel_lpe_audio.h>
 
-#include "i915_debugfs.h"
 #include "i915_drv.h"
 #include "i915_reg.h"
 #include "intel_atomic.h"
drivers/gpu/drm/i915/display/skl_watermark.c +11 -12
index ae4e9e680c2e..e254fb21b47f 100644
@@ -18,7 +18,6 @@
 #include "i915_drv.h"
 #include "i915_fixed.h"
 #include "i915_reg.h"
-#include "intel_pcode.h"
 #include "intel_pm.h"
 
 static void skl_sagv_disable(struct drm_i915_private *i915);
@@ -81,9 +80,9 @@ intel_sagv_block_time(struct drm_i915_private *i915)
 		u32 val = 0;
 		int ret;
 
-		ret = snb_pcode_read(&i915->uncore,
-				     GEN12_PCODE_READ_SAGV_BLOCK_TIME_US,
-				     &val, NULL);
+		ret = intel_de_pcode_read(i915,
+					  GEN12_PCODE_READ_SAGV_BLOCK_TIME_US,
+					  &val, NULL);
 		if (ret) {
 			drm_dbg_kms(&i915->drm, "Couldn't read SAGV block time!\n");
 			return 0;
@@ -150,8 +149,8 @@ static void skl_sagv_enable(struct drm_i915_private *i915)
 		return;
 
 	drm_dbg_kms(&i915->drm, "Enabling SAGV\n");
-	ret = snb_pcode_write(&i915->uncore, GEN9_PCODE_SAGV_CONTROL,
-			      GEN9_SAGV_ENABLE);
+	ret = intel_de_pcode_write(i915, GEN9_PCODE_SAGV_CONTROL,
+				   GEN9_SAGV_ENABLE);
 
 	/* We don't need to wait for SAGV when enabling */
 
@@ -183,10 +182,10 @@ static void skl_sagv_disable(struct drm_i915_private *i915)
 
 	drm_dbg_kms(&i915->drm, "Disabling SAGV\n");
 	/* bspec says to keep retrying for at least 1 ms */
-	ret = skl_pcode_request(&i915->uncore, GEN9_PCODE_SAGV_CONTROL,
-				GEN9_SAGV_DISABLE,
-				GEN9_SAGV_IS_DISABLED, GEN9_SAGV_IS_DISABLED,
-				1);
+	ret = intel_de_pcode_request(i915, GEN9_PCODE_SAGV_CONTROL,
+				     GEN9_SAGV_DISABLE,
+				     GEN9_SAGV_IS_DISABLED, GEN9_SAGV_IS_DISABLED,
+				     1);
 	/*
 	 * Some skl systems, pre-release machines in particular,
 	 * don't actually have SAGV.
@@ -3224,7 +3223,7 @@ static void skl_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
 
 	/* read the first set of memory latencies[0:3] */
 	val = 0; /* data0 to be programmed to 0 for first set */
-	ret = snb_pcode_read(&i915->uncore, GEN9_PCODE_READ_MEM_LATENCY, &val, NULL);
+	ret = intel_de_pcode_read(i915, GEN9_PCODE_READ_MEM_LATENCY, &val, NULL);
 	if (ret) {
 		drm_err(&i915->drm, "SKL Mailbox read error = %d\n", ret);
 		return;
@@ -3237,7 +3236,7 @@ static void skl_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
 
 	/* read the second set of memory latencies[4:7] */
 	val = 1; /* data0 to be programmed to 1 for second set */
-	ret = snb_pcode_read(&i915->uncore, GEN9_PCODE_READ_MEM_LATENCY, &val, NULL);
+	ret = intel_de_pcode_read(i915, GEN9_PCODE_READ_MEM_LATENCY, &val, NULL);
 	if (ret) {
 		drm_err(&i915->drm, "SKL Mailbox read error = %d\n", ret);
 		return;
Signature · 1 line
2.37.3
author maintainer
#65 lore raw

RFC PATCH 15/20 drm/i915: Rename find_section to find_bdb_section

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

This prevents a namespace collision on other archs.

---
 drivers/gpu/drm/i915/display/intel_bios.c | 46 +++++++++++------------
 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +23 -23
index 755e56f9db6c..7fd96b409d48 100644
@@ -143,8 +143,8 @@ struct bdb_block_entry {
 };
 
 static const void *
-find_section(struct drm_i915_private *i915,
-	     enum bdb_block_id section_id)
+bdb_find_section(struct drm_i915_private *i915,
+		 enum bdb_block_id section_id)
 {
 	struct bdb_block_entry *entry;
 
@@ -203,7 +203,7 @@ static size_t lfp_data_min_size(struct drm_i915_private *i915)
 	const struct bdb_lvds_lfp_data_ptrs *ptrs;
 	size_t size;
 
-	ptrs = find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
+	ptrs = bdb_find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
 	if (!ptrs)
 		return 0;
 
@@ -632,7 +632,7 @@ static int vbt_get_panel_type(struct drm_i915_private *i915,
 {
 	const struct bdb_lvds_options *lvds_options;
 
-	lvds_options = find_section(i915, BDB_LVDS_OPTIONS);
+	lvds_options = bdb_find_section(i915, BDB_LVDS_OPTIONS);
 	if (!lvds_options)
 		return -1;
 
@@ -672,11 +672,11 @@ static int pnpid_get_panel_type(struct drm_i915_private *i915,
 
 	dump_pnp_id(i915, edid_id, "EDID");
 
-	ptrs = find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
+	ptrs = bdb_find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
 	if (!ptrs)
 		return -1;
 
-	data = find_section(i915, BDB_LVDS_LFP_DATA);
+	data = bdb_find_section(i915, BDB_LVDS_LFP_DATA);
 	if (!data)
 		return -1;
 
@@ -792,7 +792,7 @@ parse_panel_options(struct drm_i915_private *i915,
 	int panel_type = panel->vbt.panel_type;
 	int drrs_mode;
 
-	lvds_options = find_section(i915, BDB_LVDS_OPTIONS);
+	lvds_options = bdb_find_section(i915, BDB_LVDS_OPTIONS);
 	if (!lvds_options)
 		return;
 
@@ -882,11 +882,11 @@ parse_lfp_data(struct drm_i915_private *i915,
 	const struct lvds_pnp_id *pnp_id;
 	int panel_type = panel->vbt.panel_type;
 
-	ptrs = find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
+	ptrs = bdb_find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
 	if (!ptrs)
 		return;
 
-	data = find_section(i915, BDB_LVDS_LFP_DATA);
+	data = bdb_find_section(i915, BDB_LVDS_LFP_DATA);
 	if (!data)
 		return;
 
@@ -933,7 +933,7 @@ parse_generic_dtd(struct drm_i915_private *i915,
 	if (i915->display.vbt.version < 229)
 		return;
 
-	generic_dtd = find_section(i915, BDB_GENERIC_DTD);
+	generic_dtd = bdb_find_section(i915, BDB_GENERIC_DTD);
 	if (!generic_dtd)
 		return;
 
@@ -1012,7 +1012,7 @@ parse_lfp_backlight(struct drm_i915_private *i915,
 	int panel_type = panel->vbt.panel_type;
 	u16 level;
 
-	backlight_data = find_section(i915, BDB_LVDS_BACKLIGHT);
+	backlight_data = bdb_find_section(i915, BDB_LVDS_BACKLIGHT);
 	if (!backlight_data)
 		return;
 
@@ -1113,14 +1113,14 @@ parse_sdvo_panel_data(struct drm_i915_private *i915,
 	if (index == -1) {
 		const struct bdb_sdvo_lvds_options *sdvo_lvds_options;
 
-		sdvo_lvds_options = find_section(i915, BDB_SDVO_LVDS_OPTIONS);
+		sdvo_lvds_options = bdb_find_section(i915, BDB_SDVO_LVDS_OPTIONS);
 		if (!sdvo_lvds_options)
 			return;
 
 		index = sdvo_lvds_options->panel_type;
 	}
 
-	dtds = find_section(i915, BDB_SDVO_PANEL_DTDS);
+	dtds = bdb_find_section(i915, BDB_SDVO_PANEL_DTDS);
 	if (!dtds)
 		return;
 
@@ -1156,7 +1156,7 @@ parse_general_features(struct drm_i915_private *i915)
 {
 	const struct bdb_general_features *general;
 
-	general = find_section(i915, BDB_GENERAL_FEATURES);
+	general = bdb_find_section(i915, BDB_GENERAL_FEATURES);
 	if (!general)
 		return;
 
@@ -1280,7 +1280,7 @@ parse_driver_features(struct drm_i915_private *i915)
 {
 	const struct bdb_driver_features *driver;
 
-	driver = find_section(i915, BDB_DRIVER_FEATURES);
+	driver = bdb_find_section(i915, BDB_DRIVER_FEATURES);
 	if (!driver)
 		return;
 
@@ -1317,7 +1317,7 @@ parse_panel_driver_features(struct drm_i915_private *i915,
 {
 	const struct bdb_driver_features *driver;
 
-	driver = find_section(i915, BDB_DRIVER_FEATURES);
+	driver = bdb_find_section(i915, BDB_DRIVER_FEATURES);
 	if (!driver)
 		return;
 
@@ -1357,7 +1357,7 @@ parse_power_conservation_features(struct drm_i915_private *i915,
 	if (i915->display.vbt.version < 228)
 		return;
 
-	power = find_section(i915, BDB_LFP_POWER);
+	power = bdb_find_section(i915, BDB_LFP_POWER);
 	if (!power)
 		return;
 
@@ -1397,7 +1397,7 @@ parse_edp(struct drm_i915_private *i915,
 	const struct edp_fast_link_params *edp_link_params;
 	int panel_type = panel->vbt.panel_type;
 
-	edp = find_section(i915, BDB_EDP);
+	edp = bdb_find_section(i915, BDB_EDP);
 	if (!edp)
 		return;
 
@@ -1527,7 +1527,7 @@ parse_psr(struct drm_i915_private *i915,
 	const struct psr_table *psr_table;
 	int panel_type = panel->vbt.panel_type;
 
-	psr = find_section(i915, BDB_PSR);
+	psr = bdb_find_section(i915, BDB_PSR);
 	if (!psr) {
 		drm_dbg_kms(&i915->drm, "No PSR BDB found.\n");
 		return;
@@ -1688,7 +1688,7 @@ parse_mipi_config(struct drm_i915_private *i915,
 	/* Parse #52 for panel index used from panel_type already
 	 * parsed
 	 */
-	start = find_section(i915, BDB_MIPI_CONFIG);
+	start = bdb_find_section(i915, BDB_MIPI_CONFIG);
 	if (!start) {
 		drm_dbg_kms(&i915->drm, "No MIPI config BDB found");
 		return;
@@ -2000,7 +2000,7 @@ parse_mipi_sequence(struct drm_i915_private *i915,
 	if (panel->vbt.dsi.panel_id != MIPI_DSI_GENERIC_PANEL_ID)
 		return;
 
-	sequence = find_section(i915, BDB_MIPI_SEQUENCE);
+	sequence = bdb_find_section(i915, BDB_MIPI_SEQUENCE);
 	if (!sequence) {
 		drm_dbg_kms(&i915->drm,
 			    "No MIPI Sequence found, parsing complete\n");
@@ -2082,7 +2082,7 @@ parse_compression_parameters(struct drm_i915_private *i915)
 	if (i915->display.vbt.version < 198)
 		return;
 
-	params = find_section(i915, BDB_COMPRESSION_PARAMETERS);
+	params = bdb_find_section(i915, BDB_COMPRESSION_PARAMETERS);
 	if (params) {
 		/* Sanity checks */
 		if (params->entry_size != sizeof(params->data[0])) {
@@ -2756,7 +2756,7 @@ parse_general_definitions(struct drm_i915_private *i915)
 	u16 block_size;
 	int bus_pin;
 
-	defs = find_section(i915, BDB_GENERAL_DEFINITIONS);
+	defs = bdb_find_section(i915, BDB_GENERAL_DEFINITIONS);
 	if (!defs) {
 		drm_dbg_kms(&i915->drm,
 			    "No general definition block is found, no devices defined.\n");
Signature · 1 line
2.37.3
author maintainer
#66 lore raw

RFC PATCH 16/20 drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

Only required for some old pre-gen9 platforms, not for Xe.

---
 drivers/gpu/drm/i915/Makefile                         | 2 +-
 drivers/gpu/drm/i915/display/intel_display_reg_defs.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/Makefile +1 -1
index f47f00b162a4..a6e7cd2185c2 100644
@@ -12,7 +12,7 @@
 # Note the danger in using -Wall -Wextra is that when CI updates gcc we
 # will most likely get a sudden build breakage... Hopefully we will fix
 # new warnings before CI updates!
-subdir-ccflags-y := -Wall -Wextra
+subdir-ccflags-y := -Wall -Wextra -DI915
 subdir-ccflags-y += -Wno-format-security
 subdir-ccflags-y += -Wno-unused-parameter
 subdir-ccflags-y += -Wno-type-limits
drivers/gpu/drm/i915/display/intel_display_reg_defs.h +4 -0
index 02605418ff08..e163eedd8ffd 100644
@@ -8,7 +8,11 @@
 
 #include "i915_reg_defs.h"
 
+#ifdef I915
 #define DISPLAY_MMIO_BASE(dev_priv)	(INTEL_INFO(dev_priv)->display.mmio_offset)
+#else
+#define DISPLAY_MMIO_BASE(dev_priv)    ((dev_priv) ? 0U : 0U)
+#endif
 
 #define VLV_DISPLAY_BASE		0x180000
 
Signature · 1 line
2.37.3
author maintainer
#67 lore raw

RFC PATCH 17/20 drm/i915/display: Fix a use-after-free when intel_edp_init_connector fails

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

We enable the DP aux channel during probe, but may free the connector soon afterwards. Ensure the DP aux display power put is completed before everything is freed, to prevent a use-after-free in icl_aux_pw_to_phy(), called from icl_combo_phy_aux_power_well_disable.

---
 drivers/gpu/drm/i915/display/intel_display_power.c | 2 +-
 drivers/gpu/drm/i915/display/intel_display_power.h | 1 +
 drivers/gpu/drm/i915/display/intel_dp_aux.c        | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display_power.c +1 -1
index fd0fedb65e42..cdb36e3f96cd 100644
@@ -786,7 +786,7 @@ void intel_display_power_flush_work(struct drm_i915_private *i915)
  * Like intel_display_power_flush_work(), but also ensure that the work
  * handler function is not running any more when this function returns.
  */
-static void
+void
 intel_display_power_flush_work_sync(struct drm_i915_private *i915)
 {
 	struct i915_power_domains *power_domains = &i915->display.power.domains;
drivers/gpu/drm/i915/display/intel_display_power.h +1 -0
index 2154d900b1aa..d220f6b16e00 100644
@@ -195,6 +195,7 @@ void __intel_display_power_put_async(struct drm_i915_private *i915,
 				     enum intel_display_power_domain domain,
 				     intel_wakeref_t wakeref);
 void intel_display_power_flush_work(struct drm_i915_private *i915);
+void intel_display_power_flush_work_sync(struct drm_i915_private *i915);
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
 void intel_display_power_put(struct drm_i915_private *dev_priv,
 			     enum intel_display_power_domain domain,
drivers/gpu/drm/i915/display/intel_dp_aux.c +2 -0
index 91c93c93e5fc..220aa88c67ee 100644
@@ -680,6 +680,8 @@ void intel_dp_aux_fini(struct intel_dp *intel_dp)
 	if (cpu_latency_qos_request_active(&intel_dp->pm_qos))
 		cpu_latency_qos_remove_request(&intel_dp->pm_qos);
 
+	/* Ensure async work from intel_dp_aux_xfer() is flushed before we clean up */
+	intel_display_power_flush_work_sync(dp_to_i915(intel_dp));
 	kfree(intel_dp->aux.name);
 }
 
Signature · 1 line
2.37.3
author maintainer
#68 lore raw

RFC PATCH 18/20 drm/i915/display: Remaining changes to make xe compile

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

Xe, the new Intel GPU driver, will re-use the i915 display.

At least for now, the plan is to use symbolic links and adjust the build so we are building the display either for i915 or for xe.

The display can be split out if needed.
Also the compilation is optional at this time

[Rodrigo changed i915_reg_defs.h, commit msg, and rebased]
---
 drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
 .../gpu/drm/i915/display/intel_atomic_plane.c |  25 ++-
 .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_bw.c       |   2 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  23 ++-
 drivers/gpu/drm/i915/display/intel_color.c    |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
 drivers/gpu/drm/i915/display/intel_cursor.c   |   8 +-
 drivers/gpu/drm/i915/display/intel_display.c  | 150 ++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../gpu/drm/i915/display/intel_display_core.h |   5 +-
 .../drm/i915/display/intel_display_debugfs.c  |   8 +
 .../drm/i915/display/intel_display_power.c    |  35 ++--
 .../drm/i915/display/intel_display_power.h    |   5 +
 .../i915/display/intel_display_power_map.c    |   7 +
 .../i915/display/intel_display_power_well.c   |  17 +-
 .../drm/i915/display/intel_display_trace.h    |   6 +
 .../drm/i915/display/intel_display_types.h    |  24 ++-
 drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |   4 +
 drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 ++
 drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
 drivers/gpu/drm/i915/display/intel_dsb.c      | 124 ++++++++++++---
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 ++-
 drivers/gpu/drm/i915/display/intel_fb.c       |  96 +++++++++--
 drivers/gpu/drm/i915/display/intel_fbc.c      |  49 +++++-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 101 ++++++++++--
 drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
 .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
 .../drm/i915/display/intel_modeset_setup.c    |  11 +-
 drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
 .../gpu/drm/i915/display/intel_pch_display.h  |  16 ++
 .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
 drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 +++
 drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
 drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
 drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
 .../drm/i915/display/skl_universal_plane.c    |  51 +++++-
 drivers/gpu/drm/i915/display/skl_watermark.c  |   2 +-
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
 drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
 44 files changed, 811 insertions(+), 129 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic.c +2 -0
index 6621aa245caf..56875afa592f 100644
@@ -522,7 +522,9 @@ void intel_atomic_state_free(struct drm_atomic_state *_state)
 	drm_atomic_state_default_release(&state->base);
 	kfree(state->global_objs);
 
+#ifdef I915
 	i915_sw_fence_fini(&state->commit_ready);
+#endif
 
 	kfree(state);
 }
drivers/gpu/drm/i915/display/intel_atomic_plane.c +21 -4
index 10e1fc9d0698..acb32396e73c 100644
@@ -34,7 +34,9 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
 
+#ifdef I915
 #include "gt/intel_rps.h"
+#endif
 
 #include "intel_atomic_plane.h"
 #include "intel_cdclk.h"
@@ -107,7 +109,9 @@ intel_plane_duplicate_state(struct drm_plane *plane)
 	__drm_atomic_helper_plane_duplicate_state(plane, &intel_state->uapi);
 
 	intel_state->ggtt_vma = NULL;
+#ifdef I915
 	intel_state->dpt_vma = NULL;
+#endif
 	intel_state->flags = 0;
 
 	/* add reference to fb */
@@ -132,7 +136,9 @@ intel_plane_destroy_state(struct drm_plane *plane,
 	struct intel_plane_state *plane_state = to_intel_plane_state(state);
 
 	drm_WARN_ON(plane->dev, plane_state->ggtt_vma);
+#ifdef I915
 	drm_WARN_ON(plane->dev, plane_state->dpt_vma);
+#endif
 
 	__drm_atomic_helper_plane_destroy_state(&plane_state->uapi);
 	if (plane_state->hw.fb)
@@ -937,6 +943,7 @@ int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
 	return 0;
 }
 
+#ifdef I915
 struct wait_rps_boost {
 	struct wait_queue_entry wait;
 
@@ -994,6 +1001,7 @@ static void add_rps_boost_after_vblank(struct drm_crtc *crtc,
 
 	add_wait_queue(drm_crtc_vblank_waitqueue(crtc), &wait->wait);
 }
+#endif
 
 /**
  * intel_prepare_plane_fb - Prepare fb for usage on plane
@@ -1011,10 +1019,11 @@ static int
 intel_prepare_plane_fb(struct drm_plane *_plane,
 		       struct drm_plane_state *_new_plane_state)
 {
-	struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY };
-	struct intel_plane *plane = to_intel_plane(_plane);
 	struct intel_plane_state *new_plane_state =
 		to_intel_plane_state(_new_plane_state);
+#ifdef I915
+	struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY };
+	struct intel_plane *plane = to_intel_plane(_plane);
 	struct intel_atomic_state *state =
 		to_intel_atomic_state(new_plane_state->uapi.state);
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -1113,6 +1122,12 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
 	intel_plane_unpin_fb(new_plane_state);
 
 	return ret;
+#else
+	if (!intel_fb_obj(new_plane_state->hw.fb))
+		return 0;
+
+	return intel_plane_pin_fb(new_plane_state);
+#endif
 }
 
 /**
@@ -1128,18 +1143,20 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
 {
 	struct intel_plane_state *old_plane_state =
 		to_intel_plane_state(_old_plane_state);
-	struct intel_atomic_state *state =
+	__maybe_unused struct intel_atomic_state *state =
 		to_intel_atomic_state(old_plane_state->uapi.state);
-	struct drm_i915_private *dev_priv = to_i915(plane->dev);
+	__maybe_unused struct drm_i915_private *dev_priv = to_i915(plane->dev);
 	struct drm_i915_gem_object *obj = intel_fb_obj(old_plane_state->hw.fb);
 
 	if (!obj)
 		return;
 
+#ifdef I915
 	if (state->rps_interactive) {
 		intel_rps_mark_interactive(&to_gt(dev_priv)->rps, false);
 		state->rps_interactive = false;
 	}
+#endif
 
 	/* Should only be called after a successful intel_prepare_plane_fb()! */
 	intel_plane_unpin_fb(old_plane_state);
drivers/gpu/drm/i915/display/intel_backlight.c +1 -1
index 5b7da72c95b8..e63eb43622e0 100644
@@ -19,7 +19,7 @@
 #include "intel_dp_aux_backlight.h"
 #include "intel_dsi_dcs_backlight.h"
 #include "intel_panel.h"
-#include "intel_pci_config.h"
+#include "../i915/intel_pci_config.h"
 #include "intel_pps.h"
 #include "intel_quirks.h"
 
drivers/gpu/drm/i915/display/intel_bw.c +1 -1
index 54e03a3eaa0f..67b4e947589c 100644
@@ -15,7 +15,7 @@
 #include "intel_display_core.h"
 #include "intel_display_types.h"
 #include "skl_watermark.h"
-#include "intel_mchbar_regs.h"
+#include "../i915/intel_mchbar_regs.h"
 
 /* Parameters for Qclk Geyserville (QGV) */
 struct intel_qgv_point {
drivers/gpu/drm/i915/display/intel_cdclk.c +20 -3
index 80e2db6b5ea4..3b6a37403f25 100644
@@ -23,7 +23,6 @@
 
 #include <linux/time.h>
 
-#include "hsw_ips.h"
 #include "i915_reg.h"
 #include "intel_atomic.h"
 #include "intel_atomic_plane.h"
@@ -33,10 +32,14 @@
 #include "intel_crtc.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
-#include "intel_mchbar_regs.h"
-#include "intel_pci_config.h"
+#include "../i915/intel_mchbar_regs.h"
+#include "../i915/intel_pci_config.h"
 #include "intel_psr.h"
+
+#ifdef I915
+#include "hsw_ips.h"
 #include "vlv_sideband.h"
+#endif
 
 /**
  * DOC: CDCLK / RAWCLK
@@ -474,6 +477,7 @@ static void hsw_get_cdclk(struct drm_i915_private *dev_priv,
 		cdclk_config->cdclk = 540000;
 }
 
+#ifdef I915
 static int vlv_calc_cdclk(struct drm_i915_private *dev_priv, int min_cdclk)
 {
 	int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ?
@@ -712,6 +716,7 @@ static void chv_set_cdclk(struct drm_i915_private *dev_priv,
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_DISPLAY_CORE, wakeref);
 }
+#endif
 
 static int bdw_calc_cdclk(int min_cdclk)
 {
@@ -2375,9 +2380,11 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 
 	min_cdclk = intel_pixel_rate_to_cdclk(crtc_state);
 
+#ifdef I915
 	/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
 	if (IS_BROADWELL(dev_priv) && hsw_crtc_state_ips_capable(crtc_state))
 		min_cdclk = DIV_ROUND_UP(min_cdclk * 100, 95);
+#endif
 
 	/* BSpec says "Do not use DisplayPort with CDCLK less than 432 MHz,
 	 * audio enabled, port width x4, and link rate HBR2 (5.4 GHz), or else
@@ -2571,6 +2578,7 @@ static int bxt_compute_min_voltage_level(struct intel_cdclk_state *cdclk_state)
 	return min_voltage_level;
 }
 
+#ifdef I915
 static int vlv_modeset_calc_cdclk(struct intel_cdclk_state *cdclk_state)
 {
 	struct intel_atomic_state *state = cdclk_state->base.state;
@@ -2599,6 +2607,7 @@ static int vlv_modeset_calc_cdclk(struct intel_cdclk_state *cdclk_state)
 
 	return 0;
 }
+#endif
 
 static int bdw_modeset_calc_cdclk(struct intel_cdclk_state *cdclk_state)
 {
@@ -3101,12 +3110,14 @@ static int pch_rawclk(struct drm_i915_private *dev_priv)
 	return (intel_de_read(dev_priv, PCH_RAWCLK_FREQ) & RAWCLK_FREQ_MASK) * 1000;
 }
 
+#ifdef I915
 static int vlv_hrawclk(struct drm_i915_private *dev_priv)
 {
 	/* RAWCLK_FREQ_VLV register updated from power well code */
 	return vlv_get_cck_clock_hpll(dev_priv, "hrawclk",
 				      CCK_DISPLAY_REF_CLOCK_CONTROL);
 }
+#endif
 
 static int i9xx_hrawclk(struct drm_i915_private *dev_priv)
 {
@@ -3188,8 +3199,10 @@ u32 intel_read_rawclk(struct drm_i915_private *dev_priv)
 		freq = cnp_rawclk(dev_priv);
 	else if (HAS_PCH_SPLIT(dev_priv))
 		freq = pch_rawclk(dev_priv);
+#ifdef I915
 	else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
 		freq = vlv_hrawclk(dev_priv);
+#endif
 	else if (DISPLAY_VER(dev_priv) >= 3)
 		freq = i9xx_hrawclk(dev_priv);
 	else
@@ -3246,6 +3259,7 @@ static const struct intel_cdclk_funcs bdw_cdclk_funcs = {
 	.modeset_calc_cdclk = bdw_modeset_calc_cdclk,
 };
 
+#ifdef I915
 static const struct intel_cdclk_funcs chv_cdclk_funcs = {
 	.get_cdclk = vlv_get_cdclk,
 	.set_cdclk = chv_set_cdclk,
@@ -3257,6 +3271,7 @@ static const struct intel_cdclk_funcs vlv_cdclk_funcs = {
 	.set_cdclk = vlv_set_cdclk,
 	.modeset_calc_cdclk = vlv_modeset_calc_cdclk,
 };
+#endif
 
 static const struct intel_cdclk_funcs hsw_cdclk_funcs = {
 	.get_cdclk = hsw_get_cdclk,
@@ -3378,10 +3393,12 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
 		dev_priv->display.funcs.cdclk = &bdw_cdclk_funcs;
 	} else if (IS_HASWELL(dev_priv)) {
 		dev_priv->display.funcs.cdclk = &hsw_cdclk_funcs;
+#ifdef I915
 	} else if (IS_CHERRYVIEW(dev_priv)) {
 		dev_priv->display.funcs.cdclk = &chv_cdclk_funcs;
 	} else if (IS_VALLEYVIEW(dev_priv)) {
 		dev_priv->display.funcs.cdclk = &vlv_cdclk_funcs;
+#endif
 	} else if (IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv)) {
 		dev_priv->display.funcs.cdclk = &fixed_400mhz_cdclk_funcs;
 	} else if (IS_IRONLAKE(dev_priv)) {
drivers/gpu/drm/i915/display/intel_color.c +1 -0
index d57631b0bb9a..22f42ec3ee03 100644
@@ -26,6 +26,7 @@
 #include "intel_color.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
+#include "intel_dpll.h"
 #include "intel_dsb.h"
 
 struct intel_color_funcs {
drivers/gpu/drm/i915/display/intel_crtc.c +12 -2
index 037fc140b585..5214bfe86a13 100644
@@ -12,8 +12,10 @@
 #include <drm/drm_vblank_work.h>
 
 #include "i915_irq.h"
+#ifdef I915
 #include "i915_vgpu.h"
 #include "i9xx_plane.h"
+#endif
 #include "icl_dsi.h"
 #include "intel_atomic.h"
 #include "intel_atomic_plane.h"
@@ -306,7 +308,11 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 		primary = skl_universal_plane_create(dev_priv, pipe,
 						     PLANE_PRIMARY);
 	else
+#ifdef I915
 		primary = intel_primary_plane_create(dev_priv, pipe);
+#else
+		BUG_ON(1);
+#endif
 	if (IS_ERR(primary)) {
 		ret = PTR_ERR(primary);
 		goto fail;
@@ -655,13 +661,15 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
 					 drm_crtc_accurate_vblank_count(&crtc->base) + 1,
 					 false);
 	} else if (new_crtc_state->uapi.event) {
+		unsigned long flags;
+
 		drm_WARN_ON(&dev_priv->drm,
 			    drm_crtc_vblank_get(&crtc->base) != 0);
 
-		spin_lock(&crtc->base.dev->event_lock);
+		spin_lock_irqsave(&crtc->base.dev->event_lock, flags);
 		drm_crtc_arm_vblank_event(&crtc->base,
 					  new_crtc_state->uapi.event);
-		spin_unlock(&crtc->base.dev->event_lock);
+		spin_unlock_irqrestore(&crtc->base.dev->event_lock, flags);
 
 		new_crtc_state->uapi.event = NULL;
 	}
@@ -684,8 +692,10 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
 
 	local_irq_enable();
 
+#ifdef I915
 	if (intel_vgpu_active(dev_priv))
 		return;
+#endif
 
 	if (crtc->debug.start_vbl_count &&
 	    crtc->debug.start_vbl_count != end_vbl_count) {
drivers/gpu/drm/i915/display/intel_cursor.c +4 -4
index 371009f8e194..5bdd66e66202 100644
@@ -31,15 +31,15 @@ static const u32 intel_cursor_formats[] = {
 
 static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
 {
-	struct drm_i915_private *dev_priv =
+	__maybe_unused struct drm_i915_private *dev_priv =
 		to_i915(plane_state->uapi.plane->dev);
-	const struct drm_framebuffer *fb = plane_state->hw.fb;
-	const struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 	u32 base;
 
+#ifdef I915
 	if (INTEL_INFO(dev_priv)->display.cursor_needs_physical)
-		base = sg_dma_address(obj->mm.pages->sgl);
+		base = sg_dma_address(intel_fb_obj(plane_state->hw.fb)->mm.pages->sgl);
 	else
+#endif
 		base = intel_plane_ggtt_offset(plane_state);
 
 	return base + plane_state->view.color_plane[0].offset;
drivers/gpu/drm/i915/display/intel_display.c +134 -16

489 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_display.h +8 -1
index ef73730f32b0..b063d16f4767 100644
@@ -545,6 +545,7 @@ int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
 		      const char *name, u32 reg, int ref_freq);
 int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv,
 			   const char *name, u32 reg);
+void intel_hpd_poll_fini(struct drm_i915_private *i915);
 void intel_init_display_hooks(struct drm_i915_private *dev_priv);
 unsigned int intel_fb_xy_to_linear(int x, int y,
 				   const struct intel_plane_state *state,
@@ -670,10 +671,16 @@ void assert_transcoder(struct drm_i915_private *dev_priv,
  * enable distros and users to tailor their preferred amount of i915 abrt
  * spam.
  */
+#ifdef I915
+#define i915_display_verbose_check (i915_modparams.verbose_state_checks)
+#else
+#define i915_display_verbose_check 1
+#endif
+
 #define I915_STATE_WARN(condition, format...) ({			\
 	int __ret_warn_on = !!(condition);				\
 	if (unlikely(__ret_warn_on))					\
-		if (!WARN(i915_modparams.verbose_state_checks, format))	\
+		if (!WARN(i915_display_verbose_check, format))	\
 			DRM_ERROR(format);				\
 	unlikely(__ret_warn_on);					\
 })
drivers/gpu/drm/i915/display/intel_display_core.h +4 -1
index 57ddce3ba02b..1c65b5b2893e 100644
@@ -227,12 +227,13 @@ struct intel_wm {
 	u16 skl_latency[8];
 
 	/* current hardware state */
+#ifdef I915
 	union {
 		struct ilk_wm_values hw;
 		struct vlv_wm_values vlv;
 		struct g4x_wm_values g4x;
 	};
-
+#endif
 	u8 max_level;
 
 	/*
@@ -274,10 +275,12 @@ struct intel_display {
 	} funcs;
 
 	/* Grouping using anonymous structs. Keep sorted. */
+#ifdef I915
 	struct intel_atomic_helper {
 		struct llist_head free_list;
 		struct work_struct free_work;
 	} atomic_helper;
+#endif
 
 	struct {
 		/* backlight registers and fields in struct intel_panel */
drivers/gpu/drm/i915/display/intel_display_debugfs.c +8 -0
index 7bcd90384a46..6c40ca8a709f 100644
@@ -8,7 +8,11 @@
 #include <drm/drm_debugfs.h>
 #include <drm/drm_fourcc.h>
 
+#ifdef I915
 #include "i915_debugfs.h"
+#else
+#define i915_debugfs_describe_obj(a, b) do { } while (0)
+#endif
 #include "i915_irq.h"
 #include "i915_reg.h"
 #include "intel_de.h"
@@ -51,6 +55,7 @@ static int i915_frontbuffer_tracking(struct seq_file *m, void *unused)
 
 static int i915_ips_status(struct seq_file *m, void *unused)
 {
+#ifdef I915
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 	intel_wakeref_t wakeref;
 
@@ -74,6 +79,9 @@ static int i915_ips_status(struct seq_file *m, void *unused)
 	intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
 
 	return 0;
+#else
+	return -ENODEV;
+#endif
 }
 
 static int i915_sr_status(struct seq_file *m, void *unused)
drivers/gpu/drm/i915/display/intel_display_power.c +22 -13
index cdb36e3f96cd..c3a57ec0d2f3 100644
@@ -16,11 +16,17 @@
 #include "intel_display_power_well.h"
 #include "intel_display_types.h"
 #include "intel_dmc.h"
-#include "intel_mchbar_regs.h"
+#include "../i915/intel_mchbar_regs.h"
 #include "intel_pch_refclk.h"
 #include "intel_snps_phy.h"
 #include "skl_watermark.h"
+
+#ifdef I915
 #include "vlv_sideband.h"
+#else
+#define PUNIT_REG_ISPSSPM0 0
+#define PUNIT_REG_VEDSSPM0 0
+#endif
 
 #define for_each_power_domain_well(__dev_priv, __power_well, __domain)	\
 	for_each_power_well(__dev_priv, __power_well)				\
@@ -212,8 +218,10 @@ bool __intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
 	struct i915_power_well *power_well;
 	bool is_enabled;
 
+#ifdef I915
 	if (dev_priv->runtime_pm.suspended)
 		return false;
+#endif
 
 	is_enabled = true;
 
@@ -621,7 +629,6 @@ release_async_put_domains(struct i915_power_domains *power_domains,
 	struct drm_i915_private *dev_priv =
 		container_of(power_domains, struct drm_i915_private,
 			     display.power.domains);
-	struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
 	enum intel_display_power_domain domain;
 	intel_wakeref_t wakeref;
 
@@ -630,8 +637,8 @@ release_async_put_domains(struct i915_power_domains *power_domains,
 	 * wakeref to make the state checker happy about the HW access during
 	 * power well disabling.
 	 */
-	assert_rpm_raw_wakeref_held(rpm);
-	wakeref = intel_runtime_pm_get(rpm);
+	assert_rpm_raw_wakeref_held(&dev_priv->runtime_pm);
+	wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
 
 	for_each_power_domain(domain, mask) {
 		/* Clear before put, so put's sanity check is happy. */
@@ -639,7 +646,7 @@ release_async_put_domains(struct i915_power_domains *power_domains,
 		__intel_display_power_put_domain(dev_priv, domain);
 	}
 
-	intel_runtime_pm_put(rpm, wakeref);
+	intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
 }
 
 static void
@@ -649,8 +656,7 @@ intel_display_power_put_async_work(struct work_struct *work)
 		container_of(work, struct drm_i915_private,
 			     display.power.domains.async_put_work.work);
 	struct i915_power_domains *power_domains = &dev_priv->display.power.domains;
-	struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
-	intel_wakeref_t new_work_wakeref = intel_runtime_pm_get_raw(rpm);
+	intel_wakeref_t new_work_wakeref = intel_runtime_pm_get_raw(&dev_priv->runtime_pm);
 	intel_wakeref_t old_work_wakeref = 0;
 
 	mutex_lock(&power_domains->lock);
@@ -689,9 +695,9 @@ intel_display_power_put_async_work(struct work_struct *work)
 	mutex_unlock(&power_domains->lock);
 
 	if (old_work_wakeref)
-		intel_runtime_pm_put_raw(rpm, old_work_wakeref);
+		intel_runtime_pm_put_raw(&dev_priv->runtime_pm, old_work_wakeref);
 	if (new_work_wakeref)
-		intel_runtime_pm_put_raw(rpm, new_work_wakeref);
+		intel_runtime_pm_put_raw(&dev_priv->runtime_pm, new_work_wakeref);
 }
 
 /**
@@ -709,8 +715,7 @@ void __intel_display_power_put_async(struct drm_i915_private *i915,
 				     intel_wakeref_t wakeref)
 {
 	struct i915_power_domains *power_domains = &i915->display.power.domains;
-	struct intel_runtime_pm *rpm = &i915->runtime_pm;
-	intel_wakeref_t work_wakeref = intel_runtime_pm_get_raw(rpm);
+	intel_wakeref_t work_wakeref = intel_runtime_pm_get_raw(&i915->runtime_pm);
 
 	mutex_lock(&power_domains->lock);
 
@@ -737,9 +742,9 @@ void __intel_display_power_put_async(struct drm_i915_private *i915,
 	mutex_unlock(&power_domains->lock);
 
 	if (work_wakeref)
-		intel_runtime_pm_put_raw(rpm, work_wakeref);
+		intel_runtime_pm_put_raw(&i915->runtime_pm, work_wakeref);
 
-	intel_runtime_pm_put(rpm, wakeref);
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 }
 
 /**
@@ -1830,6 +1835,7 @@ static void vlv_cmnlane_wa(struct drm_i915_private *dev_priv)
 
 static bool vlv_punit_is_power_gated(struct drm_i915_private *dev_priv, u32 reg0)
 {
+#ifdef I915
 	bool ret;
 
 	vlv_punit_get(dev_priv);
@@ -1837,6 +1843,9 @@ static bool vlv_punit_is_power_gated(struct drm_i915_private *dev_priv, u32 reg0
 	vlv_punit_put(dev_priv);
 
 	return ret;
+#else
+	return false;
+#endif
 }
 
 static void assert_ved_power_gated(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/display/intel_display_power.h +5 -0
index d220f6b16e00..3aae045749f7 100644
@@ -7,6 +7,11 @@
 #define __INTEL_DISPLAY_POWER_H__
 
 #include "intel_wakeref.h"
+#include <linux/types.h>
+#include <linux/bitops.h>
+#include <linux/mutex.h>
+#include <linux/workqueue.h>
+#include "intel_runtime_pm.h"
 
 enum aux_ch;
 enum dpio_channel;
drivers/gpu/drm/i915/display/intel_display_power_map.c +7 -0
index f5d66ca85b19..6e1facc66af3 100644
@@ -6,7 +6,10 @@
 #include "i915_drv.h"
 #include "i915_reg.h"
 
+#ifdef I915
 #include "vlv_sideband_reg.h"
+#else
+#endif
 
 #include "intel_display_power_map.h"
 #include "intel_display_power_well.h"
@@ -197,6 +200,7 @@ I915_DECL_PW_DOMAINS(vlv_pwdoms_dpio_tx_bc_lanes,
 	POWER_DOMAIN_INIT);
 
 static const struct i915_power_well_desc vlv_power_wells_main[] = {
+#ifdef I915
 	{
 		.instances = &I915_PW_INSTANCES(
 			I915_PW("display", &vlv_pwdoms_display,
@@ -224,6 +228,7 @@ static const struct i915_power_well_desc vlv_power_wells_main[] = {
 		),
 		.ops = &vlv_dpio_cmn_power_well_ops,
 	},
+#endif
 };
 
 static const struct i915_power_well_desc_list vlv_power_wells[] = {
@@ -274,6 +279,7 @@ I915_DECL_PW_DOMAINS(chv_pwdoms_dpio_cmn_d,
 	POWER_DOMAIN_INIT);
 
 static const struct i915_power_well_desc chv_power_wells_main[] = {
+#ifdef I915
 	{
 		/*
 		 * Pipe A power well is the new disp2d well. Pipe B and C
@@ -295,6 +301,7 @@ static const struct i915_power_well_desc chv_power_wells_main[] = {
 		),
 		.ops = &chv_dpio_cmn_power_well_ops,
 	},
+#endif
 };
 
 static const struct i915_power_well_desc_list chv_power_wells[] = {
drivers/gpu/drm/i915/display/intel_display_power_well.c +16 -1
index a1d75956ae97..9683cb661f62 100644
@@ -8,7 +8,6 @@
 #include "intel_backlight_regs.h"
 #include "intel_combo_phy.h"
 #include "intel_combo_phy_regs.h"
-#include "intel_crt.h"
 #include "intel_de.h"
 #include "intel_display_power_well.h"
 #include "intel_display_types.h"
@@ -22,8 +21,12 @@
 #include "intel_tc.h"
 #include "intel_vga.h"
 #include "skl_watermark.h"
+
+#ifdef I915
+#include "intel_crt.h"
 #include "vlv_sideband.h"
 #include "vlv_sideband_reg.h"
+#endif
 
 struct i915_power_well_regs {
 	i915_reg_t bios;
@@ -1061,6 +1064,7 @@ static void i830_pipes_power_well_sync_hw(struct drm_i915_private *dev_priv,
 		i830_pipes_power_well_disable(dev_priv, power_well);
 }
 
+#ifdef I915
 static void vlv_set_power_well(struct drm_i915_private *dev_priv,
 			       struct i915_power_well *power_well, bool enable)
 {
@@ -1719,6 +1723,7 @@ static void chv_pipe_power_well_disable(struct drm_i915_private *dev_priv,
 
 	chv_set_pipe_power_well(dev_priv, power_well, false);
 }
+#endif
 
 static void
 tgl_tc_cold_request(struct drm_i915_private *i915, bool block)
@@ -1843,17 +1848,21 @@ const struct i915_power_well_ops i9xx_always_on_power_well_ops = {
 };
 
 const struct i915_power_well_ops chv_pipe_power_well_ops = {
+#ifdef I915
 	.sync_hw = chv_pipe_power_well_sync_hw,
 	.enable = chv_pipe_power_well_enable,
 	.disable = chv_pipe_power_well_disable,
 	.is_enabled = chv_pipe_power_well_enabled,
+#endif
 };
 
 const struct i915_power_well_ops chv_dpio_cmn_power_well_ops = {
 	.sync_hw = i9xx_power_well_sync_hw_noop,
+#ifdef I915
 	.enable = chv_dpio_cmn_power_well_enable,
 	.disable = chv_dpio_cmn_power_well_disable,
 	.is_enabled = vlv_power_well_enabled,
+#endif
 };
 
 const struct i915_power_well_ops i830_pipes_power_well_ops = {
@@ -1894,23 +1903,29 @@ const struct i915_power_well_ops bxt_dpio_cmn_power_well_ops = {
 
 const struct i915_power_well_ops vlv_display_power_well_ops = {
 	.sync_hw = i9xx_power_well_sync_hw_noop,
+#ifdef I915
 	.enable = vlv_display_power_well_enable,
 	.disable = vlv_display_power_well_disable,
 	.is_enabled = vlv_power_well_enabled,
+#endif
 };
 
 const struct i915_power_well_ops vlv_dpio_cmn_power_well_ops = {
 	.sync_hw = i9xx_power_well_sync_hw_noop,
+#ifdef I915
 	.enable = vlv_dpio_cmn_power_well_enable,
 	.disable = vlv_dpio_cmn_power_well_disable,
 	.is_enabled = vlv_power_well_enabled,
+#endif
 };
 
 const struct i915_power_well_ops vlv_dpio_power_well_ops = {
 	.sync_hw = i9xx_power_well_sync_hw_noop,
+#ifdef I915
 	.enable = vlv_power_well_enable,
 	.disable = vlv_power_well_disable,
 	.is_enabled = vlv_power_well_enabled,
+#endif
 };
 
 static const struct i915_power_well_regs icl_aux_power_well_regs = {
drivers/gpu/drm/i915/display/intel_display_trace.h +6 -0
index 725aba3fa531..391ddb94062b 100644
@@ -185,6 +185,7 @@ TRACE_EVENT(intel_memory_cxsr,
 		      __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
 );
 
+#ifdef I915
 TRACE_EVENT(g4x_wm,
 	    TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
 	    TP_ARGS(crtc, wm),
@@ -277,6 +278,7 @@ TRACE_EVENT(vlv_wm,
 		      __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
 		      __entry->sr_plane, __entry->sr_cursor)
 );
+#endif
 
 TRACE_EVENT(vlv_fifo_size,
 	    TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
@@ -648,6 +650,10 @@ TRACE_EVENT(intel_frontbuffer_flush,
 /* This part must be outside protection */
 #undef TRACE_INCLUDE_PATH
 #undef TRACE_INCLUDE_FILE
+#ifdef I915
 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915/display
+#else
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/xe/display
+#endif
 #define TRACE_INCLUDE_FILE intel_display_trace
 #include <trace/define_trace.h>
drivers/gpu/drm/i915/display/intel_display_types.h +21 -3
index 34250a9cf3e1..3bd391d33e42 100644
@@ -46,6 +46,7 @@
 #include <drm/i915_mei_hdcp_interface.h>
 #include <media/cec-notifier.h>
 
+#include "i915_utils.h"
 #include "i915_vma.h"
 #include "i915_vma_types.h"
 #include "intel_bios.h"
@@ -141,7 +142,9 @@ struct intel_framebuffer {
 		struct intel_fb_view remapped_view;
 	};
 
+#ifdef I915
 	struct i915_address_space *dpt_vm;
+#endif
 };
 
 enum intel_hotplug_state {
@@ -653,7 +656,9 @@ struct intel_atomic_state {
 
 	bool rps_interactive;
 
+#ifdef I915
 	struct i915_sw_fence commit_ready;
+#endif
 
 	struct llist_node freed;
 };
@@ -679,7 +684,11 @@ struct intel_plane_state {
 	} hw;
 
 	struct i915_vma *ggtt_vma;
+#ifdef I915
 	struct i915_vma *dpt_vma;
+#else
+	struct i915_vma embed_vma;
+#endif
 	unsigned long flags;
 #define PLANE_HAS_FENCE BIT(0)
 
@@ -739,9 +748,9 @@ struct intel_plane_state {
 	 * this plane. They're calculated by the linked plane's wm code.
 	 */
 	u32 planar_slave;
-
+#ifdef I915
 	struct drm_intel_sprite_colorkey ckey;
-
+#endif
 	struct drm_rect psr2_sel_fetch_area;
 
 	/* Clear Color Value */
@@ -851,6 +860,7 @@ struct skl_pipe_wm {
 	bool use_sagv_wm;
 };
 
+#ifdef I915
 enum vlv_wm_level {
 	VLV_WM_LEVEL_PM2,
 	VLV_WM_LEVEL_PM5,
@@ -884,6 +894,7 @@ struct g4x_wm_state {
 	bool hpll_en;
 	bool fbc_en;
 };
+#endif
 
 struct intel_crtc_wm_state {
 	union {
@@ -927,7 +938,7 @@ struct intel_crtc_wm_state {
 			/* pre-icl: for planar Y */
 			struct skl_ddb_entry plane_ddb_y[I915_MAX_PLANES];
 		} skl;
-
+#ifdef I915
 		struct {
 			struct g4x_pipe_wm raw[NUM_VLV_WM_LEVELS]; /* not inverted */
 			struct vlv_wm_state intermediate; /* inverted */
@@ -940,6 +951,7 @@ struct intel_crtc_wm_state {
 			struct g4x_wm_state intermediate;
 			struct g4x_wm_state optimal;
 		} g4x;
+#endif
 	};
 
 	/*
@@ -1387,6 +1399,7 @@ struct intel_crtc {
 	bool pch_fifo_underrun_disabled;
 
 	/* per-pipe watermark state */
+#ifdef I915
 	struct {
 		/* watermarks currently being used  */
 		union {
@@ -1395,6 +1408,7 @@ struct intel_crtc {
 			struct g4x_wm_state g4x;
 		} active;
 	} wm;
+#endif
 
 	struct {
 		struct mutex mutex;
@@ -2053,7 +2067,11 @@ intel_crtc_needs_color_update(const struct intel_crtc_state *crtc_state)
 
 static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_state)
 {
+#ifdef I915
 	return i915_ggtt_offset(plane_state->ggtt_vma);
+#else
+	return plane_state->ggtt_vma->node.start;
+#endif
 }
 
 #endif /*  __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_dmc.c +16 -1
index 905b5dcdca14..5482ca6ccda7 100644
@@ -30,6 +30,18 @@
 #include "intel_dmc.h"
 #include "intel_dmc_regs.h"
 
+#ifndef I915
+#include "xe_uc_fw.h"
+
+#define INTEL_UC_FIRMWARE_URL XE_UC_FIRMWARE_URL
+
+__printf(2, 3)
+static inline void
+i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...)
+{
+}
+#endif
+
 /**
  * DOC: DMC Firmware Support
  *
@@ -262,8 +274,11 @@ static const struct stepping_info *
 intel_get_stepping_info(struct drm_i915_private *i915,
 			struct stepping_info *si)
 {
+#ifdef I915
 	const char *step_name = intel_step_name(RUNTIME_INFO(i915)->step.display_step);
-
+#else
+	const char *step_name = xe_step_name(i915->info.step.display);
+#endif
 	si->stepping = step_name[0];
 	si->substepping = step_name[1];
 	return si;
drivers/gpu/drm/i915/display/intel_dp.c +10 -1
index bf80f296a8fd..55973e9aeca3 100644
@@ -43,8 +43,10 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_probe_helper.h>
 
+#ifdef I915
 #include "g4x_dp.h"
 #include "i915_debugfs.h"
+#endif
 #include "i915_drv.h"
 #include "i915_reg.h"
 #include "intel_atomic.h"
@@ -2164,8 +2166,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 	if (pipe_config->splitter.enable)
 		pipe_config->dp_m_n.data_m *= pipe_config->splitter.link_count;
 
+#ifdef I915
 	if (!HAS_DDI(dev_priv))
 		g4x_dp_set_clock(encoder, pipe_config);
+#endif
 
 	intel_vrr_compute_config(pipe_config, conn_state);
 	intel_psr_compute_config(intel_dp, pipe_config, conn_state);
@@ -5209,9 +5213,11 @@ intel_edp_add_properties(struct intel_dp *intel_dp)
 static void intel_edp_backlight_setup(struct intel_dp *intel_dp,
 				      struct intel_connector *connector)
 {
-	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
 	enum pipe pipe = INVALID_PIPE;
 
+#ifdef I915
+	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+
 	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
 		/*
 		 * Figure out the current pipe for the initial backlight setup.
@@ -5231,6 +5237,7 @@ static void intel_edp_backlight_setup(struct intel_dp *intel_dp,
 			    connector->base.base.id, connector->base.name,
 			    pipe_name(pipe));
 	}
+#endif
 
 	intel_backlight_setup(connector, pipe);
 }
@@ -5427,8 +5434,10 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
 	intel_dp_set_default_sink_rates(intel_dp);
 	intel_dp_set_default_max_sink_lane_count(intel_dp);
 
+#ifdef I915
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
 		intel_dp->pps.active_pipe = vlv_active_pipe(intel_dp);
+#endif
 
 	drm_dbg_kms(&dev_priv->drm,
 		    "Adding %s connector on [ENCODER:%d:%s]\n",
drivers/gpu/drm/i915/display/intel_dp_aux.c +4 -0
index 220aa88c67ee..b4b9d2e1fec7 100644
@@ -5,7 +5,11 @@
 
 #include "i915_drv.h"
 #include "i915_reg.h"
+#ifdef I915
 #include "i915_trace.h"
+#else
+#define trace_i915_reg_rw(a...) do { } while (0)
+#endif
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp_aux.h"
drivers/gpu/drm/i915/display/intel_dpio_phy.h +15 -0
index 9c7725dacb47..952e8d446425 100644
@@ -7,6 +7,7 @@
 #define __INTEL_DPIO_PHY_H__
 
 #include <linux/types.h>
+#include "intel_display.h"
 
 enum pipe;
 enum port;
@@ -26,6 +27,7 @@ enum dpio_phy {
 	DPIO_PHY2,
 };
 
+#ifdef I915
 void bxt_port_to_phy_channel(struct drm_i915_private *dev_priv, enum port port,
 			     enum dpio_phy *phy, enum dpio_channel *ch);
 void bxt_ddi_phy_set_signal_levels(struct intel_encoder *encoder,
@@ -71,4 +73,17 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
 void vlv_phy_reset_lanes(struct intel_encoder *encoder,
 			 const struct intel_crtc_state *old_crtc_state);
 
+#else
+#define bxt_port_to_phy_channel(xe, port, phy, ch) do { *phy = 0; *ch = 0; } while (xe && port && 0)
+static inline void bxt_ddi_phy_set_signal_levels(struct intel_encoder *x,
+						 const struct intel_crtc_state *y) {}
+#define bxt_ddi_phy_init(xe, phy) do { } while (xe && phy && 0)
+#define bxt_ddi_phy_uninit(xe, phy) do { } while (xe && phy && 0)
+#define bxt_ddi_phy_is_enabled(xe, phy) (xe && phy && 0)
+static inline bool bxt_ddi_phy_verify_state(struct xe_device *xe, enum dpio_phy phy) { return false; }
+#define bxt_ddi_phy_calc_lane_lat_optim_mask(x) (x && 0)
+#define bxt_ddi_phy_set_lane_optim_mask(x, y) do { } while (x && y && 0)
+#define bxt_ddi_phy_get_lane_lat_optim_mask(x) (x && 0)
+#endif
+
 #endif /* __INTEL_DPIO_PHY_H__ */
drivers/gpu/drm/i915/display/intel_dpll.c +7 -1
index c236aafe9be0..bfc214b36585 100644
@@ -17,7 +17,10 @@
 #include "intel_panel.h"
 #include "intel_pps.h"
 #include "intel_snps_phy.h"
+
+#ifdef I915
 #include "vlv_sideband.h"
+#endif
 
 struct intel_dpll_funcs {
 	int (*crtc_compute_clock)(struct intel_atomic_state *state,
@@ -1594,6 +1597,7 @@ void i9xx_enable_pll(const struct intel_crtc_state *crtc_state)
 	}
 }
 
+#ifdef I915
 static void vlv_pllb_recal_opamp(struct drm_i915_private *dev_priv,
 				 enum pipe pipe)
 {
@@ -2005,6 +2009,7 @@ void chv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
 
 	vlv_dpio_put(dev_priv);
 }
+#endif
 
 void i9xx_disable_pll(const struct intel_crtc_state *crtc_state)
 {
@@ -2023,7 +2028,7 @@ void i9xx_disable_pll(const struct intel_crtc_state *crtc_state)
 	intel_de_posting_read(dev_priv, DPLL(pipe));
 }
 
-
+#ifdef I915
 /**
  * vlv_force_pll_off - forcibly disable just the PLL
  * @dev_priv: i915 private structure
@@ -2039,6 +2044,7 @@ void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe)
 	else
 		vlv_disable_pll(dev_priv, pipe);
 }
+#endif
 
 /* Only for pre-ILK configs */
 static void assert_pll(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/display/intel_dpll_mgr.c +4 -0
index 1974eb580ed1..56b4055c9ef4 100644
@@ -607,6 +607,7 @@ static void hsw_ddi_spll_enable(struct drm_i915_private *dev_priv,
 static void hsw_ddi_wrpll_disable(struct drm_i915_private *dev_priv,
 				  struct intel_shared_dpll *pll)
 {
+#ifdef I915
 	const enum intel_dpll_id id = pll->info->id;
 	u32 val;
 
@@ -620,11 +621,13 @@ static void hsw_ddi_wrpll_disable(struct drm_i915_private *dev_priv,
 	 */
 	if (dev_priv->pch_ssc_use & BIT(id))
 		intel_init_pch_refclk(dev_priv);
+#endif
 }
 
 static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,
 				 struct intel_shared_dpll *pll)
 {
+#ifdef I915
 	enum intel_dpll_id id = pll->info->id;
 	u32 val;
 
@@ -638,6 +641,7 @@ static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,
 	 */
 	if (dev_priv->pch_ssc_use & BIT(id))
 		intel_init_pch_refclk(dev_priv);
+#endif
 }
 
 static bool hsw_ddi_wrpll_get_hw_state(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/display/intel_dsb.c +99 -25

230 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_dsi_vbt.c +20 -6
index 2cbc1292ab38..b45552d96c0c 100644
@@ -46,9 +46,11 @@
 #include "intel_dsi.h"
 #include "intel_dsi_vbt.h"
 #include "intel_gmbus_regs.h"
+#ifdef I915
 #include "vlv_dsi.h"
 #include "vlv_dsi_regs.h"
 #include "vlv_sideband.h"
+#endif
 
 #define MIPI_TRANSFER_MODE_SHIFT	0
 #define MIPI_VIRTUAL_CHANNEL_SHIFT	1
@@ -76,6 +78,7 @@ struct gpio_map {
 	bool init;
 };
 
+#ifdef I915
 static struct gpio_map vlv_gpio_table[] = {
 	{ VLV_GPIO_NC_0_HV_DDI0_HPD },
 	{ VLV_GPIO_NC_1_HV_DDI0_DDC_SDA },
@@ -90,6 +93,7 @@ static struct gpio_map vlv_gpio_table[] = {
 	{ VLV_GPIO_NC_10_PANEL1_BKLTEN },
 	{ VLV_GPIO_NC_11_PANEL1_BKLTCTL },
 };
+#endif
 
 struct i2c_adapter_lookup {
 	u16 slave_addr;
@@ -219,10 +223,10 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
 		mipi_dsi_dcs_write_buffer(dsi_device, data, len);
 		break;
 	}
-
+#ifdef I915
 	if (DISPLAY_VER(dev_priv) < 11)
 		vlv_dsi_wait_for_fifo_empty(intel_dsi, port);
-
+#endif
 out:
 	data += len;
 
@@ -242,6 +246,7 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)
 	return data;
 }
 
+#ifdef I915
 static void vlv_exec_gpio(struct intel_connector *connector,
 			  u8 gpio_source, u8 gpio_index, bool value)
 {
@@ -370,6 +375,7 @@ static void bxt_exec_gpio(struct intel_connector *connector,
 
 	gpiod_set_value(gpio_desc, value);
 }
+#endif
 
 static void icl_exec_gpio(struct intel_connector *connector,
 			  u8 gpio_source, u8 gpio_index, bool value)
@@ -491,12 +497,14 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 		icl_native_gpio_set_value(dev_priv, gpio_number, value);
 	else if (DISPLAY_VER(dev_priv) >= 11)
 		icl_exec_gpio(connector, gpio_source, gpio_index, value);
+#ifdef I915
 	else if (IS_VALLEYVIEW(dev_priv))
 		vlv_exec_gpio(connector, gpio_source, gpio_number, value);
 	else if (IS_CHERRYVIEW(dev_priv))
 		chv_exec_gpio(connector, gpio_source, gpio_number, value);
 	else
 		bxt_exec_gpio(connector, gpio_source, gpio_index, value);
+#endif
 
 	return data;
 }
@@ -821,8 +829,10 @@ void intel_dsi_log_params(struct intel_dsi *intel_dsi)
 		    intel_dsi->clk_lp_to_hs_count);
 	drm_dbg_kms(&i915->drm, "HS to LP Clock Count 0x%x\n",
 		    intel_dsi->clk_hs_to_lp_count);
+#ifdef I915
 	drm_dbg_kms(&i915->drm, "BTA %s\n",
 		    str_enabled_disabled(!(intel_dsi->video_frmt_cfg_bits & DISABLE_VIDEO_BTA)));
+#endif
 }
 
 bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
@@ -841,9 +851,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->eotp_pkt = mipi_config->eot_pkt_disabled ? 0 : 1;
 	intel_dsi->clock_stop = mipi_config->enable_clk_stop ? 1 : 0;
 	intel_dsi->lane_count = mipi_config->lane_cnt + 1;
-	intel_dsi->pixel_format =
-			pixel_format_from_register_bits(
-				mipi_config->videomode_color_format << 7);
+	intel_dsi->pixel_format = mipi_config->videomode_color_format << 7;
 
 	intel_dsi->dual_link = mipi_config->dual_link;
 	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
@@ -857,7 +865,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->init_count = mipi_config->master_init_timer;
 	intel_dsi->bw_timer = mipi_config->dbi_bw_timer;
 	intel_dsi->video_frmt_cfg_bits =
-		mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0;
+		mipi_config->bta_enabled ? BIT(3) : 0;
 	intel_dsi->bgr_enabled = mipi_config->rgb_flip;
 
 	/* Starting point, adjusted depending on dual link and burst mode */
@@ -940,6 +948,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
  * If the GOP did not initialize the panel (HDMI inserted) we may need to also
  * change the pinmux for the SoC's PWM0 pin from GPIO to PWM.
  */
+#ifdef I915
 static struct gpiod_lookup_table pmic_panel_gpio_table = {
 	/* Intel GFX is consumer */
 	.dev_id = "0000:00:02.0",
@@ -963,9 +972,11 @@ static const struct pinctrl_map soc_pwm_pinctrl_map[] = {
 	PIN_MAP_MUX_GROUP("0000:00:02.0", "soc_pwm0", "INT33FC:00",
 			  "pwm0_grp", "pwm"),
 };
+#endif
 
 void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on)
 {
+#ifdef I915
 	struct drm_device *dev = intel_dsi->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_connector *connector = intel_dsi->attached_connector;
@@ -1018,10 +1029,12 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on)
 			intel_dsi->gpio_backlight = NULL;
 		}
 	}
+#endif
 }
 
 void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi)
 {
+#ifdef I915
 	struct drm_device *dev = intel_dsi->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_connector *connector = intel_dsi->attached_connector;
@@ -1045,4 +1058,5 @@ void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi)
 		pinctrl_unregister_mappings(soc_pwm_pinctrl_map);
 		gpiod_remove_lookup_table(&soc_panel_gpio_table);
 	}
+#endif
 }
drivers/gpu/drm/i915/display/intel_fb.c +80 -16

260 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_fbc.c +45 -4

134 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_fbdev.c +92 -9

211 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_gmbus.c +1 -1
index 0bc4f6b48e80..2d099f4c52cd 100644
@@ -39,7 +39,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_gmbus.h"
-#include "intel_gmbus_regs.h"
+#include "../i915/display/intel_gmbus_regs.h"
 
 struct intel_gmbus {
 	struct i2c_adapter adapter;
drivers/gpu/drm/i915/display/intel_lpe_audio.h +8 -0
index f848c5038714..1e236df9273b 100644
@@ -12,11 +12,19 @@ enum pipe;
 enum port;
 struct drm_i915_private;
 
+#ifdef I915
 int  intel_lpe_audio_init(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
 			    enum pipe pipe, enum port port,
 			    const void *eld, int ls_clock, bool dp_output);
+#else
+#define intel_lpe_audio_init(xe) (-ENODEV)
+#define intel_lpe_audio_teardown(xe) BUG_ON(1)
+#define intel_lpe_audio_irq_handler(xe) do { } while (0)
+#define intel_lpe_audio_notify(xe, a, b, c, d, e) do { } while (0)
+
+#endif
 
 #endif /* __INTEL_LPE_AUDIO_H__ */
drivers/gpu/drm/i915/display/intel_modeset_setup.c +7 -4
index 96395bfbd41d..6f705acaf225 100644
@@ -721,18 +721,21 @@ void intel_modeset_setup_hw_state(struct drm_i915_private *i915,
 
 	intel_dpll_sanitize_state(i915);
 
-	if (IS_G4X(i915)) {
+	if (DISPLAY_VER(i915) >= 9) {
+		skl_wm_get_hw_state(i915);
+		skl_wm_sanitize(i915);
+	}
+#ifdef I915
+	else if (IS_G4X(i915)) {
 		g4x_wm_get_hw_state(i915);
 		g4x_wm_sanitize(i915);
 	} else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
 		vlv_wm_get_hw_state(i915);
 		vlv_wm_sanitize(i915);
-	} else if (DISPLAY_VER(i915) >= 9) {
-		skl_wm_get_hw_state(i915);
-		skl_wm_sanitize(i915);
 	} else if (HAS_PCH_SPLIT(i915)) {
 		ilk_wm_get_hw_state(i915);
 	}
+#endif
 
 	for_each_intel_crtc(&i915->drm, crtc) {
 		struct intel_crtc_state *crtc_state =
drivers/gpu/drm/i915/display/intel_opregion.c +1 -1
index e0184745632c..057a68237efe 100644
@@ -37,7 +37,7 @@
 #include "intel_backlight.h"
 #include "intel_display_types.h"
 #include "intel_opregion.h"
-#include "intel_pci_config.h"
+#include "../i915/intel_pci_config.h"
 
 #define OPREGION_HEADER_OFFSET 0
 #define OPREGION_ACPI_OFFSET   0x100
drivers/gpu/drm/i915/display/intel_pch_display.h +16 -0
index 41a63413cb3d..e8b50e9a4969 100644
@@ -15,6 +15,7 @@ struct intel_crtc;
 struct intel_crtc_state;
 struct intel_link_m_n;
 
+#ifdef I915
 bool intel_has_pch_trancoder(struct drm_i915_private *i915,
 			     enum pipe pch_transcoder);
 enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc);
@@ -41,5 +42,20 @@ void intel_pch_transcoder_get_m2_n2(struct intel_crtc *crtc,
 				    struct intel_link_m_n *m_n);
 
 void intel_pch_sanitize(struct drm_i915_private *i915);
+#else
+#define intel_has_pch_trancoder(xe, pipe) (xe && pipe && 0)
+#define intel_crtc_pch_transcoder(crtc) ((crtc)->pipe)
+#define ilk_pch_pre_enable(state, crtc) do { } while (0)
+#define ilk_pch_enable(state, crtc) do { } while (0)
+#define ilk_pch_disable(state, crtc) do { } while (0)
+#define ilk_pch_post_disable(state, crtc) do { } while (0)
+#define ilk_pch_get_config(crtc) do { } while (0)
+#define lpt_pch_enable(state, crtc) do { } while (0)
+#define lpt_pch_disable(state, crtc) do { } while (0)
+#define lpt_pch_get_config(crtc) do { } while (0)
+#define intel_pch_transcoder_get_m1_n1(crtc, m_n) memset((m_n), 0, sizeof(*m_n))
+#define intel_pch_transcoder_get_m2_n2(crtc, m_n) memset((m_n), 0, sizeof(*m_n))
+#define intel_pch_sanitize(xe) do { } while (0)
+#endif
 
 #endif
drivers/gpu/drm/i915/display/intel_pch_refclk.h +8 -0
index 9bcf56629f24..aa4f6e0b1127 100644
@@ -11,6 +11,7 @@
 struct drm_i915_private;
 struct intel_crtc_state;
 
+#ifdef I915
 void lpt_program_iclkip(const struct intel_crtc_state *crtc_state);
 void lpt_disable_iclkip(struct drm_i915_private *dev_priv);
 int lpt_get_iclkip(struct drm_i915_private *dev_priv);
@@ -18,5 +19,12 @@ int lpt_iclkip(const struct intel_crtc_state *crtc_state);
 
 void intel_init_pch_refclk(struct drm_i915_private *dev_priv);
 void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
+#else
+#define lpt_program_iclkip(cstate) do { } while (0)
+#define lpt_disable_iclkip(xe) do { } while (0)
+#define lpt_get_iclkip(xe) (WARN_ON(-ENODEV))
+#define intel_init_pch_refclk(xe) do { } while (0)
+#define lpt_disable_clkout_dp(xe) do { } while (0)
+#endif
 
 #endif
drivers/gpu/drm/i915/display/intel_pipe_crc.c +1 -0
index e9774670e3f6..a4b7a8ec3720 100644
@@ -34,6 +34,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_pipe_crc.h"
+#include "i915_irq.h"
 
 static const char * const pipe_crc_sources[] = {
 	[INTEL_PIPE_CRC_SOURCE_NONE] = "none",
drivers/gpu/drm/i915/display/intel_sprite.c +21 -0
index e6b4d24b9cd0..000561eadcc1 100644
@@ -43,8 +43,10 @@
 
 #include "i915_drv.h"
 #include "i915_reg.h"
+#ifdef I915
 #include "i915_vgpu.h"
 #include "i9xx_plane.h"
+#endif
 #include "intel_atomic_plane.h"
 #include "intel_crtc.h"
 #include "intel_de.h"
@@ -112,6 +114,7 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
 	return 0;
 }
 
+#ifdef I915
 static void i9xx_plane_linear_gamma(u16 gamma[8])
 {
 	/* The points are not evenly spaced. */
@@ -325,6 +328,7 @@ static u32 vlv_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state)
 static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state,
 			  const struct intel_plane_state *plane_state)
 {
+#ifdef I915
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
 	unsigned int rotation = plane_state->hw.rotation;
 	const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
@@ -396,6 +400,9 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state,
 		sprctl |= SP_SOURCE_KEY;
 
 	return sprctl;
+#else
+	return 0;
+#endif
 }
 
 static void vlv_sprite_update_gamma(const struct intel_plane_state *plane_state)
@@ -447,6 +454,7 @@ vlv_sprite_update_arm(struct intel_plane *plane,
 		      const struct intel_crtc_state *crtc_state,
 		      const struct intel_plane_state *plane_state)
 {
+#ifdef I915
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	enum pipe pipe = plane->pipe;
 	enum plane_id plane_id = plane->id;
@@ -486,6 +494,7 @@ vlv_sprite_update_arm(struct intel_plane *plane,
 	intel_de_write_fw(dev_priv, SPCNTR(pipe, plane_id), sprctl);
 	intel_de_write_fw(dev_priv, SPSURF(pipe, plane_id),
 			  intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
+#endif
 
 	vlv_sprite_update_clrc(plane_state);
 	vlv_sprite_update_gamma(plane_state);
@@ -711,6 +720,7 @@ static bool ivb_need_sprite_gamma(const struct intel_plane_state *plane_state)
 static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,
 			  const struct intel_plane_state *plane_state)
 {
+#ifdef I915
 	struct drm_i915_private *dev_priv =
 		to_i915(plane_state->uapi.plane->dev);
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
@@ -780,6 +790,9 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,
 		sprctl |= SPRITE_SOURCE_KEY;
 
 	return sprctl;
+#else
+	return 0;
+#endif
 }
 
 static void ivb_sprite_linear_gamma(const struct intel_plane_state *plane_state,
@@ -1723,10 +1736,13 @@ static const struct drm_plane_funcs vlv_sprite_funcs = {
 	.format_mod_supported = vlv_sprite_format_mod_supported,
 };
 
+#endif
+
 struct intel_plane *
 intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 			  enum pipe pipe, int sprite)
 {
+#ifdef I915
 	struct intel_plane *plane;
 	const struct drm_plane_funcs *plane_funcs;
 	unsigned int supported_rotations;
@@ -1846,4 +1862,9 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 	intel_plane_free(plane);
 
 	return ERR_PTR(ret);
+#else
+	BUG_ON(1);
+	return ERR_PTR(-ENODEV);
+#endif
 }
+
drivers/gpu/drm/i915/display/intel_vbt_defs.h +1 -1
index a9f44abfc9fc..001de8fe4e64 100644
@@ -30,7 +30,7 @@
  *
  * Please do NOT include anywhere else.
  */
-#ifndef _INTEL_BIOS_PRIVATE
+#if !defined(_INTEL_BIOS_PRIVATE) && !defined(HDRTEST)
 #error "intel_vbt_defs.h is private to intel_bios.c"
 #endif
 
drivers/gpu/drm/i915/display/intel_vga.c +5 -0
index a69bfcac9a94..b15dcc84ae8c 100644
@@ -101,6 +101,7 @@ void intel_vga_reset_io_mem(struct drm_i915_private *i915)
 static int
 intel_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
 {
+#ifdef I915
 	unsigned int reg = DISPLAY_VER(i915) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
 	u16 gmch_ctrl;
 
@@ -123,6 +124,10 @@ intel_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
 	}
 
 	return 0;
+#else
+	/* Only works on some machines because bios forgets to lock the reg. */
+	return -EIO;
+#endif
 }
 
 static unsigned int
drivers/gpu/drm/i915/display/skl_scaler.c +2 -0
index d7390067b7d4..8c918734416d 100644
@@ -244,6 +244,7 @@ int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
 	if (ret || plane_state->scaler_id < 0)
 		return ret;
 
+#ifdef I915
 	/* check colorkey */
 	if (plane_state->ckey.flags) {
 		drm_dbg_kms(&dev_priv->drm,
@@ -252,6 +253,7 @@ int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
 			    intel_plane->base.name);
 		return -EINVAL;
 	}
+#endif
 
 	/* Check src format */
 	switch (fb->format->format) {
drivers/gpu/drm/i915/display/skl_universal_plane.c +44 -7

149 lines not on this page · raw message

drivers/gpu/drm/i915/display/skl_watermark.c +1 -1
index e254fb21b47f..381d4f75e7c8 100644
@@ -16,7 +16,7 @@
 #include "skl_watermark.h"
 
 #include "i915_drv.h"
-#include "i915_fixed.h"
+#include "../i915/i915_fixed.h"
 #include "i915_reg.h"
 #include "intel_pm.h"
 
drivers/gpu/drm/i915/gt/intel_gt_regs.h +2 -1
index f8eb807b56f9..3b9e20dd6039 100644
@@ -7,8 +7,9 @@
 #define __INTEL_GT_REGS__
 
 #include "i915_reg_defs.h"
+#ifdef I915
 #include "display/intel_display_reg_defs.h"	/* VLV_DISPLAY_BASE */
-
+#endif
 #define MCR_REG(offset)	((const i915_mcr_reg_t){ .reg = (offset) })
 
 /*
drivers/gpu/drm/i915/i915_reg_defs.h +8 -0
index be43580a6979..1e3966609844 100644
@@ -132,9 +132,13 @@ typedef struct {
 
 #define _MMIO(r) ((const i915_reg_t){ .reg = (r) })
 
+#ifdef I915
 typedef struct {
 	u32 reg;
 } i915_mcr_reg_t;
+#else
+#define i915_mcr_reg_t i915_reg_t
+#endif
 
 #define INVALID_MMIO_REG _MMIO(0)
 
@@ -143,8 +147,12 @@ typedef struct {
  * simply operations on the register's offset and don't care about the MCR vs
  * non-MCR nature of the register.
  */
+#ifdef I915
 #define i915_mmio_reg_offset(r) \
 	_Generic((r), i915_reg_t: (r).reg, i915_mcr_reg_t: (r).reg)
+#else
+#define i915_mmio_reg_offset(r) ((r).reg)
+#endif
 #define i915_mmio_reg_equal(a, b) (i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b))
 #define i915_mmio_reg_valid(r) (!i915_mmio_reg_equal(r, INVALID_MMIO_REG))
 
Signature · 1 line
2.37.3
author maintainer
#69 lore raw

RFC PATCH 19/20 sound/hda: Allow XE as i915 replacement for sound

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

Xe, is a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake. Let's ensure sound can accept xe instead of i915 whenever that is in use.

---
 sound/hda/hdac_i915.c      | 17 +++---------
 sound/pci/hda/hda_intel.c  | 56 ++++++++++++++++++++------------------
 sound/soc/intel/avs/core.c | 13 ++++++---
 sound/soc/sof/intel/hda.c  |  7 +++--
 4 files changed, 48 insertions(+), 45 deletions(-)
sound/hda/hdac_i915.c +4 -13
index 161a9711cd63..39c548b34fcd 100644
@@ -108,7 +108,8 @@ static int i915_component_master_match(struct device *dev, int subcomponent,
 	hdac_pci = to_pci_dev(bus->dev);
 	i915_pci = to_pci_dev(dev);
 
-	if (!strcmp(dev->driver->name, "i915") &&
+	if ((!strcmp(dev->driver->name, "i915") ||
+	     !strcmp(dev->driver->name, "xe")) &&
 	    subcomponent == I915_COMPONENT_AUDIO &&
 	    connectivity_check(i915_pci, hdac_pci))
 		return 1;
@@ -159,20 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
 	if (err < 0)
 		return err;
 	acomp = bus->audio_component;
-	if (!acomp)
-		return -ENODEV;
-	if (!acomp->ops) {
-		if (!IS_ENABLED(CONFIG_MODULES) ||
-		    !request_module("i915")) {
-			/* 60s timeout */
-			wait_for_completion_killable_timeout(&acomp->master_bind_complete,
-							     msecs_to_jiffies(60 * 1000));
-		}
-	}
-	if (!acomp->ops) {
+	if (!acomp || !acomp->ops) {
 		dev_info(bus->dev, "couldn't bind with audio component\n");
 		snd_hdac_acomp_exit(bus);
-		return -ENODEV;
+		return -EPROBE_DEFER;
 	}
 	return 0;
 }
sound/pci/hda/hda_intel.c +30 -26

80 lines not on this page · raw message

sound/soc/intel/avs/core.c +9 -4
index bb0719c58ca4..353aa40eb6dc 100644
@@ -187,10 +187,6 @@ static void avs_hda_probe_work(struct work_struct *work)
 
 	pm_runtime_set_active(bus->dev); /* clear runtime_error flag */
 
-	ret = snd_hdac_i915_init(bus);
-	if (ret < 0)
-		dev_info(bus->dev, "i915 init unsuccessful: %d\n", ret);
-
 	snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);
 	avs_hdac_bus_init_chip(bus, true);
 	avs_hdac_bus_probe_codecs(bus);
@@ -460,10 +456,19 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
 	pci_set_drvdata(pci, bus);
 	device_disable_async_suspend(dev);
 
+	ret = snd_hdac_i915_init(bus);
+	if (ret == -EPROBE_DEFER)
+		goto err_unmaster;
+	else if (ret < 0)
+		dev_info(bus->dev, "i915 init unsuccessful: %d\n", ret);
+
 	schedule_work(&adev->probe_work);
 
 	return 0;
 
+err_unmaster:
+	pci_clear_master(pci);
+	pci_set_drvdata(pci, NULL);
 err_acquire_irq:
 	snd_hdac_bus_free_stream_pages(bus);
 	snd_hdac_ext_stream_free_all(bus);
sound/soc/sof/intel/hda.c +5 -2
index 1188ec51816b..671291838b8e 100644
@@ -719,8 +719,11 @@ static int hda_init(struct snd_sof_dev *sdev)
 
 	/* init i915 and HDMI codecs */
 	ret = hda_codec_i915_init(sdev);
-	if (ret < 0)
-		dev_warn(sdev->dev, "init of i915 and HDMI codec failed\n");
+	if (ret < 0) {
+		if (ret != -EPROBE_DEFER)
+			dev_warn(sdev->dev, "init of i915 and HDMI codec failed: %i\n", ret);
+		return ret;
+	}
 
 	/* get controller capabilities */
 	ret = hda_dsp_ctrl_get_caps(sdev);
Signature · 1 line
2.37.3
author maintainer
#70 lore raw

RFC PATCH 20/20 mei/hdcp: Also enable for XE

In reply to Matthew Brost

From: Maarten Lankhorst <[email protected]>

Xe, is a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake. Let's ensure mei/hdcp can accept xe instead of i915 whenever that is in use.

---
 drivers/misc/mei/hdcp/Kconfig    | 2 +-
 drivers/misc/mei/hdcp/mei_hdcp.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/Kconfig +1 -1
index 54e1c9526909..2ac9148988d4 100644
@@ -4,7 +4,7 @@
 config INTEL_MEI_HDCP
 	tristate "Intel HDCP2.2 services of ME Interface"
 	select INTEL_MEI_ME
-	depends on DRM_I915
+	depends on DRM_I915 || DRM_XE
 	help
 	  MEI Support for HDCP2.2 Services on Intel platforms.
 
drivers/misc/mei/hdcp/mei_hdcp.c +2 -1
index e889a8bd7ac8..699dfc4a0a57 100644
@@ -784,7 +784,8 @@ static int mei_hdcp_component_match(struct device *dev, int subcomponent,
 {
 	struct device *base = data;
 
-	if (!dev->driver || strcmp(dev->driver->name, "i915") ||
+	if (!dev->driver ||
+	    (strcmp(dev->driver->name, "i915") && strcmp(dev->driver->name, "xe")) ||
 	    subcomponent != I915_COMPONENT_HDCP)
 		return 0;
 
Signature · 1 line
2.37.3
#71 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for Initial Xe driver submission

In reply to Matthew Brost
== Series Details ==

== Series Details ==

Series: Initial Xe driver submission
URL : https://patchwork.freedesktop.org/series/112189/
State : failure

== Summary ==

Error: patch https://patchwork.freedesktop.org/api/1.0/series/112189/revisions/1/mbox/ not applied
Applying: drm/suballoc: Introduce a generic suballocation manager
Applying: drm/amd: Convert amdgpu to use suballocation helper.
Applying: drm/radeon: Use the drm suballocation manager implementation.
Applying: drm/sched: Convert drm scheduler to use a work queue rather than kthread
Applying: drm/sched: Add generic scheduler message interface
Applying: drm/sched: Start run wq before TDR in drm_sched_start
Applying: drm/sched: Submit job before starting TDR
Applying: drm/sched: Add helper to set TDR timeout
Applying: drm: Add a gpu page-table walker helper
Applying: drm/ttm: Don't print error message if eviction was interrupted
Applying: drm/i915: Remove gem and overlay frontbuffer tracking
Applying: drm/i915/display: Neuter frontbuffer tracking harder
Applying: drm/i915/display: Add more macros to remove all direct calls to uncore
Applying: drm/i915/display: Remove all uncore mmio accesses in favor of intel_de
Applying: drm/i915: Rename find_section to find_bdb_section
Applying: drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe
Applying: drm/i915/display: Fix a use-after-free when intel_edp_init_connector fails
Applying: drm/i915/display: Remaining changes to make xe compile
Applying: sound/hda: Allow XE as i915 replacement for sound
Using index info to reconstruct a base tree...
M sound/hda/hdac_i915.c
M sound/pci/hda/hda_intel.c
Falling back to patching base and 3-way merge...
Auto-merging sound/pci/hda/hda_intel.c
CONFLICT (content): Merge conflict in sound/pci/hda/hda_intel.c
Auto-merging sound/hda/hdac_i915.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0019 sound/hda: Allow XE as i915 replacement for sound
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

#72 lore raw
In reply to Matthew Brost

Hi

Am 22.12.22 um 23:21 schrieb Matthew Brost:

Quoted 11 lines

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

After Xe has stabilized, will i915 loose the ability to drive this hardware (and possibly other)? I'm specfically thinking of the i915 code that requires TTM. Keeping that dependecy within Xe only might benefit DRM as a whole.

Quoted 16 lines

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

Quoted 7 lines

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Could both drivers reside in a common parent directory and share something like a DRM Intel helper module with the common code? This would fit well with the common design of DRM helpers.

Best regards
Thomas

Quoted 165 lines

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

  drivers/gpu/drm/Kconfig                       |   5 +
  drivers/gpu/drm/Makefile                      |   4 +
  drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
  drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
  drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
  drivers/gpu/drm/i915/Makefile                 |   2 +-
  drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
  drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
  drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
  .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
  .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
  drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
  drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
  drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
  drivers/gpu/drm/i915/display/intel_color.c    |   1 +
  drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
  drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
  drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
  drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
  drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
  .../gpu/drm/i915/display/intel_display_core.h |   5 +-
  .../drm/i915/display/intel_display_debugfs.c  |   8 +
  .../drm/i915/display/intel_display_power.c    |  40 ++-
  .../drm/i915/display/intel_display_power.h    |   6 +
  .../i915/display/intel_display_power_map.c    |   7 +
  .../i915/display/intel_display_power_well.c   |  24 +-
  .../drm/i915/display/intel_display_reg_defs.h |   4 +
  .../drm/i915/display/intel_display_trace.h    |   6 +
  .../drm/i915/display/intel_display_types.h    |  32 +-
  drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
  drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
  drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
  drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
  drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
  drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
  drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
  drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
  drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
  drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
  drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
  drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
  drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
  drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
  .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
  .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
  drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
  drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
  drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
  .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
  .../drm/i915/display/intel_modeset_setup.c    |  11 +-
  drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
  drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
  .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
  .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
  drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
  .../drm/i915/display/intel_plane_initial.c    |   3 +-
  drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
  drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
  drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
  drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
  drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
  .../drm/i915/display/skl_universal_plane.c    |  52 ++-
  drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
  drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
  drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
  .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
  drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
  drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
  drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
  drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
  drivers/gpu/drm/i915/i915_driver.c            |   1 +
  drivers/gpu/drm/i915/i915_gem.c               |   8 -
  drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
  drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
  drivers/gpu/drm/i915/i915_vma.c               |  12 -
  drivers/gpu/drm/radeon/radeon.h               |  55 +--
  drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
  drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
  drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
  drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
  drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
  drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
  drivers/misc/mei/hdcp/Kconfig                 |   2 +-
  drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
  include/drm/drm_pt_walk.h                     | 161 +++++++++
  include/drm/drm_suballoc.h                    | 112 ++++++
  include/drm/gpu_scheduler.h                   |  41 ++-
  sound/hda/hdac_i915.c                         |  17 +-
  sound/pci/hda/hda_intel.c                     |  56 +--
  sound/soc/intel/avs/core.c                    |  13 +-
  sound/soc/sof/intel/hda.c                     |   7 +-
  98 files changed, 2076 insertions(+), 1325 deletions(-)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 drivers/gpu/drm/drm_suballoc.c create mode 100644 include/drm/drm_pt_walk.h create mode 100644 include/drm/drm_suballoc.h

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
maintainer
#73 lore raw
Quoted 15 lines · Thomas Zimmermann

Hi

Am 22.12.22 um 23:21 schrieb Matthew Brost:

Quoted 11 lines

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

Quoted 4 lines

After Xe has stabilized, will i915 loose the ability to drive this hardware (and possibly other)? I'm specfically thinking of the i915 code that requires TTM. Keeping that dependecy within Xe only might benefit DRM as a whole.

There's going to be a number of platforms supported by both drivers, and from purely a i915 standpoint dropping any currently supported platforms or that dependency from i915 would be a regression.

Quoted 24 lines
Quoted 16 lines

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

Quoted 7 lines

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Quoted 3 lines

Could both drivers reside in a common parent directory and share something like a DRM Intel helper module with the common code? This would fit well with the common design of DRM helpers.

I think it's too early to tell.

For one thing, setting that up would be a lot of up front infrastructure work. I'm not sure how to even pull that off when Xe is still out-of-tree and i915 development plunges on upstream as ever.

For another, realistically, the overlap between supported platforms is going to end at some point, and eventually new platforms are only going to be supported with Xe. That's going to open up new possibilities for refactoring also the display code. I think it would be premature to lock in to a common directory structure or a common helper module at this point.

I'm not saying no to the idea, and we've contemplated it before, but I think there are still too many moving parts to decide to go that way.

BR,
Jani.

Quoted 169 lines

Best regards
Thomas

Quoted 165 lines

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

  drivers/gpu/drm/Kconfig                       |   5 +
  drivers/gpu/drm/Makefile                      |   4 +
  drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
  drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
  drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
  drivers/gpu/drm/i915/Makefile                 |   2 +-
  drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
  drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
  drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
  .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
  .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
  drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
  drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
  drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
  drivers/gpu/drm/i915/display/intel_color.c    |   1 +
  drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
  drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
  drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
  drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
  drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
  .../gpu/drm/i915/display/intel_display_core.h |   5 +-
  .../drm/i915/display/intel_display_debugfs.c  |   8 +
  .../drm/i915/display/intel_display_power.c    |  40 ++-
  .../drm/i915/display/intel_display_power.h    |   6 +
  .../i915/display/intel_display_power_map.c    |   7 +
  .../i915/display/intel_display_power_well.c   |  24 +-
  .../drm/i915/display/intel_display_reg_defs.h |   4 +
  .../drm/i915/display/intel_display_trace.h    |   6 +
  .../drm/i915/display/intel_display_types.h    |  32 +-
  drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
  drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
  drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
  drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
  drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
  drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
  drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
  drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
  drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
  drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
  drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
  drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
  drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
  drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
  .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
  .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
  drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
  drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
  drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
  .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
  .../drm/i915/display/intel_modeset_setup.c    |  11 +-
  drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
  drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
  .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
  .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
  drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
  .../drm/i915/display/intel_plane_initial.c    |   3 +-
  drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
  drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
  drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
  drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
  drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
  .../drm/i915/display/skl_universal_plane.c    |  52 ++-
  drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
  drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
  drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
  .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
  drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
  drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
  drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
  drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
  drivers/gpu/drm/i915/i915_driver.c            |   1 +
  drivers/gpu/drm/i915/i915_gem.c               |   8 -
  drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
  drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
  drivers/gpu/drm/i915/i915_vma.c               |  12 -
  drivers/gpu/drm/radeon/radeon.h               |  55 +--
  drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
  drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
  drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
  drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
  drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
  drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
  drivers/misc/mei/hdcp/Kconfig                 |   2 +-
  drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
  include/drm/drm_pt_walk.h                     | 161 +++++++++
  include/drm/drm_suballoc.h                    | 112 ++++++
  include/drm/gpu_scheduler.h                   |  41 ++-
  sound/hda/hdac_i915.c                         |  17 +-
  sound/pci/hda/hda_intel.c                     |  56 +--
  sound/soc/intel/avs/core.c                    |  13 +-
  sound/soc/sof/intel/hda.c                     |   7 +-
  98 files changed, 2076 insertions(+), 1325 deletions(-)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 drivers/gpu/drm/drm_suballoc.c create mode 100644 include/drm/drm_pt_walk.h create mode 100644 include/drm/drm_suballoc.h

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#74 lore raw

Hi,

Quoted 66 lines · On Mon, 02 Jan 2023 13:42:46 +0200 Jani Nikula <[email protected]>…
Quoted 15 lines · Thomas Zimmermann

Hi

Am 22.12.22 um 23:21 schrieb Matthew Brost:

Quoted 11 lines

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

Quoted 4 lines

After Xe has stabilized, will i915 loose the ability to drive this hardware (and possibly other)? I'm specfically thinking of the i915 code that requires TTM. Keeping that dependecy within Xe only might benefit DRM as a whole.

There's going to be a number of platforms supported by both drivers, and from purely a i915 standpoint dropping any currently supported platforms or that dependency from i915 would be a regression.

Quoted 24 lines
Quoted 16 lines

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

Quoted 7 lines

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Quoted 3 lines

Could both drivers reside in a common parent directory and share something like a DRM Intel helper module with the common code? This would fit well with the common design of DRM helpers.

I think it's too early to tell.

For one thing, setting that up would be a lot of up front infrastructure work. I'm not sure how to even pull that off when Xe is still out-of-tree and i915 development plunges on upstream as ever.

For another, realistically, the overlap between supported platforms is going to end at some point, and eventually new platforms are only going to be supported with Xe. That's going to open up new possibilities for refactoring also the display code. I think it would be premature to lock in to a common directory structure or a common helper module at this point.

Quoted 2 lines

I'm not saying no to the idea, and we've contemplated it before, but I think there are still too many moving parts to decide to go that way.

FWIW, I actually have the same dilemma with the driver for new Mali GPUs I'm working on. I initially started making it a sub-driver of the existing panfrost driver (some HW blocks are similar, like the IOMMU and a few other things, and some SW abstracts can be shared here and there, like the GEM allocator logic). But I'm now considering forking the driver (after Alyssa planted the seed :-)), not only because I want to start from a clean sheet on the the uAPI front (wouldn't be an issue in your case, because you're talking about sharing helpers, not the driver frontend), but also because any refactor to panfrost is a potential source of regression for existing users. So, I tend to agree with Jani here, trying to share code before things have settled down is likely to cause pain to both Xe and i915 users+developers.

Best Regards,

Boris

#75 lore raw
Quoted 14 lines
Quoted 11 lines

For one thing, setting that up would be a lot of up front infrastructure work. I'm not sure how to even pull that off when Xe is still out-of-tree and i915 development plunges on upstream as ever.

For another, realistically, the overlap between supported platforms is going to end at some point, and eventually new platforms are only going to be supported with Xe. That's going to open up new possibilities for refactoring also the display code. I think it would be premature to lock in to a common directory structure or a common helper module at this point.

Quoted 2 lines

I'm not saying no to the idea, and we've contemplated it before, but I think there are still too many moving parts to decide to go that way.

Quoted 13 lines

FWIW, I actually have the same dilemma with the driver for new Mali GPUs I'm working on. I initially started making it a sub-driver of the existing panfrost driver (some HW blocks are similar, like the IOMMU and a few other things, and some SW abstracts can be shared here and there, like the GEM allocator logic). But I'm now considering forking the driver (after Alyssa planted the seed :-)), not only because I want to start from a clean sheet on the the uAPI front (wouldn't be an issue in your case, because you're talking about sharing helpers, not the driver frontend), but also because any refactor to panfrost is a potential source of regression for existing users. So, I tend to agree with Jani here, trying to share code before things have settled down is likely to cause pain to both Xe and i915 users+developers.

++

I pretend to have never written a kernel driver, so will not comment there. But Boris and I were previously bit trying to share code between our GL and VK drivers, before VK settled down, causing pain for both. I don't want a kernelside repeat of that (for either Mali or Intel).

I tend to think that, if you're tempted to share a driver frontend without the backend, that's a sign that there's too much boilerplate for the frontend and maybe there needs to be more helpers somewhere. For Xe, that doesn't apply since the hw overlaps between the drivers, but for Mali, there really is more different than similar and there's an obvious, acute break between "old Mali" and "new Mali". The shared "instantiate a DRM driver boilerplate" is pretty trivial, and the MMU code is as simple as it gets...

#76 lore raw
In reply to Matthew Brost
Quoted 35 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Quoted 4 lines

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

What is the plan going forward for the execlists backend? I think it would be preferable to not upstream something semi-functional and so to carry technical debt in the brand new code base, from the very start. If it is for Tigerlake, which is the starting platform for Xe, could it be made GuC only Tigerlake for instance?

Regards,

Tvrtko

author maintainer
#77 lore raw
Quoted 42 lines · Tvrtko Ursulin
Quoted 35 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Quoted 4 lines

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

Quoted 6 lines

What is the plan going forward for the execlists backend? I think it would be preferable to not upstream something semi-functional and so to carry technical debt in the brand new code base, from the very start. If it is for Tigerlake, which is the starting platform for Xe, could it be made GuC only Tigerlake for instance?

A little background here. In the original PoC written by Jason and Dave, the execlist backend was the only one present and it was in semi-working state. As soon as myself and a few others started working on Xe we went full in a on the GuC backend. We left the execlist backend basically in the state it was in. We left it in place for 2 reasons.

1. Having 2 backends from the start ensured we layered our code correctly. The layer was a complete disaster in the i915 so we really wanted to avoid that.
2. The thought was it might be needed for early product bring up one day.

As I think about this a bit more, we likely just delete execlist backend before merging this upstream and perhaps just carry 1 large patch internally with this implementation that we can use as needed. Final decession TDB though.

Matt

Quoted 3 lines

Regards,

Tvrtko

#78 lore raw
Quoted 62 lines · Matthew Brost
Quoted 42 lines · Tvrtko Ursulin
Quoted 35 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Quoted 4 lines

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

Quoted 6 lines

What is the plan going forward for the execlists backend? I think it would be preferable to not upstream something semi-functional and so to carry technical debt in the brand new code base, from the very start. If it is for Tigerlake, which is the starting platform for Xe, could it be made GuC only Tigerlake for instance?

A little background here. In the original PoC written by Jason and Dave, the execlist backend was the only one present and it was in semi-working state. As soon as myself and a few others started working on Xe we went full in a on the GuC backend. We left the execlist backend basically in the state it was in. We left it in place for 2 reasons.

1. Having 2 backends from the start ensured we layered our code correctly. The layer was a complete disaster in the i915 so we really wanted to avoid that.
2. The thought was it might be needed for early product bring up one day.

Quoted 4 lines

As I think about this a bit more, we likely just delete execlist backend before merging this upstream and perhaps just carry 1 large patch internally with this implementation that we can use as needed. Final decession TDB though.

but that might regress after some time on "let's keep 2 backends so we layer the code correctly". Leaving the additional backend behind CONFIG_BROKEN or XE_EXPERIMENTAL, or something like that, not enabled by distros, but enabled in CI would be a good idea IMO.

Carrying a large patch out of tree would make things harder for new platforms. A perfect backend split would make it possible, but like I said, we are likely not to have it if we delete the second backend.

Lucas De Marchi

Quoted 6 lines

Matt

Quoted 3 lines

Regards,

Tvrtko

author maintainer
#79 lore raw
Quoted 68 lines · Lucas De Marchi
Quoted 62 lines · Matthew Brost
Quoted 42 lines · Tvrtko Ursulin
Quoted 35 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

Quoted 4 lines

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

Quoted 6 lines

What is the plan going forward for the execlists backend? I think it would be preferable to not upstream something semi-functional and so to carry technical debt in the brand new code base, from the very start. If it is for Tigerlake, which is the starting platform for Xe, could it be made GuC only Tigerlake for instance?

A little background here. In the original PoC written by Jason and Dave, the execlist backend was the only one present and it was in semi-working state. As soon as myself and a few others started working on Xe we went full in a on the GuC backend. We left the execlist backend basically in the state it was in. We left it in place for 2 reasons.

1. Having 2 backends from the start ensured we layered our code correctly. The layer was a complete disaster in the i915 so we really wanted to avoid that.
2. The thought was it might be needed for early product bring up one day.

Quoted 4 lines

As I think about this a bit more, we likely just delete execlist backend before merging this upstream and perhaps just carry 1 large patch internally with this implementation that we can use as needed. Final decession TDB though.

Quoted 9 lines

but that might regress after some time on "let's keep 2 backends so we layer the code correctly". Leaving the additional backend behind CONFIG_BROKEN or XE_EXPERIMENTAL, or something like that, not enabled by distros, but enabled in CI would be a good idea IMO.

Carrying a large patch out of tree would make things harder for new platforms. A perfect backend split would make it possible, but like I said, we are likely not to have it if we delete the second backend.

Good points here Lucas. One thing that we absolutely have wrong is falling back to execlists if GuC firmware is missing. We def should not be doing that as it creates confusion.

I kinda like the idea hiding it behind a config option + module parameter to use the backend so you really, really need to try to be able to use it + with this in the code it make us disciplined in our layering. At some point we will likely another supported backend and at that point we may decide to delete this backend.

Matt

Quoted 8 lines

Lucas De Marchi

Quoted 6 lines

Matt

Quoted 3 lines

Regards,

Tvrtko

#80 lore raw
Quoted 107 lines · Matthew Brost
Quoted 7 lines · Lucas De Marchi
Quoted 6 lines · Matthew Brost
Quoted 5 lines · Tvrtko Ursulin
Quoted 3 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that

supports both

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

integrated and discrete platforms starting with Tiger Lake (first

platform with

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Intel Xe Architecture). The intention of this new driver is to

have a fresh base

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to work from that is unencumbered by older platforms, whilst also

taking the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

opportunity to rearchitect our driver to increase sharing across

the drm

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

subsystem, both leveraging and allowing us to contribute more

towards other

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

shared components like TTM and drm/scheduler. The memory model is

based on VM

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bind which is similar to the i915 implementation. Likewise the

execbuf

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has

experimental

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

support for multiple platforms starting from Tiger Lake, with

initial support

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan

drivers), as well

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2]

and NEO

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

implementation will be released publicly early next year. We also

have a suite

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple

architectures from

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the get-go, right now with tests running both on X86 and ARM

hosts. And we

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

intend to continue working on it and improving on it as part of

the kernel

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

community upstream.

The new Xe driver leverages a lot from i915 and work on i915

continues as we

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the

i915 driver so

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that there is maximum reuse there. Currently this is being done by

compiling the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

display code twice, but alternatives to that are under

consideration and we want

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to have more discussion on what the best final solution will look

like over the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

next few months. Right now, work is ongoing in refactoring the

display codebase

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to remove as much as possible any unnecessary dependencies on i915

specific data

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

structures there..

We currently have 2 submission backends, execlists and GuC. The

execlist is

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

meant mostly for testing and is not fully functional while GuC

backend is fully

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

functional. As with the i915 and GuC submission, in Xe the GuC

firmware is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

required and should be placed in /lib/firmware/xe.

What is the plan going forward for the execlists backend? I think it

would

Quoted 1 line
Quoted 1 line
Quoted 1 line

be preferable to not upstream something semi-functional and so to

carry

Quoted 1 line
Quoted 1 line
Quoted 1 line

technical debt in the brand new code base, from the very start. If

it is for

Quoted 1 line
Quoted 1 line
Quoted 1 line

Tigerlake, which is the starting platform for Xe, could it be made

GuC only

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Tigerlake for instance?

A little background here. In the original PoC written by Jason and

Dave,

Quoted 1 line
Quoted 1 line

the execlist backend was the only one present and it was in

semi-working

Quoted 11 lines
Quoted 11 lines

state. As soon as myself and a few others started working on Xe we went full in a on the GuC backend. We left the execlist backend basically in the state it was in. We left it in place for 2 reasons.

1. Having 2 backends from the start ensured we layered our code correctly. The layer was a complete disaster in the i915 so we really wanted to avoid that.
2. The thought was it might be needed for early product bring up one day.

As I think about this a bit more, we likely just delete execlist

backend

Quoted 9 lines
Quoted 3 lines

before merging this upstream and perhaps just carry 1 large patch internally with this implementation that we can use as needed. Final decession TDB though.

but that might regress after some time on "let's keep 2 backends so we layer the code correctly". Leaving the additional backend behind CONFIG_BROKEN or XE_EXPERIMENTAL, or something like that, not enabled by distros, but enabled in CI would be a good idea IMO.

Quoted 9 lines
Quoted 4 lines

Carrying a large patch out of tree would make things harder for new platforms. A perfect backend split would make it possible, but like I said, we are likely not to have it if we delete the second backend.

Good points here Lucas. One thing that we absolutely have wrong is falling back to execlists if GuC firmware is missing. We def should not be doing that as it creates confusion.

Yeah, we certainly shouldn't be falling back on it silently. That's a recipe for disaster. If it stays, it should be behind a config option that's clearly labeled as broken or not intended for production use. If someone is a zero-firmware purist and wants to enable it and accept the brokenness, that's their choice.

I'm not especially attached to the execlist back-end so I'm not going to insist on anything here RE keeping it.

There is more to me starting with execlists than avoiding GuC, though. One of the reasons I did it was to prove that the same core Xe scheduling model
[3] doesn't depend on firmware. As long as your hardware has some ability to juggle independent per-context rings, you can get the same separation and it makes everything cleaner. If this is the direction things are headed (and I really think it is; I need to blog about it), being able to do the Xe model on more primitive hardware which lacks competent firmware-based submission is important. I wanted to prototype that to show that it could be done.

I also kinda wanted to prove that execlists didn't have to be horrible like in i915. You know, for funzies....

--Jason

[3]:
https://lists.freedesktop.org/archives/dri-devel/2023-January/386381.html

Quoted 17 lines

I kinda like the idea hiding it behind a config option + module parameter to use the backend so you really, really need to try to be able to use it + with this in the code it make us disciplined in our layering. At some point we will likely another supported backend and at that point we may decide to delete this backend.

Matt

Quoted 8 lines

Lucas De Marchi

Quoted 6 lines

Matt

Quoted 3 lines

Regards,

Tvrtko

#81 lore raw
In reply to Matthew Brost

+Frank, who's also working on the pvr uAPI.

Hi,

Quoted 11 lines · On Thu, 22 Dec 2022 14:21:07 -0800 Matthew Brost <[email protected]>…

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

Sorry to hijack this thread, again, but I'm currently working on the pancsf uAPI, and I was wondering how DRM maintainers/developers felt about the new direction taken by the Xe driver on some aspects of their uAPI (to decide if I should copy these patterns or go the old way):

- plan for ioctl extensions through '__u64 extensions;' fields (the vulkan way, basically)
- turning the GETPARAM in DEV_QUERY which can return more than a 64-bit integer at a time
- having ioctls taking sub-operations instead of one ioctl per operation (I'm referring to VM_BIND here, which handles map, unmap, restart, ... through a single entry point)

Regards,

Boris

#82 lore raw
In reply to Matthew Brost
Quoted 71 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with
Intel Xe Architecture). The intention of this new driver is to have a fresh base
to work from that is unencumbered by older platforms, whilst also taking the
opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM
bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support
implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well
as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite
of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from
the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we
ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so
that there is maximum reuse there. Currently this is being done by compiling the
display code twice, but alternatives to that are under consideration and we want
to have more discussion on what the best final solution will look like over the
next few months. Right now, work is ongoing in refactoring the display codebase
to remove as much as possible any unnecessary dependencies on i915 specific data
structures there..

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully
functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate
commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in
a public repo listed below.

Quoted 3 lines

Xe driver commit:

https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Drive-by comment here because I don't see any actual xe patches on the list:

You probably want to drop DRM_XE_SYNC_DMA_BUF from the uAPI. Now that we've landed the new dma-buf ioctls for sync_file import/export, there's really no reason to have it as part of submit. Dropping it should also make locking a tiny bit easier.

--Jason

Quoted 149 lines

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and
wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

 drivers/gpu/drm/Kconfig                       |   5 +
 drivers/gpu/drm/Makefile                      |   4 +
 drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
 drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
 drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
 drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
 drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
 .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
 drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
 drivers/gpu/drm/i915/display/intel_color.c    |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
 drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
 drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
 drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../gpu/drm/i915/display/intel_display_core.h |   5 +-
 .../drm/i915/display/intel_display_debugfs.c  |   8 +
 .../drm/i915/display/intel_display_power.c    |  40 ++-
 .../drm/i915/display/intel_display_power.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   7 +
 .../i915/display/intel_display_power_well.c   |  24 +-
 .../drm/i915/display/intel_display_reg_defs.h |   4 +
 .../drm/i915/display/intel_display_trace.h    |   6 +
 .../drm/i915/display/intel_display_types.h    |  32 +-
 drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
 drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
 drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
 drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
 drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
 drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
 drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
 drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
 .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
 .../drm/i915/display/intel_modeset_setup.c    |  11 +-
 drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
 .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
 .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
 drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
 .../drm/i915/display/intel_plane_initial.c    |   3 +-
 drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
 drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
 drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
 drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
 .../drm/i915/display/skl_universal_plane.c    |  52 ++-
 drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/i915/i915_gem.c               |   8 -
 drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
 drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
 drivers/gpu/drm/i915/i915_vma.c               |  12 -
 drivers/gpu/drm/radeon/radeon.h               |  55 +--
 drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
 drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
 drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
 drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
 drivers/misc/mei/hdcp/Kconfig                 |   2 +-
 drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
 include/drm/drm_pt_walk.h                     | 161 +++++++++
 include/drm/drm_suballoc.h                    | 112 ++++++
 include/drm/gpu_scheduler.h                   |  41 ++-
 sound/hda/hdac_i915.c                         |  17 +-
 sound/pci/hda/hda_intel.c                     |  56 +--
 sound/soc/intel/avs/core.c                    |  13 +-
 sound/soc/sof/intel/hda.c                     |   7 +-
 98 files changed, 2076 insertions(+), 1325 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_pt_walk.h
 create mode 100644 include/drm/drm_suballoc.h

--
2.37.3

#83 lore raw
In reply to Matthew Brost

Hi all,

[I thought I've sent this out earlier this week, but alas got stuck, kinda bad timing now since I'm out next week but oh well]

So xe is a quite substantial thing, and I think we need a clear plan how to land this or it will take forever, and managers will panic. Also I'm not a big fan of "Dave/me reviews everything", we defacto had that for amd's dc/dal and it was not fun. The idea here is how to get everything reviewed without having two people end up somewhat arbitrary as deciders.

I've compiled a bunch of topics on what I think the important areas are, first code that should be consistent about new-style render drivers that are aimed for vk/compute userspace as the primary feature driver:

- figure out consensus solution for fw scheduler and drm/sched frontend among interested driver parties (probably xe, amdgpu, nouveau, new panfrost)

- for the interface itself it might be good to have the drm_gpu_scheduler as the single per-hw-engine driver api object (but internally a new structure), while renaming the current drm_gpu_scheduler to drm_gpu_sched_internal. That way I think we can address the main critique of the current xe scheduler plan
- keep the drm_gpu_sched_internal : drm_sched_entity 1:1 relationship for fw scheduler
- keep the driver api relationship of drm_gpu_scheduler : drm_sched_entity 1:n, the api functions simply iterate over a mutex protect list of internal schedulers. this should also help drivers with locking mistakes around setup/teardown and gpu reset.
- drivers select with a flag or something between the current mode (where the drm_gpu_sched_internal is attached to the drm_gpu_scheduler api object) or the new fw scheduler mode (where drm_gpu_sched_internal is attached to the drm_sched_entity)
- overall still no fundamental changes (like the current patches) to drm/sched data structures and algorithms. But unlike the current patches we keep the possibility open for eventual refactoring without having to again refactor all the drivers. Even better, we can delay such refactoring until we have a handful of real-word drivers test-driving this all so we know we actually do the right thing. This should allow us to address all the fairness/efficiency/whatever concerns that have been floating around without having to fix them all up upfront, before we actually know what needs to be fixed.

- the generic scheduler code should also including the handling of endless compute contexts, with the minimal scaffolding for preempt-ctx fences (probably on the drm_sched_entity) and making sure drm/sched can cope with the lack of job completion fence. This is very minimal amounts of code, but it helps a lot for cross-driver review if this works the same (with the same locking and all that) for everyone. Ideally this gets extracted from amdkfd, but as long as it's going to be used by all drivers supporting endless/compute context going forward it's good enough.

- I'm assuming this also means Matt Brost will include a patch to add himself as drm/sched reviewer in MAINTAINERS, or at least something like that

- adopt the gem_exec/vma helpers. again we probably want consensus here among the same driver projects. I don't care whether these helpers specify the ioctl structs or not, but they absolutely need to enforce the overall locking scheme for all major structs and list (so vm and vma).

- we also should have cross-driver consensus on async vm_bind support. I think everyone added in-syncobj support, the real fun is probably more in/out userspace memory fences (and personally I'm still not sure that's a good idea but ... *eh*). I think cross driver consensus on how this should work (ideally with helper support so people don't get it wrong in all the possible ways) would be best.

- this also means some userptr integration and some consensus how userptr should work for vm_bind across drivers. I don't think allowing drivers to reinvent that wheel is a bright idea, there's just a bit too much to get wrong here.

- for some of these the consensus might land on more/less shared code than what I sketched out above, the important part really is that we have consensus on these. Kinda similar to how the atomic kms infrastructure move a _lot_ more of the code back into drivers, because they really just needed the flexibility to program the hw correctly. Right now we definitely don't have enough shared code, for sure with i915-gem, but we also need to make sure we're not overcorrecting too badly (a bit of overcorrecting generally doesn't hurt).

All the above will make sure that the driver overall is in concepts and design aligned with the overall community direction, but I think it'd still be good if someone outside of the intel gpu group reviews the driver code itself. Last time we had a huge driver submission (amd's DC/DAL) this fell on Dave&me, but this time around I think we have a perfect candidate with Oded:

- Oded needs/wants to spend some time on ramping up on how drm render drivers work anyway, and xe is probably the best example of a driver that's both supposed to be full-featured, but also doesn't contain an entire display driver on the side.

- Oded is in Habana, which is legally part of Intel. Bean counter budget shuffling to make this happen should be possible.

- Habana is still fairly distinct entity within Intel, so that is probably the best approach for some independent review, without making the xe team beholden to some non-Intel people.

The above should yield some pretty clear road towards landing xe, without any big review fights with Dave/me like we had with amd's DC/DAL, which took a rather long time to land unfortunately :-(

These are just my thoughts, let the bikeshed commence!

Ideally we put them all into a TODO like we've done for DC/DAL, once we have some consensus.

Cheers, Daniel

Quoted 202 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

 drivers/gpu/drm/Kconfig                       |   5 +
 drivers/gpu/drm/Makefile                      |   4 +
 drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
 drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
 drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
 drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
 drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
 .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
 drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
 drivers/gpu/drm/i915/display/intel_color.c    |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
 drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
 drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
 drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../gpu/drm/i915/display/intel_display_core.h |   5 +-
 .../drm/i915/display/intel_display_debugfs.c  |   8 +
 .../drm/i915/display/intel_display_power.c    |  40 ++-
 .../drm/i915/display/intel_display_power.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   7 +
 .../i915/display/intel_display_power_well.c   |  24 +-
 .../drm/i915/display/intel_display_reg_defs.h |   4 +
 .../drm/i915/display/intel_display_trace.h    |   6 +
 .../drm/i915/display/intel_display_types.h    |  32 +-
 drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
 drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
 drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
 drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
 drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
 drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
 drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
 drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
 .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
 .../drm/i915/display/intel_modeset_setup.c    |  11 +-
 drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
 .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
 .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
 drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
 .../drm/i915/display/intel_plane_initial.c    |   3 +-
 drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
 drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
 drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
 drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
 .../drm/i915/display/skl_universal_plane.c    |  52 ++-
 drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/i915/i915_gem.c               |   8 -
 drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
 drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
 drivers/gpu/drm/i915/i915_vma.c               |  12 -
 drivers/gpu/drm/radeon/radeon.h               |  55 +--
 drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
 drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
 drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
 drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
 drivers/misc/mei/hdcp/Kconfig                 |   2 +-
 drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
 include/drm/drm_pt_walk.h                     | 161 +++++++++
 include/drm/drm_suballoc.h                    | 112 ++++++
 include/drm/gpu_scheduler.h                   |  41 ++-
 sound/hda/hdac_i915.c                         |  17 +-
 sound/pci/hda/hda_intel.c                     |  56 +--
 sound/soc/intel/avs/core.c                    |  13 +-
 sound/soc/sof/intel/hda.c                     |   7 +-
 98 files changed, 2076 insertions(+), 1325 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_pt_walk.h
 create mode 100644 include/drm/drm_suballoc.h
Signature · 1 line
2.37.3
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#84 lore raw
Quoted 90 lines · Daniel Vetter

Hi all,

[I thought I've sent this out earlier this week, but alas got stuck, kinda bad timing now since I'm out next week but oh well]

So xe is a quite substantial thing, and I think we need a clear plan how to land this or it will take forever, and managers will panic. Also I'm not a big fan of "Dave/me reviews everything", we defacto had that for amd's dc/dal and it was not fun. The idea here is how to get everything reviewed without having two people end up somewhat arbitrary as deciders.

I've compiled a bunch of topics on what I think the important areas are, first code that should be consistent about new-style render drivers that are aimed for vk/compute userspace as the primary feature driver:

- figure out consensus solution for fw scheduler and drm/sched frontend among interested driver parties (probably xe, amdgpu, nouveau, new panfrost)

- for the interface itself it might be good to have the drm_gpu_scheduler as the single per-hw-engine driver api object (but internally a new structure), while renaming the current drm_gpu_scheduler to drm_gpu_sched_internal. That way I think we can address the main critique of the current xe scheduler plan
- keep the drm_gpu_sched_internal : drm_sched_entity 1:1 relationship for fw scheduler
- keep the driver api relationship of drm_gpu_scheduler : drm_sched_entity 1:n, the api functions simply iterate over a mutex protect list of internal schedulers. this should also help drivers with locking mistakes around setup/teardown and gpu reset.
- drivers select with a flag or something between the current mode (where the drm_gpu_sched_internal is attached to the drm_gpu_scheduler api object) or the new fw scheduler mode (where drm_gpu_sched_internal is attached to the drm_sched_entity)
- overall still no fundamental changes (like the current patches) to drm/sched data structures and algorithms. But unlike the current patches we keep the possibility open for eventual refactoring without having to again refactor all the drivers. Even better, we can delay such refactoring until we have a handful of real-word drivers test-driving this all so we know we actually do the right thing. This should allow us to address all the fairness/efficiency/whatever concerns that have been floating around without having to fix them all up upfront, before we actually know what needs to be fixed.

- the generic scheduler code should also including the handling of endless compute contexts, with the minimal scaffolding for preempt-ctx fences (probably on the drm_sched_entity) and making sure drm/sched can cope with the lack of job completion fence. This is very minimal amounts of code, but it helps a lot for cross-driver review if this works the same (with the same locking and all that) for everyone. Ideally this gets extracted from amdkfd, but as long as it's going to be used by all drivers supporting endless/compute context going forward it's good enough.

- I'm assuming this also means Matt Brost will include a patch to add himself as drm/sched reviewer in MAINTAINERS, or at least something like that

- adopt the gem_exec/vma helpers. again we probably want consensus here among the same driver projects. I don't care whether these helpers specify the ioctl structs or not, but they absolutely need to enforce the overall locking scheme for all major structs and list (so vm and vma).

- we also should have cross-driver consensus on async vm_bind support. I think everyone added in-syncobj support, the real fun is probably more in/out userspace memory fences (and personally I'm still not sure that's a good idea but ... *eh*). I think cross driver consensus on how this should work (ideally with helper support so people don't get it wrong in all the possible ways) would be best.

- this also means some userptr integration and some consensus how userptr should work for vm_bind across drivers. I don't think allowing drivers to reinvent that wheel is a bright idea, there's just a bit too much to get wrong here.

- for some of these the consensus might land on more/less shared code than what I sketched out above, the important part really is that we have consensus on these. Kinda similar to how the atomic kms infrastructure move a _lot_ more of the code back into drivers, because they really just needed the flexibility to program the hw correctly. Right now we definitely don't have enough shared code, for sure with i915-gem, but we also need to make sure we're not overcorrecting too badly (a bit of overcorrecting generally doesn't hurt).

All the above will make sure that the driver overall is in concepts and design aligned with the overall community direction, but I think it'd still be good if someone outside of the intel gpu group reviews the driver code itself. Last time we had a huge driver submission (amd's DC/DAL) this fell on Dave&me, but this time around I think we have a perfect candidate with Oded:

- Oded needs/wants to spend some time on ramping up on how drm render drivers work anyway, and xe is probably the best example of a driver that's both supposed to be full-featured, but also doesn't contain an entire display driver on the side.

Quoted 6 lines

- Oded is in Habana, which is legally part of Intel. Bean counter budget shuffling to make this happen should be possible.

- Habana is still fairly distinct entity within Intel, so that is probably the best approach for some independent review, without making the xe team beholden to some non-Intel people.

Hi Daniel,
Thanks for suggesting it, I'll gladly do it.
I guess I'll have more feedback on the plan itself after I'll start going over the current Xe driver code.

Oded

Quoted 220 lines

The above should yield some pretty clear road towards landing xe, without any big review fights with Dave/me like we had with amd's DC/DAL, which took a rather long time to land unfortunately :-(

These are just my thoughts, let the bikeshed commence!

Ideally we put them all into a TODO like we've done for DC/DAL, once we have some consensus.

Cheers, Daniel

Quoted 199 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

 drivers/gpu/drm/Kconfig                       |   5 +
 drivers/gpu/drm/Makefile                      |   4 +
 drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
 drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
 drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
 drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
 drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
 .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
 drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
 drivers/gpu/drm/i915/display/intel_color.c    |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
 drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
 drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
 drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../gpu/drm/i915/display/intel_display_core.h |   5 +-
 .../drm/i915/display/intel_display_debugfs.c  |   8 +
 .../drm/i915/display/intel_display_power.c    |  40 ++-
 .../drm/i915/display/intel_display_power.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   7 +
 .../i915/display/intel_display_power_well.c   |  24 +-
 .../drm/i915/display/intel_display_reg_defs.h |   4 +
 .../drm/i915/display/intel_display_trace.h    |   6 +
 .../drm/i915/display/intel_display_types.h    |  32 +-
 drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
 drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
 drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
 drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
 drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
 drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
 drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
 drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
 .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
 .../drm/i915/display/intel_modeset_setup.c    |  11 +-
 drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
 .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
 .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
 drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
 .../drm/i915/display/intel_plane_initial.c    |   3 +-
 drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
 drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
 drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
 drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
 .../drm/i915/display/skl_universal_plane.c    |  52 ++-
 drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/i915/i915_gem.c               |   8 -
 drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
 drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
 drivers/gpu/drm/i915/i915_vma.c               |  12 -
 drivers/gpu/drm/radeon/radeon.h               |  55 +--
 drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
 drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
 drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
 drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
 drivers/misc/mei/hdcp/Kconfig                 |   2 +-
 drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
 include/drm/drm_pt_walk.h                     | 161 +++++++++
 include/drm/drm_suballoc.h                    | 112 ++++++
 include/drm/gpu_scheduler.h                   |  41 ++-
 sound/hda/hdac_i915.c                         |  17 +-
 sound/pci/hda/hda_intel.c                     |  56 +--
 sound/soc/intel/avs/core.c                    |  13 +-
 sound/soc/sof/intel/hda.c                     |   7 +-
 98 files changed, 2076 insertions(+), 1325 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_pt_walk.h
 create mode 100644 include/drm/drm_suballoc.h
Quoted 3 lines

--
2.37.3

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

maintainer
#85 lore raw
In reply to Daniel Vetter
Quoted 10 lines · Daniel Vetter

Hi all,

[I thought I've sent this out earlier this week, but alas got stuck, kinda bad timing now since I'm out next week but oh well]

So xe is a quite substantial thing, and I think we need a clear plan how to land this or it will take forever, and managers will panic. Also I'm not a big fan of "Dave/me reviews everything", we defacto had that for amd's dc/dal and it was not fun. The idea here is how to get everything reviewed without having two people end up somewhat arbitrary as deciders.

Thank you so much for taking time to write it down. We need to get alignment on the critical topics to see how we can move this forward.

Quoted 7 lines

I've compiled a bunch of topics on what I think the important areas are, first code that should be consistent about new-style render drivers that are aimed for vk/compute userspace as the primary feature driver:

- figure out consensus solution for fw scheduler and drm/sched frontend among interested driver parties (probably xe, amdgpu, nouveau, new panfrost)

Yeap. We do need to figure this out. But just to ensure that we are in the same page here. What I had in mind was that Matt would upstream the 5 or 6 drm_sched related patches that we have underneath Xe patches on drm-misc with addressing the community feedback, then we would merge Xe with the current schedule solution (or modifications based on the modifications of these mentioned patches) and then we would continue to work with the other drivers to improve the drm sched frontend while we are already in tree. Possible? or do you want to see fundamental changes before we can even consider to get in? Like the ones below?

Quoted 16 lines

- for the interface itself it might be good to have the drm_gpu_scheduler as the single per-hw-engine driver api object (but internally a new structure), while renaming the current drm_gpu_scheduler to drm_gpu_sched_internal. That way I think we can address the main critique of the current xe scheduler plan
- keep the drm_gpu_sched_internal : drm_sched_entity 1:1 relationship for fw scheduler
- keep the driver api relationship of drm_gpu_scheduler : drm_sched_entity 1:n, the api functions simply iterate over a mutex protect list of internal schedulers. this should also help drivers with locking mistakes around setup/teardown and gpu reset.
- drivers select with a flag or something between the current mode (where the drm_gpu_sched_internal is attached to the drm_gpu_scheduler api object) or the new fw scheduler mode (where drm_gpu_sched_internal is attached to the drm_sched_entity)
- overall still no fundamental changes (like the current patches) to drm/sched

Quoted 8 lines

data structures and algorithms. But unlike the current patches we keep the possibility open for eventual refactoring without having to again refactor all the drivers. Even better, we can delay such refactoring until we have a handful of real-word drivers test-driving this all so we know we actually do the right thing. This should allow us to address all the fairness/efficiency/whatever concerns that have been floating around without having to fix them all up upfront, before we actually know what needs to be fixed.

do you believe this has to be decided and moved towards one of this before we get merged?

Quoted 9 lines

- the generic scheduler code should also including the handling of endless compute contexts, with the minimal scaffolding for preempt-ctx fences (probably on the drm_sched_entity) and making sure drm/sched can cope with the lack of job completion fence. This is very minimal amounts of code, but it helps a lot for cross-driver review if this works the same (with the same locking and all that) for everyone. Ideally this gets extracted from amdkfd, but as long as it's going to be used by all drivers supporting endless/compute context going forward it's good enough.

On this one I'm a bit clueless to be honest. I thought the biggest problem with the long running context or even endless were due to the hangcheck premption or migrations that would end in some pagefaults.
But yeap, it looks that there are opens to get these kind of workloads properly supported. But with this in mind do you see any real blocker on Xe? or any must-have thing?

Quoted 3 lines

- I'm assuming this also means Matt Brost will include a patch to add himself as drm/sched reviewer in MAINTAINERS, or at least something like that

+1 on this idea!
This enforces our engagement and commitment with the drm_sched imho.

Quoted 5 lines

- adopt the gem_exec/vma helpers. again we probably want consensus here among the same driver projects. I don't care whether these helpers specify the ioctl structs or not, but they absolutely need to enforce the overall locking scheme for all major structs and list (so vm and vma).

On this front I thought we would need to align on a common drm_vm_bind based on the common parts of xe vm_bind and nouveau one. And also some engagement that I thought it would be easier after we are integrated and part of the drm-next. Do we need to do this earlier? Could you please open it a bit more on what exactly you want to see before we can be considered to get merged or after?

Quoted 7 lines

- we also should have cross-driver consensus on async vm_bind support. I think everyone added in-syncobj support, the real fun is probably more in/out userspace memory fences (and personally I'm still not sure that's a good idea but ... *eh*). I think cross driver consensus on how this should work (ideally with helper support so people don't get it wrong in all the possible ways) would be best.

Should the consensus API come first? should this block the nouveau implementation and move us all towards the drm_vm_bind? or can we sync in-tree?

Quoted 4 lines

- this also means some userptr integration and some consensus how userptr should work for vm_bind across drivers. I don't think allowing drivers to reinvent that wheel is a bright idea, there's just a bit too much to get wrong here.

ack. but kind of same question. is it a blocker to align before? or easier to align in tree?

Quoted 8 lines

- for some of these the consensus might land on more/less shared code than what I sketched out above, the important part really is that we have consensus on these. Kinda similar to how the atomic kms infrastructure move a _lot_ more of the code back into drivers, because they really just needed the flexibility to program the hw correctly. Right now we definitely don't have enough shared code, for sure with i915-gem, but we also need to make sure we're not overcorrecting too badly (a bit of overcorrecting generally doesn't hurt).

+1 on this. We need to work more in the drm layers like display has done successfully!

Quoted 12 lines

All the above will make sure that the driver overall is in concepts and design aligned with the overall community direction, but I think it'd still be good if someone outside of the intel gpu group reviews the driver code itself. Last time we had a huge driver submission (amd's DC/DAL) this fell on Dave&me, but this time around I think we have a perfect candidate with Oded:

- Oded needs/wants to spend some time on ramping up on how drm render drivers work anyway, and xe is probably the best example of a driver that's both supposed to be full-featured, but also doesn't contain an entire display driver on the side.

Quoted 6 lines

- Oded is in Habana, which is legally part of Intel. Bean counter budget shuffling to make this happen should be possible.

- Habana is still fairly distinct entity within Intel, so that is probably the best approach for some independent review, without making the xe team beholden to some non-Intel people.

+1 on this entire idea here as well.

Quoted 4 lines

The above should yield some pretty clear road towards landing xe, without any big review fights with Dave/me like we had with amd's DC/DAL, which took a rather long time to land unfortunately :-(

As I wrote already, I really agree with you that we should work more with the drm and more with the other drivers. But for the logistics of the work and the rebase pains and to avoid a situation where we have a totally divergent driver, I believe the fastest way is to solve any blockers and big issues before, then merge, then work towards more collaboration on the next step.

Specially when with Xe we are not planning to remove the force_probe flag for a while, what puts us in a "staging" situation. We could even make use of the CONFIG_STAGING if needed.

Thoughts?
And most than that, any already know big blockers?

Quoted 2 lines

These are just my thoughts, let the bikeshed commence!

:)

Quoted 3 lines

Ideally we put them all into a TODO like we've done for DC/DAL, once we have some consensus.

I like the TODO list idea.
And also we need to use more the RFC doc section as well, like i915-vmbind used.

On the TODO part, where do you recommend to add in the doc?

Again, thank you so much,
Rodrigo.

Quoted 211 lines

Cheers, Daniel

Quoted 202 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

 drivers/gpu/drm/Kconfig                       |   5 +
 drivers/gpu/drm/Makefile                      |   4 +
 drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
 drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
 drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
 drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
 drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
 .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
 drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
 drivers/gpu/drm/i915/display/intel_color.c    |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
 drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
 drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
 drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../gpu/drm/i915/display/intel_display_core.h |   5 +-
 .../drm/i915/display/intel_display_debugfs.c  |   8 +
 .../drm/i915/display/intel_display_power.c    |  40 ++-
 .../drm/i915/display/intel_display_power.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   7 +
 .../i915/display/intel_display_power_well.c   |  24 +-
 .../drm/i915/display/intel_display_reg_defs.h |   4 +
 .../drm/i915/display/intel_display_trace.h    |   6 +
 .../drm/i915/display/intel_display_types.h    |  32 +-
 drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
 drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
 drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
 drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
 drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
 drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
 drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
 drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
 .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
 .../drm/i915/display/intel_modeset_setup.c    |  11 +-
 drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
 .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
 .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
 drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
 .../drm/i915/display/intel_plane_initial.c    |   3 +-
 drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
 drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
 drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
 drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
 .../drm/i915/display/skl_universal_plane.c    |  52 ++-
 drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/i915/i915_gem.c               |   8 -
 drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
 drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
 drivers/gpu/drm/i915/i915_vma.c               |  12 -
 drivers/gpu/drm/radeon/radeon.h               |  55 +--
 drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
 drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
 drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
 drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
 drivers/misc/mei/hdcp/Kconfig                 |   2 +-
 drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
 include/drm/drm_pt_walk.h                     | 161 +++++++++
 include/drm/drm_suballoc.h                    | 112 ++++++
 include/drm/gpu_scheduler.h                   |  41 ++-
 sound/hda/hdac_i915.c                         |  17 +-
 sound/pci/hda/hda_intel.c                     |  56 +--
 sound/soc/intel/avs/core.c                    |  13 +-
 sound/soc/sof/intel/hda.c                     |   7 +-
 98 files changed, 2076 insertions(+), 1325 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_pt_walk.h
 create mode 100644 include/drm/drm_suballoc.h
Signature · 1 line
2.37.3
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#86 lore raw
Quoted 6 lines · Rodrigo Vivi
Quoted 5 lines · Daniel Vetter

Hi all,

[I thought I've sent this out earlier this week, but alas got stuck, kinda bad timing now since I'm out next week but oh well]

Quoted 8 lines
Quoted 5 lines

So xe is a quite substantial thing, and I think we need a clear plan how to land this or it will take forever, and managers will panic. Also I'm not a big fan of "Dave/me reviews everything", we defacto had that for amd's dc/dal and it was not fun. The idea here is how to get everything reviewed without having two people end up somewhat arbitrary as deciders.

Thank you so much for taking time to write it down. We need to get alignment on the critical topics to see how we can move this forward.

Sorry for the delay on my side, last week was carneval and this week big team meeting.

Quoted 7 lines
Quoted 6 lines

I've compiled a bunch of topics on what I think the important areas are, first code that should be consistent about new-style render drivers that are aimed for vk/compute userspace as the primary feature driver:

- figure out consensus solution for fw scheduler and drm/sched frontend among interested driver parties (probably xe, amdgpu, nouveau, new panfrost)

Quoted 8 lines

Yeap. We do need to figure this out. But just to ensure that we are in the same page here. What I had in mind was that Matt would upstream the 5 or 6 drm_sched related patches that we have underneath Xe patches on drm-misc with addressing the community feedback, then we would merge Xe with the current schedule solution (or modifications based on the modifications of these mentioned patches) and then we would continue to work with the other drivers to improve the drm sched frontend while we are already in tree. Possible? or do you want to see fundamental changes before we can even consider to get in? Like the ones below?

The trouble with that is that then you'll have a lot more driver changes and big renames in drivers after they landed. Which might be too painful, and why I suggested the below minimal-most driver-api wrapping to decouple that. My worry is that if you don't do that, then the driver merging will be bogged down in endless discussions about what the refactoring should look like exactly (the discussions here and elsewhere kinda gave a preview), and it'll make driver merging actually slower. Hence my suggestion to just decouple things enough so that people agree to merge now and refactor later as the reasonable thing.

Now if there would be consensus that this here is already perfect and nothing more needed for fw scheduling, then I think just going ahead with that would be perfectly fine, but I'm kinda not seeing that.

Given that there is so much discussion here I don't want to step in with an arbitrary maintainer verdict, that's largely the approach we've done with amd's dal and I don't think it was the best way forward really.

Quoted 24 lines
Quoted 15 lines

- for the interface itself it might be good to have the drm_gpu_scheduler as the single per-hw-engine driver api object (but internally a new structure), while renaming the current drm_gpu_scheduler to drm_gpu_sched_internal. That way I think we can address the main critique of the current xe scheduler plan
- keep the drm_gpu_sched_internal : drm_sched_entity 1:1 relationship for fw scheduler
- keep the driver api relationship of drm_gpu_scheduler : drm_sched_entity 1:n, the api functions simply iterate over a mutex protect list of internal schedulers. this should also help drivers with locking mistakes around setup/teardown and gpu reset.
- drivers select with a flag or something between the current mode (where the drm_gpu_sched_internal is attached to the drm_gpu_scheduler api object) or the new fw scheduler mode (where drm_gpu_sched_internal is attached to the drm_sched_entity)
- overall still no fundamental changes (like the current patches) to drm/sched

Quoted 8 lines

data structures and algorithms. But unlike the current patches we keep the possibility open for eventual refactoring without having to again refactor all the drivers. Even better, we can delay such refactoring until we have a handful of real-word drivers test-driving this all so we know we actually do the right thing. This should allow us to address all the fairness/efficiency/whatever concerns that have been floating around without having to fix them all up upfront, before we actually know what needs to be fixed.

Quoted 2 lines

do you believe this has to be decided and moved towards one of this before we get merged?

I think either clear consensus by stakeholders that refactoring afterwards is the right thing, or something like the above to decouple fw scheduling drivers from drm/sched is I think needed. And my gut feeling is that the 2nd option is a much faster and less risky path to xe, but if you want to do the big dri-devel arguing championship, you can do that too :-)

Quoted 9 lines
Quoted 8 lines

- the generic scheduler code should also including the handling of endless compute contexts, with the minimal scaffolding for preempt-ctx fences (probably on the drm_sched_entity) and making sure drm/sched can cope with the lack of job completion fence. This is very minimal amounts of code, but it helps a lot for cross-driver review if this works the same (with the same locking and all that) for everyone. Ideally this gets extracted from amdkfd, but as long as it's going to be used by all drivers supporting endless/compute context going forward it's good enough.

Quoted 6 lines

On this one I'm a bit clueless to be honest. I thought the biggest problem with the long running context or even endless were due to the hangcheck premption or migrations that would end in some pagefaults.
But yeap, it looks that there are opens to get these kind of workloads properly supported. But with this in mind do you see any real blocker on Xe? or any must-have thing?

Yeah hangcheck is the architectural issue, this here is just my suggestion for how to solve it technically in code in a consistent way across drivers. From a subsystem maintainer pov the important stuff is really that drivers share key concepts as much as possible, and I think this is one such key concept. E.g. for amd's dal we didn't ask them to rewrite the entire thing to our taste, but to properly integrate key drm display concepts and structs directly into their driver so that when you want to look for all crtc related code across all drivers you just have to chase drm_crtc, and not figure out what a crtc is in each driver (e.g. in i915 display speak crtc = pipe).

Same here, just minimal data structure and scaffolding for long-running context and preempt ctx fences would be really good I think.

Quoted 12 lines
Quoted 2 lines

- I'm assuming this also means Matt Brost will include a patch to add himself as drm/sched reviewer in MAINTAINERS, or at least something like that

+1 on this idea!
This enforces our engagement and commitment with the drm_sched imho.

Quoted 5 lines

- adopt the gem_exec/vma helpers. again we probably want consensus here among the same driver projects. I don't care whether these helpers specify the ioctl structs or not, but they absolutely need to enforce the overall locking scheme for all major structs and list (so vm and vma).

Quoted 5 lines

On this front I thought we would need to align on a common drm_vm_bind based on the common parts of xe vm_bind and nouveau one. And also some engagement that I thought it would be easier after we are integrated and part of the drm-next. Do we need to do this earlier? Could you please open it a bit more on what exactly you want to see before we can be considered to get merged or after?

Again, I don't really want to do the maintainer verdict here and just dictate, I think much better if these discussions are done directly among the involved people. I do generally think that the refactoring should happen upfront for xe, simply due to past track record. Which yes sucks a bit and is a special requirement, but I think a bit a stricter barrier but a really clear one is much better for everyone than some very, very handwaving "enough to make Dave&me happy" super vague thing that will guarantee heated arguments like we've had plenty with amd's dal.

Quoted 9 lines
Quoted 6 lines

- we also should have cross-driver consensus on async vm_bind support. I think everyone added in-syncobj support, the real fun is probably more in/out userspace memory fences (and personally I'm still not sure that's a good idea but ... *eh*). I think cross driver consensus on how this should work (ideally with helper support so people don't get it wrong in all the possible ways) would be best.

Should the consensus API come first? should this block the nouveau implementation and move us all towards the drm_vm_bind? or can we sync in-tree?

Same as above.

Since async isn't a requirement (it's optional for both vk and I guess also for compute since current compute still works on i915-gem, which doesn't have this?) this shouldn't block merging the xe driver. So I think it's not too horrendous to make this a blocker. Of course if the vulkan folks disagree then maybe do some other merge order (and record all that with appropriate amounts of acks).

Quoted 6 lines
Quoted 3 lines

- this also means some userptr integration and some consensus how userptr should work for vm_bind across drivers. I don't think allowing drivers to reinvent that wheel is a bright idea, there's just a bit too much to get wrong here.

ack. but kind of same question. is it a blocker to align before? or easier to align in tree?

Still same as above, I think best is to make them all as clear per-merge goals so that we avoid endless "is this now good enough" discussions with all the frustration and arbitrary delays this would bring. And yes again I realize this sucks a bit and is a bit special. Kinda the same idea like we've tried doing with the refactoring/feature-landing documents in Documenation/gpu/rfc.rst.

Actually maybe the entire xe merge plan should perhaps become Documentation/gpu/rfc/xe.rst?

Quoted 42 lines
Quoted 7 lines

- for some of these the consensus might land on more/less shared code than what I sketched out above, the important part really is that we have consensus on these. Kinda similar to how the atomic kms infrastructure move a _lot_ more of the code back into drivers, because they really just needed the flexibility to program the hw correctly. Right now we definitely don't have enough shared code, for sure with i915-gem, but we also need to make sure we're not overcorrecting too badly (a bit of overcorrecting generally doesn't hurt).

+1 on this. We need to work more in the drm layers like display has done successfully!

Quoted 12 lines

All the above will make sure that the driver overall is in concepts and design aligned with the overall community direction, but I think it'd still be good if someone outside of the intel gpu group reviews the driver code itself. Last time we had a huge driver submission (amd's DC/DAL) this fell on Dave&me, but this time around I think we have a perfect candidate with Oded:

- Oded needs/wants to spend some time on ramping up on how drm render drivers work anyway, and xe is probably the best example of a driver that's both supposed to be full-featured, but also doesn't contain an entire display driver on the side.

Quoted 6 lines

- Oded is in Habana, which is legally part of Intel. Bean counter budget shuffling to make this happen should be possible.

- Habana is still fairly distinct entity within Intel, so that is probably the best approach for some independent review, without making the xe team beholden to some non-Intel people.

+1 on this entire idea here as well.

Quoted 4 lines

The above should yield some pretty clear road towards landing xe, without any big review fights with Dave/me like we had with amd's DC/DAL, which took a rather long time to land unfortunately :-(

As I wrote already, I really agree with you that we should work more with the drm and more with the other drivers. But for the logistics of the work and the rebase pains and to avoid a situation where we have a totally divergent driver, I believe the fastest way is to solve any blockers and big issues before, then merge, then work towards more collaboration on the next step.

Quoted 3 lines

Specially when with Xe we are not planning to remove the force_probe flag for a while, what puts us in a "staging" situation. We could even make use of the CONFIG_STAGING if needed.

I general, I agree with this.

But also, I've acked a bunch of these plans for intel-gem (like the i915 guc scheduler), and then we had to backtrack those because everyone realize that "refactor in-tree" was actually impossible.

It's definitely a bit "burned too many times on this" reaction, but I'd like to make sure we don't end up in that situation again with the next big pile of intel-gem code.

Quoted 9 lines

Thoughts?
And most than that, any already know big blockers?

Quoted 2 lines

These are just my thoughts, let the bikeshed commence!

:)

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

Ideally we put them all into a TODO like we've done for DC/DAL, once we have some consensus.

I like the TODO list idea.
And also we need to use more the RFC doc section as well, like i915-vmbind used.

On the TODO part, where do you recommend to add in the doc?

See above, I think we have the right place with the rfc section already.

Cheers, Daniel

Quoted 215 lines

Again, thank you so much,
Rodrigo.

Quoted 211 lines

Cheers, Daniel

Quoted 199 lines · Matthew Brost

Hello,

This is a submission for Xe, a new driver for Intel GPUs that supports both integrated and discrete platforms starting with Tiger Lake (first platform with Intel Xe Architecture). The intention of this new driver is to have a fresh base to work from that is unencumbered by older platforms, whilst also taking the opportunity to rearchitect our driver to increase sharing across the drm subsystem, both leveraging and allowing us to contribute more towards other shared components like TTM and drm/scheduler. The memory model is based on VM bind which is similar to the i915 implementation. Likewise the execbuf implementation for Xe is very similar to execbuf3 in the i915 [1].

The code is at a stage where it is already functional and has experimental support for multiple platforms starting from Tiger Lake, with initial support implemented in Mesa (for Iris and Anv, our OpenGL and Vulkan drivers), as well as in NEO (for OpenCL and Level0). A Mesa MR has been posted [2] and NEO implementation will be released publicly early next year. We also have a suite of IGTs for XE that will appear on the IGT list shortly.

It has been built with the assumption of supporting multiple architectures from the get-go, right now with tests running both on X86 and ARM hosts. And we intend to continue working on it and improving on it as part of the kernel community upstream.

The new Xe driver leverages a lot from i915 and work on i915 continues as we ready Xe for production throughout 2023.

As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. Currently this is being done by compiling the display code twice, but alternatives to that are under consideration and we want to have more discussion on what the best final solution will look like over the next few months. Right now, work is ongoing in refactoring the display codebase to remove as much as possible any unnecessary dependencies on i915 specific data structures there..

We currently have 2 submission backends, execlists and GuC. The execlist is meant mostly for testing and is not fully functional while GuC backend is fully functional. As with the i915 and GuC submission, in Xe the GuC firmware is required and should be placed in /lib/firmware/xe.

The GuC firmware can be found in the below location:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The easiest way to setup firmware is:
cp -r /lib/firmware/i915 /lib/firmware/xe

The code has been organized such that we have all patches that touch areas outside of drm/xe first for review, and then the actual new driver in a separate commit. The code which is outside of drm/xe is included in this RFC while drm/xe is not due to the size of the commit. The drm/xe is code is available in a public repo listed below.

Xe driver commit:
https://cgit.freedesktop.org/drm/drm-xe/commit/?h=drm-xe-next&id=9cb016ebbb6a275f57b1cb512b95d5a842391ad7

Xe kernel repo:
https://cgit.freedesktop.org/drm/drm-xe/

There's a lot of work still to happen on Xe but we're very excited about it and wanted to share it early and welcome feedback and discussion.

Cheers,
Matthew Brost

[1] https://patchwork.freedesktop.org/series/105879/
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20418

Maarten Lankhorst (12):
drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation. drm/i915: Remove gem and overlay frontbuffer tracking drm/i915/display: Neuter frontbuffer tracking harder drm/i915/display: Add more macros to remove all direct calls to uncore drm/i915/display: Remove all uncore mmio accesses in favor of intel_de drm/i915: Rename find_section to find_bdb_section drm/i915/regs: Set DISPLAY_MMIO_BASE to 0 for xe drm/i915/display: Fix a use-after-free when intel_edp_init_connector
fails
drm/i915/display: Remaining changes to make xe compile sound/hda: Allow XE as i915 replacement for sound mei/hdcp: Also enable for XE

Matthew Brost (5):
drm/sched: Convert drm scheduler to use a work queue rather than
kthread
drm/sched: Add generic scheduler message interface drm/sched: Start run wq before TDR in drm_sched_start drm/sched: Submit job before starting TDR
drm/sched: Add helper to set TDR timeout

Thomas Hellström (3):
drm/suballoc: Introduce a generic suballocation manager
drm: Add a gpu page-table walker helper
drm/ttm: Don't print error message if eviction was interrupted

 drivers/gpu/drm/Kconfig                       |   5 +
 drivers/gpu/drm/Makefile                      |   4 +
 drivers/gpu/drm/amd/amdgpu/Kconfig            |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 320 +-----------------
 drivers/gpu/drm/drm_pt_walk.c                 | 159 +++++++++
 drivers/gpu/drm/drm_suballoc.c                | 301 ++++++++++++++++
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 drivers/gpu/drm/i915/display/hsw_ips.c        |   7 +-
 drivers/gpu/drm/i915/display/i9xx_plane.c     |   1 +
 drivers/gpu/drm/i915/display/intel_atomic.c   |   2 +
 .../gpu/drm/i915/display/intel_atomic_plane.c |  25 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_bios.c     |  71 ++--
 drivers/gpu/drm/i915/display/intel_bw.c       |  36 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  68 ++--
 drivers/gpu/drm/i915/display/intel_color.c    |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |  14 +-
 drivers/gpu/drm/i915/display/intel_cursor.c   |  14 +-
 drivers/gpu/drm/i915/display/intel_de.h       |  38 +++
 drivers/gpu/drm/i915/display/intel_display.c  | 155 +++++++--
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../gpu/drm/i915/display/intel_display_core.h |   5 +-
 .../drm/i915/display/intel_display_debugfs.c  |   8 +
 .../drm/i915/display/intel_display_power.c    |  40 ++-
 .../drm/i915/display/intel_display_power.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   7 +
 .../i915/display/intel_display_power_well.c   |  24 +-
 .../drm/i915/display/intel_display_reg_defs.h |   4 +
 .../drm/i915/display/intel_display_trace.h    |   6 +
 .../drm/i915/display/intel_display_types.h    |  32 +-
 drivers/gpu/drm/i915/display/intel_dmc.c      |  17 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  11 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |   6 +
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |   9 +-
 drivers/gpu/drm/i915/display/intel_dpio_phy.h |  15 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   8 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   4 +
 drivers/gpu/drm/i915/display/intel_drrs.c     |   1 +
 drivers/gpu/drm/i915/display/intel_dsb.c      | 124 +++++--
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c  |  26 +-
 drivers/gpu/drm/i915/display/intel_fb.c       | 108 ++++--
 drivers/gpu/drm/i915/display/intel_fb_pin.c   |   6 -
 drivers/gpu/drm/i915/display/intel_fbc.c      |  49 ++-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 108 +++++-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 103 +-----
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  67 +---
 drivers/gpu/drm/i915/display/intel_gmbus.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     |   9 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   1 -
 .../gpu/drm/i915/display/intel_lpe_audio.h    |   8 +
 .../drm/i915/display/intel_modeset_setup.c    |  11 +-
 drivers/gpu/drm/i915/display/intel_opregion.c |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |  14 -
 .../gpu/drm/i915/display/intel_pch_display.h  |  16 +
 .../gpu/drm/i915/display/intel_pch_refclk.h   |   8 +
 drivers/gpu/drm/i915/display/intel_pipe_crc.c |   1 +
 .../drm/i915/display/intel_plane_initial.c    |   3 +-
 drivers/gpu/drm/i915/display/intel_psr.c      |   1 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 ++
 drivers/gpu/drm/i915/display/intel_vbt_defs.h |   2 +-
 drivers/gpu/drm/i915/display/intel_vga.c      |   5 +
 drivers/gpu/drm/i915/display/skl_scaler.c     |   2 +
 .../drm/i915/display/skl_universal_plane.c    |  52 ++-
 drivers/gpu/drm/i915/display/skl_watermark.c  |  25 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   4 -
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   7 -
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |   2 -
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  25 --
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  22 --
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   4 -
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   3 +-
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/i915/i915_gem.c               |   8 -
 drivers/gpu/drm/i915/i915_gem_gtt.c           |   1 -
 drivers/gpu/drm/i915/i915_reg_defs.h          |   8 +
 drivers/gpu/drm/i915/i915_vma.c               |  12 -
 drivers/gpu/drm/radeon/radeon.h               |  55 +--
 drivers/gpu/drm/radeon/radeon_ib.c            |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h        |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c            | 314 ++---------------
 drivers/gpu/drm/radeon/radeon_semaphore.c     |   6 +-
 drivers/gpu/drm/scheduler/sched_main.c        | 182 +++++++---
 drivers/gpu/drm/ttm/ttm_bo.c                  |   3 +-
 drivers/misc/mei/hdcp/Kconfig                 |   2 +-
 drivers/misc/mei/hdcp/mei_hdcp.c              |   3 +-
 include/drm/drm_pt_walk.h                     | 161 +++++++++
 include/drm/drm_suballoc.h                    | 112 ++++++
 include/drm/gpu_scheduler.h                   |  41 ++-
 sound/hda/hdac_i915.c                         |  17 +-
 sound/pci/hda/hda_intel.c                     |  56 +--
 sound/soc/intel/avs/core.c                    |  13 +-
 sound/soc/sof/intel/hda.c                     |   7 +-
 98 files changed, 2076 insertions(+), 1325 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_pt_walk.h
 create mode 100644 include/drm/drm_suballoc.h
Quoted 3 lines

--
2.37.3

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch