From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Xiaoyao Li" <xiaoyao.li@intel.com>,
qemu-stable@nongnu.org,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Brijesh Singh" <brijesh.singh@amd.com>,
"Pankaj Gupta" <pankaj.gupta@amd.com>
Subject: Re: [PATCH] physmem: replace assertion with error
Date: Mon, 17 Feb 2025 14:15:37 +0100 [thread overview]
Message-ID: <7c22d254-f1a1-4162-bf07-e70677bce540@redhat.com> (raw)
In-Reply-To: <051e10cb-7cb1-430d-956d-b508b7f7db5a@linaro.org>
On Mon, Feb 17, 2025 at 1:28 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> > qemu-system-x86_64 -m 512 -nographic -object sev-snp-guest,reduced-phys-bits=48,id=sev0 \
> > -M q35,kernel-irqchip=split,confidential-guest-support=sev0
> > qemu-system-x86_64: ../system/physmem.c:1871: ram_block_add: Assertion `kvm_enabled()' failed.
>
> I'd expect sev-snp-guest to bail out early enough.
>
> Is a KVM-enabled check in sev_snp_guest_instance_init() missing?
instance_init cannot do any check (it cannot fail). There is a check for
whether sev_common_kvm_init succeeded:
if (machine->cgs && !machine->cgs->ready) {
error_setg(errp, "accelerator does not support confidential guest %s",
object_get_typename(OBJECT(machine->cgs)));
exit(1);
}
but that doesn't help if the system/physmem.c code is reached before
qemu_machine_creation_done(), for example in qemu_init_board().
Likewise, you cannot fal in host_memory_backend_init() because that's
also an instance_init callback.
> > - assert(kvm_enabled());
> > + if (!kvm_enabled()) {
> > + error_setg(errp, "cannot set up private guest memory for %s: KVM required",
> > + object_get_typename(OBJECT(current_machine->cgs)));
>
> Common code should be SW vs HW accel, so IMHO your check
> should go within sev_snp_guest_instance_init(), removing
> the assertion here. That said I have no clue about SEV.
This code is outside accel/kvm or target/*/kvn, but it is not quite
common code. A few lines below you have:
new_block->guest_memfd =
kvm_create_guest_memfd(new_block->max_length, 0, errp);
Paolo
next prev parent reply other threads:[~2025-02-17 13:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 12:08 [PATCH] physmem: replace assertion with error Paolo Bonzini
2025-02-17 12:19 ` Daniel P. Berrangé
2025-02-17 12:28 ` Philippe Mathieu-Daudé
2025-02-17 13:15 ` Paolo Bonzini [this message]
2025-02-18 1:30 ` Xiaoyao Li
2025-02-18 15:45 ` David Hildenbrand
2025-02-19 6:39 ` Gupta, Pankaj
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=7c22d254-f1a1-4162-bf07-e70677bce540@redhat.com \
--to=pbonzini@redhat.com \
--cc=berrange@redhat.com \
--cc=brijesh.singh@amd.com \
--cc=mtosatti@redhat.com \
--cc=pankaj.gupta@amd.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=xiaoyao.li@intel.com \
/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).