Re: [PATCH v28 06/22] x86/sgx: Add wrappers for ENCLS leaf functions

From: Sean Christopherson
Date: Mon Mar 09 2020 - 17:14:29 EST


On Wed, Mar 04, 2020 at 01:35:53AM +0200, Jarkko Sakkinen wrote:
> +/* Issue a WARN() about an ENCLS leaf. */
> +#define ENCLS_WARN(r, name) { \
> + do { \
> + int _r = (r); \
> + WARN(_r, "%s returned %d (0x%x)\n", (name), _r, _r); \

This should be a WARN_ONCE(), otherwise we'll spam the log if something
goes awry, e.g. if there's a correctable #MC or a rogue write to a MCi_CTL
MSR, either of which will "soft" disable SGX (CPUID 0x7 still reports
SGX/SGXLC support, but all CPUID 0x12 sub-leafs return zeros).

> + } while (0); \
> +}