[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/25] libqos: read QVIRTIO_MMIO_VERSION register
From: |
Michael S. Tsirkin |
Subject: |
[PULL 10/25] libqos: read QVIRTIO_MMIO_VERSION register |
Date: |
Sat, 26 Oct 2019 15:40:01 -0400 |
From: Stefan Hajnoczi <address@hidden>
There was no real virtio-mmio ABI change between Legacy and VIRTIO 1.0
except that the Version field was incremented from 1 to 2.
However, QEMU does not allow Legacy drivers to perform VIRTIO 1.0
operations like accessing 64-bit feature bits. Since we will introduce
64-bit feature bit support we need a way to differentiate between
virtio-mmio Version 1 and 2 to avoid upsetting QEMU when we operate in
Legacy mode.
Stash away the Version field so later patches can change behavior
depending on the version.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
tests/libqos/virtio-mmio.c | 3 +++
tests/libqos/virtio-mmio.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c
index d0047876a8..7154b03c1d 100644
--- a/tests/libqos/virtio-mmio.c
+++ b/tests/libqos/virtio-mmio.c
@@ -223,6 +223,9 @@ void qvirtio_mmio_init_device(QVirtioMMIODevice *dev,
QTestState *qts,
magic = qtest_readl(qts, addr + QVIRTIO_MMIO_MAGIC_VALUE);
g_assert(magic == ('v' | 'i' << 8 | 'r' << 16 | 't' << 24));
+ dev->version = qtest_readl(qts, addr + QVIRTIO_MMIO_VERSION);
+ g_assert(dev->version == 1 || dev->version == 2);
+
dev->qts = qts;
dev->addr = addr;
dev->page_size = page_size;
diff --git a/tests/libqos/virtio-mmio.h b/tests/libqos/virtio-mmio.h
index 17a17141c3..0e45778b07 100644
--- a/tests/libqos/virtio-mmio.h
+++ b/tests/libqos/virtio-mmio.h
@@ -40,6 +40,7 @@ typedef struct QVirtioMMIODevice {
uint64_t addr;
uint32_t page_size;
uint32_t features; /* As it cannot be read later, save it */
+ uint32_t version;
} QVirtioMMIODevice;
extern const QVirtioBus qvirtio_mmio;
--
MST
- [PULL 00/25] virtio: features, tests, Michael S. Tsirkin, 2019/10/26
- [PULL 01/25] virtio: basic structure for packed ring, Michael S. Tsirkin, 2019/10/26
- [PULL 02/25] virtio: device/driver area size calculation refactor for split ring, Michael S. Tsirkin, 2019/10/26
- [PULL 03/25] virtio: Free blk virqueues at unrealize(), Michael S. Tsirkin, 2019/10/26
- [PULL 04/25] virtio: Free rnd virqueue at unrealize(), Michael S. Tsirkin, 2019/10/26
- [PULL 05/25] virtio: basic packed virtqueue support, Michael S. Tsirkin, 2019/10/26
- [PULL 06/25] virtio: event suppression support for packed ring, Michael S. Tsirkin, 2019/10/26
- [PULL 07/25] vhost_net: enable packed ring support, Michael S. Tsirkin, 2019/10/26
- [PULL 08/25] virtio: add property to enable packed virtqueue, Michael S. Tsirkin, 2019/10/26
- [PULL 09/25] tests/virtio-blk-test: read config space after feature negotiation, Michael S. Tsirkin, 2019/10/26
- [PULL 10/25] libqos: read QVIRTIO_MMIO_VERSION register,
Michael S. Tsirkin <=
- [PULL 11/25] libqos: extend feature bits to 64-bit, Michael S. Tsirkin, 2019/10/26
- [PULL 16/25] libqos: implement VIRTIO 1.0 FEATURES_OK step, Michael S. Tsirkin, 2019/10/26
- [PULL 17/25] libqos: access VIRTIO 1.0 vring in little-endian, Michael S. Tsirkin, 2019/10/26
- [PULL 18/25] libqos: add iteration support to qpci_find_capability(), Michael S. Tsirkin, 2019/10/26
- [PULL 19/25] libqos: pass full QVirtQueue to set_queue_address(), Michael S. Tsirkin, 2019/10/26
- [PULL 20/25] libqos: add MSI-X callbacks to QVirtioPCIDevice, Michael S. Tsirkin, 2019/10/26
- [PULL 21/25] libqos: expose common virtqueue setup/cleanup functions, Michael S. Tsirkin, 2019/10/26
- [PULL 22/25] libqos: make the virtio-pci BAR index configurable, Michael S. Tsirkin, 2019/10/26
- [PULL 23/25] libqos: extract Legacy virtio-pci.c code, Michael S. Tsirkin, 2019/10/26
- [PULL 24/25] libqos: add VIRTIO PCI 1.0 support, Michael S. Tsirkin, 2019/10/26