qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Wei Huang <wei.huang2@amd.com>
Cc: ehabkost@redhat.com, mst@redhat.com, qemu-devel@nongnu.org,
	peterx@redhat.com, pbonzini@redhat.com,
	Suravee.Suthikulpanit@amd.com, rth@twiddle.net
Subject: Re: [PATCH V1 2/3] amd-iommu: Sync IOVA-to-GPA translation during page invalidation
Date: Tue, 29 Sep 2020 13:34:14 -0600	[thread overview]
Message-ID: <20200929133414.41982c53@x1.home> (raw)
In-Reply-To: <20200928200506.75441-3-wei.huang2@amd.com>

On Mon, 28 Sep 2020 15:05:05 -0500
Wei Huang <wei.huang2@amd.com> wrote:

> Add support to sync the IOVA-to-GPA translation at the time of IOMMU
> page invalidation. This function is called when two IOMMU commands,
> AMDVI_CMD_INVAL_AMDVI_PAGES and AMDVI_CMD_INVAL_AMDVI_ALL, are
> intercepted. Address space notifiers are called accordingly.
> 
> Co-developed-by: Wei Huang <wei.huang2@amd.com>
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> ---
>  hw/i386/amd_iommu.c | 177 ++++++++++++++++++++++++++++++++++++++++++++
>  hw/i386/amd_iommu.h |  10 +++
>  hw/vfio/common.c    |   3 +-
>  3 files changed, 189 insertions(+), 1 deletion(-)
...
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 13471ae29436..243216499ce0 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -346,7 +346,8 @@ static int vfio_dma_map(VFIOContainer *container, hwaddr iova,
>       * the VGA ROM space.
>       */
>      if (ioctl(container->fd, VFIO_IOMMU_MAP_DMA, &map) == 0 ||
> -        (errno == EBUSY && vfio_dma_unmap(container, iova, size) == 0 &&
> +        ((errno == EEXIST || errno == EBUSY) &&
> +         vfio_dma_unmap(container, iova, size) == 0 &&
>           ioctl(container->fd, VFIO_IOMMU_MAP_DMA, &map) == 0)) {
>          return 0;
>      }


This seems like it should be a separate patch.  AFAICT the commit log
doesn't even hint at why this change is necessary.  I think the -EBUSY
error pre-dates vIOMMU as well.  Responding the same for an -EEXIST
almost suggests a coherency issue between QEMU and the kernel, or a
direct mapping replacement without an invalidation, which doesn't seem
to be what this patch is implementing.  Thanks,

Alex



  reply	other threads:[~2020-09-29 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 20:05 [PATCH V1 0/3] Passthru device support under emulated amd-iommu Wei Huang
2020-09-28 20:05 ` [PATCH V1 1/3] amd-iommu: Add address space notifier and replay support Wei Huang
2020-09-28 20:05 ` [PATCH V1 2/3] amd-iommu: Sync IOVA-to-GPA translation during page invalidation Wei Huang
2020-09-29 19:34   ` Alex Williamson [this message]
2020-09-30 20:43     ` Wei Huang
2020-09-28 20:05 ` [PATCH V1 3/3] amd-iommu: Fix amdvi_mmio_trace() to differentiate MMIO R/W Wei Huang
2020-09-29  2:08 ` [PATCH V1 0/3] Passthru device support under emulated amd-iommu no-reply

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=20200929133414.41982c53@x1.home \
    --to=alex.williamson@redhat.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=wei.huang2@amd.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).