Skip to content

Commit 0aa94d3

Browse files
committed
initial Turin CPU platform
1 parent 2d7479e commit 0aa94d3

File tree

4 files changed

+73
-4
lines changed

4 files changed

+73
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ rand_distr = "0.5.1"
653653
rand_seeder = "0.4.0"
654654
range-requests = { path = "range-requests" }
655655
ratatui = "0.29.0"
656-
raw-cpuid = { git = "https://github.com/oxidecomputer/rust-cpuid.git", rev = "0a8dbd2311263f6a59ea58089e33c8331436ff3a" }
656+
raw-cpuid = { git = "https://github.com/oxidecomputer/rust-cpuid.git", rev = "8bdf76bfaa45bc30e944f8409d40f9edc7d62423" }
657657
rayon = "1.10"
658658
rcgen = "0.12.1"
659659
reconfigurator-cli = { path = "dev-tools/reconfigurator-cli" }

nexus/src/app/instance_platform/cpu_platform.rs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,70 @@ fn milan_ideal() -> CpuIdDump {
548548
dump
549549
}
550550

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+
551615
pub fn milan_rfd314() -> CpuIdDump {
552616
// This is the Milan we'd "want" to expose, absent any other constraints.
553617
let baseline = milan_ideal();

nexus/src/app/instance_platform/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,18 @@ fn cpuid_from_vmm_cpu_platform(
509509
) -> Option<Cpuid> {
510510
let cpuid = match platform {
511511
db::model::VmmCpuPlatform::SledDefault => return None,
512-
db::model::VmmCpuPlatform::AmdMilan
513-
| db::model::VmmCpuPlatform::AmdTurin => Cpuid {
512+
db::model::VmmCpuPlatform::AmdMilan => Cpuid {
514513
entries: cpu_platform::dump_to_cpuid_entries(
515514
cpu_platform::milan_rfd314(),
516515
),
517516
vendor: CpuidVendor::Amd,
518517
},
518+
db::model::VmmCpuPlatform::AmdTurin => Cpuid {
519+
entries: cpu_platform::dump_to_cpuid_entries(
520+
cpu_platform::turin_v1(),
521+
),
522+
vendor: CpuidVendor::Amd,
523+
},
519524
};
520525

521526
Some(cpuid)

0 commit comments

Comments
 (0)