[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/21] virtio-mmio: cleanup reset
From: |
Paolo Bonzini |
Subject: |
[PULL 14/21] virtio-mmio: cleanup reset |
Date: |
Thu, 16 Jun 2022 10:32:02 +0200 |
Make virtio_mmio_soft_reset reset the virtio device, which is performed by
both the "soft" and the "hard" reset; and then call virtio_mmio_soft_reset
from virtio_mmio_reset to emphasize that the latter is a superset of the
former.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/virtio/virtio-mmio.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 6d81a26473..d240efef97 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -72,12 +72,12 @@ static void virtio_mmio_soft_reset(VirtIOMMIOProxy *proxy)
{
int i;
- if (proxy->legacy) {
- return;
- }
+ virtio_bus_reset(&proxy->bus);
- for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
- proxy->vqs[i].enabled = 0;
+ if (!proxy->legacy) {
+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
+ proxy->vqs[i].enabled = 0;
+ }
}
}
@@ -376,7 +376,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset,
uint64_t value,
return;
}
if (value == 0) {
- virtio_bus_reset(&vdev->bus);
+ virtio_mmio_soft_reset(proxy);
} else {
virtio_queue_set_addr(vdev, vdev->queue_sel,
value << proxy->guest_page_shift);
@@ -432,7 +432,6 @@ static void virtio_mmio_write(void *opaque, hwaddr offset,
uint64_t value,
}
if (vdev->status == 0) {
- virtio_reset(vdev);
virtio_mmio_soft_reset(proxy);
}
break;
@@ -627,7 +626,8 @@ static void virtio_mmio_reset(DeviceState *d)
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
int i;
- virtio_bus_reset(&proxy->bus);
+ virtio_mmio_soft_reset(proxy);
+
proxy->host_features_sel = 0;
proxy->guest_features_sel = 0;
proxy->guest_page_shift = 0;
@@ -636,7 +636,6 @@ static void virtio_mmio_reset(DeviceState *d)
proxy->guest_features[0] = proxy->guest_features[1] = 0;
for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
- proxy->vqs[i].enabled = 0;
proxy->vqs[i].num = 0;
proxy->vqs[i].desc[0] = proxy->vqs[i].desc[1] = 0;
proxy->vqs[i].avail[0] = proxy->vqs[i].avail[1] = 0;
--
2.36.1
- [PULL 04/21] cutils: add functions for IEC and SI prefixes, (continued)
- [PULL 04/21] cutils: add functions for IEC and SI prefixes, Paolo Bonzini, 2022/06/16
- [PULL 06/21] qmp: add filtering of statistics by provider, Paolo Bonzini, 2022/06/16
- [PULL 01/21] qmp: Support for querying stats, Paolo Bonzini, 2022/06/16
- [PULL 07/21] hmp: add filtering of statistics by provider, Paolo Bonzini, 2022/06/16
- [PULL 10/21] block: add more commands to preconfig mode, Paolo Bonzini, 2022/06/16
- [PULL 11/21] s390x: simplify virtio_ccw_reset_virtio, Paolo Bonzini, 2022/06/16
- [PULL 12/21] virtio-mmio: stop ioeventfd on legacy reset, Paolo Bonzini, 2022/06/16
- [PULL 13/21] virtio: stop ioeventfd on reset, Paolo Bonzini, 2022/06/16
- [PULL 15/21] configure: update list of preserved environment variables, Paolo Bonzini, 2022/06/16
- [PULL 18/21] build: fix check for -fsanitize-coverage-allowlist, Paolo Bonzini, 2022/06/16
- [PULL 14/21] virtio-mmio: cleanup reset,
Paolo Bonzini <=
- [PULL 16/21] configure: cleanup -fno-pie detection, Paolo Bonzini, 2022/06/16
- [PULL 17/21] tests/vm: allow running tests in an unconfigured source tree, Paolo Bonzini, 2022/06/16
- [PULL 20/21] meson: put cross compiler info in a separate section, Paolo Bonzini, 2022/06/16
- [PULL 21/21] build: include pc-bios/ part in the ROMS variable, Paolo Bonzini, 2022/06/16
- [PULL 19/21] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled, Paolo Bonzini, 2022/06/16
- Re: [PULL 00/21] Statistics, preconfig and cleanup patches for 2022-06-16, Richard Henderson, 2022/06/16