Re: [PATCH] [v2] x86: coco: replace static const cc_mask with a function

From: Kirill A. Shutemov
Date: Tue Mar 11 2025 - 06:55:55 EST


On Mon, Mar 10, 2025 at 02:10:59PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> When extra warnings are enabled, the cc_mask definition in asm/coco.h
> causes a build failure with gcc:
>
> arch/x86/include/asm/coco.h:28:18: error: 'cc_mask' defined but not used [-Werror=unused-const-variable=]
> 28 | static const u64 cc_mask = 0;
>
> Add a cc_get_mask() function mirroring cc_set_mask() for the one
> user of the variable outside of the coco implementation.
>
> Fixes: a0a8d15a798b ("x86/tdx: Preserve shared bit on mprotect()")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> --
> v2: use an inline helper instead of a __maybe_unused annotaiton.

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>

--
Kiryl Shutsemau / Kirill A. Shutemov