Re: [Bug] virtio-gpu broken with qemu/kvm on arm64 on kernel 5.5+

2020-02-26 Thread Gerd Hoffmann
Hi, > > ... into 5.6-rc3 fixes the corruption for me. > > I tried those 2 patches on top of kernel 5.6-rc3 and they indeed fix the > problem. > > I applied them on top of 5.5.6 and they also fix the problem! > Could we get those 2 patches applied to stable 5.5, please? Series just re-posted.

[PATCH v5 2/3] drm/virtio: fix mmap page attributes

2020-02-26 Thread Gerd Hoffmann
virtio-gpu uses cached mappings, set drm_gem_shmem_object.map_cached accordingly. Cc: sta...@vger.kernel.org Fixes: c66df701e783 ("drm/virtio: switch from ttm to gem shmem helpers") Reported-by: Gurchetan Singh Reported-by: Guillaume Gardet Signed-off-by: Gerd Hoffmann --- drive

[PATCH v5 3/3] drm/udl: simplify gem object mapping.

2020-02-26 Thread Gerd Hoffmann
ff-by: Gerd Hoffmann --- drivers/gpu/drm/udl/udl_gem.c | 62 ++- 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index b6e26f98aa0a..7e3a88b25b6b 100644 --- a/drivers/gpu/drm/udl/udl_gem.c

[PATCH v5 1/3] drm/shmem: add support for per object caching flags.

2020-02-26 Thread Gerd Hoffmann
Add map_cached bool to drm_gem_shmem_object, to request cached mappings on a per-object base. Check the flag before adding writecombine to pgprot bits. Cc: sta...@vger.kernel.org Signed-off-by: Gerd Hoffmann --- include/drm/drm_gem_shmem_helper.h | 5 + drivers/gpu/drm

[PATCH v5 0/3] drm/virtio: fix mmap page attributes

2020-02-26 Thread Gerd Hoffmann
v5: rebase, add tags, add cc stable for 1+2, no code changes. v4: back to v2-ish design, but simplified a bit. v3: switch to drm_gem_object_funcs callback. v2: make shmem helper caching configurable. Gerd Hoffmann (3): drm/shmem: add support for per object caching flags. drm/virtio: fix mmap

Re: RFC: drm/virtio: Dummy virtio GPU

2020-02-25 Thread Gerd Hoffmann
> > No. > > > > First, what is wrong with vkms? > The total lines of vkms driver is 1.2k+. Which is small for a drm driver. > I think it doesn't work along > itself to provide things like mmap on prime fd? (I tried it months > ago). Seems vkms only supports prime import, not prime export. Maybe

Re: [Bug] virtio-gpu broken with qemu/kvm on arm64 on kernel 5.5+

2020-02-25 Thread Gerd Hoffmann
Hi, > > Perhaps try the entire series? > > > > https://patchwork.kernel.org/cover/11300619/ Latest version is at: https://git.kraxel.org/cgit/linux/log/?h=drm-virtio-no-wc > Applied entire series on top of 5.5.6, but still the same problem. Can you double-check? Cherry-picking the shmem

Re: RFC: drm/virtio: Dummy virtio GPU

2020-02-25 Thread Gerd Hoffmann
On Mon, Feb 24, 2020 at 03:01:54PM -0800, Lepton Wu wrote: > Hi, > > I'd like to get comments on this before I polish it. This is a > simple way to get something similar with vkms but it heavily reuse > the code provided by virtio-gpu. Please feel free to give me any > feedbacks or comments. No.

Re: [PATCH 2/2] drm/virtio: Support virtgpu exported resources

2020-02-24 Thread Gerd Hoffmann
Hi, > +struct dma_buf *virtgpu_gem_prime_export(struct drm_gem_object *obj, > + int flags) > +{ [ ... ] > +} > + > +struct drm_gem_object *virtgpu_gem_prime_import(struct drm_device *dev, > + struct dma_buf *buf) >

Re: [PATCH 1/2] virtio: add dma-buf support for exported objects

2020-02-24 Thread Gerd Hoffmann
On Wed, Feb 19, 2020 at 05:06:36PM +0900, David Stevens wrote: > This change adds a new flavor of dma-bufs that can be used by virtio > drivers to share exported objects. A virtio dma-buf can be queried by > virtio drivers to obtain the UUID which identifies the underlying > exported object. That

Re: [PATCH v2] drm/virtio: fix resource id creation race

2020-02-24 Thread Gerd Hoffmann
On Thu, Feb 20, 2020 at 02:53:19PM -0800, John Bates wrote: > The previous code was not thread safe and caused > undefined behavior from spurious duplicate resource IDs. > In this patch, an atomic_t is used instead. We no longer > see any duplicate IDs in tests with this change. > > Fixes: 16065fc

Re: [PATCH 4/4 v6] drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl

2020-02-24 Thread Gerd Hoffmann
On Fri, Feb 21, 2020 at 04:54:02PM -0800, Gurchetan Singh wrote: > On Fri, Feb 21, 2020 at 3:06 PM Chia-I Wu wrote: > > > > On Wed, Feb 19, 2020 at 2:34 PM Gurchetan Singh > > wrote: > > > > > > For old userspace, initialization will still be implicit. > > > > > > For backwards compatibility, enq

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-24 Thread Gerd Hoffmann
Hi, > > The plan is for virtio-gpu device to reserve a huge memory region in > > the guest. Memslots may be added dynamically or statically to back > > the region. > > so the region is marked as E820_RESERVED to prevent guest kernel > from using it for other purpose and then virtio-gpu device

Re: [PATCH 31/52] drm/cirrus: Fully embrace devm_

2020-02-24 Thread Gerd Hoffmann
Daniel Vetter > Cc: Dave Airlie > Cc: Gerd Hoffmann > Cc: Daniel Vetter > Cc: "Noralf Trønnes" > Cc: Emil Velikov > Cc: Thomas Zimmermann > Cc: virtualizat...@lists.linux-foundation.org Acked-by: Gerd Hoffmann ___ dri

Re: [PATCH 30/52] drm/cirrus: Drop explicit drm_mode_config_cleanup call

2020-02-24 Thread Gerd Hoffmann
On Wed, Feb 19, 2020 at 11:21:00AM +0100, Daniel Vetter wrote: > We can even delete the drm_driver.release hook now! > > Signed-off-by: Daniel Vetter > Cc: Dave Airlie > Cc: Gerd Hoffmann > Cc: Daniel Vetter > Cc: "Noralf Trønnes" > Cc: Sam Ravnb

Re: [PATCH 29/52] drm/bochs: Drop explicit drm_mode_config_cleanup

2020-02-24 Thread Gerd Hoffmann
> > Signed-off-by: Daniel Vetter > Cc: Gerd Hoffmann > Cc: virtualizat...@lists.linux-foundation.org Acked-by: Gerd Hoffmann ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 28/52] drm/bochs: Remove leftover drm_atomic_helper_shutdown

2020-02-24 Thread Gerd Hoffmann
On Wed, Feb 19, 2020 at 11:20:58AM +0100, Daniel Vetter wrote: > Small mistake that crept into > > commit 81da8c3b8d3df6f05b11300b7d17ccd1f3017fab > Author: Gerd Hoffmann > Date: Tue Feb 11 14:52:18 2020 +0100 > > drm/bochs: add drm_driver.releas

Re: [PATCH 10/52] drm/cirrus: Use drmm_add_final_kfree

2020-02-24 Thread Gerd Hoffmann
m_device and the drmm_ stuff. Acked-by: Gerd Hoffmann ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 4/4] drm/qxl: Use simple encoder

2020-02-24 Thread Gerd Hoffmann
On Tue, Feb 18, 2020 at 09:48:15AM +0100, Thomas Zimmermann wrote: > The qxl driver uses an empty implementation for its encoder. Replace > the code with the generic simple encoder. > > v2: > * rebase onto new simple-encoder interface > > Signed-off-by: Thomas Zimmer

Re: [PATCH 8/8] drm/ttm: do not keep GPU dependent addresses

2020-02-24 Thread Gerd Hoffmann
Hi, > 2 unfortunately I can't say the same for bochs but it works with this patch > series so I think bochs is fine as well. bochs needs the offset only to scanout framebuffers, which in turn requires framebuffers being pinned to vram. So all green here. cheers, Gerd __

Re: [PATCH 6/8] drm/vram-helper: don't use ttm bo->offset

2020-02-24 Thread Gerd Hoffmann
On Mon, Feb 17, 2020 at 04:04:25PM +0100, Nirmoy Das wrote: > Calculate GPU offset within vram-helper without depending on > bo->offset > > Signed-off-by: Nirmoy Das Acked-by: Gerd Hoffmann ___ dri-devel mailing list dri-devel@lists.

Re: [PATCH 7/8] drm/bochs: use drm_gem_vram_offset to get bo offset

2020-02-24 Thread Gerd Hoffmann
On Mon, Feb 17, 2020 at 04:04:26PM +0100, Nirmoy Das wrote: > Switch over to GEM VRAM's implementation to retrieve bo->offset > > Signed-off-by: Nirmoy Das Acked-by: Gerd Hoffmann ___ dri-devel mailing list dri-devel@lists.free

Re: [PATCH 6/7] drm/bochs: don't use ttm bo->offset

2020-02-17 Thread Gerd Hoffmann
On Mon, Feb 17, 2020 at 11:18:40AM +0100, Nirmoy Das wrote: > Calculate GPU offset within bochs driver itself without depending on > bo->offset > > Signed-off-by: Nirmoy Das > --- > drivers/gpu/drm/bochs/bochs_kms.c | 3 ++- > drivers/gpu/drm/drm_gem_vram_helper.c | 2 +- > 2 files changed,

Re: [PATCH 5/7] drm/qxl: don't use ttm bo->offset

2020-02-17 Thread Gerd Hoffmann
that I'll happily Acked-by: Gerd Hoffmann cheers, Gerd ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 2/2] drm/format_helper: Dual licence the file in GPL 2 and MIT

2020-02-17 Thread Gerd Hoffmann
On Sat, Feb 15, 2020 at 07:09:11PM +0100, Emmanuel Vadot wrote: > From: Emmanuel Vadot > > Contributors for this file are : > Gerd Hoffmann > Maxime Ripard > Noralf Trønnes > > Signed-off-by: Emmanuel Vadot > --- > drivers/gpu/drm/drm_format_helper.c | 2 +-

[PATCH] drm/qxl: don't take vga ports on rev5+

2020-02-14 Thread Gerd Hoffmann
qemu 5.0 introduces a new qxl hardware revision 5. Unlike revision 4 (and below) the device doesn't switch back into vga compatibility mode when someone touches the vga ports. So we don't have to reserve the vga ports any more to avoid that happening. Signed-off-by: Gerd Hoffmann --

[PATCH v4 4/6] drm/virtio: batch resource creation

2020-02-14 Thread Gerd Hoffmann
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_create_resource(), virtio_gpu_cmd_resource_create_3d() and virtio_gpu_cmd_resource_attach_backing(). virtio_gpu_object_create() will batch commands and notify only once when creating a resource. Signed-off-by: Gerd Hoffmann

[PATCH v4 2/6] drm/virtio: notify before waiting

2020-02-14 Thread Gerd Hoffmann
Before we are going to wait for virtqueue entries becoming available call virtio_gpu_notify() to make sure the host has seen everything we've submitted. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gp

[PATCH v4 1/6] drm/virtio: rework notification for better batching

2020-02-14 Thread Gerd Hoffmann
batching to separate patches. v2: - rebase to latest drm-misc-next. - use "if (!atomic_read())". - add review & test tags. Signed-off-by: Gerd Hoffmann Reviewed-by: Gurchetan Singh Tested-by: Gurchetan Singh Reviewed-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6

[PATCH v4 6/6] drm/virtio: move remaining virtio_gpu_notify calls

2020-02-14 Thread Gerd Hoffmann
Move all remaining virtio_gpu_notify() calls from virtio_gpu_cmd_* to the callers, for consistency reasons. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_gem.c| 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 3 +++ drivers/gpu/drm/virtio/virtgpu_kms.c| 3 +++ drivers

[PATCH v4 5/6] drm/virtio: batch display query

2020-02-14 Thread Gerd Hoffmann
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_get_display_info() and virtio_gpu_cmd_get_edids(). virtio_gpu_config_changed_work_func() and virtio_gpu_init() will batch commands and notify only once per update Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu

[PATCH v4 3/6] drm/virtio: batch plane updates (pageflip)

2020-02-14 Thread Gerd Hoffmann
-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 + drivers/gpu/drm/virtio/virtgpu_plane.c | 3 +++ drivers/gpu/drm/virtio/virtgpu_vq.c | 4 4 files changed, 6 insertions(+), 4 deletions

[PATCH v4 0/6] drm/virtio: rework batching

2020-02-14 Thread Gerd Hoffmann
v4: - add patches #2 + #6. v3: - split into multiple patches. Gerd Hoffmann (6): drm/virtio: rework notification for better batching drm/virtio: notify before waiting drm/virtio: batch plane updates (pageflip) drm/virtio: batch resource creation drm/virtio: batch display query drm

Re: [RFC PATCH 5/6] drm/qxl: don't use ttm bo->offset

2020-02-14 Thread Gerd Hoffmann
> -   if (bo->mem.mm_node) > -   bo->offset = (bo->mem.start << PAGE_SHIFT) + > -   bdev->man[bo->mem.mem_type].gpu_offset; > -   else > -   bo->offset = 0; > - > > > My assumption is > > (bo->tbo.offset - slot->gpu_offset + offset) == (bo->tbo.me

[PATCH] drm/virtio: fix error check

2020-02-14 Thread Gerd Hoffmann
The >= compare op must happen in cpu byte order, doing it in little endian fails on big endian machines like s390. Reported-by: Sebastian Mitterle Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driv

Re: [RFC PATCH 5/6] drm/qxl: don't use ttm bo->offset

2020-02-13 Thread Gerd Hoffmann
> @@ -311,10 +311,8 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct > qxl_bo *bo, > (bo->tbo.mem.mem_type == TTM_PL_VRAM) > ? &qdev->main_slot : &qdev->surfaces_slot; > > - WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset); > - > -

[PATCH v3 3/4] drm/virtio: batch resource creation

2020-02-13 Thread Gerd Hoffmann
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_create_resource(), virtio_gpu_cmd_resource_create_3d() and virtio_gpu_cmd_resource_attach_backing(). virtio_gpu_object_create() will batch commands and notify only once when creating a resource. Signed-off-by: Gerd Hoffmann

[PATCH v3 2/4] drm/virtio: batch plane updates (pageflip)

2020-02-13 Thread Gerd Hoffmann
-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 + drivers/gpu/drm/virtio/virtgpu_plane.c | 3 +++ drivers/gpu/drm/virtio/virtgpu_vq.c | 4 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu

[PATCH v3 4/4] drm/virtio: batch display query.

2020-02-13 Thread Gerd Hoffmann
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_get_display_info() and virtio_gpu_cmd_get_edids(). virtio_gpu_config_changed_work_func() and virtio_gpu_init() will batch commands and notify only once per update Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio

[PATCH v3 0/4] drm/virtio: rework batching

2020-02-13 Thread Gerd Hoffmann
v4: - split into multiple patches. Gerd Hoffmann (4): drm/virtio: rework notification for better batching drm/virtio: batch plane updates (pageflip) drm/virtio: batch resource creation drm/virtio: batch display query. drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++-- drivers/gpu/drm

[PATCH v3 1/4] drm/virtio: rework notification for better batching

2020-02-13 Thread Gerd Hoffmann
batching to separate patches. v2: - rebase to latest drm-misc-next. - use "if (!atomic_read())". - add review & test tags. Signed-off-by: Gerd Hoffmann Reviewed-by: Gurchetan Singh Tested-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++-- drivers/

Re: [PATCH] drm/qxl: replace zero-length array with flexible-array member

2020-02-13 Thread Gerd Hoffmann
On Wed, Feb 12, 2020 at 01:33:44PM -0600, Gustavo A. R. Silva wrote: > The current codebase makes use of the zero-length array language > extension to the C90 standard, but the preferred mechanism to declare > variable-length types such as these ones is a flexible array member[1][2], > introduced i

[PATCH v2] drm/virtio: rework batching

2020-02-12 Thread Gerd Hoffmann
for userspace ioctls. v2: - rebase to latest drm-misc-next. - use "if (!atomic_read())". - add review & test tags. Signed-off-by: Gerd Hoffmann Reviewed-by: Gurchetan Singh Tested-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++--- drivers/

Re: [PATCH 3/4] drm/virtio: track whether or not a context has been initiated

2020-02-12 Thread Gerd Hoffmann
Hi, > --- a/drivers/gpu/drm/virtio/virtgpu_kms.c > +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c > @@ -270,7 +270,9 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct > drm_file *file) > return id; > } > > + > vfpriv->ctx_id = id; checkpatch warning here: -:

Re: [PATCH v4] drm/virtio: add drm_driver.release callback.

2020-02-12 Thread Gerd Hoffmann
On Tue, Feb 11, 2020 at 03:27:11PM +0100, Daniel Vetter wrote: > On Tue, Feb 11, 2020 at 02:58:04PM +0100, Gerd Hoffmann wrote: > > Split virtio_gpu_deinit(), move the drm shutdown and release to > > virtio_gpu_release(). Drop vqs_ready variable, instead use > > drm_dev_{

Re: [PATCH v4] drm/bochs: add drm_driver.release callback.

2020-02-12 Thread Gerd Hoffmann
On Tue, Feb 11, 2020 at 03:19:56PM +0100, Daniel Vetter wrote: > On Tue, Feb 11, 2020 at 02:52:18PM +0100, Gerd Hoffmann wrote: > > Call bochs_unload via drm_driver.release to make sure we release stuff > > when it is safe to do so. Use drm_dev_{enter,exit,unplug} to avoid > &

[PATCH v4] drm/virtio: add drm_driver.release callback.

2020-02-11 Thread Gerd Hoffmann
Split virtio_gpu_deinit(), move the drm shutdown and release to virtio_gpu_release(). Drop vqs_ready variable, instead use drm_dev_{enter,exit,unplug} to avoid touching hardware after device removal. Tidy up here and there. v4: add changelog. v3: use drm_dev_*(). Signed-off-by: Gerd Hoffmann

[PATCH v4] drm/cirrus: add drm_driver.release callback.

2020-02-11 Thread Gerd Hoffmann
(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/cirrus/cirrus.c | 43 - 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c index a91fb0d7282c..d2ff63ce8eaf 100644 --- a/drivers/gpu/drm

[PATCH v4] drm/bochs: add drm_driver.release callback.

2020-02-11 Thread Gerd Hoffmann
-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs_drv.c | 6 +++--- drivers/gpu/drm/bochs/bochs_hw.c | 24 +++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index 10460878414e

[PATCH 0/2] drm/virtio: locking/reservation fixes

2020-02-11 Thread Gerd Hoffmann
Gerd Hoffmann (2): drm/virtio: fix virtio_gpu_execbuffer_ioctl locking drm/virtio: fix virtio_gpu_cursor_plane_update(). drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++-- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 2 files changed, 11 insertions(+), 10 deletions

[PATCH 1/2] drm/virtio: fix virtio_gpu_execbuffer_ioctl locking

2020-02-11 Thread Gerd Hoffmann
Lockdep says we can't call vmemdup() while having objects reserved because it needs the mmap semaphore. So reorder the calls reserve the objects later. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++-- 1 file changed, 10 insertions(+

[PATCH 2/2] drm/virtio: fix virtio_gpu_cursor_plane_update().

2020-02-11 Thread Gerd Hoffmann
Add missing virtio_gpu_array_lock_resv() call. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index ac42c84d2d7f..d1c3f5fbfee4 100644

Re: [PATCH v2 2/3] drm/virtio: never kick in virtio_gpu_queue_ctrl_sgs

2020-02-11 Thread Gerd Hoffmann
Hi, > @@ -541,6 +539,7 @@ void virtio_gpu_cmd_unref_resource(struct > virtio_gpu_device *vgdev, > cmd_p->resource_id = cpu_to_le32(resource_id); > > virtio_gpu_queue_ctrl_buffer(vgdev, vbuf); > + virtio_gpu_commit_ctrl(vgdev); > } Well, I was more thinking about adding that

[PATCH] drm/virtio: rework batching

2020-02-11 Thread Gerd Hoffmann
for userspace ioctls. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++--- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +++ drivers/gpu/drm/virtio/virtgpu_kms.c | 3 +++ drivers/gpu/drm/virtio

[PATCH v3] drm/virtio: add drm_driver.release callback.

2020-02-11 Thread Gerd Hoffmann
Split virtio_gpu_deinit(), move the drm shutdown and release to virtio_gpu_release(). Drop vqs_ready variable, instead use drm_dev_{enter,exit,unplug} to avoid touching hardware after device removal. Tidy up here and there. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH v3] drm/cirrus: add drm_driver.release callback.

2020-02-11 Thread Gerd Hoffmann
Move final cleanups from cirrus_pci_remove() to the new callback. Add drm_atomic_helper_shutdown() call to cirrus_pci_remove(). Use drm_dev_{enter,exit,unplug} to avoid touching hardware after device removal. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/cirrus/cirrus.c | 43

[PATCH v3] drm/bochs: add drm_driver.release callback.

2020-02-11 Thread Gerd Hoffmann
Call bochs_unload via drm_driver.release to make sure we release stuff when it is safe to do so. Use drm_dev_{enter,exit,unplug} to avoid touching hardware after device removal. Tidy up here and there. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs_drv.c | 6 +++--- drivers/gpu

[PATCH v2 0/2] drm/qxl: driver release fixes.

2020-02-10 Thread Gerd Hoffmann
Gerd Hoffmann (2): drm/qxl: reorder calls in qxl_device_fini(). drm/qxl: add drm_driver.release callback. drivers/gpu/drm/qxl/qxl_drv.c | 26 +++--- drivers/gpu/drm/qxl/qxl_kms.c | 8 2 files changed, 23 insertions(+), 11 deletions(-) -- 2.18.1

[PATCH v2 1/2] drm/qxl: reorder calls in qxl_device_fini().

2020-02-10 Thread Gerd Hoffmann
Reorder calls in qxl_device_fini(). Cleaning up gem & ttm might trigger qxl commands, so we should do that before releaseing command rings. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_kms.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu

[PATCH v2 2/2] drm/qxl: add drm_driver.release callback.

2020-02-10 Thread Gerd Hoffmann
Move final cleanups to qxl_drm_release() callback. Add drm_atomic_helper_shutdown() call to qxl_pci_remove(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_drv.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/qxl

[PATCH v2] drm/virtio: add drm_driver.release callback.

2020-02-10 Thread Gerd Hoffmann
Split virtio_gpu_deinit(), move the drm shutdown and release to virtio_gpu_release(). Also free vbufs in case we can't queue them. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_display.c | 1 - drivers/gpu/drm/v

[PATCH v2] drm/cirrus: add drm_driver.release callback.

2020-02-10 Thread Gerd Hoffmann
Move final cleanups from cirrus_pci_remove() to the new callback. Add drm_atomic_helper_shutdown() call to cirrus_pci_remove(). Set pointers to NULL after iounmap() and check them before using them to make sure we don't touch released hardware. Signed-off-by: Gerd Hoffmann --- drivers/gp

[PATCH v2] drm/bochs: add drm_driver.release callback.

2020-02-10 Thread Gerd Hoffmann
touched after bochs_pci_remove returns. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs.h | 1 + drivers/gpu/drm/bochs/bochs_drv.c | 6 +++--- drivers/gpu/drm/bochs/bochs_hw.c | 14 ++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm

Re: [PATCH 1/2] drm/bochs: Clear struct drm_connector_funcs.dpms

2020-02-10 Thread Gerd Hoffmann
On Fri, Feb 07, 2020 at 03:16:01PM +0100, Thomas Zimmermann wrote: > Atomic modesetting doesn't use struct drm_connector_funcs.dpms and > the set function, drm_helper_connector_dpms(), wouldn't support it > anyway. So keep the pointer to NULL. > > Signed-off-by: Thomas Zi

[PATCH] drm/bochs: deinit bugfix

2020-02-07 Thread Gerd Hoffmann
Check whenever mode_config was actually properly initialized before trying to clean it up. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs_kms.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index

Re: [PATCH v2] drm/bochs: downgrade pci_request_region failure from error to warning

2020-02-07 Thread Gerd Hoffmann
On Fri, Feb 07, 2020 at 01:06:00PM +0100, Thomas Zimmermann wrote: > Hi > > Am 07.02.20 um 12:57 schrieb Gerd Hoffmann: > > Shutdown of firmware framebuffer has a bunch of problems. Because > > of this the framebuffer region might still b

Re: [PATCH 2/6] drm: Add drm_simple_encoder_{init,create}()

2020-02-07 Thread Gerd Hoffmann
> > How about using > > > > #define drm_simple_encoder_init(dev, type, name, ...) \ > > drm_encoder_init(dev, drm_simple_encoder_funcs_cleanup, type, name, > > __VA_ARGS__) > > > > instead ? > I guess you want to save a few lines in the implementation of > drm_simple_encoder_init() (?)

[PATCH] drm/cirrus: add drm_driver.release callback.

2020-02-07 Thread Gerd Hoffmann
Move final cleanups from cirrus_pci_remove() to the new callback. Add drm_atomic_helper_shutdown() call to cirrus_pci_remove(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/cirrus/cirrus.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm

[PATCH] drm/virtio: add drm_driver.release callback.

2020-02-07 Thread Gerd Hoffmann
Split virtio_gpu_deinit(), move the drm shutdown and release to virtio_gpu_release(). Also free vbufs in case we can't queue them. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_drv.c | 4 drivers/gpu/drm/virtio/virtgpu_

[PATCH] drm/qxl: add drm_driver.release callback.

2020-02-07 Thread Gerd Hoffmann
Move final cleanups to qxl_drm_release() callback. Add drm_atomic_helper_shutdown() call to qxl_pci_remove(). Reorder calls in qxl_device_fini(). Cleaning up gem & ttm might trigger qxl commands, so we should do that before releaseing command rings. Signed-off-by: Gerd Hoffmann --- dri

[PATCH] drm/bochs: add drm_driver.release callback.

2020-02-07 Thread Gerd Hoffmann
From: Gurchetan Singh Move bochs_unload call from bochs_remove() to the new bochs_release() callback. Also call drm_dev_unregister() first in bochs_remove(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs_drv.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions

[PATCH v2] drm/bochs: downgrade pci_request_region failure from error to warning

2020-02-07 Thread Gerd Hoffmann
round this issue. Reported-by: Marek Marczykowski-Górecki Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs_hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c index b615b7dfdd9d..a387efa9e559 1

Re: [PATCH 2/6] drm: Add drm_simple_encoder_{init,create}()

2020-02-07 Thread Gerd Hoffmann
> +static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = { > + .destroy = drm_encoder_cleanup, > +}; > + > +/** > + * drm_simple_encoder_init - Init a preallocated encoder > + * @dev: drm device > + * @funcs: callbacks for this encoder > + * @encoder_type: user visible type o

Re: [PATCH 2/2] drm/virtio: remove the global disable_notify state

2020-02-07 Thread Gerd Hoffmann
On Thu, Feb 06, 2020 at 11:22:14AM -0800, Chia-I Wu wrote: > The global disable_notify state does not scale well when we start > using it in more places and when there are multiple threads. Use > command-level bools to control whether to notify or not. Hmm, I don't like passing around the bool ev

[PATCH v2 1/4] drm/virtio: simplify virtio_gpu_alloc_cmd

2020-02-06 Thread Gerd Hoffmann
Just call virtio_gpu_alloc_cmd_resp with some fixed args instead of duplicating most of the function body. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/virtio

[PATCH v2 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-06 Thread Gerd Hoffmann
Introduce new virtio_gpu_object_shmem_init() helper function which will create the virtio_gpu_mem_entry array, containing the backing storage information for the host. For the most path this just moves code from virtio_gpu_object_attach(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm

[PATCH v2 3/4] drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()

2020-02-06 Thread Gerd Hoffmann
Stop sending DETACH_BACKING commands, that will happening anyway when releasing resources via UNREF. Handle guest-side cleanup in virtio_gpu_cleanup_object(), called when the host finished processing the UNREF command. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH v2 0/4] drm/virtio: rework backing storage handling

2020-02-06 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Gerd Hoffmann (4): drm/virtio: simplify virtio_gpu_alloc_cmd drm/virtio: resource teardown tweaks drm/virtio: move mapping teardown to virtio_gpu_cleanup_object() drm/virtio: move virtio_gpu_mem_entry initialization to new function drivers/gpu/drm/virtio

[PATCH v2 2/4] drm/virtio: resource teardown tweaks

2020-02-06 Thread Gerd Hoffmann
Add new virtio_gpu_cleanup_object() helper function for object cleanup. Wire up callback function for resource unref, do cleanup from callback when we know the host stopped using the resource. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h| 4 +++- drivers/gpu/drm

[PATCH v2] drm/virtio: fix ring free check

2020-02-06 Thread Gerd Hoffmann
If the virtio device supports indirect ring descriptors we need only one ring entry for the whole command. Take that into account when checking whenever the virtqueue has enough free entries for our command. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1

Re: [PATCH] drm/virtio: fix ring free check

2020-02-06 Thread Gerd Hoffmann
Hi, > > + indirect = virtio_has_feature(vgdev->vdev, > > VIRTIO_RING_F_INDIRECT_DESC); > > + vqcnt = indirect ? 1 : elemcnt; > Is the feature dynamic and require the lock held? If not, the result > can be cached and the fixup can happen before grabbing the lock Not dynamic, so yes

Re: [PATCH 00/11] drm/virtio: fixes and cleanups for vbuf queuing

2020-02-06 Thread Gerd Hoffmann
On Wed, Feb 05, 2020 at 10:19:44AM -0800, Chia-I Wu wrote: > This series consists of fixes and cleanups for > virtio_gpu_queue_fenced_ctrl_buffer, except for the last patch. The fixes are > for corner cases that were overlooked. The cleanups make the last patch > easier, but they should be good i

[PATCH] drm/virtio: fix ring free check

2020-02-06 Thread Gerd Hoffmann
If the virtio device supports indirect ring descriptors we need only one ring entry for the whole command. Take that into account when checking whenever the virtqueue has enough free entries for our command. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 9 ++--- 1

Re: [PATCH 09/11] drm/virtio: avoid an infinite loop

2020-02-06 Thread Gerd Hoffmann
On Wed, Feb 05, 2020 at 10:19:53AM -0800, Chia-I Wu wrote: > Make sure elemcnt does not exceed the maximum element count in > virtio_gpu_queue_ctrl_sgs. We should improve our error handling or > impose a size limit on execbuffer, which are TODOs. Hmm, virtio supports indirect ring entries, so lar

Re: [PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-06 Thread Gerd Hoffmann
Hi, > > virtio_gpu_cmd_resource_attach_backing(vgdev, obj->hw_res_handle, > > - ents, nents, > > + obj->ents, obj->nents, > >fence); > > + obj->

Re: [PATCH 2/4] drm/virtio: resource teardown tweaks

2020-02-05 Thread Gerd Hoffmann
> > - > > - drm_gem_shmem_free_object(obj); > > + if (bo->created) { > > + virtio_gpu_cmd_unref_resource(vgdev, bo); > > + /* completion handler calls virtio_gpu_cleanup_object() */ > nitpick: we don't need this comment when virtio_gpu_cmd_unref_cb is > defin

[PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-05 Thread Gerd Hoffmann
Introduce new virtio_gpu_object_shmem_init() helper function which will create the virtio_gpu_mem_entry array, containing the backing storage information for the host. For the most path this just moves code from virtio_gpu_object_attach(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm

[PATCH 1/4] drm/virtio: simplify virtio_gpu_alloc_cmd

2020-02-05 Thread Gerd Hoffmann
Just call virtio_gpu_alloc_cmd_resp with some fixed args instead of duplicating most of the function body. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/virtio

[PATCH 2/4] drm/virtio: resource teardown tweaks

2020-02-05 Thread Gerd Hoffmann
Add new virtio_gpu_cleanup_object() helper function for object cleanup. Wire up callback function for resource unref, do cleanup from callback when we know the host stopped using the resource. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h| 3 ++- drivers/gpu/drm

[PATCH 3/4] drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()

2020-02-05 Thread Gerd Hoffmann
Stop sending DETACH_BACKING commands, that will happening anyway when releasing resources via UNREF. Handle guest-side cleanup in virtio_gpu_cleanup_object(), called when the host finished processing the UNREF command. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH 0/4] drm/virtio: rework backing storage handling

2020-02-05 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Gerd Hoffmann (4): drm/virtio: simplify virtio_gpu_alloc_cmd drm/virtio: resource teardown tweaks drm/virtio: move mapping teardown to virtio_gpu_cleanup_object() drm/virtio: move virtio_gpu_mem_entry initialization to new function drivers/gpu/drm/virtio

[PATCH] drm/virtio: ratelimit error logging

2020-02-05 Thread Gerd Hoffmann
Avoid flooding the log in case we screw up badly. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 5914e79d3429

[PATCH] drm/virtio: fix vblank handling

2020-02-04 Thread Gerd Hoffmann
virtio has its own commit fail function. Add the drm_atomic_helper_fake_vblank() call there. Fixes: 2a735ad3d211 ("drm/virtio: Remove sending of vblank event") Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 + 1 file changed, 1 insertion(+) diff --git

Re: [PATCH v2 2/4] drm/bochs: Implement struct drm_mode_config_funcs.mode_valid

2020-02-03 Thread Gerd Hoffmann
. > > v2: > * remove bochs_connector_mode_valid(), which now serves no purpose > > Signed-off-by: Thomas Zimmermann Reviewed-by: Gerd Hoffmann > --- > drivers/gpu/drm/bochs/bochs_kms.c | 21 + > 1 file changed, 1 insertion(+), 20 deletions(-) >

Re: [PATCH 2/4] drm/bochs: Implement struct drm_mode_config_funcs.mode_valid

2020-02-03 Thread Gerd Hoffmann
On Mon, Feb 03, 2020 at 09:35:54AM +0100, Thomas Zimmermann wrote: > Hi Gerd > > Am 03.02.20 um 07:47 schrieb Gerd Hoffmann: > > On Sat, Feb 01, 2020 at 01:27:42PM +0100, Thomas Zimmermann wrote: > >> The implementation of struct drm_mode_config_funcs.mode_valid verifie

Re: [PATCH 2/4] drm/bochs: Implement struct drm_mode_config_funcs.mode_valid

2020-02-02 Thread Gerd Hoffmann
On Sat, Feb 01, 2020 at 01:27:42PM +0100, Thomas Zimmermann wrote: > The implementation of struct drm_mode_config_funcs.mode_valid verifies > that enough video memory is available for a given display mode. There is bochs_connector_mode_valid() doing the same check, you can drop it when hooking up

Re: [PATCH v3 0/4] Use no_vblank property for drivers without VBLANK

2020-01-21 Thread Gerd Hoffmann
do not support interrupts. Xen comes with its > own VBLANK logic and disables no_vblank explictly. Acked-by: Gerd Hoffmann ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] fbdev: wait for references go away

2020-01-20 Thread Gerd Hoffmann
Hi, > > open. Which can result in drm driver not being able to grab resources > > (and fail initialization) because the firmware framebuffer still holds > > them. Reportedly plymouth can trigger this. > > Could you please describe issue some more? > > I guess that a problem is happening duri

[PATCH] fbdev: wait for references go away

2020-01-20 Thread Gerd Hoffmann
. Reportedly plymouth can trigger this. Fix this by trying to wait until all references are gone. Don't wait forever though given that userspace might keep the file handle open. Reported-by: Marek Marczykowski-Górecki Signed-off-by: Gerd Hoffmann --- drivers/video/fbdev/core/fbmem.c | 7 +++ 1

[PATCH] drm/virtio: add missing virtio_gpu_array_lock_resv call

2020-01-10 Thread Gerd Hoffmann
When submitting a fenced command we must lock the object reservations because virtio_gpu_queue_fenced_ctrl_buffer() unlocks after adding the fence. Reported-by: Jann Horn Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+) diff --git a

<    1   2   3   4   5   6   7   8   9   10   >