Page MenuHomeFreeBSD

FreeBSD enablement for ARM64 in Hyper-V
ClosedPublic

Authored by schakrabarti_microsoft.com on Sep 6 2022, 1:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 8:03 AM
Unknown Object (File)
Sat, Apr 6, 2:40 PM
Unknown Object (File)
Mon, Apr 1, 1:13 PM
Unknown Object (File)
Mon, Mar 25, 8:31 AM
Unknown Object (File)
Mar 4 2024, 10:00 PM
Unknown Object (File)
Feb 22 2024, 9:11 AM
Unknown Object (File)
Jan 28 2024, 7:17 AM
Unknown Object (File)
Jan 1 2024, 12:40 PM

Details

Summary

These changes are part of the large review, which includes : D36256 , D36052.
The changes are to refactor the code of vmbus.c and hyperv.c to keep minimal arch specific codes there and have them in separate files in x86/ arm64/ .
x86 is a new directory, which contains codes for x86 / x86_64. Instead of repeating the same codes in existing amd64/ and i386/, this approach reduced the
repetition.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This revision is now accepted and ready to land.Sep 29 2022, 8:12 AM
mmel added inline comments.
sys/dev/hyperv/vmbus/aarch64/hyperv_machdep.c
61 ↗(On Diff #111175)

But who will check if the target supports PSCI 1.2 (or later)? All my FDT-based boards hang inside the arm_smccc_1_2_hvc() function (none of them support PSCI 1.2).

sys/dev/hyperv/vmbus/aarch64/hyperv_aarch64.c
191

Huh, this function is obviously wrong and incomplete . We don't always run on a hypervisor and don't need SMCCC 1.2. There is no check for return values in hv_get_vpreg_128() .
I'm afraid this code was newer tested on a system without hyper-v

sys/dev/hyperv/vmbus/aarch64/hyperv_aarch64.c
191

Thanks for pointing, I have just found this problem. Will add a check with AcpiGbl_FADT HypervisorId to check if we are on Hyper-V or not ,
based on that will return.
Proposed change:
bool
hyperv_identify_features(void)
{
struct hv_get_vp_registers_output result;

        if (AcpiGbl_FADT.HypervisorId == "MsHyperv")
	   vm_guest = VM_GUEST_HV;
        else
            return (False);

hv_get_vpreg_128(CPUID_LEAF_HV_FEATURES, &result);
hyperv_features = result.as32.a;
hv_get_vpreg_128(CPUID_LEAF_HV_IDENTITY, &result);
hyperv_ver_major = result.as32.b >> 16;
hv_get_vpreg_128(CPUID_LEAF_HV_RECOMMENDS, &result);
hyperv_recommends = result.as32.a;
return (true);
}
will put this change, which should solve the problem.

Will put the

sys/dev/hyperv/vmbus/aarch64/hyperv_aarch64.c
191

WIll put the new patch for review by tomorrow.