From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dennis Chen Subject: Re: [PATCH v11 4/8] iommu/msi-iommu: initialization Date: Wed, 20 Jul 2016 19:43:38 +0800 Message-ID: <20160720114337.GB1915@arm.com> References: <1468932911-23062-1-git-send-email-eric.auger@redhat.com> <1468932911-23062-5-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: <1468932911-23062-5-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Content-Disposition: inline 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 Cc: jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, marc.zyngier-5wv7dgnIgG8@public.gmane.org, andre.przywara-5wv7dgnIgG8@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org, robert.richter-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, nd-5wv7dgnIgG8@public.gmane.org, Manish.Jaggi-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org, christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org List-Id: kvmarm@lists.cs.columbia.edu Hi Eric, Some small questions/comments below: On Tue, Jul 19, 2016 at 12:55:07PM +0000, Eric Auger wrote: > iommu_get/put_msi_cookie allocates/frees the resource used to store > and ref count the MSI doorbell mappings. iommu_msi_set_aperture > initializes the iova domain used for MSI IOVA allocation and sets the > iommu domain's msi geometry. > > The implementation relies on dma-iommu API and iova API. > > New msi functions are fully implemented if CONFIG_IOMMU_MSI is set. > > Signed-off-by: Eric Auger > > --- > v10: > - split error management in iommu_msi_set_aperture > > v9: > - remove is_aperture_set and use iommu_domain_msi_aperture_valid helper > instead > - set iommu domain's msi geometry > > v8: > - new design where msi-iommu relies on dma-iommu > - remove the iommu_domain * from the doorbell_mapping struct > - added is_aperture_set > > v7: > - fix locking > - add iova_cache_get/put > - static inline functions when CONFIG_IOMMU_DMA_RESERVED is not set > - introduce struct reserved_iova_domain to encapsulate prot info & > add prot parameter in alloc_reserved_iova_domain > > v5 -> v6: > - use spin lock instead of mutex > > v3 -> v4: > - formerly in "iommu/arm-smmu: implement alloc/free_reserved_iova_domain" & > "iommu: add alloc/free_reserved_iova_domain" > > v2 -> v3: > - remove iommu_alloc_reserved_iova_domain & iommu_free_reserved_iova_domain > static implementation in case CONFIG_IOMMU_API is not set > > v1 -> v2: > - moved from vfio API to IOMMU API > --- > drivers/iommu/Kconfig | 7 ++++ > drivers/iommu/Makefile | 1 + > drivers/iommu/msi-iommu.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ > include/linux/msi-iommu.h | 65 ++++++++++++++++++++++++++++++ > 4 files changed, 173 insertions(+) > create mode 100644 drivers/iommu/msi-iommu.c > create mode 100644 include/linux/msi-iommu.h > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index ad08603..5ea1610 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -74,6 +74,11 @@ config IOMMU_DMA > select IOMMU_IOVA > select NEED_SG_DMA_LENGTH > > +# IOMMU MSI mapping > +config IOMMU_MSI > + bool > + select IOMMU_DMA > + > config FSL_PAMU > bool "Freescale IOMMU support" > depends on PPC_E500MC || (COMPILE_TEST && PPC) > @@ -296,6 +301,7 @@ config SPAPR_TCE_IOMMU > config ARM_SMMU > bool "ARM Ltd. System MMU (SMMU) Support" > depends on (ARM64 || ARM) && MMU > + select IOMMU_MSI > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select ARM_DMA_USE_IOMMU if ARM > @@ -309,6 +315,7 @@ config ARM_SMMU > config ARM_SMMU_V3 > bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > depends on ARM64 && PCI > + select IOMMU_MSI > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select GENERIC_MSI_IRQ_DOMAIN > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index c6edb31..a381e66 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -2,6 +2,7 @@ obj-$(CONFIG_IOMMU_API) += iommu.o > obj-$(CONFIG_IOMMU_API) += iommu-traces.o > obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o > obj-$(CONFIG_IOMMU_DMA) += dma-iommu.o > +obj-$(CONFIG_IOMMU_MSI) += msi-iommu.o > obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o > obj-$(CONFIG_IOMMU_IO_PGTABLE_ARMV7S) += io-pgtable-arm-v7s.o > obj-$(CONFIG_IOMMU_IO_PGTABLE_LPAE) += io-pgtable-arm.o > diff --git a/drivers/iommu/msi-iommu.c b/drivers/iommu/msi-iommu.c > new file mode 100644 > index 0000000..de02ede > --- /dev/null > +++ b/drivers/iommu/msi-iommu.c > @@ -0,0 +1,100 @@ > +/* > + * Reserved IOVA Management > + * > + * Copyright (c) 2015 Linaro Ltd. > + * www.linaro.org > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +struct doorbell_mapping { > + struct kref kref; > + struct list_head next; > + phys_addr_t addr; > + dma_addr_t iova; > + size_t size; > +}; > + > +struct doorbell_mapping_info { > + struct list_head list; /* list of doorbell mapping entries */ > + spinlock_t lock; > +}; > + > +int iommu_get_msi_cookie(struct iommu_domain *domain) > +{ > + struct doorbell_mapping_info *dmi; > + int ret; > + > + if (domain->msi_cookie || domain->iova_cookie) > + return -EINVAL; > + > + ret = iommu_get_dma_cookie(domain); > + if (ret) > + return ret; > + > + dmi = kzalloc(sizeof(*dmi), GFP_KERNEL); if dmi == NULL here, > + > + INIT_LIST_HEAD(&dmi->list); > + spin_lock_init(&dmi->lock); will the above 2-line codes triger kernel NULL pointer dereference panic message? if so why don't we check dmi immediately after the kzalloc call like this: dmi = kzalloc(sizeof(*dmi), GFP_KERNEL); domain->msi_cookie = dmi; if (!dmi) return -ENOMEM; > + iova_cache_get(); return iova_cache_get(); > + > + domain->msi_cookie = dmi; > + > + return dmi ? 0 : -ENOMEM; > +} > +EXPORT_SYMBOL(iommu_get_msi_cookie); > + > +void iommu_put_msi_cookie(struct iommu_domain *domain) > +{ > + struct doorbell_mapping_info *dmi = domain->msi_cookie; > + > + if (!dmi) > + return; > + > + domain->msi_cookie = NULL; > + > + WARN_ON(!list_empty(&dmi->list)); > + > + kfree(dmi); > + iommu_put_dma_cookie(domain); > + iova_cache_put(); > +} > +EXPORT_SYMBOL(iommu_put_msi_cookie); > + > +int iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end) > +{ > + struct doorbell_mapping_info *dmi = domain->msi_cookie; > + int ret; > + > + if (!dmi) > + return -ENODEV; > + > + if (iommu_domain_msi_aperture_valid(domain)) > + return -EINVAL; > + > + ret = iommu_dma_init_domain(domain, start, end - start + 1); > + > + if (!ret) { > + domain->msi_geometry.aperture_start = start; > + domain->msi_geometry.aperture_end = end; > + } > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(iommu_msi_set_aperture); > + > diff --git a/include/linux/msi-iommu.h b/include/linux/msi-iommu.h > new file mode 100644 > index 0000000..392aa6f > --- /dev/null > +++ b/include/linux/msi-iommu.h > @@ -0,0 +1,65 @@ > +/* > + * Copyright (c) 2015 Linaro Ltd. > + * www.linaro.org > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > +#ifndef __MSI_IOMMU_H > +#define __MSI_IOMMU_H > + > +#include > +#include > + > +struct iommu_domain; > + > +#ifdef CONFIG_IOMMU_MSI > + > +/** > + * iommu_get_msi_cookie - Acquire MSI mapping resources for a domain > + * @domain: IOMMU domain to prepare for MSI mapping > + * > + * IOMMU drivers which require MSI mapping should normally call this > + * from their domain_alloc callback when domain->type == > + * IOMMU_DOMAIN_UNMANAGED. > + */ > +int iommu_get_msi_cookie(struct iommu_domain *domain); > + > +/** > + * iommu_put_msi_cookie - Release a domain's MSI mapping resources > + * @domain: IOMMU domain previously prepared by iommu_get_msi_cookie() > + * > + * IOMMU drivers requesting MSI mapping should normally call this from > + * their domain_free callback. > + */ > +void iommu_put_msi_cookie(struct iommu_domain *domain); > + > +/** > + * iommu_msi_set_aperture: allocate the msi iova domain > + * according to the specified start/end IOVAs > + * > + * @domain: iommu domain handle > + * @start: MSI iova start address > + * @end: MSI iova end address > + */ > +int iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end); > + > +#else > + > +static inline int > +iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end) > +{ > + return -ENOENT; > +} > + > +#endif /* CONFIG_IOMMU_MSI */ > +#endif /* __MSI_IOMMU_H */ > -- > 1.9.1 > > _______________________________________________ > kvmarm mailing list > kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm > From mboxrd@z Thu Jan 1 00:00:00 1970 From: dennis.chen@arm.com (Dennis Chen) Date: Wed, 20 Jul 2016 19:43:38 +0800 Subject: [PATCH v11 4/8] iommu/msi-iommu: initialization In-Reply-To: <1468932911-23062-5-git-send-email-eric.auger@redhat.com> References: <1468932911-23062-1-git-send-email-eric.auger@redhat.com> <1468932911-23062-5-git-send-email-eric.auger@redhat.com> Message-ID: <20160720114337.GB1915@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Eric, Some small questions/comments below: On Tue, Jul 19, 2016 at 12:55:07PM +0000, Eric Auger wrote: > iommu_get/put_msi_cookie allocates/frees the resource used to store > and ref count the MSI doorbell mappings. iommu_msi_set_aperture > initializes the iova domain used for MSI IOVA allocation and sets the > iommu domain's msi geometry. > > The implementation relies on dma-iommu API and iova API. > > New msi functions are fully implemented if CONFIG_IOMMU_MSI is set. > > Signed-off-by: Eric Auger > > --- > v10: > - split error management in iommu_msi_set_aperture > > v9: > - remove is_aperture_set and use iommu_domain_msi_aperture_valid helper > instead > - set iommu domain's msi geometry > > v8: > - new design where msi-iommu relies on dma-iommu > - remove the iommu_domain * from the doorbell_mapping struct > - added is_aperture_set > > v7: > - fix locking > - add iova_cache_get/put > - static inline functions when CONFIG_IOMMU_DMA_RESERVED is not set > - introduce struct reserved_iova_domain to encapsulate prot info & > add prot parameter in alloc_reserved_iova_domain > > v5 -> v6: > - use spin lock instead of mutex > > v3 -> v4: > - formerly in "iommu/arm-smmu: implement alloc/free_reserved_iova_domain" & > "iommu: add alloc/free_reserved_iova_domain" > > v2 -> v3: > - remove iommu_alloc_reserved_iova_domain & iommu_free_reserved_iova_domain > static implementation in case CONFIG_IOMMU_API is not set > > v1 -> v2: > - moved from vfio API to IOMMU API > --- > drivers/iommu/Kconfig | 7 ++++ > drivers/iommu/Makefile | 1 + > drivers/iommu/msi-iommu.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ > include/linux/msi-iommu.h | 65 ++++++++++++++++++++++++++++++ > 4 files changed, 173 insertions(+) > create mode 100644 drivers/iommu/msi-iommu.c > create mode 100644 include/linux/msi-iommu.h > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index ad08603..5ea1610 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -74,6 +74,11 @@ config IOMMU_DMA > select IOMMU_IOVA > select NEED_SG_DMA_LENGTH > > +# IOMMU MSI mapping > +config IOMMU_MSI > + bool > + select IOMMU_DMA > + > config FSL_PAMU > bool "Freescale IOMMU support" > depends on PPC_E500MC || (COMPILE_TEST && PPC) > @@ -296,6 +301,7 @@ config SPAPR_TCE_IOMMU > config ARM_SMMU > bool "ARM Ltd. System MMU (SMMU) Support" > depends on (ARM64 || ARM) && MMU > + select IOMMU_MSI > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select ARM_DMA_USE_IOMMU if ARM > @@ -309,6 +315,7 @@ config ARM_SMMU > config ARM_SMMU_V3 > bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > depends on ARM64 && PCI > + select IOMMU_MSI > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select GENERIC_MSI_IRQ_DOMAIN > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index c6edb31..a381e66 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -2,6 +2,7 @@ obj-$(CONFIG_IOMMU_API) += iommu.o > obj-$(CONFIG_IOMMU_API) += iommu-traces.o > obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o > obj-$(CONFIG_IOMMU_DMA) += dma-iommu.o > +obj-$(CONFIG_IOMMU_MSI) += msi-iommu.o > obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o > obj-$(CONFIG_IOMMU_IO_PGTABLE_ARMV7S) += io-pgtable-arm-v7s.o > obj-$(CONFIG_IOMMU_IO_PGTABLE_LPAE) += io-pgtable-arm.o > diff --git a/drivers/iommu/msi-iommu.c b/drivers/iommu/msi-iommu.c > new file mode 100644 > index 0000000..de02ede > --- /dev/null > +++ b/drivers/iommu/msi-iommu.c > @@ -0,0 +1,100 @@ > +/* > + * Reserved IOVA Management > + * > + * Copyright (c) 2015 Linaro Ltd. > + * www.linaro.org > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +struct doorbell_mapping { > + struct kref kref; > + struct list_head next; > + phys_addr_t addr; > + dma_addr_t iova; > + size_t size; > +}; > + > +struct doorbell_mapping_info { > + struct list_head list; /* list of doorbell mapping entries */ > + spinlock_t lock; > +}; > + > +int iommu_get_msi_cookie(struct iommu_domain *domain) > +{ > + struct doorbell_mapping_info *dmi; > + int ret; > + > + if (domain->msi_cookie || domain->iova_cookie) > + return -EINVAL; > + > + ret = iommu_get_dma_cookie(domain); > + if (ret) > + return ret; > + > + dmi = kzalloc(sizeof(*dmi), GFP_KERNEL); if dmi == NULL here, > + > + INIT_LIST_HEAD(&dmi->list); > + spin_lock_init(&dmi->lock); will the above 2-line codes triger kernel NULL pointer dereference panic message? if so why don't we check dmi immediately after the kzalloc call like this: dmi = kzalloc(sizeof(*dmi), GFP_KERNEL); domain->msi_cookie = dmi; if (!dmi) return -ENOMEM; > + iova_cache_get(); return iova_cache_get(); > + > + domain->msi_cookie = dmi; > + > + return dmi ? 0 : -ENOMEM; > +} > +EXPORT_SYMBOL(iommu_get_msi_cookie); > + > +void iommu_put_msi_cookie(struct iommu_domain *domain) > +{ > + struct doorbell_mapping_info *dmi = domain->msi_cookie; > + > + if (!dmi) > + return; > + > + domain->msi_cookie = NULL; > + > + WARN_ON(!list_empty(&dmi->list)); > + > + kfree(dmi); > + iommu_put_dma_cookie(domain); > + iova_cache_put(); > +} > +EXPORT_SYMBOL(iommu_put_msi_cookie); > + > +int iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end) > +{ > + struct doorbell_mapping_info *dmi = domain->msi_cookie; > + int ret; > + > + if (!dmi) > + return -ENODEV; > + > + if (iommu_domain_msi_aperture_valid(domain)) > + return -EINVAL; > + > + ret = iommu_dma_init_domain(domain, start, end - start + 1); > + > + if (!ret) { > + domain->msi_geometry.aperture_start = start; > + domain->msi_geometry.aperture_end = end; > + } > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(iommu_msi_set_aperture); > + > diff --git a/include/linux/msi-iommu.h b/include/linux/msi-iommu.h > new file mode 100644 > index 0000000..392aa6f > --- /dev/null > +++ b/include/linux/msi-iommu.h > @@ -0,0 +1,65 @@ > +/* > + * Copyright (c) 2015 Linaro Ltd. > + * www.linaro.org > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > +#ifndef __MSI_IOMMU_H > +#define __MSI_IOMMU_H > + > +#include > +#include > + > +struct iommu_domain; > + > +#ifdef CONFIG_IOMMU_MSI > + > +/** > + * iommu_get_msi_cookie - Acquire MSI mapping resources for a domain > + * @domain: IOMMU domain to prepare for MSI mapping > + * > + * IOMMU drivers which require MSI mapping should normally call this > + * from their domain_alloc callback when domain->type == > + * IOMMU_DOMAIN_UNMANAGED. > + */ > +int iommu_get_msi_cookie(struct iommu_domain *domain); > + > +/** > + * iommu_put_msi_cookie - Release a domain's MSI mapping resources > + * @domain: IOMMU domain previously prepared by iommu_get_msi_cookie() > + * > + * IOMMU drivers requesting MSI mapping should normally call this from > + * their domain_free callback. > + */ > +void iommu_put_msi_cookie(struct iommu_domain *domain); > + > +/** > + * iommu_msi_set_aperture: allocate the msi iova domain > + * according to the specified start/end IOVAs > + * > + * @domain: iommu domain handle > + * @start: MSI iova start address > + * @end: MSI iova end address > + */ > +int iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end); > + > +#else > + > +static inline int > +iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end) > +{ > + return -ENOENT; > +} > + > +#endif /* CONFIG_IOMMU_MSI */ > +#endif /* __MSI_IOMMU_H */ > -- > 1.9.1 > > _______________________________________________ > kvmarm mailing list > kvmarm at lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753668AbcGTLoB (ORCPT ); Wed, 20 Jul 2016 07:44:01 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:40212 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753278AbcGTLnx convert rfc822-to-8bit (ORCPT ); Wed, 20 Jul 2016 07:43:53 -0400 Date: Wed, 20 Jul 2016 19:43:38 +0800 From: Dennis Chen To: Eric Auger CC: , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v11 4/8] iommu/msi-iommu: initialization Message-ID: <20160720114337.GB1915@arm.com> References: <1468932911-23062-1-git-send-email-eric.auger@redhat.com> <1468932911-23062-5-git-send-email-eric.auger@redhat.com> MIME-Version: 1.0 In-Reply-To: <1468932911-23062-5-git-send-email-eric.auger@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140;IPV:CAL;SCL:-1;CTRY:GB;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(24454002)(199003)(97756001)(46406003)(4001350100001)(26826002)(83506001)(47776003)(15975445007)(92566002)(76176999)(50986999)(23726003)(54356999)(586003)(33656002)(2906002)(2950100001)(1076002)(110136002)(77096005)(189998001)(19580405001)(19580395003)(4326007)(246002)(87936001)(6806005)(104016004)(305945005)(356003)(7696003)(5003600100003)(7846002)(36756003)(8676002)(8936002)(106466001)(11100500001)(86362001)(50466002)(15974865002)(18370500001)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0801MB1433;H:nebula.arm.com;FPR:;SPF:Pass;PTR:fw-tnat.cambridge.arm.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD023;1:Ol54/nPhcDffQiFUYqgfb0sba0u1aYXS4eCuIjL3Mul5CKXR97d71N401iXWPfSsYCZcB5DEsSI2TAcE/I3K5D8KxmF/3G8/xSVbQq6CaHBS3bM3ZXAnPXmCIWLMzIOBZGQ2iPYSfKBVbClizvv+r8IvrinVCmmkJ8ImfIzGVCv0DwQ8FTox3a0+3S6K90nAXyVqqRnbaADvss2QRIBygVVmorXLlQHZsnF+HOI6YMmo6E/cyrTjRLpRCj9az0Q8M6fBWPdB8atCIIyR3Gl4S+RJ/zbcs2bCY7UdysIbgLYUmylgiNglqB/hANZvKI3EfATDz/vK9gvkKDJzcYnlcFqMAygRIOLnHAY75QG6wBebX2oR3Iyy6WmPcXlT6AgXpYnm9lqt87npa+MIGmtq5vhtPpJuIv/aTk1r+rMB07+QN/d186absgAsCskhHTl0jmhbIVAIXNKEi15ITHh5ATT3lV+TnqrKBF1j56F9oCUvD33ANoaNVMp2OS0EBKv2CXEGYyaOixCqAEeXnPUqwML+xKOzAPpkDaX0LOgYoeDHyQ15BWewKMXGY9OT67TI0+8QNNsUni8cv3ppxP4cnuZF45fAqTdnODwrzLv4BsY= X-MS-Office365-Filtering-Correlation-Id: aa791ffb-cd0c-4cb8-1d19-08d3b0931c47 X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1433;2:5BuRV0B0v3NrpfeUF1C7q7sWj4Rzpctpcoud3VaUvITLaDSfnZb/JPseSfgIpNTK05xjz1eMBz0ngIEG4eJQ0nZRmWX/yhtryLpNwy1QsIQ4NroUjgdnucULoGtAWT166vvSmKD7yQRnzjkTRCVVJXL2J641bbOTby7QlT8a3qhkMfEloP8hhPqUJ9+YPe2v;3:fT7AHO7VVqwpc7UtQO5wvMCrnIF3FHfaQGuFf/vwD/70OQ2dFWwOWA1R1OE4wKfyoGV8rLei/Il9jvqrYVHX32s/BeVOywoUYyfnsKnk4GKTYUuG4Z6TKiritvyRARXUf8nSDySKTLo/QtZTBC86454gqJY5qEi+P0Zf+Asc4KJdIxn9Nwav/ChIEPcD9IcRYXDQL1Vus1Fa9FWWSNCJN22x2+I6acFrclyOPny2XkM5nwuoag+XcVaayBoGItM+uYg35ZHKZkfIbvyYkDrxiw==;25:8lHlcoymy0NGHFiBqj5aJ4kXTeyjMwt9c9bRbozaOlbMeB1/ldEUPVV/pQSmtf2nfWV9ma1tPvrJ/mUE7aGsgNY/vGXwX9NV9aPM4aOrQ1pVyFKwy+zdgBQzLbDB6DspgFGziBOrWEdVZt4iC8+TgkOpvjFcV+6NSIF6mv0N2qo89/qw9t0VdTOCGm3YyzlD9vTWw9EyaM10Af2NHk3KAJuVlUJxY/9MaEyl0d84tnR9Ur2tEWUSRSiBrZRZmbx0WO2D4dOy89qtRSqjvhyfKSnkmh+MO8SjvCTcufttXr9JUwyL1ppfvUeGMlld8LZf12vAlxotbuDsWjKYp7iV2/iBkfwK8OhpfqDy/si4V+a7bMG2LIYVWO7Jdd51w957cjmuhxRUNICDIFhdW3qFuYfgZ3a1XBQ4vv3MponmnA8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:HE1PR0801MB1433; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1433;31:FD6mJBqd+iaDIrPbhw/QaW5nqMky/UQQuvYJZ0abhrJa19XQ/d97er9l8gtRLcsEbD+pF/v0rC4/2YPTVRUhM8P37qdv2En8HkIv5j5M6sJ3pKDO97y9Uz6Cy0Zf100srAKpdDLpIaxaHdWG6Ff9Zp2mnXCboMbd7u2u1cc0WrOSZ4f8Diw69cisbDIrk85Zx/ncN3g4nu8ypOZe02lJqg==;20:RIXfManzaxHrKj7441fOja+ajWAnF0WY/izyuXoq2iguyNLzF8tNgaKdoCdlIzSORPM0zxMcwdET6aG4rcDwaNiZATwti5Q+0J4Q/8z0ExDoPobUgsphfSD7II8y7oWR7ddiJcHDIzaLipOnXo8Hhyw7FrAFqKhLXpn7jOnTUw1tnG89NMHInd9+NdjdjBxmUxPlDlrv3dn5XjEbkdUIMvlpw7yJrq4QLCC7w6sINYiqGHV7ow2qmzScEVBMmu+s NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85170053105377); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13023025)(13024025)(13020025)(13013025)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:HE1PR0801MB1433;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1433; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1433;4:wCQPKCAEw3i9zKvmRMdNx5lWuaAI0TqLjIxVBLVOkdiQZI/lK+epS+G9d4QIfDVHMjCyQSHpEvTVhGWb5eCHz+ka61SBeGNLhBZJNHsmTWTZUkdd5NaDIY4rXfVyq+a0On+gBoCXs7w5T6zYzzNSAUqSv7L8MPsZlNxdHUG3AZpVNL8KOU2PJpZu1OLmzaDVYH3EZI5jJUAX+scrjePhXB4HiDlDt13cHgBmSTO4OgGVtHj5+sojHVWIi3MdbJ2DMJQml8W6ZcwyM7ZicN3FeDFdm3FrSr3kEi2q30SdMN94+/8Ky+7nKI6he1qddhPW9KTmZeElzPGpFM0FnXJwrlaD/w2vAOAjnA1172JoxBlNIX9nt+57eddAXO1RE6MRjzwDiVdanoYRELXH8cHq0dtyp1D++6pkkd4WusOwbzEzxPfGsmWHwS+kyIJ2IEY8v0heEJ9dzusb14GplogXvSYid2FuOg581OsjWydCclNhqGdLyLwpQ7ytm08NwcoU X-Forefront-PRVS: 000947967F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0801MB1433;23:4E+NdqHlCNhoy7LcWbkdDuMoTWDP1xnr8oZjsF2?= =?us-ascii?Q?EXS6m+I3kcQqbbolvMnp0VldbeWqbM/w2HnBuf0GrdWFfDLOkh7fIsROLsoT?= =?us-ascii?Q?LgcN+pgvKNgEC2fSUpC6HrSB1U/Y9kN/z8t938vThrJViP3O7ZYzB2LgFX1Z?= =?us-ascii?Q?C2TrLs6nEoIvEzq97W5H0GJ23OpGZo92xha5XFGSmDlu6Cu6eBSCmYnnipK+?= =?us-ascii?Q?aCyLyptSlRF+HThxfWW7Vf1jh3KFtYxLKNi8mJtgPt+GI52kc1xxh55hvS3U?= =?us-ascii?Q?wynEbzwwgGZG/FDoUkpf7Y8UwAqP/c23gWfvSMj/m1MnotyB+x+NMp7kGZvB?= =?us-ascii?Q?whBsYuVC6y3zQi2pOfWLqmgDqrAjkMTkqoOXtsVGVDBCiSWKLilIUyT0Cl/c?= =?us-ascii?Q?HGZ+p/plnZ3OWz1rIvzebvvfDpAIgcx+4TpV6kXLwu6C4gUkTiRD44sDiMoK?= =?us-ascii?Q?G0jylD4Wx236LpIuhXD+mT+XDxl2etblpu8bV5RfLrBMbePCVgcwXxG69CCn?= =?us-ascii?Q?Q5FuVu/zwWArZPYaAlnWHtAxmwaVr9721JaiHjFrzjQo9byGBg4EewjBUx84?= =?us-ascii?Q?QANp6wk+cEd6JsLLhqAhakgIVqzYvQ5cCZBMEY6fYtFvFTHhP7OKOTbay3QI?= =?us-ascii?Q?OgTw/ibOAkRGYxrHaKb9vHT6On/6VGIIF09o/5Nhq/VKpbLLdTu5nGUjCMKe?= =?us-ascii?Q?t+EQC8codDQF/i28aP2+yuMlrmoKLaLpnAFSTazzrWQfirx2Vgr83XU+mGuH?= =?us-ascii?Q?/Q8csYbKnZxJasFPph1WEtmGgR/h0KB7EgUOSz6UNoqw+5Kri3OT+LZDFSJE?= =?us-ascii?Q?gzF4FZn86UEkeiQfI61DLmEFElRdqQd3kxRfZVYyz/BGqaebsh2ag/qk4Cz7?= =?us-ascii?Q?lhEQ/JHyPJ0/YeJ11KsRlkEhMg7Gj1C5bOj0gO64cTcb0vqHQb+CbiNB8ymj?= =?us-ascii?Q?Ohl4uj3gqUdT9NCF4pnWianeXmG9auWYvvGkHvY2a3bJH9Gcsxpi/g5C0RPZ?= =?us-ascii?Q?H5pvGM2VDes2iwJZKfzoe9GRR5MiB6L0XNS4Lkru7bStkbf0cwNjSNPxbxmf?= =?us-ascii?Q?gRa8M8w3WIFqDClLBnLA2zVwk8GzwVyssgSTcz3pJ3958BDsYB8ZA6t5CPi0?= =?us-ascii?Q?84uNj2WN577RRKNxABJI/GrSc4ZsLvusDDKtruiXv9n0B+RpgxtzRn3myTca?= =?us-ascii?Q?HM8vtk6shFMQDdQPShDAvs+G+Sp+ZKa9i4L83q63pR/m5sl/SWdfTHzKtvg?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1433;6:/R+9A4APsS7eYMrSlRrh9LwTWWBrw6PRVCNXMNc8ls/KIo0sE/LWIFEb1qkrsob0uDdPk+Kie6tZ0/6RLDg3I5RQ4GOPjKMoNsfT+F2HdmcaIFS78xorJWg3ZacGdSVU2Xu9G4MYFCByETTvkhyepWZF9eZw44i9UQ3DMJvcXZpr9qzKY6sJgV2nHZ2vKvLHD97HdMDbqpoieVYbkHcd5kR+C0LqdFOzPgYZQh3+MwAMOc8r0wCu8PQ4OPgYBCA1etFCHFLcLMEidGq4154Wmcyb0ERZxs/LxeGNZoHBuyysVP4DxJtkd/UR22YRnyevlzAMLbnq1MeMtRjaq6Xe2w==;5:0JfLqsKOE3t+7CLTcHCWvGuWjNmTuDhLllutOrpEVGTI3Rj+sqSzjcZZS33zUKX4wfmQ1tZ8t8sNuxjpVLPJE73NoMkWukGf6x52PQehiSU0gKXLbSv9TiK3951Ra86x3iKA9EJ5+n2Uoq/IzGYi5A==;24:D9M2tCdchtMFF8WzhcDES2kHA0NmYnAK3tYpcQqYsLAmG6WnE/ZJLfIvAw9RFwCLbQ5xxAzpvQbcUWBhZa+WrwaRbhFWUsGzvc77nxJNFPQ=;7:aPmrP/ydNULOlQHbU1sLkckNKRoww/Jjz1ms/1ae8Xdw7BTRM2tihNuk4VpSVVj4wzKXyJmMzwyZA7O/p4oHUcNCV1HShZNpvlA03bWrymAHPrpQn+gzOyyklrYhCzIuD2aXO+Jgm7JqKC/qnjJRRtkgDHSc1nEt7sk1xEA91rXP5swdqPECiJoo1kS8oe+IGXl70jvELgBxRdE0EQ/rW+EZ3FP7eKrIUVJtC+8YmlGdWFprH21bEhxgkEi91HQP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1433;20:q6xXJpT5ihB9XANTqOrKa1GtGyr1/MgRacdXKIFoIUbinU7F+3qMxogOmo0quYCeBtSGSYUdu3Rc9EzIW2ZzEZQHV2zhTbe7Uje3T0Pt76vyJ2O14bgP1m7IoLWdDzV7IGKEaOMI0Bo+rTsf7VYmdF3xjbOmLTRn+iPBy4cG8W4= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2016 11:43:46.7979 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[217.140.96.140];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1433 X-MC-Unique: Tady1fMcOxSNWbvhF07yLQ-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, Some small questions/comments below: On Tue, Jul 19, 2016 at 12:55:07PM +0000, Eric Auger wrote: > iommu_get/put_msi_cookie allocates/frees the resource used to store > and ref count the MSI doorbell mappings. iommu_msi_set_aperture > initializes the iova domain used for MSI IOVA allocation and sets the > iommu domain's msi geometry. > > The implementation relies on dma-iommu API and iova API. > > New msi functions are fully implemented if CONFIG_IOMMU_MSI is set. > > Signed-off-by: Eric Auger > > --- > v10: > - split error management in iommu_msi_set_aperture > > v9: > - remove is_aperture_set and use iommu_domain_msi_aperture_valid helper > instead > - set iommu domain's msi geometry > > v8: > - new design where msi-iommu relies on dma-iommu > - remove the iommu_domain * from the doorbell_mapping struct > - added is_aperture_set > > v7: > - fix locking > - add iova_cache_get/put > - static inline functions when CONFIG_IOMMU_DMA_RESERVED is not set > - introduce struct reserved_iova_domain to encapsulate prot info & > add prot parameter in alloc_reserved_iova_domain > > v5 -> v6: > - use spin lock instead of mutex > > v3 -> v4: > - formerly in "iommu/arm-smmu: implement alloc/free_reserved_iova_domain" & > "iommu: add alloc/free_reserved_iova_domain" > > v2 -> v3: > - remove iommu_alloc_reserved_iova_domain & iommu_free_reserved_iova_domain > static implementation in case CONFIG_IOMMU_API is not set > > v1 -> v2: > - moved from vfio API to IOMMU API > --- > drivers/iommu/Kconfig | 7 ++++ > drivers/iommu/Makefile | 1 + > drivers/iommu/msi-iommu.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ > include/linux/msi-iommu.h | 65 ++++++++++++++++++++++++++++++ > 4 files changed, 173 insertions(+) > create mode 100644 drivers/iommu/msi-iommu.c > create mode 100644 include/linux/msi-iommu.h > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index ad08603..5ea1610 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -74,6 +74,11 @@ config IOMMU_DMA > select IOMMU_IOVA > select NEED_SG_DMA_LENGTH > > +# IOMMU MSI mapping > +config IOMMU_MSI > + bool > + select IOMMU_DMA > + > config FSL_PAMU > bool "Freescale IOMMU support" > depends on PPC_E500MC || (COMPILE_TEST && PPC) > @@ -296,6 +301,7 @@ config SPAPR_TCE_IOMMU > config ARM_SMMU > bool "ARM Ltd. System MMU (SMMU) Support" > depends on (ARM64 || ARM) && MMU > + select IOMMU_MSI > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select ARM_DMA_USE_IOMMU if ARM > @@ -309,6 +315,7 @@ config ARM_SMMU > config ARM_SMMU_V3 > bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > depends on ARM64 && PCI > + select IOMMU_MSI > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select GENERIC_MSI_IRQ_DOMAIN > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index c6edb31..a381e66 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -2,6 +2,7 @@ obj-$(CONFIG_IOMMU_API) += iommu.o > obj-$(CONFIG_IOMMU_API) += iommu-traces.o > obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o > obj-$(CONFIG_IOMMU_DMA) += dma-iommu.o > +obj-$(CONFIG_IOMMU_MSI) += msi-iommu.o > obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o > obj-$(CONFIG_IOMMU_IO_PGTABLE_ARMV7S) += io-pgtable-arm-v7s.o > obj-$(CONFIG_IOMMU_IO_PGTABLE_LPAE) += io-pgtable-arm.o > diff --git a/drivers/iommu/msi-iommu.c b/drivers/iommu/msi-iommu.c > new file mode 100644 > index 0000000..de02ede > --- /dev/null > +++ b/drivers/iommu/msi-iommu.c > @@ -0,0 +1,100 @@ > +/* > + * Reserved IOVA Management > + * > + * Copyright (c) 2015 Linaro Ltd. > + * www.linaro.org > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +struct doorbell_mapping { > + struct kref kref; > + struct list_head next; > + phys_addr_t addr; > + dma_addr_t iova; > + size_t size; > +}; > + > +struct doorbell_mapping_info { > + struct list_head list; /* list of doorbell mapping entries */ > + spinlock_t lock; > +}; > + > +int iommu_get_msi_cookie(struct iommu_domain *domain) > +{ > + struct doorbell_mapping_info *dmi; > + int ret; > + > + if (domain->msi_cookie || domain->iova_cookie) > + return -EINVAL; > + > + ret = iommu_get_dma_cookie(domain); > + if (ret) > + return ret; > + > + dmi = kzalloc(sizeof(*dmi), GFP_KERNEL); if dmi == NULL here, > + > + INIT_LIST_HEAD(&dmi->list); > + spin_lock_init(&dmi->lock); will the above 2-line codes triger kernel NULL pointer dereference panic message? if so why don't we check dmi immediately after the kzalloc call like this: dmi = kzalloc(sizeof(*dmi), GFP_KERNEL); domain->msi_cookie = dmi; if (!dmi) return -ENOMEM; > + iova_cache_get(); return iova_cache_get(); > + > + domain->msi_cookie = dmi; > + > + return dmi ? 0 : -ENOMEM; > +} > +EXPORT_SYMBOL(iommu_get_msi_cookie); > + > +void iommu_put_msi_cookie(struct iommu_domain *domain) > +{ > + struct doorbell_mapping_info *dmi = domain->msi_cookie; > + > + if (!dmi) > + return; > + > + domain->msi_cookie = NULL; > + > + WARN_ON(!list_empty(&dmi->list)); > + > + kfree(dmi); > + iommu_put_dma_cookie(domain); > + iova_cache_put(); > +} > +EXPORT_SYMBOL(iommu_put_msi_cookie); > + > +int iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end) > +{ > + struct doorbell_mapping_info *dmi = domain->msi_cookie; > + int ret; > + > + if (!dmi) > + return -ENODEV; > + > + if (iommu_domain_msi_aperture_valid(domain)) > + return -EINVAL; > + > + ret = iommu_dma_init_domain(domain, start, end - start + 1); > + > + if (!ret) { > + domain->msi_geometry.aperture_start = start; > + domain->msi_geometry.aperture_end = end; > + } > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(iommu_msi_set_aperture); > + > diff --git a/include/linux/msi-iommu.h b/include/linux/msi-iommu.h > new file mode 100644 > index 0000000..392aa6f > --- /dev/null > +++ b/include/linux/msi-iommu.h > @@ -0,0 +1,65 @@ > +/* > + * Copyright (c) 2015 Linaro Ltd. > + * www.linaro.org > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > +#ifndef __MSI_IOMMU_H > +#define __MSI_IOMMU_H > + > +#include > +#include > + > +struct iommu_domain; > + > +#ifdef CONFIG_IOMMU_MSI > + > +/** > + * iommu_get_msi_cookie - Acquire MSI mapping resources for a domain > + * @domain: IOMMU domain to prepare for MSI mapping > + * > + * IOMMU drivers which require MSI mapping should normally call this > + * from their domain_alloc callback when domain->type == > + * IOMMU_DOMAIN_UNMANAGED. > + */ > +int iommu_get_msi_cookie(struct iommu_domain *domain); > + > +/** > + * iommu_put_msi_cookie - Release a domain's MSI mapping resources > + * @domain: IOMMU domain previously prepared by iommu_get_msi_cookie() > + * > + * IOMMU drivers requesting MSI mapping should normally call this from > + * their domain_free callback. > + */ > +void iommu_put_msi_cookie(struct iommu_domain *domain); > + > +/** > + * iommu_msi_set_aperture: allocate the msi iova domain > + * according to the specified start/end IOVAs > + * > + * @domain: iommu domain handle > + * @start: MSI iova start address > + * @end: MSI iova end address > + */ > +int iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end); > + > +#else > + > +static inline int > +iommu_msi_set_aperture(struct iommu_domain *domain, > + dma_addr_t start, dma_addr_t end) > +{ > + return -ENOENT; > +} > + > +#endif /* CONFIG_IOMMU_MSI */ > +#endif /* __MSI_IOMMU_H */ > -- > 1.9.1 > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm >