dev: Use the new ByteOrder param type in VirtIO devices
authorAndreas Sandberg <andreas.sandberg@arm.com>
Mon, 24 Aug 2020 17:00:57 +0000 (18:00 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Thu, 10 Sep 2020 14:27:17 +0000 (14:27 +0000)
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 <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33296
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
src/dev/virtio/VirtIO.py
src/dev/virtio/base.cc

index bebacadb5d818ffa1f8bb152d493e3efa24f6d9e..ed8cffa53e0d119e0f4474bed856534b927402c2 100644 (file)
@@ -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'
index 6b4fe0a36ccd46c6a699c8e6cd66dd44e23a0441..84841af4c844aa69b6a9bfbd66d972fe0c48a756 100644 (file)
 
 #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)
 {