linux-stable/drivers/virtio
Stefano Garzarella 4ae4311131 virtio: use virtio_device_ready() in virtio_device_restore()
commit 8d65bc9a5b upstream.

After waking up a suspended VM, the kernel prints the following trace
for virtio drivers which do not directly call virtio_device_ready() in
the .restore:

    PM: suspend exit
    irq 22: nobody cared (try booting with the "irqpoll" option)
    Call Trace:
     <IRQ>
     dump_stack_lvl+0x38/0x49
     dump_stack+0x10/0x12
     __report_bad_irq+0x3a/0xaf
     note_interrupt.cold+0xb/0x60
     handle_irq_event+0x71/0x80
     handle_fasteoi_irq+0x95/0x1e0
     __common_interrupt+0x6b/0x110
     common_interrupt+0x63/0xe0
     asm_common_interrupt+0x1e/0x40
     ? __do_softirq+0x75/0x2f3
     irq_exit_rcu+0x93/0xe0
     sysvec_apic_timer_interrupt+0xac/0xd0
     </IRQ>
     <TASK>
     asm_sysvec_apic_timer_interrupt+0x12/0x20
     arch_cpu_idle+0x12/0x20
     default_idle_call+0x39/0xf0
     do_idle+0x1b5/0x210
     cpu_startup_entry+0x20/0x30
     start_secondary+0xf3/0x100
     secondary_startup_64_no_verify+0xc3/0xcb
     </TASK>
    handlers:
    [<000000008f9bac49>] vp_interrupt
    [<000000008f9bac49>] vp_interrupt
    Disabling IRQ #22

This happens because we don't invoke .enable_cbs callback in
virtio_device_restore(). That callback is used by some transports
(e.g. virtio-pci) to enable interrupts.

Let's fix it, by calling virtio_device_ready() as we do in
virtio_dev_probe(). This function calls .enable_cts callback and sets
DRIVER_OK status bit.

This fix also avoids setting DRIVER_OK twice for those drivers that
call virtio_device_ready() in the .restore.

Fixes: d50497eb4e ("virtio_config: introduce a new .enable_cbs method")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20220322114313.116516-1-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-08 13:58:57 +02:00
..
Kconfig virtio: drop default for virtio-mem 2022-03-06 06:06:50 -05:00
Makefile virtio-pci: introduce legacy device module 2021-11-01 04:30:34 -04:00
virtio.c virtio: use virtio_device_ready() in virtio_device_restore() 2022-04-08 13:58:57 +02:00
virtio_balloon.c virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
virtio_dma_buf.c dma-buf: move dma-buf symbols into the DMA_BUF module namespace 2021-10-25 14:53:08 +02:00
virtio_input.c virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
virtio_mem.c virtio/virtio_mem: handle a possible NULL as a memcpy parameter 2022-01-14 18:50:53 -05:00
virtio_mmio.c virtio-mmio: Use to_virtio_mmio_device() to simply code 2021-03-14 04:37:35 -04:00
virtio_pci_common.c Revert "virtio_pci: harden MSI-X interrupts" 2022-04-08 13:58:57 +02:00
virtio_pci_common.h Revert "virtio_pci: harden MSI-X interrupts" 2022-04-08 13:58:57 +02:00
virtio_pci_legacy.c Revert "virtio_pci: harden MSI-X interrupts" 2022-04-08 13:58:57 +02:00
virtio_pci_legacy_dev.c virtio/virtio_pci_legacy_dev: ensure the correct return value 2022-01-14 18:50:53 -05:00
virtio_pci_modern.c Revert "virtio_pci: harden MSI-X interrupts" 2022-04-08 13:58:57 +02:00
virtio_pci_modern_dev.c virtio: fix a typo in function "vp_modern_remove" comments. 2022-01-14 18:50:53 -05:00
virtio_ring.c virtio_ring: mark ring unused on error 2022-01-14 18:50:53 -05:00
virtio_vdpa.c vdpa: factor out vdpa_set_features_unlocked for vdpa internal use 2022-03-04 11:56:33 -05:00