[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v3 07/14] memory: add section range info for
From: |
Peter Xu |
Subject: |
Re: [Qemu-devel] [PATCH RFC v3 07/14] memory: add section range info for IOMMU notifier |
Date: |
Fri, 13 Jan 2017 18:22:53 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Jan 13, 2017 at 05:37:43PM +0800, Jason Wang wrote:
[...]
> >>>diff --git a/memory.c b/memory.c
> >>>index 2bfc37f..e88bb54 100644
> >>>--- a/memory.c
> >>>+++ b/memory.c
> >>>@@ -1671,7 +1671,9 @@ void memory_region_notify_iommu(MemoryRegion *mr,
> >>> }
> >>> QLIST_FOREACH(iommu_notifier, &mr->iommu_notify, node) {
> >>>- if (iommu_notifier->notifier_flags & request_flags) {
> >>>+ if (iommu_notifier->notifier_flags & request_flags &&
> >>>+ iommu_notifier->start <= entry.iova &&
> >>>+ iommu_notifier->end >= entry.iova) {
> >>> iommu_notifier->notify(iommu_notifier, &entry);
> >>> }
> >>> }
> >>This seems breaks vhost device IOTLB. How about keep the the behavior
> >>somehow?
> >Thanks to point out. How about I squash this into this patch?
> >
> >--------8<--------
> >diff --git a/memory.c b/memory.c
> >index e88bb54..6de02dd 100644
> >--- a/memory.c
> >+++ b/memory.c
> >@@ -1608,8 +1608,14 @@ void
> >memory_region_register_iommu_notifier(MemoryRegion *mr,
> > return;
> > }
> >+ if (n->start == 0 && n->end == 0) {
> >+ /* If these are not specified, we listen to the whole range */
> >+ n->end = (hwaddr)(-1);
> >+ }
> >+
> > /* We need to register for at least one bitfield */
> > assert(n->notifier_flags != IOMMU_NOTIFIER_NONE);
> >+ assert(n->start <= n->end);
> > QLIST_INSERT_HEAD(&mr->iommu_notify, n, node);
> > memory_region_update_iommu_notify_flags(mr);
> > }
> >-------->8--------
> >
> >-- peterx
>
> This should work, or you can introduce a memory_region_iommu_notifier_init()
> to force user to explicitly initialize start and end.
Hmm, this sounds better, considering that IOMMUNotifier is getting
more fields to be inited. Thanks,
-- peterx
[Qemu-devel] [PATCH RFC v3 08/14] memory: provide iommu_replay_all(), Peter Xu, 2017/01/12
[Qemu-devel] [PATCH RFC v3 09/14] memory: introduce memory_region_notify_one(), Peter Xu, 2017/01/12
[Qemu-devel] [PATCH RFC v3 10/14] memory: add MemoryRegionIOMMUOps.replay() callback, Peter Xu, 2017/01/12
[Qemu-devel] [PATCH RFC v3 11/14] intel_iommu: provide its own replay() callback, Peter Xu, 2017/01/12