dev-arm: Instantiate SCMI in VExpress_GEM5 platforms
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 28 May 2020 17:46:42 +0000 (18:46 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 2 Nov 2020 13:27:01 +0000 (13:27 +0000)
JIRA: https://gem5.atlassian.net/browse/GEM5-768

Change-Id: If5c03aed43f6a521c657e0c9b1dfa95fa4c72413
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34380
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/dev/arm/RealView.py

index d35f7ceda5fc0fe25d67e925b1306c807c895237..bf8e0e6cfaca2d18f371a3085236de21db08307e 100644 (file)
@@ -53,6 +53,7 @@ from m5.objects.Uart import Uart
 from m5.objects.SimpleMemory import SimpleMemory
 from m5.objects.GenericTimer import *
 from m5.objects.Gic import *
+from m5.objects.MHU import MHU, Scp2ApDoorbell, Ap2ScpDoorbell
 from m5.objects.EnergyCtrl import EnergyCtrl
 from m5.objects.ClockedObject import ClockedObject
 from m5.objects.SubSystem import SubSystem
@@ -61,6 +62,7 @@ from m5.objects.ClockedObject import ClockedObject
 from m5.objects.PS2 import *
 from m5.objects.VirtIOMMIO import MmioVirtIO
 from m5.objects.Display import Display, Display1080p
+from m5.objects.Scmi import *
 from m5.objects.SMMUv3 import SMMUv3
 from m5.objects.PciDevice import PciLegacyIoBar, PciIoBar
 
@@ -607,6 +609,23 @@ Reference:
     type = 'FVPBasePwrCtrl'
     cxx_header = 'dev/arm/fvp_base_pwr_ctrl.hh'
 
+class GenericMHU(MHU):
+    lowp_scp2ap = Scp2ApDoorbell(
+        set_address=0x10020008, clear_address=0x10020010,
+        interrupt=ArmSPI(num=68))
+    highp_scp2ap = Scp2ApDoorbell(
+        set_address=0x10020028, clear_address=0x10020030,
+        interrupt=ArmSPI(num=67))
+    sec_scp2ap = Scp2ApDoorbell(
+        set_address=0x10020208, clear_address=0x10020210,
+        interrupt=ArmSPI(num=69))
+    lowp_ap2scp = Ap2ScpDoorbell(
+        set_address=0x10020108, clear_address=0x10020110)
+    highp_ap2scp = Ap2ScpDoorbell(
+        set_address=0x10020128, clear_address=0x10020130)
+    sec_ap2scp = Ap2ScpDoorbell(
+        set_address=0x10020308, clear_address=0x10020310)
+
 class RealView(Platform):
     type = 'RealView'
     cxx_header = "dev/arm/realview.hh"
@@ -912,6 +931,7 @@ Memory map:
    0x10000000-0x13ffffff: gem5-specific peripherals (Off-chip, CS5)
        0x10000000-0x1000ffff: gem5 energy controller
        0x10010000-0x1001ffff: gem5 pseudo-ops
+       0x10020000-0x1002ffff: gem5 MHU
 
    0x14000000-0x17ffffff: Reserved (Off-chip, PSRAM, CS1)
    0x18000000-0x1bffffff: Reserved (Off-chip, Peripherals, CS2)
@@ -1188,6 +1208,25 @@ Interrupts:
         #  system.
         cur_sys.m5ops_base = 0x10010000
 
+    def attachScmi(self, bus):
+        # Generate and attach the mailbox
+        self.mailbox = GenericMHU(pio_addr=0x10020000)
+        self._attach_device(self.mailbox, bus)
+
+        # Generate and attach the SCMI platform
+        _scmi_comm = ScmiCommunication(
+            agent_channel = ScmiAgentChannel(
+                shmem=self.non_trusted_sram,
+                shmem_range=AddrRange(0x2e000000, size=0x200),
+                doorbell=self.mailbox.highp_ap2scp),
+            platform_channel = ScmiPlatformChannel(
+                shmem=self.non_trusted_sram,
+                shmem_range=AddrRange(0x2e000000, size=0x200),
+                doorbell=self.mailbox.highp_scp2ap))
+
+        self.scmi = ScmiPlatform(comms=[ _scmi_comm ])
+        self._attach_device(self.scmi, bus)
+
     def generateDeviceTree(self, state):
         # Generate using standard RealView function
         dt = list(super(VExpress_GEM5_Base, self).generateDeviceTree(state))