mbox series

[0/2] SEV firmware error list touchups

Message ID 20210218151633.215374-1-ckuehl@redhat.com (mailing list archive)
Headers show
Series SEV firmware error list touchups | expand

Message

Connor Kuehl Feb. 18, 2021, 3:16 p.m. UTC
Connor Kuehl (2):
  sev: use explicit indices for mapping firmware error codes to strings
  sev: add missing firmware error conditions

 target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 23 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 18, 2021, 3:48 p.m. UTC | #1
On 2/18/21 4:16 PM, Connor Kuehl wrote:
> Connor Kuehl (2):
>   sev: use explicit indices for mapping firmware error codes to strings
>   sev: add missing firmware error conditions
> 
>  target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>  1 file changed, 25 insertions(+), 23 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


To avoid this problem in future (new error code added on the Linux
kernel side) would it be acceptable to add a 3rd patch as:

-- >8 --
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 0f414df02f3..e086d3198e8 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -155,9 +155,12 @@ sev_platform_ioctl(int fd, int cmd, void *data, int
*error)
 static const char *
 fw_error_to_str(int code)
 {
+    QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 == SEV_RET_MAX);
+
     if (code < 0 || code >= SEV_FW_MAX_ERROR) {
         return "unknown error";
     }
+    assert(sev_fw_errlist[code]);

     return sev_fw_errlist[code];
 }
---

which triggers a build error if scripts/update-linux-headers.sh
added another sev_ret_code entry?
Connor Kuehl Feb. 19, 2021, 2:46 p.m. UTC | #2
On 2/18/21 9:48 AM, Philippe Mathieu-Daudé wrote:
> On 2/18/21 4:16 PM, Connor Kuehl wrote:
>> Connor Kuehl (2):
>>    sev: use explicit indices for mapping firmware error codes to strings
>>    sev: add missing firmware error conditions
>>
>>   target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>>   1 file changed, 25 insertions(+), 23 deletions(-)
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Thank you! :-)

> To avoid this problem in future (new error code added on the Linux
> kernel side) would it be acceptable to add a 3rd patch as:
> 
> -- >8 --
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 0f414df02f3..e086d3198e8 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -155,9 +155,12 @@ sev_platform_ioctl(int fd, int cmd, void *data, int
> *error)
>   static const char *
>   fw_error_to_str(int code)
>   {
> +    QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 == SEV_RET_MAX);
> +
>       if (code < 0 || code >= SEV_FW_MAX_ERROR) {
>           return "unknown error";
>       }
> +    assert(sev_fw_errlist[code]);
> 
>       return sev_fw_errlist[code];
>   }
> ---
> 
> which triggers a build error if scripts/update-linux-headers.sh
> added another sev_ret_code entry?
> 

I like this a lot. Should I send a v2 of the series with a third patch 
like this or shall I wait to see if these patches get applied then send 
something like this as a follow up patch?

Thank you,

Connor
Philippe Mathieu-Daudé Feb. 19, 2021, 5:57 p.m. UTC | #3
On 2/19/21 3:46 PM, Connor Kuehl wrote:
> On 2/18/21 9:48 AM, Philippe Mathieu-Daudé wrote:
>> On 2/18/21 4:16 PM, Connor Kuehl wrote:
>>> Connor Kuehl (2):
>>>    sev: use explicit indices for mapping firmware error codes to strings
>>>    sev: add missing firmware error conditions
>>>
>>>   target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>>>   1 file changed, 25 insertions(+), 23 deletions(-)
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Thank you! :-)
> 
>> To avoid this problem in future (new error code added on the Linux
>> kernel side) would it be acceptable to add a 3rd patch as:
>>
>> -- >8 --
>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>> index 0f414df02f3..e086d3198e8 100644
>> --- a/target/i386/sev.c
>> +++ b/target/i386/sev.c
>> @@ -155,9 +155,12 @@ sev_platform_ioctl(int fd, int cmd, void *data, int
>> *error)
>>   static const char *
>>   fw_error_to_str(int code)
>>   {
>> +    QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 == SEV_RET_MAX);
>> +
>>       if (code < 0 || code >= SEV_FW_MAX_ERROR) {
>>           return "unknown error";
>>       }
>> +    assert(sev_fw_errlist[code]);
>>
>>       return sev_fw_errlist[code];
>>   }
>> ---
>>
>> which triggers a build error if scripts/update-linux-headers.sh
>> added another sev_ret_code entry?
>>
> 
> I like this a lot. Should I send a v2 of the series with a third patch
> like this or shall I wait to see if these patches get applied then send
> something like this as a follow up patch?

Since I've the patch locally I'll simply send it.
Connor Kuehl March 8, 2021, 4:41 p.m. UTC | #4
On 2/18/21 9:16 AM, Connor Kuehl wrote:
> Connor Kuehl (2):
>    sev: use explicit indices for mapping firmware error codes to strings
>    sev: add missing firmware error conditions
> 
>   target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>   1 file changed, 25 insertions(+), 23 deletions(-)
> 

Ping. Also, I am not sure whose tree these are best suited for.

Connor
Connor Kuehl March 15, 2021, 2:08 p.m. UTC | #5
On 2/18/21 9:16 AM, Connor Kuehl wrote:
> Connor Kuehl (2):
>    sev: use explicit indices for mapping firmware error codes to strings
>    sev: add missing firmware error conditions
> 
>   target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>   1 file changed, 25 insertions(+), 23 deletions(-)
> 

Eduardo, Paolo, Richard: ping
Philippe Mathieu-Daudé March 22, 2021, 10:18 a.m. UTC | #6
Hi Connor,

On 3/15/21 3:08 PM, Connor Kuehl wrote:
> On 2/18/21 9:16 AM, Connor Kuehl wrote:
>> Connor Kuehl (2):
>>    sev: use explicit indices for mapping firmware error codes to strings
>>    sev: add missing firmware error conditions
>>
>>   target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>>   1 file changed, 25 insertions(+), 23 deletions(-)
>>
> 
> Eduardo, Paolo, Richard: ping

Looks too late for 6.0 now.

Can you repost/ping after QEMU 6.0 is release?

Thanks,

Phil.
Connor Kuehl March 22, 2021, 2:09 p.m. UTC | #7
On 3/22/21 5:18 AM, Philippe Mathieu-Daudé wrote:
> Hi Connor,
> 
> On 3/15/21 3:08 PM, Connor Kuehl wrote:
>> On 2/18/21 9:16 AM, Connor Kuehl wrote:
>>> Connor Kuehl (2):
>>>     sev: use explicit indices for mapping firmware error codes to strings
>>>     sev: add missing firmware error conditions
>>>
>>>    target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
>>>    1 file changed, 25 insertions(+), 23 deletions(-)
>>>
>>
>> Eduardo, Paolo, Richard: ping
> 
> Looks too late for 6.0 now.
> 
> Can you repost/ping after QEMU 6.0 is release?

Sure.

Connor
Eduardo Habkost March 22, 2021, 4:43 p.m. UTC | #8
On Mon, Mar 22, 2021 at 09:09:44AM -0500, Connor Kuehl wrote:
> On 3/22/21 5:18 AM, Philippe Mathieu-Daudé wrote:
> > Hi Connor,
> > 
> > On 3/15/21 3:08 PM, Connor Kuehl wrote:
> > > On 2/18/21 9:16 AM, Connor Kuehl wrote:
> > > > Connor Kuehl (2):
> > > >     sev: use explicit indices for mapping firmware error codes to strings
> > > >     sev: add missing firmware error conditions
> > > > 
> > > >    target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
> > > >    1 file changed, 25 insertions(+), 23 deletions(-)
> > > > 
> > > 
> > > Eduardo, Paolo, Richard: ping
> > 
> > Looks too late for 6.0 now.
> > 
> > Can you repost/ping after QEMU 6.0 is release?
> 
> Sure.

My apologies for not replying before and not reviewing or merging
this in time for 6.0.  I'm seriously behind on all my upstream
maintainer work.
Philippe Mathieu-Daudé May 11, 2021, 7:36 a.m. UTC | #9
On Mon, Mar 22, 2021 at 5:43 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
> On Mon, Mar 22, 2021 at 09:09:44AM -0500, Connor Kuehl wrote:
> > On 3/22/21 5:18 AM, Philippe Mathieu-Daudé wrote:
> > > On 3/15/21 3:08 PM, Connor Kuehl wrote:
> > > > On 2/18/21 9:16 AM, Connor Kuehl wrote:
> > > > > Connor Kuehl (2):
> > > > >     sev: use explicit indices for mapping firmware error codes to strings
> > > > >     sev: add missing firmware error conditions
> > > > >
> > > > >    target/i386/sev.c | 48 ++++++++++++++++++++++++-----------------------
> > > > >    1 file changed, 25 insertions(+), 23 deletions(-)
> > > > >
> > > >
> > > > Eduardo, Paolo, Richard: ping
> > >
> > > Looks too late for 6.0 now.
> > >
> > > Can you repost/ping after QEMU 6.0 is release?
> >
> > Sure.
>
> My apologies for not replying before and not reviewing or merging
> this in time for 6.0.

FYI there is a RESEND:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg803017.html