From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f66.google.com ([209.85.208.66]:43031 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbeJEOYQ (ORCPT ); Fri, 5 Oct 2018 10:24:16 -0400 Received: by mail-ed1-f66.google.com with SMTP id y20-v6so4126143eds.10 for ; Fri, 05 Oct 2018 00:26:50 -0700 (PDT) Date: Fri, 5 Oct 2018 09:26:45 +0200 From: Daniel Vetter To: Lyude Paul Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Daniel Vetter , Jani Nikula , stable@vger.kernel.org, Joonas Lahtinen , Rodrigo Vivi , David Airlie , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 4/5] drm/i915: Skip vcpi allocation for MSTB ports that are gone Message-ID: <20181005072645.GW31561@phenom.ffwll.local> References: <20181005002956.7317-1-lyude@redhat.com> <20181005002956.7317-5-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181005002956.7317-5-lyude@redhat.com> Sender: stable-owner@vger.kernel.org List-ID: On Thu, Oct 04, 2018 at 08:29:53PM -0400, Lyude Paul wrote: > Since we need to be able to allow DPMS on->off prop changes after an MST > port has disappeared from the system, we need to be able to make sure we > can compute a config for the resulting atomic commit. Currently this is > impossible when the port has disappeared, since the VCPI slot searching > we try to do in intel_dp_mst_compute_config() will fail with -EINVAL. > > Since the only commits we want to allow on no-longer-present MST ports > are ones that shut off display hardware, we already know that no VCPI > allocations are needed. So, hardcode the VCPI slot count to 0 when > intel_dp_mst_compute_config() is called on an MST port that's gone. > > Signed-off-by: Lyude Paul > Cc: stable@vger.kernel.org > --- > drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c > index fcb9b87b9339..a366f32b048a 100644 > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > @@ -42,7 +42,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, > to_intel_connector(conn_state->connector); > struct drm_atomic_state *state = pipe_config->base.state; > int bpp; > - int lane_count, slots; > + int lane_count, slots = 0; > const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; > int mst_pbn; > bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, > @@ -76,11 +76,16 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, > mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); > pipe_config->pbn = mst_pbn; > > - slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, > - connector->port, mst_pbn); > - if (slots < 0) { > - DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); > - return false; > + if (!connector->mst_port_gone) { Wondered why you don't need this for nouveau/amdgpu, but a bit of grepping later says they don't even bother to check that in their atomic_check functions. So if a multi-stream cable runs out of vcpi slots, they just toss up their hands, atomic be damned :-( With the s/mst_port_gone/READ_ONCE(!conn->registered)/ bikeshed: Reviewed-by: Daniel Vetter I wondered a bit whether ths fuction shouldn't just return 0 if the connector is gone, but we'd need to audit/fix other drivers first. -Daniel > + slots = drm_dp_atomic_find_vcpi_slots(state, > + &intel_dp->mst_mgr, > + connector->port, > + mst_pbn); > + if (slots < 0) { > + DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", > + slots); > + return false; > + } > } > > intel_link_compute_m_n(bpp, lane_count, > -- > 2.17.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch