[PATCH] x86/coco: Replace cc_attr_flags with a bool

Thorsten Blum posted 1 patch 3 weeks, 3 days ago
arch/x86/coco/core.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
[PATCH] x86/coco: Replace cc_attr_flags with a bool
Posted by Thorsten Blum 3 weeks, 3 days ago
The cc_attr_flags structure contains only the host_sev_snp bit. Replace
the structure with a bool.

No functional change.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/x86/coco/core.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c
index 418ec77bbe3a..8c1842a29f44 100644
--- a/arch/x86/coco/core.c
+++ b/arch/x86/coco/core.c
@@ -22,10 +22,7 @@ SYM_PIC_ALIAS(cc_vendor);
 u64 cc_mask __ro_after_init;
 SYM_PIC_ALIAS(cc_mask);
 
-static struct cc_attr_flags {
-	__u64 host_sev_snp	: 1,
-	      __resv		: 63;
-} cc_flags;
+static bool cc_host_sev_snp;
 
 static bool noinstr intel_cc_platform_has(enum cc_attr attr)
 {
@@ -103,7 +100,7 @@ static bool noinstr amd_cc_platform_has(enum cc_attr attr)
 		return sev_status & MSR_AMD64_SNP_SECURE_TSC;
 
 	case CC_ATTR_HOST_SEV_SNP:
-		return cc_flags.host_sev_snp;
+		return cc_host_sev_snp;
 
 	case CC_ATTR_SNP_SECURE_AVIC:
 		return sev_status & MSR_AMD64_SNP_SECURE_AVIC;
@@ -169,7 +166,7 @@ static void amd_cc_platform_clear(enum cc_attr attr)
 {
 	switch (attr) {
 	case CC_ATTR_HOST_SEV_SNP:
-		cc_flags.host_sev_snp = 0;
+		cc_host_sev_snp = false;
 		break;
 	default:
 		break;
@@ -191,7 +188,7 @@ static void amd_cc_platform_set(enum cc_attr attr)
 {
 	switch (attr) {
 	case CC_ATTR_HOST_SEV_SNP:
-		cc_flags.host_sev_snp = 1;
+		cc_host_sev_snp = true;
 		break;
 	default:
 		break;
Re: [PATCH] x86/coco: Replace cc_attr_flags with a bool
Posted by Borislav Petkov 3 weeks, 3 days ago
On Wed, Sep 02, 2026 at 02:06:33AM +0200, Thorsten Blum wrote:
> The cc_attr_flags structure contains only the host_sev_snp bit. Replace
> the structure with a bool.

Nope, do some git archeology before you send patches.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH] x86/coco: Replace cc_attr_flags with a bool
Posted by Thorsten Blum 3 weeks, 3 days ago
On Tue, Sep 01, 2026 at 05:57:03PM -0700, Borislav Petkov wrote:
> On Wed, Sep 02, 2026 at 02:06:33AM +0200, Thorsten Blum wrote:
> > The cc_attr_flags structure contains only the host_sev_snp bit. Replace
> > the structure with a bool.
> 
> Nope, do some git archeology before you send patches.

I did check before sending. My motivation for the cleanup was that in
the ~2.5 years since bc6f707fc0fe ("x86/cc: Add cc_platform_set/_clear()
helpers"), host_sev_snp has remained the only member of cc_flags.
Re: [PATCH] x86/coco: Replace cc_attr_flags with a bool
Posted by Borislav Petkov 3 weeks, 2 days ago
On Wed, Sep 02, 2026 at 11:53:59AM +0200, Thorsten Blum wrote:
> I did check before sending. My motivation for the cleanup was that in
> the ~2.5 years since bc6f707fc0fe ("x86/cc: Add cc_platform_set/_clear()
> helpers"), host_sev_snp has remained the only member of cc_flags.

And?

That is bothering you so much so that you would send a patch for it?

If you really wanna help, you'd be immensely more helpful if you tested
kernels and did some code review to help out maintainers. Because we're
drowning in patches but not drowning in reviewers...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette