From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: RFC: iommu_ops -- limitation with current attach_dev() API Date: Thu, 12 Jan 2012 15:55:00 +0100 Message-ID: <20120112145500.GB25119@8bytes.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Joerg Roedel , Alex Williamson , Scott Wood , varun.sethi@freescale.com, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, Alexander Graf To: Stuart Yoder Return-path: Received: from 8bytes.org ([88.198.83.132]:57078 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753385Ab2ALOzC (ORCPT ); Thu, 12 Jan 2012 09:55:02 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jan 10, 2012 at 11:15:54AM -0600, Stuart Yoder wrote: > We have devices that are capable of and need to access multiple > domains. At the hardware level the device has multiple 'logical > I/O device numbers' which is the index into our IOMMU tables. This > means the device can target DMA operations to 2 different > address spaces. Your IOMMU is a real challenge it seems ;-) > In some internal discussions here at Freescale, here were some > of our initial ideas: > > -in 'struct device' define a new list of hardware/physical DMA 'domains' > that represent each address space a device can target: > > struct list_head iommu_hw_domain_head; I think we really should introduce a dev->iommu pointer which can be used by IOMMU drivers. Your hardware is on the third architecture needing such a pointer and hiding it in dev->archdata. > That list would get populated when the device struct is > initialized with an arch specific list of the hardware 'domains'. > > -define a new iommu_ops function to add devices with this hardware > domain info: > > extern int iommu_attach_device_ext(struct iommu_domain *domain, > struct device *dev, void *iommu_hw_domain); How about just enumerating the device address spaces with an u32 and use that to assign the domains. Or is an in-kernel descriptor for the hardware-side really needed? If so, why? Joerg