From: Peter Xu <peterx@redhat.com>
To: Wei Huang <wei.huang2@amd.com>
Cc: ehabkost@redhat.com, mst@redhat.com, qemu-devel@nongnu.org,
alex.williamson@redhat.com, pbonzini@redhat.com,
Suravee.Suthikulpanit@amd.com, rth@twiddle.net
Subject: Re: [PATCH V2 1/3] amd-iommu: Add address space notifier and replay support
Date: Fri, 2 Oct 2020 14:53:03 -0400 [thread overview]
Message-ID: <20201002185303.GE5473@xz-x1> (raw)
In-Reply-To: <20201002145907.1294353-2-wei.huang2@amd.com>
On Fri, Oct 02, 2020 at 09:59:05AM -0500, Wei Huang wrote:
> +static void amdvi_address_space_unmap(AMDVIAddressSpace *as, IOMMUNotifier *n)
> +{
> + IOMMUTLBEntry entry;
> + hwaddr start = n->start;
> + hwaddr end = n->end;
> + hwaddr size = end - start + 1;
> +
> + entry.target_as = &address_space_memory;
> + entry.iova = start;
> + entry.translated_addr = 0;
> + entry.perm = IOMMU_NONE;
> + entry.addr_mask = size - 1;
This may race with Eugenio's series:
https://mail.gnu.org/archive/html/qemu-ppc/2020-09/msg00131.html
IMHO that series should be acceptable for merging already. Anyway, there's
probably a trivial conflict to solve.
> +
> + memory_region_notify_one(n, &entry);
> +}
> +
> static gboolean amdvi_iotlb_remove_by_domid(gpointer key, gpointer value,
> gpointer user_data)
> {
> @@ -1473,14 +1491,17 @@ static int amdvi_iommu_notify_flag_changed(IOMMUMemoryRegion *iommu,
> Error **errp)
> {
> AMDVIAddressSpace *as = container_of(iommu, AMDVIAddressSpace, iommu);
> + AMDVIState *s = as->iommu_state;
>
> - if (new & IOMMU_NOTIFIER_MAP) {
> - error_setg(errp,
> - "device %02x.%02x.%x requires iommu notifier which is not "
> - "currently supported", as->bus_num, PCI_SLOT(as->devfn),
> - PCI_FUNC(as->devfn));
> - return -EINVAL;
Ideally, we shouldn't remove this error message until the functionality is
fully implemented. Otherwise an user could potentially boot such a vm with a
broken assigned device.
Thanks,
> + /* Update address space notifier flags */
> + as->notifier_flags = new;
> +
> + if (old == IOMMU_NOTIFIER_NONE) {
> + QLIST_INSERT_HEAD(&s->amdvi_as_with_notifiers, as, next);
> + } else if (new == IOMMU_NOTIFIER_NONE) {
> + QLIST_REMOVE(as, next);
> }
> +
> return 0;
> }
--
Peter Xu
next prev parent reply other threads:[~2020-10-02 18:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 14:59 [PATCH V2 0/3] Passthru device support under emulated amd-iommu Wei Huang
2020-10-02 14:59 ` [PATCH V2 1/3] amd-iommu: Add address space notifier and replay support Wei Huang
2020-10-02 18:53 ` Peter Xu [this message]
2020-10-02 14:59 ` [PATCH V2 2/3] amd-iommu: Sync IOVA-to-GPA translation during page invalidation Wei Huang
2020-10-02 19:11 ` Peter Xu
2020-10-02 14:59 ` [PATCH V2 3/3] amd-iommu: Fix amdvi_mmio_trace() to differentiate MMIO R/W Wei Huang
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=20201002185303.GE5473@xz-x1 \
--to=peterx@redhat.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=alex.williamson@redhat.com \
--cc=ehabkost@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@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).