dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Context isolation uAPI fixes
@ 2022-07-29 16:16 Adrian Larumbe
  2022-07-29 16:16 ` [PATCH 1/2] drm/i915: Change semantics of context isolation reporting to UM Adrian Larumbe
  2022-07-29 16:16 ` [PATCH 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Adrian Larumbe
  0 siblings, 2 replies; 3+ messages in thread
From: Adrian Larumbe @ 2022-07-29 16:16 UTC (permalink / raw)
  To: daniel, intel-gfx, dri-devel; +Cc: bob.beckett, adrian.larumbe

This patch series addresses the concerns in
https://gitlab.freedesktop.org/drm/intel/-/issues/4264

Parallel work has be done on IGT to test changes in the kernel driver:
https://lists.freedesktop.org/archives/igt-dev/2022-May/041600.html

Test-with: 20220516205000.2960491-1-adrian.larumbe@collabora.com

Adrian Larumbe (2):
  drm/i915: Change semantics of context isolation reporting to UM
  drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION

 drivers/gpu/drm/i915/gt/intel_engine_user.c | 14 ++++++++++++++
 drivers/gpu/drm/i915/gt/intel_engine_user.h |  1 +
 drivers/gpu/drm/i915/i915_getparam.c        |  2 +-
 include/uapi/drm/i915_drm.h                 |  4 ----
 4 files changed, 16 insertions(+), 5 deletions(-)

-- 
2.37.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] drm/i915: Change semantics of context isolation reporting to UM
  2022-07-29 16:16 [PATCH 0/2] Context isolation uAPI fixes Adrian Larumbe
@ 2022-07-29 16:16 ` Adrian Larumbe
  2022-07-29 16:16 ` [PATCH 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Adrian Larumbe
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Larumbe @ 2022-07-29 16:16 UTC (permalink / raw)
  To: daniel, intel-gfx, dri-devel; +Cc: bob.beckett, adrian.larumbe

I915_PARAM_HAS_CONTEXT_ISOLATION was already being used as a boolean by
both Iris and Vulkan , and stood for the guarantee that, when creating a
new context, it would not contain register state from preexisting ones.

However, the actual param ioctl was returning a bitmask for the
engines in which isolation is supported, and IGT gem_ctx_isolation was
exploiting this wrong semantics when making decisions about which
engines support it.

This is a uAPI documentation change that precedes the actual change in
the getparam ioctl.

Signed-off-by: Adrian Larumbe <adrian.larumbe@collabora.com>
---
 include/uapi/drm/i915_drm.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 094f6e377793..09adb7ea01d1 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -692,10 +692,6 @@ typedef struct drm_i915_irq_wait {
  * supports) that all state set by this context will not leak to any other
  * context.
  *
- * As not every engine across every gen support contexts, the returned
- * value reports the support of context isolation for individual engines by
- * returning a bitmask of each engine class set to true if that class supports
- * isolation.
  */
 #define I915_PARAM_HAS_CONTEXT_ISOLATION 50
 
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION
  2022-07-29 16:16 [PATCH 0/2] Context isolation uAPI fixes Adrian Larumbe
  2022-07-29 16:16 ` [PATCH 1/2] drm/i915: Change semantics of context isolation reporting to UM Adrian Larumbe
@ 2022-07-29 16:16 ` Adrian Larumbe
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Larumbe @ 2022-07-29 16:16 UTC (permalink / raw)
  To: daniel, intel-gfx, dri-devel; +Cc: bob.beckett, adrian.larumbe

In a previous commit, the uAPI documentation for this param was updated
to reflect the actual usage expected by Iris. Now make sure the driver
does indeed return a boolean value rather than an engine bitmask.

Signed-off-by: Adrian Larumbe <adrian.larumbe@collabora.com>
---
 drivers/gpu/drm/i915/gt/intel_engine_user.c | 14 ++++++++++++++
 drivers/gpu/drm/i915/gt/intel_engine_user.h |  1 +
 drivers/gpu/drm/i915/i915_getparam.c        |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c
index 46a174f8aa00..7bdee1c9d940 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
@@ -306,3 +306,17 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
 
 	return which;
 }
+
+bool engines_context_isolated(struct drm_i915_private *i915)
+{
+	struct intel_engine_cs *engine;
+
+	if (!DRIVER_CAPS(i915)->has_logical_contexts)
+		return false;
+
+	for_each_uabi_engine(engine, i915)
+		if (!engine->default_state)
+			return false;
+
+	return true;
+}
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.h b/drivers/gpu/drm/i915/gt/intel_engine_user.h
index 3dc7e8ab9fbc..760167db07d5 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_user.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine_user.h
@@ -15,6 +15,7 @@ struct intel_engine_cs *
 intel_engine_lookup_user(struct drm_i915_private *i915, u8 class, u8 instance);
 
 unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915);
+bool engines_context_isolated(struct drm_i915_private *i915);
 
 void intel_engine_add_user(struct intel_engine_cs *engine);
 void intel_engines_driver_register(struct drm_i915_private *i915);
diff --git a/drivers/gpu/drm/i915/i915_getparam.c b/drivers/gpu/drm/i915/i915_getparam.c
index 6fd15b39570c..dd31cc00c529 100644
--- a/drivers/gpu/drm/i915/i915_getparam.c
+++ b/drivers/gpu/drm/i915/i915_getparam.c
@@ -145,7 +145,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
 		value = 1;
 		break;
 	case I915_PARAM_HAS_CONTEXT_ISOLATION:
-		value = intel_engines_has_context_isolation(i915);
+		value = engines_context_isolated(i915);
 		break;
 	case I915_PARAM_SLICE_MASK:
 		/* Not supported from Xe_HP onward; use topology queries */
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-29 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 16:16 [PATCH 0/2] Context isolation uAPI fixes Adrian Larumbe
2022-07-29 16:16 ` [PATCH 1/2] drm/i915: Change semantics of context isolation reporting to UM Adrian Larumbe
2022-07-29 16:16 ` [PATCH 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Adrian Larumbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).