From patchwork Mon Jan 23 16:18:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9532981 X-Patchwork-Delegate: agross@codeaurora.org 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 CB5076042D for ; Mon, 23 Jan 2017 16:19:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0732846E for ; Mon, 23 Jan 2017 16:19:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF02028471; Mon, 23 Jan 2017 16:19:05 +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 62DF42846B for ; Mon, 23 Jan 2017 16:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751449AbdAWQS6 (ORCPT ); Mon, 23 Jan 2017 11:18:58 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:34480 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347AbdAWQS5 (ORCPT ); Mon, 23 Jan 2017 11:18:57 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8438E607F0; Mon, 23 Jan 2017 16:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1485188336; bh=pfoZ7nOB+6nt+7Of3UFED1H/Og0537QGdPFltGM6M/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEvKK6sjuekbBPw9EscSmxpKzpqZpiHllCwyNCE0cINYECJ7aCSWOZeE/l383vg1h oPF0roVib//80r4eLoRvpv5RVD1wD6fLfvoHhl0zQF6gojTTN8BwjFoTf85jJFZKJf hXTRnQGOkhHWtHfOJUNLVbyYYD1/Dx6UNFzLTMbo= Received: from blr-ubuntu-32.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 93D8960A0C; Mon, 23 Jan 2017 16:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1485188329; bh=pfoZ7nOB+6nt+7Of3UFED1H/Og0537QGdPFltGM6M/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wq/Y9A7hMHxUKQgbr9NMoImErpbbLaW1ODr5sqGBT0+bR7f/sPIno5/BJvXuNtFwb ZjDkxL43U6FfE9gbcMxNMHtZvdkfZxvTj7Kd2JaAcaTuQOSfhrcqrr02/ezSF5rxZe ql/JXM4GxrA5R0Lt3P/aznaeqNLSEoa4N+lcgmQc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 93D8960A0C 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 Cc: sricharan@codeaurora.org Subject: [PATCH V7 05/11] ACPI/IORT: Add function to check SMMUs drivers presence Date: Mon, 23 Jan 2017 21:48:07 +0530 Message-Id: <1485188293-20263-6-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1485188293-20263-1-git-send-email-sricharan@codeaurora.org> References: <1485188293-20263-1-git-send-email-sricharan@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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. Signed-off-by: Lorenzo Pieralisi Cc: 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 e0d2e6e..bf0ed09 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)