From patchwork Tue Apr 4 10:18:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9661249 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 04E9F602B9 for ; Tue, 4 Apr 2017 10:24:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA50F28307 for ; Tue, 4 Apr 2017 10:24:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEC172849D; Tue, 4 Apr 2017 10:24:38 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 DCAFE2841D for ; Tue, 4 Apr 2017 10:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753671AbdDDKTj (ORCPT ); Tue, 4 Apr 2017 06:19:39 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44840 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753419AbdDDKTf (ORCPT ); Tue, 4 Apr 2017 06:19:35 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DC79460DF5; Tue, 4 Apr 2017 10:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1491301174; bh=Kn6OKTqlzyi82VTQOluZav2hhs2cYTX57h6MP3uaxsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PcDUBhjzx0BJYZfFA2CQWHml8pPd621tiQoaq7wN4ILvelyE45/QJNW6C8/+CxWsd e6RIZM2JHfDkUjQWK2v/VGVvGbg70bWqnGq9BWcHvuR8LJ+o1a/Mre+TClSE+476OY nDxNpFyqFJo5uKrL5ynFlgEpcbXne9RopSwvl6AI= 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 896F660DDD; Tue, 4 Apr 2017 10:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1491301173; bh=Kn6OKTqlzyi82VTQOluZav2hhs2cYTX57h6MP3uaxsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2wZbx4wDVaXReWLF2pCwYRUTcPJBHtgQW3fg8mvchw8o/BbMt3C3kW5YcuaCuBfd mPsidDDB0GR18dpNQSmHQN7cJmpb0ZtrZQYR0JqxuMfMbfTjFPgjxcGPepj17Ag1dL YxyJX2SaYBVpp6hugjy7WqGNU0m6hJowGUGu7vBs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 896F660DDD 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 Cc: sricharan@codeaurora.org Subject: [PATCH V10 05/12] ACPI/IORT: Add function to check SMMUs drivers presence Date: Tue, 4 Apr 2017 15:48:18 +0530 Message-Id: <1491301105-5274-6-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491301105-5274-1-git-send-email-sricharan@codeaurora.org> References: <1489086061-9356-1-git-send-email-sricharan@codeaurora.org> <1491301105-5274-1-git-send-email-sricharan@codeaurora.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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 Cc: Robin Murphy Cc: Sricharan R Reviewed-by: Robin Murphy --- 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)