From patchwork Tue Jun 7 13:31:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 9161269 X-Patchwork-Delegate: bhelgaas@google.com 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 2BF1E60572 for ; Tue, 7 Jun 2016 13:33:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CC402656B for ; Tue, 7 Jun 2016 13:33:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11A5027248; Tue, 7 Jun 2016 13:33:18 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 051AB2656B for ; Tue, 7 Jun 2016 13:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932744AbcFGNc5 (ORCPT ); Tue, 7 Jun 2016 09:32:57 -0400 Received: from foss.arm.com ([217.140.101.70]:44489 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932929AbcFGNbX (ORCPT ); Tue, 7 Jun 2016 09:31:23 -0400 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 C6FA59C2; Tue, 7 Jun 2016 06:31:56 -0700 (PDT) Received: from red-moon.cambridge.arm.com (red-moon.cambridge.arm.com [10.1.203.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 01CB33F213; Tue, 7 Jun 2016 06:31:19 -0700 (PDT) From: Lorenzo Pieralisi To: iommu@lists.linux-foundation.org Cc: Lorenzo Pieralisi , Will Deacon , Robin Murphy , Joerg Roedel , Marc Zyngier , "Rafael J. Wysocki" , Tomasz Nowicki , Hanjun Guo , Jon Masters , Sinan Kaya , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v2 10/15] drivers: iommu: arm-smmu-v3: enable ACPI driver initialization Date: Tue, 7 Jun 2016 14:31:05 +0100 Message-Id: <1465306270-27076-11-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1465306270-27076-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1465306270-27076-1-git-send-email-lorenzo.pieralisi@arm.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On systems booting with ACPI that enable the ARM SMMU components in the kernel config options, the ARM SMMU v3 init function (ie arm_smmu_init(), that registers the driver and sets-up bus iommu operations) does not run only because the device tree interface (of_find_matching_node()) fails to find the respective device tree nodes for ARM SMMU devices. This works as long as there are no ARM SMMU devices to be probed with ACPI. If ARM SMMU v3 components are part of the IORT tables, for them to be instantiated and probed the function registering the ARM SMMU v3 driver must be able to register the driver and initialize the bus IOMMU operations accordingly. This patch changes the logic in arm-smmu-v3 init call to allow for it to be probed in ACPI systems. Signed-off-by: Lorenzo Pieralisi Cc: Will Deacon Cc: Robin Murphy Cc: Joerg Roedel Acked-by: Will Deacon --- drivers/iommu/arm-smmu-v3.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 75f93aa..90745a8 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2643,11 +2643,16 @@ static int __init arm_smmu_init(void) struct device_node *np; int ret; - np = of_find_matching_node(NULL, arm_smmu_of_match); - if (!np) - return 0; + if (acpi_disabled) { + np = of_find_matching_node(NULL, arm_smmu_of_match); + if (!np) + return 0; - of_node_put(np); + of_node_put(np); + } else { + if (!iort_node_match(ACPI_IORT_NODE_SMMU_V3)) + return 0; + } ret = platform_driver_register(&arm_smmu_driver); if (ret)