Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2853888rdb; Tue, 12 Sep 2023 14:24:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFU7VQgo/foSZ6kY06Ja5NKiJ+UV66x6EMA3QnNTUI4Bb/9KNziBf8BiTQkwCeG2CjKBHPt X-Received: by 2002:a05:6a00:24d4:b0:68e:351b:15b9 with SMTP id d20-20020a056a0024d400b0068e351b15b9mr1079671pfv.4.1694553880669; Tue, 12 Sep 2023 14:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694553880; cv=none; d=google.com; s=arc-20160816; b=SBWqTr1vy8EUbKLZbCHo8zmJShw1bRY+EuMsqNwLtAQfnDBiHZXZ/amPP2TlQ7D87I yF26Mu95ZlE0L5EEpbdTwlO5jBApc5hnDIAUbcIMq5azFljrtQMdRcXJX7PrL/krhpO5 jIKNIofIf5INaDleWWT9QP5ZOlE0ZC77qPVyUvByMbgjf+9n1D7xk+JZXTrdnvjT+5c/ uylSqHGa7WFuThVoHuT1h7LXW4211Um8gpmYuonuFKT6tJ86zx1LVjl2f0nrXbW/XfOr 5qW3JRiaoWvAW+2rPLLcQXqbZH85G8KjvySNBus0jv/91ZEsVGFCy6pNBOcZ2a83EWT7 De1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=qfWN69mP00ualtZXK+0LNWzFxGf625lUtnnMX/7yIhI=; fh=lc7KQfzBulWRrCSQ5kRrrRhZ18+9TMwpcUXQGCUwywY=; b=gFksxjG2aupOMJmPkPWc1F2lzUnlyQg2Yj9x0nwchDNrgDhSIthyTrtTssvkRNreS5 Ci3U0qlDM4N9GKGQ6g51UXg8QZ35xNxfT/4u18n18S0pmspqKddUBDWGNkDyt0z8z3oL YnJsag7FSNsDGIXKmhuERZB/+Qk+m4eGa3EIJjO8Re4s356HGguPAyNKvzbDce9T4x3v pyzQEUx75YRkYbrwvZNmxsDo6jl5Sx+Dgcft6S8RHwVO9zpI5IJh6XOFTN7MfA6SlnW+ o/ibt3r+hFb2k/adzDnSripxIm7IxzPPdsiWEPslzrgfRxLtS3SjUFK5WcmK+KU3hSMe 2bDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M+I/RmgU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p16-20020a056a000b5000b0068e3b9aeefasi9003283pfo.138.2023.09.12.14.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 14:24:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M+I/RmgU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 568A281552DB; Tue, 12 Sep 2023 10:40:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237105AbjILRj4 (ORCPT + 99 others); Tue, 12 Sep 2023 13:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236827AbjILRjx (ORCPT ); Tue, 12 Sep 2023 13:39:53 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E9110D3 for ; Tue, 12 Sep 2023 10:39:49 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-500cfb168c6so9697867e87.2 for ; Tue, 12 Sep 2023 10:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694540387; x=1695145187; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qfWN69mP00ualtZXK+0LNWzFxGf625lUtnnMX/7yIhI=; b=M+I/RmgU8xsyVSXy0yh8auVtBOcMVq2c+HuwneqMon6pMuLz1n1pljG5OwcZ+uU5k7 9mV5QoPbIdVATsPtjQ8zTSEiYaIINuFynjLdQIRhwhmGek8oFQQvq3idT+q8L1zTFBQ6 IV65+0ir+nI9z+kj7ODAket0TTk8lCMcHudxhX1Gp/3t8TRqWO+I4/TtzC+kFYS+PCFb cwCkpp7by+Hk6kwWCxd+PDhHsWlvR8eIvkmGx8yiiCiDF0RrAX9oxdqGTRiiNdUIJwQq bRGhhfLDuKnQ46wDz75hFV73/Laqi3aL6X9AKbyGW4j6QXGMsMDhlleYMXshJP4ZcfH4 ZviQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694540387; x=1695145187; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qfWN69mP00ualtZXK+0LNWzFxGf625lUtnnMX/7yIhI=; b=TTpK/xoetJxAZjV5H9Y/+7c4qoCDaE31JM07qwfx1xU2E6KE+KGBc0M2I7COb9nHXV KNiUd6LU3IUf46pQ9C2+fqaITKVH6mqb4+Zi3fOTgOW0FDig6OBdmhRUoI8dCbaUoNm2 xxkJpI6O52LJklTd6s7BQ+C9LzQlULINxZPpbOtVL9gLLsSk6Siqan1opnKoxOchFpXu uDx4h+DAQ8baHOhlSTFAphas5d42ghlu5i3hWyvxYpU/oXPLqiMmxCYunq6S5LazFflb KIvcAKvzilqjzHCYd3GdZoJ6dj457BTLCEynTCTlNDi2x47J8ZSh6V6DUCiWl00UNvVB ejbQ== X-Gm-Message-State: AOJu0Yy50AQqMNiC44te2JnYpp3oOvwhv3SZFAAHHyawjpaUR0nEXhEH To+ZtP3ZWuo/wsnn+0IWQRd7Iw== X-Received: by 2002:a05:6512:3698:b0:501:bf30:714c with SMTP id d24-20020a056512369800b00501bf30714cmr163908lfs.24.1694540387403; Tue, 12 Sep 2023 10:39:47 -0700 (PDT) Received: from ?IPV6:2001:14ba:a0db:1f00::8a5? (dzdqv0yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::8a5]) by smtp.gmail.com with ESMTPSA id u6-20020ac24c26000000b005008757cd6csm1828256lfq.241.2023.09.12.10.39.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Sep 2023 10:39:46 -0700 (PDT) Message-ID: Date: Tue, 12 Sep 2023 20:39:45 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 01/12] Revert "drm/sysfs: Link DRM connectors to corresponding Type-C connectors" Content-Language: en-GB To: Heikki Krogerus Cc: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Bryan O'Donoghue , Guenter Roeck , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, Won Chung References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> <20230903214150.2877023-2-dmitry.baryshkov@linaro.org> <6b6bacee-f7b6-4cfe-be3d-24bda44bfbcf@linaro.org> From: Dmitry Baryshkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Sep 2023 10:40:18 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 lipwig.vger.email On 12/09/2023 14:05, Heikki Krogerus wrote: > On Tue, Sep 12, 2023 at 12:15:10AM +0300, Dmitry Baryshkov wrote: >> On 06/09/2023 16:38, Heikki Krogerus wrote: >>> On Wed, Sep 06, 2023 at 03:48:35PM +0300, Dmitry Baryshkov wrote: >>>> On Wed, 6 Sept 2023 at 15:44, Heikki Krogerus >>>> wrote: >>>>> >>>>> On Tue, Sep 05, 2023 at 01:56:59PM +0300, Dmitry Baryshkov wrote: >>>>>> Hi Heikki, >>>>>> >>>>>> On Tue, 5 Sept 2023 at 11:50, Heikki Krogerus >>>>>> wrote: >>>>>>> >>>>>>> Hi Dmitry, >>>>>>> >>>>>>> On Mon, Sep 04, 2023 at 12:41:39AM +0300, Dmitry Baryshkov wrote: >>>>>>>> The kdev->fwnode pointer is never set in drm_sysfs_connector_add(), so >>>>>>>> dev_fwnode() checks never succeed, making the respective commit NOP. >>>>>>> >>>>>>> That's not true. The dev->fwnode is assigned when the device is >>>>>>> created on ACPI platforms automatically. If the drm_connector fwnode >>>>>>> member is assigned before the device is registered, then that fwnode >>>>>>> is assigned also to the device - see drm_connector_acpi_find_companion(). >>>>>>> >>>>>>> But please note that even if drm_connector does not have anything in >>>>>>> its fwnode member, the device may still be assigned fwnode, just based >>>>>>> on some other logic (maybe in drivers/acpi/acpi_video.c?). >>>>>>> >>>>>>>> And if drm_sysfs_connector_add() is modified to set kdev->fwnode, it >>>>>>>> breaks drivers already using components (as it was pointed at [1]), >>>>>>>> resulting in a deadlock. Lockdep trace is provided below. >>>>>>>> >>>>>>>> Granted these two issues, it seems impractical to fix this commit in any >>>>>>>> sane way. Revert it instead. >>>>>>> >>>>>>> I think there is already user space stuff that relies on these links, >>>>>>> so I'm not sure you can just remove them like that. If the component >>>>>>> framework is not the correct tool here, then I think you need to >>>>>>> suggest some other way of creating them. >>>>>> >>>>>> The issue (that was pointed out during review) is that having a >>>>>> component code in the framework code can lead to lockups. With the >>>>>> patch #2 in place (which is the only logical way to set kdev->fwnode >>>>>> for non-ACPI systems) probing of drivers which use components and set >>>>>> drm_connector::fwnode breaks immediately. >>>>>> >>>>>> Can we move the component part to the respective drivers? With the >>>>>> patch 2 in place, connector->fwnode will be copied to the created >>>>>> kdev's fwnode pointer. >>>>>> >>>>>> Another option might be to make this drm_sysfs component registration optional. >>>>> >>>>> You don't need to use the component framework at all if there is >>>>> a better way of determining the connection between the DP and its >>>>> Type-C connector (I'm assuming that that's what this series is about). >>>>> You just need the symlinks, not the component. >>>> >>>> The problem is that right now this component registration has become >>>> mandatory. And if I set the kdev->fwnode manually (like in the patch >>>> 2), the kernel hangs inside the component code. >>>> That's why I proposed to move the components to the place where they >>>> are really necessary, e.g. i915 and amd drivers. >>> >>> So why can't we replace the component with the method you are >>> proposing in this series of finding out the Type-C port also with >>> i915, AMD, or whatever driver and platform (that's the only thing that >>> component is used for)? >> >> The drm/msm driver uses drm_bridge for the pipeline (including the last DP >> entry) and the drm_bridge_connector to create the connector. I think that >> enabling i915 and AMD drivers to use drm_bridge fells out of scope for this >> series. >> >> >>> Determining the connection between a DP and its Type-C connector is >>> starting to get really important, so ideally we have a common solution >>> for that. >> >> Yes. This is what we have been discussing with Simon for quite some time on >> #dri-devel. >> >> Unfortunately I think the solution that got merged was pretty much hastened >> in instead of being well-thought. For example, it is also not always >> possible to provide the drm_connector / typec_connector links (as you can >> see from the patch7. Sometimes we can only express that this is a Type-C DP >> connector, but we can not easily point it to the particular USB-C port. >> >> So, I'm not sure, how can we proceed here. Currently merged patch breaks >> drm/msm if we even try to use it by setting kdef->fwnode to >> drm_connector->fwnode. The pointed out `drivers/usb/typec/port-mapper.c` is >> an ACPI-only thing, which is not expected to work in a non-ACPI cases. > > You really have to always supply not only the Type-C ports and partners, > but also the alt modes. You need them, firstly to keep things sane > inside kernel, but more importantly, so they are always exposed to the > user space, AND, always the same way. We have ABIs for all this stuff, > including the DP alt mode. Use them. No shortcuts. > > So here's what you need to do. UCSI does not seem to bring you > anything useful, so just disable it for now. You don't need it. Your > port driver is clearly drivers/soc/qcom/pmic_glink_altmode.c, so > that's where you need to register all these components - the ports, > partners and alt modes. You have all the needed information there. To make things even more complicate, UCSI is necessary for the USB part of the story. It handles vbus and direction. > Only after you've done that we can start to look at how should the > connection between the DPs and their USB Type-C connectors be handled. But sure enough, I can add typec port registration to the altmode driver. This will solve the 'port not existing' part of the story. I'd like to hear your opinion on: - components. Using them breaks drm/msm. How can we proceed? - PATH property usage. This way we make USB-C DisplayPort behave like the MST ports. -- With best wishes Dmitry