From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: RFC: extend iommu_ops with domain attributes API Date: Thu, 12 Jan 2012 10:14:31 -0700 Message-ID: <1326388471.2958.2.camel@x201.home> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Alexey Kardashevskiy , Joerg Roedel , Scott Wood , Alexander Graf , kvm@vger.kernel.org, iommu@lists.linux-foundation.org, varun.sethi@freescale.com To: Stuart Yoder Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1025 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754543Ab2ALROo (ORCPT ); Thu, 12 Jan 2012 12:14:44 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2012-01-10 at 10:22 -0600, Stuart Yoder wrote: > As we work on mapping the Freescale IOMMU (called PAMU) into the existing > Linux iommu infrastructure, one issue is that we have additional domain > attributes that need to be set. This was discussed briefly a month ago > or so and I believe there was a need for a similar mechanism by IBM. > > We are proposing a couple of APIs to be added to iommu_ops to > get/set domain attributes: > > int domain_set_attr(struct iommu_domain *domain, int attr_type, void *data); > int domain_get_attr(struct iommu_domain *domain, int attr_type, void *data); > > A couple of the attributes I'm considering PAMU specific with a generic > enable attribute: > > enum iommu_attr_type { > IOMMU_ATTR_PAMU_GEOMETRY, // the PAMU geometry for the domain > IOMMU_ATTR_PAMU_STASH, // stash characteristics for a domain > IOMMU_ATTR_ENABLE > }; > > The data for each attribute value is defined as: > > IOMMU_ATTR_PAMU_GEOMETRY - data is a struct: > > struct dma_geometry_attr { > u64 iova; // iova of the DMA domain > u32 size; // must be a power of 2 and be greater > // or equal than 4KB. > u32 subwin_cnt; // power of 2 between 1 and 256 Agree with Joerg's comments. size/subwin count should probably both be u64 if generalized and the restrictions would be iommu dependent. Is this also where we should expose a bitmap of available mapping sizes? Thanks, Alex