Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754025AbcKNMA6 (ORCPT ); Mon, 14 Nov 2016 07:00:58 -0500 Received: from foss.arm.com ([217.140.101.70]:55784 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932449AbcKNMAx (ORCPT ); Mon, 14 Nov 2016 07:00:53 -0500 Subject: Re: [PATCH v7 04/16] drivers: iommu: make of_iommu_set/get_ops() DT agnostic To: Lorenzo Pieralisi References: <20161109141948.19244-1-lorenzo.pieralisi@arm.com> <20161109141948.19244-5-lorenzo.pieralisi@arm.com> <20161111152248.GS2078@8bytes.org> <552e674a-f434-f08f-8e16-a94544ce8e6e@arm.com> <20161111162736.GV2078@8bytes.org> <33769e3c-265f-6e89-adf9-6d35b1e03579@arm.com> <20161114102654.GA1677@red-moon> Cc: Joerg Roedel , iommu@lists.linux-foundation.org, Will Deacon , Hanjun Guo , Marc Zyngier , "Rafael J. Wysocki" , Tomasz Nowicki , Jon Masters , Eric Auger , Sinan Kaya , Nate Watterson , Prem Mallappa , Dennis Chen , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Robin Murphy Message-ID: <41e3eff1-9ce6-bcfb-5716-c65ef38add63@arm.com> Date: Mon, 14 Nov 2016 12:00:47 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161114102654.GA1677@red-moon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2608 Lines: 54 On 14/11/16 10:26, Lorenzo Pieralisi wrote: > Hi Robin, Joerg, > > On Fri, Nov 11, 2016 at 05:43:39PM +0000, Robin Murphy wrote: >> On 11/11/16 16:27, Joerg Roedel wrote: >>> On Fri, Nov 11, 2016 at 04:17:37PM +0000, Robin Murphy wrote: >>>> In the original of_iommu_configure design, the thought was that an ops >>>> structure could be IOMMU-instance-specific (hence the later-removed >>>> "priv" member), so I suppose right now it is mostly a hangover from >>>> that. However, it's also what we initialise a device's fwspec with, so >>>> becomes important again if we're ever going to get past the limitations >>>> of buses-which-are-not-actually-buses[1]. >>> >>> Yeah, I discussed this with a few others at LPC. My current idea is to >>> tell the iommu-core which hardware-iommus exist in the system and a >>> seperate iommu_ops ptr for each of them. Then every struct device can >>> link to the iommu-instance it is translated by. >> >> Er, that sounds very much like a description of what we already have in >> 4.9-rc. Every struct device now has an iommu_fwspec which encapsulates >> both an iommu_ops pointer (which can perfectly well be per-instance if >> the IOMMU driver wants) and a place for the IOMMU-private data to >> replace the mess of archdata.iommu and driver-internal globals. >> >>> We are not there yet, but this will give you the same per-device >>> iommu-ops as implemented here. >> >> With those two patches I linked to, which make the bulk of the IOMMU >> core code per-device-ops-aware off the bat, I'd say we *are* already >> pretty much there. It's only iommu_domain_alloc() which needs a >> device-based alternative, and the non-of_xlate-based IOMMU drivers to >> either call iommu_fwspec_init() for themselves, or perhaps for x86 >> plumbing in DMAR/IVRS equivalents of the IORT parsing to the >> infrastructure provided by this series. > > I think it all boils down to how we end up implementing the per-device > iommu_ops look-up/binding, question is what do you want me to do with > this patch, it should be fine to drop it and use dev->bus->iommu_ops > for the look-up but I should know sooner rather than later to make > sure the series get another good round of testing. If we've already made the decision to move away from bus ops, I don't see that it makes sense to deliberately introduce new dependencies on them. Besides, as it stands, this patch literally implements "tell the iommu-core which hardware-iommus exist in the system and a seperate iommu_ops ptr for each of them" straight off. Robin. > > Please let me know, thank you very much. > > Lorenzo >