Skip to content

Instantly share code, notes, and snippets.

@cyring
Created March 10, 2025 18:03
Show Gist options
  • Save cyring/e077025f36391f7a52f753aa0fa33aeb to your computer and use it in GitHub Desktop.
Save cyring/e077025f36391f7a52f753aa0fa33aeb to your computer and use it in GitHub Desktop.
POWER10
IBM POWER10 Functional Simulator
@cyring
Copy link
Author

cyring commented Mar 10, 2025

Prerequisities

  • ArchLinux
uname -a
Linux RYZEN 6.13.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 07 Mar 2025 20:19:00 +0000 x86_64 GNU/Linux
  • Preferably build into a clean chroot [1]
  • Download the IBM POWER10 Functional Simulator [2]
  • What is Power10 Functional Simulator? [3]
  • POWER10 Functional Simulator User Guide [4]
  • 17 GB of storage

Preparing

nano /etc/ssh/sshd_config
PermitRootLogin yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
systemctl enable sshd
systemctl restart sshd

Installing

cd
rpm -ivh --nodeps systemsim-p10-1.2-4.x86_64.rpm ## See [2]
ls -la /opt/ibm/systemsim-p10-1.2-4/
drwxr-xr-x 7 root root 4096 Mar 10 18:01 .
drwxr-xr-x 3 root root 4096 Mar 10 18:01 ..
drwxr-xr-x 2 root root 4096 Mar 10 18:01 bin
drwxr-xr-x 4 root root 4096 Mar 10 18:01 examples
drwxr-xr-x 2 root root 4096 Oct 27  2022 images
drwxr-xr-x 6 root root 4096 Mar 10 18:01 lib
drwxr-xr-x 3 root root 4096 Mar 10 18:01 run

Verifying

ssh -Y root@localhost

PATH=$PATH:/opt/ibm/systemsim-p10-1.2-4/bin/
systemsim -h
POWER10 Functional Simulator Version 1.2.4
Built: 22:58:37 Oct 26 2022

usage: /opt/ibm/systemsim-p10-1.2-4/bin/../bin/systemsim-p10 [-f file] [options] ...
	-f file : name of initial TCL file (.systemsim.tcl)
	-T time : time limit (in seconds)
	-o name : output file name (stdout by default)

	-C      : no console to command window
	-e      : expect mode
	-G f    : frequency of the p7 core [3.4, 3.7, or 4.0] 
	-g      : Enable Tk Graphical Interface
	-H      : Configure high-end system
	-i      : no instruction numbers
	-L      : Configure low-end system
	-m name : Machine configuration
	-n      : Disable opening XTerms for the consoles
	-N n    : SMT mode, define number of threads per core 
	-p name : server mode on named pipe name
	-q      : quiet mode
	-Q      : very very quiet mode
	-r      : regression mode
	-R      : version repo
	-s port : server port #
	-S      : spin on "mambo_go" until cleared by attached debugger
	-t      : no time stamps
	-v      : mambo versions
	-W      : no warnings
	-x      : no core dumps

@cyring
Copy link
Author

cyring commented Mar 10, 2025

Starting

  • See Installing and Invoking the Simulator at [4]
cd /opt/ibm/systemsim-p10-1.2-4/images/
wget https://ftp2.osuosl.org/pub/ppc64el/systemsim/p10/vmlinux
wget https://ftp2.osuosl.org/pub/ppc64el/systemsim/p10/skiboot.lid
wget https://ftp2.osuosl.org/pub/ppc64el/systemsim/p10/ubuntu2004-at15.img.gz
gunzip ubuntu2004-at15.img.gz
ln -s ubuntu2004-at15.img disk.img
cd -

systemsim -N 4 -f /opt/ibm/systemsim-p10-1.2-4/run/p10/linux/boot-linux-ubuntu-p10.tcl 

@cyring
Copy link
Author

cyring commented Mar 10, 2025

2025-03-11-000336_804x484_scrot

@cyring
Copy link
Author

cyring commented Mar 10, 2025

2025-03-11-005825_724x544_scrot

@cyring
Copy link
Author

cyring commented Mar 11, 2025

CoreFreq

  • No operational network yet in the above simulation. To install CoreFreq and its kernel prerequisites, we will make them manually.

Prepare

  • Mount the supplied Ubuntu disk image to prepare the on-going kernel headers and copy the CoreFreq source codes; in particular the new branch ppc64le

Step 1

sudo losetup -f /opt/ibm/systemsim-p10-1.2-4/images/ubuntu2004-at15.img
sudo mount /dev/loop0 /mnt
cd /mnt/usr/src
sudo git clone -b linux-5.14.y https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
sudo mv -v linux linux-5.14.y
cd -
cd /mnt/home/mambo
mkdir src
cd src
git clone [email protected]:cyring/CoreFreq.git
cd
sudo umount  /mnt
sudo losetup -D

Step 2

ssh -Y root@localhost

PATH=$PATH:/opt/ibm/systemsim-p10-1.2-4/bin
systemsim -f /opt/ibm/systemsim-p10-1.2-4/run/p10/linux/boot-linux-ubuntu-p10.tcl 

Step 3

## Synchronize date and time with the host
timedatectl set-timezone Universal
date +%Y%m%d -s "20250312"
date +%T -s "07:04:30"

## Prepare the Linux kernel source code
cd /lib/modules
mkdir $(uname -r)
cd $(uname -r)
ln -s /usr/src/linux-5.14.y build
cd build
## find . -type f -exec touch {} + ## Optionally fix files timestamp vs host clock
zcat /proc/config.gz > .config
make prepare
make -j7 modules
make install
make modules_install
make headers_install
cd
ls -l /boot/{vmlinux,initrd.img}
shutdown -h now

Step 4

  • Extract and copy the following kernel file to /opt/ibm/systemsim-p10-1.2-4/images/ using losetup mount as described in Step 1
/boot/initrd.img -> initrd.img-5.14.21
/boot/vmlinux -> vmlinux-5.14.21

Build

  • Boot simulator again as Step 2
  • Don't forget to set date and time in the VM as Step 3
su mambo
cd ~/src/CoreFreq
make clean
make -j
  CLEAN [M] /home/mambo/src/CoreFreq/build
  CLEAN [build/corefreqd]
  CLEAN [build/corefreq-cli]
  CLEAN [build/module/corefreqk.c]
  CLEAN [build/Makefile]
  RMDIR [build/module]
  RMDIR [build]
  CC [build/corefreqd.o]
  CC [build/corefreqm.o]
  CC [build/corefreq-cli.o]
  CC [build/corefreq-ui.o]
  CC [build/corefreq-cli-rsc.o]
  CC [build/corefreq-cli-json.o]
  CC [build/corefreq-cli-extra.o]
  LD [build/corefreqd]
  LD [build/corefreq-cli]
  CC [M]  /home/mambo/src/CoreFreq/build/module/corefreqk.o
  LD [M]  /home/mambo/src/CoreFreq/build/corefreqk.o
  MODPOST /home/mambo/src/CoreFreq/build/Module.symvers
  CC [M]  /home/mambo/src/CoreFreq/build/corefreqk.mod.o
  LD [M]  /home/mambo/src/CoreFreq/build/corefreqk.ko

@cyring
Copy link
Author

cyring commented Mar 12, 2025

Debian

  • Download the Debian virtual machine, in qcow2 format: 64-bit Little Endian PowerPC (qcow2)
  • Install QEMU for PowerPC
  • Start the virtual machine with the qcow image
pacman -S qemu-system-ppc

qemu-system-ppc64 -nographic -smp 6 -m 3G debian-12-nocloud-ppc64el.qcow2
  • Once in the VM, create a privileged user account
useradd -m nickname
passwd nickname
nano /etc/sudoers.d/01_first
nickname ALL=(ALL) ALL
  • Install the kernel development packages
sudo apt-get update
apt-cache search linux-headers-$(uname -r)
sudo apt install linux-headers-6.1.0-31-powerpc64le
sudo apt install make
sudo apt install gcc
sudo apt install ssh
sudo apt install git

CoreFreq

  • Build and Run CoreFreq, alpha preview version for PowerPC
cd
mkdir src
cd src
git clone [email protected]:cyring/CoreFreq.git
make -j

sudo sync; sudo insmod build/corefreqk.ko 
sudo sync; sudo build/corefreqd -q &
./build/corefreq-cli 

jobs
kill %1
sudo rmmod corefreqk

2025-03-12-181149_642x410_scrot
2025-03-12-181107_642x359_scrot
2025-03-12-181119_642x359_scrot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment