Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp233455pxb; Mon, 13 Sep 2021 17:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW8rpn3Q+m1qDPfMC+Riw8hYwi2JGAtsNFBIlmk7OKrE7dXuKFqozdxqtuQEWeh/ZLKqEG X-Received: by 2002:aa7:df09:: with SMTP id c9mr16559912edy.243.1631580848934; Mon, 13 Sep 2021 17:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580848; cv=none; d=google.com; s=arc-20160816; b=fvUjZBLUc9orPnLw7TWjnue2BnMH5nSTzsWF4PlZiYJls8x1kDv8rvEvsUcAetglcv dUaCSB0jq1FVAMf5XCDgolOTc5H+xulyq8RogNYTsJ2+tEftrKLdVLUvaI7Xe4WVOYA0 OMvHbRdgrjfTFb5AyN7rCCK+PmYAnbn1VLjgqRW25n7SyYEYrIC1bFaG+YU0djMmiZOm STBx1vvJ4abcmApTUKLE284047KsyDPc9isGsCXE8oxPCnd1L/WNJJoKoepE2XUTPUMm N0hbI92VonxvQBCrOuKkcYHCsmFiZcsZtgDBocut0NZpzy2ZyFDyKzkcUfVpLQDiNVgJ TkTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3lgerMcCp2K9ShReApi8DGbf28y98p46EVsaZuS0mKQ=; b=nGbz2nnVe3sy08BZI9Ej32dr+YMB5mvrypGqVOHH9bizQWPTCPs0uU5kkPpalsGXi4 T5eCN268nHe7V22xdd9M9BZnGL7CfNXlhxOiKDzqelwAQmwEXotFX3b8lV61Xxzg5MIe ZTnQKMiLCruJnBXnSjbWw/XjT5CSIOQCXk7gQk4IIxMrp3/NF6uOZ9JgFGL5sdvUSR6u pk/dlfisK9ZtOHaJmJiRu1Rb64QLwXWj4cPLofo96Fn3DE022Mt5TKEZ7+/dxjWEsgzM FpmoeT30IGXGH6aLM8Z954ehyVbeIJwwCrBpFsdPTDO3YKs5VmiFVOEhfURvX9AHEaQw mYLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg13si4361565edb.604.2021.09.13.17.53.45; Mon, 13 Sep 2021 17:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1345557AbhIMS1b (ORCPT + 99 others); Mon, 13 Sep 2021 14:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:59704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236669AbhIMS1V (ORCPT ); Mon, 13 Sep 2021 14:27:21 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CB607610E6; Mon, 13 Sep 2021 18:26:05 +0000 (UTC) Received: from [198.52.44.129] (helo=wait-a-minute.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mPqea-00AYPD-3V; Mon, 13 Sep 2021 19:26:04 +0100 From: Marc Zyngier To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Alyssa Rosenzweig , Stan Skowronek , Mark Kettenis , Sven Peter , Hector Martin , Robin Murphy , kernel-team@android.com Subject: [PATCH v3 03/10] PCI: of: Allow matching of an interrupt-map local to a pci device Date: Mon, 13 Sep 2021 19:25:43 +0100 Message-Id: <20210913182550.264165-4-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210913182550.264165-1-maz@kernel.org> References: <20210913182550.264165-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 198.52.44.129 X-SA-Exim-Rcpt-To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, lorenzo.pieralisi@arm.com, kw@linux.com, alyssa@rosenzweig.io, stan@corellium.com, kettenis@openbsd.org, sven@svenpeter.dev, marcan@marcan.st, Robin.Murphy@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just as we now allow an interrupt map to be parsed when part of an interrupt controller, there is no reason to ignore an interrupt map that would be part of a pci device node such as a root port since we already allow interrupt specifiers. This allows the device itself to use the interrupt map for for its own purpose. Signed-off-by: Marc Zyngier --- drivers/pci/of.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index d84381ce82b5..443cebb0622e 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -423,7 +423,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, */ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) { - struct device_node *dn, *ppnode; + struct device_node *dn, *ppnode = NULL; struct pci_dev *ppdev; __be32 laddr[3]; u8 pin; @@ -452,8 +452,14 @@ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args * if (pin == 0) return -ENODEV; + /* Local interrupt-map in the device node? Use it! */ + if (dn && of_get_property(dn, "interrupt-map", NULL)) { + pin = pci_swizzle_interrupt_pin(pdev, pin); + ppnode = dn; + } + /* Now we walk up the PCI tree */ - for (;;) { + while (!ppnode) { /* Get the pci_dev of our parent */ ppdev = pdev->bus->self; -- 2.30.2