Skip to content
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

sevctl ok: Detect and use host arch's CPU generation #5

Merged
merged 2 commits into from
Apr 4, 2022
Merged

sevctl ok: Detect and use host arch's CPU generation #5

merged 2 commits into from
Apr 4, 2022

Conversation

tylerfanelli
Copy link
Member

When using sevctl ok without specifying a generation, allow the tool to determine the underlying processor's SEV generation and only include tests relevant to that specific generation.

@tylerfanelli tylerfanelli requested a review from slp March 24, 2022 16:30
src/ok.rs Show resolved Hide resolved
@@ -46,7 +46,7 @@ Probes processor, sysfs, and KVM for AMD SEV, SEV-ES, and SEV-SNP related featur

```console
$ sevctl ok {sev, es, snp} // Probes support for the generation specified.
$ sevctl ok // Probes for SEV, SEV-ES, and SEV-SNP support.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of feel like the original comment was easier to understand. Perhaps adding an (autodetected) to the end of it would be sufficient?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read that as Probes for SEV, SEV-ES, and SEV-SNP support regardless of the generation you're running on, which would no longer be the case with this update.

What about Probes for SEV, SEV-ES, and SEV-SNP based on the autodetected generation the host CPU is running on?

When the ok command is invoked without a processor generation specified,
probe the host hardware for the current generation of AMD processor and
test for that generation specifically.

Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
@tylerfanelli
Copy link
Member Author

@slp there needed to be some conversion from the CPUID string to get an actual usize from it, but once that is finished, it is simple usize comparison instead of String comparison (saving CPU cycles)

@tylerfanelli tylerfanelli requested a review from slp March 31, 2022 17:55
@slp
Copy link
Contributor

slp commented Apr 4, 2022

LGTM, thanks!

@slp slp merged commit 94ab528 into virtee:main Apr 4, 2022
@tylerfanelli tylerfanelli deleted the ok_usearch branch April 6, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants