Message ID | 1468933894-23250-5-git-send-email-eric.auger@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, [auto build test ERROR on vfio/next] [also build test ERROR on v4.7-rc7 next-20160722] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Eric-Auger/KVM-PCIe-MSI-passthrough-on-ARM-ARM64-kernel-part-3-3-vfio-changes/20160724-082318 base: https://github.com/awilliam/linux-vfio.git next config: x86_64-rhel (attached as .config) compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): >> drivers/vfio/vfio_iommu_type1.c:39:29: fatal error: linux/msi-iommu.h: No such file or directory #include <linux/msi-iommu.h> ^ compilation terminated. vim +39 drivers/vfio/vfio_iommu_type1.c 33 #include <linux/rbtree.h> 34 #include <linux/sched.h> 35 #include <linux/slab.h> 36 #include <linux/uaccess.h> 37 #include <linux/vfio.h> 38 #include <linux/workqueue.h> > 39 #include <linux/msi-iommu.h> 40 41 #define DRIVER_VERSION "0.2" 42 #define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>" --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi, On 24/07/2016 03:41, kbuild test robot wrote: > Hi, > > [auto build test ERROR on vfio/next] > [also build test ERROR on v4.7-rc7 next-20160722] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Eric-Auger/KVM-PCIe-MSI-passthrough-on-ARM-ARM64-kernel-part-3-3-vfio-changes/20160724-082318 > base: https://github.com/awilliam/linux-vfio.git next > config: x86_64-rhel (attached as .config) > compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705 > reproduce: > # save the attached .config to linux build tree > make ARCH=x86_64 > > All errors (new ones prefixed by >>): > >>> drivers/vfio/vfio_iommu_type1.c:39:29: fatal error: linux/msi-iommu.h: No such file or directory > #include <linux/msi-iommu.h> > ^ > compilation terminated. > > vim +39 drivers/vfio/vfio_iommu_type1.c > > 33 #include <linux/rbtree.h> > 34 #include <linux/sched.h> > 35 #include <linux/slab.h> > 36 #include <linux/uaccess.h> > 37 #include <linux/vfio.h> > 38 #include <linux/workqueue.h> > > 39 #include <linux/msi-iommu.h> Dependency on part I of this series. Thanks Eric > 40 > 41 #define DRIVER_VERSION "0.2" > 42 #define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>" > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 65a4038..69c775e 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -36,6 +36,7 @@ #include <linux/uaccess.h> #include <linux/vfio.h> #include <linux/workqueue.h> +#include <linux/msi-iommu.h> #define DRIVER_VERSION "0.2" #define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>" @@ -387,7 +388,7 @@ static void vfio_unmap_unpin(struct vfio_iommu *iommu, struct vfio_dma *dma) struct vfio_domain *domain, *d; long unlocked = 0; - if (!dma->size) + if (!dma->size || dma->type != VFIO_IOVA_USER) return; /* * We use the IOMMU to track the physical addresses, otherwise we'd @@ -724,6 +725,14 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu, dma = rb_entry(n, struct vfio_dma, node); iova = dma->iova; + if (dma->type == VFIO_IOVA_RESERVED_MSI) { + ret = iommu_msi_set_aperture(domain->domain, + dma->iova, + iova + dma->size - 1); + WARN_ON(ret); + continue; + } + while (iova < dma->iova + dma->size) { phys_addr_t phys = iommu_iova_to_phys(d->domain, iova); size_t size;
Before allowing the end-user to create VFIO_IOVA_RESERVED dma slots, let's implement the expected behavior for removal and replay. As opposed to user dma slots, reserved IOVAs are not systematically bound to PAs and PAs are not pinned. VFIO just initializes the IOVA "aperture". IOVAs are allocated outside of the VFIO framework, by the MSI layer which is responsible to free and unmap them. The MSI mapping resources are freeed by the IOMMU driver on domain destruction. On the creation of a new domain, the "replay" of a reserved slot simply needs to set the MSI aperture on the new domain. Signed-off-by: Eric Auger <eric.auger@redhat.com> --- v9 -> v10: - replay of a reserved slot sets the MSI aperture on the new domain - use VFIO_IOVA_RESERVED_MSI enum value instead of VFIO_IOVA_RESERVED v7 -> v8: - do no destroy anything anymore, just bypass unmap/unpin and iommu_map on replay --- drivers/vfio/vfio_iommu_type1.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)