From: Auger Eric <eric.auger@redhat.com>
To: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"virtio-dev@lists.oasis-open.org"
<virtio-dev@lists.oasis-open.org>
Cc: Will Deacon <Will.Deacon@arm.com>,
Robin Murphy <Robin.Murphy@arm.com>,
Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
"mst@redhat.com" <mst@redhat.com>,
"jasowang@redhat.com" <jasowang@redhat.com>,
Marc Zyngier <Marc.Zyngier@arm.com>,
"eric.auger.pro@gmail.com" <eric.auger.pro@gmail.com>,
"bharat.bhushan@nxp.com" <bharat.bhushan@nxp.com>,
"peterx@redhat.com" <peterx@redhat.com>,
"kevin.tian@intel.com" <kevin.tian@intel.com>
Subject: Re: [RFC] virtio-iommu version 0.4
Date: Wed, 20 Sep 2017 11:37:25 +0200 [thread overview]
Message-ID: <6d9f91df-ebb0-2ae0-a098-60a6bcd0e09b@redhat.com> (raw)
In-Reply-To: <4543e6dc-0f36-11ad-784a-d7c07399d10f@arm.com>
Hi Jean,
On 19/09/2017 12:47, Jean-Philippe Brucker wrote:
> Hi Eric,
>
> On 12/09/17 18:13, Auger Eric wrote:
>> 2.6.7
>> - As I am currently integrating v0.4 in QEMU here are some other comments:
>> At the moment struct virtio_iommu_req_probe flags is missing in your
>> header. As such I understood the ACK protocol was not implemented by the
>> driver in your branch.
>
> Uh indeed. And yet I could swear I've written that code... somewhere. I
> will add it to the batch of v0.5 changes, it shouldn't be too invasive.
>
>> - VIRTIO_IOMMU_PROBE_PROPERTY_TYPE_MASK is VIRTIO_IOMMU_T_MASK in your
>> header too.
>
> Yes, keeping VIRTIO_IOMMU_PROBE_PROPERTY_TYPE_MASK is probably best
> (though it is a mouthful).
>
>> 2.6.8.2:
>> - I am really confused about what the device should report as resv
>> regions depending on the PE nature (VFIO or not VFIO)
>>
>> In other iommu drivers, the resv regions are populated by the iommu
>> driver through its get_resv_regions callback. They are usually composed
>> of an iommu specific MSI region (mapped or bypassed) and non IOMMU
>> specific (device specific) reserved regions:
>> iommu_dma_get_resv_regions(). In the case of virtio-iommu driver, those
>> are the guest reserved regions.
>>
>> First in the current virtio-iommu driver I don't see the
>> iommu_dma_get_resv_regions call. Do you agree that the virtio-iommu
>> driver should compute the non IOMMU specific MSI regions ie. this is
>> not the responsability of the virtio-iommu device.
>
> For SW_MSI, certainly. The driver allocates a fixed IOVA region for
> mapping the MSI doorbell. But the driver has to know whether the doorbell
> region is translated or bypassed.
Sorry I was talking about *non* IOMMU specific MSI regions, typically
the regions corresponding to guest PCI host bridge windows. This is
normally computed in the iommu driver and I didn't that that in the
existing virtio-iommu driver.
>
>> Then why is it more the job of the device to return the guest iommu
>> specific region rather than the driver itself?
>
> The MSI region is architectural on x86 IOMMUs, but
> implementation-defined on virtio-iommu. It depends which platform the host
> is emulating. In Linux, x86 IOMMU drivers register the bypass region
> because there always is an IOAPIC on the other end, with a fixed MSI
> address. But virtio-iommu may be either behind a GIC, an APIC or some
> other IRQ chip.
>
> The driver *could* go over all the irqchips/platforms it knows and try to
> guess if there is a fixed doorbell or if it needs to reserve an IOVA for
> them, but it would look horrible. I much prefer having a well-defined way
> of doing this, so a description from the device.
This means I must have target specific code in the virtio-iommu device
which is unusual, right? I was initially thinking you could handle that
on the driver side using a config set for ARM|ARM64. But on the other
hand you should communicate the info to the device ...
>
>> Then I understand this is the responsability of the virtio-iommu device
>> to gather information about the host resv regions in case of VFIO EP.
>> Typically the host PCIe host bridge windows cannot be used for IOVA.
>> Also the host MSI reserved IOVA window cannot be used. Do you agree.
>
> Yes, all regions reported in sysfs reserved_regions in the host would be
> reported as RESV_T_RESERVED by virtio-iommu.
So to summarize if the probe request is sent to an emulated device, we
should return the target specific MSI window. We can't and don't return
the non IOMMU specific guest reserved windows.
For a VFIO device, we would return all reserved regions of the group the
device belongs to. Is that correct?
>
>> I really think the spec should clarify what exact resv regions the
>> device should return in case of VFIO device and non VFIO device.
>
> Agreed. I will add something about RESV_T_RESERVED with the PCI bridge
> example in Implementation Notes. Do you think the MSI examples at the end
> need improvement as well? I can try to explain that RESV_MSI regions in
> virtio-iommu are only those of the emulated platform, not the HW or SW MSI
> regions from the host.
I think I would expect an explanation detailing returned reserved
regions for pure emulated devices and HW/VFIO devices.
Another unrelated remark:
- you should add a permission violation error.
- wrt the probe request ACK protocol, this looks pretty heavy as both
the driver and the device need to parse the req_probe buffer. The device
need to fill in the output buffer and then read the same info on the
input buffer. Couldn't we imagine something simpler?
Thanks
Eric
>
> Thanks,
> Jean
>
next prev parent reply other threads:[~2017-09-20 9:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 18:19 [RFC] virtio-iommu version 0.4 Jean-Philippe Brucker
2017-08-04 18:19 ` [RFC] virtio-iommu v0.4 - IOMMU Device Jean-Philippe Brucker
2017-08-04 18:19 ` [RFC] virtio-iommu v0.4 - Implementation notes Jean-Philippe Brucker
2017-08-14 8:27 ` [RFC] virtio-iommu version 0.4 Tian, Kevin
[not found] ` <AADFC41AFE54684AB9EE6CBC0274A5D190D7173C-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-08-14 9:38 ` Jean-Philippe Brucker
2017-08-16 4:08 ` [virtio-dev] " Adam Tao
2017-08-17 10:12 ` Jean-Philippe Brucker
[not found] ` <a2e573f3-bdfb-b5e5-7835-a7597abd48f5-5wv7dgnIgG8@public.gmane.org>
2017-08-17 11:27 ` Bharat Bhushan
2017-08-23 10:01 ` Jean-Philippe Brucker
2017-08-28 7:39 ` Tian, Kevin
2017-09-06 11:54 ` Jean-Philippe Brucker
2017-09-21 6:27 ` Tian, Kevin
2017-09-25 13:32 ` [virtio-dev] " Jean-Philippe Brucker
2017-08-23 13:55 ` Auger Eric
[not found] ` <f9b02ce1-057f-df4f-90d7-52616ad60b88-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-09-06 11:48 ` [virtio-dev] " Jean-Philippe Brucker
2017-09-21 6:41 ` Tian, Kevin
[not found] ` <AADFC41AFE54684AB9EE6CBC0274A5D190DDD022-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-09-25 13:47 ` [virtio-dev] " Jean-Philippe Brucker
2017-09-12 17:13 ` Auger Eric
[not found] ` <072f5a14-baae-57a9-9c5b-b93163c67075-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-09-13 3:47 ` Bharat Bhushan
2017-09-19 10:47 ` Jean-Philippe Brucker
2017-09-20 9:37 ` Auger Eric [this message]
2017-09-21 10:29 ` Jean-Philippe Brucker
2017-10-03 13:04 ` Auger Eric
[not found] ` <0e0db2c0-86bc-a76a-05bd-0b41e00ba926-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-09 19:46 ` [virtio-dev] " Jean-Philippe Brucker
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=6d9f91df-ebb0-2ae0-a098-60a6bcd0e09b@redhat.com \
--to=eric.auger@redhat.com \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=Marc.Zyngier@arm.com \
--cc=Robin.Murphy@arm.com \
--cc=Will.Deacon@arm.com \
--cc=bharat.bhushan@nxp.com \
--cc=eric.auger.pro@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jasowang@redhat.com \
--cc=jean-philippe.brucker@arm.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).