Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634692

RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf

From "Chen, Xiaoguang" <xiaoguang.chen@intel.com>
Newsgroups linux.kernel
Subject RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf
Date 2017-05-03 03:50 +0200
Message-ID <tCRAt-68i-3@gated-at.bofh.it> (permalink)
References <tBaHf-5yJ-7@gated-at.bofh.it> <tBaHf-5yJ-5@gated-at.bofh.it> <tCCL7-4Uk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



>-----Original Message-----
>From: Gerd Hoffmann [mailto:kraxel@redhat.com]
>Sent: Tuesday, May 02, 2017 5:51 PM
>To: Chen, Xiaoguang <xiaoguang.chen@intel.com>
>Cc: alex.williamson@redhat.com; intel-gfx@lists.freedesktop.org; intel-gvt-
>dev@lists.freedesktop.org; Wang, Zhi A <zhi.a.wang@intel.com>;
>zhenyuw@linux.intel.com; linux-kernel@vger.kernel.org; Lv, Zhiyuan
><zhiyuan.lv@intel.com>; Tian, Kevin <kevin.tian@intel.com>
>Subject: Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf
>
>On Fr, 2017-04-28 at 17:35 +0800, Xiaoguang Chen wrote:
>> +static size_t intel_vgpu_reg_rw_gvtg(struct intel_vgpu *vgpu, char
>> *buf,
>> +               size_t count, loff_t *ppos, bool iswrite) {
>> +       unsigned int i = VFIO_PCI_OFFSET_TO_INDEX(*ppos) -
>> +                       VFIO_PCI_NUM_REGIONS;
>> +       loff_t pos = *ppos & VFIO_PCI_OFFSET_MASK;
>> +       int fd;
>> +
>> +       if (pos >= vgpu->vdev.region[i].size || iswrite) {
>> +               gvt_vgpu_err("invalid op or offset for Intel vgpu fd
>> region\n");
>> +               return -EINVAL;
>> +       }
>> +
>> +       fd = anon_inode_getfd("gvtg", &intel_vgpu_gvtg_ops, vgpu,
>> +                       O_RDWR | O_CLOEXEC);
>> +       if (fd < 0) {
>> +               gvt_vgpu_err("create intel vgpu fd failed:%d\n", fd);
>> +               return -EINVAL;
>> +       }
>> +
>> +       count = min(count, (size_t)(vgpu->vdev.region[i].size - pos));
>> +       memcpy(buf, &fd, count);
>> +
>> +       return count;
>> +}
>
>Hmm, that looks like a rather strange way to return a file descriptor.
>
>What is the reason to not use ioctls on the vfio file handle, like older version of
>these patches did?
If I understood correctly that Alex prefer not to change the ioctls on the vfio file handle like the old version.
So I used this way the smallest change to general vfio framework only adding a subregion definition.

>
>cheers,
>  Gerd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Xiaoguang Chen <xiaoguang.chen@intel.com> - 2017-04-28 11:50 +0200
  Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Gerd Hoffmann <kraxel@redhat.com> - 2017-05-02 12:00 +0200
    RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf "Chen, Xiaoguang" <xiaoguang.chen@intel.com> - 2017-05-03 03:50 +0200
      RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf "Chen, Xiaoguang" <xiaoguang.chen@intel.com> - 2017-05-04 05:20 +0200
        Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Alex Williamson <alex.williamson@redhat.com> - 2017-05-04 18:10 +0200
          Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Gerd Hoffmann <kraxel@redhat.com> - 2017-05-05 09:00 +0200
            Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Alex Williamson <alex.williamson@redhat.com> - 2017-05-05 17:20 +0200
              RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf "Chen, Xiaoguang" <xiaoguang.chen@intel.com> - 2017-05-11 10:50 +0200
                Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Gerd Hoffmann <kraxel@redhat.com> - 2017-05-11 15:30 +0200
                Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Alex Williamson <alex.williamson@redhat.com> - 2017-05-11 17:50 +0200

csiph-web