Page MenuHomeFreeBSD

bhyve: Add bhyverun and vmexit handlers for arm64
Needs ReviewPublic

Authored by markj on Jul 12 2023, 1:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 7:32 AM
Unknown Object (File)
Dec 19 2023, 8:19 PM
Unknown Object (File)
Dec 11 2023, 4:29 AM
Unknown Object (File)
Nov 20 2023, 9:20 PM
Unknown Object (File)
Nov 20 2023, 9:15 PM
Unknown Object (File)
Nov 20 2023, 8:50 PM
Unknown Object (File)
Nov 6 2023, 8:03 AM
Unknown Object (File)
Oct 28 2023, 6:11 PM

Details

Reviewers
jhb
corvink
andrew
Group Reviewers
bhyve
Summary

vmexit handlers are imported mostly unmodified from
https://github.com/zxombie/freebsd/tree/bhyvearm64 . The
bhyverun_machdep.c is also mostly from that branch, though refactored
quite a bit by me.

Diff Detail

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

Event Timeline

markj requested review of this revision.Jul 12 2023, 1:53 PM

Presumably the arm64-specific bits of this series depend on sys/arm64/include/vmm_dev.h being added?

This revision is now accepted and ready to land.Jul 12 2023, 7:10 PM

vmexit_hyp is incomplete, e.g. the PARange check is commented out.

corvink added inline comments.
usr.sbin/bhyve/aarch64/bhyverun_machdep.c
123

Shouldn't those bits be added to a aarch64/uart.c file?

usr.sbin/bhyve/aarch64/vmexit.c
88

This one seems to be very generic. Seems like it matches the amd64. So, we shouldn't make it MD.

usr.sbin/bhyve/aarch64/bhyverun_machdep.c
123

They could be, yes. This code is simple enough that I opted to keep them here for now, so that it's easy to share info with the FDT builder. This code is not very generic yet, and until ACPI support is done I'd prefer to keep things simple.

usr.sbin/bhyve/aarch64/vmexit.c
88

I ended up changing it slightly (arm64 doesn't have triple faults).

usr.sbin/bhyve/aarch64/vmexit.c
253

Is this needed? I though I moved it to the kernel as we don't have all the needed information here.

usr.sbin/bhyve/aarch64/vmexit.c
253

I have been trying to answer that same question for myself. :)

Indeed, I can't see how we could reach this code. The kernel handles this case, and properly raises an address space fault in the case you pointed out earlier.

markj marked an inline comment as done.

Make vmexit_hyp() a stub. Translation faults are handled in the kernel.

This revision now requires review to proceed.Sep 5 2023, 1:45 PM
usr.sbin/bhyve/aarch64/bhyverun_machdep.c
5

Should this get an additional copyright line? Even when mostly copied from existing amd64 it seems odd to have no extra copyright line.

This revision is now accepted and ready to land.Sep 6 2023, 9:24 AM

Allocate space for a GIC redistributor per vCPU. From jrtc27.

This revision now requires review to proceed.Dec 11 2023, 4:14 PM
usr.sbin/bhyve/aarch64/bhyverun_machdep.c
74

It's not recommended to place ACPI tables in memory because it has some constraints. On amd64 we just do that for backward compatibility. It's preferred to use QemuFwCfg to pass ACPI tables to the guest. Afaik, QemuFwCfg isn't supported by aarch64 yet. Nevertheless, it would be better to fix that instead of placing ACPI tables in memory.

usr.sbin/bhyve/aarch64/bhyverun_machdep.c
74

Sorry for the slow reply. The defaults were inherited from amd64 from before you changed this setting. It's moot for now since we don't build ACPI tables on arm64 at all currently.