Re: [PATCH] drm/virtio: Fix GEM handle creation UAF

2022-12-16 Thread Chia-I Wu
t reason, dropping > the handle's reference must be done *after* we are done dereferencing > the object. > > Signed-off-by: Rob Clark Reviewed-by: Chia-I Wu ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lis

Re: [PATCH v2] virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create()

2022-09-19 Thread Chia-I Wu
hould '(1 << ring_idx)' be a 64 bit type? > > Fixes: cd7f5ca33585 ("drm/virtio: implement context init: add > virtio_gpu_fence_event") > Signed-off-by: Dan Carpenter > --- > v2: Style change. Use BIT_ULL(). Reviewed-by: Chia-I Wu > > drivers/gpu/drm/virtio/virtgpu

Re: [PATCH] virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create()

2022-09-15 Thread Chia-I Wu
On Thu, Sep 15, 2022 at 4:14 AM Dan Carpenter wrote: > > The ->ring_idx_mask variable is a u64 so static checkers, Smatch in > this case, complain if the BIT() is not also a u64. > > drivers/gpu/drm/virtio/virtgpu_ioctl.c:50 virtio_gpu_fence_event_create() > warn: should '(1 << ring_idx)' be a 64

[PATCH] drm/virtio: set fb_modifiers_not_supported

2022-08-31 Thread Chia-I Wu
_supported flag in mode_config") Suggested-by: Shao-Chuan Lee Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 5c7f198c0712..9ea7611a9e0f

Re: [PATCH v2] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init

2022-06-11 Thread Chia-I Wu
("drm/virtio: move virtio_gpu_mem_entry initialization to > new function") > Signed-off-by: Miaoqian Lin > --- > changes in v2: > - Update Fixes tag. > - rebase the working tree. > v1 Link: > https://lore.kernel.org/all/2021122207264

Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event

2022-04-05 Thread Chia-I Wu
-by: Rob Clark Reviewed-by: Chia-I Wu Might want to wait for Gurchetan to chime in as he added the mechanism. > --- > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +--- > include/uapi/drm/virtgpu_drm.h | 2 ++ > 2 files changed, 7 insertions(+), 3 deletions(-) >

Re: [PATCH] virtio-gpu: fix a missing check to avoid NULL dereference

2022-03-28 Thread Chia-I Wu
("virtio-gpu: add 3d/virgl support") > Signed-off-by: Xiaomeng Tong Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > b/drivers

Re: [PATCH] drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes

2022-03-24 Thread Chia-I Wu
On Wed, Mar 23, 2022 at 4:01 AM Liu Zixian wrote: > diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c > b/drivers/gpu/drm/virtio/virtgpu_display.c > index 5b00310ac..f73352e7b 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_display.c > +++ b/drivers/gpu/drm/virtio/virtgpu_display.c > @@ -179,6

Re: [PATCH] drm/virtio: Add USE_INTERNAL blob flag

2022-02-22 Thread Chia-I Wu
On Fri, Feb 18, 2022 at 9:51 AM Rob Clark wrote: > > On Fri, Feb 18, 2022 at 8:42 AM Chia-I Wu wrote: > > > > On Fri, Feb 18, 2022 at 7:57 AM Rob Clark wrote: > > > > > > From: Rob Clark > > > > > > With native userspace drivers in guest

Re: [PATCH] drm/virtio: Remove restriction of non-zero blob_flags

2022-02-22 Thread Chia-I Wu
st VMM. > > Signed-off-by: Rob Clark Reviewed-by: Chia-I Wu ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH] drm/virtio: Add USE_INTERNAL blob flag

2022-02-18 Thread Chia-I Wu
On Fri, Feb 18, 2022 at 7:57 AM Rob Clark wrote: > > From: Rob Clark > > With native userspace drivers in guest, a lot of GEM objects need to be > neither shared nor mappable. And in fact making everything mappable > and/or sharable results in unreasonably high fd usage in host VMM. > >

Re: [PATCH v2 0/2] drm/gem-shmem: Various improvements

2022-02-10 Thread Chia-I Wu
c | 1 + > include/drm/drm_gem_shmem_helper.h | 2 ++ > 6 files changed, 10 insertions(+), 3 deletions(-) Reviewed-by: Chia-I Wu > > -- > 2.34.1 > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH v2] drm/virtio: Fix an NULL vs IS_ERR() bug in virtio_gpu_object_shmem_init()

2021-11-23 Thread Chia-I Wu
gt; --- > v2: I originally sent this patch on 19 Jun 2020 but it was somehow > not applied. As I review it now, I see that the bug is actually > older than I originally thought and so I have updated the Fixes > tag. Reviewed-by: Chia-I Wu

Re: [PATCH] drm/virtio: delay pinning the pages till first use

2021-11-02 Thread Chia-I Wu
On Tue, Nov 2, 2021 at 6:07 AM Gerd Hoffmann wrote: > > On Tue, Nov 02, 2021 at 12:31:39PM +0100, Maksym Wezdecki wrote: > > From: mwezdeck > > > > The idea behind the commit: > > 1. not pin the pages during resource_create ioctl > > 2. pin the pages on the first use during: > > -

Re: drm/virtio: not pin pages on demand

2021-10-28 Thread Chia-I Wu
col while maintaining backward compatibility. > > > What do you think about that? > > I still think that switching to blob resources would be the better > solution. Yes, it's alot of work and not something which helps > short-term. But adding a new API as interim solution isn't grea

Re: drm/virtio: not pin pages on demand

2021-10-21 Thread Chia-I Wu
On Thu, Oct 21, 2021 at 4:52 AM Gerd Hoffmann wrote: > > On Thu, Oct 21, 2021 at 11:55:47AM +0200, Maksym Wezdecki wrote: > > I get your point. However, we need to make resource_create ioctl, > > in order to create corresponding resource on the host. > > That used to be the case but isn't true

Re: [PATCH v3 3/4] drm/virtio: batch resource creation

2020-02-13 Thread Chia-I Wu
On Thu, Feb 13, 2020 at 5:22 AM Gerd Hoffmann wrote: > > Move virtio_gpu_notify() to higher-level functions for > virtio_gpu_cmd_create_resource(), virtio_gpu_cmd_resource_create_3d() > and virtio_gpu_cmd_resource_attach_backing(). > > virtio_gpu_object_create() will batch commands and notify

Re: [PATCH v2] drm/virtio: rework batching

2020-02-12 Thread Chia-I Wu
On Wed, Feb 12, 2020 at 3:13 AM Gerd Hoffmann wrote: > > Drop the virtio_gpu_{disable,enable}_notify(). Add a new > virtio_gpu_notify() call instead, which must be called whenever > the driver wants make sure the host is notified needed. > > Drop notification from command submission. Add

Re: [PATCH v2 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-07 Thread Chia-I Wu
gt; + return ret; > + } > + > + ret = virtio_gpu_object_attach(vgdev, bo, ents, nents); > if (ret != 0) { > virtio_gpu_free_object(_obj->base); > return ret; > diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c

Re: [PATCH v2] drm/virtio: fix ring free check

2020-02-06 Thread Chia-I Wu
bool has_virgl_3d; > bool has_edid; > + bool has_indirect; has_indirect_desc? Either way, Reviewed-by: Chia-I Wu > > struct work_struct config_changed_work; > > diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c > b/drivers/gpu/drm/virtio/virtgp

Re: [PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-06 Thread Chia-I Wu
On Thu, Feb 6, 2020 at 12:55 AM Gerd Hoffmann wrote: > > Hi, > > > > virtio_gpu_cmd_resource_attach_backing(vgdev, obj->hw_res_handle, > > > - ents, nents, > > > + obj->ents, obj->nents, > > >

Re: [PATCH 2/4] drm/virtio: resource teardown tweaks

2020-02-06 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 10:43 PM Gerd Hoffmann wrote: > > > > - > > > - drm_gem_shmem_free_object(obj); > > > + if (bo->created) { > > > + virtio_gpu_cmd_unref_resource(vgdev, bo); > > > + /* completion handler calls virtio_gpu_cleanup_object() */ > >

Re: [PATCH] drm/virtio: fix ring free check

2020-02-06 Thread Chia-I Wu
num_free < elemcnt) { > + indirect = virtio_has_feature(vgdev->vdev, > VIRTIO_RING_F_INDIRECT_DESC); > + vqcnt = indirect ? 1 : elemcnt; Is the feature dynamic and require the lock held? If not, the result can be cached and the fixup can happen before grabbing the lo

Re: [PATCH] drm/virtio: ratelimit error logging

2020-02-05 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 2:26 AM Gerd Hoffmann wrote: > > Avoid flooding the log in case we screw up badly. > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_vq.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >

Re: [PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-05 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 3:00 AM Gerd Hoffmann wrote: > > Introduce new virtio_gpu_object_shmem_init() helper function which will > create the virtio_gpu_mem_entry array, containing the backing storage > information for the host. For the most path this just moves code from >

Re: [PATCH 2/4] drm/virtio: resource teardown tweaks

2020-02-05 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 3:00 AM Gerd Hoffmann wrote: > > Add new virtio_gpu_cleanup_object() helper function for object cleanup. > Wire up callback function for resource unref, do cleanup from callback > when we know the host stopped using the resource. > > Signed-off-by: Gerd Hoffmann > --- >

Re: [PATCH] drm/virtio: add missing virtio_gpu_array_lock_resv call

2020-01-10 Thread Chia-I Wu
fence. > > Thanks a lot! With this patch applied, my VM doesn't throw lockdep > warnings anymore. If you want, you can add: > > Tested-by: Jann Horn > > > Reported-by: Jann Horn > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > > --- > > drivers/gpu

Re: [PATCH 3/3] virtio-gpu: use damage info for display updates.

2019-12-11 Thread Chia-I Wu
On Wed, Dec 11, 2019 at 12:42 AM Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 41 +++--- > 1 file changed, 24 insertions(+), 17 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c >

Re: [PATCH 1/3] drm/virtio: skip set_scanout if framebuffer didn't change

2019-12-11 Thread Chia-I Wu
On Wed, Dec 11, 2019 at 12:42 AM Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 31 ++ > 1 file changed, 17 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c >

Re: [PATCH] drm/virtio: enable prime mmap support

2019-09-12 Thread Chia-I Wu
On Thu, Sep 12, 2019 at 4:46 AM Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c > b/drivers/gpu/

Re: [PATCH] drm/virtio: Fix warning in virtio_gpu_queue_fenced_ctrl_buffer.

2019-09-12 Thread Chia-I Wu
On Thu, Sep 12, 2019 at 9:00 AM David Riley wrote: > > Fix warning introduced with commit e1218b8c0cc1 > ("drm/virtio: Use vmalloc for command buffer allocations.") > from drm-misc-next. > > Signed-off-by: David Riley Reviewed-by: Chia-I Wu > --- > drive

Re: [PATCH] drm/virtio: fix command submission with objects but without fence.

2019-09-05 Thread Chia-I Wu
On Wed, Sep 4, 2019 at 10:23 PM Gerd Hoffmann wrote: > > On Wed, Sep 04, 2019 at 04:10:30PM -0700, Chia-I Wu wrote: > > On Wed, Sep 4, 2019 at 12:48 AM Gerd Hoffmann wrote: > > > > > > Only call virtio_gpu_array_add_fence if we actually have a fence. > > >

Re: [PATCH] drm/virtio: fix command submission with objects but without fence.

2019-09-04 Thread Chia-I Wu
On Wed, Sep 4, 2019 at 12:48 AM Gerd Hoffmann wrote: > > Only call virtio_gpu_array_add_fence if we actually have a fence. > > Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing") > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_vq.c | 9 +

Re: [PATCH] drm/virtio: add worker for object release

2019-09-03 Thread Chia-I Wu
worker is also the one which will free up slots in the command > queue. > > Reported-by: Chia-I Wu > Signed-off-by: Gerd Hoffmann Tested-by: Chia-I Wu Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 8 > drive

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Chia-I Wu
On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > Hi, > > > > > - kfree(vbuf->data_buf); > > > > + kvfree(vbuf->data_buf); > > > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > > > needed here I gues? > > > > > > > kvfree() handles vmalloc/kmalloc/kvmalloc internally by

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Chia-I Wu
On Thu, Aug 29, 2019 at 2:24 PM David Riley wrote: > > Userspace requested command buffer allocations could be too large > to make as a contiguous allocation. Use vmalloc if necessary to > satisfy those allocations. > > Signed-off-by: David Riley > --- > drivers/gpu/drm/virtio/virtgpu_ioctl.c

Re: [PATCH v8 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-08-28 Thread Chia-I Wu
per. > v5: some small optimizations (Chia-I Wu). > v4: make them virtio-private instead of generic helpers. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 17 + > drivers/gpu/drm/virtio/virtgpu_gem.c | 93 > 2 fi

Re: [PATCH v8 02/18] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-08-28 Thread Chia-I Wu
On Fri, Aug 23, 2019 at 2:55 AM Gerd Hoffmann wrote: > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > This also makes the ioctl run lockless. > > v5: handle lookup failure. > v2: use reservation_object_test_signaled_rcu for VIRTGPU_WAIT_NOWAIT. > > Signed-off-by: Gerd

Re: [PATCH 2/2] drm/virtio: notify virtqueues without holding spinlock

2019-08-27 Thread Chia-I Wu
k. This avoids triggering a vmexit while holding the lock and > thereby fixes a rather bad spinlock contention. > > Suggested-by: Chia-I Wu > Signed-off-by: Gerd Hoffmann Series is Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_vq.c | 25 +++--

Re: [PATCH v2] drm/virtio: add plane check

2019-08-27 Thread Chia-I Wu
On Mon, Aug 26, 2019 at 10:21 PM Gerd Hoffmann wrote: > > On Mon, Aug 26, 2019 at 03:34:56PM -0700, Chia-I Wu wrote: > > On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann wrote: > > > > > > Use drm_atomic_helper_check_plane_state() > > > to sanity check

Re: [PATCH v2] drm/virtio: add plane check

2019-08-26 Thread Chia-I Wu
On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann wrote: > > Use drm_atomic_helper_check_plane_state() > to sanity check the plane state. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 17 - > 1 file changed, 16 insertions(+), 1 deletion(-) > >

Re: [PATCH v2] drm/virtio: make resource id workaround runtime switchable.

2019-08-26 Thread Chia-I Wu
On Thu, Aug 22, 2019 at 3:26 AM Gerd Hoffmann wrote: > > Also update the comment with a reference to the virglrenderer fix. > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_object.c | 44 ++--- > 1 file c

Re: [PATCH v6 11/18] drm/virtio: switch from ttm to gem shmem helpers

2019-07-17 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > virtio-gpu basically needs a sg_table for the bo, to tell the host where > the backing pages for the object are. So the gem shmem helpers are a > perfect fit. Some drm_gem_object_funcs need thin wrappers to update the > host state, but

[PATCH] drm/virtio: kick vq outside of the vq lock

2019-07-10 Thread Chia-I Wu
virtio_gpu_dequeue_ctrl_func. If virtqueue_notify was called with the vq lock held, the worker thread would have to busy wait inside virtio_gpu_dequeue_ctrl_func. v2: fix scrambled commit message Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 19 +-- 1 file changed, 13

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-10 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 11:46 AM Chia-I Wu wrote: > > On Thu, Jul 4, 2019 at 4:25 AM Gerd Hoffmann wrote: > > > > Hi, > > > > > > if (fence) > > > > virtio_gpu_fence_emit(vg

[PATCH] drm/virtio: kick vq outside of the vq lock

2019-07-10 Thread Chia-I Wu
virtio_gpu_dequeue_ctrl_func. If virtqueue_notify was called with the vq lock held, the worker thread would busy wait inside virtio_gpu_dequeue_ctrl_func. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-07-06 Thread Chia-I Wu
On Fri, Jul 5, 2019 at 1:53 AM Gerd Hoffmann wrote: > > On Thu, Jul 04, 2019 at 12:17:48PM -0700, Chia-I Wu wrote: > > On Thu, Jul 4, 2019 at 4:10 AM Gerd Hoffmann wrote: > > > > > > Hi, > > > > > > > > - r = ttm_bo

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:10 AM Gerd Hoffmann wrote: > > Hi, > > > > - r = ttm_bo_reserve(>tbo, true, false, NULL); > > > + r = reservation_object_lock_interruptible(bo->gem_base.resv, > > > NULL); > > Can you elaborate a bit about how TTM keeps the BOs alive in, for > > example,

Re: [PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:51 AM Gerd Hoffmann wrote: > > Hi, > > > > convert_to_hw_box(, >box); > > > if (!vgdev->has_virgl_3d) { > > > virtio_gpu_cmd_transfer_to_host_2d > > > - (vgdev, qobj, offset, > > > + (vgdev,

Re: [PATCH v6 14/18] drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:48 AM Gerd Hoffmann wrote: > > On Wed, Jul 03, 2019 at 01:05:12PM -0700, Chia-I Wu wrote: > > On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > > > > > Switch to the virtio_gpu_array_* helper workflow. > > (just repeating

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:25 AM Gerd Hoffmann wrote: > > Hi, > > > > if (fence) > > > virtio_gpu_fence_emit(vgdev, hdr, fence); > > > + if (vbuf->objs) { > > > + virtio_gpu_array_add_fence(vbuf->objs, >f); > > > +

Re: [PATCH v6 14/18] drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Switch to the virtio_gpu_array_* helper workflow. (just repeating my question on patch 6) Does this fix the obj refcount issue? When was the issue introduced? > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h

Re: [PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Switch to the virtio_gpu_array_* helper workflow. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 43 -- >

Re: [PATCH v6 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-07-03 Thread Chia-I Wu
On Wed, Jul 3, 2019 at 11:31 AM Chia-I Wu wrote: > > On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > > > Some helper functions to manage an array of gem objects. > > > > v6: > > - add ticket to struct virtio_gpu_object_array. > > - add v

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Rework fencing workflow, starting with virtio_gpu_execbuffer_ioctl. > Stop using ttm helpers, use the virtio_gpu_array_* helpers (which work > on the reservation objects directly) instead. > > New workflow: > > (1) All gem objects needed by

Re: [PATCH v6 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-07-03 Thread Chia-I Wu
per. > v5: some small optimizations (Chia-I Wu). > v4: make them virtio-private instead of generic helpers. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 17 ++ > drivers/gpu/drm/virtio/virtgpu_gem.c | 83 > 2 fi

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Call reservation_object_* directly instead > of using ttm_bo_{reserve,unreserve}. > > v4: check for EINTR only. > v3: check for EINTR too. > > Signed-off-by: Gerd Hoffmann > Reviewed-by: Daniel Vetter > --- >

Re: [PATCH v4 02/12] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 3:05 AM Gerd Hoffmann wrote: > > On Wed, Jun 26, 2019 at 04:55:20PM -0700, Chia-I Wu wrote: > > On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > > > > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > > >

Re: [PATCH v4 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 3:34 AM Gerd Hoffmann wrote: > > Hi, > > > > --- a/drivers/gpu/drm/virtio/virtgpu_drv.h > > > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h > > > @@ -120,9 +120,9 @@ struct virtio_gpu_vbuffer { > > > > > > char *resp_buf; > > > int resp_size; > > > - > > >

Re: [PATCH v4 11/12] drm/virtio: switch from ttm to gem shmem helpers

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 3:49 AM Gerd Hoffmann wrote: > > > > static inline struct virtio_gpu_object* > > > virtio_gpu_object_ref(struct virtio_gpu_object *bo) > > > The last users of these two helpers are removed with this patch. We > > can remove them. > > patch 12/12 does that. I meant

Re: [PATCH v5 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-30 Thread Chia-I Wu
(pressed Send too early) On Sun, Jun 30, 2019 at 11:20 AM Chia-I Wu wrote: > > On Fri, Jun 28, 2019 at 5:13 AM Gerd Hoffmann wrote: > > > > Use gem reservation helpers and direct reservation_object_* calls > > instead of ttm. > > > > v5: fix fencing (Chia-

Re: [PATCH v5 09/12] drm/virtio: rework virtio_gpu_object_create fencing

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 5:13 AM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v5: fix fencing (Chia-I Wu). > v3: Due to using the gem reservation object it is initialized and ready > for use before calling t

Re: [PATCH v5 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 5:13 AM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v5: fix fencing (Chia-I Wu). > v3: Also attach the array of gem objects to the virtio command buffer, > so we can drop

Re: [PATCH v3 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-26 Thread Chia-I Wu
I tried my best to review this series. I am not really a kernel dev so please take that with a grain of salt. On Wed, Jun 19, 2019 at 11:01 PM Gerd Hoffmann wrote: > > Hi, > > > Also, I strongly recommend you do a very basic igt to exercise this, i.e. > > allocate some buffers, submit them in

Re: [PATCH v4 11/12] drm/virtio: switch from ttm to gem shmem helpers

2019-06-26 Thread Chia-I Wu
. On Wed, Jun 19, 2019 at 11:08 PM Gerd Hoffmann wrote: > > virtio-gpu basically needs a sg_table for the bo, to tell the host where > the backing pages for the object are. So the gem shmem helpers are a > perfect fit. Some drm_gem_object_funcs need thin wrappers to update the > host state,

Re: [PATCH v4 09/12] drm/virtio: rework virtio_gpu_object_create fencing

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v3: Due to using the gem reservation object it is initialized and ready > for use before calling ttm_bo_init, so we can also drop the tricky fence >

Re: [PATCH v4 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:08 PM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v3: Also attach the array of gem objects to the virtio command buffer, > so we can drop the object references in the completion callback. Needed >

Re: [PATCH v4 07/12] drm/virtio: add virtio_gpu_object_array & helpers

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:08 PM Gerd Hoffmann wrote: > > Some helper functions to manage an array of gem objects. > > v4: make them virtio-private instead of generic helpers. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 10 ++ >

Re: [PATCH v4 02/12] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > This also makes the ioctl run lockless. The userspace has a BO cache to avoid freeing BOs immediately but to reuse them on next allocations. The BO cache checks if a BO

Re: [PATCH] drm/virtio: Remove redundant return type

2019-05-03 Thread Chia-I Wu
Suggested-by: Emil Velikov Reviewed-by: Chia-I Wu > --- > > This patch was suggested in this email thread: > > [PATCH] drm/virtio: allocate fences with GFP_KERNEL > https://www.spinics.net/lists/dri-devel/msg208536.html > > drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- > dri

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-19 Thread Chia-I Wu
On Wed, Apr 17, 2019 at 2:57 AM Gerd Hoffmann wrote: > > On Fri, Apr 12, 2019 at 04:34:20PM -0700, Chia-I Wu wrote: > > Hi, > > > > I am still new to virgl, and missed the last round of discussion about > > resource_create_v2. > > > > From the discuss

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-19 Thread Chia-I Wu
Hi, I am still new to virgl, and missed the last round of discussion about resource_create_v2. >From the discussion below, semantically resource_create_v2 creates a host resource object _without_ any storage; memory_create creates a host memory object which provides the storage. Is that