dev-arm: Treat GICv3 reserved addresses as RES0

According to the GIC specification (IHI0069) reserved addresses in the
GIC memory map are treated as RES0.  We allow to disable this behaviour
and panic instead (reserved_res0 = False, which is what we have been
doing so far) to catch development bugs (in gem5 and in the guest SW)

Change-Id: I23f98519c2f256c092a52425735b8792bae7a2c7
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71138
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2023-05-31 13:57:12 +01:00
parent 942a9ea503
commit b355baac93
4 changed files with 26 additions and 6 deletions

View File

@@ -315,6 +315,15 @@ class Gicv3(BaseGic):
gicv4 = Param.Bool(False, "GIC is GICv4 compatible")
reserved_is_res0 = Param.Bool(
True,
"According to the GIC specification (IHI0069) "
"reserved addresses in the GIC memory map are treated as RES0. "
"We allow to disable this behaviour and panic instead "
"(reserved_res0 = False) to catch development bugs "
"(in gem5 and in the guest SW)",
)
def interruptCells(self, int_type, int_num, int_trigger, partition=None):
"""
Interupt cells generation helper:

View File

@@ -167,6 +167,17 @@ class Gicv3 : public BaseGic, public Gicv3Registers
Tick write(PacketPtr pkt) override;
bool supportsVersion(GicVersion version) override;
template<typename... Args>
void
reserved(const char* fmt, Args... args) const
{
if (params().reserved_is_res0) {
warn(fmt, args...);
} else {
panic(fmt, args...);
}
}
public:
Gicv3(const Params &p);

View File

@@ -505,8 +505,8 @@ Gicv3Distributor::read(Addr addr, size_t size, bool is_secure_access)
return 0; // RES0
default:
panic("Gicv3Distributor::read(): invalid offset %#x\n", addr);
break;
gic->reserved("Gicv3Distributor::read(): invalid offset %#x\n", addr);
return 0; // RES0
}
}
@@ -999,7 +999,7 @@ Gicv3Distributor::write(Addr addr, uint64_t data, size_t size,
}
default:
panic("Gicv3Distributor::write(): invalid offset %#x\n", addr);
gic->reserved("Gicv3Distributor::write(): invalid offset %#x\n", addr);
break;
}
}

View File

@@ -377,8 +377,8 @@ Gicv3Redistributor::read(Addr addr, size_t size, bool is_secure_access)
return 0;
default:
panic("Gicv3Redistributor::read(): invalid offset %#x\n", addr);
break;
gic->reserved("Gicv3Redistributor::read(): invalid offset %#x\n", addr);
return 0; // RES0
}
}
@@ -704,7 +704,7 @@ Gicv3Redistributor::write(Addr addr, uint64_t data, size_t size,
}
default:
panic("Gicv3Redistributor::write(): invalid offset %#x\n", addr);
gic->reserved("Gicv3Redistributor::write(): invalid offset %#x\n", addr);
break;
}
}