Hello Gabor Dozsa,

I'd like you to do a code review. Please visit

    https://gem5-review.googlesource.com/4202

to review the following change.


Change subject: config, arm: FS configuration for the ARM starter kit
......................................................................

config, arm: FS configuration for the ARM starter kit

Add a full system example configuration for the ARM Research Starter
Kit on System Modeling. More information can be found at:
http://www.arm.com/ResearchEnablement/SystemModeling

Change-Id: Ifa40419d21923a32bb383d58466e421fe4260ddd
Signed-off-by: Gabor Dozsa <[email protected]>
Signed-off-by: Andreas Sandberg <[email protected]>
---
A configs/example/arm/starter_fs.py
1 file changed, 212 insertions(+), 0 deletions(-)



diff --git a/configs/example/arm/starter_fs.py b/configs/example/arm/starter_fs.py
new file mode 100644
index 0000000..f3dbbec
--- /dev/null
+++ b/configs/example/arm/starter_fs.py
@@ -0,0 +1,212 @@
+# Copyright (c) 2016-2017 ARM Limited
+# All rights reserved.
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder.  You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#  Authors:  Andreas Sandberg
+#            Chuan Zhu
+#            Gabor Dozsa
+#
+
+import os
+import m5
+from m5.util import addToPath
+from m5.objects import *
+import argparse
+
+m5.util.addToPath('../..')
+
+from common import SysPaths
+from common import MemConfig
+from common.cores.arm import HPI
+
+import devices
+
+
+default_dist_version = '20170616'
+
+default_kernel = 'vmlinux.vexpress_gem5_v1_64.' + default_dist_version
+default_disk = 'linaro-minimal-aarch64.img'
+default_mem_size= "2GB"
+
+
+
+# Pre-defined CPU configurations. Each tuple must be ordered as : (cpu_class, +# l1_icache_class, l1_dcache_class, walk_cache_class, l2_Cache_class). Any of
+# the cache class may be 'None' if the particular cache is not present.
+cpu_types = {
+
+    "atomic" : ( AtomicSimpleCPU, None, None, None, None),
+    "minor" : (MinorCPU,
+               devices.L1I, devices.L1D,
+               devices.WalkCache,
+               devices.L2),
+    "hpi" : ( HPI.HPI,
+              HPI.HPI_ICache, HPI.HPI_DCache,
+              HPI.HPI_WalkCache,
+              HPI.HPI_L2)
+}
+
+
+def addOptions(parser):
+    parser.add_argument("--dtb", type=str, default=None,
+                        help="DTB file to load")
+    parser.add_argument("--kernel", type=str, default=default_kernel,
+                        help="Linux kernel")
+    parser.add_argument("--disk-image", type=str,
+                        default=default_disk,
+                        help="Disk to instantiate")
+    parser.add_argument("--script", type=str, default="",
+                        help = "Linux bootscript")
+    parser.add_argument("--cpu", type=str, choices=cpu_types.keys(),
+                        default="atomic",
+                        help="CPU model to use")
+    parser.add_argument("--cpu-freq", type=str, default="4GHz")
+    parser.add_argument("--num-cores", type=int, default=1,
+                        help="Number of CPU cores")
+    parser.add_argument("--mem-type", default="DDR3_1600_8x8",
+                        choices=MemConfig.mem_names(),
+                        help = "type of memory to use")
+    parser.add_argument("--mem-channels", type=int, default=1,
+                        help = "number of memory channels")
+    parser.add_argument("--mem-ranks", type=int, default=None,
+                        help = "number of memory ranks per channel")
+    parser.add_argument("--mem-size", action="store", type=str,
+                        default=default_mem_size,
+                        help="Specify the physical memory size")
+    parser.add_argument("--checkpoint", action="store_true")
+    parser.add_argument("--restore", type=str, default=None)
+
+    return parser
+
+
+def create(args):
+    ''' Create and configure the system object. '''
+
+    if not args.dtb:
+        dtb_file = SysPaths.binary("armv8_gem5_v1_%icpu.%s.dtb" %
+                                   (args.num_cores, default_dist_version))
+    else:
+        dtb_file = args.dtb
+
+    if args.script and not os.path.isfile(args.script):
+        print "Error: Bootscript %s does not exist" % args.script
+        sys.exit(1)
+
+    cpu_class = cpu_types[args.cpu][0]
+    mem_mode = cpu_class.memory_mode()
+    # Only simulate caches when using a timing CPU (e.g., the HPI model)
+    caches = True if mem_mode == "timing" else False
+
+    system = devices.SimpleSystem(caches,
+                                  args.mem_size,
+                                  mem_mode=mem_mode,
+                                  dtb_filename=dtb_file,
+                                  kernel=SysPaths.binary(args.kernel),
+                                  readfile=args.script,
+                                  machine_type="DTOnly")
+
+    MemConfig.config_mem(args, system)
+
+    # attach disk image
+    image = CowDiskImage()
+    image.child.image_file = SysPaths.disk(args.disk_image)
+    system.disk_images = [ image ]
+    system.pci_vio_block = [ PciVirtIO(vio=VirtIOBlock(image=image)) ]
+    system.attach_pci(system.pci_vio_block[0])
+
+    system.connect()
+
+    # add CPUs to the system
+    system.cpu_cluster = devices.CpuCluster(system,
+                                            args.num_cores,
+                                            args.cpu_freq, "1.0V",
+                                            *cpu_types[args.cpu])
+
+    system.addCaches(caches, last_cache_level=2)
+
+    system.realview.setupBootLoader(system.membus, system, SysPaths.binary)
+
+    # Linux boot command flags
+    kernel_cmd = [
+        "console=ttyAMA0",
+        "lpj=19988480",
+        "norandmaps",
+        "root=/dev/vda1",
+        "rw",
+        "mem=%s" % args.mem_size,
+        "vmalloc=768MB"
+    ]
+    system.boot_osflags = " ".join(kernel_cmd)
+
+    return system
+
+
+def run(args):
+    cptdir = m5.options.outdir
+    if args.checkpoint:
+        print "Checkpoint directory: %s" % cptdir
+
+    while True:
+        event = m5.simulate()
+        exit_msg = event.getCause()
+        if exit_msg == "checkpoint":
+            print "Dropping checkpoint at tick %d" % m5.curTick()
+ cpt_dir = os.path.join(m5.options.outdir, "cpt.%d" % m5.curTick())
+            m5.checkpoint(os.path.join(cpt_dir))
+            print "Checkpoint done."
+        else:
+            print exit_msg, " @ ", m5.curTick()
+            break
+
+    sys.exit(event.getCode())
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    addOptions(parser)
+    args = parser.parse_args()
+
+    root = Root(full_system=True)
+    root.system = create(args)
+
+    if args.restore is not None:
+        m5.instantiate(args.restore)
+    else:
+        m5.instantiate()
+
+    run(args)
+
+
+if __name__ == "__m5_main__":
+    main()

--
To view, visit https://gem5-review.googlesource.com/4202
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa40419d21923a32bb383d58466e421fe4260ddd
Gerrit-Change-Number: 4202
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabor Dozsa <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to