From 3126e84db773f64e46b1d02a9a27892bf6612d30 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Tue, 20 Aug 2019 16:18:53 +0100 Subject: dev-arm: Fix GICv3 ITS indexing error Table walks were not considering the entry size when evaluating the address. Change-Id: Ica6bf6d88632985ee8ed120448b32e0f7e918a8a Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20329 Maintainer: Andreas Sandberg Tested-by: kokoro --- src/dev/arm/gic_v3_its.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dev/arm/gic_v3_its.cc b/src/dev/arm/gic_v3_its.cc index 692bbd071..f822042ce 100644 --- a/src/dev/arm/gic_v3_its.cc +++ b/src/dev/arm/gic_v3_its.cc @@ -146,7 +146,7 @@ void ItsProcess::writeDeviceTable(Yield &yield, uint32_t device_id, DTE dte) { const Addr base = its.pageAddress(Gicv3Its::DEVICE_TABLE); - const Addr address = base + device_id; + const Addr address = base + (device_id * sizeof(dte)); DPRINTF(ITS, "Writing DTE at address %#x: %#x\n", address, dte); @@ -157,7 +157,7 @@ void ItsProcess::writeIrqTranslationTable( Yield &yield, const Addr itt_base, uint32_t event_id, ITTE itte) { - const Addr address = itt_base + event_id; + const Addr address = itt_base + (event_id * sizeof(itte)); doWrite(yield, address, &itte, sizeof(itte)); @@ -169,7 +169,7 @@ ItsProcess::writeIrqCollectionTable( Yield &yield, uint32_t collection_id, CTE cte) { const Addr base = its.pageAddress(Gicv3Its::COLLECTION_TABLE); - const Addr address = base + collection_id; + const Addr address = base + (collection_id * sizeof(cte)); doWrite(yield, address, &cte, sizeof(cte)); @@ -179,10 +179,10 @@ ItsProcess::writeIrqCollectionTable( uint64_t ItsProcess::readDeviceTable(Yield &yield, uint32_t device_id) { + uint64_t dte; const Addr base = its.pageAddress(Gicv3Its::DEVICE_TABLE); - const Addr address = base + device_id; + const Addr address = base + (device_id * sizeof(dte)); - uint64_t dte; doRead(yield, address, &dte, sizeof(dte)); DPRINTF(ITS, "Reading DTE at address %#x: %#x\n", address, dte); @@ -193,9 +193,9 @@ uint64_t ItsProcess::readIrqTranslationTable( Yield &yield, const Addr itt_base, uint32_t event_id) { - const Addr address = itt_base + event_id; - uint64_t itte; + const Addr address = itt_base + (event_id * sizeof(itte)); + doRead(yield, address, &itte, sizeof(itte)); DPRINTF(ITS, "Reading ITTE at address %#x: %#x\n", address, itte); @@ -205,10 +205,10 @@ ItsProcess::readIrqTranslationTable( uint64_t ItsProcess::readIrqCollectionTable(Yield &yield, uint32_t collection_id) { + uint64_t cte; const Addr base = its.pageAddress(Gicv3Its::COLLECTION_TABLE); - const Addr address = base + collection_id; + const Addr address = base + (collection_id * sizeof(cte)); - uint64_t cte; doRead(yield, address, &cte, sizeof(cte)); DPRINTF(ITS, "Reading CTE at address %#x: %#x\n", address, cte); -- cgit v1.2.3