From: Joao Martins <joao.m.martins@oracle.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "Liu, Yi L" <yi.l.liu@intel.com>,
Eric Auger <eric.auger@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cedric Le Goater <clg@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Avihai Horon <avihaih@nvidia.com>
Subject: Re: [PATCH RFCv2 1/8] backends/iommufd: Introduce helper function iommufd_device_get_hw_capabilities()
Date: Mon, 26 Feb 2024 10:10:59 +0000 [thread overview]
Message-ID: <03e4a92e-ccf7-4659-b9be-6530158b4cfa@oracle.com> (raw)
In-Reply-To: <SJ0PR11MB6744CF6315A3BD4906C115F8925A2@SJ0PR11MB6744.namprd11.prod.outlook.com>
On 26/02/2024 07:29, Duan, Zhenzhong wrote:
> Hi Joao,
>
>> -----Original Message-----
>> From: Joao Martins <joao.m.martins@oracle.com>
>> Subject: [PATCH RFCv2 1/8] backends/iommufd: Introduce helper function
>> iommufd_device_get_hw_capabilities()
>>
>> The new helper will fetch vendor agnostic IOMMU capabilities supported
>> both by hardware and software. Right now it is only iommu dirty
>> tracking.
>>
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> ---
>> backends/iommufd.c | 25 +++++++++++++++++++++++++
>> include/sysemu/iommufd.h | 2 ++
>> 2 files changed, 27 insertions(+)
>>
>> diff --git a/backends/iommufd.c b/backends/iommufd.c
>> index d92791bba935..8486894f1b3f 100644
>> --- a/backends/iommufd.c
>> +++ b/backends/iommufd.c
>> @@ -237,3 +237,28 @@ void iommufd_device_init(IOMMUFDDevice *idev)
>> host_iommu_base_device_init(&idev->base, HID_IOMMUFD,
>> sizeof(IOMMUFDDevice));
>> }
>> +
>> +int iommufd_device_get_hw_capabilities(IOMMUFDDevice *idev, uint64_t
>> *caps,
>> + Error **errp)
>> +{
>> + struct iommu_hw_info info = {
>> + .size = sizeof(info),
>> + .flags = 0,
>> + .dev_id = idev->devid,
>> + .data_len = 0,
>> + .__reserved = 0,
>> + .data_uptr = 0,
>> + .out_capabilities = 0,
>> + };
>> + int ret;
>> +
>> + ret = ioctl(idev->iommufd->fd, IOMMU_GET_HW_INFO, &info);
>> + if (ret) {
>> + error_setg_errno(errp, errno,
>> + "Failed to get hardware info capabilities");
>> + } else {
>> + *caps = info.out_capabilities;
>> + }
>> +
>> + return ret;
>> +}
>
> This helper is redundant with https://lists.gnu.org/archive/html/qemu-devel/2024-02/msg00031.html
> We have to get other elements in info in nesting series, so mind using that helper
> Instead to avoid redundancy? I can move that patch ahead for your usage.
>
Sure.
Btw, speaking of which. You series could actually be split into two. One for
iommufd device abstraction part (patch 00-09) and another for the nesting bits
(10-18). FWIW this series here as submitted was actually just placing it on top
of the iommufd device abstraction
I am still planning on adding this same helper, probably just calling into
yours. Mostly because I disregard the data/data-size as I am only interested in
vendor agnostic capabilities.
> Thanks
> Zhenzhong
>
>> diff --git a/include/sysemu/iommufd.h b/include/sysemu/iommufd.h
>> index c3f346976039..4afe97307dbe 100644
>> --- a/include/sysemu/iommufd.h
>> +++ b/include/sysemu/iommufd.h
>> @@ -47,4 +47,6 @@ typedef struct IOMMUFDDevice {
>> } IOMMUFDDevice;
>>
>> void iommufd_device_init(IOMMUFDDevice *idev);
>> +int iommufd_device_get_hw_capabilities(IOMMUFDDevice *idev, uint64_t
>> *caps,
>> + Error **errp);
>> #endif
>> --
>> 2.39.3
>
next prev parent reply other threads:[~2024-02-26 10:12 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 13:56 [PATCH RFCv2 0/8] vfio/iommufd: IOMMUFD Dirty Tracking Joao Martins
2024-02-12 13:56 ` [PATCH RFCv2 1/8] backends/iommufd: Introduce helper function iommufd_device_get_hw_capabilities() Joao Martins
2024-02-26 7:29 ` Duan, Zhenzhong
2024-02-26 10:10 ` Joao Martins [this message]
2024-02-27 4:04 ` Duan, Zhenzhong
2024-02-12 13:56 ` [PATCH RFCv2 2/8] vfio/iommufd: Introduce auto domain creation Joao Martins
2024-02-12 16:27 ` Jason Gunthorpe
2024-02-12 18:09 ` Joao Martins
2024-02-26 9:14 ` Duan, Zhenzhong
2024-02-13 12:01 ` Joao Martins
2024-02-19 8:58 ` Avihai Horon
2024-02-20 10:42 ` Joao Martins
2024-02-12 13:56 ` [PATCH RFCv2 3/8] vfio/iommufd: Probe and request hwpt dirty tracking capability Joao Martins
2024-02-19 9:03 ` Avihai Horon
2024-02-20 10:51 ` Joao Martins
2024-02-20 12:46 ` Avihai Horon
2024-02-12 13:56 ` [PATCH RFCv2 4/8] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support Joao Martins
2024-02-19 9:17 ` Avihai Horon
2024-02-12 13:56 ` [PATCH RFCv2 5/8] vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support Joao Martins
2024-02-19 9:30 ` Avihai Horon
2024-02-20 10:59 ` Joao Martins
2024-02-20 12:52 ` Avihai Horon
2024-02-20 13:17 ` Joao Martins
2024-02-12 13:56 ` [PATCH RFCv2 6/8] backends/iommufd: Add ability to disable hugepages Joao Martins
2024-02-12 16:59 ` Jason Gunthorpe
2024-02-12 17:17 ` Markus Armbruster
2024-02-12 19:16 ` Joao Martins
2024-02-19 10:05 ` Avihai Horon
2024-02-20 11:01 ` Joao Martins
2024-02-12 13:56 ` [PATCH RFCv2 7/8] vfio/migration: Don't block migration device dirty tracking is unsupported Joao Martins
2024-02-19 10:12 ` Avihai Horon
2024-02-20 11:05 ` Joao Martins
2024-02-12 13:56 ` [PATCH RFCv2 8/8] vfio/common: Allow disabling device dirty page tracking Joao Martins
2024-02-13 11:59 ` [PATCH RFCv2 0/8] vfio/iommufd: IOMMUFD Dirty Tracking Joao Martins
2024-02-14 15:40 ` Cédric Le Goater
2024-02-14 16:25 ` Joao Martins
2024-02-15 14:20 ` Eric Auger
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=03e4a92e-ccf7-4659-b9be-6530158b4cfa@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=avihaih@nvidia.com \
--cc=berrange@redhat.com \
--cc=clg@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=eric.auger@redhat.com \
--cc=jgg@nvidia.com \
--cc=pbonzini@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).