From: Joao Martins <joao.m.martins@oracle.com>
To: Steve Sistare <steven.sistare@oracle.com>, qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
Cedric Le Goater <clg@redhat.com>
Subject: Re: [PATCH] vfio/iommufd: no hw_info for mediated devices
Date: Tue, 10 Sep 2024 20:29:54 +0100 [thread overview]
Message-ID: <73f10bc0-5e3f-412d-8e2a-44d013c4b7ba@oracle.com> (raw)
In-Reply-To: <1725990021-107183-1-git-send-email-steven.sistare@oracle.com>
On 10/09/2024 18:40, Steve Sistare wrote:
> IOMMU_GET_HW_INFO fails for a vfio mediated device (aka mdev), because
> the devid is associated with kernel type IOMMUFD_OBJ_ACCESS, not
> IOMMUFD_OBJ_DEVICE. Assume IOMMU_HW_INFO_TYPE_NONE and proceed.
>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> hw/vfio/iommufd.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
> index cb7257b..d8928d4 100644
> --- a/hw/vfio/iommufd.c
> +++ b/hw/vfio/iommufd.c
> @@ -635,6 +635,7 @@ static void vfio_iommu_iommufd_class_init(ObjectClass *klass, void *data)
> static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
> Error **errp)
> {
> + Error *err = NULL;
> VFIODevice *vdev = opaque;
> HostIOMMUDeviceCaps *caps = &hiod->caps;
> enum iommu_hw_info_type type;
> @@ -645,8 +646,9 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
> hiod->agent = opaque;
>
> if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
> - &type, &data, sizeof(data), errp)) {
> - return false;
> + &type, &data, sizeof(data), &err)) {
> + warn_report_err(err);
> + type = IOMMU_HW_INFO_TYPE_NONE;
> }
>
> hiod->name = g_strdup(vdev->name);
At least we aren't supposed to call realize() on an mdev.
See commit 9f17604195c ("vfio/iommufd: Don't initialize nor set a
HOST_IOMMU_DEVICE with mdev"). There's another refactor later on in commit
83a4d596a93 ("vfio/{iommufd, container}: Invoke HostIOMMUDevice::realize()
during attach_device()") where we also don't realize() when vbasedev->hiod is NULL.
Unless the stty mdevs aren't matching examples, then this shouldn't be possible
(I didn't have one with real hw behind to test).
So if you are hitting this codepath then vbasedev::mdev is false, which I don't
understand how it's possible?
next prev parent reply other threads:[~2024-09-10 19:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 17:40 [PATCH] vfio/iommufd: no hw_info for mediated devices Steve Sistare
2024-09-10 19:29 ` Joao Martins [this message]
2024-09-10 19:51 ` Steven Sistare
2024-09-11 19:32 ` Steven Sistare
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=73f10bc0-5e3f-412d-8e2a-44d013c4b7ba@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.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).