[RFC PATCH] drm/ttm, drm/vmwgfx: Have TTM support AMD SEV encryption

2019-05-24 Thread VMware
From: Thomas Hellstrom With SEV encryption, all DMA memory must be marked decrypted (AKA "shared") for devices to be able to read it. In the future we might want to be able to switch normal (encrypted) memory to decrypted in exactly the same way as we handle caching states, and that would require

[PATCH v4 6/9] drm/vmwgfx: Implement an infrastructure for write-coherent resources

2019-06-11 Thread VMware
ivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c @@ -0,0 +1,409 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/****** + * + * Copyright 2019 VMware, Inc., Palo Alto, CA., USA + * + * Permission is hereby granted, free of charge,

[PATCH v4 9/9] drm/vmwgfx: Add surface dirty-tracking callbacks

2019-06-11 Thread VMware
From: Thomas Hellstrom Add the callbacks necessary to implement emulated coherent memory for surfaces. Add a flag to the gb_surface_create ioctl to indicate that surface memory should be coherent. Also bump the drm minor version to signal the availability of coherent surfaces. Signed-off-by: Tho

[PATCH v4 0/9] Emulated coherent graphics memory

2019-06-11 Thread VMware
Planning to merge this through the drm/vmwgfx tree soon, so if there are any objections, please speak up. Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU o

[PATCH v4 7/9] drm/vmwgfx: Use an RBtree instead of linked list for MOB resources

2019-06-11 Thread VMware
From: Thomas Hellstrom With emulated coherent memory we need to be able to quickly look up a resource from the MOB offset. Instead of traversing a linked list with O(n) worst case, use an RBtree with O(log n) worst case complexity. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat ---

[PATCH v4 8/9] drm/vmwgfx: Implement an infrastructure for read-coherent resources

2019-06-11 Thread VMware
From: Thomas Hellstrom Similar to write-coherent resources, make sure that from the user-space point of view, GPU rendered contents is automatically available for reading by the CPU. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |

[PATCH v4 5/9] drm/ttm: TTM fault handler helpers

2019-06-11 Thread VMware
From: Thomas Hellstrom With the vmwgfx dirty tracking, the default TTM fault handler is not completely sufficient (vmwgfx need to modify the vma->vm_flags member, and also needs to restrict the number of prefaults). We also want to replicate the new ttm_bo_vm_reserve() functionality So start tu

[PATCH v4 4/9] drm/ttm: Allow the driver to provide the ttm struct vm_operations_struct

2019-06-11 Thread VMware
From: Thomas Hellstrom Add a pointer to the struct vm_operations_struct in the bo_device, and assign that pointer to the default value currently used. The driver can then optionally modify that pointer and the new value can be used for each new vma created. Cc: "Christian König" Signed-off-by

Re: [PATCH v4 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-11 Thread VMware
Hi, Nadav, On 6/11/19 7:21 PM, Nadav Amit wrote: On Jun 11, 2019, at 5:24 AM, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom [ snip ] +/** + * apply_pt_wrprotect - Leaf pte callback to write-protect a pte + * @pte: Pointer to the pte + * @token: Page table token, see

Re: [PATCH v4 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-11 Thread VMware
On 6/11/19 9:10 PM, Nadav Amit wrote: On Jun 11, 2019, at 11:26 AM, Thomas Hellström (VMware) wrote: Hi, Nadav, On 6/11/19 7:21 PM, Nadav Amit wrote: On Jun 11, 2019, at 5:24 AM, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom [ snip ] +/** + * apply_pt_wrprotect - Leaf pte

[PATCH 1/2] drm/vmwgfx: Use the backdoor port if the HB port is not available

2019-06-11 Thread VMware
...@vger.kernel.org Fixes: 89da76fde68d ("drm/vmwgfx: Add VMWare host messaging capability") Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 146 ++-- 1 file changed, 117 insertions(+), 29 deletions(-) diff --git a/drive

[PATCH 2/2] drm/vmwgfx: Honor the sg list segment size limitation

2019-06-11 Thread VMware
From: Thomas Hellstrom When building sg tables, honor the device sg list segment size limitation. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu

[PATCH v5 6/9] drm/vmwgfx: Implement an infrastructure for write-coherent resources

2019-06-11 Thread VMware
ivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c @@ -0,0 +1,409 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/****** + * + * Copyright 2019 VMware, Inc., Palo Alto, CA., USA + * + * Permission is hereby granted, free of charge,

[PATCH v5 8/9] drm/vmwgfx: Implement an infrastructure for read-coherent resources

2019-06-11 Thread VMware
From: Thomas Hellstrom Similar to write-coherent resources, make sure that from the user-space point of view, GPU rendered contents is automatically available for reading by the CPU. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |

[PATCH v5 9/9] drm/vmwgfx: Add surface dirty-tracking callbacks

2019-06-11 Thread VMware
From: Thomas Hellstrom Add the callbacks necessary to implement emulated coherent memory for surfaces. Add a flag to the gb_surface_create ioctl to indicate that surface memory should be coherent. Also bump the drm minor version to signal the availability of coherent surfaces. Signed-off-by: Tho

[PATCH v5 7/9] drm/vmwgfx: Use an RBtree instead of linked list for MOB resources

2019-06-11 Thread VMware
From: Thomas Hellstrom With emulated coherent memory we need to be able to quickly look up a resource from the MOB offset. Instead of traversing a linked list with O(n) worst case, use an RBtree with O(log n) worst case complexity. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat ---

[PATCH v5 2/9] mm: Add an apply_to_pfn_range interface

2019-06-11 Thread VMware
From: Thomas Hellstrom This is basically apply_to_page_range with added functionality: Allocating missing parts of the page table becomes optional, which means that the function can be guaranteed not to error if allocation is disabled. Also passing of the closure struct and callback function beco

[PATCH v5 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-11 Thread VMware
on large accesses into small memory regions. The added file "as_dirty_helpers.c" is initially listed as maintained by VMware under our DRM driver. If somebody would like it elsewhere, that's of course no problem. Notable changes since RFC: - Added comments to help avoid the usage of

[PATCH v5 5/9] drm/ttm: TTM fault handler helpers

2019-06-11 Thread VMware
From: Thomas Hellstrom With the vmwgfx dirty tracking, the default TTM fault handler is not completely sufficient (vmwgfx need to modify the vma->vm_flags member, and also needs to restrict the number of prefaults). We also want to replicate the new ttm_bo_vm_reserve() functionality So start tu

[PATCH v5 0/9] Emulated coherent graphics memory

2019-06-11 Thread VMware
Planning to merge this through the drm/vmwgfx tree soon, so if there are any objections, please speak up. Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU o

[PATCH v5 1/9] mm: Allow the [page|pfn]_mkwrite callbacks to drop the mmap_sem

2019-06-11 Thread VMware
From: Thomas Hellstrom Driver fault callbacks are allowed to drop the mmap_sem when expecting long hardware waits to avoid blocking other mm users. Allow the mkwrite callbacks to do the same by returning early on VM_FAULT_RETRY. In particular we want to be able to drop the mmap_sem when waiting

[PATCH v5 4/9] drm/ttm: Allow the driver to provide the ttm struct vm_operations_struct

2019-06-11 Thread VMware
From: Thomas Hellstrom Add a pointer to the struct vm_operations_struct in the bo_device, and assign that pointer to the default value currently used. The driver can then optionally modify that pointer and the new value can be used for each new vma created. Cc: "Christian König" Signed-off-by

[PATCH v4 2/9] mm: Add an apply_to_pfn_range interface

2019-06-11 Thread VMware
From: Thomas Hellstrom This is basically apply_to_page_range with added functionality: Allocating missing parts of the page table becomes optional, which means that the function can be guaranteed not to error if allocation is disabled. Also passing of the closure struct and callback function beco

[PATCH v4 1/9] mm: Allow the [page|pfn]_mkwrite callbacks to drop the mmap_sem

2019-06-11 Thread VMware
From: Thomas Hellstrom Driver fault callbacks are allowed to drop the mmap_sem when expecting long hardware waits to avoid blocking other mm users. Allow the mkwrite callbacks to do the same by returning early on VM_FAULT_RETRY. In particular we want to be able to drop the mmap_sem when waiting

[PATCH v4 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-11 Thread VMware
on large accesses into small memory regions. The added file "as_dirty_helpers.c" is initially listed as maintained by VMware under our DRM driver. If somebody would like it elsewhere, that's of course no problem. Notable changes since RFC: - Added comments to help avoid the usage of

Re: [PATCH v5 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-12 Thread VMware
On 6/12/19 1:23 PM, Christoph Hellwig wrote: On Wed, Jun 12, 2019 at 08:42:37AM +0200, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom Add two utilities to a) write-protect and b) clean all ptes pointing into a range of an address space. The utilities are intended to aid in tracking

Re: [PATCH v5 2/9] mm: Add an apply_to_pfn_range interface

2019-06-12 Thread VMware
On 6/12/19 2:16 PM, Christoph Hellwig wrote: On Wed, Jun 12, 2019 at 08:42:36AM +0200, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom This is basically apply_to_page_range with added functionality: Allocating missing parts of the page table becomes optional, which means that the

[PATCH v6 4/9] drm/ttm: Allow the driver to provide the ttm struct vm_operations_struct

2019-06-12 Thread VMware
From: Thomas Hellstrom Add a pointer to the struct vm_operations_struct in the bo_device, and assign that pointer to the default value currently used. The driver can then optionally modify that pointer and the new value can be used for each new vma created. Cc: "Christian König" Signed-off-by

[PATCH v6 7/9] drm/vmwgfx: Use an RBtree instead of linked list for MOB resources

2019-06-12 Thread VMware
From: Thomas Hellstrom With emulated coherent memory we need to be able to quickly look up a resource from the MOB offset. Instead of traversing a linked list with O(n) worst case, use an RBtree with O(log n) worst case complexity. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat ---

[PATCH v6 6/9] drm/vmwgfx: Implement an infrastructure for write-coherent resources

2019-06-12 Thread VMware
ivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c @@ -0,0 +1,409 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/****** + * + * Copyright 2019 VMware, Inc., Palo Alto, CA., USA + * + * Permission is hereby granted, free of charge,

[PATCH v6 8/9] drm/vmwgfx: Implement an infrastructure for read-coherent resources

2019-06-12 Thread VMware
From: Thomas Hellstrom Similar to write-coherent resources, make sure that from the user-space point of view, GPU rendered contents is automatically available for reading by the CPU. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |

[PATCH v6 5/9] drm/ttm: TTM fault handler helpers

2019-06-12 Thread VMware
From: Thomas Hellstrom With the vmwgfx dirty tracking, the default TTM fault handler is not completely sufficient (vmwgfx need to modify the vma->vm_flags member, and also needs to restrict the number of prefaults). We also want to replicate the new ttm_bo_vm_reserve() functionality So start tu

[PATCH v6 0/9] Emulated coherent graphics memory

2019-06-12 Thread VMware
Planning to merge this through the drm/vmwgfx tree soon, so if there are any objections, please speak up. Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU o

[PATCH v6 9/9] drm/vmwgfx: Add surface dirty-tracking callbacks

2019-06-12 Thread VMware
From: Thomas Hellstrom Add the callbacks necessary to implement emulated coherent memory for surfaces. Add a flag to the gb_surface_create ioctl to indicate that surface memory should be coherent. Also bump the drm minor version to signal the availability of coherent surfaces. Signed-off-by: Tho

[PATCH v6 2/9] mm: Add an apply_to_pfn_range interface

2019-06-12 Thread VMware
From: Thomas Hellstrom This is basically apply_to_page_range with added functionality: Allocating missing parts of the page table becomes optional, which means that the function can be guaranteed not to error if allocation is disabled. Also passing of the closure struct and callback function beco

[PATCH v6 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-12 Thread VMware
on large accesses into small memory regions. The added file "as_dirty_helpers.c" is initially listed as maintained by VMware under our DRM driver. If somebody would like it elsewhere, that's of course no problem. Notable changes since RFC: - Added comments to help avoid the usage of

[PATCH v6 1/9] mm: Allow the [page|pfn]_mkwrite callbacks to drop the mmap_sem

2019-06-12 Thread VMware
From: Thomas Hellstrom Driver fault callbacks are allowed to drop the mmap_sem when expecting long hardware waits to avoid blocking other mm users. Allow the mkwrite callbacks to do the same by returning early on VM_FAULT_RETRY. In particular we want to be able to drop the mmap_sem when waiting

[PATCH v7 0/9] Emulated coherent graphics memory

2019-06-17 Thread VMware
Planning to merge this through the drm/vmwgfx tree soon, so if there are any objections, please speak up. Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU o

[PATCH v7 9/9] drm/vmwgfx: Add surface dirty-tracking callbacks

2019-06-17 Thread VMware
From: Thomas Hellstrom Add the callbacks necessary to implement emulated coherent memory for surfaces. Add a flag to the gb_surface_create ioctl to indicate that surface memory should be coherent. Also bump the drm minor version to signal the availability of coherent surfaces. Signed-off-by: Tho

[PATCH v7 3/9] mm: Add write-protect and clean utilities for address space ranges

2019-06-17 Thread VMware
on large accesses into small memory regions. The added file "as_dirty_helpers.c" is initially listed as maintained by VMware under our DRM driver. If somebody would like it elsewhere, that's of course no problem. Notable changes since RFC: - Added comments to help avoid the usage of

[PATCH v7 8/9] drm/vmwgfx: Implement an infrastructure for read-coherent resources

2019-06-17 Thread VMware
From: Thomas Hellstrom Similar to write-coherent resources, make sure that from the user-space point of view, GPU rendered contents is automatically available for reading by the CPU. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |

[PATCH v7 4/9] drm/ttm: Allow the driver to provide the ttm struct vm_operations_struct

2019-06-17 Thread VMware
From: Thomas Hellstrom Add a pointer to the struct vm_operations_struct in the bo_device, and assign that pointer to the default value currently used. The driver can then optionally modify that pointer and the new value can be used for each new vma created. Cc: "Christian König" Signed-off-by

[PATCH v7 5/9] drm/ttm: TTM fault handler helpers

2019-06-17 Thread VMware
From: Thomas Hellstrom With the vmwgfx dirty tracking, the default TTM fault handler is not completely sufficient (vmwgfx need to modify the vma->vm_flags member, and also needs to restrict the number of prefaults). We also want to replicate the new ttm_bo_vm_reserve() functionality So start tu

[PATCH v7 1/9] mm: Allow the [page|pfn]_mkwrite callbacks to drop the mmap_sem

2019-06-17 Thread VMware
From: Thomas Hellstrom Driver fault callbacks are allowed to drop the mmap_sem when expecting long hardware waits to avoid blocking other mm users. Allow the mkwrite callbacks to do the same by returning early on VM_FAULT_RETRY. In particular we want to be able to drop the mmap_sem when waiting

[PATCH v7 7/9] drm/vmwgfx: Use an RBtree instead of linked list for MOB resources

2019-06-17 Thread VMware
From: Thomas Hellstrom With emulated coherent memory we need to be able to quickly look up a resource from the MOB offset. Instead of traversing a linked list with O(n) worst case, use an RBtree with O(log n) worst case complexity. Signed-off-by: Thomas Hellstrom Reviewed-by: Deepak Rawat ---

[PATCH v7 6/9] drm/vmwgfx: Implement an infrastructure for write-coherent resources

2019-06-17 Thread VMware
ivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c @@ -0,0 +1,409 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/****** + * + * Copyright 2019 VMware, Inc., Palo Alto, CA., USA + * + * Permission is hereby granted, free of charge,

[PATCH v7 2/9] mm: Add an apply_to_pfn_range interface

2019-06-17 Thread VMware
From: Thomas Hellstrom This is basically apply_to_page_range with added functionality: Allocating missing parts of the page table becomes optional, which means that the function can be guaranteed not to error if allocation is disabled. Also passing of the closure struct and callback function beco

[PATCH 2/4] drm/vmwgfx: Add debug message for layout change ioctl

2019-06-17 Thread VMware
From: Deepak Rawat Add debug code to check user-space layout change request. Signed-off-by: Deepak Rawat Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 8 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 8 2 files changed, 16 insertions(+) diff --git a/driver

[PATCH 1/4] drm/vmwgfx: Assign eviction priorities to resources

2019-06-17 Thread VMware
From: Thomas Hellstrom TTM provides a means to assign eviction priorities to buffer object. This means that all buffer objects with a lower priority will be evicted first on memory pressure. Use this to make sure surfaces and in particular non-dirty surfaces are evicted first. Evicting in particu

[PATCH 3/4] drm/vmwgfx: Use VMW_DEBUG_KMS for vmwgfx mode-setting user errors

2019-06-17 Thread VMware
From: Deepak Rawat For errors during layout change ioctl use VMW_DEBUG_KMS instead of DRM_ERROR. Signed-off-by: Deepak Rawat Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/d

[PATCH 4/4] drm/vmwgfx: Kill unneeded legacy security features

2019-06-17 Thread VMware
From: Thomas Hellstrom At one point, the GPU command verifier and user-space handle manager couldn't properly protect GPU clients from accessing each other's data. Instead there was an elaborate mechanism to make sure only the active master's primary clients could render. The other clients were e

[git pull] vmwgfx-fixes-5.2

2019-06-18 Thread VMware
Dave, Daniel, A couple of fixes for vmwgfx. Two fixes for a DMA sg-list debug warning message. These are not cc'd stable since there is no evidence of actual breakage. On fix for the high-bandwidth backdoor port which is cc'd stable due to upcoming hardware, on which the code would otherwise break

[git pull] vmwgfx-next

2019-06-19 Thread VMware
Dave, Daniel - The coherent memory changes including mm changes. - Some vmwgfx debug fixes. - Removal of vmwgfx legacy security checks. The following changes since commit 561564bea3248293398dc32ec36da40fb71faed0: Merge tag 'omapdrm-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/l

Re: [PATCH v2 00/18] drm/ttm: make ttm bo a gem bo subclass

2019-06-21 Thread VMware
On 6/21/19 1:57 PM, Gerd Hoffmann wrote: Aargh. Please don't do this. Multiple reasons: 1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, h

Re: drm pull for v5.3-rc1

2019-07-15 Thread VMware
Hi, All. On 7/15/19 8:00 PM, Linus Torvalds wrote: On Mon, Jul 15, 2019 at 10:37 AM Linus Torvalds wrote: I'm not pulling this. Why did you merge it into your tree, when apparently you were aware of how questionable it is judging by the drm pull request. Looking at some of the fallout, I also

[PATCH v7 4/8] mm: Add write-protect and clean utilities for address space ranges

2019-11-07 Thread VMware
From: Thomas Hellstrom Add two utilities to 1) write-protect and 2) clean all ptes pointing into a range of an address space. The utilities are intended to aid in tracking dirty pages (either driver-allocated system memory or pci device memory). The write-protect utility should be used in conjunc

[PATCH v7 1/8] mm: Remove BUG_ON mmap_sem not held from xxx_trans_huge_lock()

2019-11-07 Thread VMware
From: Thomas Hellstrom The caller needs to make sure that the vma is not torn down during the lock operation and can also use the i_mmap_rwsem for file-backed vmas. Remove the BUG_ON. We could, as an alternative, add a test that either vma->vm_mm->mmap_sem or vma->vm_file->f_mapping->i_mmap_rwsem

[PATCH v7 3/8] mm: Add a walk_page_mapping() function to the pagewalk code

2019-11-07 Thread VMware
From: Thomas Hellstrom For users that want to travers all page table entries pointing into a region of a struct address_space mapping, introduce a walk_page_mapping() function. The walk_page_mapping() function will be initially be used for dirty- tracking in virtual graphics drivers. Cc: Andrew

[PATCH v7 2/8] mm: pagewalk: Take the pagetable lock in walk_pte_range()

2019-11-07 Thread VMware
From: Thomas Hellstrom Without the lock, anybody modifying a pte from within this function might have it concurrently modified by someone else. Cc: Matthew Wilcox Cc: Will Deacon Cc: Peter Zijlstra Cc: Rik van Riel Cc: Minchan Kim Cc: Michal Hocko Cc: Huang Ying Cc: Jérôme Glisse Cc: Kir

[PATCH v7 7/8] drm/vmwgfx: Implement an infrastructure for read-coherent resources

2019-11-07 Thread VMware
From: Thomas Hellstrom Similar to write-coherent resources, make sure that from the user-space point of view, GPU rendered contents is automatically available for reading by the CPU. Cc: Andrew Morton Cc: Matthew Wilcox Cc: Will Deacon Cc: Peter Zijlstra Cc: Rik van Riel Cc: Minchan Kim Cc

[PATCH v7 6/8] drm/vmwgfx: Use an RBtree instead of linked list for MOB resources

2019-11-07 Thread VMware
From: Thomas Hellstrom With emulated coherent memory we need to be able to quickly look up a resource from the MOB offset. Instead of traversing a linked list with O(n) worst case, use an RBtree with O(log n) worst case complexity. Cc: Andrew Morton Cc: Matthew Wilcox Cc: Will Deacon Cc: Pete

[PATCH v7 8/8] drm/vmwgfx: Add surface dirty-tracking callbacks

2019-11-07 Thread VMware
From: Thomas Hellstrom Add the callbacks necessary to implement emulated coherent memory for surfaces. Add a flag to the gb_surface_create ioctl to indicate that surface memory should be coherent. Also bump the drm minor version to signal the availability of coherent surfaces. Cc: Andrew Morton

[PATCH v7 5/8] drm/vmwgfx: Implement an infrastructure for write-coherent resources

2019-11-07 Thread VMware
/null +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c @@ -0,0 +1,421 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/****** + * + * Copyright 2019 VMware, Inc., Palo Alto, CA., USA + * + * Permission is hereby granted, free of char

[PATCH v7 0/8] Emulated coherent graphics memory take 2

2019-11-07 Thread VMware
From: Thomas Hellström Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU operation that touches that memory, and the CPU sees any content written by the GPU

[PATCH] drm/vmwgfx: Use coherent memory if there are dma mapping size restrictions

2019-11-13 Thread VMware
From: Thomas Hellstrom We're gradually moving towards using DMA coherent memory in most situations, although TTM interactions with the DMA layers is still a work-in-progress. Meanwhile, use coherent memory when there are size restrictions meaning that there is a chance that streaming dma mapping

[PATCH] drm/vmwgfx: remove set but not used variable 'srf'

2019-11-13 Thread VMware
From: YueHaibing drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:339:22: warning: variable srf set but not used [-Wunused-but-set-variable] 'srf' is never used, so can be removed. Signed-off-by: YueHaibing Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 -- 1 file chan

[PATCH] drm/vmwgfx: Use dma-coherent memory for high-bandwidth port messaging

2019-11-13 Thread VMware
From: Thomas Hellstrom With AMD-SEV high-bandwidth port messaging runs into trouble since the message content is encrypted using the vm-specific key, and the hypervisor is unable to read it. So use unencrypted dma-coherent bounce buffers for temporary message storage space. Allocating that memor

[git pull] vmwgfx-coherent

2019-11-13 Thread VMware
Dave, Daniel, Take 2 of the coherent memory patches are now ready for pulling. Following the discussion we had after the last merge attempt that had to be reverted, it might make sense to send this to Linus as a pull request separate from other DRM stuff. This time Linus has been heavily involved

Re: [PATCH] drm/vmwgfx: Use coherent memory if there are dma mapping size restrictions

2019-11-13 Thread VMware
Hi, On 11/13/19 3:16 PM, Christoph Hellwig wrote: On Wed, Nov 13, 2019 at 10:51:43AM +0100, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom We're gradually moving towards using DMA coherent memory in most situations, although TTM interactions with the DMA layers is still a wo

Re: drm/vmwgfx: Use dma-coherent memory for high-bandwidth port messaging

2019-11-13 Thread VMware
Hi, Nathan, On 11/13/19 9:01 PM, Nathan Chancellor wrote: On Wed, Nov 13, 2019 at 10:51:42AM +0100, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom With AMD-SEV high-bandwidth port messaging runs into trouble since the message content is encrypted using the vm-specific key, and the

[PATCH 3/3] drm/vmwgfx: Use coherent memory if there are dma mapping size restrictions

2019-11-14 Thread VMware
From: Thomas Hellstrom We're gradually moving towards using DMA coherent memory in most situations, although TTM interactions with the DMA layers is still a work-in-progress. Meanwhile, use coherent memory when there are size restrictions meaning that there is a chance that streaming dma mapping

[PATCH 1/3] drm/vmwgfx: Remove the vmw_dma_phys mode code

2019-11-14 Thread VMware
From: Thomas Hellstrom This mode is not used anymore. Remove the dead code. Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c| 4 +--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h| 1 - drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 9 - 3 files changed, 1 in

[PATCH 2/3] drm/vmwgfx: Remove the restrict_dma_mask module parameter

2019-11-14 Thread VMware
From: Thomas Hellstrom The restrict_dma_mask was mainly used for iommu functionality debugging and has no use anymore. Remove it. Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vmwg

[PATCH 0/3] drm/vmwgfx: Clean- and fix up DMA mode selection

2019-11-14 Thread VMware
From: Thomas Hellstrom (VMware) Clean up and fix dma mode selection. We remove an unused mode, a largely unused module option and finally add a check to enable dma coherent memory in those cases streaming dma mappings are undesired or won't work. Note that this series is intended to be ap

Re: [PATCH 3/3] drm/vmwgfx: Use coherent memory if there are dma mapping size restrictions

2019-11-14 Thread VMware
On 11/14/19 1:40 PM, Christoph Hellwig wrote: On Thu, Nov 14, 2019 at 11:56:45AM +0100, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom We're gradually moving towards using DMA coherent memory in most situations, although TTM interactions with the DMA layers is still a wo

[git pull] vmwgfx-next

2019-11-14 Thread VMware
Dave, Daniel Two minor cleanups / fixes for -next. The following changes since commit 3ca3a9eab7085b3c938b5d088c3020269cfecdc8: Merge tag 'drm-misc-next-fixes-2019-11-06' of git://anongit.freedesktop.org/drm/drm-misc into drm-next (2019-11-08 16:48:22 +1000) are available in the Git reposit

[PATCH v4 2/2] mm, drm/ttm: Fix vm page protection handling

2019-12-12 Thread VMware
From: Thomas Hellstrom TTM graphics buffer objects may, transparently to user-space, move between IO and system memory. When that happens, all PTEs pointing to the old location are zapped before the move and then faulted in again if needed. When that happens, the page protection caching mode- an

[PATCH v4 0/2] mm, drm/ttm: Fix pte insertion with customized protection

2019-12-12 Thread VMware
From: Thomas Hellstrom The drm/ttm module is using a modified on-stack copy of the struct vm_area_struct to be able to set a page protection with customized caching. Fix that by adding a vmf_insert_mixed_prot() function similar to the existing vmf_insert_pfn_prot() for use with drm/ttm. I'd like

[PATCH v4 1/2] mm: Add a vmf_insert_mixed_prot() function

2019-12-12 Thread VMware
From: Thomas Hellstrom The TTM module today uses a hack to be able to set a different page protection than struct vm_area_struct::vm_page_prot. To be able to do this properly, add the needed vm functionality as vmf_insert_mixed_prot(). Cc: Andrew Morton Cc: Michal Hocko Cc: "Matthew Wilcox (Or

Ack to merge through DRM tree? WAS [PATCH v4 0/2] mm, drm/ttm: Fix pte insertion with customized protection

2019-12-20 Thread VMware
Andrew, On 12/12/19 9:47 AM, Thomas Hellström (VMware) wrote: From: Thomas Hellstrom The drm/ttm module is using a modified on-stack copy of the struct vm_area_struct to be able to set a page protection with customized caching. Fix that by adding a vmf_insert_mixed_prot() function similar to

Re: [PATCH 2/3] drm/ttm: always keep BOs on the LRU

2019-10-18 Thread VMware
Hi, Christian, On 10/16/19 11:30 AM, Christian König wrote: Am 25.09.19 um 14:10 schrieb Christian König: Am 25.09.19 um 14:06 schrieb Thomas Hellström (VMware): On 9/25/19 12:55 PM, Christian König wrote: This allows blocking for BOs to become available in the memory management. Amdgpu is

Re: [PATCH 2/3] drm/ttm: always keep BOs on the LRU

2019-10-21 Thread VMware
On 10/18/19 3:49 PM, Thomas Hellström (VMware) wrote: Hi, Christian, On 10/16/19 11:30 AM, Christian König wrote: Am 25.09.19 um 14:10 schrieb Christian König: Am 25.09.19 um 14:06 schrieb Thomas Hellström (VMware): On 9/25/19 12:55 PM, Christian König wrote: This allows blocking for BOs

Re: [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2

2020-02-18 Thread VMware
On 2/17/20 6:55 PM, Daniel Vetter wrote: On Mon, Feb 17, 2020 at 04:45:09PM +0100, Christian König wrote: Implement the importer side of unpinned DMA-buf handling. v2: update page tables immediately Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 66

Re: [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2

2020-02-18 Thread VMware
On 2/18/20 10:01 PM, Daniel Vetter wrote: On Tue, Feb 18, 2020 at 9:17 PM Thomas Hellström (VMware) wrote: On 2/17/20 6:55 PM, Daniel Vetter wrote: On Mon, Feb 17, 2020 at 04:45:09PM +0100, Christian König wrote: Implement the importer side of unpinned DMA-buf handling. v2: update page

Re: [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2

2020-02-20 Thread VMware
On 2/19/20 7:42 AM, Thomas Hellström (VMware) wrote: On 2/18/20 10:01 PM, Daniel Vetter wrote: On Tue, Feb 18, 2020 at 9:17 PM Thomas Hellström (VMware) wrote: On 2/17/20 6:55 PM, Daniel Vetter wrote: On Mon, Feb 17, 2020 at 04:45:09PM +0100, Christian König wrote: Implement the importer

[PATCH v4 2/9] mm: Introduce vma_is_special_huge

2020-02-20 Thread VMware
From: Thomas Hellstrom 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_normal_page(): "Special" mappings do

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

2020-02-20 Thread VMware
From: Thomas Hellstrom 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 Glisse" Cc: "Christian König" Cc: Dan Williams S

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

2020-02-20 Thread VMware
From: Thomas Hellstrom The vma argument is only dereferenced for reading. Cc: Andrew Morton Cc: Michal Hocko Cc: "Matthew Wilcox (Oracle)" Cc: "Kirill A. Shutemov" Cc: Ralph Campbell Cc: "Jérôme Glisse" Cc: "Christian König" Cc: Dan Williams Signed-off-by: Thomas Hellstrom Reviewed-by:

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

2020-02-20 Thread VMware
From: Thomas Hellstrom 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 determine when it might be

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

2020-02-20 Thread VMware
From: Thomas Hellstrom 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 Wilcox (Oracle)" Cc: "Kiri

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

2020-02-20 Thread VMware
166 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Huge page-table-entry support for IO memory. + * + * Copyright (C) 2007-2019 Vmware, Inc. All rights reservedd. + */ +#include "vmwgfx_drv.h" +#include +#include +#include + +/** + * struct vmw_thp_manager - Range manager impl

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

2020-02-20 Thread VMware
From: Thomas Hellstrom We currently only do COW and write-notify on the PTE level, so if the huge_fault() handler returns VM_FAULT_FALLBACK on wp faults, split the huge pages and page-table entries. Also do this for huge PUDs if there is no huge_fault() handler and the vma is not anonymous, simil

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

2020-02-20 Thread VMware
From: Thomas Hellstrom 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: Ralph Campbell Cc: "Jérôme Glisse" Cc: "Christ

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

2020-02-20 Thread VMware
In order to reduce TLB misses and CPU usage 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 when splitting huge- and giant page table entries, (

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

2020-02-20 Thread VMware
From: Thomas Hellstrom 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 the kernel needs to be

Re: [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2

2020-02-20 Thread VMware
On 2/20/20 7:04 PM, Daniel Vetter wrote: On Thu, Feb 20, 2020 at 10:39:06AM +0100, Thomas Hellström (VMware) wrote: On 2/19/20 7:42 AM, Thomas Hellström (VMware) wrote: On 2/18/20 10:01 PM, Daniel Vetter wrote: On Tue, Feb 18, 2020 at 9:17 PM Thomas Hellström (VMware) wrote: On 2/17/20 6:55

Re: [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2

2020-02-20 Thread VMware
On 2/20/20 9:08 PM, Daniel Vetter wrote: On Thu, Feb 20, 2020 at 08:46:27PM +0100, Thomas Hellström (VMware) wrote: On 2/20/20 7:04 PM, Daniel Vetter wrote: On Thu, Feb 20, 2020 at 10:39:06AM +0100, Thomas Hellström (VMware) wrote: On 2/19/20 7:42 AM, Thomas Hellström (VMware) wrote: On 2/18

Re: [PATCH 3/8] drm/vmwgfx: don't use ttm bo->offset

2020-02-21 Thread VMware
On 2/19/20 2:53 PM, Nirmoy Das wrote: Calculate GPU offset within vmwgfx driver itself without depending on bo->offset Signed-off-by: Nirmoy Das Acked-by: Christian König Tested-by: Thomas Hellstrom Acked-by: Thomas Hellstrom ___ dri-devel mail

Re: [PATCH v3 0/8] do not store GPU address in TTM

2020-02-21 Thread VMware
Hi, On 2/19/20 2:53 PM, Nirmoy Das wrote: With this patch series I am trying to remove GPU address dependency in TTM and moving GPU address calculation to individual drm drivers. For future reference, could you please add a motivation for the series? for example cleanup, needed because, simpli

Re: [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2

2020-02-21 Thread VMware
On 2/21/20 6:12 PM, Daniel Vetter wrote: On Thu, Feb 20, 2020 at 11:51:07PM +0100, Thomas Hellström (VMware) wrote: On 2/20/20 9:08 PM, Daniel Vetter wrote: On Thu, Feb 20, 2020 at 08:46:27PM +0100, Thomas Hellström (VMware) wrote: On 2/20/20 7:04 PM, Daniel Vetter wrote: On Thu, Feb 20

  1   2   3   4   5   >