Skip to contentSkip to conversation

pvh: add rwmem_ranges to keep mapped special regions

RFC PATCH In review Elena Ufimtseva 2 participants 2 messages Feb 13, 2015 – Feb 17, 2015

lore
Share & tools
lore
#0 lore raw

RFC PATCH 3/5 pvh: add rwmem_ranges to keep mapped special regions

Patch adds rwmem_ranges in arch_hvm_iommu to keep specail regions specified by dom0_iommu_rwmem boot option.
These special regions mapped with p2m_sys_rw type introduced in the previous patch.

TODO:
- specify mapped flag in rwmem_range struct to indicte that actual mapping was successful;

---
 xen/drivers/passthrough/x86/iommu.c |    1 +
 xen/include/asm-x86/hvm/iommu.h     |    2 ++
 xen/include/xen/iommu.h             |    5 +++++
 3 files changed, 8 insertions(+)
xen/drivers/passthrough/x86/iommu.c +1 -0
index 52d8948..2e266a7 100644
@@ -118,6 +118,7 @@ int arch_iommu_domain_init(struct domain *d)
     spin_lock_init(&hd->arch.mapping_lock);
     INIT_LIST_HEAD(&hd->arch.g2m_ioport_list);
     INIT_LIST_HEAD(&hd->arch.mapped_rmrrs);
+    INIT_LIST_HEAD(&hd->arch.rwmem_ranges);
 
     return 0;
 }
xen/include/asm-x86/hvm/iommu.h +2 -0
index 46cb126..3261b5c 100644
@@ -2,6 +2,7 @@
 #define __ASM_X86_HVM_IOMMU_H__
 
 #include <xen/errno.h>
+#include <xen/iommu.h>
 
 struct iommu_ops;
 extern const struct iommu_ops intel_iommu_ops;
@@ -54,6 +55,7 @@ struct arch_hvm_iommu
     struct list_head g2m_ioport_list;   /* guest to machine ioport mapping */
     u64 iommu_bitmap;              /* bitmap of iommu(s) that the domain uses */
     struct list_head mapped_rmrrs;
+    struct list_head rwmem_ranges;
 
     /* amd iommu support */
     int paging_mode;
xen/include/xen/iommu.h +5 -0
index 8eb764a..a5762e0 100644
@@ -191,4 +191,9 @@ DECLARE_PER_CPU(bool_t, iommu_dont_flush_iotlb);
 extern struct spinlock iommu_pt_cleanup_lock;
 extern struct page_list_head iommu_pt_cleanup_list;
 
+struct rwmem_range {
+    struct list_head list;
+    u64 start, end;
+};
+
 #endif /* _IOMMU_H_ */
Signature · 1 line
1.7.10.4
#1 lore raw

xen/include/asm-x86/hvm/iommu.h line 5

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 13.02.15 at 19:52, <[email protected]> wrote:
xen/include/asm-x86/hvm/iommu.h +1 -0
@@ -2,6 +2,7 @@
 #define __ASM_X86_HVM_IOMMU_H__
 
 #include <xen/errno.h>
+#include <xen/iommu.h>

Why?

xen/include/xen/iommu.h DECLARE_PER_CPU(bool_t, iommu_dont_flush_iotlb); · line 197

Quoted 10 lines
xen/include/xen/iommu.h +4 -0
@@ -191,4 +191,9 @@ DECLARE_PER_CPU(bool_t, iommu_dont_flush_iotlb);
 extern struct spinlock iommu_pt_cleanup_lock;
 extern struct page_list_head iommu_pt_cleanup_list;
 
+struct rwmem_range {
+    struct list_head list;
+    u64 start, end;
+};

Without this being used anywhere you leave us to guess what the fields are for. I think patches 2, 3, and at least 4 are unhelpful to be split apart.

Jan