[PATCH] scsi: virtio_scsi: Use struct_size() helper

2019-06-19 Thread Gustavo A. R. Silva
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct virtio_scsi { ... struct virtio_scsi_vq req_vqs[]; }; Make use

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

2019-06-19 Thread Daniel Vetter
On Wed, Jun 19, 2019 at 11:04:16AM +0200, 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.

Re: [PATCH v3 06/12] drm/virtio: drop no_wait argument from virtio_gpu_object_reserve

2019-06-19 Thread Daniel Vetter
On Wed, Jun 19, 2019 at 11:04:14AM +0200, Gerd Hoffmann wrote: > All callers pass no_wait = false. > > Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 5 ++--- > drivers/gpu/drm/virtio/virtgpu_gem.c | 4 ++-- >

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

2019-06-19 Thread Emil Velikov
Hi Gerd, On 2019/06/19, Gerd Hoffmann wrote: > -static void virtio_gpu_init_ttm_placement(struct virtio_gpu_object *vgbo) > +static const struct drm_gem_object_funcs v3d_gem_funcs = { s/v3d/virtio/g Doubt I'll have the time for a proper review - just this and the 1/12 nits :-\ HTH Emil

Re: [PATCH 1/1] scsi: virtio_scsi: remove unused 'affinity_hint_set'

2019-06-19 Thread Paolo Bonzini
On 19/06/19 09:52, Dongli Zhang wrote: > The 'affinity_hint_set' is not used any longer since > commit 0d9f0a52c8b9 ("virtio_scsi: use virtio IRQ affinity"). > > Signed-off-by: Dongli Zhang > --- > drivers/scsi/virtio_scsi.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git

Re: [PATCH v3 07/12] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve,unreserve}

2019-06-19 Thread Daniel Vetter
On Wed, Jun 19, 2019 at 11:04:15AM +0200, Gerd Hoffmann wrote: > Call reservation_object_* directly instead > of using ttm_bo_{reserve,unreserve}. > > v3: check for EINTR too. > > Signed-off-by: Gerd Hoffmann > Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 6 +++---

[PATCH v3 02/12] drm/virtio: pass gem reservation object to ttm init

2019-06-19 Thread Gerd Hoffmann
With this gem and ttm will use the same reservation object, so mixing and matching ttm / gem reservation helpers should work fine. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter --- drivers/gpu/drm/virtio/virtgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v3 12/12] drm/virtio: remove virtio_gpu_alloc_object

2019-06-19 Thread Gerd Hoffmann
Thin wrapper around virtio_gpu_object_create(), but calling that directly works equally well. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 4 drivers/gpu/drm/virtio/virtgpu_gem.c | 23 --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6

[PATCH v3 04/12] drm/virtio: simplify cursor updates

2019-06-19 Thread Gerd Hoffmann
No need to do the reservation dance, we can just wait on the fence directly. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter --- drivers/gpu/drm/virtio/virtgpu_plane.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git

[PATCH v3 06/12] drm/virtio: drop no_wait argument from virtio_gpu_object_reserve

2019-06-19 Thread Gerd Hoffmann
All callers pass no_wait = false. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 5 ++--- drivers/gpu/drm/virtio/virtgpu_gem.c | 4 ++-- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git

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

2019-06-19 Thread Gerd Hoffmann
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 otherwise the helpers handle everything just fine. Once the

[PATCH v3 07/12] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-06-19 Thread Gerd Hoffmann
Call reservation_object_* directly instead of using ttm_bo_{reserve,unreserve}. v3: check for EINTR too. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

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

2019-06-19 Thread Gerd Hoffmann
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 logic which checks whenever the command is in flight still. We can

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

2019-06-19 Thread Gerd Hoffmann
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 because ttm fence helpers grab a reference for us, but gem helpers

[PATCH v3 03/12] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-06-19 Thread Gerd Hoffmann
Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). This also makes the ioctl run lockless. v2: use reservation_object_test_signaled_rcu for VIRTGPU_WAIT_NOWAIT. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 24

[PATCH v3 10/12] drm/virtio: drop virtio_gpu_object_list_validate/virtio_gpu_unref_list

2019-06-19 Thread Gerd Hoffmann
No users left. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 3 -- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 39 -- 2 files changed, 42 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH v3 05/12] drm/virtio: remove virtio_gpu_object_wait

2019-06-19 Thread Gerd Hoffmann
No users left. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter --- drivers/gpu/drm/virtio/virtgpu_drv.h| 1 - drivers/gpu/drm/virtio/virtgpu_object.c | 13 - 2 files changed, 14 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH 1/1] scsi: virtio_scsi: remove unused 'affinity_hint_set'

2019-06-19 Thread Dongli Zhang
The 'affinity_hint_set' is not used any longer since commit 0d9f0a52c8b9 ("virtio_scsi: use virtio IRQ affinity"). Signed-off-by: Dongli Zhang --- drivers/scsi/virtio_scsi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index