Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2354754pxb; Fri, 5 Feb 2021 16:11:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbcwIqYeQbuNRWefFUPNm1IKLoGknGmL8ivBceqbkcdLTtjkHFPIVvKFw2SnAHdgm1dvTe X-Received: by 2002:a17:906:d18e:: with SMTP id c14mr6431804ejz.302.1612570291380; Fri, 05 Feb 2021 16:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612570291; cv=none; d=google.com; s=arc-20160816; b=x8PjN2xWzlFB7KM01PhdvFpBjZOboa7XTclLmKIBPvpwTENR2uebq9ayOEmKpZby2C AutW7ZpX5WXulA0KA5GZXyZw7oEMcYuwYjs2PeAdIC1HfLMyBcG2xovcjOepL4A4Q7aL 5tIEa2wWH+7i8XPlfQAx/6oFYNf0ZtgypjzBwSMdZ81Da266ar+ndl+kQJ0rIYdkuNN9 U306gVa+m2zL2G8icfOxjBdG2fT1cOWawIADGX9TOzswySwk1Pq/e8136TXh/ryfIZ4o cSrPzXgUDD3V7OV8tymOPNDwDgjBGHw7ZXY8tyk18aerFS2WcPoSuvUBiQuxeLu/mrrC Ykag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=eeIQ3lc6028oLMlea4AHNdLl0tt2BQ1HMogC4rAypDI=; b=wpcJ1UzIX7InKzMGf+1ERDapZXoeTf/naYUihwBoxcU9bMAzPFAmKR7DRoZNxs5kRU CPmy6MH0nkdpKkZrrjrA5W9OzJT0frqvY2QXZVVLaI/JXNoxnSFL9pkqSjLHblhrsGi1 ISWe9YyKLUKoIAHQpPdiFq2Dm6Utp7N675iym3K9zxJCktSCVJIELCBfw++9hdGkgTBi PVqje56P6Xt72dHiKURawowvtPFkv1S9uFXqXdWwx9aoxfp+tBuRXk86YK94xMS2dbT5 KaVUbP5C+OSrfnDXu0jS5JbBK4CDXs7spfn7v7E6QuAzbMrzOeKLuIfxusySktSaINKU I6qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s2 header.b=QXVUNaAT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq1si6064084ejb.675.2021.02.05.16.11.06; Fri, 05 Feb 2021 16:11:31 -0800 (PST) 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; dkim=pass header.i=@xs4all.nl header.s=s2 header.b=QXVUNaAT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbhBFAHq (ORCPT + 99 others); Fri, 5 Feb 2021 19:07:46 -0500 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:57677 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbhBENsL (ORCPT ); Fri, 5 Feb 2021 08:48:11 -0500 Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud9.xs4all.net with ESMTPA id 81RclTJVeFFpm81RglH0Uh; Fri, 05 Feb 2021 14:46:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s2; t=1612532809; bh=eeIQ3lc6028oLMlea4AHNdLl0tt2BQ1HMogC4rAypDI=; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=QXVUNaAT1tII5aFDk+cPR8pJYdtQgXYC6klZDolwlsOsOcOtMcYruZwvaYPoLxCp3 bfZGWpZWYMLUa1r+Vkit1r45mKmGycy0z9+BChbGO1uFFzTrsugaZQy5UkmiDPzfkN Qx4EL0yU37Li6HA4uSZQz+Lp8L0PcwHSrwMhaIiYhnoC5cqLFeiOMEYnIICROjpjGC mXwY9uy+oPn+F17WWxDL/TYwwwP74y1uMwirFXg0PJ6pw/TkooBsLoxhcQ0yDa0vZ6 CyTlMqKIIJzmQEE35EygcZKFXjLxs8GChTlgkmbENglKUl9CAHKsO57ZCuuKQUp+Nw aO13Xc+6FR7bw== Subject: Re: [PATCH v3 2/4] drm_dp_mst_topology: use correct AUX channel To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Sam McNally Cc: LKML , Thomas Zimmermann , David Airlie , Hans Verkuil , dri-devel@lists.freedesktop.org References: <20200923121320.v3.1.I8693156f555875e5c8342e86ab37ce968dfdd277@changeid> <20200923121320.v3.2.Ided0ab0808c4908238bd2eb9ebb6ffb2c9312789@changeid> <2a7c2edc-b83c-dccf-487d-1415b4bc23ff@xs4all.nl> From: Hans Verkuil Message-ID: Date: Fri, 5 Feb 2021 14:46:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfF/2LkHUBR6Sj5FcCmtu5nSjDtH0gXnDX48kOwSB2540xv2DzasTmniuBdVtNsBlQec0ezWIItZKJZVotxicsO8IKSyPnZpsIJauJsqzAvJDL62upT2c 3nEQGLoRVxVe9PS4j5SXwaaEbtesNJksIRkjsdC5LZGKs80/IRoVWTdRzXRqtn2cD3f/1dbCwaVvWXNzv2G9EYv0e2mO4A7RgBwkncLqWc8W+/y+0gpFFk1E xCzTOOpZtwXm5xDH+kRAhQW9OesbT9rSKmjZU1rkPu3YPzYsb2X4b6T02rq8YwQk3lKLzwX8LjLcf4QvJVeyQOTKfXRS9KNt+wfvhcVJHpl3UpszBFZVjA+G 6hT1EtSnM959b3M6T6cKpeY6jAbejDWyDJDOuDUWEOaHTu1/B7OT+vFTpHBpmizJS8NzussN Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/02/2021 14:24, Ville Syrjälä wrote: > On Fri, Feb 05, 2021 at 04:17:51PM +1100, Sam McNally wrote: >> On Thu, 4 Feb 2021 at 21:19, Hans Verkuil wrote: >>> >>> On 01/02/2021 23:13, Ville Syrjälä wrote: >>>> On Wed, Sep 23, 2020 at 12:13:53PM +1000, Sam McNally wrote: >>>>> From: Hans Verkuil >>>>> >>>>> For adapters behind an MST hub use the correct AUX channel. >>>>> >>>>> Signed-off-by: Hans Verkuil >>>>> [sammc@chromium.org: rebased, removing redundant changes] >>>>> Signed-off-by: Sam McNally >>>>> --- >>>>> >>>>> (no changes since v1) >>>>> >>>>> drivers/gpu/drm/drm_dp_mst_topology.c | 36 +++++++++++++++++++++++++++ >>>>> 1 file changed, 36 insertions(+) >>>>> >>>>> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c >>>>> index 15b6cc39a754..0d753201adbd 100644 >>>>> --- a/drivers/gpu/drm/drm_dp_mst_topology.c >>>>> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c >>>>> @@ -2255,6 +2255,9 @@ drm_dp_mst_topology_unlink_port(struct drm_dp_mst_topology_mgr *mgr, >>>>> drm_dp_mst_topology_put_port(port); >>>>> } >>>>> >>>>> +static ssize_t >>>>> +drm_dp_mst_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg); >>>>> + >>>>> static struct drm_dp_mst_port * >>>>> drm_dp_mst_add_port(struct drm_device *dev, >>>>> struct drm_dp_mst_topology_mgr *mgr, >>>>> @@ -2271,9 +2274,13 @@ drm_dp_mst_add_port(struct drm_device *dev, >>>>> port->port_num = port_number; >>>>> port->mgr = mgr; >>>>> port->aux.name = "DPMST"; >>>>> + mutex_init(&port->aux.hw_mutex); >>>>> + mutex_init(&port->aux.cec.lock); >>>>> port->aux.dev = dev->dev; >>>>> port->aux.is_remote = true; >>>>> >>>>> + port->aux.transfer = drm_dp_mst_aux_transfer; >>>>> + >>>> >>>> This was supposed to be handled via higher levels checking for >>>> is_remote==true. >>> >>> Ah, I suspect this patch can be dropped entirely: it predates commit 2f221a5efed4 >>> ("drm/dp_mst: Add MST support to DP DPCD R/W functions"). >>> >>> It looks like that commit basically solved what this older patch attempts to do >>> as well. >>> >>> Sam, can you test if it works without this patch? >> >> It almost just works; drm_dp_cec uses whether aux.transfer is non-null >> to filter out non-DP connectors. Using aux.is_remote as another signal >> indicating a DP connector seems plausible. We can drop this patch. > > Why would anyone even call this stuff on a non-DP connector? > And where did they even get the struct drm_dp_aux to do so? This check came in with commit 5ce70c799ac2 ("drm_dp_cec: check that aux has a transfer function"). It seems nouveau and amdgpu specific. A better approach would be to fix those drivers to only call these cec functions for DP outputs. I think I moved the test to drm_dp_cec.c primarily for robustness (i.e. do nothing if called for a non-DP output). But that might not be the right approach after all. Regards, Hans > >> Thanks all! >>> >>> Regards, >>> >>> Hans >>> >>>> >>>>> /* initialize the MST downstream port's AUX crc work queue */ >>>>> drm_dp_remote_aux_init(&port->aux); >>>>> >>>>> @@ -3503,6 +3510,35 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr, >>>>> return 0; >>>>> } >>>>> >>>>> +static ssize_t >>>>> +drm_dp_mst_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) >>>>> +{ >>>>> + struct drm_dp_mst_port *port = >>>>> + container_of(aux, struct drm_dp_mst_port, aux); >>>>> + int ret; >>>>> + >>>>> + switch (msg->request & ~DP_AUX_I2C_MOT) { >>>>> + case DP_AUX_NATIVE_WRITE: >>>>> + case DP_AUX_I2C_WRITE: >>>>> + case DP_AUX_I2C_WRITE_STATUS_UPDATE: >>>>> + ret = drm_dp_send_dpcd_write(port->mgr, port, msg->address, >>>>> + msg->size, msg->buffer); >>>> >>>> That doesn't make sense to me. I2c writes and DPCD writes >>>> are definitely not the same thing. >>>> >>>> aux->transfer is a very low level thing. I don't think it's the >>>> correct level of abstraction for sideband. >>>> >>>>> + break; >>>>> + >>>>> + case DP_AUX_NATIVE_READ: >>>>> + case DP_AUX_I2C_READ: >>>>> + ret = drm_dp_send_dpcd_read(port->mgr, port, msg->address, >>>>> + msg->size, msg->buffer); >>>>> + break; >>>>> + >>>>> + default: >>>>> + ret = -EINVAL; >>>>> + break; >>>>> + } >>>>> + >>>>> + return ret; >>>>> +} >>>>> + >>>>> static int drm_dp_get_vc_payload_bw(u8 dp_link_bw, u8 dp_link_count) >>>>> { >>>>> if (dp_link_bw == 0 || dp_link_count == 0) >>>>> -- >>>>> 2.28.0.681.g6f77f65b4e-goog >>>>> >>>>> _______________________________________________ >>>>> dri-devel mailing list >>>>> dri-devel@lists.freedesktop.org >>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel >>>> >>> >