aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.rootkeys1
-rw-r--r--xen-2.4.16/common/domain.c24
-rw-r--r--xen-2.4.16/common/memory.c79
-rw-r--r--xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h3
-rw-r--r--xen-2.4.16/include/xeno/dom0_ops.h2
-rw-r--r--xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c34
-rw-r--r--xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c12
-rw-r--r--xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h16
-rw-r--r--xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h21
9 files changed, 78 insertions, 114 deletions
diff --git a/.rootkeys b/.rootkeys
index 126194df93..691edf2e60 100644
--- a/.rootkeys
+++ b/.rootkeys
@@ -251,7 +251,6 @@
3ddb79b7Xyaoep6U0kLvx6Kx7OauDw xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c
3df9ce13K7qSLBtHV-01QHPW62649Q xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c
3ddb79b7PulSkF9m3c7K5MkxHRf4hA xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h
-3df9ce13tITy-OuYx_zQemsvqqLTWA xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h
3ddba759XOjcl_OF-52dOYq7sgMykQ xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c
3ddb79b7s7yYBioHidSkIoHtQxYmOw xenolinux-2.4.16-sparse/arch/xeno/drivers/network/Makefile
3ddb79b7CpLL98ScdpbKkVBktlbCtQ xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c
diff --git a/xen-2.4.16/common/domain.c b/xen-2.4.16/common/domain.c
index 3a0222c7d6..2e502a4d75 100644
--- a/xen-2.4.16/common/domain.c
+++ b/xen-2.4.16/common/domain.c
@@ -17,8 +17,6 @@
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY)
-extern int do_process_page_updates_bh(page_update_request_t *, int);
-
extern int nr_mods;
extern module_t *mod;
extern unsigned char *cmdline;
@@ -415,39 +413,17 @@ unsigned int alloc_new_dom_mem(struct task_struct *p, unsigned int kbytes)
int final_setup_guestos(struct task_struct * p, dom_meminfo_t * meminfo)
{
- struct list_head *list_ent;
l2_pgentry_t * l2tab;
l1_pgentry_t * l1tab;
start_info_t * virt_startinfo_addr;
unsigned long virt_stack_addr;
unsigned long long time;
unsigned long phys_l2tab;
- page_update_request_t * pgt_updates;
- unsigned long curr_update_phys;
- unsigned long count;
net_ring_t *net_ring;
net_vif_t *net_vif;
char *dst; // temporary
int i; // temporary
- /* first of all, set up domain pagetables */
- pgt_updates = (page_update_request_t *)
- map_domain_mem(meminfo->pgt_update_arr);
- curr_update_phys = meminfo->pgt_update_arr;
- for(count = 0; count < meminfo->num_pgt_updates; count++){
- do_process_page_updates_bh(pgt_updates, 1);
- pgt_updates++;
- if(!((unsigned long)pgt_updates & (PAGE_SIZE-1))){
- unmap_domain_mem(pgt_updates-1);
- list_ent = frame_table[curr_update_phys >> PAGE_SHIFT].list.next;
- curr_update_phys = list_entry(list_ent, struct pfn_info, list) -
- frame_table;
- curr_update_phys <<= PAGE_SHIFT;
- pgt_updates = map_domain_mem(curr_update_phys);
- }
- }
- unmap_domain_mem((void *)((unsigned long)(pgt_updates-1) & PAGE_MASK));
-
/* entries 0xe0000000 onwards in page table must contain hypervisor
* mem mappings - set them up.
*/
diff --git a/xen-2.4.16/common/memory.c b/xen-2.4.16/common/memory.c
index 264cedfc9c..1ac70b43a9 100644
--- a/xen-2.4.16/common/memory.c
+++ b/xen-2.4.16/common/memory.c
@@ -175,7 +175,7 @@
#include <asm/uaccess.h>
#include <asm/domain_page.h>
-#if 0
+#if 1
#define MEM_LOG(_f, _a...) printk("DOM%d: (file=memory.c, line=%d) " _f "\n", current->domain, __LINE__, ## _a )
#else
#define MEM_LOG(_f, _a...) ((void)0)
@@ -697,36 +697,22 @@ static int do_extended_command(unsigned long ptr, unsigned long val)
return err;
}
-/*
- * functions to handle page table updates: upper half is invoked in case pt
- * updates are requested by a domain and it invokes copy_from_user. bottom half
- * is invoked both in case of domain downcall and domain building by
- * hypervisor.
- */
-page_update_request_t * do_process_page_updates_uh(page_update_request_t *updates,
- int count)
-{
- page_update_request_t * ret = kmalloc(sizeof(page_update_request_t) * count,
- GFP_KERNEL);
-
- if ( copy_from_user(ret, updates, sizeof(page_update_request_t) * count) )
- {
- kill_domain_with_errmsg("Cannot read page update request");
- }
-
- return ret;
-}
-/* Apply updates to page table @pagetable_id within the current domain. */
-int do_process_page_updates_bh(page_update_request_t * cur, int count)
+int do_process_page_updates(page_update_request_t *ureqs, int count)
{
+ page_update_request_t req;
unsigned long flags, pfn;
struct pfn_info *page;
int err = 0, i;
for ( i = 0; i < count; i++ )
{
- pfn = cur->ptr >> PAGE_SHIFT;
+ if ( copy_from_user(&req, ureqs, sizeof(req)) )
+ {
+ kill_domain_with_errmsg("Cannot read page update request");
+ }
+
+ pfn = req.ptr >> PAGE_SHIFT;
if ( pfn >= max_page )
{
MEM_LOG("Page out of range (%08lx > %08lx)", pfn, max_page);
@@ -736,7 +722,7 @@ int do_process_page_updates_bh(page_update_request_t * cur, int count)
err = 1;
/* Least significant bits of 'ptr' demux the operation type. */
- switch ( cur->ptr & (sizeof(l1_pgentry_t)-1) )
+ switch ( req.ptr & (sizeof(l1_pgentry_t)-1) )
{
/*
* PGREQ_NORMAL: Normal update to any level of page table.
@@ -750,13 +736,13 @@ int do_process_page_updates_bh(page_update_request_t * cur, int count)
switch ( (flags & PG_type_mask) )
{
case PGT_l1_page_table:
- err = mod_l1_entry(cur->ptr, mk_l1_pgentry(cur->val));
+ err = mod_l1_entry(req.ptr, mk_l1_pgentry(req.val));
break;
case PGT_l2_page_table:
- err = mod_l2_entry(cur->ptr, mk_l2_pgentry(cur->val));
+ err = mod_l2_entry(req.ptr, mk_l2_pgentry(req.val));
break;
default:
- MEM_LOG("Update to non-pt page %08lx", cur->ptr);
+ MEM_LOG("Update to non-pt page %08lx", req.ptr);
break;
}
}
@@ -771,7 +757,7 @@ int do_process_page_updates_bh(page_update_request_t * cur, int count)
page = frame_table + pfn;
if ( DOMAIN_OKAY(page->flags) )
{
- machine_to_phys_mapping[pfn] = cur->val;
+ machine_to_phys_mapping[pfn] = req.val;
err = 0;
}
else
@@ -786,12 +772,27 @@ int do_process_page_updates_bh(page_update_request_t * cur, int count)
* in the least-siginificant bits of the 'value' field.
*/
case PGREQ_EXTENDED_COMMAND:
- cur->ptr &= ~(sizeof(l1_pgentry_t) - 1);
- err = do_extended_command(cur->ptr, cur->val);
+ req.ptr &= ~(sizeof(l1_pgentry_t) - 1);
+ err = do_extended_command(req.ptr, req.val);
break;
+ case PGREQ_UNCHECKED_UPDATE:
+ req.ptr &= ~(sizeof(l1_pgentry_t) - 1);
+ if ( current->domain == 0 )
+ {
+ unsigned long *ptr = map_domain_mem(req.ptr);
+ *ptr = req.val;
+ unmap_domain_mem(ptr);
+ err = 0;
+ }
+ else
+ {
+ MEM_LOG("Bad unchecked update attempt");
+ }
+ break;
+
default:
- MEM_LOG("Invalid page update command %08lx", cur->ptr);
+ MEM_LOG("Invalid page update command %08lx", req.ptr);
break;
}
@@ -800,7 +801,7 @@ int do_process_page_updates_bh(page_update_request_t * cur, int count)
kill_domain_with_errmsg("Illegal page update request");
}
- cur++;
+ ureqs++;
}
if ( tlb_flush[smp_processor_id()] )
@@ -809,20 +810,8 @@ int do_process_page_updates_bh(page_update_request_t * cur, int count)
__asm__ __volatile__ (
"movl %%eax,%%cr3" : :
"a" (pagetable_val(current->mm.pagetable)));
+
}
return(0);
}
-
-/* Apply updates to page table @pagetable_id within the current domain. */
-int do_process_page_updates(page_update_request_t *updates, int count)
-{
- page_update_request_t * pg_updates;
- int ret;
-
- pg_updates = do_process_page_updates_uh(updates, count);
- ret = do_process_page_updates_bh(pg_updates, count);
- kfree(pg_updates);
-
- return ret;
-}
diff --git a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h
index 7f53057cab..9c9d752efd 100644
--- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h
+++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h
@@ -43,6 +43,8 @@ typedef struct
#define PGREQ_MPT_UPDATE 1
/* An extended command. */
#define PGREQ_EXTENDED_COMMAND 2
+/* DOM0 can make entirely unchecked updates which do not affect refcnts. */
+#define PGREQ_UNCHECKED_UPDATE 3
unsigned long ptr, val; /* *ptr = val */
/* Announce a new top-level page table. */
#define PGEXT_PIN_L1_TABLE 0
@@ -53,7 +55,6 @@ typedef struct
#define PGEXT_NEW_BASEPTR 5
#define PGEXT_TLB_FLUSH 6
#define PGEXT_INVLPG 7
-#define PGEXT_
#define PGEXT_CMD_MASK 255
#define PGEXT_CMD_SHIFT 8
} page_update_request_t;
diff --git a/xen-2.4.16/include/xeno/dom0_ops.h b/xen-2.4.16/include/xeno/dom0_ops.h
index da82ada596..49a5842fab 100644
--- a/xen-2.4.16/include/xeno/dom0_ops.h
+++ b/xen-2.4.16/include/xeno/dom0_ops.h
@@ -43,8 +43,6 @@ typedef struct domain_launch
unsigned long virt_load_addr;
unsigned long virt_shinfo_addr;
unsigned long virt_startinfo_addr;
- unsigned long pgt_update_arr;
- unsigned long num_pgt_updates;
unsigned int num_vifs;
char cmd_line[MAX_CMD_LEN];
} dom_meminfo_t;
diff --git a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c
index 1321f3eb52..f8a6ea93ea 100644
--- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c
+++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
* dom0_core.c
*
@@ -31,9 +30,19 @@
#include <asm/tlb.h>
#include "dom0_ops.h"
-#include "hypervisor_defs.h"
-#define XENO_BASE "xeno" // proc file name defs should be in separate .h
+/* Private proc-file data structures. */
+typedef struct proc_data {
+ unsigned int domain;
+ unsigned long map_size;
+} dom_procdata_t;
+
+typedef struct proc_mem_data {
+ unsigned long pfn;
+ int tot_pages;
+} proc_memdata_t;
+
+#define XENO_BASE "xeno"
#define DOM0_CMD_INTF "dom0_cmd"
#define DOM0_NEWDOM "new_dom_data"
@@ -195,9 +204,18 @@ static int cmd_write_proc(struct file *file, const char *buffer,
goto out;
}
- /* is the request intended for hypervisor? */
- if(op.cmd != MAP_DOM_MEM){
-
+ if ( op.cmd == MAP_DOM_MEM )
+ {
+ ret = dom_map_mem(op.u.dommem.domain, op.u.dommem.start_pfn,
+ op.u.dommem.tot_pages);
+ }
+ else if ( op.cmd == DO_PGUPDATES )
+ {
+ ret = HYPERVISOR_pt_update((void *)op.u.pgupdate.pgt_update_arr,
+ op.u.pgupdate.num_pgt_updates);
+ }
+ else
+ {
ret = HYPERVISOR_dom0_op(&op);
/* if new domain created, create proc entries */
@@ -223,10 +241,6 @@ static int cmd_write_proc(struct file *file, const char *buffer,
}
- } else {
-
- ret = dom_map_mem(op.u.dommem.domain, op.u.dommem.start_pfn,
- op.u.dommem.tot_pages);
}
out:
diff --git a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c
index 55e0495ab0..9d14070a1e 100644
--- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c
+++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c
@@ -14,7 +14,6 @@
#include <asm/tlb.h>
#include <asm/mmu.h>
-#include "hypervisor_defs.h"
#include "dom0_ops.h"
#define MAP_CONT 0
@@ -22,14 +21,15 @@
extern struct list_head * find_direct(struct list_head *, unsigned long);
-/* bd240: functions below perform direct mapping to the real physical pages needed for
- * mapping various hypervisor specific structures needed in dom0 userspace by various
- * management applications such as domain builder etc.
+/*
+ * bd240: functions below perform direct mapping to the real physical pages
+ * needed for mapping various hypervisor specific structures needed in dom0
+ * userspace by various management applications such as domain builder etc.
*/
-#define direct_set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low)
+#define direct_set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr)|PGREQ_UNCHECKED_UPDATE, (pteval).pte_low)
-#define direct_pte_clear(pteptr) queue_l1_entry_update(__pa(pteptr), 0)
+#define direct_pte_clear(pteptr) queue_l1_entry_update(__pa(pteptr)|PGREQ_UNCHECKED_UPDATE, 0)
#define __direct_pte(x) ((pte_t) { (x) } )
#define __direct_mk_pte(page_nr,pgprot) __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
diff --git a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h
index 502c97e768..d98ce1b1eb 100644
--- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h
+++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h
@@ -9,9 +9,10 @@
#define DOM0_NEWDOMAIN 0
#define DOM0_KILLDOMAIN 1
#define DOM0_GETMEMLIST 2
-#define MAP_DOM_MEM 3
#define DOM0_STARTDOM 4
-#define MAX_CMD 4
+#define MAP_DOM_MEM 6 /* Not passed down to Xen */
+#define DO_PGUPDATES 7 /* Not passed down to Xen */
+#define MAX_CMD 8
#define MAX_CMD_LEN 256
@@ -35,6 +36,7 @@ typedef struct dom0_getmemlist_st
void *buffer;
} dom0_getmemlist_t;
+/* This is entirely processed by XenoLinux */
typedef struct dom_mem
{
unsigned int domain;
@@ -43,6 +45,13 @@ typedef struct dom_mem
int tot_pages;
} dom_mem_t;
+/* This is entirely processed by XenoLinux */
+typedef struct dom_pgupdate
+{
+ unsigned long pgt_update_arr;
+ unsigned long num_pgt_updates;
+} dom_pgupdate_t;
+
typedef struct domain_launch
{
unsigned int domain;
@@ -50,8 +59,6 @@ typedef struct domain_launch
unsigned long virt_load_addr;
unsigned long virt_shinfo_addr;
unsigned long virt_startinfo_addr;
- unsigned long pgt_update_arr;
- unsigned long num_pgt_updates;
unsigned int num_vifs;
char cmd_line[MAX_CMD_LEN];
} dom_meminfo_t;
@@ -65,6 +72,7 @@ typedef struct dom0_op_st
dom0_killdomain_t killdomain;
dom0_getmemlist_t getmemlist;
dom_mem_t dommem;
+ dom_pgupdate_t pgupdate;
dom_meminfo_t meminfo;
}
u;
diff --git a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h
deleted file mode 100644
index e2965ff6a4..0000000000
--- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/******************************************************************************
- * dom0_ops.h
- *
- * Data structures defined in hypervisor code but needed in DOM0 as well.
- * Contents of this file should be kept in sync with the hypervisor ones
- * unless you do not want something terrible :) to happen.
- *
- * Copyright (c) 2002, Keir Fraser & Boris Dragovic
- */
-
-
-typedef struct proc_data {
- unsigned int domain;
- unsigned long map_size;
-} dom_procdata_t;
-
-typedef struct proc_mem_data {
- unsigned long pfn;
- int tot_pages;
-} proc_memdata_t;