diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-04-26 11:24:17 +0100 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-05-02 14:42:42 +0000 |
commit | 5f29ec8a5e66e5865a35fb3bc509f31b20053081 (patch) | |
tree | b742c91e514a0a3830497bb89a5ed3219d414fa5 /src/dev | |
parent | 68f2f1c5f55bee74b7d4c99f3c612473869f81e6 (diff) | |
download | gem5-5f29ec8a5e66e5865a35fb3bc509f31b20053081.tar.xz |
dev-arm: Get a Gicv3Redistributor ptr from phys address
The patch is adding the following method to Gicv3:
* Gicv3::getRedistributorByAddr
This will be needed by the ITS when trying to select the target
redistributor after decoding the collection table entry (RDBase).
Change-Id: I40e2c155f2fdc8ca6d3c20ff7a27702e02499f20
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18597
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/dev')
-rw-r--r-- | src/dev/arm/gic_v3.cc | 49 | ||||
-rw-r--r-- | src/dev/arm/gic_v3.hh | 4 |
2 files changed, 33 insertions, 20 deletions
diff --git a/src/dev/arm/gic_v3.cc b/src/dev/arm/gic_v3.cc index 2832d33f8..9004f656f 100644 --- a/src/dev/arm/gic_v3.cc +++ b/src/dev/arm/gic_v3.cc @@ -110,19 +110,15 @@ Gicv3::read(PacketPtr pkt) "size %d is_secure_access %d (value %#x)\n", pkt->req->contextId(), daddr, size, is_secure_access, resp); } else if (redistRange.contains(addr)) { - Addr daddr = addr - redistRange.start(); - uint32_t redistributor_id = - daddr / redistSize; - daddr = daddr % redistSize; - panic_if(redistributor_id >= redistributors.size(), - "Invalid redistributor_id!"); - panic_if(!redistributors[redistributor_id], "Redistributor is null!"); - resp = redistributors[redistributor_id]->read(daddr, size, - is_secure_access); + Addr daddr = (addr - redistRange.start()) % redistSize; + + Gicv3Redistributor *redist = getRedistributorByAddr(addr); + resp = redist->read(daddr, size, is_secure_access); + delay = params()->redist_pio_delay; DPRINTF(GIC, "Gicv3::read(): (redistributor %d) context_id %d " "register %#x size %d is_secure_access %d (value %#x)\n", - redistributor_id, pkt->req->contextId(), daddr, size, + redist->processorNumber(), pkt->req->contextId(), daddr, size, is_secure_access, resp); } else { panic("Gicv3::read(): unknown address %#x\n", addr); @@ -151,19 +147,16 @@ Gicv3::write(PacketPtr pkt) distributor->write(daddr, data, size, is_secure_access); delay = params()->dist_pio_delay; } else if (redistRange.contains(addr)) { - Addr daddr = addr - redistRange.start(); - uint32_t redistributor_id = - daddr / redistSize; - daddr = daddr % redistSize; - panic_if(redistributor_id >= redistributors.size(), - "Invalid redistributor_id!"); - panic_if(!redistributors[redistributor_id], "Redistributor is null!"); + Addr daddr = (addr - redistRange.start()) % redistSize; + + Gicv3Redistributor *redist = getRedistributorByAddr(addr); DPRINTF(GIC, "Gicv3::write(): (redistributor %d) context_id %d " "register %#x size %d is_secure_access %d value %#x\n", - redistributor_id, pkt->req->contextId(), daddr, size, + redist->processorNumber(), pkt->req->contextId(), daddr, size, is_secure_access, data); - redistributors[redistributor_id]->write(daddr, data, size, - is_secure_access); + + redist->write(daddr, data, size, is_secure_access); + delay = params()->redist_pio_delay; } else { panic("Gicv3::write(): unknown address %#x\n", addr); @@ -228,6 +221,22 @@ Gicv3::getRedistributorByAffinity(uint32_t affinity) const return nullptr; } +Gicv3Redistributor * +Gicv3::getRedistributorByAddr(Addr addr) const +{ + panic_if(!redistRange.contains(addr), + "Address not pointing to a valid redistributor\n"); + + const Addr daddr = addr - redistRange.start(); + const uint32_t redistributor_id = daddr / redistSize; + + panic_if(redistributor_id >= redistributors.size(), + "Invalid redistributor_id!"); + panic_if(!redistributors[redistributor_id], "Redistributor is null!"); + + return redistributors[redistributor_id]; +} + void Gicv3::serialize(CheckpointOut & cp) const { diff --git a/src/dev/arm/gic_v3.hh b/src/dev/arm/gic_v3.hh index 48cc52029..5a13a7479 100644 --- a/src/dev/arm/gic_v3.hh +++ b/src/dev/arm/gic_v3.hh @@ -141,6 +141,10 @@ class Gicv3 : public BaseGic Gicv3Redistributor * getRedistributorByAffinity(uint32_t affinity) const; + + Gicv3Redistributor * + getRedistributorByAddr(Addr address) const; + void postInt(uint32_t cpu, ArmISA::InterruptTypes int_type); }; |