From: Viktor Prutyanov <viktor@daynix.com>
To: mst@redhat.com, jasowang@redhat.com, marcel.apfelbaum@gmail.com,
pbonzini@redhat.com, peterx@redhat.com, david@redhat.com
Cc: philmd@linaro.org, qemu-devel@nongnu.org, yan@daynix.com,
yuri.benditovich@daynix.com, Viktor Prutyanov <viktor@daynix.com>
Subject: [RFC PATCH 3/4] memory: add interface for triggering IOMMU notify_flag_changed handler
Date: Mon, 24 Apr 2023 14:21:46 +0300 [thread overview]
Message-ID: <20230424112147.17083-4-viktor@daynix.com> (raw)
In-Reply-To: <20230424112147.17083-1-viktor@daynix.com>
This interface helps if IOMMU notify_flag_changed should be triggered
after changing IOMMU notifier flags in the runtime.
Signed-off-by: Viktor Prutyanov <viktor@daynix.com>
---
include/exec/memory.h | 2 ++
softmmu/memory.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2e602a2fad..c8d5f69add 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1772,6 +1772,8 @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n);
void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
IOMMUNotifier *n);
+void memory_region_iommu_notify_flags_changed(MemoryRegion *mr);
+
/**
* memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is
* defined on the IOMMU.
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 9d64efca26..e4a53cde6c 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1950,6 +1950,18 @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)
}
}
+void memory_region_iommu_notify_flags_changed(MemoryRegion *mr)
+{
+ IOMMUMemoryRegion *iommu_mr;
+
+ if (mr->alias) {
+ memory_region_iommu_notify_flags_changed(mr->alias);
+ return;
+ }
+ iommu_mr = IOMMU_MEMORY_REGION(mr);
+ memory_region_update_iommu_notify_flags(iommu_mr, NULL);
+}
+
void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
IOMMUNotifier *n)
{
--
2.21.0
next prev parent reply other threads:[~2023-04-24 11:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 11:21 [RFC PATCH 0/4] vhost: register and change IOMMU flag depending on ATS state Viktor Prutyanov
2023-04-24 11:21 ` [RFC PATCH 1/4] pci: add handling of Enable bit in ATS Control Register Viktor Prutyanov
2023-04-26 5:31 ` Jason Wang
2023-04-26 5:48 ` Jason Wang
2023-05-02 21:35 ` Viktor Prutyanov
2023-04-24 11:21 ` [RFC PATCH 2/4] virtio-pci: add handling of ATS state change Viktor Prutyanov
2023-04-26 5:50 ` Jason Wang
2023-04-24 11:21 ` Viktor Prutyanov [this message]
2023-04-26 14:20 ` [RFC PATCH 3/4] memory: add interface for triggering IOMMU notify_flag_changed handler Peter Xu
2023-04-24 11:21 ` [RFC PATCH 4/4] vhost: register and change IOMMU flag depending on ATS state Viktor Prutyanov
2023-04-26 5:54 ` Jason Wang
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=20230424112147.17083-4-viktor@daynix.com \
--to=viktor@daynix.com \
--cc=david@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yan@daynix.com \
--cc=yuri.benditovich@daynix.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).