Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1591161rwl; Fri, 24 Mar 2023 12:39:47 -0700 (PDT) X-Google-Smtp-Source: AKy350bJLOs4wEYAhGQtn7jzpgFX9KeZUkPt89hXNy+jfw+6VEUL+XS7hJ+Pmlt8i11ti58x7DJ4 X-Received: by 2002:aa7:cc04:0:b0:4fd:2a29:ceac with SMTP id q4-20020aa7cc04000000b004fd2a29ceacmr4033605edt.14.1679686786888; Fri, 24 Mar 2023 12:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679686786; cv=none; d=google.com; s=arc-20160816; b=DO0FWeICqvxrKlBItLLW0EIiGsF4lC5CJai/jU6Fbm1IqyxJgFj2Jll3XliBBi5Nrk y5A0M+wHhSfiEqedsYkHVyqVlQZ48eiOwlMeEWKa/1zyUMyUMlfO9+2TA37/13ClVutW BZDtj1RAwY27avEwTrVz8jdhhHa1z044SN9LWRZWpOJ8/ARtv7OIt8wJ3E2HoIAyklgh OsBroY9kZQAWKDrrzjqxSu7v8QyyUeLshRJ6VDBlyoO6RY5wk+VlGn+s+QUMfpDdduDv 7k5OKGr0L0KRiMfxcC+7S2Z4FbFXLOoPrl/+Wx9VMINiOfxDgy7MVikoBtn9pmQe2RVr FoaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=A76mQMLCXjYaVOvcsZRi/XfbCpgyGK8ELYNqRDF4dnY=; b=Q6KMOVQMFbtZ+CgX61x7efgjxj6IgO60CFiAdpa5au0XkEJcfuJO+jII1zHVADubHp 1/CjYSqQe2haUnfL3Sgqf6klnbh5qb8Od1uHBPoF7c5vwOZXbClsvCGaqvOZxI3/3GYe //EX1nsnwsuo6XtQ+zh9MsQhX9UXobRFBwV04Z492tUdJbban+w8Sb9a7riOGW2EAWvX MqN/iG4sNLFaKqeNMyD6z3UMutWOw1RJh2A0Hu0vFmhUV79/wQjNND1ixRDg3+lhP/IT vWa13JNANzEC6/OrSwW72TQSIzYwNFPmG0zIeq5pieTuMC0bfM7+vCQzreRlZpSpyqyP vMuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BGlDYDho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020aa7c586000000b004ac746e3f9asi21737983edq.441.2023.03.24.12.39.21; Fri, 24 Mar 2023 12:39:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BGlDYDho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbjCXT1d (ORCPT + 99 others); Fri, 24 Mar 2023 15:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbjCXT1a (ORCPT ); Fri, 24 Mar 2023 15:27:30 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A9201DBAA for ; Fri, 24 Mar 2023 12:27:27 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id t15so2843769wrz.7 for ; Fri, 24 Mar 2023 12:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679686046; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=A76mQMLCXjYaVOvcsZRi/XfbCpgyGK8ELYNqRDF4dnY=; b=BGlDYDhoCSHvCE30sxCZJ330CsatpMec4rqSDHE1b4iNuDgzdZP3RcITGzQLdhSQE1 0N3Yz4BMfkOggoOZZEfuE48SBNrNXGe5M58Yo36TE3i0jUzVIoBUrgNYgI0hYrQog6Yc 0ccSEqEMB5Z2pmlPWflgH7nYkrYlTvygQ/xE0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679686046; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A76mQMLCXjYaVOvcsZRi/XfbCpgyGK8ELYNqRDF4dnY=; b=mfQw8/ut6WJK30hG5/29ujPX1P4sK5FodP5DmRVF7Db9xJpeYcrWaxjrKvIYvq023L d1o70/N+2XLrV2bJ+B2RK3mOz4kliyeR5UziMgvwAXQVR/A4tk8BGWrYWlQewgMDz/Qt 83tau+V53LPYMMSzThyFIDoWONkViIClh0pk4gFzcP56FiNps84XNIJlNat1T8yYPagJ TU4NIHfcqoAkkb4pYcJYY6Fe92rg22+fcRhwUGeTmiQP4pvEyO63igc5FJrmtwbCJlLE GUfHLCdT6ac2pqG600VDh7FdHhcNyBRIIS3GweK67UGVLsaJh10dlnciyApAsjwtMpzn B+RA== X-Gm-Message-State: AAQBX9eXphcBJyge61VWo9C3LyrDigP+i0X0Gvg9L46psg9BF8Q5jA7X GwcwKAVbbBQ7km5t6o8VX9bK7gbuBDKLw/VddK/+Sw== X-Received: by 2002:adf:f8cf:0:b0:2d3:3db2:bbae with SMTP id f15-20020adff8cf000000b002d33db2bbaemr804498wrq.5.1679686046094; Fri, 24 Mar 2023 12:27:26 -0700 (PDT) MIME-Version: 1.0 References: <20230118193015.911074-1-markyacoub@google.com> <20230118193015.911074-7-markyacoub@google.com> In-Reply-To: From: Mark Yacoub Date: Fri, 24 Mar 2023 15:27:15 -0400 Message-ID: Subject: Re: [PATCH v6 06/10] drm/i915/hdcp: Retain hdcp_capable return codes To: "Kandpal, Suraj" Cc: "quic_khsieh@quicinc.com" , "linux-arm-msm@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "freedreno@lists.freedesktop.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "intel-gfx@lists.freedesktop.org" , "quic_sbillaka@quicinc.com" , "konrad.dybcio@somainline.org" , "Souza, Jose" , "bjorn.andersson@linaro.org" , "krzysztof.kozlowski+dt@linaro.org" , "hbh25y@gmail.com" , "Vasut, Marek" , "Dixit, Ashutosh" , "sean@poorly.run" , "abhinavk@codeaurora.org" , "javierm@redhat.com" , "Murthy, Arun R" , "Lisovskiy, Stanislav" , "agross@kernel.org" , "quic_jesszhan@quicinc.com" , "Nautiyal, Ankit K" , "Nikula, Jani" , "De Marchi, Lucas" , "quic_abhinavk@quicinc.com" , "swboyd@chromium.org" , "robh+dt@kernel.org" , "christophe.jaillet@wanadoo.fr" , "maxime@cerno.tech" , "Vivi, Rodrigo" , "johan+linaro@kernel.org" , "tvrtko.ursulin@linux.intel.com" , "andersson@kernel.org" , "dianders@chromium.org" , "Sharma, Swati2" , "Navare, Manasi D" , "tzimmermann@suse.de" , "Modem, Bhanuprakash" , "dmitry.baryshkov@linaro.org" , "seanpaul@chromium.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 23, 2023 at 3:18=E2=80=AFAM Kandpal, Suraj wrote: > > > > > -----Original Message----- > > From: Kandpal, Suraj > > Sent: Friday, March 10, 2023 1:55 PM > > To: Mark Yacoub ; quic_khsieh@quicinc.com; > > linux-arm-msm@vger.kernel.org; dri-devel@lists.freedesktop.org; > > freedreno@lists.freedesktop.org; devicetree@vger.kernel.org; linux- > > kernel@vger.kernel.org; intel-gfx@lists.freedesktop.org > > Cc: quic_sbillaka@quicinc.com; konrad.dybcio@somainline.org; Souza, Jos= e > > ; bjorn.andersson@linaro.org; > > krzysztof.kozlowski+dt@linaro.org; hbh25y@gmail.com; Vasut, Marek > > ; Dixit, Ashutosh ; > > sean@poorly.run; abhinavk@codeaurora.org; javierm@redhat.com; Murthy, > > Arun R ; Lisovskiy, Stanislav > > ; agross@kernel.org; > > quic_jesszhan@quicinc.com; Nautiyal, Ankit K ; > > Nikula, Jani ; De Marchi, Lucas > > ; quic_abhinavk@quicinc.com; > > swboyd@chromium.org; robh+dt@kernel.org; > > christophe.jaillet@wanadoo.fr; maxime@cerno.tech; Vivi, Rodrigo > > ; johan+linaro@kernel.org; > > tvrtko.ursulin@linux.intel.com; andersson@kernel.org; > > dianders@chromium.org; Sharma, Swati2 ; > > Navare, Manasi D ; tzimmermann@suse.de; > > Modem, Bhanuprakash ; > > dmitry.baryshkov@linaro.org; seanpaul@chromium.org > > Subject: RE: [PATCH v6 06/10] drm/i915/hdcp: Retain hdcp_capable return > > codes > > > > > Subject: [PATCH v6 06/10] drm/i915/hdcp: Retain hdcp_capable return > > > codes > > > > > > From: Sean Paul > > > > > > The shim functions return error codes, but they are discarded in > > > intel_hdcp.c. This patch plumbs the return codes through so they are > > > properly handled. > > > > > > Acked-by: Jani Nikula > > > Reviewed-by: Rodrigo Vivi > > > Signed-off-by: Sean Paul > > > Signed-off-by: Mark Yacoub > > > Link: > > > https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-7- > > > sean@poorly.run #v1 > > > Link: > > > https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-7- > > > sean@poorly.run #v2 > > > Link: > > > https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-7- > > > sean@poorly.run #v3 > > > Link: > > > > > https://patchwork.freedesktop.org/patch/msgid/20211105030434.2828845- > > > 7-sean@poorly.run #v4 > > > Link: > > > > > https://patchwork.freedesktop.org/patch/msgid/20220411204741.1074308- > > > 7-sean@poorly.run #v5 > > > > > > Changes in v2: > > > -None > > > Changes in v3: > > > -None > > > Changes in v4: > > > -None > > > Changes in v5: > > > -None > > > Changes in v6: > > > -Rebased > > > > > > --- > > > .../drm/i915/display/intel_display_debugfs.c | 9 +++- > > > drivers/gpu/drm/i915/display/intel_hdcp.c | 51 ++++++++++-------= -- > > > drivers/gpu/drm/i915/display/intel_hdcp.h | 4 +- > > > 3 files changed, 37 insertions(+), 27 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > > b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > > index 7c7253a2541c..13a4153bb76e 100644 > > > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > > @@ -492,6 +492,7 @@ static void intel_panel_info(struct seq_file *m, > > > static void intel_hdcp_info(struct seq_file *m, > > > struct intel_connector *intel_connector) { > > > + int ret; > > > bool hdcp_cap, hdcp2_cap; > > > > > > if (!intel_connector->hdcp.shim) { > > > @@ -499,8 +500,12 @@ static void intel_hdcp_info(struct seq_file *m, > > > goto out; > > > } > > > > > > - hdcp_cap =3D intel_hdcp_capable(intel_connector); > > > - hdcp2_cap =3D intel_hdcp2_capable(intel_connector); > > > + ret =3D intel_hdcp_capable(intel_connector, &hdcp_cap); > > > + if (ret) > > > + hdcp_cap =3D false; > > > + ret =3D intel_hdcp2_capable(intel_connector, &hdcp2_cap); > > > + if (ret) > > > + hdcp2_cap =3D false; > > > > > > > This does not seem to be adding value here as this error which you refe= rred > > to as being ignored is used both in case of hdmi and dp is being to det= ermine > > if hdcp_cap or hdcp2 cap is true or false which you basically reiterate= here too > > check the intel_dp_hdcp2_capable and intel_hdmi_hdcp2_capable . > > this change in itself can be removed. > > > > Regards, > > Suraj Kandpal > > Hey Suraj, what we're trying to do here is to have a distinction between 2 things: 1. were we able to check of the capability or not. like did the connection work well 2. if the check went well, what capability were were able to read We may or may not need both info. But since we moved to common DRM, it might be best keep the distinction and each driver can handle it as it sees fit. > > > if (hdcp_cap) > > > seq_puts(m, "HDCP1.4 "); > > > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c > > > b/drivers/gpu/drm/i915/display/intel_hdcp.c > > > index 0a20bc41be55..61a862ae1f28 100644 > > > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c > > > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c > > > @@ -177,50 +177,49 @@ int intel_hdcp_read_valid_bksv(struct > > > intel_digital_port *dig_port, } > > > > > > /* Is HDCP1.4 capable on Platform and Sink */ -bool > > > intel_hdcp_capable(struct intel_connector *connector) > > > +int intel_hdcp_capable(struct intel_connector *connector, bool > > > +*capable) > > > { > > > struct intel_digital_port *dig_port =3D > > > intel_attached_dig_port(connector); > > > const struct intel_hdcp_shim *shim =3D connector->hdcp.shim; > > > - bool capable =3D false; > > > u8 bksv[5]; > > > > > > + *capable =3D false; > > > + > > > if (!shim) > > > - return capable; > > > + return 0; > > > > > > - if (shim->hdcp_capable) { > > > - shim->hdcp_capable(dig_port, &capable); > > > - } else { > > > - if (!intel_hdcp_read_valid_bksv(dig_port, shim, bksv)) > > > - capable =3D true; > > > - } > > > + if (shim->hdcp_capable) > > > + return shim->hdcp_capable(dig_port, capable); > > > + > > > + if (!intel_hdcp_read_valid_bksv(dig_port, shim, bksv)) > > > + *capable =3D true; > > > > > > - return capable; > > > + return 0; > > > } > > > > > > /* Is HDCP2.2 capable on Platform and Sink */ -bool > > > intel_hdcp2_capable(struct intel_connector *connector) > > > +int intel_hdcp2_capable(struct intel_connector *connector, bool > > > +*capable) > > > { > > > struct intel_digital_port *dig_port =3D > > > intel_attached_dig_port(connector); > > > struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev= ); > > > struct intel_hdcp *hdcp =3D &connector->hdcp; > > > - bool capable =3D false; > > > + > > > + *capable =3D false; > > > > > > /* I915 support for HDCP2.2 */ > > > if (!hdcp->hdcp2_supported) > > > - return false; > > > + return 0; > > > > > > /* MEI interface is solid */ > > > mutex_lock(&dev_priv->display.hdcp.comp_mutex); > > > if (!dev_priv->display.hdcp.comp_added || !dev_priv- > > > >display.hdcp.master) { > > > mutex_unlock(&dev_priv->display.hdcp.comp_mutex); > > > - return false; > > > + return 0; > > > } > > > mutex_unlock(&dev_priv->display.hdcp.comp_mutex); > > > > > > /* Sink's capability for HDCP2.2 */ > > > - hdcp->shim->hdcp_2_2_capable(dig_port, &capable); > > > - > > > - return capable; > > > + return hdcp->shim->hdcp_2_2_capable(dig_port, capable); > > > } > > > > > > static bool intel_hdcp_in_use(struct drm_i915_private *dev_priv, @@ = - > > > 2355,6 +2354,7 @@ int intel_hdcp_enable(struct intel_connector > > > *connector, > > > struct intel_digital_port *dig_port =3D > > > intel_attached_dig_port(connector); > > > struct intel_hdcp *hdcp =3D &connector->hdcp; > > > unsigned long check_link_interval =3D > > DRM_HDCP_CHECK_PERIOD_MS; > > > + bool capable; > > > int ret =3D -EINVAL; > > > > > > if (!hdcp->shim) > > > @@ -2373,21 +2373,27 @@ int intel_hdcp_enable(struct intel_connector > > > *connector, > > > * Considering that HDCP2.2 is more secure than HDCP1.4, If the > > > setup > > > * is capable of HDCP2.2, it is preferred to use HDCP2.2. > > > */ > > > - if (intel_hdcp2_capable(connector)) { > > > + ret =3D intel_hdcp2_capable(connector, &capable); > > > + if (capable) { > > > ret =3D _intel_hdcp2_enable(connector); > > > - if (!ret) > > > + if (!ret) { > > > check_link_interval =3D > > > DRM_HDCP2_CHECK_PERIOD_MS; > > > + goto out; > > > + } > > HI, > Just noticed another changed here if any error is returned with intel_hdc= 2_capable > You directly jump to out which will stop us from enabling hdcp 1.4 we sho= uld check > for hdcp 1.4 capability even if hdcp 2.2 capability is returned with an e= rror one other > reason I don't think the handling of error codes are adding value here. > > Regards, > Suraj Kandpal Hey Suraj - the goto happens if we know that the device is hdcp2 capable. If it's capable, we do enable it. If we have no error returned, that's when we skip hdcp1.4 otherwise, if it's not capable, or the enable returned with an error code, we don't goto out but move on to try on hdcp 1.4 Thanks! > > > } > > > > > > /* > > > * When HDCP2.2 fails and Content Type is not Type1, HDCP1.4 will > > > * be attempted. > > > */ > > > - if (ret && intel_hdcp_capable(connector) && > > > - hdcp->content_type !=3D DRM_MODE_HDCP_CONTENT_TYPE1) { > > > + ret =3D intel_hdcp_capable(connector, &capable); > > > + if (ret) > > > + goto out; > > > + > > > + if (capable && hdcp->content_type !=3D > > > DRM_MODE_HDCP_CONTENT_TYPE1) > > > ret =3D _intel_hdcp_enable(connector); > > > - } > > > > > > +out: > > > if (!ret) { > > > schedule_delayed_work(&hdcp->check_work, > > > check_link_interval); > > > intel_hdcp_update_value(connector, > > > @@ -2395,7 +2401,6 @@ int intel_hdcp_enable(struct intel_connector > > > *connector, > > > true); > > > } > > > > > > -out: > > > mutex_unlock(&dig_port->hdcp_mutex); > > > mutex_unlock(&hdcp->mutex); > > > return ret; > > > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h > > > b/drivers/gpu/drm/i915/display/intel_hdcp.h > > > index 7c5fd84a7b65..f06f6e5a2b1a 100644 > > > --- a/drivers/gpu/drm/i915/display/intel_hdcp.h > > > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.h > > > @@ -33,8 +33,8 @@ void intel_hdcp_update_pipe(struct > > > intel_atomic_state *state, > > > const struct intel_crtc_state *crtc_state, > > > const struct drm_connector_state *conn_state)= ; > > bool > > > is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port); > > > -bool intel_hdcp_capable(struct intel_connector *connector); -bool > > > intel_hdcp2_capable(struct intel_connector *connector); > > > +int intel_hdcp_capable(struct intel_connector *connector, bool > > > +*capable); int intel_hdcp2_capable(struct intel_connector *connector= , > > > +bool *capable); > > > void intel_hdcp_component_init(struct drm_i915_private *dev_priv); > > > void intel_hdcp_component_fini(struct drm_i915_private *dev_priv); > > > void intel_hdcp_cleanup(struct intel_connector *connector); > > > -- > > > 2.39.0.246.g2a6d74b583-goog >