qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Joao Martins <joao.m.martins@oracle.com>, qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
	Cedric Le Goater <clg@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Jason Wang <jasowang@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Eduardo Habkost <eduardo@habkost.net>,
	Avihai Horon <avihaih@nvidia.com>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v3 08/15] vfio/common: Relax vIOMMU detection when DMA translation is off
Date: Tue, 30 May 2023 23:39:31 +0200	[thread overview]
Message-ID: <661455ce-b310-adbb-268c-3b0771d8bf7f@linaro.org> (raw)
In-Reply-To: <20230530175937.24202-9-joao.m.martins@oracle.com>

On 30/5/23 19:59, Joao Martins wrote:
> Relax the vIOMMU migration blocker when the underlying IOMMU reports that
> DMA translation disabled. When it is disabled there will be no DMA mappings
> via the vIOMMU and the guest only uses it for Interrupt Remapping.
> 
> The latter is done via the vfio_viommu_preset() return value whereby in
> addition to validating that the address space is memory, we also check
> whether the IOMMU MR has DMA translation on.

> Assume it is enabled if
> there's no IOMMU MR or if no dma-translation property is supported.

This comment ^ ...

> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> ---
>   hw/vfio/common.c | 22 +++++++++++++++++++++-
>   1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index fa8fd949b1cf..060acccb3443 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -414,12 +414,32 @@ void vfio_unblock_multiple_devices_migration(void)
>       multiple_devices_migration_blocker = NULL;
>   }
>   
> +static bool vfio_viommu_dma_translation_enabled(VFIOAddressSpace *space)
> +{
> +    bool enabled = false;
> +    int ret;
> +
> +    if (!space->iommu_mr) {
> +        return true;
> +    }
> +
> +    ret = memory_region_iommu_get_attr(space->iommu_mr,
> +                                       IOMMU_ATTR_DMA_TRANSLATION,
> +                                       &enabled);
> +    if (ret || enabled) {

... could be helpful if duplicated here.

> +        return true;
> +    }
> +
> +    return false;
> +}



  reply	other threads:[~2023-05-30 21:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 17:59 [PATCH v3 00/15] vfio: VFIO migration support with vIOMMU Joao Martins
2023-05-30 17:59 ` [PATCH v3 01/15] hw/pci: Refactor pci_device_iommu_address_space() Joao Martins
2023-05-30 22:04   ` Philippe Mathieu-Daudé
2023-05-31 10:03     ` Joao Martins
2023-06-22 20:50       ` Michael S. Tsirkin
2023-06-22 21:01         ` Joao Martins
2023-05-30 17:59 ` [PATCH v3 02/15] hw/pci: Add a pci_setup_iommu_info() helper Joao Martins
2023-05-30 17:59 ` [PATCH v3 03/15] hw/pci: Add a pci_device_iommu_memory_region() helper Joao Martins
2023-06-05 16:57   ` Peter Xu
2023-06-06 11:22     ` Joao Martins
2023-06-06 15:03       ` Peter Xu
2023-06-06 15:05         ` Peter Xu
2023-06-06 17:44           ` Joao Martins
2023-05-30 17:59 ` [PATCH v3 04/15] intel-iommu: Switch to pci_setup_iommu_info() Joao Martins
2023-05-30 17:59 ` [PATCH v3 05/15] vfio/common: Track the IOMMU MR behind the device in addition to the AS Joao Martins
2023-05-30 17:59 ` [PATCH v3 06/15] memory/iommu: Add IOMMU_ATTR_DMA_TRANSLATION attribute Joao Martins
2023-05-30 17:59 ` [PATCH v3 07/15] intel-iommu: Implement get_attr() method Joao Martins
2023-05-30 17:59 ` [PATCH v3 08/15] vfio/common: Relax vIOMMU detection when DMA translation is off Joao Martins
2023-05-30 21:39   ` Philippe Mathieu-Daudé [this message]
2023-05-31  9:39     ` Joao Martins
2023-05-30 17:59 ` [PATCH v3 09/15] memory/iommu: Add IOMMU_ATTR_MAX_IOVA attribute Joao Martins
2023-05-30 17:59 ` [PATCH v3 10/15] intel-iommu: Implement IOMMU_ATTR_MAX_IOVA get_attr() attribute Joao Martins
2023-05-30 21:45   ` Philippe Mathieu-Daudé
2023-05-31  9:54     ` Joao Martins
2023-05-31 13:59       ` Philippe Mathieu-Daudé
2023-05-30 17:59 ` [PATCH v3 11/15] vfio/common: Move dirty tracking ranges update to helper Joao Martins
2023-05-30 17:59 ` [PATCH v3 12/15] vfio/common: Support device dirty page tracking with vIOMMU Joao Martins
2023-05-30 17:59 ` [PATCH v3 13/15] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap() Joao Martins
2023-05-30 17:59 ` [PATCH v3 14/15] vfio/common: Optimize device dirty page tracking with vIOMMU Joao Martins
2023-05-30 17:59 ` [PATCH v3 15/15] vfio/common: Block migration with vIOMMUs without address width limits Joao Martins

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=661455ce-b310-adbb-268c-3b0771d8bf7f@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=avihaih@nvidia.com \
    --cc=clg@redhat.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=jasowang@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=joao.m.martins@oracle.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@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).