dev-arm: Fix VExpressFastmodel timer configs
authorYu-hsin Wang <yuhsingw@google.com>
Wed, 21 Oct 2020 10:19:34 +0000 (18:19 +0800)
committerYu-hsin Wang <yuhsingw@google.com>
Tue, 3 Nov 2020 01:29:21 +0000 (01:29 +0000)
generic_timer is no longer in the return value of _on_chip_devices. We
should correct the _on_chip_devices. Furthermore, to prevent the timer
conflict with the fastmodel, we should remove unwanted timer.

Change-Id: I6ec7f9749546df3e8f125a5b96e7ed83cab2ea56
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36379
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/fastmodel/CortexA76/FastModelCortexA76.py
src/dev/arm/VExpressFastmodel.py

index 65d57a1c1c15a8550fd7126752949fca440c2ce2..0b0fa8d99dceed446653aeca8bb84426b4c0b644 100644 (file)
@@ -34,6 +34,7 @@ from m5.objects.FastModelGIC import Gicv3CommsTargetSocket
 from m5.objects.Gic import ArmPPI
 from m5.objects.Iris import IrisBaseCPU
 from m5.objects.SystemC import SystemC_ScModule
+from m5.util.fdthelper import FdtNode, FdtPropertyWords
 
 class FastModelCortexA76(IrisBaseCPU):
     type = 'FastModelCortexA76'
@@ -348,6 +349,21 @@ class FastModelCortexA76Cluster(SimObject):
     walk_cache_latency = Param.UInt64(0, "Walk cache latency for TA (Timing "\
             "Annotation), expressed in simulation ticks")
 
+    def generateDeviceTree(self, state):
+        node = FdtNode("timer")
+
+        node.appendCompatible(["arm,cortex-a15-timer",
+                               "arm,armv7-timer",
+                               "arm,armv8-timer"])
+        node.append(FdtPropertyWords("interrupts", [
+            1, int(self.cntpsirq.num), 0xf08,
+            1, int(self.cntpnsirq.num), 0xf08,
+            1, int(self.cntvirq.num), 0xf08,
+            1, int(self.cnthpirq.num), 0xf08,
+        ]))
+
+        yield node
+
 class FastModelScxEvsCortexA76x1(SystemC_ScModule):
     type = 'FastModelScxEvsCortexA76x1'
     cxx_class = 'FastModel::ScxEvsCortexA76<FastModel::ScxEvsCortexA76x1Types>'
index 015f6d4d74c7758ebab48c6027da7284d58b2d05..a6b9b342657313a36a76205fd02f39e36670e2cc 100644 (file)
@@ -26,6 +26,7 @@
 from m5.objects.FastModelGIC import FastModelGIC, SCFastModelGIC
 from m5.objects.Gic import ArmSPI
 from m5.objects.RealView import VExpress_GEM5_Base, HDLcd
+from m5.objects.SubSystem import SubSystem
 
 class VExpressFastmodel(VExpress_GEM5_Base):
     gic = FastModelGIC(
@@ -39,14 +40,19 @@ class VExpressFastmodel(VExpress_GEM5_Base):
         pxl_clk=VExpress_GEM5_Base.dcc.osc_pxl, pio_addr=0x2b000000,
         interrupt=ArmSPI(num=95))
 
-    def __init__(self, *args, **kwargs):
-        super(VExpressFastmodel, self).__init__(*args, **kwargs)
+    # Remove original timer to prevent from possible conflict with Fastmodel
+    # timer.
+    generic_timer = SubSystem()
+    generic_timer_mem = SubSystem()
+    sys_counter = SubSystem()
 
     def _on_chip_devices(self):
-        devices = super(VExpressFastmodel, self)._on_chip_devices()
-        devices += [ self.gic, self.hdlcd ]
-        devices.remove(self.generic_timer)
-        return devices
+        return [
+            self.gic,
+            self.hdlcd,
+            self.system_watchdog,
+            self.trusted_watchdog,
+        ]
 
     def setupBootLoader(self, cur_sys, loc, boot_loader=None):
         if boot_loader is None: