ia64/xen-unstable
changeset 120:658b3aeca0e5
bitkeeper revision 1.22.1.7 (3e4039d3HqYce1Oml41mAtYFTKkhkA)
dom0_ops.h, dom0_memory.c, dom0_core.c, hypervisor-if.h, memory.c, domain.c:
Cleaned up domain building some more.
.del-hypervisor_defs.h~7d77395edca9f612:
Delete: xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h
dom0_ops.h, dom0_memory.c, dom0_core.c, hypervisor-if.h, memory.c, domain.c:
Cleaned up domain building some more.
.del-hypervisor_defs.h~7d77395edca9f612:
Delete: xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h
author | kaf24@labyrinth.cl.cam.ac.uk |
---|---|
date | Tue Feb 04 22:08:19 2003 +0000 (2003-02-04) |
parents | 134b05519a54 |
children | b1b1608f5d5c 946e29624b77 |
files | .rootkeys xen-2.4.16/common/domain.c xen-2.4.16/common/memory.c xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h xen-2.4.16/include/xeno/dom0_ops.h xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h |
line diff
1.1 --- a/.rootkeys Tue Feb 04 15:47:11 2003 +0000 1.2 +++ b/.rootkeys Tue Feb 04 22:08:19 2003 +0000 1.3 @@ -251,7 +251,6 @@ 3ddb79b75eo4PRXkT6Th9popt_SJhg xenolinux 1.4 3ddb79b7Xyaoep6U0kLvx6Kx7OauDw xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c 1.5 3df9ce13K7qSLBtHV-01QHPW62649Q xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c 1.6 3ddb79b7PulSkF9m3c7K5MkxHRf4hA xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h 1.7 -3df9ce13tITy-OuYx_zQemsvqqLTWA xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h 1.8 3ddba759XOjcl_OF-52dOYq7sgMykQ xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c 1.9 3ddb79b7s7yYBioHidSkIoHtQxYmOw xenolinux-2.4.16-sparse/arch/xeno/drivers/network/Makefile 1.10 3ddb79b7CpLL98ScdpbKkVBktlbCtQ xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c
2.1 --- a/xen-2.4.16/common/domain.c Tue Feb 04 15:47:11 2003 +0000 2.2 +++ b/xen-2.4.16/common/domain.c Tue Feb 04 22:08:19 2003 +0000 2.3 @@ -17,8 +17,6 @@ 2.4 #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED) 2.5 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY) 2.6 2.7 -extern int do_process_page_updates_bh(page_update_request_t *, int); 2.8 - 2.9 extern int nr_mods; 2.10 extern module_t *mod; 2.11 extern unsigned char *cmdline; 2.12 @@ -415,39 +413,17 @@ unsigned int alloc_new_dom_mem(struct ta 2.13 2.14 int final_setup_guestos(struct task_struct * p, dom_meminfo_t * meminfo) 2.15 { 2.16 - struct list_head *list_ent; 2.17 l2_pgentry_t * l2tab; 2.18 l1_pgentry_t * l1tab; 2.19 start_info_t * virt_startinfo_addr; 2.20 unsigned long virt_stack_addr; 2.21 unsigned long long time; 2.22 unsigned long phys_l2tab; 2.23 - page_update_request_t * pgt_updates; 2.24 - unsigned long curr_update_phys; 2.25 - unsigned long count; 2.26 net_ring_t *net_ring; 2.27 net_vif_t *net_vif; 2.28 char *dst; // temporary 2.29 int i; // temporary 2.30 2.31 - /* first of all, set up domain pagetables */ 2.32 - pgt_updates = (page_update_request_t *) 2.33 - map_domain_mem(meminfo->pgt_update_arr); 2.34 - curr_update_phys = meminfo->pgt_update_arr; 2.35 - for(count = 0; count < meminfo->num_pgt_updates; count++){ 2.36 - do_process_page_updates_bh(pgt_updates, 1); 2.37 - pgt_updates++; 2.38 - if(!((unsigned long)pgt_updates & (PAGE_SIZE-1))){ 2.39 - unmap_domain_mem(pgt_updates-1); 2.40 - list_ent = frame_table[curr_update_phys >> PAGE_SHIFT].list.next; 2.41 - curr_update_phys = list_entry(list_ent, struct pfn_info, list) - 2.42 - frame_table; 2.43 - curr_update_phys <<= PAGE_SHIFT; 2.44 - pgt_updates = map_domain_mem(curr_update_phys); 2.45 - } 2.46 - } 2.47 - unmap_domain_mem((void *)((unsigned long)(pgt_updates-1) & PAGE_MASK)); 2.48 - 2.49 /* entries 0xe0000000 onwards in page table must contain hypervisor 2.50 * mem mappings - set them up. 2.51 */
3.1 --- a/xen-2.4.16/common/memory.c Tue Feb 04 15:47:11 2003 +0000 3.2 +++ b/xen-2.4.16/common/memory.c Tue Feb 04 22:08:19 2003 +0000 3.3 @@ -175,7 +175,7 @@ 3.4 #include <asm/uaccess.h> 3.5 #include <asm/domain_page.h> 3.6 3.7 -#if 0 3.8 +#if 1 3.9 #define MEM_LOG(_f, _a...) printk("DOM%d: (file=memory.c, line=%d) " _f "\n", current->domain, __LINE__, ## _a ) 3.10 #else 3.11 #define MEM_LOG(_f, _a...) ((void)0) 3.12 @@ -697,36 +697,22 @@ static int do_extended_command(unsigned 3.13 return err; 3.14 } 3.15 3.16 -/* 3.17 - * functions to handle page table updates: upper half is invoked in case pt 3.18 - * updates are requested by a domain and it invokes copy_from_user. bottom half 3.19 - * is invoked both in case of domain downcall and domain building by 3.20 - * hypervisor. 3.21 - */ 3.22 -page_update_request_t * do_process_page_updates_uh(page_update_request_t *updates, 3.23 - int count) 3.24 + 3.25 +int do_process_page_updates(page_update_request_t *ureqs, int count) 3.26 { 3.27 - page_update_request_t * ret = kmalloc(sizeof(page_update_request_t) * count, 3.28 - GFP_KERNEL); 3.29 - 3.30 - if ( copy_from_user(ret, updates, sizeof(page_update_request_t) * count) ) 3.31 - { 3.32 - kill_domain_with_errmsg("Cannot read page update request"); 3.33 - } 3.34 - 3.35 - return ret; 3.36 -} 3.37 - 3.38 -/* Apply updates to page table @pagetable_id within the current domain. */ 3.39 -int do_process_page_updates_bh(page_update_request_t * cur, int count) 3.40 -{ 3.41 + page_update_request_t req; 3.42 unsigned long flags, pfn; 3.43 struct pfn_info *page; 3.44 int err = 0, i; 3.45 3.46 for ( i = 0; i < count; i++ ) 3.47 { 3.48 - pfn = cur->ptr >> PAGE_SHIFT; 3.49 + if ( copy_from_user(&req, ureqs, sizeof(req)) ) 3.50 + { 3.51 + kill_domain_with_errmsg("Cannot read page update request"); 3.52 + } 3.53 + 3.54 + pfn = req.ptr >> PAGE_SHIFT; 3.55 if ( pfn >= max_page ) 3.56 { 3.57 MEM_LOG("Page out of range (%08lx > %08lx)", pfn, max_page); 3.58 @@ -736,7 +722,7 @@ int do_process_page_updates_bh(page_upda 3.59 err = 1; 3.60 3.61 /* Least significant bits of 'ptr' demux the operation type. */ 3.62 - switch ( cur->ptr & (sizeof(l1_pgentry_t)-1) ) 3.63 + switch ( req.ptr & (sizeof(l1_pgentry_t)-1) ) 3.64 { 3.65 /* 3.66 * PGREQ_NORMAL: Normal update to any level of page table. 3.67 @@ -750,13 +736,13 @@ int do_process_page_updates_bh(page_upda 3.68 switch ( (flags & PG_type_mask) ) 3.69 { 3.70 case PGT_l1_page_table: 3.71 - err = mod_l1_entry(cur->ptr, mk_l1_pgentry(cur->val)); 3.72 + err = mod_l1_entry(req.ptr, mk_l1_pgentry(req.val)); 3.73 break; 3.74 case PGT_l2_page_table: 3.75 - err = mod_l2_entry(cur->ptr, mk_l2_pgentry(cur->val)); 3.76 + err = mod_l2_entry(req.ptr, mk_l2_pgentry(req.val)); 3.77 break; 3.78 default: 3.79 - MEM_LOG("Update to non-pt page %08lx", cur->ptr); 3.80 + MEM_LOG("Update to non-pt page %08lx", req.ptr); 3.81 break; 3.82 } 3.83 } 3.84 @@ -771,7 +757,7 @@ int do_process_page_updates_bh(page_upda 3.85 page = frame_table + pfn; 3.86 if ( DOMAIN_OKAY(page->flags) ) 3.87 { 3.88 - machine_to_phys_mapping[pfn] = cur->val; 3.89 + machine_to_phys_mapping[pfn] = req.val; 3.90 err = 0; 3.91 } 3.92 else 3.93 @@ -786,12 +772,27 @@ int do_process_page_updates_bh(page_upda 3.94 * in the least-siginificant bits of the 'value' field. 3.95 */ 3.96 case PGREQ_EXTENDED_COMMAND: 3.97 - cur->ptr &= ~(sizeof(l1_pgentry_t) - 1); 3.98 - err = do_extended_command(cur->ptr, cur->val); 3.99 + req.ptr &= ~(sizeof(l1_pgentry_t) - 1); 3.100 + err = do_extended_command(req.ptr, req.val); 3.101 break; 3.102 3.103 + case PGREQ_UNCHECKED_UPDATE: 3.104 + req.ptr &= ~(sizeof(l1_pgentry_t) - 1); 3.105 + if ( current->domain == 0 ) 3.106 + { 3.107 + unsigned long *ptr = map_domain_mem(req.ptr); 3.108 + *ptr = req.val; 3.109 + unmap_domain_mem(ptr); 3.110 + err = 0; 3.111 + } 3.112 + else 3.113 + { 3.114 + MEM_LOG("Bad unchecked update attempt"); 3.115 + } 3.116 + break; 3.117 + 3.118 default: 3.119 - MEM_LOG("Invalid page update command %08lx", cur->ptr); 3.120 + MEM_LOG("Invalid page update command %08lx", req.ptr); 3.121 break; 3.122 } 3.123 3.124 @@ -800,7 +801,7 @@ int do_process_page_updates_bh(page_upda 3.125 kill_domain_with_errmsg("Illegal page update request"); 3.126 } 3.127 3.128 - cur++; 3.129 + ureqs++; 3.130 } 3.131 3.132 if ( tlb_flush[smp_processor_id()] ) 3.133 @@ -809,20 +810,8 @@ int do_process_page_updates_bh(page_upda 3.134 __asm__ __volatile__ ( 3.135 "movl %%eax,%%cr3" : : 3.136 "a" (pagetable_val(current->mm.pagetable))); 3.137 + 3.138 } 3.139 3.140 return(0); 3.141 } 3.142 - 3.143 -/* Apply updates to page table @pagetable_id within the current domain. */ 3.144 -int do_process_page_updates(page_update_request_t *updates, int count) 3.145 -{ 3.146 - page_update_request_t * pg_updates; 3.147 - int ret; 3.148 - 3.149 - pg_updates = do_process_page_updates_uh(updates, count); 3.150 - ret = do_process_page_updates_bh(pg_updates, count); 3.151 - kfree(pg_updates); 3.152 - 3.153 - return ret; 3.154 -}
4.1 --- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h Tue Feb 04 15:47:11 2003 +0000 4.2 +++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h Tue Feb 04 22:08:19 2003 +0000 4.3 @@ -43,6 +43,8 @@ typedef struct 4.4 #define PGREQ_MPT_UPDATE 1 4.5 /* An extended command. */ 4.6 #define PGREQ_EXTENDED_COMMAND 2 4.7 +/* DOM0 can make entirely unchecked updates which do not affect refcnts. */ 4.8 +#define PGREQ_UNCHECKED_UPDATE 3 4.9 unsigned long ptr, val; /* *ptr = val */ 4.10 /* Announce a new top-level page table. */ 4.11 #define PGEXT_PIN_L1_TABLE 0 4.12 @@ -53,7 +55,6 @@ typedef struct 4.13 #define PGEXT_NEW_BASEPTR 5 4.14 #define PGEXT_TLB_FLUSH 6 4.15 #define PGEXT_INVLPG 7 4.16 -#define PGEXT_ 4.17 #define PGEXT_CMD_MASK 255 4.18 #define PGEXT_CMD_SHIFT 8 4.19 } page_update_request_t;
5.1 --- a/xen-2.4.16/include/xeno/dom0_ops.h Tue Feb 04 15:47:11 2003 +0000 5.2 +++ b/xen-2.4.16/include/xeno/dom0_ops.h Tue Feb 04 22:08:19 2003 +0000 5.3 @@ -43,8 +43,6 @@ typedef struct domain_launch 5.4 unsigned long virt_load_addr; 5.5 unsigned long virt_shinfo_addr; 5.6 unsigned long virt_startinfo_addr; 5.7 - unsigned long pgt_update_arr; 5.8 - unsigned long num_pgt_updates; 5.9 unsigned int num_vifs; 5.10 char cmd_line[MAX_CMD_LEN]; 5.11 } dom_meminfo_t;
6.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c Tue Feb 04 15:47:11 2003 +0000 6.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c Tue Feb 04 22:08:19 2003 +0000 6.3 @@ -1,4 +1,3 @@ 6.4 - 6.5 /****************************************************************************** 6.6 * dom0_core.c 6.7 * 6.8 @@ -31,9 +30,19 @@ 6.9 #include <asm/tlb.h> 6.10 6.11 #include "dom0_ops.h" 6.12 -#include "hypervisor_defs.h" 6.13 + 6.14 +/* Private proc-file data structures. */ 6.15 +typedef struct proc_data { 6.16 + unsigned int domain; 6.17 + unsigned long map_size; 6.18 +} dom_procdata_t; 6.19 6.20 -#define XENO_BASE "xeno" // proc file name defs should be in separate .h 6.21 +typedef struct proc_mem_data { 6.22 + unsigned long pfn; 6.23 + int tot_pages; 6.24 +} proc_memdata_t; 6.25 + 6.26 +#define XENO_BASE "xeno" 6.27 #define DOM0_CMD_INTF "dom0_cmd" 6.28 #define DOM0_NEWDOM "new_dom_data" 6.29 6.30 @@ -195,9 +204,18 @@ static int cmd_write_proc(struct file *f 6.31 goto out; 6.32 } 6.33 6.34 - /* is the request intended for hypervisor? */ 6.35 - if(op.cmd != MAP_DOM_MEM){ 6.36 - 6.37 + if ( op.cmd == MAP_DOM_MEM ) 6.38 + { 6.39 + ret = dom_map_mem(op.u.dommem.domain, op.u.dommem.start_pfn, 6.40 + op.u.dommem.tot_pages); 6.41 + } 6.42 + else if ( op.cmd == DO_PGUPDATES ) 6.43 + { 6.44 + ret = HYPERVISOR_pt_update((void *)op.u.pgupdate.pgt_update_arr, 6.45 + op.u.pgupdate.num_pgt_updates); 6.46 + } 6.47 + else 6.48 + { 6.49 ret = HYPERVISOR_dom0_op(&op); 6.50 6.51 /* if new domain created, create proc entries */ 6.52 @@ -223,10 +241,6 @@ static int cmd_write_proc(struct file *f 6.53 6.54 } 6.55 6.56 - } else { 6.57 - 6.58 - ret = dom_map_mem(op.u.dommem.domain, op.u.dommem.start_pfn, 6.59 - op.u.dommem.tot_pages); 6.60 } 6.61 6.62 out:
7.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c Tue Feb 04 15:47:11 2003 +0000 7.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c Tue Feb 04 22:08:19 2003 +0000 7.3 @@ -14,7 +14,6 @@ 7.4 #include <asm/tlb.h> 7.5 #include <asm/mmu.h> 7.6 7.7 -#include "hypervisor_defs.h" 7.8 #include "dom0_ops.h" 7.9 7.10 #define MAP_CONT 0 7.11 @@ -22,14 +21,15 @@ 7.12 7.13 extern struct list_head * find_direct(struct list_head *, unsigned long); 7.14 7.15 -/* bd240: functions below perform direct mapping to the real physical pages needed for 7.16 - * mapping various hypervisor specific structures needed in dom0 userspace by various 7.17 - * management applications such as domain builder etc. 7.18 +/* 7.19 + * bd240: functions below perform direct mapping to the real physical pages 7.20 + * needed for mapping various hypervisor specific structures needed in dom0 7.21 + * userspace by various management applications such as domain builder etc. 7.22 */ 7.23 7.24 -#define direct_set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low) 7.25 +#define direct_set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr)|PGREQ_UNCHECKED_UPDATE, (pteval).pte_low) 7.26 7.27 -#define direct_pte_clear(pteptr) queue_l1_entry_update(__pa(pteptr), 0) 7.28 +#define direct_pte_clear(pteptr) queue_l1_entry_update(__pa(pteptr)|PGREQ_UNCHECKED_UPDATE, 0) 7.29 7.30 #define __direct_pte(x) ((pte_t) { (x) } ) 7.31 #define __direct_mk_pte(page_nr,pgprot) __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
8.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h Tue Feb 04 15:47:11 2003 +0000 8.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_ops.h Tue Feb 04 22:08:19 2003 +0000 8.3 @@ -9,9 +9,10 @@ 8.4 #define DOM0_NEWDOMAIN 0 8.5 #define DOM0_KILLDOMAIN 1 8.6 #define DOM0_GETMEMLIST 2 8.7 -#define MAP_DOM_MEM 3 8.8 #define DOM0_STARTDOM 4 8.9 -#define MAX_CMD 4 8.10 +#define MAP_DOM_MEM 6 /* Not passed down to Xen */ 8.11 +#define DO_PGUPDATES 7 /* Not passed down to Xen */ 8.12 +#define MAX_CMD 8 8.13 8.14 #define MAX_CMD_LEN 256 8.15 8.16 @@ -35,6 +36,7 @@ typedef struct dom0_getmemlist_st 8.17 void *buffer; 8.18 } dom0_getmemlist_t; 8.19 8.20 +/* This is entirely processed by XenoLinux */ 8.21 typedef struct dom_mem 8.22 { 8.23 unsigned int domain; 8.24 @@ -43,6 +45,13 @@ typedef struct dom_mem 8.25 int tot_pages; 8.26 } dom_mem_t; 8.27 8.28 +/* This is entirely processed by XenoLinux */ 8.29 +typedef struct dom_pgupdate 8.30 +{ 8.31 + unsigned long pgt_update_arr; 8.32 + unsigned long num_pgt_updates; 8.33 +} dom_pgupdate_t; 8.34 + 8.35 typedef struct domain_launch 8.36 { 8.37 unsigned int domain; 8.38 @@ -50,8 +59,6 @@ typedef struct domain_launch 8.39 unsigned long virt_load_addr; 8.40 unsigned long virt_shinfo_addr; 8.41 unsigned long virt_startinfo_addr; 8.42 - unsigned long pgt_update_arr; 8.43 - unsigned long num_pgt_updates; 8.44 unsigned int num_vifs; 8.45 char cmd_line[MAX_CMD_LEN]; 8.46 } dom_meminfo_t; 8.47 @@ -65,6 +72,7 @@ typedef struct dom0_op_st 8.48 dom0_killdomain_t killdomain; 8.49 dom0_getmemlist_t getmemlist; 8.50 dom_mem_t dommem; 8.51 + dom_pgupdate_t pgupdate; 8.52 dom_meminfo_t meminfo; 8.53 } 8.54 u;
9.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/hypervisor_defs.h Tue Feb 04 15:47:11 2003 +0000 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,21 +0,0 @@ 9.4 - 9.5 -/****************************************************************************** 9.6 - * dom0_ops.h 9.7 - * 9.8 - * Data structures defined in hypervisor code but needed in DOM0 as well. 9.9 - * Contents of this file should be kept in sync with the hypervisor ones 9.10 - * unless you do not want something terrible :) to happen. 9.11 - * 9.12 - * Copyright (c) 2002, Keir Fraser & Boris Dragovic 9.13 - */ 9.14 - 9.15 - 9.16 -typedef struct proc_data { 9.17 - unsigned int domain; 9.18 - unsigned long map_size; 9.19 -} dom_procdata_t; 9.20 - 9.21 -typedef struct proc_mem_data { 9.22 - unsigned long pfn; 9.23 - int tot_pages; 9.24 -} proc_memdata_t;