public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] drm/virtio: Set missing bo->attached flag
@ 2024-11-29 15:53 Dmitry Osipenko
  2024-12-02 17:29 ` Kasireddy, Vivek
  2025-01-09 14:04 ` Dmitry Osipenko
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2024-11-29 15:53 UTC (permalink / raw)
  To: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
	Kim Dongwon, Kasireddy Vivek
  Cc: Rob Clark, dri-devel, virtualization, linux-kernel, kernel

VirtIO-GPU driver now supports detachment of shmem BOs from host, but
doing it only for imported dma-bufs. Mark all shmem BOs as attached, not
just dma-bufs. This is a minor correction since detachment of a non-dmabuf
BOs not supported today.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 drivers/gpu/drm/virtio/virtgpu_prime.c | 1 -
 drivers/gpu/drm/virtio/virtgpu_vq.c    | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_prime.c b/drivers/gpu/drm/virtio/virtgpu_prime.c
index 688810d1b611..33084ce1d01d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_prime.c
+++ b/drivers/gpu/drm/virtio/virtgpu_prime.c
@@ -249,7 +249,6 @@ static int virtgpu_dma_buf_init_obj(struct drm_device *dev,
 	virtio_gpu_cmd_resource_create_blob(vgdev, bo, &params,
 					    ents, nents);
 	bo->guest_blob = true;
-	bo->attached = true;
 
 	dma_buf_unpin(attach);
 	dma_resv_unlock(resv);
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index ad91624df42d..062639250a4e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -1300,6 +1300,9 @@ virtio_gpu_cmd_resource_create_blob(struct virtio_gpu_device *vgdev,
 
 	virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
 	bo->created = true;
+
+	if (nents)
+		bo->attached = true;
 }
 
 void virtio_gpu_cmd_set_scanout_blob(struct virtio_gpu_device *vgdev,
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v1] drm/virtio: Set missing bo->attached flag
  2024-11-29 15:53 [PATCH v1] drm/virtio: Set missing bo->attached flag Dmitry Osipenko
@ 2024-12-02 17:29 ` Kasireddy, Vivek
  2025-01-09 14:04 ` Dmitry Osipenko
  1 sibling, 0 replies; 3+ messages in thread
From: Kasireddy, Vivek @ 2024-12-02 17:29 UTC (permalink / raw)
  To: Dmitry Osipenko, David Airlie, Gerd Hoffmann, Gurchetan Singh,
	Chia-I Wu, Kim, Dongwon
  Cc: Rob Clark, dri-devel@lists.freedesktop.org,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	kernel@collabora.com

> Subject: [PATCH v1] drm/virtio: Set missing bo->attached flag
> 
> VirtIO-GPU driver now supports detachment of shmem BOs from host, but
> doing it only for imported dma-bufs. Mark all shmem BOs as attached, not
> just dma-bufs. This is a minor correction since detachment of a non-dmabuf
> BOs not supported today.
> 
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
>  drivers/gpu/drm/virtio/virtgpu_prime.c | 1 -
>  drivers/gpu/drm/virtio/virtgpu_vq.c    | 3 +++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_prime.c
> b/drivers/gpu/drm/virtio/virtgpu_prime.c
> index 688810d1b611..33084ce1d01d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_prime.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_prime.c
> @@ -249,7 +249,6 @@ static int virtgpu_dma_buf_init_obj(struct
> drm_device *dev,
>  	virtio_gpu_cmd_resource_create_blob(vgdev, bo, &params,
>  					    ents, nents);
>  	bo->guest_blob = true;
> -	bo->attached = true;
> 
>  	dma_buf_unpin(attach);
>  	dma_resv_unlock(resv);
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c
> b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index ad91624df42d..062639250a4e 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -1300,6 +1300,9 @@ virtio_gpu_cmd_resource_create_blob(struct
> virtio_gpu_device *vgdev,
> 
>  	virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
>  	bo->created = true;
> +
> +	if (nents)
> +		bo->attached = true;
Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com>

>  }
> 
>  void virtio_gpu_cmd_set_scanout_blob(struct virtio_gpu_device *vgdev,
> --
> 2.47.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] drm/virtio: Set missing bo->attached flag
  2024-11-29 15:53 [PATCH v1] drm/virtio: Set missing bo->attached flag Dmitry Osipenko
  2024-12-02 17:29 ` Kasireddy, Vivek
@ 2025-01-09 14:04 ` Dmitry Osipenko
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2025-01-09 14:04 UTC (permalink / raw)
  To: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
	Kim Dongwon, Kasireddy Vivek
  Cc: Rob Clark, dri-devel, virtualization, linux-kernel, kernel

On 11/29/24 18:53, Dmitry Osipenko wrote:
> VirtIO-GPU driver now supports detachment of shmem BOs from host, but
> doing it only for imported dma-bufs. Mark all shmem BOs as attached, not
> just dma-bufs. This is a minor correction since detachment of a non-dmabuf
> BOs not supported today.
> 
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
>  drivers/gpu/drm/virtio/virtgpu_prime.c | 1 -
>  drivers/gpu/drm/virtio/virtgpu_vq.c    | 3 +++
>  2 files changed, 3 insertions(+), 1 deletion(-)

Applied to misc-next

-- 
Best regards,
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-09 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 15:53 [PATCH v1] drm/virtio: Set missing bo->attached flag Dmitry Osipenko
2024-12-02 17:29 ` Kasireddy, Vivek
2025-01-09 14:04 ` Dmitry Osipenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox