forked from cloud-hypervisor/cloud-hypervisor
-
Notifications
You must be signed in to change notification settings - Fork 4
DRAFT-DRAFT: Cpu profiles #1: CPUID feature restriction #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5dc01cb
build: Bump crate-ci/typos from 1.33.1 to 1.34.0
dependabot[bot] b6852af
docs: Fix the chown command in macvtap-bridge.md
liuw 51d16ab
Start manual implementation of CPUID feature flag values
olivereanderson 3b9962f
Add Feature flags with macros
olivereanderson 71bcaad
constructor
olivereanderson 3dd61f6
Intersect feature flags
olivereanderson 659b194
Move CpuProfile into arch/src/lib.rs
olivereanderson bf5955c
Make it compile with warnings
olivereanderson f48b1e7
Implement the restriction, improve documentation and some minor cleanup
olivereanderson bce9f29
Adjust documentation
olivereanderson 199adc3
Fix missing conditional compilation
olivereanderson cc2e355
Fix name
olivereanderson 4a23b61
Include missing field
olivereanderson 0f75b3e
Shorten macro
olivereanderson 618f169
Simplify macro further
olivereanderson 8218816
Drop guard early
olivereanderson 96ffe84
Make inner value public
olivereanderson 89a7ab3
Rename CpuIdFeatureFlags
olivereanderson 389f5f6
Refactor: Less structs. Use one complete struct with all feature regi…
olivereanderson 1964fbf
Refactoring
olivereanderson 2e50d2c
Add TODO comment for AMD duplicates
olivereanderson f68a9d9
More associated constants
olivereanderson 5c1ae50
Change macro to be more doc friendly
olivereanderson b08bcc2
Improve logs and add more comments
olivereanderson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| use crate::x86_64::cpuid_feature_flags::{CpuIdEntryRegister, CpuIdFeatureFlags}; | ||
|
|
||
| impl CpuIdFeatureFlags { | ||
| pub const fn intel_cascadelake_v1() -> Self { | ||
| use CpuIdEntryRegister as FF; | ||
|
|
||
| Self { | ||
| edx_1: FF::VME | ||
| .or(FF::SSE2) | ||
| .or(FF::SSE) | ||
| .or(FF::FXSR) | ||
| .or(FF::MMX) | ||
| .or(FF::CLFLUSH) | ||
| .or(FF::PSE36) | ||
| .or(FF::PAT) | ||
| .or(FF::CMOV) | ||
| .or(FF::MCA) | ||
| .or(FF::PGE) | ||
| .or(FF::MTRR) | ||
| .or(FF::SEP) | ||
| .or(FF::APIC) | ||
| .or(FF::CX8) | ||
| .or(FF::MCE) | ||
| .or(FF::PAE) | ||
| .or(FF::MSR) | ||
| .or(FF::TSC) | ||
| .or(FF::PSE) | ||
| .or(FF::DE) | ||
| .or(FF::FPU), | ||
|
|
||
| ecx_1: FF::AVX | ||
| .or(FF::XSAVE) | ||
| .or(FF::AES) | ||
| .or(FF::POPCNT) | ||
| .or(FF::X2APIC) | ||
| .or(FF::SSE4_2) | ||
| .or(FF::SSE4_1) | ||
| .or(FF::CX16) | ||
| .or(FF::SSSE3) | ||
| .or(FF::PCLMULQDQ) | ||
| .or(FF::SSE3) | ||
| .or(FF::TSC_DEADLINE) | ||
| .or(FF::FMA) | ||
| .or(FF::MOVBE) | ||
| .or(FF::PCID) | ||
| .or(FF::F16C) | ||
| .or(FF::RDRAND), | ||
|
|
||
| edx_8000_0001h: FF::LM | ||
| .or(FF::PDPE1GB) | ||
| .or(FF::RDTSCP) | ||
| .or(FF::NX) | ||
| .or(FF::SYSCALL), | ||
| ecx_8000_0001h: FF::ABM.or(FF::LAHF_LM).or(FF::PREFETCH_3DNOW), | ||
| ebx_7_0: FF::FSGSBASE | ||
| .or(FF::BMI1) | ||
| .or(FF::HLE) | ||
| .or(FF::AVX2) | ||
| .or(FF::SMEP) | ||
| .or(FF::BMI2) | ||
| .or(FF::ERMS) | ||
| .or(FF::INVPCID) | ||
| .or(FF::RTM) | ||
| .or(FF::RDSEED) | ||
| .or(FF::ADX) | ||
| .or(FF::SMAP) | ||
| .or(FF::CLWB) | ||
| .or(FF::AVX512F) | ||
| .or(FF::AVX512DQ) | ||
| .or(FF::AVX512BW) | ||
| .or(FF::AVX512CD) | ||
| .or(FF::AVX512VL) | ||
| .or(FF::CLFLUSHOPT), | ||
| ecx_7_0: FF::PKU.or(FF::AVX512VNNI), | ||
| edx_7_0: FF::SPEC_CTRL.or(FF::SSBD), | ||
| eax_0dh_1: FF::XSAVEOPT.or(FF::XSAVEC).or(FF::XGETBV1), | ||
| eax_7_1: FF::NULL, | ||
| ecx_7_1: FF::NULL, | ||
| edx_7_1: FF::NULL, | ||
| edx_7_2: FF::NULL, | ||
| ecx_14h: FF::NULL, | ||
| ecx_24h_1: FF::NULL, | ||
| /* | ||
| Caskadelake Server only supports TscInvariant, but this feature cannot be relied upon in the context of migration hence we also leave that turned off. | ||
| TODO: Isnt't this feature very useful when the VM is running normally though? (i.e. outside of migrations). | ||
| */ | ||
| edx_8000_0007h: FF::NULL, | ||
| ebx_8000_0008h: FF::NULL, | ||
| edx_8000_000ah: FF::NULL, | ||
| eax_8000_0021h: FF::NULL, | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| mod cpuid_feature_flags_impl; | ||
| #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "kebab-case")] | ||
| pub enum CpuProfile { | ||
| #[default] | ||
| Host, | ||
| CascadelakeServerV1, | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not my doing.
Should fix this before merging.