2022-03-25 18:08:24

by Peter Gonda

[permalink] [raw]
Subject: Re: [PATCH v2] Add KVM_EXIT_SHUTDOWN metadata for SEV-ES

On Fri, Mar 25, 2022 at 9:29 AM Paolo Bonzini <[email protected]> wrote:
>
> On 3/25/22 16:27, Peter Gonda wrote:
> > SEV-ES guests can request termination using the GHCB's MSR protocol. See
> > AMD's GHCB spec section '4.1.13 Termination Request'. Currently when a
> > guest does this the userspace VMM sees an KVM_EXIT_UNKNOWN (-EVINAL)
> > return code from KVM_RUN. By adding a KVM_EXIT_SHUTDOWN_ENTRY to kvm_run
> > struct the userspace VMM can clear see the guest has requested a SEV-ES
> > termination including the termination reason code set and reason code.
> >
> > Signed-off-by: Peter Gonda <[email protected]>
> > Cc: Paolo Bonzini <[email protected]>
> > Cc: Borislav Petkov <[email protected]>
> > Cc: Tom Lendacky <[email protected]>
> > Cc: Brijesh Singh <[email protected]>
> > Cc: Joerg Roedel <[email protected]>
> > Cc: Marc Orr <[email protected]>
> > Cc: Sean Christopherson <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
>
> This is missing an update to Documentation/.
>

My mistake. I'll send another revision. Is the behavior of
KVM_CAP_EXIT_SHUTDOWN_REASON OK? Or should we only return 1 for SEV-ES
guests?


2022-03-25 19:22:02

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v2] Add KVM_EXIT_SHUTDOWN metadata for SEV-ES

On 3/25/22 16:31, Peter Gonda wrote:
> On Fri, Mar 25, 2022 at 9:29 AM Paolo Bonzini <[email protected]> wrote:
>>
>> On 3/25/22 16:27, Peter Gonda wrote:
>>> SEV-ES guests can request termination using the GHCB's MSR protocol. See
>>> AMD's GHCB spec section '4.1.13 Termination Request'. Currently when a
>>> guest does this the userspace VMM sees an KVM_EXIT_UNKNOWN (-EVINAL)
>>> return code from KVM_RUN. By adding a KVM_EXIT_SHUTDOWN_ENTRY to kvm_run
>>> struct the userspace VMM can clear see the guest has requested a SEV-ES
>>> termination including the termination reason code set and reason code.
>>>
>>> Signed-off-by: Peter Gonda <[email protected]>
>>> Cc: Paolo Bonzini <[email protected]>
>>> Cc: Borislav Petkov <[email protected]>
>>> Cc: Tom Lendacky <[email protected]>
>>> Cc: Brijesh Singh <[email protected]>
>>> Cc: Joerg Roedel <[email protected]>
>>> Cc: Marc Orr <[email protected]>
>>> Cc: Sean Christopherson <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>
>> This is missing an update to Documentation/.
>>
>
> My mistake. I'll send another revision. Is the behavior of
> KVM_CAP_EXIT_SHUTDOWN_REASON OK? Or should we only return 1 for SEV-ES
> guests?

No, you can return 1 unconditionally, but you should also set reason and
clear ndata in the other cases that return KVM_EXIT_SHUTDOWN.

Paolo

2022-03-31 05:01:07

by Peter Gonda

[permalink] [raw]
Subject: Re: [PATCH v2] Add KVM_EXIT_SHUTDOWN metadata for SEV-ES

On Fri, Mar 25, 2022 at 10:53 AM Paolo Bonzini <[email protected]> wrote:
>
> On 3/25/22 16:31, Peter Gonda wrote:
> > On Fri, Mar 25, 2022 at 9:29 AM Paolo Bonzini <[email protected]> wrote:
> >>
> >> On 3/25/22 16:27, Peter Gonda wrote:
> >>> SEV-ES guests can request termination using the GHCB's MSR protocol. See
> >>> AMD's GHCB spec section '4.1.13 Termination Request'. Currently when a
> >>> guest does this the userspace VMM sees an KVM_EXIT_UNKNOWN (-EVINAL)
> >>> return code from KVM_RUN. By adding a KVM_EXIT_SHUTDOWN_ENTRY to kvm_run
> >>> struct the userspace VMM can clear see the guest has requested a SEV-ES
> >>> termination including the termination reason code set and reason code.
> >>>
> >>> Signed-off-by: Peter Gonda <[email protected]>
> >>> Cc: Paolo Bonzini <[email protected]>
> >>> Cc: Borislav Petkov <[email protected]>
> >>> Cc: Tom Lendacky <[email protected]>
> >>> Cc: Brijesh Singh <[email protected]>
> >>> Cc: Joerg Roedel <[email protected]>
> >>> Cc: Marc Orr <[email protected]>
> >>> Cc: Sean Christopherson <[email protected]>
> >>> Cc: [email protected]
> >>> Cc: [email protected]
> >>
> >> This is missing an update to Documentation/.
> >>
> >
> > My mistake. I'll send another revision. Is the behavior of
> > KVM_CAP_EXIT_SHUTDOWN_REASON OK? Or should we only return 1 for SEV-ES
> > guests?
>
> No, you can return 1 unconditionally, but you should also set reason and
> clear ndata in the other cases that return KVM_EXIT_SHUTDOWN.


Sounds good! Done in V3, thanks