Commit 8a02ea42 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-intel-next-fixes-2021-06-29' of...

Merge tag 'drm-intel-next-fixes-2021-06-29' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

The biggest fix is the restoration of mmap ioctl for gen12 integrated parts
which lack was breaking ADL-P with media stack.
Besides that a small selftest fix and a theoretical overflow on
i915->pipe_to_crtc_mapping.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YNtsfguvCRSROBUZ@intel.com
parents 4bac159e c90c4c65
...@@ -9618,7 +9618,6 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, ...@@ -9618,7 +9618,6 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
struct intel_crtc_state *old_crtc_state, struct intel_crtc_state *old_crtc_state,
struct intel_crtc_state *new_crtc_state) struct intel_crtc_state *new_crtc_state)
{ {
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct intel_crtc_state *slave_crtc_state, *master_crtc_state; struct intel_crtc_state *slave_crtc_state, *master_crtc_state;
struct intel_crtc *slave, *master; struct intel_crtc *slave, *master;
...@@ -9634,15 +9633,15 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, ...@@ -9634,15 +9633,15 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
if (!new_crtc_state->bigjoiner) if (!new_crtc_state->bigjoiner)
return 0; return 0;
if (1 + crtc->pipe >= INTEL_NUM_PIPES(dev_priv)) { slave = intel_dsc_get_bigjoiner_secondary(crtc);
if (!slave) {
DRM_DEBUG_KMS("[CRTC:%d:%s] Big joiner configuration requires " DRM_DEBUG_KMS("[CRTC:%d:%s] Big joiner configuration requires "
"CRTC + 1 to be used, doesn't exist\n", "CRTC + 1 to be used, doesn't exist\n",
crtc->base.base.id, crtc->base.name); crtc->base.base.id, crtc->base.name);
return -EINVAL; return -EINVAL;
} }
slave = new_crtc_state->bigjoiner_linked_crtc = new_crtc_state->bigjoiner_linked_crtc = slave;
intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave); slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave);
master = crtc; master = crtc;
if (IS_ERR(slave_crtc_state)) if (IS_ERR(slave_crtc_state))
......
...@@ -1723,6 +1723,14 @@ vlv_pipe_to_channel(enum pipe pipe) ...@@ -1723,6 +1723,14 @@ vlv_pipe_to_channel(enum pipe pipe)
} }
} }
static inline bool intel_pipe_valid(struct drm_i915_private *i915, enum pipe pipe)
{
return (pipe >= 0 &&
pipe < ARRAY_SIZE(i915->pipe_to_crtc_mapping) &&
INTEL_INFO(i915)->pipe_mask & BIT(pipe) &&
i915->pipe_to_crtc_mapping[pipe]);
}
static inline struct intel_crtc * static inline struct intel_crtc *
intel_get_first_crtc(struct drm_i915_private *dev_priv) intel_get_first_crtc(struct drm_i915_private *dev_priv)
{ {
......
...@@ -1106,6 +1106,27 @@ static i915_reg_t dss_ctl2_reg(const struct intel_crtc_state *crtc_state) ...@@ -1106,6 +1106,27 @@ static i915_reg_t dss_ctl2_reg(const struct intel_crtc_state *crtc_state)
return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL2(pipe) : DSS_CTL2; return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL2(pipe) : DSS_CTL2;
} }
static struct intel_crtc *
_get_crtc_for_pipe(struct drm_i915_private *i915, enum pipe pipe)
{
if (!intel_pipe_valid(i915, pipe))
return NULL;
return intel_get_crtc_for_pipe(i915, pipe);
}
struct intel_crtc *
intel_dsc_get_bigjoiner_secondary(const struct intel_crtc *primary_crtc)
{
return _get_crtc_for_pipe(to_i915(primary_crtc->base.dev), primary_crtc->pipe + 1);
}
static struct intel_crtc *
intel_dsc_get_bigjoiner_primary(const struct intel_crtc *secondary_crtc)
{
return _get_crtc_for_pipe(to_i915(secondary_crtc->base.dev), secondary_crtc->pipe - 1);
}
void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state) void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
...@@ -1178,15 +1199,13 @@ void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state) ...@@ -1178,15 +1199,13 @@ void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state)
dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc_state)); dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc_state));
if (dss_ctl1 & UNCOMPRESSED_JOINER_MASTER) { if (dss_ctl1 & UNCOMPRESSED_JOINER_MASTER) {
crtc_state->bigjoiner = true; crtc_state->bigjoiner = true;
if (!WARN_ON(INTEL_NUM_PIPES(dev_priv) == crtc->pipe + 1)) crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_secondary(crtc);
crtc_state->bigjoiner_linked_crtc = drm_WARN_ON(&dev_priv->drm, !crtc_state->bigjoiner_linked_crtc);
intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
} else if (dss_ctl1 & UNCOMPRESSED_JOINER_SLAVE) { } else if (dss_ctl1 & UNCOMPRESSED_JOINER_SLAVE) {
crtc_state->bigjoiner = true; crtc_state->bigjoiner = true;
crtc_state->bigjoiner_slave = true; crtc_state->bigjoiner_slave = true;
if (!WARN_ON(crtc->pipe == PIPE_A)) crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_primary(crtc);
crtc_state->bigjoiner_linked_crtc = drm_WARN_ON(&dev_priv->drm, !crtc_state->bigjoiner_linked_crtc);
intel_get_crtc_for_pipe(dev_priv, crtc->pipe - 1);
} }
} }
...@@ -1224,14 +1243,11 @@ void intel_dsc_get_config(struct intel_crtc_state *crtc_state) ...@@ -1224,14 +1243,11 @@ void intel_dsc_get_config(struct intel_crtc_state *crtc_state)
if (!(dss_ctl1 & MASTER_BIG_JOINER_ENABLE)) { if (!(dss_ctl1 & MASTER_BIG_JOINER_ENABLE)) {
crtc_state->bigjoiner_slave = true; crtc_state->bigjoiner_slave = true;
if (!WARN_ON(crtc->pipe == PIPE_A)) crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_primary(crtc);
crtc_state->bigjoiner_linked_crtc =
intel_get_crtc_for_pipe(dev_priv, crtc->pipe - 1);
} else { } else {
if (!WARN_ON(INTEL_NUM_PIPES(dev_priv) == crtc->pipe + 1)) crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_secondary(crtc);
crtc_state->bigjoiner_linked_crtc =
intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
} }
drm_WARN_ON(&dev_priv->drm, !crtc_state->bigjoiner_linked_crtc);
} }
/* FIXME: add more state readout as needed */ /* FIXME: add more state readout as needed */
......
...@@ -22,5 +22,6 @@ void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state); ...@@ -22,5 +22,6 @@ void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state);
void intel_dsc_get_config(struct intel_crtc_state *crtc_state); void intel_dsc_get_config(struct intel_crtc_state *crtc_state);
enum intel_display_power_domain enum intel_display_power_domain
intel_dsc_power_domain(const struct intel_crtc_state *crtc_state); intel_dsc_power_domain(const struct intel_crtc_state *crtc_state);
struct intel_crtc *intel_dsc_get_bigjoiner_secondary(const struct intel_crtc *primary_crtc);
#endif /* __INTEL_VDSC_H__ */ #endif /* __INTEL_VDSC_H__ */
...@@ -61,10 +61,11 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, ...@@ -61,10 +61,11 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
unsigned long addr; unsigned long addr;
/* mmap ioctl is disallowed for all platforms after TGL-LP. This also /*
* covers all platforms with local memory. * mmap ioctl is disallowed for all discrete platforms,
* and for all platforms with GRAPHICS_VER > 12.
*/ */
if (GRAPHICS_VER(i915) >= 12 && !IS_TIGERLAKE(i915)) if (IS_DGFX(i915) || GRAPHICS_VER(i915) > 12)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (args->flags & ~(I915_MMAP_WC)) if (args->flags & ~(I915_MMAP_WC))
......
...@@ -551,6 +551,32 @@ static int live_pin_rewind(void *arg) ...@@ -551,6 +551,32 @@ static int live_pin_rewind(void *arg)
return err; return err;
} }
static int engine_lock_reset_tasklet(struct intel_engine_cs *engine)
{
tasklet_disable(&engine->execlists.tasklet);
local_bh_disable();
if (test_and_set_bit(I915_RESET_ENGINE + engine->id,
&engine->gt->reset.flags)) {
local_bh_enable();
tasklet_enable(&engine->execlists.tasklet);
intel_gt_set_wedged(engine->gt);
return -EBUSY;
}
return 0;
}
static void engine_unlock_reset_tasklet(struct intel_engine_cs *engine)
{
clear_and_wake_up_bit(I915_RESET_ENGINE + engine->id,
&engine->gt->reset.flags);
local_bh_enable();
tasklet_enable(&engine->execlists.tasklet);
}
static int live_hold_reset(void *arg) static int live_hold_reset(void *arg)
{ {
struct intel_gt *gt = arg; struct intel_gt *gt = arg;
...@@ -598,15 +624,9 @@ static int live_hold_reset(void *arg) ...@@ -598,15 +624,9 @@ static int live_hold_reset(void *arg)
/* We have our request executing, now remove it and reset */ /* We have our request executing, now remove it and reset */
local_bh_disable(); err = engine_lock_reset_tasklet(engine);
if (test_and_set_bit(I915_RESET_ENGINE + id, if (err)
&gt->reset.flags)) {
local_bh_enable();
intel_gt_set_wedged(gt);
err = -EBUSY;
goto out; goto out;
}
tasklet_disable(&engine->execlists.tasklet);
engine->execlists.tasklet.callback(&engine->execlists.tasklet); engine->execlists.tasklet.callback(&engine->execlists.tasklet);
GEM_BUG_ON(execlists_active(&engine->execlists) != rq); GEM_BUG_ON(execlists_active(&engine->execlists) != rq);
...@@ -618,10 +638,7 @@ static int live_hold_reset(void *arg) ...@@ -618,10 +638,7 @@ static int live_hold_reset(void *arg)
__intel_engine_reset_bh(engine, NULL); __intel_engine_reset_bh(engine, NULL);
GEM_BUG_ON(rq->fence.error != -EIO); GEM_BUG_ON(rq->fence.error != -EIO);
tasklet_enable(&engine->execlists.tasklet); engine_unlock_reset_tasklet(engine);
clear_and_wake_up_bit(I915_RESET_ENGINE + id,
&gt->reset.flags);
local_bh_enable();
/* Check that we do not resubmit the held request */ /* Check that we do not resubmit the held request */
if (!i915_request_wait(rq, 0, HZ / 5)) { if (!i915_request_wait(rq, 0, HZ / 5)) {
...@@ -4585,15 +4602,9 @@ static int reset_virtual_engine(struct intel_gt *gt, ...@@ -4585,15 +4602,9 @@ static int reset_virtual_engine(struct intel_gt *gt,
GEM_BUG_ON(engine == ve->engine); GEM_BUG_ON(engine == ve->engine);
/* Take ownership of the reset and tasklet */ /* Take ownership of the reset and tasklet */
local_bh_disable(); err = engine_lock_reset_tasklet(engine);
if (test_and_set_bit(I915_RESET_ENGINE + engine->id, if (err)
&gt->reset.flags)) {
local_bh_enable();
intel_gt_set_wedged(gt);
err = -EBUSY;
goto out_heartbeat; goto out_heartbeat;
}
tasklet_disable(&engine->execlists.tasklet);
engine->execlists.tasklet.callback(&engine->execlists.tasklet); engine->execlists.tasklet.callback(&engine->execlists.tasklet);
GEM_BUG_ON(execlists_active(&engine->execlists) != rq); GEM_BUG_ON(execlists_active(&engine->execlists) != rq);
...@@ -4612,9 +4623,7 @@ static int reset_virtual_engine(struct intel_gt *gt, ...@@ -4612,9 +4623,7 @@ static int reset_virtual_engine(struct intel_gt *gt,
GEM_BUG_ON(rq->fence.error != -EIO); GEM_BUG_ON(rq->fence.error != -EIO);
/* Release our grasp on the engine, letting CS flow again */ /* Release our grasp on the engine, letting CS flow again */
tasklet_enable(&engine->execlists.tasklet); engine_unlock_reset_tasklet(engine);
clear_and_wake_up_bit(I915_RESET_ENGINE + engine->id, &gt->reset.flags);
local_bh_enable();
/* Check that we do not resubmit the held request */ /* Check that we do not resubmit the held request */
i915_request_get(rq); i915_request_get(rq);
......
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