diff mbox series

[v10,20/50] KVM: SEV: Select CONFIG_KVM_SW_PROTECTED_VM when CONFIG_KVM_AMD_SEV=y

Message ID 20231016132819.1002933-21-michael.roth@amd.com (mailing list archive)
State New
Headers show
Series Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support | expand

Commit Message

Michael Roth Oct. 16, 2023, 1:27 p.m. UTC
SEV-SNP relies on the restricted/protected memory support to run guests,
so make sure to enable that support with the
CONFIG_KVM_SW_PROTECTED_VM build option.

Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 arch/x86/kvm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Paolo Bonzini Dec. 13, 2023, 12:54 p.m. UTC | #1
On 10/16/23 15:27, Michael Roth wrote:
> SEV-SNP relies on the restricted/protected memory support to run guests,
> so make sure to enable that support with the
> CONFIG_KVM_SW_PROTECTED_VM build option.
> 
> Signed-off-by: Michael Roth<michael.roth@amd.com>
> ---

Why select KVM_SW_PROTECTED_VM and not KVM_GENERIC_PRIVATE_MEM?

Paolo
Borislav Petkov Dec. 18, 2023, 10:13 a.m. UTC | #2
On Mon, Oct 16, 2023 at 08:27:49AM -0500, Michael Roth wrote:
> SEV-SNP relies on the restricted/protected memory support to run guests,
> so make sure to enable that support with the
> CONFIG_KVM_SW_PROTECTED_VM build option.
> 
> Signed-off-by: Michael Roth <michael.roth@amd.com>
> ---
>  arch/x86/kvm/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> index 8452ed0228cb..71dc506aa3fb 100644
> --- a/arch/x86/kvm/Kconfig
> +++ b/arch/x86/kvm/Kconfig
> @@ -126,6 +126,7 @@ config KVM_AMD_SEV
>  	bool "AMD Secure Encrypted Virtualization (SEV) support"
>  	depends on KVM_AMD && X86_64
>  	depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
> +	select KVM_SW_PROTECTED_VM
>  	help
>  	  Provides support for launching Encrypted VMs (SEV) and Encrypted VMs
>  	  with Encrypted State (SEV-ES) on AMD processors.
> -- 

Kconfig doesn't like this one:

WARNING: unmet direct dependencies detected for KVM_SW_PROTECTED_VM
  Depends on [n]: VIRTUALIZATION [=y] && EXPERT [=n] && X86_64 [=y]
  Selected by [m]:
  - KVM_AMD_SEV [=y] && VIRTUALIZATION [=y] && KVM_AMD [=m] && X86_64 [=y] && CRYPTO_DEV_SP_PSP [=y] && (KVM_AMD [=m]!=y || CRYPTO_DEV_CCP_DD [=m]!=m)

WARNING: unmet direct dependencies detected for KVM_SW_PROTECTED_VM
  Depends on [n]: VIRTUALIZATION [=y] && EXPERT [=n] && X86_64 [=y]
  Selected by [m]:
  - KVM_AMD_SEV [=y] && VIRTUALIZATION [=y] && KVM_AMD [=m] && X86_64 [=y] && CRYPTO_DEV_SP_PSP [=y] && (KVM_AMD [=m]!=y || CRYPTO_DEV_CCP_DD [=m]!=m)
Michael Roth Dec. 29, 2023, 9:40 p.m. UTC | #3
On Mon, Dec 18, 2023 at 11:13:50AM +0100, Borislav Petkov wrote:
> On Mon, Oct 16, 2023 at 08:27:49AM -0500, Michael Roth wrote:
> > SEV-SNP relies on the restricted/protected memory support to run guests,
> > so make sure to enable that support with the
> > CONFIG_KVM_SW_PROTECTED_VM build option.
> > 
> > Signed-off-by: Michael Roth <michael.roth@amd.com>
> > ---
> >  arch/x86/kvm/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> > index 8452ed0228cb..71dc506aa3fb 100644
> > --- a/arch/x86/kvm/Kconfig
> > +++ b/arch/x86/kvm/Kconfig
> > @@ -126,6 +126,7 @@ config KVM_AMD_SEV
> >  	bool "AMD Secure Encrypted Virtualization (SEV) support"
> >  	depends on KVM_AMD && X86_64
> >  	depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
> > +	select KVM_SW_PROTECTED_VM
> >  	help
> >  	  Provides support for launching Encrypted VMs (SEV) and Encrypted VMs
> >  	  with Encrypted State (SEV-ES) on AMD processors.
> > -- 
> 
> Kconfig doesn't like this one:
> 
> WARNING: unmet direct dependencies detected for KVM_SW_PROTECTED_VM
>   Depends on [n]: VIRTUALIZATION [=y] && EXPERT [=n] && X86_64 [=y]
>   Selected by [m]:
>   - KVM_AMD_SEV [=y] && VIRTUALIZATION [=y] && KVM_AMD [=m] && X86_64 [=y] && CRYPTO_DEV_SP_PSP [=y] && (KVM_AMD [=m]!=y || CRYPTO_DEV_CCP_DD [=m]!=m)
> 
> WARNING: unmet direct dependencies detected for KVM_SW_PROTECTED_VM
>   Depends on [n]: VIRTUALIZATION [=y] && EXPERT [=n] && X86_64 [=y]
>   Selected by [m]:
>   - KVM_AMD_SEV [=y] && VIRTUALIZATION [=y] && KVM_AMD [=m] && X86_64 [=y] && CRYPTO_DEV_SP_PSP [=y] && (KVM_AMD [=m]!=y || CRYPTO_DEV_CCP_DD [=m]!=m)

I think this is because KVM_SW_PROTECTED_VM requires EXPERT, which has
to be set explicitly. But I think Paolo is right that
KVM_GENERIC_PRIVATE_MEM is more appropriate, which does not require
EXPERT.

-Mike

> 
> 
> -- 
> Regards/Gruss,
>     Boris.
> 
> https://people.kernel.org/tglx/notes-about-netiquette
>
Michael Roth Dec. 29, 2023, 9:41 p.m. UTC | #4
On Wed, Dec 13, 2023 at 01:54:55PM +0100, Paolo Bonzini wrote:
> On 10/16/23 15:27, Michael Roth wrote:
> > SEV-SNP relies on the restricted/protected memory support to run guests,
> > so make sure to enable that support with the
> > CONFIG_KVM_SW_PROTECTED_VM build option.
> > 
> > Signed-off-by: Michael Roth<michael.roth@amd.com>
> > ---
> 
> Why select KVM_SW_PROTECTED_VM and not KVM_GENERIC_PRIVATE_MEM?

I'm not sure, maybe there were previous iterations where it made sense
but KVM_GENERIC_PRIVATE_MEM definitely seems more appropriate now. I've
changed it accordingly.

-Mike

> 
> Paolo
> 
>
diff mbox series

Patch

diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 8452ed0228cb..71dc506aa3fb 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -126,6 +126,7 @@  config KVM_AMD_SEV
 	bool "AMD Secure Encrypted Virtualization (SEV) support"
 	depends on KVM_AMD && X86_64
 	depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
+	select KVM_SW_PROTECTED_VM
 	help
 	  Provides support for launching Encrypted VMs (SEV) and Encrypted VMs
 	  with Encrypted State (SEV-ES) on AMD processors.