Commit cfd36ae3 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-intel-fixes-2024-05-30' of...

Merge tag 'drm-intel-fixes-2024-05-30' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-fixes

drm/i915 fixes for v6.10-rc2:
- Fix a race in audio component by registering it later
- Make DPT object unshrinkable to avoid shrinking when framebuffer has
  not shrunk
- Fix CCS id calculation to fix a perf regression
- Fix selftest caching mode
- Fix FIELD_PREP compiler warnings
- Fix indefinite wait for GT wakeref release
- Revert overeager multi-gt pm reference removal
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87a5k7iwod.fsf@intel.com
parents 3e049b6b 75800e2e
...@@ -1252,17 +1252,6 @@ static const struct component_ops i915_audio_component_bind_ops = { ...@@ -1252,17 +1252,6 @@ static const struct component_ops i915_audio_component_bind_ops = {
static void i915_audio_component_init(struct drm_i915_private *i915) static void i915_audio_component_init(struct drm_i915_private *i915)
{ {
u32 aud_freq, aud_freq_init; u32 aud_freq, aud_freq_init;
int ret;
ret = component_add_typed(i915->drm.dev,
&i915_audio_component_bind_ops,
I915_COMPONENT_AUDIO);
if (ret < 0) {
drm_err(&i915->drm,
"failed to add audio component (%d)\n", ret);
/* continue with reduced functionality */
return;
}
if (DISPLAY_VER(i915) >= 9) { if (DISPLAY_VER(i915) >= 9) {
aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL); aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL);
...@@ -1285,6 +1274,21 @@ static void i915_audio_component_init(struct drm_i915_private *i915) ...@@ -1285,6 +1274,21 @@ static void i915_audio_component_init(struct drm_i915_private *i915)
/* init with current cdclk */ /* init with current cdclk */
intel_audio_cdclk_change_post(i915); intel_audio_cdclk_change_post(i915);
}
static void i915_audio_component_register(struct drm_i915_private *i915)
{
int ret;
ret = component_add_typed(i915->drm.dev,
&i915_audio_component_bind_ops,
I915_COMPONENT_AUDIO);
if (ret < 0) {
drm_err(&i915->drm,
"failed to add audio component (%d)\n", ret);
/* continue with reduced functionality */
return;
}
i915->display.audio.component_registered = true; i915->display.audio.component_registered = true;
} }
...@@ -1317,6 +1321,12 @@ void intel_audio_init(struct drm_i915_private *i915) ...@@ -1317,6 +1321,12 @@ void intel_audio_init(struct drm_i915_private *i915)
i915_audio_component_init(i915); i915_audio_component_init(i915);
} }
void intel_audio_register(struct drm_i915_private *i915)
{
if (!i915->display.audio.lpe.platdev)
i915_audio_component_register(i915);
}
/** /**
* intel_audio_deinit() - deinitialize the audio driver * intel_audio_deinit() - deinitialize the audio driver
* @i915: the i915 drm device private data * @i915: the i915 drm device private data
......
...@@ -28,6 +28,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder, ...@@ -28,6 +28,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder,
void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv); void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv);
void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv); void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv);
void intel_audio_init(struct drm_i915_private *dev_priv); void intel_audio_init(struct drm_i915_private *dev_priv);
void intel_audio_register(struct drm_i915_private *i915);
void intel_audio_deinit(struct drm_i915_private *dev_priv); void intel_audio_deinit(struct drm_i915_private *dev_priv);
void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state); void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state);
......
...@@ -540,6 +540,8 @@ void intel_display_driver_register(struct drm_i915_private *i915) ...@@ -540,6 +540,8 @@ void intel_display_driver_register(struct drm_i915_private *i915)
intel_display_driver_enable_user_access(i915); intel_display_driver_enable_user_access(i915);
intel_audio_register(i915);
intel_display_debugfs_register(i915); intel_display_debugfs_register(i915);
/* /*
......
...@@ -255,6 +255,7 @@ struct i915_execbuffer { ...@@ -255,6 +255,7 @@ struct i915_execbuffer {
struct intel_context *context; /* logical state for the request */ struct intel_context *context; /* logical state for the request */
struct i915_gem_context *gem_context; /** caller's context */ struct i915_gem_context *gem_context; /** caller's context */
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
intel_wakeref_t wakeref_gt0;
/** our requests to build */ /** our requests to build */
struct i915_request *requests[MAX_ENGINE_INSTANCE + 1]; struct i915_request *requests[MAX_ENGINE_INSTANCE + 1];
...@@ -2685,6 +2686,7 @@ static int ...@@ -2685,6 +2686,7 @@ static int
eb_select_engine(struct i915_execbuffer *eb) eb_select_engine(struct i915_execbuffer *eb)
{ {
struct intel_context *ce, *child; struct intel_context *ce, *child;
struct intel_gt *gt;
unsigned int idx; unsigned int idx;
int err; int err;
...@@ -2708,10 +2710,17 @@ eb_select_engine(struct i915_execbuffer *eb) ...@@ -2708,10 +2710,17 @@ eb_select_engine(struct i915_execbuffer *eb)
} }
} }
eb->num_batches = ce->parallel.number_children + 1; eb->num_batches = ce->parallel.number_children + 1;
gt = ce->engine->gt;
for_each_child(ce, child) for_each_child(ce, child)
intel_context_get(child); intel_context_get(child);
eb->wakeref = intel_gt_pm_get(ce->engine->gt); eb->wakeref = intel_gt_pm_get(ce->engine->gt);
/*
* Keep GT0 active on MTL so that i915_vma_parked() doesn't
* free VMAs while execbuf ioctl is validating VMAs.
*/
if (gt->info.id)
eb->wakeref_gt0 = intel_gt_pm_get(to_gt(gt->i915));
if (!test_bit(CONTEXT_ALLOC_BIT, &ce->flags)) { if (!test_bit(CONTEXT_ALLOC_BIT, &ce->flags)) {
err = intel_context_alloc_state(ce); err = intel_context_alloc_state(ce);
...@@ -2750,6 +2759,9 @@ eb_select_engine(struct i915_execbuffer *eb) ...@@ -2750,6 +2759,9 @@ eb_select_engine(struct i915_execbuffer *eb)
return err; return err;
err: err:
if (gt->info.id)
intel_gt_pm_put(to_gt(gt->i915), eb->wakeref_gt0);
intel_gt_pm_put(ce->engine->gt, eb->wakeref); intel_gt_pm_put(ce->engine->gt, eb->wakeref);
for_each_child(ce, child) for_each_child(ce, child)
intel_context_put(child); intel_context_put(child);
...@@ -2763,6 +2775,12 @@ eb_put_engine(struct i915_execbuffer *eb) ...@@ -2763,6 +2775,12 @@ eb_put_engine(struct i915_execbuffer *eb)
struct intel_context *child; struct intel_context *child;
i915_vm_put(eb->context->vm); i915_vm_put(eb->context->vm);
/*
* This works in conjunction with eb_select_engine() to prevent
* i915_vma_parked() from interfering while execbuf validates vmas.
*/
if (eb->gt->info.id)
intel_gt_pm_put(to_gt(eb->gt->i915), eb->wakeref_gt0);
intel_gt_pm_put(eb->context->engine->gt, eb->wakeref); intel_gt_pm_put(eb->context->engine->gt, eb->wakeref);
for_each_child(eb->context, child) for_each_child(eb->context, child)
intel_context_put(child); intel_context_put(child);
......
...@@ -284,7 +284,9 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj); ...@@ -284,7 +284,9 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj);
static inline bool static inline bool
i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
{ {
return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE); /* TODO: make DPT shrinkable when it has no bound vmas */
return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) &&
!obj->is_dpt;
} }
static inline bool static inline bool
......
...@@ -196,7 +196,7 @@ static int verify_access(struct drm_i915_private *i915, ...@@ -196,7 +196,7 @@ static int verify_access(struct drm_i915_private *i915,
if (err) if (err)
goto out_file; goto out_file;
mode = intel_gt_coherent_map_type(to_gt(i915), native_obj, true); mode = intel_gt_coherent_map_type(to_gt(i915), native_obj, false);
vaddr = i915_gem_object_pin_map_unlocked(native_obj, mode); vaddr = i915_gem_object_pin_map_unlocked(native_obj, mode);
if (IS_ERR(vaddr)) { if (IS_ERR(vaddr)) {
err = PTR_ERR(vaddr); err = PTR_ERR(vaddr);
......
...@@ -263,8 +263,13 @@ static void signal_irq_work(struct irq_work *work) ...@@ -263,8 +263,13 @@ static void signal_irq_work(struct irq_work *work)
i915_request_put(rq); i915_request_put(rq);
} }
/* Lazy irq enabling after HW submission */
if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers)) if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers))
intel_breadcrumbs_arm_irq(b); intel_breadcrumbs_arm_irq(b);
/* And confirm that we still want irqs enabled before we yield */
if (READ_ONCE(b->irq_armed) && !atomic_read(&b->active))
intel_breadcrumbs_disarm_irq(b);
} }
struct intel_breadcrumbs * struct intel_breadcrumbs *
...@@ -315,13 +320,7 @@ void __intel_breadcrumbs_park(struct intel_breadcrumbs *b) ...@@ -315,13 +320,7 @@ void __intel_breadcrumbs_park(struct intel_breadcrumbs *b)
return; return;
/* Kick the work once more to drain the signalers, and disarm the irq */ /* Kick the work once more to drain the signalers, and disarm the irq */
irq_work_sync(&b->irq_work); irq_work_queue(&b->irq_work);
while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) {
local_irq_disable();
signal_irq_work(&b->irq_work);
local_irq_enable();
cond_resched();
}
} }
void intel_breadcrumbs_free(struct kref *kref) void intel_breadcrumbs_free(struct kref *kref)
...@@ -404,7 +403,7 @@ static void insert_breadcrumb(struct i915_request *rq) ...@@ -404,7 +403,7 @@ static void insert_breadcrumb(struct i915_request *rq)
* the request as it may have completed and raised the interrupt as * the request as it may have completed and raised the interrupt as
* we were attaching it into the lists. * we were attaching it into the lists.
*/ */
if (!b->irq_armed || __i915_request_is_complete(rq)) if (!READ_ONCE(b->irq_armed) || __i915_request_is_complete(rq))
irq_work_queue(&b->irq_work); irq_work_queue(&b->irq_work);
} }
......
...@@ -885,6 +885,12 @@ static intel_engine_mask_t init_engine_mask(struct intel_gt *gt) ...@@ -885,6 +885,12 @@ static intel_engine_mask_t init_engine_mask(struct intel_gt *gt)
if (IS_DG2(gt->i915)) { if (IS_DG2(gt->i915)) {
u8 first_ccs = __ffs(CCS_MASK(gt)); u8 first_ccs = __ffs(CCS_MASK(gt));
/*
* Store the number of active cslices before
* changing the CCS engine configuration
*/
gt->ccs.cslices = CCS_MASK(gt);
/* Mask off all the CCS engine */ /* Mask off all the CCS engine */
info->engine_mask &= ~GENMASK(CCS3, CCS0); info->engine_mask &= ~GENMASK(CCS3, CCS0);
/* Put back in the first CCS engine */ /* Put back in the first CCS engine */
......
...@@ -19,7 +19,7 @@ unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt) ...@@ -19,7 +19,7 @@ unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt)
/* Build the value for the fixed CCS load balancing */ /* Build the value for the fixed CCS load balancing */
for (cslice = 0; cslice < I915_MAX_CCS; cslice++) { for (cslice = 0; cslice < I915_MAX_CCS; cslice++) {
if (CCS_MASK(gt) & BIT(cslice)) if (gt->ccs.cslices & BIT(cslice))
/* /*
* If available, assign the cslice * If available, assign the cslice
* to the first available engine... * to the first available engine...
......
...@@ -207,6 +207,14 @@ struct intel_gt { ...@@ -207,6 +207,14 @@ struct intel_gt {
[MAX_ENGINE_INSTANCE + 1]; [MAX_ENGINE_INSTANCE + 1];
enum intel_submission_method submission_method; enum intel_submission_method submission_method;
struct {
/*
* Mask of the non fused CCS slices
* to be used for the load balancing
*/
intel_engine_mask_t cslices;
} ccs;
/* /*
* Default address space (either GGTT or ppGTT depending on arch). * Default address space (either GGTT or ppGTT depending on arch).
* *
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
*/ */
#define GUC_KLV_LEN_MIN 1u #define GUC_KLV_LEN_MIN 1u
#define GUC_KLV_0_KEY (0xffff << 16) #define GUC_KLV_0_KEY (0xffffu << 16)
#define GUC_KLV_0_LEN (0xffff << 0) #define GUC_KLV_0_LEN (0xffffu << 0)
#define GUC_KLV_n_VALUE (0xffffffff << 0) #define GUC_KLV_n_VALUE (0xffffffffu << 0)
/** /**
* DOC: GuC Self Config KLVs * DOC: GuC Self Config KLVs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment