From patchwork Thu Jan 10 18:41:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 10756631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D970313B5 for ; Thu, 10 Jan 2019 18:42:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C739C29D5E for ; Thu, 10 Jan 2019 18:42:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB61E29D66; Thu, 10 Jan 2019 18:42:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5FB7429D5E for ; Thu, 10 Jan 2019 18:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=SuWaX4RpSYQMsZ2cgmGvsFqJhelbM4Guv+Yd1hAheLU=; b=bKZWGqmRoZcF41 Uzb7ITJXFUHqNqp5cFcRbDveCo8iRBLKJgeoLouH/vpH7qxWN392BGwTqGlPOcfbY85YsSEtmkoih OzLfCyPdPRTgPp+mtMAasmArotDezZgH8CE/D+dHh2hgNSUWdLhhw/cuzjCjjkYNVdOte0aIjq4Er krBEey721Hv7UIWhH9LmB5ItuKC6MkQc2TTjmN+u9Q3HPb86Bm8enOXy9+uKVKnt8BztO9s2vnQC2 LOoWLN0K9YUYujkdAI7pLTDy2/aap6RGetS4+Vb7JJM5ZnvlDbN2Ch6o8K1Nl9FIfKTamd3rEyoen nq46jO2qw2Wzkke/SCYA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghfHN-0002uw-EC; Thu, 10 Jan 2019 18:42:09 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghfHK-0002uJ-DA for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 18:42:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 74C8B1596; Thu, 10 Jan 2019 10:42:02 -0800 (PST) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 822E43F694; Thu, 10 Jan 2019 10:42:00 -0800 (PST) From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH] ACPI/IORT: Fix rc_dma_get_range() Date: Thu, 10 Jan 2019 18:41:51 +0000 Message-Id: <20190110184151.27492-1-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_104206_448751_030A611B X-CRM114-Status: GOOD ( 11.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Rafael J. Wysocki" , Lorenzo Pieralisi , Eric Auger , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , linux-acpi@vger.kernel.org, Hanjun Guo , Sudeep Holla , Robin Murphy Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jean-Philippe Brucker When executed for a PCI_ROOT_COMPLEX type, iort_match_node_callback() expects the opaque pointer argument to be a PCI bus device. At the moment rc_dma_get_range() passes the PCI endpoint instead of the bus, and we've been lucky to have pci_domain_nr(ptr) return 0 instead of crashing. Pass the bus device to iort_scan_node(). Fixes: 5ac65e8c8941 ("ACPI/IORT: Support address size limit for root complexes") Reported-by: Eric Auger Signed-off-by: Jean-Philippe Brucker Signed-off-by: Lorenzo Pieralisi Reviewed-by: Eric Auger Acked-by: Robin Murphy Cc: stable@vger.kernel.org Cc: Will Deacon Cc: Hanjun Guo Cc: Sudeep Holla Cc: Catalin Marinas Cc: "Rafael J. Wysocki" --- Will, Catalin, resending a reformatted version of this fix previously posted in [1], please merge it for one of the upcoming -rc. Thanks, Lorenzo [1] https://marc.info/?l=linux-acpi&m=154712742324811&w=2 drivers/acpi/arm64/iort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index fdd90ffceb85..c08afe44c488 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -952,9 +952,10 @@ static int rc_dma_get_range(struct device *dev, u64 *size) { struct acpi_iort_node *node; struct acpi_iort_root_complex *rc; + struct pci_bus *pbus = to_pci_dev(dev)->bus; node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, - iort_match_node_callback, dev); + iort_match_node_callback, &pbus->dev); if (!node || node->revision < 1) return -ENODEV;