Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2357132pxy; Sun, 2 May 2021 20:14:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+GpwzpVAfRXo80OpXgs6U/PdsKErn94Q6OnqmVbOSzZvHC6IH5zWRhPXPjC5vavvrBX5V X-Received: by 2002:a17:906:1b09:: with SMTP id o9mr14586609ejg.102.1620011669199; Sun, 02 May 2021 20:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620011669; cv=none; d=google.com; s=arc-20160816; b=c9+lnT+QA7lwtApSUd/jgn0xZRsmDAYaNqR1qwrNNUlnF4HVBwo6NVRAgPIks1ra/K lX+ALKEMFhrVEPLFoCB762XJtTCKRp33Sl+/X26jmiM4POufKTclBWZuEOFk5UzviZsm wKFu7fYKs0IhZ106CDyb3OUSPEfXWmtq4IQnOR6needqvGseAID9SHTVegwNld0lC3dt hDrLHqLKdqNnkwyTM9VjiO6R5Hz1NF63LDGWznfKMkRCoTyeqh0e4b3LZ7rYv4CXRM7r NQVwhiexUv8v54JHPyCUQR/MIMfMXeb3t192snlOYhFWUYvU5/9YRV3ylhSht7xNix8n HKwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=r8T3Z2Fz/UuiqW7YitolaZ0354OsnRaev6lWyoTqtO4=; b=WclFrnQuNvLGtKWj1cyvdc4fp68qN+YGmNaRO8+3Wun4q2rDkcaiFzVMyUH7eWw+DI BNKuok5jcrep0dngRTVlrriVC6E9Ou+eRLc3oYQFl0iMkoqqOQk1EYTV2B4XjPuLsK4y 0CY+eTo06px9P9bk7oW2pC9h2X5PsWSHy5z9xKL5Dqvhwu8v/DUzfLeGS/h7AuOO5saA BIrfVdd70VLh/wQOq/tzzpM7rsuJr7gK+WswwGbD4+r8cRiL7awMtjvy/El1IhLrogdx MeR5Agd77O+6lBGEvafxLQHcA6r4v2zQEIimkGCqrA268/oujzuQbEQho+9+iwt7+IST BK0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s5si7366626edw.318.2021.05.02.20.14.05; Sun, 02 May 2021 20:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbhECDOG (ORCPT + 99 others); Sun, 2 May 2021 23:14:06 -0400 Received: from mga12.intel.com ([192.55.52.136]:32498 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbhECDOF (ORCPT ); Sun, 2 May 2021 23:14:05 -0400 IronPort-SDR: aRFKyM+uLGO7XrRuSstfc01ekQ+C2HoQgJsB2kY1KOJPR/YVg6TsFAsLb+0CGLUTv5UAgFGczV BY0oGo8mlnSw== X-IronPort-AV: E=McAfee;i="6200,9189,9972"; a="177182983" X-IronPort-AV: E=Sophos;i="5.82,268,1613462400"; d="scan'208";a="177182983" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2021 20:13:12 -0700 IronPort-SDR: DlWEuVc0GsZ3l2+sap/HNaJbO6bnemkBr3ic7xwnaYf3UstWJiIJgYMNDV7JDDnl61Yd449exs SRFm40MiPnQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,268,1613462400"; d="scan'208";a="389370171" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.171]) by orsmga006.jf.intel.com with SMTP; 02 May 2021 20:13:08 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 03 May 2021 06:13:08 +0300 Date: Mon, 3 May 2021 06:13:08 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Lyude Paul Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, =?iso-8859-1?B?Suly9G1l?= de Bretagne , David Airlie , open list , Jani Nikula , stable@vger.kernel.org, Thomas Zimmermann , Sean Paul Subject: Re: [PATCH 1/2] drm/dp: Handle zeroed port counts in drm_dp_read_downstream_info() Message-ID: References: <20210430223428.10514-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210430223428.10514-1-lyude@redhat.com> X-Patchwork-Hint: comment Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 30, 2021 at 06:34:27PM -0400, Lyude Paul wrote: > While the DP specification isn't entirely clear on if this should be > allowed or not, some branch devices report having downstream ports present > while also reporting a downstream port count of 0. So to avoid breaking > those devices, we need to handle this in drm_dp_read_downstream_info(). > > So, to do this we assume there's no downstream port info when the > downstream port count is 0. > > Signed-off-by: Lyude Paul > Tested-by: J?r?me de Bretagne > Bugzilla: https://gitlab.freedesktop.org/drm/intel/-/issues/3416 > Fixes: 3d3721ccb18a ("drm/i915/dp: Extract drm_dp_read_downstream_info()") > Cc: # v5.10+ > --- > drivers/gpu/drm/drm_dp_helper.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c > index cb56d74e9d38..27c8c5bdf7d9 100644 > --- a/drivers/gpu/drm/drm_dp_helper.c > +++ b/drivers/gpu/drm/drm_dp_helper.c > @@ -682,7 +682,14 @@ int drm_dp_read_downstream_info(struct drm_dp_aux *aux, > !(dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT)) > return 0; > > + /* Some branches advertise having 0 downstream ports, despite also advertising they have a > + * downstream port present. The DP spec isn't clear on if this is allowed or not, but since > + * some branches do it we need to handle it regardless. > + */ > len = drm_dp_downstream_port_count(dpcd); > + if (!len) > + return 0; > + Seems sane enough. Reviewed-by: Ville Syrj?l? > if (dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DETAILED_CAP_INFO_AVAILABLE) > len *= 4; > > -- > 2.30.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel