Hello Nikos Nikoleris,
I'd like you to do a code review. Please visit
https://gem5-review.googlesource.com/2325
to review the following change.
Change subject: dev: Add a dummy VirtIO device
......................................................................
dev: Add a dummy VirtIO device
VirtIO transport interfaces always expect a VirtIO device
pointer. However, there are cases (in particular when using VirtIO's
MMIO interface) where we want to instantiate an interface without a
device. Add a dummy device using VirtIO device ID 0 and no queues to
handle this use case.
Change-Id: I6cbe12fd403903ef585be40279c3b1321fde48ff
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-by: Nikos Nikoleris <[email protected]>
Reviewed-by: Sudhanshu Jha <[email protected]>
Reviewed-by: Rekai Gonzalez Alberquilla <[email protected]>
---
M src/dev/virtio/VirtIO.py
M src/dev/virtio/base.cc
M src/dev/virtio/base.hh
3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/dev/virtio/VirtIO.py b/src/dev/virtio/VirtIO.py
index 1345c76..bf050fd 100644
--- a/src/dev/virtio/VirtIO.py
+++ b/src/dev/virtio/VirtIO.py
@@ -1,6 +1,6 @@
# -*- mode:python -*-
-# Copyright (c) 2014 ARM Limited
+# Copyright (c) 2014, 2016 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -53,11 +53,15 @@
system = Param.System(Parent.any, "system object")
+class VirtIODummyDevice(VirtIODeviceBase):
+ type = 'VirtIODummyDevice'
+ cxx_header = 'dev/virtio/base.hh'
+
class PciVirtIO(PciDevice):
type = 'PciVirtIO'
cxx_header = 'dev/virtio/pci.hh'
- vio = Param.VirtIODeviceBase("VirtIO device")
+ vio = Param.VirtIODeviceBase(VirtIODummyDevice(), "VirtIO device")
VendorID = 0x1AF4
SubsystemVendorID = VendorID;
diff --git a/src/dev/virtio/base.cc b/src/dev/virtio/base.cc
index f098784..61dd306 100644
--- a/src/dev/virtio/base.cc
+++ b/src/dev/virtio/base.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 ARM Limited
+ * Copyright (c) 2014, 2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -41,6 +41,7 @@
#include "debug/VIO.hh"
#include "params/VirtIODeviceBase.hh"
+#include "params/VirtIODummyDevice.hh"
VirtDescriptor::VirtDescriptor(PortProxy &_memProxy, VirtQueue &_queue,
Index descIndex)
@@ -477,3 +478,15 @@
{
_queues.push_back(&queue);
}
+
+
+VirtIODummyDevice::VirtIODummyDevice(VirtIODummyDeviceParams *params)
+ : VirtIODeviceBase(params, ID_INVALID, 0, 0)
+{
+}
+
+VirtIODummyDevice *
+VirtIODummyDeviceParams::create()
+{
+ return new VirtIODummyDevice(this);
+}
diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh
index 4d4c165..89c281f 100644
--- a/src/dev/virtio/base.hh
+++ b/src/dev/virtio/base.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 ARM Limited
+ * Copyright (c) 2014, 2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -48,6 +48,8 @@
#include "sim/sim_object.hh"
struct VirtIODeviceBaseParams;
+struct VirtIODummyDeviceParams;
+
class VirtQueue;
/** @{
@@ -875,4 +877,14 @@
Callback *transKick;
};
+class VirtIODummyDevice : public VirtIODeviceBase
+{
+ public:
+ VirtIODummyDevice(VirtIODummyDeviceParams *params);
+
+ protected:
+ /** VirtIO device ID */
+ static const DeviceId ID_INVALID = 0x00;
+};
+
#endif // __DEV_VIRTIO_BASE_HH__
--
To view, visit https://gem5-review.googlesource.com/2325
To unsubscribe, visit https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cbe12fd403903ef585be40279c3b1321fde48ff
Gerrit-Change-Number: 2325
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev