dev: Fix reset of virtio devices
The VirtualQueue reset was just resetting the queue address but it was not touching other cached state and its associated ring buffers (used and avail) Change-Id: I55cc767d791825899d62c4cd88b84809527f3f22 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39701 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -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
|
||||
@@ -255,6 +255,16 @@ VirtQueue::unserialize(CheckpointIn &cp)
|
||||
setAddress(addr_in);
|
||||
}
|
||||
|
||||
void
|
||||
VirtQueue::reset()
|
||||
{
|
||||
_address = 0;
|
||||
_last_avail = 0;
|
||||
|
||||
avail.reset();
|
||||
used.reset();
|
||||
}
|
||||
|
||||
void
|
||||
VirtQueue::setAddress(Addr address)
|
||||
{
|
||||
@@ -366,7 +376,7 @@ VirtIODeviceBase::reset()
|
||||
_deviceStatus = 0;
|
||||
|
||||
for (QueueID i = 0; i < _queues.size(); ++i)
|
||||
_queues[i]->setAddress(0);
|
||||
_queues[i]->reset();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -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 @@ public:
|
||||
/** @{
|
||||
* @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 @@ public:
|
||||
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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user