Received: by 10.223.164.202 with SMTP id h10csp2362278wrb; Sat, 18 Nov 2017 20:16:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMb2XimCQVkOxjKCz8po66ucYXQwNwXTH5Gr8JjdOESmKmbfj0xuDmj2IejGEVN3JT22ZULZ X-Received: by 10.84.137.106 with SMTP id 97mr10067821plm.429.1511064998420; Sat, 18 Nov 2017 20:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511064998; cv=none; d=google.com; s=arc-20160816; b=xUpNDOAGfINqweat4iWYG5ltPbmOaNm42zuXuf61v4cFhbVyJs8+uJAyRXGybURRzC J+nxVvEOg2h5g1unEvx4ceDK8GeZ18IODhVbnvWJkoOL0QJTA1CI21D97fGGptbABORU KjGk1x2D7s1RViVcY8hGc9f3lVBxL0lDcbfMSqgbJqUHA5UVAmbcQPNCl+/zI4Ik4Woi PDFX8PTSLKVp2WVHg3XhFqpWz0FCdYGy4GwprDrHlbehubYHVakmimPjLQr092ZdpkeM 4D7Z9UDkNlRRzN1i4lvRRDiQlRamfC2rDHG3HdpwNg4kACdhaghaBHQwIJV0PeTgB9Fh c6aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject:arc-authentication-results; bh=abLrjPoWSX5rR8UmI3Up5s11GpAJ1LKUSXvYTaf3NC4=; b=UDK1ReIpo8m6qBgYY60rDQ3mwbCAzB30CmY4BUX/hV+1s7uJ+Mof1qmC6Z7b5gXDUg H/zuf7nt+Y+nXEU0XC7vUY/Zag2ptUpFoUdv0/26i4x+ONKcolfb2tMp/hbQg2NkmLgh k1juSuAPP+mbZa4xn5/NoA9avQb3Aw6zev8BQeERYebtiIKDJia0xuJ+8twzLi9Tid34 +WjgDZCesLZ2DQcz7BkEnneOPpIqosYTM4zZGJrrv8tUXR5sxOsshiHG6JwvzAm63eXm 4iRG8hrs91ZaM32Er2unqYcYzpJsu5KIY+gPZ2CuKUpfXyJQKmgPIPNQDO2ePUVoxzrl HXJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185si6073021pfc.43.2017.11.18.20.16.25; Sat, 18 Nov 2017 20:16:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423009AbdKRR7w (ORCPT + 92 others); Sat, 18 Nov 2017 12:59:52 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:6218 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764939AbdKRR7r (ORCPT ); Sat, 18 Nov 2017 12:59:47 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Sat, 18 Nov 2017 09:59:44 -0800 Received: from HQMAIL104.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Sat, 18 Nov 2017 10:00:25 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Sat, 18 Nov 2017 10:00:25 -0800 Received: from BGMAIL102.nvidia.com (10.25.59.11) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Sat, 18 Nov 2017 17:59:45 +0000 Received: from [10.24.71.91] (10.24.71.91) by bgmail102.nvidia.com (10.25.59.11) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Sat, 18 Nov 2017 17:59:40 +0000 Subject: Re: [PATCH v18 5/6] vfio: ABI for mdev display dma-buf operation To: Alex Williamson , Zhenyu Wang CC: Tina Zhang , , Daniel Vetter , , , , , , , , , , References: <1510737115-4258-1-git-send-email-tina.zhang@intel.com> <1510737115-4258-6-git-send-email-tina.zhang@intel.com> <20171115114842.30a0f72e@t450s.home> <20171116032156.owtssoypall2q4qp@zhen-hp.sh.intel.com> <20171115211136.627396bc@t450s.home> <20171118083015.24b0b1dd@t450s.home> X-Nvconfidentiality: public From: Kirti Wankhede Message-ID: Date: Sat, 18 Nov 2017 23:29:31 +0530 MIME-Version: 1.0 In-Reply-To: <20171118083015.24b0b1dd@t450s.home> X-Originating-IP: [10.24.71.91] X-ClientProxiedBy: BGMAIL104.nvidia.com (10.25.59.13) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extremely sorry for the delay. This works for VFIO_GFX_PLANE_TYPE_REGION. Tested with local changes. Reviewed-by: Kirti Wankhede Thanks, Kirti On 11/18/2017 9:00 PM, Alex Williamson wrote: > > Kirti? > > On Wed, 15 Nov 2017 21:11:42 -0700 > Alex Williamson wrote: > >> On Thu, 16 Nov 2017 11:21:56 +0800 >> Zhenyu Wang wrote: >> >>> On 2017.11.15 11:48:42 -0700, Alex Williamson wrote: >>>> On Wed, 15 Nov 2017 17:11:54 +0800 >>>> Tina Zhang wrote: >>>> >>>>> Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user query and get >>>>> a plane and its information. So far, two types of buffers are supported: >>>>> buffers based on dma-buf and buffers based on region. >>>>> >>>>> This ioctl can be invoked with: >>>>> 1) Either DMABUF or REGION flag. Vendor driver returns a plane_info >>>>> successfully only when the specific kind of buffer is supported. >>>>> 2) Flag PROBE. And at the same time either DMABUF or REGION must be set, >>>>> so that vendor driver returns success only when the specific kind of >>>>> buffer is supported. >>>>> >>>>> Add VFIO_DEVICE_GET_GFX_DMABUF ioctl command to let user get a specific >>>>> dma-buf fd of an exposed MDEV buffer provided by dmabuf_id which was >>>>> returned in VFIO_DEVICE_QUERY_GFX_PLANE ioctl command. >>>>> >>>>> The life cycle of an exposed MDEV buffer is handled by userspace and >>>>> tracked by kernel space. The returned dmabuf_id in struct vfio_device_ >>>>> query_gfx_plane can be a new id of a new exposed buffer or an old id of >>>>> a re-exported buffer. Host user can check the value of dmabuf_id to see >>>>> if it needs to create new resources according to the new exposed buffer >>>>> or just re-use the existing resource related to the old buffer. >>>>> >>>>> v18: >>>>> - update comments for VFIO_DEVICE_GET_GFX_DMABUF. (Alex) >>>>> >>>>> v17: >>>>> - modify VFIO_DEVICE_GET_GFX_DMABUF interface. (Alex) >>>>> >>>>> v16: >>>>> - add x_hot and y_hot fields. (Gerd) >>>>> - add comments for VFIO_DEVICE_GET_GFX_DMABUF. (Alex) >>>>> - rebase to 4.14.0-rc6. >>>>> >>>>> v15: >>>>> - add a ioctl to get a dmabuf for a given dmabuf id. (Gerd) >>>>> >>>>> v14: >>>>> - add PROBE, DMABUF and REGION flags. (Alex) >>>>> >>>>> v12: >>>>> - add drm_format_mod back. (Gerd and Zhenyu) >>>>> - add region_index. (Gerd) >>>>> >>>>> v11: >>>>> - rename plane_type to drm_plane_type. (Gerd) >>>>> - move fields of vfio_device_query_gfx_plane to vfio_device_gfx_plane_info. >>>>> (Gerd) >>>>> - remove drm_format_mod, start fields. (Daniel) >>>>> - remove plane_id. >>>>> >>>>> v10: >>>>> - refine the ABI API VFIO_DEVICE_QUERY_GFX_PLANE. (Alex) (Gerd) >>>>> >>>>> v3: >>>>> - add a field gvt_plane_info in the drm_i915_gem_obj structure to save >>>>> the decoded plane information to avoid look up while need the plane >>>>> info. (Gerd) >>>>> >>>>> Signed-off-by: Tina Zhang >>>>> Cc: Gerd Hoffmann >>>>> Cc: Alex Williamson >>>>> Cc: Daniel Vetter >>>>> --- >>>>> include/uapi/linux/vfio.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++ >>>>> 1 file changed, 62 insertions(+) >>>>> >>>>> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h >>>>> index ae46105..5c1cca2 100644 >>>>> --- a/include/uapi/linux/vfio.h >>>>> +++ b/include/uapi/linux/vfio.h >>>>> @@ -502,6 +502,68 @@ struct vfio_pci_hot_reset { >>>>> >>>>> #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) >>>>> >>>>> +/** >>>>> + * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14, >>>>> + * struct vfio_device_query_gfx_plane) >>>>> + * >>>>> + * Set the drm_plane_type and flags, then retrieve the gfx plane info. >>>>> + * >>>>> + * flags supported: >>>>> + * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set >>>>> + * to ask if the mdev supports dma-buf. 0 on support, -EINVAL on no >>>>> + * support for dma-buf. >>>>> + * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set >>>>> + * to ask if the mdev supports region. 0 on support, -EINVAL on no >>>>> + * support for region. >>>>> + * - VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set >>>>> + * with each call to query the plane info. >>>>> + * - Others are invalid and return -EINVAL. >>>>> + * >>>>> + * Note: >>>>> + * 1. Plane could be disabled by guest. In that case, success will be >>>>> + * returned with zero-initialized drm_format, size, width and height >>>>> + * fields. >>>>> + * 2. x_hot/y_hot is set to 0xFFFFFFFF if no hotspot information available >>>>> + * >>>>> + * Return: 0 on success, -errno on other failure. >>>>> + */ >>>>> +struct vfio_device_gfx_plane_info { >>>>> + __u32 argsz; >>>>> + __u32 flags; >>>>> +#define VFIO_GFX_PLANE_TYPE_PROBE (1 << 0) >>>>> +#define VFIO_GFX_PLANE_TYPE_DMABUF (1 << 1) >>>>> +#define VFIO_GFX_PLANE_TYPE_REGION (1 << 2) >>>>> + /* in */ >>>>> + __u32 drm_plane_type; /* type of plane: DRM_PLANE_TYPE_* */ >>>>> + /* out */ >>>>> + __u32 drm_format; /* drm format of plane */ >>>>> + __u64 drm_format_mod; /* tiled mode */ >>>>> + __u32 width; /* width of plane */ >>>>> + __u32 height; /* height of plane */ >>>>> + __u32 stride; /* stride of plane */ >>>>> + __u32 size; /* size of plane in bytes, align on page*/ >>>>> + __u32 x_pos; /* horizontal position of cursor plane */ >>>>> + __u32 y_pos; /* vertical position of cursor plane*/ >>>>> + __u32 x_hot; /* horizontal position of cursor hotspot */ >>>>> + __u32 y_hot; /* vertical position of cursor hotspot */ >>>>> + union { >>>>> + __u32 region_index; /* region index */ >>>>> + __u32 dmabuf_id; /* dma-buf id */ >>>>> + }; >>>>> +}; >>>>> + >>>>> +#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14) >>>>> + >>>>> +/** >>>>> + * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32) >>>>> + * >>>>> + * Return a new dma-buf file descriptor for an exposed guest framebuffer >>>>> + * described by the provided dmabuf_id. The dmabuf_id is returned from VFIO_ >>>>> + * DEVICE_QUERY_GFX_PLANE as a token of the exposed guest framebuffer. >>>>> + */ >>>>> + >>>>> +#define VFIO_DEVICE_GET_GFX_DMABUF _IO(VFIO_TYPE, VFIO_BASE + 15) >>>>> + >>>>> /* -------- API for Type1 VFIO IOMMU -------- */ >>>>> >>>>> /** >>>> >>>> Looks good to me. Kirti, have you had a chance yet to verify this is >>>> sufficient for your region-based approach? It would be great to get >>>> confirmation of that ASAP so we can get this in. Thanks, >>>> >>> >>> Alex, do you mind by merging this just through gvt tree? Or you would >>> like to merge this then send pull request for us then we can apply left? >> >> I'm fine with this going through the gvt tree, but I want some >> confirmation from nvidia that this meets their needs as well before I >> provide an ack. Thanks, >> >> Alex From 1584466270141856176@xxx Sun Nov 19 04:13:07 +0000 2017 X-GM-THRID: 1584123250500840008 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread