Re: [PATCH] drm/virtio: Fix NULL pointer deref in virtgpu_dma_buf_free_obj()

2025-05-07 Thread Dmitry Osipenko
is >>> freed as we took a reference on it in virtgpu_gem_prime_import(). >>> >>> Fixes: 415cb45895f4 ("drm/virtio: Use dma_buf from GEM object >>> instance") >>> Cc: Dmitry Osipenko >>> Cc: Thomas Zimmermann >>> Signed-off

Re: [RFC PATCH 0/2] Virtio-GPU suspend and resume

2025-05-05 Thread Dmitry Osipenko
On 5/5/25 22:38, Kim, Dongwon wrote: >> I tried to apply your kernel patches and then suspend/resume guest kernel, it >> doesn't work: >> >> virtio_gpu_transfer_to_host_2d: no backing storage 2 >> [ 22.909454] [drm:virtio_gpu_dequeue_ctrl_func] ERROR response >> 0x1200 (command 0x105) >> virtio_g

Re: [RFC PATCH 0/2] Virtio-GPU suspend and resume

2025-05-05 Thread Dmitry Osipenko
On 4/19/25 02:29, dongwon@intel.com wrote: > From: Dongwon Kim > > This patch series introduces a freeze and restore mechanism for > the virtio-gpu driver: > > First patch adds `virtgpu_freeze` and `virtgpu_restore` functions. > These functions handle the deletion of virtio queues before sus

Re: [PATCH 3/3] virtgpu: deallocate capsets on device deinit

2025-05-05 Thread Dmitry Osipenko
On 5/5/25 18:58, Dmitry Osipenko wrote: > On 5/5/25 11:59, Manos Pitsidianakis wrote: >> diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c >> b/drivers/gpu/drm/virtio/virtgpu_kms.c >> index >> 7b3c4d314f8eee692e2842a7056d6dc64936fc2f..a8b751179332b9ec2fbba1392a6ee0e63

Re: [PATCH] drm/virtio: Fix NULL pointer deref in virtgpu_dma_buf_free_obj()

2025-05-05 Thread Dmitry Osipenko
be valid until the object is > freed as we took a reference on it in virtgpu_gem_prime_import(). > > Fixes: 415cb45895f4 ("drm/virtio: Use dma_buf from GEM object instance") > Cc: Dmitry Osipenko > Cc: Thomas Zimmermann > Signed-off-by: Vivek Kasireddy > --- >

Re: [RFC PATCH 0/2] Virtio-GPU suspend and resume

2025-05-05 Thread Dmitry Osipenko
On 4/19/25 02:29, dongwon@intel.com wrote: > From: Dongwon Kim > > This patch series introduces a freeze and restore mechanism for > the virtio-gpu driver: > > First patch adds `virtgpu_freeze` and `virtgpu_restore` functions. > These functions handle the deletion of virtio queues before sus

Re: [PATCH 3/3] virtgpu: deallocate capsets on device deinit

2025-05-05 Thread Dmitry Osipenko
On 5/5/25 11:59, Manos Pitsidianakis wrote: > diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c > b/drivers/gpu/drm/virtio/virtgpu_kms.c > index > 7b3c4d314f8eee692e2842a7056d6dc64936fc2f..a8b751179332b9ec2fbba1392a6ee0e638a5192e > 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_kms.c > +++ b/driv

Re: [PATCH] drm/virtio: Support drm_panic with non-vmapped shmem BO

2025-04-16 Thread Dmitry Osipenko
On 4/12/25 16:20, Ryosuke Yasuoka wrote: > Pass array of pages of the scanout buffer [1] to shmem BO, allowing > drm_panic to work even if the BO is not vmapped. > > [1] https://lore.kernel.org/all/20250407140138.162383-3-jfale...@redhat.com/ > > Signed-off-by: Jocelyn Falempe > Signed-off-by: R

Re: [PATCH 0/2] drm/virtio: Avoid struct drm_gem_object.import_attach

2025-04-16 Thread Dmitry Osipenko
On 4/14/25 16:11, Thomas Zimmermann wrote: > Avoid the use of struct drm_gem_object.import_attach to get the > object's dma-buf or test for an imported buffer. The import_attach > field in struct drm_gem_object is an artifact of the import process, > but should not be used otherwise. > > The helpe

Re: [PATCH] drm/virtio: Support drm_panic with non-vmapped shmem BO

2025-04-16 Thread Dmitry Osipenko
On 4/16/25 10:05, Thomas Zimmermann wrote: > Hi > > Am 12.04.25 um 15:20 schrieb Ryosuke Yasuoka: >> Pass array of pages of the scanout buffer [1] to shmem BO, allowing >> drm_panic to work even if the BO is not vmapped. >> >> [1] https://lore.kernel.org/all/20250407140138.162383-3- >> jfale...@re

Re: [PATCH] drm/virtio: Support drm_panic with non-vmapped shmem BO

2025-04-16 Thread Dmitry Osipenko
> + return -ENODEV; > + /* map scanout buffer later */ > + sb->pages = shmem->pages; > + } > > sb->format = plane->state->fb->format; > sb->height = plane->state->fb->height; > > base-commit: e7bb7d44c3b97aea1f0e354c6499900154ac67f2 Works well! Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 17/19] drm/virtio: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-15 Thread Dmitry Osipenko
On 4/10/25 19:32, Ville Syrjala wrote: > From: Ville Syrjälä > > Plumb the format info from .fb_create() all the way to > drm_helper_mode_fill_fb_struct() to avoid the redundant > lookup. > > Cc: David Airlie > Cc: Gerd Hoffmann > Cc: Dmitry Osipenko > Cc: Gu

Re: [PATCH 2/2] drm/virtio: Use dma_buf from GEM object instance

2025-04-15 Thread Dmitry Osipenko
gt; dma_resv_lock(dmabuf->resv, NULL); > virtgpu_dma_buf_unmap(bo); > dma_resv_unlock(dmabuf->resv); > > - dma_buf_detach(dmabuf, attach); > + dma_buf_detach(dmabuf, obj->import_attach); > dma_buf_put(dmabuf); > } > Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 1/2] drm/virtio: Test for imported buffers with drm_gem_is_imported()

2025-04-15 Thread Dmitry Osipenko
> > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 8 > drivers/gpu/drm/virtio/virtgpu_prime.c | 2 +- > 2 files changed, 5 insertions(+), 5 deletions(-) Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 4/4] drm/gem: Inline drm_gem_pin() into PRIME helpers

2025-04-14 Thread Dmitry Osipenko
therwise looks good. Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 2/4] drm/gem-vram: Do not set pin and unpin callbacks

2025-04-14 Thread Dmitry Osipenko
On 4/4/25 16:23, Thomas Zimmermann wrote: > Gem-vram helpers do not support PRIME dma-buf sharing. No nothing > will ever call pin/unpin on its buffer objects. Do not set these > callbacks in struct drm_gem_object_funcs. > > Signed-off-by: Thomas Zimmermann Reviewed-by:

Re: [PATCH 3/4] drm/gem-vram: Un-export pin helpers

2025-04-14 Thread Dmitry Osipenko
On 4/4/25 16:23, Thomas Zimmermann wrote: > There are no external callers of the gem-vram pin helpers. Hence > unexport them. > > Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 1/4] drm/client: Do not pin in drm_client_buffer_vmap()

2025-04-14 Thread Dmitry Osipenko
On 4/4/25 16:23, Thomas Zimmermann wrote: > +int drm_client_buffer_vmap(struct drm_client_buffer *buffer, > +struct iosys_map *map_copy) > { > struct drm_gem_object *gem = buffer->gem; > struct iosys_map *map = &buffer->map; > int ret; > > drm_gem_

Re: [PATCH v20 01/10] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names

2025-04-05 Thread Dmitry Osipenko
On 3/24/25 16:05, Christian König wrote: > Am 22.03.25 um 22:25 schrieb Dmitry Osipenko: >> Make drm/gem API function names consistent by having locked function >> use the _locked postfix in the name, while the unlocked variants don't >> use the _unlocked postfix. Rename

[PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1)

2025-04-05 Thread Dmitry Osipenko
/dri-devel/20240105184624.508603-1-dmitry.osipe...@collabora.com/ Changelog: v20:- Rebased on recent drm-misc. Added r-bs that were given to v19. Dmitry Osipenko (10): drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names drm/gem: Add _locked postfix to functions that

Re: [PATCH v2 7/7] drm/virtio: implement userptr: add interval tree

2025-04-05 Thread Dmitry Osipenko
On 3/30/25 14:57, Dmitry Osipenko wrote: >> +userptr = virtio_gpu_userptr_from_addr_range( >> +vfpriv, params->userptr, params->userptr + params->size - 1UL); > Is it possible that userptr address will be same for two different > processes? See now the

Re: [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1)

2025-04-05 Thread Dmitry Osipenko
On 4/3/25 10:03, Thomas Zimmermann wrote: > Hi > > Am 03.04.25 um 02:37 schrieb Lucas De Marchi: >> On Sun, Mar 23, 2025 at 12:25:58AM +0300, Dmitry Osipenko wrote: >>> Hi, >>> >>> This a continuation of a year-old series that adds generic DRM-shmem >&

[PATCH v20 05/10] drm/shmem-helper: Refactor locked/unlocked functions

2025-04-04 Thread Dmitry Osipenko
Add locked and remove unlocked postfixes from drm-shmem function names, making names consistent with the drm/gem core code. Reviewed-by: Boris Brezillon Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 60

Re: [PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

2025-04-04 Thread Dmitry Osipenko
On 4/2/25 15:47, Thomas Zimmermann wrote: > Hi > > Am 22.03.25 um 22:26 schrieb Dmitry Osipenko: >> The vmapped pages shall be pinned in memory and previously get/ >> put_pages() >> were implicitly hard-pinning/unpinning the pages. This will no longer be >>

Re: [PATCH v1] drm/shmem-helper: Fix unsetting shmem vaddr while vmap refcount > 0

2025-04-04 Thread Dmitry Osipenko
On 4/3/25 17:26, Dmitry Osipenko wrote: > We switched to use refcount_t for vmaps and missed to change the vunmap > code to properly unset the vmap pointer, which is now cleared while vmap's > refcount > 0. Clear the cached vmap pointer only when refcounting drops to >

Re: [PATCH v2 1/2] drm/virtio: introduce the HOST_PAGE_SIZE feature

2025-04-03 Thread Dmitry Osipenko
On 4/2/25 20:55, Dmitry Osipenko wrote: > On 4/2/25 20:46, Sergio Lopez wrote: >> diff --git a/include/uapi/linux/virtio_gpu.h >> b/include/uapi/linux/virtio_gpu.h >> index >> bf2c9cabd20793e3851e749baadf210341445501..adc264df4e458e9c754936c3015c069e5ee6b899 >&

Re: [PATCH v2 7/7] drm/virtio: implement userptr: add interval tree

2025-04-03 Thread Dmitry Osipenko
On 4/3/25 06:28, Huang, Honglei1 wrote: > > Hi Dmitry: > > Really sorry for missed this comment. Yes it can be done in UMD, > actually the interval tree is used with the MMU notifier normally, > it is for preventing create same MMU notifier for overlapped areas. > Cause this version patch set doe

[PATCH v1] drm/shmem-helper: Fix unsetting shmem vaddr while vmap refcount > 0

2025-04-03 Thread Dmitry Osipenko
se refcount_t for vmap_use_count") Reported-by: Lucas De Marchi Closes: https://lore.kernel.org/dri-devel/20250403105053.788b0...@collabora.com/T/#m3dca6d81bedc8d6146a56b82694624fbc6fa4c96 Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++-- 1 file changed,

Re: [PATCH v2 2/2] drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params

2025-04-02 Thread Dmitry Osipenko
On 4/2/25 20:46, Sergio Lopez wrote: > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > index > c33c057365f85a2ace536f91655c903036827312..405203b3c3847a8b318a7118aa34356c839d249e > 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/drive

Re: [PATCH v2 1/2] drm/virtio: introduce the HOST_PAGE_SIZE feature

2025-04-02 Thread Dmitry Osipenko
On 4/2/25 20:46, Sergio Lopez wrote: > diff --git a/include/uapi/linux/virtio_gpu.h b/include/uapi/linux/virtio_gpu.h > index > bf2c9cabd20793e3851e749baadf210341445501..adc264df4e458e9c754936c3015c069e5ee6b899 > 100644 > --- a/include/uapi/linux/virtio_gpu.h > +++ b/include/uapi/linux/virtio_gpu

Re: [PATCH v2 7/7] drm/virtio: implement userptr: add interval tree

2025-04-02 Thread Dmitry Osipenko
On 4/2/25 04:53, Huang, Honglei1 wrote: > > On 2025/3/30 19:57, Dmitry Osipenko wrote: >> If the purpose of this feature is to dedup usrptr BOs of a the single >> process/application, can this can be done in userspace? I assume it can be done in userspace, don't see why i

Re: [PATCH v6] drm/syncobj: Extend EXPORT_SYNC_FILE for timeline syncobjs

2025-04-01 Thread Dmitry Osipenko
reedesktop.org/virgl/virglrenderer/-/merge_requests/805 >> >> v2: Add DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_TIMELINE >> v3: Add unstaged uabi header hunk >> v4: Also handle IMPORT_SYNC_FILE case >> v5: Address comments from Dmitry >> v6: checkpatch.pl nits >> >> Signed-off-by:

Re: [PATCH v2 1/2] drm/virtio: Don't attach GEM to a non-created context in gem_object_open()

2025-04-01 Thread Dmitry Osipenko
On 4/1/25 22:53, Rob Clark wrote: > On Tue, Apr 1, 2025 at 5:39 AM Dmitry Osipenko > wrote: >> >> The vfpriv->ctx_id is always initialized to a non-zero value. Check whether >> context was created before attaching GEM to this context ID. This left >> unnoticed

Re: [PATCH v1] MAINTAINERS: Add Dmitry Osipenko as drm/virtio co-maintainer

2025-04-01 Thread Dmitry Osipenko
On 4/1/25 17:34, Gurchetan Singh wrote: > On Tue, Apr 1, 2025 at 7:25 AM Gerd Hoffmann wrote: > >> On Tue, Apr 01, 2025 at 04:01:51PM +0300, Dmitry Osipenko wrote: >>> I was helping to co-maintain VirtIO-GPU driver in drm-misc with >>> permission from Gerd Hoffm

[PATCH v2 2/2] drm/virtio: Fix missed dmabuf unpinning in error path of prepare_fb()

2025-04-01 Thread Dmitry Osipenko
Correct error handling in prepare_fb() to fix leaking resources when error happens. Fixes: 4a696a2ee646 ("drm/virtio: Add prepare and cleanup routines for imported dmabuf obj") Cc: # v6.14+ Acked-by: Vivek Kasireddy Signed-off-by: Dmitry Osipenko --- v2: Change order of prep_obj/f

[PATCH v2 1/2] drm/virtio: Don't attach GEM to a non-created context in gem_object_open()

2025-04-01 Thread Dmitry Osipenko
086b9f27f0ab ("drm/virtio: Don't create a context with default param if context_init is supported") Cc: # v6.14+ Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_gem.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu

Re: [PATCH v5] drm/syncobj: Extend EXPORT_SYNC_FILE for timeline syncobjs

2025-04-01 Thread Dmitry Osipenko
v3: Add unstaged uabi header hunk > v4: Also handle IMPORT_SYNC_FILE case > v5: Address comments from Dmitry > > Signed-off-by: Rob Clark > --- > drivers/gpu/drm/drm_syncobj.c | 45 +++ > include/uapi/drm/drm.h| 4 > 2 files

[PATCH v1] MAINTAINERS: Add Dmitry Osipenko as drm/virtio co-maintainer

2025-04-01 Thread Dmitry Osipenko
I was helping to co-maintain VirtIO-GPU driver in drm-misc with permission from Gerd Hoffmann for past 2 years and would like to receive new patches directly into my inbox. Add myself as co-maintainer. Signed-off-by: Dmitry Osipenko --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff

Re: [PATCH v2 7/7] drm/virtio: implement userptr: add interval tree

2025-03-30 Thread Dmitry Osipenko
If the purpose of this feature is to dedup usrptr BOs of a the single process/application, can this can be done in userspace? On 3/21/25 11:00, Honglei Huang wrote: > int virtio_gpu_userptr_create(struct virtio_gpu_device *vgdev, > struct drm_file *file, >

Re: [PATCH v1 1/7] virtio-gpu api: add blob userptr resource

2025-03-30 Thread Dmitry Osipenko
On 3/29/25 22:50, Demi Marie Obenour wrote: > On 3/26/25 10:46 AM, Dmitry Osipenko wrote: >> On 3/6/25 13:51, Huang, Honglei1 wrote: >>> >>> On 2025/3/1 5:21, Demi Marie Obenour wrote: >>>> On 2/28/25 12:36 AM, Honglei Huang wrote: >>>>> From:

Re: [PATCH v2] drm/virtio: Add capset definitions

2025-03-27 Thread Dmitry Osipenko
On 3/27/25 18:25, Aaron Ruby wrote: > > Since the context-type additions to the virtio-gpu spec, these have been > defined locally in guest user-space, and virtio-gpu backend library code. > > Now, these capsets have been stabilized, and should be defined in > a common space, in both the virtio_g

Re: [PATCH v1 1/7] virtio-gpu api: add blob userptr resource

2025-03-27 Thread Dmitry Osipenko
On 3/27/25 06:00, Huang, Honglei1 wrote: > > > On 2025/3/26 22:46, Dmitry Osipenko wrote: >> On 3/6/25 13:51, Huang, Honglei1 wrote: >>> >>> On 2025/3/1 5:21, Demi Marie Obenour wrote: >>>> On 2/28/25 12:36 AM, Honglei Huang wrote: >>>>

Re: [PATCH v1 2/2] drm/virtio: Fix missed dmabuf unpinning in error path of prepare_fb()

2025-03-27 Thread Dmitry Osipenko
On 3/27/25 10:14, Kasireddy, Vivek wrote: >> Another question, why do we need this fencing for imported dmabuf? >> Fencing isn't done host/guest blobs in this code, while dmabuf is >> essentially a guest blob. Could you please clarify why this fence is >> needed? Maybe we shouldn't allocate fence i

[PATCH v20 10/10] drm/shmem-helper: Use refcount_t for vmap_use_count

2025-03-27 Thread Dmitry Osipenko
illon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 28 ++ drivers/gpu/drm/tests/drm_gem_shmem_test.c | 6 ++--- include/drm/drm_gem_shmem_helper.h | 2 +- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/gp

Re: [PATCH v4] drm/syncobj: Extend EXPORT_SYNC_FILE for timeline syncobjs

2025-03-27 Thread Dmitry Osipenko
On 3/28/25 00:36, Rob Clark wrote: ... > static int drm_syncobj_import_sync_file_fence(struct drm_file *file_private, > - int fd, int handle) > + int fd, int handle, u64 point) > { > struct dma_fence *fence

Re: [PATCH 1/3] accel/ivpu: pages_use_count is now a refcount_t

2025-03-27 Thread Dmitry Osipenko
On 3/27/25 15:19, Jacek Lawrynowicz wrote: > Hi, > > On 3/27/2025 12:37 PM, Dmitry Osipenko wrote: >> On 3/27/25 14:30, Jani Nikula wrote: >>> On Thu, 27 Mar 2025, Boris Brezillon wrote: >>>> Commit 051b6646d36d ("drm/shmem-helper: Use refcount_t for &

Re: [PATCH 1/3] accel/ivpu: pages_use_count is now a refcount_t

2025-03-27 Thread Dmitry Osipenko
hind. >> >> Fixes: 051b6646d36d ("drm/shmem-helper: Use refcount_t for pages_use_count") >> Signed-off-by: Boris Brezillon >> Cc: Dmitry Osipenko >> Cc: Jacek Lawrynowicz >> Cc: Maciej Falkowski >> Cc: Oded Gabbay >> Cc: dri-devel@lis

Re: [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1)

2025-03-27 Thread Dmitry Osipenko
On 3/27/25 13:45, Boris Brezillon wrote: > On Wed, 26 Mar 2025 23:08:55 +0300 > Dmitry Osipenko wrote: > >> On 3/25/25 17:17, Thomas Zimmermann wrote: >>> I've looked through this before, so >>> >>> Acked-by: Thomas Zimmermann >>>

Re: [PATCH 2/3] accel/ivpu: s/drm_gem_shmem_v[un]map/drm_gem_shmem_v[un]map_locked/

2025-03-27 Thread Dmitry Osipenko
eft behind. > > Fixes: 954907f7147d ("drm/shmem-helper: Refactor locked/unlocked functions") > Signed-off-by: Boris Brezillon > Cc: Dmitry Osipenko > Cc: Jacek Lawrynowicz > Cc: Maciej Falkowski > Cc: Oded Gabbay > Cc: dri-devel@lists.freedesktop.org > ---

Re: [PATCH 3/3] accel/amdxdna: s/drm_gem_v[un]map_unlocked/drm_gem_v[un]map/

2025-03-27 Thread Dmitry Osipenko
locked postfix of > drm_gem_v/unmap() function names") > Signed-off-by: Boris Brezillon > Cc: Dmitry Osipenko > Cc: Min Ma > Cc: Lizhi Hou > Cc: Oded Gabbay > Cc: dri-devel@lists.freedesktop.org > --- > drivers/accel/amdxdna/amdxdna_gem.c | 4 ++-- > 1 file c

Re: [PATCH 1/3] accel/ivpu: pages_use_count is now a refcount_t

2025-03-27 Thread Dmitry Osipenko
/shmem-helper: Use refcount_t for pages_use_count") > Signed-off-by: Boris Brezillon > Cc: Dmitry Osipenko > Cc: Jacek Lawrynowicz > Cc: Maciej Falkowski > Cc: Oded Gabbay > Cc: dri-devel@lists.freedesktop.org > --- > drivers/accel/ivpu/ivpu_gem.c | 2 +- > 1 file changed, 1

Re: [PATCH] drm/virtio: Add capset definitions

2025-03-26 Thread Dmitry Osipenko
On 3/25/25 18:42, Aaron Ruby wrote: > From 73e0b6fb04d90b70de1f40e8e2ffc8fe497fa204 Mon Sep 17 00:00:00 2001 > From: Aaron Ruby > Date: Mon, 24 Mar 2025 16:18:43 -0400 > Subject: [PATCH] drm/virtio: Add capset definitions > > Since the context-type additions to the virtio-gpu spec, these have bee

Re: [PATCH] drm/virtio: Fix flickering issue seen with imported dmabufs

2025-03-26 Thread Dmitry Osipenko
(Wayland). This >>> problem is mostly seen with dGPUs in the case where the FBs are >>> allocated in VRAM but need to be migrated to System RAM as they >>> are shared with virtio-gpu. >>> >>> Fixes: ca77f27a2665 ("drm/virtio: Import prime buffers f

Re: [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1)

2025-03-26 Thread Dmitry Osipenko
On 3/25/25 17:17, Thomas Zimmermann wrote: > I've looked through this before, so > > Acked-by: Thomas Zimmermann > > for the series. Applied to misc-next, thanks! -- Best regards, Dmitry

Re: [RFC PATCH v2 3/6] drm/shmem: Implement sparse allocation of pages for shmem objects

2025-03-26 Thread Dmitry Osipenko
On 3/26/25 05:14, Adrián Larumbe wrote: > +static struct sg_table * > +drm_gem_shmem_sparse_get_sgt_range(struct drm_gem_shmem_object *shmem, > +unsigned int n_pages, pgoff_t page_offset, > +gfp_t gfp) > +{ > + struct drm_gem_objec

Re: [PATCH v1 1/7] virtio-gpu api: add blob userptr resource

2025-03-26 Thread Dmitry Osipenko
On 3/6/25 13:51, Huang, Honglei1 wrote: > > On 2025/3/1 5:21, Demi Marie Obenour wrote: >> On 2/28/25 12:36 AM, Honglei Huang wrote: >>> From: Honglei Huang >>> >>> Add a new resource for blob resource, called userptr, used for let >>> host access guest user space memory, to acquire buffer based

Re: [PATCH v1 2/2] drm/virtio: Fix missed dmabuf unpinning in error path of prepare_fb()

2025-03-26 Thread Dmitry Osipenko
On 3/26/25 08:14, Kasireddy, Vivek wrote: ... >> static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane, >> struct drm_plane_state *new_state) >> { >> @@ -376,23 +386,16 @@ static int virtio_gpu_plane_prepare_fb(struct >> drm_plane *plane, >>

[PATCH v20 01/10] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names

2025-03-25 Thread Dmitry Osipenko
ipard Reviewed-by: Boris Brezillon Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_client.c | 10 +- drivers/gpu/drm/drm_gem.c| 20 ++-- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++--- drivers/gp

[PATCH v1 2/2] drm/virtio: Fix missed dmabuf unpinning in error path of prepare_fb()

2025-03-25 Thread Dmitry Osipenko
Unpin imported dmabuf on fence allocation failure in prepare_fb(). Fixes: 4a696a2ee646 ("drm/virtio: Add prepare and cleanup routines for imported dmabuf obj") Cc: # v6.14+ Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_plane.c | 25 ++--- 1 fi

[PATCH v1 1/2] drm/virtio: Don't attach GEM to a non-created context in gem_object_open()

2025-03-25 Thread Dmitry Osipenko
086b9f27f0ab ("drm/virtio: Don't create a context with default param if context_init is supported") Cc: # v6.14+ Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_gem.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu

Re: [PATCH] drm/virtio: Fix flickering issue seen with imported dmabufs

2025-03-25 Thread Dmitry Osipenko
mport prime buffers from other devices as > guest blobs") > Cc: Gerd Hoffmann > Cc: Dmitry Osipenko > Cc: Gurchetan Singh > Cc: Chia-I Wu > Signed-off-by: Vivek Kasireddy > --- > drivers/gpu/drm/virtio/virtgpu_prime.c | 1 + > 1 file changed, 1 insertion(+) &g

[PATCH v20 08/10] drm/shmem-helper: Use refcount_t for pages_use_count

2025-03-22 Thread Dmitry Osipenko
Use atomic refcount_t helper for pages_use_count to optimize pin/unpin functions by skipping reservation locking while GEM's pin refcount > 1. Acked-by: Maxime Ripard Reviewed-by: Boris Brezillon Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers

[PATCH v20 07/10] drm/shmem-helper: Add and use pages_pin_count

2025-03-22 Thread Dmitry Osipenko
swapped out). The pages_pin_count > 1 will hard-pin pages in memory. Acked-by: Maxime Ripard Reviewed-by: Boris Brezillon Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 16 +++- include/drm/drm_gem_shmem_helper.h |

[PATCH v20 06/10] drm/shmem-helper: Remove obsoleted is_iomem test

2025-03-22 Thread Dmitry Osipenko
Maxime Ripard Suggested-by: Thomas Zimmermann Reviewed-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c inde

[PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

2025-03-22 Thread Dmitry Osipenko
t-pinned), while the new pages_pin_count will do the hard-pinning. Switch the vmap/vunmap() to use pin/unpin() functions in a preparation of addition of the memory shrinker support to drm-shmem. Acked-by: Maxime Ripard Reviewed-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers

[PATCH v20 04/10] drm/shmem-helper: Make all exported symbols GPL

2025-03-22 Thread Dmitry Osipenko
Make all drm-shmem exported symbols GPL to make them consistent with the rest of drm-shmem symbols. Acked-by: Maxime Ripard Reviewed-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 16 1 file changed, 8 insertions(+), 8

[PATCH v20 03/10] drm/gem: Document locking rule of vmap and evict callbacks

2025-03-22 Thread Dmitry Osipenko
The vmap/vunmap/evict GEM callbacks are always invoked with a held GEM's reservation lock. Document this locking rule for clarity. Reviewed-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- include/drm/drm_gem.h | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --

[PATCH v20 02/10] drm/gem: Add _locked postfix to functions that have unlocked counterpart

2025-03-22 Thread Dmitry Osipenko
Add _locked postfix to drm_gem functions that have unlocked counterpart functions to make GEM functions naming more consistent and intuitive in regards to the locking requirements. Acked-by: Maxime Ripard Reviewed-by: Boris Brezillon Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko

Re: [PATCH v19 22/30] drm/shmem-helper: Add common memory shrinker

2025-03-05 Thread Dmitry Osipenko
On 3/4/25 14:43, Thomas Zimmermann wrote: > Hi > > Am 04.03.25 um 11:59 schrieb Dmitry Osipenko: >> On 3/4/25 13:29, Thomas Zimmermann wrote: >>> Hi >>> >>> Am 05.01.24 um 19:46 schrieb Dmitry Osipenko: >>>> Introduce common drm-shmem shrinke

Re: [PATCH v19 22/30] drm/shmem-helper: Add common memory shrinker

2025-03-04 Thread Dmitry Osipenko
On 3/4/25 13:29, Thomas Zimmermann wrote: > Hi > > Am 05.01.24 um 19:46 schrieb Dmitry Osipenko: >> Introduce common drm-shmem shrinker for DRM drivers. > > What's the status of this patch? It was de-prioritized on my list a year ago as I had to move to a higher prior

Re: [PATCH v2 21/25] drm/virtio: Compute dumb-buffer sizes with drm_mode_size_dumb()

2025-02-20 Thread Dmitry Osipenko
args->height; > - args->size = ALIGN(args->size, PAGE_SIZE); > - > params.format = virtio_gpu_translate_format(DRM_FORMAT_HOST_XRGB); > params.width = args->width; > params.height = args->height; > @@ -92,7 +92,6 @@ int virtio_gpu_mode_dumb_create(struct d

Re: [PATCH RFC v3 4/4] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-20 Thread Dmitry Osipenko
e VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs 7 /* Bitmask of supported > capability set ids */ > #define VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME 8 /* Ability to set debug name > from userspace */ > +#define VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE 9 /* Host SHM page size, with > format PAGE_SIZE >> 12 */ > > struct drm_virtgpu_getparam { > __u64 param; > Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH RFC v2 4/5] virtio-mmio: read shm region page size

2025-02-20 Thread Dmitry Osipenko
On 2/20/25 13:24, Sergio Lopez Pascual wrote: > Dmitry Osipenko writes: > >> On 2/14/25 18:16, Sergio Lopez wrote: >>> Use the newly introduced SHM_PAGE_SHIFT register to read the page shift >>> for the shared memory region, derive the page size from it and stor

Re: [PATCH RFC v2 4/5] virtio-mmio: read shm region page size

2025-02-19 Thread Dmitry Osipenko
On 2/14/25 18:16, Sergio Lopez wrote: > Use the newly introduced SHM_PAGE_SHIFT register to read the page shift > for the shared memory region, derive the page size from it and store the > resulting value into virtio_shm_region. > > Signed-off-by: Sergio Lopez > --- > drivers/virtio/virtio_mmio.

Re: [PATCH RFC v2 3/5] virtio-pci: extend virtio_pci_cap with page_shift

2025-02-19 Thread Dmitry Osipenko
io_pci_cap { > __u8 cfg_type; /* Identifies the structure. */ > __u8 bar; /* Where to find it. */ > __u8 id;/* Multiple capabilities of the same type */ > - __u8 padding[2];/* Pad to full dword. */ > + __u8 page_shift;/* Page shift for > VIRTIO_PCI_CAP_SHARED_MEMORY_CFG. */ > + __u8 padding[1];/* Pad to full dword. */ > __le32 offset; /* Offset within bar. */ > __le32 length; /* Length of the structure, in bytes. */ > }; > Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH RFC v2 2/5] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE

2025-02-19 Thread Dmitry Osipenko
42 > +#define VIRTIO_TRANSPORT_F_END 43 > > #ifndef VIRTIO_CONFIG_NO_LEGACY > /* Do we get callbacks when the ring is completely used, even if we've > @@ -120,4 +120,9 @@ > */ > #define VIRTIO_F_ADMIN_VQ41 > > +/* > + *

Re: [PATCH RFC v2 1/5] virtio_config: add page_size field to virtio_shm_region

2025-02-19 Thread Dmitry Osipenko
On 2/14/25 18:16, Sergio Lopez wrote: > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > index > 5d78c2d572abfcfe2b84cdd82df622320fe97d5d..1f594b626d7a7734e8ec58766737a118c26bad94 > 100644 > --- a/drivers/virtio/virtio_mmio.c > +++ b/drivers/virtio/virtio_mmio.c > @@ -56

Re: [PATCH 4/4] dma-buf: drop caching of sg_tables

2025-02-17 Thread Dmitry Osipenko
pping. > - * @dir: direction of cached mapping. > * @peer2peer: true if the importer can handle peer resources without pages. > * @priv: exporter specific attachment data. > * @importer_ops: importer operations for this attachment, if provided > @@ -514,8 +503,6 @@ struct dma_buf_attachment { > struct dma_buf *dmabuf; > struct device *dev; > struct list_head node; > - struct sg_table *sgt; > - enum dma_data_direction dir; > bool peer2peer; > const struct dma_buf_attach_ops *importer_ops; > void *importer_priv; Recalling being very confused by this cached sgt many years ago when faced it for the first time :) Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 1/4] dma-buf: fix incorrect dma-fence documentation

2025-02-17 Thread Dmitry Osipenko
On 2/11/25 19:31, Christian König wrote: > diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h > index e7ad819962e3..e230af0d123f 100644 > --- a/include/linux/dma-fence.h > +++ b/include/linux/dma-fence.h > @@ -169,8 +169,8 @@ struct dma_fence_ops { >* implementation know tha

Re: [PATCH 2/4] dma-buf/dma-fence: remove unnecessary callbacks

2025-02-17 Thread Dmitry Osipenko
ack to fill in free-form debug info specific to this fence, like > - * the sequence number. > - * > - * This callback is optional. > - */ > - void (*fence_value_str)(struct dma_fence *fence, char *str, int size); > - > - /** > - * @timeline_value_str: > -

Re: [PATCH 3/4] dma-buf: dma-buf: stop mapping sg_tables on attach

2025-02-17 Thread Dmitry Osipenko
as long as IGT passes. Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH 2/4] dma-buf/dma-fence: remove unnecessary callbacks

2025-02-17 Thread Dmitry Osipenko
On 2/17/25 20:11, Dmitry Osipenko wrote: > On 2/11/25 19:31, Christian König wrote: >> The fence_value_str and timeline_value_str callbacks were just an >> unnecessary abstraction in the SW sync implementation. >> >> The only caller of those callbacks already knew that t

Re: [PATCH v1] drm/virtio: Extend blob UAPI with deferred-mapping hinting

2025-02-14 Thread Dmitry Osipenko
On 2/14/25 20:45, Rob Clark wrote: > On Sun, Jan 26, 2025 at 12:43 PM Dmitry Osipenko > wrote: >> >> If userspace never maps GEM object, then BO wastes hostmem space >> because VirtIO-GPU driver maps VRAM BO at the BO's creating time. >> >&

Re: [PATCH RFC v2 5/5] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-14 Thread Dmitry Osipenko
On 2/14/25 18:16, Sergio Lopez wrote: > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > index > c33c057365f85a2ace536f91655c903036827312..4b49635b4fe1d4256f219823341cef8e5fa8f029 > 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/driv

Re: [PATCH v7] drm/virtio: Add drm_panic support

2025-02-09 Thread Dmitry Osipenko
On 2/6/25 13:42, Ryosuke Yasuoka wrote: > Virtio gpu supports the drm_panic module, which displays a message to > the screen when a kernel panic occurs. It is supported where it has > vmapped shmem BO. > > Signed-off-by: Jocelyn Falempe > Signed-off-by: Ryosuke Yasuoka > --- Applied to misc-nex

Re: [PATCH v2] drm/virtio: Align host mapping request to maximum platform page size

2025-02-07 Thread Dmitry Osipenko
On 2/6/25 18:17, Sasha Finkelstein wrote: > On Wed, 29 Jan 2025 at 15:40, Dmitry Osipenko > wrote: >> Otherwise, the proper solution would be to pass info about host's page >> size to guest using extended virtio protocol. > > It is not fully clear to me, as to

Re: [PATCH v5] drm/virtio: Add drm_panic support

2025-02-02 Thread Dmitry Osipenko
On 12/2/24 20:19, Jocelyn Falempe wrote: >>> >>> I've now noticed that drm_gem_shmem_vmap() expects BO reservation lock >>> to be held and we can't take lock it at a panic time. >>> >>> https://elixir.bootlin.com/linux/v6.12.1/source/drivers/gpu/drm/ >>> drm_gem_shmem_helper.c#L330 >>> >>> This res

Re: [PATCH v6] drm/virtio: Add drm_panic support

2025-02-02 Thread Dmitry Osipenko
On 1/30/25 12:05, Ryosuke Yasuoka wrote: > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h > b/drivers/gpu/drm/virtio/virtgpu_drv.h > index f42ca9d8ed10..44511f316851 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_drv.h > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h > @@ -126,6 +126,12 @@ struct vi

Re: [PATCH v6] drm/virtio: Add drm_panic support

2025-02-02 Thread Dmitry Osipenko
Hi, On 1/30/25 12:05, Ryosuke Yasuoka wrote: ... > +static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, > + struct drm_scanout_buffer *sb) > +{ > + struct virtio_gpu_object *bo; > + > + if (!plane->state || !plane->state->fb || !plane->sta

Re: [PATCH v2] drm/virtio: Align host mapping request to maximum platform page size

2025-01-29 Thread Dmitry Osipenko
On 1/26/25 00:08, Sasha Finkelstein via B4 Relay wrote: > --- a/drivers/gpu/drm/virtio/virtgpu_vram.c > +++ b/drivers/gpu/drm/virtio/virtgpu_vram.c > @@ -150,8 +150,8 @@ static int virtio_gpu_vram_map(struct virtio_gpu_object > *bo) > return -EINVAL; > > spin_lock(&vgdev->hos

[PATCH v1] drm/virtio: Extend blob UAPI with deferred-mapping hinting

2025-01-26 Thread Dmitry Osipenko
n the flag is set by userspace. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_gem.c | 9 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 + drivers/gpu/drm/virtio/virtgpu_vram.c | 30 +- include/uap

Re: [PATCH RESEND] drm/virtio: Align host mapping request to maximum platform page size

2025-01-24 Thread Dmitry Osipenko
On 1/25/25 01:58, Sasha Finkelstein wrote: > On Fri, 24 Jan 2025 at 23:52, Dmitry Osipenko > wrote: >>> - ret = drm_mm_insert_node(&vgdev->host_visible_mm, &vram->vram_node, >>> - bo->base.base.size); >>

Re: [PATCH RESEND] drm/virtio: Align host mapping request to maximum platform page size

2025-01-24 Thread Dmitry Osipenko
On 1/25/25 01:01, Sasha Finkelstein via B4 Relay wrote: > From: Sasha Finkelstein > > This allows running different page sizes between host and guest on > platforms that support mixed page sizes. > > Signed-off-by: Sasha Finkelstein > --- > drivers/gpu/drm/virtio/virtgpu_vram.c | 10 --

Re: [PATCH] drm/virtio: Support partial maps of GEM objects

2025-01-24 Thread Dmitry Osipenko
On 1/19/25 23:23, Dmitry Osipenko wrote: > On 1/19/25 23:02, Dmitry Osipenko wrote: >> On 1/19/25 19:18, Sasha Finkelstein wrote: >>> On Sun, 19 Jan 2025 at 12:50, Dmitry Osipenko >>> wrote: >>>>> ret = io_remap_pfn_range(vma, vma->vm_sta

Re: [PATCH] drm/virtio: Support partial maps of GEM objects

2025-01-19 Thread Dmitry Osipenko
On 1/19/25 23:02, Dmitry Osipenko wrote: > On 1/19/25 19:18, Sasha Finkelstein wrote: >> On Sun, 19 Jan 2025 at 12:50, Dmitry Osipenko >> wrote: >>>> ret = io_remap_pfn_range(vma, vma->vm_start, >>>> -

Re: [PATCH] drm/virtio: Support partial maps of GEM objects

2025-01-19 Thread Dmitry Osipenko
On 1/19/25 19:18, Sasha Finkelstein wrote: > On Sun, 19 Jan 2025 at 12:50, Dmitry Osipenko > wrote: >>> ret = io_remap_pfn_range(vma, vma->vm_start, >>> - vram->vram_node.start >> PAGE_SHIFT, >>> +

Re: [PATCH] drm/virtio: Don't return error if virtio-gpu PCI dev is not found

2025-01-19 Thread Dmitry Osipenko
nitialization. > > Fixes: 5dd8b536bb ("drm/virtio: Lock the VGA resources during initialization") > Suggested-by: Dmitry Osipenko > Cc: Gerd Hoffmann > Cc: Gurchetan Singh > Cc: Chia-I Wu > Signed-off-by: Vivek Kasireddy > --- > drivers/gpu/drm/virtio/virtgp

Re: [PATCH] drm/virtio: Support partial maps of GEM objects

2025-01-19 Thread Dmitry Osipenko
Hi, On 1/10/25 00:45, Sasha Finkelstein via B4 Relay wrote: > From: Sasha Finkelstein > > Those are useful to implement coherent cross-vm mmap. > > Signed-off-by: Sasha Finkelstein > --- > drivers/gpu/drm/virtio/virtgpu_vram.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > >

Re: [PATCH] drm/virtio: Lock the VGA resources during initialization

2025-01-09 Thread Dmitry Osipenko
On 12/11/24 09:43, Vivek Kasireddy wrote: > +static int __init virtio_gpu_driver_init(void) > +{ > + struct pci_dev *pdev; > + int ret; > + > + pdev = pci_get_device(PCI_VENDOR_ID_REDHAT_QUMRANET, > + PCI_DEVICE_ID_VIRTIO_GPU, > + NULL

Re: [PATCH v1] drm/virtio: Factor out common dmabuf unmapping code

2025-01-09 Thread Dmitry Osipenko
On 12/2/24 08:39, Dmitry Osipenko wrote: > Move out dmabuf detachment and unmapping into separate function. This > removes duplicated code and there is no need to check the GEM's kref now, > since both bo->attached and bo->sgt are unset under held reservation lock. >

  1   2   3   4   5   6   7   8   9   10   >