Skip to content

Commit 510dd74

Browse files
committed
hide FFXSR and WBNOINVD
FFXSR is used by Windows Server 2022 if available, which causes it to die very early in boot - the feature is not supported by illumos bhyve and we return a GP if the EFER bit is set. WBNOINVD is also masked by default bhyve CPUID masking, though this one is probably fine to pass through. Either way, because it is typically masked, guests using this are basically untested (though as some datapoints, Windows/Linux/illumos seem fine on bhyve with this bit passed through..)
1 parent c704a20 commit 510dd74

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

nexus/src/app/instance_platform/cpu_platform.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ fn milan_ideal() -> CpuIdDump {
437437
leaf.set_syscall_sysret(true);
438438
leaf.set_execute_disable(true);
439439
leaf.set_mmx_extensions(true);
440-
leaf.set_fast_fxsave_fxstor(true);
440+
// illumos does not support setting EFER.FFSXR, so hide the bit
441+
leaf.set_fast_fxsave_fxstor(false);
441442
leaf.set_1gib_pages(true);
442443
leaf.set_rdtscp(true);
443444
leaf.set_64bit_mode(true);
@@ -653,6 +654,19 @@ pub fn milan_rfd314() -> CpuIdDump {
653654
.set_l2_l3_cache_and_tlb_info(Some(leaf))
654655
.expect("can set leaf 8000_0006h");
655656

657+
let mut leaf = cpuid
658+
.get_processor_capacity_feature_info()
659+
.expect("can get leaf 8000_0008h");
660+
661+
// Support for `wbnoinvd` is hidden in bhyve for the time being. This would
662+
// probably be fine to pass through, but it is as-yet untested. Continue
663+
// hiding this instruction.
664+
leaf.set_wbnoinvd(false);
665+
666+
cpuid
667+
.set_processor_capacity_feature_info(Some(leaf))
668+
.expect("can set leaf 8000_0008h");
669+
656670
// Set up TLB information for 1GiB pages (leaf 8000_0019h)
657671
let mut leaf = Tlb1gbPageInfo::empty();
658672
leaf.set_dtlb_l1_1gb_associativity(0xF);
@@ -805,14 +819,14 @@ mod test {
805819
0xD, 0x2, 0x00000100, 0x00000240, 0x00000000, 0x00000000
806820
),
807821
cpuid_leaf!(0x80000000, 0x80000021, 0x68747541, 0x444D4163, 0x69746E65),
808-
cpuid_leaf!(0x80000001, 0x00A00F11, 0x40000000, 0x444001F9, 0x27D3FBFF),
822+
cpuid_leaf!(0x80000001, 0x00A00F11, 0x40000000, 0x444001F9, 0x25D3FBFF),
809823
cpuid_leaf!(0x80000002, 0x20444D41, 0x43595045, 0x31373720, 0x36205033),
810824
cpuid_leaf!(0x80000003, 0x6F432D34, 0x50206572, 0x65636F72, 0x726F7373),
811825
cpuid_leaf!(0x80000004, 0x20202020, 0x20202020, 0x20202020, 0x00202020),
812826
cpuid_leaf!(0x80000005, 0xFF40FF40, 0xFF40FF40, 0x20080140, 0x20080140),
813827
cpuid_leaf!(0x80000006, 0x48002200, 0x68004200, 0x02006140, 0x08009140),
814828
cpuid_leaf!(0x80000007, 0x00000000, 0x00000000, 0x00000000, 0x00000100),
815-
cpuid_leaf!(0x80000008, 0x00003030, 0x00000205, 0x00000000, 0x00000000),
829+
cpuid_leaf!(0x80000008, 0x00003030, 0x00000005, 0x00000000, 0x00000000),
816830
cpuid_leaf!(0x8000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
817831
cpuid_leaf!(0x80000019, 0xF040F040, 0xF0400000, 0x00000000, 0x00000000),
818832
cpuid_leaf!(0x8000001A, 0x00000006, 0x00000000, 0x00000000, 0x00000000),
@@ -975,8 +989,6 @@ mod test {
975989
// had been passing the CPUID bits through
976990
ext_processor_features.set_skinit(true);
977991
ext_processor_features.set_wdt(true);
978-
// TODO: Fast FXSAVE was not passed through?
979-
ext_processor_features.set_fast_fxsave_fxstor(false);
980992
cpuid
981993
.set_extended_processor_and_feature_identifiers(Some(
982994
ext_processor_features,
@@ -991,9 +1003,6 @@ mod test {
9911003
// even though the MSR itself is not available to guests.
9921004
leaf.set_inst_ret_cntr_msr(true);
9931005

994-
// TODO: Support for `wbnoinvd` was hidden from guests by byhve?
995-
leaf.set_wbnoinvd(false);
996-
9971006
// INVLPGB and RDPRU max were passed through even those instructions are not
9981007
// supported.
9991008
leaf.set_invlpgb_max_pages(7);

0 commit comments

Comments
 (0)