From: Tom Lendacky <thomas.lendacky@amd.com>
To: "Pratik R. Sampat" <pratikrajesh.sampat@amd.com>, kvm@vger.kernel.org
Cc: shuah@kernel.org, michael.roth@amd.com, seanjc@google.com,
pbonzini@redhat.com, pgonda@google.com,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC 1/5] selftests: KVM: Add a basic SNP smoke test
Date: Thu, 11 Jul 2024 10:56:13 -0500 [thread overview]
Message-ID: <b7c4316a-1b00-521c-991a-57e1d105952f@amd.com> (raw)
In-Reply-To: <20240710220540.188239-2-pratikrajesh.sampat@amd.com>
On 7/10/24 17:05, Pratik R. Sampat wrote:
> Extend sev_smoke_test to also run a minimal SEV-SNP smoke test that
> initializes and sets up private memory regions required to run a simple
> SEV-SNP guest.
>
> Similar to it's SEV-ES smoke test counterpart, this also does not support
> GHCB and ucall yet and uses the GHCB MSR protocol to trigger an exit of
> the type KVM_EXIT_SYSTEM_EVENT.
>
> Also, decouple policy and type and require functions to provide both
> such that there is no assumption regarding the type using policy.
>
> Signed-off-by: Pratik R. Sampat <pratikrajesh.sampat@amd.com>
> ---
> .../selftests/kvm/include/x86_64/processor.h | 1 +
> .../selftests/kvm/include/x86_64/sev.h | 29 ++++++++
> tools/testing/selftests/kvm/lib/kvm_util.c | 7 +-
> .../selftests/kvm/lib/x86_64/processor.c | 6 +-
> tools/testing/selftests/kvm/lib/x86_64/sev.c | 70 ++++++++++++++++++-
> .../selftests/kvm/x86_64/sev_smoke_test.c | 51 ++++++++++----
> 6 files changed, 146 insertions(+), 18 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index 8eb57de0b587..5683fc9794e4 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> +
> + if (kvm_cpu_has(X86_FEATURE_SNP) && is_kvm_snp_supported()) {
> + test_sev(guest_snp_code, KVM_X86_SNP_VM, SNP_POLICY_SMT | SNP_POLICY_RSVD_MBO);
> + /* Test minimum firmware level */
> + test_sev(guest_snp_code, KVM_X86_SNP_VM,
> + SNP_POLICY_SMT | SNP_POLICY_RSVD_MBO |
> + (SNP_FW_REQ_VER_MAJOR * SNP_POLICY_ABI_MAJOR) |
> + (SNP_FW_REQ_VER_MINOR * SNP_POLICY_ABI_MINOR));
This seems an odd way of setting these fields. Maybe, instead, use a
couple of macros that take the values and shift appropriately and ensure
that they don't exceed the 8-bits each field occupies.
Thanks,
Tom
>
next prev parent reply other threads:[~2024-07-11 15:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-10 22:05 [RFC 0/5] SEV Kernel Selftests Pratik R. Sampat
2024-07-10 22:05 ` [RFC 1/5] selftests: KVM: Add a basic SNP smoke test Pratik R. Sampat
2024-07-11 15:16 ` Peter Gonda
2024-07-11 16:21 ` Sampat, Pratik Rajesh
2024-07-11 15:56 ` Tom Lendacky [this message]
2024-07-11 16:23 ` Sampat, Pratik Rajesh
2024-07-10 22:05 ` [RFC 2/5] selftests: KVM: Decouple SEV ioctls from asserts Pratik R. Sampat
2024-07-11 15:19 ` Peter Gonda
2024-07-11 16:11 ` Peter Gonda
2024-07-11 16:27 ` Sampat, Pratik Rajesh
2024-08-09 15:40 ` Sean Christopherson
2024-08-13 15:23 ` Pratik R. Sampat
2024-08-13 15:27 ` Sean Christopherson
2024-08-13 15:30 ` Pratik R. Sampat
2024-07-10 22:05 ` [RFC 3/5] selftests: KVM: SEV IOCTL test Pratik R. Sampat
2024-07-11 15:23 ` Peter Gonda
2024-07-11 16:23 ` Sampat, Pratik Rajesh
2024-07-11 18:34 ` Tom Lendacky
2024-07-11 20:02 ` Sampat, Pratik Rajesh
2024-08-09 15:45 ` Sean Christopherson
2024-08-13 15:23 ` Pratik R. Sampat
2024-07-10 22:05 ` [RFC 4/5] selftests: KVM: SNP " Pratik R. Sampat
2024-07-11 15:57 ` Peter Gonda
2024-07-11 16:27 ` Sampat, Pratik Rajesh
2024-08-09 15:48 ` Sean Christopherson
2024-08-13 15:23 ` Pratik R. Sampat
2024-07-10 22:05 ` [RFC 5/5] selftests: KVM: SEV-SNP test for KVM_SEV_INIT2 Pratik R. Sampat
2024-07-11 15:57 ` Peter Gonda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b7c4316a-1b00-521c-991a-57e1d105952f@amd.com \
--to=thomas.lendacky@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=pgonda@google.com \
--cc=pratikrajesh.sampat@amd.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®