qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] target-i386: sev: fail query-sev-capabilities if QEMU cannot use SEV
Date: Wed, 1 Jul 2020 09:12:03 -0500	[thread overview]
Message-ID: <d68fb8a7-8423-02c6-c1a5-8438161c654e@redhat.com> (raw)
In-Reply-To: <20200630154521.552874-3-pbonzini@redhat.com>

On 6/30/20 10:45 AM, Paolo Bonzini wrote:
> In some cases, such as if the kvm-amd "sev" module parameter is set
> to 0, SEV will be unavailable but query-sev-capabilities will still
> return all the information.  This tricks libvirt into erroneously
> reporting that SEV is available.  Check the actual usability of the
> feature and return the appropriate error if QEMU cannot use KVM
> or KVM cannot use SEV.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   target/i386/sev.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 70f9ee026f..22194b3e32 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -450,6 +450,15 @@ sev_get_capabilities(Error **errp)
>       uint32_t ebx;
>       int fd;
>   
> +    if (!kvm_enabled()) {
> +        error_setg(errp, "KVM not enabled\n");
> +        return NULL;
> +    }
> +    if (kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, NULL) < 0) {
> +        error_setg(errp, "SEV is not enabled\n");

Patchew was correct: drop the two \n.  With that fix,

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-07-01 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 15:45 [PATCH 0/2] error-reporting for query-sev-capabilities Paolo Bonzini
2020-06-30 15:45 ` [PATCH 1/2] target-i386: sev: provide proper error reporting " Paolo Bonzini
2020-07-01 14:11   ` Eric Blake
2020-06-30 15:45 ` [PATCH 2/2] target-i386: sev: fail query-sev-capabilities if QEMU cannot use SEV Paolo Bonzini
2020-07-01 14:12   ` Eric Blake [this message]
2020-07-03 16:08   ` Dr. David Alan Gilbert
2020-07-03 16:10     ` Paolo Bonzini
2020-06-30 16:09 ` [PATCH 0/2] error-reporting for query-sev-capabilities no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d68fb8a7-8423-02c6-c1a5-8438161c654e@redhat.com \
    --to=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).