[PATCH v7 00/10] Basic SEV-SNP Selftests

2025-02-21 Thread Pratik R. Sampat
This patch series extends the sev_init2 and the sev_smoke test to exercise the SEV-SNP VM launch workflow. Primarily, it introduces the architectural defines, its support in the SEV library and extends the tests to interact with the SEV-SNP ioctl() wrappers. Patch 1 - Do not advertize SNP on ini

[PATCH v7 09/10] KVM: selftests: Abstractions for SEV to decouple policy from type

2025-02-21 Thread Pratik R. Sampat
In preparation for SNP, cleanup the smoke test to decouple deriving type from policy. This enables us to reuse existing interfaces as well as deduplicate the test calls that are called for SEV and SEV-ES. No functional change intended. [sea...@google.com: deduplication of common SEV+ test calls]

[PATCH v7 07/10] KVM: selftests: Add library support for interacting with SNP

2025-02-21 Thread Pratik R. Sampat
Extend the SEV library to include support for SNP ioctl() wrappers, which aid in launching and interacting with a SEV-SNP guest. Signed-off-by: Pratik R. Sampat --- v6..v7: * Remove FW version macros (Sean) * Define a new type KVM_SEV_PAGE_TYPE_INVALID so that encrypt_region called using the S

[PATCH v7 10/10] KVM: selftests: Add a basic SEV-SNP smoke test

2025-02-21 Thread Pratik R. Sampat
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 its SEV-ES smoke test counterpart, this also does not support GHCB and ucall yet and uses the GHCB MSR protocol to trigger an exit o

[PATCH v7 08/10] KVM: selftests: Force GUEST_MEMFD flag for SNP VM type

2025-02-21 Thread Pratik R. Sampat
Force the SEV-SNP VM type to set the KVM_MEM_GUEST_MEMFD flag for the creation of private memslots. Signed-off-by: Pratik R. Sampat --- v6..v7: * No change --- tools/testing/selftests/kvm/lib/kvm_util.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/testing/sel

[PATCH v7 04/10] KVM: selftests: Add SMT control state helper

2025-02-21 Thread Pratik R. Sampat
Move the SMT control check out of the hyperv_cpuid selftest so that it is generally accessible all selftests. Split the functionality into a helper that populates a buffer with SMT control value which other helpers can use to ascertain if SMT state is available and active. Signed-off-by: Pratik R.

[PATCH v7 06/10] KVM: selftests: Introduce SEV VM type check

2025-02-21 Thread Pratik R. Sampat
In preparation for SNP, declutter the vm type check by introducing a SEV-SNP VM type check as well as a transitive set of helper functions. The SNP VM type is the subset of SEV-ES. Similarly, the SEV-ES and SNP types are subset of the SEV VM type check. Signed-off-by: Pratik R. Sampat --- v6..v7

[PATCH v7 03/10] KVM: selftests: Add vmgexit helper

2025-02-21 Thread Pratik R. Sampat
Abstract rep vmmcall coded into the vmgexit helper for the sev library. No functional change intended. Signed-off-by: Pratik R. Sampat --- v6..v7: * Change vmgexit macro define to an inline function (Sean) --- tools/testing/selftests/kvm/include/x86/sev.h| 5 + tools/testing/selftests/

[PATCH v7 05/10] KVM: selftests: Replace assert() with TEST_ASSERT_EQ()

2025-02-21 Thread Pratik R. Sampat
For SEV tests, assert() failures on VM type or fd do not provide sufficient error reporting. Replace assert() with TEST_ASSERT_EQ() to obtain more detailed information on the assertion condition failure, including the call stack. Signed-off-by: Pratik R. Sampat --- v6..v7: * New - Replace older

[PATCH v7 01/10] KVM: SEV: Disable SEV-SNP support on initialization failure

2025-02-21 Thread Pratik R. Sampat
During platform init, SNP initialization may fail for several reasons, such as firmware command failures and incompatible versions. However, the KVM capability may continue to advertise support for it. Export this information to KVM and withdraw SEV-SNP support if has not been successfully initiali

[PATCH v7 02/10] KVM: selftests: SEV-SNP test for KVM_SEV_INIT2

2025-02-21 Thread Pratik R. Sampat
Add the X86_FEATURE_SEV_SNP CPU feature to the architectural definition for the SEV-SNP VM type to exercise the KVM_SEV_INIT2 call. Ensure that the SNP test is skipped in scenarios where CPUID supports it but KVM does not, preventing reporting of failure in such cases. Reviewed-by: Nikunj A Dadhan

Re: [PATCH RFC 15/24] rcu: Support Clang's capability analysis

2025-02-21 Thread Peter Zijlstra
On Fri, Feb 21, 2025 at 08:46:45PM +0100, Marco Elver wrote: > Anything else you see as urgent? Re-entrant locks support a deal breaker? Most actual locks are not recursive -- RCU being the big exception here. As to this being deal breakers, I don't think so. We should just start with the bits w

Re: [PATCH RFC 15/24] rcu: Support Clang's capability analysis

2025-02-21 Thread Marco Elver
On Fri, 21 Feb 2025 at 19:52, Peter Zijlstra wrote: > > On Fri, Feb 21, 2025 at 10:08:06AM -0800, Paul E. McKenney wrote: > > > > ... unfortunately even for shared locks, the compiler does not like > > > re-entrancy yet. It's not yet supported, and to fix that I'd have to go > > > and implement th

Re: [PATCH RFC 15/24] rcu: Support Clang's capability analysis

2025-02-21 Thread Peter Zijlstra
On Fri, Feb 21, 2025 at 10:08:06AM -0800, Paul E. McKenney wrote: > > ... unfortunately even for shared locks, the compiler does not like > > re-entrancy yet. It's not yet supported, and to fix that I'd have to go > > and implement that in Clang first before coming back to this. > > This would be

Re: [PATCH RFC 15/24] rcu: Support Clang's capability analysis

2025-02-21 Thread Paul E. McKenney
On Fri, Feb 21, 2025 at 06:10:02PM +0100, Marco Elver wrote: > On Thu, Feb 20, 2025 at 05:26PM -0800, Paul E. McKenney wrote: > [...] > > > That's what I've tried with this patch (rcu_read_lock_bh() also > > > acquires "RCU", on top of "RCU_BH"). I need to add a re-entrancy test, > > > and make sur

Re: [PATCH RFC 15/24] rcu: Support Clang's capability analysis

2025-02-21 Thread Marco Elver
On Thu, Feb 20, 2025 at 05:26PM -0800, Paul E. McKenney wrote: [...] > > That's what I've tried with this patch (rcu_read_lock_bh() also > > acquires "RCU", on top of "RCU_BH"). I need to add a re-entrancy test, > > and make sure it doesn't complain about that. At a later stage we > > might also wa