From: "Cédric Le Goater" <clg@redhat.com>
To: Zhenzhong Duan <zhenzhong.duan@intel.com>, qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, eric.auger@redhat.com,
peterx@redhat.com, jasowang@redhat.com, mst@redhat.com,
jgg@nvidia.com, nicolinc@nvidia.com, joao.m.martins@oracle.com,
kevin.tian@intel.com, yi.l.liu@intel.com, chao.p.peng@intel.com,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 01/10] backends: Introduce abstract HostIOMMUDevice
Date: Mon, 15 Apr 2024 10:09:20 +0200 [thread overview]
Message-ID: <677ab8a4-0d64-4a55-bb46-4ee5a5a1c543@redhat.com> (raw)
In-Reply-To: <20240408081230.1030078-2-zhenzhong.duan@intel.com>
On 4/8/24 10:12, Zhenzhong Duan wrote:
> Introduce HostIOMMUDevice as an abstraction of host IOMMU device.
>
> get_host_iommu_info() is used to get host IOMMU info, different
> backends can have different implementations and result format.
>
> Introduce a macro CONFIG_HOST_IOMMU_DEVICE to define the usage
> for VFIO, and VDPA in the future.
>
> Suggested-by: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
LGTM,
> ---
> MAINTAINERS | 2 ++
> include/sysemu/host_iommu_device.h | 19 +++++++++++++++++++
> backends/host_iommu_device.c | 19 +++++++++++++++++++
> backends/Kconfig | 5 +++++
> backends/meson.build | 1 +
> 5 files changed, 46 insertions(+)
> create mode 100644 include/sysemu/host_iommu_device.h
> create mode 100644 backends/host_iommu_device.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e71183eef9..22f71cbe02 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2202,6 +2202,8 @@ M: Zhenzhong Duan <zhenzhong.duan@intel.com>
> S: Supported
> F: backends/iommufd.c
> F: include/sysemu/iommufd.h
> +F: backends/host_iommu_device.c
> +F: include/sysemu/host_iommu_device.h
> F: include/qemu/chardev_open.h
> F: util/chardev_open.c
> F: docs/devel/vfio-iommufd.rst
> diff --git a/include/sysemu/host_iommu_device.h b/include/sysemu/host_iommu_device.h
> new file mode 100644
> index 0000000000..22ccbe3a5d
> --- /dev/null
> +++ b/include/sysemu/host_iommu_device.h
> @@ -0,0 +1,19 @@
> +#ifndef HOST_IOMMU_DEVICE_H
> +#define HOST_IOMMU_DEVICE_H
> +
> +#include "qom/object.h"
> +
> +#define TYPE_HOST_IOMMU_DEVICE "host-iommu-device"
> +OBJECT_DECLARE_TYPE(HostIOMMUDevice, HostIOMMUDeviceClass, HOST_IOMMU_DEVICE)
> +
> +struct HostIOMMUDevice {
> + Object parent;
> +};
> +
> +struct HostIOMMUDeviceClass {
> + ObjectClass parent_class;
Could you please document the struct and its handlers ? This is more for
the future reader to understand the VFIO concepts than for the generated
docs. Anyhow, it could be useful for the docs also. Overall, the QEMU VFIO
susbsytem suffers from a lack of documentation and we should try to improve
that in the next cycle.
Thanks,
C.
> + int (*get_host_iommu_info)(HostIOMMUDevice *hiod, void *data, uint32_t len,
> + Error **errp);
> +};
> +#endif
> diff --git a/backends/host_iommu_device.c b/backends/host_iommu_device.c
> new file mode 100644
> index 0000000000..6cb6007d8c
> --- /dev/null
> +++ b/backends/host_iommu_device.c
> @@ -0,0 +1,19 @@
> +#include "qemu/osdep.h"
> +#include "sysemu/host_iommu_device.h"
> +
> +OBJECT_DEFINE_ABSTRACT_TYPE(HostIOMMUDevice,
> + host_iommu_device,
> + HOST_IOMMU_DEVICE,
> + OBJECT)
> +
> +static void host_iommu_device_class_init(ObjectClass *oc, void *data)
> +{
> +}
> +
> +static void host_iommu_device_init(Object *obj)
> +{
> +}
> +
> +static void host_iommu_device_finalize(Object *obj)
> +{
> +}
> diff --git a/backends/Kconfig b/backends/Kconfig
> index 2cb23f62fa..34ab29e994 100644
> --- a/backends/Kconfig
> +++ b/backends/Kconfig
> @@ -3,3 +3,8 @@ source tpm/Kconfig
> config IOMMUFD
> bool
> depends on VFIO
> +
> +config HOST_IOMMU_DEVICE
> + bool
> + default y
> + depends on VFIO
> diff --git a/backends/meson.build b/backends/meson.build
> index 8b2b111497..2e975d641e 100644
> --- a/backends/meson.build
> +++ b/backends/meson.build
> @@ -25,6 +25,7 @@ if have_vhost_user
> endif
> system_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c'))
> system_ss.add(when: 'CONFIG_IOMMUFD', if_true: files('iommufd.c'))
> +system_ss.add(when: 'CONFIG_HOST_IOMMU_DEVICE', if_true: files('host_iommu_device.c'))
> if have_vhost_user_crypto
> system_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost-user.c'))
> endif
next prev parent reply other threads:[~2024-04-15 8:10 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 8:12 [PATCH v2 00/10] Add a host IOMMU device abstraction Zhenzhong Duan
2024-04-08 8:12 ` [PATCH v2 01/10] backends: Introduce abstract HostIOMMUDevice Zhenzhong Duan
2024-04-15 8:09 ` Cédric Le Goater [this message]
2024-04-15 9:57 ` Duan, Zhenzhong
2024-04-15 9:18 ` Philippe Mathieu-Daudé
2024-04-15 9:58 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 02/10] vfio: Introduce HIODLegacyVFIO device Zhenzhong Duan
2024-04-15 9:19 ` Philippe Mathieu-Daudé
2024-04-15 10:10 ` Duan, Zhenzhong
2024-04-15 11:12 ` Philippe Mathieu-Daudé
2024-04-15 12:12 ` Duan, Zhenzhong
2024-04-15 12:47 ` Cédric Le Goater
2024-04-16 3:41 ` Duan, Zhenzhong
2024-04-16 13:53 ` Cédric Le Goater
2024-04-17 4:22 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 03/10] backends/iommufd: Introduce abstract HIODIOMMUFD device Zhenzhong Duan
2024-04-09 3:41 ` Duan, Zhenzhong
2024-04-15 13:07 ` Cédric Le Goater
2024-04-16 4:09 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 04/10] vfio/iommufd: Introduce HIODIOMMUFDVFIO device Zhenzhong Duan
2024-04-08 8:12 ` [PATCH v2 05/10] vfio: Implement get_host_iommu_info() callback Zhenzhong Duan
2024-04-15 13:15 ` Cédric Le Goater
2024-04-16 5:58 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 06/10] backends/iommufd: Introduce helper function iommufd_backend_get_device_info() Zhenzhong Duan
2024-04-15 13:22 ` Cédric Le Goater
2024-04-16 6:07 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 07/10] backends/iommufd: Implement get_host_iommu_info() callback Zhenzhong Duan
2024-04-15 13:23 ` Cédric Le Goater
2024-04-16 6:10 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 08/10] vfio: Create host IOMMU device instance Zhenzhong Duan
2024-04-15 13:25 ` Cédric Le Goater
2024-04-16 6:11 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 09/10] hw/pci: Introduce pci_device_set/unset_iommu_device() Zhenzhong Duan
2024-04-15 13:34 ` Cédric Le Goater
2024-04-16 6:11 ` Duan, Zhenzhong
2024-04-08 8:12 ` [PATCH v2 10/10] vfio: Pass HostIOMMUDevice to vIOMMU Zhenzhong Duan
2024-04-15 13:37 ` Cédric Le Goater
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=677ab8a4-0d64-4a55-bb46-4ee5a5a1c543@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@intel.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=jgg@nvidia.com \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=mst@redhat.com \
--cc=nicolinc@nvidia.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yi.l.liu@intel.com \
--cc=zhenzhong.duan@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).