gem5  v21.1.0.2
base.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, 2016-2017, 2021 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __DEV_VIRTIO_BASE_HH__
39 #define __DEV_VIRTIO_BASE_HH__
40 
41 #include <cstdint>
42 #include <functional>
43 #include <vector>
44 
45 #include "base/bitunion.hh"
46 #include "base/compiler.hh"
47 #include "base/types.hh"
48 #include "dev/virtio/virtio_ring.h"
49 #include "mem/port_proxy.hh"
50 #include "sim/serialize.hh"
51 #include "sim/sim_object.hh"
52 
53 namespace gem5
54 {
55 
56 struct VirtIODeviceBaseParams;
57 struct VirtIODummyDeviceParams;
58 
59 class VirtQueue;
60 
74 template <typename T>
75 inline std::enable_if_t<std::is_same<T, vring_used_elem>::value, T>
77 {
78  v.id = swap_byte(v.id);
79  v.len = swap_byte(v.len);
80  return v;
81 }
82 
83 template <typename T>
84 inline std::enable_if_t<std::is_same<T, vring_desc>::value, T>
86 {
87  v.addr = swap_byte(v.addr);
88  v.len = swap_byte(v.len);
89  v.flags = swap_byte(v.flags);
90  v.next = swap_byte(v.next);
91  return v;
92 }
93 
118 {
119  public:
121  typedef uint16_t Index;
122 
133  VirtDescriptor(PortProxy &memProxy, ByteOrder bo,
135  // WORKAROUND: The noexcept declaration works around a bug where
136  // gcc 4.7 tries to call the wrong constructor when emplacing
137  // something into a vector.
138  VirtDescriptor(VirtDescriptor &&other) noexcept;
139  ~VirtDescriptor() noexcept;
140 
141  VirtDescriptor &operator=(VirtDescriptor &&rhs) noexcept;
142 
144  Index index() const { return _index; }
145 
147  void update();
148 
150  void updateChain();
159  void dump() const;
164  void dumpChain() const;
185  void read(size_t offset, uint8_t *dst, size_t size) const;
200  void write(size_t offset, const uint8_t *src, size_t size);
213  size_t size() const { return desc.len; }
214 
220  bool hasNext() const { return desc.flags & VRING_DESC_F_NEXT; }
227  VirtDescriptor *next() const;
228 
230  bool isIncoming() const { return !isOutgoing(); }
232  bool isOutgoing() const { return desc.flags & VRING_DESC_F_WRITE; }
233 
234 
247  void chainRead(size_t offset, uint8_t *dst, size_t size) const;
260  void chainWrite(size_t offset, const uint8_t *src, size_t size);
269  size_t chainSize() const;
272  private:
273  // Remove default constructor
274  VirtDescriptor();
275  // Prevent copying
276  VirtDescriptor(const VirtDescriptor &other);
277 
282 
284  ByteOrder byteOrder;
285 
288 
291 };
292 
302 class VirtQueue : public Serializable
303 {
304  public:
305  virtual ~VirtQueue() {};
306 
310  void serialize(CheckpointOut &cp) const override;
311  void unserialize(CheckpointIn &cp) override;
312 
322  void reset();
323 
329  void setAddress(Addr address);
335  Addr getAddress() const { return _address; }
336 
342  uint16_t getSize() const { return _size; }
343 
354  return &descriptors[index];
355  }
386  void produceDescriptor(VirtDescriptor *desc, uint32_t len);
404  virtual void onNotify();
415  virtual void onNotifyDescriptor(VirtDescriptor *desc) {};
422  void dump() const;
430  static const Addr ALIGN_BITS = 12;
431  static const Addr ALIGN_SIZE = 1 << ALIGN_BITS;
434  protected:
444  VirtQueue(PortProxy &proxy, ByteOrder bo, uint16_t size);
445 
447  ByteOrder byteOrder;
448 
449  private:
450  VirtQueue();
451 
453  const uint16_t _size;
458 
459  private:
467  template<typename T>
468  class VirtRing
469  {
470  public:
471  typedef uint16_t Flags;
472  typedef uint16_t Index;
473 
474  struct GEM5_PACKED Header
475  {
478  };
479 
480  VirtRing<T>(PortProxy &proxy, ByteOrder bo, uint16_t size) :
481  header{0, 0}, ring(size), _proxy(proxy), _base(0), byteOrder(bo)
482  {}
483 
485  void
487  {
488  header = {0, 0};
489  _base = 0;
490  };
491 
498 
500  void
502  {
503  assert(_base != 0);
504  _proxy.readBlob(_base, &header, sizeof(header));
507  }
508 
509  void
511  {
512  Header out;
513  assert(_base != 0);
514  out.flags = htog(header.flags, byteOrder);
515  out.index = htog(header.index, byteOrder);
516  _proxy.writeBlob(_base, &out, sizeof(out));
517  }
518 
519  void
521  {
522  readHeader();
523 
524  /* Read and byte-swap the elements in the ring */
525  T temp[ring.size()];
526  _proxy.readBlob(_base + sizeof(header),
527  temp, sizeof(T) * ring.size());
528  for (int i = 0; i < ring.size(); ++i)
529  ring[i] = gtoh(temp[i], byteOrder);
530  }
531 
532  void
534  {
535  assert(_base != 0);
536  /* Create a byte-swapped copy of the ring and write it to
537  * guest memory. */
538  T temp[ring.size()];
539  for (int i = 0; i < ring.size(); ++i)
540  temp[i] = htog(ring[i], byteOrder);
541  _proxy.writeBlob(_base + sizeof(header),
542  temp, sizeof(T) * ring.size());
543  writeHeader();
544  }
545 
547  Header header;
550 
551  private:
552  // Remove default constructor
553  VirtRing<T>();
554 
560  ByteOrder byteOrder;
561  };
562 
567 
570  uint16_t _last_avail;
571 
575 };
576 
588 {
589  public:
590  typedef uint16_t QueueID;
591  typedef uint32_t FeatureBits;
597  typedef uint16_t VirtAddress;
599  typedef uint16_t DeviceId;
600 
601  BitUnion8(DeviceStatus)
602  Bitfield<7> failed;
603  Bitfield<2> driver_ok;
604  Bitfield<1> driver;
605  Bitfield<0> acknowledge;
606  EndBitUnion(DeviceStatus)
607 
608  typedef VirtIODeviceBaseParams Params;
609  VirtIODeviceBase(const Params &params, DeviceId id, size_t config_size,
610  FeatureBits features);
611  virtual ~VirtIODeviceBase();
612 
613  public:
617  void serialize(CheckpointOut &cp) const override;
618  void unserialize(CheckpointIn &cp) override;
622  protected:
637  void
639  {
640  assert(transKick);
641  transKick();
642  };
643 
655  void registerQueue(VirtQueue &queue);
656 
657 
671  public:
689  virtual void readConfig(PacketPtr pkt, Addr cfgOffset);
704  virtual void writeConfig(PacketPtr pkt, Addr cfgOffset);
705 
718  virtual void reset();
721  protected:
733  void readConfigBlob(PacketPtr pkt, Addr cfgOffset, const uint8_t *cfg);
734 
742  void writeConfigBlob(PacketPtr pkt, Addr cfgOffset, uint8_t *cfg);
743 
747  ByteOrder byteOrder;
748 
751  public:
761  void
762  registerKickCallback(const std::function<void()> &callback)
763  {
764  assert(!transKick);
765  transKick = callback;
766  }
767 
768 
778  void onNotify(QueueID index);
779 
780 
790  void setQueueSelect(QueueID idx) { _queueSelect = idx; }
800  QueueID getQueueSelect() const { return _queueSelect; }
801 
816  void setQueueAddress(uint32_t address);
830  uint32_t getQueueAddress() const;
831 
838  uint16_t getQueueSize() const { return getCurrentQueue().getSize(); }
839 
848  void setDeviceStatus(DeviceStatus status);
849 
855  DeviceStatus getDeviceStatus() const { return _deviceStatus; }
856 
863  void setGuestFeatures(FeatureBits features);
864 
871 
874 
876  const size_t configSize;
877 
882  private:
884  const VirtQueue &getCurrentQueue() const;
887 
894  DeviceStatus _deviceStatus;
895 
898 
901 
903  std::function<void()> transKick;
904 };
905 
907 {
908  public:
909  VirtIODummyDevice(const VirtIODummyDeviceParams &params);
910 
911  protected:
913  static const DeviceId ID_INVALID = 0x00;
914 };
915 
916 } // namespace gem5
917 
918 #endif // __DEV_VIRTIO_BASE_HH__
gem5::VirtIODeviceBase::getCurrentQueue
const VirtQueue & getCurrentQueue() const
Convenience method to get the currently selected queue.
Definition: base.cc:459
gem5::VirtQueue::memProxy
PortProxy & memProxy
Guest physical memory proxy.
Definition: base.hh:457
gem5::VirtQueue::VirtRing::writeHeader
void writeHeader()
Definition: base.hh:510
gem5::VirtQueue::used
VirtRing< struct vring_used_elem > used
Ring of used (outgoing) descriptors.
Definition: base.hh:566
gem5::ArmISA::len
Bitfield< 18, 16 > len
Definition: misc_types.hh:444
gem5::PortProxy::writeBlob
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
Definition: port_proxy.hh:192
gem5::VirtIODeviceBase::writeConfigBlob
void writeConfigBlob(PacketPtr pkt, Addr cfgOffset, uint8_t *cfg)
Write configuration data to a device structure.
Definition: base.cc:446
gem5::VirtIODeviceBase::~VirtIODeviceBase
virtual ~VirtIODeviceBase()
Definition: base.cc:350
gem5::VirtDescriptor::write
void write(size_t offset, const uint8_t *src, size_t size)
Write to the contents of a descriptor.
Definition: base.cc:160
gem5::VirtDescriptor::dumpChain
void dumpChain() const
Dump the contents of a descriptor chain starting at this descriptor.
Definition: base.cc:126
gem5::VirtIODeviceBase::transKick
std::function< void()> transKick
Callbacks to kick the guest through the transport layer
Definition: base.hh:903
serialize.hh
gem5::VirtDescriptor::index
Index index() const
Get the descriptor's index into the virtqueue.
Definition: base.hh:144
gem5::VirtQueue::VirtRing::read
void read()
Definition: base.hh:520
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::VirtDescriptor::desc
vring_desc desc
Underlying descriptor.
Definition: base.hh:290
gem5::VirtDescriptor::hasNext
bool hasNext() const
Is this descriptor chained to another descriptor?
Definition: base.hh:220
gem5::VirtIODeviceBase::DeviceId
uint16_t DeviceId
Device Type (sometimes known as subsystem ID)
Definition: base.hh:599
gem5::VirtQueue::getAddress
Addr getAddress() const
Get the guest physical address of this queue.
Definition: base.hh:335
gem5::VirtDescriptor::Index
uint16_t Index
Descriptor index in virtqueue.
Definition: base.hh:121
gem5::VirtQueue::VirtRing::_base
Addr _base
Guest physical base address of the ring buffer.
Definition: base.hh:558
gem5::VirtDescriptor::isIncoming
bool isIncoming() const
Check if this is a read-only descriptor (incoming data).
Definition: base.hh:230
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::VirtIODeviceBase::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: base.cc:365
gem5::VirtDescriptor::update
void update()
Populate this descriptor with data from the guest.
Definition: base.cc:78
gem5::VirtQueue::reset
void reset()
Reset cached state in this queue and in the associated ring buffers.
Definition: base.cc:262
gem5::VirtDescriptor::queue
VirtQueue * queue
Pointer to virtqueue owning this descriptor.
Definition: base.hh:281
gem5::VirtQueue::dump
void dump() const
Dump the contents of a queue.
Definition: base.cc:318
VRING_DESC_F_NEXT
#define VRING_DESC_F_NEXT
Definition: virtio_ring.h:37
gem5::VirtIODeviceBase::_queueSelect
QueueID _queueSelect
Queue select register (set by guest)
Definition: base.hh:897
gem5::VirtQueue::VirtRing::Flags
uint16_t Flags
Definition: base.hh:471
gem5::VirtIODeviceBase::configSize
const size_t configSize
Size of the device's configuration space.
Definition: base.hh:876
gem5::VirtQueue::ALIGN_BITS
static const Addr ALIGN_BITS
Page size used by VirtIO. It's hard-coded to 4096 bytes in the spec for historical reasons.
Definition: base.hh:430
gem5::VirtIODummyDevice::ID_INVALID
static const DeviceId ID_INVALID
VirtIO device ID.
Definition: base.hh:913
gem5::VirtIODeviceBase::driver_ok
Bitfield< 2 > driver_ok
Definition: base.hh:603
vring_desc::len
uint32_t len
Definition: virtio_ring.h:67
gem5::VirtIODeviceBase::writeConfig
virtual void writeConfig(PacketPtr pkt, Addr cfgOffset)
Write to the configuration space of a device.
Definition: base.cc:428
std::vector
STL vector class.
Definition: stl.hh:37
gem5::VirtQueue::VirtRing::Header::flags
Flags flags
Definition: base.hh:476
gem5::VirtDescriptor::chainWrite
void chainWrite(size_t offset, const uint8_t *src, size_t size)
Write to a descriptor chain.
Definition: base.cc:195
gem5::VirtIODeviceBase::setGuestFeatures
void setGuestFeatures(FeatureBits features)
Set feature bits accepted by the guest driver.
Definition: base.cc:398
gem5::VirtIODeviceBase::EndBitUnion
EndBitUnion(DeviceStatus) typedef VirtIODeviceBaseParams Params
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
gem5::VirtDescriptor::dump
void dump() const
Dump the contents of a descriptor.
Definition: base.cc:109
gem5::VirtQueue::VirtRing
VirtIO ring buffer wrapper.
Definition: base.hh:468
gem5::VirtQueue::VirtRing::reset
void reset()
Reset any state in the ring buffer.
Definition: base.hh:486
gem5::VirtIODeviceBase::readConfigBlob
void readConfigBlob(PacketPtr pkt, Addr cfgOffset, const uint8_t *cfg)
Read configuration data from a device structure.
Definition: base.cc:434
gem5::VirtDescriptor::next
VirtDescriptor * next() const
Get the pointer to the next descriptor in a chain.
Definition: base.cc:138
gem5::VirtDescriptor::isOutgoing
bool isOutgoing() const
Check if this is a write-only descriptor (outgoing data).
Definition: base.hh:232
gem5::VirtIODeviceBase::reset
virtual void reset()
Driver-request device reset.
Definition: base.cc:375
gem5::SimObject::Params
SimObjectParams Params
Definition: sim_object.hh:170
gem5::VirtIODeviceBase::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: base.cc:355
gem5::VirtQueue
Base wrapper around a virtqueue.
Definition: base.hh:302
gem5::VirtQueue::VirtRing::_proxy
PortProxy & _proxy
Guest physical memory proxy.
Definition: base.hh:556
gem5::Serializable
Basic support for object serialization.
Definition: serialize.hh:169
gem5::VirtQueue::onNotify
virtual void onNotify()
Notify queue of pending events.
Definition: base.cc:328
gem5::VirtIODeviceBase::getQueueSize
uint16_t getQueueSize() const
Get the size (descriptors) of the currently active queue.
Definition: base.hh:838
gem5::VirtIODeviceBase::acknowledge
Bitfield< 0 > acknowledge
Definition: base.hh:605
gem5::VirtQueue::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: base.cc:242
gem5::VirtIODeviceBase::setQueueSelect
void setQueueSelect(QueueID idx)
Change currently active queue.
Definition: base.hh:790
gem5::VirtIODeviceBase::registerKickCallback
void registerKickCallback(const std::function< void()> &callback)
Register a callback to kick the guest through the transport interface.
Definition: base.hh:762
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
sim_object.hh
gem5::VirtDescriptor::chainSize
size_t chainSize() const
Retrieve the size of this descriptor chain.
Definition: base.cc:218
gem5::VirtIODeviceBase::registerQueue
void registerQueue(VirtQueue &queue)
Register a new VirtQueue with the device model.
Definition: base.cc:491
gem5::VirtIODeviceBase::driver
Bitfield< 1 > driver
Definition: base.hh:604
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::VirtIODeviceBase::setQueueAddress
void setQueueAddress(uint32_t address)
Change the host physical address of the currently active queue.
Definition: base.cc:477
gem5::VirtIODeviceBase::kick
void kick()
Inform the guest of available buffers.
Definition: base.hh:638
gem5::VirtIODeviceBase::deviceId
const DeviceId deviceId
Device ID (sometimes known as subsystem ID)
Definition: base.hh:873
gem5::VirtIODeviceBase::_queues
std::vector< VirtQueue * > _queues
List of virtual queues supported by this device.
Definition: base.hh:900
gem5::VirtIODummyDevice
Definition: base.hh:906
gem5::PowerISA::bo
Bitfield< 25, 21 > bo
Definition: types.hh:82
gem5::VirtQueue::~VirtQueue
virtual ~VirtQueue()
Definition: base.hh:305
gem5::VirtIODeviceBase::_deviceStatus
DeviceStatus _deviceStatus
Status of the device.
Definition: base.hh:894
gem5::VirtQueue::setAddress
void setAddress(Addr address)
Set the base address of this queue.
Definition: base.cc:272
gem5::VirtDescriptor::memProxy
PortProxy * memProxy
Pointer to memory proxy.
Definition: base.hh:279
bitunion.hh
gem5::VirtIODeviceBase::deviceFeatures
const FeatureBits deviceFeatures
Feature set offered by the device.
Definition: base.hh:879
gem5::ArmISA::v
Bitfield< 28 > v
Definition: misc_types.hh:54
gem5::VirtDescriptor::size
size_t size() const
Retrieve the size of this descriptor.
Definition: base.hh:213
gem5::VirtQueue::VirtRing::readHeader
void readHeader()
Update the ring buffer header with data from the guest.
Definition: base.hh:501
port_proxy.hh
gem5::gtoh
T gtoh(T value, ByteOrder guest_byte_order)
Definition: byteswap.hh:194
gem5::VirtIODeviceBase::guestFeatures
FeatureBits guestFeatures
Feature set accepted by the guest.
Definition: base.hh:668
gem5::PortProxy
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:86
gem5::VirtIODummyDevice::VirtIODummyDevice
VirtIODummyDevice(const VirtIODummyDeviceParams &params)
Definition: base.cc:497
gem5::htog
T htog(T value, ByteOrder guest_byte_order)
Definition: byteswap.hh:187
gem5::swap_byte
std::enable_if_t< std::is_same< T, vring_used_elem >::value, T > swap_byte(T v)
Definition: base.hh:76
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::VirtQueue::VirtRing::byteOrder
ByteOrder byteOrder
Byte order in the ring.
Definition: base.hh:560
compiler.hh
gem5::VirtDescriptor::byteOrder
ByteOrder byteOrder
The byte order the descriptor is stored in.
Definition: base.hh:284
gem5::VirtIODeviceBase::onNotify
void onNotify(QueueID index)
Driver is requesting service.
Definition: base.cc:386
gem5::VirtIODeviceBase
Base class for all VirtIO-based devices.
Definition: base.hh:587
gem5::PortProxy::readBlob
void readBlob(Addr addr, void *p, int size) const
Higher level interfaces based on the above.
Definition: port_proxy.hh:182
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::VirtQueue::descriptors
std::vector< VirtDescriptor > descriptors
Vector of pre-created descriptors indexed by their index into the queue.
Definition: base.hh:574
gem5::VirtIODeviceBase::BitUnion8
BitUnion8(DeviceStatus) Bitfield< 7 > failed
gem5::VirtQueue::VirtRing::header
Header header
Ring buffer header in host byte order.
Definition: base.hh:547
gem5::VirtQueue::VirtRing::setAddress
void setAddress(Addr addr)
Set the base address of the VirtIO ring buffer.
Definition: base.hh:497
gem5::VirtQueue::_size
const uint16_t _size
Queue size in terms of number of descriptors.
Definition: base.hh:453
gem5::VirtIODeviceBase::FeatureBits
uint32_t FeatureBits
Definition: base.hh:591
gem5::VirtDescriptor::_index
Index _index
Index in virtqueue.
Definition: base.hh:287
vring_desc::flags
uint16_t flags
Definition: virtio_ring.h:69
vring_desc
Definition: virtio_ring.h:62
gem5::VirtIODeviceBase::getDeviceStatus
DeviceStatus getDeviceStatus() const
Retrieve the device status.
Definition: base.hh:855
gem5::VirtQueue::avail
VirtRing< VirtDescriptor::Index > avail
Ring of available (incoming) descriptors.
Definition: base.hh:564
gem5::VirtIODeviceBase::VirtAddress
uint16_t VirtAddress
This is a VirtQueue address as exposed through the low-level interface. The address needs to be multi...
Definition: base.hh:597
gem5::VirtQueue::onNotifyDescriptor
virtual void onNotifyDescriptor(VirtDescriptor *desc)
Notify queue of pending incoming descriptor.
Definition: base.hh:415
gem5::VirtDescriptor
VirtIO descriptor (chain) wrapper.
Definition: base.hh:117
gem5::VirtQueue::VirtRing::Header::index
Index index
Definition: base.hh:477
gem5::VirtQueue::ALIGN_SIZE
static const Addr ALIGN_SIZE
Definition: base.hh:431
gem5::VirtQueue::getSize
uint16_t getSize() const
Get the number of descriptors available in this queue.
Definition: base.hh:342
types.hh
gem5::VirtIODeviceBase::byteOrder
ByteOrder byteOrder
The byte order of the queues, descriptors, etc.
Definition: base.hh:747
gem5::VirtQueue::produceDescriptor
void produceDescriptor(VirtDescriptor *desc, uint32_t len)
Send a descriptor chain to the guest.
Definition: base.cc:304
gem5::VirtQueue::getDescriptor
VirtDescriptor * getDescriptor(VirtDescriptor::Index index)
Get a pointer to a specific descriptor in the queue.
Definition: base.hh:353
gem5::VirtQueue::VirtQueue
VirtQueue()
gem5::VirtDescriptor::VirtDescriptor
VirtDescriptor()
gem5::VirtQueue::byteOrder
ByteOrder byteOrder
Byte order in this queue.
Definition: base.hh:447
gem5::VirtQueue::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: base.cc:249
gem5::VirtIODeviceBase::getQueueSelect
QueueID getQueueSelect() const
Get the currently active queue.
Definition: base.hh:800
gem5::VirtDescriptor::chainRead
void chainRead(size_t offset, uint8_t *dst, size_t size) const
Read the contents of a descriptor chain.
Definition: base.cc:172
gem5::VirtIODeviceBase::VirtIODeviceBase
VirtIODeviceBase(const Params &params, DeviceId id, size_t config_size, FeatureBits features)
Definition: base.cc:339
gem5::VirtQueue::_address
Addr _address
Base address of the queue.
Definition: base.hh:455
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::VirtDescriptor::~VirtDescriptor
~VirtDescriptor() noexcept
Definition: base.cc:61
gem5::VirtIODeviceBase::getGuestFeatures
FeatureBits getGuestFeatures() const
Get features accepted by the guest driver.
Definition: base.hh:870
gem5::VirtIODeviceBase::QueueID
uint16_t QueueID
Definition: base.hh:590
gem5::VirtQueue::_last_avail
uint16_t _last_avail
Offset of last consumed descriptor in the VirtQueue::avail ring.
Definition: base.hh:570
gem5::VirtQueue::VirtRing::ring
std::vector< T > ring
Elements in ring in host byte order.
Definition: base.hh:549
VRING_DESC_F_WRITE
#define VRING_DESC_F_WRITE
Definition: virtio_ring.h:39
gem5::VirtQueue::VirtRing::Index
uint16_t Index
Definition: base.hh:472
gem5::VirtIODeviceBase::getQueueAddress
uint32_t getQueueAddress() const
Get the host physical address of the currently active queue.
Definition: base.cc:483
virtio_ring.h
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::VirtDescriptor::read
void read(size_t offset, uint8_t *dst, size_t size) const
Read the contents of a descriptor.
Definition: base.cc:148
gem5::VirtQueue::consumeDescriptor
VirtDescriptor * consumeDescriptor()
Get an incoming descriptor chain from the queue.
Definition: base.cc:285
gem5::VirtQueue::VirtRing::Header
Definition: base.hh:474
gem5::VirtDescriptor::updateChain
void updateChain()
Populate this descriptor chain with data from the guest.
Definition: base.cc:97
gem5::VirtQueue::VirtRing::write
void write()
Definition: base.hh:533
gem5::VirtIODeviceBase::readConfig
virtual void readConfig(PacketPtr pkt, Addr cfgOffset)
Read from the configuration space of a device.
Definition: base.cc:422
gem5::VirtIODeviceBase::setDeviceStatus
void setDeviceStatus(DeviceStatus status)
Update device status and optionally reset device.
Definition: base.cc:412
gem5::ArmISA::status
Bitfield< 5, 0 > status
Definition: misc_types.hh:422
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Tue Sep 21 2021 12:24:57 for gem5 by doxygen 1.8.17