Skip to content

Make run_qemu.sh usable on 64-bit Arm archtecutre systems #140

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ikitayama
Copy link
Collaborator

This PR is tested on my Ubuntu arm64 port VM with:

qemu=~/projects/qemu/build/qemu-system-aarch64 ../run_qemu/run_qemu.sh -r none --no-cxl --no-kvm --no-hmat -p 1S --no-kvm

@ikitayama ikitayama requested a review from stellarhopper as a code owner April 1, 2025 03:01
@marc-hb marc-hb marked this pull request as draft April 1, 2025 22:21
Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing this early prototype! I'm making this a draft because we can't just replace x86 with ARM and drop the former :-)

I also see some changes that really do not look ARM-specific.

Please break down this PR and re-submit smaller, more focused pieces; start with the simplest and easiest changes.

You can either use git branches or something like git push HEAD~x, see more advice here:

https://github.com/zephyrproject-rtos/zephyr/pull/83839/files

@@ -33,5 +33,6 @@ Packages=
libtracefs-dev
libtraceevent-dev
libsystemd-dev
systemd
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What specific failure does this fix? I really don't see how this could not already be included by default, the system would by definition not boot otherwise. I've tested this file without this line with both Ubuntu 22 and 24 and never had any issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: https://github.com/pmem/run_qemu/issues/141 I am at this moment Im unable to launch a system with the specific --cxl-test option. Surely adding --cxl doesn't prevent system booting though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPDATE: problem is fixed now and this was not the way to fix it.

@@ -34,7 +34,7 @@ jobs:
- os: ubuntu-24.04
img_distro: ubuntu
img_rel: noble
arch: [x86_64]
arch: [arm64]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a list, you must append not replace.

Copy link
Collaborator Author

@ikitayama ikitayama Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. I'll fix.

debian_vars.sh Outdated
@@ -2,4 +2,5 @@
# SPDX-License-Identifier: CC0-1.0
# Copyright (C) 2023 Intel Corporation. All rights reserved.

ovmf_path="/usr/share/OVMF/"
#ovmf_path="/usr/share/OVMF/"
ovmf_path="/usr/share/qemu-efi/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmmm... I thought you were only testing Ubuntu, did you test Debian too?

If the previous value is incorrect then don't leave it commented out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My oversite - I didn't test run_qemu.sh with Debian, so I'll drop in the next spin.

run_qemu.sh Outdated
@@ -19,7 +19,8 @@ pmem_final_size="$((pmem_size + pmem_label_size))"
selftests_home=root/built-selftests
: "${mkosi_bin:=mkosi}"
mkosi_opts=("-i" "-f")
console="ttyS0"
#console="ttyS0"
console="ttyAMA0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wonder why ttyS0 is x86-specific...?

Maybe there is a need to make this more flexible/configurable but it is really related to ARM?

In any case we can't just replace one hardcoding with another.

run_qemu.sh Outdated
"memory_hotplug.memmap_on_memory=force"
#"initcall_debug"
#"log_buf_len=20M"
#"memory_hotplug.memmap_on_memory=force"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how selinux=0 could hurt any architecture.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, disabling SELinux is a good thing other might complain but so be it. Will fix.

run_qemu.sh Outdated
@@ -729,7 +731,7 @@ build_kernel_cmdline()
# This requires systemd v251 or above (commit 4b9a4b017, April 2022)
kcmd+=(
systemd.set_credential=agetty.autologin:root
systemd.set_credential=login.noauth:yes
systemd.set_credential=login.noauth:yes\"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whichever issue this helps with, unbalanced quotes inside a single constant can't be the solution :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turned out, -append does not require a pair of """s, if I set -cpu explicitly in my case "max". In your q35 machine case it was not needed I suppose.

run_qemu.sh Outdated
@@ -1355,10 +1357,11 @@ get_ovmf_binaries()
if ! [ -e "OVMF_CODE.fd" ] && ! [ -e "OVMF_VARS.fd" ]; then
if [ ! -f "$ovmf_path/OVMF_CODE.fd" ]; then
echo "OVMF binaries not found, please install '[edk2-]ovmf' or similar, 'edk2-shell', ..."
exit 1
#exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this code support AAVMF instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WIll remove exit 1 should be there to baill out.

accel="kvm"

arch=$(uname -m)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you running ARM on x86 or ARM on ARM? I can see both being useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on my MacBook Pro powered by M1, then on it I create an Ubuntu 24.10 as you suggested, VM. So 64-bit Arm on 64-bit Arm. That's my answer. Do you guys want to support say like riscv base system launch an X86 VM and do execute run_qemu.sh by the way?

@@ -1455,7 +1478,7 @@ prepare_qcmd()
{
# this step may expect files to be present at the toplevel, so run
# it before dropping into the builddir
build_kernel_cmdline "/dev/sda2"
build_kernel_cmdline "/dev/vda2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this can be ARM-specific...

@@ -3,3 +3,4 @@
# Copyright (C) 2023 Intel Corporation. All rights reserved.

ovmf_path="/usr/share/OVMF/"
aavmf_path="/usr/share/AAVMF/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled to find which package contains this file, maybe add a few comments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely, I'll add.

realm@machine-1:~/projects/cxl$ apt-get show qemu-efi-aarch64
E: Invalid operation show
realm@machine-1:~/projects/cxl$
realm@machine-1:~/projects/cxl$ apt-cache show qemu-efi-aarch64
Package: qemu-efi-aarch64
Architecture: all
Version: 2024.05-2ubuntu0.1
Multi-Arch: foreign
Priority: extra
Section: misc
Source: edk2
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian QEMU Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 329778
Suggests: qemu-system-arm
Breaks: qemu-efi (<< 0~20161202.7bbe0b3e-2)
Filename: pool/main/e/edk2/qemu-efi-aarch64_2024.05-2ubuntu0.1_all.deb
Size: 4101360
MD5sum: 321614f7e5cf568ea467e0466d0333c9
SHA1: edf3bf59385a2dad9d561e5da63a3426d68d1ee9
SHA256: d7059e3bf40b802e700cfd6be62ae627a035ae5b9432e4b354f1ded390f9ba90
SHA512: 57bb702923f3fb816620a8a5b1e987e8110b72e9cd78d4eb6b6adf8532d9b2f1b1a9db56e48f9457ede704be5146809273e9eb91a9afaea7547aba5642630952
Homepage: http://www.tianocore.org
Description-en: UEFI firmware for 64-bit ARM virtual machines
 qemu-efi-aarch64 is a build of EDK II for 64-bit ARM virtual machines. It
 includes full support for UEFI, including Secure Boot.
Description-md5: 0191997e8e7dbde0e9009d3719a10aea

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 4, 2025

@ikitayama I see you just pushed some reverts of commits already in this PR.

Just FYI, all pmem git repos are used the "traditional" git way, not the usual GitHub way.

https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#pr-requirements

...
During development, commits may include intermediary changes (e.g., partial implementations, temporary files, or debugging code). These should be squashed or rewritten before submitting the pull request. Remove non-final artifacts, such as:

Temporary renaming of files that are later renamed again.

Code that was rewritten or significantly changed in later commits.

Ensure Clean History Before Submission
...

@ikitayama
Copy link
Collaborator Author

@marc-hb sorry about this. Should I close this PR? As this is not merged as is, and I've made smaller chunks of PRs (too small as you pointed out though) already and after an multi architectures support is added I'll take it from there.

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 4, 2025

You don't need to close this PR, sorry for the misunderstanding. You can keep it to share ideas, prototypes, anything as it's in "draft" status now. This was just general advice FYI for other, non-draft PRs

marc-hb added a commit to marc-hb/run_qemu that referenced this pull request Apr 9, 2025
Initial support for q35 and "virt". Default to the host architecture.

Progress towards supporting ARM64 as discussed in pmem#140, pmem#143 and others.

Signed-off-by: Marc Herbert <[email protected]>
ikitayama pushed a commit to ikitayama/run_qemu that referenced this pull request Apr 9, 2025
Initial support for q35 and "virt". Default to the host architecture.

Progress towards supporting ARM64 as discussed in pmem#140, pmem#143 and others.

Signed-off-by: Marc Herbert <[email protected]>
marc-hb added a commit to marc-hb/run_qemu that referenced this pull request Apr 9, 2025
Initial support for q35 and "virt". Default to the host architecture.

Progress towards supporting ARM64 as discussed in pmem#140, pmem#143 and others.

Signed-off-by: Marc Herbert <[email protected]>
marc-hb added a commit to marc-hb/run_qemu that referenced this pull request Apr 9, 2025
Initial support for q35 and "virt". Default to the host architecture.

Progress towards supporting ARM64 as discussed in pmem#140, pmem#143 and others.

Signed-off-by: Marc Herbert <[email protected]>
marc-hb added a commit to marc-hb/run_qemu that referenced this pull request Apr 9, 2025
Progress towards supporting ARM64 as discussed in pmem#140, pmem#143 and others.

Signed-off-by: Marc Herbert <[email protected]>
marc-hb added a commit to marc-hb/run_qemu that referenced this pull request Apr 10, 2025
Progress towards supporting ARM64 as discussed in pmem#140, pmem#143 and others.

Signed-off-by: Marc Herbert <[email protected]>
Signed-off-by: Itaru Kitayama [email protected]
Tested-by: Itaru Kitayama [email protected]
marc-hb added a commit that referenced this pull request Apr 10, 2025
Progress towards supporting ARM64 as discussed in #140, #143 and others.

Signed-off-by: Marc Herbert <[email protected]>
Signed-off-by: Itaru Kitayama [email protected]
Tested-by: Itaru Kitayama [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants