From: Eric Auger <eric.auger@redhat.com>
To: eric.auger@redhat.com, eric.auger.pro@gmail.com,
peter.maydell@linaro.org, qemu-arm@nongnu.org,
qemu-devel@nongnu.org, alex.williamson@redhat.com,
pranav.sawargaonkar@gmail.com
Cc: diana.craciun@freescale.com, christoffer.dall@linaro.org,
drjones@redhat.com, Bharat.Bhushan@freescale.com, fkan@apm.com
Subject: [Qemu-devel] [RFC v5 3/8] memory: Add reserved_iova region type
Date: Mon, 17 Oct 2016 19:38:25 +0000 [thread overview]
Message-ID: <1476733110-14293-4-git-send-email-eric.auger@redhat.com> (raw)
In-Reply-To: <1476733110-14293-1-git-send-email-eric.auger@redhat.com>
Introduce a new reserved_iova region type. This type of iova region
is bound to be used by the kernel to map some host physical addresses
(typically MSI frames).
A new initializer, memory_region_init_reserved_iova is introduced, as
well as a test function, memory_region_is_reserved_iova.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
include/exec/memory.h | 29 +++++++++++++++++++++++++++++
memory.c | 11 +++++++++++
2 files changed, 40 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 10d7eac..f97b1f4 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -191,6 +191,7 @@ struct MemoryRegion {
/* The following fields should fit in a cache line */
bool romd_mode;
bool ram;
+ bool reserved_iova;
bool subpage;
bool readonly; /* For RAM regions */
bool rom_device;
@@ -385,6 +386,21 @@ void memory_region_init_ram(MemoryRegion *mr,
Error **errp);
/**
+ * memory_region_init_reserved_iova: Initialize reserved iova memory region
+ *
+ * @mr: the #MemoryRegion to be initialized.
+ * @owner: the object that tracks the region's reference count
+ * @name: the name of the region.
+ * @size: size of the region.
+ * @errp: pointer to Error*, to store an error if it happens.
+ */
+void memory_region_init_reserved_iova(MemoryRegion *mr,
+ struct Object *owner,
+ const char *name,
+ uint64_t size,
+ Error **errp);
+
+/**
* memory_region_init_resizeable_ram: Initialize memory region with resizeable
* RAM. Accesses into the region will
* modify memory directly. Only an initial
@@ -573,6 +589,19 @@ static inline bool memory_region_is_ram(MemoryRegion *mr)
}
/**
+ * memory_region_is_reserved_iova: check whether a memory region corresponds to
+ reserved iova
+ *
+ * Returns %true is a memory region is reserved iova
+ *
+ * @mr: the memory region being queried
+ */
+static inline bool memory_region_is_reserved_iova(MemoryRegion *mr)
+{
+ return mr->reserved_iova;
+}
+
+/**
* memory_region_is_skip_dump: check whether a memory region should not be
* dumped
*
diff --git a/memory.c b/memory.c
index 58f9269..00a0ebe 100644
--- a/memory.c
+++ b/memory.c
@@ -1309,6 +1309,17 @@ void memory_region_init_ram(MemoryRegion *mr,
mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
}
+void memory_region_init_reserved_iova(MemoryRegion *mr,
+ Object *owner,
+ const char *name,
+ uint64_t size,
+ Error **errp)
+{
+ memory_region_init(mr, owner, name, size);
+ mr->reserved_iova = true;
+ mr->terminates = true;
+}
+
void memory_region_init_resizeable_ram(MemoryRegion *mr,
Object *owner,
const char *name,
--
1.9.1
next prev parent reply other threads:[~2016-10-17 19:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 19:38 [Qemu-devel] [RFC v5 0/8] KVM PCI/MSI passthrough with mach-virt Eric Auger
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 1/8] linux-headers: Partial update for MSI IOVA handling Eric Auger
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 2/8] hw: vfio: common: vfio_get_iommu_type1_info Eric Auger
2016-10-17 19:38 ` Eric Auger [this message]
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 4/8] memory: memory_region_find_by_name Eric Auger
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 5/8] hw: platform-bus: Enable to map any memory region onto the platform-bus Eric Auger
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 6/8] hw: platform-bus: Add platform bus stub Eric Auger
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 7/8] hw: vfio: common: vfio_prepare_msi_mapping Eric Auger
2016-10-17 19:38 ` [Qemu-devel] [RFC v5 8/8] hw: vfio: common: Adapt vfio_listeners for reserved_iova region Eric Auger
2016-10-17 20:16 ` [Qemu-devel] [RFC v5 0/8] KVM PCI/MSI passthrough with mach-virt no-reply
2016-10-17 20:56 ` Auger Eric
2016-10-18 5:49 ` Fam Zheng
2016-10-18 13:34 ` Fam Zheng
2016-10-18 13:49 ` Auger Eric
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=1476733110-14293-4-git-send-email-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=Bharat.Bhushan@freescale.com \
--cc=alex.williamson@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=diana.craciun@freescale.com \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=fkan@apm.com \
--cc=peter.maydell@linaro.org \
--cc=pranav.sawargaonkar@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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).