From 49a71ca1d0da10495651375ea0587c3fb6019702 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Wed, 1 May 2019 10:59:22 +0100 Subject: [PATCH] dev-arm: Store a PhysProxy port in Gicv3Redist This spares us from retrieving the TC pointer every time we want to write/read to memory (LPIs) Change-Id: Iad76b5e69188fa0ac5c6777a3b2664b0fc66b12f Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18600 Maintainer: Andreas Sandberg Tested-by: kokoro --- src/dev/arm/gic_v3_redistributor.cc | 30 ++++++++++++++--------------- src/dev/arm/gic_v3_redistributor.hh | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/dev/arm/gic_v3_redistributor.cc b/src/dev/arm/gic_v3_redistributor.cc index 0ee6b8adc..de6bd6389 100644 --- a/src/dev/arm/gic_v3_redistributor.cc +++ b/src/dev/arm/gic_v3_redistributor.cc @@ -44,6 +44,7 @@ Gicv3Redistributor::Gicv3Redistributor(Gicv3 * gic, uint32_t cpu_id) distributor(nullptr), cpuInterface(nullptr), cpuId(cpu_id), + memProxy(nullptr), irqGroup(Gicv3::SGI_MAX + Gicv3::PPI_MAX), irqEnabled(Gicv3::SGI_MAX + Gicv3::PPI_MAX), irqPending(Gicv3::SGI_MAX + Gicv3::PPI_MAX), @@ -61,6 +62,8 @@ Gicv3Redistributor::init() { distributor = gic->getDistributor(); cpuInterface = gic->getCPUInterface(cpuId); + + memProxy = &gic->getSystem()->physProxy; } void @@ -804,7 +807,6 @@ Gicv3Redistributor::update() // Check LPIs if (EnableLPIs) { - ThreadContext * tc = gic->getSystem()->getThreadContext(cpuId); const uint32_t largest_lpi_id = 1 << (lpiIDBits + 1); const uint32_t number_lpis = largest_lpi_id - SMALLEST_LPI_ID + 1; @@ -812,13 +814,13 @@ Gicv3Redistributor::update() uint8_t lpi_pending_table[largest_lpi_id / 8]; uint8_t lpi_config_table[number_lpis]; - tc->getPhysProxy().readBlob(lpiPendingTablePtr, - (uint8_t *) lpi_pending_table, - sizeof(lpi_pending_table)); + memProxy->readBlob(lpiPendingTablePtr, + (uint8_t *) lpi_pending_table, + sizeof(lpi_pending_table)); - tc->getPhysProxy().readBlob(lpiConfigurationTablePtr, - (uint8_t*) lpi_config_table, - sizeof(lpi_config_table)); + memProxy->readBlob(lpiConfigurationTablePtr, + (uint8_t*) lpi_config_table, + sizeof(lpi_config_table)); for (int lpi_id = SMALLEST_LPI_ID; lpi_id < largest_lpi_id; lpi_id++) { @@ -866,10 +868,9 @@ Gicv3Redistributor::readEntryLPI(uint32_t lpi_id) Addr lpi_pending_entry_ptr = lpiPendingTablePtr + (lpi_id / 8); uint8_t lpi_pending_entry; - ThreadContext * tc = gic->getSystem()->getThreadContext(cpuId); - tc->getPhysProxy().readBlob(lpi_pending_entry_ptr, - (uint8_t*) &lpi_pending_entry, - sizeof(lpi_pending_entry)); + memProxy->readBlob(lpi_pending_entry_ptr, + (uint8_t*) &lpi_pending_entry, + sizeof(lpi_pending_entry)); return lpi_pending_entry; } @@ -879,10 +880,9 @@ Gicv3Redistributor::writeEntryLPI(uint32_t lpi_id, uint8_t lpi_pending_entry) { Addr lpi_pending_entry_ptr = lpiPendingTablePtr + (lpi_id / 8); - ThreadContext * tc = gic->getSystem()->getThreadContext(cpuId); - tc->getPhysProxy().writeBlob(lpi_pending_entry_ptr, - (uint8_t*) &lpi_pending_entry, - sizeof(lpi_pending_entry)); + memProxy->writeBlob(lpi_pending_entry_ptr, + (uint8_t*) &lpi_pending_entry, + sizeof(lpi_pending_entry)); } bool diff --git a/src/dev/arm/gic_v3_redistributor.hh b/src/dev/arm/gic_v3_redistributor.hh index 6aff91db5..8d7de3d7a 100644 --- a/src/dev/arm/gic_v3_redistributor.hh +++ b/src/dev/arm/gic_v3_redistributor.hh @@ -51,6 +51,7 @@ class Gicv3Redistributor : public Serializable Gicv3Distributor * distributor; Gicv3CPUInterface * cpuInterface; uint32_t cpuId; + PortProxy * memProxy; /* * GICv3 defines 2 contiguous 64KB frames for each redistributor. -- 2.30.2