@@ -1348,6 +1348,11 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr,
static uint64_t virtio_pci_notify_read(void *opaque, hwaddr addr,
unsigned size)
{
+ VirtIOPCIProxy *proxy = opaque;
+ if (virtio_bus_get_device(&proxy->bus) == NULL) {
+ return UINT64_MAX;
+ }
+
return 0;
}
@@ -1385,7 +1390,7 @@ static uint64_t virtio_pci_isr_read(void *opaque, hwaddr addr,
uint64_t val;
if (vdev == NULL) {
- return 0;
+ return UINT64_MAX;
}
val = qatomic_xchg(&vdev->isr, 0);
@@ -1406,7 +1411,7 @@ static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr,
uint64_t val;
if (vdev == NULL) {
- return 0;
+ return UINT64_MAX;
}
switch (size) {
Added check for "notify" memory region. Now reads will return "-1" if a virtio device is not present on a virtio bus. Signed-off-by: Andrew Melnychenko <andrew@daynix.com> --- hw/virtio/virtio-pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)