>
> +/* Counter to count the active SGX users */
> +static int sgx_usage_count;
>
[...]
> + * Return:
> + * %0: - Success or not supported
> + * %-EAGAIN: - Can be safely retried, failure is due to lack of
> + * entropy in RNG
> + * %-EIO: - Unexpected error, retries are not advisable
> + */
This time I actually downloaded those patches and applied to my local, and
I found the descriptions of the error codes are not vertically aligned.
Please fix (and it's sad we still need to fix this type of thing in v13).
Nit: as said before, the k-doc comment doc says:
.. in order to produce the desired line breaks, you need to use a ReST
list, e. g.:
* Return:
* * %0 - OK to runtime suspend the device
* * %-EBUSY - Device should not be runtime suspended
(hint: there's an additional '*' before the '%'.)
But I guess it's just a nit but not a blocker.
> +static int __maybe_unused sgx_update_svn(void)
> +{
> + int ret;
> +
> + /*
> + * If EUPDATESVN is not available, it is ok to
> + * silently skip it to comply with legacy behavior.
> + */
> + if (!cpu_feature_enabled(X86_FEATURE_SGX_EUPDATESVN))
> + return 0;
> +
> + /*
> + * EPC is guaranteed to be empty when there are no users.
> + * Ensure we are on our first user before proceeding further.
> + */
> + WARN(sgx_usage_count != 1, "Elevated usage count when calling
> EUPDATESVN\n");
It seems you are obsessed to use "!= 1", rather than "!= 0".
IIUC, Dave suggested the latter [*]:
/* EPC is guaranteed to be empty when there are no users: */
WARN(count, "Elevated usage count...");
.. which is my natural response too.
And the odd is I actually need to look at the next patch to see why "!= 1"
is used.
[*]
https://lore.kernel.org/linux-sgx/[email protected]/T/#m2225b27448de868a7bc1b86ed7f2ee784367ba84