@@ -548,6 +548,70 @@ fn milan_ideal() -> CpuIdDump {
548
548
dump
549
549
}
550
550
551
+ pub fn turin_v1 ( ) -> CpuIdDump {
552
+ // For VMs, a Turin-like CPU is very much like Milan with AVX-512 features,
553
+ // so start from Milan.
554
+ let baseline = milan_ideal ( ) ;
555
+
556
+ let mut cpuid = CpuId :: with_cpuid_reader ( baseline) ;
557
+
558
+ let mut leaf = cpuid. get_extended_feature_info ( )
559
+ . expect ( "baseline Milan defines leaf 7" ) ;
560
+
561
+ // These are the AVX512 features present on a 9365, when I'd looked in
562
+ // September, anyway
563
+ leaf. set_avx512f ( true ) ;
564
+ leaf. set_avx512dq ( true ) ;
565
+ leaf. set_avx512_ifma ( true ) ;
566
+ leaf. set_avx512cd ( true ) ;
567
+ leaf. set_avx512bw ( true ) ;
568
+ leaf. set_avx512vl ( true ) ;
569
+
570
+ leaf. set_avx512vbmi ( true ) ;
571
+ leaf. set_avx512vbmi2 ( true ) ;
572
+ leaf. set_gfni ( true ) ;
573
+ leaf. set_avx512vnni ( true ) ;
574
+ leaf. set_avx512bitalg ( true ) ;
575
+ leaf. set_avx512vpopcntdq ( true ) ;
576
+
577
+ leaf. set_avx512_bf16 ( true ) ;
578
+ leaf. set_avx_vnni ( true ) ;
579
+
580
+ cpuid. set_extended_feature_info ( Some ( leaf) )
581
+ . expect ( "can set leaf 7h" ) ;
582
+
583
+ let mut leaf = cpuid
584
+ . get_extended_processor_and_feature_identifiers ( )
585
+ . expect ( "baseline Milan defines leaf 8000_0001" ) ;
586
+ // RDTSCP requires some bhyve and Propolis work to support, so it is masked
587
+ // off for now.
588
+ leaf. set_rdtscp ( false ) ;
589
+ cpuid. set_extended_processor_and_feature_identifiers ( Some ( leaf) )
590
+ . expect ( "can set leaf 8000_0001h" ) ;
591
+
592
+ cpuid
593
+ . set_processor_brand_string ( Some ( b"Oxide Virtual Turin-like Processor" ) )
594
+ . expect ( "can set vCPU brand string" ) ;
595
+
596
+ let mut leaf = cpuid
597
+ . get_processor_capacity_feature_info ( )
598
+ . expect ( "can get leaf 8000_0008h" ) ;
599
+
600
+ // Support for `wbnoinvd` is hidden in bhyve for the time being. This would
601
+ // probably be fine to pass through, but it is as-yet untested. Continue
602
+ // hiding this instruction.
603
+ leaf. set_wbnoinvd ( false ) ;
604
+
605
+ cpuid
606
+ . set_processor_capacity_feature_info ( Some ( leaf) )
607
+ . expect ( "can set leaf 8000_0008h" ) ;
608
+
609
+ // Cache topology leaves are otherwise left zeroed; if we can avoid getting
610
+ // into it, let's try!
611
+
612
+ cpuid. into_source ( )
613
+ }
614
+
551
615
pub fn milan_rfd314 ( ) -> CpuIdDump {
552
616
// This is the Milan we'd "want" to expose, absent any other constraints.
553
617
let baseline = milan_ideal ( ) ;
0 commit comments