summaryrefslogtreecommitdiff
path: root/src/dev/arm/gic_v3_its.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dev/arm/gic_v3_its.cc')
-rw-r--r--src/dev/arm/gic_v3_its.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/dev/arm/gic_v3_its.cc b/src/dev/arm/gic_v3_its.cc
index ca363f409..ab0d8c2d0 100644
--- a/src/dev/arm/gic_v3_its.cc
+++ b/src/dev/arm/gic_v3_its.cc
@@ -1065,19 +1065,30 @@ Gicv3Its::incrementReadPointer()
gitsCreadr.offset = gitsCreadr.offset + 1;
// Check for wrapping
- auto queue_end = (4096 * (gitsCbaser.size + 1));
-
- if (gitsCreadr.offset == queue_end) {
+ if (gitsCreadr.offset == maxCommands()) {
gitsCreadr.offset = 0;
}
}
+uint64_t
+Gicv3Its::maxCommands() const
+{
+ return (4096 * (gitsCbaser.size + 1)) / sizeof(ItsCommand::CommandEntry);
+}
+
void
Gicv3Its::checkCommandQueue()
{
if (!gitsControl.enabled || !gitsCbaser.valid)
return;
+ // If GITS_CWRITER gets set by sw to a value bigger than the
+ // allowed one, the command queue should stop processing commands
+ // until the register gets reset to an allowed one
+ if (gitsCwriter.offset >= maxCommands()) {
+ return;
+ }
+
if (gitsCwriter.offset != gitsCreadr.offset) {
// writer and reader pointing to different command
// entries: queue not empty.