Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1317901
| From | Eric Auger <eric.auger@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/10] vfio: introduce vfio_group_require_msi_mapping |
| Date | 2016-01-26 14:20 +0100 |
| Message-ID | <qVbHl-4Dq-39@gated-at.bofh.it> (permalink) |
| References | <qVbHj-4Dq-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This new function enables to know whether msi write transaction
addresses must be mapped.
Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
drivers/vfio/vfio.c | 22 ++++++++++++++++++++++
drivers/vfio/vfio_iommu_type1.c | 8 ++++++++
include/linux/vfio.h | 2 ++
3 files changed, 32 insertions(+)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 2760d4c..f3df5a10 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -793,6 +793,28 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb,
return NOTIFY_OK;
}
+bool vfio_group_require_msi_mapping(struct vfio_group *group)
+{
+ struct vfio_container *container = group->container;
+ struct vfio_iommu_driver *driver;
+ bool ret;
+
+ down_read(&container->group_lock);
+
+ driver = container->iommu_driver;
+ if (!driver || !driver->ops || !driver->ops->require_msi_mapping) {
+ ret = -EINVAL;
+ goto up;
+ }
+
+ ret = driver->ops->require_msi_mapping(container->iommu_data);
+
+up:
+ up_read(&container->group_lock);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(vfio_group_require_msi_mapping);
+
/**
* VFIO driver API
*/
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index a79e2a8..2f085d3 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -1179,6 +1179,13 @@ unlock:
return ret;
}
+static bool vfio_iommu_type1_require_msi_mapping(void *iommu_data)
+{
+ struct vfio_iommu *iommu = iommu_data;
+
+ return vfio_domains_require_msi_mapping(iommu);
+}
+
static void *vfio_iommu_type1_open(unsigned long arg)
{
struct vfio_iommu *iommu;
@@ -1336,6 +1343,7 @@ static const struct vfio_iommu_driver_ops vfio_iommu_driver_ops_type1 = {
vfio_iommu_type1_alloc_map_reserved_iova,
.unmap_free_reserved_iova =
vfio_iommu_type1_unmap_free_reserved_iova,
+ .require_msi_mapping = vfio_iommu_type1_require_msi_mapping,
};
static int __init vfio_iommu_type1_init(void)
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index f7eaf30..3e6cbeb 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -58,6 +58,7 @@ extern void *vfio_del_group_dev(struct device *dev);
extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
extern void vfio_device_put(struct vfio_device *device);
extern void *vfio_device_data(struct vfio_device *device);
+extern bool vfio_group_require_msi_mapping(struct vfio_group *group);
/**
* struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
@@ -85,6 +86,7 @@ struct vfio_iommu_driver_ops {
int (*unmap_free_reserved_iova)(void *iommu_data,
struct iommu_group *group,
dma_addr_t iova);
+ bool (*require_msi_mapping)(void *iommu_data);
};
extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/10] KVM PCIe/MSI passthrough on ARM/ARM64 Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 09/10] vfio-pci: create an iommu mapping for msi address Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 01/10] iommu: Add DOMAIN_ATTR_MSI_MAPPING attribute Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 05/10] vfio/type1: attach a reserved iova domain to vfio_domain Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 10/10] vfio: allow the user to register reserved iova range for MSI mapping Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
Re: [PATCH 10/10] vfio: allow the user to register reserved iova range for MSI mapping kbuild test robot <lkp@intel.com> - 2016-01-26 17:50 +0100
Re: [PATCH 10/10] vfio: allow the user to register reserved iova range for MSI mapping kbuild test robot <lkp@intel.com> - 2016-01-26 19:40 +0100
[PATCH 06/10] vfio: introduce vfio_group_alloc_map_/unmap_free_reserved_iova Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
Re: [PATCH 06/10] vfio: introduce vfio_group_alloc_map_/unmap_free_reserved_iova kbuild test robot <lkp@intel.com> - 2016-01-26 17:20 +0100
Re: [PATCH 06/10] vfio: introduce vfio_group_alloc_map_/unmap_free_reserved_iova Eric Auger <eric.auger@linaro.org> - 2016-01-26 17:40 +0100
[PATCH 08/10] vfio: introduce vfio_group_require_msi_mapping Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 04/10] vfio: introduce VFIO_IOVA_RESERVED vfio_dma type Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 03/10] vfio_iommu_type1: add reserved binding RB tree management Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
[PATCH 02/10] vfio: expose MSI mapping requirement through VFIO_IOMMU_GET_INFO Eric Auger <eric.auger@linaro.org> - 2016-01-26 14:20 +0100
RE: [PATCH 00/10] KVM PCIe/MSI passthrough on ARM/ARM64 Pavel Fedin <p.fedin@samsung.com> - 2016-01-26 18:30 +0100
Re: [PATCH 00/10] KVM PCIe/MSI passthrough on ARM/ARM64 Eric Auger <eric.auger@linaro.org> - 2016-01-27 10:00 +0100
csiph-web