WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Introduce XENFEAT_writable_mmu_structures.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Introduce XENFEAT_writable_mmu_structures.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Jan 2006 15:34:08 +0000
Delivery-date: Fri, 27 Jan 2006 15:44:03 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian.Campbell@xxxxxxxxxxxxx
# Node ID 0eb38397e60845e72c60fbf0820c65491262d250
# Parent  31083f13ae47f55bc86407450c37eb1e6d8656e7
Introduce XENFEAT_writable_mmu_structures.

This feature flag indicates to the guest that it is allowable to
use writable LDT, GDT and page table pages.

Signed-off-by: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Index: xen-features/xen/include/public/version.h
===================================================================
--- xen-features.orig/xen/include/public/version.h      2006-01-27 
11:27:14.000000000 +0000
+++ xen-features/xen/include/public/version.h   2006-01-27 11:27:14.000000000 
+0000
@@ -45,6 +45,9 @@
     uint32_t     submap;        /* OUT: 32-bit submap */
 } xen_feature_info_t;

+#define _XENFEAT_writable_mmu_structures 0
+#define XENFEAT_writable_mmu_structures (1UL<<_XENFEAT_writable_mmu_structures)
+
 #define XENFEAT_NR_SUBMAPS 1

 #endif /* __XEN_PUBLIC_VERSION_H__ */
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c   
2006-01-27 11:27:14.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c        
2006-01-27 11:27:14.000000000 +0000
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 #include <asm/mmu_context.h>

+#include <asm-xen/features.h>
 #include <asm-xen/foreign_page.h>
 #include <asm/hypervisor.h>

@@ -391,24 +392,42 @@
 #ifndef CONFIG_XEN_SHADOW_MODE
 void make_lowmem_mmu_page_readonly(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_wrprotect(*pte), 0);
        BUG_ON(rc);
 }

 void make_lowmem_mmu_page_writable(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_mkwrite(*pte), 0);
        BUG_ON(rc);
 }

 void make_mmu_page_readonly(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_wrprotect(*pte), 0);
        if (rc) /* fallback? */
                xen_l1_entry_update(pte, pte_wrprotect(*pte));
@@ -426,8 +445,14 @@

 void make_mmu_page_writable(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_mkwrite(*pte), 0);
        if (rc) /* fallback? */
                xen_l1_entry_update(pte, pte_mkwrite(*pte));
@@ -443,6 +468,9 @@

 void make_mmu_pages_readonly(void *va, unsigned int nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
+
        while (nr-- != 0) {
                make_mmu_page_readonly(va);
                va = (void *)((unsigned long)va + PAGE_SIZE);
@@ -451,6 +479,8 @@

 void make_mmu_pages_writable(void *va, unsigned int nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
        while (nr-- != 0) {
                make_mmu_page_writable(va);
                va = (void *)((unsigned long)va + PAGE_SIZE);
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c    
2006-01-27 11:27:14.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c 2006-01-27 
11:27:18.000000000 +0000
@@ -40,6 +40,8 @@
 #include <asm/proto.h>
 #include <asm/smp.h>

+#include <asm-xen/features.h>
+
 #ifndef Dprintk
 #define Dprintk(x...)
 #endif
@@ -72,6 +74,9 @@
        pte_t pte, *ptep;
        unsigned long *page = (unsigned long *) init_level4_pgt;

+       if (xen_feature(writable_mmu_structures))
+               return;
+
        addr = (unsigned long) page[pgd_index(_va)];
        addr_to_page(addr, page);

@@ -93,6 +98,9 @@
        pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
        unsigned long addr = (unsigned long) va;

+       if (xen_feature(writable_mmu_structures))
+               return;
+
        pgd = pgd_offset_k(addr);
        pud = pud_offset(pgd, addr);
        pmd = pmd_offset(pud, addr);
@@ -111,6 +119,9 @@
        pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
        unsigned long addr = (unsigned long) va;

+       if (xen_feature(writable_mmu_structures))
+               return;
+
        pgd = pgd_offset_k(addr);
        pud = pud_offset(pgd, addr);
        pmd = pmd_offset(pud, addr);
@@ -126,6 +137,9 @@

 void make_mmu_pages_readonly(void *va, unsigned nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
+
        while (nr-- != 0) {
                make_mmu_page_readonly(va);
                va = (void*)((unsigned long)va + PAGE_SIZE);
@@ -134,6 +148,8 @@

 void make_mmu_pages_writable(void *va, unsigned nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
        while (nr-- != 0) {
                make_mmu_page_writable(va);
                va = (void*)((unsigned long)va + PAGE_SIZE);
@@ -385,6 +401,9 @@
 {
        int readonly = 0;

+       if (xen_feature(writable_mmu_structures))
+               return 0;
+
        /* Make old and new page tables read-only. */
        if ((paddr >= (xen_start_info->pt_base - __START_KERNEL_map))
            && (paddr < ((table_start << PAGE_SHIFT) + tables_space)))

diff -r 31083f13ae47 -r 0eb38397e608 
linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c   Fri Jan 27 11:31:12 2006
+++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c   Fri Jan 27 11:31:14 2006
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 #include <asm/mmu_context.h>
 
+#include <asm-xen/features.h>
 #include <asm-xen/foreign_page.h>
 #include <asm/hypervisor.h>
 
@@ -391,24 +392,42 @@
 #ifndef CONFIG_XEN_SHADOW_MODE
 void make_lowmem_mmu_page_readonly(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_wrprotect(*pte), 0);
        BUG_ON(rc);
 }
 
 void make_lowmem_mmu_page_writable(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_mkwrite(*pte), 0);
        BUG_ON(rc);
 }
 
 void make_mmu_page_readonly(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_wrprotect(*pte), 0);
        if (rc) /* fallback? */
                xen_l1_entry_update(pte, pte_wrprotect(*pte));
@@ -426,8 +445,14 @@
 
 void make_mmu_page_writable(void *va)
 {
-       pte_t *pte = virt_to_ptep(va);
-       int rc = HYPERVISOR_update_va_mapping(
+       pte_t *pte;
+       int rc;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
+
+       pte = virt_to_ptep(va);
+       rc = HYPERVISOR_update_va_mapping(
                (unsigned long)va, pte_mkwrite(*pte), 0);
        if (rc) /* fallback? */
                xen_l1_entry_update(pte, pte_mkwrite(*pte));
@@ -443,6 +468,9 @@
 
 void make_mmu_pages_readonly(void *va, unsigned int nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
+
        while (nr-- != 0) {
                make_mmu_page_readonly(va);
                va = (void *)((unsigned long)va + PAGE_SIZE);
@@ -451,6 +479,8 @@
 
 void make_mmu_pages_writable(void *va, unsigned int nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
        while (nr-- != 0) {
                make_mmu_page_writable(va);
                va = (void *)((unsigned long)va + PAGE_SIZE);
diff -r 31083f13ae47 -r 0eb38397e608 
linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c    Fri Jan 27 11:31:12 2006
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c    Fri Jan 27 11:31:14 2006
@@ -40,6 +40,8 @@
 #include <asm/proto.h>
 #include <asm/smp.h>
 
+#include <asm-xen/features.h>
+
 #ifndef Dprintk
 #define Dprintk(x...)
 #endif
@@ -72,6 +74,9 @@
        pte_t pte, *ptep;
        unsigned long *page = (unsigned long *) init_level4_pgt;
 
+       if (xen_feature(writable_mmu_structures))
+               return;
+
        addr = (unsigned long) page[pgd_index(_va)];
        addr_to_page(addr, page);
 
@@ -92,6 +97,9 @@
 {
        pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
        unsigned long addr = (unsigned long) va;
+
+       if (xen_feature(writable_mmu_structures))
+               return;
 
        pgd = pgd_offset_k(addr);
        pud = pud_offset(pgd, addr);
@@ -111,6 +119,9 @@
        pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
        unsigned long addr = (unsigned long) va;
 
+       if (xen_feature(writable_mmu_structures))
+               return;
+
        pgd = pgd_offset_k(addr);
        pud = pud_offset(pgd, addr);
        pmd = pmd_offset(pud, addr);
@@ -126,6 +137,9 @@
 
 void make_mmu_pages_readonly(void *va, unsigned nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
+
        while (nr-- != 0) {
                make_mmu_page_readonly(va);
                va = (void*)((unsigned long)va + PAGE_SIZE);
@@ -134,6 +148,8 @@
 
 void make_mmu_pages_writable(void *va, unsigned nr)
 {
+       if (xen_feature(writable_mmu_structures))
+               return;
        while (nr-- != 0) {
                make_mmu_page_writable(va);
                va = (void*)((unsigned long)va + PAGE_SIZE);
@@ -384,6 +400,9 @@
 static inline int make_readonly(unsigned long paddr)
 {
        int readonly = 0;
+
+       if (xen_feature(writable_mmu_structures))
+               return 0;
 
        /* Make old and new page tables read-only. */
        if ((paddr >= (xen_start_info->pt_base - __START_KERNEL_map))
diff -r 31083f13ae47 -r 0eb38397e608 xen/include/public/version.h
--- a/xen/include/public/version.h      Fri Jan 27 11:31:12 2006
+++ b/xen/include/public/version.h      Fri Jan 27 11:31:14 2006
@@ -45,6 +45,9 @@
     uint32_t     submap;        /* OUT: 32-bit submap */
 } xen_feature_info_t;
 
+#define _XENFEAT_writable_mmu_structures 0
+#define XENFEAT_writable_mmu_structures (1UL<<_XENFEAT_writable_mmu_structures)
+
 #define XENFEAT_NR_SUBMAPS 1
 
 #endif /* __XEN_PUBLIC_VERSION_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Introduce XENFEAT_writable_mmu_structures., Xen patchbot -unstable <=