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
F86783113: D38438.id116784.diff
Tue, Jun 25, 12:50 PM
Unknown Object (File)
Fri, Jun 21, 9:44 PM
Unknown Object (File)
Sat, Jun 8, 10:05 AM
Unknown Object (File)
Sat, Jun 8, 10:05 AM
Unknown Object (File)
Sat, Jun 8, 10:05 AM
Unknown Object (File)
May 21 2024, 6:26 PM
Unknown Object (File)
May 19 2024, 11:47 PM
Unknown Object (File)
May 19 2024, 4:30 PM
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 Not Applicable
Unit
Tests Not Applicable

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
154

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

160

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