[PATCH v2 1/4] x86/mm: Export force_dma_unencrypted

2019-09-03 Thread VMware
From: Thomas Hellstrom The force_dma_unencrypted symbol is needed by TTM to set up the correct page protection when memory encryption is active. Export it. Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" C

Re: [PATCH v2 1/4] x86/mm: Export force_dma_unencrypted

2019-09-03 Thread VMware
Hi, Christoph, On 9/3/19 3:46 PM, Christoph Hellwig wrote: On Tue, Sep 03, 2019 at 03:15:01PM +0200, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom The force_dma_unencrypted symbol is needed by TTM to set up the correct page protection when memory encryption is active. Export it

Re: [PATCH v2 1/4] x86/mm: Export force_dma_unencrypted

2019-09-03 Thread VMware
On 9/3/19 5:14 PM, Dave Hansen wrote: On 9/3/19 6:15 AM, Thomas Hellström (VMware) wrote: The force_dma_unencrypted symbol is needed by TTM to set up the correct page protection when memory encryption is active. Export it. It would be great if this had enough background that I didn't ha

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-03 Thread VMware
On 9/3/19 9:55 PM, Dave Hansen wrote: On 9/3/19 12:51 PM, Daniel Vetter wrote: The thing we need to stop is having mixed encryption rules under one VMA. The point here is that we want this. We need to be able to move the buffer between device ptes and system memory ptes, transparently, behind u

Re: [PATCH v2 1/4] x86/mm: Export force_dma_unencrypted

2019-09-03 Thread VMware
On 9/3/19 6:22 PM, Christoph Hellwig wrote: On Tue, Sep 03, 2019 at 04:32:45PM +0200, Thomas Hellström (VMware) wrote: Is this a layer violation concern, that is, would you be ok with a similar helper for TTM, or is it that you want to force the graphics drivers into adhering strictly to the

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-03 Thread VMware
On 9/3/19 10:51 PM, Dave Hansen wrote: On 9/3/19 1:36 PM, Thomas Hellström (VMware) wrote: So the question here should really be, can we determine already at mmap time whether backing memory will be unencrypted and adjust the *real* vma->vm_page_prot under the mmap_sem? Possibly, but t

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-03 Thread VMware
On 9/3/19 11:46 PM, Andy Lutomirski wrote: On Tue, Sep 3, 2019 at 2:05 PM Thomas Hellström (VMware) wrote: On 9/3/19 10:51 PM, Dave Hansen wrote: On 9/3/19 1:36 PM, Thomas Hellström (VMware) wrote: So the question here should really be, can we determine already at mmap time whether backing

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-03 Thread VMware
On 9/4/19 12:08 AM, Thomas Hellström (VMware) wrote: On 9/3/19 11:46 PM, Andy Lutomirski wrote: On Tue, Sep 3, 2019 at 2:05 PM Thomas Hellström (VMware) wrote: On 9/3/19 10:51 PM, Dave Hansen wrote: On 9/3/19 1:36 PM, Thomas Hellström (VMware) wrote: So the question here should really be

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-03 Thread VMware
On 9/4/19 1:15 AM, Andy Lutomirski wrote: On Sep 3, 2019, at 3:15 PM, Thomas Hellström (VMware) wrote: On 9/4/19 12:08 AM, Thomas Hellström (VMware) wrote: On 9/3/19 11:46 PM, Andy Lutomirski wrote: On Tue, Sep 3, 2019 at 2:05 PM Thomas Hellström (VMware) wrote: On 9/3/19 10:51 PM, Dave

Re: [PATCH v2 1/4] x86/mm: Export force_dma_unencrypted

2019-09-04 Thread VMware
On 9/4/19 8:58 AM, Christoph Hellwig wrote: On Tue, Sep 03, 2019 at 10:46:18PM +0200, Thomas Hellström (VMware) wrote: What I mean with "from an engineering perspective" is that drivers would end up with a non-trivial amount of code supporting purely academic cases: Setups wher

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-04 Thread VMware
Hi, Christian, On 9/4/19 9:33 AM, Koenig, Christian wrote: Am 03.09.19 um 23:05 schrieb Thomas Hellström (VMware): On 9/3/19 10:51 PM, Dave Hansen wrote: On 9/3/19 1:36 PM, Thomas Hellström (VMware) wrote: So the question here should really be, can we determine already at mmap time whether

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-04 Thread VMware
Hi, Dave, On 9/4/19 1:10 AM, Dave Hansen wrote: Thomas, this series has garnered a nak and a whole pile of thoroughly confused reviewers. Could you take another stab at this along with a more ample changelog explaining the context of the problem? I suspect that's a better place to start than h

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-04 Thread VMware
On 9/4/19 10:19 AM, Thomas Hellström (VMware) wrote: Hi, Christian, On 9/4/19 9:33 AM, Koenig, Christian wrote: Am 03.09.19 um 23:05 schrieb Thomas Hellström (VMware): On 9/3/19 10:51 PM, Dave Hansen wrote: On 9/3/19 1:36 PM, Thomas Hellström (VMware) wrote: So the question here should

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-04 Thread VMware
On 9/4/19 9:53 AM, Daniel Vetter wrote: On Wed, Sep 4, 2019 at 8:49 AM Thomas Hellström (VMware) wrote: On 9/4/19 1:15 AM, Andy Lutomirski wrote: But, reading this, I have more questions: Can’t you get rid of cvma by using vmf_insert_pfn_prot()? It looks like that, although there are

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-04 Thread VMware
On 9/4/19 1:10 PM, Koenig, Christian wrote: Am 04.09.19 um 10:19 schrieb Thomas Hellström (VMware): Hi, Christian, On 9/4/19 9:33 AM, Koenig, Christian wrote: Am 03.09.19 um 23:05 schrieb Thomas Hellström (VMware): On 9/3/19 10:51 PM, Dave Hansen wrote: On 9/3/19 1:36 PM, Thomas Hellström

Re: [PATCH v2 3/4] drm/ttm, drm/vmwgfx: Correctly support support AMD memory encryption

2019-09-04 Thread VMware
On 9/4/19 2:35 PM, Thomas Hellström (VMware) wrote: I've already talked with Christoph that we probably want to switch TTM over to using that instead to also get rid of the ttm_io_prot() hack. OK, would that mean us ditching other memory modes completely? And on-the-fly caching transi

Re: [PATCH v2 1/4] x86/mm: Export force_dma_unencrypted

2019-09-04 Thread VMware
On 9/4/19 2:22 PM, Christoph Hellwig wrote: On Wed, Sep 04, 2019 at 09:32:30AM +0200, Thomas Hellström (VMware) wrote: That sounds great. Is there anything I can do to help out? I thought this was more or less a dead end since the current dma_mmap_ API requires the mmap_sem to be held in write

Re: [PATCH v2 0/4] Have TTM support SEV encryption with coherent memory

2019-09-05 Thread VMware
On 9/3/19 3:15 PM, Thomas Hellström (VMware) wrote: With SEV memory encryption and in some cases also with SME memory encryption, coherent memory is unencrypted. In those cases, TTM doesn't set up the correct page protection. Fix this by having the TTM coherent page allocator call int

[git pull] vmwgfx-fixes-5.3

2019-09-05 Thread VMware
From: Thomas Hellström Dave, Daniel A single fix from Dan for a previous fix that generated a regression. The following changes since commit 6b7c3b86f0b63134b2ab56508921a0853ffa687a: drm/vmwgfx: fix memory leak when too many retries have occurred (2019-08-08 11:22:54 +0200) are available

TTM huge page-faults WAS: Re: [RFC PATCH 1/2] x86: Don't let pgprot_modify() change the page encryption bit

2019-09-11 Thread VMware
removing people that are probably not interested from CC adding dri-devel On 9/11/19 11:08 AM, Koenig, Christian wrote: Am 10.09.19 um 21:26 schrieb Thomas Hellström (VMware): On 9/10/19 6:11 PM, Andy Lutomirski wrote: On Sep 5, 2019, at 8:24 AM, Christoph Hellwig wrote: On Thu, Sep 05

Re: TTM huge page-faults WAS: Re: [RFC PATCH 1/2] x86: Don't let pgprot_modify() change the page encryption bit

2019-09-11 Thread VMware
On 9/11/19 4:06 PM, Koenig, Christian wrote: Am 11.09.19 um 12:10 schrieb Thomas Hellström (VMware): [SNIP] The problem seen in TTM is that we want to be able to change the vm_page_prot from the fault handler, but it's problematic since we have the mmap_sem typically only in read mode.

[git pull] vmwgfx-fixes-5.3

2019-08-08 Thread VMware
Dave, Daniel A single memory leak fix from Colin Ian King. The following changes since commit f536579c148249505b388d525ac1866e080fd66a: Merge tag 'drm-fixes-5.3-2019-08-07' of git://people.freedesktop.org/~agd5f/linux into drm-fixes (2019-08-08 13:25:50 +1000) are available in the Git repos

Re: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer

2019-08-08 Thread VMware
On 8/8/19 2:02 PM, Daniel Vetter wrote: On Thu, Aug 08, 2019 at 12:35:21PM +0200, Gerd Hoffmann wrote: On Thu, Aug 08, 2019 at 09:48:49AM +, Koenig, Christian wrote: Am 08.08.19 um 11:36 schrieb Gerd Hoffmann: Rename the embedded struct vma_offset_manager, it is named _vma_manager now. tt

[git pull] vmwgfx-next

2019-08-14 Thread VMware
From: Thomas Hellstrom (VMware) Dave, Daniel A couple of independent patches extracted from the 5.3 pull request, fixed for merge conflicts. And the drmP.h removal from Sam. /Thomas The following changes since commit e7f7287bf5f746d29f3607178851246a005dd398: Merge tag 'drm-next-5.4

Re: [git pull] vmwgfx-next

2019-08-14 Thread VMware
On 8/14/19 9:31 AM, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom (VMware) Dave, Daniel A couple of independent patches extracted from the 5.3 pull request, fixed for merge conflicts. Hmm. Just noted an unused variable resulting from one of the commits. Please ignore this for now

[git pull] vmwgfx-next

2019-08-15 Thread VMware
From: Thomas Hellstrom (VMware) Dave, Daniel A couple of independent patches extracted from the 5.3 pull request, fixed for merge conflicts and a single unused variable warning. And the drmP.h removal from Sam. /Thomas The following changes since commit

Separate pull request? WAS: [PATCH v6 0/9] Huge page-table entries for TTM

2020-03-24 Thread VMware
On 3/4/20 11:28 AM, Thomas Hellström (VMware) wrote: In order to reduce CPU usage [1] and in theory TLB misses this patchset enables huge- and giant page-table entries for TTM and TTM-enabled graphics drivers. Patch 1 and 2 introduce a vma_is_special_huge() function to make the mm code take

[PATCH v7 1/9] fs: Constify vma argument to vma_is_dax

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" The function is used by upcoming vma_is_special_huge() with which we want to use a const vma argument. Since for vma_is_dax() the vma argument is only dereferenced for reading, constify it. Cc: Andrew Morton Cc: Michal Hocko Cc: "Matthew Wilco

[PATCH v7 7/9] drm: Add a drm_get_unmapped_area() helper

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" Unaligned virtual addresses makes it unlikely that huge page-table entries can be used. So align virtual buffer object address huge page boundaries to the underlying physical address huge page boundaries taking buffer object sizes into account to dete

[PATCH v7 6/9] drm/vmwgfx: Support huge page faults

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" With vmwgfx dirty-tracking we need a specialized huge_fault callback. Implement and hook it up. Cc: Andrew Morton Cc: Michal Hocko Cc: "Matthew Wilcox (Oracle)" Cc: "Kirill A. Shutemov" Cc: Ralph Campbell Cc: "Jérôme Glis

[PATCH v7 8/9] drm/vmwgfx: Introduce a huge page aligning TTM range manager

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" Using huge page-table entries requires that the physical address of the start of a buffer object is huge page size aligned. Make a special version of the TTM range manager that accomplishes this, but falls back to a smaller page size alignment (PUD

[PATCH v7 9/9] drm/vmwgfx: Hook up the helpers to align buffer objects

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" Start using the helpers that align buffer object user-space addresses and buffer object vram addresses to huge page boundaries. This is to improve the chances of allowing huge page-table entries. Cc: Andrew Morton Cc: Michal Hocko Cc: "Matthew

[PATCH v7 2/9] mm: Introduce vma_is_special_huge

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" For VM_PFNMAP and VM_MIXEDMAP vmas that want to support transhuge pages and -page table entries, introduce vma_is_special_huge() that takes the same codepaths as vma_is_dax(). The use of "special" follows the definition in memory.c, vm_nor

[PATCH v7 3/9] mm: Split huge pages on write-notify or COW

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" The functions wp_huge_pmd() and wp_huge_pud() currently relies on the huge_fault() callback to split huge page table entries if needed. However for module users that requires export of the split_huge_xxx() functionality which may be undesired. Instead

[PATCH v7 4/9] mm: Add vmf_insert_pfn_xxx_prot() for huge page-table entries

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" For graphics drivers needing to modify the page-protection, add huge page-table entries counterparts to vmf_insert_pfn_prot(). Cc: Andrew Morton Cc: Michal Hocko Cc: "Matthew Wilcox (Oracle)" Cc: "Kirill A. Shutemov" Cc: Ralp

[PATCH v7 0/9] Huge page-table entries for TTM

2020-03-24 Thread VMware
From: Thomas Hellstrom (VMware) In order to reduce CPU usage [1] and in theory TLB misses this patchset enables huge- and giant page-table entries for TTM and TTM-enabled graphics drivers. Patch 1 and 2 introduce a vma_is_special_huge() function to make the mm code take the same path as DAX

[PATCH v7 5/9] drm/ttm, drm/vmwgfx: Support huge TTM pagefaults

2020-03-24 Thread VMware
From: "Thomas Hellstrom (VMware)" Support huge (PMD-size and PUD-size) page-table entries by providing a huge_fault() callback. We still support private mappings and write-notify by splitting the huge page-table entries on write-access. Note that for huge page-faults to occur, either

[git pull] ttm-transhuge

2020-03-25 Thread VMware
s to align buffer objects (2020-03-24 18:50:35 +0100) ---- Thomas Hellstrom (VMware) (9): fs: Constify vma argument to vma_is_dax mm: Introduce vma_is_special_huge mm: Split huge pages on write-notify or COW mm: Add vmf_insert_pfn_xxx_prot() for huge page-tabl

Re: Bad rss-counter state from drm/ttm, drm/vmwgfx: Support huge TTM pagefaults

2020-04-06 Thread VMware
On 4/6/20 9:51 PM, Alex Xu (Hello71) wrote: Using 314b658 with amdgpu, starting sway and firefox causes "BUG: Bad rss-counter state" and "BUG: non-zero pgtables_bytes on freeing mm" to start filling dmesg, and then closing programs causes more BUGs and hangs, and then everything grinds to a halt

Re: Bad rss-counter state from drm/ttm, drm/vmwgfx: Support huge TTM pagefaults

2020-04-06 Thread VMware
the attached patch, that'd be great! Thanks, Thomas >From b630b9b4dcc1d01514d97a84cbb7f0cb85333154 Mon Sep 17 00:00:00 2001 From: "Thomas Hellstrom (VMware)" Date: Mon, 6 Apr 2020 22:55:13 +0200 Subject: [PATCH] drm/ttm: Temporarily disable the huge_fault() callback Signed-off-by

Re: Bad rss-counter state from drm/ttm, drm/vmwgfx: Support huge TTM pagefaults

2020-04-07 Thread VMware
On 4/7/20 2:38 AM, Alex Xu (Hello71) wrote: Excerpts from Thomas Hellström (VMware)'s message of April 6, 2020 5:04 pm: Hi, On 4/6/20 9:51 PM, Alex Xu (Hello71) wrote: Using 314b658 with amdgpu, starting sway and firefox causes "BUG: Bad rss-counter state" and "BUG: non-ze

Re: Bad rss-counter state from drm/ttm, drm/vmwgfx: Support huge TTM pagefaults

2020-04-07 Thread VMware
On 4/7/20 5:36 PM, Alex Xu (Hello71) wrote: Excerpts from Thomas Hellström (VMware)'s message of April 7, 2020 7:26 am: On 4/7/20 2:38 AM, Alex Xu (Hello71) wrote: Excerpts from Thomas Hellström (VMware)'s message of April 6, 2020 5:04 pm: Hi, On 4/6/20 9:51 PM, Alex Xu (Hell

[PATCH] drm/ttm: Temporarily disable the huge_fault() callback

2020-04-08 Thread VMware
From: "Thomas Hellstrom (VMware)" With amdgpu and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y, there are errors like: BUG: non-zero pgtables_bytes on freeing mm and: BUG: Bad rss-counter state with TTM transparent huge-pages. Until we've figured out what other TTM drivers do differen

Re: [PATCH] drm/ttm: Temporarily disable the huge_fault() callback

2020-04-08 Thread VMware
Hi, Christian, On 4/8/20 1:53 PM, Thomas Hellström (VMware) wrote: From: "Thomas Hellstrom (VMware)" With amdgpu and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y, there are errors like: BUG: non-zero pgtables_bytes on freeing mm and: BUG: Bad rss-counter state with TTM transparent huge-pa

Re: [PATCH] drm/ttm: Temporarily disable the huge_fault() callback

2020-04-08 Thread VMware
On 4/8/20 2:19 PM, Christian König wrote: Am 08.04.20 um 14:01 schrieb Thomas Hellström (VMware): Hi, Christian, On 4/8/20 1:53 PM, Thomas Hellström (VMware) wrote: From: "Thomas Hellstrom (VMware)" With amdgpu and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y, there are errors like: BUG

[PATCH] drm/ttm: Temporarily disable the huge_fault() callback

2020-04-09 Thread VMware
From: "Thomas Hellstrom (VMware)" With amdgpu and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y, there are errors like: BUG: non-zero pgtables_bytes on freeing mm and: BUG: Bad rss-counter state with TTM transparent huge-pages. Until we've figured out what other TTM drivers do differen

Re: [PATCH] drm/ttm: Temporarily disable the huge_fault() callback

2020-04-09 Thread VMware
Dave, Christian, Could any of you pick this up (I'm currently on vacation) to have a chance of getting it in before -rc1? Thanks, Thomas On 4/9/20 6:49 PM, Thomas Hellström (VMware) wrote: From: "Thomas Hellstrom (VMware)" With amdgpu and CONFIG_TRANSPARENT_HUGEPAGE_ALWA

[git pull] vmwgfx-fixes-5.2

2019-05-22 Thread Thomas Hellstrom (VMware)
Dave, Daniel A set of misc fixes for various issues that have surfaced recently. All Cc'd stable except the dma iterator fix which shouldn't really cause any real issues on older kernels. The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9: Linux 5.2-rc1 (2019-05-19 15:

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 pr

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

2022-04-20 Thread Martin Krastev (VMware)
h XA state tracker which is used for xrender acceleration on xf86-video-vmware, apps/tests which use a lot of memory (a good test being the piglit's streaming-texture-leak) and desktops. Signed-off-by: Zack Rusin Fixes: 8afa13a0583f ("drm/vmwgfx: Implement DRIVER_GEM") Reporte

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

2022-09-16 Thread Martin Krastev (VMware)
mleak. Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats") Signed-off-by: Rafael Mendonca --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c ind

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

[git-pull] vmwgfx-next

2020-03-16 Thread Thomas Hellstrom (VMware)
Dave, Daniel, The first vmwgfx-next pull for 5.7. Roland Scheidegger will follow up with a larger pull request for functionality needed for GL4 support. - Disable DMA when using SEV encryption - An -RT fix - Code cleanups Thanks, Thomas The following changes since commit d3bd37f587b4438d47751d0

[git pull] feature/staging_sm5

2020-03-20 Thread Roland Scheidegger (VMware)
/vmwgfx: Add SM5 param for userspace Thomas Hellström (VMware) (1): drm/vmwgfx: Use vmwgfx version 2.18 to signal SM5 compatibility drivers/gpu/drm/vmwgfx/Makefile| 2 +- drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h | 161 - .../gpu/drm/vmwgfx/device_include

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

2023-01-27 Thread Martin Krastev (VMware)
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/** - * - * Copyright 2009-2011 VMware, Inc., Palo Alto, CA., USA - * - * Permission is hereby granted, free of

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 no

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

2023-01-27 Thread Martin Krastev (VMware)
/** * - * Copyright © 2011-2018 VMware, Inc., Palo Alto, CA., USA + * Copyright © 2011-2023 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -26,55 +26,54

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

2023-01-27 Thread Martin Krastev (VMware)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 OR MIT */ /****** * - * Copyright 2009-2022 VMware, Inc., Palo Alto, CA., USA + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining

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 to

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

2023-01-31 Thread Martin Krastev (VMware)
file mode 100644 index 265f7c48d856.. --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/** - * - * Copyright 2009-2011 VMware, Inc

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

2023-01-31 Thread Martin Krastev (VMware)
*/ -int vmw_kms_stdu_dma(struct vmw_private *dev_priv, -struct drm_file *file_priv, -struct vmw_framebuffer *vfb, -struct drm_vmw_fence_rep __user *user_fence_rep, -struct drm_clip_rect *clips, -struct

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 --- driv

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 "Maaz Mombasawala (VMware)
drm/vmwgfx/vmwgfx_ttm_glue.c > deleted file mode 100644 > index 265f7c48d856.. > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c > +++ /dev/null > @@ -1,110 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 OR MIT > -/

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
scrn.c > @@ -445,7 +445,7 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane, > vmw_overlay_pause_all(dev_priv); > ret = vmw_bo_create(dev_priv, size, > &vmw_vram_placement, > - false, true, &vmw_bo_bo_free, &vps->bo); > + false, true, &vps->bo); > vmw_overlay_resume_all(dev_priv); > if (ret) { > vps->bo = NULL; /* vmw_bo_init frees on error */ > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c > index 108a496b5d18..93b1400aed4a 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c > @@ -893,7 +893,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv, > return -EINVAL; > > ret = vmw_bo_create(dev_priv, size, &vmw_sys_placement, > - true, true, vmw_bo_bo_free, &buf); > + true, true, &buf); > if (unlikely(ret != 0)) > goto out; > LGTM! Reviewed-by: Maaz Mombasawala -- Maaz Mombasawala (VMware)

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
s/gpu/drm/vmwgfx/vmwgfx_bo.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c > @@ -1,7 +1,7 @@ > // SPDX-License-Identifier: GPL-2.0 OR MIT > /** > * > - * Copyright © 2011-2018 VMware, Inc., Palo Alto, CA., USA > + * Copyright © 2011-2023 VMware,

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
vmw_private *dev_priv, > if (ret) > return ERR_PTR(ret); > > - vfb->pin = vmw_framebuffer_pin; > - vfb->unpin = vmw_framebuffer_unpin; > - > return vfb; > } > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h > b/dr

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
gt; *plane, > hotspot_x, hotspot_y); > } > > - if (vps->bo) { > - if (ttm_kmap_obj_virtual(&vps->bo->map, &dummy)) > - atomic_dec(&vps->bo->base_mapped_count); > - } > - > du->cursor_x = new_state->crtc_x + du->set_gui_x; > du->cursor_y = new_state->crtc_y + du->set_gui_y; > LGTM! Reviewed-by: Maaz Mombasawala -- Maaz Mombasawala (VMware)

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
_mapped) { > vmw_bo_unmap(vps->surf->res.backup); > vps->surf_mapped = false; > } > > - if (vps->bo && ttm_kmap_obj_virtual(&vps->bo->map, &dummy)) { > + if (vps->bo && ttm_kmap_obj_virtual(&vps->bo->map, &is_iomem)) { > const int ret = ttm_bo_reserve(&vps->bo->base, true, false, > NULL); > > if (likely(ret == 0)) { LGTM! Reviewed-by: Maaz Mombasawala -- Maaz Mombasawala (VMware)

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
dst_pitch = ddirty->pitch; > + dst_bo = &ddirty->buf->base; > + dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; > > (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, > src_bo, src_of

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

2023-01-31 Thread "Maaz Mombasawala (VMware)
On 1/30/23 19: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 policy of vmw_bo. > > Instead of duplicating all of that code and special ca

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

2023-02-08 Thread "Maaz Mombasawala (VMware)
x/vmwgfx_surface.c > @@ -867,7 +867,6 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void > *data, > goto out_unlock; > } > vmw_bo_reference(res->guest_memory_bo); > - drm_gem_object_get(&res->guest_memory_bo->tbo.base); > } > > tmp = vmw_resource_reference(&srf->res); LGTM! Reviewed-by: Maaz Mombasawala -- Maaz Mombasawala (VMware)

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

2023-02-08 Thread "Maaz Mombasawala (VMware)
vmw_bo_create(dev_priv, ¶ms, p_vbo); > - > - (*p_vbo)->tbo.base.funcs = &vmw_gem_object_funcs; > if (ret != 0) > goto out_no_bo; > > + (*p_vbo)->tbo.base.funcs = &vmw_gem_object_funcs; > + > ret = drm_gem_handle_create(filp, &(*p_vbo)->tbo.base, handle); > /* drop reference from allocate - handle holds it now */ > drm_gem_object_put(&(*p_vbo)->tbo.base); LGTM! Reviewed-by: Maaz Mombasawala -- Maaz Mombasawala (VMware)

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 the

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 It is pos

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 in vmw

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 to dst_m

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 in 'vmw_exec

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

2022-10-21 Thread "Maaz Mombasawala (VMware)
> * This function copies fence information to user-space. If copying fails, > the > * user-space struct drm_vmw_fence_rep::error member is hopefully left -- Looks good. Reviewed-by: Maaz Mombasawala Maaz Mombasawala (VMware)

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

2022-11-07 Thread Martin Krastev (VMware)
is unsafe without protection of mmap_lock, fix it by calling mmap_read_lock() & mmap_read_unlock(). 2) fix & refactor the incorrect exception handling procedure in vmw_mksstat_add_ioctl(). Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats") Signed-off

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] 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 was disabli

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

2022-12-01 Thread "Maaz Mombasawala (VMware)
gt; struct drm_device *dev = &dev_priv->drm; > int i; > > + /* Screen objects won't work if GMR's aren't available */ > + if (!dev_priv->has_gmr) > + return -ENOSYS; > + > if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) { > return -ENOSYS; > } LGTM -- Maaz Mombasawala (VMware)

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 by submitt

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

2022-12-07 Thread "Maaz Mombasawala (VMware)
+ vmw_val_add_flag_none); > + if (unlikely(ret != 0)){ > + vmw_resource_unreference(&res); > return ret; > + } > > sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); > sw_context->man = vmw_context_res_man(res); > > + vmw_resource_unreference(&res); > return 0; > } > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c > index f66caa540e14..c7d645e5ec7b 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c > @@ -281,39 +281,6 @@ int vmw_user_resource_lookup_handle(struct vmw_private > *dev_priv, > return ret; > } > > -/** > - * vmw_user_resource_noref_lookup_handle - lookup a struct resource from a > - * TTM user-space handle and perform basic type checks > - * > - * @dev_priv: Pointer to a device private struct > - * @tfile:Pointer to a struct ttm_object_file identifying the caller > - * @handle: The TTM user-space handle > - * @converter:Pointer to an object describing the resource type > - * > - * If the handle can't be found or is associated with an incorrect resource > - * type, -EINVAL will be returned. > - */ > -struct vmw_resource * > -vmw_user_resource_noref_lookup_handle(struct vmw_private *dev_priv, > - struct ttm_object_file *tfile, > - uint32_t handle, > - const struct vmw_user_resource_conv > - *converter) > -{ > - struct ttm_base_object *base; > - > - base = ttm_base_object_noref_lookup(tfile, handle); > - if (!base) > - return ERR_PTR(-ESRCH); > - > - if (unlikely(ttm_base_object_type(base) != converter->object_type)) { > - ttm_base_object_noref_release(); > - return ERR_PTR(-EINVAL); > - } > - > - return converter->base_obj_to_res(base); > -} > - > /* > * Helper function that looks either a surface or bo. > * -- Maaz Mombasawala (VMware)

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

2023-04-05 Thread Martin Krastev (VMware)
crashes by making sure the device supports vblank before using it. Fixes crashes on boot, as in: Oops: [#1] PREEMPT SMP PTI CPU: 0 PID: 377 Comm: systemd-modules Not tainted 6.3.0-rc4-vmwgfx #1 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11

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 by cla

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 in

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

2023-03-21 Thread "Maaz Mombasawala (VMware)
> __printf(1, 2) int vmw_host_printf(const char *fmt, ...); > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c > index ca1a3fe44fa5..2651fe0ef518 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c > @@ -1179,3 +1179,12 @@ int vmw_mksstat_remove_ioctl(struct drm_device *dev, > void *data, > > return -EAGAIN; > } > + > +/** > + * vmw_disable_backdoor: Disables all backdoor communication > + * with the hypervisor. > + */ > +void vmw_disable_backdoor(void) > +{ > + vmw_msg_enabled = 0; > +} LGTM Reviewed-by: Maaz Mombasawala -- Maaz Mombasawala (VMware)

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

2023-06-16 Thread Maaz Mombasawala (VMWare)
LGTM. Reviewed-by: Maaz Mombasawala Maaz Mombasawala (VMware) On 6/16/2023 12:09 PM, 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. if ever, checking the

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

2023-06-17 Thread Martin Krastev (VMware)
. if ever, checking the upper bound on the shader stages but never a lower bound (valid shader stages start at 1 not 0). Fixes kernel oopses ending up in vmw_binding_add, e.g.: Oops: [#1] PREEMPT SMP PTI CPU: 1 PID: 2443 Comm: testcase Not tainted 6.3.0-rc4-vmwgfx #1 Hardware name: VMware, Inc

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 pl

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. > >This went unnoticed be

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

2023-08-23 Thread Maaz Mombasawala (VMWare)
LGTM! Reviewed-by: Maaz Mombasawala Maaz Mombasawala (VMware) On 8/17/2023 9:13 PM, 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. This went unnoticed because only ver

[PATCH] drm/vmwgfx: fix update of display surface when resolution changes

2020-07-13 Thread Roland Scheidegger (VMware)
From: Roland Scheidegger The assignment of metadata overwrote the new display resolution values, hence we'd miss the size actually changed and wouldn't redefine the surface. This would then lead to command buffer error when trying to update the screen target (due to the size mismatch), and result

[git pull] vmwgfx-fixes-5.8

2020-07-15 Thread Roland Scheidegger (VMware)
Dave, Daniel, vmwgfx-fixes pull for 5.8. Just one fix for now, but it's a really important one, causing black screens in VMs (sometimes on boot), hence marking it for stable. The following changes since commit 1f054fd26e29784d373c3d29c348ee48f1c41fb2: drm/vmwgfx: fix update of display surface

[PATCH v2 10/17] drm/vmwgfx: Add support for indirect and dispatch commands

2020-03-23 Thread Roland Scheidegger (VMware)
From: Deepak Rawat Validate indirect and dispatch commands in command buffer. Signed-off-by: Deepak Rawat Reviewed-by: Thomas Hellström (VMware) Reviewed-by: Roland Scheidegger Signed-off-by: Roland Scheidegger --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 70 + 1

[PATCH v2 07/17] drm/vmwgfx: Read new register for GB memory when available

2020-03-23 Thread Roland Scheidegger (VMware)
From: Deepak Rawat Virtual device added new register for suggested GB memory, read the new register when available. Signed-off-by: Deepak Rawat Reviewed-by: Thomas Hellström (VMware) Reviewed-by: Roland Scheidegger Signed-off-by: Roland Scheidegger --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

[PATCH v2 00/17] drm/vmwgfx add support for GL4

2020-03-23 Thread Roland Scheidegger (VMware)
This series updates vmwgfx to support newer vmware svga device protocol and expose new commands to userspace.. This is required for supporting newer GL4 features in the guest. This syncs up the device headers, adds support for the new commands, and also refactors some code (in particular around

[PATCH v2 15/17] drm/vmwgfx: Add surface define v4 command

2020-03-23 Thread Roland Scheidegger (VMware)
Rawat Reviewed-by: Thomas Hellström (VMware) Reviewed-by: Roland Scheidegger Signed-off-by: Roland Scheidegger --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 36 +++-- include/uapi/drm/vmwgfx_drm.h | 12 + 3

<    1   2   3   4   5   >