Re: [PATCH v2] drm/vmwgfx: Bump the minor version

2021-12-09 Thread Martin Krastev
uot; > +#define VMWGFX_DRIVER_DATE "20211206" >  #define VMWGFX_DRIVER_MAJOR 2 > -#define VMWGFX_DRIVER_MINOR 19 > +#define VMWGFX_DRIVER_MINOR 20 >  #define VMWGFX_DRIVER_PATCHLEVEL 0 >  #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) >  #define VMWGFX_MAX_RELOCATIONS 2048 Reviewed-by: Martin Krastev

Re: [PATCH 06/12] drm/vmwgfx: Update device headers for GL43

2021-12-09 Thread Martin Krastev
a_overlay.h | 6 +++--- > drivers/gpu/drm/vmwgfx/device_include/svga_reg.h | 14 -- > 9 files changed, 41 insertions(+), 34 deletions(-) Reviewed-by: Martin Krastev

Re: [PATCH 11/12] drm/vmwgfx: Remove usage of MOBFMT_RANGE

2021-12-09 Thread Martin Krastev
9,6 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt) > break; > } > > - old = ~((dma_addr_t) 0); > - vmw_tt->vsgt.num_regions = 0; > - for (vmw_piter_start(, vsgt, 0); vmw_piter_next();) { > - dma_addr_t cur = vmw_piter_dma_addr(); > - > - if (cur != old + PAGE_SIZE) > - vmw_tt->vsgt.num_regions++; > - old = cur; > - } > - > vmw_tt->mapped = true; > return 0; > Reviewed-by: Martin Krastev

Re: [PATCH 08/12] drm/vmwgfx: support 64 UAVs

2021-12-09 Thread Martin Krastev
vmw_cmd_set_uav(struct vmw_private *dev_priv, > if (!has_sm5_context(dev_priv)) > return -EINVAL; > > - if (num_uav > SVGA3D_MAX_UAVIEWS) { > + if (num_uav > vmw_max_num_uavs(dev_priv)) { > VMW_DEBUG_USER("Invalid UAV binding.\n"); > return -EINVAL; > } > @@ -2948,7 +2948,7 @@ static int vmw_cmd_set_cs_uav(struct vmw_private > *dev_priv, > if (!has_sm5_context(dev_priv)) > return -EINVAL; > > - if (num_uav > SVGA3D_MAX_UAVIEWS) { > + if (num_uav > vmw_max_num_uavs(dev_priv)) { > VMW_DEBUG_USER("Invalid UAV binding.\n"); > return -EINVAL; > } Reviewed-by: Martin Krastev

Re: [PATCH] drm/vmwgfx: Fix possible usage of an uninitialized variable

2021-12-16 Thread Martin Krastev
& drm_vmw_synccpu_allow_cs)) { > - atomic_dec(_bo->cpu_writers); > + if (!ret) { > + if (!(flags & drm_vmw_synccpu_allow_cs)) { > + atomic_dec(_bo->cpu_writers); > + } > + ttm_bo_put(_bo->base); > } > - ttm_bo_put(_bo->base); > > return ret; > } Reviewed-by: Martin Krastev -- Regards, Martin

Re: [PATCH] drm/vmwgfx: Unmap the surface before resetting it on a plane state

2024-01-03 Thread Martin Krastev
Great catch! That was a nasty one. Reviewed-by: Martin Krastev Regards, Martin On Sun, Dec 24, 2023 at 7:29 AM Zack Rusin wrote: > Switch to a new plane state requires unreferencing of all held surfaces. > In the work required for mob cursors the mapped surfaces started being &g

Re: [PATCH] drm/vmwgfx: Fix possible null pointer derefence with invalid contexts

2024-01-11 Thread Martin Krastev
on to discover it. > Niels De Graef who reported it and helped to track down the poc. > > Fixes: 9c079b8ce8bf ("drm/vmwgfx: Adapt execbuf to the new validation api") > Cc: # v4.20+ > Reported-by: Niels De Graef > Signed-off-by: Zack Rusin > Cc: Martin Krastev &g

Re: [PATCH 5/5] drm/vmwgfx: Fix the lifetime of the bo cursor memory

2024-01-27 Thread Martin Krastev
- const int ret = ttm_bo_reserve(>bo->tbo, true, false, > NULL); > - > - if (likely(ret == 0)) { > - ttm_bo_kunmap(>bo->map); > - ttm_bo_unreserve(>bo->tbo); > - } > - } > - > vmw_du_cursor_plane_unmap_cm(vps); > vmw_du_put_cursor_mob(vcp, vps); > > -- > 2.40.1 > LGTM! Reviewed-by: Martin Krastev Regards, Martin

Re: [PATCH] drm/vmwgfx: Enable DMA mappings with SEV

2024-04-09 Thread Martin Krastev
as(CC_ATTR_MEM_ENCRYPT)) > dev_priv->map_mode = vmw_dma_alloc_coherent; > else if (vmw_restrict_iommu) > dev_priv->map_mode = vmw_dma_map_bind; > -- > 2.40.1 LGTM! Reviewed-by: Martin Krastev Regards, Martin

Re: [PATCH 2/5] drm/vmwgfx: Implement virtual crc generation

2024-04-09 Thread Martin Krastev
On Wed, Apr 3, 2024 at 2:28 AM Zack Rusin wrote: > > crc checksums are used to validate the output. Normally they're part > of the actual display hardware but on virtual stack there's nothing > to automatically generate them. > > Implement crc generation for the vmwgfx stack. This works only on >

Re: [PATCH 4/5] drm/vmwgfx: Fix crtc's atomic check conditional

2024-04-09 Thread Martin Krastev
but broken userspace might expect > +* some actual rendering so give a clue as why it's blank. > +*/ > + if (new_state->enable && !has_primary) > + drm_dbg_driver(>drm, > + "CRTC without a primary plane will be > blank.\n"); > > > if (new_state->connector_mask != connector_mask && > -- > 2.40.1 > LGTM! Reviewed-by: Martin Krastev Regards, Martin

Re: [PATCH 3/5] drm/vmwgfx: Fix prime import/export

2024-04-09 Thread Martin Krastev
Great to have this! Reviewed-by: Martin Krastev Regards, Martin On Wed, Apr 3, 2024 at 2:28 AM Zack Rusin wrote: > > vmwgfx never supported prime import of external buffers. Furthermore the > driver exposes two different objects to userspace: vmw_surface's and > gem buffers but

Re: [PATCH v2 0/5] drm/vmwgfx: vblank and crc generation support

2024-04-12 Thread Martin Krastev
| 632 + > drivers/gpu/drm/vmwgfx/vmwgfx_vkms.h | 75 +++ > 17 files changed, 965 insertions(+), 109 deletions(-) > create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c > create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_vkms.h > > -- > 2.40.1 > LGTM to the series. Signed-off-by: Martin Krastev Regards, Martin

Re: [PATCH] drm/vmwgfx: Fix Legacy Display Unit

2024-04-26 Thread Martin Krastev
Good catch! Reviewed-by: Martin Krastev Regards, Martin On Thu, Apr 25, 2024 at 11:07 PM Ian Forbes wrote: > > Legacy DU was broken by the referenced fixes commit because the placement > and the busy_placement no longer pointed to the same object. This was later > fixed indirect

Re: [PATCH] drm/vmwgfx: Fix invalid reads in fence signaled events

2024-04-26 Thread Martin Krastev
LGTM! Reviewed-by: Martin Krastev Regards, Martin On Thu, Apr 25, 2024 at 10:27 PM Zack Rusin wrote: > > Correctly set the length of the drm_event to the size of the structure > that's actually used. > > The length of the drm_event was set to the parent st

Re: [PATCH v2 0/5] drm/vmwgfx: vblank and crc generation support

2024-04-15 Thread Martin Krastev
On Fri, Apr 12, 2024 at 5:36 PM Martin Krastev wrote: > > On Fri, Apr 12, 2024 at 5:55 AM Zack Rusin wrote: > > > > vmwgfx didn't have support for vblank or crc generation which made it > > impossible to use a large number of IGT tests to properly test DRM > &g

Re: [PATCH] drm/vmwgfx: Keep a gem reference to user bos in surfaces

2023-09-28 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM Reviewed-by: Martin Krastev Regards, Martin On 28.09.23 г. 7:13 ч., Zack Rusin wrote: From: Zack Rusin Surfaces can be backed (i.e. stored in) memory objects (mob's) which are created and managed by the userspace as GEM buffers. Surfaces grab only a ttm

Re: [PATCH] drm/vmwgfx: Fix possible invalid drm gem put calls

2023-08-18 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 18 Aug 2023 04:13:14, Zack Rusin wrote: >From: Zack Rusin > >vmw_bo_unreference sets the input buffer to null on exit, resulting in >null ptr deref's on the subsequent drm gem put calls. > >T

Re: [PATCH v2] drm/vmwgfx: Fix gem refcounting and memory evictions

2022-04-20 Thread Martin Krastev (VMware)
From: Martin Krastev From: Zack Rusin Date: Wed, 20 Apr 2022 at 07:03 Subject: [PATCH v2] drm/vmwgfx: Fix gem refcounting and memory evictions To: Cc: , From: Zack Rusin v2: Add the last part of the ref count fix which was spotted by Philipp Sieweck where the ref count of cpu writers

Re: [PATCH 2/6] drm/vmwgfx: Create mouse hotspot properties on cursor planes

2022-06-03 Thread Martin Krastev (VMware)
From: Martin Krastev On 2.06.22 г. 18:42 ч., Zack Rusin wrote: From: Zack Rusin Atomic modesetting got support for mouse hotspots via the hotspot properties. Drivers need to create those properties on cursor planes which require the mouse hotspot coordinates. Add the code creating hotspot

Re: [PATCH v2 3/8] drm/vmwgfx: Use the hotspot properties from cursor planes

2022-07-25 Thread Martin Krastev (VMware)
From: Martin Krastev On 12.07.22 г. 6:32 ч., Zack Rusin wrote: From: Zack Rusin Atomic modesetting got support for mouse hotspots via the hotspot properties. Port the legacy kms hotspot handling to the new properties on cursor planes. Signed-off-by: Zack Rusin Cc: Martin Krastev Cc: Maaz

Re: [PATCH v3 17/17] drm/vmwgfx: Fix a sparse warning in kernel docs

2022-10-21 Thread Martin Krastev (VMware)
From: Martin Krastev On 21.10.22 г. 6:44 ч., Zack Rusin wrote: From: Zack Rusin Fixes a warning about extra docs about a function argument that has been removed a while back: drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:3888: warning: Excess function parameter 'sync_file' description

Re: [PATCH] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl()

2022-09-17 Thread Martin Krastev (VMware)
Thank you for the catch! Reviewed-by: Martin Krastev Regards, Martin On 16.09.22 г. 23:47 ч., Rafael Mendonca wrote: If the copy of the description string from userspace fails, then the page for the instance descriptor doesn't get freed before returning -EFAULT, which leads to a memleak

Re: [PATCH] drm/ttm: Fix a regression causing kernel oops'es

2023-01-11 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 11.01.23 г. 19:50 ч., Zack Rusin wrote: From: Zack Rusin The branch is explicitly taken if ttm == NULL which means that to avoid a null pointer reference the ttm object can not be used inside. Switch back

Re: [PATCH] drm/vmwgfx: Remove rcu locks from user resources

2022-12-07 Thread Martin Krastev (VMware)
From: Martin Krastev Looks good! Reviewed-by: Martin Krastev Regards, Martin On 7.12.22 г. 19:29 ч., Zack Rusin wrote: From: Zack Rusin User resource lookups used rcu to avoid two extra atomics. Unfortunately the rcu paths were buggy and it was easy to make the driver crash

Re: [PATCH] drm/vmwgfx: Don't use screen objects when SEV is active

2022-12-01 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 1.12.22 г. 19:53 ч., Zack Rusin wrote: From: Zack Rusin When SEV is enabled gmr's and mob's are explicitly disabled because the encrypted system memory can not be used by the hypervisor. The driver

Re: [PATCH 1/7] drm/vmwgfx: Use the common gem mmap instead of the custom code

2023-01-27 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 26.01.23 г. 19:38 ч., Zack Rusin wrote: From: Zack Rusin Before vmwgfx supported gem it needed to implement the entire mmap logic explicitly. With GEM support that's not needed and the generic code can be used

Re: [PATCH 2/7] drm/vmwgfx: Remove the duplicate bo_free function

2023-01-27 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 26.01.23 г. 19:38 ч., Zack Rusin wrote: From: Zack Rusin Remove the explicit bo_free parameter which was switching between vmw_bo_bo_free and vmw_gem_destroy which had exactly the same implementation. It makes

Re: [PATCH 5/7] drm/vmwgfx: Cleanup the vmw bo usage in the cursor paths

2023-01-27 Thread Martin Krastev (VMware)
From: Martin Krastev Ah, good! Reviewed-by: Martin Krastev Regards, Martin On 26.01.23 г. 19:38 ч., Zack Rusin wrote: From: Zack Rusin Base mapped count is useless because the ttm unmap functions handle null maps just fine so completely remove all the code related to it. Rename dummy

Re: [PATCH 4/7] drm/vmwgfx: Simplify fb pinning

2023-01-27 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 26.01.23 г. 19:38 ч., Zack Rusin wrote: From: Zack Rusin Only the legacy display unit requires pinning of the fb memory in vram. Both the screen objects and screen targets can present from any buffer. That makes

Re: [PATCH 3/7] drm/vmwgfx: Rename vmw_buffer_object to vmw_bo

2023-01-27 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 26.01.23 г. 19:38 ч., Zack Rusin wrote: From: Zack Rusin The rest of the drivers which are using ttm have mostly standardized on driver_prefix_bo as the name for subclasses of the TTM buffer object. Make vmwgfx

Re: [PATCH v2] drm/vmwgfx: Protect pin_user_pages with mmap_lock

2022-11-07 Thread Martin Krastev (VMware)
From: Martin Krastev Thanks for the catch. LGTM, with the following remarks: 1) Original design used erroneously pin_user_pages() in place of pin_user_pages_fast(); you could just substitute pin_user_pages for pin_user_pages_fast and call it a day, Please, consider that option after

Re: [PATCH v3] drm/vmwgfx: Fix race issue calling pin_user_pages

2022-11-09 Thread Martin Krastev (VMware)
From: Martin Krastev Looks great! Reviewed-by: Martin Krastev Regards, Martin On 9.11.22 г. 17:37 ч., Dawei Li wrote: pin_user_pages() is unsafe without protection of mmap_lock, fix it by calling pin_user_pages_fast(). Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-

Re: [PATCH v2 6/8] drm/vmwgfx: Rename dummy to is_iomem

2023-01-31 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM Reviewed-by: Martin Krastev Regards, Martin On 31.01.23 г. 5:35 ч., Zack Rusin wrote: From: Zack Rusin Rename dummy to is_iomem because that's what it is even if we're not activelly using it. Makes the code easier to read. Signed-off-by: Zack Rusin

Re: [PATCH v2 7/8] drm/vmwgfx: Abstract placement selection

2023-01-31 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM Reviewed-by: Martin Krastev Regards, Martin On 31.01.23 г. 5:35 ч., Zack Rusin wrote: From: Zack Rusin Problem with explicit placement selection in vmwgfx is that by the time the buffer object needs to be validated the information about which placement

Re: [PATCH v2 8/8] drm/vmwgfx: Stop using raw ttm_buffer_object's

2023-01-31 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 31.01.23 г. 5:35 ч., Zack Rusin wrote: From: Zack Rusin Various bits of the driver used raw ttm_buffer_object instead of the driver specific vmw_bo object. All those places used to duplicate the mapped bo caching

Re: [PATCH v2 1/8] drm/vmwgfx: Use the common gem mmap instead of the custom code

2023-01-31 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM Reviewed-by: Martin Krastev Regards, Martin On 31.01.23 г. 5:35 ч., Zack Rusin wrote: From: Zack Rusin Before vmwgfx supported gem it needed to implement the entire mmap logic explicitly. With GEM support that's not needed and the generic code can be used

Re: [PATCH] drm/vmwgfx: Fix src/dst_pitch confusion

2023-03-15 Thread Martin Krastev (VMware)
From: Martin Krastev We reviewers botched that one. Reviewed-by: Martin Krastev Regards, Martin On 14.03.23 г. 23:14 ч., Zack Rusin wrote: From: Zack Rusin The src/dst_pitch got mixed up during the rework of the function, make sure the offset's refer to the correct one. Spotted

Re: [PATCH 2/3] drm/vmwgfx: Print errors when running on broken/unsupported configs

2023-03-21 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 21.03.23 г. 4:09 ч., Zack Rusin wrote: From: Zack Rusin virtualbox implemented an incomplete version of the svga device which they decided to drop soon after the initial release. The device was always broken

Re: [PATCH] drm/atomic-helper: Do not assume vblank is always present

2023-04-05 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM! Reviewed-by: Martin Krastev Regards, Martin On 5.04.23 г. 7:56 ч., Zack Rusin wrote: From: Zack Rusin Many drivers (in particular all of the virtualized drivers) do not implement vblank handling. Assuming vblank is always present leads to crashes. Fix

Re: [PATCH] drm/vmwgfx: Stop accessing buffer objects which failed init

2023-02-09 Thread Martin Krastev (VMware)
From: Martin Krastev Much nicer now. Reviewed-by: Martin Krastev Regards, Martin On 8.02.23 г. 20:00 ч., Zack Rusin wrote: From: Zack Rusin ttm_bo_init_reserved on failure puts the buffer object back which causes it to be deleted, but kfree was still being called on the same buffer

Re: [PATCH v2] drm/vmwgfx: Do not drop the reference to the handle too soon

2023-02-09 Thread Martin Krastev (VMware)
From: Martin Krastev LGTM Reviewed-by: Martin Krastev Regards, Martin On 9.02.23 г. 14:37 ч., Zack Rusin wrote: From: Zack Rusin v2: Update the commit message to include note describing why the second usag of vmw_gem_object_create_with_handle in vmwgfx_surface.c wasn't changed

Re: [PATCH] drm/vmwgfx: Do not drop the reference to the handle too soon

2023-02-09 Thread Martin Krastev (VMware)
From: Martin Krastev Looks good to me. Reviewed-by: Martin Krastev Regards, Martin On 8.02.23 г. 23:53 ч., Zack Rusin wrote: From: Zack Rusin It is possible for userspace to predict the next buffer handle and to destroy the buffer while it's still used by the kernel. Delay dropping

Re: [PATCH] drm/vmwgfx: Fix shader stage validation

2023-06-17 Thread Martin Krastev (VMware)
From: Martin Krastev Looks good! Reviewed-by: Martin Krastev Regards, Martin On 16.06.23 г. 22:09 ч., Zack Rusin wrote: From: Zack Rusin For multiple commands the driver was not correctly validating the shader stages resulting in possible kernel oopses. The validation code was only

Re: [PATCH v3 3/8] drm/vmwgfx: Use the hotspot properties from cursor planes

2023-06-27 Thread Martin Krastev (VMware)
From: Martin Krastev Looks good. Reviewed-by: Martin Krastev Regards, Martin On 27.06.23 г. 6:58 ч., Zack Rusin wrote: From: Zack Rusin Atomic modesetting got support for mouse hotspots via the hotspot properties. Port the legacy kms hotspot handling to the new properties on cursor