From: Luigi Leonardi <leonardi@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Ani Sinha <anisinha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] igvm: populate errp in stub functions
Date: Tue, 9 Jun 2026 16:02:17 +0200 [thread overview]
Message-ID: <aigUdNYq0YRtAZKt@leonardi-redhat> (raw)
In-Reply-To: <aigULaw73khPNxoR@redhat.com>
Hi Daniel,
On Tue, Jun 09, 2026 at 02:25:01PM +0100, Daniel P. Berrangé wrote:
>On Tue, Jun 09, 2026 at 03:20:14PM +0200, Luigi Leonardi wrote:
>> Use error_setg() to report that IGVM is not available, matching
>> the pattern used by other stubs in the tree.
>>
>> Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
>> Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
>> ---
>> stubs/igvm.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/stubs/igvm.c b/stubs/igvm.c
>> index 9e9f683fc9..dfb85eb548 100644
>> --- a/stubs/igvm.c
>> +++ b/stubs/igvm.c
>> @@ -17,15 +17,18 @@ int qigvm_x86_get_mem_map_entry(int index,
>> ConfidentialGuestMemoryMapEntry *entry,
>> Error **errp)
>> {
>> + error_setg(errp, "IGVM not supported on this platform");
>> return -1;
>> }
>>
>> int qigvm_x86_set_vp_context(void *data, int index, Error **errp)
>> {
>> + error_setg(errp, "IGVM not supported on this platform");
>> return -1;
>> }
>>
>> int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **errp)
>> {
>> + error_setg(errp, "IGVM not supported on this platform");
>> return -1;
>> }
>
>This is not wrong per-se, so on that basis
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
>but are any of these stubs actually reachable when IGVM is not
>enabled in the build ? Usually with stubs we find that one
>or two methods are the primary entrypoints which must return
>an error, at which point everything else becomes unreachable.
>The latter cases can just be g_assert_not_reached() as a sanity
>check that some unexpected codepath isn't calling in without
>checking status earlier. Those would thus would not need
>error_setg, nor a 'return' statement.
No, when IGVM is not enabled in the build it's not possible to trigger
any of these stubs. On top of that, I don't think it is possible to trigger
these stubs even when igvm is enabled. This is because the only architecture
that implements igvm support in qemu is x86.
To give more context: the igvm code is split between `backends/igvm.c` and
`target/i386/igvm.c`. The former contains arch-independent functions,
while the latter, x86 related functions.
Therefore, stubs will only become relevant when new architectures will be
supported.
I'm not sure about using asserts here, because with this patch [1] we'll
handle optional igvm directives. So, when we support aarch64 in igvm,
we could have some directives (eg: `IGVM_VHT_MADT`) that are
implemented for one architecture but not for a different one, resulting
in the stub being hit. So, if that directive is marked as optional in the
igvm file, we should not crash qemu.
[1] https://lore.kernel.org/all/20260609-igvm_optional-v2-2-b1f1f08dc40e@redhat.com/
HTH,
Luigi
prev parent reply other threads:[~2026-06-09 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 13:20 [PATCH] igvm: populate errp in stub functions Luigi Leonardi
2026-06-09 13:25 ` Daniel P. Berrangé
2026-06-09 13:43 ` Markus Armbruster
2026-06-09 14:02 ` Luigi Leonardi [this message]
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=aigUdNYq0YRtAZKt@leonardi-redhat \
--to=leonardi@redhat.com \
--cc=anisinha@redhat.com \
--cc=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.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 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.