From patchwork Thu Oct 15 08:30:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 54987 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 55C7722FFA for ; Thu, 15 Oct 2015 08:36:55 +0000 (UTC) Received: by wijq8 with SMTP id q8sf6447484wij.1 for ; Thu, 15 Oct 2015 01:36:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=bdCE54u3D9ndNYgCgcSmwh3h22SnsUpwM1HEmM8dDb4=; b=C2aGT9CImWBHYcoIFiV6LY1J9K/wbkhaaUYeYStMeZKSiKekAkHs7HxPhTNA0m+gBN ZYsEUApv2JCtaC245y1YJJs7VH49PwN2+gP349NlFW6kLjWHgmXeqgJNfphatJ2If/m+ +e4WGwjlmsSz9nsS91cBw4rtJaQf6qhwBjNCfNbo7Si6Oqj0gi0HksZkW8BSdSzwFH9r CnimQ1lkyovWu5RpfXdbmklLiF/JFJg7zpBVXcUmHomwv+H5LSyFaLEZhYi1DExh/HOu qAZkth4tHByku2vBNWUh0mG3layMuaBIJImb2eud3d8/gAhxOBaDCvPke5f93f+/zen3 vpAw== X-Gm-Message-State: ALoCoQmIt4lqqRRPv880wSGoeAmVPrSWrLoxUFTgb64Ghf+/o+eCmKRw2ZKX5O5eng4naNAco0M+ X-Received: by 10.194.156.193 with SMTP id wg1mr1820012wjb.3.1444898214604; Thu, 15 Oct 2015 01:36:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.162.81 with SMTP id l78ls115625lfe.46.gmail; Thu, 15 Oct 2015 01:36:54 -0700 (PDT) X-Received: by 10.112.171.69 with SMTP id as5mr3780403lbc.111.1444898214420; Thu, 15 Oct 2015 01:36:54 -0700 (PDT) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id uc9si8378600lbb.103.2015.10.15.01.36.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 01:36:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lffv3 with SMTP id v3so24202896lff.0 for ; Thu, 15 Oct 2015 01:36:54 -0700 (PDT) X-Received: by 10.25.77.133 with SMTP id a127mr2528380lfb.19.1444898214233; Thu, 15 Oct 2015 01:36:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp479084lbq; Thu, 15 Oct 2015 01:36:53 -0700 (PDT) X-Received: by 10.66.161.234 with SMTP id xv10mr8635936pab.131.1444898213151; Thu, 15 Oct 2015 01:36:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zq5si19909475pbc.163.2015.10.15.01.36.52; Thu, 15 Oct 2015 01:36:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751745AbbJOIgt (ORCPT + 30 others); Thu, 15 Oct 2015 04:36:49 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:27611 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbbJOIgq (ORCPT ); Thu, 15 Oct 2015 04:36:46 -0400 Received: from 172.24.1.51 (EHLO szxeml433-hub.china.huawei.com) ([172.24.1.51]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CWU18554; Thu, 15 Oct 2015 16:36:25 +0800 (CST) Received: from localhost (10.177.23.164) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.235.1; Thu, 15 Oct 2015 16:36:17 +0800 From: Zhen Lei To: Catalin Marinas , Will Deacon , Joerg Roedel , linux-arm-kernel , iommu , Robin Murphy , Laurent Pinchart , linux-kernel CC: Zefan Li , Xinwei Hu , "Tianhong Ding" , Hanjun Guo , Zhen Lei Subject: [PATCH v4 4/5] iommu/arm-smmu: to backward compatible with probe non-deferral Date: Thu, 15 Oct 2015 16:30:46 +0800 Message-ID: <1444897847-18040-5-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1444897847-18040-1-git-send-email-thunder.leizhen@huawei.com> References: <1444897847-18040-1-git-send-email-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: thunder.leizhen@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch eliminate the strong dependence on Laurent's series(to support probe deferral). That means, no matter whether Laurent's series upstreamed or not, the smmu-v3 driver will always work well. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 021a846..66052e9 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1857,6 +1857,12 @@ static int arm_smmu_add_device(struct device *dev) struct pci_dev *pdev; struct device *root; + if (dev->archdata.iommu == ERR_PTR(-EPROBE_DEFER)) { + dev->archdata.iommu = NULL; + + return of_iommu_configure(dev, dev->of_node) ? 0 : -ENODEV; + } + /* only support pci devices hotplug */ if (!dev_is_pci(dev)) return -ENODEV; @@ -1930,6 +1936,11 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) return -EINVAL; smmu = platform_get_drvdata(pdev); + if (!smmu) { + dev->archdata.iommu = ERR_PTR(-EPROBE_DEFER); + + return -EPROBE_DEFER; + } if (!dev->archdata.iommu) dev->archdata.iommu = smmu; @@ -2768,7 +2779,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) /* Record our private device structure */ platform_set_drvdata(pdev, smmu); - of_iommu_set_ops(smmu->dev->of_node, &arm_smmu_ops); /* Reset the device */ ret = arm_smmu_device_reset(smmu); @@ -2840,7 +2850,13 @@ static void __exit arm_smmu_exit(void) subsys_initcall(arm_smmu_init); module_exit(arm_smmu_exit); -IOMMU_OF_DECLARE(arm_smmu_v3, "arm,smmu-v3", NULL); +static int arm_smmu_of_iommu_init(struct device_node *np) +{ + of_iommu_set_ops(np, &arm_smmu_ops); + + return 0; +} +IOMMU_OF_DECLARE(arm_smmu_v3, "arm,smmu-v3", arm_smmu_of_iommu_init); MODULE_DESCRIPTION("IOMMU API for ARM architected SMMUv3 implementations"); MODULE_AUTHOR("Will Deacon ");