Page MenuHomeFreeBSD

bhyve: Add bhyverun and vmexit handlers for arm64
ClosedPublic

Authored by markj on Jul 12 2023, 1:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 16, 11:44 PM
Unknown Object (File)
Thu, May 16, 11:44 PM
Unknown Object (File)
Thu, May 16, 11:43 PM
Unknown Object (File)
Thu, May 16, 11:43 PM
Unknown Object (File)
Wed, May 15, 12:56 AM
Unknown Object (File)
Wed, May 15, 12:43 AM
Unknown Object (File)
Thu, May 9, 11:41 AM
Unknown Object (File)
Fri, May 3, 7:02 PM

Details

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 Not Applicable
Unit
Tests Not Applicable

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
75

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
75

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.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 10 2024, 3:20 PM
This revision was automatically updated to reflect the committed changes.