ia64/xen-unstable
changeset 6854:9af349b055e5
Merge latest xen-unstable into xen-ia64-unstable to prep
for push back to xen-unstable
for push back to xen-unstable
line diff
1.1 --- a/.hgignore Wed Sep 14 15:33:52 2005 -0600 1.2 +++ b/.hgignore Wed Sep 14 15:36:10 2005 -0600 1.3 @@ -84,7 +84,6 @@ 1.4 ^tools/blktap/ublkback/ublkback$ 1.5 ^tools/blktap/xen/.*$ 1.6 ^tools/check/\..*$ 1.7 -^tools/examples/xmexample\.vmx$ 1.8 ^tools/console/xenconsoled$ 1.9 ^tools/console/xenconsole$ 1.10 ^tools/debugger/pdb/pdb$
11.1 --- a/docs/misc/sedf_scheduler_mini-HOWTO.txt Wed Sep 14 15:33:52 2005 -0600 11.2 +++ b/docs/misc/sedf_scheduler_mini-HOWTO.txt Wed Sep 14 15:36:10 2005 -0600 11.3 @@ -10,7 +10,7 @@ Overview: 11.4 Usage: 11.5 -add "sched=sedf" on Xen's boot command-line 11.6 -create domains as usual 11.7 - -use "xm sedf <dom-id> <period> <slice> <latency-hint> <extra> <weight>" 11.8 + -use "xm sched-sedf <dom-id> <period> <slice> <latency-hint> <extra> <weight>" 11.9 Where: 11.10 -period/slice are the normal EDF scheduling parameters in nanosecs 11.11 -latency-hint is the scaled period in case the domain is doing heavy I/O 11.12 @@ -22,23 +22,23 @@ Usage: 11.13 11.14 Examples: 11.15 normal EDF (20ms/5ms): 11.16 - xm sedf <dom-id> 20000000 5000000 0 0 0 11.17 + xm sched-sedf <dom-id> 20000000 5000000 0 0 0 11.18 11.19 best-effort domains (i.e. non-realtime): 11.20 - xm sedf <dom-id> 20000000 0 0 1 0 11.21 + xm sched-sedf <dom-id> 20000000 0 0 1 0 11.22 11.23 normal EDF (20ms/5ms) + share of extra-time: 11.24 - xm sedf <dom-id> 20000000 5000000 0 1 0 11.25 + xm sched-sedf <dom-id> 20000000 5000000 0 1 0 11.26 11.27 4 domains with weights 2:3:4:2 11.28 - xm sedf <d1> 0 0 0 0 2 11.29 - xm sedf <d2> 0 0 0 0 3 11.30 - xm sedf <d3> 0 0 0 0 4 11.31 - xm sedf <d4> 0 0 0 0 2 11.32 + xm sched-sedf <d1> 0 0 0 0 2 11.33 + xm sched-sedf <d2> 0 0 0 0 3 11.34 + xm sched-sedf <d3> 0 0 0 0 4 11.35 + xm sched-sedf <d4> 0 0 0 0 2 11.36 11.37 1 fully-specified (10ms/3ms) domain, 3 other domains share 11.38 available rest in 2:7:3 ratio: 11.39 - xm sedf <d1> 10000000 3000000 0 0 0 11.40 - xm sedf <d2> 0 0 0 0 2 11.41 - xm sedf <d3> 0 0 0 0 7 11.42 - xm sedf <d4> 0 0 0 0 3 11.43 \ No newline at end of file 11.44 + xm sched-sedf <d1> 10000000 3000000 0 0 0 11.45 + xm sched-sedf <d2> 0 0 0 0 2 11.46 + xm sched-sedf <d3> 0 0 0 0 7 11.47 + xm sched-sedf <d4> 0 0 0 0 3
25.1 --- a/extras/mini-os/include/hypervisor.h Wed Sep 14 15:33:52 2005 -0600 25.2 +++ b/extras/mini-os/include/hypervisor.h Wed Sep 14 15:36:10 2005 -0600 25.3 @@ -14,9 +14,6 @@ 25.4 25.5 #include <types.h> 25.6 #include <xen/xen.h> 25.7 -#include <xen/io/domain_controller.h> 25.8 - 25.9 - 25.10 25.11 /* 25.12 * a placeholder for the start of day information passed up from the hypervisor
42.1 --- a/extras/mini-os/mm.c Wed Sep 14 15:33:52 2005 -0600 42.2 +++ b/extras/mini-os/mm.c Wed Sep 14 15:36:10 2005 -0600 42.3 @@ -432,7 +432,7 @@ void build_pagetable(unsigned long *star 42.4 42.5 /* Pin the page to provide correct protection */ 42.6 pin_request.cmd = MMUEXT_PIN_L1_TABLE; 42.7 - pin_request.mfn = pfn_to_mfn(pt_frame); 42.8 + pin_request.arg1.mfn = pfn_to_mfn(pt_frame); 42.9 if(HYPERVISOR_mmuext_op(&pin_request, 1, NULL, DOMID_SELF) < 0) 42.10 { 42.11 printk("ERROR: pinning failed\n");
147.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c Wed Sep 14 15:33:52 2005 -0600 147.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c Wed Sep 14 15:36:10 2005 -0600 147.3 @@ -15,7 +15,7 @@ 147.4 #include <asm/apic.h> 147.5 #include <mach_apic.h> 147.6 #endif 147.7 -#include <asm-xen/hypervisor.h> 147.8 +#include <asm/hypervisor.h> 147.9 147.10 #include "cpu.h" 147.11
162.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Wed Sep 14 15:33:52 2005 -0600 162.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Wed Sep 14 15:36:10 2005 -0600 162.3 @@ -53,7 +53,7 @@ 162.4 #include <asm/io_apic.h> 162.5 #include <asm/ist.h> 162.6 #include <asm/io.h> 162.7 -#include <asm-xen/hypervisor.h> 162.8 +#include <asm/hypervisor.h> 162.9 #include <asm-xen/xen-public/physdev.h> 162.10 #include <asm-xen/xen-public/memory.h> 162.11 #include "setup_arch_pre.h"
174.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c Wed Sep 14 15:33:52 2005 -0600 174.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c Wed Sep 14 15:36:10 2005 -0600 174.3 @@ -33,7 +33,7 @@ 174.4 #include <linux/vmalloc.h> 174.5 #include <asm/page.h> 174.6 #include <asm/pgtable.h> 174.7 -#include <asm-xen/hypervisor.h> 174.8 +#include <asm/hypervisor.h> 174.9 #include <asm-xen/balloon.h> 174.10 #include <asm-xen/xen-public/memory.h> 174.11 #include <linux/module.h> 174.12 @@ -115,7 +115,7 @@ void xen_pt_switch(unsigned long ptr) 174.13 { 174.14 struct mmuext_op op; 174.15 op.cmd = MMUEXT_NEW_BASEPTR; 174.16 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.17 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.18 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.19 } 174.20 174.21 @@ -123,7 +123,7 @@ void xen_new_user_pt(unsigned long ptr) 174.22 { 174.23 struct mmuext_op op; 174.24 op.cmd = MMUEXT_NEW_USER_BASEPTR; 174.25 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.26 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.27 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.28 } 174.29 174.30 @@ -138,7 +138,7 @@ void xen_invlpg(unsigned long ptr) 174.31 { 174.32 struct mmuext_op op; 174.33 op.cmd = MMUEXT_INVLPG_LOCAL; 174.34 - op.linear_addr = ptr & PAGE_MASK; 174.35 + op.arg1.linear_addr = ptr & PAGE_MASK; 174.36 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.37 } 174.38 174.39 @@ -157,7 +157,7 @@ void xen_tlb_flush_mask(cpumask_t *mask) 174.40 if ( cpus_empty(*mask) ) 174.41 return; 174.42 op.cmd = MMUEXT_TLB_FLUSH_MULTI; 174.43 - op.vcpumask = mask->bits; 174.44 + op.arg2.vcpumask = mask->bits; 174.45 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.46 } 174.47 174.48 @@ -165,7 +165,7 @@ void xen_invlpg_all(unsigned long ptr) 174.49 { 174.50 struct mmuext_op op; 174.51 op.cmd = MMUEXT_INVLPG_ALL; 174.52 - op.linear_addr = ptr & PAGE_MASK; 174.53 + op.arg1.linear_addr = ptr & PAGE_MASK; 174.54 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.55 } 174.56 174.57 @@ -175,8 +175,8 @@ void xen_invlpg_mask(cpumask_t *mask, un 174.58 if ( cpus_empty(*mask) ) 174.59 return; 174.60 op.cmd = MMUEXT_INVLPG_MULTI; 174.61 - op.vcpumask = mask->bits; 174.62 - op.linear_addr = ptr & PAGE_MASK; 174.63 + op.arg1.linear_addr = ptr & PAGE_MASK; 174.64 + op.arg2.vcpumask = mask->bits; 174.65 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.66 } 174.67 174.68 @@ -193,7 +193,7 @@ void xen_pgd_pin(unsigned long ptr) 174.69 #else 174.70 op.cmd = MMUEXT_PIN_L2_TABLE; 174.71 #endif 174.72 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.73 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.74 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.75 } 174.76 174.77 @@ -201,7 +201,7 @@ void xen_pgd_unpin(unsigned long ptr) 174.78 { 174.79 struct mmuext_op op; 174.80 op.cmd = MMUEXT_UNPIN_TABLE; 174.81 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.82 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.83 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.84 } 174.85 174.86 @@ -209,7 +209,7 @@ void xen_pte_pin(unsigned long ptr) 174.87 { 174.88 struct mmuext_op op; 174.89 op.cmd = MMUEXT_PIN_L1_TABLE; 174.90 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.91 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.92 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.93 } 174.94 174.95 @@ -217,7 +217,7 @@ void xen_pte_unpin(unsigned long ptr) 174.96 { 174.97 struct mmuext_op op; 174.98 op.cmd = MMUEXT_UNPIN_TABLE; 174.99 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.100 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.101 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.102 } 174.103 174.104 @@ -226,7 +226,7 @@ void xen_pud_pin(unsigned long ptr) 174.105 { 174.106 struct mmuext_op op; 174.107 op.cmd = MMUEXT_PIN_L3_TABLE; 174.108 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.109 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.110 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.111 } 174.112 174.113 @@ -234,7 +234,7 @@ void xen_pud_unpin(unsigned long ptr) 174.114 { 174.115 struct mmuext_op op; 174.116 op.cmd = MMUEXT_UNPIN_TABLE; 174.117 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.118 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.119 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.120 } 174.121 174.122 @@ -242,7 +242,7 @@ void xen_pmd_pin(unsigned long ptr) 174.123 { 174.124 struct mmuext_op op; 174.125 op.cmd = MMUEXT_PIN_L2_TABLE; 174.126 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.127 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.128 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.129 } 174.130 174.131 @@ -250,7 +250,7 @@ void xen_pmd_unpin(unsigned long ptr) 174.132 { 174.133 struct mmuext_op op; 174.134 op.cmd = MMUEXT_UNPIN_TABLE; 174.135 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.136 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 174.137 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.138 } 174.139 #endif /* CONFIG_X86_64 */ 174.140 @@ -260,8 +260,8 @@ void xen_set_ldt(unsigned long ptr, unsi 174.141 { 174.142 struct mmuext_op op; 174.143 op.cmd = MMUEXT_SET_LDT; 174.144 - op.linear_addr = ptr; 174.145 - op.nr_ents = len; 174.146 + op.arg1.linear_addr = ptr; 174.147 + op.arg2.nr_ents = len; 174.148 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 174.149 } 174.150
175.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c Wed Sep 14 15:33:52 2005 -0600 175.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c Wed Sep 14 15:36:10 2005 -0600 175.3 @@ -39,7 +39,7 @@ 175.4 #include <asm/tlb.h> 175.5 #include <asm/tlbflush.h> 175.6 #include <asm/sections.h> 175.7 -#include <asm-xen/hypervisor.h> 175.8 +#include <asm/hypervisor.h> 175.9 175.10 extern unsigned long *contiguous_bitmap; 175.11
177.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c Wed Sep 14 15:33:52 2005 -0600 177.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c Wed Sep 14 15:36:10 2005 -0600 177.3 @@ -25,7 +25,7 @@ 177.4 #include <asm/mmu_context.h> 177.5 177.6 #include <asm-xen/foreign_page.h> 177.7 -#include <asm-xen/hypervisor.h> 177.8 +#include <asm/hypervisor.h> 177.9 177.10 void show_mem(void) 177.11 {
178.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile Wed Sep 14 15:33:52 2005 -0600 178.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile Wed Sep 14 15:36:10 2005 -0600 178.3 @@ -2,7 +2,7 @@ XENARCH := $(subst ",,$(CONFIG_XENARCH)) 178.4 178.5 CFLAGS += -Iarch/$(XENARCH)/pci 178.6 178.7 -c-obj-y := i386.o 178.8 +obj-y := i386.o 178.9 178.10 #c-obj-$(CONFIG_PCI_BIOS) += pcbios.o 178.11 c-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
179.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 179.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/pci/i386.c Wed Sep 14 15:36:10 2005 -0600 179.3 @@ -0,0 +1,304 @@ 179.4 +/* 179.5 + * Low-Level PCI Access for i386 machines 179.6 + * 179.7 + * Copyright 1993, 1994 Drew Eckhardt 179.8 + * Visionary Computing 179.9 + * (Unix and Linux consulting and custom programming) 179.10 + * Drew@Colorado.EDU 179.11 + * +1 (303) 786-7975 179.12 + * 179.13 + * Drew's work was sponsored by: 179.14 + * iX Multiuser Multitasking Magazine 179.15 + * Hannover, Germany 179.16 + * hm@ix.de 179.17 + * 179.18 + * Copyright 1997--2000 Martin Mares <mj@ucw.cz> 179.19 + * 179.20 + * For more information, please consult the following manuals (look at 179.21 + * http://www.pcisig.com/ for how to get them): 179.22 + * 179.23 + * PCI BIOS Specification 179.24 + * PCI Local Bus Specification 179.25 + * PCI to PCI Bridge Specification 179.26 + * PCI System Design Guide 179.27 + * 179.28 + */ 179.29 + 179.30 +#include <linux/types.h> 179.31 +#include <linux/kernel.h> 179.32 +#include <linux/pci.h> 179.33 +#include <linux/init.h> 179.34 +#include <linux/ioport.h> 179.35 +#include <linux/errno.h> 179.36 + 179.37 +#include "pci.h" 179.38 + 179.39 +/* 179.40 + * We need to avoid collisions with `mirrored' VGA ports 179.41 + * and other strange ISA hardware, so we always want the 179.42 + * addresses to be allocated in the 0x000-0x0ff region 179.43 + * modulo 0x400. 179.44 + * 179.45 + * Why? Because some silly external IO cards only decode 179.46 + * the low 10 bits of the IO address. The 0x00-0xff region 179.47 + * is reserved for motherboard devices that decode all 16 179.48 + * bits, so it's ok to allocate at, say, 0x2800-0x28ff, 179.49 + * but we want to try to avoid allocating at 0x2900-0x2bff 179.50 + * which might have be mirrored at 0x0100-0x03ff.. 179.51 + */ 179.52 +void 179.53 +pcibios_align_resource(void *data, struct resource *res, 179.54 + unsigned long size, unsigned long align) 179.55 +{ 179.56 + if (res->flags & IORESOURCE_IO) { 179.57 + unsigned long start = res->start; 179.58 + 179.59 + if (start & 0x300) { 179.60 + start = (start + 0x3ff) & ~0x3ff; 179.61 + res->start = start; 179.62 + } 179.63 + } 179.64 +} 179.65 + 179.66 + 179.67 +/* 179.68 + * Handle resources of PCI devices. If the world were perfect, we could 179.69 + * just allocate all the resource regions and do nothing more. It isn't. 179.70 + * On the other hand, we cannot just re-allocate all devices, as it would 179.71 + * require us to know lots of host bridge internals. So we attempt to 179.72 + * keep as much of the original configuration as possible, but tweak it 179.73 + * when it's found to be wrong. 179.74 + * 179.75 + * Known BIOS problems we have to work around: 179.76 + * - I/O or memory regions not configured 179.77 + * - regions configured, but not enabled in the command register 179.78 + * - bogus I/O addresses above 64K used 179.79 + * - expansion ROMs left enabled (this may sound harmless, but given 179.80 + * the fact the PCI specs explicitly allow address decoders to be 179.81 + * shared between expansion ROMs and other resource regions, it's 179.82 + * at least dangerous) 179.83 + * 179.84 + * Our solution: 179.85 + * (1) Allocate resources for all buses behind PCI-to-PCI bridges. 179.86 + * This gives us fixed barriers on where we can allocate. 179.87 + * (2) Allocate resources for all enabled devices. If there is 179.88 + * a collision, just mark the resource as unallocated. Also 179.89 + * disable expansion ROMs during this step. 179.90 + * (3) Try to allocate resources for disabled devices. If the 179.91 + * resources were assigned correctly, everything goes well, 179.92 + * if they weren't, they won't disturb allocation of other 179.93 + * resources. 179.94 + * (4) Assign new addresses to resources which were either 179.95 + * not configured at all or misconfigured. If explicitly 179.96 + * requested by the user, configure expansion ROM address 179.97 + * as well. 179.98 + */ 179.99 + 179.100 +static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) 179.101 +{ 179.102 + struct pci_bus *bus; 179.103 + struct pci_dev *dev; 179.104 + int idx; 179.105 + struct resource *r, *pr; 179.106 + 179.107 + /* Depth-First Search on bus tree */ 179.108 + list_for_each_entry(bus, bus_list, node) { 179.109 + if ((dev = bus->self)) { 179.110 + for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { 179.111 + r = &dev->resource[idx]; 179.112 + if (!r->start) 179.113 + continue; 179.114 + pr = pci_find_parent_resource(dev, r); 179.115 + if (!pr || request_resource(pr, r) < 0) 179.116 + printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); 179.117 + } 179.118 + } 179.119 + pcibios_allocate_bus_resources(&bus->children); 179.120 + } 179.121 +} 179.122 + 179.123 +static void __init pcibios_allocate_resources(int pass) 179.124 +{ 179.125 + struct pci_dev *dev = NULL; 179.126 + int idx, disabled; 179.127 + u16 command; 179.128 + struct resource *r, *pr; 179.129 + 179.130 + for_each_pci_dev(dev) { 179.131 + pci_read_config_word(dev, PCI_COMMAND, &command); 179.132 + for(idx = 0; idx < 6; idx++) { 179.133 + r = &dev->resource[idx]; 179.134 + if (r->parent) /* Already allocated */ 179.135 + continue; 179.136 + if (!r->start) /* Address not assigned at all */ 179.137 + continue; 179.138 + if (r->flags & IORESOURCE_IO) 179.139 + disabled = !(command & PCI_COMMAND_IO); 179.140 + else 179.141 + disabled = !(command & PCI_COMMAND_MEMORY); 179.142 + if (pass == disabled) { 179.143 + DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", 179.144 + r->start, r->end, r->flags, disabled, pass); 179.145 + pr = pci_find_parent_resource(dev, r); 179.146 + if (!pr || request_resource(pr, r) < 0) { 179.147 + printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, pci_name(dev)); 179.148 + /* We'll assign a new address later */ 179.149 + r->end -= r->start; 179.150 + r->start = 0; 179.151 + } 179.152 + } 179.153 + } 179.154 + if (!pass) { 179.155 + r = &dev->resource[PCI_ROM_RESOURCE]; 179.156 + if (r->flags & IORESOURCE_ROM_ENABLE) { 179.157 + /* Turn the ROM off, leave the resource region, but keep it unregistered. */ 179.158 + u32 reg; 179.159 + DBG("PCI: Switching off ROM of %s\n", pci_name(dev)); 179.160 + r->flags &= ~IORESOURCE_ROM_ENABLE; 179.161 + pci_read_config_dword(dev, dev->rom_base_reg, ®); 179.162 + pci_write_config_dword(dev, dev->rom_base_reg, reg & ~PCI_ROM_ADDRESS_ENABLE); 179.163 + } 179.164 + } 179.165 + } 179.166 +} 179.167 + 179.168 +static int __init pcibios_assign_resources(void) 179.169 +{ 179.170 + struct pci_dev *dev = NULL; 179.171 + int idx; 179.172 + struct resource *r; 179.173 + 179.174 + for_each_pci_dev(dev) { 179.175 + int class = dev->class >> 8; 179.176 + 179.177 + /* Don't touch classless devices and host bridges */ 179.178 + if (!class || class == PCI_CLASS_BRIDGE_HOST) 179.179 + continue; 179.180 + 179.181 + for(idx=0; idx<6; idx++) { 179.182 + r = &dev->resource[idx]; 179.183 + 179.184 + /* 179.185 + * Don't touch IDE controllers and I/O ports of video cards! 179.186 + */ 179.187 + if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) || 179.188 + (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO))) 179.189 + continue; 179.190 + 179.191 + /* 179.192 + * We shall assign a new address to this resource, either because 179.193 + * the BIOS forgot to do so or because we have decided the old 179.194 + * address was unusable for some reason. 179.195 + */ 179.196 + if (!r->start && r->end) 179.197 + pci_assign_resource(dev, idx); 179.198 + } 179.199 + 179.200 + if (pci_probe & PCI_ASSIGN_ROMS) { 179.201 + r = &dev->resource[PCI_ROM_RESOURCE]; 179.202 + r->end -= r->start; 179.203 + r->start = 0; 179.204 + if (r->end) 179.205 + pci_assign_resource(dev, PCI_ROM_RESOURCE); 179.206 + } 179.207 + } 179.208 + return 0; 179.209 +} 179.210 + 179.211 +void __init pcibios_resource_survey(void) 179.212 +{ 179.213 + DBG("PCI: Allocating resources\n"); 179.214 + pcibios_allocate_bus_resources(&pci_root_buses); 179.215 + pcibios_allocate_resources(0); 179.216 + pcibios_allocate_resources(1); 179.217 +} 179.218 + 179.219 +/** 179.220 + * called in fs_initcall (one below subsys_initcall), 179.221 + * give a chance for motherboard reserve resources 179.222 + */ 179.223 +fs_initcall(pcibios_assign_resources); 179.224 + 179.225 +int pcibios_enable_resources(struct pci_dev *dev, int mask) 179.226 +{ 179.227 + u16 cmd, old_cmd; 179.228 + int idx; 179.229 + struct resource *r; 179.230 + 179.231 + pci_read_config_word(dev, PCI_COMMAND, &cmd); 179.232 + old_cmd = cmd; 179.233 + for(idx=0; idx<6; idx++) { 179.234 + /* Only set up the requested stuff */ 179.235 + if (!(mask & (1<<idx))) 179.236 + continue; 179.237 + 179.238 + r = &dev->resource[idx]; 179.239 + if (!r->start && r->end) { 179.240 + printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); 179.241 + return -EINVAL; 179.242 + } 179.243 + if (r->flags & IORESOURCE_IO) 179.244 + cmd |= PCI_COMMAND_IO; 179.245 + if (r->flags & IORESOURCE_MEM) 179.246 + cmd |= PCI_COMMAND_MEMORY; 179.247 + } 179.248 + if (dev->resource[PCI_ROM_RESOURCE].start) 179.249 + cmd |= PCI_COMMAND_MEMORY; 179.250 + if (cmd != old_cmd) { 179.251 + printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); 179.252 + pci_write_config_word(dev, PCI_COMMAND, cmd); 179.253 + } 179.254 + return 0; 179.255 +} 179.256 + 179.257 +/* 179.258 + * If we set up a device for bus mastering, we need to check the latency 179.259 + * timer as certain crappy BIOSes forget to set it properly. 179.260 + */ 179.261 +unsigned int pcibios_max_latency = 255; 179.262 + 179.263 +void pcibios_set_master(struct pci_dev *dev) 179.264 +{ 179.265 + u8 lat; 179.266 + pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); 179.267 + if (lat < 16) 179.268 + lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency; 179.269 + else if (lat > pcibios_max_latency) 179.270 + lat = pcibios_max_latency; 179.271 + else 179.272 + return; 179.273 + printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat); 179.274 + pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 179.275 +} 179.276 + 179.277 +int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 179.278 + enum pci_mmap_state mmap_state, int write_combine) 179.279 +{ 179.280 + unsigned long prot; 179.281 + 179.282 + /* I/O space cannot be accessed via normal processor loads and 179.283 + * stores on this platform. 179.284 + */ 179.285 + if (mmap_state == pci_mmap_io) 179.286 + return -EINVAL; 179.287 + 179.288 + /* Leave vm_pgoff as-is, the PCI space address is the physical 179.289 + * address on this platform. 179.290 + */ 179.291 + vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO); 179.292 + 179.293 + prot = pgprot_val(vma->vm_page_prot); 179.294 + if (boot_cpu_data.x86 > 3) 179.295 + prot |= _PAGE_PCD | _PAGE_PWT; 179.296 + vma->vm_page_prot = __pgprot(prot); 179.297 + 179.298 + /* Write-combine setting is ignored, it is changed via the mtrr 179.299 + * interfaces on this platform. 179.300 + */ 179.301 + if (direct_remap_pfn_range(vma->vm_mm, vma->vm_start, vma->vm_pgoff, 179.302 + vma->vm_end - vma->vm_start, 179.303 + vma->vm_page_prot, DOMID_IO)) 179.304 + return -EAGAIN; 179.305 + 179.306 + return 0; 179.307 +}
182.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Wed Sep 14 15:33:52 2005 -0600 182.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Wed Sep 14 15:36:10 2005 -0600 182.3 @@ -27,7 +27,7 @@ 182.4 #include <asm/uaccess.h> 182.5 #include <asm/io.h> 182.6 182.7 -static inline int uncached_access(struct file *file, unsigned long addr) 182.8 +static inline int uncached_access(struct file *file) 182.9 { 182.10 if (file->f_flags & O_SYNC) 182.11 return 1; 182.12 @@ -90,10 +90,9 @@ out: 182.13 182.14 static int mmap_mem(struct file * file, struct vm_area_struct * vma) 182.15 { 182.16 - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 182.17 int uncached; 182.18 182.19 - uncached = uncached_access(file, offset); 182.20 + uncached = uncached_access(file); 182.21 if (uncached) 182.22 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 182.23 182.24 @@ -106,8 +105,9 @@ static int mmap_mem(struct file * file, 182.25 if (uncached) 182.26 vma->vm_flags |= VM_IO; 182.27 182.28 - if (io_remap_page_range(vma, vma->vm_start, offset, 182.29 - vma->vm_end-vma->vm_start, vma->vm_page_prot)) 182.30 + if (direct_remap_pfn_range(vma->vm_mm, vma->vm_start, vma->vm_pgoff, 182.31 + vma->vm_end - vma->vm_start, 182.32 + vma->vm_page_prot, DOMID_IO)) 182.33 return -EAGAIN; 182.34 182.35 return 0;
183.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Sep 14 15:33:52 2005 -0600 183.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Sep 14 15:36:10 2005 -0600 183.3 @@ -40,7 +40,7 @@ 183.4 #include <asm/synch_bitops.h> 183.5 #include <asm-xen/xen-public/event_channel.h> 183.6 #include <asm-xen/xen-public/physdev.h> 183.7 -#include <asm-xen/hypervisor.h> 183.8 +#include <asm/hypervisor.h> 183.9 #include <asm-xen/evtchn.h> 183.10 183.11 /*
186.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Wed Sep 14 15:33:52 2005 -0600 186.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Wed Sep 14 15:36:10 2005 -0600 186.3 @@ -10,7 +10,7 @@ 186.4 #include <asm/irq.h> 186.5 #include <asm/mmu_context.h> 186.6 #include <asm-xen/evtchn.h> 186.7 -#include <asm-xen/hypervisor.h> 186.8 +#include <asm/hypervisor.h> 186.9 #include <asm-xen/xen-public/dom0_ops.h> 186.10 #include <asm-xen/queues.h> 186.11 #include <asm-xen/xenbus.h> 186.12 @@ -320,20 +320,28 @@ static void __shutdown_handler(void *unu 186.13 static void shutdown_handler(struct xenbus_watch *watch, const char *node) 186.14 { 186.15 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); 186.16 + char *str; 186.17 + int err; 186.18 186.19 - char *str; 186.20 - 186.21 + again: 186.22 + err = xenbus_transaction_start("control"); 186.23 + if (err) 186.24 + return; 186.25 str = (char *)xenbus_read("control", "shutdown", NULL); 186.26 - /* Ignore read errors. */ 186.27 - if (IS_ERR(str)) 186.28 - return; 186.29 - if (strlen(str) == 0) { 186.30 - kfree(str); 186.31 - return; 186.32 + /* Ignore read errors and empty reads. */ 186.33 + if (XENBUS_IS_ERR_READ(str)) { 186.34 + xenbus_transaction_end(1); 186.35 + return; 186.36 } 186.37 186.38 xenbus_write("control", "shutdown", "", O_CREAT); 186.39 186.40 + err = xenbus_transaction_end(0); 186.41 + if (err == -ETIMEDOUT) { 186.42 + kfree(str); 186.43 + goto again; 186.44 + } 186.45 + 186.46 if (strcmp(str, "poweroff") == 0) 186.47 shutting_down = SHUTDOWN_POWEROFF; 186.48 else if (strcmp(str, "reboot") == 0) 186.49 @@ -355,16 +363,26 @@ static void shutdown_handler(struct xenb 186.50 static void sysrq_handler(struct xenbus_watch *watch, const char *node) 186.51 { 186.52 char sysrq_key = '\0'; 186.53 - 186.54 + int err; 186.55 + 186.56 + again: 186.57 + err = xenbus_transaction_start("control"); 186.58 + if (err) 186.59 + return; 186.60 if (!xenbus_scanf("control", "sysrq", "%c", &sysrq_key)) { 186.61 printk(KERN_ERR "Unable to read sysrq code in control/sysrq\n"); 186.62 - return; 186.63 + xenbus_transaction_end(1); 186.64 + return; 186.65 } 186.66 186.67 - xenbus_printf("control", "sysrq", "%c", '\0'); 186.68 + if (sysrq_key != '\0') 186.69 + xenbus_printf("control", "sysrq", "%c", '\0'); 186.70 + 186.71 + err = xenbus_transaction_end(0); 186.72 + if (err == -ETIMEDOUT) 186.73 + goto again; 186.74 186.75 if (sysrq_key != '\0') { 186.76 - 186.77 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 186.78 handle_sysrq(sysrq_key, NULL, NULL); 186.79 #else
187.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c Wed Sep 14 15:33:52 2005 -0600 187.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c Wed Sep 14 15:36:10 2005 -0600 187.3 @@ -12,7 +12,7 @@ 187.4 #include <linux/init.h> 187.5 #include <asm/io.h> 187.6 #include <asm/page.h> 187.7 -#include <asm-xen/hypervisor.h> 187.8 +#include <asm/hypervisor.h> 187.9 187.10 /* Referenced in netback.c. */ 187.11 /*static*/ kmem_cache_t *skbuff_cachep;
201.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S Wed Sep 14 15:33:52 2005 -0600 201.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S Wed Sep 14 15:36:10 2005 -0600 201.3 @@ -751,10 +751,10 @@ ecrit: /**** END OF CRITICAL REGION *** 201.4 # Hypervisor uses this for application faults while it executes. 201.5 ENTRY(failsafe_callback) 201.6 addq $0x10,%rsp /* skip rcx and r11 */ 201.7 -1: movl (%rsp),%ds 201.8 -2: movl 8(%rsp),%es 201.9 -3: movl 16(%rsp),%fs 201.10 -4: movl 24(%rsp),%gs 201.11 +1: mov (%rsp),%ds 201.12 +2: mov 8(%rsp),%es 201.13 +3: mov 16(%rsp),%fs 201.14 +4: mov 24(%rsp),%gs 201.15 addq $0x20,%rsp /* skip the above selectors */ 201.16 SAVE_ALL 201.17 jmp error_exit
213.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Wed Sep 14 15:33:52 2005 -0600 213.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Wed Sep 14 15:36:10 2005 -0600 213.3 @@ -61,7 +61,7 @@ 213.4 #include <linux/percpu.h> 213.5 #include <asm-xen/xen-public/physdev.h> 213.6 #include "setup_arch_pre.h" 213.7 -#include <asm-xen/hypervisor.h> 213.8 +#include <asm/hypervisor.h> 213.9 #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 213.10 #define PFN_PHYS(x) ((x) << PAGE_SHIFT) 213.11 #define end_pfn_map end_pfn
214.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c Wed Sep 14 15:33:52 2005 -0600 214.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c Wed Sep 14 15:36:10 2005 -0600 214.3 @@ -31,7 +31,7 @@ 214.4 #include <asm/mman.h> 214.5 #include <asm/numa.h> 214.6 #ifdef CONFIG_XEN 214.7 -#include <asm-xen/hypervisor.h> 214.8 +#include <asm/hypervisor.h> 214.9 #endif 214.10 char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 214.11
226.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile Wed Sep 14 15:33:52 2005 -0600 226.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile Wed Sep 14 15:36:10 2005 -0600 226.3 @@ -8,7 +8,7 @@ CFLAGS += -Iarch/$(XENARCH)/pci 226.4 226.5 CFLAGS += -Iarch/i386/pci 226.6 226.7 -c-i386-obj-y := i386.o 226.8 +c-xen-obj-y := i386.o 226.9 c-i386-obj-y += fixup.o 226.10 c-i386-obj-$(CONFIG_ACPI_PCI) += acpi.o 226.11 c-i386-obj-y += legacy.o common.o
243.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Sep 14 15:33:52 2005 -0600 243.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Sep 14 15:36:10 2005 -0600 243.3 @@ -42,7 +42,7 @@ 243.4 #include <linux/highmem.h> 243.5 #include <linux/vmalloc.h> 243.6 #include <asm-xen/xen_proc.h> 243.7 -#include <asm-xen/hypervisor.h> 243.8 +#include <asm/hypervisor.h> 243.9 #include <asm-xen/balloon.h> 243.10 #include <asm-xen/xen-public/memory.h> 243.11 #include <asm/pgalloc.h>
246.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Wed Sep 14 15:33:52 2005 -0600 246.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Wed Sep 14 15:36:10 2005 -0600 246.3 @@ -13,7 +13,7 @@ 246.4 #include <asm/setup.h> 246.5 #include <asm/pgalloc.h> 246.6 #include <asm-xen/evtchn.h> 246.7 -#include <asm-xen/hypervisor.h> 246.8 +#include <asm/hypervisor.h> 246.9 #include <asm-xen/xen-public/io/blkif.h> 246.10 #include <asm-xen/xen-public/io/ring.h> 246.11 #include <asm-xen/gnttab.h> 246.12 @@ -33,7 +33,7 @@ struct vbd { 246.13 blkif_vdev_t handle; /* what the domain refers to this vbd as */ 246.14 unsigned char readonly; /* Non-zero -> read-only */ 246.15 unsigned char type; /* VDISK_xxx */ 246.16 - blkif_pdev_t pdevice; /* phys device that this vbd maps to */ 246.17 + u32 pdevice; /* phys device that this vbd maps to */ 246.18 struct block_device *bdev; 246.19 }; 246.20 246.21 @@ -65,11 +65,6 @@ typedef struct blkif_st { 246.22 grant_ref_t shmem_ref; 246.23 } blkif_t; 246.24 246.25 -void blkif_create(blkif_be_create_t *create); 246.26 -void blkif_destroy(blkif_be_destroy_t *destroy); 246.27 -void blkif_connect(blkif_be_connect_t *connect); 246.28 -int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id); 246.29 -void blkif_disconnect_complete(blkif_t *blkif); 246.30 blkif_t *alloc_blkif(domid_t domid); 246.31 void free_blkif_callback(blkif_t *blkif); 246.32 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn); 246.33 @@ -82,7 +77,7 @@ int blkif_map(blkif_t *blkif, unsigned l 246.34 } while (0) 246.35 246.36 /* Create a vbd. */ 246.37 -int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, blkif_pdev_t pdevice, 246.38 +int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, u32 pdevice, 246.39 int readonly); 246.40 void vbd_free(struct vbd *vbd); 246.41
248.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Wed Sep 14 15:33:52 2005 -0600 248.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Wed Sep 14 15:36:10 2005 -0600 248.3 @@ -9,7 +9,7 @@ 248.4 #include "common.h" 248.5 #include <asm-xen/xenbus.h> 248.6 248.7 -static inline dev_t vbd_map_devnum(blkif_pdev_t cookie) 248.8 +static inline dev_t vbd_map_devnum(u32 cookie) 248.9 { 248.10 return MKDEV(BLKIF_MAJOR(cookie), BLKIF_MINOR(cookie)); 248.11 } 248.12 @@ -33,7 +33,7 @@ unsigned long vbd_secsize(struct vbd *vb 248.13 } 248.14 248.15 int vbd_create(blkif_t *blkif, blkif_vdev_t handle, 248.16 - blkif_pdev_t pdevice, int readonly) 248.17 + u32 pdevice, int readonly) 248.18 { 248.19 struct vbd *vbd; 248.20
249.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Sep 14 15:33:52 2005 -0600 249.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Sep 14 15:36:10 2005 -0600 249.3 @@ -178,6 +178,8 @@ static void backend_changed(struct xenbu 249.4 249.5 err = vbd_create(be->blkif, handle, be->pdev, be->readonly); 249.6 if (err) { 249.7 + blkif_put(be->blkif); 249.8 + be->blkif = NULL; 249.9 xenbus_dev_error(dev, err, "creating vbd structure"); 249.10 return; 249.11 }
253.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Wed Sep 14 15:33:52 2005 -0600 253.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Wed Sep 14 15:36:10 2005 -0600 253.3 @@ -45,7 +45,7 @@ 253.4 #include <linux/blkdev.h> 253.5 #include <linux/major.h> 253.6 #include <linux/devfs_fs_kernel.h> 253.7 -#include <asm-xen/hypervisor.h> 253.8 +#include <asm/hypervisor.h> 253.9 #include <asm-xen/xenbus.h> 253.10 #include <asm-xen/gnttab.h> 253.11 #include <asm-xen/xen-public/xen.h>
257.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h Wed Sep 14 15:33:52 2005 -0600 257.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h Wed Sep 14 15:36:10 2005 -0600 257.3 @@ -20,7 +20,7 @@ 257.4 #include <asm/io.h> 257.5 #include <asm/setup.h> 257.6 #include <asm/pgalloc.h> 257.7 -#include <asm-xen/hypervisor.h> 257.8 +#include <asm/hypervisor.h> 257.9 #include <asm-xen/xen-public/io/blkif.h> 257.10 #include <asm-xen/xen-public/io/ring.h> 257.11
258.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/common.h Wed Sep 14 15:33:52 2005 -0600 258.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/common.h Wed Sep 14 15:36:10 2005 -0600 258.3 @@ -13,7 +13,7 @@ 258.4 #include <asm/setup.h> 258.5 #include <asm/pgalloc.h> 258.6 #include <asm-xen/evtchn.h> 258.7 -#include <asm-xen/hypervisor.h> 258.8 +#include <asm/hypervisor.h> 258.9 #include <asm-xen/xen-public/io/blkif.h> 258.10 #include <asm-xen/xen-public/io/ring.h> 258.11 #include <asm-xen/gnttab.h> 258.12 @@ -35,7 +35,7 @@ struct vbd { 258.13 blkif_vdev_t handle; /* what the domain refers to this vbd as */ 258.14 unsigned char readonly; /* Non-zero -> read-only */ 258.15 unsigned char type; /* VDISK_xxx */ 258.16 - blkif_pdev_t pdevice; /* phys device that this vbd maps to */ 258.17 + u32 pdevice; /* phys device that this vbd maps to */ 258.18 struct block_device *bdev; 258.19 }; 258.20 258.21 @@ -67,11 +67,6 @@ typedef struct blkif_st { 258.22 grant_ref_t shmem_ref; 258.23 } blkif_t; 258.24 258.25 -void blkif_create(blkif_be_create_t *create); 258.26 -void blkif_destroy(blkif_be_destroy_t *destroy); 258.27 -void blkif_connect(blkif_be_connect_t *connect); 258.28 -int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id); 258.29 -void blkif_disconnect_complete(blkif_t *blkif); 258.30 blkif_t *alloc_blkif(domid_t domid); 258.31 void free_blkif_callback(blkif_t *blkif); 258.32 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn); 258.33 @@ -84,7 +79,7 @@ int blkif_map(blkif_t *blkif, unsigned l 258.34 } while (0) 258.35 258.36 /* Create a vbd. */ 258.37 -int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, blkif_pdev_t pdevice, 258.38 +int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, u32 pdevice, 258.39 int readonly); 258.40 void vbd_free(struct vbd *vbd); 258.41
262.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Sep 14 15:33:52 2005 -0600 262.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Sep 14 15:36:10 2005 -0600 262.3 @@ -51,7 +51,7 @@ 262.4 #include <asm/uaccess.h> 262.5 #include <asm-xen/xen-public/xen.h> 262.6 #include <asm-xen/xen-public/event_channel.h> 262.7 -#include <asm-xen/hypervisor.h> 262.8 +#include <asm/hypervisor.h> 262.9 #include <asm-xen/evtchn.h> 262.10 262.11 #include "xencons_ring.h"
263.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Wed Sep 14 15:33:52 2005 -0600 263.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Wed Sep 14 15:36:10 2005 -0600 263.3 @@ -13,7 +13,7 @@ 263.4 #include <linux/mm.h> 263.5 #include <linux/slab.h> 263.6 263.7 -#include <asm-xen/hypervisor.h> 263.8 +#include <asm/hypervisor.h> 263.9 #include <asm-xen/evtchn.h> 263.10 #include <linux/wait.h> 263.11 #include <linux/interrupt.h>
271.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Sep 14 15:33:52 2005 -0600 271.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Sep 14 15:36:10 2005 -0600 271.3 @@ -294,7 +294,7 @@ static void net_rx_action(unsigned long 271.4 mcl++; 271.5 271.6 mmuext->cmd = MMUEXT_REASSIGN_PAGE; 271.7 - mmuext->mfn = old_mfn; 271.8 + mmuext->arg1.mfn = old_mfn; 271.9 mmuext++; 271.10 #endif 271.11 mmu->ptr = ((unsigned long long)new_mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE; 271.12 @@ -355,7 +355,7 @@ static void net_rx_action(unsigned long 271.13 #ifdef CONFIG_XEN_NETDEV_GRANT 271.14 old_mfn = 0; /* XXX Fix this so we can free_mfn() on error! */ 271.15 #else 271.16 - old_mfn = mmuext[0].mfn; 271.17 + old_mfn = mmuext[0].arg1.mfn; 271.18 #endif 271.19 atomic_set(&(skb_shinfo(skb)->dataref), 1); 271.20 skb_shinfo(skb)->nr_frags = 0;
286.1 --- a/linux-2.6-xen-sparse/drivers/xen/usbback/common.h Wed Sep 14 15:33:52 2005 -0600 286.2 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/common.h Wed Sep 14 15:36:10 2005 -0600 286.3 @@ -12,7 +12,7 @@ 286.4 #include <asm/io.h> 286.5 #include <asm/setup.h> 286.6 #include <asm/pgalloc.h> 286.7 -#include <asm-xen/hypervisor.h> 286.8 +#include <asm/hypervisor.h> 286.9 286.10 #include <asm-xen/xen-public/io/usbif.h> 286.11
293.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Sep 14 15:33:52 2005 -0600 293.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Sep 14 15:36:10 2005 -0600 293.3 @@ -27,7 +27,7 @@ 293.4 * IN THE SOFTWARE. 293.5 */ 293.6 293.7 -#include <asm-xen/hypervisor.h> 293.8 +#include <asm/hypervisor.h> 293.9 #include <asm-xen/evtchn.h> 293.10 #include <linux/wait.h> 293.11 #include <linux/interrupt.h>
296.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Sep 14 15:33:52 2005 -0600 296.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Sep 14 15:36:10 2005 -0600 296.3 @@ -27,7 +27,7 @@ 296.4 */ 296.5 #define DEBUG 296.6 296.7 -#include <asm-xen/hypervisor.h> 296.8 +#include <asm/hypervisor.h> 296.9 #include <asm-xen/xenbus.h> 296.10 #include <asm-xen/balloon.h> 296.11 #include <linux/kernel.h>
307.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 307.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h Wed Sep 14 15:36:10 2005 -0600 307.3 @@ -0,0 +1,188 @@ 307.4 +/****************************************************************************** 307.5 + * hypervisor.h 307.6 + * 307.7 + * Linux-specific hypervisor handling. 307.8 + * 307.9 + * Copyright (c) 2002-2004, K A Fraser 307.10 + * 307.11 + * This file may be distributed separately from the Linux kernel, or 307.12 + * incorporated into other software packages, subject to the following license: 307.13 + * 307.14 + * Permission is hereby granted, free of charge, to any person obtaining a copy 307.15 + * of this source file (the "Software"), to deal in the Software without 307.16 + * restriction, including without limitation the rights to use, copy, modify, 307.17 + * merge, publish, distribute, sublicense, and/or sell copies of the Software, 307.18 + * and to permit persons to whom the Software is furnished to do so, subject to 307.19 + * the following conditions: 307.20 + * 307.21 + * The above copyright notice and this permission notice shall be included in 307.22 + * all copies or substantial portions of the Software. 307.23 + * 307.24 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 307.25 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 307.26 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 307.27 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 307.28 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 307.29 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 307.30 + * IN THE SOFTWARE. 307.31 + */ 307.32 + 307.33 +#ifndef __HYPERVISOR_H__ 307.34 +#define __HYPERVISOR_H__ 307.35 + 307.36 +#include <linux/config.h> 307.37 +#include <linux/types.h> 307.38 +#include <linux/kernel.h> 307.39 +#include <linux/version.h> 307.40 +#include <asm-xen/xen-public/xen.h> 307.41 +#include <asm-xen/xen-public/dom0_ops.h> 307.42 +#include <asm/ptrace.h> 307.43 +#include <asm/page.h> 307.44 +#if defined(__i386__) 307.45 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 307.46 +# ifdef CONFIG_X86_PAE 307.47 +# include <asm-generic/pgtable-nopud.h> 307.48 +# else 307.49 +# include <asm-generic/pgtable-nopmd.h> 307.50 +# endif 307.51 +# else 307.52 +# define pud_t pgd_t 307.53 +# endif 307.54 +#endif 307.55 + 307.56 +/* arch/xen/i386/kernel/setup.c */ 307.57 +extern start_info_t *xen_start_info; 307.58 + 307.59 +/* arch/xen/kernel/evtchn.c */ 307.60 +/* Force a proper event-channel callback from Xen. */ 307.61 +void force_evtchn_callback(void); 307.62 + 307.63 +/* arch/xen/kernel/process.c */ 307.64 +void xen_cpu_idle (void); 307.65 + 307.66 +/* arch/xen/i386/kernel/hypervisor.c */ 307.67 +void do_hypervisor_callback(struct pt_regs *regs); 307.68 + 307.69 +/* arch/xen/i386/kernel/head.S */ 307.70 +void lgdt_finish(void); 307.71 + 307.72 +/* arch/xen/i386/mm/hypervisor.c */ 307.73 +/* 307.74 + * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already 307.75 + * be MACHINE addresses. 307.76 + */ 307.77 + 307.78 +void xen_pt_switch(unsigned long ptr); 307.79 +void xen_new_user_pt(unsigned long ptr); /* x86_64 only */ 307.80 +void xen_load_gs(unsigned int selector); /* x86_64 only */ 307.81 +void xen_tlb_flush(void); 307.82 +void xen_invlpg(unsigned long ptr); 307.83 + 307.84 +#ifndef CONFIG_XEN_SHADOW_MODE 307.85 +void xen_l1_entry_update(pte_t *ptr, pte_t val); 307.86 +void xen_l2_entry_update(pmd_t *ptr, pmd_t val); 307.87 +void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ 307.88 +void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */ 307.89 +void xen_pgd_pin(unsigned long ptr); 307.90 +void xen_pgd_unpin(unsigned long ptr); 307.91 +void xen_pud_pin(unsigned long ptr); /* x86_64 only */ 307.92 +void xen_pud_unpin(unsigned long ptr); /* x86_64 only */ 307.93 +void xen_pmd_pin(unsigned long ptr); /* x86_64 only */ 307.94 +void xen_pmd_unpin(unsigned long ptr); /* x86_64 only */ 307.95 +void xen_pte_pin(unsigned long ptr); 307.96 +void xen_pte_unpin(unsigned long ptr); 307.97 +#else 307.98 +#define xen_l1_entry_update(_p, _v) set_pte((_p), (_v)) 307.99 +#define xen_l2_entry_update(_p, _v) set_pgd((_p), (_v)) 307.100 +#define xen_pgd_pin(_p) ((void)0) 307.101 +#define xen_pgd_unpin(_p) ((void)0) 307.102 +#define xen_pte_pin(_p) ((void)0) 307.103 +#define xen_pte_unpin(_p) ((void)0) 307.104 +#endif 307.105 + 307.106 +void xen_set_ldt(unsigned long ptr, unsigned long bytes); 307.107 +void xen_machphys_update(unsigned long mfn, unsigned long pfn); 307.108 + 307.109 +#ifdef CONFIG_SMP 307.110 +#include <linux/cpumask.h> 307.111 +void xen_tlb_flush_all(void); 307.112 +void xen_invlpg_all(unsigned long ptr); 307.113 +void xen_tlb_flush_mask(cpumask_t *mask); 307.114 +void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr); 307.115 +#endif 307.116 + 307.117 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 307.118 +/* 307.119 +** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 307.120 +** include sufficient #defines to allow the below to build. 307.121 +*/ 307.122 +#define DEFINE_PER_CPU(type, name) \ 307.123 + __typeof__(type) per_cpu__##name 307.124 + 307.125 +#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 307.126 +#define __get_cpu_var(var) per_cpu__##var 307.127 +#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 307.128 + 307.129 +#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 307.130 +#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) 307.131 +#endif /* linux < 2.6.0 */ 307.132 + 307.133 +void xen_create_contiguous_region(unsigned long vstart, unsigned int order); 307.134 +void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 307.135 + 307.136 +#include <asm/hypercall.h> 307.137 + 307.138 +#if defined(CONFIG_X86_64) 307.139 +#define MULTI_UVMFLAGS_INDEX 2 307.140 +#define MULTI_UVMDOMID_INDEX 3 307.141 +#else 307.142 +#define MULTI_UVMFLAGS_INDEX 3 307.143 +#define MULTI_UVMDOMID_INDEX 4 307.144 +#endif 307.145 + 307.146 +static inline void 307.147 +MULTI_update_va_mapping( 307.148 + multicall_entry_t *mcl, unsigned long va, 307.149 + pte_t new_val, unsigned long flags) 307.150 +{ 307.151 + mcl->op = __HYPERVISOR_update_va_mapping; 307.152 + mcl->args[0] = va; 307.153 +#if defined(CONFIG_X86_64) 307.154 + mcl->args[1] = new_val.pte; 307.155 + mcl->args[2] = flags; 307.156 +#elif defined(CONFIG_X86_PAE) 307.157 + mcl->args[1] = new_val.pte_low; 307.158 + mcl->args[2] = new_val.pte_high; 307.159 + mcl->args[3] = flags; 307.160 +#else 307.161 + mcl->args[1] = new_val.pte_low; 307.162 + mcl->args[2] = 0; 307.163 + mcl->args[3] = flags; 307.164 +#endif 307.165 +} 307.166 + 307.167 +static inline void 307.168 +MULTI_update_va_mapping_otherdomain( 307.169 + multicall_entry_t *mcl, unsigned long va, 307.170 + pte_t new_val, unsigned long flags, domid_t domid) 307.171 +{ 307.172 + mcl->op = __HYPERVISOR_update_va_mapping_otherdomain; 307.173 + mcl->args[0] = va; 307.174 +#if defined(CONFIG_X86_64) 307.175 + mcl->args[1] = new_val.pte; 307.176 + mcl->args[2] = flags; 307.177 + mcl->args[3] = domid; 307.178 +#elif defined(CONFIG_X86_PAE) 307.179 + mcl->args[1] = new_val.pte_low; 307.180 + mcl->args[2] = new_val.pte_high; 307.181 + mcl->args[3] = flags; 307.182 + mcl->args[4] = domid; 307.183 +#else 307.184 + mcl->args[1] = new_val.pte_low; 307.185 + mcl->args[2] = 0; 307.186 + mcl->args[3] = flags; 307.187 + mcl->args[4] = domid; 307.188 +#endif 307.189 +} 307.190 + 307.191 +#endif /* __HYPERVISOR_H__ */
315.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h Wed Sep 14 15:33:52 2005 -0600 315.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h Wed Sep 14 15:36:10 2005 -0600 315.3 @@ -67,7 +67,7 @@ static inline void switch_mm(struct mm_s 315.4 /* Re-load page tables: load_cr3(next->pgd) */ 315.5 per_cpu(cur_pgd, cpu) = next->pgd; 315.6 op->cmd = MMUEXT_NEW_BASEPTR; 315.7 - op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 315.8 + op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 315.9 op++; 315.10 315.11 /* 315.12 @@ -76,8 +76,8 @@ static inline void switch_mm(struct mm_s 315.13 if (unlikely(prev->context.ldt != next->context.ldt)) { 315.14 /* load_LDT_nolock(&next->context, cpu) */ 315.15 op->cmd = MMUEXT_SET_LDT; 315.16 - op->linear_addr = (unsigned long)next->context.ldt; 315.17 - op->nr_ents = next->context.size; 315.18 + op->arg1.linear_addr = (unsigned long)next->context.ldt; 315.19 + op->arg2.nr_ents = next->context.size; 315.20 op++; 315.21 } 315.22
322.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h Wed Sep 14 15:33:52 2005 -0600 322.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h Wed Sep 14 15:36:10 2005 -0600 322.3 @@ -2,7 +2,7 @@ 322.4 #define _I386_PGTABLE_H 322.5 322.6 #include <linux/config.h> 322.7 -#include <asm-xen/hypervisor.h> 322.8 +#include <asm/hypervisor.h> 322.9 322.10 /* 322.11 * The Linux memory management assumes a three-level page table setup. On
331.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h Wed Sep 14 15:33:52 2005 -0600 331.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h Wed Sep 14 15:36:10 2005 -0600 331.3 @@ -7,7 +7,7 @@ 331.4 #include <asm/synch_bitops.h> 331.5 #include <asm/segment.h> 331.6 #include <asm/cpufeature.h> 331.7 -#include <asm-xen/hypervisor.h> 331.8 +#include <asm/hypervisor.h> 331.9 #include <asm/smp_alt.h> 331.10 331.11 #ifdef __KERNEL__
342.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 342.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypervisor.h Wed Sep 14 15:36:10 2005 -0600 342.3 @@ -0,0 +1,2 @@ 342.4 + 342.5 +#include <asm-i386/hypervisor.h>
352.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h Wed Sep 14 15:33:52 2005 -0600 352.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h Wed Sep 14 15:36:10 2005 -0600 352.3 @@ -83,19 +83,19 @@ static inline void switch_mm(struct mm_s 352.4 /* load_cr3(next->pgd) */ 352.5 per_cpu(cur_pgd, smp_processor_id()) = next->pgd; 352.6 op->cmd = MMUEXT_NEW_BASEPTR; 352.7 - op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 352.8 + op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 352.9 op++; 352.10 352.11 /* xen_new_user_pt(__pa(__user_pgd(next->pgd))) */ 352.12 op->cmd = MMUEXT_NEW_USER_BASEPTR; 352.13 - op->mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT); 352.14 + op->arg1.mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT); 352.15 op++; 352.16 352.17 if (unlikely(next->context.ldt != prev->context.ldt)) { 352.18 /* load_LDT_nolock(&next->context, cpu) */ 352.19 op->cmd = MMUEXT_SET_LDT; 352.20 - op->linear_addr = (unsigned long)next->context.ldt; 352.21 - op->nr_ents = next->context.size; 352.22 + op->arg1.linear_addr = (unsigned long)next->context.ldt; 352.23 + op->arg2.nr_ents = next->context.size; 352.24 op++; 352.25 } 352.26
357.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Wed Sep 14 15:33:52 2005 -0600 357.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Wed Sep 14 15:36:10 2005 -0600 357.3 @@ -12,7 +12,7 @@ 357.4 #include <linux/sched.h> 357.5 #include <asm/pda.h> 357.6 #ifdef CONFIG_XEN 357.7 -#include <asm-xen/hypervisor.h> 357.8 +#include <asm/hypervisor.h> 357.9 357.10 extern pud_t level3_user_pgt[512]; 357.11 extern pud_t init_level4_user_pgt[];
363.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h Wed Sep 14 15:33:52 2005 -0600 363.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h Wed Sep 14 15:36:10 2005 -0600 363.3 @@ -5,7 +5,7 @@ 363.4 #include <linux/kernel.h> 363.5 #include <asm/segment.h> 363.6 #include <asm/synch_bitops.h> 363.7 -#include <asm-xen/hypervisor.h> 363.8 +#include <asm/hypervisor.h> 363.9 #include <asm-xen/xen-public/arch-x86_64.h> 363.10 363.11 #ifdef __KERNEL__
369.1 --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Wed Sep 14 15:33:52 2005 -0600 369.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Wed Sep 14 15:36:10 2005 -0600 369.3 @@ -33,7 +33,7 @@ 369.4 369.5 #include <linux/config.h> 369.6 #include <linux/interrupt.h> 369.7 -#include <asm-xen/hypervisor.h> 369.8 +#include <asm/hypervisor.h> 369.9 #include <asm/ptrace.h> 369.10 #include <asm/synch_bitops.h> 369.11 #include <asm-xen/xen-public/event_channel.h>
371.1 --- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Wed Sep 14 15:33:52 2005 -0600 371.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Wed Sep 14 15:36:10 2005 -0600 371.3 @@ -14,7 +14,7 @@ 371.4 #define __ASM_GNTTAB_H__ 371.5 371.6 #include <linux/config.h> 371.7 -#include <asm-xen/hypervisor.h> 371.8 +#include <asm/hypervisor.h> 371.9 #include <asm-xen/xen-public/grant_table.h> 371.10 371.11 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
372.1 --- a/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h Wed Sep 14 15:33:52 2005 -0600 372.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 372.3 @@ -1,189 +0,0 @@ 372.4 -/****************************************************************************** 372.5 - * hypervisor.h 372.6 - * 372.7 - * Linux-specific hypervisor handling. 372.8 - * 372.9 - * Copyright (c) 2002-2004, K A Fraser 372.10 - * 372.11 - * This file may be distributed separately from the Linux kernel, or 372.12 - * incorporated into other software packages, subject to the following license: 372.13 - * 372.14 - * Permission is hereby granted, free of charge, to any person obtaining a copy 372.15 - * of this source file (the "Software"), to deal in the Software without 372.16 - * restriction, including without limitation the rights to use, copy, modify, 372.17 - * merge, publish, distribute, sublicense, and/or sell copies of the Software, 372.18 - * and to permit persons to whom the Software is furnished to do so, subject to 372.19 - * the following conditions: 372.20 - * 372.21 - * The above copyright notice and this permission notice shall be included in 372.22 - * all copies or substantial portions of the Software. 372.23 - * 372.24 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 372.25 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 372.26 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 372.27 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 372.28 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 372.29 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 372.30 - * IN THE SOFTWARE. 372.31 - */ 372.32 - 372.33 -#ifndef __HYPERVISOR_H__ 372.34 -#define __HYPERVISOR_H__ 372.35 - 372.36 -#include <linux/config.h> 372.37 -#include <linux/types.h> 372.38 -#include <linux/kernel.h> 372.39 -#include <linux/version.h> 372.40 -#include <asm-xen/xen-public/xen.h> 372.41 -#include <asm-xen/xen-public/dom0_ops.h> 372.42 -#include <asm-xen/xen-public/io/domain_controller.h> 372.43 -#include <asm/ptrace.h> 372.44 -#include <asm/page.h> 372.45 -#if defined(__i386__) 372.46 -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 372.47 -# ifdef CONFIG_X86_PAE 372.48 -# include <asm-generic/pgtable-nopud.h> 372.49 -# else 372.50 -# include <asm-generic/pgtable-nopmd.h> 372.51 -# endif 372.52 -# else 372.53 -# define pud_t pgd_t 372.54 -# endif 372.55 -#endif 372.56 - 372.57 -/* arch/xen/i386/kernel/setup.c */ 372.58 -extern start_info_t *xen_start_info; 372.59 - 372.60 -/* arch/xen/kernel/evtchn.c */ 372.61 -/* Force a proper event-channel callback from Xen. */ 372.62 -void force_evtchn_callback(void); 372.63 - 372.64 -/* arch/xen/kernel/process.c */ 372.65 -void xen_cpu_idle (void); 372.66 - 372.67 -/* arch/xen/i386/kernel/hypervisor.c */ 372.68 -void do_hypervisor_callback(struct pt_regs *regs); 372.69 - 372.70 -/* arch/xen/i386/kernel/head.S */ 372.71 -void lgdt_finish(void); 372.72 - 372.73 -/* arch/xen/i386/mm/hypervisor.c */ 372.74 -/* 372.75 - * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already 372.76 - * be MACHINE addresses. 372.77 - */ 372.78 - 372.79 -void xen_pt_switch(unsigned long ptr); 372.80 -void xen_new_user_pt(unsigned long ptr); /* x86_64 only */ 372.81 -void xen_load_gs(unsigned int selector); /* x86_64 only */ 372.82 -void xen_tlb_flush(void); 372.83 -void xen_invlpg(unsigned long ptr); 372.84 - 372.85 -#ifndef CONFIG_XEN_SHADOW_MODE 372.86 -void xen_l1_entry_update(pte_t *ptr, pte_t val); 372.87 -void xen_l2_entry_update(pmd_t *ptr, pmd_t val); 372.88 -void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ 372.89 -void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */ 372.90 -void xen_pgd_pin(unsigned long ptr); 372.91 -void xen_pgd_unpin(unsigned long ptr); 372.92 -void xen_pud_pin(unsigned long ptr); /* x86_64 only */ 372.93 -void xen_pud_unpin(unsigned long ptr); /* x86_64 only */ 372.94 -void xen_pmd_pin(unsigned long ptr); /* x86_64 only */ 372.95 -void xen_pmd_unpin(unsigned long ptr); /* x86_64 only */ 372.96 -void xen_pte_pin(unsigned long ptr); 372.97 -void xen_pte_unpin(unsigned long ptr); 372.98 -#else 372.99 -#define xen_l1_entry_update(_p, _v) set_pte((_p), (_v)) 372.100 -#define xen_l2_entry_update(_p, _v) set_pgd((_p), (_v)) 372.101 -#define xen_pgd_pin(_p) ((void)0) 372.102 -#define xen_pgd_unpin(_p) ((void)0) 372.103 -#define xen_pte_pin(_p) ((void)0) 372.104 -#define xen_pte_unpin(_p) ((void)0) 372.105 -#endif 372.106 - 372.107 -void xen_set_ldt(unsigned long ptr, unsigned long bytes); 372.108 -void xen_machphys_update(unsigned long mfn, unsigned long pfn); 372.109 - 372.110 -#ifdef CONFIG_SMP 372.111 -#include <linux/cpumask.h> 372.112 -void xen_tlb_flush_all(void); 372.113 -void xen_invlpg_all(unsigned long ptr); 372.114 -void xen_tlb_flush_mask(cpumask_t *mask); 372.115 -void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr); 372.116 -#endif 372.117 - 372.118 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 372.119 -/* 372.120 -** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 372.121 -** include sufficient #defines to allow the below to build. 372.122 -*/ 372.123 -#define DEFINE_PER_CPU(type, name) \ 372.124 - __typeof__(type) per_cpu__##name 372.125 - 372.126 -#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 372.127 -#define __get_cpu_var(var) per_cpu__##var 372.128 -#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 372.129 - 372.130 -#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 372.131 -#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) 372.132 -#endif /* linux < 2.6.0 */ 372.133 - 372.134 -void xen_create_contiguous_region(unsigned long vstart, unsigned int order); 372.135 -void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 372.136 - 372.137 -#include <asm/hypercall.h> 372.138 - 372.139 -#if defined(CONFIG_X86_64) 372.140 -#define MULTI_UVMFLAGS_INDEX 2 372.141 -#define MULTI_UVMDOMID_INDEX 3 372.142 -#else 372.143 -#define MULTI_UVMFLAGS_INDEX 3 372.144 -#define MULTI_UVMDOMID_INDEX 4 372.145 -#endif 372.146 - 372.147 -static inline void 372.148 -MULTI_update_va_mapping( 372.149 - multicall_entry_t *mcl, unsigned long va, 372.150 - pte_t new_val, unsigned long flags) 372.151 -{ 372.152 - mcl->op = __HYPERVISOR_update_va_mapping; 372.153 - mcl->args[0] = va; 372.154 -#if defined(CONFIG_X86_64) 372.155 - mcl->args[1] = new_val.pte; 372.156 - mcl->args[2] = flags; 372.157 -#elif defined(CONFIG_X86_PAE) 372.158 - mcl->args[1] = new_val.pte_low; 372.159 - mcl->args[2] = new_val.pte_high; 372.160 - mcl->args[3] = flags; 372.161 -#else 372.162 - mcl->args[1] = new_val.pte_low; 372.163 - mcl->args[2] = 0; 372.164 - mcl->args[3] = flags; 372.165 -#endif 372.166 -} 372.167 - 372.168 -static inline void 372.169 -MULTI_update_va_mapping_otherdomain( 372.170 - multicall_entry_t *mcl, unsigned long va, 372.171 - pte_t new_val, unsigned long flags, domid_t domid) 372.172 -{ 372.173 - mcl->op = __HYPERVISOR_update_va_mapping_otherdomain; 372.174 - mcl->args[0] = va; 372.175 -#if defined(CONFIG_X86_64) 372.176 - mcl->args[1] = new_val.pte; 372.177 - mcl->args[2] = flags; 372.178 - mcl->args[3] = domid; 372.179 -#elif defined(CONFIG_X86_PAE) 372.180 - mcl->args[1] = new_val.pte_low; 372.181 - mcl->args[2] = new_val.pte_high; 372.182 - mcl->args[3] = flags; 372.183 - mcl->args[4] = domid; 372.184 -#else 372.185 - mcl->args[1] = new_val.pte_low; 372.186 - mcl->args[2] = 0; 372.187 - mcl->args[3] = flags; 372.188 - mcl->args[4] = domid; 372.189 -#endif 372.190 -} 372.191 - 372.192 -#endif /* __HYPERVISOR_H__ */
422.1 --- a/tools/console/daemon/io.c Wed Sep 14 15:33:52 2005 -0600 422.2 +++ b/tools/console/daemon/io.c Wed Sep 14 15:36:10 2005 -0600 422.3 @@ -22,10 +22,8 @@ 422.4 422.5 #include "utils.h" 422.6 #include "io.h" 422.7 - 422.8 #include "xenctrl.h" 422.9 #include "xs.h" 422.10 -#include "xen/io/domain_controller.h" 422.11 422.12 #include <malloc.h> 422.13 #include <stdlib.h>
425.1 --- a/tools/console/daemon/utils.c Wed Sep 14 15:33:52 2005 -0600 425.2 +++ b/tools/console/daemon/utils.c Wed Sep 14 15:36:10 2005 -0600 425.3 @@ -34,8 +34,6 @@ 425.4 #include <string.h> 425.5 425.6 #include "xenctrl.h" 425.7 -#include "xen/io/domain_controller.h" 425.8 - 425.9 #include "utils.h" 425.10 425.11 struct xs_handle *xs;
467.1 --- a/tools/examples/Makefile Wed Sep 14 15:33:52 2005 -0600 467.2 +++ b/tools/examples/Makefile Wed Sep 14 15:36:10 2005 -0600 467.3 @@ -25,21 +25,20 @@ XEN_SCRIPTS += block-phy 467.4 XEN_SCRIPTS += block-file 467.5 XEN_SCRIPTS += block-enbd 467.6 467.7 -XEN_BOOT_DIR = /usr/$(LIBDIR)/xen/boot 467.8 +# no 64-bit specifics in mem-map.sxp 467.9 +# so place in /usr/lib, not /usr/lib64 467.10 +XEN_BOOT_DIR = /usr/lib/xen/boot 467.11 XEN_BOOT = mem-map.sxp 467.12 467.13 XEN_HOTPLUG_DIR = /etc/hotplug 467.14 XEN_HOTPLUG_SCRIPTS = xen-backend.agent 467.15 467.16 -all: 467.17 +all: 467.18 build: 467.19 467.20 install: all install-initd install-configs install-scripts install-boot \ 467.21 install-hotplug 467.22 467.23 -xmexample.vmx: xmexample.vmx.in 467.24 - sed -e 's/@@LIBDIR@@/$(LIBDIR)/' < $< > $@ 467.25 - 467.26 install-initd: 467.27 [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d 467.28 $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d 467.29 @@ -80,4 +79,3 @@ install-hotplug: 467.30 done 467.31 467.32 clean: 467.33 - $(RM) xmexample.vmx
473.1 --- a/tools/examples/network-bridge Wed Sep 14 15:33:52 2005 -0600 473.2 +++ b/tools/examples/network-bridge Wed Sep 14 15:36:10 2005 -0600 473.3 @@ -222,27 +222,31 @@ op_stop () { 473.4 return 473.5 fi 473.6 473.7 - brctl delif ${bridge} ${netdev} 473.8 + if ifconfig peth0 2>/dev/null | grep -q peth0 ; then 473.9 473.10 - if ifconfig veth0 2>/dev/null | grep -q veth0 ; then 473.11 - brctl delif ${bridge} vif0.0 473.12 ifconfig vif0.0 down 473.13 - mac=`ifconfig veth0 | grep HWadd | sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'` 473.14 - ifconfig ${netdev} down 473.15 - ifconfig ${netdev} hw ether ${mac} 473.16 - ifconfig ${netdev} arp up 473.17 - transfer_addrs veth0 ${netdev} 473.18 - transfer_routes veth0 ${netdev} 473.19 - del_addrs veth0 473.20 - ifconfig veth0 -arp down 473.21 - ifconfig veth0 hw ether 00:00:00:00:00:00 473.22 + mac=`ifconfig eth0 | grep HWadd | \ 473.23 + sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'` 473.24 + ifconfig ${netdev} 0.0.0.0 down 473.25 + ifconfig ${netdev} hw ether fe:ff:ff:ff:ff:ff 473.26 + 473.27 + ifconfig p${netdev} down 473.28 + ifconfig p${netdev} hw ether ${mac} arp 473.29 + brctl delif ${bridge} p${netdev} 473.30 + 473.31 + ip link set eth0 name veth0 473.32 + ip link set peth0 name eth0 473.33 + ifconfig ${bridge} down 473.34 + brctl delbr ${bridge} 473.35 + ifup eth0 473.36 + 473.37 else 473.38 transfer_routes ${bridge} ${netdev} 473.39 fi 473.40 } 473.41 473.42 case ${OP} in 473.43 - start) 473.44 + start) 473.45 op_start 473.46 ;; 473.47
476.1 --- a/tools/examples/xen-backend.agent Wed Sep 14 15:33:52 2005 -0600 476.2 +++ b/tools/examples/xen-backend.agent Wed Sep 14 15:36:10 2005 -0600 476.3 @@ -1,3 +1,7 @@ 476.4 + 476.5 +copyrev: 0000000000000000000000000000000000000000 476.6 +copy: tools/examples/backend.hotplug 476.7 + 476.8 #! /bin/sh 476.9 476.10 #ACTION=add
478.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 478.2 +++ b/tools/examples/xmexample.vmx Wed Sep 14 15:36:10 2005 -0600 478.3 @@ -0,0 +1,102 @@ 478.4 +# -*- mode: python; -*- 478.5 +#============================================================================ 478.6 +# Python configuration setup for 'xm create'. 478.7 +# This script sets the parameters used when a domain is created using 'xm create'. 478.8 +# You use a separate script for each domain you want to create, or 478.9 +# you can set the parameters for the domain on the xm command line. 478.10 +#============================================================================ 478.11 + 478.12 +import os, re 478.13 +arch = os.uname()[4] 478.14 +if re.search('64', arch): 478.15 + arch_libdir = 'lib64' 478.16 +else: 478.17 + arch_libdir = 'lib' 478.18 + 478.19 +#---------------------------------------------------------------------------- 478.20 +# Kernel image file. 478.21 +kernel = "/usr/lib/xen/boot/vmxloader" 478.22 + 478.23 +# The domain build function. VMX domain uses 'vmx'. 478.24 +builder='vmx' 478.25 + 478.26 +# Initial memory allocation (in megabytes) for the new domain. 478.27 +memory = 128 478.28 + 478.29 +# A name for your domain. All domains must have different names. 478.30 +name = "ExampleVMXDomain" 478.31 + 478.32 +# Which CPU to start domain on? 478.33 +#cpu = -1 # leave to Xen to pick 478.34 + 478.35 +# Optionally define mac and/or bridge for the network interfaces. 478.36 +# Random MACs are assigned if not given. 478.37 +#vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ] 478.38 + 478.39 +#---------------------------------------------------------------------------- 478.40 +# Define the disk devices you want the domain to have access to, and 478.41 +# what you want them accessible as. 478.42 +# Each disk entry is of the form phy:UNAME,DEV,MODE 478.43 +# where UNAME is the device, DEV is the device name the domain will see, 478.44 +# and MODE is r for read-only, w for read-write. 478.45 + 478.46 +#disk = [ 'phy:hda1,hda1,r' ] 478.47 +disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ] 478.48 + 478.49 +#---------------------------------------------------------------------------- 478.50 +# Set according to whether you want the domain restarted when it exits. 478.51 +# The default is 'onreboot', which restarts the domain when it shuts down 478.52 +# with exit code reboot. 478.53 +# Other values are 'always', and 'never'. 478.54 + 478.55 +#restart = 'onreboot' 478.56 + 478.57 +#============================================================================ 478.58 + 478.59 +# New stuff 478.60 +device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm' 478.61 + 478.62 +# Advanced users only. Don't touch if you don't know what you're doing 478.63 +memmap = '/usr/lib/xen/boot/mem-map.sxp' 478.64 + 478.65 +#----------------------------------------------------------------------------- 478.66 +# Disk image for 478.67 +#cdrom= 478.68 + 478.69 +#----------------------------------------------------------------------------- 478.70 +# boot on floppy (a), hard disk (c) or CD-ROM (d) 478.71 +#boot=[a|c|d] 478.72 +#----------------------------------------------------------------------------- 478.73 +# write to temporary files instead of disk image files 478.74 +#snapshot=1 478.75 + 478.76 +#---------------------------------------------------------------------------- 478.77 +# enable SDL library for graphics, default = 0 478.78 +sdl=0 478.79 + 478.80 +#---------------------------------------------------------------------------- 478.81 +# enable VNC library for graphics, default = 1 478.82 +vnc=1 478.83 + 478.84 +#---------------------------------------------------------------------------- 478.85 +# enable spawning vncviewer(only valid when vnc=1), default = 1 478.86 +vncviewer=1 478.87 + 478.88 +#---------------------------------------------------------------------------- 478.89 +# no graphics, use serial port 478.90 +#nographic=0 478.91 + 478.92 + 478.93 +#----------------------------------------------------------------------------- 478.94 +# enable audio support 478.95 +#enable-audio=1 478.96 + 478.97 + 478.98 +#----------------------------------------------------------------------------- 478.99 +# set the real time clock to local time [default=0 i.e. set to utc] 478.100 +#localtime=1 478.101 + 478.102 + 478.103 +#----------------------------------------------------------------------------- 478.104 +# start in full screen 478.105 +#full-screen=1
479.1 --- a/tools/examples/xmexample.vmx.in Wed Sep 14 15:33:52 2005 -0600 479.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 479.3 @@ -1,96 +0,0 @@ 479.4 -# -*- mode: python; -*- 479.5 -#============================================================================ 479.6 -# Python configuration setup for 'xm create'. 479.7 -# This script sets the parameters used when a domain is created using 'xm create'. 479.8 -# You use a separate script for each domain you want to create, or 479.9 -# you can set the parameters for the domain on the xm command line. 479.10 -#============================================================================ 479.11 - 479.12 -#---------------------------------------------------------------------------- 479.13 -# Kernel image file. 479.14 -kernel = "/usr/@@LIBDIR@@/xen/boot/vmxloader" 479.15 - 479.16 -# The domain build function. VMX domain uses 'vmx'. 479.17 -builder='vmx' 479.18 - 479.19 -# Initial memory allocation (in megabytes) for the new domain. 479.20 -memory = 128 479.21 - 479.22 -# A name for your domain. All domains must have different names. 479.23 -name = "ExampleVMXDomain" 479.24 - 479.25 -# Which CPU to start domain on? 479.26 -#cpu = -1 # leave to Xen to pick 479.27 - 479.28 -# Optionally define mac and/or bridge for the network interfaces. 479.29 -# Random MACs are assigned if not given. 479.30 -#vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ] 479.31 - 479.32 -#---------------------------------------------------------------------------- 479.33 -# Define the disk devices you want the domain to have access to, and 479.34 -# what you want them accessible as. 479.35 -# Each disk entry is of the form phy:UNAME,DEV,MODE 479.36 -# where UNAME is the device, DEV is the device name the domain will see, 479.37 -# and MODE is r for read-only, w for read-write. 479.38 - 479.39 -#disk = [ 'phy:hda1,hda1,r' ] 479.40 -disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ] 479.41 - 479.42 -#---------------------------------------------------------------------------- 479.43 -# Set according to whether you want the domain restarted when it exits. 479.44 -# The default is 'onreboot', which restarts the domain when it shuts down 479.45 -# with exit code reboot. 479.46 -# Other values are 'always', and 'never'. 479.47 - 479.48 -#restart = 'onreboot' 479.49 - 479.50 -#============================================================================ 479.51 - 479.52 - 479.53 -# New stuff 479.54 -device_model = '/usr/@@LIBDIR@@/xen/bin/qemu-dm' 479.55 - 479.56 -# Advanced users only. Don't touch if you don't know what you're doing 479.57 -memmap = '/usr/@@LIBDIR@@/xen/boot/mem-map.sxp' 479.58 - 479.59 -#----------------------------------------------------------------------------- 479.60 -# Disk image for 479.61 -#cdrom= 479.62 - 479.63 -#----------------------------------------------------------------------------- 479.64 -# boot on floppy (a), hard disk (c) or CD-ROM (d) 479.65 -#boot=[a|c|d] 479.66 -#----------------------------------------------------------------------------- 479.67 -# write to temporary files instead of disk image files 479.68 -#snapshot=1 479.69 - 479.70 -#---------------------------------------------------------------------------- 479.71 -# enable SDL library for graphics, default = 0 479.72 -sdl=0 479.73 - 479.74 -#---------------------------------------------------------------------------- 479.75 -# enable VNC library for graphics, default = 1 479.76 -vnc=1 479.77 - 479.78 -#---------------------------------------------------------------------------- 479.79 -# enable spawning vncviewer(only valid when vnc=1), default = 1 479.80 -vncviewer=1 479.81 - 479.82 -#---------------------------------------------------------------------------- 479.83 -# no graphics, use serial port 479.84 -#nographic=0 479.85 - 479.86 - 479.87 -#----------------------------------------------------------------------------- 479.88 -# enable audio support 479.89 -#enable-audio=1 479.90 - 479.91 - 479.92 -#----------------------------------------------------------------------------- 479.93 -# set the real time clock to local time [default=0 i.e. set to utc] 479.94 -#localtime=1 479.95 - 479.96 - 479.97 -#----------------------------------------------------------------------------- 479.98 -# start in full screen 479.99 -#full-screen=1
483.1 --- a/tools/firmware/Makefile Wed Sep 14 15:33:52 2005 -0600 483.2 +++ b/tools/firmware/Makefile Wed Sep 14 15:36:10 2005 -0600 483.3 @@ -1,6 +1,8 @@ 483.4 XEN_ROOT = ../.. 483.5 include $(XEN_ROOT)/tools/Rules.mk 483.6 483.7 +# vmxloader is a 32-bit protected mode binary. 483.8 +# It belongs in /usr/lib, not /usr/lib64. 483.9 TARGET := vmxassist/vmxloader 483.10 INSTALL_DIR := $(DESTDIR)/usr/lib/xen/boot 483.11
493.1 --- a/tools/ioemu/hw/i8259.c Wed Sep 14 15:33:52 2005 -0600 493.2 +++ b/tools/ioemu/hw/i8259.c Wed Sep 14 15:36:10 2005 -0600 493.3 @@ -128,21 +128,23 @@ static int pic_get_irq(PicState *s) 493.4 /* pic[1] is connected to pin2 of pic[0] */ 493.5 #define CASCADE_IRQ 2 493.6 493.7 -static void shared_page_update() 493.8 +extern shared_iopage_t *shared_page; 493.9 + 493.10 +static void xen_update_shared_imr(void) 493.11 { 493.12 - extern shared_iopage_t *shared_page; 493.13 - uint8_t * pmask = (uint8_t *)&(shared_page->sp_global.pic_mask[0]); 493.14 - int index; 493.15 + uint8_t *pmask = (uint8_t *)shared_page->sp_global.pic_mask; 493.16 + int index; 493.17 493.18 index = pics[0].irq_base/8; 493.19 pmask[index] = pics[0].imr; 493.20 - index = pics[1].irq_base/8; 493.21 493.22 - if ( pics[0].imr & (1 << CASCADE_IRQ) ) { 493.23 - pmask[index] = 0xff; 493.24 - } else { 493.25 - pmask[index] = pics[1].imr; 493.26 - } 493.27 + index = pics[1].irq_base/8; 493.28 + pmask[index] = (pics[0].imr & (1 << CASCADE_IRQ)) ? 0xff : pics[1].imr; 493.29 +} 493.30 + 493.31 +static void xen_clear_shared_irr(void) 493.32 +{ 493.33 + memset(shared_page->sp_global.pic_intr, 0, INTR_LEN); 493.34 } 493.35 493.36 /* raise irq to CPU if necessary. must be called every time the active 493.37 @@ -174,7 +176,8 @@ static void pic_update_irq(void) 493.38 #endif 493.39 cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HARD); 493.40 } 493.41 - shared_page_update(); 493.42 + 493.43 + xen_update_shared_imr(); 493.44 } 493.45 493.46 #ifdef DEBUG_IRQ_LATENCY 493.47 @@ -283,7 +286,9 @@ static void pic_reset(void *opaque) 493.48 tmp = s->elcr_mask; 493.49 memset(s, 0, sizeof(PicState)); 493.50 s->elcr_mask = tmp; 493.51 - shared_page_update(); 493.52 + 493.53 + xen_update_shared_imr(); 493.54 + xen_clear_shared_irr(); 493.55 } 493.56 493.57 static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
511.1 --- a/tools/libxc/xc_domain.c Wed Sep 14 15:33:52 2005 -0600 511.2 +++ b/tools/libxc/xc_domain.c Wed Sep 14 15:36:10 2005 -0600 511.3 @@ -134,7 +134,7 @@ int xc_domain_getinfolist(int xc_handle, 511.4 int ret = 0; 511.5 dom0_op_t op; 511.6 511.7 - if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0) 511.8 + if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 ) 511.9 return -1; 511.10 511.11 op.cmd = DOM0_GETDOMAININFOLIST; 511.12 @@ -142,12 +142,12 @@ int xc_domain_getinfolist(int xc_handle, 511.13 op.u.getdomaininfolist.max_domains = max_domains; 511.14 op.u.getdomaininfolist.buffer = info; 511.15 511.16 - if(xc_dom0_op(xc_handle, &op) < 0) 511.17 + if ( xc_dom0_op(xc_handle, &op) < 0 ) 511.18 ret = -1; 511.19 else 511.20 ret = op.u.getdomaininfolist.num_domains; 511.21 511.22 - if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0) 511.23 + if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 ) 511.24 ret = -1; 511.25 511.26 return ret; 511.27 @@ -277,15 +277,18 @@ int xc_domain_memory_increase_reservatio 511.28 }; 511.29 511.30 err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation); 511.31 - if (err == nr_extents) 511.32 + if ( err == nr_extents ) 511.33 return 0; 511.34 511.35 - if (err > 0) { 511.36 - fprintf(stderr,"Failed alocation for dom %d : %ld pages order %d addr_bits %d\n", 511.37 - domid, nr_extents, extent_order, address_bits); 511.38 + if ( err > 0 ) 511.39 + { 511.40 + fprintf(stderr, "Failed allocation for dom %d: " 511.41 + "%ld pages order %d addr_bits %d\n", 511.42 + domid, nr_extents, extent_order, address_bits); 511.43 errno = ENOMEM; 511.44 err = -1; 511.45 } 511.46 + 511.47 return err; 511.48 } 511.49 511.50 @@ -304,24 +307,24 @@ int xc_domain_memory_decrease_reservatio 511.51 .domid = domid 511.52 }; 511.53 511.54 - if (extent_start == NULL) 511.55 + if ( extent_start == NULL ) 511.56 { 511.57 fprintf(stderr,"decrease_reservation extent_start is NULL!\n"); 511.58 errno = EINVAL; 511.59 - err = -1; 511.60 - goto out; 511.61 + return -1; 511.62 } 511.63 511.64 - err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation); 511.65 - if (err == nr_extents) 511.66 + err = xc_memory_op(xc_handle, XENMEM_decrease_reservation, &reservation); 511.67 + if ( err == nr_extents ) 511.68 return 0; 511.69 511.70 - if (err > 0) { 511.71 - fprintf(stderr,"Failed de-alocation for dom %d : %ld pages order %d\n", 511.72 - domid, nr_extents, extent_order); 511.73 + if ( err > 0 ) 511.74 + { 511.75 + fprintf(stderr,"Failed deallocation for dom %d: %ld pages order %d\n", 511.76 + domid, nr_extents, extent_order); 511.77 errno = EBUSY; 511.78 err = -1; 511.79 } 511.80 -out: 511.81 + 511.82 return err; 511.83 }
515.1 --- a/tools/libxc/xc_linux_restore.c Wed Sep 14 15:33:52 2005 -0600 515.2 +++ b/tools/libxc/xc_linux_restore.c Wed Sep 14 15:36:10 2005 -0600 515.3 @@ -421,7 +421,7 @@ int xc_linux_restore(int xc_handle, int 515.4 pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE; 515.5 else /* pfn_type[i] == (L2TAB|LPINTAB) */ 515.6 pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE; 515.7 - pin[nr_pins].mfn = pfn_to_mfn_table[i]; 515.8 + pin[nr_pins].arg1.mfn = pfn_to_mfn_table[i]; 515.9 if ( ++nr_pins == MAX_PIN_BATCH ) 515.10 { 515.11 if ( xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
516.1 --- a/tools/libxc/xc_linux_save.c Wed Sep 14 15:33:52 2005 -0600 516.2 +++ b/tools/libxc/xc_linux_save.c Wed Sep 14 15:36:10 2005 -0600 516.3 @@ -14,8 +14,6 @@ 516.4 516.5 #include "xg_private.h" 516.6 516.7 -#include <xen/io/domain_controller.h> 516.8 - 516.9 #define BATCH_SIZE 1024 /* 1024 pages (4MB) at a time */ 516.10 516.11 #define MAX_MBIT_RATE 500
520.1 --- a/tools/libxc/xc_private.c Wed Sep 14 15:33:52 2005 -0600 520.2 +++ b/tools/libxc/xc_private.c Wed Sep 14 15:36:10 2005 -0600 520.3 @@ -465,14 +465,14 @@ unsigned long xc_make_page_below_4G( 520.4 unsigned long new_mfn; 520.5 520.6 if ( xc_domain_memory_decrease_reservation( 520.7 - xc_handle, domid, 1, 0, &mfn) != 1 ) 520.8 + xc_handle, domid, 1, 0, &mfn) != 0 ) 520.9 { 520.10 fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn); 520.11 return 0; 520.12 } 520.13 520.14 if ( xc_domain_memory_increase_reservation( 520.15 - xc_handle, domid, 1, 0, 32, &new_mfn) != 1 ) 520.16 + xc_handle, domid, 1, 0, 32, &new_mfn) != 0 ) 520.17 { 520.18 fprintf(stderr,"xc_make_page_below_4G increase failed. mfn=%lx\n",mfn); 520.19 return 0;
523.1 --- a/tools/libxc/xc_vmx_build.c Wed Sep 14 15:33:52 2005 -0600 523.2 +++ b/tools/libxc/xc_vmx_build.c Wed Sep 14 15:36:10 2005 -0600 523.3 @@ -169,21 +169,35 @@ static int zap_mmio_range(int xc_handle, 523.4 l2_pgentry_t *vl2tab; 523.5 523.6 mmio_addr = mmio_range_start & PAGE_MASK; 523.7 - for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) { 523.8 + for ( ; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE ) 523.9 + { 523.10 vl3e = vl3tab[l3_table_offset(mmio_addr)]; 523.11 - if (vl3e == 0) 523.12 + if ( vl3e == 0 ) 523.13 continue; 523.14 - vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 523.15 - PROT_READ|PROT_WRITE, vl3e >> PAGE_SHIFT); 523.16 - if (vl2tab == 0) { 523.17 + 523.18 + vl2tab = xc_map_foreign_range( 523.19 + xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl3e>>PAGE_SHIFT); 523.20 + if ( vl2tab == NULL ) 523.21 + { 523.22 PERROR("Failed zap MMIO range"); 523.23 return -1; 523.24 } 523.25 + 523.26 vl2e = vl2tab[l2_table_offset(mmio_addr)]; 523.27 - if (vl2e == 0) 523.28 + if ( vl2e == 0 ) 523.29 + { 523.30 + munmap(vl2tab, PAGE_SIZE); 523.31 continue; 523.32 - vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 523.33 - PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT); 523.34 + } 523.35 + 523.36 + vl1tab = xc_map_foreign_range( 523.37 + xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl2e>>PAGE_SHIFT); 523.38 + if ( vl1tab == NULL ) 523.39 + { 523.40 + PERROR("Failed zap MMIO range"); 523.41 + munmap(vl2tab, PAGE_SIZE); 523.42 + return -1; 523.43 + } 523.44 523.45 vl1tab[l1_table_offset(mmio_addr)] = 0; 523.46 munmap(vl2tab, PAGE_SIZE);
526.1 --- a/tools/libxc/xg_private.c Wed Sep 14 15:33:52 2005 -0600 526.2 +++ b/tools/libxc/xg_private.c Wed Sep 14 15:36:10 2005 -0600 526.3 @@ -65,7 +65,7 @@ int pin_table( 526.4 struct mmuext_op op; 526.5 526.6 op.cmd = type; 526.7 - op.mfn = mfn; 526.8 + op.arg1.mfn = mfn; 526.9 526.10 if ( xc_mmuext_op(xc_handle, &op, 1, dom) < 0 ) 526.11 return 1;
543.1 --- a/tools/python/xen/lowlevel/xs/xs.c Wed Sep 14 15:33:52 2005 -0600 543.2 +++ b/tools/python/xen/lowlevel/xs/xs.c Wed Sep 14 15:36:10 2005 -0600 543.3 @@ -74,6 +74,7 @@ static inline PyObject *pyvalue_str(char 543.4 " path [string]: xenstore path\n" \ 543.5 "\n" \ 543.6 "Returns: [string] data read.\n" \ 543.7 + " None if key doesn't exist.\n" \ 543.8 "Raises RuntimeError on error.\n" \ 543.9 "\n" 543.10 543.11 @@ -97,7 +98,11 @@ static PyObject *xspy_read(PyObject *sel 543.12 xsval = xs_read(xh, path, &xsval_n); 543.13 Py_END_ALLOW_THREADS 543.14 if (!xsval) { 543.15 - PyErr_SetFromErrno(PyExc_RuntimeError); 543.16 + if (errno == ENOENT) { 543.17 + Py_INCREF(Py_None); 543.18 + val = Py_None; 543.19 + } else 543.20 + PyErr_SetFromErrno(PyExc_RuntimeError); 543.21 goto exit; 543.22 } 543.23 val = PyString_FromStringAndSize(xsval, xsval_n); 543.24 @@ -160,6 +165,7 @@ static PyObject *xspy_write(PyObject *se 543.25 " path [string]: path to list.\n" \ 543.26 "\n" \ 543.27 "Returns: [string array] list of subdirectory names.\n" \ 543.28 + " None if key doesn't exist.\n" \ 543.29 "Raises RuntimeError on error.\n" \ 543.30 "\n" 543.31 543.32 @@ -183,12 +189,17 @@ static PyObject *xspy_ls(PyObject *self, 543.33 xsval = xs_directory(xh, path, &xsval_n); 543.34 Py_END_ALLOW_THREADS 543.35 if (!xsval) { 543.36 - PyErr_SetFromErrno(PyExc_RuntimeError); 543.37 - goto exit; 543.38 + if (errno == ENOENT) { 543.39 + Py_INCREF(Py_None); 543.40 + val = Py_None; 543.41 + } else 543.42 + PyErr_SetFromErrno(PyExc_RuntimeError); 543.43 + goto exit; 543.44 } 543.45 val = PyList_New(xsval_n); 543.46 for (i = 0; i < xsval_n; i++) 543.47 PyList_SetItem(val, i, PyString_FromString(xsval[i])); 543.48 + free(xsval); 543.49 exit: 543.50 return val; 543.51 } 543.52 @@ -253,7 +264,7 @@ static PyObject *xspy_rm(PyObject *self, 543.53 Py_BEGIN_ALLOW_THREADS 543.54 xsval = xs_rm(xh, path); 543.55 Py_END_ALLOW_THREADS 543.56 - if (!xsval) { 543.57 + if (!xsval && errno != ENOENT) { 543.58 PyErr_SetFromErrno(PyExc_RuntimeError); 543.59 goto exit; 543.60 }
570.1 --- a/tools/python/xen/xend/XendCheckpoint.py Wed Sep 14 15:33:52 2005 -0600 570.2 +++ b/tools/python/xen/xend/XendCheckpoint.py Wed Sep 14 15:36:10 2005 -0600 570.3 @@ -13,6 +13,7 @@ from string import join 570.4 from struct import pack, unpack, calcsize 570.5 from xen.util.xpopen import xPopen3 570.6 import xen.lowlevel.xc; xc = xen.lowlevel.xc.new() 570.7 +from xen.xend.xenstore.xsutil import IntroduceDomain 570.8 570.9 from XendError import XendError 570.10 from XendLogging import log 570.11 @@ -48,7 +49,7 @@ def save(xd, fd, dominfo, live): 570.12 # simply uses the defaults compiled into libxenguest; see the comments 570.13 # and/or code in xc_linux_save() for more information. 570.14 cmd = [PATH_XC_SAVE, str(xc.handle()), str(fd), 570.15 - str(dominfo.id), "0", "0", str(int(live)) ] 570.16 + str(dominfo.domid), "0", "0", str(int(live)) ] 570.17 log.info("[xc_save] " + join(cmd)) 570.18 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 570.19 570.20 @@ -68,18 +69,10 @@ def save(xd, fd, dominfo, live): 570.21 if fd == child.fromchild.fileno(): 570.22 l = child.fromchild.readline() 570.23 if l.rstrip() == "suspend": 570.24 - log.info("suspending %d" % dominfo.id) 570.25 - xd.domain_shutdown(dominfo.id, reason='suspend') 570.26 + log.info("suspending %d" % dominfo.domid) 570.27 + xd.domain_shutdown(dominfo.domid, reason='suspend') 570.28 dominfo.state_wait("suspended") 570.29 - log.info("suspend %d done" % dominfo.id) 570.30 - if dominfo.store_channel: 570.31 - try: 570.32 - dominfo.db.releaseDomain(dominfo.id) 570.33 - except Exception, ex: 570.34 - log.warning( 570.35 - "error in domain release on xenstore: %s", 570.36 - ex) 570.37 - pass 570.38 + log.info("suspend %d done" % dominfo.domid) 570.39 child.tochild.write("done\n") 570.40 child.tochild.flush() 570.41 if filter(lambda (fd, event): event & select.POLLHUP, r): 570.42 @@ -90,12 +83,8 @@ def save(xd, fd, dominfo, live): 570.43 if child.wait() != 0: 570.44 raise XendError("xc_save failed: %s" % lasterr) 570.45 570.46 - if dominfo.store_channel: 570.47 - dominfo.store_channel.close() 570.48 - dominfo.db['store_channel'].delete() 570.49 - dominfo.db.saveDB(save=True) 570.50 - dominfo.store_channel = None 570.51 - xd.domain_destroy(dominfo.id) 570.52 + dominfo.setStoreChannel(None) 570.53 + xd.domain_destroy(dominfo.domid) 570.54 return None 570.55 570.56 def restore(xd, fd): 570.57 @@ -137,7 +126,7 @@ def restore(xd, fd): 570.58 console_evtchn = 0 570.59 570.60 cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd), 570.61 - str(dominfo.id), str(nr_pfns), 570.62 + str(dominfo.domid), str(nr_pfns), 570.63 str(store_evtchn), str(console_evtchn)] 570.64 log.info("[xc_restore] " + join(cmd)) 570.65 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 570.66 @@ -163,16 +152,15 @@ def restore(xd, fd): 570.67 m = re.match(r"^(store-mfn) (\d+)\n$", l) 570.68 if m: 570.69 if dominfo.store_channel: 570.70 - dominfo.store_mfn = int(m.group(2)) 570.71 + dominfo.setStoreRef(int(m.group(2))) 570.72 if dominfo.store_mfn >= 0: 570.73 - dominfo.db.introduceDomain(dominfo.id, 570.74 - dominfo.store_mfn, 570.75 - dominfo.store_channel) 570.76 - dominfo.exportToDB(save=True, sync=True) 570.77 + IntroduceDomain(dominfo.domid, 570.78 + dominfo.store_mfn, 570.79 + dominfo.store_channel.port1, 570.80 + dominfo.path) 570.81 m = re.match(r"^(console-mfn) (\d+)\n$", l) 570.82 if m: 570.83 - dominfo.console_mfn = int(m.group(2)) 570.84 - dominfo.exportToDB(save=True, sync=True) 570.85 + dominfo.setConsoleRef(int(m.group(2))) 570.86 try: 570.87 l = child.fromchild.readline() 570.88 except:
574.1 --- a/tools/python/xen/xend/XendDomain.py Wed Sep 14 15:33:52 2005 -0600 574.2 +++ b/tools/python/xen/xend/XendDomain.py Wed Sep 14 15:36:10 2005 -0600 574.3 @@ -130,8 +130,11 @@ class XendDomain: 574.4 doms = self.xen_domains() 574.5 self.dbmap.readDB() 574.6 for domdb in self.dbmap.values(): 574.7 + if not domdb.has_key("xend"): 574.8 + continue 574.9 + db = domdb.addChild("xend") 574.10 try: 574.11 - domid = int(domdb.id) 574.12 + domid = int(domdb["domid"].getData()) 574.13 except: 574.14 domid = None 574.15 # XXX if domid in self.domains, then something went wrong 574.16 @@ -139,7 +142,8 @@ class XendDomain: 574.17 domdb.delete() 574.18 elif domid in doms: 574.19 try: 574.20 - self._new_domain(domdb, doms[domid]) 574.21 + self._new_domain(domdb["uuid"].getData(), domid, db, 574.22 + doms[domid]) 574.23 except Exception, ex: 574.24 log.exception("Error recreating domain info: id=%d", domid) 574.25 self._delete_domain(domid) 574.26 @@ -155,15 +159,15 @@ class XendDomain: 574.27 def close(self): 574.28 pass 574.29 574.30 - def _new_domain(self, db, info): 574.31 + def _new_domain(self, uuid, domid, db, info): 574.32 """Create a domain entry from saved info. 574.33 574.34 @param db: saved info from the db 574.35 @param info: domain info from xen 574.36 @return: domain 574.37 """ 574.38 - dominfo = XendDomainInfo.recreate(db, info) 574.39 - self.domains[dominfo.id] = dominfo 574.40 + dominfo = XendDomainInfo.recreate(uuid, domid, db, info) 574.41 + self.domains[dominfo.domid] = dominfo 574.42 return dominfo 574.43 574.44 def _add_domain(self, info, notify=True): 574.45 @@ -174,15 +178,15 @@ class XendDomain: 574.46 """ 574.47 # Remove entries under the wrong id. 574.48 for i, d in self.domains.items(): 574.49 - if i != d.id: 574.50 + if i != d.domid: 574.51 del self.domains[i] 574.52 self.dbmap.delete(d.uuid) 574.53 - if info.id in self.domains: 574.54 + if info.domid in self.domains: 574.55 notify = False 574.56 - self.domains[info.id] = info 574.57 + self.domains[info.domid] = info 574.58 info.exportToDB(save=True) 574.59 if notify: 574.60 - eserver.inject('xend.domain.create', [info.name, info.id]) 574.61 + eserver.inject('xend.domain.create', [info.name, info.domid]) 574.62 574.63 def _delete_domain(self, id, notify=True): 574.64 """Remove a domain from the tables. 574.65 @@ -201,11 +205,14 @@ class XendDomain: 574.66 info.cleanup() 574.67 info.delete() 574.68 if notify: 574.69 - eserver.inject('xend.domain.died', [info.name, info.id]) 574.70 + eserver.inject('xend.domain.died', [info.name, info.domid]) 574.71 # XXX this should not be needed 574.72 for domdb in self.dbmap.values(): 574.73 + if not domdb.has_key("xend"): 574.74 + continue 574.75 + db = domdb.addChild("xend") 574.76 try: 574.77 - domid = int(domdb.id) 574.78 + domid = int(domdb["domid"].getData()) 574.79 except: 574.80 domid = None 574.81 if (domid is None) or (domid == id): 574.82 @@ -261,13 +268,13 @@ class XendDomain: 574.83 # Update entries for existing domains. 574.84 do_domain_restarts = False 574.85 for d in self.domains.values(): 574.86 - info = doms.get(d.id) 574.87 + info = doms.get(d.domid) 574.88 if info: 574.89 d.update(info) 574.90 elif d.restart_pending(): 574.91 do_domain_restarts = True 574.92 else: 574.93 - self._delete_domain(d.id) 574.94 + self._delete_domain(d.domid) 574.95 if cleanup and do_domain_restarts: 574.96 scheduler.now(self.domain_restarts) 574.97 574.98 @@ -298,20 +305,20 @@ class XendDomain: 574.99 574.100 @param dominfo: domain object 574.101 """ 574.102 - log.info("Restarting domain: name=%s id=%s", dominfo.name, dominfo.id) 574.103 + log.info("Restarting domain: name=%s id=%s", dominfo.name, dominfo.domid) 574.104 eserver.inject("xend.domain.restart", 574.105 - [dominfo.name, dominfo.id, "begin"]) 574.106 + [dominfo.name, dominfo.domid, "begin"]) 574.107 try: 574.108 dominfo.restart() 574.109 - log.info('Restarted domain name=%s id=%s', dominfo.name, dominfo.id) 574.110 + log.info('Restarted domain name=%s id=%s', dominfo.name, dominfo.domid) 574.111 eserver.inject("xend.domain.restart", 574.112 - [dominfo.name, dominfo.id, "success"]) 574.113 - self.domain_unpause(dominfo.id) 574.114 + [dominfo.name, dominfo.domid, "success"]) 574.115 + self.domain_unpause(dominfo.domid) 574.116 except Exception, ex: 574.117 log.exception("Exception restarting domain: name=%s id=%s", 574.118 - dominfo.name, dominfo.id) 574.119 + dominfo.name, dominfo.domid) 574.120 eserver.inject("xend.domain.restart", 574.121 - [dominfo.name, dominfo.id, "fail"]) 574.122 + [dominfo.name, dominfo.domid, "fail"]) 574.123 return dominfo 574.124 574.125 def domain_configure(self, vmconfig): 574.126 @@ -355,12 +362,12 @@ class XendDomain: 574.127 log.info( 574.128 "Creating entry for unknown domain: id=%d uuid=%s", 574.129 id, uuid) 574.130 - db = self.dbmap.addChild(uuid) 574.131 - dominfo = XendDomainInfo.recreate(db, info) 574.132 - dominfo.setdom(id) 574.133 + db = self.dbmap.addChild("%s/xend" % uuid) 574.134 + dominfo = XendDomainInfo.recreate(uuid, id, db, info) 574.135 self._add_domain(dominfo) 574.136 return dominfo 574.137 except Exception, ex: 574.138 + raise 574.139 log.exception("Error creating domain info: id=%d", id) 574.140 return None 574.141 574.142 @@ -383,9 +390,9 @@ class XendDomain: 574.143 @param id: domain id 574.144 """ 574.145 dominfo = self.domain_lookup(id) 574.146 - eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.id]) 574.147 + eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.domid]) 574.148 try: 574.149 - return xc.domain_unpause(dom=dominfo.id) 574.150 + return xc.domain_unpause(dom=dominfo.domid) 574.151 except Exception, ex: 574.152 raise XendError(str(ex)) 574.153 574.154 @@ -395,9 +402,9 @@ class XendDomain: 574.155 @param id: domain id 574.156 """ 574.157 dominfo = self.domain_lookup(id) 574.158 - eserver.inject('xend.domain.pause', [dominfo.name, dominfo.id]) 574.159 + eserver.inject('xend.domain.pause', [dominfo.name, dominfo.domid]) 574.160 try: 574.161 - return xc.domain_pause(dom=dominfo.id) 574.162 + return xc.domain_pause(dom=dominfo.domid) 574.163 except Exception, ex: 574.164 raise XendError(str(ex)) 574.165 574.166 @@ -413,8 +420,8 @@ class XendDomain: 574.167 @param reason: shutdown type: poweroff, reboot, suspend, halt 574.168 """ 574.169 dominfo = self.domain_lookup(id) 574.170 - self.domain_restart_schedule(dominfo.id, reason, force=True) 574.171 - eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.id, reason]) 574.172 + self.domain_restart_schedule(dominfo.domid, reason, force=True) 574.173 + eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.domid, reason]) 574.174 if reason == 'halt': 574.175 reason = 'poweroff' 574.176 val = dominfo.shutdown(reason) 574.177 @@ -438,7 +445,7 @@ class XendDomain: 574.178 if not dominfo.shutdown_pending: 574.179 # domain doesn't need shutdown 574.180 continue 574.181 - id = dominfo.id 574.182 + id = dominfo.domid 574.183 left = dominfo.shutdown_time_left(SHUTDOWN_TIMEOUT) 574.184 if left <= 0: 574.185 # Shutdown expired - destroy domain. 574.186 @@ -469,15 +476,15 @@ class XendDomain: 574.187 restart = (force and reason == 'reboot') or dominfo.restart_needed(reason) 574.188 if restart: 574.189 log.info('Scheduling restart for domain: name=%s id=%s', 574.190 - dominfo.name, dominfo.id) 574.191 + dominfo.name, dominfo.domid) 574.192 eserver.inject("xend.domain.restart", 574.193 - [dominfo.name, dominfo.id, "schedule"]) 574.194 + [dominfo.name, dominfo.domid, "schedule"]) 574.195 dominfo.restarting() 574.196 else: 574.197 log.info('Cancelling restart for domain: name=%s id=%s', 574.198 - dominfo.name, dominfo.id) 574.199 + dominfo.name, dominfo.domid) 574.200 eserver.inject("xend.domain.restart", 574.201 - [dominfo.name, dominfo.id, "cancel"]) 574.202 + [dominfo.name, dominfo.domid, "cancel"]) 574.203 dominfo.restart_cancel() 574.204 574.205 def domain_restarts(self): 574.206 @@ -487,8 +494,8 @@ class XendDomain: 574.207 for dominfo in self.domains.values(): 574.208 if not dominfo.restart_pending(): 574.209 continue 574.210 - print 'domain_restarts>', dominfo.name, dominfo.id 574.211 - info = doms.get(dominfo.id) 574.212 + print 'domain_restarts>', dominfo.name, dominfo.domid 574.213 + info = doms.get(dominfo.domid) 574.214 if info: 574.215 # Don't execute restart for domains still running. 574.216 print 'domain_restarts> still runnning: ', dominfo.name 574.217 @@ -505,7 +512,7 @@ class XendDomain: 574.218 try: 574.219 dominfo = self.domain_lookup(id) 574.220 log.info('Destroying domain: name=%s', dominfo.name) 574.221 - eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.id]) 574.222 + eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.domid]) 574.223 val = dominfo.destroy() 574.224 except: 574.225 #todo 574.226 @@ -580,7 +587,7 @@ class XendDomain: 574.227 """ 574.228 dominfo = self.domain_lookup(id) 574.229 try: 574.230 - return xc.domain_pincpu(dominfo.id, vcpu, cpumap) 574.231 + return xc.domain_pincpu(dominfo.domid, vcpu, cpumap) 574.232 except Exception, ex: 574.233 raise XendError(str(ex)) 574.234 574.235 @@ -589,7 +596,7 @@ class XendDomain: 574.236 """ 574.237 dominfo = self.domain_lookup(id) 574.238 try: 574.239 - return xc.bvtsched_domain_set(dom=dominfo.id, mcuadv=mcuadv, 574.240 + return xc.bvtsched_domain_set(dom=dominfo.domid, mcuadv=mcuadv, 574.241 warpback=warpback, warpvalue=warpvalue, 574.242 warpl=warpl, warpu=warpu) 574.243 except Exception, ex: 574.244 @@ -600,7 +607,7 @@ class XendDomain: 574.245 """ 574.246 dominfo = self.domain_lookup(id) 574.247 try: 574.248 - return xc.bvtsched_domain_get(dominfo.id) 574.249 + return xc.bvtsched_domain_get(dominfo.domid) 574.250 except Exception, ex: 574.251 raise XendError(str(ex)) 574.252 574.253 @@ -610,7 +617,7 @@ class XendDomain: 574.254 """ 574.255 dominfo = self.domain_lookup(id) 574.256 try: 574.257 - return xc.sedf_domain_set(dominfo.id, period, slice, latency, extratime, weight) 574.258 + return xc.sedf_domain_set(dominfo.domid, period, slice, latency, extratime, weight) 574.259 except Exception, ex: 574.260 raise XendError(str(ex)) 574.261 574.262 @@ -619,7 +626,7 @@ class XendDomain: 574.263 """ 574.264 dominfo = self.domain_lookup(id) 574.265 try: 574.266 - return xc.sedf_domain_get(dominfo.id) 574.267 + return xc.sedf_domain_get(dominfo.domid) 574.268 except Exception, ex: 574.269 raise XendError(str(ex)) 574.270 574.271 @@ -667,7 +674,7 @@ class XendDomain: 574.272 @param type: device type 574.273 """ 574.274 dominfo = self.domain_lookup(id) 574.275 - val = dominfo.device_destroy(type, devid) 574.276 + val = dominfo.device_delete(type, devid) 574.277 dominfo.exportToDB() 574.278 return val 574.279 574.280 @@ -709,7 +716,7 @@ class XendDomain: 574.281 """ 574.282 dominfo = self.domain_lookup(id) 574.283 try: 574.284 - return xc.shadow_control(dominfo.id, op) 574.285 + return xc.shadow_control(dominfo.domid, op) 574.286 except Exception, ex: 574.287 raise XendError(str(ex)) 574.288 574.289 @@ -723,7 +730,7 @@ class XendDomain: 574.290 dominfo = self.domain_lookup(id) 574.291 maxmem = int(mem) * 1024 574.292 try: 574.293 - return xc.domain_setmaxmem(dominfo.id, maxmem_kb = maxmem) 574.294 + return xc.domain_setmaxmem(dominfo.domid, maxmem_kb = maxmem) 574.295 except Exception, ex: 574.296 raise XendError(str(ex)) 574.297 574.298 @@ -735,7 +742,7 @@ class XendDomain: 574.299 @return: 0 on success, -1 on error 574.300 """ 574.301 dominfo = self.domain_lookup(id) 574.302 - return dominfo.mem_target_set(mem) 574.303 + return dominfo.setMemoryTarget(mem * (1 << 20)) 574.304 574.305 def domain_vcpu_hotplug(self, id, vcpu, state): 574.306 """Enable or disable VCPU vcpu in DOM id 574.307 @@ -755,12 +762,12 @@ class XendDomain: 574.308 @param id: domain 574.309 """ 574.310 dominfo = self.domain_lookup(id) 574.311 - corefile = "/var/xen/dump/%s.%s.core"% (dominfo.name, dominfo.id) 574.312 + corefile = "/var/xen/dump/%s.%s.core"% (dominfo.name, dominfo.domid) 574.313 try: 574.314 - xc.domain_dumpcore(dom=dominfo.id, corefile=corefile) 574.315 + xc.domain_dumpcore(dom=dominfo.domid, corefile=corefile) 574.316 except Exception, ex: 574.317 log.warning("Dumpcore failed, id=%s name=%s: %s", 574.318 - dominfo.id, dominfo.name, ex) 574.319 + dominfo.domid, dominfo.name, ex) 574.320 574.321 def instance(): 574.322 """Singleton constructor. Use this instead of the class constructor.
575.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 15:33:52 2005 -0600 575.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 15:36:10 2005 -0600 575.3 @@ -27,6 +27,7 @@ import string, re 575.4 import os 575.5 import time 575.6 import threading 575.7 +import errno 575.8 575.9 import xen.lowlevel.xc; xc = xen.lowlevel.xc.new() 575.10 from xen.util.ip import check_subnet, get_current_ipgw 575.11 @@ -48,6 +49,7 @@ from xen.xend.XendRoot import get_compon 575.12 from xen.xend.uuid import getUuid 575.13 from xen.xend.xenstore import DBVar, XenNode, DBMap 575.14 from xen.xend.xenstore.xstransact import xstransact 575.15 +from xen.xend.xenstore.xsutil import IntroduceDomain 575.16 575.17 """Shutdown code for poweroff.""" 575.18 DOMAIN_POWEROFF = 0 575.19 @@ -128,7 +130,7 @@ class XendDomainInfo: 575.20 @raise: VmError for invalid configuration 575.21 """ 575.22 uuid = getUuid() 575.23 - db = parentdb.addChild(uuid) 575.24 + db = parentdb.addChild("%s/xend" % uuid) 575.25 path = parentdb.getPath() 575.26 vm = cls(uuid, path, db) 575.27 vm.construct(config) 575.28 @@ -138,23 +140,26 @@ class XendDomainInfo: 575.29 575.30 create = classmethod(create) 575.31 575.32 - def recreate(cls, db, info): 575.33 + def recreate(cls, uuid, domid, db, info): 575.34 """Create the VM object for an existing domain. 575.35 575.36 @param db: domain db 575.37 @param info: domain info from xc 575.38 """ 575.39 - dom = info['dom'] 575.40 - path = "/".join(db.getPath().split("/")[0:-1]) 575.41 - vm = cls(db.getName(), path, db) 575.42 - vm.setdom(dom) 575.43 - db.readDB() 575.44 + path = "/".join(db.getPath().split("/")[0:-2]) 575.45 + vm = cls(uuid, path, db) 575.46 + vm.setDomid(domid) 575.47 + vm.name, vm.start_time = vm.gatherVm(("name", str), 575.48 + ("start-time", float)) 575.49 + try: 575.50 + db.readDB() 575.51 + except: pass 575.52 vm.importFromDB() 575.53 config = vm.config 575.54 log.debug('info=' + str(info)) 575.55 log.debug('config=' + prettyprintstring(config)) 575.56 575.57 - vm.memory = info['mem_kb']/1024 575.58 + vm.memory = info['mem_kb'] / 1024 575.59 vm.target = info['mem_kb'] * 1024 575.60 575.61 if config: 575.62 @@ -164,7 +169,7 @@ class XendDomainInfo: 575.63 finally: 575.64 vm.recreate = False 575.65 else: 575.66 - vm.setName("Domain-%d" % dom) 575.67 + vm.setName("Domain-%d" % domid) 575.68 575.69 vm.exportToDB(save=True) 575.70 return vm 575.71 @@ -180,13 +185,13 @@ class XendDomainInfo: 575.72 """ 575.73 if not uuid: 575.74 uuid = getUuid() 575.75 - db = parentdb.addChild(uuid) 575.76 + db = parentdb.addChild("%s/xend" % uuid) 575.77 path = parentdb.getPath() 575.78 vm = cls(uuid, path, db) 575.79 ssidref = int(sxp.child_value(config, 'ssidref')) 575.80 log.debug('restoring with ssidref='+str(ssidref)) 575.81 id = xc.domain_create(ssidref = ssidref) 575.82 - vm.setdom(id) 575.83 + vm.setDomid(id) 575.84 vm.clear_shutdown() 575.85 try: 575.86 vm.restore = True 575.87 @@ -199,32 +204,26 @@ class XendDomainInfo: 575.88 restore = classmethod(restore) 575.89 575.90 __exports__ = [ 575.91 - DBVar('id', ty='int'), 575.92 - DBVar('name', ty='str'), 575.93 - DBVar('uuid', ty='str'), 575.94 DBVar('config', ty='sxpr'), 575.95 - DBVar('start_time', ty='float'), 575.96 DBVar('state', ty='str'), 575.97 - DBVar('store_mfn', ty='long'), 575.98 - DBVar('console_mfn', ty='long', path="console/ring-ref"), 575.99 DBVar('restart_mode', ty='str'), 575.100 DBVar('restart_state', ty='str'), 575.101 DBVar('restart_time', ty='float'), 575.102 DBVar('restart_count', ty='int'), 575.103 - DBVar('target', ty='long', path="memory/target"), 575.104 DBVar('device_model_pid', ty='int'), 575.105 ] 575.106 575.107 def __init__(self, uuid, path, db): 575.108 self.uuid = uuid 575.109 self.path = path + "/" + uuid 575.110 + 575.111 self.db = db 575.112 575.113 self.recreate = 0 575.114 self.restore = 0 575.115 575.116 self.config = None 575.117 - self.id = None 575.118 + self.domid = None 575.119 self.cpu_weight = 1 575.120 self.start_time = None 575.121 self.name = None 575.122 @@ -260,10 +259,42 @@ class XendDomainInfo: 575.123 self.restart_count = 0 575.124 575.125 self.vcpus = 1 575.126 - self.vcpusdb = {} 575.127 self.bootloader = None 575.128 self.device_model_pid = 0 575.129 575.130 + self.writeVm("uuid", self.uuid) 575.131 + self.storeDom("vm", self.path) 575.132 + 575.133 + def readVm(self, *args): 575.134 + return xstransact.Read(self.path, *args) 575.135 + 575.136 + def writeVm(self, *args): 575.137 + return xstransact.Write(self.path, *args) 575.138 + 575.139 + def removeVm(self, *args): 575.140 + return xstransact.Remove(self.path, *args) 575.141 + 575.142 + def gatherVm(self, *args): 575.143 + return xstransact.Gather(self.path, *args) 575.144 + 575.145 + def storeVm(self, *args): 575.146 + return xstransact.Store(self.path, *args) 575.147 + 575.148 + def readDom(self, *args): 575.149 + return xstransact.Read(self.path, *args) 575.150 + 575.151 + def writeDom(self, *args): 575.152 + return xstransact.Write(self.path, *args) 575.153 + 575.154 + def removeDom(self, *args): 575.155 + return xstransact.Remove(self.path, *args) 575.156 + 575.157 + def gatherDom(self, *args): 575.158 + return xstransact.Gather(self.path, *args) 575.159 + 575.160 + def storeDom(self, *args): 575.161 + return xstransact.Store(self.path, *args) 575.162 + 575.163 def setDB(self, db): 575.164 self.db = db 575.165 575.166 @@ -271,50 +302,56 @@ class XendDomainInfo: 575.167 self.db.saveDB(save=save, sync=sync) 575.168 575.169 def exportToDB(self, save=False, sync=False): 575.170 - if self.store_channel: 575.171 - self.store_channel.saveToDB(self.db.addChild("store_channel"), 575.172 - save=save) 575.173 - if self.console_channel: 575.174 - self.db['console/port'] = "%i" % self.console_channel.port1 575.175 if self.image: 575.176 self.image.exportToDB(save=save, sync=sync) 575.177 self.db.exportToDB(self, fields=self.__exports__, save=save, sync=sync) 575.178 575.179 def importFromDB(self): 575.180 self.db.importFromDB(self, fields=self.__exports__) 575.181 - self.store_channel = self.eventChannelOld("store_channel") 575.182 + self.store_channel = self.eventChannel("store/port") 575.183 575.184 - def setdom(self, dom): 575.185 + def setDomid(self, domid): 575.186 """Set the domain id. 575.187 575.188 @param dom: domain id 575.189 """ 575.190 - self.id = int(dom) 575.191 - #self.db.id = self.id 575.192 + self.domid = domid 575.193 + self.storeDom("domid", self.domid) 575.194 575.195 def getDomain(self): 575.196 - return self.id 575.197 + return self.domid 575.198 575.199 def setName(self, name): 575.200 self.name = name 575.201 - self.db.name = self.name 575.202 + self.storeVm("name", name) 575.203 575.204 def getName(self): 575.205 return self.name 575.206 575.207 - def getStoreChannel(self): 575.208 - return self.store_channel 575.209 + def setStoreRef(self, ref): 575.210 + self.store_mfn = ref 575.211 + self.storeDom("store/ring-ref", ref) 575.212 575.213 - def getConsoleChannel(self): 575.214 - return self.console_channel 575.215 + def setStoreChannel(self, channel): 575.216 + if self.store_channel and self.store_channel != channel: 575.217 + self.store_channel.close() 575.218 + self.store_channel = channel 575.219 + self.storeDom("store/port", channel.port1) 575.220 + 575.221 + def setConsoleRef(self, ref): 575.222 + self.console_mfn = ref 575.223 + self.storeDom("console/ring-ref", ref) 575.224 + 575.225 + def setMemoryTarget(self, target): 575.226 + self.memory_target = target 575.227 + self.storeDom("memory/target", target) 575.228 575.229 def update(self, info=None): 575.230 """Update with info from xc.domain_getinfo(). 575.231 """ 575.232 - self.info = info or dom_get(self.id) 575.233 + self.info = info or dom_get(self.domid) 575.234 self.memory = self.info['mem_kb'] / 1024 575.235 self.ssidref = self.info['ssidref'] 575.236 - self.target = self.info['mem_kb'] * 1024 575.237 575.238 def state_set(self, state): 575.239 self.state_updated.acquire() 575.240 @@ -332,7 +369,7 @@ class XendDomainInfo: 575.241 575.242 def __str__(self): 575.243 s = "<domain" 575.244 - s += " id=" + str(self.id) 575.245 + s += " id=" + str(self.domid) 575.246 s += " name=" + self.name 575.247 s += " memory=" + str(self.memory) 575.248 s += " ssidref=" + str(self.ssidref) 575.249 @@ -373,7 +410,7 @@ class XendDomainInfo: 575.250 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 575.251 575.252 front = { 'backend' : backpath, 575.253 - 'backend-id' : "%i" % backdom.id, 575.254 + 'backend-id' : "%i" % backdom.domid, 575.255 'virtual-device' : "%i" % devnum } 575.256 xstransact.Write(frontpath, front) 575.257 575.258 @@ -382,7 +419,7 @@ class XendDomainInfo: 575.259 back = { 'type' : type, 575.260 'params' : params, 575.261 'frontend' : frontpath, 575.262 - 'frontend-id' : "%i" % self.id } 575.263 + 'frontend-id' : "%i" % self.domid } 575.264 xstransact.Write(backpath, back) 575.265 575.266 return 575.267 @@ -415,7 +452,7 @@ class XendDomainInfo: 575.268 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 575.269 575.270 front = { 'backend' : backpath, 575.271 - 'backend-id' : "%i" % backdom.id, 575.272 + 'backend-id' : "%i" % backdom.domid, 575.273 'handle' : "%i" % devnum, 575.274 'mac' : mac } 575.275 xstransact.Write(frontpath, front) 575.276 @@ -425,7 +462,7 @@ class XendDomainInfo: 575.277 'mac' : mac, 575.278 'bridge' : bridge, 575.279 'frontend' : frontpath, 575.280 - 'frontend-id' : "%i" % self.id, 575.281 + 'frontend-id' : "%i" % self.domid, 575.282 'handle' : "%i" % devnum } 575.283 if ipaddr: 575.284 back['ip'] = ' '.join(ipaddr) 575.285 @@ -444,13 +481,13 @@ class XendDomainInfo: 575.286 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 575.287 575.288 front = { 'backend' : backpath, 575.289 - 'backend-id' : "%i" % backdom.id, 575.290 + 'backend-id' : "%i" % backdom.domid, 575.291 'handle' : "%i" % devnum } 575.292 xstransact.Write(frontpath, front) 575.293 575.294 back = { 'instance' : "%i" % devnum, 575.295 'frontend' : frontpath, 575.296 - 'frontend-id' : "%i" % self.id } 575.297 + 'frontend-id' : "%i" % self.domid } 575.298 xstransact.Write(backpath, back) 575.299 575.300 return 575.301 @@ -485,7 +522,7 @@ class XendDomainInfo: 575.302 575.303 def sxpr(self): 575.304 sxpr = ['domain', 575.305 - ['id', self.id], 575.306 + ['domid', self.domid], 575.307 ['name', self.name], 575.308 ['memory', self.memory], 575.309 ['ssidref', self.ssidref], 575.310 @@ -582,7 +619,7 @@ class XendDomainInfo: 575.311 return 575.312 if dominfo.is_terminated(): 575.313 return 575.314 - if not self.id or (dominfo.id != self.id): 575.315 + if not self.domid or (dominfo.domid != self.domid): 575.316 raise VmError('vm name clash: ' + name) 575.317 575.318 def construct(self, config): 575.319 @@ -630,11 +667,11 @@ class XendDomainInfo: 575.320 self.memory = int(sxp.child_value(config, 'memory')) 575.321 if self.memory is None: 575.322 raise VmError('missing memory size') 575.323 - self.target = self.memory * (1 << 20) 575.324 + self.setMemoryTarget(self.memory * (1 << 20)) 575.325 self.ssidref = int(sxp.child_value(config, 'ssidref')) 575.326 cpu = sxp.child_value(config, 'cpu') 575.327 - if self.recreate and self.id and cpu is not None and int(cpu) >= 0: 575.328 - xc.domain_pincpu(self.id, 0, 1<<int(cpu)) 575.329 + if self.recreate and self.domid and cpu is not None and int(cpu) >= 0: 575.330 + xc.domain_pincpu(self.domid, 0, 1<<int(cpu)) 575.331 try: 575.332 image = sxp.child_value(self.config, 'image') 575.333 vcpus = sxp.child_value(image, 'vcpus') 575.334 @@ -643,15 +680,11 @@ class XendDomainInfo: 575.335 except: 575.336 raise VmError('invalid vcpus value') 575.337 575.338 - def exportVCPUSToDB(self, vcpus): 575.339 - for v in range(0,vcpus): 575.340 - path = "/cpu/%d"%(v) 575.341 - if not self.vcpusdb.has_key(path): 575.342 - self.vcpusdb[path] = self.db.addChild(path) 575.343 - db = self.vcpusdb[path] 575.344 - log.debug("writing key availability=online to path %s in store"%(path)) 575.345 - db['availability'] = "online" 575.346 - db.saveDB(save=True) 575.347 + def configure_vcpus(self, vcpus): 575.348 + d = {} 575.349 + for v in range(0, vcpus): 575.350 + d["cpu/%d/availability" % v] = "online" 575.351 + self.writeVm(d) 575.352 575.353 def init_image(self): 575.354 """Create boot image handler for the domain. 575.355 @@ -668,18 +701,17 @@ class XendDomainInfo: 575.356 self.image.createImage() 575.357 self.exportToDB() 575.358 if self.store_channel and self.store_mfn >= 0: 575.359 - self.db.introduceDomain(self.id, 575.360 - self.store_mfn, 575.361 - self.store_channel) 575.362 + IntroduceDomain(self.domid, self.store_mfn, 575.363 + self.store_channel.port1, self.path) 575.364 # get the configured value of vcpus and update store 575.365 - self.exportVCPUSToDB(self.vcpus) 575.366 + self.configure_vcpus(self.vcpus) 575.367 575.368 def delete(self): 575.369 """Delete the vm's db. 575.370 """ 575.371 - if dom_get(self.id): 575.372 + if dom_get(self.domid): 575.373 return 575.374 - self.id = None 575.375 + self.domid = None 575.376 self.saveToDB(sync=True) 575.377 try: 575.378 # Todo: eventually will have to wait for devices to signal 575.379 @@ -695,10 +727,10 @@ class XendDomainInfo: 575.380 The domain will not finally go away unless all vm 575.381 devices have been released. 575.382 """ 575.383 - if self.id is None: 575.384 + if self.domid is None: 575.385 return 575.386 try: 575.387 - xc.domain_destroy(dom=self.id) 575.388 + xc.domain_destroy(dom=self.domid) 575.389 except Exception, err: 575.390 log.exception("Domain destroy failed: %s", self.name) 575.391 575.392 @@ -708,16 +740,7 @@ class XendDomainInfo: 575.393 self.state = STATE_VM_TERMINATED 575.394 self.release_devices() 575.395 if self.store_channel: 575.396 - try: 575.397 - self.store_channel.close() 575.398 - self.store_channel = None 575.399 - except: 575.400 - pass 575.401 - try: 575.402 - self.db.releaseDomain(self.id) 575.403 - except Exception, ex: 575.404 - log.warning("error in domain release on xenstore: %s", ex) 575.405 - pass 575.406 + self.setStoreChannel(None) 575.407 if self.console_channel: 575.408 # notify processes using this cosole? 575.409 try: 575.410 @@ -765,7 +788,7 @@ class XendDomainInfo: 575.411 def show(self): 575.412 """Print virtual machine info. 575.413 """ 575.414 - print "[VM dom=%d name=%s memory=%d ssidref=%d" % (self.id, self.name, self.memory, self.ssidref) 575.415 + print "[VM dom=%d name=%s memory=%d ssidref=%d" % (self.domid, self.name, self.memory, self.ssidref) 575.416 print "image:" 575.417 sxp.show(self.image) 575.418 print "]" 575.419 @@ -777,46 +800,37 @@ class XendDomainInfo: 575.420 return 575.421 if self.start_time is None: 575.422 self.start_time = time.time() 575.423 + self.storeVm(("start-time", self.start_time)) 575.424 try: 575.425 cpu = int(sxp.child_value(self.config, 'cpu', '-1')) 575.426 except: 575.427 raise VmError('invalid cpu') 575.428 - id = self.image.initDomain(self.id, self.memory, self.ssidref, cpu, self.cpu_weight) 575.429 + id = self.image.initDomain(self.domid, self.memory, self.ssidref, cpu, self.cpu_weight) 575.430 log.debug('init_domain> Created domain=%d name=%s memory=%d', 575.431 id, self.name, self.memory) 575.432 - self.setdom(id) 575.433 + self.setDomid(id) 575.434 575.435 - def eventChannelOld(self, key): 575.436 - """Create an event channel to the domain. 575.437 - If saved info is available recreate the channel. 575.438 - 575.439 - @param key db key for the saved data (if any) 575.440 - """ 575.441 - db = self.db.addChild(key) 575.442 - return EventChannel.restoreFromDB(db, 0, self.id) 575.443 - 575.444 - def eventChannel(self, path=None, key=None): 575.445 + def eventChannel(self, path=None): 575.446 """Create an event channel to the domain. 575.447 575.448 @param path under which port is stored in db 575.449 """ 575.450 port = 0 575.451 - try: 575.452 - if path and key: 575.453 - if path: 575.454 - db = self.db.addChild(path) 575.455 - else: 575.456 - db = self.db 575.457 - port = int(db[key].getData()) 575.458 - except: pass 575.459 - return EventChannel.interdomain(0, self.id, port1=port, port2=0) 575.460 + if path: 575.461 + try: 575.462 + port = int(self.readDom(path)) 575.463 + except: 575.464 + # if anything goes wrong, assume the port was not yet set 575.465 + pass 575.466 + ret = EventChannel.interdomain(0, self.domid, port1=port, port2=0) 575.467 + self.storeDom(path, ret.port1) 575.468 + return ret 575.469 575.470 def create_channel(self): 575.471 """Create the channels to the domain. 575.472 """ 575.473 - self.store_channel = self.eventChannelOld("store_channel") 575.474 - self.console_channel = self.eventChannel("console", "port") 575.475 - 575.476 + self.store_channel = self.eventChannel("store/port") 575.477 + self.console_channel = self.eventChannel("console/port") 575.478 575.479 def create_configured_devices(self): 575.480 devices = sxp.children(self.config, 'device') 575.481 @@ -1046,50 +1060,30 @@ class XendDomainInfo: 575.482 log.warning("Unknown config field %s", field_name) 575.483 index[field_name] = field_index + 1 575.484 575.485 - def mem_target_set(self, target): 575.486 - """Set domain memory target in bytes. 575.487 - """ 575.488 - if target: 575.489 - self.target = target * (1 << 20) 575.490 - # Commit to XenStore immediately 575.491 - self.exportToDB() 575.492 - 575.493 def vcpu_hotplug(self, vcpu, state): 575.494 """Disable or enable VCPU in domain. 575.495 """ 575.496 - db = "" 575.497 - try: 575.498 - db = self.vcpusdb['/cpu/%d'%(vcpu)] 575.499 - except: 575.500 - log.error("Invalid VCPU") 575.501 + if vcpu > self.vcpus: 575.502 + log.error("Invalid VCPU %d" % vcpu) 575.503 return 575.504 - 575.505 - if self.store_channel: 575.506 - if int(state) == 0: 575.507 - db['availability'] = "offline" 575.508 - else: 575.509 - db['availability'] = "online" 575.510 - 575.511 - db.saveDB(save=True) 575.512 + if int(state) == 0: 575.513 + availability = "offline" 575.514 + else: 575.515 + availability = "online" 575.516 + self.storeVm("cpu/%d/availability" % vcpu, availability) 575.517 575.518 def shutdown(self, reason): 575.519 if not reason in shutdown_reasons.values(): 575.520 raise XendError('invalid reason:' + reason) 575.521 - db = self.db.addChild("/control"); 575.522 - db['shutdown'] = reason; 575.523 - db.saveDB(save=True); 575.524 + self.storeVm("control/shutdown", reason) 575.525 if not reason in ['suspend']: 575.526 self.shutdown_pending = {'start':time.time(), 'reason':reason} 575.527 575.528 def clear_shutdown(self): 575.529 - db = self.db.addChild("/control") 575.530 - db['shutdown'] = "" 575.531 - db.saveDB(save=True) 575.532 + self.removeVm("control/shutdown") 575.533 575.534 def send_sysrq(self, key=0): 575.535 - db = self.db.addChild("/control"); 575.536 - db['sysrq'] = '%c' % key; 575.537 - db.saveDB(save=True); 575.538 + self.storeVm("control/sysrq", '%c' % key) 575.539 575.540 def shutdown_time_left(self, timeout): 575.541 if not self.shutdown_pending: 575.542 @@ -1098,14 +1092,22 @@ class XendDomainInfo: 575.543 575.544 def dom0_init_store(self): 575.545 if not self.store_channel: 575.546 - self.store_channel = self.eventChannelOld("store_channel") 575.547 - self.store_mfn = xc.init_store(self.store_channel.port2) 575.548 - if self.store_mfn >= 0: 575.549 - self.db.introduceDomain(self.id, self.store_mfn, 575.550 - self.store_channel) 575.551 - self.exportToDB(save=True, sync=True) 575.552 - # get run-time value of vcpus and update store 575.553 - self.exportVCPUSToDB(dom_get(self.id)['vcpus']) 575.554 + self.store_channel = self.eventChannel("store/port") 575.555 + if not self.store_channel: 575.556 + return 575.557 + ref = xc.init_store(self.store_channel.port2) 575.558 + if ref and ref >= 0: 575.559 + self.setStoreRef(ref) 575.560 + try: 575.561 + IntroduceDomain(self.domid, ref, self.store_channel.port1, 575.562 + self.path) 575.563 + except RuntimeError, ex: 575.564 + if ex.args[0] == errno.EISCONN: 575.565 + pass 575.566 + else: 575.567 + raise 575.568 + # get run-time value of vcpus and update store 575.569 + self.configure_vcpus(dom_get(self.domid)['vcpus']) 575.570 575.571 575.572 def vm_field_ignore(_, _1, _2, _3): 575.573 @@ -1126,7 +1128,7 @@ def vm_field_maxmem(vm, _1, val, _2): 575.574 maxmem = int(maxmem) 575.575 except: 575.576 raise VmError("invalid maxmem: " + str(maxmem)) 575.577 - xc.domain_setmaxmem(vm.id, maxmem_kb = maxmem * 1024) 575.578 + xc.domain_setmaxmem(vm.domid, maxmem_kb = maxmem * 1024) 575.579 575.580 575.581 #============================================================================
583.1 --- a/tools/python/xen/xend/image.py Wed Sep 14 15:33:52 2005 -0600 583.2 +++ b/tools/python/xen/xend/image.py Wed Sep 14 15:36:10 2005 -0600 583.3 @@ -23,6 +23,7 @@ from xen.xend import sxp 583.4 from xen.xend.XendError import VmError 583.5 from xen.xend.XendLogging import log 583.6 from xen.xend.xenstore import DBVar 583.7 +from xen.xend.xenstore.xstransact import xstransact 583.8 583.9 from xen.xend.server import channel 583.10 583.11 @@ -154,7 +155,6 @@ class ImageHandler: 583.12 if dom <= 0: 583.13 raise VmError('Creating domain failed: name=%s' % self.vm.name) 583.14 log.debug("initDomain: cpu=%d mem_kb=%d ssidref=%d dom=%d", cpu, mem_kb, ssidref, dom) 583.15 - # xc.domain_setuuid(dom, uuid) 583.16 xc.domain_setcpuweight(dom, cpu_weight) 583.17 xc.domain_setmaxmem(dom, mem_kb) 583.18 583.19 @@ -240,6 +240,12 @@ class ImageHandler: 583.20 """Extra cleanup on domain destroy (define in subclass if needed).""" 583.21 pass 583.22 583.23 + def set_vminfo(self, d): 583.24 + if d.has_key('store_mfn'): 583.25 + self.vm.setStoreRef(d.get('store_mfn')) 583.26 + if d.has_key('console_mfn'): 583.27 + self.vm.setConsoleRef(d.get('console_mfn')) 583.28 + 583.29 addImageHandlerClass = ImageHandler.addImageHandlerClass 583.30 583.31 class LinuxImageHandler(ImageHandler): 583.32 @@ -274,8 +280,7 @@ class LinuxImageHandler(ImageHandler): 583.33 flags = self.flags, 583.34 vcpus = self.vm.vcpus) 583.35 if isinstance(ret, dict): 583.36 - self.vm.store_mfn = ret.get('store_mfn') 583.37 - self.vm.console_mfn = ret.get('console_mfn') 583.38 + self.set_vminfo(ret) 583.39 return 0 583.40 return ret 583.41 583.42 @@ -318,7 +323,7 @@ class VmxImageHandler(ImageHandler): 583.43 flags = self.flags, 583.44 vcpus = self.vm.vcpus) 583.45 if isinstance(ret, dict): 583.46 - self.vm.store_mfn = ret.get('store_mfn') 583.47 + self.set_vminfo(ret) 583.48 return 0 583.49 return ret 583.50
587.1 --- a/tools/python/xen/xend/server/SrvDomain.py Wed Sep 14 15:33:52 2005 -0600 587.2 +++ b/tools/python/xen/xend/server/SrvDomain.py Wed Sep 14 15:36:10 2005 -0600 587.3 @@ -41,21 +41,21 @@ class SrvDomain(SrvDir): 587.4 fn = FormFn(self.xd.domain_configure, 587.5 [['dom', 'int'], 587.6 ['config', 'sxpr']]) 587.7 - return fn(req.args, {'dom': self.dom.id}) 587.8 + return fn(req.args, {'dom': self.dom.domid}) 587.9 587.10 def op_unpause(self, op, req): 587.11 - val = self.xd.domain_unpause(self.dom.id) 587.12 + val = self.xd.domain_unpause(self.dom.domid) 587.13 return val 587.14 587.15 def op_pause(self, op, req): 587.16 - val = self.xd.domain_pause(self.dom.id) 587.17 + val = self.xd.domain_pause(self.dom.domid) 587.18 return val 587.19 587.20 def op_shutdown(self, op, req): 587.21 fn = FormFn(self.xd.domain_shutdown, 587.22 [['dom', 'int'], 587.23 ['reason', 'str']]) 587.24 - val = fn(req.args, {'dom': self.dom.id}) 587.25 + val = fn(req.args, {'dom': self.dom.domid}) 587.26 req.setResponseCode(http.ACCEPTED) 587.27 req.setHeader("Location", "%s/.." % req.prePathURL()) 587.28 return val 587.29 @@ -64,7 +64,7 @@ class SrvDomain(SrvDir): 587.30 fn = FormFn(self.xd.domain_sysrq, 587.31 [['dom', 'int'], 587.32 ['key', 'int']]) 587.33 - val = fn(req.args, {'dom' : self.dom.id}) 587.34 + val = fn(req.args, {'dom' : self.dom.domid}) 587.35 req.setResponseCode(http.ACCEPTED) 587.36 req.setHeader("Location", "%s/.." % req.prePathURL()) 587.37 return val 587.38 @@ -73,7 +73,7 @@ class SrvDomain(SrvDir): 587.39 fn = FormFn(self.xd.domain_destroy, 587.40 [['dom', 'int'], 587.41 ['reason', 'str']]) 587.42 - val = fn(req.args, {'dom': self.dom.id}) 587.43 + val = fn(req.args, {'dom': self.dom.domid}) 587.44 req.setHeader("Location", "%s/.." % req.prePathURL()) 587.45 return val 587.46 587.47 @@ -84,7 +84,7 @@ class SrvDomain(SrvDir): 587.48 fn = FormFn(self.xd.domain_save, 587.49 [['dom', 'int'], 587.50 ['file', 'str']]) 587.51 - val = fn(req.args, {'dom': self.dom.id}) 587.52 + val = fn(req.args, {'dom': self.dom.domid}) 587.53 return 0 587.54 587.55 def op_migrate(self, op, req): 587.56 @@ -96,14 +96,14 @@ class SrvDomain(SrvDir): 587.57 ['destination', 'str'], 587.58 ['live', 'int'], 587.59 ['resource', 'int']]) 587.60 - return fn(req.args, {'dom': self.dom.id}) 587.61 + return fn(req.args, {'dom': self.dom.domid}) 587.62 587.63 def op_pincpu(self, op, req): 587.64 fn = FormFn(self.xd.domain_pincpu, 587.65 [['dom', 'int'], 587.66 ['vcpu', 'int'], 587.67 ['cpumap', 'int']]) 587.68 - val = fn(req.args, {'dom': self.dom.id}) 587.69 + val = fn(req.args, {'dom': self.dom.domid}) 587.70 return val 587.71 587.72 def op_cpu_bvt_set(self, op, req): 587.73 @@ -114,7 +114,7 @@ class SrvDomain(SrvDir): 587.74 ['warpvalue', 'int'], 587.75 ['warpl', 'long'], 587.76 ['warpu', 'long']]) 587.77 - val = fn(req.args, {'dom': self.dom.id}) 587.78 + val = fn(req.args, {'dom': self.dom.domid}) 587.79 return val 587.80 587.81 587.82 @@ -126,28 +126,28 @@ class SrvDomain(SrvDir): 587.83 ['latency', 'int'], 587.84 ['extratime', 'int'], 587.85 ['weight', 'int']]) 587.86 - val = fn(req.args, {'dom': self.dom.id}) 587.87 + val = fn(req.args, {'dom': self.dom.domid}) 587.88 return val 587.89 587.90 def op_maxmem_set(self, op, req): 587.91 fn = FormFn(self.xd.domain_maxmem_set, 587.92 [['dom', 'int'], 587.93 ['memory', 'int']]) 587.94 - val = fn(req.args, {'dom': self.dom.id}) 587.95 + val = fn(req.args, {'dom': self.dom.domid}) 587.96 return val 587.97 587.98 def op_mem_target_set(self, op, req): 587.99 fn = FormFn(self.xd.domain_mem_target_set, 587.100 [['dom', 'int'], 587.101 ['target', 'int']]) 587.102 - val = fn(req.args, {'dom': self.dom.id}) 587.103 + val = fn(req.args, {'dom': self.dom.domid}) 587.104 return val 587.105 587.106 def op_devices(self, op, req): 587.107 fn = FormFn(self.xd.domain_devtype_ls, 587.108 [['dom', 'int'], 587.109 ['type', 'str']]) 587.110 - val = fn(req.args, {'dom': self.dom.id}) 587.111 + val = fn(req.args, {'dom': self.dom.domid}) 587.112 return val 587.113 587.114 def op_device(self, op, req): 587.115 @@ -155,7 +155,7 @@ class SrvDomain(SrvDir): 587.116 [['dom', 'int'], 587.117 ['type', 'str'], 587.118 ['idx', 'int']]) 587.119 - val = fn(req.args, {'dom': self.dom.id}) 587.120 + val = fn(req.args, {'dom': self.dom.domid}) 587.121 if val: 587.122 return val.sxpr() 587.123 else: 587.124 @@ -165,7 +165,7 @@ class SrvDomain(SrvDir): 587.125 fn = FormFn(self.xd.domain_device_create, 587.126 [['dom', 'int'], 587.127 ['config', 'sxpr']]) 587.128 - val = fn(req.args, {'dom': self.dom.id}) 587.129 + val = fn(req.args, {'dom': self.dom.domid}) 587.130 return val 587.131 587.132 def op_device_refresh(self, op, req): 587.133 @@ -173,7 +173,7 @@ class SrvDomain(SrvDir): 587.134 [['dom', 'int'], 587.135 ['type', 'str'], 587.136 ['idx', 'str']]) 587.137 - val = fn(req.args, {'dom': self.dom.id}) 587.138 + val = fn(req.args, {'dom': self.dom.domid}) 587.139 return val 587.140 587.141 def op_device_destroy(self, op, req): 587.142 @@ -181,7 +181,7 @@ class SrvDomain(SrvDir): 587.143 [['dom', 'int'], 587.144 ['type', 'str'], 587.145 ['idx', 'str']]) 587.146 - val = fn(req.args, {'dom': self.dom.id}) 587.147 + val = fn(req.args, {'dom': self.dom.domid}) 587.148 return val 587.149 587.150 def op_device_configure(self, op, req): 587.151 @@ -189,7 +189,7 @@ class SrvDomain(SrvDir): 587.152 [['dom', 'int'], 587.153 ['config', 'sxpr'], 587.154 ['idx', 'str']]) 587.155 - val = fn(req.args, {'dom': self.dom.id}) 587.156 + val = fn(req.args, {'dom': self.dom.domid}) 587.157 return val 587.158 587.159 def op_vif_limit_set(self, op, req): 587.160 @@ -198,7 +198,7 @@ class SrvDomain(SrvDir): 587.161 ['vif', 'int'], 587.162 ['credit', 'int'], 587.163 ['period', 'int']]) 587.164 - val = fn(req.args, {'dom': self.dom.id}) 587.165 + val = fn(req.args, {'dom': self.dom.domid}) 587.166 return val 587.167 587.168 def op_vcpu_hotplug(self, op, req): 587.169 @@ -206,7 +206,7 @@ class SrvDomain(SrvDir): 587.170 [['dom', 'int'], 587.171 ['vcpu', 'int'], 587.172 ['state', 'int']]) 587.173 - val = fn(req.args, {'dom': self.dom.id}) 587.174 + val = fn(req.args, {'dom': self.dom.domid}) 587.175 return val 587.176 587.177 def render_POST(self, req):
588.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py Wed Sep 14 15:33:52 2005 -0600 588.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py Wed Sep 14 15:36:10 2005 -0600 588.3 @@ -154,7 +154,7 @@ class SrvDomainDir(SrvDir): 588.4 for d in domains: 588.5 req.write('<li><a href="%s%s"> Domain %s</a>' 588.6 % (url, d.name, d.name)) 588.7 - req.write('id=%s' % d.id) 588.8 + req.write('id=%s' % d.domid) 588.9 req.write('memory=%d'% d.memory) 588.10 req.write('ssidref=%d'% d.ssidref) 588.11 req.write('</li>')
594.1 --- a/tools/python/xen/xend/server/blkif.py Wed Sep 14 15:33:52 2005 -0600 594.2 +++ b/tools/python/xen/xend/server/blkif.py Wed Sep 14 15:36:10 2005 -0600 594.3 @@ -123,7 +123,7 @@ class BlkDev(Dev): 594.4 def init(self, recreate=False, reboot=False): 594.5 self.frontendDomain = self.getDomain() 594.6 backend = self.getBackend() 594.7 - self.backendId = backend.id 594.8 + self.backendId = backend.domid 594.9 594.10 def configure(self, config, change=False, recreate=False): 594.11 if change: 594.12 @@ -146,7 +146,7 @@ class BlkDev(Dev): 594.13 594.14 try: 594.15 xd = get_component('xen.xend.XendDomain') 594.16 - self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 594.17 + self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 594.18 except: 594.19 raise XendError('invalid backend domain') 594.20
598.1 --- a/tools/python/xen/xend/server/netif.py Wed Sep 14 15:33:52 2005 -0600 598.2 +++ b/tools/python/xen/xend/server/netif.py Wed Sep 14 15:36:10 2005 -0600 598.3 @@ -180,7 +180,7 @@ class NetDev(Dev): 598.4 else: 598.5 #todo: Code below will fail on xend restart when backend is not domain 0. 598.6 xd = get_component('xen.xend.XendDomain') 598.7 - self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 598.8 + self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 598.9 except: 598.10 raise XendError('invalid backend domain') 598.11 return self.config 598.12 @@ -206,7 +206,7 @@ class NetDev(Dev): 598.13 mtu = self._get_config_mtu(config) 598.14 598.15 xd = get_component('xen.xend.XendDomain') 598.16 - backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 598.17 + backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 598.18 598.19 if (mac is not None) and (mac != self.mac): 598.20 raise XendError("cannot change mac")
607.1 --- a/tools/python/xen/xend/xenstore/xsnode.py Wed Sep 14 15:33:52 2005 -0600 607.2 +++ b/tools/python/xen/xend/xenstore/xsnode.py Wed Sep 14 15:36:10 2005 -0600 607.3 @@ -365,18 +365,6 @@ class XenStore: 607.4 finally: 607.5 self.watchThread = None 607.6 607.7 - def introduceDomain(self, dom, page, evtchn, path): 607.8 - try: 607.9 - self.getxs().introduce_domain(dom, page, evtchn.port1, path) 607.10 - except RuntimeError, ex: 607.11 - if ex.args[0] == errno.EISCONN: 607.12 - return None 607.13 - else: 607.14 - raise 607.15 - 607.16 - def releaseDomain(self, dom): 607.17 - self.getxs().release_domain(dom) 607.18 - 607.19 def getXenStore(): 607.20 global xenstore 607.21 try: 607.22 @@ -461,12 +449,6 @@ class XenNode: 607.23 def ls(self): 607.24 return self.store.ls(self.path) 607.25 607.26 - def introduceDomain(self, dom, page, evtchn, path): 607.27 - self.store.introduceDomain(dom, page, evtchn, path) 607.28 - 607.29 - def releaseDomain(self, dom): 607.30 - self.store.releaseDomain(dom) 607.31 - 607.32 def watch(self, fn, path=""): 607.33 """Watch a path for changes. The path is relative 607.34 to the node and defaults to the node itself.
608.1 --- a/tools/python/xen/xend/xenstore/xsobj.py Wed Sep 14 15:33:52 2005 -0600 608.2 +++ b/tools/python/xen/xend/xenstore/xsobj.py Wed Sep 14 15:36:10 2005 -0600 608.3 @@ -319,30 +319,6 @@ class DBMap(dict): 608.4 def getPath(self): 608.5 return self.__db__ and self.__db__.relPath() 608.6 608.7 - def introduceDomain(self, dom, page, evtchn, path=None): 608.8 - db = self.__db__ 608.9 - if path is None: 608.10 - path = db.relPath() 608.11 - log.info("DBMap>introduceDomain> %d %d %s %s" %(dom, page, evtchn, path)) 608.12 - try: 608.13 - db.introduceDomain(dom, page, evtchn, path) 608.14 - except Exception, ex: 608.15 - import traceback 608.16 - traceback.print_exc() 608.17 - log.info("DBMap>introduceDomain> %s" %ex) 608.18 - pass # todo: don't ignore 608.19 - 608.20 - def releaseDomain(self, dom): 608.21 - db = self.__db__ 608.22 - log.info("DBMap>releaseDomain> %d" %dom) 608.23 - try: 608.24 - db.releaseDomain(dom) 608.25 - except Exception, ex: 608.26 - import traceback 608.27 - traceback.print_exc() 608.28 - log.info("DBMap>releaseDomain> %s" %ex) 608.29 - pass # todo: don't ignore 608.30 - 608.31 def watch(self, fn, path=""): 608.32 return self.__db__.watch(fn, path=path) 608.33 608.34 @@ -509,9 +485,11 @@ class DBMap(dict): 608.35 if self.__db__ is None: 608.36 return 608.37 self.__data__ = self.__db__.getData() 608.38 - for k in self.__db__.ls(): 608.39 - n = self.addChild(k) 608.40 - n.readDB() 608.41 + l = self.__db__.ls() 608.42 + if l: 608.43 + for k in l: 608.44 + n = self.addChild(k) 608.45 + n.readDB() 608.46 self.__dirty__ = False 608.47 608.48 def readChildDB(self, k):
610.1 --- a/tools/python/xen/xend/xenstore/xstransact.py Wed Sep 14 15:33:52 2005 -0600 610.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py Wed Sep 14 15:36:10 2005 -0600 610.3 @@ -7,14 +7,7 @@ 610.4 import errno 610.5 import threading 610.6 from xen.lowlevel import xs 610.7 - 610.8 -handles = {} 610.9 - 610.10 -# XXX need to g/c handles from dead threads 610.11 -def xshandle(): 610.12 - if not handles.has_key(threading.currentThread()): 610.13 - handles[threading.currentThread()] = xs.open() 610.14 - return handles[threading.currentThread()] 610.15 +from xen.xend.xenstore.xsutil import xshandle 610.16 610.17 class xstransact: 610.18 610.19 @@ -43,8 +36,6 @@ class xstransact: 610.20 return xshandle().transaction_end(False) 610.21 610.22 def abort(self): 610.23 - if not self.in_transaction: 610.24 - raise RuntimeError 610.25 self.in_transaction = False 610.26 return xshandle().transaction_end(True) 610.27 610.28 @@ -100,7 +91,10 @@ class xstransact: 610.29 610.30 def _list(self, key): 610.31 path = "%s/%s" % (self.path, key) 610.32 - return map(lambda x: key + "/" + x, xshandle().ls(path)) 610.33 + l = xshandle().ls(path) 610.34 + if l: 610.35 + return map(lambda x: key + "/" + x, l) 610.36 + return [] 610.37 610.38 def list(self, *args): 610.39 if len(args) == 0: 610.40 @@ -110,6 +104,45 @@ class xstransact: 610.41 ret.extend(self._list(key)) 610.42 return ret 610.43 610.44 + def gather(self, *args): 610.45 + if len(args) and type(args[0]) != tuple: 610.46 + args = args, 610.47 + ret = [] 610.48 + for tup in args: 610.49 + if len(tup) == 2: 610.50 + (key, fn) = tup 610.51 + defval = None 610.52 + else: 610.53 + (key, fn, defval) = tup 610.54 + try: 610.55 + val = fn(self._read(key)) 610.56 + except TypeError: 610.57 + val = defval 610.58 + ret.append(val) 610.59 + if len(ret) == 1: 610.60 + return ret[0] 610.61 + return ret 610.62 + 610.63 + def store(self, *args): 610.64 + if len(args) and type(args[0]) != tuple: 610.65 + args = args, 610.66 + for tup in args: 610.67 + if len(tup) == 2: 610.68 + (key, val) = tup 610.69 + try: 610.70 + fmt = { str : "%s", 610.71 + int : "%i", 610.72 + float : "%f", 610.73 + type(None) : None }[type(val)] 610.74 + except KeyError: 610.75 + raise TypeError 610.76 + else: 610.77 + (key, val, fmt) = tup 610.78 + if val is None: 610.79 + self._remove(key) 610.80 + else: 610.81 + self._write(key, fmt % val) 610.82 + 610.83 610.84 def Read(cls, path, *args): 610.85 while True: 610.86 @@ -119,8 +152,13 @@ class xstransact: 610.87 t.commit() 610.88 return v 610.89 except RuntimeError, ex: 610.90 + t.abort() 610.91 if ex.args[0] == errno.ETIMEDOUT: 610.92 pass 610.93 + else: 610.94 + raise 610.95 + except: 610.96 + t.abort() 610.97 raise 610.98 610.99 Read = classmethod(Read) 610.100 @@ -133,13 +171,18 @@ class xstransact: 610.101 t.commit() 610.102 return 610.103 except RuntimeError, ex: 610.104 + t.abort() 610.105 if ex.args[0] == errno.ETIMEDOUT: 610.106 pass 610.107 + else: 610.108 + raise 610.109 + except: 610.110 + t.abort() 610.111 raise 610.112 610.113 Write = classmethod(Write) 610.114 610.115 - def Remove(cls, *args): 610.116 + def Remove(cls, path, *args): 610.117 while True: 610.118 try: 610.119 t = cls(path) 610.120 @@ -147,8 +190,13 @@ class xstransact: 610.121 t.commit() 610.122 return 610.123 except RuntimeError, ex: 610.124 + t.abort() 610.125 if ex.args[0] == errno.ETIMEDOUT: 610.126 pass 610.127 + else: 610.128 + raise 610.129 + except: 610.130 + t.abort() 610.131 raise 610.132 610.133 Remove = classmethod(Remove) 610.134 @@ -161,8 +209,51 @@ class xstransact: 610.135 t.commit() 610.136 return v 610.137 except RuntimeError, ex: 610.138 + t.abort() 610.139 if ex.args[0] == errno.ETIMEDOUT: 610.140 pass 610.141 + else: 610.142 + raise 610.143 + except: 610.144 + t.abort() 610.145 raise 610.146 610.147 List = classmethod(List) 610.148 + 610.149 + def Gather(cls, path, *args): 610.150 + while True: 610.151 + try: 610.152 + t = cls(path) 610.153 + v = t.gather(*args) 610.154 + t.commit() 610.155 + return v 610.156 + except RuntimeError, ex: 610.157 + t.abort() 610.158 + if ex.args[0] == errno.ETIMEDOUT: 610.159 + pass 610.160 + else: 610.161 + raise 610.162 + except: 610.163 + t.abort() 610.164 + raise 610.165 + 610.166 + Gather = classmethod(Gather) 610.167 + 610.168 + def Store(cls, path, *args): 610.169 + while True: 610.170 + try: 610.171 + t = cls(path) 610.172 + v = t.store(*args) 610.173 + t.commit() 610.174 + return v 610.175 + except RuntimeError, ex: 610.176 + t.abort() 610.177 + if ex.args[0] == errno.ETIMEDOUT: 610.178 + pass 610.179 + else: 610.180 + raise 610.181 + except: 610.182 + t.abort() 610.183 + raise 610.184 + 610.185 + Store = classmethod(Store)
611.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 611.2 +++ b/tools/python/xen/xend/xenstore/xsutil.py Wed Sep 14 15:36:10 2005 -0600 611.3 @@ -0,0 +1,20 @@ 611.4 +# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk> 611.5 + 611.6 +# This file is subject to the terms and conditions of the GNU General 611.7 +# Public License. See the file "COPYING" in the main directory of 611.8 +# this archive for more details. 611.9 + 611.10 +import threading 611.11 +from xen.lowlevel import xs 611.12 + 611.13 +handles = {} 611.14 + 611.15 +# XXX need to g/c handles from dead threads 611.16 +def xshandle(): 611.17 + if not handles.has_key(threading.currentThread()): 611.18 + handles[threading.currentThread()] = xs.open() 611.19 + return handles[threading.currentThread()] 611.20 + 611.21 + 611.22 +def IntroduceDomain(domid, page, port, path): 611.23 + return xshandle().introduce_domain(domid, page, port, path)
613.1 --- a/tools/python/xen/xm/create.py Wed Sep 14 15:33:52 2005 -0600 613.2 +++ b/tools/python/xen/xm/create.py Wed Sep 14 15:36:10 2005 -0600 613.3 @@ -750,7 +750,7 @@ def make_domain(opts, config): 613.4 server.xend_domain_destroy(dom) 613.5 opts.err("Failed to unpause domain %s" % dom) 613.6 opts.info("Started domain %s" % (dom)) 613.7 - return int(sxp.child_value(dominfo, 'id')) 613.8 + return int(sxp.child_value(dominfo, 'domid')) 613.9 613.10 def get_dom0_alloc(): 613.11 """Return current allocation memory of dom0 (in MB). Return 0 on error"""
616.1 --- a/tools/python/xen/xm/main.py Wed Sep 14 15:33:52 2005 -0600 616.2 +++ b/tools/python/xen/xm/main.py Wed Sep 14 15:36:10 2005 -0600 616.3 @@ -64,7 +64,6 @@ xm full list of subcommands: 616.4 Domain Commands: 616.5 console <DomId> attach to console of DomId 616.6 cpus-list <DomId> <VCpu> get the list of cpus for a VCPU 616.7 - cpus-set <DomId> <VCpu> <CPUS> set which cpus a VCPU can use. 616.8 create <ConfigFile> create a domain 616.9 destroy <DomId> terminate a domain immediately 616.10 domid <DomName> convert a domain name to a domain id 616.11 @@ -83,6 +82,7 @@ xm full list of subcommands: 616.12 vcpu-enable <DomId> <VCPU> disable VCPU in a domain 616.13 vcpu-disable <DomId> <VCPU> enable VCPU in a domain 616.14 vcpu-list <DomId> get the list of VCPUs for a domain 616.15 + vcpu-pin <DomId> <VCpu> <CPUS> set which cpus a VCPU can use. 616.16 616.17 Xen Host Commands: 616.18 dmesg [--clear] read or clear Xen's message buffer 616.19 @@ -91,14 +91,15 @@ xm full list of subcommands: 616.20 top monitor system and domains in real-time 616.21 616.22 Scheduler Commands: 616.23 - bvt <options> set BVT scheduler parameters 616.24 - bvt_ctxallow <Allow> set the BVT scheduler context switch allowance 616.25 - sedf <options> set simple EDF parameters 616.26 + sched-bvt <options> set BVT scheduler parameters 616.27 + sched-bvt-ctxallow <Allow> 616.28 + Set the BVT scheduler context switch allowance 616.29 + sched-sedf <options> set simple EDF parameters 616.30 616.31 Virtual Device Commands: 616.32 - block-create <DomId> <BackDev> <FrontDev> <Mode> [BackDomId] 616.33 + block-attach <DomId> <BackDev> <FrontDev> <Mode> [BackDomId] 616.34 Create a new virtual block device 616.35 - block-destroy <DomId> <DevId> Destroy a domain's virtual block device 616.36 + block-detach <DomId> <DevId> Destroy a domain's virtual block device 616.37 block-list <DomId> List virtual block devices for a domain 616.38 block-refresh <DomId> <DevId> Refresh a virtual block device for a domain 616.39 network-limit <DomId> <Vif> <Credit> <Period> 616.40 @@ -172,8 +173,7 @@ def xm_create(args): 616.41 from xen.xm import create 616.42 # ugly hack because the opt parser apparently wants 616.43 # the subcommand name just to throw it away! 616.44 - args.insert(0,"bogus") 616.45 - create.main(args) 616.46 + create.main(["bogus"] + args) 616.47 616.48 def xm_save(args): 616.49 arg_check(args,2,"save") 616.50 @@ -192,17 +192,16 @@ def xm_restore(args): 616.51 from xen.xend.XendClient import server 616.52 info = server.xend_domain_restore(savefile) 616.53 PrettyPrint.prettyprint(info) 616.54 - id = sxp.child_value(info, 'id') 616.55 + id = sxp.child_value(info, 'domid') 616.56 if id is not None: 616.57 - server.xend_domain_unpause(id) 616.58 + server.xend_domain_unpause(domid) 616.59 616.60 def xm_migrate(args): 616.61 # TODO: arg_check 616.62 from xen.xm import migrate 616.63 # ugly hack because the opt parser apparently wants 616.64 # the subcommand name just to throw it away! 616.65 - args.insert(0,"bogus") 616.66 - migrate.main(args) 616.67 + migrate.main(["bogus"] + args) 616.68 616.69 def xm_list(args): 616.70 use_long = 0 616.71 @@ -242,7 +241,7 @@ def xm_list(args): 616.72 616.73 def parse_doms_info(info): 616.74 dominfo = {} 616.75 - dominfo['dom'] = int(sxp.child_value(info, 'id', '-1')) 616.76 + dominfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) 616.77 dominfo['name'] = sxp.child_value(info, 'name', '??') 616.78 dominfo['mem'] = int(sxp.child_value(info, 'memory', '0')) 616.79 dominfo['cpu'] = str(sxp.child_value(info, 'cpu', '0')) 616.80 @@ -265,7 +264,7 @@ def parse_doms_info(info): 616.81 for cpu in vcpu_to_cpu: 616.82 vcpuinfo = {} 616.83 vcpuinfo['name'] = sxp.child_value(info, 'name', '??') 616.84 - vcpuinfo['dom'] = int(sxp.child_value(info, 'id', '-1')) 616.85 + vcpuinfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) 616.86 vcpuinfo['vcpu'] = int(count) 616.87 vcpuinfo['cpu'] = int(cpu) 616.88 vcpuinfo['cpumap'] = int(cpumap[count])&mask 616.89 @@ -289,8 +288,7 @@ def xm_show_vcpus(domsinfo): 616.90 vcpuinfo) 616.91 616.92 def xm_vcpu_list(args): 616.93 - args.insert(0,"-v") 616.94 - xm_list(args) 616.95 + xm_list(["-v"] + args) 616.96 616.97 def xm_destroy(args): 616.98 arg_check(args,1,"destroy") 616.99 @@ -298,33 +296,28 @@ def xm_destroy(args): 616.100 from xen.xm import destroy 616.101 # ugly hack because the opt parser apparently wants 616.102 # the subcommand name just to throw it away! 616.103 - args.insert(0,"bogus") 616.104 - destroy.main(args) 616.105 + destroy.main(["bogus"] + args) 616.106 616.107 def xm_reboot(args): 616.108 arg_check(args,1,"reboot") 616.109 + from xen.xm import shutdown 616.110 # ugly hack because the opt parser apparently wants 616.111 # the subcommand name just to throw it away! 616.112 - args.insert(0,"bogus") 616.113 - args.insert(2,"-R") 616.114 - from xen.xm import shutdown 616.115 - shutdown.main(args) 616.116 + shutdown.main(["bogus", "-R"] + args) 616.117 616.118 def xm_shutdown(args): 616.119 arg_check(args,1,"shutdown") 616.120 616.121 + from xen.xm import shutdown 616.122 # ugly hack because the opt parser apparently wants 616.123 # the subcommand name just to throw it away! 616.124 - args.insert(0,"bogus") 616.125 - from xen.xm import shutdown 616.126 - shutdown.main(args) 616.127 + shutdown.main(["bogus"] + args) 616.128 616.129 def xm_sysrq(args): 616.130 from xen.xm import sysrq 616.131 # ugly hack because the opt parser apparently wants 616.132 # the subcommand name just to throw it away! 616.133 - args.insert(0,"bogus") 616.134 - sysrq.main(args) 616.135 + sysrq.main(["bogus"] + args) 616.136 616.137 def xm_pause(args): 616.138 arg_check(args, 1, "pause") 616.139 @@ -358,8 +351,8 @@ def cpu_make_map(cpulist): 616.140 616.141 return cpumap 616.142 616.143 -def xm_cpus_set(args): 616.144 - arg_check(args, 3, "cpus-set") 616.145 +def xm_vcpu_pin(args): 616.146 + arg_check(args, 3, "vcpu-pin") 616.147 616.148 dom = args[0] 616.149 vcpu = int(args[1]) 616.150 @@ -395,7 +388,7 @@ def xm_vcpu_enable(args): 616.151 616.152 from xen.xend.XendClient import server 616.153 dom = server.xend_domain(name) 616.154 - id = sxp.child_value(dom, 'id') 616.155 + id = sxp.child_value(dom, 'domid') 616.156 server.xend_domain_vcpu_hotplug(id, vcpu, 1) 616.157 616.158 def xm_vcpu_disable(args): 616.159 @@ -406,7 +399,7 @@ def xm_vcpu_disable(args): 616.160 616.161 from xen.xend.XendClient import server 616.162 dom = server.xend_domain(name) 616.163 - id = sxp.child_value(dom, 'id') 616.164 + id = sxp.child_value(dom, 'domid') 616.165 server.xend_domain_vcpu_hotplug(id, vcpu, 0) 616.166 616.167 def xm_domid(args): 616.168 @@ -414,7 +407,7 @@ def xm_domid(args): 616.169 616.170 from xen.xend.XendClient import server 616.171 dom = server.xend_domain(name) 616.172 - print sxp.child_value(dom, 'id') 616.173 + print sxp.child_value(dom, 'domid') 616.174 616.175 def xm_domname(args): 616.176 name = args[0] 616.177 @@ -423,22 +416,22 @@ def xm_domname(args): 616.178 dom = server.xend_domain(name) 616.179 print sxp.child_value(dom, 'name') 616.180 616.181 -def xm_bvt(args): 616.182 - arg_check(args, 6, "bvt") 616.183 +def xm_sched_bvt(args): 616.184 + arg_check(args, 6, "sched-bvt") 616.185 dom = args[0] 616.186 v = map(long, args[1:6]) 616.187 from xen.xend.XendClient import server 616.188 server.xend_domain_cpu_bvt_set(dom, *v) 616.189 616.190 -def xm_bvt_ctxallow(args): 616.191 - arg_check(args, 1, "bvt_ctxallow") 616.192 +def xm_sched_bvt_ctxallow(args): 616.193 + arg_check(args, 1, "sched-bvt-ctxallow") 616.194 616.195 slice = int(args[0]) 616.196 from xen.xend.XendClient import server 616.197 server.xend_node_cpu_bvt_slice_set(slice) 616.198 616.199 -def xm_sedf(args): 616.200 - arg_check(args, 6, "sedf") 616.201 +def xm_sched_sedf(args): 616.202 + arg_check(args, 6, "sched-sedf") 616.203 616.204 dom = args[0] 616.205 v = map(int, args[1:6]) 616.206 @@ -462,7 +455,7 @@ def xm_console(args): 616.207 dom = args[0] 616.208 from xen.xend.XendClient import server 616.209 info = server.xend_domain(dom) 616.210 - domid = int(sxp.child_value(info, 'id', '-1')) 616.211 + domid = int(sxp.child_value(info, 'domid', '-1')) 616.212 cmd = "/usr/libexec/xen/xenconsole %d" % domid 616.213 os.execvp('/usr/libexec/xen/xenconsole', cmd.split()) 616.214 console = sxp.child(info, "console") 616.215 @@ -482,10 +475,11 @@ its contents if the [-c|--clear] flag is 616.216 fn=set_true, default=0, 616.217 use="Clear the contents of the Xen message buffer.") 616.218 # Work around for gopts 616.219 - args.insert(0,"bogus") 616.220 - gopts.parse(args) 616.221 - if not (1 <= len(args) <= 2): 616.222 - err('Invalid arguments: ' + str(args)) 616.223 + myargs = args 616.224 + myargs.insert(0, "bogus") 616.225 + gopts.parse(myargs) 616.226 + if not (1 <= len(myargs) <= 2): 616.227 + err('Invalid arguments: ' + str(myargs)) 616.228 616.229 from xen.xend.XendClient import server 616.230 if not gopts.vals.clear: 616.231 @@ -512,6 +506,14 @@ def xm_network_list(args): 616.232 sxp.show(x) 616.233 print 616.234 616.235 +def xm_network_attach(args): 616.236 + 616.237 + print "Not implemented" 616.238 + 616.239 +def xm_network_detach(args): 616.240 + 616.241 + print "Not implemented" 616.242 + 616.243 def xm_block_list(args): 616.244 arg_check(args,1,"block-list") 616.245 dom = args[0] 616.246 @@ -520,11 +522,14 @@ def xm_block_list(args): 616.247 sxp.show(x) 616.248 print 616.249 616.250 -def xm_block_create(args): 616.251 +def xm_block_attach(args): 616.252 n = len(args) 616.253 + if n == 0: 616.254 + usage("block-attach") 616.255 + 616.256 if n < 4 or n > 5: 616.257 err("%s: Invalid argument(s)" % args[0]) 616.258 - usage("block-create") 616.259 + usage("block-attach") 616.260 616.261 dom = args[0] 616.262 vbd = ['vbd', 616.263 @@ -546,8 +551,8 @@ def xm_block_refresh(args): 616.264 from xen.xend.XendClient import server 616.265 server.xend_domain_device_refresh(dom, 'vbd', dev) 616.266 616.267 -def xm_block_destroy(args): 616.268 - arg_check(args,2,"block-destroy") 616.269 +def xm_block_detach(args): 616.270 + arg_check(args,2,"block-detach") 616.271 616.272 dom = args[0] 616.273 dev = args[1] 616.274 @@ -615,7 +620,7 @@ commands = { 616.275 "mem-max": xm_mem_max, 616.276 "mem-set": xm_mem_set, 616.277 # cpu commands 616.278 - "cpus-set": xm_cpus_set, 616.279 + "vcpu-pin": xm_vcpu_pin, 616.280 # "cpus-list": xm_cpus_list, 616.281 "vcpu-enable": xm_vcpu_enable, 616.282 "vcpu-disable": xm_vcpu_disable, 616.283 @@ -631,17 +636,19 @@ commands = { 616.284 "info": xm_info, 616.285 "log": xm_log, 616.286 # scheduler 616.287 - "bvt": xm_bvt, 616.288 - "bvt_ctxallow": xm_bvt_ctxallow, 616.289 - "sedf": xm_sedf, 616.290 + "sched-bvt": xm_sched_bvt, 616.291 + "sched-bvt-ctxallow": xm_sched_bvt_ctxallow, 616.292 + "sched-sedf": xm_sched_sedf, 616.293 # block 616.294 - "block-create": xm_block_create, 616.295 - "block-destroy": xm_block_destroy, 616.296 + "block-attach": xm_block_attach, 616.297 + "block-detach": xm_block_detach, 616.298 "block-list": xm_block_list, 616.299 "block-refresh": xm_block_refresh, 616.300 # network 616.301 "network-limit": xm_network_limit, 616.302 "network-list": xm_network_list, 616.303 + "network-attach": xm_network_attach, 616.304 + "network-detach": xm_network_detach, 616.305 # vnet 616.306 "vnet-list": xm_vnet_list, 616.307 "vnet-create": xm_vnet_create, 616.308 @@ -719,8 +726,6 @@ def main(argv=sys.argv): 616.309 sys.exit(1) 616.310 except XendError, ex: 616.311 if len(args) > 0: 616.312 - if args[0] == "bogus": 616.313 - args.remove("bogus") 616.314 handle_xend_error(argv[1], args[0], ex) 616.315 else: 616.316 print "Unexpected error:", sys.exc_info()[0]
793.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 793.2 +++ b/tools/xenstore/testsuite/16block-watch-crash.test Wed Sep 14 15:36:10 2005 -0600 793.3 @@ -0,0 +1,13 @@ 793.4 +# Test case where blocked connection gets sent watch. 793.5 + 793.6 +mkdir /test 793.7 +watch /test token 793.8 +1 start /test 793.9 +# This will block on above 793.10 +noackwrite /test/entry create contents 793.11 +1 write /test/entry2 create contents 793.12 +1 commit 793.13 +readack 793.14 +expect /test/entry2:token 793.15 +waitwatch 793.16 +ackwatch token
800.1 --- a/tools/xenstore/xenstored_core.c Wed Sep 14 15:33:52 2005 -0600 800.2 +++ b/tools/xenstore/xenstored_core.c Wed Sep 14 15:36:10 2005 -0600 800.3 @@ -50,7 +50,6 @@ 800.4 #include "xenstored_transaction.h" 800.5 #include "xenstored_domain.h" 800.6 #include "xenctrl.h" 800.7 -#include "xen/io/domain_controller.h" 800.8 800.9 static bool verbose; 800.10 LIST_HEAD(connections);
806.1 --- a/tools/xenstore/xenstored_watch.c Wed Sep 14 15:33:52 2005 -0600 806.2 +++ b/tools/xenstore/xenstored_watch.c Wed Sep 14 15:36:10 2005 -0600 806.3 @@ -144,7 +144,7 @@ void fire_watches(struct connection *con 806.4 else 806.5 continue; 806.6 /* If connection not doing anything, queue this. */ 806.7 - if (!i->out) 806.8 + if (i->state == OK) 806.9 queue_next_event(i); 806.10 } 806.11 }
815.1 --- a/tools/xenstore/xs_test.c Wed Sep 14 15:33:52 2005 -0600 815.2 +++ b/tools/xenstore/xs_test.c Wed Sep 14 15:36:10 2005 -0600 815.3 @@ -398,12 +398,16 @@ static void do_noackwrite(unsigned int h 815.4 static void do_readack(unsigned int handle) 815.5 { 815.6 enum xsd_sockmsg_type type; 815.7 - char *ret; 815.8 + char *ret = NULL; 815.9 815.10 - ret = read_reply(handles[handle]->fd, &type, NULL); 815.11 - if (!ret) 815.12 - failed(handle); 815.13 - free(ret); 815.14 + /* Watches can have fired before reply comes: daemon detects 815.15 + * and re-transmits, so we can ignore this. */ 815.16 + do { 815.17 + free(ret); 815.18 + ret = read_reply(handles[handle]->fd, &type, NULL); 815.19 + if (!ret) 815.20 + failed(handle); 815.21 + } while (type == XS_WATCH_EVENT); 815.22 } 815.23 815.24 static void do_setid(unsigned int handle, char *id)
861.1 --- a/xen/arch/x86/mm.c Wed Sep 14 15:33:52 2005 -0600 861.2 +++ b/xen/arch/x86/mm.c Wed Sep 14 15:36:10 2005 -0600 861.3 @@ -1659,7 +1659,7 @@ int do_mmuext_op( 861.4 { 861.5 struct mmuext_op op; 861.6 int rc = 0, i = 0, okay, cpu = smp_processor_id(); 861.7 - unsigned long type, done = 0; 861.8 + unsigned long mfn, type, done = 0; 861.9 struct pfn_info *page; 861.10 struct vcpu *v = current; 861.11 struct domain *d = v->domain, *e; 861.12 @@ -1706,7 +1706,8 @@ int do_mmuext_op( 861.13 } 861.14 861.15 okay = 1; 861.16 - page = &frame_table[op.mfn]; 861.17 + mfn = op.arg1.mfn; 861.18 + page = &frame_table[mfn]; 861.19 861.20 switch ( op.cmd ) 861.21 { 861.22 @@ -1717,17 +1718,17 @@ int do_mmuext_op( 861.23 if ( shadow_mode_refcounts(FOREIGNDOM) ) 861.24 type = PGT_writable_page; 861.25 861.26 - okay = get_page_and_type_from_pagenr(op.mfn, type, FOREIGNDOM); 861.27 + okay = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM); 861.28 if ( unlikely(!okay) ) 861.29 { 861.30 - MEM_LOG("Error while pinning mfn %lx", op.mfn); 861.31 + MEM_LOG("Error while pinning mfn %lx", mfn); 861.32 break; 861.33 } 861.34 861.35 if ( unlikely(test_and_set_bit(_PGT_pinned, 861.36 &page->u.inuse.type_info)) ) 861.37 { 861.38 - MEM_LOG("Mfn %lx already pinned", op.mfn); 861.39 + MEM_LOG("Mfn %lx already pinned", mfn); 861.40 put_page_and_type(page); 861.41 okay = 0; 861.42 break; 861.43 @@ -1750,10 +1751,10 @@ int do_mmuext_op( 861.44 goto pin_page; 861.45 861.46 case MMUEXT_UNPIN_TABLE: 861.47 - if ( unlikely(!(okay = get_page_from_pagenr(op.mfn, FOREIGNDOM))) ) 861.48 + if ( unlikely(!(okay = get_page_from_pagenr(mfn, FOREIGNDOM))) ) 861.49 { 861.50 MEM_LOG("Mfn %lx bad domain (dom=%p)", 861.51 - op.mfn, page_get_owner(page)); 861.52 + mfn, page_get_owner(page)); 861.53 } 861.54 else if ( likely(test_and_clear_bit(_PGT_pinned, 861.55 &page->u.inuse.type_info)) ) 861.56 @@ -1765,28 +1766,28 @@ int do_mmuext_op( 861.57 { 861.58 okay = 0; 861.59 put_page(page); 861.60 - MEM_LOG("Mfn %lx not pinned", op.mfn); 861.61 + MEM_LOG("Mfn %lx not pinned", mfn); 861.62 } 861.63 break; 861.64 861.65 case MMUEXT_NEW_BASEPTR: 861.66 - okay = new_guest_cr3(op.mfn); 861.67 + okay = new_guest_cr3(mfn); 861.68 percpu_info[cpu].deferred_ops &= ~DOP_FLUSH_TLB; 861.69 break; 861.70 861.71 #ifdef __x86_64__ 861.72 case MMUEXT_NEW_USER_BASEPTR: 861.73 okay = get_page_and_type_from_pagenr( 861.74 - op.mfn, PGT_root_page_table, d); 861.75 + mfn, PGT_root_page_table, d); 861.76 if ( unlikely(!okay) ) 861.77 { 861.78 - MEM_LOG("Error while installing new mfn %lx", op.mfn); 861.79 + MEM_LOG("Error while installing new mfn %lx", mfn); 861.80 } 861.81 else 861.82 { 861.83 unsigned long old_mfn = 861.84 pagetable_get_pfn(v->arch.guest_table_user); 861.85 - v->arch.guest_table_user = mk_pagetable(op.mfn << PAGE_SHIFT); 861.86 + v->arch.guest_table_user = mk_pagetable(mfn << PAGE_SHIFT); 861.87 if ( old_mfn != 0 ) 861.88 put_page_and_type(&frame_table[old_mfn]); 861.89 } 861.90 @@ -1799,8 +1800,8 @@ int do_mmuext_op( 861.91 861.92 case MMUEXT_INVLPG_LOCAL: 861.93 if ( shadow_mode_enabled(d) ) 861.94 - shadow_invlpg(v, op.linear_addr); 861.95 - local_flush_tlb_one(op.linear_addr); 861.96 + shadow_invlpg(v, op.arg1.linear_addr); 861.97 + local_flush_tlb_one(op.arg1.linear_addr); 861.98 break; 861.99 861.100 case MMUEXT_TLB_FLUSH_MULTI: 861.101 @@ -1808,7 +1809,7 @@ int do_mmuext_op( 861.102 { 861.103 unsigned long vmask; 861.104 cpumask_t pmask; 861.105 - if ( unlikely(get_user(vmask, (unsigned long *)op.vcpumask)) ) 861.106 + if ( unlikely(get_user(vmask, (unsigned long *)op.arg2.vcpumask)) ) 861.107 { 861.108 okay = 0; 861.109 break; 861.110 @@ -1818,7 +1819,7 @@ int do_mmuext_op( 861.111 if ( op.cmd == MMUEXT_TLB_FLUSH_MULTI ) 861.112 flush_tlb_mask(pmask); 861.113 else 861.114 - flush_tlb_one_mask(pmask, op.linear_addr); 861.115 + flush_tlb_one_mask(pmask, op.arg1.linear_addr); 861.116 break; 861.117 } 861.118 861.119 @@ -1827,7 +1828,7 @@ int do_mmuext_op( 861.120 break; 861.121 861.122 case MMUEXT_INVLPG_ALL: 861.123 - flush_tlb_one_mask(d->cpumask, op.linear_addr); 861.124 + flush_tlb_one_mask(d->cpumask, op.arg1.linear_addr); 861.125 break; 861.126 861.127 case MMUEXT_FLUSH_CACHE: 861.128 @@ -1852,8 +1853,8 @@ int do_mmuext_op( 861.129 break; 861.130 } 861.131 861.132 - unsigned long ptr = op.linear_addr; 861.133 - unsigned long ents = op.nr_ents; 861.134 + unsigned long ptr = op.arg1.linear_addr; 861.135 + unsigned long ents = op.arg2.nr_ents; 861.136 if ( ((ptr & (PAGE_SIZE-1)) != 0) || 861.137 (ents > 8192) || 861.138 !array_access_ok(ptr, ents, LDT_ENTRY_SIZE) ) 861.139 @@ -1886,7 +1887,7 @@ int do_mmuext_op( 861.140 e = percpu_info[cpu].foreign; 861.141 if ( unlikely(e == NULL) ) 861.142 { 861.143 - MEM_LOG("No FOREIGNDOM to reassign mfn %lx to", op.mfn); 861.144 + MEM_LOG("No FOREIGNDOM to reassign mfn %lx to", mfn); 861.145 okay = 0; 861.146 break; 861.147 } 861.148 @@ -1919,7 +1920,7 @@ int do_mmuext_op( 861.149 { 861.150 MEM_LOG("Transferee has no reservation headroom (%d,%d), or " 861.151 "page is in Xen heap (%lx), or dom is dying (%ld).", 861.152 - e->tot_pages, e->max_pages, op.mfn, e->domain_flags); 861.153 + e->tot_pages, e->max_pages, mfn, e->domain_flags); 861.154 okay = 0; 861.155 goto reassign_fail; 861.156 }
872.1 --- a/xen/arch/x86/vmx.c Wed Sep 14 15:33:52 2005 -0600 872.2 +++ b/xen/arch/x86/vmx.c Wed Sep 14 15:36:10 2005 -0600 872.3 @@ -1021,7 +1021,7 @@ static int vmx_set_cr0(unsigned long val 872.4 * CR0: We don't want to lose PE and PG. 872.5 */ 872.6 paging_enabled = vmx_paging_enabled(d); 872.7 - __vmwrite(GUEST_CR0, (value | X86_CR0_PE | X86_CR0_PG)); 872.8 + __vmwrite(GUEST_CR0, value | X86_CR0_PE | X86_CR0_PG | X86_CR0_NE); 872.9 __vmwrite(CR0_READ_SHADOW, value); 872.10 872.11 VMX_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx\n", value);
873.1 --- a/xen/arch/x86/vmx_intercept.c Wed Sep 14 15:33:52 2005 -0600 873.2 +++ b/xen/arch/x86/vmx_intercept.c Wed Sep 14 15:36:10 2005 -0600 873.3 @@ -227,6 +227,7 @@ void vmx_hooks_assist(struct vcpu *d) 873.4 u64 *intr = &(sp->sp_global.pic_intr[0]); 873.5 struct vmx_virpit_t *vpit = &(d->domain->arch.vmx_platform.vmx_pit); 873.6 int rw_mode, reinit = 0; 873.7 + int oldvec = 0; 873.8 873.9 /* load init count*/ 873.10 if (p->state == STATE_IORESP_HOOK) { 873.11 @@ -235,6 +236,7 @@ void vmx_hooks_assist(struct vcpu *d) 873.12 VMX_DBG_LOG(DBG_LEVEL_1, "VMX_PIT: guest reset PIT with channel %lx!\n", (unsigned long) ((p->u.data >> 24) & 0x3) ); 873.13 rem_ac_timer(&(vpit->pit_timer)); 873.14 reinit = 1; 873.15 + oldvec = vpit->vector; 873.16 } 873.17 else 873.18 init_ac_timer(&vpit->pit_timer, pit_timer_fn, vpit, d->processor); 873.19 @@ -250,6 +252,12 @@ void vmx_hooks_assist(struct vcpu *d) 873.20 vpit->period = 1000000; 873.21 } 873.22 vpit->vector = ((p->u.data >> 16) & 0xFF); 873.23 + 873.24 + if( reinit && oldvec != vpit->vector){ 873.25 + clear_bit(oldvec, intr); 873.26 + vpit->pending_intr_nr = 0; 873.27 + } 873.28 + 873.29 vpit->channel = ((p->u.data >> 24) & 0x3); 873.30 vpit->first_injected = 0; 873.31
899.1 --- a/xen/common/schedule.c Wed Sep 14 15:33:52 2005 -0600 899.2 +++ b/xen/common/schedule.c Wed Sep 14 15:36:10 2005 -0600 899.3 @@ -211,11 +211,12 @@ void vcpu_sleep_sync(struct vcpu *v) 899.4 899.5 /* 899.6 * We can be sure that the VCPU is finally descheduled after the running 899.7 - * flag is cleared and the scheduler lock is released. 899.8 + * flag is cleared and the scheduler lock is released. We also check that 899.9 + * the domain continues to be unrunnable, in case someone else wakes it. 899.10 */ 899.11 - while ( test_bit(_VCPUF_running, &v->vcpu_flags) 899.12 - && !domain_runnable(v) 899.13 - && spin_is_locked(&schedule_data[v->processor].schedule_lock) ) 899.14 + while ( !domain_runnable(v) && 899.15 + (test_bit(_VCPUF_running, &v->vcpu_flags) || 899.16 + spin_is_locked(&schedule_data[v->processor].schedule_lock)) ) 899.17 cpu_relax(); 899.18 899.19 sync_vcpu_execstate(v);
1023.1 --- a/xen/include/public/arch-x86_64.h Wed Sep 14 15:33:52 2005 -0600 1023.2 +++ b/xen/include/public/arch-x86_64.h Wed Sep 14 15:36:10 2005 -0600 1023.3 @@ -124,30 +124,38 @@ typedef struct trap_info { 1023.4 unsigned long address; /* code offset */ 1023.5 } trap_info_t; 1023.6 1023.7 +#ifdef __GNUC__ 1023.8 +/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */ 1023.9 +#define __DECL_REG(name) union { u64 r ## name, e ## name; } 1023.10 +#else 1023.11 +/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */ 1023.12 +#define __DECL_REG(name) u64 r ## name 1023.13 +#endif 1023.14 + 1023.15 typedef struct cpu_user_regs { 1023.16 u64 r15; 1023.17 u64 r14; 1023.18 u64 r13; 1023.19 u64 r12; 1023.20 - union { u64 rbp, ebp; }; 1023.21 - union { u64 rbx, ebx; }; 1023.22 + __DECL_REG(bp); 1023.23 + __DECL_REG(bx); 1023.24 u64 r11; 1023.25 u64 r10; 1023.26 u64 r9; 1023.27 u64 r8; 1023.28 - union { u64 rax, eax; }; 1023.29 - union { u64 rcx, ecx; }; 1023.30 - union { u64 rdx, edx; }; 1023.31 - union { u64 rsi, esi; }; 1023.32 - union { u64 rdi, edi; }; 1023.33 + __DECL_REG(ax); 1023.34 + __DECL_REG(cx); 1023.35 + __DECL_REG(dx); 1023.36 + __DECL_REG(si); 1023.37 + __DECL_REG(di); 1023.38 u32 error_code; /* private */ 1023.39 u32 entry_vector; /* private */ 1023.40 - union { u64 rip, eip; }; 1023.41 + __DECL_REG(ip); 1023.42 u16 cs, _pad0[1]; 1023.43 u8 saved_upcall_mask; 1023.44 u8 _pad1[3]; 1023.45 - union { u64 rflags, eflags; }; 1023.46 - union { u64 rsp, esp; }; 1023.47 + __DECL_REG(flags); 1023.48 + __DECL_REG(sp); 1023.49 u16 ss, _pad2[3]; 1023.50 u16 es, _pad3[3]; 1023.51 u16 ds, _pad4[3]; 1023.52 @@ -155,6 +163,8 @@ typedef struct cpu_user_regs { 1023.53 u16 gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_user. */ 1023.54 } cpu_user_regs_t; 1023.55 1023.56 +#undef __DECL_REG 1023.57 + 1023.58 typedef u64 tsc_timestamp_t; /* RDTSC timestamp */ 1023.59 1023.60 /*
1027.1 --- a/xen/include/public/io/domain_controller.h Wed Sep 14 15:33:52 2005 -0600 1027.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1027.3 @@ -1,787 +0,0 @@ 1027.4 -/****************************************************************************** 1027.5 - * domain_controller.h 1027.6 - * 1027.7 - * Interface to server controller (e.g., 'xend'). This header file defines the 1027.8 - * interface that is shared with guest OSes. 1027.9 - * 1027.10 - * Copyright (c) 2004, K A Fraser 1027.11 - */ 1027.12 - 1027.13 -#ifndef __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ 1027.14 -#define __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ 1027.15 - 1027.16 -#include "ring.h" 1027.17 - 1027.18 -/* 1027.19 - * CONTROLLER MESSAGING INTERFACE. 1027.20 - */ 1027.21 - 1027.22 -typedef struct control_msg { 1027.23 - u8 type; /* 0: echoed in response */ 1027.24 - u8 subtype; /* 1: echoed in response */ 1027.25 - u8 id; /* 2: echoed in response */ 1027.26 - u8 length; /* 3: number of bytes in 'msg' */ 1027.27 - u8 msg[60]; /* 4: type-specific message data */ 1027.28 -} control_msg_t; /* 64 bytes */ 1027.29 - 1027.30 -/* These are used by the control message deferred ring. */ 1027.31 -#define CONTROL_RING_SIZE 8 1027.32 -typedef u32 CONTROL_RING_IDX; 1027.33 -#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1)) 1027.34 - 1027.35 -/* 1027.36 - * Generate control ring structures and types. 1027.37 - * 1027.38 - * CONTROL_RING_MEM is currently an 8-slot ring of ctrl_msg_t structs and 1027.39 - * two 32-bit counters: (64 * 8) + (2 * 4) = 520 1027.40 - */ 1027.41 -#define CONTROL_RING_MEM 520 1027.42 -DEFINE_RING_TYPES(ctrl, control_msg_t, control_msg_t); 1027.43 - 1027.44 -typedef struct control_if { 1027.45 - union { 1027.46 - ctrl_sring_t tx_ring; /* guest -> controller */ 1027.47 - char __x[CONTROL_RING_MEM]; 1027.48 - }; 1027.49 - union { 1027.50 - ctrl_sring_t rx_ring; /* controller -> guest */ 1027.51 - char __y[CONTROL_RING_MEM]; 1027.52 - }; 1027.53 -} control_if_t; 1027.54 - 1027.55 -/* 1027.56 - * Top-level command types. 1027.57 - */ 1027.58 -#define CMSG_CONSOLE 0 /* Console */ 1027.59 -#define CMSG_BLKIF_BE 1 /* Block-device backend */ 1027.60 -#define CMSG_BLKIF_FE 2 /* Block-device frontend */ 1027.61 -#define CMSG_NETIF_BE 3 /* Network-device backend */ 1027.62 -#define CMSG_NETIF_FE 4 /* Network-device frontend */ 1027.63 -#define CMSG_SHUTDOWN 6 /* Shutdown messages */ 1027.64 -#define CMSG_MEM_REQUEST 7 /* Memory reservation reqs */ 1027.65 -#define CMSG_USBIF_BE 8 /* USB controller backend */ 1027.66 -#define CMSG_USBIF_FE 9 /* USB controller frontend */ 1027.67 -#define CMSG_VCPU_HOTPLUG 10 /* Hotplug VCPU messages */ 1027.68 -#define CMSG_DEBUG 11 /* PDB backend */ 1027.69 - 1027.70 -/****************************************************************************** 1027.71 - * CONSOLE DEFINITIONS 1027.72 - */ 1027.73 - 1027.74 -/* 1027.75 - * Subtypes for console messages. 1027.76 - */ 1027.77 -#define CMSG_CONSOLE_DATA 0 1027.78 - 1027.79 - 1027.80 -/****************************************************************************** 1027.81 - * BLOCK-INTERFACE FRONTEND DEFINITIONS 1027.82 - */ 1027.83 - 1027.84 -/* Messages from domain controller to guest. */ 1027.85 -#define CMSG_BLKIF_FE_INTERFACE_STATUS 0 1027.86 - 1027.87 -/* Messages from guest to domain controller. */ 1027.88 -#define CMSG_BLKIF_FE_DRIVER_STATUS 32 1027.89 -#define CMSG_BLKIF_FE_INTERFACE_CONNECT 33 1027.90 -#define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34 1027.91 -#define CMSG_BLKIF_FE_INTERFACE_QUERY 35 1027.92 - 1027.93 -#ifndef blkif_vdev_t 1027.94 -#define blkif_vdev_t u16 1027.95 -#endif 1027.96 -#define blkif_pdev_t u32 1027.97 - 1027.98 -/* 1027.99 - * CMSG_BLKIF_FE_INTERFACE_STATUS: 1027.100 - * Notify a guest about a status change on one of its block interfaces. 1027.101 - * If the interface is DESTROYED or DOWN then the interface is disconnected: 1027.102 - * 1. The shared-memory frame is available for reuse. 1027.103 - * 2. Any unacknowledged messages pending on the interface were dropped. 1027.104 - */ 1027.105 -#define BLKIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */ 1027.106 -#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ 1027.107 -#define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */ 1027.108 -#define BLKIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */ 1027.109 -typedef struct blkif_fe_interface_status { 1027.110 - u32 handle; 1027.111 - u32 status; 1027.112 - u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ 1027.113 - domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */ 1027.114 -} blkif_fe_interface_status_t; 1027.115 - 1027.116 -/* 1027.117 - * CMSG_BLKIF_FE_DRIVER_STATUS: 1027.118 - * Notify the domain controller that the front-end driver is DOWN or UP. 1027.119 - * When the driver goes DOWN then the controller will send no more 1027.120 - * status-change notifications. 1027.121 - * If the driver goes DOWN while interfaces are still UP, the domain 1027.122 - * will automatically take the interfaces DOWN. 1027.123 - * 1027.124 - * NB. The controller should not send an INTERFACE_STATUS_CHANGED message 1027.125 - * for interfaces that are active when it receives an UP notification. We 1027.126 - * expect that the frontend driver will query those interfaces itself. 1027.127 - */ 1027.128 -#define BLKIF_DRIVER_STATUS_DOWN 0 1027.129 -#define BLKIF_DRIVER_STATUS_UP 1 1027.130 -typedef struct blkif_fe_driver_status { 1027.131 - /* IN */ 1027.132 - u32 status; /* BLKIF_DRIVER_STATUS_??? */ 1027.133 - /* OUT */ 1027.134 - /* Driver should query interfaces [0..max_handle]. */ 1027.135 - u32 max_handle; 1027.136 -} blkif_fe_driver_status_t; 1027.137 - 1027.138 -/* 1027.139 - * CMSG_BLKIF_FE_INTERFACE_CONNECT: 1027.140 - * If successful, the domain controller will acknowledge with a 1027.141 - * STATUS_CONNECTED message. 1027.142 - */ 1027.143 -typedef struct blkif_fe_interface_connect { 1027.144 - u32 handle; 1027.145 - unsigned long shmem_frame; 1027.146 - int shmem_ref; 1027.147 -} blkif_fe_interface_connect_t; 1027.148 - 1027.149 -/* 1027.150 - * CMSG_BLKIF_FE_INTERFACE_DISCONNECT: 1027.151 - * If successful, the domain controller will acknowledge with a 1027.152 - * STATUS_DISCONNECTED message. 1027.153 - */ 1027.154 -typedef struct blkif_fe_interface_disconnect { 1027.155 - u32 handle; 1027.156 -} blkif_fe_interface_disconnect_t; 1027.157 - 1027.158 -/* 1027.159 - * CMSG_BLKIF_FE_INTERFACE_QUERY: 1027.160 - */ 1027.161 -typedef struct blkif_fe_interface_query { 1027.162 - /* IN */ 1027.163 - u32 handle; 1027.164 - /* OUT */ 1027.165 - u32 status; 1027.166 - u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ 1027.167 - domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */ 1027.168 -} blkif_fe_interface_query_t; 1027.169 - 1027.170 - 1027.171 -/****************************************************************************** 1027.172 - * BLOCK-INTERFACE BACKEND DEFINITIONS 1027.173 - */ 1027.174 - 1027.175 -/* Messages from domain controller. */ 1027.176 -#define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */ 1027.177 -#define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */ 1027.178 -#define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */ 1027.179 -#define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */ 1027.180 -#define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */ 1027.181 -#define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */ 1027.182 - 1027.183 -/* Messages to domain controller. */ 1027.184 -#define CMSG_BLKIF_BE_DRIVER_STATUS 32 1027.185 - 1027.186 -/* 1027.187 - * Message request/response definitions for block-device messages. 1027.188 - */ 1027.189 - 1027.190 -/* Non-specific 'okay' return. */ 1027.191 -#define BLKIF_BE_STATUS_OKAY 0 1027.192 -/* Non-specific 'error' return. */ 1027.193 -#define BLKIF_BE_STATUS_ERROR 1 1027.194 -/* The following are specific error returns. */ 1027.195 -#define BLKIF_BE_STATUS_INTERFACE_EXISTS 2 1027.196 -#define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3 1027.197 -#define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4 1027.198 -#define BLKIF_BE_STATUS_VBD_EXISTS 5 1027.199 -#define BLKIF_BE_STATUS_VBD_NOT_FOUND 6 1027.200 -#define BLKIF_BE_STATUS_OUT_OF_MEMORY 7 1027.201 -#define BLKIF_BE_STATUS_PHYSDEV_NOT_FOUND 8 1027.202 -#define BLKIF_BE_STATUS_MAPPING_ERROR 9 1027.203 - 1027.204 -/* This macro can be used to create an array of descriptive error strings. */ 1027.205 -#define BLKIF_BE_STATUS_ERRORS { \ 1027.206 - "Okay", \ 1027.207 - "Non-specific error", \ 1027.208 - "Interface already exists", \ 1027.209 - "Interface not found", \ 1027.210 - "Interface is still connected", \ 1027.211 - "VBD already exists", \ 1027.212 - "VBD not found", \ 1027.213 - "Out of memory", \ 1027.214 - "Extent not found for VBD", \ 1027.215 - "Could not map domain memory" } 1027.216 - 1027.217 -/* 1027.218 - * CMSG_BLKIF_BE_CREATE: 1027.219 - * When the driver sends a successful response then the interface is fully 1027.220 - * created. The controller will send a DOWN notification to the front-end 1027.221 - * driver. 1027.222 - */ 1027.223 -typedef struct blkif_be_create { 1027.224 - /* IN */ 1027.225 - domid_t domid; /* Domain attached to new interface. */ 1027.226 - u32 blkif_handle; /* Domain-specific interface handle. */ 1027.227 - /* OUT */ 1027.228 - u32 status; 1027.229 -} blkif_be_create_t; 1027.230 - 1027.231 -/* 1027.232 - * CMSG_BLKIF_BE_DESTROY: 1027.233 - * When the driver sends a successful response then the interface is fully 1027.234 - * torn down. The controller will send a DESTROYED notification to the 1027.235 - * front-end driver. 1027.236 - */ 1027.237 -typedef struct blkif_be_destroy { 1027.238 - /* IN */ 1027.239 - domid_t domid; /* Identify interface to be destroyed. */ 1027.240 - u32 blkif_handle; /* ...ditto... */ 1027.241 - /* OUT */ 1027.242 - u32 status; 1027.243 -} blkif_be_destroy_t; 1027.244 - 1027.245 -/* 1027.246 - * CMSG_BLKIF_BE_CONNECT: 1027.247 - * When the driver sends a successful response then the interface is fully 1027.248 - * connected. The controller will send a CONNECTED notification to the 1027.249 - * front-end driver. 1027.250 - */ 1027.251 -typedef struct blkif_be_connect { 1027.252 - /* IN */ 1027.253 - domid_t domid; /* Domain attached to new interface. */ 1027.254 - u32 blkif_handle; /* Domain-specific interface handle. */ 1027.255 - unsigned long shmem_frame;/* Page cont. shared comms window. */ 1027.256 - int shmem_ref; /* Grant table reference. */ 1027.257 - u32 evtchn; /* Event channel for notifications. */ 1027.258 - /* OUT */ 1027.259 - u32 status; 1027.260 -} blkif_be_connect_t; 1027.261 - 1027.262 -/* 1027.263 - * CMSG_BLKIF_BE_DISCONNECT: 1027.264 - * When the driver sends a successful response then the interface is fully 1027.265 - * disconnected. The controller will send a DOWN notification to the front-end 1027.266 - * driver. 1027.267 - */ 1027.268 -typedef struct blkif_be_disconnect { 1027.269 - /* IN */ 1027.270 - domid_t domid; /* Domain attached to new interface. */ 1027.271 - u32 blkif_handle; /* Domain-specific interface handle. */ 1027.272 - /* OUT */ 1027.273 - u32 status; 1027.274 -} blkif_be_disconnect_t; 1027.275 - 1027.276 -/* CMSG_BLKIF_BE_VBD_CREATE */ 1027.277 -typedef struct blkif_be_vbd_create { 1027.278 - /* IN */ 1027.279 - domid_t domid; /* Identify blkdev interface. */ 1027.280 - u32 blkif_handle; /* ...ditto... */ 1027.281 - blkif_pdev_t pdevice; 1027.282 - u32 dev_handle; /* Extended device id field. */ 1027.283 - blkif_vdev_t vdevice; /* Interface-specific id for this VBD. */ 1027.284 - u16 readonly; /* Non-zero -> VBD isn't writable. */ 1027.285 - /* OUT */ 1027.286 - u32 status; 1027.287 -} blkif_be_vbd_create_t; 1027.288 - 1027.289 -/* CMSG_BLKIF_BE_VBD_DESTROY */ 1027.290 -typedef struct blkif_be_vbd_destroy { 1027.291 - /* IN */ 1027.292 - domid_t domid; /* Identify blkdev interface. */ 1027.293 - u32 blkif_handle; /* ...ditto... */ 1027.294 - blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */ 1027.295 - /* OUT */ 1027.296 - u32 status; 1027.297 -} blkif_be_vbd_destroy_t; 1027.298 - 1027.299 -/* 1027.300 - * CMSG_BLKIF_BE_DRIVER_STATUS: 1027.301 - * Notify the domain controller that the back-end driver is DOWN or UP. 1027.302 - * If the driver goes DOWN while interfaces are still UP, the controller 1027.303 - * will automatically send DOWN notifications. 1027.304 - */ 1027.305 -typedef struct blkif_be_driver_status { 1027.306 - u32 status; /* BLKIF_DRIVER_STATUS_??? */ 1027.307 -} blkif_be_driver_status_t; 1027.308 - 1027.309 - 1027.310 -/****************************************************************************** 1027.311 - * NETWORK-INTERFACE FRONTEND DEFINITIONS 1027.312 - */ 1027.313 - 1027.314 -/* Messages from domain controller to guest. */ 1027.315 -#define CMSG_NETIF_FE_INTERFACE_STATUS 0 1027.316 - 1027.317 -/* Messages from guest to domain controller. */ 1027.318 -#define CMSG_NETIF_FE_DRIVER_STATUS 32 1027.319 -#define CMSG_NETIF_FE_INTERFACE_CONNECT 33 1027.320 -#define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34 1027.321 -#define CMSG_NETIF_FE_INTERFACE_QUERY 35 1027.322 - 1027.323 -/* 1027.324 - * CMSG_NETIF_FE_INTERFACE_STATUS: 1027.325 - * Notify a guest about a status change on one of its network interfaces. 1027.326 - * If the interface is CLOSED or DOWN then the interface is disconnected: 1027.327 - * 1. The shared-memory frame is available for reuse. 1027.328 - * 2. Any unacknowledged messgaes pending on the interface were dropped. 1027.329 - */ 1027.330 -#define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */ 1027.331 -#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ 1027.332 -#define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */ 1027.333 -#define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */ 1027.334 -typedef struct netif_fe_interface_status { 1027.335 - u32 handle; 1027.336 - u32 status; 1027.337 - u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 1027.338 - u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 1027.339 - domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */ 1027.340 -} netif_fe_interface_status_t; 1027.341 - 1027.342 -/* 1027.343 - * CMSG_NETIF_FE_DRIVER_STATUS: 1027.344 - * Notify the domain controller that the front-end driver is DOWN or UP. 1027.345 - * When the driver goes DOWN then the controller will send no more 1027.346 - * status-change notifications. 1027.347 - * If the driver goes DOWN while interfaces are still UP, the domain 1027.348 - * will automatically take the interfaces DOWN. 1027.349 - * 1027.350 - * NB. The controller should not send an INTERFACE_STATUS message 1027.351 - * for interfaces that are active when it receives an UP notification. We 1027.352 - * expect that the frontend driver will query those interfaces itself. 1027.353 - */ 1027.354 -#define NETIF_DRIVER_STATUS_DOWN 0 1027.355 -#define NETIF_DRIVER_STATUS_UP 1 1027.356 -typedef struct netif_fe_driver_status { 1027.357 - /* IN */ 1027.358 - u32 status; /* NETIF_DRIVER_STATUS_??? */ 1027.359 - /* OUT */ 1027.360 - /* Driver should query interfaces [0..max_handle]. */ 1027.361 - u32 max_handle; 1027.362 -} netif_fe_driver_status_t; 1027.363 - 1027.364 -/* 1027.365 - * CMSG_NETIF_FE_INTERFACE_CONNECT: 1027.366 - * If successful, the domain controller will acknowledge with a 1027.367 - * STATUS_CONNECTED message. 1027.368 - */ 1027.369 -typedef struct netif_fe_interface_connect { 1027.370 - u32 handle; 1027.371 - unsigned long tx_shmem_frame; 1027.372 - int tx_shmem_ref; 1027.373 - unsigned long rx_shmem_frame; 1027.374 - int rx_shmem_ref; 1027.375 -} netif_fe_interface_connect_t; 1027.376 - 1027.377 -/* 1027.378 - * CMSG_NETIF_FE_INTERFACE_DISCONNECT: 1027.379 - * If successful, the domain controller will acknowledge with a 1027.380 - * STATUS_DISCONNECTED message. 1027.381 - */ 1027.382 -typedef struct netif_fe_interface_disconnect { 1027.383 - u32 handle; 1027.384 -} netif_fe_interface_disconnect_t; 1027.385 - 1027.386 -/* 1027.387 - * CMSG_NETIF_FE_INTERFACE_QUERY: 1027.388 - */ 1027.389 -typedef struct netif_fe_interface_query { 1027.390 - /* IN */ 1027.391 - u32 handle; 1027.392 - /* OUT */ 1027.393 - u32 status; 1027.394 - u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 1027.395 - u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 1027.396 - domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */ 1027.397 -} netif_fe_interface_query_t; 1027.398 - 1027.399 - 1027.400 -/****************************************************************************** 1027.401 - * NETWORK-INTERFACE BACKEND DEFINITIONS 1027.402 - */ 1027.403 - 1027.404 -/* Messages from domain controller. */ 1027.405 -#define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */ 1027.406 -#define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */ 1027.407 -#define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */ 1027.408 -#define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */ 1027.409 -#define CMSG_NETIF_BE_CREDITLIMIT 4 /* Limit i/f to a given credit limit. */ 1027.410 - 1027.411 -/* Messages to domain controller. */ 1027.412 -#define CMSG_NETIF_BE_DRIVER_STATUS 32 1027.413 - 1027.414 -/* 1027.415 - * Message request/response definitions for net-device messages. 1027.416 - */ 1027.417 - 1027.418 -/* Non-specific 'okay' return. */ 1027.419 -#define NETIF_BE_STATUS_OKAY 0 1027.420 -/* Non-specific 'error' return. */ 1027.421 -#define NETIF_BE_STATUS_ERROR 1 1027.422 -/* The following are specific error returns. */ 1027.423 -#define NETIF_BE_STATUS_INTERFACE_EXISTS 2 1027.424 -#define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3 1027.425 -#define NETIF_BE_STATUS_INTERFACE_CONNECTED 4 1027.426 -#define NETIF_BE_STATUS_OUT_OF_MEMORY 5 1027.427 -#define NETIF_BE_STATUS_MAPPING_ERROR 6 1027.428 - 1027.429 -/* This macro can be used to create an array of descriptive error strings. */ 1027.430 -#define NETIF_BE_STATUS_ERRORS { \ 1027.431 - "Okay", \ 1027.432 - "Non-specific error", \ 1027.433 - "Interface already exists", \ 1027.434 - "Interface not found", \ 1027.435 - "Interface is still connected", \ 1027.436 - "Out of memory", \ 1027.437 - "Could not map domain memory" } 1027.438 - 1027.439 -/* 1027.440 - * CMSG_NETIF_BE_CREATE: 1027.441 - * When the driver sends a successful response then the interface is fully 1027.442 - * created. The controller will send a DOWN notification to the front-end 1027.443 - * driver. 1027.444 - */ 1027.445 -typedef struct netif_be_create { 1027.446 - /* IN */ 1027.447 - domid_t domid; /* Domain attached to new interface. */ 1027.448 - u32 netif_handle; /* Domain-specific interface handle. */ 1027.449 - u8 mac[6]; 1027.450 - u8 be_mac[6]; 1027.451 - /* OUT */ 1027.452 - u32 status; 1027.453 -} netif_be_create_t; 1027.454 - 1027.455 -/* 1027.456 - * CMSG_NETIF_BE_DESTROY: 1027.457 - * When the driver sends a successful response then the interface is fully 1027.458 - * torn down. The controller will send a DESTROYED notification to the 1027.459 - * front-end driver. 1027.460 - */ 1027.461 -typedef struct netif_be_destroy { 1027.462 - /* IN */ 1027.463 - domid_t domid; /* Identify interface to be destroyed. */ 1027.464 - u32 netif_handle; /* ...ditto... */ 1027.465 - /* OUT */ 1027.466 - u32 status; 1027.467 -} netif_be_destroy_t; 1027.468 - 1027.469 -/* 1027.470 - * CMSG_NETIF_BE_CREDITLIMIT: 1027.471 - * Limit a virtual interface to "credit_bytes" bytes per "period_usec" 1027.472 - * microseconds. 1027.473 - */ 1027.474 -typedef struct netif_be_creditlimit { 1027.475 - /* IN */ 1027.476 - domid_t domid; /* Domain attached to new interface. */ 1027.477 - u32 netif_handle; /* Domain-specific interface handle. */ 1027.478 - u32 credit_bytes; /* Vifs credit of bytes per period. */ 1027.479 - u32 period_usec; /* Credit replenishment period. */ 1027.480 - /* OUT */ 1027.481 - u32 status; 1027.482 -} netif_be_creditlimit_t; 1027.483 - 1027.484 -/* 1027.485 - * CMSG_NETIF_BE_CONNECT: 1027.486 - * When the driver sends a successful response then the interface is fully 1027.487 - * connected. The controller will send a CONNECTED notification to the 1027.488 - * front-end driver. 1027.489 - */ 1027.490 -typedef struct netif_be_connect { 1027.491 - /* IN */ 1027.492 - domid_t domid; /* Domain attached to new interface. */ 1027.493 - u32 netif_handle; /* Domain-specific interface handle. */ 1027.494 - unsigned long tx_shmem_frame;/* Page cont. tx shared comms window. */ 1027.495 - int tx_shmem_ref; /* Grant reference for above */ 1027.496 - unsigned long rx_shmem_frame;/* Page cont. rx shared comms window. */ 1027.497 - int rx_shmem_ref; /* Grant reference for above */ 1027.498 - u16 evtchn; /* Event channel for notifications. */ 1027.499 - /* OUT */ 1027.500 - u32 status; 1027.501 -} netif_be_connect_t; 1027.502 - 1027.503 -/* 1027.504 - * CMSG_NETIF_BE_DISCONNECT: 1027.505 - * When the driver sends a successful response then the interface is fully 1027.506 - * disconnected. The controller will send a DOWN notification to the front-end 1027.507 - * driver. 1027.508 - */ 1027.509 -typedef struct netif_be_disconnect { 1027.510 - /* IN */ 1027.511 - domid_t domid; /* Domain attached to new interface. */ 1027.512 - u32 netif_handle; /* Domain-specific interface handle. */ 1027.513 - /* OUT */ 1027.514 - u32 status; 1027.515 -} netif_be_disconnect_t; 1027.516 - 1027.517 -/* 1027.518 - * CMSG_NETIF_BE_DRIVER_STATUS: 1027.519 - * Notify the domain controller that the back-end driver is DOWN or UP. 1027.520 - * If the driver goes DOWN while interfaces are still UP, the domain 1027.521 - * will automatically send DOWN notifications. 1027.522 - */ 1027.523 -typedef struct netif_be_driver_status { 1027.524 - u32 status; /* NETIF_DRIVER_STATUS_??? */ 1027.525 -} netif_be_driver_status_t; 1027.526 - 1027.527 - 1027.528 - 1027.529 -/****************************************************************************** 1027.530 - * USB-INTERFACE FRONTEND DEFINITIONS 1027.531 - */ 1027.532 - 1027.533 -/* Messages from domain controller to guest. */ 1027.534 -#define CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED 0 1027.535 - 1027.536 -/* Messages from guest to domain controller. */ 1027.537 -#define CMSG_USBIF_FE_DRIVER_STATUS_CHANGED 32 1027.538 -#define CMSG_USBIF_FE_INTERFACE_CONNECT 33 1027.539 -#define CMSG_USBIF_FE_INTERFACE_DISCONNECT 34 1027.540 -/* 1027.541 - * CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED: 1027.542 - * Notify a guest about a status change on one of its block interfaces. 1027.543 - * If the interface is DESTROYED or DOWN then the interface is disconnected: 1027.544 - * 1. The shared-memory frame is available for reuse. 1027.545 - * 2. Any unacknowledged messages pending on the interface were dropped. 1027.546 - */ 1027.547 -#define USBIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */ 1027.548 -#define USBIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ 1027.549 -#define USBIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */ 1027.550 -typedef struct usbif_fe_interface_status_changed { 1027.551 - u32 status; 1027.552 - u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ 1027.553 - domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */ 1027.554 - u32 bandwidth; 1027.555 - u32 num_ports; 1027.556 -} usbif_fe_interface_status_changed_t; 1027.557 - 1027.558 -/* 1027.559 - * CMSG_USBIF_FE_DRIVER_STATUS_CHANGED: 1027.560 - * Notify the domain controller that the front-end driver is DOWN or UP. 1027.561 - * When the driver goes DOWN then the controller will send no more 1027.562 - * status-change notifications. 1027.563 - * If the driver goes DOWN while interfaces are still UP, the domain 1027.564 - * will automatically take the interfaces DOWN. 1027.565 - * 1027.566 - * NB. The controller should not send an INTERFACE_STATUS_CHANGED message 1027.567 - * for interfaces that are active when it receives an UP notification. We 1027.568 - * expect that the frontend driver will query those interfaces itself. 1027.569 - */ 1027.570 -#define USBIF_DRIVER_STATUS_DOWN 0 1027.571 -#define USBIF_DRIVER_STATUS_UP 1 1027.572 -typedef struct usbif_fe_driver_status_changed { 1027.573 - /* IN */ 1027.574 - u32 status; /* USBIF_DRIVER_STATUS_??? */ 1027.575 -} usbif_fe_driver_status_changed_t; 1027.576 - 1027.577 -/* 1027.578 - * CMSG_USBIF_FE_INTERFACE_CONNECT: 1027.579 - * If successful, the domain controller will acknowledge with a 1027.580 - * STATUS_CONNECTED message. 1027.581 - */ 1027.582 -typedef struct usbif_fe_interface_connect { 1027.583 - unsigned long shmem_frame; 1027.584 -} usbif_fe_interface_connect_t; 1027.585 - 1027.586 -/* 1027.587 - * CMSG_USBIF_FE_INTERFACE_DISCONNECT: 1027.588 - * If successful, the domain controller will acknowledge with a 1027.589 - * STATUS_DISCONNECTED message. 1027.590 - */ 1027.591 -typedef struct usbif_fe_interface_disconnect { 1027.592 - int dummy; /* make struct non-empty */ 1027.593 -} usbif_fe_interface_disconnect_t; 1027.594 - 1027.595 - 1027.596 -/****************************************************************************** 1027.597 - * USB-INTERFACE BACKEND DEFINITIONS 1027.598 - */ 1027.599 - 1027.600 -/* Messages from domain controller. */ 1027.601 -#define CMSG_USBIF_BE_CREATE 0 /* Create a new block-device interface. */ 1027.602 -#define CMSG_USBIF_BE_DESTROY 1 /* Destroy a block-device interface. */ 1027.603 -#define CMSG_USBIF_BE_CONNECT 2 /* Connect i/f to remote driver. */ 1027.604 -#define CMSG_USBIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */ 1027.605 -#define CMSG_USBIF_BE_CLAIM_PORT 4 /* Claim host port for a domain. */ 1027.606 -#define CMSG_USBIF_BE_RELEASE_PORT 5 /* Release host port. */ 1027.607 -/* Messages to domain controller. */ 1027.608 -#define CMSG_USBIF_BE_DRIVER_STATUS_CHANGED 32 1027.609 - 1027.610 -/* Non-specific 'okay' return. */ 1027.611 -#define USBIF_BE_STATUS_OKAY 0 1027.612 -/* Non-specific 'error' return. */ 1027.613 -#define USBIF_BE_STATUS_ERROR 1 1027.614 -/* The following are specific error returns. */ 1027.615 -#define USBIF_BE_STATUS_INTERFACE_EXISTS 2 1027.616 -#define USBIF_BE_STATUS_INTERFACE_NOT_FOUND 3 1027.617 -#define USBIF_BE_STATUS_INTERFACE_CONNECTED 4 1027.618 -#define USBIF_BE_STATUS_OUT_OF_MEMORY 7 1027.619 -#define USBIF_BE_STATUS_MAPPING_ERROR 9 1027.620 - 1027.621 -/* This macro can be used to create an array of descriptive error strings. */ 1027.622 -#define USBIF_BE_STATUS_ERRORS { \ 1027.623 - "Okay", \ 1027.624 - "Non-specific error", \ 1027.625 - "Interface already exists", \ 1027.626 - "Interface not found", \ 1027.627 - "Interface is still connected", \ 1027.628 - "Out of memory", \ 1027.629 - "Could not map domain memory" } 1027.630 - 1027.631 -/* 1027.632 - * CMSG_USBIF_BE_CREATE: 1027.633 - * When the driver sends a successful response then the interface is fully 1027.634 - * created. The controller will send a DOWN notification to the front-end 1027.635 - * driver. 1027.636 - */ 1027.637 -typedef struct usbif_be_create { 1027.638 - /* IN */ 1027.639 - domid_t domid; /* Domain attached to new interface. */ 1027.640 - /* OUT */ 1027.641 - u32 status; 1027.642 -} usbif_be_create_t; 1027.643 - 1027.644 -/* 1027.645 - * CMSG_USBIF_BE_DESTROY: 1027.646 - * When the driver sends a successful response then the interface is fully 1027.647 - * torn down. The controller will send a DESTROYED notification to the 1027.648 - * front-end driver. 1027.649 - */ 1027.650 -typedef struct usbif_be_destroy { 1027.651 - /* IN */ 1027.652 - domid_t domid; /* Identify interface to be destroyed. */ 1027.653 - /* OUT */ 1027.654 - u32 status; 1027.655 -} usbif_be_destroy_t; 1027.656 - 1027.657 -/* 1027.658 - * CMSG_USBIF_BE_CONNECT: 1027.659 - * When the driver sends a successful response then the interface is fully 1027.660 - * connected. The controller will send a CONNECTED notification to the 1027.661 - * front-end driver. 1027.662 - */ 1027.663 -typedef struct usbif_be_connect { 1027.664 - /* IN */ 1027.665 - domid_t domid; /* Domain attached to new interface. */ 1027.666 - unsigned long shmem_frame;/* Page cont. shared comms window. */ 1027.667 - u32 evtchn; /* Event channel for notifications. */ 1027.668 - u32 bandwidth; /* Bandwidth allocated for isoch / int - us 1027.669 - * per 1ms frame (ie between 0 and 900 or 800 1027.670 - * depending on USB version). */ 1027.671 - /* OUT */ 1027.672 - u32 status; 1027.673 -} usbif_be_connect_t; 1027.674 - 1027.675 -/* 1027.676 - * CMSG_USBIF_BE_DISCONNECT: 1027.677 - * When the driver sends a successful response then the interface is fully 1027.678 - * disconnected. The controller will send a DOWN notification to the front-end 1027.679 - * driver. 1027.680 - */ 1027.681 -typedef struct usbif_be_disconnect { 1027.682 - /* IN */ 1027.683 - domid_t domid; /* Domain attached to new interface. */ 1027.684 - /* OUT */ 1027.685 - u32 status; 1027.686 -} usbif_be_disconnect_t; 1027.687 - 1027.688 -/* 1027.689 - * CMSG_USBIF_BE_DRIVER_STATUS_CHANGED: 1027.690 - * Notify the domain controller that the back-end driver is DOWN or UP. 1027.691 - * If the driver goes DOWN while interfaces are still UP, the controller 1027.692 - * will automatically send DOWN notifications. 1027.693 - */ 1027.694 -typedef struct usbif_be_driver_status_changed { 1027.695 - u32 status; /* USBIF_DRIVER_STATUS_??? */ 1027.696 -} usbif_be_driver_status_changed_t; 1027.697 - 1027.698 -#define USB_PATH_LEN 16 1027.699 - 1027.700 -/* 1027.701 - * CMSG_USBIF_BE_CLAIM_PORT: 1027.702 - * Instruct the backend driver to claim any device plugged into the specified 1027.703 - * host port and to allow the specified domain to control that port. 1027.704 - */ 1027.705 -typedef struct usbif_be_claim_port { 1027.706 - /* IN */ 1027.707 - domid_t domid; /* which domain */ 1027.708 - u32 usbif_port; /* port on the virtual root hub */ 1027.709 - u32 status; /* status of operation */ 1027.710 - char path[USB_PATH_LEN]; /* Currently specified in the Linux style - may need to be 1027.711 - * converted to some OS-independent format at some stage. */ 1027.712 -} usbif_be_claim_port_t; 1027.713 - 1027.714 -/* 1027.715 - * CMSG_USBIF_BE_RELEASE_PORT: 1027.716 - * Instruct the backend driver to release any device plugged into the specified 1027.717 - * host port. 1027.718 - */ 1027.719 -typedef struct usbif_be_release_port { 1027.720 - char path[USB_PATH_LEN]; 1027.721 -} usbif_be_release_port_t; 1027.722 - 1027.723 -/****************************************************************************** 1027.724 - * SHUTDOWN DEFINITIONS 1027.725 - */ 1027.726 - 1027.727 -/* 1027.728 - * Subtypes for shutdown messages. 1027.729 - */ 1027.730 -#define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */ 1027.731 -#define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */ 1027.732 -#define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */ 1027.733 - /* SHUTDOWN_suspend. */ 1027.734 -#define CMSG_SHUTDOWN_SYSRQ 3 1027.735 - 1027.736 -typedef struct shutdown_sysrq { 1027.737 - char key; /* sysrq key */ 1027.738 -} shutdown_sysrq_t; 1027.739 - 1027.740 -/****************************************************************************** 1027.741 - * VCPU HOTPLUG CONTROLS 1027.742 - */ 1027.743 - 1027.744 -/* 1027.745 - * Subtypes for shutdown messages. 1027.746 - */ 1027.747 -#define CMSG_VCPU_HOTPLUG_OFF 0 /* turn vcpu off */ 1027.748 -#define CMSG_VCPU_HOTPLUG_ON 1 /* turn vcpu on */ 1027.749 - 1027.750 -/* 1027.751 - * CMSG_VCPU_HOTPLUG: 1027.752 - * Indicate which vcpu's state should change 1027.753 - */ 1027.754 -typedef struct vcpu_hotplug { 1027.755 - u32 vcpu; /* VCPU's whose state will change */ 1027.756 - u32 status; /* Return code indicates success or failure. */ 1027.757 -} vcpu_hotplug_t; 1027.758 - 1027.759 -/****************************************************************************** 1027.760 - * MEMORY CONTROLS 1027.761 - */ 1027.762 - 1027.763 -#define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */ 1027.764 - 1027.765 -/* 1027.766 - * CMSG_MEM_REQUEST: 1027.767 - * Request that the domain change its memory reservation. 1027.768 - */ 1027.769 -typedef struct mem_request { 1027.770 - /* OUT */ 1027.771 - u32 target; /* Target memory reservation in pages. */ 1027.772 - /* IN */ 1027.773 - u32 status; /* Return code indicates success or failure. */ 1027.774 -} mem_request_t; 1027.775 - 1027.776 - 1027.777 -/****************************************************************************** 1027.778 - * PDB INTERFACE DEFINITIONS 1027.779 - */ 1027.780 - 1027.781 -#define CMSG_DEBUG_CONNECTION_STATUS 0 1027.782 -typedef struct pdb_Connection { 1027.783 -#define PDB_CONNECTION_STATUS_UP 1 1027.784 -#define PDB_CONNECTION_STATUS_DOWN 2 1027.785 - u32 status; 1027.786 - unsigned long ring; /* status: UP */ 1027.787 - u32 evtchn; /* status: UP */ 1027.788 -} pdb_connection_t, *pdb_connection_p; 1027.789 - 1027.790 -#endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */
1030.1 --- a/xen/include/public/io/ring.h Wed Sep 14 15:33:52 2005 -0600 1030.2 +++ b/xen/include/public/io/ring.h Wed Sep 14 15:36:10 2005 -0600 1030.3 @@ -87,7 +87,7 @@ struct __name##_back_ring { 1030.4 /* Syntactic sugar */ \ 1030.5 typedef struct __name##_sring __name##_sring_t; \ 1030.6 typedef struct __name##_front_ring __name##_front_ring_t; \ 1030.7 -typedef struct __name##_back_ring __name##_back_ring_t; 1030.8 +typedef struct __name##_back_ring __name##_back_ring_t 1030.9 1030.10 /* 1030.11 * Macros for manipulating rings.
1036.1 --- a/xen/include/public/xen.h Wed Sep 14 15:33:52 2005 -0600 1036.2 +++ b/xen/include/public/xen.h Wed Sep 14 15:36:10 2005 -0600 1036.3 @@ -174,13 +174,13 @@ struct mmuext_op { 1036.4 unsigned long mfn; 1036.5 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ 1036.6 unsigned long linear_addr; 1036.7 - }; 1036.8 + } arg1; 1036.9 union { 1036.10 /* SET_LDT */ 1036.11 unsigned int nr_ents; 1036.12 /* TLB_FLUSH_MULTI, INVLPG_MULTI */ 1036.13 void *vcpumask; 1036.14 - }; 1036.15 + } arg2; 1036.16 }; 1036.17 #endif 1036.18