From: Jike Song <jike.song@intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "Ruan, Shuai" <shuai.ruan@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
kvm@vger.kernel.org, "igvt-g@lists.01.org" <igvt-g@ml01.01.org>,
qemu-devel <qemu-devel@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Zhiyuan Lv <zhiyuan.lv@intel.com>
Subject: Re: VFIO based vGPU(was Re: [Announcement] 2015-Q3 release of XenGT - a Mediated ...)
Date: Wed, 20 Jan 2016 16:59:50 +0800 [thread overview]
Message-ID: <569F4C86.2070501@intel.com> (raw)
In-Reply-To: <1453143919.32741.169.camel@redhat.com>
On 01/19/2016 03:05 AM, Alex Williamson wrote:
> On Mon, 2016-01-18 at 16:56 +0800, Jike Song wrote:
>>
>> Would you elaborate a bit about 'iommu backends' here? Previously
>> I thought that entire type1 will be duplicated. If not, what is supposed
>> to add, a new vfio_dma_do_map?
>
> I don't know that you necessarily want to re-use any of the
> vfio_iommu_type1.c code as-is, it's just the API that we'll want to
> keep consistent so QEMU doesn't need to learn about a new iommu
> backend. Opportunities for sharing certainly may arise, you may want
> to use a similar red-black tree for storing current mappings, the
> pinning code may be similar, etc. We can evaluate on a case by case
> basis whether it makes sense to pull out common code for each of those.
It would be great if you can help abstracting it :)
>
> As for an iommu backend in general, if you look at the code flow
> example in Documentation/vfio.txt, the user opens a container
> (/dev/vfio/vfio) and a group (/dev/vfio/$GROUPNUM). The group is set
> to associate with a container instance via VFIO_GROUP_SET_CONTAINER and
> then an iommu model is set for the container with VFIO_SET_IOMMU.
> Looking at drivers/vfio/vfio.c:vfio_ioctl_set_iommu(), we look for an
> iommu backend that supports the requested extension (VFIO_TYPE1_IOMMU),
> call the open() callback on it and then attempt to attach the group via
> the attach_group() callback. At this latter callback, the iommu
> backend can compare the device to those that it actually supports. For
> instance the existing vfio_iommu_type1 will attempt to use the IOMMU
> API and should fail if the device cannot be supported with that. The
> current loop in vfio_ioctl_set_iommu() will exit in this case, but as
> you can see in the code, it's easy to make it continue and look for
> another iommu backend that supports the requested extension.
>
Got it, sure type1 API w/ userspace should be kept, while a new backend
being used for vgpu.
>>> The benefit here is that QEMU could work
>>> unmodified, using the type1 vfio-iommu API regardless of whether a
>>> device is directly assigned or virtual.
>>>
>>> Let's look at the type1 interface; we have simple map and unmap
>>> interfaces which map and unmap process virtual address space (vaddr) to
>>> the device address space (iova). The host physical address is obtained
>>> by pinning the vaddr. In the current implementation, a map operation
>>> pins pages and populates the hardware iommu. A vgpu compatible
>>> implementation might simply register the translation into a kernel-
>>> based database to be called upon later. When the host graphics driver
>>> needs to enable dma for the vgpu, it doesn't need to go to QEMU for the
>>> translation, it already possesses the iova to vaddr mapping, which
>>> becomes iova to hpa after a pinning operation.
>>>
>>> So, I would encourage you to look at creating a vgpu vfio iommu
>>> backened that makes use of the type1 api since it will reduce the
>>> changes necessary for userspace.
>>>
>>
>> BTW, that should be done in the 'bus' driver, right?
>
> I think you have some flexibility between the graphics driver and the
> vfio-vgpu driver in where this is done. If we want vfio-vgpu to be
> more generic, then vgpu device creation and management should probably
> be done in the graphics driver and vfio-vgpu should be able to probe
> that device and call back into the graphics driver to handle requests.
> If it turns out there's not much for vfio-vgpu to share, ie. it's just
> a passthrough for device specific emulation, then maybe we want a vfio-
> intel-vgpu instead.
>
Good to know that.
>>
>> Looks that things get more clear overall, with small exceptions.
>> Thanks for the advice:)
>
> Yes, please let me know how I can help. Thanks,
>
> Alex
>
I will start the coding soon, will do :)
--
Thanks,
Jike
WARNING: multiple messages have this Message-ID (diff)
From: Jike Song <jike.song@intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "Ruan, Shuai" <shuai.ruan@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
kvm@vger.kernel.org, "igvt-g@lists.01.org" <igvt-g@ml01.01.org>,
qemu-devel <qemu-devel@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Zhiyuan Lv <zhiyuan.lv@intel.com>
Subject: Re: [Qemu-devel] VFIO based vGPU(was Re: [Announcement] 2015-Q3 release of XenGT - a Mediated ...)
Date: Wed, 20 Jan 2016 16:59:50 +0800 [thread overview]
Message-ID: <569F4C86.2070501@intel.com> (raw)
In-Reply-To: <1453143919.32741.169.camel@redhat.com>
On 01/19/2016 03:05 AM, Alex Williamson wrote:
> On Mon, 2016-01-18 at 16:56 +0800, Jike Song wrote:
>>
>> Would you elaborate a bit about 'iommu backends' here? Previously
>> I thought that entire type1 will be duplicated. If not, what is supposed
>> to add, a new vfio_dma_do_map?
>
> I don't know that you necessarily want to re-use any of the
> vfio_iommu_type1.c code as-is, it's just the API that we'll want to
> keep consistent so QEMU doesn't need to learn about a new iommu
> backend. Opportunities for sharing certainly may arise, you may want
> to use a similar red-black tree for storing current mappings, the
> pinning code may be similar, etc. We can evaluate on a case by case
> basis whether it makes sense to pull out common code for each of those.
It would be great if you can help abstracting it :)
>
> As for an iommu backend in general, if you look at the code flow
> example in Documentation/vfio.txt, the user opens a container
> (/dev/vfio/vfio) and a group (/dev/vfio/$GROUPNUM). The group is set
> to associate with a container instance via VFIO_GROUP_SET_CONTAINER and
> then an iommu model is set for the container with VFIO_SET_IOMMU.
> Looking at drivers/vfio/vfio.c:vfio_ioctl_set_iommu(), we look for an
> iommu backend that supports the requested extension (VFIO_TYPE1_IOMMU),
> call the open() callback on it and then attempt to attach the group via
> the attach_group() callback. At this latter callback, the iommu
> backend can compare the device to those that it actually supports. For
> instance the existing vfio_iommu_type1 will attempt to use the IOMMU
> API and should fail if the device cannot be supported with that. The
> current loop in vfio_ioctl_set_iommu() will exit in this case, but as
> you can see in the code, it's easy to make it continue and look for
> another iommu backend that supports the requested extension.
>
Got it, sure type1 API w/ userspace should be kept, while a new backend
being used for vgpu.
>>> The benefit here is that QEMU could work
>>> unmodified, using the type1 vfio-iommu API regardless of whether a
>>> device is directly assigned or virtual.
>>>
>>> Let's look at the type1 interface; we have simple map and unmap
>>> interfaces which map and unmap process virtual address space (vaddr) to
>>> the device address space (iova). The host physical address is obtained
>>> by pinning the vaddr. In the current implementation, a map operation
>>> pins pages and populates the hardware iommu. A vgpu compatible
>>> implementation might simply register the translation into a kernel-
>>> based database to be called upon later. When the host graphics driver
>>> needs to enable dma for the vgpu, it doesn't need to go to QEMU for the
>>> translation, it already possesses the iova to vaddr mapping, which
>>> becomes iova to hpa after a pinning operation.
>>>
>>> So, I would encourage you to look at creating a vgpu vfio iommu
>>> backened that makes use of the type1 api since it will reduce the
>>> changes necessary for userspace.
>>>
>>
>> BTW, that should be done in the 'bus' driver, right?
>
> I think you have some flexibility between the graphics driver and the
> vfio-vgpu driver in where this is done. If we want vfio-vgpu to be
> more generic, then vgpu device creation and management should probably
> be done in the graphics driver and vfio-vgpu should be able to probe
> that device and call back into the graphics driver to handle requests.
> If it turns out there's not much for vfio-vgpu to share, ie. it's just
> a passthrough for device specific emulation, then maybe we want a vfio-
> intel-vgpu instead.
>
Good to know that.
>>
>> Looks that things get more clear overall, with small exceptions.
>> Thanks for the advice:)
>
> Yes, please let me know how I can help. Thanks,
>
> Alex
>
I will start the coding soon, will do :)
--
Thanks,
Jike
next prev parent reply other threads:[~2016-01-20 8:59 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 2:39 VFIO based vGPU(was Re: [Announcement] 2015-Q3 release of XenGT - a Mediated ...) Jike Song
2016-01-18 2:39 ` [Qemu-devel] " Jike Song
2016-01-18 4:47 ` Alex Williamson
2016-01-18 4:47 ` [Qemu-devel] " Alex Williamson
2016-01-18 8:56 ` Jike Song
2016-01-18 8:56 ` [Qemu-devel] " Jike Song
2016-01-18 19:05 ` Alex Williamson
2016-01-18 19:05 ` [Qemu-devel] " Alex Williamson
2016-01-20 8:59 ` Jike Song [this message]
2016-01-20 8:59 ` Jike Song
2016-01-20 9:05 ` Tian, Kevin
2016-01-20 9:05 ` [Qemu-devel] " Tian, Kevin
2016-01-25 11:34 ` Jike Song
2016-01-25 11:34 ` [Qemu-devel] " Jike Song
2016-01-25 21:30 ` Alex Williamson
2016-01-25 21:30 ` [Qemu-devel] " Alex Williamson
2016-01-25 21:45 ` Tian, Kevin
2016-01-25 21:45 ` [Qemu-devel] " Tian, Kevin
2016-01-25 21:48 ` Tian, Kevin
2016-01-25 21:48 ` [Qemu-devel] " Tian, Kevin
2016-01-26 9:48 ` Neo Jia
2016-01-26 9:48 ` [Qemu-devel] " Neo Jia
2016-01-26 10:20 ` Neo Jia
2016-01-26 10:20 ` [Qemu-devel] " Neo Jia
2016-01-26 19:24 ` Tian, Kevin
2016-01-26 19:24 ` [Qemu-devel] " Tian, Kevin
2016-01-26 19:29 ` Neo Jia
2016-01-26 19:29 ` [Qemu-devel] " Neo Jia
2016-01-26 20:06 ` Alex Williamson
2016-01-26 20:06 ` [Qemu-devel] " Alex Williamson
2016-01-26 21:38 ` Tian, Kevin
2016-01-26 21:38 ` [Qemu-devel] " Tian, Kevin
2016-01-26 22:28 ` Neo Jia
2016-01-26 22:28 ` [Qemu-devel] " Neo Jia
2016-01-26 23:30 ` Alex Williamson
2016-01-26 23:30 ` [Qemu-devel] " Alex Williamson
2016-01-27 9:14 ` Neo Jia
2016-01-27 9:14 ` [Qemu-devel] " Neo Jia
2016-01-27 16:10 ` Alex Williamson
2016-01-27 16:10 ` [Qemu-devel] " Alex Williamson
2016-01-27 21:48 ` Neo Jia
2016-01-27 21:48 ` [Qemu-devel] " Neo Jia
2016-01-27 8:06 ` Kirti Wankhede
2016-01-27 8:06 ` [Qemu-devel] " Kirti Wankhede
2016-01-27 16:00 ` Alex Williamson
2016-01-27 16:00 ` [Qemu-devel] " Alex Williamson
2016-01-27 20:55 ` Kirti Wankhede
2016-01-27 20:55 ` [Qemu-devel] " Kirti Wankhede
2016-01-27 21:58 ` Alex Williamson
2016-01-27 21:58 ` [Qemu-devel] " Alex Williamson
2016-01-28 3:01 ` Kirti Wankhede
2016-01-28 3:01 ` [Qemu-devel] " Kirti Wankhede
2016-01-26 7:41 ` Jike Song
2016-01-26 7:41 ` [Qemu-devel] " Jike Song
2016-01-26 14:05 ` Yang Zhang
2016-01-26 14:05 ` [Qemu-devel] " Yang Zhang
2016-01-26 16:37 ` Alex Williamson
2016-01-26 16:37 ` [Qemu-devel] " Alex Williamson
2016-01-26 21:21 ` Tian, Kevin
2016-01-26 21:21 ` [Qemu-devel] " Tian, Kevin
2016-01-26 21:30 ` Neo Jia
2016-01-26 21:30 ` [Qemu-devel] " Neo Jia
2016-01-26 21:43 ` Tian, Kevin
2016-01-26 21:43 ` [Qemu-devel] " Tian, Kevin
2016-01-26 21:43 ` Alex Williamson
2016-01-26 21:43 ` [Qemu-devel] " Alex Williamson
2016-01-26 21:50 ` Tian, Kevin
2016-01-26 21:50 ` [Qemu-devel] " Tian, Kevin
2016-01-26 22:07 ` Alex Williamson
2016-01-26 22:07 ` [Qemu-devel] " Alex Williamson
2016-01-26 22:15 ` Tian, Kevin
2016-01-26 22:15 ` [Qemu-devel] " Tian, Kevin
2016-01-26 22:27 ` Alex Williamson
2016-01-26 22:27 ` [Qemu-devel] " Alex Williamson
2016-01-26 22:39 ` Tian, Kevin
2016-01-26 22:39 ` [Qemu-devel] " Tian, Kevin
2016-01-26 22:56 ` Alex Williamson
2016-01-26 22:56 ` [Qemu-devel] " Alex Williamson
2016-01-27 1:47 ` Jike Song
2016-01-27 1:47 ` [Qemu-devel] " Jike Song
2016-01-27 3:07 ` Alex Williamson
2016-01-27 3:07 ` [Qemu-devel] " Alex Williamson
2016-01-27 5:43 ` Jike Song
2016-01-27 5:43 ` [Qemu-devel] " Jike Song
2016-01-27 16:19 ` Alex Williamson
2016-01-27 16:19 ` [Qemu-devel] " Alex Williamson
2016-01-28 6:00 ` Jike Song
2016-01-28 6:00 ` [Qemu-devel] " Jike Song
2016-01-28 15:23 ` Alex Williamson
2016-01-28 15:23 ` [Qemu-devel] " Alex Williamson
2016-01-29 7:20 ` Jike Song
2016-01-29 7:20 ` [Qemu-devel] " Jike Song
2016-01-29 8:49 ` [iGVT-g] " Jike Song
2016-01-29 8:49 ` [Qemu-devel] " Jike Song
2016-01-29 18:50 ` Alex Williamson
2016-01-29 18:50 ` [Qemu-devel] " Alex Williamson
2016-02-01 13:10 ` Gerd Hoffmann
2016-02-01 13:10 ` [Qemu-devel] " Gerd Hoffmann
2016-02-01 21:44 ` Alex Williamson
2016-02-01 21:44 ` [Qemu-devel] " Alex Williamson
2016-02-02 7:28 ` Gerd Hoffmann
2016-02-02 7:28 ` [Qemu-devel] " Gerd Hoffmann
2016-02-02 7:35 ` Zhiyuan Lv
2016-02-02 7:35 ` [Qemu-devel] " Zhiyuan Lv
2016-01-27 1:52 ` Yang Zhang
2016-01-27 1:52 ` [Qemu-devel] " Yang Zhang
2016-01-27 3:37 ` Alex Williamson
2016-01-27 3:37 ` [Qemu-devel] " Alex Williamson
2016-01-27 0:06 ` Jike Song
2016-01-27 0:06 ` [Qemu-devel] " Jike Song
2016-01-27 1:34 ` Yang Zhang
2016-01-27 1:34 ` [Qemu-devel] " Yang Zhang
2016-01-27 1:51 ` Jike Song
2016-01-27 1:51 ` [Qemu-devel] " Jike Song
2016-01-26 16:12 ` Alex Williamson
2016-01-26 16:12 ` [Qemu-devel] " Alex Williamson
2016-01-26 21:57 ` Tian, Kevin
2016-01-26 21:57 ` [Qemu-devel] " Tian, Kevin
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=569F4C86.2070501@intel.com \
--to=jike.song@intel.com \
--cc=alex.williamson@redhat.com \
--cc=igvt-g@ml01.01.org \
--cc=kevin.tian@intel.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shuai.ruan@intel.com \
--cc=zhiyuan.lv@intel.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.