From: "Cédric Le Goater" <clg@redhat.com>
To: Eric Auger <eric.auger@redhat.com>,
eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, mst@redhat.com, jean-philippe@linaro.org,
peter.maydell@linaro.org, zhenzhong.duan@intel.com,
alex.williamson@redhat.com, jasowang@redhat.com
Cc: yanghliu@redhat.com
Subject: Re: [PATCH 2/6] virtio-iommu: Remove probe_done
Date: Tue, 16 Jul 2024 15:06:08 +0200 [thread overview]
Message-ID: <ee956f5d-676c-404e-a07c-8bc3330cdbcd@redhat.com> (raw)
In-Reply-To: <20240716094619.1713905-3-eric.auger@redhat.com>
On 7/16/24 11:45, Eric Auger wrote:
> Now we have switched to PCIIOMMUOps to convey host IOMMU information,
> the host reserved regions are transmitted when the PCIe topology is
> built. This happens way before the virtio-iommu driver calls the probe
> request. So let's remove the probe_done flag that allowed to check
> the probe was not done before the IOMMU MR got enabled. Besides this
> probe_done flag had a flaw wrt migration since it was not saved/restored.
>
> The only case at risk is if 2 devices were plugged to a
> PCIe to PCI bridge and thus aliased. First of all we
> discovered in the past this case was not properly supported for
> neither SMMU nor virtio-iommu on guest kernel side: see
>
> [RFC] virtio-iommu: Take into account possible aliasing in virtio_iommu_mr()
> https://lore.kernel.org/all/20230116124709.793084-1-eric.auger@redhat.com/
>
> If this were supported by the guest kernel, it is unclear what the call
> sequence would be from a virtio-iommu driver point of view.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> ---
> include/hw/virtio/virtio-iommu.h | 1 -
> hw/virtio/virtio-iommu.c | 3 ---
> 2 files changed, 4 deletions(-)
>
> diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-iommu.h
> index bdb3da72d0..7db4210b16 100644
> --- a/include/hw/virtio/virtio-iommu.h
> +++ b/include/hw/virtio/virtio-iommu.h
> @@ -43,7 +43,6 @@ typedef struct IOMMUDevice {
> MemoryRegion bypass_mr; /* The alias of shared memory MR */
> GList *resv_regions;
> GList *host_resv_ranges;
> - bool probe_done;
> } IOMMUDevice;
>
> typedef struct IOMMUPciBus {
> diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
> index 4e34dacd6e..2c54c0d976 100644
> --- a/hw/virtio/virtio-iommu.c
> +++ b/hw/virtio/virtio-iommu.c
> @@ -555,8 +555,6 @@ static int virtio_iommu_set_host_iova_ranges(VirtIOIOMMU *s, PCIBus *bus,
>
> current_ranges = sdev->host_resv_ranges;
>
> - g_assert(!sdev->probe_done);
> -
> /* check that each new resv region is included in an existing one */
> if (sdev->host_resv_ranges) {
> range_inverse_array(iova_ranges,
> @@ -956,7 +954,6 @@ static int virtio_iommu_probe(VirtIOIOMMU *s,
> }
> buf += count;
> free -= count;
> - sdev->probe_done = true;
>
> return VIRTIO_IOMMU_S_OK;
> }
next prev parent reply other threads:[~2024-07-16 13:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 9:45 [PATCH 0/6] VIRTIO-IOMMU/VFIO: Revert IOMMUDevice clear and fix hotunplug Eric Auger
2024-07-16 9:45 ` [PATCH 1/6] Revert "virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged" Eric Auger
2024-07-16 13:05 ` Cédric Le Goater
2024-07-16 9:45 ` [PATCH 2/6] virtio-iommu: Remove probe_done Eric Auger
2024-07-16 13:06 ` Cédric Le Goater [this message]
2024-07-16 9:45 ` [PATCH 3/6] virtio-iommu: Free [host_]resv_ranges on unset_iommu_devices Eric Auger
2024-07-16 13:36 ` Cédric Le Goater
2024-07-17 3:06 ` Duan, Zhenzhong
2024-07-17 7:40 ` Eric Auger
2024-07-17 7:56 ` Duan, Zhenzhong
2024-07-16 9:45 ` [PATCH 4/6] virtio-iommu: Remove the end point on detach Eric Auger
2024-07-16 13:36 ` Cédric Le Goater
2024-07-16 9:45 ` [PATCH 5/6] hw/vfio/common: Add vfio_listener_region_del_iommu trace event Eric Auger
2024-07-16 13:36 ` Cédric Le Goater
2024-07-16 9:45 ` [PATCH 6/6] virtio-iommu: Add trace point on virtio_iommu_detach_endpoint_from_domain Eric Auger
2024-07-16 13:36 ` Cédric Le Goater
2024-07-16 14:02 ` [PATCH 0/6] VIRTIO-IOMMU/VFIO: Revert IOMMUDevice clear and fix hotunplug Cédric Le Goater
2024-07-16 14:59 ` 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=ee956f5d-676c-404e-a07c-8bc3330cdbcd@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=jean-philippe@linaro.org \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=yanghliu@redhat.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).