Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp628382lqm; Wed, 1 May 2024 10:38:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGeXPlpF261FzZwOIDRjBTeRz9UDMbQphiCqlIFL2DqQJKgKRi3aqk95MCZpIqyemIj9fKYtXC8qquJKyQYoVMsMZF3aY+www2u6cSMA== X-Google-Smtp-Source: AGHT+IH9To5isyPnyRaRZRPQSjfy7bPFUxKmVcxK68CPdQ8wVsjRj2GMRZkY0yjQ5ZrUcQGfWWSV X-Received: by 2002:a17:902:82c9:b0:1ea:42d1:1421 with SMTP id u9-20020a17090282c900b001ea42d11421mr3030417plz.68.1714585125653; Wed, 01 May 2024 10:38:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714585125; cv=pass; d=google.com; s=arc-20160816; b=XH/ZV1E6Cbz8bKqpW38Gg0agSubVqZ6JVdAQfd2QzwEaVJTAXoRuokkosGHHIyMmNV Zc7ls+bn1h1vp9dB22KzZxfRbLr38r/AzEsIcOgwzGz2E4mnrBX1wgWL69xc9SAIJx90 OJhecMmuLgYBBcUU2ELd/U4dGnnjXcYyYshsi0SPjk9sS67l0AbLKq7oGE4kvMLEQRSF Jnf0QNFFp3mdfeBI5D9pTgDLpzt7q9J822LcAstVvFRp0DFdLWg9/KZf7CD6R8VSXvVv Aiw1Z2E0hDKsrlf3YsbvzOsDJ8gfzsTv8JN4EZpoXoqiULS8a9cY97CYNEdYMRZ3pj19 1gNQ== 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=hm61l9udpJc4ixVtmhZ/jAk4ub0yDimKopfEsdmr8w8=; fh=z81upDLMn8LotDJmM9peXiQH9gc2zTxiwPL8Sqeu3u4=; b=wUP54rphYBPmPOv6viYUZRMAJcpZe7DJVNCAI7Vi5V0VRHRrypxypP5QNqI9GDp1pv nmgoouH8X3PaoohGdLsesxIyzGksROIvoV/CjttbDIj0u+wTLrOQ8g9vvpxAuDaTO9qk B7aM9LpGTOxBW8HfsxVXzjd2WaBgvKNTVKiXaSDshXGrD9rAvl+3had1HNe7w8Xm94Wu 62hPD563FSoQ+zK3JMwFtdZbuA6Pn6Vh9y9IkXsyvZJbBbalVJu8qgqokP5B2ZbfFOny A1TllqPl1XbTLwT2rLHIKSU9eD3svNMkz1M2fMOO1wQlC6bPRn5geMneyeSBKY1aa5dJ +y+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FG482jE1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j13-20020a170903024d00b001ec8df2d902si1917557plh.143.2024.05.01.10.38.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 10:38:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FG482jE1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165656-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AAEEEB22343 for ; Wed, 1 May 2024 17:38:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FDA31304B1; Wed, 1 May 2024 17:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FG482jE1" 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 262C5D2FE; Wed, 1 May 2024 17:38:28 +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=1714585109; cv=none; b=hBk2z4MA3JWM4s9SPx9gD1wB+k3oOIF838svJx7zBs7ci2c0h0vzOkCe+zll1l/GZ2tndh3qjRk2MNMEfhACMp2I7kiw5zAiXZNBufq5lxZxxmqCejxKSR9T3NZxRRYYXp7vpkwjgHdIYEu0JGYW5+nsyzT6akqMdv4A3KKBOtA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714585109; c=relaxed/simple; bh=3Rom1K33gLjGc5KMu7YOMHTB0qLyXpnfXozkAEwXuwQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=PKd7GUJiMxZwD9EtP178mmOwafAs8acex0vuvItmIA2xOvSSHmWCXODQqCbzHtp5IdRS5hGP++HP5v2a2s/ohYHksgV9LNPzJFNql/MZhmGG/XLU66BfuIauZ+06/gfc+rRRl6eJrcL1mBD8DVOYJCnRq3l//RRNp02yaW6MSN4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FG482jE1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EA32C072AA; Wed, 1 May 2024 17:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714585108; bh=3Rom1K33gLjGc5KMu7YOMHTB0qLyXpnfXozkAEwXuwQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=FG482jE1b23MALPQTleYDyQE1i/V2NpJTWpzv1GQrZKsSaSchZfte6XfXHrUIstsY wWdvHyKMw9fx5FUqlBzhSH8osTQZvwTaZrGrt0Xn7ftNu8Xnk9lGJlz2dzCPMB9qoz KALX3k6b91XTBT3kA1wPdPZM1m66uA/qOBn4jLCr8YaiQvQ9BXxjfR5pprRftIrhrw /9yJKII93CaytSG1/TarbiJyKVzIxg351HGh1Dn0Eh9JPrh8emJM5tohPnWbTgYddS MVvWkLicm8OIZWsV8yNLVsfkfG/AJ0uL+iysVuZKcIktl/Ty/JJRX7tSvQs9GmjmOW nh95iuzB5VEsA== Date: Wed, 1 May 2024 12:38:26 -0500 From: Bjorn Helgaas To: Herve Codina Cc: Thomas Gleixner , Rob Herring , 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 15/17] pci: of_property: Add the interrupt-controller property in PCI device nodes Message-ID: <20240501173826.GA808463@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: <20240430083730.134918-16-herve.codina@bootlin.com> In subject: s/pci:/PCI:/ to match history. s/Add the/Add/ for brevity. On Tue, Apr 30, 2024 at 10:37:24AM +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). Rewrap into one paragraph or add blank line to separate paragraphs. > 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 > --- > 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 c2c7334152bc..9f8b940029ed 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) > { > @@ -334,6 +354,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.44.0 >