All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
@ 2021-02-19 18:01 Philippe Mathieu-Daudé
  2021-02-19 20:21 ` Connor Kuehl
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-19 18:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: Tom Lendacky, Brijesh Singh, Eduardo Habkost, Connor Kuehl,
	Richard Henderson, Paolo Bonzini, Philippe Mathieu-Daudé

Ensure sev_fw_errlist[] is updated after running
the update-linux-headers.sh script.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
---
 target/i386/sev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/i386/sev.c b/target/i386/sev.c
index 37690ae809c..92c69a23769 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
 static SevGuestState *sev_guest;
 static Error *sev_mig_blocker;
 
-static const char *const sev_fw_errlist[] = {
+static const char *const sev_fw_errlist[SEV_RET_MAX] = {
     [SEV_RET_SUCCESS]                = "",
     [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
     [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
@@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
     [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
     [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
 };
+/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
+QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
 
 #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
 
@@ -160,6 +162,7 @@ fw_error_to_str(int code)
     if (code < 0 || code >= SEV_FW_MAX_ERROR) {
         return "unknown error";
     }
+    assert(sev_fw_errlist[code]);
 
     return sev_fw_errlist[code];
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-02-19 18:01 [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers Philippe Mathieu-Daudé
@ 2021-02-19 20:21 ` Connor Kuehl
  2021-03-08 10:21 ` Philippe Mathieu-Daudé
  2021-06-02 10:48 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 8+ messages in thread
From: Connor Kuehl @ 2021-02-19 20:21 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Tom Lendacky, Richard Henderson, Brijesh Singh, Eduardo Habkost,
	Paolo Bonzini

On 2/19/21 12:01 PM, Philippe Mathieu-Daudé wrote:
> Ensure sev_fw_errlist[] is updated after running
> the update-linux-headers.sh script.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
> ---
>   target/i386/sev.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Connor Kuehl <ckuehl@redhat.com>

Thanks!

Connor



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-02-19 18:01 [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers Philippe Mathieu-Daudé
  2021-02-19 20:21 ` Connor Kuehl
@ 2021-03-08 10:21 ` Philippe Mathieu-Daudé
  2021-03-18 15:38   ` Philippe Mathieu-Daudé
  2021-06-02 10:48 ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-08 10:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Tom Lendacky, Brijesh Singh, Eduardo Habkost, Connor Kuehl,
	Richard Henderson, Paolo Bonzini

ping?

On 2/19/21 7:01 PM, Philippe Mathieu-Daudé wrote:
> Ensure sev_fw_errlist[] is updated after running
> the update-linux-headers.sh script.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
> ---
>  target/i386/sev.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 37690ae809c..92c69a23769 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
>  static SevGuestState *sev_guest;
>  static Error *sev_mig_blocker;
>  
> -static const char *const sev_fw_errlist[] = {
> +static const char *const sev_fw_errlist[SEV_RET_MAX] = {
>      [SEV_RET_SUCCESS]                = "",
>      [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
>      [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
> @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
>      [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
>      [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
>  };
> +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
> +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
>  
>  #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
>  
> @@ -160,6 +162,7 @@ fw_error_to_str(int code)
>      if (code < 0 || code >= SEV_FW_MAX_ERROR) {
>          return "unknown error";
>      }
> +    assert(sev_fw_errlist[code]);
>  
>      return sev_fw_errlist[code];
>  }
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-03-08 10:21 ` Philippe Mathieu-Daudé
@ 2021-03-18 15:38   ` Philippe Mathieu-Daudé
  2021-03-18 15:44     ` Brijesh Singh
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-18 15:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Tom Lendacky, Brijesh Singh, Eduardo Habkost, Connor Kuehl,
	Richard Henderson, Paolo Bonzini

ping^2?

On 3/8/21 11:21 AM, Philippe Mathieu-Daudé wrote:
> ping?
> 
> On 2/19/21 7:01 PM, Philippe Mathieu-Daudé wrote:
>> Ensure sev_fw_errlist[] is updated after running
>> the update-linux-headers.sh script.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
>> ---
>>  target/i386/sev.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>> index 37690ae809c..92c69a23769 100644
>> --- a/target/i386/sev.c
>> +++ b/target/i386/sev.c
>> @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
>>  static SevGuestState *sev_guest;
>>  static Error *sev_mig_blocker;
>>  
>> -static const char *const sev_fw_errlist[] = {
>> +static const char *const sev_fw_errlist[SEV_RET_MAX] = {
>>      [SEV_RET_SUCCESS]                = "",
>>      [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
>>      [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
>> @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
>>      [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
>>      [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
>>  };
>> +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
>> +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
>>  
>>  #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
>>  
>> @@ -160,6 +162,7 @@ fw_error_to_str(int code)
>>      if (code < 0 || code >= SEV_FW_MAX_ERROR) {
>>          return "unknown error";
>>      }
>> +    assert(sev_fw_errlist[code]);
>>  
>>      return sev_fw_errlist[code];
>>  }
>>
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-03-18 15:38   ` Philippe Mathieu-Daudé
@ 2021-03-18 15:44     ` Brijesh Singh
  0 siblings, 0 replies; 8+ messages in thread
From: Brijesh Singh @ 2021-03-18 15:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Tom Lendacky, brijesh.singh, Eduardo Habkost, Connor Kuehl,
	Richard Henderson, Paolo Bonzini


On 3/18/21 10:38 AM, Philippe Mathieu-Daudé wrote:
> ping^2?
>
> On 3/8/21 11:21 AM, Philippe Mathieu-Daudé wrote:
>> ping?
>>
>> On 2/19/21 7:01 PM, Philippe Mathieu-Daudé wrote:
>>> Ensure sev_fw_errlist[] is updated after running
>>> the update-linux-headers.sh script.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>> Based-on: <20210218151633.215374-1-ckuehl@redhat.com>

I am in the favor to keep list in sync with header updates. thanks

Acked-by: Brijesh Singh <brijesh.singh@amd.com>

>>> ---
>>>  target/i386/sev.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>>> index 37690ae809c..92c69a23769 100644
>>> --- a/target/i386/sev.c
>>> +++ b/target/i386/sev.c
>>> @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
>>>  static SevGuestState *sev_guest;
>>>  static Error *sev_mig_blocker;
>>>  
>>> -static const char *const sev_fw_errlist[] = {
>>> +static const char *const sev_fw_errlist[SEV_RET_MAX] = {
>>>      [SEV_RET_SUCCESS]                = "",
>>>      [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
>>>      [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
>>> @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
>>>      [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
>>>      [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
>>>  };
>>> +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
>>> +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
>>>  
>>>  #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
>>>  
>>> @@ -160,6 +162,7 @@ fw_error_to_str(int code)
>>>      if (code < 0 || code >= SEV_FW_MAX_ERROR) {
>>>          return "unknown error";
>>>      }
>>> +    assert(sev_fw_errlist[code]);
>>>  
>>>      return sev_fw_errlist[code];
>>>  }
>>>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-02-19 18:01 [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers Philippe Mathieu-Daudé
  2021-02-19 20:21 ` Connor Kuehl
  2021-03-08 10:21 ` Philippe Mathieu-Daudé
@ 2021-06-02 10:48 ` Philippe Mathieu-Daudé
  2021-06-02 14:22   ` Eduardo Habkost
  2 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-06-02 10:48 UTC (permalink / raw)
  To: qemu-devel, Eduardo Habkost
  Cc: Tom Lendacky, Brijesh Singh, Connor Kuehl, Richard Henderson,
	QEMU Trivial, Paolo Bonzini

This patch was supposed to go via Eduardo's tree but he
missed it, can it go via qemu-trivial instead?

On 2/19/21 7:01 PM, Philippe Mathieu-Daudé wrote:
> Ensure sev_fw_errlist[] is updated after running
> the update-linux-headers.sh script.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
> ---
>  target/i386/sev.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 37690ae809c..92c69a23769 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
>  static SevGuestState *sev_guest;
>  static Error *sev_mig_blocker;
>  
> -static const char *const sev_fw_errlist[] = {
> +static const char *const sev_fw_errlist[SEV_RET_MAX] = {
>      [SEV_RET_SUCCESS]                = "",
>      [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
>      [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
> @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
>      [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
>      [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
>  };
> +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
> +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
>  
>  #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
>  
> @@ -160,6 +162,7 @@ fw_error_to_str(int code)
>      if (code < 0 || code >= SEV_FW_MAX_ERROR) {
>          return "unknown error";
>      }
> +    assert(sev_fw_errlist[code]);
>  
>      return sev_fw_errlist[code];
>  }
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-06-02 10:48 ` Philippe Mathieu-Daudé
@ 2021-06-02 14:22   ` Eduardo Habkost
  2021-06-03  7:30     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 8+ messages in thread
From: Eduardo Habkost @ 2021-06-02 14:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Tom Lendacky, Brijesh Singh, Connor Kuehl, Richard Henderson,
	qemu-devel, QEMU Trivial, Paolo Bonzini

On Wed, Jun 02, 2021 at 12:48:18PM +0200, Philippe Mathieu-Daudé wrote:
> This patch was supposed to go via Eduardo's tree but he
> missed it, can it go via qemu-trivial instead?

My apologies, again.  I'm still behind on my qemu-devel backlog,
and this was still buried in my inbox.

> 
> On 2/19/21 7:01 PM, Philippe Mathieu-Daudé wrote:
> > Ensure sev_fw_errlist[] is updated after running
> > the update-linux-headers.sh script.
> > 
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > ---
> > Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
> > ---
> >  target/i386/sev.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/target/i386/sev.c b/target/i386/sev.c
> > index 37690ae809c..92c69a23769 100644
> > --- a/target/i386/sev.c
> > +++ b/target/i386/sev.c
> > @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
> >  static SevGuestState *sev_guest;
> >  static Error *sev_mig_blocker;
> >  
> > -static const char *const sev_fw_errlist[] = {
> > +static const char *const sev_fw_errlist[SEV_RET_MAX] = {
> >      [SEV_RET_SUCCESS]                = "",
> >      [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
> >      [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
> > @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
> >      [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
> >      [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
> >  };
> > +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
> > +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);

A mechanism to notify us when sev_fw_errlist needs to be updated
would be useful, but I'm not sure I agree with this change.
I expect update-linux-headers patches always consist of 100%
automated changes.  This patch would require a manual update of
target/i386/sev.c to be included in the same commit as
the header update.


> >  
> >  #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
> >  
> > @@ -160,6 +162,7 @@ fw_error_to_str(int code)
> >      if (code < 0 || code >= SEV_FW_MAX_ERROR) {
> >          return "unknown error";
> >      }
> > +    assert(sev_fw_errlist[code]);
> >  
> >      return sev_fw_errlist[code];
> >  }
> > 
> 

-- 
Eduardo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
  2021-06-02 14:22   ` Eduardo Habkost
@ 2021-06-03  7:30     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-06-03  7:30 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Tom Lendacky, Brijesh Singh, Connor Kuehl, Richard Henderson,
	qemu-devel, QEMU Trivial, Paolo Bonzini

On 6/2/21 4:22 PM, Eduardo Habkost wrote:
> On Wed, Jun 02, 2021 at 12:48:18PM +0200, Philippe Mathieu-Daudé wrote:
>> This patch was supposed to go via Eduardo's tree but he
>> missed it, can it go via qemu-trivial instead?
> 
> My apologies, again.  I'm still behind on my qemu-devel backlog,
> and this was still buried in my inbox.
> 
>>
>> On 2/19/21 7:01 PM, Philippe Mathieu-Daudé wrote:
>>> Ensure sev_fw_errlist[] is updated after running
>>> the update-linux-headers.sh script.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>> Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
>>> ---
>>>  target/i386/sev.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>>> index 37690ae809c..92c69a23769 100644
>>> --- a/target/i386/sev.c
>>> +++ b/target/i386/sev.c
>>> @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
>>>  static SevGuestState *sev_guest;
>>>  static Error *sev_mig_blocker;
>>>  
>>> -static const char *const sev_fw_errlist[] = {
>>> +static const char *const sev_fw_errlist[SEV_RET_MAX] = {
>>>      [SEV_RET_SUCCESS]                = "",
>>>      [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
>>>      [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
>>> @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
>>>      [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
>>>      [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
>>>  };
>>> +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
>>> +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
> 
> A mechanism to notify us when sev_fw_errlist needs to be updated
> would be useful, but I'm not sure I agree with this change.
> I expect update-linux-headers patches always consist of 100%
> automated changes.  This patch would require a manual update of
> target/i386/sev.c to be included in the same commit as
> the header update.

OK :(



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-03  7:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 18:01 [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers Philippe Mathieu-Daudé
2021-02-19 20:21 ` Connor Kuehl
2021-03-08 10:21 ` Philippe Mathieu-Daudé
2021-03-18 15:38   ` Philippe Mathieu-Daudé
2021-03-18 15:44     ` Brijesh Singh
2021-06-02 10:48 ` Philippe Mathieu-Daudé
2021-06-02 14:22   ` Eduardo Habkost
2021-06-03  7:30     ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.