Nikolaos & Gem5 community,

Thanks for the detailed instructions to run Full system with NICs with
#COSSIM edits. My project partner and I tried all the way to the end. 
Both are experiencing /dev/mem problem as below. We've tried different ways
to change to root owner and chmod, but with no luck

Any help on how to proceed? 

Thanks in advance


$ sudo chroot .
Starting gem5 init... reading run script file.
Can't open /dev/mem: Operation not permitted
Failed to run m5 readfile, exiting!
Can't open /dev/mem: Operation not permitted
m5 exit failed, dropping to shell.

# m5 readfile
Can't open /dev/mem: Operation not permitted
# whoami
root
# ls -l /dev/mem
crw-r----- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem

# chown root:kmem /dev/mem 
# m5 readfile 
Can't open /dev/mem: Operation not permitted

# chmod 660 /dev/mem 
# m5 readfile
Can't open /dev/mem: Operation not permitted

# chown root:kmem /dev/mem
# 
# m5 readfile
Can't open /dev/mem: Operation not permitted

# chmod 666 /dev/mem
# ls -l /dev/mem
crw-rw-rw- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem
#
# m5 readfile
Can't open /dev/mem: Operation not permitted



-----Original Message-----
From: Νικόλαος Ταμπουρατζής <ntampourat...@ece.auth.gr> 
Sent: Wednesday, May 11, 2022 12:10 PM
To: The gem5 Users mailing list <gem5-users@gem5.org>
Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5?

Dear rshankar,

As I know, the NIC in gem5 is worked only with Full System (FS) mode in
order to load the correct drivers etc. You can add the following in order to
add the NIC in FS mode:

https://github.com/H2020-COSSIM/cgem5/blob/main/src/dev/x86/SouthBridge.py
(see the lines with #COSSIM)
https://github.com/H2020-COSSIM/cgem5/blob/main/configs/common/FSConfig.py
(lines 636, 674-676)

Build the gem5.

You need download the vmlinux-5.4.49 kernel from here:  
https://github.com/gem5/gem5-resources/tree/stable/src/linux-kernel

You need download the x86-ubuntu.img image from here:  
http://dist.gem5.org/dist/v21-2/images/x86/ubuntu-18-04/x86-ubuntu.img.gz

Mount the x86-ubuntu.img and add the gem5_init.sh in /root using:

sudo mount -o loop,offset=1048576 x86-ubuntu.img /mnt cd /mnt sudo mount
--bind /proc /mnt/proc sudo mount --bind /dev /mnt/dev sudo chroot .
cd root
nano gem5_init.sh #Add the following script:

#!/bin/bash

# Copyright (c) 2021 The University of Texas at Austin.
# SPDX-License-Identifier: BSD 3-Clause

echo "Starting gem5 init... reading run script file."
if ! m5 readfile > /tmp/script; then
     echo "Failed to run m5 readfile, exiting!!"
     rm -f /tmp/script
     if ! m5 exit; then
         # Useful for booting the disk image in (e.g.,) qemu for debugging
         echo "m5 exit failed, dropping to shell."
         /bin/sh
     fi
else
     echo "Running m5 script from /tmp/script !!"
     chmod 755 /tmp/script
     /tmp/script
     echo "Done running script, exiting."
     rm -f /tmp/script
     /bin/sh
     #m5 exit
fi



exit
# now we are back to the host system
cd
sudo umount /mnt/proc
sudo umount /mnt/dev
sudo umount /mnt


Now, you may use this cmd to start the FS execution:

/home/cossim/COSSIM/cgem5/build/X86/gem5.fast --listener-mode=on
/home/cossim/COSSIM/cgem5/configs/example/fs.py
--kernel=vmlinux-5.4.49 --disk-image=x86-ubuntu.img --dual

The 1st terminal is in 3456 port (telnet 127.0.0.1 3456) The 2nd terminal is
in 3457 port (telnet 127.0.0.1 3457)

After boot, you need add the localhost and IP in both terminals (eg.  
ifconfig lo 127.0.0.1 & ifconfig eth0 10.0.1.x), where x 2 and 3). You can
use "ping -c 1 10.0.1.x" to check the functionality.

If you use the above steps in your work, refer to the following COSSIM
paper, please: https://dl.acm.org/doi/10.1145/3378934

If someone has configured the NIC with SE mode, please give us details! :)

Best regards,
Nikolaos Tampouratzis



Quoting rshank...@austin.rr.com <mailto:rshank...@austin.rr.com> :

> Hello,
>
>
>
> I'd like to add a NIC to simple Gem5 model derived from two_level.py 
> running in SE mode, x86 CPU.
>
> Is this supported in Gem5?
>
>
>
> Per COSSIM version of gem5 (aka cgem5) states below.  I'd like to stay 
> on
> Gem5 - so any guidance here is appreciated.
>
>
>
> GitHub - H2020-COSSIM/cgem5: Modified GEM5 March 2022 release 
> <https://github.com/H2020-COSSIM/cgem5>
>
>
>
> In GEM5's publicly available repositories, the only network interface 
> card implemented, tested and verified is the Intel 8254x based gigabit 
> Ethernet adapter. It is provided as a PCI GEM5 network device using 
> the e1000 Linux driver.
>
> However, the latest version of GEM5 supports this real-network device 
> only on ARM-based architectures. In the scope of COSSIM, GEM5 has been 
> recently modified so as to support the Intel 8254x network card for 
> the x86 ISA


_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org <mailto:gem5-users@gem5.org>
To unsubscribe send an email to gem5-users-le...@gem5.org
<mailto:gem5-users-le...@gem5.org> 
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to