Re: [PATCH V3 1/4] crypto: ccp - Fix SEV_INIT error logging on init

From: Tom Lendacky
Date: Thu Nov 11 2021 - 09:10:46 EST


On 11/10/21 11:29 AM, Peter Gonda wrote:
On Tue, Nov 9, 2021 at 12:25 PM Tom Lendacky <thomas.lendacky@xxxxxxx> wrote:
On 11/9/21 10:46 AM, Peter Gonda wrote:
On Tue, Nov 9, 2021 at 9:27 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
On Tue, Nov 02, 2021, Peter Gonda wrote:


...


That's one of those things we've wanted to get around to improving but
just haven't had the time. So, yes, if you wish to refactor the 'error'
related area, that would be great.

OK so when I actually sat down to work on this. I realized this is
bigger than I thought. If we want to have error == -1 for all return
from psp-sev.h functions where the PSP isn't called yet there are a
lot of changes. For example if CONFIG_CRYPTO_DEV_SP_PSP is not defined
all these stubs need to be to set `*errror == -`, basically all these
functions need to be updated.

So to keep this series more targeted. I think I'll drop the error
here. And just have this patch print the rc value. If what I said

In that case, I think you should keep the error value and initialize it to 0. That is consistent with the other paths. Then, if you take on the fixups, it can be changed then.

above seems reasonable I'll do those error refactors. Are people
envisioning something else for the error fixups?

The main refactoring I wanted was to make sure the caller didn't have to initialize the error variable. Whether to initialize it to 0 or -1 wasn't part of my original thoughts. But I do like the -1 value because, theoretically, we shouldn't get such a value back from the PSP. So if the value printed is not -1, that is an indication that the PSP API was called no matter the value of rc.

Thanks,
Tom



Thanks,
Tom