Received: by 10.213.65.68 with SMTP id h4csp896328imn; Wed, 4 Apr 2018 09:03:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx48npQC08HGCZUE9T51CDpWv1QQXxZrf4vfwJA62FYTxCI9HZaly8WNnYChXZUr0RPDlRmDe X-Received: by 10.98.10.156 with SMTP id 28mr14362333pfk.33.1522857796794; Wed, 04 Apr 2018 09:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522857796; cv=none; d=google.com; s=arc-20160816; b=F+y6ahfOYa84ERwJ45xHYk2aU0fFeXSsJ4fpWZ0KtZr91ykx9NEu8E20HVRAWX+DHV 9BzLBqUlAYyow+OizgpcCGBGVhhOLdUD9rZefRV333H4Xu69C2K1zHtMklizZMVB4xug u0CranZwj9W0jpJlwjk5O9V0wb5MPTqu9RAqIOETBbzJNlSt+3ODrn0Zrgyzj1qDagQM lkB1c176XKZ8T98czHwmcYumxRkMmN5K5aqVGk4l64SkPSRryErekNCSyDRf3gjNzG65 ZmgOBsaB/zS3wYyBBFXYinyR9j81JsSehRHr4smDy80m8Xw4EenJywaZIaf1BtfIX1EV M0fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=XMRdbyJcPPOmmYjOw9vw2elB8GE3ADAVOjGnyG6+crc=; b=NmRc8LsZlM4ZVtsrz1cA7L72ZbzBVFuHQqOSmT8mUBNTmJ9mPVgTnjqhwdQsX71seo frs4LGwj6WWd3ZRXeKm6ILk/mS86ezr4nBcYn0WaB6FdNMq+6qAe/CVmjMfT+mQNkhbD aWQBpsKHWBObvJZBI2ot5bjNA4l/8axpInTUkIVBbXuAQbaNSagBA+fc3+6rxiKYNyyV kHrVyujjDxhktFReITJybvZnhTSgkqxLQdhDU9VbnPDeH2R6ClSXdFgJ9lksp5g7bj+j dGDgNbqA6yybEWLKIZ+0H/FwJHC4gNmtU9zXrd6hQIJLhs4eDmPH6EyRn2MuaClZh1V1 oBEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v190si3879565pgb.67.2018.04.04.09.03.02; Wed, 04 Apr 2018 09:03:16 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbeDDQBr (ORCPT + 99 others); Wed, 4 Apr 2018 12:01:47 -0400 Received: from foss.arm.com ([217.140.101.70]:46214 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbeDDQBp (ORCPT ); Wed, 4 Apr 2018 12:01:45 -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 555501529; Wed, 4 Apr 2018 09:01:45 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AEF153F24A; Wed, 4 Apr 2018 09:01:43 -0700 (PDT) Date: Wed, 4 Apr 2018 17:01:38 +0100 From: Lorenzo Pieralisi To: Wang Dongsheng Cc: rjw@rjwysocki.net, gregkh@linuxfoundation.org, hanjun.guo@linaro.org, sudeep.holla@arm.com, yu.zheng@hxt-semitech.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com Subject: Re: [RFC PATCH 2/2] ACPI/IORT: use swiotlb_dma_ops when smmu probe failed Message-ID: <20180404160138.GA9317@e107981-ln.cambridge.arm.com> References: <1522317660-11080-1-git-send-email-dongsheng.wang@hxt-semitech.com> <1522317660-11080-3-git-send-email-dongsheng.wang@hxt-semitech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522317660-11080-3-git-send-email-dongsheng.wang@hxt-semitech.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc Robin] On Thu, Mar 29, 2018 at 03:01:00AM -0700, Wang Dongsheng wrote: > If SMMU probe failed, master should use swiotlb as dma ops. > SMMU may probe failed with specified environment, so there > are not any iommu resources in iommu_device_list. > > The master will always get EPROBE_DEFER from really_probe > (dma_configure) but in fact SMMU has probe failed. The issue > causes all of masters failed to be driven. I added Robin to pick his brain. An alternative would consist in using a bus notifier to prevent deferred probing once the SMMU driver probing failed but that seems backwards given that a major reason to move to deferred probing was to remove the bus notifiers dependency in the first place. It seems to me this is both an OF/ACPI issue - it is not an IORT only problem. Lorenzo > Signed-off-by: Wang Dongsheng > --- > drivers/acpi/arm64/iort.c | 39 +++++++++++++++++++++++++++++++++------ > 1 file changed, 33 insertions(+), 6 deletions(-) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index e2f7bdd..a6f4c27 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -774,17 +774,45 @@ static int arm_smmu_iort_xlate(struct device *dev, u32 streamid, > return ret; > } > > -static inline bool iort_iommu_driver_enabled(u8 type) > +static int iort_check_dev_dl_status(struct device *dev, void *data) > { > + struct fwnode_handle *fwnode = data; > + > + if (dev->fwnode != fwnode) > + return 0; > + > + if (dev->links.status == DL_DEV_PROBE_FAILED) > + return -ENODEV; > + > + return -EPROBE_DEFER; > +} > + > +static int iort_iommu_driver_enabled(u8 type, struct fwnode_handle *fwnode) > +{ > + bool buildin; > + int ret; > + > switch (type) { > case ACPI_IORT_NODE_SMMU_V3: > - return IS_BUILTIN(CONFIG_ARM_SMMU_V3); > + buildin = IS_BUILTIN(CONFIG_ARM_SMMU_V3); > + break; > case ACPI_IORT_NODE_SMMU: > - return IS_BUILTIN(CONFIG_ARM_SMMU); > + buildin = IS_BUILTIN(CONFIG_ARM_SMMU); > + break; > default: > pr_warn("IORT node type %u does not describe an SMMU\n", type); > - return false; > + buildin = false; > } > + > + if (!buildin) > + return -ENODEV; > + > + ret = bus_for_each_dev(&platform_bus_type, NULL, fwnode, > + iort_check_dev_dl_status); > + if (!ret) > + return -EPROBE_DEFER; > + > + return ret; > } > > #ifdef CONFIG_IOMMU_API > @@ -919,8 +947,7 @@ static int iort_iommu_xlate(struct device *dev, struct acpi_iort_node *node, > */ > ops = iommu_ops_from_fwnode(iort_fwnode); > if (!ops) > - return iort_iommu_driver_enabled(node->type) ? > - -EPROBE_DEFER : -ENODEV; > + return iort_iommu_driver_enabled(node->type, iort_fwnode); > > return arm_smmu_iort_xlate(dev, streamid, iort_fwnode, ops); > } > -- > 2.7.4 >