From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754118AbdEDDKE (ORCPT ); Wed, 3 May 2017 23:10:04 -0400 Received: from mga09.intel.com ([134.134.136.24]:24974 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753956AbdEDDJz (ORCPT ); Wed, 3 May 2017 23:09:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,286,1491289200"; d="scan'208";a="97026994" From: "Chen, Xiaoguang" To: "alex.williamson@redhat.com" CC: "Tian, Kevin" , "intel-gfx@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "zhenyuw@linux.intel.com" , "alex.williamson@redhat.com" , "Lv, Zhiyuan" , "intel-gvt-dev@lists.freedesktop.org" , "Wang, Zhi A" , Gerd Hoffmann Subject: RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Thread-Topic: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf Thread-Index: AQHSwAN47y043l0J90m8wsAsHWts2aHgTQ8AgAGNjMCAAazCQA== Date: Thu, 4 May 2017 03:09:40 +0000 Message-ID: References: <1493372130-27727-1-git-send-email-xiaoguang.chen@intel.com> <1493372130-27727-7-git-send-email-xiaoguang.chen@intel.com> <1493718658.8581.82.camel@redhat.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v443A606008107 Hi Alex, do you have any comments for this interface? >-----Original Message----- >From: intel-gvt-dev [mailto:intel-gvt-dev-bounces@lists.freedesktop.org] On >Behalf Of Chen, Xiaoguang >Sent: Wednesday, May 03, 2017 9:39 AM >To: Gerd Hoffmann >Cc: Tian, Kevin ; intel-gfx@lists.freedesktop.org; linux- >kernel@vger.kernel.org; zhenyuw@linux.intel.com; alex.williamson@redhat.com; >Lv, Zhiyuan ; intel-gvt-dev@lists.freedesktop.org; Wang, >Zhi A >Subject: RE: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf > > > >>-----Original Message----- >>From: Gerd Hoffmann [mailto:kraxel@redhat.com] >>Sent: Tuesday, May 02, 2017 5:51 PM >>To: Chen, Xiaoguang >>Cc: alex.williamson@redhat.com; intel-gfx@lists.freedesktop.org; >>intel-gvt- dev@lists.freedesktop.org; Wang, Zhi A >>; zhenyuw@linux.intel.com; >>linux-kernel@vger.kernel.org; Lv, Zhiyuan ; Tian, >>Kevin >>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 > >_______________________________________________ >intel-gvt-dev mailing list >intel-gvt-dev@lists.freedesktop.org >https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev