Received: by 10.223.164.202 with SMTP id h10csp3874121wrb; Mon, 20 Nov 2017 06:26:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMY883FPZunhk65LE/Z933n9NNFclF8sAK1BN5kT3vHk2zeNq1hOrmDj5SQLqgnZQN+wpLvV X-Received: by 10.99.126.6 with SMTP id z6mr13962791pgc.305.1511187984503; Mon, 20 Nov 2017 06:26:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511187984; cv=none; d=google.com; s=arc-20160816; b=gQy2lkI9/yfwjdyOnNTZflwjnDXcc9gMIdO60ocsG0+VzFFM1bSHytjkXmbhMHvWsL cJ1MHAR0N5kI7IOePfmgaoQNcZzlrNFxx6qk6+dmS9I0LXrvS/XqB67yE6XcfBJIHjiy 7oazTMN2vnKG+iOS5FPMfYMJ/6+z8Vjg1sKDCPN+xZ0DGcoU9T2x70zPQAx+XImRof+C xhcGBIwXzhYVOlbCrifw3Ys/4rLOdSbbgTy0/m1PjeZuygRlat/BlriTfiYZr1/dMXVL 3L1Lqp2e3cFp0dvYwtJU3Og2xPbh0KI7kCObLk2Eo/BsTmsMo+bCN9TCFYUYm8fX/gB9 CDhw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=TT7tLZgiYNYjPUVMnuB+5D74wn4c+47lA+YnS7r655o=; b=pKf9sjsTmnfX4zz5Gl0zIe/FFEH3S4ShNBMLXaXNnrim1QqWfYU4+B8hbVduWq2JaD 3OoqAxRPBNJtgDWN9L7+PBCfgfZ9LNd/meQa1udMJvSC5kwGY5CSzh1mYWuxLurG760n mknJRerHkGrHr26ZSQ9YEduAytANP1lEFHskCFSp/DwwOCjLGXveEmF1U3aXlor8nE3p TeRrxwevlLXhA9TM6CZup93sXbDudCsf6nT/hShY6OexuaTbTIW82wB5/ksLBTDLV8WV I+O7UUH3kyISvF5bCAGtkKWk0OxHLZd1Vce+FnwYM2zSDlCFvoZBDXbfAO9nm8Dt2gpb tNXQ== 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 i62si6476487pli.604.2017.11.20.06.26.14; Mon, 20 Nov 2017 06:26:24 -0800 (PST) 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 S1751282AbdKTOZR (ORCPT + 66 others); Mon, 20 Nov 2017 09:25:17 -0500 Received: from foss.arm.com ([217.140.101.70]:58068 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbdKTOZQ (ORCPT ); Mon, 20 Nov 2017 09:25:16 -0500 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 4AF4E1596; Mon, 20 Nov 2017 06:25:16 -0800 (PST) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E49653F487; Mon, 20 Nov 2017 06:25:15 -0800 (PST) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 423F168037E; Mon, 20 Nov 2017 14:25:14 +0000 (GMT) Date: Mon, 20 Nov 2017 14:25:14 +0000 From: Liviu Dudau To: Robin Murphy Cc: Joerg Roedel , Laurent Pinchart , Geert Uytterhoeven , Shawn Lin , Magnus Damm , LKML , IOMMU ML Subject: Re: [PATCH v2] iommu/ipmmu-vmsa: Do not replace bus IOMMU ops on driver init. Message-ID: <20171120142514.GI5165@e110455-lin.cambridge.arm.com> References: <20170918100444.21878-1-Liviu.Dudau@arm.com> <20170920141352.29377-1-Liviu.Dudau@arm.com> <938d213c-f207-218e-554f-08035eaa1e6d@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <938d213c-f207-218e-554f-08035eaa1e6d@arm.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 13, 2017 at 04:48:45PM +0100, Robin Murphy wrote: > Hi Joerg, Hi, > > On 20/09/17 15:13, Liviu Dudau wrote: > > If the IPMMU driver is compiled in the kernel it will replace the > > platform bus IOMMU ops on running the ipmmu_init() function, regardless > > if there is any IPMMU hardware present or not. This screws up systems > > that just want to build a generic kernel that runs on multiple platforms > > and use a different IOMMU implementation. > > > > Move the bus_set_iommu() call at the end of the ipmmu_probe() function > > when we know that hardware is present. With current IOMMU framework it > > should be safe (at least for OF case). > > > > Now that the ipmmu_init() and ipmmu_exit() functions are simple calls to > > platform_driver_register() and platform_driver_unregister(), replace > > them with the module_platform_driver() macro call. > > Are you OK with taking this patch as a fix for 4.14, or would you rather > have something that can safely backport past 4.12 without implicit > dependencies? This is a config/link-order dependent thing that's been > lurking since the beginning, but only coming to light now that other > drivers are changing their behaviour, so I don't think there's really a > single Fixes: commit that can be singled out. Can someone update me on the fate of this patch? Can someone queue it for the next release? Best regards, Liviu > > Robin. > > > Signed-off-by: Liviu Dudau > > Cc: Laurent Pinchart > > --- > > drivers/iommu/ipmmu-vmsa.c | 29 +++++------------------------ > > 1 file changed, 5 insertions(+), 24 deletions(-) > > > > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c > > index 195d6e93ac718..31912997bffdf 100644 > > --- a/drivers/iommu/ipmmu-vmsa.c > > +++ b/drivers/iommu/ipmmu-vmsa.c > > @@ -966,10 +966,11 @@ static int ipmmu_probe(struct platform_device *pdev) > > return ret; > > > > /* > > - * We can't create the ARM mapping here as it requires the bus to have > > - * an IOMMU, which only happens when bus_set_iommu() is called in > > - * ipmmu_init() after the probe function returns. > > + * Now that we have validated the presence of the hardware, set > > + * the bus IOMMU ops to enable future domain and device setup. > > */ > > + if (!iommu_present(&platform_bus_type)) > > + bus_set_iommu(&platform_bus_type, &ipmmu_ops); > > > > platform_set_drvdata(pdev, mmu); > > > > @@ -1006,27 +1007,7 @@ static struct platform_driver ipmmu_driver = { > > .remove = ipmmu_remove, > > }; > > > > -static int __init ipmmu_init(void) > > -{ > > - int ret; > > - > > - ret = platform_driver_register(&ipmmu_driver); > > - if (ret < 0) > > - return ret; > > - > > - if (!iommu_present(&platform_bus_type)) > > - bus_set_iommu(&platform_bus_type, &ipmmu_ops); > > - > > - return 0; > > -} > > - > > -static void __exit ipmmu_exit(void) > > -{ > > - return platform_driver_unregister(&ipmmu_driver); > > -} > > - > > -subsys_initcall(ipmmu_init); > > -module_exit(ipmmu_exit); > > +module_platform_driver(ipmmu_driver); > > > > MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU"); > > MODULE_AUTHOR("Laurent Pinchart "); > > > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯ From 1581157993679606603@xxx Fri Oct 13 15:49:28 +0000 2017 X-GM-THRID: 1578902883289057090 X-Gmail-Labels: Inbox,Category Forums