virtio: Fix virtio_mmio_read()/virtio_mmio_write()
authorLaurent Vivier <laurent@vivier.eu>
Sun, 14 Mar 2021 20:03:00 +0000 (21:03 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 22 Mar 2021 14:17:53 +0000 (10:17 -0400)
commit0ab8c021c6c594846915cbeb501fa87ab8780949
tree00abf519ed1f5c165ab66ac102139c2a557e9284
parentf0f20022a0c744930935fdb7020a8c18347d391a
virtio: Fix virtio_mmio_read()/virtio_mmio_write()

Both functions don't check the personality of the interface (legacy or
modern) before accessing the configuration memory and always use
virtio_config_readX()/virtio_config_writeX().

With this patch, they now check the personality and in legacy mode
call virtio_config_readX()/virtio_config_writeX(), otherwise call
virtio_config_modern_readX()/virtio_config_modern_writeX().

This change has been tested with virtio-mmio guests (virt stretch/armhf and
virt sid/m68k) and virtio-pci guests (pseries RHEL-7.3/ppc64 and /ppc64le).

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210314200300.3259170-1-laurent@vivier.eu>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-mmio.c