Re: Invalid accelerator kvm / error: kvm run failed Function not implemented ERRORS trying to virtualize a guest OS on the ARM Chromebook running with a relatively recent kernel version and KVM enable

2023-08-10 Thread Mario Marietto
---> You can't use KVM with the vexpress-a15 board. The only Arm guest
machine that will work with KVM is the "virt" board.

ok,I tried -M virt like this :

qemu-system-arm \
-enable-kvm -serial stdio -kernel zImage \
-m 512 -M virt -cpu cortex-a15 \

but I've got the same error : qemu-system-arm: invalid accelerator kvm

On Thu, Aug 10, 2023 at 7:27 PM Mario Marietto 
wrote:

> ---> You can't use KVM with the vexpress-a15 board. The only Arm guest
> machine that will work with KVM is the "virt" board.
>
> point 1)
>
> On the virtual open systems website they used the vexpress-a15 board. You
> can read by yourself what they say :
>
> The guests that we will create later will be based on the Versatile
> Express QEMU machine model. For we will use a different kernel branch
> specific to that platform:
>
>
> $ git checkout origin/kvm-vexpress-3.9$ curl 
> http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/guest-config
>  > .config$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage dtbs -j4
>
>
> Then we can append the dtb file to the kernel image with:
>
>
> $ cat arch/arm/boot/dts/rtsm_ve-cortex_a15x1.dtb >> arch/arm/boot/zImage
>
>
> That way we only need to handle one file. Make sure to copy
> *arch/arm/boot/zImage* for later usage.
>
>
> point 2)
>
>
> On the devuan 4 host os that I have installed I'm using kernel 5.4,that's
> lower than 5.7,so the qemu support for it should be there.
>
>
> point 3)
>
>
> if I use the "virt" board,does the KVM acceleration work ?
>
>
> thanks.
>
> On Thu, Aug 10, 2023 at 7:07 PM Peter Maydell 
> wrote:
>
>> On Thu, 10 Aug 2023 at 17:52, Mario Marietto 
>> wrote:
>>
>> > I conducted some further experiments :
>> >
>> > In this example I've used qemu 5.2.0 installed by default by the devuan
>> 4 :
>> >
>> >
>> > qemu-system-arm \
>> > -enable-kvm -serial stdio -kernel zImage \
>> > -m 512 -M vexpress-a15 -cpu cortex-a15 \
>> > -drive
>> file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
>> > -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
>> > -device
>> virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
>> > -netdev type=user,id=net0 \
>> > -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
>> >  virtio_mmio.device=1M@0x4e00:74:0 \
>> >  virtio_mmio.device=1M@0x4e10:75:1 \
>> >  root=/dev/vda rw ip=dhcp --no-log"
>> >
>> > qemu-system-arm: invalid accelerator kvm.
>>
>> You can't use KVM with the vexpress-a15 board. The only
>> Arm guest machine that will work with KVM is the "virt"
>> board.
>>
>> Further, it looks like your host CPU is 32-bit. QEMU 5.2
>> dropped support for running KVM on 32-bit hosts, because this
>> support was dropped from host kernels in kernel version 5.7.
>>
>> Basically, 32-bit hosts are just too small to do anything
>> sensible with virtual machines, which is why the kernel
>> (and in turn QEMU) dropped that support. If you want
>> to play around with Arm virtualization, use a 64-bit host.
>> (64-bit hosts can still use KVM to virtualize 32-bit
>> guests if you want 32-bit guests.)
>>
>> thanks
>> -- PMM
>>
>
>
> --
> Mario.
>


-- 
Mario.


Re: Invalid accelerator kvm / error: kvm run failed Function not implemented ERRORS trying to virtualize a guest OS on the ARM Chromebook running with a relatively recent kernel version and KVM enable

2023-08-10 Thread Mario Marietto
---> You can't use KVM with the vexpress-a15 board. The only Arm guest
machine that will work with KVM is the "virt" board.

point 1)

On the virtual open systems website they used the vexpress-a15 board. You
can read by yourself what they say :

The guests that we will create later will be based on the Versatile Express
QEMU machine model. For we will use a different kernel branch specific to
that platform:


$ git checkout origin/kvm-vexpress-3.9$ curl
http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/guest-config
> .config$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage
dtbs -j4


Then we can append the dtb file to the kernel image with:


$ cat arch/arm/boot/dts/rtsm_ve-cortex_a15x1.dtb >> arch/arm/boot/zImage


That way we only need to handle one file. Make sure to copy
*arch/arm/boot/zImage* for later usage.


point 2)


On the devuan 4 host os that I have installed I'm using kernel 5.4,that's
lower than 5.7,so the qemu support for it should be there.


point 3)


if I use the "virt" board,does the KVM acceleration work ?


thanks.

On Thu, Aug 10, 2023 at 7:07 PM Peter Maydell 
wrote:

> On Thu, 10 Aug 2023 at 17:52, Mario Marietto 
> wrote:
>
> > I conducted some further experiments :
> >
> > In this example I've used qemu 5.2.0 installed by default by the devuan
> 4 :
> >
> >
> > qemu-system-arm \
> > -enable-kvm -serial stdio -kernel zImage \
> > -m 512 -M vexpress-a15 -cpu cortex-a15 \
> > -drive
> file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
> > -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
> > -device
> virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
> > -netdev type=user,id=net0 \
> > -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
> >  virtio_mmio.device=1M@0x4e00:74:0 \
> >  virtio_mmio.device=1M@0x4e10:75:1 \
> >  root=/dev/vda rw ip=dhcp --no-log"
> >
> > qemu-system-arm: invalid accelerator kvm.
>
> You can't use KVM with the vexpress-a15 board. The only
> Arm guest machine that will work with KVM is the "virt"
> board.
>
> Further, it looks like your host CPU is 32-bit. QEMU 5.2
> dropped support for running KVM on 32-bit hosts, because this
> support was dropped from host kernels in kernel version 5.7.
>
> Basically, 32-bit hosts are just too small to do anything
> sensible with virtual machines, which is why the kernel
> (and in turn QEMU) dropped that support. If you want
> to play around with Arm virtualization, use a 64-bit host.
> (64-bit hosts can still use KVM to virtualize 32-bit
> guests if you want 32-bit guests.)
>
> thanks
> -- PMM
>


-- 
Mario.


Re: Invalid accelerator kvm / error: kvm run failed Function not implemented ERRORS trying to virtualize a guest OS on the ARM Chromebook running with a relatively recent kernel version and KVM enable

2023-08-10 Thread Peter Maydell
On Thu, 10 Aug 2023 at 17:52, Mario Marietto  wrote:

> I conducted some further experiments :
>
> In this example I've used qemu 5.2.0 installed by default by the devuan 4 :
>
>
> qemu-system-arm \
> -enable-kvm -serial stdio -kernel zImage \
> -m 512 -M vexpress-a15 -cpu cortex-a15 \
> -drive 
> file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
> -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
> -device 
> virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
> -netdev type=user,id=net0 \
> -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
>  virtio_mmio.device=1M@0x4e00:74:0 \
>  virtio_mmio.device=1M@0x4e10:75:1 \
>  root=/dev/vda rw ip=dhcp --no-log"
>
> qemu-system-arm: invalid accelerator kvm.

You can't use KVM with the vexpress-a15 board. The only
Arm guest machine that will work with KVM is the "virt"
board.

Further, it looks like your host CPU is 32-bit. QEMU 5.2
dropped support for running KVM on 32-bit hosts, because this
support was dropped from host kernels in kernel version 5.7.

Basically, 32-bit hosts are just too small to do anything
sensible with virtual machines, which is why the kernel
(and in turn QEMU) dropped that support. If you want
to play around with Arm virtualization, use a 64-bit host.
(64-bit hosts can still use KVM to virtualize 32-bit
guests if you want 32-bit guests.)

thanks
-- PMM



Need help with CentOS 7 container arm64 container update

2023-08-10 Thread John Pfuntner -X (jpfuntne - ACTALENT SERVICES LLC at Cisco)
My team builds several amd64 and arm64 Linux container images daily and lately 
we've been having trouble with the CentOS 7 arm64 build hanging.  Our build 
machine is an amd64 Ubuntu Openstack machine running Docker and we use QEMU to 
run arm64 containers.  We recently upgraded tooling to:


  *   Ubuntu 22.04.2
  *   Docker 24.0.5
  *   We're installing these packages:
binfmt-support/jammy,jammy,now 2.2.1-2 amd64 [installed]
qemu-guest-agent/jammy-updates,jammy-updates,now 1:6.2+dfsg-2ubuntu6.12 amd64 
[installed]
qemu-user-static/jammy-updates,jammy-updates,now 1:6.2+dfsg-2ubuntu6.12 amd64 
[installed]
qemu/jammy-updates,jammy-updates,now 1:6.2+dfsg-2ubuntu6.12 amd64 [installed]

We start the container with the centos:7 image which looks like it's 18 months 
old.  The problem first manifested when doing apt upgrade -y in a CentOS 7 
arm64 container and I've tracked it down to a single command:

/lib64/ld-2.17.so --verify /usr/bin/true

The command seems to be taking over the CPU:

[root@83d610f0f031 /]# ps -e -o pid,ppid,etime,time,state,args
PIDPPID ELAPSED TIME S COMMAND
  1   0   40:35 00:00:00 S 
/usr/libexec/qemu-binfmt/aarch64-binfmt-P /bin/bash /bin/bash
 35   1   38:50 00:38:28 R 
/usr/libexec/qemu-binfmt/aarch64-binfmt-P /lib64/ld-2.17.so /lib64/ld-2.17.so 
--verify /usr/bin/true
140   1  1-00:03:13 00:00:00 R ps -e -o pid,ppid,etime,time,state,args
[root@83d610f0f031 /]#

The same scenario doesn't happen on our previous build system using Ubuntu 20 
(qemu 4.2-3ubuntu6.27 and Docker 24.0.5).

I also did the following scenario:


  1.  Started an AWS Ubuntu 22 arm64 instance
  2.  Installed Docker
  3.  Started a CentOS 7 container (native arm64 architecture)
  4.  Observed the command did not hang

I don't know for sure this is a QEMU issue but it's a candidate.  Can anyone 
suggest further paths of investigation?  Should I open a QEMU bug?


Need help/advice with CentOS 7 arm64 container on Ubuntu 22 amd64 Docker host

2023-08-10 Thread John Pfuntner -X (jpfuntne - ACTALENT SERVICES LLC at Cisco)
My team builds several amd64 and arm64 Linux container images daily and lately 
we've been having trouble with the CentOS 7 arm64 build hanging.  Our build 
machine is an amd64 Ubuntu Openstack machine running Docker and we use QEMU to 
run arm64 containers.  We recently upgraded tooling to:


  *   Ubuntu 22.04.2
  *   Docker 24.0.5
  *   We're installing these packages:
binfmt-support/jammy,jammy,now 2.2.1-2 amd64 [installed]
qemu-guest-agent/jammy-updates,jammy-updates,now 1:6.2+dfsg-2ubuntu6.12 amd64 
[installed]
qemu-user-static/jammy-updates,jammy-updates,now 1:6.2+dfsg-2ubuntu6.12 amd64 
[installed]
qemu/jammy-updates,jammy-updates,now 1:6.2+dfsg-2ubuntu6.12 amd64 [installed]
We start the container with the centos:7 image which looks like it's 18 months 
old.  The problem first manifested when doing apt upgrade -y in a CentOS 7 
arm64 container and I've tracked it down to this command command:

/lib64/ld-2.17.so --verify /usr/bin/true

The command seems to be taking over the CPU:

[root@83d610f0f031 /]# ps -e -o pid,ppid,etime,time,state,args
PIDPPID ELAPSED TIME S COMMAND
  1   0   40:35 00:00:00 S 
/usr/libexec/qemu-binfmt/aarch64-binfmt-P /bin/bash /bin/bash
 35   1   38:50 00:38:28 R 
/usr/libexec/qemu-binfmt/aarch64-binfmt-P /lib64/ld-2.17.so /lib64/ld-2.17.so 
--verify /usr/bin/true
140   1  1-00:03:13 00:00:00 R ps -e -o pid,ppid,etime,time,state,args
[root@83d610f0f031 /]#

The same scenario doesn't happen on our previous build system using Ubuntu 20 
(qemu 4.2-3ubuntu6.27 and Docker 24.0.5).

I also did the following scenario:


  1.  Started an AWS Ubuntu 22 arm64 instance
  2.  Installed Docker
  3.  Started a CentOS 7 container (native arm64 architecture)
  4.  Observed the command did not hang

I don't know for sure this is a QEMU issue but it's a candidate.  Can anyone 
suggest further paths of investigation?  Should I open a QEMU bug?



Invalid accelerator kvm / error: kvm run failed Function not implemented ERRORS trying to virtualize a guest OS on the ARM Chromebook running with a relatively recent kernel version and KVM enabled

2023-08-10 Thread Mario Marietto
Hello to everyone.


This will be a long and high technical post about a nice toy that comes
back from the past. So,keep ready to brush up some old knowledge.

I've enabled KVM on a more recent kernel version,to be precise on the
5.4.244,on the old ARM Chromebook model xe303c12,following mainly this
tutorial :


http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/


This is how I have achieved the goal (or at least I think that I did) :

I have formatted my sd card following the procedure explained by the v.o.s
website.

In the u boot source directory I did :


$ sudo ./scripts/sdcard.sh /dev/sdX


This erased all data and created 4 partitions in the sd-card, along with
copying the u-boot binary to the first partition:



   1.

   ChromeOS signed binary (vos chained u-boot)
   2.

   Partition 2 not used
   3.

   EXT2 partition for u-boot files (here I have copied your zImage
   (converted in uImage and your exynos5250-snow.dtb files). I've got the zip
   file that you created for me one month ago,here :


https://github.com/quarkscript/linux-armv7-xe303c12-only/files/11615040/5.4.244-kvm.zip


I have decompressed it and I've got the zImage file that was stored inside
the deb file.

Since I want to use u-boot,I have converted zImage into uImage using the
following command :


mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000
-n "Linux kernel" -d zImage uImage



   1.

   4. EXT4 partition for userspace files. Here I have copied the devuan 4
   userland files that I've got here :


https://drive.google.com/u/0/uc?id=1KSgE-3G2GEBzcYhk_JleVYWl6m061GdI=download


but I haven't used btrfs fs,but ext4. And I have extended the space on the
partition from 1882M to 200 GB.


sudo dd if=nv_uboot-snow.kpart of=/dev/sdX1 (nv_uboot-snow.kpart taken
from the vos website)


I wrote a little bash script that executes the command line :


dmesg > /root/Desktop/log


as soon as the desktop environment started (kde 5). This is the content of
the log file :


https://pastebin.ubuntu.com/p/GQ59sqt72v/


I read "*kvm: Hyp mode initialized successfully*". So I'm sure that kvm is
working on the kernel version that I've used (5.4.244),infact :


[image: r/qemu_kvm - Invalid accelerator kvm / error: kvm run failed
Function not implemented ERRORS trying to virtualize a guest OS on the ARM
Chromebook running with a relatively recent kernel version and KVM enabled]



OK,now let's talk about how to virtualize a GUEST os.

I've installed virt-manager and I tried to create a new virtual machine.
With my big surprise,I saw the warning :


KVM is not available.
This may mean the KVM package is not installed or
the KVM kernel modules are not loaded.


What could be the cause ? KVM seems to be running great. It is detected by
kvm-ok and even virt-manager can establish a connection to QEMU / KVM. The
qemu version installed is 5.2.0.


I conducted some further experiments :

In this example I've used qemu 5.2.0 installed by default by the devuan 4 :


qemu-system-arm \
-enable-kvm -serial stdio -kernel zImage \
-m 512 -M vexpress-a15 -cpu cortex-a15 \
-drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none
\
-device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
-device 
virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55"
\
-netdev type=user,id=net0 \
-append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
 virtio_mmio.device=1M@0x4e00:74:0 \
 virtio_mmio.device=1M@0x4e10:75:1 \
 root=/dev/vda rw ip=dhcp --no-log"

qemu-system-arm: invalid accelerator kvm.


In this example I've compiled qemu-system-arm on ubuntu 12.04 as described
by the vos tutorial and then I've copied the libraries produced on ubuntu
12.04 to the devuan 4 + 5.4 kernel installation :


/12.04/usr/local/bin/./qemu-system-arm \
-enable-kvm -serial stdio -kernel zImage \
-m 512 -M vexpress-a15 -cpu cortex-a15 \
-drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none
\
-device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
-device 
virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55"
\
-netdev type=user,id=net0 \
-append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
 virtio_mmio.device=1M@0x4e00:74:0 \
 virtio_mmio.device=1M@0x4e10:75:1 \
 root=/dev/vda rw ip=dhcp --no-log"


(process:2843): GLib-WARNING **: 14:17:40.742:
../../../glib/gmem.c:497: custom memory allocation vtable not
supported

error: kvm run failed Function not implemented


At this point I don't know what to do to enable the kvm acceleration,but I
have a vague idea about the reason why it does not work.

The developers says :



The guests that we will create later will be based on the Versatile Express
QEMU machine model. For we 

does windows 2012 supports memory hot plugging on qemu 6.2

2023-08-10 Thread Jiatong Shen
Hello community experts,

  We are using qemu version 6.2 and are trying to do memory hotplugging for
windows 2012 std edition. The libvirt dimm configuration is appended below.
The problem I am facing is after dimm is attached, in guest the device is
shown as an unknown device and driver pnpmem.sys cannot properly handle the
device. I also tried qemu 4.2 and it seems to be working fine.

  So my question is is windows 2012 supports memory hot plugging on qemu
6.2? And where can I find some logs to identify the issue? Thank you.


-- 

Best Regards,

Jiatong Shen


the dimm device xml looks like,

  
4194304
0
  
  
  



Please help me with one minor issue regarding network configuration

2023-08-10 Thread Antonio Apostoliu
Hello

I see this page
https://github.com/xhjcehust/qemu-virtnet-loopback

You are so kind to tell me the network arguments part for connecting on
Windows host (with configurated loopback interface named retealoopback)

I tried:
-netdev tap,id=mynet1,ifname=retealoopback -device
virtio-net-pci,netdev=mynet1
as second network adapter

Qemu output was:
tap: Could not open 'retealoopback'  - on standard output stream
and
C:\Program Files\qemu\qemu-system-x86_64.exe: -netdev
tap,id=mynet1,ifname=retealoopback: Device 'tap' could not be initialized -
on Debug(error) output stream

Context was:
C:\Users\antonio.apostoliu>ipconfig

Ethernet adapter retealoopback:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.209.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
.
C:\Users\antonio.apostoliu>

I used:
https://qemu.weilnetz.de/w64/2023/qemu-w64-setup-20230802.exe

The loopback interface was configurated with next powershell script

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
$NIC_NAME = "retealoopback"
$IpAddress='192.168.209.1'
$PrefixLength=24
[string] $strFilenameTranscript = "retealoopback.log"
Start-Transcript -path $strFilenameTranscript | Out-Null
 .\devcon.exe -r install $env:windir\Inf\Netloop.inf *MSLOOP | Out-Null
$eth_loopback = Get-NetAdapter|where{$_.DriverDescription -eq "Microsoft
KM-TEST Loopback Adapter"}
Rename-NetAdapter -Name $eth_loopback.name -NewName $NIC_NAME
if ($IpAddress){
New-NetIPAddress -InterfaceAlias $NIC_NAME -IPAddress $IpAddress
-PrefixLength $PrefixLength -AddressFamily ipv4
}
Set-NetIPInterface -InterfaceIndex $eth_loopback.ifIndex -InterfaceMetric
"254" -WeakHostReceive Enabled -WeakHostSend Enabled
Disable-NetAdapterBinding -Name $NIC_NAME -ComponentID ms_msclient
Disable-NetAdapterBinding -Name $NIC_NAME -ComponentID ms_pacer
Disable-NetAdapterBinding -Name $NIC_NAME -ComponentID ms_server
Disable-NetAdapterBinding -Name $NIC_NAME -ComponentID ms_tcpip6
Disable-NetAdapterBinding -Name $NIC_NAME -ComponentID ms_lltdio
Disable-NetAdapterBinding -Name $NIC_NAME -ComponentID ms_rspndr
Stop-Transcript

Best regards
P.S  With
https://build.openvpn.net/downloads/releases/tap-windows-9.21.2.zip works


boot from usb-host device

2023-08-10 Thread José Ramón Muñoz Pekkarinen
Hi,

I'm testing to boot a virtual machine from an
usb device on the host using usb-host device.
The bios seems not to find the usb device and
try alternatives methods to boot until all fail. Setting
-boot menu=on, the available options doesn't list
any usb drive. Is this somehow possible or am I
doing something terribly wrong? The virtual machine
command line follows:

/usr/bin/qemu-system-x86_64 -enable-kvm -M q35 \
   -vga none -display gtk,gl=on -cpu host -smp 8,cores=8,threads=1 \
   -m 4G -mem-path /dev/hugepages -L /usr/share/qemu -full-screen \
   -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 \
   -device virtio-vga-gl \
   -device qemu-xhci,id=xhci -device usb-tablet \
   -device usb-host,vendorid=0x20a0,productid=0x4109 \
   -device usb-host,vendorid=0x1050,productid=0x0407 \
   -netdev user,id=user.0 -device virtio-net-pci,netdev=user.0 \
   -device virtio-serial \
   -chardev
socket,path=/tmp/tails-virtio-serial,server=on,wait=off,id=tails-virtio-serial
\
   -device 
virtserialport,chardev=tails-virtio-serial,name=org.qemu.guest_agent.0

The device to boot is the usb-host 20a0:4109.

Thanks!

José Pekkarinen.