xen.git
19 years agoRemove shadow-translate Linux patches for now. We'll merge this stuff
kaf24@firebug.cl.cam.ac.uk [Sat, 28 Jan 2006 11:09:45 +0000 (12:09 +0100)]
Remove shadow-translate Linux patches for now. We'll merge this stuff
in piecemeal.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoFix build.
sos22@douglas.cl.cam.ac.uk [Sat, 28 Jan 2006 10:09:18 +0000 (11:09 +0100)]
Fix build.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMerge.
sos22@douglas.cl.cam.ac.uk [Fri, 27 Jan 2006 21:18:15 +0000 (22:18 +0100)]
Merge.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoTurn down debug a bit, and generally tidy hings up a little.
sos22@douglas.cl.cam.ac.uk [Fri, 27 Jan 2006 20:57:07 +0000 (21:57 +0100)]
Turn down debug a bit, and generally tidy hings up a little.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoBug fix: we need to eagerly synchronise th HL2, since Xen relies on it
sos22@douglas.cl.cam.ac.uk [Fri, 27 Jan 2006 20:38:55 +0000 (21:38 +0100)]
Bug fix: we need to eagerly synchronise th HL2, since Xen relies on it
(via the guest linear table), and faults to that don't get sent to the
shadow mode infrastructure, and so we can't do it lazily.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMerge up and generally make shadow mode be nice.
sos22@douglas.cl.cam.ac.uk [Fri, 27 Jan 2006 20:23:06 +0000 (21:23 +0100)]
Merge up and generally make shadow mode be nice.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoAdd hypercall-declaring header files.
kaf24@firebug.cl.cam.ac.uk [Fri, 27 Jan 2006 15:17:38 +0000 (16:17 +0100)]
Add hypercall-declaring header files.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoUniform definition of do_iret prototype. Use 'struct foo'
kaf24@firebug.cl.cam.ac.uk [Fri, 27 Jan 2006 15:16:52 +0000 (16:16 +0100)]
Uniform definition of do_iret prototype. Use 'struct foo'
in various places instead of 'foo_t'.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoCheckin missing hunks from previous commit
Ian.Campbell@xensource.com [Fri, 27 Jan 2006 14:24:50 +0000 (14:24 +0000)]
Checkin missing hunks from previous commit

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
19 years agomerge
Ian.Campbell@xensource.com [Fri, 27 Jan 2006 11:51:57 +0000 (11:51 +0000)]
merge

19 years agoNew memory hypercall 'populate_physmap'. Accepts a list of
kaf24@firebug.cl.cam.ac.uk [Fri, 27 Jan 2006 11:49:47 +0000 (12:49 +0100)]
New memory hypercall 'populate_physmap'. Accepts a list of
pseudophys frame numbers to be populated with memory.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoNeed to include module.h to get EXPORT_SYMBOL macros.
kaf24@firebug.cl.cam.ac.uk [Fri, 27 Jan 2006 11:48:32 +0000 (12:48 +0100)]
Need to include module.h to get EXPORT_SYMBOL macros.
Export xen driver util functions with GPL tag.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoIntroduce XENFEAT_writable_mmu_structures.
Ian.Campbell@xensource.com [Fri, 27 Jan 2006 11:31:14 +0000 (11:31 +0000)]
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@XenSource.com>
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)))

19 years agoAdd XENVER_get_features sub-operation to HYPERVISOR_xen_version.
Ian.Campbell@xensource.com [Fri, 27 Jan 2006 11:31:12 +0000 (11:31 +0000)]
Add XENVER_get_features sub-operation to HYPERVISOR_xen_version.

This operation allows a guest OS to determine which features are
supported by the running version of Xen. This changeset contains the
base infrastructure but does not implement any features yet.

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c 2006-01-27 11:13:22.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c 2006-01-27 11:27:14.000000000 +0000
@@ -56,6 +56,7 @@
 #include <asm/hypervisor.h>
 #include <asm-xen/xen-public/physdev.h>
 #include <asm-xen/xen-public/memory.h>
+#include <asm-xen/features.h>
 #include "setup_arch_pre.h"
 #include <bios_ebda.h>

@@ -1591,6 +1592,9 @@
  rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
  rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
 #endif
+
+ setup_xen_features();
+
  ARCH_SETUP
  if (efi_enabled)
  efi_init();
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c 2006-01-27 11:13:22.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c 2006-01-27 11:27:14.000000000 +0000
@@ -63,6 +63,7 @@
 #include "setup_arch_pre.h"
 #include <asm/hypervisor.h>
 #include <asm-xen/xen-public/nmi.h>
+#include <asm-xen/features.h>
 #define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
 #define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
 #define end_pfn_map end_pfn
@@ -587,6 +588,8 @@

 #endif

+ setup_xen_features();
+
  HYPERVISOR_vm_assist(VMASST_CMD_enable,
       VMASST_TYPE_writable_pagetables);

Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/features.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/features.h 2006-01-27 11:27:14.000000000 +0000
@@ -0,0 +1,20 @@
+/******************************************************************************
+ * features.h
+ *
+ * Query the features reported by Xen.
+ *
+ * Copyright (c) 2006, Ian Campbell
+ */
+
+#ifndef __ASM_XEN_FEATURES_H__
+#define __ASM_XEN_FEATURES_H__
+
+#include <asm-xen/xen-public/version.h>
+
+extern void setup_xen_features(void);
+
+extern unsigned long xen_features[XENFEAT_NR_SUBMAPS];
+
+#define xen_feature(flag) (test_bit(_XENFEAT_ ## flag, xen_features))
+
+#endif
Index: xen-features/xen/common/kernel.c
===================================================================
--- xen-features.orig/xen/common/kernel.c 2006-01-27 11:13:22.000000000 +0000
+++ xen-features/xen/common/kernel.c 2006-01-27 11:27:34.000000000 +0000
@@ -144,6 +144,28 @@
             return -EFAULT;
         return 0;
     }
+
+    case XENVER_get_features:
+    {
+        xen_feature_info_t fi;
+
+        if ( copy_from_user(&fi, arg, sizeof(fi)) )
+            return -EFAULT;
+
+        switch ( fi.submap_idx )
+        {
+        case 0:
+            fi.submap = 0;
+            break;
+        default:
+            return -EINVAL;
+        }
+
+        if ( copy_to_user(arg, &fi, sizeof(fi)) )
+            return -EFAULT;
+        return 0;
+    }
+
     }

     return -ENOSYS;
Index: xen-features/xen/include/public/version.h
===================================================================
--- xen-features.orig/xen/include/public/version.h 2006-01-27 11:13:22.000000000 +0000
+++ xen-features/xen/include/public/version.h 2006-01-27 11:27:22.000000000 +0000
@@ -39,6 +39,14 @@
     unsigned long virt_start;
 } xen_platform_parameters_t;

+#define XENVER_get_features 6
+typedef struct xen_feature_info {
+    unsigned int submap_idx;    /* IN: which 32-bit submap to return */
+    uint32_t     submap;        /* OUT: 32-bit submap */
+} xen_feature_info_t;
+
+#define XENFEAT_NR_SUBMAPS 1
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */

 /*
Index: xen-features/linux-2.6-xen-sparse/arch/xen/kernel/features.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/kernel/features.c 2006-01-27 11:27:14.000000000 +0000
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * features.c
+ *
+ * Xen feature flags.
+ *
+ * Copyright (c) 2006, Ian Campbell
+ */
+#include <linux/types.h>
+#include <linux/cache.h>
+#include <asm/hypervisor.h>
+#include <asm-xen/features.h>
+
+/* When we rebase to a more recent version of Linux we can use __read_mostly here. */
+unsigned long xen_features[XENFEAT_NR_SUBMAPS] __cacheline_aligned;
+
+void setup_xen_features(void)
+{
+     uint32_t *flags = (uint32_t *)&xen_features[0];
+     xen_feature_info_t fi;
+     int i;
+
+     for (i=0; i<XENFEAT_NR_SUBMAPS; i++) {
+   fi.submap_idx = i;
+   if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
+        break;
+   flags[i] = fi.submap;
+     }
+}
+

19 years agoRename funtions
Ian.Campbell@xensource.com [Fri, 27 Jan 2006 11:29:42 +0000 (11:29 +0000)]
Rename funtions
    early_make_page_readonly() (x86/64)
    make_lowmem_page_readonly() (x86/32)
    make_page_readonly()  (x86)
    make_pages_readonly()  (x86)
    make_page_writable() (x86)
    make_pages_writable() (x86)
to
    early_make_mmu_page_readonly()
    make_lowmem_mmu_page_readonly()
    make_mmu_page_readonly()
    make_mmu_pages_readonly()
    make_mmu_page_writable()
    make_mmu_pages_writable()

These functions are only called by LDT, GDT or page table page
construction, initialisation and destruction functions and in the
future they will behave in a MMU page specific manner.

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h 2006-01-27 10:56:59.000000000 +0000
@@ -413,19 +413,19 @@
 } while (0)

 #ifndef CONFIG_XEN_SHADOW_MODE
-void make_lowmem_page_readonly(void *va);
-void make_lowmem_page_writable(void *va);
-void make_page_readonly(void *va);
-void make_page_writable(void *va);
-void make_pages_readonly(void *va, unsigned int nr);
-void make_pages_writable(void *va, unsigned int nr);
+void make_lowmem_mmu_page_readonly(void *va);
+void make_lowmem_mmu_page_writable(void *va);
+void make_mmu_page_readonly(void *va);
+void make_mmu_page_writable(void *va);
+void make_mmu_pages_readonly(void *va, unsigned int nr);
+void make_mmu_pages_writable(void *va, unsigned int nr);
 #else
-#define make_lowmem_page_readonly(_va) ((void)0)
-#define make_lowmem_page_writable(_va) ((void)0)
-#define make_page_readonly(_va)        ((void)0)
-#define make_page_writable(_va)        ((void)0)
-#define make_pages_readonly(_va, _nr)  ((void)0)
-#define make_pages_writable(_va, _nr)  ((void)0)
+#define make_lowmem_mmu_page_readonly(_va) ((void)0)
+#define make_lowmem_mmu_page_writable(_va)     ((void)0)
+#define make_mmu_page_readonly(_va)        ((void)0)
+#define make_mmu_page_writable(_va)            ((void)0)
+#define make_mmu_pages_readonly(_va, _nr)  ((void)0)
+#define make_mmu_pages_writable(_va, _nr)      ((void)0)
 #endif

 #define virt_to_ptep(__va) \
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c 2006-01-27 10:18:19.000000000 +0000
@@ -572,7 +572,7 @@
       va < gdt_descr->address + gdt_descr->size;
       va += PAGE_SIZE, f++) {
  frames[f] = virt_to_mfn(va);
- make_lowmem_page_readonly((void *)va);
+ make_lowmem_mmu_page_readonly((void *)va);
  }
  if (HYPERVISOR_set_gdt(frames, gdt_descr->size / 8))
  BUG();
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c 2006-01-27 10:56:59.000000000 +0000
@@ -59,8 +59,8 @@
  cpumask_t mask;
  preempt_disable();
 #endif
- make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
-     PAGE_SIZE);
+ make_mmu_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
  load_LDT(pc);
 #ifdef CONFIG_SMP
  mask = cpumask_of_cpu(smp_processor_id());
@@ -70,7 +70,7 @@
 #endif
  }
  if (oldsize) {
- make_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
+ make_mmu_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
  PAGE_SIZE);
  if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
  vfree(oldldt);
@@ -86,8 +86,8 @@
  if (err < 0)
  return err;
  memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
- make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
-     PAGE_SIZE);
+ make_mmu_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
  return 0;
 }

@@ -119,9 +119,9 @@
  if (mm->context.size) {
  if (mm == current->active_mm)
  clear_LDT();
- make_pages_writable(mm->context.ldt,
-     (mm->context.size * LDT_ENTRY_SIZE) /
-     PAGE_SIZE);
+ make_mmu_pages_writable(mm->context.ldt,
+ (mm->context.size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
  if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
  vfree(mm->context.ldt);
  else
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c 2006-01-27 10:18:19.000000000 +0000
@@ -68,7 +68,7 @@

 #ifdef CONFIG_X86_PAE
  pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- make_lowmem_page_readonly(pmd_table);
+ make_lowmem_mmu_page_readonly(pmd_table);
  set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
  pud = pud_offset(pgd, 0);
  if (pmd_table != pmd_offset(pud, 0))
@@ -89,7 +89,7 @@
 {
  if (pmd_none(*pmd)) {
  pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- make_lowmem_page_readonly(page_table);
+ make_lowmem_mmu_page_readonly(page_table);
  set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
  if (page_table != pte_offset_kernel(pmd, 0))
  BUG();
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 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c 2006-01-27 11:01:11.000000000 +0000
@@ -198,7 +198,7 @@
 {
  pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
  if (pte)
- make_lowmem_page_readonly(pte);
+ make_lowmem_mmu_page_readonly(pte);
  return pte;
 }

@@ -344,7 +344,7 @@
  pmd_t *kpmd = pmd_offset(kpud, v);
  pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
  memcpy(pmd, kpmd, PAGE_SIZE);
- make_lowmem_page_readonly(pmd);
+ make_lowmem_mmu_page_readonly(pmd);
  }
  pgd_list_add(pgd);
  spin_unlock_irqrestore(&pgd_lock, flags);
@@ -378,7 +378,7 @@
  spin_unlock_irqrestore(&pgd_lock, flags);
  for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
  pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
- make_lowmem_page_writable(pmd);
+ make_lowmem_mmu_page_writable(pmd);
  memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
  kmem_cache_free(pmd_cache, pmd);
  }
@@ -389,7 +389,7 @@
 }

 #ifndef CONFIG_XEN_SHADOW_MODE
-void make_lowmem_page_readonly(void *va)
+void make_lowmem_mmu_page_readonly(void *va)
 {
  pte_t *pte = virt_to_ptep(va);
  int rc = HYPERVISOR_update_va_mapping(
@@ -397,7 +397,7 @@
  BUG_ON(rc);
 }

-void make_lowmem_page_writable(void *va)
+void make_lowmem_mmu_page_writable(void *va)
 {
  pte_t *pte = virt_to_ptep(va);
  int rc = HYPERVISOR_update_va_mapping(
@@ -405,7 +405,7 @@
  BUG_ON(rc);
 }

-void make_page_readonly(void *va)
+void make_mmu_page_readonly(void *va)
 {
  pte_t *pte = virt_to_ptep(va);
  int rc = HYPERVISOR_update_va_mapping(
@@ -419,12 +419,12 @@
  kmap_flush_unused(); /* flush stale writable kmaps */
  else
 #endif
- make_lowmem_page_readonly(
+ make_lowmem_mmu_page_readonly(
  phys_to_virt(pfn << PAGE_SHIFT));
  }
 }

-void make_page_writable(void *va)
+void make_mmu_page_writable(void *va)
 {
  pte_t *pte = virt_to_ptep(va);
  int rc = HYPERVISOR_update_va_mapping(
@@ -436,23 +436,23 @@
 #ifdef CONFIG_HIGHMEM
  if (pfn < highstart_pfn)
 #endif
- make_lowmem_page_writable(
+ make_lowmem_mmu_page_writable(
  phys_to_virt(pfn << PAGE_SHIFT));
  }
 }

-void make_pages_readonly(void *va, unsigned int nr)
+void make_mmu_pages_readonly(void *va, unsigned int nr)
 {
  while (nr-- != 0) {
- make_page_readonly(va);
+ make_mmu_page_readonly(va);
  va = (void *)((unsigned long)va + PAGE_SIZE);
  }
 }

-void make_pages_writable(void *va, unsigned int nr)
+void make_mmu_pages_writable(void *va, unsigned int nr)
 {
  while (nr-- != 0) {
- make_page_writable(va);
+ make_mmu_page_writable(va);
  va = (void *)((unsigned long)va + PAGE_SIZE);
  }
 }
Index: xen-features/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c 2006-01-27 10:18:19.000000000 +0000
@@ -239,7 +239,7 @@
  memcpy((void *)cpu_gdt_descr[cpu].address,
         (void *)cpu_gdt_descr[0].address,
         cpu_gdt_descr[0].size);
- make_page_readonly((void *)cpu_gdt_descr[cpu].address);
+ make_mmu_page_readonly((void *)cpu_gdt_descr[cpu].address);

  cpu_set(cpu, cpu_possible_map);
 #ifdef CONFIG_HOTPLUG_CPU
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c 2006-01-27 10:56:59.000000000 +0000
@@ -65,8 +65,8 @@

  preempt_disable();
 #endif
- make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
-     PAGE_SIZE);
+ make_mmu_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
  load_LDT(pc);
 #ifdef CONFIG_SMP
  mask = cpumask_of_cpu(smp_processor_id());
@@ -76,7 +76,7 @@
 #endif
  }
  if (oldsize) {
- make_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
+ make_mmu_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
  PAGE_SIZE);
  if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
  vfree(oldldt);
@@ -92,8 +92,8 @@
  if (err < 0)
  return err;
  memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
- make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
-     PAGE_SIZE);
+ make_mmu_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
  return 0;
 }

@@ -131,9 +131,9 @@
  if (mm->context.size) {
  if (mm == current->active_mm)
  clear_LDT();
- make_pages_writable(mm->context.ldt,
-     (mm->context.size * LDT_ENTRY_SIZE) /
-     PAGE_SIZE);
+ make_mmu_pages_writable(mm->context.ldt,
+ (mm->context.size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
  if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
  vfree(mm->context.ldt);
  else
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c 2006-01-27 10:18:19.000000000 +0000
@@ -141,7 +141,7 @@
       va < gdt_descr->address + gdt_descr->size;
       va += PAGE_SIZE, f++) {
  frames[f] = virt_to_mfn(va);
- make_page_readonly((void *)va);
+ make_mmu_page_readonly((void *)va);
  }
  if (HYPERVISOR_set_gdt(frames, gdt_descr->size /
                                sizeof (struct desc_struct)))
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 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c 2006-01-27 11:01:11.000000000 +0000
@@ -66,7 +66,7 @@
  (((mfn_to_pfn((addr) >> PAGE_SHIFT)) << PAGE_SHIFT) + \
  __START_KERNEL_map)))

-static void early_make_page_readonly(void *va)
+static void early_make_mmu_page_readonly(void *va)
 {
  unsigned long addr, _va = (unsigned long)va;
  pte_t pte, *ptep;
@@ -88,7 +88,7 @@
  BUG();
 }

-void make_page_readonly(void *va)
+void make_mmu_page_readonly(void *va)
 {
  pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
  unsigned long addr = (unsigned long) va;
@@ -103,10 +103,10 @@
  xen_l1_entry_update(ptep, pte); /* fallback */

  if ((addr >= VMALLOC_START) && (addr < VMALLOC_END))
- make_page_readonly(__va(pte_pfn(pte) << PAGE_SHIFT));
+ make_mmu_page_readonly(__va(pte_pfn(pte) << PAGE_SHIFT));
 }

-void make_page_writable(void *va)
+void make_mmu_page_writable(void *va)
 {
  pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
  unsigned long addr = (unsigned long) va;
@@ -121,21 +121,21 @@
  xen_l1_entry_update(ptep, pte); /* fallback */

  if ((addr >= VMALLOC_START) && (addr < VMALLOC_END))
- make_page_writable(__va(pte_pfn(pte) << PAGE_SHIFT));
+ make_mmu_page_writable(__va(pte_pfn(pte) << PAGE_SHIFT));
 }

-void make_pages_readonly(void *va, unsigned nr)
+void make_mmu_pages_readonly(void *va, unsigned nr)
 {
  while (nr-- != 0) {
- make_page_readonly(va);
+ make_mmu_page_readonly(va);
  va = (void*)((unsigned long)va + PAGE_SIZE);
  }
 }

-void make_pages_writable(void *va, unsigned nr)
+void make_mmu_pages_writable(void *va, unsigned nr)
 {
  while (nr-- != 0) {
- make_page_writable(va);
+ make_mmu_page_writable(va);
  va = (void*)((unsigned long)va + PAGE_SIZE);
  }
 }
@@ -223,7 +223,7 @@
  pud = (user_mode ? pud_offset_u(vaddr) : pud_offset(pgd, vaddr));
  if (pud_none(*pud)) {
  pmd = (pmd_t *) spp_getpage();
- make_page_readonly(pmd);
+ make_mmu_page_readonly(pmd);
  xen_pmd_pin(__pa(pmd));
  set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
  if (pmd != pmd_offset(pud, 0)) {
@@ -234,7 +234,7 @@
  pmd = pmd_offset(pud, vaddr);
  if (pmd_none(*pmd)) {
  pte = (pte_t *) spp_getpage();
- make_page_readonly(pte);
+ make_mmu_page_readonly(pte);
  xen_pte_pin(__pa(pte));
  set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
  if (pte != pte_offset_kernel(pmd, 0)) {
@@ -276,7 +276,7 @@
  if (pud_none(*pud)) {

  pmd = (pmd_t *) spp_getpage();
- make_page_readonly(pmd);
+ make_mmu_page_readonly(pmd);
  xen_pmd_pin(__pa(pmd));

  set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
@@ -290,7 +290,7 @@

  if (pmd_none(*pmd)) {
  pte = (pte_t *) spp_getpage();
- make_page_readonly(pte);
+ make_mmu_page_readonly(pte);
  xen_pte_pin(__pa(pte));

  set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
@@ -419,7 +419,7 @@
  }

  pmd = alloc_static_page(&pmd_phys);
- early_make_page_readonly(pmd);
+ early_make_mmu_page_readonly(pmd);
  xen_pmd_pin(pmd_phys);
  set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
        for (j = 0; j < PTRS_PER_PMD; pmd++, j++) {
@@ -448,7 +448,7 @@
  __set_pte(pte, __pte(paddr | _KERNPG_TABLE));
  }
  pte = pte_save;
- early_make_page_readonly(pte);
+ early_make_mmu_page_readonly(pte);
  xen_pte_pin(pte_phys);
  set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE));
  }
@@ -497,11 +497,11 @@
        _KERNPG_TABLE | _PAGE_USER);
  memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);

- early_make_page_readonly(init_level4_pgt);
- early_make_page_readonly(init_level4_user_pgt);
- early_make_page_readonly(level3_kernel_pgt);
- early_make_page_readonly(level3_user_pgt);
- early_make_page_readonly(level2_kernel_pgt);
+ early_make_mmu_page_readonly(init_level4_pgt);
+ early_make_mmu_page_readonly(init_level4_user_pgt);
+ early_make_mmu_page_readonly(level3_kernel_pgt);
+ early_make_mmu_page_readonly(level3_user_pgt);
+ early_make_mmu_page_readonly(level2_kernel_pgt);

  xen_pgd_pin(__pa_symbol(init_level4_pgt));
  xen_pgd_pin(__pa_symbol(init_level4_user_pgt));
@@ -539,7 +539,7 @@
  pmd = (pmd_t *)&page[pmd_index(va)];
  if (pmd_none(*pmd)) {
  pte_page = alloc_static_page(&phys);
- early_make_page_readonly(pte_page);
+ early_make_mmu_page_readonly(pte_page);
  xen_pte_pin(phys);
  set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
  } else {
@@ -586,7 +586,7 @@
  for (; start < end; start = next) {
  unsigned long pud_phys;
  pud_t *pud = alloc_static_page(&pud_phys);
- early_make_page_readonly(pud);
+ early_make_mmu_page_readonly(pud);
  xen_pud_pin(pud_phys);
  next = start + PGDIR_SIZE;
  if (next > end)
@@ -791,11 +791,11 @@
  set_page_count(virt_to_page(addr), 1);
  memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE);
  xen_pte_unpin(__pa(addr));
- make_page_writable(__va(__pa(addr)));
+ make_mmu_page_writable(__va(__pa(addr)));
  /*
   * Make pages from __PAGE_OFFSET address as well
   */
- make_page_writable((void *)addr);
+ make_mmu_page_writable((void *)addr);
  free_page(addr);
  totalram_pages++;
  }
Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgalloc.h
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgalloc.h 2006-01-27 10:18:17.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgalloc.h 2006-01-27 10:56:59.000000000 +0000
@@ -7,10 +7,10 @@
 #include <linux/mm.h>
 #include <asm/io.h> /* for phys_to_virt and page_to_pseudophys */

-void make_page_readonly(void *va);
-void make_page_writable(void *va);
-void make_pages_readonly(void *va, unsigned int nr);
-void make_pages_writable(void *va, unsigned int nr);
+void make_mmu_page_readonly(void *va);
+void make_mmu_page_writable(void *va);
+void make_mmu_pages_readonly(void *va, unsigned int nr);
+void make_mmu_pages_writable(void *va, unsigned int nr);

 #define __user_pgd(pgd) ((pgd) + PTRS_PER_PGD)

@@ -161,7 +161,7 @@
 {
         pte_t *pte = (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
         if (pte)
- make_page_readonly(pte);
+ make_mmu_page_readonly(pte);

  return pte;
 }
@@ -181,7 +181,7 @@
 {
  BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
         xen_pte_unpin(__pa(pte));
-        make_page_writable(pte);
+        make_mmu_page_writable(pte);
  free_page((unsigned long)pte);
 }

Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h 2006-01-27 11:01:53.000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h 2006-01-27 11:02:07.000000000 +0000
@@ -42,7 +42,7 @@
 static inline void pte_free_kernel(pte_t *pte)
 {
  free_page((unsigned long)pte);
- make_page_writable(pte);
+ make_mmu_page_writable(pte);
 }

 extern void pte_free(struct page *pte);

19 years agoFix a silly bug.
sos22@douglas.cl.cam.ac.uk [Thu, 26 Jan 2006 18:52:18 +0000 (19:52 +0100)]
Fix a silly bug.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoCreate a block of reserved PFNs in shadow translate mode guests, and
sos22@douglas.cl.cam.ac.uk [Thu, 26 Jan 2006 18:40:13 +0000 (19:40 +0100)]
Create a block of reserved PFNs in shadow translate mode guests, and
move the shared info and grant table pfns into that block.  This
allows us to remove the get_gnttablist dom0 op, and simplifies the
domain creation code slightly.  Having the reserved block managed by
Xen may also make it slightly easier to handle the case where the
grant table needs to be extended at run time.

Suggested-by: kaf24
Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMerge.
sos22@douglas.cl.cam.ac.uk [Thu, 26 Jan 2006 17:02:21 +0000 (18:02 +0100)]
Merge.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMake SMP guests work in shadow translate mode.
sos22@douglas.cl.cam.ac.uk [Thu, 26 Jan 2006 17:00:40 +0000 (18:00 +0100)]
Make SMP guests work in shadow translate mode.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoExplicitly block attempts to mutate the M2P tables of shadow mode
sos22@douglas.cl.cam.ac.uk [Thu, 26 Jan 2006 13:39:12 +0000 (14:39 +0100)]
Explicitly block attempts to mutate the M2P tables of shadow mode
guests once they're running.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoGet the network interface working in shadow translate mode. This
sos22@douglas.cl.cam.ac.uk [Thu, 26 Jan 2006 13:33:20 +0000 (14:33 +0100)]
Get the network interface working in shadow translate mode.  This
required a few extra __gpfn_to_mfn translations, and also required a
minor change in the grant tables interface: if we're in shadow
translate mode, then shared->frame is supposed to be the pfn you want
to map the new mfn to when accepting a grant transfer, and Xen handles
updating the M2P and P2M tables for you.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMust destroy grant-table maptrack table before pagetables,
kaf24@firebug.cl.cam.ac.uk [Thu, 26 Jan 2006 10:31:28 +0000 (11:31 +0100)]
Must destroy grant-table maptrack table before pagetables,
as the latter hold reference counts that maptrack entries
implicitly rely on.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoRemove unneeded /proc/xen/grant and its libxc wrapper.
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 23:17:06 +0000 (00:17 +0100)]
Remove unneeded /proc/xen/grant and its libxc wrapper.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoTreat xenstore UUID for domU's like MAC addresses for virtual network
emellor@leeni.uk.xensource.com [Wed, 25 Jan 2006 23:10:03 +0000 (00:10 +0100)]
Treat xenstore UUID for domU's like MAC addresses for virtual network
interfaces -- can be set by user in domU configuration, but is
generated randomly by default.

Signed-off-by: Andrew D. Ball <aball@us.ibm.com>
19 years agoUpdated README for xm-test for the new "--with-vmx-kernel=KERNEL"
stekloff@elm3b216.beaverton.ibm.com [Wed, 25 Jan 2006 23:06:46 +0000 (00:06 +0100)]
Updated README for xm-test for the new "--with-vmx-kernel=KERNEL"
configuration option.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
19 years agoAdd configuration option for specifying kernel to use for hvm/vmx testing
stekloff@elm3b216.beaverton.ibm.com [Wed, 25 Jan 2006 23:06:39 +0000 (00:06 +0100)]
Add configuration option for specifying kernel to use for hvm/vmx testing
in xm-test. Added --with-vmx-kernel=KERNEL.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
19 years agoMerge.
sos22@douglas.cl.cam.ac.uk [Wed, 25 Jan 2006 22:35:22 +0000 (23:35 +0100)]
Merge.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoFix 64-bit build.
sos22@douglas.cl.cam.ac.uk [Wed, 25 Jan 2006 22:31:07 +0000 (23:31 +0100)]
Fix 64-bit build.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoCallers of __gpfn_to_mfn() do not need to check
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 18:16:07 +0000 (19:16 +0100)]
Callers of __gpfn_to_mfn() do not need to check
shadow-translate mode.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoFix the 64-bit build.
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 18:09:28 +0000 (19:09 +0100)]
Fix the 64-bit build.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoMake some basic cases of grant tables work in shadow translate mode.
sos22@douglas.cl.cam.ac.uk [Wed, 25 Jan 2006 17:57:44 +0000 (18:57 +0100)]
Make some basic cases of grant tables work in shadow translate mode.
This is enough to get block devices to work.

Note that this involves assigning PFNs to the machine frames used for
the grant table structures.  While I'm here, I also assigned a PFN to
the shared info frame.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMerge.
sos22@douglas.cl.cam.ac.uk [Wed, 25 Jan 2006 16:41:22 +0000 (17:41 +0100)]
Merge.
Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoMake shadow translate mode work for unprivileged, uniprocessor guests
sos22@douglas.cl.cam.ac.uk [Wed, 25 Jan 2006 16:15:11 +0000 (17:15 +0100)]
Make shadow translate mode work for unprivileged, uniprocessor guests
with no devices on plain 32 bit non-PAE hosts.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoChange domain_crash to say where it was called from.
sos22@douglas.cl.cam.ac.uk [Wed, 25 Jan 2006 16:14:19 +0000 (17:14 +0100)]
Change domain_crash to say where it was called from.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
19 years agoFix batched request list overflow on packet receive path
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 13:36:35 +0000 (14:36 +0100)]
Fix batched request list overflow on packet receive path
in the netback driver.

Signed-off-by: Robert Read <robert@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoExport Xen driver util function symbols so that Xen drivers
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 13:28:07 +0000 (14:28 +0100)]
Export Xen driver util function symbols so that Xen drivers
can build as modules.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoSeparate the validity checking of the page frame in 2 chunks.
vhanquez@kneesa.uk.xensource.com [Wed, 25 Jan 2006 11:51:21 +0000 (11:51 +0000)]
Separate the validity checking of the page frame in 2 chunks.
give a more accurate error message, and don't call pfn_to_page before
validating the pfn.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoFix inline asm hypercall argument parameter indexes.
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 11:34:02 +0000 (12:34 +0100)]
Fix inline asm hypercall argument parameter indexes.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoRev8517 (Reduce locked critical region in __enter_scheduler()), enable
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 10:44:39 +0000 (11:44 +0100)]
Rev8517 (Reduce locked critical region in __enter_scheduler()), enable
interrupt now before context switch. Then arch specific context_switch
stub needs to disable interrupt itself.

To solve some intermittent corruption.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
19 years agoMissing put_page_and_type() in dom0_op hypercall.
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 10:12:34 +0000 (11:12 +0100)]
Missing put_page_and_type() in dom0_op hypercall.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoFix 64-bit build and fix the transfer-page code for the
kaf24@firebug.cl.cam.ac.uk [Wed, 25 Jan 2006 10:08:33 +0000 (11:08 +0100)]
Fix 64-bit build and fix the transfer-page code for the
iret hypercall.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoFix an incorrect type, and a missing return value check,
kaf24@firebug.cl.cam.ac.uk [Tue, 24 Jan 2006 17:08:11 +0000 (18:08 +0100)]
Fix an incorrect type, and a missing return value check,
in direct_remap_pfn_range().

Signed-off-by: Jan Beulich <JBeulich@novell.com>
19 years agoIndirect hypercalls through a hypercall transfer page.
kaf24@firebug.cl.cam.ac.uk [Tue, 24 Jan 2006 17:05:45 +0000 (18:05 +0100)]
Indirect hypercalls through a hypercall transfer page.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoAdding __init__.py file to remove build warning.
toml@tomlt2.austin.ibm.com [Tue, 24 Jan 2006 16:59:54 +0000 (17:59 +0100)]
Adding __init__.py file to remove build warning.
It turns out the hg export command does not include zero
size files in the generated diff and this was overlooked.

19 years agoAdded dependency check for lilo in configure.ac for vmx enabled builds. Must
stekloff@elm3b216.beaverton.ibm.com [Tue, 24 Jan 2006 16:59:33 +0000 (17:59 +0100)]
Added dependency check for lilo in configure.ac for vmx enabled builds. Must
have lilo version 22.7 or greater.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
19 years agoThis patch make xm reboot/shutdown work for vmx doamin.
Ke Yu [Tue, 24 Jan 2006 16:58:43 +0000 (17:58 +0100)]
This patch make xm reboot/shutdown work for vmx doamin.

xm reboot fails due to two issues:
1. no mechanism to change XendDomainInfo.info to trigger domain reboot
2. ioemu blkif parameter is missing during reboot, thus device model recreation will fail.

This patch fix these issues by
1. introducing a xswatch to monitor the control/shutdown node. once fired, it will change the XendDomainInfo.info to trigger domain reboot
2. saving the ioemu blkif parameter in xen store just like DomU does.

Signed-off-by: Yu Ke <ke.yu@intel.com>
19 years agoMerged.
emellor@leeni.uk.xensource.com [Tue, 24 Jan 2006 16:54:34 +0000 (17:54 +0100)]
Merged.

19 years agoreindent few lines that were using softtab instead of hardtab.
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 13:21:11 +0000 (13:21 +0000)]
reindent few lines that were using softtab instead of hardtab.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoadd some checking of opening and read in dom0_init and return -1 if error.
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 13:14:42 +0000 (13:14 +0000)]
add some checking of opening and read in dom0_init and return -1 if error.
instead of crashing, it now prints a more meaningful error message.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoMerge
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 12:06:48 +0000 (12:06 +0000)]
Merge

19 years agouse talloc_zero instead of talloc + memset
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 12:03:06 +0000 (12:03 +0000)]
use talloc_zero instead of talloc + memset

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agouse format printf style to write to tracefd instead of using write syscall.
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 11:50:38 +0000 (11:50 +0000)]
use format printf style to write to tracefd instead of using write syscall.
add a static buffer to trace() instead of always allocating from the heap.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoTwo shell commands weren't properly spaced in a makefile.
kaf24@firebug.cl.cam.ac.uk [Tue, 24 Jan 2006 11:26:38 +0000 (12:26 +0100)]
Two shell commands weren't properly spaced in a makefile.

Signed-off-by: Jan Beulich <JBeulich@novell.com>
19 years agofixup memory leak and return value, if malloc or realloc fail.
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 10:55:45 +0000 (10:55 +0000)]
fixup memory leak and return value, if malloc or realloc fail.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agofixup reallocation to "twice the size + 1", instead of "3 times the size".
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 10:52:52 +0000 (10:52 +0000)]
fixup reallocation to "twice the size + 1", instead of "3 times the size".
max *= 2 + 1 <==> max *= 3

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agodup and open error value is -1, not < 0
vhanquez@kneesa.uk.xensource.com [Tue, 24 Jan 2006 10:37:44 +0000 (10:37 +0000)]
dup and open error value is -1, not < 0

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoThe present pud_offset_k implementation runs the value read through
kaf24@firebug.cl.cam.ac.uk [Mon, 23 Jan 2006 15:27:00 +0000 (16:27 +0100)]
The present pud_offset_k implementation runs the value read through
the m2p translation process twice. With that removed, it can then
also be simplified.

Signed-off-by: Jan Beulich <JBeulich@novell.com>
19 years agoia64 specific part of gdbstub.
kaf24@firebug.cl.cam.ac.uk [Mon, 23 Jan 2006 14:47:00 +0000 (15:47 +0100)]
ia64 specific part of gdbstub.

Signed-off-by: Isaku Yamahtata <yamahata@valinux.co.jp>
19 years agoEmergency system halt should halt all processors, not just
kaf24@firebug.cl.cam.ac.uk [Mon, 23 Jan 2006 14:17:14 +0000 (15:17 +0100)]
Emergency system halt should halt all processors, not just
the crashing processor.

Signed-off-by: Jan Beulich <JBeulich@novell.com>
19 years agoThe arguments to memset are ordered incorrectly in the
kaf24@firebug.cl.cam.ac.uk [Fri, 20 Jan 2006 19:31:09 +0000 (20:31 +0100)]
The arguments to memset are ordered incorrectly in the
pcm_hw_clear function of audio.c.

Signed-off-by: Charles Coffing <ccoffing@novell.com>
19 years agoAllow disabling the tx checksums on the xen loopback
kaf24@firebug.cl.cam.ac.uk [Thu, 19 Jan 2006 19:11:09 +0000 (20:11 +0100)]
Allow disabling the tx checksums on the xen loopback
interface, which is used for the virtual interfaces of dom0 instead
of netfront/netback.

I need to issue ethtool -K eth0 tx off to work around a bad checksum
problem, which has been reported for domUs a few months ago. I'm
bridging dom0's eth0 to a domU where I do NAT to a different virtual
interface. Without this change, I get lots of packets with bad
checksums.

Signed-off-by: Jan Niehusmann <jan@gondor.com>
19 years agoFix a bug that causes storage key auth to be generated twice.
kaf24@firebug.cl.cam.ac.uk [Thu, 19 Jan 2006 19:04:53 +0000 (20:04 +0100)]
Fix a bug that causes storage key auth to be generated twice.

Signed-off-by: Vinnie Scarlata <vincent.r.scarlata@intel.com>
19 years agoHaving /usr/bin/xsls conflicts with xsls as distributed in scalapack
kaf24@firebug.cl.cam.ac.uk [Thu, 19 Jan 2006 08:16:01 +0000 (09:16 +0100)]
Having /usr/bin/xsls conflicts with xsls as distributed in scalapack
(http://www.netlib.org/scalapack/).  It should probably be xenstore-ls
a) for namespacing and b) to match up with the other xenstore commands
better.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
19 years agoCleanup dirty code avoiding warning messages when compiling
kaf24@firebug.cl.cam.ac.uk [Thu, 19 Jan 2006 08:12:40 +0000 (09:12 +0100)]
Cleanup dirty code avoiding warning messages when compiling
ioemu.

Signed-off-by: Haifeng Xue <haifeng.xue@intel.com>
19 years agoDelete 2 unused Kconfig files.
vhanquez@kneesa.uk.xensource.com [Wed, 18 Jan 2006 12:58:11 +0000 (12:58 +0000)]
Delete 2 unused Kconfig files.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoNo longer call xc_vcpu_getcontext() on restore (required after cset 8610).
smh22@firebug.cl.cam.ac.uk [Tue, 17 Jan 2006 15:09:03 +0000 (16:09 +0100)]
No longer call xc_vcpu_getcontext() on restore (required after cset 8610).

Signed-off-by: Steven Hand <steven@xensource.com>
19 years agoMinor documentation fix
maf46@burn.cl.cam.ac.uk [Tue, 17 Jan 2006 15:06:03 +0000 (16:06 +0100)]
Minor documentation fix

19 years agoRemove the spin on VCPUF_running from context_switch().
kaf24@firebug.cl.cam.ac.uk [Tue, 17 Jan 2006 13:24:42 +0000 (14:24 +0100)]
Remove the spin on VCPUF_running from context_switch().
It doesn't work because we already set VCPUF_running
locally, and the scheduler should not pick another CPU's
VCPUF_running VCPU anyway, since it mustn't modify the
processor field.

Instead just add a simple assertion to the scheduler to
ensure the scheduling algorithm is not picking an
inappropriate VCPU.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoSync against scheduler tail on other CPUs when context
kaf24@firebug.cl.cam.ac.uk [Tue, 17 Jan 2006 12:25:30 +0000 (13:25 +0100)]
Sync against scheduler tail on other CPUs when context
switching to a new VCPU. Otherwise we cannot pull the
VCPU's state off the other CPU.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoreturn -ENOMEM value instead of -1 when running out of memory.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 23:54:24 +0000 (23:54 +0000)]
return -ENOMEM value instead of -1 when running out of memory.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agosanitize tpmfront. missing spin_unlock'ing in error paths and fix coding style.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 23:43:58 +0000 (23:43 +0000)]
sanitize tpmfront. missing spin_unlock'ing in error paths and fix coding style.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agobool type doesn't exist in C, don't try to emulate one.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 22:11:43 +0000 (22:11 +0000)]
bool type doesn't exist in C, don't try to emulate one.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoremove ASSERT macro.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 22:07:29 +0000 (22:07 +0000)]
remove ASSERT macro.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoreplace ASSERT by BUG_ON.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 22:04:42 +0000 (22:04 +0000)]
replace ASSERT by BUG_ON.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agodefine all DPRINTK as pr_debug
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 21:58:44 +0000 (21:58 +0000)]
define all DPRINTK as pr_debug

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agofix xenbus_scanf called with NULL instead of XBT_NULL.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 21:48:24 +0000 (21:48 +0000)]
fix xenbus_scanf called with NULL instead of XBT_NULL.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agouse standard pr_debug macro for DPRINTK.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 21:43:17 +0000 (21:43 +0000)]
use standard pr_debug macro for DPRINTK.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoremove ASSERT macro that is not used anymore in blkback.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 21:29:10 +0000 (21:29 +0000)]
remove ASSERT macro that is not used anymore in blkback.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoremove unnecessary macro bdev_put which is an alias to blkdev_put.
vhanquez@kneesa.uk.xensource.com [Mon, 16 Jan 2006 21:13:29 +0000 (21:13 +0000)]
remove unnecessary macro bdev_put which is an alias to blkdev_put.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
19 years agoComplete arch_domain_create refactoring for ia64.
kaf24@firebug.cl.cam.ac.uk [Mon, 16 Jan 2006 13:47:31 +0000 (14:47 +0100)]
Complete arch_domain_create refactoring for ia64.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
19 years agoRemove the free_vcpu() interface I added in the preceding
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 22:40:09 +0000 (23:40 +0100)]
Remove the free_vcpu() interface I added in the preceding
changeset. It makes no sense, since an allocated VCPU
cannot be freed at any arbitrary point because individual
VCPUs are not refcounted.

Instead extend free_domain() slightly so it really does do
the reverse of alloc_vcpu() for every allocated VCPU.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoSome refactoring of domain creation/destruction.
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 22:16:43 +0000 (23:16 +0100)]
Some refactoring of domain creation/destruction.

Interface name changes:
1. do_createdomain -> domain_create

2. domain_destruct -> domain_destroy

Arch-specific changes:
1. arch_do_createdomain -> arch_domain_create
This function now takes a domain pointer, not a VCPU
pointer! Initialisation of VCPU0 must happen in
alloc_vcpu_struct().

2. free_perdomain_pt -> arch_domain_destroy
This function must undo the work of arch_domain_create

TODO: arch_domain_create() refactoring is not completed
for ia64.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoxc_vcpu_getcontext() can no longer be called before a
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 21:17:33 +0000 (22:17 +0100)]
xc_vcpu_getcontext() can no longer be called before a
VCPU's context has been explicitly initialised.

Fix all the domain builders to no longer attempt this.
They really don't need to anyhow.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoArch-specific per-vcpu info should be initialised to zero
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 20:26:40 +0000 (21:26 +0100)]
Arch-specific per-vcpu info should be initialised to zero
when allocating a new vcpu structure, not copied from
CPU0's idle VCPU. Especially now that the idle VCPU itself
is dynamically allocated.

This should fix assertions people have been seeing in
getdomain_info_ctxt() relation to IOPL in eflags.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoFix 64-bit build with crash_debug enabled.
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 16:05:31 +0000 (17:05 +0100)]
Fix 64-bit build with crash_debug enabled.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoRename cdb to gdbstub and split it into arch dependent/neutral part.
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 15:58:54 +0000 (16:58 +0100)]
Rename cdb to gdbstub and split it into arch dependent/neutral part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
19 years agomerge
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 09:36:40 +0000 (10:36 +0100)]
merge

19 years agoFix the issue of system crash in vmx stress test.
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 09:35:39 +0000 (10:35 +0100)]
Fix the issue of system crash in vmx stress test.
There is a path that shadow L2 table is assigned
after it is unshadowed in stress test.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
19 years agoMerge with xen-ia64-unstable.hg
kaf24@firebug.cl.cam.ac.uk [Sat, 14 Jan 2006 00:04:06 +0000 (01:04 +0100)]
Merge with xen-ia64-unstable.hg

19 years agoMake all nmi debugkey tracing arch specific.
kaf24@firebug.cl.cam.ac.uk [Fri, 13 Jan 2006 22:41:28 +0000 (23:41 +0100)]
Make all nmi debugkey tracing arch specific.

Signed-off-by: Keir Fraser <keir@xensource.com>
19 years agoWork around new nmi code in keyhandler
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 20:58:41 +0000 (14:58 -0600)]
Work around new nmi code in keyhandler
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
19 years agoLeave *_SOFTIRQ definitions to Xen common code
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 20:31:00 +0000 (14:31 -0600)]
Leave *_SOFTIRQ definitions to Xen common code
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
19 years agoRemove annoying #warning when compiling with CONFIG_XEN_SMP
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 20:19:30 +0000 (14:19 -0600)]
Remove annoying #warning when compiling with CONFIG_XEN_SMP

19 years agoFix for !CONFIG_SMP compile
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 20:16:44 +0000 (14:16 -0600)]
Fix for !CONFIG_SMP compile
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
19 years agoMerge
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 20:12:24 +0000 (14:12 -0600)]
Merge

19 years agoCorrectly handle dumping a VM86 guest's stack.
Ian.Campbell@xensource.com [Fri, 13 Jan 2006 16:56:09 +0000 (16:56 +0000)]
Correctly handle dumping a VM86 guest's stack.

If the guest context is VM86 then we need to treat ss:sp as 16 bit
segment:offset rather than 32 bit selector:offset.

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
19 years agoAllow asm-offsets to work with vanilla binutils
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 16:38:44 +0000 (10:38 -0600)]
Allow asm-offsets to work with vanilla binutils
Necessary because SHARED_ARCHINFO_ADDR is negative
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
19 years agocorrect implementation of flush_tlb_mask needed to reenable CONFIG_SMP
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 16:36:47 +0000 (10:36 -0600)]
correct implementation of flush_tlb_mask needed to reenable CONFIG_SMP
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
19 years agoMake xmexaple.vti support network option too and other small modifications for conven...
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 16:25:10 +0000 (10:25 -0600)]
Make xmexaple.vti support network option too and other small modifications for convenient use.
Signed-off-by Zhang xiantao <xiantao.zhang@intel.com>

19 years agoUnused page struct fields commented out.
djm@kirby.fc.hp.com [Fri, 13 Jan 2006 16:24:19 +0000 (10:24 -0600)]
Unused page struct fields commented out.
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>