From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Auger Subject: [RFC 03/11] iommu: Introduce IOMMU_DOMAIN_MIXED Date: Tue, 27 Sep 2016 20:48:30 +0000 Message-ID: <1475009318-2617-4-git-send-email-eric.auger@redhat.com> References: <1475009318-2617-1-git-send-email-eric.auger@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1475009318-2617-1-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, marc.zyngier-5wv7dgnIgG8@public.gmane.org, robin.murphy-5wv7dgnIgG8@public.gmane.org, alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org, tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: drjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Manish.Jaggi-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org, p.fedin-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, pranav.sawargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, yehuday-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org List-Id: iommu@lists.linux-foundation.org We introduce a new IOMMU domain type, dubbed IOMMU_DOMAIN_MIXED. It is bound to be used as a replacement of IOMMU_DOMAIN_UNMANAGED when the IOMMU translates MSI addresses. Such domain hosts "unmanaged" reserved IOVA ranges chosen by the iommu-api user, dished out as part of alloc_iova. Rest if available for internal iova needs such as MSI frame IOVA allocation. Signed-off-by: Eric Auger --- include/linux/iommu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 5c2673a..44fe213 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -62,6 +62,9 @@ struct iommu_domain_msi_geometry { #define __IOMMU_DOMAIN_DMA_API (1U << 1) /* Domain for use in DMA-API implementation */ #define __IOMMU_DOMAIN_PT (1U << 2) /* Domain is identity mapped */ +#define __IOMMU_DOMAIN_MIXED (1U << 3) /* Domain mixing unmanaged and + * managed IOVAS + */ /* * This are the possible domain-types @@ -71,6 +74,9 @@ struct iommu_domain_msi_geometry { * IOMMU_DOMAIN_IDENTITY - DMA addresses are system physical addresses * IOMMU_DOMAIN_UNMANAGED - DMA mappings managed by IOMMU-API user, used * for VMs + * IOMMU_DOMAIN_MIXED - Most DMA mappings are managed by IOMMU-API + * users and holes are left available for + internal use such as MSI frame IOVA allocation * IOMMU_DOMAIN_DMA - Internally used for DMA-API implementations. * This flag allows IOMMU drivers to implement * certain optimizations for these domains @@ -80,6 +86,9 @@ struct iommu_domain_msi_geometry { #define IOMMU_DOMAIN_UNMANAGED (__IOMMU_DOMAIN_PAGING) #define IOMMU_DOMAIN_DMA (__IOMMU_DOMAIN_PAGING | \ __IOMMU_DOMAIN_DMA_API) +#define IOMMU_DOMAIN_MIXED (__IOMMU_DOMAIN_MIXED | \ + __IOMMU_DOMAIN_PAGING | \ + __IOMMU_DOMAIN_DMA_API) struct iommu_domain { unsigned type; -- 1.9.1