Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp601318lqt; Thu, 6 Jun 2024 12:27:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWp69uk/QYEG2dcX0V7uSEpjZNRzaX1Bj9biKELey6KT5/PvcakvaoLrpXNoR0S/eODMsaFSNhwsdazaoVBmcV6jb73lu/Szh6Fyh8jmQ== X-Google-Smtp-Source: AGHT+IGrbRFOiVYaJf07nnvOxF4hHq6yWM4bsCK699hwQZSPjBT98CL3DcasTz5B/f/NhinwU8ia X-Received: by 2002:a17:902:654b:b0:1f6:91a1:88cb with SMTP id d9443c01a7336-1f6d02fe4fcmr5286595ad.31.1717702044029; Thu, 06 Jun 2024 12:27:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717702044; cv=pass; d=google.com; s=arc-20160816; b=0ar7waktv6Gr8inTQQp2aSajZ2ZympAEPwZrNh3xfJXtSegrR9tgv6FXFarSb0btTw YxsPLpyTselMqEgC9nD1HqRLu/lNfLaOq/RvGLCAJj0beR6g8CfLRoZBi35ooBo2eJt3 D7hl9DUj5Yn5LGF2jdI54dmwbS/OlKZTF7MykfLnXQhPREZ9/r2zPt70b0Vdjb3RXvtz 8vXBYv6RniMeUkckgQIfg55mEeD1bDi8B1OqeqVon2oK+XhGLFDc/k099LE2xK6yHsAc H1JN+q6FnSXNXki3S/F+rA4dOw/5wMYSa4cvBVo24uwoRVh5G2KanGJhVscP1Tzfj3BF kl6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=xBw4CAnl3WZ5sOcpLSZex0nxrwP2MTcFmbt5gMfrnak=; fh=tznusYK8SIW/Sy1yYQmaX824JQ4PCbELji9SIJ7GY9U=; b=yHZrSTyomOKPYWBMtSBDYk2esuF1siRbAluzZnIG4SzqRA2nUwU03w7sGmgEbJ7WVP +rFGG4LIPOyKdbiqGjEovDJhth4+0o953V7XhL5+8bh88RLLLC8LWk7Ub0XlhUlUrSnX 8ITxCLZjowfJUxHBTKZUETXwSFckH3Na5nClzDgjFA3i7WPTYJLB9LLF7f0xg9Hg31rb ycU8npm9i2Fft0Px2dtxNo8mzs3MSZyq1FAOMKjTaSHmxKemLJ4KGuvbj/h5KjI0OM0E V3Oj+R99sb26T+rQ9WyEL6CbjIGA9Xlj+hnsYz4goHeelk/kgYie31+JeG8OWYuyDK4C KATA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qHPrf9QG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 d9443c01a7336-1f6bd7d6857si16350005ad.212.2024.06.06.12.27.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 12:27:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204940-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=@kernel.org header.s=k20201202 header.b=qHPrf9QG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 68275281B59 for ; Thu, 6 Jun 2024 19:26:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35D866D1A9; Thu, 6 Jun 2024 19:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qHPrf9QG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E7B12110E; Thu, 6 Jun 2024 19:26:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717701974; cv=none; b=HHg9fyaSTB46khqexomMdQMOPV9eTcgL2bDOhrKglPPW37deuV9ZoJsPlm7Rq+6q5ojlZuxWi/2PV4Dofqjhq/3tsBKzer0YCQZtGaJlXW1/MEJdjs8DXWxBQuEG7PZwBKO13PqgCDXNToQlMDBwG5mJdt1TArrhZuPx8JcTc7M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717701974; c=relaxed/simple; bh=1HIaQotNiUpWV2qc7pNQjMXtq8vCq2cgNxyb4ZjQbJ0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=ASj4rX8rPSEuHSNIK+XvTyhNwd/5bikyuEjwnV3RFEZ1zLC215DmwhEemF3SgQVCq6rYwFtSwDiYfwNjNHkMegaiZU1VTwLWjWOYJ5JrxFqfl0NkaCXwM+3GIVMYbOEIjhY/E9L4VhmvEXObFctibWu3w8SyRLqGTYYNBTV08vY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qHPrf9QG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7DFFC2BD10; Thu, 6 Jun 2024 19:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717701973; bh=1HIaQotNiUpWV2qc7pNQjMXtq8vCq2cgNxyb4ZjQbJ0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=qHPrf9QGQnvxAvKCMsYlArJj+cnlvJo3xKFVsMgLa1Ty3FFrtK/HuvI7/9tW3Sq5I Hclf/l/+fMttK7SpWNevDE8H1tL4cmlioTU33WNuPQQDVvSJo2RkBzs1JzkvJsuEUf K/G1iST0k7V9BHTiBBMkIHBY27RFn8pCyAFOTUobP7R0h3W9H8loQeU2py618TpYwP lZqMfztQd5+9uAzS7ShnRUka7fRfQYfo11okwWxX5RIqR44rdNY344T4k3Q/McDUl4 aCwZTPBkpLydJvrnzPLtE0RbKkTH9mizfgBP0JZkdolj5LnBm/PR08wpPnmmu0qu1y ruDta++esJMaQ== Date: Thu, 6 Jun 2024 14:26:12 -0500 From: Bjorn Helgaas To: Herve Codina , Rob Herring Cc: Simon Horman , Sai Krishna Gajula , Thomas Gleixner , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lee Jones , Arnd Bergmann , Horatiu Vultur , UNGLinuxDriver@microchip.com, Andrew Lunn , Heiner Kallweit , Russell King , Saravana Kannan , Bjorn Helgaas , Philipp Zabel , Lars Povlsen , Steen Hegelund , Daniel Machon , Alexandre Belloni , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Allan Nielsen , Luca Ceresoli , Thomas Petazzoni Subject: Re: [PATCH v2 17/19] PCI: of_property: Add interrupt-controller property in PCI device nodes Message-ID: <20240606192612.GA814032@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240527161450.326615-18-herve.codina@bootlin.com> On Mon, May 27, 2024 at 06:14:44PM +0200, Herve Codina wrote: > PCI devices and bridges DT nodes created during the PCI scan are created > with the interrupt-map property set to handle interrupts. > > In order to set this interrupt-map property at a specific level, a > phandle to the parent interrupt controller is needed. On systems that > are not fully described by a device-tree, the parent interrupt > controller may be unavailable (i.e. not described by the device-tree). > > As mentioned in the [1], avoiding the use of the interrupt-map property > and considering a PCI device as an interrupt controller itself avoid the > use of a parent interrupt phandle. > > In that case, the PCI device itself as an interrupt controller is > responsible for routing the interrupts described in the device-tree > world (DT overlay) to the PCI interrupts. > > Add the 'interrupt-controller' property in the PCI device DT node. > > [1]: https://lore.kernel.org/lkml/CAL_Jsq+je7+9ATR=B6jXHjEJHjn24vQFs4Tvi9=vhDeK9n42Aw@mail.gmail.com/ > > Signed-off-by: Herve Codina No objection from me, but I'd like an ack/review from Rob. > --- > drivers/pci/of_property.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c > index 03539e505372..5a0b98e69795 100644 > --- a/drivers/pci/of_property.c > +++ b/drivers/pci/of_property.c > @@ -183,6 +183,26 @@ static int of_pci_prop_interrupts(struct pci_dev *pdev, > return of_changeset_add_prop_u32(ocs, np, "interrupts", (u32)pin); > } > > +static int of_pci_prop_intr_ctrl(struct pci_dev *pdev, struct of_changeset *ocs, > + struct device_node *np) > +{ > + int ret; > + u8 pin; > + > + ret = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); > + if (ret != 0) > + return ret; > + > + if (!pin) > + return 0; > + > + ret = of_changeset_add_prop_u32(ocs, np, "#interrupt-cells", 1); > + if (ret) > + return ret; > + > + return of_changeset_add_prop_bool(ocs, np, "interrupt-controller"); > +} > + > static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, > struct device_node *np) > { > @@ -336,6 +356,10 @@ int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs, > ret = of_pci_prop_intr_map(pdev, ocs, np); > if (ret) > return ret; > + } else { > + ret = of_pci_prop_intr_ctrl(pdev, ocs, np); > + if (ret) > + return ret; > } > > ret = of_pci_prop_ranges(pdev, ocs, np); > -- > 2.45.0 >