On Thu, Nov 12, 2026 at 01:15:25PM +0100, Markus Armbruster wrote:
> Markus Armbruster <[email protected]> writes:
> 
> > Daniel P. Berrangé <[email protected]> writes:
> 
> [...]
> 
> >> Normal practice is for types to be unconditionally registered.  Do we
> >> have any examples outside of this SGX case where we conditionally
> >> register types ?   Should we change this to follow normal practice ?
> >
> > Loosely related: conditional *class* properties.  Example:
> >
> >     static void
> >     memfd_backend_class_init(ObjectClass *oc, const void *data)
> >     {
> >         HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc);
> >
> >         bc->alloc = memfd_backend_memory_alloc;
> >
> >         if (qemu_memfd_check(MFD_HUGETLB)) {
> >             object_class_property_add_bool(oc, "hugetlb",
> >                                            memfd_backend_get_hugetlb,
> >                                            memfd_backend_set_hugetlb);
> >             object_class_property_set_description(oc, "hugetlb",
> >                                                   "Use huge pages");
> >             object_class_property_add(oc, "hugetlbsize", "uint64",
> >                                       &uint64_type_info,
> >                                       memfd_backend_get_hugetlbsize,
> >                                       memfd_backend_set_hugetlbsize,
> >                                       NULL, NULL);
> >             object_class_property_set_description(oc, "hugetlbsize",
> >                                                   "Huge pages size (ex: 2M, 
> > 1G)");
> >         }
> >
> >         [...]
> >     }
> >
> > These properties are also declared in qapi/qom.json if CONFIG_LINUX.
> > QAPI introspection (query-qmp-schema) shows them then.  QOM
> > introspection (qom-list-properties etc.) only shows them when the
> > MFD_HUGETLB check succeeded.
> >
> > Feels undesirable to me.
> 
> [...]
> 
> Conditional turned out to be unnecessary here:
> 
>     Subject: [PATCH 7/7] backends/hostmem-memfd: Add huge TLB properties 
> unconditionally
>     Date: Wed, 11 Nov 2026 13:23:42 +0100
>     Message-ID: <[email protected]>
> 
> I found a few more:
> 
> * Property "loadparm" of scsi-cd, scsi-hd, virtio-blk-pci,
>   virtio-net-pci only if target_s390x()
> 
> * Several properties of xenpvh-machine on ARM and i386 only if
>   ->has_virtio_mmio, ->has_pci, ->has_tpm
> 
> I don't plan to examine these.

The 'loadparm' issue is one that we need to fix for the multi-target
work. We need a unified QOM tree that is invariant across targets,
so that property should become unconditional. Checks for invalid
usage must be done at realize() time instead.

Yonggang had some patches for this which I've included  in a proposed
series I just CC'd you on:

  https://lists.gnu.org/archive/html/qemu-devel/2026-11/msg02739.html
  https://lists.gnu.org/archive/html/qemu-devel/2026-11/msg02740.html

and 'virtio-mem' was another example

  https://lists.gnu.org/archive/html/qemu-devel/2026-11/msg02750.html

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Reply via email to