* [PATCH v2 0/2] Context isolation uAPI fixes
@ 2025-10-08 11:56 Krzysztof Niemiec
2025-10-08 11:56 ` [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM Krzysztof Niemiec
2025-10-08 11:56 ` [PATCH v2 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Krzysztof Niemiec
0 siblings, 2 replies; 6+ messages in thread
From: Krzysztof Niemiec @ 2025-10-08 11:56 UTC (permalink / raw)
To: dri-devel, intel-gfx
Cc: Adrian Larumbe, Simona Vetter, Andi Shyti, Janusz Krzysztofik,
Krzysztof Karas, Sebastian Brzezinka, Krzysztof Niemiec
This patch series addresses the concerns in
https://gitlab.freedesktop.org/drm/intel/-/issues/4264
Parallel work has been 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
v2:
- rebased the patches on the current upstream tree for the resend
- fixed up small typos
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.45.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM
2025-10-08 11:56 [PATCH v2 0/2] Context isolation uAPI fixes Krzysztof Niemiec
@ 2025-10-08 11:56 ` Krzysztof Niemiec
2025-10-09 21:43 ` Chris Wilson
2025-10-14 15:36 ` Petr Vorel
2025-10-08 11:56 ` [PATCH v2 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Krzysztof Niemiec
1 sibling, 2 replies; 6+ messages in thread
From: Krzysztof Niemiec @ 2025-10-08 11:56 UTC (permalink / raw)
To: dri-devel, intel-gfx
Cc: Adrian Larumbe, Simona Vetter, Andi Shyti, Janusz Krzysztofik,
Krzysztof Karas, Sebastian Brzezinka, Krzysztof Niemiec
From: Adrian Larumbe <adrian.larumbe@collabora.com>
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>
Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.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 535cb68fdb5c..5aff550034fc 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -724,10 +724,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.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION
2025-10-08 11:56 [PATCH v2 0/2] Context isolation uAPI fixes Krzysztof Niemiec
2025-10-08 11:56 ` [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM Krzysztof Niemiec
@ 2025-10-08 11:56 ` Krzysztof Niemiec
2025-10-08 14:02 ` Jani Nikula
1 sibling, 1 reply; 6+ messages in thread
From: Krzysztof Niemiec @ 2025-10-08 11:56 UTC (permalink / raw)
To: dri-devel, intel-gfx
Cc: Adrian Larumbe, Simona Vetter, Andi Shyti, Janusz Krzysztofik,
Krzysztof Karas, Sebastian Brzezinka, Krzysztof Niemiec
From: Adrian Larumbe <adrian.larumbe@collabora.com>
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>
Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.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 833987015b8b..1f8e2bc540a9 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
@@ -324,3 +324,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 6fcda6d7b5b7..34999ab51a6f 100644
--- a/drivers/gpu/drm/i915/i915_getparam.c
+++ b/drivers/gpu/drm/i915/i915_getparam.c
@@ -163,7 +163,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
value = -EINVAL;
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.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION
2025-10-08 11:56 ` [PATCH v2 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Krzysztof Niemiec
@ 2025-10-08 14:02 ` Jani Nikula
0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2025-10-08 14:02 UTC (permalink / raw)
To: Krzysztof Niemiec, dri-devel, intel-gfx
Cc: Adrian Larumbe, Simona Vetter, Andi Shyti, Janusz Krzysztofik,
Krzysztof Karas, Sebastian Brzezinka, Krzysztof Niemiec
On Wed, 08 Oct 2025, Krzysztof Niemiec <krzysztof.niemiec@intel.com> wrote:
> From: Adrian Larumbe <adrian.larumbe@collabora.com>
>
> 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>
> Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.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 833987015b8b..1f8e2bc540a9 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> @@ -324,3 +324,17 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
>
> return which;
> }
> +
> +bool engines_context_isolated(struct drm_i915_private *i915)
Please see other functions exposed from the file, and use name prefixing
accordingly.
BR,
Jani.
> +{
> + 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 6fcda6d7b5b7..34999ab51a6f 100644
> --- a/drivers/gpu/drm/i915/i915_getparam.c
> +++ b/drivers/gpu/drm/i915/i915_getparam.c
> @@ -163,7 +163,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
> value = -EINVAL;
> 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 */
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM
2025-10-08 11:56 ` [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM Krzysztof Niemiec
@ 2025-10-09 21:43 ` Chris Wilson
2025-10-14 15:36 ` Petr Vorel
1 sibling, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2025-10-09 21:43 UTC (permalink / raw)
To: Krzysztof Niemiec, dri-devel, intel-gfx
Cc: Adrian Larumbe, Andi Shyti, Janusz Krzysztofik, Krzysztof Karas,
Sebastian Brzezinka, Krzysztof Niemiec
Quoting Krzysztof Niemiec (2025-10-08 13:56:32)
> From: Adrian Larumbe <adrian.larumbe@collabora.com>
>
> 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.
The ABI predates Iris and Vulkan and provides information about
platforms that they do not support. Since they are using a strict subset
of the pre-existing ABI, there is no requirement to make backwards or
forwards incompatible changes to the stable information provided by the
kernel.
-Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM
2025-10-08 11:56 ` [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM Krzysztof Niemiec
2025-10-09 21:43 ` Chris Wilson
@ 2025-10-14 15:36 ` Petr Vorel
1 sibling, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2025-10-14 15:36 UTC (permalink / raw)
To: Krzysztof Niemiec
Cc: dri-devel, intel-gfx, Adrian Larumbe, Simona Vetter, Andi Shyti,
Janusz Krzysztofik, Krzysztof Karas, Sebastian Brzezinka
Hi all,
> From: Adrian Larumbe <adrian.larumbe@collabora.com>
> 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>
> Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.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 535cb68fdb5c..5aff550034fc 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -724,10 +724,6 @@ typedef struct drm_i915_irq_wait {
> * supports) that all state set by this context will not leak to any other
> * context.
> *
nit: could you please remove also this trailing line above which contains only
'*'?
Kind regards,
Petr
> - * 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-14 15:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 11:56 [PATCH v2 0/2] Context isolation uAPI fixes Krzysztof Niemiec
2025-10-08 11:56 ` [PATCH v2 1/2] drm/i915: Change semantics of context isolation reporting to UM Krzysztof Niemiec
2025-10-09 21:43 ` Chris Wilson
2025-10-14 15:36 ` Petr Vorel
2025-10-08 11:56 ` [PATCH v2 2/2] drm/i915: force getparam ioctl return bool for HAS_CONTEXT_ISOLATION Krzysztof Niemiec
2025-10-08 14:02 ` Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox