linux/drivers/gpu/drm/qxl
Zongmin Zhou 4da7aad41c drm/qxl: fix the suspend/resume issue on qxl device
Details:
Currently, when trying to suspend and resume with qxl device,
there are some error messages after resuming,
eventually caused to black screen and can't be recovered.

The first error message:
	[   64.668577][    C3] [drm] driver is in bug mode

This error is due to guest qxl driver
will call qxl_reinit_memslots(qdev) during system resume,
but didn't call qxl_io_reset(qdev) before this,
Then will cause the QXL_IO_MEMSLOT_ADD operation to fail on QEMU,
qxl->guest_bug flag will be set,As a result,
the QXL device can't communicate with guest qxl driver through the IO port.

after fix the first error,can success to resume and login to desktop,
but shortly after that will observe the second error message :
	[  353.095343][  T863] qxl 0000:00:02.0: object_init failed for (262144, 0x00000001)
	[  353.096660][  T863] [drm:qxl_gem_object_create [qxl]] *ERROR* Failed to allocate GEM object (260852, 1, 4096, -12)
	[  353.097277][  T863] [drm:qxl_alloc_ioctl [qxl]] *ERROR* qxl_alloc_ioctl: failed to create gem ret=-12
	[  368.197538][  T863] qxl 0000:00:02.0: object_init failed for (3149824, 0x00000001)
	[  368.197541][  T863] [drm:qxl_alloc_bo_reserved [qxl]] *ERROR* failed to allocate VRAM BO

The problem is caused by calling qxl_ring_init_hdr(qdev->release_ring)
in qxl_drm_resume() function.
When do QXL_IO_RESET,QEMU will call init_qxl_ram(),
so params like prod,cons,notify_on_cons and notify_on_prod
will be set to default value.
Ring push/pop actions for release_ring can be performed normally.
But call qxl_ring_init_hdr(qdev->release_ring)
will eventually set notify_on_prod to number of QXL_RELEASE_RING_SIZE,
affect the value of notify in qxl_push_free_res() function always be false,
QEMU will no longer send events of QXL_INTERRUPT_DISPLAY to the
guest qxl driver,so qxl_ring_pop() will never been called anymore,
and can't do dma_fence_signal(),result to ttm_bo_wait_ctx(bo, ctx)
always return EBUSY,fail to call qxl_bo_create().

Test scenario:
1) start virtual machine with qemu command "-device qxl-vga"
2) click suspend botton to enter suspend mode
3) resume and observe the error message in kernel logs,screen will be black

Let's fix this by reset io and remove the qxl_ring_init_hdr calling.

Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>
Suggested-by: Ming Xie<xieming@kylinos.cn>
Link: http://patchwork.freedesktop.org/patch/msgid/20220907094423.93581-1-min_halo@163.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-09-07 12:13:22 +02:00
..
Kconfig
Makefile
qxl_cmd.c drm/qxl: use ttm bo priorities 2021-02-19 09:13:25 +01:00
qxl_debugfs.c dma-buf: add DMA_RESV_USAGE_BOOKKEEP v3 2022-04-07 12:53:54 +02:00
qxl_dev.h drm/qxl: use flexible-array member instead of zero-length array 2020-12-22 13:43:29 +01:00
qxl_display.c drm/plane-helper: Export individual helpers 2022-07-26 18:42:07 +02:00
qxl_draw.c drm: Drop drm_framebuffer.h from drm_crtc.h 2022-06-20 23:53:55 +03:00
qxl_drv.c drm/qxl: fix the suspend/resume issue on qxl device 2022-09-07 12:13:22 +02:00
qxl_drv.h drm-misc-next for v5.18: 2022-02-25 05:50:18 +10:00
qxl_dumb.c drm: qxl: ensure surf.data is ininitialized 2021-06-09 08:52:07 +02:00
qxl_gem.c drm/qxl: use ttm bo priorities 2021-02-19 09:13:25 +01:00
qxl_image.c drm/qxl: rename qxl_bo_kmap -> qxl_bo_vmap_locked 2021-02-19 09:13:25 +01:00
qxl_ioctl.c drm/qxl: Move ioctl array next to its only user 2022-01-27 19:15:24 +01:00
qxl_irq.c drm/qxl: Convert to Linux IRQ interfaces 2021-07-15 11:16:06 +02:00
qxl_kms.c drm/qxl: remove qxl_log_level global 2022-06-09 07:30:12 +02:00
qxl_object.c drm/ttm: rename and cleanup ttm_bo_init 2022-07-11 10:53:13 +02:00
qxl_object.h dma-buf-map: Rename to iosys-map 2022-02-07 16:35:35 -08:00
qxl_prime.c dma-buf-map: Rename to iosys-map 2022-02-07 16:35:35 -08:00
qxl_release.c dma-buf: specify usage while adding fences to dma_resv obj v7 2022-04-07 12:53:53 +02:00
qxl_ttm.c drm/qxl: Use TTM builtin resource manager debugfs code 2022-04-20 21:06:02 -04:00