Re: [PATCH] OvmfPkg/BhyveBhf: install bhyve's ACPI tables

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Fri, 31 Mar 2023 20:25:52 UTC
Hello.

Nothing of unusual is happened and I didn't see any ACPI output message :
(I'm running FreeBSD 13.2-RC5 releng/13.2-n254613-0386b9bd6cda GENERIC amd64
)

19-Ubuntu-2210-ACPI-vm19 :

#!/bin/sh

setxkbmap it
bhyvectl --vm=vm0:19 --destroy
vms="$(ls /dev/vmm/*)"
vncs="$(ps ax | awk '/vncviewer [0]/{print $6}')"
echo $vms
echo $vncs

if ! pciconf -l pci0:2:0:0 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/0 is not attached to ppt,attaching..."
kldload nvidia-modeset
devctl detach pci0:2:0:0
devctl set driver pci0:2:0:0 ppt
else
echo "rtx 2080ti slot 2/0/0 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:1 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/1 is not attached to ppt,attaching..."
devctl detach pci0:2:0:1
devctl set driver pci0:2:0:1 ppt
else
echo "rtx 2080ti slot 2/0/1 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:2 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/2 is not attached to ppt,attaching..."
devctl detach pci0:2:0:2
devctl set driver pci0:2:0:2 ppt
else
echo "rtx 2080ti slot 2/0/2 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:3 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/3 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:3
devctl set driver pci0:2:0:3 ppt
else
echo "rtx 2080ti slot 2/0/3 is already attached to ppt"
fi

echo "rtx 2080ti is fully attached to ppt"

for vm in $vms; do
                session="${vm##*/}"
                echo "bhyve session = $session"
                echo "vnc session = $vncs"
                                if ! printf '%s\n' "${vncs}" | grep
"${session}"; then
                                printf 'VNC session not found,destroying
ghost vms\n'
                                bhyvectl --vm=$session --destroy

                else
                                printf 'Found VNC session %s\n'
"${session},no ghost vms found,not destroying them"
                fi
done

vmdisk0=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (NM13N4CZ)/
&& d{print d}'`
echo "Seagate M3 Portable 1.8 TB ; $vmdisk0"

vmdisk1=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(2022285F1175)/ && d{print d}'`
echo "CT1000P1SSD8 ; $vmdisk1"

vmdisk2=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(2015020204055E)/ && d{print d}'`
echo "TOSHIBA External USB 3.0 1.8 TB ; $vmdisk2"

vmdisk3=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(20130506005976F)/ && d{print d}'`
echo "TOSHIBA External USB 3.0 932G ; $vmdisk3"

vmdisk4=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(BE0191500218)/ && d{print d}'`
echo "G-DRIVE USB ; $vmdisk4"

vmdisk5=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(38434B4237354B45)/ && d{print d}'`
echo "Elements 25A3 ; $vmdisk5"

vmdisk6=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(WD-WCAV2X597309)/ && d{print d}'`
echo "WDC WD3200AAJS-00L7A0-298 GB ; $vmdisk6"

vmdisk7=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(0774911DDC4200A6)/ && d{print d}'`
echo "SanDisk Cruzer-15GB ; $vmdisk7"

vmdisk8=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(60A44C4138D8F311190A0149)/ && d{print d}'`
echo "Kingston DataTraveler 2.0 ; $vmdisk8"

vmdisk9=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(20140100006C)/ && d{print d}'`
echo "Corsair Force 3 SSD ; $vmdisk9"

vmdisk10=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(1924E20B2AE5)/ && d{print d}'`
echo "CT500MX500SSD4 ; $vmdisk10"

vmdisk11=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(575845583038524844323238)/ && d{print d}'`
echo "WD-2500BMV ; $vmdisk11"

vmdisk12=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(57442D575845323039544433303334)/ && d{print d}'`
echo "WD-3200BMV ; $vmdisk12"

vmdisk13=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident:
(S3Z2NB0KB99028V)/ && d{print d}'`
echo "Seagate M3 Portable 1.8 TB ; $vmdisk13"

pkexec zpool import -f -R /mnt/zroot2 zroot2

bhyve -S -c sockets=2,cores=2,threads=2 -m 4G -w -H -A \
-s 0,hostbridge \
-s
1,virtio-blk,/mnt/zroot2/zroot2/bhyve/img/Linux/ubuntu2210.img,bootindex=1 \
-s 9,passthru,5/0/0 \
-s 10,virtio-blk,/dev/$vmdisk1 \
-s 11,virtio-blk,/dev/$vmdisk3 \
-s 12,virtio-blk,/dev/$vmdisk13 \
-s 13,virtio-net,tap19 \
-s 14,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5919,w=1600,h=950,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l
bootrom,/home/marietto/Desktop/Files/OS/FreeBSD/Scripts/corvin/bhyve/ACPI/BHYVE_CODE_DEBUG.fd
\
vm0:19 < /dev/null & sleep 2 && vncviewer 0:19

marietto@marietto:/usr/home/marietto/bhyve # sudo
./19-Ubuntu-2210-ACPI-vm19

vm_open: vm0:19 could not be opened: No such file or directory
ls: /dev/vmm/*: No such file or directory
rtx 2080ti slot 2/0/0 is not attached to ppt,attaching...
rtx 2080ti slot 2/0/1 is not attached to ppt,attaching...
rtx 2080ti slot 2/0/2 is not attached to ppt,attaching...
rtx 2080ti slot 2/0/3 is not attached to ppt,attaching...
rtx 2080ti is fully attached to ppt
Seagate M3 Portable 1.8 TB ; da4
CT1000P1SSD8 ; nvd0
TOSHIBA External USB 3.0 1.8 TB ; da2
TOSHIBA External USB 3.0 932G ; da5
G-DRIVE USB ; da0
Elements 25A3 ; da1
WDC WD3200AAJS-00L7A0-298 GB ; ada2
SanDisk Cruzer-15GB ;
Kingston DataTraveler 2.0 ;
Corsair Force 3 SSD ; da3
CT500MX500SSD4 ; ada0
WD-2500BMV ;
WD-3200BMV ;
Seagate M3 Portable 1.8 TB ; ada1
fbuf frame buffer base: 0x661ba800000 [sz 16777216]

TigerVNC Viewer 64-bit v1.12.0
Built on: 2021-11-23 05:59
Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.

Fri Mar 31 22:04:09 2023
DecodeManager: Detected 16 CPU core(s)
DecodeManager: Creating 4 decoder thread(s)
CConn:       Connected to host 0 port 5919
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
CConnection: Choosing security type None(1)
CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
wrmsr to register 0x140(0) on vcpu 0
wrmsr to register 0x140(0) on vcpu 1
wrmsr to register 0x140(0) on vcpu 2
wrmsr to register 0x140(0) on vcpu 3
wrmsr to register 0x140(0) on vcpu 4
wrmsr to register 0x140(0) on vcpu 5
wrmsr to register 0x140(0) on vcpu 6
wrmsr to register 0x140(0) on vcpu 7
rdmsr to register 0x64e on vcpu 2
rdmsr to register 0x34 on vcpu 2
rdmsr to register 0xc0011029 on vcpu 3
Unhandled ps2 mouse command 0xe1
Unhandled ps2 mouse command 0x0a
Unhandled ps2 mouse command 0x01
Unhandled ps2 mouse command 0x41
Unhandled ps2 mouse command 0x88
rdmsr to register 0x64d on vcpu 5
rdmsr to register 0x64d on vcpu 0

On Fri, Mar 31, 2023 at 3:18 PM Corvin Köhne <corvink@freebsd.org> wrote:

> On Fri, 2023-03-31 at 14:59 +0200, Mario Marietto wrote:
> > Hello Corvin.
> >
> > I will try your patch very soon if you  want to write carefully all
> > the commands that I should issue. Thanks.
> >
>
> I build the firmware as DEBUG and RELEASE version and attached them for
> easy testing. Just replace "-l bootrom,/usr/local/share/uefi-
> firmware/BHYVE_UEFI.fd" in your bhyve command with "-l
> bootrom,/path/to/my/attached/BHYVE_CODE_RELEASE.fd"
>
> If you encounter any issues, please use the DEBUG version as firmware.
> It should log debug information on bhyve's serial output. Please attach
> it to your error description.
>
> For those familiar with building EDKII, you can find my patch at:
> https://github.com/Beckhoff/edk2/tree/phab/corvink/acpi-tables
>
>
> --
> Kind regards,
> Corvin
>


-- 
Mario.