From: Andreas Sandberg Date: Mon, 24 Aug 2020 17:00:57 +0000 (+0100) Subject: dev: Use the new ByteOrder param type in VirtIO devices X-Git-Tag: v20.1.0.0~43 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2bda57a96124890f14172a1b41fe74a2d5c6914;p=gem5.git dev: Use the new ByteOrder param type in VirtIO devices VirtIO devices currently request their endianness from the System object. Instead of explicitly querying the system for its endianness, expose the device's endianness as a param. This param defaults to the endianness of a parent object using the Parent proxy (in practice the system). Change-Id: If4f84ff61f4d064bdd015a881790f5af03de6535 Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33296 Tested-by: kokoro Reviewed-by: Gabe Black --- diff --git a/src/dev/virtio/VirtIO.py b/src/dev/virtio/VirtIO.py index bebacadb5..ed8cffa53 100644 --- a/src/dev/virtio/VirtIO.py +++ b/src/dev/virtio/VirtIO.py @@ -50,6 +50,7 @@ class VirtIODeviceBase(SimObject): subsystem = Param.UInt8(0x00, "VirtIO subsystem ID") system = Param.System(Parent.any, "system object") + byte_order = Param.ByteOrder(Parent.byte_order, "Device byte order") class VirtIODummyDevice(VirtIODeviceBase): type = 'VirtIODummyDevice' diff --git a/src/dev/virtio/base.cc b/src/dev/virtio/base.cc index 6b4fe0a36..84841af4c 100644 --- a/src/dev/virtio/base.cc +++ b/src/dev/virtio/base.cc @@ -37,10 +37,10 @@ #include "dev/virtio/base.hh" +#include "base/trace.hh" #include "debug/VIO.hh" #include "params/VirtIODeviceBase.hh" #include "params/VirtIODummyDevice.hh" -#include "sim/system.hh" VirtDescriptor::VirtDescriptor(PortProxy &_memProxy, ByteOrder bo, VirtQueue &_queue, Index descIndex) @@ -326,7 +326,7 @@ VirtIODeviceBase::VirtIODeviceBase(Params *params, DeviceId id, size_t config_size, FeatureBits features) : SimObject(params), guestFeatures(0), - byteOrder(params->system->getGuestByteOrder()), + byteOrder(params->byte_order), deviceId(id), configSize(config_size), deviceFeatures(features), _deviceStatus(0), _queueSelect(0) {