Commit 127f5fe7 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

experiments: sync qemu support

parent 7edcb320
...@@ -61,6 +61,7 @@ class NetSim(Simulator): ...@@ -61,6 +61,7 @@ class NetSim(Simulator):
class QemuHost(HostSim): class QemuHost(HostSim):
sync = False
def resreq_cores(self): def resreq_cores(self):
return self.node_config.cores + 1 return self.node_config.cores + 1
...@@ -74,8 +75,8 @@ class QemuHost(HostSim): ...@@ -74,8 +75,8 @@ class QemuHost(HostSim):
f'{env.hdcopy_path(self)}'] f'{env.hdcopy_path(self)}']
def run_cmd(self, env): def run_cmd(self, env):
cmd = (f'{env.qemu_path} -machine q35 -cpu host -serial mon:stdio ' cmd = (f'{env.qemu_path} -machine q35 -serial mon:stdio '
'-display none -enable-kvm -nic none ' '-display none -nic none '
f'-kernel {env.qemu_kernel_path} ' f'-kernel {env.qemu_kernel_path} '
f'-drive file={env.hdcopy_path(self)},if=ide,index=0,media=disk ' f'-drive file={env.hdcopy_path(self)},if=ide,index=0,media=disk '
f'-drive file={env.cfgtar_path(self)},if=ide,index=1,media=disk,' f'-drive file={env.cfgtar_path(self)},if=ide,index=1,media=disk,'
...@@ -83,11 +84,18 @@ class QemuHost(HostSim): ...@@ -83,11 +84,18 @@ class QemuHost(HostSim):
'-append "earlyprintk=ttyS0 console=ttyS0 root=/dev/sda1 ' '-append "earlyprintk=ttyS0 console=ttyS0 root=/dev/sda1 '
'init=/home/ubuntu/guestinit.sh rw" ' 'init=/home/ubuntu/guestinit.sh rw" '
f'-m {self.node_config.memory} -smp {self.node_config.cores} ') f'-m {self.node_config.memory} -smp {self.node_config.cores} ')
if self.sync:
cmd += ' -cpu Skylake-Server -icount shift=0,sleep=off '
else:
cmd += ' -cpu host -enable-kvm '
if len(self.nics) > 0: if len(self.nics) > 0:
assert len(self.nics) == 1 assert len(self.nics) == 1
cmd += f'-chardev socket,path={env.nic_pci_path(self.nics[0])},' cmd += f'-chardev socket,path={env.nic_pci_path(self.nics[0])},'
cmd += 'id=cosimcd ' cmd += 'id=cosimcd '
cmd += '-device cosim-pci,chardev=cosimcd ' sync_onoff = 'on' if self.sync else 'off'
cmd += f'-device cosim-pci,chardev=cosimcd,sync={sync_onoff} '
return cmd return cmd
class Gem5Host(HostSim): class Gem5Host(HostSim):
...@@ -122,6 +130,7 @@ class Gem5Host(HostSim): ...@@ -122,6 +130,7 @@ class Gem5Host(HostSim):
f'--disk-image={env.hd_raw_path(self.node_config.disk_image)} ' f'--disk-image={env.hd_raw_path(self.node_config.disk_image)} '
f'--disk-image={env.cfgtar_path(self)} ' f'--disk-image={env.cfgtar_path(self)} '
f'--cpu-type={cpu_type} --mem-size={self.node_config.memory}MB ' f'--cpu-type={cpu_type} --mem-size={self.node_config.memory}MB '
f'--num-cpus={self.node_config.cores} '
'--ddio-enabled --ddio-way-part=8 --mem-type=DDR4_2400_16x4 ') '--ddio-enabled --ddio-way-part=8 --mem-type=DDR4_2400_16x4 ')
if env.restore_cp: if env.restore_cp:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment