Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from firesim:master #8

Merged
merged 19 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion boards/firechip/base-workloads/fedora-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@
},
"firmware" : {
"opensbi-src" : "../../firmware/opensbi"
}
},
"host-init" : "host-init.sh",
"files" : [
[ "trigger/start", "/usr/bin/firesim-start-trigger"],
[ "trigger/end", "/usr/bin/firesim-end-trigger"]
]
}
1 change: 1 addition & 0 deletions boards/firechip/base-workloads/fedora-base/host-init.sh
2 changes: 1 addition & 1 deletion boards/firechip/base-workloads/fedora-base/linux-config
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ CONFIG_RISCV_ROCC=y
CONFIG_STACKPROTECTOR_PER_TASK=y
CONFIG_TOOLCHAIN_HAS_ZICBOM=y
CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y
# CONFIG_RISCV_PMU is not set
CONFIG_OVERRIDE_RNG_ENTROPY=y
CONFIG_OVERRIDE_RNG_ENTROPY_VALUE=256

1 change: 1 addition & 0 deletions boards/firechip/base-workloads/fedora-base/trigger
7 changes: 6 additions & 1 deletion boards/firechip/base-workloads/ubuntu-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
},
"firmware" : {
"opensbi-src" : "../../firmware/opensbi"
}
},
"host-init" : "host-init.sh",
"files" : [
[ "trigger/start", "/usr/bin/firesim-start-trigger"],
[ "trigger/end", "/usr/bin/firesim-end-trigger"]
]
}
1 change: 1 addition & 0 deletions boards/firechip/base-workloads/ubuntu-base/host-init.sh
3 changes: 3 additions & 0 deletions boards/firechip/base-workloads/ubuntu-base/linux-config
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@ CONFIG_RISCV_ROCC=y
CONFIG_STACKPROTECTOR_PER_TASK=y
CONFIG_TOOLCHAIN_HAS_ZICBOM=y
CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y
# CONFIG_RISCV_PMU is not set
CONFIG_BLK_DEV_DM=y
CONFIG_DM_MULTIPATH=y
CONFIG_OVERRIDE_RNG_ENTROPY=y
CONFIG_OVERRIDE_RNG_ENTROPY_VALUE=256
1 change: 1 addition & 0 deletions boards/firechip/base-workloads/ubuntu-base/trigger
2 changes: 1 addition & 1 deletion boards/firechip/drivers/iceblk-driver
Submodule iceblk-driver updated 1 files
+1 −0 iceblk.c
2 changes: 1 addition & 1 deletion boards/firechip/drivers/icenet-driver
Submodule icenet-driver updated 1 files
+1 −0 icenet.c
7 changes: 3 additions & 4 deletions docs/source/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ workload.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In some cases, you may need to boot your workload in spike (typically due to a
custom ISA extension or hardware model). In that case, you may use the -s
option. Note that spike currently does not support network or block devices.
You must pass the --no-disk option to FireMarshal when using spike.
option. Note that spike currently does not support network.
You may need to pass the --no-disk option to FireMarshal when using spike.

clean
--------------------------------------
Expand All @@ -115,8 +115,7 @@ included in the output directory.

``-s --spike``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Test using spike instead of qemu (requires the --no-disk option to the
``marshal`` command).
Test using spike instead of qemu.

``-m testDir --manual testDir``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
10 changes: 6 additions & 4 deletions docs/source/internal/Build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Build Process

The goal of building a workload is to produce a working boot binary and
(optionally) a root filesystem to boot from. The same outputs are used for
Spike, Qemu, and FireSim. The one exception is that Spike does not support a
disk, so users may choose to create an initramfs-only version of their workload
for Spike (that binary will boot on Qemu and FireSim as well). The build process
proceeds as follows:
Spike, Qemu, and FireSim. Spike now supports a disk. In order to use a disk,
``libspikedevices.so`` should be installed by Chipyard to the ``RISCV`` library path (i.e. ``$RISCV/lib``)).
The Iceblk block device model will be used as the default block device model. Users may also choose to create
an initramfs-only version of their workload instead for Spike
(that binary will boot on Qemu and FireSim as well).
The build process proceeds as follows:

Build Parents
--------------------
Expand Down
25 changes: 22 additions & 3 deletions wlutil/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,30 @@ def get_free_tcp_port():
# Returns a command string to launch the given config in spike. Must be called with shell=True.
def getSpikeCmd(config, nodisk=False):
log = logging.getLogger()

spikeArgs = ''
if 'img' in config and config['img-hardcoded']:
log.warn("You have hard-coded a disk image in your workload. Spike does not support disk images, your workload may not work correctly. Consider building with the '--nodisk' option (for linux-based workloads).")
elif 'img' in config and not nodisk:
raise ValueError("Spike does not support disk-based configurations")
riscv_lib_path = os.getenv('RISCV')
if riscv_lib_path is None:
raise ValueError("The RISCV environment variable is not set")
elif not os.path.isfile(riscv_lib_path+'/lib/libspikedevices.so'):
raise ValueError("Spike does not support disk-based configurations without libspikedevices.so installed by Chipyard")
else:
spikeArgs += '--extlib=libspikedevices.so ' +\
"--device=\"iceblk," +\
'img=' + str(config.get('img', '')) + "\" "

if 'spike' in config:
spikeBin = str(config['spike'])
else:
spikeBin = 'spike'

cmd = [spikeBin,
spikeArgs,
config.get('spike-args', ''),
' -p' + str(config['cpus']),
' -m' + str(int(config['mem'] / (1024*1024)))]

if nodisk:
cmd.append(str(wlutil.noDiskPath(config['bin'])))
else:
Expand Down Expand Up @@ -119,12 +127,14 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False):
baseResDir = wlutil.getOpt('res-dir') / wlutil.getOpt('run-name')

screenIdentifiers = {}
uartlogs = []

try:
for config in configs:
if config['launch']:
runResDir = baseResDir / config['name']
uartLog = runResDir / "uartlog"
uartlogs.append(uartLog)
os.makedirs(runResDir)

if spike:
Expand Down Expand Up @@ -156,6 +166,15 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False):
for proc in jobProcs:
proc.wait()

for uartlog in uartlogs:
try:
with open(uartlog, 'r') as f:
last_line = f.readlines()[-1]
if 'COMMAND_EXIT_CODE="0"' not in last_line:
raise RuntimeError("One (or more) job(s) returned a non-zero error code. Please check output.")
except FileNotFoundError:
raise RuntimeError(f"Unable to check output of job with {uartlog} uartlog.")

except Exception:
cleanUpSubProcesses()
raise
Expand Down
Loading