Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1629241lqe; Mon, 8 Apr 2024 15:08:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSdRP6XtrkUp7EwKycck5JmzboiD55hbP5ui7/jbN3DOkrcqwVOvX2I44asZg3VdtN3pRF+pFsI3MW3Zs5UEzkDsNwvinhafYRPqajcA== X-Google-Smtp-Source: AGHT+IG+sC7OOp1WmSxwzl0oQzYlaIPfqx/CpsXLTW4LI0iEnn2oOlCqt0My311TwawhKRsmsLmZ X-Received: by 2002:a54:4e95:0:b0:3c5:ee94:414 with SMTP id c21-20020a544e95000000b003c5ee940414mr6109094oiy.51.1712614136914; Mon, 08 Apr 2024 15:08:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712614136; cv=pass; d=google.com; s=arc-20160816; b=RTmM+ykB8ofe6TxyfvV0/OWJ85s81JjluII9QO8UMmhfUVUJL5367DqB0HyccqYPk1 3lUhz9TInQvuRxlG7dY2NHMHOXzt/0agRtajnUvUrIzRAnw8B92P2Pxo62DobDglj6mJ kUncw5TueogqDz46vynkRq2CTOeYly+vFu9xVUiW4elyJJ4GEVVR1PIDBUKUnNh0VV3F RxoP6yaC+4VAACrovkGdnW45KkxW3JOlWhJzm6RVbdppQ3KVGNxOo8rvYj8BytMH6ucC 784zGUL7CZQx7ahQ5biXnrxP2A326Z5CQ7hRY1/H9lB83swBkIgGYjGDnkK/oQiTce35 nxLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=VMPTa7YZG9SFezIxNc9hWe537aXkTHEaz4nODnhs3/4=; fh=Z2drvu690/jy5+eXdMJ/T03C9kURQgyZzNP8tka0uA0=; b=ZcBCPLU3izMVfxWkGUTR6g6f8Gj9PTD4c8dfP0eub4dqm8e/oAjc8TxpesnSFSfzCu KGKEKbk8S/NOAQZ0KOb4jUWMrTnAnBrJ5F5FbihVIb1fItifw24G19HUm/8/Afdgbegu 9kA+rsl894D/D7mPg1GTKRzROudYE5j/rP8r/XSAxIGrXhYHGnsIrJ4xd8/PyNiMnXUG /GQYPM9nzmPse8eSNPpZ8a97DuWfzZHLg3uXDFTRRsviV+VljKMPVqoUOuKWvKALFJOu BNQySyntsBqq6FXYzFEfwEMzTDCLogGbFIhOwcMTedjBOCNGNS/JWpLJ9+2gi3/H4SPi KdBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WPWkWxYP; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-135964-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135964-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g12-20020ac85d4c000000b004346fa49b85si6454506qtx.171.2024.04.08.15.08.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 15:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135964-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WPWkWxYP; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-135964-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135964-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 92C481C21C6A for ; Mon, 8 Apr 2024 22:08:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7EFE1149C5C; Mon, 8 Apr 2024 22:08:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WPWkWxYP" Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CA981494BD for ; Mon, 8 Apr 2024 22:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712614091; cv=none; b=YUVS/a4fGxQ9YwjNUwRZkBqlQ2UQqC0MiJ/zDBLl629yJ6cKpD7JSZdL3WApAnSWRlO0ZzMxTUy4g44/X6dtrcCVWsoYo9Z6jvsfwx+ap2qCh0fP7Ha8e1JAk6E/YSsGlB5yT6H1WoKd2a1bpuiNagh1ntMDbxVtCPsRVIuaqU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712614091; c=relaxed/simple; bh=xxk1gyjbeyUL4zHAyBUPW/iHNjor9ToFngoeLDD2W4A=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=N7/XRuW/6iIOc6+qc8lI6Ae5Ub3kO3u/MltXIG792vV5GXG2gUGx3ky9aAiW4VvmqHDVkVU3v43ICooGev97V/LOFndBzFQsKmhE6qcAtTLoisfykzOSKpB3pw6hXI5vMUKak65Dq7PCN2u/nsf0hSiBqrHKSqcIctQG2/ul4s0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WPWkWxYP; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dd02fb9a31cso4416407276.3 for ; Mon, 08 Apr 2024 15:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712614088; x=1713218888; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VMPTa7YZG9SFezIxNc9hWe537aXkTHEaz4nODnhs3/4=; b=WPWkWxYPUGqy5S1EXVgropEHY/dP5eKtu32DDDXQE8knDID7VcPhk/5d1dSv/VUtPs pfda3hFZGzHo5hU50IPE3qN7gsdnz4SXfd6U+wFq2IGj1og3zh1k/KHK99FasFXgyrYM cHvSHT1fuh6rLEQyWAJEAZDYBp5lhuGiSNpsXZushk9ubvLe5HgDyQOfyoDuJUfkE8zd qQ1vs8sEGzP86C5Kg8U81QJ+HyBf/YvsBL5Z6mP9gH4GJRY6odfT2McaV1miLAxjLY6F jL8P30quyCY+qPLokhxTtfqJBOBf6VABqtc8JMiAAgsVN2pexn3thtq+5+bOXZwYrVsS 4XFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712614088; x=1713218888; h=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=VMPTa7YZG9SFezIxNc9hWe537aXkTHEaz4nODnhs3/4=; b=mGxoV4r3nwkoKHreMxFRFGgcufwsZbNoTldc5vW/oN0kTAwWrtE3rSNazr05dCO+o/ GE6+Gdu5WkL2P0Bwsrs/qfO1alMcb1LkrLjAt6tTNFvN1s2UiH8Wj+lmqEvJaB8Gknqp uX5lE6fj5ayQxYOa3dEjY6Nnydn/endMzeP/h6+t87+EHSVabFytcm98X+D4pef57dLH balr1KDa0zC33n4hjX/cDZ/pRlA0WN31lEavBN9PN9Zpb73NfOfl/NaJmzM6dE8IKL/N nIAUHdJrJ7LO/GvXEQXNau6ajCmc5naXkzKfLxO3uKVhAZttImX6lxyKi5wTuQ1iQ3Kg Ia5A== X-Forwarded-Encrypted: i=1; AJvYcCWP9CGRtE6B+oMu2wq9HXjVLkO+NIYo6xex6mpkGfzgQGU6EFm/VLj0esXcmbkap8ht+zKr3JMCmDxTob9yMppmBpXK34HKL43MHJSf X-Gm-Message-State: AOJu0Yy21aFJxpijUaUjeHyarBl+FwuR2gCZzCAsienIfAtrdTfNXfA3 d7gTQ07Bc3p8W4Bkok4g2q7FF+XD9naLW4D4Q6R1eSpdVPSZXWWDH5OjOHfkMwBYwIjZIPdTH6H r0X4sIYfX+W0gjeBRQsMThupBpSDKOMHHWT6C5A== X-Received: by 2002:a25:48ca:0:b0:dc6:9daf:35c7 with SMTP id v193-20020a2548ca000000b00dc69daf35c7mr7528021yba.28.1712614088530; Mon, 08 Apr 2024 15:08:08 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240406031548.25829-1-quic_abhinavk@quicinc.com> <01cb1c0d-a801-37f9-2f55-2bbd8d3a68b9@quicinc.com> <905222ad-612a-3eaf-d966-23c89c99e1f0@quicinc.com> In-Reply-To: <905222ad-612a-3eaf-d966-23c89c99e1f0@quicinc.com> From: Dmitry Baryshkov Date: Tue, 9 Apr 2024 01:07:57 +0300 Message-ID: Subject: Re: [PATCH v3] drm/msm/dp: call dp_hpd_plug_handle()/unplug_handle() directly for external HPD To: Abhinav Kumar Cc: Bjorn Andersson , freedreno@lists.freedesktop.org, Rob Clark , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , dri-devel@lists.freedesktop.org, seanpaul@chromium.org, swboyd@chromium.org, quic_jesszhan@quicinc.com, quic_bjorande@quicinc.com, johan@kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 9 Apr 2024 at 00:23, Abhinav Kumar wrote: > > > > On 4/8/2024 2:12 PM, Dmitry Baryshkov wrote: > > On Mon, 8 Apr 2024 at 22:43, Abhinav Kumar wrote: > >> > >> > >> > >> On 4/7/2024 11:48 AM, Bjorn Andersson wrote: > >>> On Fri, Apr 05, 2024 at 08:15:47PM -0700, Abhinav Kumar wrote: > >>>> From: Kuogee Hsieh > >>> [..] > >>>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > >>>> index d80f89581760..bfb6dfff27e8 100644 > >>>> --- a/drivers/gpu/drm/msm/dp/dp_display.c > >>>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c > >>>> @@ -1665,7 +1665,7 @@ void dp_bridge_hpd_notify(struct drm_bridge *bridge, > >>>> return; > >>>> > >>>> if (!dp_display->link_ready && status == connector_status_connected) > >>>> - dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0); > >>>> + dp_hpd_plug_handle(dp, 0); > >>> > >>> If I read the code correctly, and we get an external connect event > >>> inbetween a previous disconnect and the related disable call, this > >>> should result in a PLUG_INT being injected into the queue still. > >>> > >>> Will that not cause the same problem? > >>> > >>> Regards, > >>> Bjorn > >>> > >> > >> Yes, your observation is correct and I had asked the same question to > >> kuogee before taking over this change and posting. > > > > Should it then have the Co-developed-by trailers? > > > > hmmm, perhaps but that didnt result in any code change between v2 and > v3, so I didnt add it. So who authored v0 of it? From your text I had an impression that it was Kuogee. Please excuse me if I was wrong. > > >> We will have to handle that case separately. I don't have a good > >> solution yet for it without requiring further rework or we drop the > >> below snippet. > >> > >> if (state == ST_DISCONNECT_PENDING) { > >> /* wait until ST_DISCONNECTED */ > >> dp_add_event(dp, EV_HPD_PLUG_INT, 0, 1); /* delay = 1 */ > >> mutex_unlock(&dp->event_mutex); > >> return 0; > >> } > >> > >> I will need sometime to address that use-case as I need to see if we can > >> handle that better and then drop the the DISCONNECT_PENDING state to > >> address this fully. But it needs more testing. > >> > >> But, we will need this patch anyway because without this we will not be > >> able to fix even the most regular and commonly seen case of basic > >> connect/disconnect receiving complementary events. > > > > Hmm, no. We need to drop the HPD state machine, not to patch it. Once > > the driver has proper detect() callback, there will be no > > complementary events. That is a proper way to fix the code, not these > > kinds of band-aids patches. > > > > I had discussed this part too :) > > I totally agree we should fix .detect()'s behavior to just match cable > connect/disconnect and not link_ready status. > > But that alone would not have fixed this issue. If HPD thread does not > get scheduled and plug_handle() was not executed, .detect() would have > still returned old status as we will update the cable status only in > plug_handle() / unplug_handle() to have a common API between internal > and external hpd execution. I think there should be just hpd_notify, which if the HPD is up, attempts to read the DPCD. No need for separate plug/unplug_handle. The detect() can be as simple as !drm_dp_is_branch() || sink_count != 0. > > So we need to do both, make .detect() return correct status AND drop hpd > event thread processing. > > But, dropping the hpd event thread processing alone was fixing the > complimentary events issue. So kuogee had only this part in this patch. I'd prefer to wait for the final patchset then. Which has the HPD thread completely removed. > > > >>>> else if (dp_display->link_ready && status == connector_status_disconnected) > >>>> - dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); > >>>> + dp_hpd_unplug_handle(dp, 0); > >>>> } > >>>> -- > >>>> 2.43.2 > >>>> > > > > > > -- With best wishes Dmitry