From patchwork Mon Apr 10 11:20:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9672365 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 2A6D060244 for ; Mon, 10 Apr 2017 11:22:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB6327F9A for ; Mon, 10 Apr 2017 11:22:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1359B28111; Mon, 10 Apr 2017 11:22:52 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham 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 8352427F9A for ; Mon, 10 Apr 2017 11:22:51 +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:References: In-Reply-To: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:List-Owner; bh=DuWI+WksunxiHGUsSNbjYz53sUfRIakda9VqBOKmBu0=; b=X1EJrEZYICg1j1BJuyjvzyFAG0 FyGoDYQr7/2oaL4MCb/WgnFAhA4k/sKiC3fQ4nxy8gCm77O9NL7flzHVvA6DPlQ5IuBAT7CefNiyk +hYjLpgQs6yXs6WmXIBuJYaR8HqjtQR8u2zR066PHmascrqtlNM/ukycA0UWEnL3recQdq23TXB1+ 6ysxuMFeTWoCCIgUs7yOeRMBduvERlu9p/aZQQnMZLgPzoTpWubJvYW+LRY6nLWYDORvp5ePJtQn9 yfGJt0srisqMCe2vrzZdeZ5l/y5vMaLbPTtvW88A/o/7tzQt94t14wulRbh7OmHqWN+i1YIVrkYMG R8UCvJMQ==; 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 1cxXPF-0001EU-UZ; Mon, 10 Apr 2017 11:22:49 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cxXOs-0000Pn-NV for linux-arm-kernel@lists.infradead.org; Mon, 10 Apr 2017 11:22:32 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3095A60C91; Mon, 10 Apr 2017 11:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1491823330; bh=36T4XP5MPJ2FiWWggbnGxwVwr6nL6OWRl9zK524qLWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGF6uYNNDNifgO1mDVA38hX3EgoCaELkNic6flXhSvBdG8Fq/tqK2hgB/ccg4mNRG NFbNoFBuZA6K06SVGUZfiAZ9KgZe5i1YHl/fLA9IJoy5Mlv2Gsd38szMTN0n+ykEnX 0LT/yUNkwILYEzSZQ3nlUbjDB96UGSEfgExBOSEA= Received: from srichara-linux.qualcomm.com (unknown [202.46.23.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8668560D0C; Mon, 10 Apr 2017 11:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1491823328; bh=36T4XP5MPJ2FiWWggbnGxwVwr6nL6OWRl9zK524qLWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VxTXFEQgOyI1tR69Aod2cEqPFJt64iAe81BG4T72K7gTP7ZLQ/fper+qE6mW1CfQ+ CLC1gB79kKyh9bwFFIq8V0KM5j9uAfql1eXgOD/7g1VcF6jf6DMcnaV+gnTqbU23I0 cVTAo3hF3OUYEP0rEhpXuKhsr3buC3SJQouZIUuI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8668560D0C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sricharan@codeaurora.org From: Sricharan R To: robin.murphy@arm.com, will.deacon@arm.com, joro@8bytes.org, lorenzo.pieralisi@arm.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, m.szyprowski@samsung.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, tn@semihalf.com, hanjun.guo@linaro.org, okaya@codeaurora.org, robh+dt@kernel.org, frowand.list@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, rjw@rjwysocki.net, lenb@kernel.org, catalin.marinas@arm.com, arnd@arndb.de, linux-arch@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH V11 04/11] ACPI/IORT: Add function to check SMMUs drivers presence Date: Mon, 10 Apr 2017 16:50:59 +0530 Message-Id: <1491823266-1209-5-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491823266-1209-1-git-send-email-sricharan@codeaurora.org> References: <1491823266-1209-1-git-send-email-sricharan@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170410_042227_579489_A5A5AAC6 X-CRM114-Status: GOOD ( 11.94 ) 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: sricharan@codeaurora.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 From: Lorenzo Pieralisi The IOMMU probe deferral implementation requires a mechanism to detect if drivers for SMMU components are built-in in the kernel to detect whether IOMMU configuration for a given device should be deferred (ie SMMU drivers present but still not probed) or not (drivers not present). Add a simple function to IORT to detect if SMMU drivers for SMMU components managed by IORT are built-in in the kernel. Tested-by: Hanjun Guo Signed-off-by: Lorenzo Pieralisi Reviewed-by: Robin Murphy Cc: Sricharan R --- drivers/acpi/arm64/iort.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 4a5bb96..3dd9ec3 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -523,6 +523,19 @@ static int arm_smmu_iort_xlate(struct device *dev, u32 streamid, return ret; } +static inline bool iort_iommu_driver_enabled(u8 type) +{ + switch (type) { + case ACPI_IORT_NODE_SMMU_V3: + return IS_BUILTIN(CONFIG_ARM_SMMU_V3); + case ACPI_IORT_NODE_SMMU: + return IS_BUILTIN(CONFIG_ARM_SMMU); + default: + pr_warn("IORT node type %u does not describe an SMMU\n", type); + return false; + } +} + static const struct iommu_ops *iort_iommu_xlate(struct device *dev, struct acpi_iort_node *node, u32 streamid)