From patchwork Tue Sep 19 17:05:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 9959667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EAE9060208 for ; Tue, 19 Sep 2017 17:03:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8F8E28DD9 for ; Tue, 19 Sep 2017 17:03:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDE3C28EA8; Tue, 19 Sep 2017 17:03:45 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 DB51228DD9 for ; Tue, 19 Sep 2017 17:03:44 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=wkwopJoJc8tD0Ey0YJ+DyMCSPnqSj7abIIIpHqKJdug=; b=G7d zvgCgC7MP88RV4rtQmWOgUScvrsCFvFrOOGdtPqQMb1Tah7NSOGsHZFG/bLTyiAPQuiolZEfUNLxx P1w0Pw8ghO0r+nMr1lfOMSHNMA+pxTpkD46nk+bNnMtXRUFOGfkYJZd4CgC6UNDYQ5ZHucclzQakL EgQ9nmGyZ3k83/jfbpW9vBUxC+qO0+253GbhHQ4yFoICcj5qAUVY4BhLqd60ctErA02w7FyxBhn4o PW4gBs0hhPAP0JLbBAsZfxjtWIhsYUTUB5uafwIpC+xOOZ5+oWwIyjRYRMNjwRK3J2ZAL5E78iYvH Mj/l5jRvbJM4R1X8kLB2x5r23ltwzLg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1duLvu-0003is-AM; Tue, 19 Sep 2017 17:03:38 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1duLvq-0003g6-Rs for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2017 17:03:36 +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 418721435; Tue, 19 Sep 2017 10:03:11 -0700 (PDT) Received: from red-moon.cambridge.arm.com (red-moon.cambridge.arm.com [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B780E3F58C; Tue, 19 Sep 2017 10:03:09 -0700 (PDT) From: Lorenzo Pieralisi To: linux-acpi@vger.kernel.org Subject: [PATCH] ACPI/IORT: Fix PCI ACS enablement Date: Tue, 19 Sep 2017 18:05:39 +0100 Message-Id: <20170919170539.6265-1-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.10.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170919_100334_910973_2D1678EF X-CRM114-Status: GOOD ( 10.62 ) 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: Lorenzo Pieralisi , linux-pci@vger.kernel.org, Will Deacon , Alex Williamson , Zhou Wang , Robin Murphy , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 commit f6810c15cf97 ("iommu/arm-smmu: Clean up early-probing workarounds") removed kernel code that was allowing to initialize and probe the SMMU devices early (ie earlier than PCI devices through linker script callback entries) in the boot process because it was not needed any longer in that the SMMU devices/drivers now support deferred probing. Since the SMMUs probe routines are also in charge of requesting global PCI ACS kernel enablement, commit f6810c15cf97 ("iommu/arm-smmu: Clean up early-probing workarounds") also postponed PCI ACS enablement to SMMUs devices probe time, which may be too late given that PCI devices needs to detect if PCI ACS is enabled to init the respective capability through the following call path: pci_device_add() -> pci_init_capabilities() -> pci_enable_acs() Add code in the ACPI IORT SMMU platform devices initialization path (that is called before ACPI PCI enumeration) to detect if an SMMU is present in HW and enable PCI ACS if it actually is, restoring the correct PCI ACS enablement sequencing. Fixes: f6810c15cf97 ("iommu/arm-smmu: Clean up early-probing Signed-workarounds") Signed-off-by: Lorenzo Pieralisi Cc: Will Deacon Cc: Robin Murphy Cc: Zhou Wang Cc: Alex Williamson Tested-by: Zhou Wang --- drivers/acpi/arm64/iort.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 9565d57..71a7694 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1184,6 +1184,7 @@ static void __init iort_init_platform_devices(void) struct acpi_table_iort *iort; struct fwnode_handle *fwnode; int i, ret; + bool smmu_detected = false; /* * iort_table and iort both point to the start of IORT table, but @@ -1218,11 +1219,21 @@ static void __init iort_init_platform_devices(void) acpi_free_fwnode_static(fwnode); return; } + + smmu_detected = true; } iort_node = ACPI_ADD_PTR(struct acpi_iort_node, iort_node, iort_node->length); } + + /* + * If IORT reports an SMMU component make sure PCI ACS is + * requested so that PCI devices can enable it in their + * capabilities. + */ + if (smmu_detected) + pci_request_acs(); } void __init acpi_iort_init(void)