Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4140470rwb; Mon, 21 Nov 2022 04:20:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6aZtDMEW/OU/xZ3KqEZUoEaMoYU/D7QE3xSHBk01Y7vr97kSmP9gB7TaBefht4qJmhZxUt X-Received: by 2002:a17:90a:d145:b0:211:7e51:9d65 with SMTP id t5-20020a17090ad14500b002117e519d65mr25326192pjw.220.1669033244945; Mon, 21 Nov 2022 04:20:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669033244; cv=none; d=google.com; s=arc-20160816; b=vLaVk1ujVnqjLV6GcZ15QRTka6osa1TqE5F+euyIDgKmyytRc8WysWJ95ZwJFJoaDQ 09V25q7wi3EzLC385d+42t2IoM1EJYuLWYNdU6QejdewBwmfJ5X85vV4+0vZJ28ufDz6 +8YslEc6xNxrNHc0mo+L5fjsI2BYMj3dfuo7hWiRAIOUiXA1hwXHnHyESNuBZi+xKOGQ wVc5+VfYcIOFMyYmeA8xeQ6VWvvGtrNDv19axhTrw66eSIbCF8lAIe9JesqIIVnvgr2v BGyJe+bTEswH7WHtkJhnw7Gc2w3+0zmYoUX7pyHoxhhLTP8443r6Z2A59JDie4KhuV7g EhYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qFL1DdPEdFmmORdAHa8FuM8qdDJ5J5wmlOxbY4GDKhg=; b=Mlp3AFt8igj5odewJcCe0z9lgNCajQjsJ+rnUcfL42ZJlug2fX+FTWLPBV0W+55iHw 9V67DfUwQzC7FRcawnktP9sXPRv43h8/khAecFVQhh5yxSYL+2ObwsX0VG0ZCSWlohBZ 7AD/XJeeKYtqgddcsvERiET/VMJIsep74P3eDVOP4ILG1q6BfQDEqK4vDMzDmQybH5PF c1409I8NqUl1A2Xvlz8hyfykRMXZBKFBCQzy93hgEwkOKDb3qNuq6fXGiNTbyelqRnCf OP9eHYQ5GerXOxUj17YdS5KRRGhUEUAhdpdAJ7ChMzd5E0mqeFuZio6W825SYdoLApjK 0BGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xb41IYLa; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 22-20020a630316000000b0045c5a274ba3si11272410pgd.74.2022.11.21.04.20.28; Mon, 21 Nov 2022 04:20:44 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Xb41IYLa; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbiKULW1 (ORCPT + 92 others); Mon, 21 Nov 2022 06:22:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231163AbiKULVy (ORCPT ); Mon, 21 Nov 2022 06:21:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66C4BCF; Mon, 21 Nov 2022 03:17:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8750EB80E67; Mon, 21 Nov 2022 11:17:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FA8CC433D6; Mon, 21 Nov 2022 11:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669029438; bh=20eHod9+LKqinzyklLfNuMaBJMnRT6ZSBVaGJSuFWFM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xb41IYLaWLfLIWIarzzEUIzhTAKVERZ7VJaelCNFJYcVGm1Ko2vKxdkUqU9Thu4I9 O9iJdHVwP3rg0xMYEQi1TlHrjkA5sUZndcyCE34TEKSXP0R/hHIrm1ZmSZQoSHOfJI evH0ZPb0m6s3Oc4iHPKUHKgXgnHnGuvoDrZtMnI1RseOZBPFpDkHHPRpwweM4ptaZy SOO4kBYyBpOq45010BTTGmwH4Cz235xdWYYi8T3P04k8y8x0vL304l1LiCJ2OxLmL/ yAH9bWhrDsnUHvIQH3x0Ch7ma75gjMoeOTFiqzffpEvhimuin58fERanqbKr/GrNCQ wQ5wZACB4OhEg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ox4n9-0001Pz-Vt; Mon, 21 Nov 2022 12:16:48 +0100 Date: Mon, 21 Nov 2022 12:16:47 +0100 From: Johan Hovold To: Rob Herring Cc: Marc Zyngier , Krzysztof Kozlowski , Dmitry Torokhov , Bjorn Andersson , Manivannan Sadhasivam , Matthias Brugger , Linux Input , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: Re: Second-source devices and interrupt-mapping race Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi Rob, and sorry about the late follow up. I received your reply just before my holiday and then ended up in a bit of a rabbit hole with the Qualcomm PHY drivers so this got put on the back burner. On Thu, Aug 04, 2022 at 09:42:01AM -0600, Rob Herring wrote: > On Thu, Jul 28, 2022 at 3:30 AM Johan Hovold wrote: > > 2. Rob, Krzysztof, I assume that handling second-source devices by > > enabling multiple variants in the devicetree can not be considered > > correct? > > Probably not, but there's not really any defined policy there. What > that looks like in DT depends on the component. Displays are a common > one and don't lend well to populating multiple in the DT. For those, > the only solution so far is we require the 2nd source to be compatible > with the default/1st. I think that was QCom chromebooks... > > The easy answer is firmware should deal with figuring out what's > actually there and update the DT accordingly. Right. > > What about the related case of simply non-populated devices (e.g. laptop > > variants without a touchscreen)? > > Shouldn't that just be a case of the driver not screaming if there's > no device? Right, that's simple, but what I'm getting at is that this is also a case of the devicetree not describing the actual hardware. If we allow that, does that imply that we should also allow having second-source devices in the devicetree even if we know that at least one of them will be non-populated? The big difference is dealing with any "shared" resources, such has the pinconfig and interrupt in my HID example, which would now appear to be claimed by more than one device. It seems we'd need some way to describe the devices as mutually exclusive, and perhaps that's reason enough not to try to generalise the single-non-populated-device case. > > Note that we have at least two cases of "second-source" nodes in mainline > > ("rtc" and "trackpad", respectively): > > > > 85a9efcd4e29 ("ARM: mvebu: add DT support for Seagate NAS 2 and 4-Bay") > > 689b937bedde ("arm64: dts: mediatek: add mt8173 elm and hana board") > > > > and that, for example, the i2c-hid driver explicitly supports > > non-populated devices: > > > > b3a81b6c4fc6 ("HID: i2c-hid: check if device is there before really probing") > > > > and the commit message indicates that this is something that Chromebooks > > rely on. > > > > For the X13s, I'm not sure how we would go about to tell the variants > > apart (the ACPI tables that Windows use include both touchpads and an > > optional touchscreen). In the end, the boot firmware might need to > > resort to a similar kind of probing if we don't allow the kernel to do > > it. > > > > Finally, note that while disabling async probing for "second-source" > > nodes (e.g. if we could mark them as requiring that) would take care of > > the irq-mapping race, we'd still currently also need to move any > > pinconfig handles to the parent bus node (as is also done in one of the > > in-tree examples above) to suppress the corresponding pinctrl errors in > > case the populated device is probed and bound first: > > > > [ +0.010217] sc8280xp-tlmm f100000.pinctrl: pin GPIO_182 already requested by 0-0015; cannot claim for 0-002c > > If the config is the same for both we could suppress that warning. If > not the same, seems a bit dangerous to configure the wrong config... Indeed, the pin configs would need to be at least compatible. I'm sure this has the potential to mess things up with respect to other resources too. And even if it may be possible to get this to work in many cases it seems firmware needs to be involved for it to work generally. Johan