All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linu Cherian <linuc.decode@gmail.com>
To: Auger Eric <eric.auger@redhat.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"kevin.tian@intel.com" <kevin.tian@intel.com>,
	"drjones@redhat.com" <drjones@redhat.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"marc.zyngier@arm.com" <marc.zyngier@arm.com>,
	"tn@semihalf.com" <tn@semihalf.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	linu.cherian@cavium.com,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"bharatb.yadav@gmail.com" <bharatb.yadav@gmail.com>,
	Bharat Bhushan <bharat.bhushan@nxp.com>,
	"christoffer.dall@linaro.org" <christoffer.dall@linaro.org>,
	"eric.auger.pro@gmail.com" <eric.auger.pro@gmail.com>
Subject: Re: [Qemu-arm] [PATCH v4 0/5] virtio-iommu: VFIO integration
Date: Wed, 4 Oct 2017 17:19:11 +0530	[thread overview]
Message-ID: <20171004114910.GA6932@virtx40> (raw)
In-Reply-To: <0af599c0-f859-f90c-c999-bc4a0a678768@redhat.com>

Hi Eric,


On Wed Sep 27, 2017 at 11:24:01AM +0200, Auger Eric wrote:
> Hi Linu,
> 
> On 27/09/2017 11:21, Linu Cherian wrote:
> > On Wed Sep 27, 2017 at 10:55:07AM +0200, Auger Eric wrote:
> >> Hi Linu,
> >>
> >> On 27/09/2017 10:30, Bharat Bhushan wrote:
> >>> Hi,
> >>>
> >>>> -----Original Message-----
> >>>> From: Linu Cherian [mailto:linuc.decode@gmail.com]
> >>>> Sent: Wednesday, September 27, 2017 1:11 PM
> >>>> To: Bharat Bhushan <bharat.bhushan@nxp.com>
> >>>> Cc: eric.auger@redhat.com; eric.auger.pro@gmail.com;
> >>>> peter.maydell@linaro.org; alex.williamson@redhat.com; mst@redhat.com;
> >>>> qemu-arm@nongnu.org; qemu-devel@nongnu.org; kevin.tian@intel.com;
> >>>> marc.zyngier@arm.com; tn@semihalf.com; will.deacon@arm.com;
> >>>> drjones@redhat.com; robin.murphy@arm.com; christoffer.dall@linaro.org;
> >>>> bharatb.yadav@gmail.com
> >>>> Subject: Re: [Qemu-arm] [PATCH v4 0/5] virtio-iommu: VFIO integration
> >>>>
> >>>> Hi,
> >>>>
> >>>> On Wed Sep 27, 2017 at 12:03:15PM +0530, Bharat Bhushan wrote:
> >>>>> This patch series integrates VFIO/VHOST with virtio-iommu.
> >>>>>
> >>>>> This version is mainly about rebasing on v4 version on virtio-iommu
> >>>>> device framework from Eric Augur and addresing review comments.
> >>>>>
> >>>>> This patch series allows PCI pass-through using virtio-iommu.
> >>>>>
> >>>>> This series is based on:
> >>>>>  - virtio-iommu kernel driver by Jean-Philippe Brucker
> >>>>>     [1] [RFC] virtio-iommu version 0.4
> >>>>>     git://linux-arm.org/virtio-iommu.git branch viommu/v0.4
> >>
> >> Just to make sure, do you use the v0.4 virtio-iommu driver from above
> >> branch?
> >>
> >> Thanks
> > 
> > I am using git://linux-arm.org/linux-jpb.git branch virtio-iommu/v0.4.
> > Hope you are referring to the same.
> 
> Yes that's the right one. I will also investigate on my side this afternoon.
> 
> Thanks
> 
> Eric

With the below workaround, atleast ping works for me.

diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 249964a..2904617 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
        .attach_dev             = viommu_attach_dev,
        .map                    = viommu_map,
        .unmap                  = viommu_unmap,
-       .map_sg                 = viommu_map_sg,
+       .map_sg                 = default_iommu_map_sg,
        .iova_to_phys           = viommu_iova_to_phys,
        .add_device             = viommu_add_device,
        .remove_device          = viommu_remove_device,


Looks like the qemu backend doesnt have support to handle the map requests from 
virtio_iommu_map_sg, since it  merges multiple map requests into one with 
mapsize larger than page size(for eg. 0x5000). 

Atleast vfio_get_vaddr called from vfio_iommu_map_notify in Qemu expects 
the map size to be a power of 2.

 if (len & iotlb->addr_mask) {
        error_report("iommu has granularity incompatible with target AS");
        return false;
    }

Just trying to understand how this is not hitting in your case. 
 
-- 
Linu cherian

WARNING: multiple messages have this Message-ID (diff)
From: Linu Cherian <linuc.decode@gmail.com>
To: Auger Eric <eric.auger@redhat.com>
Cc: Bharat Bhushan <bharat.bhushan@nxp.com>,
	"eric.auger.pro@gmail.com" <eric.auger.pro@gmail.com>,
	"peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"kevin.tian@intel.com" <kevin.tian@intel.com>,
	"marc.zyngier@arm.com" <marc.zyngier@arm.com>,
	"tn@semihalf.com" <tn@semihalf.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"drjones@redhat.com" <drjones@redhat.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"christoffer.dall@linaro.org" <christoffer.dall@linaro.org>,
	"bharatb.yadav@gmail.com" <bharatb.yadav@gmail.com>,
	linu.cherian@cavium.com
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH v4 0/5] virtio-iommu: VFIO integration
Date: Wed, 4 Oct 2017 17:19:11 +0530	[thread overview]
Message-ID: <20171004114910.GA6932@virtx40> (raw)
In-Reply-To: <0af599c0-f859-f90c-c999-bc4a0a678768@redhat.com>

Hi Eric,


On Wed Sep 27, 2017 at 11:24:01AM +0200, Auger Eric wrote:
> Hi Linu,
> 
> On 27/09/2017 11:21, Linu Cherian wrote:
> > On Wed Sep 27, 2017 at 10:55:07AM +0200, Auger Eric wrote:
> >> Hi Linu,
> >>
> >> On 27/09/2017 10:30, Bharat Bhushan wrote:
> >>> Hi,
> >>>
> >>>> -----Original Message-----
> >>>> From: Linu Cherian [mailto:linuc.decode@gmail.com]
> >>>> Sent: Wednesday, September 27, 2017 1:11 PM
> >>>> To: Bharat Bhushan <bharat.bhushan@nxp.com>
> >>>> Cc: eric.auger@redhat.com; eric.auger.pro@gmail.com;
> >>>> peter.maydell@linaro.org; alex.williamson@redhat.com; mst@redhat.com;
> >>>> qemu-arm@nongnu.org; qemu-devel@nongnu.org; kevin.tian@intel.com;
> >>>> marc.zyngier@arm.com; tn@semihalf.com; will.deacon@arm.com;
> >>>> drjones@redhat.com; robin.murphy@arm.com; christoffer.dall@linaro.org;
> >>>> bharatb.yadav@gmail.com
> >>>> Subject: Re: [Qemu-arm] [PATCH v4 0/5] virtio-iommu: VFIO integration
> >>>>
> >>>> Hi,
> >>>>
> >>>> On Wed Sep 27, 2017 at 12:03:15PM +0530, Bharat Bhushan wrote:
> >>>>> This patch series integrates VFIO/VHOST with virtio-iommu.
> >>>>>
> >>>>> This version is mainly about rebasing on v4 version on virtio-iommu
> >>>>> device framework from Eric Augur and addresing review comments.
> >>>>>
> >>>>> This patch series allows PCI pass-through using virtio-iommu.
> >>>>>
> >>>>> This series is based on:
> >>>>>  - virtio-iommu kernel driver by Jean-Philippe Brucker
> >>>>>     [1] [RFC] virtio-iommu version 0.4
> >>>>>     git://linux-arm.org/virtio-iommu.git branch viommu/v0.4
> >>
> >> Just to make sure, do you use the v0.4 virtio-iommu driver from above
> >> branch?
> >>
> >> Thanks
> > 
> > I am using git://linux-arm.org/linux-jpb.git branch virtio-iommu/v0.4.
> > Hope you are referring to the same.
> 
> Yes that's the right one. I will also investigate on my side this afternoon.
> 
> Thanks
> 
> Eric

With the below workaround, atleast ping works for me.

diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 249964a..2904617 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
        .attach_dev             = viommu_attach_dev,
        .map                    = viommu_map,
        .unmap                  = viommu_unmap,
-       .map_sg                 = viommu_map_sg,
+       .map_sg                 = default_iommu_map_sg,
        .iova_to_phys           = viommu_iova_to_phys,
        .add_device             = viommu_add_device,
        .remove_device          = viommu_remove_device,


Looks like the qemu backend doesnt have support to handle the map requests from 
virtio_iommu_map_sg, since it  merges multiple map requests into one with 
mapsize larger than page size(for eg. 0x5000). 

Atleast vfio_get_vaddr called from vfio_iommu_map_notify in Qemu expects 
the map size to be a power of 2.

 if (len & iotlb->addr_mask) {
        error_report("iommu has granularity incompatible with target AS");
        return false;
    }

Just trying to understand how this is not hitting in your case. 
 
-- 
Linu cherian

  reply	other threads:[~2017-10-04 11:49 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27  6:33 [Qemu-arm] [PATCH v4 0/5] virtio-iommu: VFIO integration Bharat Bhushan
2017-09-27  6:33 ` [Qemu-devel] " Bharat Bhushan
2017-09-27  6:33 ` [Qemu-arm] [PATCH v4 1/5] target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route Bharat Bhushan
2017-09-27  6:33   ` [Qemu-devel] " Bharat Bhushan
2017-09-27  6:33 ` [Qemu-arm] [PATCH v4 2/5] virtio-iommu: Add iommu notifier for map/unmap Bharat Bhushan
2017-09-27  6:33   ` [Qemu-devel] " Bharat Bhushan
2017-09-27  6:33 ` [Qemu-devel] [PATCH v4 3/5] virtio-iommu: Call iommu notifier for attach/detach Bharat Bhushan
2017-09-27  6:33   ` Bharat Bhushan
2017-09-27  6:33 ` [Qemu-arm] [PATCH v4 4/5] virtio-iommu: add iommu replay Bharat Bhushan
2017-09-27  6:33   ` [Qemu-devel] " Bharat Bhushan
2017-09-27  6:33 ` [Qemu-arm] [PATCH v4 5/5] virtio-iommu: add iommu notifier memory-region Bharat Bhushan
2017-09-27  6:33   ` [Qemu-devel] " Bharat Bhushan
2017-09-27  6:46 ` [Qemu-arm] [PATCH v4 0/5] virtio-iommu: VFIO integration Bharat Bhushan
2017-09-27  6:46   ` [Qemu-devel] " Bharat Bhushan
2017-09-27  7:01   ` [Qemu-arm] " Peter Xu
2017-09-27  7:01     ` [Qemu-devel] " Peter Xu
2017-09-27  8:32     ` [Qemu-arm] " Bharat Bhushan
2017-09-27  8:32       ` [Qemu-devel] " Bharat Bhushan
2017-09-27  7:41 ` [Qemu-arm] " Linu Cherian
2017-09-27  7:41   ` [Qemu-devel] " Linu Cherian
2017-09-27  8:30   ` Bharat Bhushan
2017-09-27  8:30     ` [Qemu-devel] " Bharat Bhushan
2017-09-27  8:55     ` Auger Eric
2017-09-27  8:55       ` [Qemu-devel] " Auger Eric
2017-09-27  9:05       ` Linu Cherian
2017-09-27  9:05         ` [Qemu-devel] " Linu Cherian
2017-09-27  9:21       ` Linu Cherian
2017-09-27  9:21         ` [Qemu-devel] " Linu Cherian
2017-09-27  9:24         ` Auger Eric
2017-09-27  9:24           ` [Qemu-devel] " Auger Eric
2017-10-04 11:49           ` Linu Cherian [this message]
2017-10-04 11:49             ` Linu Cherian
2017-10-05 10:46             ` Auger Eric
2017-10-05 10:46               ` [Qemu-devel] " Auger Eric
2017-10-05 11:54               ` [Qemu-arm] [Qemu-devel] " Auger Eric
2017-10-05 11:54                 ` [Qemu-devel] [Qemu-arm] " Auger Eric
2017-10-05 12:13                 ` [Qemu-arm] [Qemu-devel] " Auger Eric
2017-10-05 12:13                   ` [Qemu-devel] [Qemu-arm] " Auger Eric
2017-10-05 17:02                   ` [Qemu-arm] [Qemu-devel] " Auger Eric
2017-10-05 17:02                     ` [Qemu-devel] [Qemu-arm] " Auger Eric
2017-10-06  3:46                     ` [Qemu-arm] [Qemu-devel] " Bharat Bhushan
2017-10-06  3:46                       ` [Qemu-devel] [Qemu-arm] " Bharat Bhushan
2017-10-06  7:24                       ` [Qemu-arm] [Qemu-devel] " Auger Eric
2017-10-06  7:24                         ` [Qemu-devel] [Qemu-arm] " Auger Eric
2017-10-06  8:41                         ` [Qemu-arm] [Qemu-devel] " Linu Cherian
2017-10-06  8:41                           ` [Qemu-devel] [Qemu-arm] " Linu Cherian
2017-10-10  6:42                       ` [Qemu-arm] [Qemu-devel] " Bharat Bhushan
2017-10-10  6:42                         ` [Qemu-devel] [Qemu-arm] " Bharat Bhushan
2017-10-11  9:42                         ` [Qemu-arm] [Qemu-devel] " Auger Eric
2017-10-11  9:42                           ` [Qemu-devel] [Qemu-arm] " Auger Eric
2017-09-27  8:58     ` Linu Cherian
2017-09-27  8:58       ` [Qemu-devel] " Linu Cherian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171004114910.GA6932@virtx40 \
    --to=linuc.decode@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=bharat.bhushan@nxp.com \
    --cc=bharatb.yadav@gmail.com \
    --cc=christoffer.dall@linaro.org \
    --cc=drjones@redhat.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=eric.auger@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=linu.cherian@cavium.com \
    --cc=marc.zyngier@arm.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=robin.murphy@arm.com \
    --cc=tn@semihalf.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.