Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2023 10:24:02 +0100 (CET)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        freebsd-arm@FreeBSD.org
Subject:   Re: detecting qemu/HVF on Apple M1 silicon
Message-ID:  <306917284.1.1676366642956@mailrelay>
In-Reply-To: <20230214080530.GE95670@funkthat.com>
References:  <20230214080530.GE95670@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_0_1079485241.1676366641320
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Van: John-Mark Gurney <jmg@funkthat.com>
Datum: dinsdag, 14 februari 2023 09:05
Aan: freebsd-arm@FreeBSD.org
Onderwerp: detecting qemu/HVF on Apple M1 silicon
>=20
> I managed to get FreeBSD running via qemu on Apple M1 silicon, but out
> of the box vm detection isn't working causing hz to be set to 1000, and
> causing lots of cpu usage to happen.
>=20
> What are the recommended ways to detect this, so we can get vm_guest set?
>=20
> A little poking around, shows that there's an ACPI device that is
> promising:
>         Device (FWCF)
>         {
>             Name (_HID, "QEMU0002")  // _HID: Hardware ID
>             Name (_STA, 0x0B)  // _STA: Status
>             Name (_CCA, One)  // _CCA: Cache Coherency Attribute
>             Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Se=
ttings
>             {
>                 Memory32Fixed (ReadWrite,
>                     0x09020000,         // Address Base
>                     0x00000018,         // Address Length
>                     )
>             })
>         }
>=20
> Here's a complete list of _HID's:
> # acpidump -d | grep _HID | sort -u
>                 Name (_HID, "PNP0C02" /* PNP Motherboard Resources */)  /=
/ _HID: Hardware ID
>                 Name (_HID, "PNP0C0F" /* PCI Interrupt Link Device */)  /=
/ _HID: Hardware ID
>             Name (_HID, "ACPI0007" /* Processor Device */)  // _HID: Hard=
ware ID
>             Name (_HID, "ACPI0013" /* Generic Event Device */)  // _HID: =
Hardware ID
>             Name (_HID, "ARMH0011")  // _HID: Hardware ID
>             Name (_HID, "LNRO0005")  // _HID: Hardware ID
>             Name (_HID, "PNP0A08" /* PCI Express Bus */)  // _HID: Hardwa=
re ID
>             Name (_HID, "PNP0C0C" /* Power Button Device */)  // _HID: Ha=
rdware ID
>             Name (_HID, "QEMU0002")  // _HID: Hardware ID
>=20
> There's also the usual virtio devices as well.
> # pciconf -l
> hostb0@pci0:0:0:0:  class=3D0x060000 rev=3D0x00 hdr=3D0x00 vendor=3D0x1b3=
6 device=3D0x0008 subvendor=3D0x1af4 subdevice=3D0x1100
> virtio_pci0@pci0:0:1:0: class=3D0x020000 rev=3D0x00 hdr=3D0x00 vendor=3D0=
x1af4 device=3D0x1000 subvendor=3D0x1af4 subdevice=3D0x0001
> virtio_pci1@pci0:0:2:0: class=3D0x038000 rev=3D0x01 hdr=3D0x00 vendor=3D0=
x1af4 device=3D0x1050 subvendor=3D0x1af4 subdevice=3D0x1100
> xhci0@pci0:0:3:0:   class=3D0x0c0330 rev=3D0x01 hdr=3D0x00 vendor=3D0x1b3=
6 device=3D0x000d subvendor=3D0x1af4 subdevice=3D0x1100
> none0@pci0:0:4:0:   class=3D0x040300 rev=3D0x01 hdr=3D0x00 vendor=3D0x808=
6 device=3D0x2668 subvendor=3D0x1af4 subdevice=3D0x1100
> virtio_pci2@pci0:0:5:0: class=3D0x010000 rev=3D0x00 hdr=3D0x00 vendor=3D0=
x1af4 device=3D0x1001 subvendor=3D0x1af4 subdevice=3D0x0002
>=20
> --=20
>   John-Mark Gurney              Voice: +1 415 225 5579
>=20
>      "All that I will do, has been done, All that I have, has not."
> =C3=82=20
>=20
>=20
>=20


Hi,

I'm using UTM as a wrapper around qemu. This gives me the following in dmes=
g which might be a good hint.
acpi0: <BOCHS BXPC>

"BOCHS" is also in the output of kenv.

Although I'm not sure if this is a good indicator for qemu.

Regards,
Ronald.
=C3=82=20
------=_Part_0_1079485241.1676366641320
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><br>
<p><strong>Van:</strong> John-Mark Gurney &lt;jmg@funkthat.com&gt;<br>
<strong>Datum:</strong> dinsdag, 14 februari 2023 09:05<br>
<strong>Aan:</strong> freebsd-arm@FreeBSD.org<br>
<strong>Onderwerp:</strong> detecting qemu/HVF on Apple M1 silicon</p>

<blockquote style=3D"padding-right: 0px; padding-left: 5px; margin-left: 5p=
x; border-left: #000000 2px solid; margin-right: 0px">
<div class=3D"MessageRFC822Viewer" id=3D"P">
<div class=3D"TextPlainViewer" id=3D"P.P">I managed to get FreeBSD running =
via qemu on Apple M1 silicon, but out<br>
of the box vm detection isn't working causing hz to be set to 1000, and<br>
causing lots of cpu usage to happen.<br>
<br>
What are the recommended ways to detect this, so we can get vm_guest set?<b=
r>
<br>
A little poking around, shows that there's an ACPI device that is<br>
promising:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Device (FWCF)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "QEMU0002") &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_STA, 0x0B) &nbsp;// _STA: Status<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_CCA, One) &nbsp;// _CCA: Cache Coherency Attribute<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_CRS, ResourceTemplate () &nbsp;// _CRS: Current Resource Settings<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<b=
r>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;Memory32Fixed (ReadWrite,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x09020000, &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Address Base<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x00000018, &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Address Length<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})<=
br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
Here's a complete list of _HID's:<br>
# acpidump -d | grep _HID | sort -u<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;Name (_HID, "PNP0C02" /* PNP Motherboard Resources */)=
 &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;Name (_HID, "PNP0C0F" /* PCI Interrupt Link Device */)=
 &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "ACPI0007" /* Processor Device */) &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "ACPI0013" /* Generic Event Device */) &nbsp;// _HID: Hardware ID<=
br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "ARMH0011") &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "LNRO0005") &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "PNP0A08" /* PCI Express Bus */) &nbsp;// _HID: Hardware ID<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "PNP0C0C" /* Power Button Device */) &nbsp;// _HID: Hardware ID<br=
>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nam=
e (_HID, "QEMU0002") &nbsp;// _HID: Hardware ID<br>
<br>
There's also the usual virtio devices as well.<br>
# pciconf -l<br>
hostb0@pci0:0:0:0: &nbsp;class=3D0x060000 rev=3D0x00 hdr=3D0x00 vendor=3D0x=
1b36 device=3D0x0008 subvendor=3D0x1af4 subdevice=3D0x1100<br>
virtio_pci0@pci0:0:1:0: class=3D0x020000 rev=3D0x00 hdr=3D0x00 vendor=3D0x1=
af4 device=3D0x1000 subvendor=3D0x1af4 subdevice=3D0x0001<br>
virtio_pci1@pci0:0:2:0: class=3D0x038000 rev=3D0x01 hdr=3D0x00 vendor=3D0x1=
af4 device=3D0x1050 subvendor=3D0x1af4 subdevice=3D0x1100<br>
xhci0@pci0:0:3:0: &nbsp;&nbsp;class=3D0x0c0330 rev=3D0x01 hdr=3D0x00 vendor=
=3D0x1b36 device=3D0x000d subvendor=3D0x1af4 subdevice=3D0x1100<br>
none0@pci0:0:4:0: &nbsp;&nbsp;class=3D0x040300 rev=3D0x01 hdr=3D0x00 vendor=
=3D0x8086 device=3D0x2668 subvendor=3D0x1af4 subdevice=3D0x1100<br>
virtio_pci2@pci0:0:5:0: class=3D0x010000 rev=3D0x00 hdr=3D0x00 vendor=3D0x1=
af4 device=3D0x1001 subvendor=3D0x1af4 subdevice=3D0x0002<br>
<br>
--&nbsp;<br>
&nbsp;&nbsp;John-Mark Gurney &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Voice: +1 415 225 5579<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"All that I will do, has been done, All that =
I have, has not."<br>
=C3=82&nbsp;</div>

<hr></div>
</blockquote>
<br>
<br>
Hi,<br>
<br>
I'm using UTM as a wrapper around qemu. This gives me the following in dmes=
g which might be a good hint.<br>
acpi0: &lt;BOCHS BXPC&gt;<br>
<br>
"BOCHS" is also in the output of kenv.<br>
<br>
Although I'm not sure if this is a good indicator for qemu.<br>
<br>
Regards,<br>
Ronald.<br>
=C3=82&nbsp;</body></html>
------=_Part_0_1079485241.1676366641320--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?306917284.1.1676366642956>