Go to the documentation of this file.
41 #include "debug/VirtIOMMIO.hh"
44 #include "params/MmioVirtIO.hh"
48 hostFeaturesSelect(0), guestFeaturesSelect(0), pageSize(0),
49 interruptStatus(0), vio(*params.vio)
62 const unsigned size(pkt->
getSize());
64 DPRINTF(VirtIOMMIO,
"Reading %u bytes @ 0x%x:\n", size,
offset);
71 panic_if(size != 4,
"Unexpected read size: %u\n", size);
74 DPRINTF(VirtIOMMIO,
" value: 0x%x\n", value);
76 pkt->
setLE<uint32_t>(value);
146 warn(
"Guest is trying to read to write-only register 0x%\n",
159 const unsigned size(pkt->
getSize());
161 DPRINTF(VirtIOMMIO,
"Writing %u bytes @ 0x%x:\n", size,
offset);
169 panic_if(size != 4,
"Unexpected write size @ 0x%x: %u\n",
offset, size);
170 DPRINTF(VirtIOMMIO,
" value: 0x%x\n", pkt->
getLE<uint32_t>());
187 }
else if (value != 0) {
188 warn(
"Setting unimplemented guest features register %u: %u\n",
200 "Unhandled VirtIO page size: %u", value);
210 warn_once(
"Ignoring queue resize hint. Requested size: %u\n", value);
217 "Unhandled VirtIO alignment size: %u", value);
233 panic_if(value > 0xff,
"Unexpected status: 0x%x\n", value);
245 warn(
"Guest is trying to write to read-only register 0x%\n",
257 DPRINTF(VirtIOMMIO,
"kick(): Sending interrupt...\n");
268 platform->postPciInt(_interruptID);
270 platform->clearPciInt(_interruptID);
void onNotify(QueueID index)
Driver is requesting service.
static const uint32_t VENDOR_ID
uint32_t guestFeaturesSelect
Addr pioAddr
Address that the device listens to.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
virtual void readConfig(PacketPtr pkt, Addr cfgOffset)
Read from the configuration space of a device.
DeviceStatus getDeviceStatus() const
Retrieve the device status.
void setInterrupts(uint32_t value)
uint64_t Tick
Tick count type.
uint32_t getQueueAddress() const
Get the host physical address of the currently active queue.
FeatureBits getGuestFeatures() const
Get features accepted by the guest driver.
const FeatureBits deviceFeatures
Feature set offered by the device.
void setQueueAddress(uint32_t address)
Change the host physical address of the currently active queue.
QueueID getQueueSelect() const
Get the currently active queue.
MmioVirtIO(const MmioVirtIOParams ¶ms)
static const Addr ALIGN_SIZE
@ OFF_GUEST_FEATURES_SELECT
static const uint32_t VERSION
uint16_t getQueueSize() const
Get the size (descriptors) of the currently active queue.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const uint32_t MAGIC
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
void setGuestFeatures(FeatureBits features)
Set feature bits accepted by the guest driver.
@ OFF_HOST_FEATURES_SELECT
void setQueueSelect(QueueID idx)
Change currently active queue.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
const DeviceId deviceId
Device ID (sometimes known as subsystem ID)
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void setDeviceStatus(DeviceStatus status)
Update device status and optionally reset device.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setLE(T v)
Set the value in the data pointer to v as little endian.
uint32_t hostFeaturesSelect
void registerKickCallback(const std::function< void()> &callback)
Register a callback to kick the guest through the transport interface.
#define panic(...)
This implements a cprintf based panic() function.
virtual void writeConfig(PacketPtr pkt, Addr cfgOffset)
Write to the configuration space of a device.
Generated on Tue Mar 23 2021 19:41:26 for gem5 by doxygen 1.8.17