From: Jike Song <jike.song@intel.com>
To: Neo Jia <cjia@nvidia.com>
Cc: shuai.ruan@intel.com, kevin.tian@intel.com,
Alex Williamson <alex.williamson@redhat.com>,
kvm@vger.kernel.org, qemu-devel@nongnu.org,
Kirti Wankhede <kwankhede@nvidia.com>,
kraxel@redhat.com, pbonzini@redhat.com, zhiyuan.lv@intel.com
Subject: Re: [Qemu-devel] [RFC PATCH v2 3/3] VFIO: Type1 IOMMU mapping support for vGPU
Date: Thu, 10 Mar 2016 11:10:10 +0800 [thread overview]
Message-ID: <56E0E592.20008@intel.com> (raw)
In-Reply-To: <20160308003139.GA22106@nvidia.com>
On 03/08/2016 08:31 AM, Neo Jia wrote:
> On Mon, Mar 07, 2016 at 02:07:15PM +0800, Jike Song wrote:
>> Hi Neo,
>>
>> On Fri, Mar 4, 2016 at 3:00 PM, Neo Jia <cjia@nvidia.com> wrote:
>>> On Wed, Mar 02, 2016 at 04:38:34PM +0800, Jike Song wrote:
>>>> On 02/24/2016 12:24 AM, Kirti Wankhede wrote:
>>>>> + vgpu_dma->size = map->size;
>>>>> +
>>>>> + vgpu_link_dma(vgpu_iommu, vgpu_dma);
>>>>
>>>> Hi Kirti & Neo,
>>>>
>>>> seems that no one actually setup mappings for IOMMU here?
>>>>
>>>
>>> Hi Jike,
>>>
>>> Yes.
>>>
>>> The actual mapping should be done by the host kernel driver after calling the
>>> translation/pinning API vgpu_dma_do_translate.
>>
>> Thanks for the reply. I mis-deleted the mail in my intel account, so
>> reply with private mail account, sorry for that.
>>
>>
>> In vgpu_dma_do_translate():
>>
>> for (i = 0; i < count; i++) {
>> {snip}
>> dma_addr_t iova = gfn_buffer[i] << PAGE_SHIFT;
>> vgpu_dma = vgpu_find_dma(vgpu_iommu, iova, 0 /* size */);
>>
>> remote_vaddr = vgpu_dma->vaddr + iova - vgpu_dma->iova;
>> if (get_user_pages_unlocked(NULL, mm, remote_vaddr, 1, 1, 0, page) == 1) {
>> pfn = page_to_pfn(page[0]);
>> }
>> gfn_buffer[i] = pfn;
>> }
>>
>> If I understand correctly, the purpose of above code, is given an
>> array of gfns, try to pin & return associated pfns. There is still no
>> IOMMU mappings here.
>
> Yes.
>
Thanks for the conformation.
>> Is it supposed to be the caller who should set
>> up IOMMU by DMA api such as dma_map_page(), after calling
>> vgpu_dma_do_translate()?
>>
>
> Don't think you need to call dma_map_page here. Once you have the pfn available
> to your GPU kernel driver, you can just go ahead to setup the mapping as you
> normally do such as calling pci_map_sg and its friends.
>
Technically it's definitely OK to call DMA API from the caller rather than here,
however personally I think it is a bit counter-intuitive: IOMMU page tables
should be constructed within the VFIO IOMMU driver.
> Thanks,
> Neo
--
Thanks,
Jike
next prev parent reply other threads:[~2016-03-10 3:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 16:24 [Qemu-devel] [RFC PATCH v2 1/3] vGPU Core driver Kirti Wankhede
2016-02-23 16:24 ` [Qemu-devel] [RFC PATCH v2 2/3] VFIO driver for vGPU device Kirti Wankhede
2016-02-23 16:24 ` [Qemu-devel] [RFC PATCH v2 3/3] VFIO: Type1 IOMMU mapping support for vGPU Kirti Wankhede
2016-03-02 8:38 ` Jike Song
2016-03-04 7:00 ` Neo Jia
2016-03-07 6:07 ` Jike Song
2016-03-08 0:31 ` Neo Jia
2016-03-10 3:10 ` Jike Song [this message]
2016-03-11 4:19 ` Neo Jia
2016-03-11 4:46 ` Tian, Kevin
2016-03-11 6:10 ` Neo Jia
2016-03-11 8:06 ` Tian, Kevin
2016-03-11 16:13 ` Alex Williamson
2016-03-11 16:55 ` Neo Jia
2016-03-11 17:56 ` Alex Williamson
2016-03-11 18:18 ` Neo Jia
2016-02-29 5:39 ` [Qemu-devel] [RFC PATCH v2 1/3] vGPU Core driver Tian, Kevin
2016-02-29 23:17 ` Neo Jia
2016-03-01 3:10 ` Jike Song
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=56E0E592.20008@intel.com \
--to=jike.song@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--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 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).