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
F81885322: D36466.id111175.diff
Wed, Nov 27, 7:46 PM
F81885321: D36466.id111175.diff
Wed, Nov 27, 7:46 PM
Unknown Object (File)
Thu, Nov 14, 8:09 AM
Unknown Object (File)
Wed, Nov 13, 10:15 PM
Unknown Object (File)
Wed, Nov 13, 11:51 AM
Unknown Object (File)
Wed, Nov 13, 11:51 AM
Unknown Object (File)
Tue, Nov 12, 9:14 PM
Unknown Object (File)
Sun, Nov 10, 6:00 AM

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
62

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.