Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-04-24 Thread Michael S. Tsirkin
On Wed, Apr 24, 2019 at 10:01:56PM -0300, Thiago Jung Bauermann wrote: > > Michael S. Tsirkin writes: > > > On Wed, Apr 17, 2019 at 06:42:00PM -0300, Thiago Jung Bauermann wrote: > >> > >> Michael S. Tsirkin writes: > >> > >> > On Thu, Mar 21, 2019 at 09:05:04PM -0300, Thiago Jung Bauermann

Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-04-24 Thread Thiago Jung Bauermann
Michael S. Tsirkin writes: > On Wed, Apr 17, 2019 at 06:42:00PM -0300, Thiago Jung Bauermann wrote: >> >> Michael S. Tsirkin writes: >> >> > On Thu, Mar 21, 2019 at 09:05:04PM -0300, Thiago Jung Bauermann wrote: >> >> >> >> Michael S. Tsirkin writes: >> >> >> >> > On Wed, Mar 20, 2019 at

Re: [PATCH v2 02/17] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|

2019-04-24 Thread Koenig, Christian
Am 24.04.19 um 14:05 schrieb Thomas Zimmermann: > Hi Christian, > > Am 24.04.19 um 13:48 schrieb Thomas Zimmermann: >> + >> +/* >> + * Helpers for struct ttm_bo_driver >> + */ >> + >> +static bool drm_is_gem_vram(struct ttm_buffer_object *bo) >> +{ >> +return (bo->destroy ==

Re: [PATCH v3 1/4] mm/balloon_compaction: list interfaces

2019-04-24 Thread Michael S. Tsirkin
On Tue, Apr 23, 2019 at 04:45:28PM -0700, Nadav Amit wrote: > Introduce interfaces for ballooning enqueueing and dequeueing of a list > of pages. These interfaces reduce the overhead of storing and restoring > IRQs by batching the operations. In addition they do not panic if the > list of pages is

Re: [PATCH v2 00/17] Share TTM code among DRM framebuffer drivers

2019-04-24 Thread Daniel Vetter
On Wed, Apr 24, 2019 at 01:48:25PM +0200, Thomas Zimmermann wrote: > Several simple framebuffer drivers copy most of the TTM code from each > other. The implementation is always the same; except for the name of > some data structures. > > As recently discussed, this patch set provides generic

Re: [PATCH v2 05/17] drm: Add VRAM MM, a simple memory manager for dedicated VRAM

2019-04-24 Thread Daniel Vetter
On Wed, Apr 24, 2019 at 01:48:30PM +0200, Thomas Zimmermann wrote: > The VRAM MM memory manager is a helper library that manages dedicated video > memory of simple framebuffer devices. It is supported to be used with > struct drm_gem_vram_object, but does not depend on it. I'm not sure keeping

Re: [PATCH v2 07/17] drm/ast: Convert AST driver to VRAM MM

2019-04-24 Thread Daniel Vetter
On Wed, Apr 24, 2019 at 01:48:32PM +0200, Thomas Zimmermann wrote: > The data structure |struct drm_vram_mm| and its helpers replace ast's > TTM-based memory manager. It's the same implementation; except for the > type names. > > v2: > * implement ast_mmap() with drm_vram_mm_mmap() > >

Re: [PATCH v2 02/17] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|

2019-04-24 Thread Thomas Zimmermann
Hi Christian, Am 24.04.19 um 13:48 schrieb Thomas Zimmermann: > + > +/* > + * Helpers for struct ttm_bo_driver > + */ > + > +static bool drm_is_gem_vram(struct ttm_buffer_object *bo) > +{ > + return (bo->destroy == ttm_buffer_object_destroy); > +} > + > +/** > + *

[PATCH v2 14/17] drm/vboxvideo: Convert vboxvideo driver to |struct drm_gem_vram_object|

2019-04-24 Thread Thomas Zimmermann
This patch replaces |struct vbox_bo| and its helpers with the generic implementation of |struct drm_gem_vram_object|. The only change in semantics is that _bo_driver.verify_access() now does the actual verification. Signed-off-by: Thomas Zimmermann Reviewed-by: Hans de Goede ---

[PATCH v2 16/17] drm/hisilicon: Convert hibmc-drm driver to |struct drm_gem_vram_object|

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_gem_vram_object| and its helpers replace |struct hibmc_bo|. It's the same implementation; except for the type names. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/hisilicon/hibmc/Kconfig | 1 + .../gpu/drm/hisilicon/hibmc/hibmc_drm_de.c| 21 +-

[PATCH v2 11/17] drm/mgag200: Convert mgag200 driver to |struct drm_gem_vram_object|

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_gem_vram_object| and its helpers replace |struct mgag200_bo|. It's the same implementation; except for the type names. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/Kconfig | 1 + drivers/gpu/drm/mgag200/mgag200_cursor.c | 63 +

[PATCH v2 17/17] drm/hisilicon: Convert hibmc-drm driver to VRAM MM

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_vram_mm| and its helpers replace hibmc's TTM-based memory manager. It's the same implementation; except for the type names. v2: * implement hibmc_mmap() with drm_vram_mm_mmap() Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/hisilicon/hibmc/Kconfig

[PATCH v2 13/17] drm/mgag200: Replace mapping code with drm_gem_vram_{kmap/kunmap}()

2019-04-24 Thread Thomas Zimmermann
The mgag200 driver establishes several memory mappings for frame buffers and cursors. This patch converts the driver to use the equivalent drm_gem_vram_kmap() functions. It removes the dependencies on TTM and cleans up the code. --- drivers/gpu/drm/mgag200/mgag200_cursor.c | 35

[PATCH v2 12/17] drm/mgag200: Convert mgag200 driver to VRAM MM

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_vram_mm| and its helpers replace mgag200's TTM-based memory manager. It's the same implementation; except for the type names. v2: * implement mgag200_mmap() with drm_vram_mm_mmap() Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/Kconfig

[PATCH v2 10/17] drm/bochs: Convert bochs driver to VRAM MM

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_vram_mm| and its helpers replace bochs' TTM-based memory manager. It's the same implementation; except for the type names. v2: * implement bochs_mmap() with drm_vram_mm_mmap() Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/bochs/Kconfig| 1 +

[PATCH v2 15/17] drm/vboxvideo: Convert vboxvideo driver to VRAM MM

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_vram_mm| and its helpers replace vboxvideo's TTM-based memory manager. It's the same implementation; except for the type names. v2: * implement vbox_mmap() with drm_vram_mm_mmap() Signed-off-by: Thomas Zimmermann Reviewed-by: Hans de Goede ---

[PATCH v2 08/17] drm/ast: Replace mapping code with drm_gem_vram_{kmap/kunmap}()

2019-04-24 Thread Thomas Zimmermann
The AST driver establishes several memory mappings for frame buffers and cursors. This patch converts the driver to use the equivalent drm_gem_vram_kmap() functions. It removes the dependencies on TTM and cleans up the code. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/ast/ast_drv.h |

[PATCH v2 09/17] drm/bochs: Convert bochs driver to |struct drm_gem_vram_object|

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_gem_vram_object| and its helpers replace |struct bochs_bo|. It's the same implementation; except for the type names. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/bochs/Kconfig | 1 + drivers/gpu/drm/bochs/bochs.h | 34 +---

[PATCH v2 06/17] drm/ast: Convert AST driver to |struct drm_gem_vram_object|

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_gem_vram_object| and its helpers replace |struct ast_bo|. It's the same implementation; except for the type names. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/ast/Kconfig| 2 +- drivers/gpu/drm/ast/ast_drv.c | 4 +- drivers/gpu/drm/ast/ast_drv.h

[PATCH v2 02/17] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|

2019-04-24 Thread Thomas Zimmermann
The provided helpers can be used for the respective callback functions in |struct ttm_bo_driver|. v2: * drm_is_gem_vram() is now a private function * documentation fixes Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_gem_vram_helper.c | 50 +++

[PATCH v2 07/17] drm/ast: Convert AST driver to VRAM MM

2019-04-24 Thread Thomas Zimmermann
The data structure |struct drm_vram_mm| and its helpers replace ast's TTM-based memory manager. It's the same implementation; except for the type names. v2: * implement ast_mmap() with drm_vram_mm_mmap() Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/ast/Kconfig| 1 +

[PATCH v2 05/17] drm: Add VRAM MM, a simple memory manager for dedicated VRAM

2019-04-24 Thread Thomas Zimmermann
The VRAM MM memory manager is a helper library that manages dedicated video memory of simple framebuffer devices. It is supported to be used with struct drm_gem_vram_object, but does not depend on it. The implementation is based on the respective code from ast, bochs, and mgag200. These drivers

[PATCH v2 01/17] drm: Add |struct drm_gem_vram_object| and helpers

2019-04-24 Thread Thomas Zimmermann
The type |struct drm_gem_vram_object| implements a GEM object for simple framebuffer devices with dedicated video memory. The BO is either located in VRAM or system memory. The implementation has been created from the respective code in ast, bochs and mgag200. These drivers copy their

[PATCH v2 03/17] drm: Add |struct drm_gem_vram_object| callbacks for |struct drm_driver|

2019-04-24 Thread Thomas Zimmermann
The provided helpers can be used for the respective callback functions in |struct drm_driver|. v2: * documentation fixes Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_gem_vram_helper.c | 48 +++ include/drm/drm_gem_vram_helper.h | 10 ++ 2

[PATCH v2 00/17] Share TTM code among DRM framebuffer drivers

2019-04-24 Thread Thomas Zimmermann
Several simple framebuffer drivers copy most of the TTM code from each other. The implementation is always the same; except for the name of some data structures. As recently discussed, this patch set provides generic memory-management code for simple framebuffers with dedicated video memory. It

[PATCH v2 04/17] drm: Add drm_gem_vram_fill_create_dumb() to create dumb buffers

2019-04-24 Thread Thomas Zimmermann
The helper function drm_gem_vram_fill_create_dumb() implements most of struct drm_driver.dumb_create() for GEM-VRAM buffer objects. It's not a full implemenation of the callback, as several driver-specific parameters are still required. v2: * documentation fixes Signed-off-by: Thomas

[PATCH v3 1/4] mm/balloon_compaction: list interfaces

2019-04-24 Thread Nadav Amit via Virtualization
Introduce interfaces for ballooning enqueueing and dequeueing of a list of pages. These interfaces reduce the overhead of storing and restoring IRQs by batching the operations. In addition they do not panic if the list of pages is empty. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc:

[PATCH v3 2/4] vmw_balloon: compaction support

2019-04-24 Thread Nadav Amit via Virtualization
Add support for compaction for VMware balloon. Since unlike the virtio balloon, we also support huge-pages, which are not going through compaction, we keep these pages in vmballoon and handle this list separately. We use the same lock to protect both lists, as this lock is not supposed to be

[PATCH v3 3/4] vmw_balloon: add memory shrinker

2019-04-24 Thread Nadav Amit via Virtualization
Add a shrinker to the VMware balloon to prevent out-of-memory events. We reuse the deflate logic for this matter. Deadlocks should not happen, as no memory allocation is performed while the locks of the communication (batch/page) and page-list are taken. In the unlikely event in which the

[PATCH v3 4/4] vmw_balloon: split refused pages

2019-04-24 Thread Nadav Amit via Virtualization
The hypervisor might refuse to inflate pages. While the balloon driver handles this scenario correctly, a refusal to inflate a 2MB pages might cause the same page to be allocated again later just for its inflation to be refused again. This wastes energy and time. To avoid this situation, split

[PATCH v3 0/4] vmw_balloon: compaction and shrinker support

2019-04-24 Thread Nadav Amit via Virtualization
VMware balloon enhancements: adding support for memory compaction, memory shrinker (to prevent OOM) and splitting of refused pages to prevent recurring inflations. Patches 1-2: Support for compaction Patch 3: Support for memory shrinker - disabled by default Patch 4: Split refused pages to