Giacomo Travaglini has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/39701 )
Change subject: dev: Fix reset of virtio devices
......................................................................
dev: Fix reset of virtio devices
Change-Id: I55cc767d791825899d62c4cd88b84809527f3f22
Signed-off-by: Giacomo Travaglini <[email protected]>
---
M src/dev/virtio/base.cc
M src/dev/virtio/base.hh
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/dev/virtio/base.cc b/src/dev/virtio/base.cc
index 0624c7e..c19cf92 100644
--- a/src/dev/virtio/base.cc
+++ b/src/dev/virtio/base.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016 ARM Limited
+ * Copyright (c) 2014, 2016, 2021 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -256,6 +256,16 @@
}
void
+VirtQueue::reset()
+{
+ _address = 0;
+ _last_avail = 0;
+
+ avail.reset();
+ used.reset();
+}
+
+void
VirtQueue::setAddress(Addr address)
{
const Addr addr_avail(address + _size * sizeof(struct vring_desc));
@@ -366,7 +376,7 @@
_deviceStatus = 0;
for (QueueID i = 0; i < _queues.size(); ++i)
- _queues[i]->setAddress(0);
+ _queues[i]->reset();
}
void
diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh
index d9ade7f..72ad02e 100644
--- a/src/dev/virtio/base.hh
+++ b/src/dev/virtio/base.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016-2017 ARM Limited
+ * Copyright (c) 2014, 2016-2017, 2021 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -305,6 +305,14 @@
/** @{
* @name Low-level Device Interface
*/
+
+ /**
+ * Reset cached state in this queue and in the associated
+ * ring buffers. A client of this method should be the
+ * VirtIODeviceBase::reset.
+ */
+ void reset();
+
/**
* Set the base address of this queue.
*
@@ -464,6 +472,14 @@
header{0, 0}, ring(size), _proxy(proxy), _base(0),
byteOrder(bo)
{}
+ /** Reset any state in the ring buffer. */
+ void
+ reset()
+ {
+ header = {0, 0};
+ _base = 0;
+ };
+
/**
* Set the base address of the VirtIO ring buffer.
*
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39701
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I55cc767d791825899d62c4cd88b84809527f3f22
Gerrit-Change-Number: 39701
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s