Skip to contentSkip to conversation

SEV-SNP guest policy bit support updates

RFC PATCH Superseded Tom Lendacky 2 participants 9 messages Aug 22, 2025 – Sep 10, 2025

Subsystems (6)
x86 KVM Crypto API KVM x86 +2 more subsystems

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tom Lendacky

author maintainer
#0 lore raw

cover SEV-SNP guest policy bit support updates

This series aims to allow more flexibility in specifying SEV-SNP policy bits by improving discoverability of supported policy bits from userspace and enabling support for newer policy bits.

- The first patch adds a new KVM_X86_GRP_SEV attribute group, KVM_X86_SNP_POLICY_BITS, that can be used to return the supported SEV-SNP policy bits. The initial support for this attribute will return the current KVM supported policy bitmask.

- The next 3 patches provide for adding to the known SEV-SNP policy bits. Since some policy bits are dependent on specific levels of SEV firmware support, the CCP driver is updated to provide an API to return the supported policy bits.

The supported policy bits bitmask used by KVM is generated by taking the policy bitmask returned by the CCP driver and ANDing it with the KVM supported policy bits. KVM supported policy bits are policy bits that do not require any specific implementation support from KVM to allow.

This series has a prereq against the ciphertext hiding patches that were recently accepted into the cryptodev tree.

The series is based off of:
git://git.kernel.org/pub/scm/virt/kvm/kvm.git next

with the added the ciphertext hiding patches

Tom Lendacky (4):
KVM: SEV: Publish supported SEV-SNP policy bits
KVM: SEV: Consolidate the SEV policy bits in a single header file
crypto: ccp - Add an API to return the supported SEV-SNP policy bits
KVM: SEV: Add known supported SEV-SNP policy bits

 arch/x86/include/uapi/asm/kvm.h |  1 +
 arch/x86/kvm/svm/sev.c          | 45 +++++++++++++++++++++------------
 arch/x86/kvm/svm/svm.h          |  3 ---
 drivers/crypto/ccp/sev-dev.c    | 37 +++++++++++++++++++++++++++
 include/linux/psp-sev.h         | 39 ++++++++++++++++++++++++++++
 5 files changed, 106 insertions(+), 19 deletions(-)

base-commit: 82a56258ec2d48f9bb1e9ce8f26b14c161dfe4fb

Signature · 1 line
2.46.2
author maintainer
#1 lore raw

RFC PATCH 1/4 KVM: SEV: Publish supported SEV-SNP policy bits

Define the set of policy bits that KVM currently knows as not requiring any implementation support within KVM. Provide this value to userspace via the KVM_GET_DEVICE_ATTR ioctl.

---
 arch/x86/include/uapi/asm/kvm.h |  1 +
 arch/x86/kvm/svm/sev.c          | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/include/uapi/asm/kvm.h +1 -0
index 0f15d683817d..90e9c4551fa6 100644
@@ -468,6 +468,7 @@ struct kvm_sync_regs {
 /* vendor-specific groups and attributes for system fd */
 #define KVM_X86_GRP_SEV			1
 #  define KVM_X86_SEV_VMSA_FEATURES	0
+#  define KVM_X86_SNP_POLICY_BITS	1
 
 struct kvm_vmx_nested_state_data {
 	__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
arch/x86/kvm/svm/sev.c +10 -1
index 2fbdebf79fbb..7e6ce092628a 100644
@@ -78,6 +78,8 @@ static u64 sev_supported_vmsa_features;
 					 SNP_POLICY_MASK_DEBUG		| \
 					 SNP_POLICY_MASK_SINGLE_SOCKET)
 
+static u64 snp_supported_policy_bits;
+
 #define INITIAL_VMSA_GPA 0xFFFFFFFFF000
 
 static u8 sev_enc_bit;
@@ -2113,6 +2115,10 @@ int sev_dev_get_attr(u32 group, u64 attr, u64 *val)
 		*val = sev_supported_vmsa_features;
 		return 0;
 
+	case KVM_X86_SNP_POLICY_BITS:
+		*val = snp_supported_policy_bits;
+		return 0;
+
 	default:
 		return -ENXIO;
 	}
@@ -2177,7 +2183,7 @@ static int snp_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp)
 	if (params.flags)
 		return -EINVAL;
 
-	if (params.policy & ~SNP_POLICY_MASK_VALID)
+	if (params.policy & ~snp_supported_policy_bits)
 		return -EINVAL;
 
 	/* Check for policy bits that must be set */
@@ -3054,6 +3060,9 @@ void __init sev_hardware_setup(void)
 			sev_supported = sev_es_supported = sev_snp_supported = false;
 		else if (sev_snp_supported)
 			sev_snp_supported = is_sev_snp_initialized();
+
+		if (sev_snp_supported)
+			snp_supported_policy_bits = SNP_POLICY_MASK_VALID;
 	}
 
 	if (boot_cpu_has(X86_FEATURE_SEV))
Signature · 1 line
2.46.2
#2 lore raw

Re: [RFC PATCH 1/4] KVM: SEV: Publish supported SEV-SNP policy bits

Quoted 27 lines · Tom Lendacky

Define the set of policy bits that KVM currently knows as not requiring any implementation support within KVM. Provide this value to userspace via the KVM_GET_DEVICE_ATTR ioctl.

---
 arch/x86/include/uapi/asm/kvm.h |  1 +
 arch/x86/kvm/svm/sev.c          | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/include/uapi/asm/kvm.h +1 -0
index 0f15d683817d..90e9c4551fa6 100644
@@ -468,6 +468,7 @@ struct kvm_sync_regs {
 /* vendor-specific groups and attributes for system fd */
 #define KVM_X86_GRP_SEV			1
 #  define KVM_X86_SEV_VMSA_FEATURES	0
+#  define KVM_X86_SNP_POLICY_BITS	1
 
 struct kvm_vmx_nested_state_data {
 	__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
arch/x86/kvm/svm/sev.c +0 -0
index 2fbdebf79fbb..7e6ce092628a 100644

arch/x86/kvm/svm/sev.c static u64 sev_supported_vmsa_features; · line 81

Quoted 4 lines
arch/x86/kvm/svm/sev.c +1 -0
@@ -78,6 +78,8 @@ static u64 sev_supported_vmsa_features;
 					 SNP_POLICY_MASK_DEBUG		| \
 					 SNP_POLICY_MASK_SINGLE_SOCKET)
 
+static u64 snp_supported_policy_bits;

This can be __ro_after_init. Hmm, off topic, but I bet we can give most of the variables confifugred by sev_hardware_setup() the same treatment. And really off topic, I have a patch somewhere to convert a bunch of KVM variables from __read_mostly to __ro_after_init...

author maintainer
#3 lore raw

Re: [RFC PATCH 1/4] KVM: SEV: Publish supported SEV-SNP policy bits

Quoted 31 lines · Sean Christopherson
Quoted 30 lines · Tom Lendacky

Define the set of policy bits that KVM currently knows as not requiring any implementation support within KVM. Provide this value to userspace via the KVM_GET_DEVICE_ATTR ioctl.

---
 arch/x86/include/uapi/asm/kvm.h |  1 +
 arch/x86/kvm/svm/sev.c          | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/include/uapi/asm/kvm.h +1 -0
index 0f15d683817d..90e9c4551fa6 100644
@@ -468,6 +468,7 @@ struct kvm_sync_regs {
 /* vendor-specific groups and attributes for system fd */
 #define KVM_X86_GRP_SEV			1
 #  define KVM_X86_SEV_VMSA_FEATURES	0
+#  define KVM_X86_SNP_POLICY_BITS	1
 
 struct kvm_vmx_nested_state_data {
 	__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
arch/x86/kvm/svm/sev.c +0 -0
index 2fbdebf79fbb..7e6ce092628a 100644
@@ -78,6 +78,8 @@ static u64 sev_supported_vmsa_features;
 					 SNP_POLICY_MASK_DEBUG		| \
 					 SNP_POLICY_MASK_SINGLE_SOCKET)
 
Quoted 3 lines

arch/x86/kvm/svm/sev.c static u64 sev_supported_vmsa_features; · line 81

Quoted 1 line
arch/x86/kvm/svm/sev.c +1 -0
+static u64 snp_supported_policy_bits;

This can be __ro_after_init. Hmm, off topic, but I bet we can give most of the

In the current form, I agree. If/when we support dynamic SEV firmware updates, we may want to re-evaluate the supported policy bits since newer SEV firmware could have made new bits available.

Maybe instead we move the call to get the current SEV firmware supported bits and ANDing of the KVM supported bits into sev_dev_get_attr() and snp_launch_start()? The downside is it is possible that the supported policy bits could change between the two calls by the VMM.

Thanks,
Tom

Quoted 3 lines

variables confifugred by sev_hardware_setup() the same treatment. And really off topic, I have a patch somewhere to convert a bunch of KVM variables from __read_mostly to __ro_after_init...

author maintainer
#4 lore raw

RFC PATCH 2/4 KVM: SEV: Consolidate the SEV policy bits in a single header file

In reply to Tom Lendacky

Consolidate SEV policy bit definitions into a single file. Use include/linux/psp-sev.h to hold the definitions and remove the current definitions from the arch/x86/kvm/svm/sev.c and arch/x86/include/svm.h files.

No functional change intended.

---
 arch/x86/kvm/svm/sev.c  | 16 ++++------------
 arch/x86/kvm/svm/svm.h  |  3 ---
 include/linux/psp-sev.h | 19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 15 deletions(-)
arch/x86/kvm/svm/sev.c +4 -12
index 7e6ce092628a..b21376e83ca7 100644
@@ -63,15 +63,7 @@ static u64 sev_supported_vmsa_features;
 #define AP_RESET_HOLD_NAE_EVENT		1
 #define AP_RESET_HOLD_MSR_PROTO		2
 
-/* As defined by SEV-SNP Firmware ABI, under "Guest Policy". */
-#define SNP_POLICY_MASK_API_MINOR	GENMASK_ULL(7, 0)
-#define SNP_POLICY_MASK_API_MAJOR	GENMASK_ULL(15, 8)
-#define SNP_POLICY_MASK_SMT		BIT_ULL(16)
-#define SNP_POLICY_MASK_RSVD_MBO	BIT_ULL(17)
-#define SNP_POLICY_MASK_DEBUG		BIT_ULL(19)
-#define SNP_POLICY_MASK_SINGLE_SOCKET	BIT_ULL(20)
-
-#define SNP_POLICY_MASK_VALID		(SNP_POLICY_MASK_API_MINOR	| \
+#define KVM_SNP_POLICY_MASK_VALID	(SNP_POLICY_MASK_API_MINOR	| \
 					 SNP_POLICY_MASK_API_MAJOR	| \
 					 SNP_POLICY_MASK_SMT		| \
 					 SNP_POLICY_MASK_RSVD_MBO	| \
@@ -3062,7 +3054,7 @@ void __init sev_hardware_setup(void)
 			sev_snp_supported = is_sev_snp_initialized();
 
 		if (sev_snp_supported)
-			snp_supported_policy_bits = SNP_POLICY_MASK_VALID;
+			snp_supported_policy_bits = KVM_SNP_POLICY_MASK_VALID;
 	}
 
 	if (boot_cpu_has(X86_FEATURE_SEV))
@@ -4993,10 +4985,10 @@ struct vmcb_save_area *sev_decrypt_vmsa(struct kvm_vcpu *vcpu)
 
 	/* Check if the SEV policy allows debugging */
 	if (sev_snp_guest(vcpu->kvm)) {
-		if (!(sev->policy & SNP_POLICY_DEBUG))
+		if (!(sev->policy & SNP_POLICY_MASK_DEBUG))
 			return NULL;
 	} else {
-		if (sev->policy & SEV_POLICY_NODBG)
+		if (sev->policy & SEV_POLICY_MASK_NODBG)
 			return NULL;
 	}
 
arch/x86/kvm/svm/svm.h +0 -3
index 58b9d168e0c8..61911a2b78c3 100644
@@ -113,9 +113,6 @@ struct kvm_sev_info {
 	cpumask_var_t have_run_cpus; /* CPUs that have done VMRUN for this VM. */
 };
 
-#define SEV_POLICY_NODBG	BIT_ULL(0)
-#define SNP_POLICY_DEBUG	BIT_ULL(19)
-
 struct kvm_svm {
 	struct kvm kvm;
 
include/linux/psp-sev.h +19 -0
index e0dbcb4b4fd9..27c92543bf38 100644
@@ -14,6 +14,25 @@
 
 #include <uapi/linux/psp-sev.h>
 
+/* As defined by SEV API, under "Guest Policy". */
+#define SEV_POLICY_MASK_NODBG			BIT(0)
+#define SEV_POLICY_MASK_NOKS			BIT(1)
+#define SEV_POLICY_MASK_ES			BIT(2)
+#define SEV_POLICY_MASK_NOSEND			BIT(3)
+#define SEV_POLICY_MASK_DOMAIN			BIT(4)
+#define SEV_POLICY_MASK_SEV			BIT(5)
+#define SEV_POLICY_MASK_API_MAJOR		GENMASK(23, 16)
+#define SEV_POLICY_MASK_API_MINOR		GENMASK(31, 24)
+
+/* As defined by SEV-SNP Firmware ABI, under "Guest Policy". */
+#define SNP_POLICY_MASK_API_MINOR		GENMASK_ULL(7, 0)
+#define SNP_POLICY_MASK_API_MAJOR		GENMASK_ULL(15, 8)
+#define SNP_POLICY_MASK_SMT			BIT_ULL(16)
+#define SNP_POLICY_MASK_RSVD_MBO		BIT_ULL(17)
+#define SNP_POLICY_MASK_MIGRATE_MA		BIT_ULL(18)
+#define SNP_POLICY_MASK_DEBUG			BIT_ULL(19)
+#define SNP_POLICY_MASK_SINGLE_SOCKET		BIT_ULL(20)
+
 #define SEV_FW_BLOB_MAX_SIZE	0x4000	/* 16KB */
 
 /**
Signature · 1 line
2.46.2
author maintainer
#5 lore raw

RFC PATCH 3/4 crypto: ccp - Add an API to return the supported SEV-SNP policy bits

In reply to Tom Lendacky

Supported policy bits are dependent on the level of SEV firmware that is currently running. Create an API to return the supported policy bits for a given level of firmware. KVM will AND that value with the KVM supported policy bits to generate the actual supported policy bits.

---
 arch/x86/kvm/svm/sev.c       |  6 ++++--
 drivers/crypto/ccp/sev-dev.c | 37 ++++++++++++++++++++++++++++++++++++
 include/linux/psp-sev.h      | 20 +++++++++++++++++++
 3 files changed, 61 insertions(+), 2 deletions(-)
arch/x86/kvm/svm/sev.c +4 -2
index b21376e83ca7..acdea463dd4f 100644
@@ -3053,8 +3053,10 @@ void __init sev_hardware_setup(void)
 		else if (sev_snp_supported)
 			sev_snp_supported = is_sev_snp_initialized();
 
-		if (sev_snp_supported)
-			snp_supported_policy_bits = KVM_SNP_POLICY_MASK_VALID;
+		if (sev_snp_supported) {
+			snp_supported_policy_bits = sev_get_snp_policy_bits();
+			snp_supported_policy_bits &= KVM_SNP_POLICY_MASK_VALID;
+		}
 	}
 
 	if (boot_cpu_has(X86_FEATURE_SEV))
drivers/crypto/ccp/sev-dev.c +37 -0
index c3bced655568..b66244d6b10f 100644
@@ -2575,6 +2575,43 @@ void sev_platform_shutdown(void)
 }
 EXPORT_SYMBOL_GPL(sev_platform_shutdown);
 
+u64 sev_get_snp_policy_bits(void)
+{
+	struct psp_device *psp = psp_master;
+	struct sev_device *sev;
+	u64 policy_bits;
+
+	if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
+		return 0;
+
+	if (!psp || !psp->sev_data)
+		return 0;
+
+	sev = psp->sev_data;
+
+	policy_bits = SNP_POLICY_MASK_BASE;
+
+	if (sev->snp_plat_status.feature_info) {
+		if (sev->snp_feat_info_0.ecx & SNP_RAPL_DISABLE_SUPPORTED)
+			policy_bits |= SNP_POLICY_MASK_RAPL_DIS;
+
+		if (sev->snp_feat_info_0.ecx & SNP_CIPHER_TEXT_HIDING_SUPPORTED)
+			policy_bits |= SNP_POLICY_MASK_CIPHERTEXT_HIDING_DRAM;
+
+		if (sev->snp_feat_info_0.ecx & SNP_AES_256_XTS_POLICY_SUPPORTED)
+			policy_bits |= SNP_POLICY_MASK_MEM_AES_256_XTS;
+
+		if (sev->snp_feat_info_0.ecx & SNP_CXL_ALLOW_POLICY_SUPPORTED)
+			policy_bits |= SNP_POLICY_MASK_CXL_ALLOW;
+
+		if (sev_version_greater_or_equal(1, 58))
+			policy_bits |= SNP_POLICY_MASK_PAGE_SWAP_DISABLE;
+	}
+
+	return policy_bits;
+}
+EXPORT_SYMBOL_GPL(sev_get_snp_policy_bits);
+
 void sev_dev_destroy(struct psp_device *psp)
 {
 	struct sev_device *sev = psp->sev_data;
include/linux/psp-sev.h +20 -0
index 27c92543bf38..1b4c68ec5c65 100644
@@ -32,6 +32,20 @@
 #define SNP_POLICY_MASK_MIGRATE_MA		BIT_ULL(18)
 #define SNP_POLICY_MASK_DEBUG			BIT_ULL(19)
 #define SNP_POLICY_MASK_SINGLE_SOCKET		BIT_ULL(20)
+#define SNP_POLICY_MASK_CXL_ALLOW		BIT_ULL(21)
+#define SNP_POLICY_MASK_MEM_AES_256_XTS		BIT_ULL(22)
+#define SNP_POLICY_MASK_RAPL_DIS		BIT_ULL(23)
+#define SNP_POLICY_MASK_CIPHERTEXT_HIDING_DRAM	BIT_ULL(24)
+#define SNP_POLICY_MASK_PAGE_SWAP_DISABLE	BIT_ULL(25)
+
+/* Base SEV-SNP policy bitmask for minimum supported SEV firmware version */
+#define SNP_POLICY_MASK_BASE	(SNP_POLICY_MASK_API_MINOR		| \
+				 SNP_POLICY_MASK_API_MAJOR		| \
+				 SNP_POLICY_MASK_SMT			| \
+				 SNP_POLICY_MASK_RSVD_MBO		| \
+				 SNP_POLICY_MASK_MIGRATE_MA		| \
+				 SNP_POLICY_MASK_DEBUG			| \
+				 SNP_POLICY_MASK_SINGLE_SOCKET)
 
 #define SEV_FW_BLOB_MAX_SIZE	0x4000	/* 16KB */
 
@@ -868,7 +882,10 @@ struct snp_feature_info {
 	u32 edx;
 } __packed;
 
+#define SNP_RAPL_DISABLE_SUPPORTED		BIT(2)
 #define SNP_CIPHER_TEXT_HIDING_SUPPORTED	BIT(3)
+#define SNP_AES_256_XTS_POLICY_SUPPORTED	BIT(4)
+#define SNP_CXL_ALLOW_POLICY_SUPPORTED		BIT(5)
 
 #ifdef CONFIG_CRYPTO_DEV_SP_PSP
 
@@ -1014,6 +1031,7 @@ void *snp_alloc_firmware_page(gfp_t mask);
 void snp_free_firmware_page(void *addr);
 void sev_platform_shutdown(void);
 bool sev_is_snp_ciphertext_hiding_supported(void);
+u64 sev_get_snp_policy_bits(void);
 
 #else	/* !CONFIG_CRYPTO_DEV_SP_PSP */
 
@@ -1052,6 +1070,8 @@ static inline void sev_platform_shutdown(void) { }
 
 static inline bool sev_is_snp_ciphertext_hiding_supported(void) { return false; }
 
+static inline u64 sev_get_snp_policy_bits(void) { return 0; }
+
 #endif	/* CONFIG_CRYPTO_DEV_SP_PSP */
 
 #endif	/* __PSP_SEV_H__ */
Signature · 1 line
2.46.2
#6 lore raw

Re: [RFC PATCH 3/4] crypto: ccp - Add an API to return the supported SEV-SNP policy bits

include/linux/psp-sev.h static inline void sev_platform_shutdown(void) { } · line 1073

Quoted 13 lines · Tom Lendacky
include/linux/psp-sev.h +2 -0
@@ -1014,6 +1031,7 @@ void *snp_alloc_firmware_page(gfp_t mask);
 void snp_free_firmware_page(void *addr);
 void sev_platform_shutdown(void);
 bool sev_is_snp_ciphertext_hiding_supported(void);
+u64 sev_get_snp_policy_bits(void);
 
 #else	/* !CONFIG_CRYPTO_DEV_SP_PSP */
 
@@ -1052,6 +1070,8 @@ static inline void sev_platform_shutdown(void) { }
 
 static inline bool sev_is_snp_ciphertext_hiding_supported(void) { return false; }
 
+static inline u64 sev_get_snp_policy_bits(void) { return 0; }

I don't think you need a stub (the ciphertext hiding one should have been omitted too). arch/x86/kvm/svm/sev.c depends on CONFIG_KVM_AMD_SEV=y, which in turn depends on CRYPTO_DEV_SP_PSP=y, so nothing will ever actually need the stub. I bet the same holds true for the majority of these stubs.

author maintainer
#7 lore raw

RFC PATCH 4/4 KVM: SEV: Add known supported SEV-SNP policy bits

In reply to Tom Lendacky

Add to the known supported SEV-SNP policy bits that don't require any implementation support from KVM in order to successfully use them.

At this time, this includes:
- CXL_ALLOW
- MEM_AES_256_XTS
- RAPL_DIS
- CIPHERTEXT_HIDING_DRAM
- PAGE_SWAP_DISABLE

Arguably, RAPL_DIS and CIPHERTEXT_HIDING_DRAM require KVM and the CCP driver to enable these features in order for the setting of the policy bits to be successfully handled. But, a guest owner may not wish their guest to run on a system that doesn't provide support for those features, so allowing the specification of these bits accomplishes that. Whether or not the bit is supported by SEV firmware, a system that doesn't support these features will either fail during the KVM validation of supported policy bits before issuing the LAUNCH_START or fail during the LAUNCH_START.

---
 arch/x86/kvm/svm/sev.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
arch/x86/kvm/svm/sev.c +16 -6
index acdea463dd4f..4f1564a52feb 100644
@@ -63,12 +63,22 @@ static u64 sev_supported_vmsa_features;
 #define AP_RESET_HOLD_NAE_EVENT		1
 #define AP_RESET_HOLD_MSR_PROTO		2
 
-#define KVM_SNP_POLICY_MASK_VALID	(SNP_POLICY_MASK_API_MINOR	| \
-					 SNP_POLICY_MASK_API_MAJOR	| \
-					 SNP_POLICY_MASK_SMT		| \
-					 SNP_POLICY_MASK_RSVD_MBO	| \
-					 SNP_POLICY_MASK_DEBUG		| \
-					 SNP_POLICY_MASK_SINGLE_SOCKET)
+/*
+ * SEV-SNP policy bits that can be supported by KVM. These include policy bits
+ * that have implementation support within KVM or policy bits that do not rely
+ * on any implementation support within KVM.
+ */
+#define KVM_SNP_POLICY_MASK_VALID	(SNP_POLICY_MASK_API_MINOR		| \
+					 SNP_POLICY_MASK_API_MAJOR		| \
+					 SNP_POLICY_MASK_SMT			| \
+					 SNP_POLICY_MASK_RSVD_MBO		| \
+					 SNP_POLICY_MASK_DEBUG			| \
+					 SNP_POLICY_MASK_SINGLE_SOCKET		| \
+					 SNP_POLICY_MASK_CXL_ALLOW		| \
+					 SNP_POLICY_MASK_MEM_AES_256_XTS	| \
+					 SNP_POLICY_MASK_RAPL_DIS		| \
+					 SNP_POLICY_MASK_CIPHERTEXT_HIDING_DRAM	| \
+					 SNP_POLICY_MASK_PAGE_SWAP_DISABLE)
 
 static u64 snp_supported_policy_bits;
 
Signature · 1 line
2.46.2
#8 lore raw
In reply to Tom Lendacky
Quoted 14 lines · Tom Lendacky

This series aims to allow more flexibility in specifying SEV-SNP policy bits by improving discoverability of supported policy bits from userspace and enabling support for newer policy bits.

- The first patch adds a new KVM_X86_GRP_SEV attribute group, KVM_X86_SNP_POLICY_BITS, that can be used to return the supported SEV-SNP policy bits. The initial support for this attribute will return the current KVM supported policy bitmask.

- The next 3 patches provide for adding to the known SEV-SNP policy bits. Since some policy bits are dependent on specific levels of SEV firmware support, the CCP driver is updated to provide an API to return the supported policy bits.

Quoted 7 lines

The supported policy bits bitmask used by KVM is generated by taking the policy bitmask returned by the CCP driver and ANDing it with the KVM supported policy bits. KVM supported policy bits are policy bits that do not require any specific implementation support from KVM to allow.

This series has a prereq against the ciphertext hiding patches that were recently accepted into the cryptodev tree.

I'm still waiting on a stable tag for that branch. Can I get that, and if the CCP changes look good, Acks on those patches? I'd prefer to take this through kvm-x86 since it adds new uAPI, even though that uAPI is fairly trivial.

Uber nits aside, looks good (though I admittedly haven't stared all that hard).

Quoted 23 lines

The series is based off of:
git://git.kernel.org/pub/scm/virt/kvm/kvm.git next

with the added the ciphertext hiding patches

Tom Lendacky (4):
KVM: SEV: Publish supported SEV-SNP policy bits
KVM: SEV: Consolidate the SEV policy bits in a single header file
crypto: ccp - Add an API to return the supported SEV-SNP policy bits
KVM: SEV: Add known supported SEV-SNP policy bits

 arch/x86/include/uapi/asm/kvm.h |  1 +
 arch/x86/kvm/svm/sev.c          | 45 +++++++++++++++++++++------------
 arch/x86/kvm/svm/svm.h          |  3 ---
 drivers/crypto/ccp/sev-dev.c    | 37 +++++++++++++++++++++++++++
 include/linux/psp-sev.h         | 39 ++++++++++++++++++++++++++++
 5 files changed, 106 insertions(+), 19 deletions(-)

base-commit: 82a56258ec2d48f9bb1e9ce8f26b14c161dfe4fb

Signature · 1 line
2.46.2