From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [PATCH 10/14] system/iommufd: Introduce iommufd_builtin() helper
Date: Sat, 8 Mar 2025 08:48:17 +0100 [thread overview]
Message-ID: <85901dab-29a5-4d50-b122-29333f7ebcd9@linaro.org> (raw)
In-Reply-To: <1e7b5507-e226-44bd-afec-0261ee3549ce@linaro.org>
On 7/3/25 21:33, Richard Henderson wrote:
> On 3/7/25 10:03, Philippe Mathieu-Daudé wrote:
>> iommufd_builtin() can be used to check at runtime whether
>> the IOMMUFD feature is built in a qemu-system binary.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> docs/devel/vfio-iommufd.rst | 2 +-
>> include/system/iommufd.h | 8 ++++++++
>> 2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/docs/devel/vfio-iommufd.rst b/docs/devel/vfio-iommufd.rst
>> index 3d1c11f175e..08882094eee 100644
>> --- a/docs/devel/vfio-iommufd.rst
>> +++ b/docs/devel/vfio-iommufd.rst
>> @@ -88,7 +88,7 @@ Step 2: configure QEMU
>> ----------------------
>> Interactions with the ``/dev/iommu`` are abstracted by a new iommufd
>> -object (compiled in with the ``CONFIG_IOMMUFD`` option).
>> +object (which availability can be checked at runtime using
>> ``iommufd_builtin()``).
>> Any QEMU device (e.g. VFIO device) wishing to use ``/dev/iommu`` must
>> be linked with an iommufd object. It gets a new optional property
>> diff --git a/include/system/iommufd.h b/include/system/iommufd.h
>> index cbab75bfbf6..ce459254025 100644
>> --- a/include/system/iommufd.h
>> +++ b/include/system/iommufd.h
>> @@ -63,4 +63,12 @@ bool
>> iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
>> Error **errp);
>> #define TYPE_HOST_IOMMU_DEVICE_IOMMUFD TYPE_HOST_IOMMU_DEVICE "-
>> iommufd"
>> +
>> +static inline bool iommufd_builtin(void)
>> +{
>> + bool ambig = false;
>> +
>> + return object_resolve_path_type("", TYPE_IOMMUFD_BACKEND, &ambig)
>> || ambig;
>> +}
>> +
>> #endif
>
> Interesting solution.
Actually this isn't appropriate as this checks for an *instance*, while
we only want the *class*.
I'll respin a different approach.
next prev parent reply other threads:[~2025-03-08 7:49 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 18:03 [PATCH 00/14] hw/vfio: Build various objects once Philippe Mathieu-Daudé
2025-03-07 18:03 ` [PATCH 01/14] hw/vfio/common: Include missing 'system/tcg.h' header Philippe Mathieu-Daudé
2025-03-07 19:14 ` Pierrick Bouvier
2025-03-07 19:35 ` Richard Henderson
2025-03-08 17:39 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 02/14] hw/vfio/spapr: Do not include <linux/kvm.h> Philippe Mathieu-Daudé
2025-03-07 19:14 ` Pierrick Bouvier
2025-03-07 19:39 ` Richard Henderson
2025-03-08 17:39 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 03/14] hw/vfio: Compile some common objects once Philippe Mathieu-Daudé
2025-03-07 19:15 ` Pierrick Bouvier
2025-03-07 19:40 ` Richard Henderson
2025-03-08 17:39 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 04/14] hw/vfio: Compile more " Philippe Mathieu-Daudé
2025-03-07 19:15 ` Pierrick Bouvier
2025-03-07 19:40 ` Richard Henderson
2025-03-08 17:45 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 05/14] hw/vfio: Compile iommufd.c once Philippe Mathieu-Daudé
2025-03-07 19:16 ` Pierrick Bouvier
2025-03-07 19:41 ` Richard Henderson
2025-03-08 17:45 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 06/14] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
2025-03-07 19:16 ` Pierrick Bouvier
2025-03-07 21:12 ` Philippe Mathieu-Daudé
2025-03-07 18:03 ` [PATCH 07/14] hw/vfio: Compile display.c once Philippe Mathieu-Daudé
2025-03-07 19:17 ` Pierrick Bouvier
2025-03-07 19:42 ` Richard Henderson
2025-03-08 17:46 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 08/14] system/kvm: Expose kvm_irqchip_[add, remove]_change_notifier() Philippe Mathieu-Daudé
2025-03-07 19:17 ` [PATCH 08/14] system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier() Pierrick Bouvier
2025-03-07 20:09 ` Richard Henderson
2025-03-08 22:18 ` Philippe Mathieu-Daudé
2025-03-07 18:03 ` [PATCH 09/14] hw/vfio/pci: Convert CONFIG_KVM check to runtime one Philippe Mathieu-Daudé
2025-03-07 19:18 ` Pierrick Bouvier
2025-03-07 20:11 ` Richard Henderson
2025-03-08 17:46 ` Cédric Le Goater
2025-03-07 18:03 ` [PATCH 10/14] system/iommufd: Introduce iommufd_builtin() helper Philippe Mathieu-Daudé
2025-03-07 19:18 ` Pierrick Bouvier
2025-03-07 20:33 ` Richard Henderson
2025-03-08 7:48 ` Philippe Mathieu-Daudé [this message]
2025-03-07 18:03 ` [PATCH 11/14] hw/vfio/pci: Check CONFIG_IOMMUFD at runtime using iommufd_builtin() Philippe Mathieu-Daudé
2025-03-07 19:19 ` Pierrick Bouvier
2025-03-07 20:35 ` Richard Henderson
2025-03-07 18:03 ` [PATCH 12/14] hw/vfio/ap: " Philippe Mathieu-Daudé
2025-03-07 19:19 ` Pierrick Bouvier
2025-03-07 20:42 ` Richard Henderson
2025-03-07 21:08 ` Philippe Mathieu-Daudé
2025-03-07 18:03 ` [PATCH 13/14] hw/vfio/ccw: " Philippe Mathieu-Daudé
2025-03-07 19:19 ` Pierrick Bouvier
2025-03-07 20:45 ` Richard Henderson
2025-03-07 21:09 ` Philippe Mathieu-Daudé
2025-03-07 18:03 ` [PATCH 14/14] hw/vfio/platform: Check CONFIG_IOMMUFD at runtime using iommufd_builtin Philippe Mathieu-Daudé
2025-03-07 19:20 ` Pierrick Bouvier
2025-03-07 20:48 ` Richard Henderson
2025-03-08 17:48 ` [PATCH 00/14] hw/vfio: Build various objects once Cédric Le Goater
2025-03-08 20:37 ` BALATON Zoltan
2025-03-08 22:31 ` Philippe Mathieu-Daudé
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=85901dab-29a5-4d50-b122-29333f7ebcd9@linaro.org \
--to=philmd@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).