dev-arm: Store a PhysProxy port in Gicv3Redist
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 1 May 2019 09:59:22 +0000 (10:59 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 2 May 2019 14:42:42 +0000 (14:42 +0000)
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 <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18600
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/arm/gic_v3_redistributor.cc
src/dev/arm/gic_v3_redistributor.hh

index 0ee6b8adc9cff1174ade0502a769f18ac77aa5b0..de6bd63891a502bf2616bb7665181b1c0b4718fb 100644 (file)
@@ -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
index 6aff91db5f4ef59c42297acf075b3b2005e024bf..8d7de3d7a366ca9c78554aec6ae5ca4d6fa49e44 100644 (file)
@@ -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.