diff options
-rw-r--r-- | configs/common/FSConfig.py | 20 | ||||
-rw-r--r-- | configs/common/Options.py | 11 | ||||
-rw-r--r-- | configs/example/arm/fs_bigLITTLE.py | 7 | ||||
-rw-r--r-- | configs/example/fs.py | 21 |
4 files changed, 50 insertions, 9 deletions
diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index 55a6e9118..ecc5f1c82 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -42,6 +42,7 @@ from __future__ import print_function from __future__ import absolute_import +import m5 from m5.objects import * from m5.util import * from .Benchmarks import * @@ -71,6 +72,19 @@ class MemBus(SystemXBar): badaddr_responder = BadAddr() default = Self.badaddr_responder.pio +def attach_9p(parent, bus): + viopci = PciVirtIO() + viopci.vio = VirtIO9PDiod() + viodir = os.path.join(m5.options.outdir, '9p') + viopci.vio.root = os.path.join(viodir, 'share') + viopci.vio.socketPath = os.path.join(viodir, 'socket') + if not os.path.exists(viopci.vio.root): + os.makedirs(viopci.vio.root) + if os.path.exists(viopci.vio.socketPath): + os.remove(viopci.vio.socketPath) + parent.viopci = viopci + parent.attachPciDevice(viopci, bus) + def fillInCmdline(mdesc, template, **kwargs): kwargs.setdefault('disk', mdesc.disk()) kwargs.setdefault('rootdev', mdesc.rootdev()) @@ -206,7 +220,8 @@ def makeSparcSystem(mem_mode, mdesc=None, cmdline=None): def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None, dtb_filename=None, bare_metal=False, cmdline=None, - external_memory="", ruby=False, security=False): + external_memory="", ruby=False, security=False, + vio_9p=None): assert machine_type pci_devices = [] @@ -374,6 +389,9 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None, self.terminal = Terminal() self.vncserver = VncServer() + if vio_9p: + attach_9p(self.realview, self.iobus) + if not ruby: self.system_port = self.membus.slave diff --git a/configs/common/Options.py b/configs/common/Options.py index c47d4f755..71d22a461 100644 --- a/configs/common/Options.py +++ b/configs/common/Options.py @@ -48,6 +48,16 @@ from m5.objects import * from .Benchmarks import * from . import ObjectList +vio_9p_help = """\ +Enable the Virtio 9P device and set the path to share. The default 9p path is +m5ou5/9p/share, and it can be changed by setting VirtIO9p.root with --param. A +sample guest mount command is: "mount -t 9p -o +trans=virtio,version=9p2000.L,aname=<host-full-path> gem5 /mnt/9p" where +"<host-full-path>" is the full path being shared on the host, and "gem5" is a +fixed mount tag. This option requires the diod 9P server to be installed in the +host PATH or selected with with: VirtIO9PDiod.diod. +""" + def _listCpuTypes(option, opt, value, parser): ObjectList.cpu_list.print() sys.exit(0) @@ -434,6 +444,7 @@ def addFSOptions(parser): parser.add_option("--enable-context-switch-stats-dump", \ action="store_true", help="Enable stats dump at context "\ "switches and dump tasks file (required for Streamline)") + parser.add_option("--vio-9p", action="store_true", help=vio_9p_help) # Benchmark options parser.add_option("--dual", action="store_true", diff --git a/configs/example/arm/fs_bigLITTLE.py b/configs/example/arm/fs_bigLITTLE.py index 94e28461f..4645d9ee8 100644 --- a/configs/example/arm/fs_bigLITTLE.py +++ b/configs/example/arm/fs_bigLITTLE.py @@ -52,8 +52,10 @@ from m5.objects import * m5.util.addToPath("../../") +from common import FSConfig from common import SysPaths from common import ObjectList +from common import Options from common.cores.arm import ex5_big, ex5_LITTLE import devices @@ -209,6 +211,8 @@ def addOptions(parser): "sets max_insts_all_threads for cpus 0, 1, 3, 5 and 7 " "Direct parameters of the root object are not accessible, " "only parameters of its children.") + parser.add_argument("--vio-9p", action="store_true", + help=Options.vio_9p_help) return parser def build(options): @@ -296,6 +300,9 @@ def build(options): m5.tlm.tlm_global_quantum_instance().set( sc.sc_time(10000.0 / 100000000.0, sc.sc_time.SC_SEC)) + if options.vio_9p: + FSConfig.attach_9p(system.realview, system.iobus) + return root def _build_kvm(system, cpus): diff --git a/configs/example/fs.py b/configs/example/fs.py index c9273198b..7efe433eb 100644 --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -92,14 +92,19 @@ def build_test_system(np): test_sys = makeLinuxX86System(test_mem_mode, np, bm[0], options.ruby, cmdline=cmdline) elif buildEnv['TARGET_ISA'] == "arm": - test_sys = makeArmSystem(test_mem_mode, options.machine_type, np, - bm[0], options.dtb_filename, - bare_metal=options.bare_metal, - cmdline=cmdline, - external_memory= - options.external_memory_system, - ruby=options.ruby, - security=options.enable_security_extensions) + test_sys = makeArmSystem( + test_mem_mode, + options.machine_type, + np, + bm[0], + options.dtb_filename, + bare_metal=options.bare_metal, + cmdline=cmdline, + external_memory=options.external_memory_system, + ruby=options.ruby, + security=options.enable_security_extensions, + vio_9p=options.vio_9p, + ) if options.enable_context_switch_stats_dump: test_sys.enable_context_switch_stats_dump = True else: |