Page MenuHomeFreeBSD

bhyve: add helper struct for qemus acpi table loader
ClosedPublic

Authored by corvink on Feb 8 2023, 2:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 12:55 PM
Unknown Object (File)
Oct 17 2024, 6:47 AM
Unknown Object (File)
Oct 16 2024, 4:54 AM
Unknown Object (File)
Oct 15 2024, 5:29 PM
Unknown Object (File)
Oct 13 2024, 1:36 PM
Unknown Object (File)
Oct 11 2024, 7:33 PM
Unknown Object (File)
Oct 10 2024, 7:47 AM
Unknown Object (File)
Oct 8 2024, 6:47 AM
Subscribers

Details

Summary

The hypervisor is aware of all system properties. For the guest bios
it's hard and complex to detect all system properties. For that reason,
it would be better if the hypervisor creates acpi tables instead of the
guest. Therefore, the hypervisor has to send the acpi tables to the
guest. At the moment, bhyve just copies the acpi tables into the guest
memory. This approach has some restrictions. You have to keep sure that
the guest doesn't overwrite them accidentally. Additionally, the size of
acpi tables is limited.

Providing a plain copy of all acpi tables by fwcfg isn't possible. Acpi
tables have to point to each other. So, if the guest copies the acpi
tables into memory by it's own, it has to patch the tables. Due to
different layouts for different acpi tables, there's no generic way to
do that. For that reason, qemu created a table loader interface. It
contains commands for the guest for loading specific blobs into guest
memory and patching those blobs.

This commit adds a qemu_loader class which handles the creation of qemu
loader commands. At the moment, the WRITE_POINTER command isn't
implement. It won't be required by bhyve's acpi table generation yet.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 50601
Build 47492: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/qemu_loader.c
10

Don't need this in new files.

233
235
250

@jhb @markj Any additional comments on this patch?

You have to allocate an element before working on it with add_checksum
or add_pointer. Therefore, insert all allocation to the head of the
queue while inserting the rest at the tail.

usr.sbin/bhyve/qemu_loader.c
153

I think we want to avoid this pattern? See commit 61482760a0ca198a9310d450133e9ac792b67955 .

159

Accept a variable length string on all qemu-loader function.

@markj @jhb Any complains about this? I'd like to get this merged for 14.0.

HEADS UP. I'm going to commit this tomorrow if noone complains.

markj added inline comments.
usr.sbin/bhyve/qemu_loader.c
197

Missing parens around return values.

This revision is now accepted and ready to land.Apr 24 2023, 3:36 PM