On Wed, Sep 29, 2021 at 11:07:30AM +0100, Daniel P. Berrangé wrote:
I'm not sure if we actually need the full driver or not for
testing
purposes. The the GenID is just in memory somewhere, and the somewhere
is reported via ACPI table entry. For QEMU its easy as the data is
exposed via fw_cfg which can be read from sysfs directly without
even needing to look at ACPI entries to find it. Not sure how we
find it with VMWare/HyperV though.
This still has the problem that qemu is mangling the vmgenid.
Nevertheless, on qemu-6.1.0-5.fc36.x86_64 I added this to a Linux
guest:
<genid>11223344-5566-7788-99aa-bbccddeeff00</genid>
which turned into:
-device vmgenid,guid=11223344-5566-7788-99aa-bbccddeeff00,id=vmgenid0
Inside the guest:
# ls /sys/firmware/qemu_fw_cfg/by_name/etc/vmgenid_guid/ -l
total 0
-r--------. 1 root root 4096 Sep 29 11:16 key
-r--------. 1 root root 4096 Sep 29 11:16 name
-r--------. 1 root root 0 Sep 29 11:16 raw
-r--------. 1 root root 4096 Sep 29 11:16 size
# hexdump -C /sys/firmware/qemu_fw_cfg/by_name/etc/vmgenid_guid/raw
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000020 00 00 00 00 00 00 00 00 44 33 22 11 66 55 88 77 |........D3".fU.w|
00000030 99 aa bb cc dd ee ff 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001000
But I think what I really need to do is look at the raw physical
address:
# hexdump -C /sys/firmware/qemu_fw_cfg/by_name/etc/vmgenid_addr/raw
00000000 28 f0 ff 7f 00 00 00 00 |(.......|
00000008
# dd if=/dev/mem bs=1 skip=$(( 0x7ffff028 )) count=16 | hexdump -C
16+0 records in
16+0 records out
16 bytes copied, 6.0392e-05 s, 265 kB/s
00000000 44 33 22 11 66 55 88 77 99 aa bb cc dd ee ff 00 |D3".fU.w........|
00000010
I think for VMware I'm really going to need the kernel driver, unless
there's some way that iasl can be used to extract the information?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org