allow dom0 to map xen's memory.
# HG changeset patch
# User Kouya Shimura <kouya@xxxxxxxxxxxxxx>
# Date 1200914420 -32400
# Node ID dc1d6b4bae38325b3faafc534dcb4f50152b9b29
# Parent ff90abf572f2d5aa7d4a7f764b3c343b66a06210
allow dom0 to map xen's memory.
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
diff -r ff90abf572f2 -r dc1d6b4bae38 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk Fri Jan 18 14:11:20 2008 -0700
+++ b/xen/arch/ia64/Rules.mk Mon Jan 21 20:20:20 2008 +0900
@@ -13,6 +13,7 @@ xen_ia64_tlb_track ?= y
xen_ia64_tlb_track ?= y
xen_ia64_tlb_track_cnt ?= n
xen_ia64_tlbflush_clock ?= y
+xen_ia64_debug_xen ?= y
ifneq ($(COMPILE_ARCH),$(TARGET_ARCH))
CROSS_COMPILE ?= /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-
@@ -59,6 +60,9 @@ ifeq ($(xen_ia64_tlbflush_clock),y)
ifeq ($(xen_ia64_tlbflush_clock),y)
CFLAGS += -DCONFIG_XEN_IA64_TLBFLUSH_CLOCK
endif
+ifeq ($(xen_ia64_debug_xen),y)
+CFLAGS += -DCONFIG_XEN_IA64_DEBUG_XEN
+endif
ifeq ($(no_warns),y)
CFLAGS += -Wa,--fatal-warnings -Werror -Wno-uninitialized
endif
diff -r ff90abf572f2 -r dc1d6b4bae38 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c Fri Jan 18 14:11:20 2008 -0700
+++ b/xen/arch/ia64/xen/mm.c Mon Jan 21 20:20:20 2008 +0900
@@ -1403,6 +1403,13 @@ zap_domain_page_one(struct domain *d, un
if (pte_none(*pte))
return;
+#ifdef CONFIG_XEN_IA64_DEBUG_XEN
+ if (d == dom0 && pte->pte & _PAGE_DEBUG_XEN) {
+ old_pte = ptep_get_and_clear(mm, mpaddr, pte);
+ return;
+ }
+#endif
+
if (mfn == INVALID_MFN) {
// clear pte
old_pte = ptep_get_and_clear(mm, mpaddr, pte);
@@ -1512,6 +1519,35 @@ __dom0vp_add_physmap(struct domain* d, u
//don't update p2m table because this page belongs to rd, not d.
perfc_incr(dom0vp_add_physmap);
out1:
+#ifdef CONFIG_XEN_IA64_DEBUG_XEN
+ if (unlikely(error != 0 && domid == DOMID_XEN)) {
+ unsigned long va = mfn << PAGE_SHIFT;
+
+ if ((va - KERNEL_START < KERNEL_TR_PAGE_SIZE) ||
+ (va - PERCPU_ADDR < PERCPU_PAGE_SIZE)) {
+ mfn = ia64_tpa(va) >> PAGE_SHIFT;
+ }
+#ifdef CONFIG_VIRTUAL_FRAME_TABLE
+ else if (va >= VIRT_FRAME_TABLE_ADDR && va < VIRT_FRAME_TABLE_END) {
+ extern long ia64_frametable_probe(unsigned long);
+ if (!ia64_frametable_probe(va))
+ return -EINVAL;
+ mfn = ia64_tpa(va) >> PAGE_SHIFT;
+ }
+#endif
+ else if (va - HYPERVISOR_VIRT_START < (1UL << IA64_MAX_PHYS_BITS)) {
+ if (!virt_addr_valid(va))
+ return -EINVAL;
+ mfn = virt_to_mfn(va);
+ }
+ else
+ return -EINVAL;
+
+ mfn |= (_PAGE_DEBUG_XEN >> PAGE_SHIFT);
+ assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, flags);
+ error = 0;
+ }
+#endif
rcu_unlock_domain(rd);
return error;
}
diff -r ff90abf572f2 -r dc1d6b4bae38
xen/include/asm-ia64/linux-xen/asm/pgtable.h
--- a/xen/include/asm-ia64/linux-xen/asm/pgtable.h Fri Jan 18 14:11:20
2008 -0700
+++ b/xen/include/asm-ia64/linux-xen/asm/pgtable.h Mon Jan 21 20:20:20
2008 +0900
@@ -97,6 +97,12 @@
#define _PAGE_PGC_ALLOCATED_BIT 59 /* _PGC_allocated */
#define _PAGE_PGC_ALLOCATED (__IA64_UL(1) << _PAGE_PGC_ALLOCATED_BIT)
+
+#ifdef CONFIG_XEN_IA64_DEBUG_XEN
+#define _PAGE_DEBUG_XEN_BIT 60
+#define _PAGE_DEBUG_XEN (__IA64_UL(1) << _PAGE_DEBUG_XEN_BIT)
+#endif
+
/* domVTI */
#define GPFN_MEM (0UL << 60) /* Guest pfn is normal mem */
#define GPFN_FRAME_BUFFER (1UL << 60) /* VGA framebuffer */
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|