Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1606399lqe; Mon, 8 Apr 2024 14:14:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlCkabxJDupBqePHymESz/bJKQdw8eSd60xqxgFIqgIMHj44EHAYoQKkFhRoIW17j8+sWhaqmqsLNqYqYMm4xYmGlzBXOvDEBWYHXqmg== X-Google-Smtp-Source: AGHT+IEAE4YoTSje/aIDni0ahASSZXLLBIrR1BvsaYKQh8F3Qvsc1d0t4GrhL+Wi/EBnRUt7T/vX X-Received: by 2002:a05:6870:46a1:b0:22e:8e17:c9c5 with SMTP id a33-20020a05687046a100b0022e8e17c9c5mr12175289oap.13.1712610877735; Mon, 08 Apr 2024 14:14:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712610877; cv=pass; d=google.com; s=arc-20160816; b=p5OrJ+A8Q7QB4ZwE/LVq+loZ7F9usTFrfM15WJqIolEP9o/yLBC2ICdkwOpSzYcEBN QKaooFPZ+1zcDm+ROJKBDD3v6LDckKYklQbrXgQNbU575UicaNJNZ2cUtQQpQbHyFqqj n51VhPN65JTzPnJRS8VbXNTqluOzUfbs2Dap/aYB7t5Kgs2qAjH3Za/6ZMyTklFnMjW9 WCa4fbPAbikFiV2PIeP8dQJRpGYlAqwwINmvPIyYgvd/va2bymfnjkAXrzHhuwA7he8G tob2MWLTs+F6B/h2sAYRKGMASUP3YEpdaKDVrUM8MZNC9Hcdf0iAd8khM1GEKGTgGFii vkLQ== 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=9H/wJYl3v6Nf1hcV5ZGzgLNZ6Hl7Vc5YVwplWIJ86fg=; fh=Z7JMJSy5JpKtb3NZsbMPQmZWnB9VgFVfCJ2V0kAKvCI=; b=jk0zBjavDC01IwoAjuKVzm99wuMjlyMY1FbfONCn5co0wbsZjnoF4BZDismUFtwP+O y+SmxyFe/Ym2fFPsACb+kHQ7zGHkIkC+DEevhpEPMPN743kM61yezusxNsMMIpcUMF1F xxjaswRMfLLD6dg4GGmmwULoTbQNNH0r5EZs+1c0+r7Uc4paou4i3C3ADaXkABG7d1g+ 3ZD7CDmytzxlG0FtH8Po/rdu0BSuPx5XqIzw1v0KXQibPpd5Mq5s2Ecq7rjkG+1mPJmb 3dRWc5dl4K2+/m6tFtxMntXkyNdhP9MSncWeTbeQRGsfM39EVn2KxOH7+MvqnTFZ/SKS YEkw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xFcQfoFd; 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-135933-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ld16-20020a056a004f9000b006ed5a4d0e1asi1562980pfb.114.2024.04.08.14.14.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 14:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135933-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xFcQfoFd; 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-135933-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135933-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 24FC2282737 for ; Mon, 8 Apr 2024 21:14:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDE42147C6F; Mon, 8 Apr 2024 21:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xFcQfoFd" Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (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 288837E8 for ; Mon, 8 Apr 2024 21:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712610844; cv=none; b=qHImwKc4gt8pLwV2fzPZQBZHg0uZPm/zs38L/wGhTEa87h1QTst1Q1o0jzo1qLrXvn1emyt3CUAIGdTf88ao95TvwngI7aE0vfut3EPB2wkQu5uqtZ/5w3OnAywZWk3lr99vYCluFSyAcyNpox75IiftGT5TNcooz642tntfyzA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712610844; c=relaxed/simple; bh=JVukTz5MbqkHdCQ0GujdpyPi+ERWJVOdSTb+ewBrKnk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=k8cGgKbDPaE/o8HsFEXVhi873jk3fI8EV6qzpZtoOku3/5ez0xY2nJIcBuZNTVwhn9xsN0cH8zGzP0W7o8nwC7mV3k7TjmiIFxYAKy6vArVIvCZyrpIx/dVfsLjUR8HVqOVfKwry/wSYAS5oJ85d1Yuf5RDkhtlxmRPBNGhqptg= 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=xFcQfoFd; arc=none smtp.client-ip=209.85.128.182 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-yw1-f182.google.com with SMTP id 00721157ae682-614ec7ee902so51366377b3.2 for ; Mon, 08 Apr 2024 14:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712610840; x=1713215640; 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=9H/wJYl3v6Nf1hcV5ZGzgLNZ6Hl7Vc5YVwplWIJ86fg=; b=xFcQfoFdgDV4AfaH9BHpzATz5eHaXaotnDjZD9NJh8onIIveDwY20PVj/Uvu5u9VHP Rqg38H/ygH3HRtyDkeS8hSugELwr0wMKTklz/o0IiwUSaa+TnDZhgf4Lr8tQLRZiWuAc AHuur5sjz9tEiShfivbM1s0itSi5AfrDpZ7DIaxdMeaE0YW32mbif5OTS0S3iGaAwLMf PDHXgg3k5q+KgLlZezPQPuIlVOml66AL/4FhJ2NHa4l1l28s5xzcbhXCCq5ZO2GcpPKg dpFuonF8TnF8s5unh9e+hzwtQ/hSoPv0ba5PnOmMdfQTqVS6LUpWJOfkITy+OE99xCFl Rjzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712610840; x=1713215640; 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=9H/wJYl3v6Nf1hcV5ZGzgLNZ6Hl7Vc5YVwplWIJ86fg=; b=d3hEZmKCnLtY+Vym1EW5gOcB91F+8kk4crsjAl0IUNrhXF4QJLaOtS1emhpBDuYVWj lzCnl8rgi1ZEeClIkxUMJkOZE8zVoEZwEEDGA750RMhkD11ayDQuMDP8tUzKoS7pysyB lVYFQLr0YopeZfU0yDHcr+Ff9ZZpOTe1GoUDFzkY2PdvPqS2x8DTARmcXv/yoBNaV56w 8r6evcFa5tKIFCCJiIEY5ZMfVQLjG8fvHnUx7PBFNQ5xrgU08AlRyST+0v9gQp/HXPtA 9saby8Yx/+bbwwnObjBhXGwByAc/Rv9jejIGA14XDRg2aE1rSZt4YwF0NGsL2W58lJSg d1Ig== X-Forwarded-Encrypted: i=1; AJvYcCVIw86UW19HDi52/BSdrtymyqdzYjlVmBCjDMANG43wkB2Fuy2upPBjIXGntrRF1FIhNOiTXeNUKC6rd+esqyKUMPeUuXtttZwgRfqt X-Gm-Message-State: AOJu0YxEdqIktiCbnUwCPMRHvB0EmG0Ccqln+rScNKdApaiGRe8Has0v /jvO2JpSss7whcTZpD4FzuENwrmL8dSpIyqSLs+LHqz4xCvQN8ex2O2vkEOjv6l0tHFpShj72l2 AAdwYmmkQwjPu17Bs+CrF9QSUzJf9bPs5NkuS+Q== X-Received: by 2002:a25:5f42:0:b0:dca:59a7:896b with SMTP id h2-20020a255f42000000b00dca59a7896bmr7293567ybm.50.1712610839753; Mon, 08 Apr 2024 14:13:59 -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> In-Reply-To: From: Dmitry Baryshkov Date: Tue, 9 Apr 2024 00:13:48 +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:08, Abhinav Kumar wrote: > > > > On 4/8/2024 1:41 PM, Bjorn Andersson wrote: > > On Mon, Apr 08, 2024 at 12:43:34PM -0700, 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. > >> > >> 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. > >> > > > > I did some more testing on this patch. Connecting and disconnecting the > > cable while in fbcon works reliably, except for: > > Thanks for the tests ! > > > - edid/modes are not read before we bring up the link so I always end up > > with 640x480 > > > > hmmm, I wonder why this should be affected due to this patch. We always > read the EDID during hpd_connect() and the selected resolution will be > programmed with the modeset. We will retry this with our x1e80100 and see. BTW, why is EDID read during HPD handling? I always supposed that it can be read much later, when the DRM framework calls the get_modes / get_edid callbacks. > > > - if I run modetest -s : the link is brought up with the new > > resolution and I get my test image on the screen. > > But as we're shutting down the link for the resolution chance I end up > > in dp_bridge_hpd_notify() with link_ready && state = disconnected. > > This triggers an unplug which hangs on the event_mutex, such that as > > soon as I get the test image, the state machine enters > > DISCONNECT_PENDING. This is immediately followed by another > > !link_ready && status = connected, which attempts to perform the plug > > operation, but as we're in DISCONNECT_PENDING this is posted on the > > event queue. From there I get a log entry from my PLUG_INT, every > > 100ms stating that we're still in DISCONNECT_PENDING. If I exit > > modetest the screen goes black, and no new mode can be selected, > > because we're in DISCONNECT_PENDING. The only way out is to disconnect > > the cable to complete the DISCONNECT_PENDING. > > > > I am going to run this test-case and see what we can do. > > > Regards, > > Bjorn > > > >> > >>>> 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