On Tue, Jan 16, 2024 at 1:25 PM Daniel Walsh <dwalsh(a)redhat.com> wrote:
 On 1/16/24 06:49, Matthias Apitz wrote:
 > Hello,
 >
 > For the purpose of the Subject: there is a tutorial at 
IBM.com:
 >
 >
 
https://developer.ibm.com/tutorials/running-x86-64-containers-mac-silicon...
 >
 > I've followed this tutorial, with a small exception, see below.
 >
 > The first step is to 'init' the machine with:
 >
 > $ podman machine init --image-path
 ~/yourFedoraImageFolder/fedora-coreos-39.20231204.3.3-qemu.x86_64.qcow2.xz
 intel
 > Extracting compressed file:
 intel_fedora-coreos-39.20231204.3.3-qemu.x86_64.qco…
 > Image resized.
 > Machine init complete
 > To start your machine run:
 >
 >       podman machine start intel
 >
 > Which worked fine. Now, before starting the machine, the tutorial asks
 to remove the following
 > lines from the config file
 ~/.config/containers/podman/machine/qemu/intel.json:
 >
 >    "-machine",
 >    "q35,accel=hvf:tcg",
 >    "-cpu",
 >    "host",
 >
 > These line are not there 1:1 and I removed these lines:
 >
 > $ diff .config/containers/podman/machine/qemu/intel.json
 .config/containers/podman/machine/qemu/intel.json.saved2
 > 6a7,12
 >>    "-accel",
 >>    "hvf",
 >>    "-accel",
 >>    "tcg",
 >>    "-cpu",
 >>    "host",
 > which seems to me correct to remove the HVF QEMU accelerator which only
 > is supported on x86 chips.
 >
 > Starting the machine now with:
 >
 > $ podman machine start intel
 > Di 16 Jan 2024 12:23:33 CET
 > Starting machine "intel"
 > Waiting for VM ...
 >
 > hangs for ever and the QEMU process has 100% CPU utilization:
 >
 > top
 > PID    COMMAND      %CPU  TIME     #TH   #WQ  #PORT MEM    PURG   CMPRS
 PGRP
 > 10802  qemu-system- 99.6  23:09.43 8/1   0    27    163M   0B     0B
 10800
 >
 > Any ideas? Thanks
 >
 >       matthias
 >
 >
 Sergio any ideas?
 
It's definitely not enough to change the lines indicated in the guide.
You'd need to makes, at least, these changes:
  "CmdLine": [
-  "/opt/homebrew/bin/qemu-system-aarch64",
-  "-accel",
-  "hvf",
+  "/opt/homebrew/bin/qemu-system-x86_64",
   "-accel",
   "tcg",
-  "-cpu",
-  "host",
   "-M",
-  "virt,highmem=on",
-  "-drive",
-
"file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on",
-  "-drive",
-
"file=/Users/slp/.local/share/containers/podman/machine/qemu/intel_ovmf_vars.fd,if=pflash,format=raw",
+  "q35",
With this, after a looooooong time (5-10 minutes), I get a running x86_64
linux machine, and I can run x86_64 containers on it.
That said, I'm not a big fan of this way of running x86_64 VMs on aarch64,
as this is full system emulation and the performance it's going to be quite
poor. Instead, a better option would be using an aarch64 VM with a distro
extended have to binfmt_misc and qemu-user-static, so can rely on usermode
emulation instead, which would yield significantly better results
(specially if we eventually support other userspace emulators, such as
fex-emu or box64).
Sergio.