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$
2.1 --- a/docs/misc/sedf_scheduler_mini-HOWTO.txt Wed Sep 14 15:33:52 2005 -0600 2.2 +++ b/docs/misc/sedf_scheduler_mini-HOWTO.txt Wed Sep 14 15:36:10 2005 -0600 2.3 @@ -10,7 +10,7 @@ Overview: 2.4 Usage: 2.5 -add "sched=sedf" on Xen's boot command-line 2.6 -create domains as usual 2.7 - -use "xm sedf <dom-id> <period> <slice> <latency-hint> <extra> <weight>" 2.8 + -use "xm sched-sedf <dom-id> <period> <slice> <latency-hint> <extra> <weight>" 2.9 Where: 2.10 -period/slice are the normal EDF scheduling parameters in nanosecs 2.11 -latency-hint is the scaled period in case the domain is doing heavy I/O 2.12 @@ -22,23 +22,23 @@ Usage: 2.13 2.14 Examples: 2.15 normal EDF (20ms/5ms): 2.16 - xm sedf <dom-id> 20000000 5000000 0 0 0 2.17 + xm sched-sedf <dom-id> 20000000 5000000 0 0 0 2.18 2.19 best-effort domains (i.e. non-realtime): 2.20 - xm sedf <dom-id> 20000000 0 0 1 0 2.21 + xm sched-sedf <dom-id> 20000000 0 0 1 0 2.22 2.23 normal EDF (20ms/5ms) + share of extra-time: 2.24 - xm sedf <dom-id> 20000000 5000000 0 1 0 2.25 + xm sched-sedf <dom-id> 20000000 5000000 0 1 0 2.26 2.27 4 domains with weights 2:3:4:2 2.28 - xm sedf <d1> 0 0 0 0 2 2.29 - xm sedf <d2> 0 0 0 0 3 2.30 - xm sedf <d3> 0 0 0 0 4 2.31 - xm sedf <d4> 0 0 0 0 2 2.32 + xm sched-sedf <d1> 0 0 0 0 2 2.33 + xm sched-sedf <d2> 0 0 0 0 3 2.34 + xm sched-sedf <d3> 0 0 0 0 4 2.35 + xm sched-sedf <d4> 0 0 0 0 2 2.36 2.37 1 fully-specified (10ms/3ms) domain, 3 other domains share 2.38 available rest in 2:7:3 ratio: 2.39 - xm sedf <d1> 10000000 3000000 0 0 0 2.40 - xm sedf <d2> 0 0 0 0 2 2.41 - xm sedf <d3> 0 0 0 0 7 2.42 - xm sedf <d4> 0 0 0 0 3 2.43 \ No newline at end of file 2.44 + xm sched-sedf <d1> 10000000 3000000 0 0 0 2.45 + xm sched-sedf <d2> 0 0 0 0 2 2.46 + xm sched-sedf <d3> 0 0 0 0 7 2.47 + xm sched-sedf <d4> 0 0 0 0 3
3.1 --- a/extras/mini-os/include/hypervisor.h Wed Sep 14 15:33:52 2005 -0600 3.2 +++ b/extras/mini-os/include/hypervisor.h Wed Sep 14 15:36:10 2005 -0600 3.3 @@ -14,9 +14,6 @@ 3.4 3.5 #include <types.h> 3.6 #include <xen/xen.h> 3.7 -#include <xen/io/domain_controller.h> 3.8 - 3.9 - 3.10 3.11 /* 3.12 * a placeholder for the start of day information passed up from the hypervisor
4.1 --- a/extras/mini-os/mm.c Wed Sep 14 15:33:52 2005 -0600 4.2 +++ b/extras/mini-os/mm.c Wed Sep 14 15:36:10 2005 -0600 4.3 @@ -432,7 +432,7 @@ void build_pagetable(unsigned long *star 4.4 4.5 /* Pin the page to provide correct protection */ 4.6 pin_request.cmd = MMUEXT_PIN_L1_TABLE; 4.7 - pin_request.mfn = pfn_to_mfn(pt_frame); 4.8 + pin_request.arg1.mfn = pfn_to_mfn(pt_frame); 4.9 if(HYPERVISOR_mmuext_op(&pin_request, 1, NULL, DOMID_SELF) < 0) 4.10 { 4.11 printk("ERROR: pinning failed\n");
5.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c Wed Sep 14 15:33:52 2005 -0600 5.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c Wed Sep 14 15:36:10 2005 -0600 5.3 @@ -15,7 +15,7 @@ 5.4 #include <asm/apic.h> 5.5 #include <mach_apic.h> 5.6 #endif 5.7 -#include <asm-xen/hypervisor.h> 5.8 +#include <asm/hypervisor.h> 5.9 5.10 #include "cpu.h" 5.11
6.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Wed Sep 14 15:33:52 2005 -0600 6.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Wed Sep 14 15:36:10 2005 -0600 6.3 @@ -53,7 +53,7 @@ 6.4 #include <asm/io_apic.h> 6.5 #include <asm/ist.h> 6.6 #include <asm/io.h> 6.7 -#include <asm-xen/hypervisor.h> 6.8 +#include <asm/hypervisor.h> 6.9 #include <asm-xen/xen-public/physdev.h> 6.10 #include <asm-xen/xen-public/memory.h> 6.11 #include "setup_arch_pre.h"
7.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c Wed Sep 14 15:33:52 2005 -0600 7.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c Wed Sep 14 15:36:10 2005 -0600 7.3 @@ -33,7 +33,7 @@ 7.4 #include <linux/vmalloc.h> 7.5 #include <asm/page.h> 7.6 #include <asm/pgtable.h> 7.7 -#include <asm-xen/hypervisor.h> 7.8 +#include <asm/hypervisor.h> 7.9 #include <asm-xen/balloon.h> 7.10 #include <asm-xen/xen-public/memory.h> 7.11 #include <linux/module.h> 7.12 @@ -115,7 +115,7 @@ void xen_pt_switch(unsigned long ptr) 7.13 { 7.14 struct mmuext_op op; 7.15 op.cmd = MMUEXT_NEW_BASEPTR; 7.16 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.17 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.18 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.19 } 7.20 7.21 @@ -123,7 +123,7 @@ void xen_new_user_pt(unsigned long ptr) 7.22 { 7.23 struct mmuext_op op; 7.24 op.cmd = MMUEXT_NEW_USER_BASEPTR; 7.25 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.26 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.27 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.28 } 7.29 7.30 @@ -138,7 +138,7 @@ void xen_invlpg(unsigned long ptr) 7.31 { 7.32 struct mmuext_op op; 7.33 op.cmd = MMUEXT_INVLPG_LOCAL; 7.34 - op.linear_addr = ptr & PAGE_MASK; 7.35 + op.arg1.linear_addr = ptr & PAGE_MASK; 7.36 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.37 } 7.38 7.39 @@ -157,7 +157,7 @@ void xen_tlb_flush_mask(cpumask_t *mask) 7.40 if ( cpus_empty(*mask) ) 7.41 return; 7.42 op.cmd = MMUEXT_TLB_FLUSH_MULTI; 7.43 - op.vcpumask = mask->bits; 7.44 + op.arg2.vcpumask = mask->bits; 7.45 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.46 } 7.47 7.48 @@ -165,7 +165,7 @@ void xen_invlpg_all(unsigned long ptr) 7.49 { 7.50 struct mmuext_op op; 7.51 op.cmd = MMUEXT_INVLPG_ALL; 7.52 - op.linear_addr = ptr & PAGE_MASK; 7.53 + op.arg1.linear_addr = ptr & PAGE_MASK; 7.54 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.55 } 7.56 7.57 @@ -175,8 +175,8 @@ void xen_invlpg_mask(cpumask_t *mask, un 7.58 if ( cpus_empty(*mask) ) 7.59 return; 7.60 op.cmd = MMUEXT_INVLPG_MULTI; 7.61 - op.vcpumask = mask->bits; 7.62 - op.linear_addr = ptr & PAGE_MASK; 7.63 + op.arg1.linear_addr = ptr & PAGE_MASK; 7.64 + op.arg2.vcpumask = mask->bits; 7.65 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.66 } 7.67 7.68 @@ -193,7 +193,7 @@ void xen_pgd_pin(unsigned long ptr) 7.69 #else 7.70 op.cmd = MMUEXT_PIN_L2_TABLE; 7.71 #endif 7.72 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.73 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.74 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.75 } 7.76 7.77 @@ -201,7 +201,7 @@ void xen_pgd_unpin(unsigned long ptr) 7.78 { 7.79 struct mmuext_op op; 7.80 op.cmd = MMUEXT_UNPIN_TABLE; 7.81 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.82 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.83 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.84 } 7.85 7.86 @@ -209,7 +209,7 @@ void xen_pte_pin(unsigned long ptr) 7.87 { 7.88 struct mmuext_op op; 7.89 op.cmd = MMUEXT_PIN_L1_TABLE; 7.90 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.91 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.92 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.93 } 7.94 7.95 @@ -217,7 +217,7 @@ void xen_pte_unpin(unsigned long ptr) 7.96 { 7.97 struct mmuext_op op; 7.98 op.cmd = MMUEXT_UNPIN_TABLE; 7.99 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.100 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.101 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.102 } 7.103 7.104 @@ -226,7 +226,7 @@ void xen_pud_pin(unsigned long ptr) 7.105 { 7.106 struct mmuext_op op; 7.107 op.cmd = MMUEXT_PIN_L3_TABLE; 7.108 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.109 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.110 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.111 } 7.112 7.113 @@ -234,7 +234,7 @@ void xen_pud_unpin(unsigned long ptr) 7.114 { 7.115 struct mmuext_op op; 7.116 op.cmd = MMUEXT_UNPIN_TABLE; 7.117 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.118 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.119 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.120 } 7.121 7.122 @@ -242,7 +242,7 @@ void xen_pmd_pin(unsigned long ptr) 7.123 { 7.124 struct mmuext_op op; 7.125 op.cmd = MMUEXT_PIN_L2_TABLE; 7.126 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.127 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.128 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.129 } 7.130 7.131 @@ -250,7 +250,7 @@ void xen_pmd_unpin(unsigned long ptr) 7.132 { 7.133 struct mmuext_op op; 7.134 op.cmd = MMUEXT_UNPIN_TABLE; 7.135 - op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.136 + op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); 7.137 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.138 } 7.139 #endif /* CONFIG_X86_64 */ 7.140 @@ -260,8 +260,8 @@ void xen_set_ldt(unsigned long ptr, unsi 7.141 { 7.142 struct mmuext_op op; 7.143 op.cmd = MMUEXT_SET_LDT; 7.144 - op.linear_addr = ptr; 7.145 - op.nr_ents = len; 7.146 + op.arg1.linear_addr = ptr; 7.147 + op.arg2.nr_ents = len; 7.148 BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); 7.149 } 7.150
8.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c Wed Sep 14 15:33:52 2005 -0600 8.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c Wed Sep 14 15:36:10 2005 -0600 8.3 @@ -39,7 +39,7 @@ 8.4 #include <asm/tlb.h> 8.5 #include <asm/tlbflush.h> 8.6 #include <asm/sections.h> 8.7 -#include <asm-xen/hypervisor.h> 8.8 +#include <asm/hypervisor.h> 8.9 8.10 extern unsigned long *contiguous_bitmap; 8.11
9.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c Wed Sep 14 15:33:52 2005 -0600 9.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c Wed Sep 14 15:36:10 2005 -0600 9.3 @@ -25,7 +25,7 @@ 9.4 #include <asm/mmu_context.h> 9.5 9.6 #include <asm-xen/foreign_page.h> 9.7 -#include <asm-xen/hypervisor.h> 9.8 +#include <asm/hypervisor.h> 9.9 9.10 void show_mem(void) 9.11 {
10.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile Wed Sep 14 15:33:52 2005 -0600 10.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile Wed Sep 14 15:36:10 2005 -0600 10.3 @@ -2,7 +2,7 @@ XENARCH := $(subst ",,$(CONFIG_XENARCH)) 10.4 10.5 CFLAGS += -Iarch/$(XENARCH)/pci 10.6 10.7 -c-obj-y := i386.o 10.8 +obj-y := i386.o 10.9 10.10 #c-obj-$(CONFIG_PCI_BIOS) += pcbios.o 10.11 c-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/pci/i386.c Wed Sep 14 15:36:10 2005 -0600 11.3 @@ -0,0 +1,304 @@ 11.4 +/* 11.5 + * Low-Level PCI Access for i386 machines 11.6 + * 11.7 + * Copyright 1993, 1994 Drew Eckhardt 11.8 + * Visionary Computing 11.9 + * (Unix and Linux consulting and custom programming) 11.10 + * Drew@Colorado.EDU 11.11 + * +1 (303) 786-7975 11.12 + * 11.13 + * Drew's work was sponsored by: 11.14 + * iX Multiuser Multitasking Magazine 11.15 + * Hannover, Germany 11.16 + * hm@ix.de 11.17 + * 11.18 + * Copyright 1997--2000 Martin Mares <mj@ucw.cz> 11.19 + * 11.20 + * For more information, please consult the following manuals (look at 11.21 + * http://www.pcisig.com/ for how to get them): 11.22 + * 11.23 + * PCI BIOS Specification 11.24 + * PCI Local Bus Specification 11.25 + * PCI to PCI Bridge Specification 11.26 + * PCI System Design Guide 11.27 + * 11.28 + */ 11.29 + 11.30 +#include <linux/types.h> 11.31 +#include <linux/kernel.h> 11.32 +#include <linux/pci.h> 11.33 +#include <linux/init.h> 11.34 +#include <linux/ioport.h> 11.35 +#include <linux/errno.h> 11.36 + 11.37 +#include "pci.h" 11.38 + 11.39 +/* 11.40 + * We need to avoid collisions with `mirrored' VGA ports 11.41 + * and other strange ISA hardware, so we always want the 11.42 + * addresses to be allocated in the 0x000-0x0ff region 11.43 + * modulo 0x400. 11.44 + * 11.45 + * Why? Because some silly external IO cards only decode 11.46 + * the low 10 bits of the IO address. The 0x00-0xff region 11.47 + * is reserved for motherboard devices that decode all 16 11.48 + * bits, so it's ok to allocate at, say, 0x2800-0x28ff, 11.49 + * but we want to try to avoid allocating at 0x2900-0x2bff 11.50 + * which might have be mirrored at 0x0100-0x03ff.. 11.51 + */ 11.52 +void 11.53 +pcibios_align_resource(void *data, struct resource *res, 11.54 + unsigned long size, unsigned long align) 11.55 +{ 11.56 + if (res->flags & IORESOURCE_IO) { 11.57 + unsigned long start = res->start; 11.58 + 11.59 + if (start & 0x300) { 11.60 + start = (start + 0x3ff) & ~0x3ff; 11.61 + res->start = start; 11.62 + } 11.63 + } 11.64 +} 11.65 + 11.66 + 11.67 +/* 11.68 + * Handle resources of PCI devices. If the world were perfect, we could 11.69 + * just allocate all the resource regions and do nothing more. It isn't. 11.70 + * On the other hand, we cannot just re-allocate all devices, as it would 11.71 + * require us to know lots of host bridge internals. So we attempt to 11.72 + * keep as much of the original configuration as possible, but tweak it 11.73 + * when it's found to be wrong. 11.74 + * 11.75 + * Known BIOS problems we have to work around: 11.76 + * - I/O or memory regions not configured 11.77 + * - regions configured, but not enabled in the command register 11.78 + * - bogus I/O addresses above 64K used 11.79 + * - expansion ROMs left enabled (this may sound harmless, but given 11.80 + * the fact the PCI specs explicitly allow address decoders to be 11.81 + * shared between expansion ROMs and other resource regions, it's 11.82 + * at least dangerous) 11.83 + * 11.84 + * Our solution: 11.85 + * (1) Allocate resources for all buses behind PCI-to-PCI bridges. 11.86 + * This gives us fixed barriers on where we can allocate. 11.87 + * (2) Allocate resources for all enabled devices. If there is 11.88 + * a collision, just mark the resource as unallocated. Also 11.89 + * disable expansion ROMs during this step. 11.90 + * (3) Try to allocate resources for disabled devices. If the 11.91 + * resources were assigned correctly, everything goes well, 11.92 + * if they weren't, they won't disturb allocation of other 11.93 + * resources. 11.94 + * (4) Assign new addresses to resources which were either 11.95 + * not configured at all or misconfigured. If explicitly 11.96 + * requested by the user, configure expansion ROM address 11.97 + * as well. 11.98 + */ 11.99 + 11.100 +static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) 11.101 +{ 11.102 + struct pci_bus *bus; 11.103 + struct pci_dev *dev; 11.104 + int idx; 11.105 + struct resource *r, *pr; 11.106 + 11.107 + /* Depth-First Search on bus tree */ 11.108 + list_for_each_entry(bus, bus_list, node) { 11.109 + if ((dev = bus->self)) { 11.110 + for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { 11.111 + r = &dev->resource[idx]; 11.112 + if (!r->start) 11.113 + continue; 11.114 + pr = pci_find_parent_resource(dev, r); 11.115 + if (!pr || request_resource(pr, r) < 0) 11.116 + printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); 11.117 + } 11.118 + } 11.119 + pcibios_allocate_bus_resources(&bus->children); 11.120 + } 11.121 +} 11.122 + 11.123 +static void __init pcibios_allocate_resources(int pass) 11.124 +{ 11.125 + struct pci_dev *dev = NULL; 11.126 + int idx, disabled; 11.127 + u16 command; 11.128 + struct resource *r, *pr; 11.129 + 11.130 + for_each_pci_dev(dev) { 11.131 + pci_read_config_word(dev, PCI_COMMAND, &command); 11.132 + for(idx = 0; idx < 6; idx++) { 11.133 + r = &dev->resource[idx]; 11.134 + if (r->parent) /* Already allocated */ 11.135 + continue; 11.136 + if (!r->start) /* Address not assigned at all */ 11.137 + continue; 11.138 + if (r->flags & IORESOURCE_IO) 11.139 + disabled = !(command & PCI_COMMAND_IO); 11.140 + else 11.141 + disabled = !(command & PCI_COMMAND_MEMORY); 11.142 + if (pass == disabled) { 11.143 + DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", 11.144 + r->start, r->end, r->flags, disabled, pass); 11.145 + pr = pci_find_parent_resource(dev, r); 11.146 + if (!pr || request_resource(pr, r) < 0) { 11.147 + printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, pci_name(dev)); 11.148 + /* We'll assign a new address later */ 11.149 + r->end -= r->start; 11.150 + r->start = 0; 11.151 + } 11.152 + } 11.153 + } 11.154 + if (!pass) { 11.155 + r = &dev->resource[PCI_ROM_RESOURCE]; 11.156 + if (r->flags & IORESOURCE_ROM_ENABLE) { 11.157 + /* Turn the ROM off, leave the resource region, but keep it unregistered. */ 11.158 + u32 reg; 11.159 + DBG("PCI: Switching off ROM of %s\n", pci_name(dev)); 11.160 + r->flags &= ~IORESOURCE_ROM_ENABLE; 11.161 + pci_read_config_dword(dev, dev->rom_base_reg, ®); 11.162 + pci_write_config_dword(dev, dev->rom_base_reg, reg & ~PCI_ROM_ADDRESS_ENABLE); 11.163 + } 11.164 + } 11.165 + } 11.166 +} 11.167 + 11.168 +static int __init pcibios_assign_resources(void) 11.169 +{ 11.170 + struct pci_dev *dev = NULL; 11.171 + int idx; 11.172 + struct resource *r; 11.173 + 11.174 + for_each_pci_dev(dev) { 11.175 + int class = dev->class >> 8; 11.176 + 11.177 + /* Don't touch classless devices and host bridges */ 11.178 + if (!class || class == PCI_CLASS_BRIDGE_HOST) 11.179 + continue; 11.180 + 11.181 + for(idx=0; idx<6; idx++) { 11.182 + r = &dev->resource[idx]; 11.183 + 11.184 + /* 11.185 + * Don't touch IDE controllers and I/O ports of video cards! 11.186 + */ 11.187 + if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) || 11.188 + (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO))) 11.189 + continue; 11.190 + 11.191 + /* 11.192 + * We shall assign a new address to this resource, either because 11.193 + * the BIOS forgot to do so or because we have decided the old 11.194 + * address was unusable for some reason. 11.195 + */ 11.196 + if (!r->start && r->end) 11.197 + pci_assign_resource(dev, idx); 11.198 + } 11.199 + 11.200 + if (pci_probe & PCI_ASSIGN_ROMS) { 11.201 + r = &dev->resource[PCI_ROM_RESOURCE]; 11.202 + r->end -= r->start; 11.203 + r->start = 0; 11.204 + if (r->end) 11.205 + pci_assign_resource(dev, PCI_ROM_RESOURCE); 11.206 + } 11.207 + } 11.208 + return 0; 11.209 +} 11.210 + 11.211 +void __init pcibios_resource_survey(void) 11.212 +{ 11.213 + DBG("PCI: Allocating resources\n"); 11.214 + pcibios_allocate_bus_resources(&pci_root_buses); 11.215 + pcibios_allocate_resources(0); 11.216 + pcibios_allocate_resources(1); 11.217 +} 11.218 + 11.219 +/** 11.220 + * called in fs_initcall (one below subsys_initcall), 11.221 + * give a chance for motherboard reserve resources 11.222 + */ 11.223 +fs_initcall(pcibios_assign_resources); 11.224 + 11.225 +int pcibios_enable_resources(struct pci_dev *dev, int mask) 11.226 +{ 11.227 + u16 cmd, old_cmd; 11.228 + int idx; 11.229 + struct resource *r; 11.230 + 11.231 + pci_read_config_word(dev, PCI_COMMAND, &cmd); 11.232 + old_cmd = cmd; 11.233 + for(idx=0; idx<6; idx++) { 11.234 + /* Only set up the requested stuff */ 11.235 + if (!(mask & (1<<idx))) 11.236 + continue; 11.237 + 11.238 + r = &dev->resource[idx]; 11.239 + if (!r->start && r->end) { 11.240 + printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); 11.241 + return -EINVAL; 11.242 + } 11.243 + if (r->flags & IORESOURCE_IO) 11.244 + cmd |= PCI_COMMAND_IO; 11.245 + if (r->flags & IORESOURCE_MEM) 11.246 + cmd |= PCI_COMMAND_MEMORY; 11.247 + } 11.248 + if (dev->resource[PCI_ROM_RESOURCE].start) 11.249 + cmd |= PCI_COMMAND_MEMORY; 11.250 + if (cmd != old_cmd) { 11.251 + printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); 11.252 + pci_write_config_word(dev, PCI_COMMAND, cmd); 11.253 + } 11.254 + return 0; 11.255 +} 11.256 + 11.257 +/* 11.258 + * If we set up a device for bus mastering, we need to check the latency 11.259 + * timer as certain crappy BIOSes forget to set it properly. 11.260 + */ 11.261 +unsigned int pcibios_max_latency = 255; 11.262 + 11.263 +void pcibios_set_master(struct pci_dev *dev) 11.264 +{ 11.265 + u8 lat; 11.266 + pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); 11.267 + if (lat < 16) 11.268 + lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency; 11.269 + else if (lat > pcibios_max_latency) 11.270 + lat = pcibios_max_latency; 11.271 + else 11.272 + return; 11.273 + printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat); 11.274 + pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 11.275 +} 11.276 + 11.277 +int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 11.278 + enum pci_mmap_state mmap_state, int write_combine) 11.279 +{ 11.280 + unsigned long prot; 11.281 + 11.282 + /* I/O space cannot be accessed via normal processor loads and 11.283 + * stores on this platform. 11.284 + */ 11.285 + if (mmap_state == pci_mmap_io) 11.286 + return -EINVAL; 11.287 + 11.288 + /* Leave vm_pgoff as-is, the PCI space address is the physical 11.289 + * address on this platform. 11.290 + */ 11.291 + vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO); 11.292 + 11.293 + prot = pgprot_val(vma->vm_page_prot); 11.294 + if (boot_cpu_data.x86 > 3) 11.295 + prot |= _PAGE_PCD | _PAGE_PWT; 11.296 + vma->vm_page_prot = __pgprot(prot); 11.297 + 11.298 + /* Write-combine setting is ignored, it is changed via the mtrr 11.299 + * interfaces on this platform. 11.300 + */ 11.301 + if (direct_remap_pfn_range(vma->vm_mm, vma->vm_start, vma->vm_pgoff, 11.302 + vma->vm_end - vma->vm_start, 11.303 + vma->vm_page_prot, DOMID_IO)) 11.304 + return -EAGAIN; 11.305 + 11.306 + return 0; 11.307 +}
12.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Wed Sep 14 15:33:52 2005 -0600 12.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Wed Sep 14 15:36:10 2005 -0600 12.3 @@ -27,7 +27,7 @@ 12.4 #include <asm/uaccess.h> 12.5 #include <asm/io.h> 12.6 12.7 -static inline int uncached_access(struct file *file, unsigned long addr) 12.8 +static inline int uncached_access(struct file *file) 12.9 { 12.10 if (file->f_flags & O_SYNC) 12.11 return 1; 12.12 @@ -90,10 +90,9 @@ out: 12.13 12.14 static int mmap_mem(struct file * file, struct vm_area_struct * vma) 12.15 { 12.16 - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 12.17 int uncached; 12.18 12.19 - uncached = uncached_access(file, offset); 12.20 + uncached = uncached_access(file); 12.21 if (uncached) 12.22 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 12.23 12.24 @@ -106,8 +105,9 @@ static int mmap_mem(struct file * file, 12.25 if (uncached) 12.26 vma->vm_flags |= VM_IO; 12.27 12.28 - if (io_remap_page_range(vma, vma->vm_start, offset, 12.29 - vma->vm_end-vma->vm_start, vma->vm_page_prot)) 12.30 + if (direct_remap_pfn_range(vma->vm_mm, vma->vm_start, vma->vm_pgoff, 12.31 + vma->vm_end - vma->vm_start, 12.32 + vma->vm_page_prot, DOMID_IO)) 12.33 return -EAGAIN; 12.34 12.35 return 0;
13.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Sep 14 15:33:52 2005 -0600 13.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Sep 14 15:36:10 2005 -0600 13.3 @@ -40,7 +40,7 @@ 13.4 #include <asm/synch_bitops.h> 13.5 #include <asm-xen/xen-public/event_channel.h> 13.6 #include <asm-xen/xen-public/physdev.h> 13.7 -#include <asm-xen/hypervisor.h> 13.8 +#include <asm/hypervisor.h> 13.9 #include <asm-xen/evtchn.h> 13.10 13.11 /*
14.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Wed Sep 14 15:33:52 2005 -0600 14.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Wed Sep 14 15:36:10 2005 -0600 14.3 @@ -10,7 +10,7 @@ 14.4 #include <asm/irq.h> 14.5 #include <asm/mmu_context.h> 14.6 #include <asm-xen/evtchn.h> 14.7 -#include <asm-xen/hypervisor.h> 14.8 +#include <asm/hypervisor.h> 14.9 #include <asm-xen/xen-public/dom0_ops.h> 14.10 #include <asm-xen/queues.h> 14.11 #include <asm-xen/xenbus.h> 14.12 @@ -320,20 +320,28 @@ static void __shutdown_handler(void *unu 14.13 static void shutdown_handler(struct xenbus_watch *watch, const char *node) 14.14 { 14.15 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); 14.16 + char *str; 14.17 + int err; 14.18 14.19 - char *str; 14.20 - 14.21 + again: 14.22 + err = xenbus_transaction_start("control"); 14.23 + if (err) 14.24 + return; 14.25 str = (char *)xenbus_read("control", "shutdown", NULL); 14.26 - /* Ignore read errors. */ 14.27 - if (IS_ERR(str)) 14.28 - return; 14.29 - if (strlen(str) == 0) { 14.30 - kfree(str); 14.31 - return; 14.32 + /* Ignore read errors and empty reads. */ 14.33 + if (XENBUS_IS_ERR_READ(str)) { 14.34 + xenbus_transaction_end(1); 14.35 + return; 14.36 } 14.37 14.38 xenbus_write("control", "shutdown", "", O_CREAT); 14.39 14.40 + err = xenbus_transaction_end(0); 14.41 + if (err == -ETIMEDOUT) { 14.42 + kfree(str); 14.43 + goto again; 14.44 + } 14.45 + 14.46 if (strcmp(str, "poweroff") == 0) 14.47 shutting_down = SHUTDOWN_POWEROFF; 14.48 else if (strcmp(str, "reboot") == 0) 14.49 @@ -355,16 +363,26 @@ static void shutdown_handler(struct xenb 14.50 static void sysrq_handler(struct xenbus_watch *watch, const char *node) 14.51 { 14.52 char sysrq_key = '\0'; 14.53 - 14.54 + int err; 14.55 + 14.56 + again: 14.57 + err = xenbus_transaction_start("control"); 14.58 + if (err) 14.59 + return; 14.60 if (!xenbus_scanf("control", "sysrq", "%c", &sysrq_key)) { 14.61 printk(KERN_ERR "Unable to read sysrq code in control/sysrq\n"); 14.62 - return; 14.63 + xenbus_transaction_end(1); 14.64 + return; 14.65 } 14.66 14.67 - xenbus_printf("control", "sysrq", "%c", '\0'); 14.68 + if (sysrq_key != '\0') 14.69 + xenbus_printf("control", "sysrq", "%c", '\0'); 14.70 + 14.71 + err = xenbus_transaction_end(0); 14.72 + if (err == -ETIMEDOUT) 14.73 + goto again; 14.74 14.75 if (sysrq_key != '\0') { 14.76 - 14.77 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 14.78 handle_sysrq(sysrq_key, NULL, NULL); 14.79 #else
15.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c Wed Sep 14 15:33:52 2005 -0600 15.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c Wed Sep 14 15:36:10 2005 -0600 15.3 @@ -12,7 +12,7 @@ 15.4 #include <linux/init.h> 15.5 #include <asm/io.h> 15.6 #include <asm/page.h> 15.7 -#include <asm-xen/hypervisor.h> 15.8 +#include <asm/hypervisor.h> 15.9 15.10 /* Referenced in netback.c. */ 15.11 /*static*/ kmem_cache_t *skbuff_cachep;
16.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S Wed Sep 14 15:33:52 2005 -0600 16.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S Wed Sep 14 15:36:10 2005 -0600 16.3 @@ -751,10 +751,10 @@ ecrit: /**** END OF CRITICAL REGION *** 16.4 # Hypervisor uses this for application faults while it executes. 16.5 ENTRY(failsafe_callback) 16.6 addq $0x10,%rsp /* skip rcx and r11 */ 16.7 -1: movl (%rsp),%ds 16.8 -2: movl 8(%rsp),%es 16.9 -3: movl 16(%rsp),%fs 16.10 -4: movl 24(%rsp),%gs 16.11 +1: mov (%rsp),%ds 16.12 +2: mov 8(%rsp),%es 16.13 +3: mov 16(%rsp),%fs 16.14 +4: mov 24(%rsp),%gs 16.15 addq $0x20,%rsp /* skip the above selectors */ 16.16 SAVE_ALL 16.17 jmp error_exit
17.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Wed Sep 14 15:33:52 2005 -0600 17.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Wed Sep 14 15:36:10 2005 -0600 17.3 @@ -61,7 +61,7 @@ 17.4 #include <linux/percpu.h> 17.5 #include <asm-xen/xen-public/physdev.h> 17.6 #include "setup_arch_pre.h" 17.7 -#include <asm-xen/hypervisor.h> 17.8 +#include <asm/hypervisor.h> 17.9 #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 17.10 #define PFN_PHYS(x) ((x) << PAGE_SHIFT) 17.11 #define end_pfn_map end_pfn
18.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c Wed Sep 14 15:33:52 2005 -0600 18.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c Wed Sep 14 15:36:10 2005 -0600 18.3 @@ -31,7 +31,7 @@ 18.4 #include <asm/mman.h> 18.5 #include <asm/numa.h> 18.6 #ifdef CONFIG_XEN 18.7 -#include <asm-xen/hypervisor.h> 18.8 +#include <asm/hypervisor.h> 18.9 #endif 18.10 char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 18.11
19.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile Wed Sep 14 15:33:52 2005 -0600 19.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile Wed Sep 14 15:36:10 2005 -0600 19.3 @@ -8,7 +8,7 @@ CFLAGS += -Iarch/$(XENARCH)/pci 19.4 19.5 CFLAGS += -Iarch/i386/pci 19.6 19.7 -c-i386-obj-y := i386.o 19.8 +c-xen-obj-y := i386.o 19.9 c-i386-obj-y += fixup.o 19.10 c-i386-obj-$(CONFIG_ACPI_PCI) += acpi.o 19.11 c-i386-obj-y += legacy.o common.o
20.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Sep 14 15:33:52 2005 -0600 20.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Sep 14 15:36:10 2005 -0600 20.3 @@ -42,7 +42,7 @@ 20.4 #include <linux/highmem.h> 20.5 #include <linux/vmalloc.h> 20.6 #include <asm-xen/xen_proc.h> 20.7 -#include <asm-xen/hypervisor.h> 20.8 +#include <asm/hypervisor.h> 20.9 #include <asm-xen/balloon.h> 20.10 #include <asm-xen/xen-public/memory.h> 20.11 #include <asm/pgalloc.h>
21.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Wed Sep 14 15:33:52 2005 -0600 21.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Wed Sep 14 15:36:10 2005 -0600 21.3 @@ -13,7 +13,7 @@ 21.4 #include <asm/setup.h> 21.5 #include <asm/pgalloc.h> 21.6 #include <asm-xen/evtchn.h> 21.7 -#include <asm-xen/hypervisor.h> 21.8 +#include <asm/hypervisor.h> 21.9 #include <asm-xen/xen-public/io/blkif.h> 21.10 #include <asm-xen/xen-public/io/ring.h> 21.11 #include <asm-xen/gnttab.h> 21.12 @@ -33,7 +33,7 @@ struct vbd { 21.13 blkif_vdev_t handle; /* what the domain refers to this vbd as */ 21.14 unsigned char readonly; /* Non-zero -> read-only */ 21.15 unsigned char type; /* VDISK_xxx */ 21.16 - blkif_pdev_t pdevice; /* phys device that this vbd maps to */ 21.17 + u32 pdevice; /* phys device that this vbd maps to */ 21.18 struct block_device *bdev; 21.19 }; 21.20 21.21 @@ -65,11 +65,6 @@ typedef struct blkif_st { 21.22 grant_ref_t shmem_ref; 21.23 } blkif_t; 21.24 21.25 -void blkif_create(blkif_be_create_t *create); 21.26 -void blkif_destroy(blkif_be_destroy_t *destroy); 21.27 -void blkif_connect(blkif_be_connect_t *connect); 21.28 -int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id); 21.29 -void blkif_disconnect_complete(blkif_t *blkif); 21.30 blkif_t *alloc_blkif(domid_t domid); 21.31 void free_blkif_callback(blkif_t *blkif); 21.32 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn); 21.33 @@ -82,7 +77,7 @@ int blkif_map(blkif_t *blkif, unsigned l 21.34 } while (0) 21.35 21.36 /* Create a vbd. */ 21.37 -int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, blkif_pdev_t pdevice, 21.38 +int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, u32 pdevice, 21.39 int readonly); 21.40 void vbd_free(struct vbd *vbd); 21.41
22.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Wed Sep 14 15:33:52 2005 -0600 22.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Wed Sep 14 15:36:10 2005 -0600 22.3 @@ -9,7 +9,7 @@ 22.4 #include "common.h" 22.5 #include <asm-xen/xenbus.h> 22.6 22.7 -static inline dev_t vbd_map_devnum(blkif_pdev_t cookie) 22.8 +static inline dev_t vbd_map_devnum(u32 cookie) 22.9 { 22.10 return MKDEV(BLKIF_MAJOR(cookie), BLKIF_MINOR(cookie)); 22.11 } 22.12 @@ -33,7 +33,7 @@ unsigned long vbd_secsize(struct vbd *vb 22.13 } 22.14 22.15 int vbd_create(blkif_t *blkif, blkif_vdev_t handle, 22.16 - blkif_pdev_t pdevice, int readonly) 22.17 + u32 pdevice, int readonly) 22.18 { 22.19 struct vbd *vbd; 22.20
23.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Sep 14 15:33:52 2005 -0600 23.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Sep 14 15:36:10 2005 -0600 23.3 @@ -178,6 +178,8 @@ static void backend_changed(struct xenbu 23.4 23.5 err = vbd_create(be->blkif, handle, be->pdev, be->readonly); 23.6 if (err) { 23.7 + blkif_put(be->blkif); 23.8 + be->blkif = NULL; 23.9 xenbus_dev_error(dev, err, "creating vbd structure"); 23.10 return; 23.11 }
24.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Wed Sep 14 15:33:52 2005 -0600 24.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Wed Sep 14 15:36:10 2005 -0600 24.3 @@ -45,7 +45,7 @@ 24.4 #include <linux/blkdev.h> 24.5 #include <linux/major.h> 24.6 #include <linux/devfs_fs_kernel.h> 24.7 -#include <asm-xen/hypervisor.h> 24.8 +#include <asm/hypervisor.h> 24.9 #include <asm-xen/xenbus.h> 24.10 #include <asm-xen/gnttab.h> 24.11 #include <asm-xen/xen-public/xen.h>
25.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h Wed Sep 14 15:33:52 2005 -0600 25.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h Wed Sep 14 15:36:10 2005 -0600 25.3 @@ -20,7 +20,7 @@ 25.4 #include <asm/io.h> 25.5 #include <asm/setup.h> 25.6 #include <asm/pgalloc.h> 25.7 -#include <asm-xen/hypervisor.h> 25.8 +#include <asm/hypervisor.h> 25.9 #include <asm-xen/xen-public/io/blkif.h> 25.10 #include <asm-xen/xen-public/io/ring.h> 25.11
26.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/common.h Wed Sep 14 15:33:52 2005 -0600 26.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/common.h Wed Sep 14 15:36:10 2005 -0600 26.3 @@ -13,7 +13,7 @@ 26.4 #include <asm/setup.h> 26.5 #include <asm/pgalloc.h> 26.6 #include <asm-xen/evtchn.h> 26.7 -#include <asm-xen/hypervisor.h> 26.8 +#include <asm/hypervisor.h> 26.9 #include <asm-xen/xen-public/io/blkif.h> 26.10 #include <asm-xen/xen-public/io/ring.h> 26.11 #include <asm-xen/gnttab.h> 26.12 @@ -35,7 +35,7 @@ struct vbd { 26.13 blkif_vdev_t handle; /* what the domain refers to this vbd as */ 26.14 unsigned char readonly; /* Non-zero -> read-only */ 26.15 unsigned char type; /* VDISK_xxx */ 26.16 - blkif_pdev_t pdevice; /* phys device that this vbd maps to */ 26.17 + u32 pdevice; /* phys device that this vbd maps to */ 26.18 struct block_device *bdev; 26.19 }; 26.20 26.21 @@ -67,11 +67,6 @@ typedef struct blkif_st { 26.22 grant_ref_t shmem_ref; 26.23 } blkif_t; 26.24 26.25 -void blkif_create(blkif_be_create_t *create); 26.26 -void blkif_destroy(blkif_be_destroy_t *destroy); 26.27 -void blkif_connect(blkif_be_connect_t *connect); 26.28 -int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id); 26.29 -void blkif_disconnect_complete(blkif_t *blkif); 26.30 blkif_t *alloc_blkif(domid_t domid); 26.31 void free_blkif_callback(blkif_t *blkif); 26.32 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn); 26.33 @@ -84,7 +79,7 @@ int blkif_map(blkif_t *blkif, unsigned l 26.34 } while (0) 26.35 26.36 /* Create a vbd. */ 26.37 -int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, blkif_pdev_t pdevice, 26.38 +int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, u32 pdevice, 26.39 int readonly); 26.40 void vbd_free(struct vbd *vbd); 26.41
27.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Sep 14 15:33:52 2005 -0600 27.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Sep 14 15:36:10 2005 -0600 27.3 @@ -51,7 +51,7 @@ 27.4 #include <asm/uaccess.h> 27.5 #include <asm-xen/xen-public/xen.h> 27.6 #include <asm-xen/xen-public/event_channel.h> 27.7 -#include <asm-xen/hypervisor.h> 27.8 +#include <asm/hypervisor.h> 27.9 #include <asm-xen/evtchn.h> 27.10 27.11 #include "xencons_ring.h"
28.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Wed Sep 14 15:33:52 2005 -0600 28.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Wed Sep 14 15:36:10 2005 -0600 28.3 @@ -13,7 +13,7 @@ 28.4 #include <linux/mm.h> 28.5 #include <linux/slab.h> 28.6 28.7 -#include <asm-xen/hypervisor.h> 28.8 +#include <asm/hypervisor.h> 28.9 #include <asm-xen/evtchn.h> 28.10 #include <linux/wait.h> 28.11 #include <linux/interrupt.h>
29.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Sep 14 15:33:52 2005 -0600 29.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Sep 14 15:36:10 2005 -0600 29.3 @@ -294,7 +294,7 @@ static void net_rx_action(unsigned long 29.4 mcl++; 29.5 29.6 mmuext->cmd = MMUEXT_REASSIGN_PAGE; 29.7 - mmuext->mfn = old_mfn; 29.8 + mmuext->arg1.mfn = old_mfn; 29.9 mmuext++; 29.10 #endif 29.11 mmu->ptr = ((unsigned long long)new_mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE; 29.12 @@ -355,7 +355,7 @@ static void net_rx_action(unsigned long 29.13 #ifdef CONFIG_XEN_NETDEV_GRANT 29.14 old_mfn = 0; /* XXX Fix this so we can free_mfn() on error! */ 29.15 #else 29.16 - old_mfn = mmuext[0].mfn; 29.17 + old_mfn = mmuext[0].arg1.mfn; 29.18 #endif 29.19 atomic_set(&(skb_shinfo(skb)->dataref), 1); 29.20 skb_shinfo(skb)->nr_frags = 0;
30.1 --- a/linux-2.6-xen-sparse/drivers/xen/usbback/common.h Wed Sep 14 15:33:52 2005 -0600 30.2 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/common.h Wed Sep 14 15:36:10 2005 -0600 30.3 @@ -12,7 +12,7 @@ 30.4 #include <asm/io.h> 30.5 #include <asm/setup.h> 30.6 #include <asm/pgalloc.h> 30.7 -#include <asm-xen/hypervisor.h> 30.8 +#include <asm/hypervisor.h> 30.9 30.10 #include <asm-xen/xen-public/io/usbif.h> 30.11
31.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Sep 14 15:33:52 2005 -0600 31.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Sep 14 15:36:10 2005 -0600 31.3 @@ -27,7 +27,7 @@ 31.4 * IN THE SOFTWARE. 31.5 */ 31.6 31.7 -#include <asm-xen/hypervisor.h> 31.8 +#include <asm/hypervisor.h> 31.9 #include <asm-xen/evtchn.h> 31.10 #include <linux/wait.h> 31.11 #include <linux/interrupt.h>
32.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Sep 14 15:33:52 2005 -0600 32.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Sep 14 15:36:10 2005 -0600 32.3 @@ -27,7 +27,7 @@ 32.4 */ 32.5 #define DEBUG 32.6 32.7 -#include <asm-xen/hypervisor.h> 32.8 +#include <asm/hypervisor.h> 32.9 #include <asm-xen/xenbus.h> 32.10 #include <asm-xen/balloon.h> 32.11 #include <linux/kernel.h>
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h Wed Sep 14 15:36:10 2005 -0600 33.3 @@ -0,0 +1,188 @@ 33.4 +/****************************************************************************** 33.5 + * hypervisor.h 33.6 + * 33.7 + * Linux-specific hypervisor handling. 33.8 + * 33.9 + * Copyright (c) 2002-2004, K A Fraser 33.10 + * 33.11 + * This file may be distributed separately from the Linux kernel, or 33.12 + * incorporated into other software packages, subject to the following license: 33.13 + * 33.14 + * Permission is hereby granted, free of charge, to any person obtaining a copy 33.15 + * of this source file (the "Software"), to deal in the Software without 33.16 + * restriction, including without limitation the rights to use, copy, modify, 33.17 + * merge, publish, distribute, sublicense, and/or sell copies of the Software, 33.18 + * and to permit persons to whom the Software is furnished to do so, subject to 33.19 + * the following conditions: 33.20 + * 33.21 + * The above copyright notice and this permission notice shall be included in 33.22 + * all copies or substantial portions of the Software. 33.23 + * 33.24 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33.25 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33.26 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33.27 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33.28 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33.29 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 33.30 + * IN THE SOFTWARE. 33.31 + */ 33.32 + 33.33 +#ifndef __HYPERVISOR_H__ 33.34 +#define __HYPERVISOR_H__ 33.35 + 33.36 +#include <linux/config.h> 33.37 +#include <linux/types.h> 33.38 +#include <linux/kernel.h> 33.39 +#include <linux/version.h> 33.40 +#include <asm-xen/xen-public/xen.h> 33.41 +#include <asm-xen/xen-public/dom0_ops.h> 33.42 +#include <asm/ptrace.h> 33.43 +#include <asm/page.h> 33.44 +#if defined(__i386__) 33.45 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 33.46 +# ifdef CONFIG_X86_PAE 33.47 +# include <asm-generic/pgtable-nopud.h> 33.48 +# else 33.49 +# include <asm-generic/pgtable-nopmd.h> 33.50 +# endif 33.51 +# else 33.52 +# define pud_t pgd_t 33.53 +# endif 33.54 +#endif 33.55 + 33.56 +/* arch/xen/i386/kernel/setup.c */ 33.57 +extern start_info_t *xen_start_info; 33.58 + 33.59 +/* arch/xen/kernel/evtchn.c */ 33.60 +/* Force a proper event-channel callback from Xen. */ 33.61 +void force_evtchn_callback(void); 33.62 + 33.63 +/* arch/xen/kernel/process.c */ 33.64 +void xen_cpu_idle (void); 33.65 + 33.66 +/* arch/xen/i386/kernel/hypervisor.c */ 33.67 +void do_hypervisor_callback(struct pt_regs *regs); 33.68 + 33.69 +/* arch/xen/i386/kernel/head.S */ 33.70 +void lgdt_finish(void); 33.71 + 33.72 +/* arch/xen/i386/mm/hypervisor.c */ 33.73 +/* 33.74 + * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already 33.75 + * be MACHINE addresses. 33.76 + */ 33.77 + 33.78 +void xen_pt_switch(unsigned long ptr); 33.79 +void xen_new_user_pt(unsigned long ptr); /* x86_64 only */ 33.80 +void xen_load_gs(unsigned int selector); /* x86_64 only */ 33.81 +void xen_tlb_flush(void); 33.82 +void xen_invlpg(unsigned long ptr); 33.83 + 33.84 +#ifndef CONFIG_XEN_SHADOW_MODE 33.85 +void xen_l1_entry_update(pte_t *ptr, pte_t val); 33.86 +void xen_l2_entry_update(pmd_t *ptr, pmd_t val); 33.87 +void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ 33.88 +void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */ 33.89 +void xen_pgd_pin(unsigned long ptr); 33.90 +void xen_pgd_unpin(unsigned long ptr); 33.91 +void xen_pud_pin(unsigned long ptr); /* x86_64 only */ 33.92 +void xen_pud_unpin(unsigned long ptr); /* x86_64 only */ 33.93 +void xen_pmd_pin(unsigned long ptr); /* x86_64 only */ 33.94 +void xen_pmd_unpin(unsigned long ptr); /* x86_64 only */ 33.95 +void xen_pte_pin(unsigned long ptr); 33.96 +void xen_pte_unpin(unsigned long ptr); 33.97 +#else 33.98 +#define xen_l1_entry_update(_p, _v) set_pte((_p), (_v)) 33.99 +#define xen_l2_entry_update(_p, _v) set_pgd((_p), (_v)) 33.100 +#define xen_pgd_pin(_p) ((void)0) 33.101 +#define xen_pgd_unpin(_p) ((void)0) 33.102 +#define xen_pte_pin(_p) ((void)0) 33.103 +#define xen_pte_unpin(_p) ((void)0) 33.104 +#endif 33.105 + 33.106 +void xen_set_ldt(unsigned long ptr, unsigned long bytes); 33.107 +void xen_machphys_update(unsigned long mfn, unsigned long pfn); 33.108 + 33.109 +#ifdef CONFIG_SMP 33.110 +#include <linux/cpumask.h> 33.111 +void xen_tlb_flush_all(void); 33.112 +void xen_invlpg_all(unsigned long ptr); 33.113 +void xen_tlb_flush_mask(cpumask_t *mask); 33.114 +void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr); 33.115 +#endif 33.116 + 33.117 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 33.118 +/* 33.119 +** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 33.120 +** include sufficient #defines to allow the below to build. 33.121 +*/ 33.122 +#define DEFINE_PER_CPU(type, name) \ 33.123 + __typeof__(type) per_cpu__##name 33.124 + 33.125 +#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 33.126 +#define __get_cpu_var(var) per_cpu__##var 33.127 +#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 33.128 + 33.129 +#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 33.130 +#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) 33.131 +#endif /* linux < 2.6.0 */ 33.132 + 33.133 +void xen_create_contiguous_region(unsigned long vstart, unsigned int order); 33.134 +void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 33.135 + 33.136 +#include <asm/hypercall.h> 33.137 + 33.138 +#if defined(CONFIG_X86_64) 33.139 +#define MULTI_UVMFLAGS_INDEX 2 33.140 +#define MULTI_UVMDOMID_INDEX 3 33.141 +#else 33.142 +#define MULTI_UVMFLAGS_INDEX 3 33.143 +#define MULTI_UVMDOMID_INDEX 4 33.144 +#endif 33.145 + 33.146 +static inline void 33.147 +MULTI_update_va_mapping( 33.148 + multicall_entry_t *mcl, unsigned long va, 33.149 + pte_t new_val, unsigned long flags) 33.150 +{ 33.151 + mcl->op = __HYPERVISOR_update_va_mapping; 33.152 + mcl->args[0] = va; 33.153 +#if defined(CONFIG_X86_64) 33.154 + mcl->args[1] = new_val.pte; 33.155 + mcl->args[2] = flags; 33.156 +#elif defined(CONFIG_X86_PAE) 33.157 + mcl->args[1] = new_val.pte_low; 33.158 + mcl->args[2] = new_val.pte_high; 33.159 + mcl->args[3] = flags; 33.160 +#else 33.161 + mcl->args[1] = new_val.pte_low; 33.162 + mcl->args[2] = 0; 33.163 + mcl->args[3] = flags; 33.164 +#endif 33.165 +} 33.166 + 33.167 +static inline void 33.168 +MULTI_update_va_mapping_otherdomain( 33.169 + multicall_entry_t *mcl, unsigned long va, 33.170 + pte_t new_val, unsigned long flags, domid_t domid) 33.171 +{ 33.172 + mcl->op = __HYPERVISOR_update_va_mapping_otherdomain; 33.173 + mcl->args[0] = va; 33.174 +#if defined(CONFIG_X86_64) 33.175 + mcl->args[1] = new_val.pte; 33.176 + mcl->args[2] = flags; 33.177 + mcl->args[3] = domid; 33.178 +#elif defined(CONFIG_X86_PAE) 33.179 + mcl->args[1] = new_val.pte_low; 33.180 + mcl->args[2] = new_val.pte_high; 33.181 + mcl->args[3] = flags; 33.182 + mcl->args[4] = domid; 33.183 +#else 33.184 + mcl->args[1] = new_val.pte_low; 33.185 + mcl->args[2] = 0; 33.186 + mcl->args[3] = flags; 33.187 + mcl->args[4] = domid; 33.188 +#endif 33.189 +} 33.190 + 33.191 +#endif /* __HYPERVISOR_H__ */
34.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h Wed Sep 14 15:33:52 2005 -0600 34.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h Wed Sep 14 15:36:10 2005 -0600 34.3 @@ -67,7 +67,7 @@ static inline void switch_mm(struct mm_s 34.4 /* Re-load page tables: load_cr3(next->pgd) */ 34.5 per_cpu(cur_pgd, cpu) = next->pgd; 34.6 op->cmd = MMUEXT_NEW_BASEPTR; 34.7 - op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 34.8 + op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 34.9 op++; 34.10 34.11 /* 34.12 @@ -76,8 +76,8 @@ static inline void switch_mm(struct mm_s 34.13 if (unlikely(prev->context.ldt != next->context.ldt)) { 34.14 /* load_LDT_nolock(&next->context, cpu) */ 34.15 op->cmd = MMUEXT_SET_LDT; 34.16 - op->linear_addr = (unsigned long)next->context.ldt; 34.17 - op->nr_ents = next->context.size; 34.18 + op->arg1.linear_addr = (unsigned long)next->context.ldt; 34.19 + op->arg2.nr_ents = next->context.size; 34.20 op++; 34.21 } 34.22
35.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h Wed Sep 14 15:33:52 2005 -0600 35.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h Wed Sep 14 15:36:10 2005 -0600 35.3 @@ -2,7 +2,7 @@ 35.4 #define _I386_PGTABLE_H 35.5 35.6 #include <linux/config.h> 35.7 -#include <asm-xen/hypervisor.h> 35.8 +#include <asm/hypervisor.h> 35.9 35.10 /* 35.11 * The Linux memory management assumes a three-level page table setup. On
36.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h Wed Sep 14 15:33:52 2005 -0600 36.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h Wed Sep 14 15:36:10 2005 -0600 36.3 @@ -7,7 +7,7 @@ 36.4 #include <asm/synch_bitops.h> 36.5 #include <asm/segment.h> 36.6 #include <asm/cpufeature.h> 36.7 -#include <asm-xen/hypervisor.h> 36.8 +#include <asm/hypervisor.h> 36.9 #include <asm/smp_alt.h> 36.10 36.11 #ifdef __KERNEL__
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypervisor.h Wed Sep 14 15:36:10 2005 -0600 37.3 @@ -0,0 +1,2 @@ 37.4 + 37.5 +#include <asm-i386/hypervisor.h>
38.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h Wed Sep 14 15:33:52 2005 -0600 38.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h Wed Sep 14 15:36:10 2005 -0600 38.3 @@ -83,19 +83,19 @@ static inline void switch_mm(struct mm_s 38.4 /* load_cr3(next->pgd) */ 38.5 per_cpu(cur_pgd, smp_processor_id()) = next->pgd; 38.6 op->cmd = MMUEXT_NEW_BASEPTR; 38.7 - op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 38.8 + op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT); 38.9 op++; 38.10 38.11 /* xen_new_user_pt(__pa(__user_pgd(next->pgd))) */ 38.12 op->cmd = MMUEXT_NEW_USER_BASEPTR; 38.13 - op->mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT); 38.14 + op->arg1.mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT); 38.15 op++; 38.16 38.17 if (unlikely(next->context.ldt != prev->context.ldt)) { 38.18 /* load_LDT_nolock(&next->context, cpu) */ 38.19 op->cmd = MMUEXT_SET_LDT; 38.20 - op->linear_addr = (unsigned long)next->context.ldt; 38.21 - op->nr_ents = next->context.size; 38.22 + op->arg1.linear_addr = (unsigned long)next->context.ldt; 38.23 + op->arg2.nr_ents = next->context.size; 38.24 op++; 38.25 } 38.26
39.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Wed Sep 14 15:33:52 2005 -0600 39.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Wed Sep 14 15:36:10 2005 -0600 39.3 @@ -12,7 +12,7 @@ 39.4 #include <linux/sched.h> 39.5 #include <asm/pda.h> 39.6 #ifdef CONFIG_XEN 39.7 -#include <asm-xen/hypervisor.h> 39.8 +#include <asm/hypervisor.h> 39.9 39.10 extern pud_t level3_user_pgt[512]; 39.11 extern pud_t init_level4_user_pgt[];
40.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h Wed Sep 14 15:33:52 2005 -0600 40.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h Wed Sep 14 15:36:10 2005 -0600 40.3 @@ -5,7 +5,7 @@ 40.4 #include <linux/kernel.h> 40.5 #include <asm/segment.h> 40.6 #include <asm/synch_bitops.h> 40.7 -#include <asm-xen/hypervisor.h> 40.8 +#include <asm/hypervisor.h> 40.9 #include <asm-xen/xen-public/arch-x86_64.h> 40.10 40.11 #ifdef __KERNEL__
41.1 --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Wed Sep 14 15:33:52 2005 -0600 41.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Wed Sep 14 15:36:10 2005 -0600 41.3 @@ -33,7 +33,7 @@ 41.4 41.5 #include <linux/config.h> 41.6 #include <linux/interrupt.h> 41.7 -#include <asm-xen/hypervisor.h> 41.8 +#include <asm/hypervisor.h> 41.9 #include <asm/ptrace.h> 41.10 #include <asm/synch_bitops.h> 41.11 #include <asm-xen/xen-public/event_channel.h>
42.1 --- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Wed Sep 14 15:33:52 2005 -0600 42.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Wed Sep 14 15:36:10 2005 -0600 42.3 @@ -14,7 +14,7 @@ 42.4 #define __ASM_GNTTAB_H__ 42.5 42.6 #include <linux/config.h> 42.7 -#include <asm-xen/hypervisor.h> 42.8 +#include <asm/hypervisor.h> 42.9 #include <asm-xen/xen-public/grant_table.h> 42.10 42.11 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
43.1 --- a/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h Wed Sep 14 15:33:52 2005 -0600 43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 43.3 @@ -1,189 +0,0 @@ 43.4 -/****************************************************************************** 43.5 - * hypervisor.h 43.6 - * 43.7 - * Linux-specific hypervisor handling. 43.8 - * 43.9 - * Copyright (c) 2002-2004, K A Fraser 43.10 - * 43.11 - * This file may be distributed separately from the Linux kernel, or 43.12 - * incorporated into other software packages, subject to the following license: 43.13 - * 43.14 - * Permission is hereby granted, free of charge, to any person obtaining a copy 43.15 - * of this source file (the "Software"), to deal in the Software without 43.16 - * restriction, including without limitation the rights to use, copy, modify, 43.17 - * merge, publish, distribute, sublicense, and/or sell copies of the Software, 43.18 - * and to permit persons to whom the Software is furnished to do so, subject to 43.19 - * the following conditions: 43.20 - * 43.21 - * The above copyright notice and this permission notice shall be included in 43.22 - * all copies or substantial portions of the Software. 43.23 - * 43.24 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 43.25 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43.26 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43.27 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 43.28 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 43.29 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 43.30 - * IN THE SOFTWARE. 43.31 - */ 43.32 - 43.33 -#ifndef __HYPERVISOR_H__ 43.34 -#define __HYPERVISOR_H__ 43.35 - 43.36 -#include <linux/config.h> 43.37 -#include <linux/types.h> 43.38 -#include <linux/kernel.h> 43.39 -#include <linux/version.h> 43.40 -#include <asm-xen/xen-public/xen.h> 43.41 -#include <asm-xen/xen-public/dom0_ops.h> 43.42 -#include <asm-xen/xen-public/io/domain_controller.h> 43.43 -#include <asm/ptrace.h> 43.44 -#include <asm/page.h> 43.45 -#if defined(__i386__) 43.46 -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 43.47 -# ifdef CONFIG_X86_PAE 43.48 -# include <asm-generic/pgtable-nopud.h> 43.49 -# else 43.50 -# include <asm-generic/pgtable-nopmd.h> 43.51 -# endif 43.52 -# else 43.53 -# define pud_t pgd_t 43.54 -# endif 43.55 -#endif 43.56 - 43.57 -/* arch/xen/i386/kernel/setup.c */ 43.58 -extern start_info_t *xen_start_info; 43.59 - 43.60 -/* arch/xen/kernel/evtchn.c */ 43.61 -/* Force a proper event-channel callback from Xen. */ 43.62 -void force_evtchn_callback(void); 43.63 - 43.64 -/* arch/xen/kernel/process.c */ 43.65 -void xen_cpu_idle (void); 43.66 - 43.67 -/* arch/xen/i386/kernel/hypervisor.c */ 43.68 -void do_hypervisor_callback(struct pt_regs *regs); 43.69 - 43.70 -/* arch/xen/i386/kernel/head.S */ 43.71 -void lgdt_finish(void); 43.72 - 43.73 -/* arch/xen/i386/mm/hypervisor.c */ 43.74 -/* 43.75 - * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already 43.76 - * be MACHINE addresses. 43.77 - */ 43.78 - 43.79 -void xen_pt_switch(unsigned long ptr); 43.80 -void xen_new_user_pt(unsigned long ptr); /* x86_64 only */ 43.81 -void xen_load_gs(unsigned int selector); /* x86_64 only */ 43.82 -void xen_tlb_flush(void); 43.83 -void xen_invlpg(unsigned long ptr); 43.84 - 43.85 -#ifndef CONFIG_XEN_SHADOW_MODE 43.86 -void xen_l1_entry_update(pte_t *ptr, pte_t val); 43.87 -void xen_l2_entry_update(pmd_t *ptr, pmd_t val); 43.88 -void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ 43.89 -void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */ 43.90 -void xen_pgd_pin(unsigned long ptr); 43.91 -void xen_pgd_unpin(unsigned long ptr); 43.92 -void xen_pud_pin(unsigned long ptr); /* x86_64 only */ 43.93 -void xen_pud_unpin(unsigned long ptr); /* x86_64 only */ 43.94 -void xen_pmd_pin(unsigned long ptr); /* x86_64 only */ 43.95 -void xen_pmd_unpin(unsigned long ptr); /* x86_64 only */ 43.96 -void xen_pte_pin(unsigned long ptr); 43.97 -void xen_pte_unpin(unsigned long ptr); 43.98 -#else 43.99 -#define xen_l1_entry_update(_p, _v) set_pte((_p), (_v)) 43.100 -#define xen_l2_entry_update(_p, _v) set_pgd((_p), (_v)) 43.101 -#define xen_pgd_pin(_p) ((void)0) 43.102 -#define xen_pgd_unpin(_p) ((void)0) 43.103 -#define xen_pte_pin(_p) ((void)0) 43.104 -#define xen_pte_unpin(_p) ((void)0) 43.105 -#endif 43.106 - 43.107 -void xen_set_ldt(unsigned long ptr, unsigned long bytes); 43.108 -void xen_machphys_update(unsigned long mfn, unsigned long pfn); 43.109 - 43.110 -#ifdef CONFIG_SMP 43.111 -#include <linux/cpumask.h> 43.112 -void xen_tlb_flush_all(void); 43.113 -void xen_invlpg_all(unsigned long ptr); 43.114 -void xen_tlb_flush_mask(cpumask_t *mask); 43.115 -void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr); 43.116 -#endif 43.117 - 43.118 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 43.119 -/* 43.120 -** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 43.121 -** include sufficient #defines to allow the below to build. 43.122 -*/ 43.123 -#define DEFINE_PER_CPU(type, name) \ 43.124 - __typeof__(type) per_cpu__##name 43.125 - 43.126 -#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 43.127 -#define __get_cpu_var(var) per_cpu__##var 43.128 -#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 43.129 - 43.130 -#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 43.131 -#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) 43.132 -#endif /* linux < 2.6.0 */ 43.133 - 43.134 -void xen_create_contiguous_region(unsigned long vstart, unsigned int order); 43.135 -void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 43.136 - 43.137 -#include <asm/hypercall.h> 43.138 - 43.139 -#if defined(CONFIG_X86_64) 43.140 -#define MULTI_UVMFLAGS_INDEX 2 43.141 -#define MULTI_UVMDOMID_INDEX 3 43.142 -#else 43.143 -#define MULTI_UVMFLAGS_INDEX 3 43.144 -#define MULTI_UVMDOMID_INDEX 4 43.145 -#endif 43.146 - 43.147 -static inline void 43.148 -MULTI_update_va_mapping( 43.149 - multicall_entry_t *mcl, unsigned long va, 43.150 - pte_t new_val, unsigned long flags) 43.151 -{ 43.152 - mcl->op = __HYPERVISOR_update_va_mapping; 43.153 - mcl->args[0] = va; 43.154 -#if defined(CONFIG_X86_64) 43.155 - mcl->args[1] = new_val.pte; 43.156 - mcl->args[2] = flags; 43.157 -#elif defined(CONFIG_X86_PAE) 43.158 - mcl->args[1] = new_val.pte_low; 43.159 - mcl->args[2] = new_val.pte_high; 43.160 - mcl->args[3] = flags; 43.161 -#else 43.162 - mcl->args[1] = new_val.pte_low; 43.163 - mcl->args[2] = 0; 43.164 - mcl->args[3] = flags; 43.165 -#endif 43.166 -} 43.167 - 43.168 -static inline void 43.169 -MULTI_update_va_mapping_otherdomain( 43.170 - multicall_entry_t *mcl, unsigned long va, 43.171 - pte_t new_val, unsigned long flags, domid_t domid) 43.172 -{ 43.173 - mcl->op = __HYPERVISOR_update_va_mapping_otherdomain; 43.174 - mcl->args[0] = va; 43.175 -#if defined(CONFIG_X86_64) 43.176 - mcl->args[1] = new_val.pte; 43.177 - mcl->args[2] = flags; 43.178 - mcl->args[3] = domid; 43.179 -#elif defined(CONFIG_X86_PAE) 43.180 - mcl->args[1] = new_val.pte_low; 43.181 - mcl->args[2] = new_val.pte_high; 43.182 - mcl->args[3] = flags; 43.183 - mcl->args[4] = domid; 43.184 -#else 43.185 - mcl->args[1] = new_val.pte_low; 43.186 - mcl->args[2] = 0; 43.187 - mcl->args[3] = flags; 43.188 - mcl->args[4] = domid; 43.189 -#endif 43.190 -} 43.191 - 43.192 -#endif /* __HYPERVISOR_H__ */
44.1 --- a/tools/console/daemon/io.c Wed Sep 14 15:33:52 2005 -0600 44.2 +++ b/tools/console/daemon/io.c Wed Sep 14 15:36:10 2005 -0600 44.3 @@ -22,10 +22,8 @@ 44.4 44.5 #include "utils.h" 44.6 #include "io.h" 44.7 - 44.8 #include "xenctrl.h" 44.9 #include "xs.h" 44.10 -#include "xen/io/domain_controller.h" 44.11 44.12 #include <malloc.h> 44.13 #include <stdlib.h>
45.1 --- a/tools/console/daemon/utils.c Wed Sep 14 15:33:52 2005 -0600 45.2 +++ b/tools/console/daemon/utils.c Wed Sep 14 15:36:10 2005 -0600 45.3 @@ -34,8 +34,6 @@ 45.4 #include <string.h> 45.5 45.6 #include "xenctrl.h" 45.7 -#include "xen/io/domain_controller.h" 45.8 - 45.9 #include "utils.h" 45.10 45.11 struct xs_handle *xs;
46.1 --- a/tools/examples/Makefile Wed Sep 14 15:33:52 2005 -0600 46.2 +++ b/tools/examples/Makefile Wed Sep 14 15:36:10 2005 -0600 46.3 @@ -25,21 +25,20 @@ XEN_SCRIPTS += block-phy 46.4 XEN_SCRIPTS += block-file 46.5 XEN_SCRIPTS += block-enbd 46.6 46.7 -XEN_BOOT_DIR = /usr/$(LIBDIR)/xen/boot 46.8 +# no 64-bit specifics in mem-map.sxp 46.9 +# so place in /usr/lib, not /usr/lib64 46.10 +XEN_BOOT_DIR = /usr/lib/xen/boot 46.11 XEN_BOOT = mem-map.sxp 46.12 46.13 XEN_HOTPLUG_DIR = /etc/hotplug 46.14 XEN_HOTPLUG_SCRIPTS = xen-backend.agent 46.15 46.16 -all: 46.17 +all: 46.18 build: 46.19 46.20 install: all install-initd install-configs install-scripts install-boot \ 46.21 install-hotplug 46.22 46.23 -xmexample.vmx: xmexample.vmx.in 46.24 - sed -e 's/@@LIBDIR@@/$(LIBDIR)/' < $< > $@ 46.25 - 46.26 install-initd: 46.27 [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d 46.28 $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d 46.29 @@ -80,4 +79,3 @@ install-hotplug: 46.30 done 46.31 46.32 clean: 46.33 - $(RM) xmexample.vmx
47.1 --- a/tools/examples/network-bridge Wed Sep 14 15:33:52 2005 -0600 47.2 +++ b/tools/examples/network-bridge Wed Sep 14 15:36:10 2005 -0600 47.3 @@ -222,27 +222,31 @@ op_stop () { 47.4 return 47.5 fi 47.6 47.7 - brctl delif ${bridge} ${netdev} 47.8 + if ifconfig peth0 2>/dev/null | grep -q peth0 ; then 47.9 47.10 - if ifconfig veth0 2>/dev/null | grep -q veth0 ; then 47.11 - brctl delif ${bridge} vif0.0 47.12 ifconfig vif0.0 down 47.13 - mac=`ifconfig veth0 | grep HWadd | sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'` 47.14 - ifconfig ${netdev} down 47.15 - ifconfig ${netdev} hw ether ${mac} 47.16 - ifconfig ${netdev} arp up 47.17 - transfer_addrs veth0 ${netdev} 47.18 - transfer_routes veth0 ${netdev} 47.19 - del_addrs veth0 47.20 - ifconfig veth0 -arp down 47.21 - ifconfig veth0 hw ether 00:00:00:00:00:00 47.22 + mac=`ifconfig eth0 | grep HWadd | \ 47.23 + sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'` 47.24 + ifconfig ${netdev} 0.0.0.0 down 47.25 + ifconfig ${netdev} hw ether fe:ff:ff:ff:ff:ff 47.26 + 47.27 + ifconfig p${netdev} down 47.28 + ifconfig p${netdev} hw ether ${mac} arp 47.29 + brctl delif ${bridge} p${netdev} 47.30 + 47.31 + ip link set eth0 name veth0 47.32 + ip link set peth0 name eth0 47.33 + ifconfig ${bridge} down 47.34 + brctl delbr ${bridge} 47.35 + ifup eth0 47.36 + 47.37 else 47.38 transfer_routes ${bridge} ${netdev} 47.39 fi 47.40 } 47.41 47.42 case ${OP} in 47.43 - start) 47.44 + start) 47.45 op_start 47.46 ;; 47.47
48.1 --- a/tools/examples/xen-backend.agent Wed Sep 14 15:33:52 2005 -0600 48.2 +++ b/tools/examples/xen-backend.agent Wed Sep 14 15:36:10 2005 -0600 48.3 @@ -1,3 +1,7 @@ 48.4 + 48.5 +copyrev: 0000000000000000000000000000000000000000 48.6 +copy: tools/examples/backend.hotplug 48.7 + 48.8 #! /bin/sh 48.9 48.10 #ACTION=add
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/tools/examples/xmexample.vmx Wed Sep 14 15:36:10 2005 -0600 49.3 @@ -0,0 +1,102 @@ 49.4 +# -*- mode: python; -*- 49.5 +#============================================================================ 49.6 +# Python configuration setup for 'xm create'. 49.7 +# This script sets the parameters used when a domain is created using 'xm create'. 49.8 +# You use a separate script for each domain you want to create, or 49.9 +# you can set the parameters for the domain on the xm command line. 49.10 +#============================================================================ 49.11 + 49.12 +import os, re 49.13 +arch = os.uname()[4] 49.14 +if re.search('64', arch): 49.15 + arch_libdir = 'lib64' 49.16 +else: 49.17 + arch_libdir = 'lib' 49.18 + 49.19 +#---------------------------------------------------------------------------- 49.20 +# Kernel image file. 49.21 +kernel = "/usr/lib/xen/boot/vmxloader" 49.22 + 49.23 +# The domain build function. VMX domain uses 'vmx'. 49.24 +builder='vmx' 49.25 + 49.26 +# Initial memory allocation (in megabytes) for the new domain. 49.27 +memory = 128 49.28 + 49.29 +# A name for your domain. All domains must have different names. 49.30 +name = "ExampleVMXDomain" 49.31 + 49.32 +# Which CPU to start domain on? 49.33 +#cpu = -1 # leave to Xen to pick 49.34 + 49.35 +# Optionally define mac and/or bridge for the network interfaces. 49.36 +# Random MACs are assigned if not given. 49.37 +#vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ] 49.38 + 49.39 +#---------------------------------------------------------------------------- 49.40 +# Define the disk devices you want the domain to have access to, and 49.41 +# what you want them accessible as. 49.42 +# Each disk entry is of the form phy:UNAME,DEV,MODE 49.43 +# where UNAME is the device, DEV is the device name the domain will see, 49.44 +# and MODE is r for read-only, w for read-write. 49.45 + 49.46 +#disk = [ 'phy:hda1,hda1,r' ] 49.47 +disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ] 49.48 + 49.49 +#---------------------------------------------------------------------------- 49.50 +# Set according to whether you want the domain restarted when it exits. 49.51 +# The default is 'onreboot', which restarts the domain when it shuts down 49.52 +# with exit code reboot. 49.53 +# Other values are 'always', and 'never'. 49.54 + 49.55 +#restart = 'onreboot' 49.56 + 49.57 +#============================================================================ 49.58 + 49.59 +# New stuff 49.60 +device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm' 49.61 + 49.62 +# Advanced users only. Don't touch if you don't know what you're doing 49.63 +memmap = '/usr/lib/xen/boot/mem-map.sxp' 49.64 + 49.65 +#----------------------------------------------------------------------------- 49.66 +# Disk image for 49.67 +#cdrom= 49.68 + 49.69 +#----------------------------------------------------------------------------- 49.70 +# boot on floppy (a), hard disk (c) or CD-ROM (d) 49.71 +#boot=[a|c|d] 49.72 +#----------------------------------------------------------------------------- 49.73 +# write to temporary files instead of disk image files 49.74 +#snapshot=1 49.75 + 49.76 +#---------------------------------------------------------------------------- 49.77 +# enable SDL library for graphics, default = 0 49.78 +sdl=0 49.79 + 49.80 +#---------------------------------------------------------------------------- 49.81 +# enable VNC library for graphics, default = 1 49.82 +vnc=1 49.83 + 49.84 +#---------------------------------------------------------------------------- 49.85 +# enable spawning vncviewer(only valid when vnc=1), default = 1 49.86 +vncviewer=1 49.87 + 49.88 +#---------------------------------------------------------------------------- 49.89 +# no graphics, use serial port 49.90 +#nographic=0 49.91 + 49.92 + 49.93 +#----------------------------------------------------------------------------- 49.94 +# enable audio support 49.95 +#enable-audio=1 49.96 + 49.97 + 49.98 +#----------------------------------------------------------------------------- 49.99 +# set the real time clock to local time [default=0 i.e. set to utc] 49.100 +#localtime=1 49.101 + 49.102 + 49.103 +#----------------------------------------------------------------------------- 49.104 +# start in full screen 49.105 +#full-screen=1
50.1 --- a/tools/examples/xmexample.vmx.in Wed Sep 14 15:33:52 2005 -0600 50.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 50.3 @@ -1,96 +0,0 @@ 50.4 -# -*- mode: python; -*- 50.5 -#============================================================================ 50.6 -# Python configuration setup for 'xm create'. 50.7 -# This script sets the parameters used when a domain is created using 'xm create'. 50.8 -# You use a separate script for each domain you want to create, or 50.9 -# you can set the parameters for the domain on the xm command line. 50.10 -#============================================================================ 50.11 - 50.12 -#---------------------------------------------------------------------------- 50.13 -# Kernel image file. 50.14 -kernel = "/usr/@@LIBDIR@@/xen/boot/vmxloader" 50.15 - 50.16 -# The domain build function. VMX domain uses 'vmx'. 50.17 -builder='vmx' 50.18 - 50.19 -# Initial memory allocation (in megabytes) for the new domain. 50.20 -memory = 128 50.21 - 50.22 -# A name for your domain. All domains must have different names. 50.23 -name = "ExampleVMXDomain" 50.24 - 50.25 -# Which CPU to start domain on? 50.26 -#cpu = -1 # leave to Xen to pick 50.27 - 50.28 -# Optionally define mac and/or bridge for the network interfaces. 50.29 -# Random MACs are assigned if not given. 50.30 -#vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ] 50.31 - 50.32 -#---------------------------------------------------------------------------- 50.33 -# Define the disk devices you want the domain to have access to, and 50.34 -# what you want them accessible as. 50.35 -# Each disk entry is of the form phy:UNAME,DEV,MODE 50.36 -# where UNAME is the device, DEV is the device name the domain will see, 50.37 -# and MODE is r for read-only, w for read-write. 50.38 - 50.39 -#disk = [ 'phy:hda1,hda1,r' ] 50.40 -disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ] 50.41 - 50.42 -#---------------------------------------------------------------------------- 50.43 -# Set according to whether you want the domain restarted when it exits. 50.44 -# The default is 'onreboot', which restarts the domain when it shuts down 50.45 -# with exit code reboot. 50.46 -# Other values are 'always', and 'never'. 50.47 - 50.48 -#restart = 'onreboot' 50.49 - 50.50 -#============================================================================ 50.51 - 50.52 - 50.53 -# New stuff 50.54 -device_model = '/usr/@@LIBDIR@@/xen/bin/qemu-dm' 50.55 - 50.56 -# Advanced users only. Don't touch if you don't know what you're doing 50.57 -memmap = '/usr/@@LIBDIR@@/xen/boot/mem-map.sxp' 50.58 - 50.59 -#----------------------------------------------------------------------------- 50.60 -# Disk image for 50.61 -#cdrom= 50.62 - 50.63 -#----------------------------------------------------------------------------- 50.64 -# boot on floppy (a), hard disk (c) or CD-ROM (d) 50.65 -#boot=[a|c|d] 50.66 -#----------------------------------------------------------------------------- 50.67 -# write to temporary files instead of disk image files 50.68 -#snapshot=1 50.69 - 50.70 -#---------------------------------------------------------------------------- 50.71 -# enable SDL library for graphics, default = 0 50.72 -sdl=0 50.73 - 50.74 -#---------------------------------------------------------------------------- 50.75 -# enable VNC library for graphics, default = 1 50.76 -vnc=1 50.77 - 50.78 -#---------------------------------------------------------------------------- 50.79 -# enable spawning vncviewer(only valid when vnc=1), default = 1 50.80 -vncviewer=1 50.81 - 50.82 -#---------------------------------------------------------------------------- 50.83 -# no graphics, use serial port 50.84 -#nographic=0 50.85 - 50.86 - 50.87 -#----------------------------------------------------------------------------- 50.88 -# enable audio support 50.89 -#enable-audio=1 50.90 - 50.91 - 50.92 -#----------------------------------------------------------------------------- 50.93 -# set the real time clock to local time [default=0 i.e. set to utc] 50.94 -#localtime=1 50.95 - 50.96 - 50.97 -#----------------------------------------------------------------------------- 50.98 -# start in full screen 50.99 -#full-screen=1
51.1 --- a/tools/firmware/Makefile Wed Sep 14 15:33:52 2005 -0600 51.2 +++ b/tools/firmware/Makefile Wed Sep 14 15:36:10 2005 -0600 51.3 @@ -1,6 +1,8 @@ 51.4 XEN_ROOT = ../.. 51.5 include $(XEN_ROOT)/tools/Rules.mk 51.6 51.7 +# vmxloader is a 32-bit protected mode binary. 51.8 +# It belongs in /usr/lib, not /usr/lib64. 51.9 TARGET := vmxassist/vmxloader 51.10 INSTALL_DIR := $(DESTDIR)/usr/lib/xen/boot 51.11
52.1 --- a/tools/ioemu/hw/i8259.c Wed Sep 14 15:33:52 2005 -0600 52.2 +++ b/tools/ioemu/hw/i8259.c Wed Sep 14 15:36:10 2005 -0600 52.3 @@ -128,21 +128,23 @@ static int pic_get_irq(PicState *s) 52.4 /* pic[1] is connected to pin2 of pic[0] */ 52.5 #define CASCADE_IRQ 2 52.6 52.7 -static void shared_page_update() 52.8 +extern shared_iopage_t *shared_page; 52.9 + 52.10 +static void xen_update_shared_imr(void) 52.11 { 52.12 - extern shared_iopage_t *shared_page; 52.13 - uint8_t * pmask = (uint8_t *)&(shared_page->sp_global.pic_mask[0]); 52.14 - int index; 52.15 + uint8_t *pmask = (uint8_t *)shared_page->sp_global.pic_mask; 52.16 + int index; 52.17 52.18 index = pics[0].irq_base/8; 52.19 pmask[index] = pics[0].imr; 52.20 - index = pics[1].irq_base/8; 52.21 52.22 - if ( pics[0].imr & (1 << CASCADE_IRQ) ) { 52.23 - pmask[index] = 0xff; 52.24 - } else { 52.25 - pmask[index] = pics[1].imr; 52.26 - } 52.27 + index = pics[1].irq_base/8; 52.28 + pmask[index] = (pics[0].imr & (1 << CASCADE_IRQ)) ? 0xff : pics[1].imr; 52.29 +} 52.30 + 52.31 +static void xen_clear_shared_irr(void) 52.32 +{ 52.33 + memset(shared_page->sp_global.pic_intr, 0, INTR_LEN); 52.34 } 52.35 52.36 /* raise irq to CPU if necessary. must be called every time the active 52.37 @@ -174,7 +176,8 @@ static void pic_update_irq(void) 52.38 #endif 52.39 cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HARD); 52.40 } 52.41 - shared_page_update(); 52.42 + 52.43 + xen_update_shared_imr(); 52.44 } 52.45 52.46 #ifdef DEBUG_IRQ_LATENCY 52.47 @@ -283,7 +286,9 @@ static void pic_reset(void *opaque) 52.48 tmp = s->elcr_mask; 52.49 memset(s, 0, sizeof(PicState)); 52.50 s->elcr_mask = tmp; 52.51 - shared_page_update(); 52.52 + 52.53 + xen_update_shared_imr(); 52.54 + xen_clear_shared_irr(); 52.55 } 52.56 52.57 static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
53.1 --- a/tools/libxc/xc_domain.c Wed Sep 14 15:33:52 2005 -0600 53.2 +++ b/tools/libxc/xc_domain.c Wed Sep 14 15:36:10 2005 -0600 53.3 @@ -134,7 +134,7 @@ int xc_domain_getinfolist(int xc_handle, 53.4 int ret = 0; 53.5 dom0_op_t op; 53.6 53.7 - if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0) 53.8 + if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 ) 53.9 return -1; 53.10 53.11 op.cmd = DOM0_GETDOMAININFOLIST; 53.12 @@ -142,12 +142,12 @@ int xc_domain_getinfolist(int xc_handle, 53.13 op.u.getdomaininfolist.max_domains = max_domains; 53.14 op.u.getdomaininfolist.buffer = info; 53.15 53.16 - if(xc_dom0_op(xc_handle, &op) < 0) 53.17 + if ( xc_dom0_op(xc_handle, &op) < 0 ) 53.18 ret = -1; 53.19 else 53.20 ret = op.u.getdomaininfolist.num_domains; 53.21 53.22 - if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0) 53.23 + if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 ) 53.24 ret = -1; 53.25 53.26 return ret; 53.27 @@ -277,15 +277,18 @@ int xc_domain_memory_increase_reservatio 53.28 }; 53.29 53.30 err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation); 53.31 - if (err == nr_extents) 53.32 + if ( err == nr_extents ) 53.33 return 0; 53.34 53.35 - if (err > 0) { 53.36 - fprintf(stderr,"Failed alocation for dom %d : %ld pages order %d addr_bits %d\n", 53.37 - domid, nr_extents, extent_order, address_bits); 53.38 + if ( err > 0 ) 53.39 + { 53.40 + fprintf(stderr, "Failed allocation for dom %d: " 53.41 + "%ld pages order %d addr_bits %d\n", 53.42 + domid, nr_extents, extent_order, address_bits); 53.43 errno = ENOMEM; 53.44 err = -1; 53.45 } 53.46 + 53.47 return err; 53.48 } 53.49 53.50 @@ -304,24 +307,24 @@ int xc_domain_memory_decrease_reservatio 53.51 .domid = domid 53.52 }; 53.53 53.54 - if (extent_start == NULL) 53.55 + if ( extent_start == NULL ) 53.56 { 53.57 fprintf(stderr,"decrease_reservation extent_start is NULL!\n"); 53.58 errno = EINVAL; 53.59 - err = -1; 53.60 - goto out; 53.61 + return -1; 53.62 } 53.63 53.64 - err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation); 53.65 - if (err == nr_extents) 53.66 + err = xc_memory_op(xc_handle, XENMEM_decrease_reservation, &reservation); 53.67 + if ( err == nr_extents ) 53.68 return 0; 53.69 53.70 - if (err > 0) { 53.71 - fprintf(stderr,"Failed de-alocation for dom %d : %ld pages order %d\n", 53.72 - domid, nr_extents, extent_order); 53.73 + if ( err > 0 ) 53.74 + { 53.75 + fprintf(stderr,"Failed deallocation for dom %d: %ld pages order %d\n", 53.76 + domid, nr_extents, extent_order); 53.77 errno = EBUSY; 53.78 err = -1; 53.79 } 53.80 -out: 53.81 + 53.82 return err; 53.83 }
54.1 --- a/tools/libxc/xc_linux_restore.c Wed Sep 14 15:33:52 2005 -0600 54.2 +++ b/tools/libxc/xc_linux_restore.c Wed Sep 14 15:36:10 2005 -0600 54.3 @@ -421,7 +421,7 @@ int xc_linux_restore(int xc_handle, int 54.4 pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE; 54.5 else /* pfn_type[i] == (L2TAB|LPINTAB) */ 54.6 pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE; 54.7 - pin[nr_pins].mfn = pfn_to_mfn_table[i]; 54.8 + pin[nr_pins].arg1.mfn = pfn_to_mfn_table[i]; 54.9 if ( ++nr_pins == MAX_PIN_BATCH ) 54.10 { 54.11 if ( xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
55.1 --- a/tools/libxc/xc_linux_save.c Wed Sep 14 15:33:52 2005 -0600 55.2 +++ b/tools/libxc/xc_linux_save.c Wed Sep 14 15:36:10 2005 -0600 55.3 @@ -14,8 +14,6 @@ 55.4 55.5 #include "xg_private.h" 55.6 55.7 -#include <xen/io/domain_controller.h> 55.8 - 55.9 #define BATCH_SIZE 1024 /* 1024 pages (4MB) at a time */ 55.10 55.11 #define MAX_MBIT_RATE 500
56.1 --- a/tools/libxc/xc_private.c Wed Sep 14 15:33:52 2005 -0600 56.2 +++ b/tools/libxc/xc_private.c Wed Sep 14 15:36:10 2005 -0600 56.3 @@ -465,14 +465,14 @@ unsigned long xc_make_page_below_4G( 56.4 unsigned long new_mfn; 56.5 56.6 if ( xc_domain_memory_decrease_reservation( 56.7 - xc_handle, domid, 1, 0, &mfn) != 1 ) 56.8 + xc_handle, domid, 1, 0, &mfn) != 0 ) 56.9 { 56.10 fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn); 56.11 return 0; 56.12 } 56.13 56.14 if ( xc_domain_memory_increase_reservation( 56.15 - xc_handle, domid, 1, 0, 32, &new_mfn) != 1 ) 56.16 + xc_handle, domid, 1, 0, 32, &new_mfn) != 0 ) 56.17 { 56.18 fprintf(stderr,"xc_make_page_below_4G increase failed. mfn=%lx\n",mfn); 56.19 return 0;
57.1 --- a/tools/libxc/xc_vmx_build.c Wed Sep 14 15:33:52 2005 -0600 57.2 +++ b/tools/libxc/xc_vmx_build.c Wed Sep 14 15:36:10 2005 -0600 57.3 @@ -169,21 +169,35 @@ static int zap_mmio_range(int xc_handle, 57.4 l2_pgentry_t *vl2tab; 57.5 57.6 mmio_addr = mmio_range_start & PAGE_MASK; 57.7 - for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) { 57.8 + for ( ; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE ) 57.9 + { 57.10 vl3e = vl3tab[l3_table_offset(mmio_addr)]; 57.11 - if (vl3e == 0) 57.12 + if ( vl3e == 0 ) 57.13 continue; 57.14 - vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 57.15 - PROT_READ|PROT_WRITE, vl3e >> PAGE_SHIFT); 57.16 - if (vl2tab == 0) { 57.17 + 57.18 + vl2tab = xc_map_foreign_range( 57.19 + xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl3e>>PAGE_SHIFT); 57.20 + if ( vl2tab == NULL ) 57.21 + { 57.22 PERROR("Failed zap MMIO range"); 57.23 return -1; 57.24 } 57.25 + 57.26 vl2e = vl2tab[l2_table_offset(mmio_addr)]; 57.27 - if (vl2e == 0) 57.28 + if ( vl2e == 0 ) 57.29 + { 57.30 + munmap(vl2tab, PAGE_SIZE); 57.31 continue; 57.32 - vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 57.33 - PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT); 57.34 + } 57.35 + 57.36 + vl1tab = xc_map_foreign_range( 57.37 + xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl2e>>PAGE_SHIFT); 57.38 + if ( vl1tab == NULL ) 57.39 + { 57.40 + PERROR("Failed zap MMIO range"); 57.41 + munmap(vl2tab, PAGE_SIZE); 57.42 + return -1; 57.43 + } 57.44 57.45 vl1tab[l1_table_offset(mmio_addr)] = 0; 57.46 munmap(vl2tab, PAGE_SIZE);
58.1 --- a/tools/libxc/xg_private.c Wed Sep 14 15:33:52 2005 -0600 58.2 +++ b/tools/libxc/xg_private.c Wed Sep 14 15:36:10 2005 -0600 58.3 @@ -65,7 +65,7 @@ int pin_table( 58.4 struct mmuext_op op; 58.5 58.6 op.cmd = type; 58.7 - op.mfn = mfn; 58.8 + op.arg1.mfn = mfn; 58.9 58.10 if ( xc_mmuext_op(xc_handle, &op, 1, dom) < 0 ) 58.11 return 1;
59.1 --- a/tools/python/xen/lowlevel/xs/xs.c Wed Sep 14 15:33:52 2005 -0600 59.2 +++ b/tools/python/xen/lowlevel/xs/xs.c Wed Sep 14 15:36:10 2005 -0600 59.3 @@ -74,6 +74,7 @@ static inline PyObject *pyvalue_str(char 59.4 " path [string]: xenstore path\n" \ 59.5 "\n" \ 59.6 "Returns: [string] data read.\n" \ 59.7 + " None if key doesn't exist.\n" \ 59.8 "Raises RuntimeError on error.\n" \ 59.9 "\n" 59.10 59.11 @@ -97,7 +98,11 @@ static PyObject *xspy_read(PyObject *sel 59.12 xsval = xs_read(xh, path, &xsval_n); 59.13 Py_END_ALLOW_THREADS 59.14 if (!xsval) { 59.15 - PyErr_SetFromErrno(PyExc_RuntimeError); 59.16 + if (errno == ENOENT) { 59.17 + Py_INCREF(Py_None); 59.18 + val = Py_None; 59.19 + } else 59.20 + PyErr_SetFromErrno(PyExc_RuntimeError); 59.21 goto exit; 59.22 } 59.23 val = PyString_FromStringAndSize(xsval, xsval_n); 59.24 @@ -160,6 +165,7 @@ static PyObject *xspy_write(PyObject *se 59.25 " path [string]: path to list.\n" \ 59.26 "\n" \ 59.27 "Returns: [string array] list of subdirectory names.\n" \ 59.28 + " None if key doesn't exist.\n" \ 59.29 "Raises RuntimeError on error.\n" \ 59.30 "\n" 59.31 59.32 @@ -183,12 +189,17 @@ static PyObject *xspy_ls(PyObject *self, 59.33 xsval = xs_directory(xh, path, &xsval_n); 59.34 Py_END_ALLOW_THREADS 59.35 if (!xsval) { 59.36 - PyErr_SetFromErrno(PyExc_RuntimeError); 59.37 - goto exit; 59.38 + if (errno == ENOENT) { 59.39 + Py_INCREF(Py_None); 59.40 + val = Py_None; 59.41 + } else 59.42 + PyErr_SetFromErrno(PyExc_RuntimeError); 59.43 + goto exit; 59.44 } 59.45 val = PyList_New(xsval_n); 59.46 for (i = 0; i < xsval_n; i++) 59.47 PyList_SetItem(val, i, PyString_FromString(xsval[i])); 59.48 + free(xsval); 59.49 exit: 59.50 return val; 59.51 } 59.52 @@ -253,7 +264,7 @@ static PyObject *xspy_rm(PyObject *self, 59.53 Py_BEGIN_ALLOW_THREADS 59.54 xsval = xs_rm(xh, path); 59.55 Py_END_ALLOW_THREADS 59.56 - if (!xsval) { 59.57 + if (!xsval && errno != ENOENT) { 59.58 PyErr_SetFromErrno(PyExc_RuntimeError); 59.59 goto exit; 59.60 }
60.1 --- a/tools/python/xen/xend/XendCheckpoint.py Wed Sep 14 15:33:52 2005 -0600 60.2 +++ b/tools/python/xen/xend/XendCheckpoint.py Wed Sep 14 15:36:10 2005 -0600 60.3 @@ -13,6 +13,7 @@ from string import join 60.4 from struct import pack, unpack, calcsize 60.5 from xen.util.xpopen import xPopen3 60.6 import xen.lowlevel.xc; xc = xen.lowlevel.xc.new() 60.7 +from xen.xend.xenstore.xsutil import IntroduceDomain 60.8 60.9 from XendError import XendError 60.10 from XendLogging import log 60.11 @@ -48,7 +49,7 @@ def save(xd, fd, dominfo, live): 60.12 # simply uses the defaults compiled into libxenguest; see the comments 60.13 # and/or code in xc_linux_save() for more information. 60.14 cmd = [PATH_XC_SAVE, str(xc.handle()), str(fd), 60.15 - str(dominfo.id), "0", "0", str(int(live)) ] 60.16 + str(dominfo.domid), "0", "0", str(int(live)) ] 60.17 log.info("[xc_save] " + join(cmd)) 60.18 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 60.19 60.20 @@ -68,18 +69,10 @@ def save(xd, fd, dominfo, live): 60.21 if fd == child.fromchild.fileno(): 60.22 l = child.fromchild.readline() 60.23 if l.rstrip() == "suspend": 60.24 - log.info("suspending %d" % dominfo.id) 60.25 - xd.domain_shutdown(dominfo.id, reason='suspend') 60.26 + log.info("suspending %d" % dominfo.domid) 60.27 + xd.domain_shutdown(dominfo.domid, reason='suspend') 60.28 dominfo.state_wait("suspended") 60.29 - log.info("suspend %d done" % dominfo.id) 60.30 - if dominfo.store_channel: 60.31 - try: 60.32 - dominfo.db.releaseDomain(dominfo.id) 60.33 - except Exception, ex: 60.34 - log.warning( 60.35 - "error in domain release on xenstore: %s", 60.36 - ex) 60.37 - pass 60.38 + log.info("suspend %d done" % dominfo.domid) 60.39 child.tochild.write("done\n") 60.40 child.tochild.flush() 60.41 if filter(lambda (fd, event): event & select.POLLHUP, r): 60.42 @@ -90,12 +83,8 @@ def save(xd, fd, dominfo, live): 60.43 if child.wait() != 0: 60.44 raise XendError("xc_save failed: %s" % lasterr) 60.45 60.46 - if dominfo.store_channel: 60.47 - dominfo.store_channel.close() 60.48 - dominfo.db['store_channel'].delete() 60.49 - dominfo.db.saveDB(save=True) 60.50 - dominfo.store_channel = None 60.51 - xd.domain_destroy(dominfo.id) 60.52 + dominfo.setStoreChannel(None) 60.53 + xd.domain_destroy(dominfo.domid) 60.54 return None 60.55 60.56 def restore(xd, fd): 60.57 @@ -137,7 +126,7 @@ def restore(xd, fd): 60.58 console_evtchn = 0 60.59 60.60 cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd), 60.61 - str(dominfo.id), str(nr_pfns), 60.62 + str(dominfo.domid), str(nr_pfns), 60.63 str(store_evtchn), str(console_evtchn)] 60.64 log.info("[xc_restore] " + join(cmd)) 60.65 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 60.66 @@ -163,16 +152,15 @@ def restore(xd, fd): 60.67 m = re.match(r"^(store-mfn) (\d+)\n$", l) 60.68 if m: 60.69 if dominfo.store_channel: 60.70 - dominfo.store_mfn = int(m.group(2)) 60.71 + dominfo.setStoreRef(int(m.group(2))) 60.72 if dominfo.store_mfn >= 0: 60.73 - dominfo.db.introduceDomain(dominfo.id, 60.74 - dominfo.store_mfn, 60.75 - dominfo.store_channel) 60.76 - dominfo.exportToDB(save=True, sync=True) 60.77 + IntroduceDomain(dominfo.domid, 60.78 + dominfo.store_mfn, 60.79 + dominfo.store_channel.port1, 60.80 + dominfo.path) 60.81 m = re.match(r"^(console-mfn) (\d+)\n$", l) 60.82 if m: 60.83 - dominfo.console_mfn = int(m.group(2)) 60.84 - dominfo.exportToDB(save=True, sync=True) 60.85 + dominfo.setConsoleRef(int(m.group(2))) 60.86 try: 60.87 l = child.fromchild.readline() 60.88 except:
61.1 --- a/tools/python/xen/xend/XendDomain.py Wed Sep 14 15:33:52 2005 -0600 61.2 +++ b/tools/python/xen/xend/XendDomain.py Wed Sep 14 15:36:10 2005 -0600 61.3 @@ -130,8 +130,11 @@ class XendDomain: 61.4 doms = self.xen_domains() 61.5 self.dbmap.readDB() 61.6 for domdb in self.dbmap.values(): 61.7 + if not domdb.has_key("xend"): 61.8 + continue 61.9 + db = domdb.addChild("xend") 61.10 try: 61.11 - domid = int(domdb.id) 61.12 + domid = int(domdb["domid"].getData()) 61.13 except: 61.14 domid = None 61.15 # XXX if domid in self.domains, then something went wrong 61.16 @@ -139,7 +142,8 @@ class XendDomain: 61.17 domdb.delete() 61.18 elif domid in doms: 61.19 try: 61.20 - self._new_domain(domdb, doms[domid]) 61.21 + self._new_domain(domdb["uuid"].getData(), domid, db, 61.22 + doms[domid]) 61.23 except Exception, ex: 61.24 log.exception("Error recreating domain info: id=%d", domid) 61.25 self._delete_domain(domid) 61.26 @@ -155,15 +159,15 @@ class XendDomain: 61.27 def close(self): 61.28 pass 61.29 61.30 - def _new_domain(self, db, info): 61.31 + def _new_domain(self, uuid, domid, db, info): 61.32 """Create a domain entry from saved info. 61.33 61.34 @param db: saved info from the db 61.35 @param info: domain info from xen 61.36 @return: domain 61.37 """ 61.38 - dominfo = XendDomainInfo.recreate(db, info) 61.39 - self.domains[dominfo.id] = dominfo 61.40 + dominfo = XendDomainInfo.recreate(uuid, domid, db, info) 61.41 + self.domains[dominfo.domid] = dominfo 61.42 return dominfo 61.43 61.44 def _add_domain(self, info, notify=True): 61.45 @@ -174,15 +178,15 @@ class XendDomain: 61.46 """ 61.47 # Remove entries under the wrong id. 61.48 for i, d in self.domains.items(): 61.49 - if i != d.id: 61.50 + if i != d.domid: 61.51 del self.domains[i] 61.52 self.dbmap.delete(d.uuid) 61.53 - if info.id in self.domains: 61.54 + if info.domid in self.domains: 61.55 notify = False 61.56 - self.domains[info.id] = info 61.57 + self.domains[info.domid] = info 61.58 info.exportToDB(save=True) 61.59 if notify: 61.60 - eserver.inject('xend.domain.create', [info.name, info.id]) 61.61 + eserver.inject('xend.domain.create', [info.name, info.domid]) 61.62 61.63 def _delete_domain(self, id, notify=True): 61.64 """Remove a domain from the tables. 61.65 @@ -201,11 +205,14 @@ class XendDomain: 61.66 info.cleanup() 61.67 info.delete() 61.68 if notify: 61.69 - eserver.inject('xend.domain.died', [info.name, info.id]) 61.70 + eserver.inject('xend.domain.died', [info.name, info.domid]) 61.71 # XXX this should not be needed 61.72 for domdb in self.dbmap.values(): 61.73 + if not domdb.has_key("xend"): 61.74 + continue 61.75 + db = domdb.addChild("xend") 61.76 try: 61.77 - domid = int(domdb.id) 61.78 + domid = int(domdb["domid"].getData()) 61.79 except: 61.80 domid = None 61.81 if (domid is None) or (domid == id): 61.82 @@ -261,13 +268,13 @@ class XendDomain: 61.83 # Update entries for existing domains. 61.84 do_domain_restarts = False 61.85 for d in self.domains.values(): 61.86 - info = doms.get(d.id) 61.87 + info = doms.get(d.domid) 61.88 if info: 61.89 d.update(info) 61.90 elif d.restart_pending(): 61.91 do_domain_restarts = True 61.92 else: 61.93 - self._delete_domain(d.id) 61.94 + self._delete_domain(d.domid) 61.95 if cleanup and do_domain_restarts: 61.96 scheduler.now(self.domain_restarts) 61.97 61.98 @@ -298,20 +305,20 @@ class XendDomain: 61.99 61.100 @param dominfo: domain object 61.101 """ 61.102 - log.info("Restarting domain: name=%s id=%s", dominfo.name, dominfo.id) 61.103 + log.info("Restarting domain: name=%s id=%s", dominfo.name, dominfo.domid) 61.104 eserver.inject("xend.domain.restart", 61.105 - [dominfo.name, dominfo.id, "begin"]) 61.106 + [dominfo.name, dominfo.domid, "begin"]) 61.107 try: 61.108 dominfo.restart() 61.109 - log.info('Restarted domain name=%s id=%s', dominfo.name, dominfo.id) 61.110 + log.info('Restarted domain name=%s id=%s', dominfo.name, dominfo.domid) 61.111 eserver.inject("xend.domain.restart", 61.112 - [dominfo.name, dominfo.id, "success"]) 61.113 - self.domain_unpause(dominfo.id) 61.114 + [dominfo.name, dominfo.domid, "success"]) 61.115 + self.domain_unpause(dominfo.domid) 61.116 except Exception, ex: 61.117 log.exception("Exception restarting domain: name=%s id=%s", 61.118 - dominfo.name, dominfo.id) 61.119 + dominfo.name, dominfo.domid) 61.120 eserver.inject("xend.domain.restart", 61.121 - [dominfo.name, dominfo.id, "fail"]) 61.122 + [dominfo.name, dominfo.domid, "fail"]) 61.123 return dominfo 61.124 61.125 def domain_configure(self, vmconfig): 61.126 @@ -355,12 +362,12 @@ class XendDomain: 61.127 log.info( 61.128 "Creating entry for unknown domain: id=%d uuid=%s", 61.129 id, uuid) 61.130 - db = self.dbmap.addChild(uuid) 61.131 - dominfo = XendDomainInfo.recreate(db, info) 61.132 - dominfo.setdom(id) 61.133 + db = self.dbmap.addChild("%s/xend" % uuid) 61.134 + dominfo = XendDomainInfo.recreate(uuid, id, db, info) 61.135 self._add_domain(dominfo) 61.136 return dominfo 61.137 except Exception, ex: 61.138 + raise 61.139 log.exception("Error creating domain info: id=%d", id) 61.140 return None 61.141 61.142 @@ -383,9 +390,9 @@ class XendDomain: 61.143 @param id: domain id 61.144 """ 61.145 dominfo = self.domain_lookup(id) 61.146 - eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.id]) 61.147 + eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.domid]) 61.148 try: 61.149 - return xc.domain_unpause(dom=dominfo.id) 61.150 + return xc.domain_unpause(dom=dominfo.domid) 61.151 except Exception, ex: 61.152 raise XendError(str(ex)) 61.153 61.154 @@ -395,9 +402,9 @@ class XendDomain: 61.155 @param id: domain id 61.156 """ 61.157 dominfo = self.domain_lookup(id) 61.158 - eserver.inject('xend.domain.pause', [dominfo.name, dominfo.id]) 61.159 + eserver.inject('xend.domain.pause', [dominfo.name, dominfo.domid]) 61.160 try: 61.161 - return xc.domain_pause(dom=dominfo.id) 61.162 + return xc.domain_pause(dom=dominfo.domid) 61.163 except Exception, ex: 61.164 raise XendError(str(ex)) 61.165 61.166 @@ -413,8 +420,8 @@ class XendDomain: 61.167 @param reason: shutdown type: poweroff, reboot, suspend, halt 61.168 """ 61.169 dominfo = self.domain_lookup(id) 61.170 - self.domain_restart_schedule(dominfo.id, reason, force=True) 61.171 - eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.id, reason]) 61.172 + self.domain_restart_schedule(dominfo.domid, reason, force=True) 61.173 + eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.domid, reason]) 61.174 if reason == 'halt': 61.175 reason = 'poweroff' 61.176 val = dominfo.shutdown(reason) 61.177 @@ -438,7 +445,7 @@ class XendDomain: 61.178 if not dominfo.shutdown_pending: 61.179 # domain doesn't need shutdown 61.180 continue 61.181 - id = dominfo.id 61.182 + id = dominfo.domid 61.183 left = dominfo.shutdown_time_left(SHUTDOWN_TIMEOUT) 61.184 if left <= 0: 61.185 # Shutdown expired - destroy domain. 61.186 @@ -469,15 +476,15 @@ class XendDomain: 61.187 restart = (force and reason == 'reboot') or dominfo.restart_needed(reason) 61.188 if restart: 61.189 log.info('Scheduling restart for domain: name=%s id=%s', 61.190 - dominfo.name, dominfo.id) 61.191 + dominfo.name, dominfo.domid) 61.192 eserver.inject("xend.domain.restart", 61.193 - [dominfo.name, dominfo.id, "schedule"]) 61.194 + [dominfo.name, dominfo.domid, "schedule"]) 61.195 dominfo.restarting() 61.196 else: 61.197 log.info('Cancelling restart for domain: name=%s id=%s', 61.198 - dominfo.name, dominfo.id) 61.199 + dominfo.name, dominfo.domid) 61.200 eserver.inject("xend.domain.restart", 61.201 - [dominfo.name, dominfo.id, "cancel"]) 61.202 + [dominfo.name, dominfo.domid, "cancel"]) 61.203 dominfo.restart_cancel() 61.204 61.205 def domain_restarts(self): 61.206 @@ -487,8 +494,8 @@ class XendDomain: 61.207 for dominfo in self.domains.values(): 61.208 if not dominfo.restart_pending(): 61.209 continue 61.210 - print 'domain_restarts>', dominfo.name, dominfo.id 61.211 - info = doms.get(dominfo.id) 61.212 + print 'domain_restarts>', dominfo.name, dominfo.domid 61.213 + info = doms.get(dominfo.domid) 61.214 if info: 61.215 # Don't execute restart for domains still running. 61.216 print 'domain_restarts> still runnning: ', dominfo.name 61.217 @@ -505,7 +512,7 @@ class XendDomain: 61.218 try: 61.219 dominfo = self.domain_lookup(id) 61.220 log.info('Destroying domain: name=%s', dominfo.name) 61.221 - eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.id]) 61.222 + eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.domid]) 61.223 val = dominfo.destroy() 61.224 except: 61.225 #todo 61.226 @@ -580,7 +587,7 @@ class XendDomain: 61.227 """ 61.228 dominfo = self.domain_lookup(id) 61.229 try: 61.230 - return xc.domain_pincpu(dominfo.id, vcpu, cpumap) 61.231 + return xc.domain_pincpu(dominfo.domid, vcpu, cpumap) 61.232 except Exception, ex: 61.233 raise XendError(str(ex)) 61.234 61.235 @@ -589,7 +596,7 @@ class XendDomain: 61.236 """ 61.237 dominfo = self.domain_lookup(id) 61.238 try: 61.239 - return xc.bvtsched_domain_set(dom=dominfo.id, mcuadv=mcuadv, 61.240 + return xc.bvtsched_domain_set(dom=dominfo.domid, mcuadv=mcuadv, 61.241 warpback=warpback, warpvalue=warpvalue, 61.242 warpl=warpl, warpu=warpu) 61.243 except Exception, ex: 61.244 @@ -600,7 +607,7 @@ class XendDomain: 61.245 """ 61.246 dominfo = self.domain_lookup(id) 61.247 try: 61.248 - return xc.bvtsched_domain_get(dominfo.id) 61.249 + return xc.bvtsched_domain_get(dominfo.domid) 61.250 except Exception, ex: 61.251 raise XendError(str(ex)) 61.252 61.253 @@ -610,7 +617,7 @@ class XendDomain: 61.254 """ 61.255 dominfo = self.domain_lookup(id) 61.256 try: 61.257 - return xc.sedf_domain_set(dominfo.id, period, slice, latency, extratime, weight) 61.258 + return xc.sedf_domain_set(dominfo.domid, period, slice, latency, extratime, weight) 61.259 except Exception, ex: 61.260 raise XendError(str(ex)) 61.261 61.262 @@ -619,7 +626,7 @@ class XendDomain: 61.263 """ 61.264 dominfo = self.domain_lookup(id) 61.265 try: 61.266 - return xc.sedf_domain_get(dominfo.id) 61.267 + return xc.sedf_domain_get(dominfo.domid) 61.268 except Exception, ex: 61.269 raise XendError(str(ex)) 61.270 61.271 @@ -667,7 +674,7 @@ class XendDomain: 61.272 @param type: device type 61.273 """ 61.274 dominfo = self.domain_lookup(id) 61.275 - val = dominfo.device_destroy(type, devid) 61.276 + val = dominfo.device_delete(type, devid) 61.277 dominfo.exportToDB() 61.278 return val 61.279 61.280 @@ -709,7 +716,7 @@ class XendDomain: 61.281 """ 61.282 dominfo = self.domain_lookup(id) 61.283 try: 61.284 - return xc.shadow_control(dominfo.id, op) 61.285 + return xc.shadow_control(dominfo.domid, op) 61.286 except Exception, ex: 61.287 raise XendError(str(ex)) 61.288 61.289 @@ -723,7 +730,7 @@ class XendDomain: 61.290 dominfo = self.domain_lookup(id) 61.291 maxmem = int(mem) * 1024 61.292 try: 61.293 - return xc.domain_setmaxmem(dominfo.id, maxmem_kb = maxmem) 61.294 + return xc.domain_setmaxmem(dominfo.domid, maxmem_kb = maxmem) 61.295 except Exception, ex: 61.296 raise XendError(str(ex)) 61.297 61.298 @@ -735,7 +742,7 @@ class XendDomain: 61.299 @return: 0 on success, -1 on error 61.300 """ 61.301 dominfo = self.domain_lookup(id) 61.302 - return dominfo.mem_target_set(mem) 61.303 + return dominfo.setMemoryTarget(mem * (1 << 20)) 61.304 61.305 def domain_vcpu_hotplug(self, id, vcpu, state): 61.306 """Enable or disable VCPU vcpu in DOM id 61.307 @@ -755,12 +762,12 @@ class XendDomain: 61.308 @param id: domain 61.309 """ 61.310 dominfo = self.domain_lookup(id) 61.311 - corefile = "/var/xen/dump/%s.%s.core"% (dominfo.name, dominfo.id) 61.312 + corefile = "/var/xen/dump/%s.%s.core"% (dominfo.name, dominfo.domid) 61.313 try: 61.314 - xc.domain_dumpcore(dom=dominfo.id, corefile=corefile) 61.315 + xc.domain_dumpcore(dom=dominfo.domid, corefile=corefile) 61.316 except Exception, ex: 61.317 log.warning("Dumpcore failed, id=%s name=%s: %s", 61.318 - dominfo.id, dominfo.name, ex) 61.319 + dominfo.domid, dominfo.name, ex) 61.320 61.321 def instance(): 61.322 """Singleton constructor. Use this instead of the class constructor.
62.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 15:33:52 2005 -0600 62.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 15:36:10 2005 -0600 62.3 @@ -27,6 +27,7 @@ import string, re 62.4 import os 62.5 import time 62.6 import threading 62.7 +import errno 62.8 62.9 import xen.lowlevel.xc; xc = xen.lowlevel.xc.new() 62.10 from xen.util.ip import check_subnet, get_current_ipgw 62.11 @@ -48,6 +49,7 @@ from xen.xend.XendRoot import get_compon 62.12 from xen.xend.uuid import getUuid 62.13 from xen.xend.xenstore import DBVar, XenNode, DBMap 62.14 from xen.xend.xenstore.xstransact import xstransact 62.15 +from xen.xend.xenstore.xsutil import IntroduceDomain 62.16 62.17 """Shutdown code for poweroff.""" 62.18 DOMAIN_POWEROFF = 0 62.19 @@ -128,7 +130,7 @@ class XendDomainInfo: 62.20 @raise: VmError for invalid configuration 62.21 """ 62.22 uuid = getUuid() 62.23 - db = parentdb.addChild(uuid) 62.24 + db = parentdb.addChild("%s/xend" % uuid) 62.25 path = parentdb.getPath() 62.26 vm = cls(uuid, path, db) 62.27 vm.construct(config) 62.28 @@ -138,23 +140,26 @@ class XendDomainInfo: 62.29 62.30 create = classmethod(create) 62.31 62.32 - def recreate(cls, db, info): 62.33 + def recreate(cls, uuid, domid, db, info): 62.34 """Create the VM object for an existing domain. 62.35 62.36 @param db: domain db 62.37 @param info: domain info from xc 62.38 """ 62.39 - dom = info['dom'] 62.40 - path = "/".join(db.getPath().split("/")[0:-1]) 62.41 - vm = cls(db.getName(), path, db) 62.42 - vm.setdom(dom) 62.43 - db.readDB() 62.44 + path = "/".join(db.getPath().split("/")[0:-2]) 62.45 + vm = cls(uuid, path, db) 62.46 + vm.setDomid(domid) 62.47 + vm.name, vm.start_time = vm.gatherVm(("name", str), 62.48 + ("start-time", float)) 62.49 + try: 62.50 + db.readDB() 62.51 + except: pass 62.52 vm.importFromDB() 62.53 config = vm.config 62.54 log.debug('info=' + str(info)) 62.55 log.debug('config=' + prettyprintstring(config)) 62.56 62.57 - vm.memory = info['mem_kb']/1024 62.58 + vm.memory = info['mem_kb'] / 1024 62.59 vm.target = info['mem_kb'] * 1024 62.60 62.61 if config: 62.62 @@ -164,7 +169,7 @@ class XendDomainInfo: 62.63 finally: 62.64 vm.recreate = False 62.65 else: 62.66 - vm.setName("Domain-%d" % dom) 62.67 + vm.setName("Domain-%d" % domid) 62.68 62.69 vm.exportToDB(save=True) 62.70 return vm 62.71 @@ -180,13 +185,13 @@ class XendDomainInfo: 62.72 """ 62.73 if not uuid: 62.74 uuid = getUuid() 62.75 - db = parentdb.addChild(uuid) 62.76 + db = parentdb.addChild("%s/xend" % uuid) 62.77 path = parentdb.getPath() 62.78 vm = cls(uuid, path, db) 62.79 ssidref = int(sxp.child_value(config, 'ssidref')) 62.80 log.debug('restoring with ssidref='+str(ssidref)) 62.81 id = xc.domain_create(ssidref = ssidref) 62.82 - vm.setdom(id) 62.83 + vm.setDomid(id) 62.84 vm.clear_shutdown() 62.85 try: 62.86 vm.restore = True 62.87 @@ -199,32 +204,26 @@ class XendDomainInfo: 62.88 restore = classmethod(restore) 62.89 62.90 __exports__ = [ 62.91 - DBVar('id', ty='int'), 62.92 - DBVar('name', ty='str'), 62.93 - DBVar('uuid', ty='str'), 62.94 DBVar('config', ty='sxpr'), 62.95 - DBVar('start_time', ty='float'), 62.96 DBVar('state', ty='str'), 62.97 - DBVar('store_mfn', ty='long'), 62.98 - DBVar('console_mfn', ty='long', path="console/ring-ref"), 62.99 DBVar('restart_mode', ty='str'), 62.100 DBVar('restart_state', ty='str'), 62.101 DBVar('restart_time', ty='float'), 62.102 DBVar('restart_count', ty='int'), 62.103 - DBVar('target', ty='long', path="memory/target"), 62.104 DBVar('device_model_pid', ty='int'), 62.105 ] 62.106 62.107 def __init__(self, uuid, path, db): 62.108 self.uuid = uuid 62.109 self.path = path + "/" + uuid 62.110 + 62.111 self.db = db 62.112 62.113 self.recreate = 0 62.114 self.restore = 0 62.115 62.116 self.config = None 62.117 - self.id = None 62.118 + self.domid = None 62.119 self.cpu_weight = 1 62.120 self.start_time = None 62.121 self.name = None 62.122 @@ -260,10 +259,42 @@ class XendDomainInfo: 62.123 self.restart_count = 0 62.124 62.125 self.vcpus = 1 62.126 - self.vcpusdb = {} 62.127 self.bootloader = None 62.128 self.device_model_pid = 0 62.129 62.130 + self.writeVm("uuid", self.uuid) 62.131 + self.storeDom("vm", self.path) 62.132 + 62.133 + def readVm(self, *args): 62.134 + return xstransact.Read(self.path, *args) 62.135 + 62.136 + def writeVm(self, *args): 62.137 + return xstransact.Write(self.path, *args) 62.138 + 62.139 + def removeVm(self, *args): 62.140 + return xstransact.Remove(self.path, *args) 62.141 + 62.142 + def gatherVm(self, *args): 62.143 + return xstransact.Gather(self.path, *args) 62.144 + 62.145 + def storeVm(self, *args): 62.146 + return xstransact.Store(self.path, *args) 62.147 + 62.148 + def readDom(self, *args): 62.149 + return xstransact.Read(self.path, *args) 62.150 + 62.151 + def writeDom(self, *args): 62.152 + return xstransact.Write(self.path, *args) 62.153 + 62.154 + def removeDom(self, *args): 62.155 + return xstransact.Remove(self.path, *args) 62.156 + 62.157 + def gatherDom(self, *args): 62.158 + return xstransact.Gather(self.path, *args) 62.159 + 62.160 + def storeDom(self, *args): 62.161 + return xstransact.Store(self.path, *args) 62.162 + 62.163 def setDB(self, db): 62.164 self.db = db 62.165 62.166 @@ -271,50 +302,56 @@ class XendDomainInfo: 62.167 self.db.saveDB(save=save, sync=sync) 62.168 62.169 def exportToDB(self, save=False, sync=False): 62.170 - if self.store_channel: 62.171 - self.store_channel.saveToDB(self.db.addChild("store_channel"), 62.172 - save=save) 62.173 - if self.console_channel: 62.174 - self.db['console/port'] = "%i" % self.console_channel.port1 62.175 if self.image: 62.176 self.image.exportToDB(save=save, sync=sync) 62.177 self.db.exportToDB(self, fields=self.__exports__, save=save, sync=sync) 62.178 62.179 def importFromDB(self): 62.180 self.db.importFromDB(self, fields=self.__exports__) 62.181 - self.store_channel = self.eventChannelOld("store_channel") 62.182 + self.store_channel = self.eventChannel("store/port") 62.183 62.184 - def setdom(self, dom): 62.185 + def setDomid(self, domid): 62.186 """Set the domain id. 62.187 62.188 @param dom: domain id 62.189 """ 62.190 - self.id = int(dom) 62.191 - #self.db.id = self.id 62.192 + self.domid = domid 62.193 + self.storeDom("domid", self.domid) 62.194 62.195 def getDomain(self): 62.196 - return self.id 62.197 + return self.domid 62.198 62.199 def setName(self, name): 62.200 self.name = name 62.201 - self.db.name = self.name 62.202 + self.storeVm("name", name) 62.203 62.204 def getName(self): 62.205 return self.name 62.206 62.207 - def getStoreChannel(self): 62.208 - return self.store_channel 62.209 + def setStoreRef(self, ref): 62.210 + self.store_mfn = ref 62.211 + self.storeDom("store/ring-ref", ref) 62.212 62.213 - def getConsoleChannel(self): 62.214 - return self.console_channel 62.215 + def setStoreChannel(self, channel): 62.216 + if self.store_channel and self.store_channel != channel: 62.217 + self.store_channel.close() 62.218 + self.store_channel = channel 62.219 + self.storeDom("store/port", channel.port1) 62.220 + 62.221 + def setConsoleRef(self, ref): 62.222 + self.console_mfn = ref 62.223 + self.storeDom("console/ring-ref", ref) 62.224 + 62.225 + def setMemoryTarget(self, target): 62.226 + self.memory_target = target 62.227 + self.storeDom("memory/target", target) 62.228 62.229 def update(self, info=None): 62.230 """Update with info from xc.domain_getinfo(). 62.231 """ 62.232 - self.info = info or dom_get(self.id) 62.233 + self.info = info or dom_get(self.domid) 62.234 self.memory = self.info['mem_kb'] / 1024 62.235 self.ssidref = self.info['ssidref'] 62.236 - self.target = self.info['mem_kb'] * 1024 62.237 62.238 def state_set(self, state): 62.239 self.state_updated.acquire() 62.240 @@ -332,7 +369,7 @@ class XendDomainInfo: 62.241 62.242 def __str__(self): 62.243 s = "<domain" 62.244 - s += " id=" + str(self.id) 62.245 + s += " id=" + str(self.domid) 62.246 s += " name=" + self.name 62.247 s += " memory=" + str(self.memory) 62.248 s += " ssidref=" + str(self.ssidref) 62.249 @@ -373,7 +410,7 @@ class XendDomainInfo: 62.250 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 62.251 62.252 front = { 'backend' : backpath, 62.253 - 'backend-id' : "%i" % backdom.id, 62.254 + 'backend-id' : "%i" % backdom.domid, 62.255 'virtual-device' : "%i" % devnum } 62.256 xstransact.Write(frontpath, front) 62.257 62.258 @@ -382,7 +419,7 @@ class XendDomainInfo: 62.259 back = { 'type' : type, 62.260 'params' : params, 62.261 'frontend' : frontpath, 62.262 - 'frontend-id' : "%i" % self.id } 62.263 + 'frontend-id' : "%i" % self.domid } 62.264 xstransact.Write(backpath, back) 62.265 62.266 return 62.267 @@ -415,7 +452,7 @@ class XendDomainInfo: 62.268 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 62.269 62.270 front = { 'backend' : backpath, 62.271 - 'backend-id' : "%i" % backdom.id, 62.272 + 'backend-id' : "%i" % backdom.domid, 62.273 'handle' : "%i" % devnum, 62.274 'mac' : mac } 62.275 xstransact.Write(frontpath, front) 62.276 @@ -425,7 +462,7 @@ class XendDomainInfo: 62.277 'mac' : mac, 62.278 'bridge' : bridge, 62.279 'frontend' : frontpath, 62.280 - 'frontend-id' : "%i" % self.id, 62.281 + 'frontend-id' : "%i" % self.domid, 62.282 'handle' : "%i" % devnum } 62.283 if ipaddr: 62.284 back['ip'] = ' '.join(ipaddr) 62.285 @@ -444,13 +481,13 @@ class XendDomainInfo: 62.286 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 62.287 62.288 front = { 'backend' : backpath, 62.289 - 'backend-id' : "%i" % backdom.id, 62.290 + 'backend-id' : "%i" % backdom.domid, 62.291 'handle' : "%i" % devnum } 62.292 xstransact.Write(frontpath, front) 62.293 62.294 back = { 'instance' : "%i" % devnum, 62.295 'frontend' : frontpath, 62.296 - 'frontend-id' : "%i" % self.id } 62.297 + 'frontend-id' : "%i" % self.domid } 62.298 xstransact.Write(backpath, back) 62.299 62.300 return 62.301 @@ -485,7 +522,7 @@ class XendDomainInfo: 62.302 62.303 def sxpr(self): 62.304 sxpr = ['domain', 62.305 - ['id', self.id], 62.306 + ['domid', self.domid], 62.307 ['name', self.name], 62.308 ['memory', self.memory], 62.309 ['ssidref', self.ssidref], 62.310 @@ -582,7 +619,7 @@ class XendDomainInfo: 62.311 return 62.312 if dominfo.is_terminated(): 62.313 return 62.314 - if not self.id or (dominfo.id != self.id): 62.315 + if not self.domid or (dominfo.domid != self.domid): 62.316 raise VmError('vm name clash: ' + name) 62.317 62.318 def construct(self, config): 62.319 @@ -630,11 +667,11 @@ class XendDomainInfo: 62.320 self.memory = int(sxp.child_value(config, 'memory')) 62.321 if self.memory is None: 62.322 raise VmError('missing memory size') 62.323 - self.target = self.memory * (1 << 20) 62.324 + self.setMemoryTarget(self.memory * (1 << 20)) 62.325 self.ssidref = int(sxp.child_value(config, 'ssidref')) 62.326 cpu = sxp.child_value(config, 'cpu') 62.327 - if self.recreate and self.id and cpu is not None and int(cpu) >= 0: 62.328 - xc.domain_pincpu(self.id, 0, 1<<int(cpu)) 62.329 + if self.recreate and self.domid and cpu is not None and int(cpu) >= 0: 62.330 + xc.domain_pincpu(self.domid, 0, 1<<int(cpu)) 62.331 try: 62.332 image = sxp.child_value(self.config, 'image') 62.333 vcpus = sxp.child_value(image, 'vcpus') 62.334 @@ -643,15 +680,11 @@ class XendDomainInfo: 62.335 except: 62.336 raise VmError('invalid vcpus value') 62.337 62.338 - def exportVCPUSToDB(self, vcpus): 62.339 - for v in range(0,vcpus): 62.340 - path = "/cpu/%d"%(v) 62.341 - if not self.vcpusdb.has_key(path): 62.342 - self.vcpusdb[path] = self.db.addChild(path) 62.343 - db = self.vcpusdb[path] 62.344 - log.debug("writing key availability=online to path %s in store"%(path)) 62.345 - db['availability'] = "online" 62.346 - db.saveDB(save=True) 62.347 + def configure_vcpus(self, vcpus): 62.348 + d = {} 62.349 + for v in range(0, vcpus): 62.350 + d["cpu/%d/availability" % v] = "online" 62.351 + self.writeVm(d) 62.352 62.353 def init_image(self): 62.354 """Create boot image handler for the domain. 62.355 @@ -668,18 +701,17 @@ class XendDomainInfo: 62.356 self.image.createImage() 62.357 self.exportToDB() 62.358 if self.store_channel and self.store_mfn >= 0: 62.359 - self.db.introduceDomain(self.id, 62.360 - self.store_mfn, 62.361 - self.store_channel) 62.362 + IntroduceDomain(self.domid, self.store_mfn, 62.363 + self.store_channel.port1, self.path) 62.364 # get the configured value of vcpus and update store 62.365 - self.exportVCPUSToDB(self.vcpus) 62.366 + self.configure_vcpus(self.vcpus) 62.367 62.368 def delete(self): 62.369 """Delete the vm's db. 62.370 """ 62.371 - if dom_get(self.id): 62.372 + if dom_get(self.domid): 62.373 return 62.374 - self.id = None 62.375 + self.domid = None 62.376 self.saveToDB(sync=True) 62.377 try: 62.378 # Todo: eventually will have to wait for devices to signal 62.379 @@ -695,10 +727,10 @@ class XendDomainInfo: 62.380 The domain will not finally go away unless all vm 62.381 devices have been released. 62.382 """ 62.383 - if self.id is None: 62.384 + if self.domid is None: 62.385 return 62.386 try: 62.387 - xc.domain_destroy(dom=self.id) 62.388 + xc.domain_destroy(dom=self.domid) 62.389 except Exception, err: 62.390 log.exception("Domain destroy failed: %s", self.name) 62.391 62.392 @@ -708,16 +740,7 @@ class XendDomainInfo: 62.393 self.state = STATE_VM_TERMINATED 62.394 self.release_devices() 62.395 if self.store_channel: 62.396 - try: 62.397 - self.store_channel.close() 62.398 - self.store_channel = None 62.399 - except: 62.400 - pass 62.401 - try: 62.402 - self.db.releaseDomain(self.id) 62.403 - except Exception, ex: 62.404 - log.warning("error in domain release on xenstore: %s", ex) 62.405 - pass 62.406 + self.setStoreChannel(None) 62.407 if self.console_channel: 62.408 # notify processes using this cosole? 62.409 try: 62.410 @@ -765,7 +788,7 @@ class XendDomainInfo: 62.411 def show(self): 62.412 """Print virtual machine info. 62.413 """ 62.414 - print "[VM dom=%d name=%s memory=%d ssidref=%d" % (self.id, self.name, self.memory, self.ssidref) 62.415 + print "[VM dom=%d name=%s memory=%d ssidref=%d" % (self.domid, self.name, self.memory, self.ssidref) 62.416 print "image:" 62.417 sxp.show(self.image) 62.418 print "]" 62.419 @@ -777,46 +800,37 @@ class XendDomainInfo: 62.420 return 62.421 if self.start_time is None: 62.422 self.start_time = time.time() 62.423 + self.storeVm(("start-time", self.start_time)) 62.424 try: 62.425 cpu = int(sxp.child_value(self.config, 'cpu', '-1')) 62.426 except: 62.427 raise VmError('invalid cpu') 62.428 - id = self.image.initDomain(self.id, self.memory, self.ssidref, cpu, self.cpu_weight) 62.429 + id = self.image.initDomain(self.domid, self.memory, self.ssidref, cpu, self.cpu_weight) 62.430 log.debug('init_domain> Created domain=%d name=%s memory=%d', 62.431 id, self.name, self.memory) 62.432 - self.setdom(id) 62.433 + self.setDomid(id) 62.434 62.435 - def eventChannelOld(self, key): 62.436 - """Create an event channel to the domain. 62.437 - If saved info is available recreate the channel. 62.438 - 62.439 - @param key db key for the saved data (if any) 62.440 - """ 62.441 - db = self.db.addChild(key) 62.442 - return EventChannel.restoreFromDB(db, 0, self.id) 62.443 - 62.444 - def eventChannel(self, path=None, key=None): 62.445 + def eventChannel(self, path=None): 62.446 """Create an event channel to the domain. 62.447 62.448 @param path under which port is stored in db 62.449 """ 62.450 port = 0 62.451 - try: 62.452 - if path and key: 62.453 - if path: 62.454 - db = self.db.addChild(path) 62.455 - else: 62.456 - db = self.db 62.457 - port = int(db[key].getData()) 62.458 - except: pass 62.459 - return EventChannel.interdomain(0, self.id, port1=port, port2=0) 62.460 + if path: 62.461 + try: 62.462 + port = int(self.readDom(path)) 62.463 + except: 62.464 + # if anything goes wrong, assume the port was not yet set 62.465 + pass 62.466 + ret = EventChannel.interdomain(0, self.domid, port1=port, port2=0) 62.467 + self.storeDom(path, ret.port1) 62.468 + return ret 62.469 62.470 def create_channel(self): 62.471 """Create the channels to the domain. 62.472 """ 62.473 - self.store_channel = self.eventChannelOld("store_channel") 62.474 - self.console_channel = self.eventChannel("console", "port") 62.475 - 62.476 + self.store_channel = self.eventChannel("store/port") 62.477 + self.console_channel = self.eventChannel("console/port") 62.478 62.479 def create_configured_devices(self): 62.480 devices = sxp.children(self.config, 'device') 62.481 @@ -1046,50 +1060,30 @@ class XendDomainInfo: 62.482 log.warning("Unknown config field %s", field_name) 62.483 index[field_name] = field_index + 1 62.484 62.485 - def mem_target_set(self, target): 62.486 - """Set domain memory target in bytes. 62.487 - """ 62.488 - if target: 62.489 - self.target = target * (1 << 20) 62.490 - # Commit to XenStore immediately 62.491 - self.exportToDB() 62.492 - 62.493 def vcpu_hotplug(self, vcpu, state): 62.494 """Disable or enable VCPU in domain. 62.495 """ 62.496 - db = "" 62.497 - try: 62.498 - db = self.vcpusdb['/cpu/%d'%(vcpu)] 62.499 - except: 62.500 - log.error("Invalid VCPU") 62.501 + if vcpu > self.vcpus: 62.502 + log.error("Invalid VCPU %d" % vcpu) 62.503 return 62.504 - 62.505 - if self.store_channel: 62.506 - if int(state) == 0: 62.507 - db['availability'] = "offline" 62.508 - else: 62.509 - db['availability'] = "online" 62.510 - 62.511 - db.saveDB(save=True) 62.512 + if int(state) == 0: 62.513 + availability = "offline" 62.514 + else: 62.515 + availability = "online" 62.516 + self.storeVm("cpu/%d/availability" % vcpu, availability) 62.517 62.518 def shutdown(self, reason): 62.519 if not reason in shutdown_reasons.values(): 62.520 raise XendError('invalid reason:' + reason) 62.521 - db = self.db.addChild("/control"); 62.522 - db['shutdown'] = reason; 62.523 - db.saveDB(save=True); 62.524 + self.storeVm("control/shutdown", reason) 62.525 if not reason in ['suspend']: 62.526 self.shutdown_pending = {'start':time.time(), 'reason':reason} 62.527 62.528 def clear_shutdown(self): 62.529 - db = self.db.addChild("/control") 62.530 - db['shutdown'] = "" 62.531 - db.saveDB(save=True) 62.532 + self.removeVm("control/shutdown") 62.533 62.534 def send_sysrq(self, key=0): 62.535 - db = self.db.addChild("/control"); 62.536 - db['sysrq'] = '%c' % key; 62.537 - db.saveDB(save=True); 62.538 + self.storeVm("control/sysrq", '%c' % key) 62.539 62.540 def shutdown_time_left(self, timeout): 62.541 if not self.shutdown_pending: 62.542 @@ -1098,14 +1092,22 @@ class XendDomainInfo: 62.543 62.544 def dom0_init_store(self): 62.545 if not self.store_channel: 62.546 - self.store_channel = self.eventChannelOld("store_channel") 62.547 - self.store_mfn = xc.init_store(self.store_channel.port2) 62.548 - if self.store_mfn >= 0: 62.549 - self.db.introduceDomain(self.id, self.store_mfn, 62.550 - self.store_channel) 62.551 - self.exportToDB(save=True, sync=True) 62.552 - # get run-time value of vcpus and update store 62.553 - self.exportVCPUSToDB(dom_get(self.id)['vcpus']) 62.554 + self.store_channel = self.eventChannel("store/port") 62.555 + if not self.store_channel: 62.556 + return 62.557 + ref = xc.init_store(self.store_channel.port2) 62.558 + if ref and ref >= 0: 62.559 + self.setStoreRef(ref) 62.560 + try: 62.561 + IntroduceDomain(self.domid, ref, self.store_channel.port1, 62.562 + self.path) 62.563 + except RuntimeError, ex: 62.564 + if ex.args[0] == errno.EISCONN: 62.565 + pass 62.566 + else: 62.567 + raise 62.568 + # get run-time value of vcpus and update store 62.569 + self.configure_vcpus(dom_get(self.domid)['vcpus']) 62.570 62.571 62.572 def vm_field_ignore(_, _1, _2, _3): 62.573 @@ -1126,7 +1128,7 @@ def vm_field_maxmem(vm, _1, val, _2): 62.574 maxmem = int(maxmem) 62.575 except: 62.576 raise VmError("invalid maxmem: " + str(maxmem)) 62.577 - xc.domain_setmaxmem(vm.id, maxmem_kb = maxmem * 1024) 62.578 + xc.domain_setmaxmem(vm.domid, maxmem_kb = maxmem * 1024) 62.579 62.580 62.581 #============================================================================
63.1 --- a/tools/python/xen/xend/image.py Wed Sep 14 15:33:52 2005 -0600 63.2 +++ b/tools/python/xen/xend/image.py Wed Sep 14 15:36:10 2005 -0600 63.3 @@ -23,6 +23,7 @@ from xen.xend import sxp 63.4 from xen.xend.XendError import VmError 63.5 from xen.xend.XendLogging import log 63.6 from xen.xend.xenstore import DBVar 63.7 +from xen.xend.xenstore.xstransact import xstransact 63.8 63.9 from xen.xend.server import channel 63.10 63.11 @@ -154,7 +155,6 @@ class ImageHandler: 63.12 if dom <= 0: 63.13 raise VmError('Creating domain failed: name=%s' % self.vm.name) 63.14 log.debug("initDomain: cpu=%d mem_kb=%d ssidref=%d dom=%d", cpu, mem_kb, ssidref, dom) 63.15 - # xc.domain_setuuid(dom, uuid) 63.16 xc.domain_setcpuweight(dom, cpu_weight) 63.17 xc.domain_setmaxmem(dom, mem_kb) 63.18 63.19 @@ -240,6 +240,12 @@ class ImageHandler: 63.20 """Extra cleanup on domain destroy (define in subclass if needed).""" 63.21 pass 63.22 63.23 + def set_vminfo(self, d): 63.24 + if d.has_key('store_mfn'): 63.25 + self.vm.setStoreRef(d.get('store_mfn')) 63.26 + if d.has_key('console_mfn'): 63.27 + self.vm.setConsoleRef(d.get('console_mfn')) 63.28 + 63.29 addImageHandlerClass = ImageHandler.addImageHandlerClass 63.30 63.31 class LinuxImageHandler(ImageHandler): 63.32 @@ -274,8 +280,7 @@ class LinuxImageHandler(ImageHandler): 63.33 flags = self.flags, 63.34 vcpus = self.vm.vcpus) 63.35 if isinstance(ret, dict): 63.36 - self.vm.store_mfn = ret.get('store_mfn') 63.37 - self.vm.console_mfn = ret.get('console_mfn') 63.38 + self.set_vminfo(ret) 63.39 return 0 63.40 return ret 63.41 63.42 @@ -318,7 +323,7 @@ class VmxImageHandler(ImageHandler): 63.43 flags = self.flags, 63.44 vcpus = self.vm.vcpus) 63.45 if isinstance(ret, dict): 63.46 - self.vm.store_mfn = ret.get('store_mfn') 63.47 + self.set_vminfo(ret) 63.48 return 0 63.49 return ret 63.50
64.1 --- a/tools/python/xen/xend/server/SrvDomain.py Wed Sep 14 15:33:52 2005 -0600 64.2 +++ b/tools/python/xen/xend/server/SrvDomain.py Wed Sep 14 15:36:10 2005 -0600 64.3 @@ -41,21 +41,21 @@ class SrvDomain(SrvDir): 64.4 fn = FormFn(self.xd.domain_configure, 64.5 [['dom', 'int'], 64.6 ['config', 'sxpr']]) 64.7 - return fn(req.args, {'dom': self.dom.id}) 64.8 + return fn(req.args, {'dom': self.dom.domid}) 64.9 64.10 def op_unpause(self, op, req): 64.11 - val = self.xd.domain_unpause(self.dom.id) 64.12 + val = self.xd.domain_unpause(self.dom.domid) 64.13 return val 64.14 64.15 def op_pause(self, op, req): 64.16 - val = self.xd.domain_pause(self.dom.id) 64.17 + val = self.xd.domain_pause(self.dom.domid) 64.18 return val 64.19 64.20 def op_shutdown(self, op, req): 64.21 fn = FormFn(self.xd.domain_shutdown, 64.22 [['dom', 'int'], 64.23 ['reason', 'str']]) 64.24 - val = fn(req.args, {'dom': self.dom.id}) 64.25 + val = fn(req.args, {'dom': self.dom.domid}) 64.26 req.setResponseCode(http.ACCEPTED) 64.27 req.setHeader("Location", "%s/.." % req.prePathURL()) 64.28 return val 64.29 @@ -64,7 +64,7 @@ class SrvDomain(SrvDir): 64.30 fn = FormFn(self.xd.domain_sysrq, 64.31 [['dom', 'int'], 64.32 ['key', 'int']]) 64.33 - val = fn(req.args, {'dom' : self.dom.id}) 64.34 + val = fn(req.args, {'dom' : self.dom.domid}) 64.35 req.setResponseCode(http.ACCEPTED) 64.36 req.setHeader("Location", "%s/.." % req.prePathURL()) 64.37 return val 64.38 @@ -73,7 +73,7 @@ class SrvDomain(SrvDir): 64.39 fn = FormFn(self.xd.domain_destroy, 64.40 [['dom', 'int'], 64.41 ['reason', 'str']]) 64.42 - val = fn(req.args, {'dom': self.dom.id}) 64.43 + val = fn(req.args, {'dom': self.dom.domid}) 64.44 req.setHeader("Location", "%s/.." % req.prePathURL()) 64.45 return val 64.46 64.47 @@ -84,7 +84,7 @@ class SrvDomain(SrvDir): 64.48 fn = FormFn(self.xd.domain_save, 64.49 [['dom', 'int'], 64.50 ['file', 'str']]) 64.51 - val = fn(req.args, {'dom': self.dom.id}) 64.52 + val = fn(req.args, {'dom': self.dom.domid}) 64.53 return 0 64.54 64.55 def op_migrate(self, op, req): 64.56 @@ -96,14 +96,14 @@ class SrvDomain(SrvDir): 64.57 ['destination', 'str'], 64.58 ['live', 'int'], 64.59 ['resource', 'int']]) 64.60 - return fn(req.args, {'dom': self.dom.id}) 64.61 + return fn(req.args, {'dom': self.dom.domid}) 64.62 64.63 def op_pincpu(self, op, req): 64.64 fn = FormFn(self.xd.domain_pincpu, 64.65 [['dom', 'int'], 64.66 ['vcpu', 'int'], 64.67 ['cpumap', 'int']]) 64.68 - val = fn(req.args, {'dom': self.dom.id}) 64.69 + val = fn(req.args, {'dom': self.dom.domid}) 64.70 return val 64.71 64.72 def op_cpu_bvt_set(self, op, req): 64.73 @@ -114,7 +114,7 @@ class SrvDomain(SrvDir): 64.74 ['warpvalue', 'int'], 64.75 ['warpl', 'long'], 64.76 ['warpu', 'long']]) 64.77 - val = fn(req.args, {'dom': self.dom.id}) 64.78 + val = fn(req.args, {'dom': self.dom.domid}) 64.79 return val 64.80 64.81 64.82 @@ -126,28 +126,28 @@ class SrvDomain(SrvDir): 64.83 ['latency', 'int'], 64.84 ['extratime', 'int'], 64.85 ['weight', 'int']]) 64.86 - val = fn(req.args, {'dom': self.dom.id}) 64.87 + val = fn(req.args, {'dom': self.dom.domid}) 64.88 return val 64.89 64.90 def op_maxmem_set(self, op, req): 64.91 fn = FormFn(self.xd.domain_maxmem_set, 64.92 [['dom', 'int'], 64.93 ['memory', 'int']]) 64.94 - val = fn(req.args, {'dom': self.dom.id}) 64.95 + val = fn(req.args, {'dom': self.dom.domid}) 64.96 return val 64.97 64.98 def op_mem_target_set(self, op, req): 64.99 fn = FormFn(self.xd.domain_mem_target_set, 64.100 [['dom', 'int'], 64.101 ['target', 'int']]) 64.102 - val = fn(req.args, {'dom': self.dom.id}) 64.103 + val = fn(req.args, {'dom': self.dom.domid}) 64.104 return val 64.105 64.106 def op_devices(self, op, req): 64.107 fn = FormFn(self.xd.domain_devtype_ls, 64.108 [['dom', 'int'], 64.109 ['type', 'str']]) 64.110 - val = fn(req.args, {'dom': self.dom.id}) 64.111 + val = fn(req.args, {'dom': self.dom.domid}) 64.112 return val 64.113 64.114 def op_device(self, op, req): 64.115 @@ -155,7 +155,7 @@ class SrvDomain(SrvDir): 64.116 [['dom', 'int'], 64.117 ['type', 'str'], 64.118 ['idx', 'int']]) 64.119 - val = fn(req.args, {'dom': self.dom.id}) 64.120 + val = fn(req.args, {'dom': self.dom.domid}) 64.121 if val: 64.122 return val.sxpr() 64.123 else: 64.124 @@ -165,7 +165,7 @@ class SrvDomain(SrvDir): 64.125 fn = FormFn(self.xd.domain_device_create, 64.126 [['dom', 'int'], 64.127 ['config', 'sxpr']]) 64.128 - val = fn(req.args, {'dom': self.dom.id}) 64.129 + val = fn(req.args, {'dom': self.dom.domid}) 64.130 return val 64.131 64.132 def op_device_refresh(self, op, req): 64.133 @@ -173,7 +173,7 @@ class SrvDomain(SrvDir): 64.134 [['dom', 'int'], 64.135 ['type', 'str'], 64.136 ['idx', 'str']]) 64.137 - val = fn(req.args, {'dom': self.dom.id}) 64.138 + val = fn(req.args, {'dom': self.dom.domid}) 64.139 return val 64.140 64.141 def op_device_destroy(self, op, req): 64.142 @@ -181,7 +181,7 @@ class SrvDomain(SrvDir): 64.143 [['dom', 'int'], 64.144 ['type', 'str'], 64.145 ['idx', 'str']]) 64.146 - val = fn(req.args, {'dom': self.dom.id}) 64.147 + val = fn(req.args, {'dom': self.dom.domid}) 64.148 return val 64.149 64.150 def op_device_configure(self, op, req): 64.151 @@ -189,7 +189,7 @@ class SrvDomain(SrvDir): 64.152 [['dom', 'int'], 64.153 ['config', 'sxpr'], 64.154 ['idx', 'str']]) 64.155 - val = fn(req.args, {'dom': self.dom.id}) 64.156 + val = fn(req.args, {'dom': self.dom.domid}) 64.157 return val 64.158 64.159 def op_vif_limit_set(self, op, req): 64.160 @@ -198,7 +198,7 @@ class SrvDomain(SrvDir): 64.161 ['vif', 'int'], 64.162 ['credit', 'int'], 64.163 ['period', 'int']]) 64.164 - val = fn(req.args, {'dom': self.dom.id}) 64.165 + val = fn(req.args, {'dom': self.dom.domid}) 64.166 return val 64.167 64.168 def op_vcpu_hotplug(self, op, req): 64.169 @@ -206,7 +206,7 @@ class SrvDomain(SrvDir): 64.170 [['dom', 'int'], 64.171 ['vcpu', 'int'], 64.172 ['state', 'int']]) 64.173 - val = fn(req.args, {'dom': self.dom.id}) 64.174 + val = fn(req.args, {'dom': self.dom.domid}) 64.175 return val 64.176 64.177 def render_POST(self, req):
65.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py Wed Sep 14 15:33:52 2005 -0600 65.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py Wed Sep 14 15:36:10 2005 -0600 65.3 @@ -154,7 +154,7 @@ class SrvDomainDir(SrvDir): 65.4 for d in domains: 65.5 req.write('<li><a href="%s%s"> Domain %s</a>' 65.6 % (url, d.name, d.name)) 65.7 - req.write('id=%s' % d.id) 65.8 + req.write('id=%s' % d.domid) 65.9 req.write('memory=%d'% d.memory) 65.10 req.write('ssidref=%d'% d.ssidref) 65.11 req.write('</li>')
66.1 --- a/tools/python/xen/xend/server/blkif.py Wed Sep 14 15:33:52 2005 -0600 66.2 +++ b/tools/python/xen/xend/server/blkif.py Wed Sep 14 15:36:10 2005 -0600 66.3 @@ -123,7 +123,7 @@ class BlkDev(Dev): 66.4 def init(self, recreate=False, reboot=False): 66.5 self.frontendDomain = self.getDomain() 66.6 backend = self.getBackend() 66.7 - self.backendId = backend.id 66.8 + self.backendId = backend.domid 66.9 66.10 def configure(self, config, change=False, recreate=False): 66.11 if change: 66.12 @@ -146,7 +146,7 @@ class BlkDev(Dev): 66.13 66.14 try: 66.15 xd = get_component('xen.xend.XendDomain') 66.16 - self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 66.17 + self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 66.18 except: 66.19 raise XendError('invalid backend domain') 66.20
67.1 --- a/tools/python/xen/xend/server/netif.py Wed Sep 14 15:33:52 2005 -0600 67.2 +++ b/tools/python/xen/xend/server/netif.py Wed Sep 14 15:36:10 2005 -0600 67.3 @@ -180,7 +180,7 @@ class NetDev(Dev): 67.4 else: 67.5 #todo: Code below will fail on xend restart when backend is not domain 0. 67.6 xd = get_component('xen.xend.XendDomain') 67.7 - self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 67.8 + self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 67.9 except: 67.10 raise XendError('invalid backend domain') 67.11 return self.config 67.12 @@ -206,7 +206,7 @@ class NetDev(Dev): 67.13 mtu = self._get_config_mtu(config) 67.14 67.15 xd = get_component('xen.xend.XendDomain') 67.16 - backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 67.17 + backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 67.18 67.19 if (mac is not None) and (mac != self.mac): 67.20 raise XendError("cannot change mac")
68.1 --- a/tools/python/xen/xend/xenstore/xsnode.py Wed Sep 14 15:33:52 2005 -0600 68.2 +++ b/tools/python/xen/xend/xenstore/xsnode.py Wed Sep 14 15:36:10 2005 -0600 68.3 @@ -365,18 +365,6 @@ class XenStore: 68.4 finally: 68.5 self.watchThread = None 68.6 68.7 - def introduceDomain(self, dom, page, evtchn, path): 68.8 - try: 68.9 - self.getxs().introduce_domain(dom, page, evtchn.port1, path) 68.10 - except RuntimeError, ex: 68.11 - if ex.args[0] == errno.EISCONN: 68.12 - return None 68.13 - else: 68.14 - raise 68.15 - 68.16 - def releaseDomain(self, dom): 68.17 - self.getxs().release_domain(dom) 68.18 - 68.19 def getXenStore(): 68.20 global xenstore 68.21 try: 68.22 @@ -461,12 +449,6 @@ class XenNode: 68.23 def ls(self): 68.24 return self.store.ls(self.path) 68.25 68.26 - def introduceDomain(self, dom, page, evtchn, path): 68.27 - self.store.introduceDomain(dom, page, evtchn, path) 68.28 - 68.29 - def releaseDomain(self, dom): 68.30 - self.store.releaseDomain(dom) 68.31 - 68.32 def watch(self, fn, path=""): 68.33 """Watch a path for changes. The path is relative 68.34 to the node and defaults to the node itself.
69.1 --- a/tools/python/xen/xend/xenstore/xsobj.py Wed Sep 14 15:33:52 2005 -0600 69.2 +++ b/tools/python/xen/xend/xenstore/xsobj.py Wed Sep 14 15:36:10 2005 -0600 69.3 @@ -319,30 +319,6 @@ class DBMap(dict): 69.4 def getPath(self): 69.5 return self.__db__ and self.__db__.relPath() 69.6 69.7 - def introduceDomain(self, dom, page, evtchn, path=None): 69.8 - db = self.__db__ 69.9 - if path is None: 69.10 - path = db.relPath() 69.11 - log.info("DBMap>introduceDomain> %d %d %s %s" %(dom, page, evtchn, path)) 69.12 - try: 69.13 - db.introduceDomain(dom, page, evtchn, path) 69.14 - except Exception, ex: 69.15 - import traceback 69.16 - traceback.print_exc() 69.17 - log.info("DBMap>introduceDomain> %s" %ex) 69.18 - pass # todo: don't ignore 69.19 - 69.20 - def releaseDomain(self, dom): 69.21 - db = self.__db__ 69.22 - log.info("DBMap>releaseDomain> %d" %dom) 69.23 - try: 69.24 - db.releaseDomain(dom) 69.25 - except Exception, ex: 69.26 - import traceback 69.27 - traceback.print_exc() 69.28 - log.info("DBMap>releaseDomain> %s" %ex) 69.29 - pass # todo: don't ignore 69.30 - 69.31 def watch(self, fn, path=""): 69.32 return self.__db__.watch(fn, path=path) 69.33 69.34 @@ -509,9 +485,11 @@ class DBMap(dict): 69.35 if self.__db__ is None: 69.36 return 69.37 self.__data__ = self.__db__.getData() 69.38 - for k in self.__db__.ls(): 69.39 - n = self.addChild(k) 69.40 - n.readDB() 69.41 + l = self.__db__.ls() 69.42 + if l: 69.43 + for k in l: 69.44 + n = self.addChild(k) 69.45 + n.readDB() 69.46 self.__dirty__ = False 69.47 69.48 def readChildDB(self, k):
70.1 --- a/tools/python/xen/xend/xenstore/xstransact.py Wed Sep 14 15:33:52 2005 -0600 70.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py Wed Sep 14 15:36:10 2005 -0600 70.3 @@ -7,14 +7,7 @@ 70.4 import errno 70.5 import threading 70.6 from xen.lowlevel import xs 70.7 - 70.8 -handles = {} 70.9 - 70.10 -# XXX need to g/c handles from dead threads 70.11 -def xshandle(): 70.12 - if not handles.has_key(threading.currentThread()): 70.13 - handles[threading.currentThread()] = xs.open() 70.14 - return handles[threading.currentThread()] 70.15 +from xen.xend.xenstore.xsutil import xshandle 70.16 70.17 class xstransact: 70.18 70.19 @@ -43,8 +36,6 @@ class xstransact: 70.20 return xshandle().transaction_end(False) 70.21 70.22 def abort(self): 70.23 - if not self.in_transaction: 70.24 - raise RuntimeError 70.25 self.in_transaction = False 70.26 return xshandle().transaction_end(True) 70.27 70.28 @@ -100,7 +91,10 @@ class xstransact: 70.29 70.30 def _list(self, key): 70.31 path = "%s/%s" % (self.path, key) 70.32 - return map(lambda x: key + "/" + x, xshandle().ls(path)) 70.33 + l = xshandle().ls(path) 70.34 + if l: 70.35 + return map(lambda x: key + "/" + x, l) 70.36 + return [] 70.37 70.38 def list(self, *args): 70.39 if len(args) == 0: 70.40 @@ -110,6 +104,45 @@ class xstransact: 70.41 ret.extend(self._list(key)) 70.42 return ret 70.43 70.44 + def gather(self, *args): 70.45 + if len(args) and type(args[0]) != tuple: 70.46 + args = args, 70.47 + ret = [] 70.48 + for tup in args: 70.49 + if len(tup) == 2: 70.50 + (key, fn) = tup 70.51 + defval = None 70.52 + else: 70.53 + (key, fn, defval) = tup 70.54 + try: 70.55 + val = fn(self._read(key)) 70.56 + except TypeError: 70.57 + val = defval 70.58 + ret.append(val) 70.59 + if len(ret) == 1: 70.60 + return ret[0] 70.61 + return ret 70.62 + 70.63 + def store(self, *args): 70.64 + if len(args) and type(args[0]) != tuple: 70.65 + args = args, 70.66 + for tup in args: 70.67 + if len(tup) == 2: 70.68 + (key, val) = tup 70.69 + try: 70.70 + fmt = { str : "%s", 70.71 + int : "%i", 70.72 + float : "%f", 70.73 + type(None) : None }[type(val)] 70.74 + except KeyError: 70.75 + raise TypeError 70.76 + else: 70.77 + (key, val, fmt) = tup 70.78 + if val is None: 70.79 + self._remove(key) 70.80 + else: 70.81 + self._write(key, fmt % val) 70.82 + 70.83 70.84 def Read(cls, path, *args): 70.85 while True: 70.86 @@ -119,8 +152,13 @@ class xstransact: 70.87 t.commit() 70.88 return v 70.89 except RuntimeError, ex: 70.90 + t.abort() 70.91 if ex.args[0] == errno.ETIMEDOUT: 70.92 pass 70.93 + else: 70.94 + raise 70.95 + except: 70.96 + t.abort() 70.97 raise 70.98 70.99 Read = classmethod(Read) 70.100 @@ -133,13 +171,18 @@ class xstransact: 70.101 t.commit() 70.102 return 70.103 except RuntimeError, ex: 70.104 + t.abort() 70.105 if ex.args[0] == errno.ETIMEDOUT: 70.106 pass 70.107 + else: 70.108 + raise 70.109 + except: 70.110 + t.abort() 70.111 raise 70.112 70.113 Write = classmethod(Write) 70.114 70.115 - def Remove(cls, *args): 70.116 + def Remove(cls, path, *args): 70.117 while True: 70.118 try: 70.119 t = cls(path) 70.120 @@ -147,8 +190,13 @@ class xstransact: 70.121 t.commit() 70.122 return 70.123 except RuntimeError, ex: 70.124 + t.abort() 70.125 if ex.args[0] == errno.ETIMEDOUT: 70.126 pass 70.127 + else: 70.128 + raise 70.129 + except: 70.130 + t.abort() 70.131 raise 70.132 70.133 Remove = classmethod(Remove) 70.134 @@ -161,8 +209,51 @@ class xstransact: 70.135 t.commit() 70.136 return v 70.137 except RuntimeError, ex: 70.138 + t.abort() 70.139 if ex.args[0] == errno.ETIMEDOUT: 70.140 pass 70.141 + else: 70.142 + raise 70.143 + except: 70.144 + t.abort() 70.145 raise 70.146 70.147 List = classmethod(List) 70.148 + 70.149 + def Gather(cls, path, *args): 70.150 + while True: 70.151 + try: 70.152 + t = cls(path) 70.153 + v = t.gather(*args) 70.154 + t.commit() 70.155 + return v 70.156 + except RuntimeError, ex: 70.157 + t.abort() 70.158 + if ex.args[0] == errno.ETIMEDOUT: 70.159 + pass 70.160 + else: 70.161 + raise 70.162 + except: 70.163 + t.abort() 70.164 + raise 70.165 + 70.166 + Gather = classmethod(Gather) 70.167 + 70.168 + def Store(cls, path, *args): 70.169 + while True: 70.170 + try: 70.171 + t = cls(path) 70.172 + v = t.store(*args) 70.173 + t.commit() 70.174 + return v 70.175 + except RuntimeError, ex: 70.176 + t.abort() 70.177 + if ex.args[0] == errno.ETIMEDOUT: 70.178 + pass 70.179 + else: 70.180 + raise 70.181 + except: 70.182 + t.abort() 70.183 + raise 70.184 + 70.185 + Store = classmethod(Store)
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 71.2 +++ b/tools/python/xen/xend/xenstore/xsutil.py Wed Sep 14 15:36:10 2005 -0600 71.3 @@ -0,0 +1,20 @@ 71.4 +# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk> 71.5 + 71.6 +# This file is subject to the terms and conditions of the GNU General 71.7 +# Public License. See the file "COPYING" in the main directory of 71.8 +# this archive for more details. 71.9 + 71.10 +import threading 71.11 +from xen.lowlevel import xs 71.12 + 71.13 +handles = {} 71.14 + 71.15 +# XXX need to g/c handles from dead threads 71.16 +def xshandle(): 71.17 + if not handles.has_key(threading.currentThread()): 71.18 + handles[threading.currentThread()] = xs.open() 71.19 + return handles[threading.currentThread()] 71.20 + 71.21 + 71.22 +def IntroduceDomain(domid, page, port, path): 71.23 + return xshandle().introduce_domain(domid, page, port, path)
72.1 --- a/tools/python/xen/xm/create.py Wed Sep 14 15:33:52 2005 -0600 72.2 +++ b/tools/python/xen/xm/create.py Wed Sep 14 15:36:10 2005 -0600 72.3 @@ -750,7 +750,7 @@ def make_domain(opts, config): 72.4 server.xend_domain_destroy(dom) 72.5 opts.err("Failed to unpause domain %s" % dom) 72.6 opts.info("Started domain %s" % (dom)) 72.7 - return int(sxp.child_value(dominfo, 'id')) 72.8 + return int(sxp.child_value(dominfo, 'domid')) 72.9 72.10 def get_dom0_alloc(): 72.11 """Return current allocation memory of dom0 (in MB). Return 0 on error"""
73.1 --- a/tools/python/xen/xm/main.py Wed Sep 14 15:33:52 2005 -0600 73.2 +++ b/tools/python/xen/xm/main.py Wed Sep 14 15:36:10 2005 -0600 73.3 @@ -64,7 +64,6 @@ xm full list of subcommands: 73.4 Domain Commands: 73.5 console <DomId> attach to console of DomId 73.6 cpus-list <DomId> <VCpu> get the list of cpus for a VCPU 73.7 - cpus-set <DomId> <VCpu> <CPUS> set which cpus a VCPU can use. 73.8 create <ConfigFile> create a domain 73.9 destroy <DomId> terminate a domain immediately 73.10 domid <DomName> convert a domain name to a domain id 73.11 @@ -83,6 +82,7 @@ xm full list of subcommands: 73.12 vcpu-enable <DomId> <VCPU> disable VCPU in a domain 73.13 vcpu-disable <DomId> <VCPU> enable VCPU in a domain 73.14 vcpu-list <DomId> get the list of VCPUs for a domain 73.15 + vcpu-pin <DomId> <VCpu> <CPUS> set which cpus a VCPU can use. 73.16 73.17 Xen Host Commands: 73.18 dmesg [--clear] read or clear Xen's message buffer 73.19 @@ -91,14 +91,15 @@ xm full list of subcommands: 73.20 top monitor system and domains in real-time 73.21 73.22 Scheduler Commands: 73.23 - bvt <options> set BVT scheduler parameters 73.24 - bvt_ctxallow <Allow> set the BVT scheduler context switch allowance 73.25 - sedf <options> set simple EDF parameters 73.26 + sched-bvt <options> set BVT scheduler parameters 73.27 + sched-bvt-ctxallow <Allow> 73.28 + Set the BVT scheduler context switch allowance 73.29 + sched-sedf <options> set simple EDF parameters 73.30 73.31 Virtual Device Commands: 73.32 - block-create <DomId> <BackDev> <FrontDev> <Mode> [BackDomId] 73.33 + block-attach <DomId> <BackDev> <FrontDev> <Mode> [BackDomId] 73.34 Create a new virtual block device 73.35 - block-destroy <DomId> <DevId> Destroy a domain's virtual block device 73.36 + block-detach <DomId> <DevId> Destroy a domain's virtual block device 73.37 block-list <DomId> List virtual block devices for a domain 73.38 block-refresh <DomId> <DevId> Refresh a virtual block device for a domain 73.39 network-limit <DomId> <Vif> <Credit> <Period> 73.40 @@ -172,8 +173,7 @@ def xm_create(args): 73.41 from xen.xm import create 73.42 # ugly hack because the opt parser apparently wants 73.43 # the subcommand name just to throw it away! 73.44 - args.insert(0,"bogus") 73.45 - create.main(args) 73.46 + create.main(["bogus"] + args) 73.47 73.48 def xm_save(args): 73.49 arg_check(args,2,"save") 73.50 @@ -192,17 +192,16 @@ def xm_restore(args): 73.51 from xen.xend.XendClient import server 73.52 info = server.xend_domain_restore(savefile) 73.53 PrettyPrint.prettyprint(info) 73.54 - id = sxp.child_value(info, 'id') 73.55 + id = sxp.child_value(info, 'domid') 73.56 if id is not None: 73.57 - server.xend_domain_unpause(id) 73.58 + server.xend_domain_unpause(domid) 73.59 73.60 def xm_migrate(args): 73.61 # TODO: arg_check 73.62 from xen.xm import migrate 73.63 # ugly hack because the opt parser apparently wants 73.64 # the subcommand name just to throw it away! 73.65 - args.insert(0,"bogus") 73.66 - migrate.main(args) 73.67 + migrate.main(["bogus"] + args) 73.68 73.69 def xm_list(args): 73.70 use_long = 0 73.71 @@ -242,7 +241,7 @@ def xm_list(args): 73.72 73.73 def parse_doms_info(info): 73.74 dominfo = {} 73.75 - dominfo['dom'] = int(sxp.child_value(info, 'id', '-1')) 73.76 + dominfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) 73.77 dominfo['name'] = sxp.child_value(info, 'name', '??') 73.78 dominfo['mem'] = int(sxp.child_value(info, 'memory', '0')) 73.79 dominfo['cpu'] = str(sxp.child_value(info, 'cpu', '0')) 73.80 @@ -265,7 +264,7 @@ def parse_doms_info(info): 73.81 for cpu in vcpu_to_cpu: 73.82 vcpuinfo = {} 73.83 vcpuinfo['name'] = sxp.child_value(info, 'name', '??') 73.84 - vcpuinfo['dom'] = int(sxp.child_value(info, 'id', '-1')) 73.85 + vcpuinfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) 73.86 vcpuinfo['vcpu'] = int(count) 73.87 vcpuinfo['cpu'] = int(cpu) 73.88 vcpuinfo['cpumap'] = int(cpumap[count])&mask 73.89 @@ -289,8 +288,7 @@ def xm_show_vcpus(domsinfo): 73.90 vcpuinfo) 73.91 73.92 def xm_vcpu_list(args): 73.93 - args.insert(0,"-v") 73.94 - xm_list(args) 73.95 + xm_list(["-v"] + args) 73.96 73.97 def xm_destroy(args): 73.98 arg_check(args,1,"destroy") 73.99 @@ -298,33 +296,28 @@ def xm_destroy(args): 73.100 from xen.xm import destroy 73.101 # ugly hack because the opt parser apparently wants 73.102 # the subcommand name just to throw it away! 73.103 - args.insert(0,"bogus") 73.104 - destroy.main(args) 73.105 + destroy.main(["bogus"] + args) 73.106 73.107 def xm_reboot(args): 73.108 arg_check(args,1,"reboot") 73.109 + from xen.xm import shutdown 73.110 # ugly hack because the opt parser apparently wants 73.111 # the subcommand name just to throw it away! 73.112 - args.insert(0,"bogus") 73.113 - args.insert(2,"-R") 73.114 - from xen.xm import shutdown 73.115 - shutdown.main(args) 73.116 + shutdown.main(["bogus", "-R"] + args) 73.117 73.118 def xm_shutdown(args): 73.119 arg_check(args,1,"shutdown") 73.120 73.121 + from xen.xm import shutdown 73.122 # ugly hack because the opt parser apparently wants 73.123 # the subcommand name just to throw it away! 73.124 - args.insert(0,"bogus") 73.125 - from xen.xm import shutdown 73.126 - shutdown.main(args) 73.127 + shutdown.main(["bogus"] + args) 73.128 73.129 def xm_sysrq(args): 73.130 from xen.xm import sysrq 73.131 # ugly hack because the opt parser apparently wants 73.132 # the subcommand name just to throw it away! 73.133 - args.insert(0,"bogus") 73.134 - sysrq.main(args) 73.135 + sysrq.main(["bogus"] + args) 73.136 73.137 def xm_pause(args): 73.138 arg_check(args, 1, "pause") 73.139 @@ -358,8 +351,8 @@ def cpu_make_map(cpulist): 73.140 73.141 return cpumap 73.142 73.143 -def xm_cpus_set(args): 73.144 - arg_check(args, 3, "cpus-set") 73.145 +def xm_vcpu_pin(args): 73.146 + arg_check(args, 3, "vcpu-pin") 73.147 73.148 dom = args[0] 73.149 vcpu = int(args[1]) 73.150 @@ -395,7 +388,7 @@ def xm_vcpu_enable(args): 73.151 73.152 from xen.xend.XendClient import server 73.153 dom = server.xend_domain(name) 73.154 - id = sxp.child_value(dom, 'id') 73.155 + id = sxp.child_value(dom, 'domid') 73.156 server.xend_domain_vcpu_hotplug(id, vcpu, 1) 73.157 73.158 def xm_vcpu_disable(args): 73.159 @@ -406,7 +399,7 @@ def xm_vcpu_disable(args): 73.160 73.161 from xen.xend.XendClient import server 73.162 dom = server.xend_domain(name) 73.163 - id = sxp.child_value(dom, 'id') 73.164 + id = sxp.child_value(dom, 'domid') 73.165 server.xend_domain_vcpu_hotplug(id, vcpu, 0) 73.166 73.167 def xm_domid(args): 73.168 @@ -414,7 +407,7 @@ def xm_domid(args): 73.169 73.170 from xen.xend.XendClient import server 73.171 dom = server.xend_domain(name) 73.172 - print sxp.child_value(dom, 'id') 73.173 + print sxp.child_value(dom, 'domid') 73.174 73.175 def xm_domname(args): 73.176 name = args[0] 73.177 @@ -423,22 +416,22 @@ def xm_domname(args): 73.178 dom = server.xend_domain(name) 73.179 print sxp.child_value(dom, 'name') 73.180 73.181 -def xm_bvt(args): 73.182 - arg_check(args, 6, "bvt") 73.183 +def xm_sched_bvt(args): 73.184 + arg_check(args, 6, "sched-bvt") 73.185 dom = args[0] 73.186 v = map(long, args[1:6]) 73.187 from xen.xend.XendClient import server 73.188 server.xend_domain_cpu_bvt_set(dom, *v) 73.189 73.190 -def xm_bvt_ctxallow(args): 73.191 - arg_check(args, 1, "bvt_ctxallow") 73.192 +def xm_sched_bvt_ctxallow(args): 73.193 + arg_check(args, 1, "sched-bvt-ctxallow") 73.194 73.195 slice = int(args[0]) 73.196 from xen.xend.XendClient import server 73.197 server.xend_node_cpu_bvt_slice_set(slice) 73.198 73.199 -def xm_sedf(args): 73.200 - arg_check(args, 6, "sedf") 73.201 +def xm_sched_sedf(args): 73.202 + arg_check(args, 6, "sched-sedf") 73.203 73.204 dom = args[0] 73.205 v = map(int, args[1:6]) 73.206 @@ -462,7 +455,7 @@ def xm_console(args): 73.207 dom = args[0] 73.208 from xen.xend.XendClient import server 73.209 info = server.xend_domain(dom) 73.210 - domid = int(sxp.child_value(info, 'id', '-1')) 73.211 + domid = int(sxp.child_value(info, 'domid', '-1')) 73.212 cmd = "/usr/libexec/xen/xenconsole %d" % domid 73.213 os.execvp('/usr/libexec/xen/xenconsole', cmd.split()) 73.214 console = sxp.child(info, "console") 73.215 @@ -482,10 +475,11 @@ its contents if the [-c|--clear] flag is 73.216 fn=set_true, default=0, 73.217 use="Clear the contents of the Xen message buffer.") 73.218 # Work around for gopts 73.219 - args.insert(0,"bogus") 73.220 - gopts.parse(args) 73.221 - if not (1 <= len(args) <= 2): 73.222 - err('Invalid arguments: ' + str(args)) 73.223 + myargs = args 73.224 + myargs.insert(0, "bogus") 73.225 + gopts.parse(myargs) 73.226 + if not (1 <= len(myargs) <= 2): 73.227 + err('Invalid arguments: ' + str(myargs)) 73.228 73.229 from xen.xend.XendClient import server 73.230 if not gopts.vals.clear: 73.231 @@ -512,6 +506,14 @@ def xm_network_list(args): 73.232 sxp.show(x) 73.233 print 73.234 73.235 +def xm_network_attach(args): 73.236 + 73.237 + print "Not implemented" 73.238 + 73.239 +def xm_network_detach(args): 73.240 + 73.241 + print "Not implemented" 73.242 + 73.243 def xm_block_list(args): 73.244 arg_check(args,1,"block-list") 73.245 dom = args[0] 73.246 @@ -520,11 +522,14 @@ def xm_block_list(args): 73.247 sxp.show(x) 73.248 print 73.249 73.250 -def xm_block_create(args): 73.251 +def xm_block_attach(args): 73.252 n = len(args) 73.253 + if n == 0: 73.254 + usage("block-attach") 73.255 + 73.256 if n < 4 or n > 5: 73.257 err("%s: Invalid argument(s)" % args[0]) 73.258 - usage("block-create") 73.259 + usage("block-attach") 73.260 73.261 dom = args[0] 73.262 vbd = ['vbd', 73.263 @@ -546,8 +551,8 @@ def xm_block_refresh(args): 73.264 from xen.xend.XendClient import server 73.265 server.xend_domain_device_refresh(dom, 'vbd', dev) 73.266 73.267 -def xm_block_destroy(args): 73.268 - arg_check(args,2,"block-destroy") 73.269 +def xm_block_detach(args): 73.270 + arg_check(args,2,"block-detach") 73.271 73.272 dom = args[0] 73.273 dev = args[1] 73.274 @@ -615,7 +620,7 @@ commands = { 73.275 "mem-max": xm_mem_max, 73.276 "mem-set": xm_mem_set, 73.277 # cpu commands 73.278 - "cpus-set": xm_cpus_set, 73.279 + "vcpu-pin": xm_vcpu_pin, 73.280 # "cpus-list": xm_cpus_list, 73.281 "vcpu-enable": xm_vcpu_enable, 73.282 "vcpu-disable": xm_vcpu_disable, 73.283 @@ -631,17 +636,19 @@ commands = { 73.284 "info": xm_info, 73.285 "log": xm_log, 73.286 # scheduler 73.287 - "bvt": xm_bvt, 73.288 - "bvt_ctxallow": xm_bvt_ctxallow, 73.289 - "sedf": xm_sedf, 73.290 + "sched-bvt": xm_sched_bvt, 73.291 + "sched-bvt-ctxallow": xm_sched_bvt_ctxallow, 73.292 + "sched-sedf": xm_sched_sedf, 73.293 # block 73.294 - "block-create": xm_block_create, 73.295 - "block-destroy": xm_block_destroy, 73.296 + "block-attach": xm_block_attach, 73.297 + "block-detach": xm_block_detach, 73.298 "block-list": xm_block_list, 73.299 "block-refresh": xm_block_refresh, 73.300 # network 73.301 "network-limit": xm_network_limit, 73.302 "network-list": xm_network_list, 73.303 + "network-attach": xm_network_attach, 73.304 + "network-detach": xm_network_detach, 73.305 # vnet 73.306 "vnet-list": xm_vnet_list, 73.307 "vnet-create": xm_vnet_create, 73.308 @@ -719,8 +726,6 @@ def main(argv=sys.argv): 73.309 sys.exit(1) 73.310 except XendError, ex: 73.311 if len(args) > 0: 73.312 - if args[0] == "bogus": 73.313 - args.remove("bogus") 73.314 handle_xend_error(argv[1], args[0], ex) 73.315 else: 73.316 print "Unexpected error:", sys.exc_info()[0]
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/tools/xenstore/testsuite/16block-watch-crash.test Wed Sep 14 15:36:10 2005 -0600 74.3 @@ -0,0 +1,13 @@ 74.4 +# Test case where blocked connection gets sent watch. 74.5 + 74.6 +mkdir /test 74.7 +watch /test token 74.8 +1 start /test 74.9 +# This will block on above 74.10 +noackwrite /test/entry create contents 74.11 +1 write /test/entry2 create contents 74.12 +1 commit 74.13 +readack 74.14 +expect /test/entry2:token 74.15 +waitwatch 74.16 +ackwatch token
75.1 --- a/tools/xenstore/xenstored_core.c Wed Sep 14 15:33:52 2005 -0600 75.2 +++ b/tools/xenstore/xenstored_core.c Wed Sep 14 15:36:10 2005 -0600 75.3 @@ -50,7 +50,6 @@ 75.4 #include "xenstored_transaction.h" 75.5 #include "xenstored_domain.h" 75.6 #include "xenctrl.h" 75.7 -#include "xen/io/domain_controller.h" 75.8 75.9 static bool verbose; 75.10 LIST_HEAD(connections);
76.1 --- a/tools/xenstore/xenstored_watch.c Wed Sep 14 15:33:52 2005 -0600 76.2 +++ b/tools/xenstore/xenstored_watch.c Wed Sep 14 15:36:10 2005 -0600 76.3 @@ -144,7 +144,7 @@ void fire_watches(struct connection *con 76.4 else 76.5 continue; 76.6 /* If connection not doing anything, queue this. */ 76.7 - if (!i->out) 76.8 + if (i->state == OK) 76.9 queue_next_event(i); 76.10 } 76.11 }
77.1 --- a/tools/xenstore/xs_test.c Wed Sep 14 15:33:52 2005 -0600 77.2 +++ b/tools/xenstore/xs_test.c Wed Sep 14 15:36:10 2005 -0600 77.3 @@ -398,12 +398,16 @@ static void do_noackwrite(unsigned int h 77.4 static void do_readack(unsigned int handle) 77.5 { 77.6 enum xsd_sockmsg_type type; 77.7 - char *ret; 77.8 + char *ret = NULL; 77.9 77.10 - ret = read_reply(handles[handle]->fd, &type, NULL); 77.11 - if (!ret) 77.12 - failed(handle); 77.13 - free(ret); 77.14 + /* Watches can have fired before reply comes: daemon detects 77.15 + * and re-transmits, so we can ignore this. */ 77.16 + do { 77.17 + free(ret); 77.18 + ret = read_reply(handles[handle]->fd, &type, NULL); 77.19 + if (!ret) 77.20 + failed(handle); 77.21 + } while (type == XS_WATCH_EVENT); 77.22 } 77.23 77.24 static void do_setid(unsigned int handle, char *id)
78.1 --- a/xen/arch/x86/mm.c Wed Sep 14 15:33:52 2005 -0600 78.2 +++ b/xen/arch/x86/mm.c Wed Sep 14 15:36:10 2005 -0600 78.3 @@ -1659,7 +1659,7 @@ int do_mmuext_op( 78.4 { 78.5 struct mmuext_op op; 78.6 int rc = 0, i = 0, okay, cpu = smp_processor_id(); 78.7 - unsigned long type, done = 0; 78.8 + unsigned long mfn, type, done = 0; 78.9 struct pfn_info *page; 78.10 struct vcpu *v = current; 78.11 struct domain *d = v->domain, *e; 78.12 @@ -1706,7 +1706,8 @@ int do_mmuext_op( 78.13 } 78.14 78.15 okay = 1; 78.16 - page = &frame_table[op.mfn]; 78.17 + mfn = op.arg1.mfn; 78.18 + page = &frame_table[mfn]; 78.19 78.20 switch ( op.cmd ) 78.21 { 78.22 @@ -1717,17 +1718,17 @@ int do_mmuext_op( 78.23 if ( shadow_mode_refcounts(FOREIGNDOM) ) 78.24 type = PGT_writable_page; 78.25 78.26 - okay = get_page_and_type_from_pagenr(op.mfn, type, FOREIGNDOM); 78.27 + okay = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM); 78.28 if ( unlikely(!okay) ) 78.29 { 78.30 - MEM_LOG("Error while pinning mfn %lx", op.mfn); 78.31 + MEM_LOG("Error while pinning mfn %lx", mfn); 78.32 break; 78.33 } 78.34 78.35 if ( unlikely(test_and_set_bit(_PGT_pinned, 78.36 &page->u.inuse.type_info)) ) 78.37 { 78.38 - MEM_LOG("Mfn %lx already pinned", op.mfn); 78.39 + MEM_LOG("Mfn %lx already pinned", mfn); 78.40 put_page_and_type(page); 78.41 okay = 0; 78.42 break; 78.43 @@ -1750,10 +1751,10 @@ int do_mmuext_op( 78.44 goto pin_page; 78.45 78.46 case MMUEXT_UNPIN_TABLE: 78.47 - if ( unlikely(!(okay = get_page_from_pagenr(op.mfn, FOREIGNDOM))) ) 78.48 + if ( unlikely(!(okay = get_page_from_pagenr(mfn, FOREIGNDOM))) ) 78.49 { 78.50 MEM_LOG("Mfn %lx bad domain (dom=%p)", 78.51 - op.mfn, page_get_owner(page)); 78.52 + mfn, page_get_owner(page)); 78.53 } 78.54 else if ( likely(test_and_clear_bit(_PGT_pinned, 78.55 &page->u.inuse.type_info)) ) 78.56 @@ -1765,28 +1766,28 @@ int do_mmuext_op( 78.57 { 78.58 okay = 0; 78.59 put_page(page); 78.60 - MEM_LOG("Mfn %lx not pinned", op.mfn); 78.61 + MEM_LOG("Mfn %lx not pinned", mfn); 78.62 } 78.63 break; 78.64 78.65 case MMUEXT_NEW_BASEPTR: 78.66 - okay = new_guest_cr3(op.mfn); 78.67 + okay = new_guest_cr3(mfn); 78.68 percpu_info[cpu].deferred_ops &= ~DOP_FLUSH_TLB; 78.69 break; 78.70 78.71 #ifdef __x86_64__ 78.72 case MMUEXT_NEW_USER_BASEPTR: 78.73 okay = get_page_and_type_from_pagenr( 78.74 - op.mfn, PGT_root_page_table, d); 78.75 + mfn, PGT_root_page_table, d); 78.76 if ( unlikely(!okay) ) 78.77 { 78.78 - MEM_LOG("Error while installing new mfn %lx", op.mfn); 78.79 + MEM_LOG("Error while installing new mfn %lx", mfn); 78.80 } 78.81 else 78.82 { 78.83 unsigned long old_mfn = 78.84 pagetable_get_pfn(v->arch.guest_table_user); 78.85 - v->arch.guest_table_user = mk_pagetable(op.mfn << PAGE_SHIFT); 78.86 + v->arch.guest_table_user = mk_pagetable(mfn << PAGE_SHIFT); 78.87 if ( old_mfn != 0 ) 78.88 put_page_and_type(&frame_table[old_mfn]); 78.89 } 78.90 @@ -1799,8 +1800,8 @@ int do_mmuext_op( 78.91 78.92 case MMUEXT_INVLPG_LOCAL: 78.93 if ( shadow_mode_enabled(d) ) 78.94 - shadow_invlpg(v, op.linear_addr); 78.95 - local_flush_tlb_one(op.linear_addr); 78.96 + shadow_invlpg(v, op.arg1.linear_addr); 78.97 + local_flush_tlb_one(op.arg1.linear_addr); 78.98 break; 78.99 78.100 case MMUEXT_TLB_FLUSH_MULTI: 78.101 @@ -1808,7 +1809,7 @@ int do_mmuext_op( 78.102 { 78.103 unsigned long vmask; 78.104 cpumask_t pmask; 78.105 - if ( unlikely(get_user(vmask, (unsigned long *)op.vcpumask)) ) 78.106 + if ( unlikely(get_user(vmask, (unsigned long *)op.arg2.vcpumask)) ) 78.107 { 78.108 okay = 0; 78.109 break; 78.110 @@ -1818,7 +1819,7 @@ int do_mmuext_op( 78.111 if ( op.cmd == MMUEXT_TLB_FLUSH_MULTI ) 78.112 flush_tlb_mask(pmask); 78.113 else 78.114 - flush_tlb_one_mask(pmask, op.linear_addr); 78.115 + flush_tlb_one_mask(pmask, op.arg1.linear_addr); 78.116 break; 78.117 } 78.118 78.119 @@ -1827,7 +1828,7 @@ int do_mmuext_op( 78.120 break; 78.121 78.122 case MMUEXT_INVLPG_ALL: 78.123 - flush_tlb_one_mask(d->cpumask, op.linear_addr); 78.124 + flush_tlb_one_mask(d->cpumask, op.arg1.linear_addr); 78.125 break; 78.126 78.127 case MMUEXT_FLUSH_CACHE: 78.128 @@ -1852,8 +1853,8 @@ int do_mmuext_op( 78.129 break; 78.130 } 78.131 78.132 - unsigned long ptr = op.linear_addr; 78.133 - unsigned long ents = op.nr_ents; 78.134 + unsigned long ptr = op.arg1.linear_addr; 78.135 + unsigned long ents = op.arg2.nr_ents; 78.136 if ( ((ptr & (PAGE_SIZE-1)) != 0) || 78.137 (ents > 8192) || 78.138 !array_access_ok(ptr, ents, LDT_ENTRY_SIZE) ) 78.139 @@ -1886,7 +1887,7 @@ int do_mmuext_op( 78.140 e = percpu_info[cpu].foreign; 78.141 if ( unlikely(e == NULL) ) 78.142 { 78.143 - MEM_LOG("No FOREIGNDOM to reassign mfn %lx to", op.mfn); 78.144 + MEM_LOG("No FOREIGNDOM to reassign mfn %lx to", mfn); 78.145 okay = 0; 78.146 break; 78.147 } 78.148 @@ -1919,7 +1920,7 @@ int do_mmuext_op( 78.149 { 78.150 MEM_LOG("Transferee has no reservation headroom (%d,%d), or " 78.151 "page is in Xen heap (%lx), or dom is dying (%ld).", 78.152 - e->tot_pages, e->max_pages, op.mfn, e->domain_flags); 78.153 + e->tot_pages, e->max_pages, mfn, e->domain_flags); 78.154 okay = 0; 78.155 goto reassign_fail; 78.156 }
79.1 --- a/xen/arch/x86/vmx.c Wed Sep 14 15:33:52 2005 -0600 79.2 +++ b/xen/arch/x86/vmx.c Wed Sep 14 15:36:10 2005 -0600 79.3 @@ -1021,7 +1021,7 @@ static int vmx_set_cr0(unsigned long val 79.4 * CR0: We don't want to lose PE and PG. 79.5 */ 79.6 paging_enabled = vmx_paging_enabled(d); 79.7 - __vmwrite(GUEST_CR0, (value | X86_CR0_PE | X86_CR0_PG)); 79.8 + __vmwrite(GUEST_CR0, value | X86_CR0_PE | X86_CR0_PG | X86_CR0_NE); 79.9 __vmwrite(CR0_READ_SHADOW, value); 79.10 79.11 VMX_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx\n", value);
80.1 --- a/xen/arch/x86/vmx_intercept.c Wed Sep 14 15:33:52 2005 -0600 80.2 +++ b/xen/arch/x86/vmx_intercept.c Wed Sep 14 15:36:10 2005 -0600 80.3 @@ -227,6 +227,7 @@ void vmx_hooks_assist(struct vcpu *d) 80.4 u64 *intr = &(sp->sp_global.pic_intr[0]); 80.5 struct vmx_virpit_t *vpit = &(d->domain->arch.vmx_platform.vmx_pit); 80.6 int rw_mode, reinit = 0; 80.7 + int oldvec = 0; 80.8 80.9 /* load init count*/ 80.10 if (p->state == STATE_IORESP_HOOK) { 80.11 @@ -235,6 +236,7 @@ void vmx_hooks_assist(struct vcpu *d) 80.12 VMX_DBG_LOG(DBG_LEVEL_1, "VMX_PIT: guest reset PIT with channel %lx!\n", (unsigned long) ((p->u.data >> 24) & 0x3) ); 80.13 rem_ac_timer(&(vpit->pit_timer)); 80.14 reinit = 1; 80.15 + oldvec = vpit->vector; 80.16 } 80.17 else 80.18 init_ac_timer(&vpit->pit_timer, pit_timer_fn, vpit, d->processor); 80.19 @@ -250,6 +252,12 @@ void vmx_hooks_assist(struct vcpu *d) 80.20 vpit->period = 1000000; 80.21 } 80.22 vpit->vector = ((p->u.data >> 16) & 0xFF); 80.23 + 80.24 + if( reinit && oldvec != vpit->vector){ 80.25 + clear_bit(oldvec, intr); 80.26 + vpit->pending_intr_nr = 0; 80.27 + } 80.28 + 80.29 vpit->channel = ((p->u.data >> 24) & 0x3); 80.30 vpit->first_injected = 0; 80.31
81.1 --- a/xen/common/schedule.c Wed Sep 14 15:33:52 2005 -0600 81.2 +++ b/xen/common/schedule.c Wed Sep 14 15:36:10 2005 -0600 81.3 @@ -211,11 +211,12 @@ void vcpu_sleep_sync(struct vcpu *v) 81.4 81.5 /* 81.6 * We can be sure that the VCPU is finally descheduled after the running 81.7 - * flag is cleared and the scheduler lock is released. 81.8 + * flag is cleared and the scheduler lock is released. We also check that 81.9 + * the domain continues to be unrunnable, in case someone else wakes it. 81.10 */ 81.11 - while ( test_bit(_VCPUF_running, &v->vcpu_flags) 81.12 - && !domain_runnable(v) 81.13 - && spin_is_locked(&schedule_data[v->processor].schedule_lock) ) 81.14 + while ( !domain_runnable(v) && 81.15 + (test_bit(_VCPUF_running, &v->vcpu_flags) || 81.16 + spin_is_locked(&schedule_data[v->processor].schedule_lock)) ) 81.17 cpu_relax(); 81.18 81.19 sync_vcpu_execstate(v);
82.1 --- a/xen/include/public/arch-x86_64.h Wed Sep 14 15:33:52 2005 -0600 82.2 +++ b/xen/include/public/arch-x86_64.h Wed Sep 14 15:36:10 2005 -0600 82.3 @@ -124,30 +124,38 @@ typedef struct trap_info { 82.4 unsigned long address; /* code offset */ 82.5 } trap_info_t; 82.6 82.7 +#ifdef __GNUC__ 82.8 +/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */ 82.9 +#define __DECL_REG(name) union { u64 r ## name, e ## name; } 82.10 +#else 82.11 +/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */ 82.12 +#define __DECL_REG(name) u64 r ## name 82.13 +#endif 82.14 + 82.15 typedef struct cpu_user_regs { 82.16 u64 r15; 82.17 u64 r14; 82.18 u64 r13; 82.19 u64 r12; 82.20 - union { u64 rbp, ebp; }; 82.21 - union { u64 rbx, ebx; }; 82.22 + __DECL_REG(bp); 82.23 + __DECL_REG(bx); 82.24 u64 r11; 82.25 u64 r10; 82.26 u64 r9; 82.27 u64 r8; 82.28 - union { u64 rax, eax; }; 82.29 - union { u64 rcx, ecx; }; 82.30 - union { u64 rdx, edx; }; 82.31 - union { u64 rsi, esi; }; 82.32 - union { u64 rdi, edi; }; 82.33 + __DECL_REG(ax); 82.34 + __DECL_REG(cx); 82.35 + __DECL_REG(dx); 82.36 + __DECL_REG(si); 82.37 + __DECL_REG(di); 82.38 u32 error_code; /* private */ 82.39 u32 entry_vector; /* private */ 82.40 - union { u64 rip, eip; }; 82.41 + __DECL_REG(ip); 82.42 u16 cs, _pad0[1]; 82.43 u8 saved_upcall_mask; 82.44 u8 _pad1[3]; 82.45 - union { u64 rflags, eflags; }; 82.46 - union { u64 rsp, esp; }; 82.47 + __DECL_REG(flags); 82.48 + __DECL_REG(sp); 82.49 u16 ss, _pad2[3]; 82.50 u16 es, _pad3[3]; 82.51 u16 ds, _pad4[3]; 82.52 @@ -155,6 +163,8 @@ typedef struct cpu_user_regs { 82.53 u16 gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_user. */ 82.54 } cpu_user_regs_t; 82.55 82.56 +#undef __DECL_REG 82.57 + 82.58 typedef u64 tsc_timestamp_t; /* RDTSC timestamp */ 82.59 82.60 /*
83.1 --- a/xen/include/public/io/domain_controller.h Wed Sep 14 15:33:52 2005 -0600 83.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 83.3 @@ -1,787 +0,0 @@ 83.4 -/****************************************************************************** 83.5 - * domain_controller.h 83.6 - * 83.7 - * Interface to server controller (e.g., 'xend'). This header file defines the 83.8 - * interface that is shared with guest OSes. 83.9 - * 83.10 - * Copyright (c) 2004, K A Fraser 83.11 - */ 83.12 - 83.13 -#ifndef __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ 83.14 -#define __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ 83.15 - 83.16 -#include "ring.h" 83.17 - 83.18 -/* 83.19 - * CONTROLLER MESSAGING INTERFACE. 83.20 - */ 83.21 - 83.22 -typedef struct control_msg { 83.23 - u8 type; /* 0: echoed in response */ 83.24 - u8 subtype; /* 1: echoed in response */ 83.25 - u8 id; /* 2: echoed in response */ 83.26 - u8 length; /* 3: number of bytes in 'msg' */ 83.27 - u8 msg[60]; /* 4: type-specific message data */ 83.28 -} control_msg_t; /* 64 bytes */ 83.29 - 83.30 -/* These are used by the control message deferred ring. */ 83.31 -#define CONTROL_RING_SIZE 8 83.32 -typedef u32 CONTROL_RING_IDX; 83.33 -#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1)) 83.34 - 83.35 -/* 83.36 - * Generate control ring structures and types. 83.37 - * 83.38 - * CONTROL_RING_MEM is currently an 8-slot ring of ctrl_msg_t structs and 83.39 - * two 32-bit counters: (64 * 8) + (2 * 4) = 520 83.40 - */ 83.41 -#define CONTROL_RING_MEM 520 83.42 -DEFINE_RING_TYPES(ctrl, control_msg_t, control_msg_t); 83.43 - 83.44 -typedef struct control_if { 83.45 - union { 83.46 - ctrl_sring_t tx_ring; /* guest -> controller */ 83.47 - char __x[CONTROL_RING_MEM]; 83.48 - }; 83.49 - union { 83.50 - ctrl_sring_t rx_ring; /* controller -> guest */ 83.51 - char __y[CONTROL_RING_MEM]; 83.52 - }; 83.53 -} control_if_t; 83.54 - 83.55 -/* 83.56 - * Top-level command types. 83.57 - */ 83.58 -#define CMSG_CONSOLE 0 /* Console */ 83.59 -#define CMSG_BLKIF_BE 1 /* Block-device backend */ 83.60 -#define CMSG_BLKIF_FE 2 /* Block-device frontend */ 83.61 -#define CMSG_NETIF_BE 3 /* Network-device backend */ 83.62 -#define CMSG_NETIF_FE 4 /* Network-device frontend */ 83.63 -#define CMSG_SHUTDOWN 6 /* Shutdown messages */ 83.64 -#define CMSG_MEM_REQUEST 7 /* Memory reservation reqs */ 83.65 -#define CMSG_USBIF_BE 8 /* USB controller backend */ 83.66 -#define CMSG_USBIF_FE 9 /* USB controller frontend */ 83.67 -#define CMSG_VCPU_HOTPLUG 10 /* Hotplug VCPU messages */ 83.68 -#define CMSG_DEBUG 11 /* PDB backend */ 83.69 - 83.70 -/****************************************************************************** 83.71 - * CONSOLE DEFINITIONS 83.72 - */ 83.73 - 83.74 -/* 83.75 - * Subtypes for console messages. 83.76 - */ 83.77 -#define CMSG_CONSOLE_DATA 0 83.78 - 83.79 - 83.80 -/****************************************************************************** 83.81 - * BLOCK-INTERFACE FRONTEND DEFINITIONS 83.82 - */ 83.83 - 83.84 -/* Messages from domain controller to guest. */ 83.85 -#define CMSG_BLKIF_FE_INTERFACE_STATUS 0 83.86 - 83.87 -/* Messages from guest to domain controller. */ 83.88 -#define CMSG_BLKIF_FE_DRIVER_STATUS 32 83.89 -#define CMSG_BLKIF_FE_INTERFACE_CONNECT 33 83.90 -#define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34 83.91 -#define CMSG_BLKIF_FE_INTERFACE_QUERY 35 83.92 - 83.93 -#ifndef blkif_vdev_t 83.94 -#define blkif_vdev_t u16 83.95 -#endif 83.96 -#define blkif_pdev_t u32 83.97 - 83.98 -/* 83.99 - * CMSG_BLKIF_FE_INTERFACE_STATUS: 83.100 - * Notify a guest about a status change on one of its block interfaces. 83.101 - * If the interface is DESTROYED or DOWN then the interface is disconnected: 83.102 - * 1. The shared-memory frame is available for reuse. 83.103 - * 2. Any unacknowledged messages pending on the interface were dropped. 83.104 - */ 83.105 -#define BLKIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */ 83.106 -#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ 83.107 -#define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */ 83.108 -#define BLKIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */ 83.109 -typedef struct blkif_fe_interface_status { 83.110 - u32 handle; 83.111 - u32 status; 83.112 - u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ 83.113 - domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */ 83.114 -} blkif_fe_interface_status_t; 83.115 - 83.116 -/* 83.117 - * CMSG_BLKIF_FE_DRIVER_STATUS: 83.118 - * Notify the domain controller that the front-end driver is DOWN or UP. 83.119 - * When the driver goes DOWN then the controller will send no more 83.120 - * status-change notifications. 83.121 - * If the driver goes DOWN while interfaces are still UP, the domain 83.122 - * will automatically take the interfaces DOWN. 83.123 - * 83.124 - * NB. The controller should not send an INTERFACE_STATUS_CHANGED message 83.125 - * for interfaces that are active when it receives an UP notification. We 83.126 - * expect that the frontend driver will query those interfaces itself. 83.127 - */ 83.128 -#define BLKIF_DRIVER_STATUS_DOWN 0 83.129 -#define BLKIF_DRIVER_STATUS_UP 1 83.130 -typedef struct blkif_fe_driver_status { 83.131 - /* IN */ 83.132 - u32 status; /* BLKIF_DRIVER_STATUS_??? */ 83.133 - /* OUT */ 83.134 - /* Driver should query interfaces [0..max_handle]. */ 83.135 - u32 max_handle; 83.136 -} blkif_fe_driver_status_t; 83.137 - 83.138 -/* 83.139 - * CMSG_BLKIF_FE_INTERFACE_CONNECT: 83.140 - * If successful, the domain controller will acknowledge with a 83.141 - * STATUS_CONNECTED message. 83.142 - */ 83.143 -typedef struct blkif_fe_interface_connect { 83.144 - u32 handle; 83.145 - unsigned long shmem_frame; 83.146 - int shmem_ref; 83.147 -} blkif_fe_interface_connect_t; 83.148 - 83.149 -/* 83.150 - * CMSG_BLKIF_FE_INTERFACE_DISCONNECT: 83.151 - * If successful, the domain controller will acknowledge with a 83.152 - * STATUS_DISCONNECTED message. 83.153 - */ 83.154 -typedef struct blkif_fe_interface_disconnect { 83.155 - u32 handle; 83.156 -} blkif_fe_interface_disconnect_t; 83.157 - 83.158 -/* 83.159 - * CMSG_BLKIF_FE_INTERFACE_QUERY: 83.160 - */ 83.161 -typedef struct blkif_fe_interface_query { 83.162 - /* IN */ 83.163 - u32 handle; 83.164 - /* OUT */ 83.165 - u32 status; 83.166 - u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ 83.167 - domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */ 83.168 -} blkif_fe_interface_query_t; 83.169 - 83.170 - 83.171 -/****************************************************************************** 83.172 - * BLOCK-INTERFACE BACKEND DEFINITIONS 83.173 - */ 83.174 - 83.175 -/* Messages from domain controller. */ 83.176 -#define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */ 83.177 -#define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */ 83.178 -#define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */ 83.179 -#define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */ 83.180 -#define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */ 83.181 -#define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */ 83.182 - 83.183 -/* Messages to domain controller. */ 83.184 -#define CMSG_BLKIF_BE_DRIVER_STATUS 32 83.185 - 83.186 -/* 83.187 - * Message request/response definitions for block-device messages. 83.188 - */ 83.189 - 83.190 -/* Non-specific 'okay' return. */ 83.191 -#define BLKIF_BE_STATUS_OKAY 0 83.192 -/* Non-specific 'error' return. */ 83.193 -#define BLKIF_BE_STATUS_ERROR 1 83.194 -/* The following are specific error returns. */ 83.195 -#define BLKIF_BE_STATUS_INTERFACE_EXISTS 2 83.196 -#define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3 83.197 -#define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4 83.198 -#define BLKIF_BE_STATUS_VBD_EXISTS 5 83.199 -#define BLKIF_BE_STATUS_VBD_NOT_FOUND 6 83.200 -#define BLKIF_BE_STATUS_OUT_OF_MEMORY 7 83.201 -#define BLKIF_BE_STATUS_PHYSDEV_NOT_FOUND 8 83.202 -#define BLKIF_BE_STATUS_MAPPING_ERROR 9 83.203 - 83.204 -/* This macro can be used to create an array of descriptive error strings. */ 83.205 -#define BLKIF_BE_STATUS_ERRORS { \ 83.206 - "Okay", \ 83.207 - "Non-specific error", \ 83.208 - "Interface already exists", \ 83.209 - "Interface not found", \ 83.210 - "Interface is still connected", \ 83.211 - "VBD already exists", \ 83.212 - "VBD not found", \ 83.213 - "Out of memory", \ 83.214 - "Extent not found for VBD", \ 83.215 - "Could not map domain memory" } 83.216 - 83.217 -/* 83.218 - * CMSG_BLKIF_BE_CREATE: 83.219 - * When the driver sends a successful response then the interface is fully 83.220 - * created. The controller will send a DOWN notification to the front-end 83.221 - * driver. 83.222 - */ 83.223 -typedef struct blkif_be_create { 83.224 - /* IN */ 83.225 - domid_t domid; /* Domain attached to new interface. */ 83.226 - u32 blkif_handle; /* Domain-specific interface handle. */ 83.227 - /* OUT */ 83.228 - u32 status; 83.229 -} blkif_be_create_t; 83.230 - 83.231 -/* 83.232 - * CMSG_BLKIF_BE_DESTROY: 83.233 - * When the driver sends a successful response then the interface is fully 83.234 - * torn down. The controller will send a DESTROYED notification to the 83.235 - * front-end driver. 83.236 - */ 83.237 -typedef struct blkif_be_destroy { 83.238 - /* IN */ 83.239 - domid_t domid; /* Identify interface to be destroyed. */ 83.240 - u32 blkif_handle; /* ...ditto... */ 83.241 - /* OUT */ 83.242 - u32 status; 83.243 -} blkif_be_destroy_t; 83.244 - 83.245 -/* 83.246 - * CMSG_BLKIF_BE_CONNECT: 83.247 - * When the driver sends a successful response then the interface is fully 83.248 - * connected. The controller will send a CONNECTED notification to the 83.249 - * front-end driver. 83.250 - */ 83.251 -typedef struct blkif_be_connect { 83.252 - /* IN */ 83.253 - domid_t domid; /* Domain attached to new interface. */ 83.254 - u32 blkif_handle; /* Domain-specific interface handle. */ 83.255 - unsigned long shmem_frame;/* Page cont. shared comms window. */ 83.256 - int shmem_ref; /* Grant table reference. */ 83.257 - u32 evtchn; /* Event channel for notifications. */ 83.258 - /* OUT */ 83.259 - u32 status; 83.260 -} blkif_be_connect_t; 83.261 - 83.262 -/* 83.263 - * CMSG_BLKIF_BE_DISCONNECT: 83.264 - * When the driver sends a successful response then the interface is fully 83.265 - * disconnected. The controller will send a DOWN notification to the front-end 83.266 - * driver. 83.267 - */ 83.268 -typedef struct blkif_be_disconnect { 83.269 - /* IN */ 83.270 - domid_t domid; /* Domain attached to new interface. */ 83.271 - u32 blkif_handle; /* Domain-specific interface handle. */ 83.272 - /* OUT */ 83.273 - u32 status; 83.274 -} blkif_be_disconnect_t; 83.275 - 83.276 -/* CMSG_BLKIF_BE_VBD_CREATE */ 83.277 -typedef struct blkif_be_vbd_create { 83.278 - /* IN */ 83.279 - domid_t domid; /* Identify blkdev interface. */ 83.280 - u32 blkif_handle; /* ...ditto... */ 83.281 - blkif_pdev_t pdevice; 83.282 - u32 dev_handle; /* Extended device id field. */ 83.283 - blkif_vdev_t vdevice; /* Interface-specific id for this VBD. */ 83.284 - u16 readonly; /* Non-zero -> VBD isn't writable. */ 83.285 - /* OUT */ 83.286 - u32 status; 83.287 -} blkif_be_vbd_create_t; 83.288 - 83.289 -/* CMSG_BLKIF_BE_VBD_DESTROY */ 83.290 -typedef struct blkif_be_vbd_destroy { 83.291 - /* IN */ 83.292 - domid_t domid; /* Identify blkdev interface. */ 83.293 - u32 blkif_handle; /* ...ditto... */ 83.294 - blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */ 83.295 - /* OUT */ 83.296 - u32 status; 83.297 -} blkif_be_vbd_destroy_t; 83.298 - 83.299 -/* 83.300 - * CMSG_BLKIF_BE_DRIVER_STATUS: 83.301 - * Notify the domain controller that the back-end driver is DOWN or UP. 83.302 - * If the driver goes DOWN while interfaces are still UP, the controller 83.303 - * will automatically send DOWN notifications. 83.304 - */ 83.305 -typedef struct blkif_be_driver_status { 83.306 - u32 status; /* BLKIF_DRIVER_STATUS_??? */ 83.307 -} blkif_be_driver_status_t; 83.308 - 83.309 - 83.310 -/****************************************************************************** 83.311 - * NETWORK-INTERFACE FRONTEND DEFINITIONS 83.312 - */ 83.313 - 83.314 -/* Messages from domain controller to guest. */ 83.315 -#define CMSG_NETIF_FE_INTERFACE_STATUS 0 83.316 - 83.317 -/* Messages from guest to domain controller. */ 83.318 -#define CMSG_NETIF_FE_DRIVER_STATUS 32 83.319 -#define CMSG_NETIF_FE_INTERFACE_CONNECT 33 83.320 -#define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34 83.321 -#define CMSG_NETIF_FE_INTERFACE_QUERY 35 83.322 - 83.323 -/* 83.324 - * CMSG_NETIF_FE_INTERFACE_STATUS: 83.325 - * Notify a guest about a status change on one of its network interfaces. 83.326 - * If the interface is CLOSED or DOWN then the interface is disconnected: 83.327 - * 1. The shared-memory frame is available for reuse. 83.328 - * 2. Any unacknowledged messgaes pending on the interface were dropped. 83.329 - */ 83.330 -#define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */ 83.331 -#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ 83.332 -#define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */ 83.333 -#define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */ 83.334 -typedef struct netif_fe_interface_status { 83.335 - u32 handle; 83.336 - u32 status; 83.337 - u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 83.338 - u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 83.339 - domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */ 83.340 -} netif_fe_interface_status_t; 83.341 - 83.342 -/* 83.343 - * CMSG_NETIF_FE_DRIVER_STATUS: 83.344 - * Notify the domain controller that the front-end driver is DOWN or UP. 83.345 - * When the driver goes DOWN then the controller will send no more 83.346 - * status-change notifications. 83.347 - * If the driver goes DOWN while interfaces are still UP, the domain 83.348 - * will automatically take the interfaces DOWN. 83.349 - * 83.350 - * NB. The controller should not send an INTERFACE_STATUS message 83.351 - * for interfaces that are active when it receives an UP notification. We 83.352 - * expect that the frontend driver will query those interfaces itself. 83.353 - */ 83.354 -#define NETIF_DRIVER_STATUS_DOWN 0 83.355 -#define NETIF_DRIVER_STATUS_UP 1 83.356 -typedef struct netif_fe_driver_status { 83.357 - /* IN */ 83.358 - u32 status; /* NETIF_DRIVER_STATUS_??? */ 83.359 - /* OUT */ 83.360 - /* Driver should query interfaces [0..max_handle]. */ 83.361 - u32 max_handle; 83.362 -} netif_fe_driver_status_t; 83.363 - 83.364 -/* 83.365 - * CMSG_NETIF_FE_INTERFACE_CONNECT: 83.366 - * If successful, the domain controller will acknowledge with a 83.367 - * STATUS_CONNECTED message. 83.368 - */ 83.369 -typedef struct netif_fe_interface_connect { 83.370 - u32 handle; 83.371 - unsigned long tx_shmem_frame; 83.372 - int tx_shmem_ref; 83.373 - unsigned long rx_shmem_frame; 83.374 - int rx_shmem_ref; 83.375 -} netif_fe_interface_connect_t; 83.376 - 83.377 -/* 83.378 - * CMSG_NETIF_FE_INTERFACE_DISCONNECT: 83.379 - * If successful, the domain controller will acknowledge with a 83.380 - * STATUS_DISCONNECTED message. 83.381 - */ 83.382 -typedef struct netif_fe_interface_disconnect { 83.383 - u32 handle; 83.384 -} netif_fe_interface_disconnect_t; 83.385 - 83.386 -/* 83.387 - * CMSG_NETIF_FE_INTERFACE_QUERY: 83.388 - */ 83.389 -typedef struct netif_fe_interface_query { 83.390 - /* IN */ 83.391 - u32 handle; 83.392 - /* OUT */ 83.393 - u32 status; 83.394 - u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 83.395 - u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */ 83.396 - domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */ 83.397 -} netif_fe_interface_query_t; 83.398 - 83.399 - 83.400 -/****************************************************************************** 83.401 - * NETWORK-INTERFACE BACKEND DEFINITIONS 83.402 - */ 83.403 - 83.404 -/* Messages from domain controller. */ 83.405 -#define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */ 83.406 -#define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */ 83.407 -#define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */ 83.408 -#define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */ 83.409 -#define CMSG_NETIF_BE_CREDITLIMIT 4 /* Limit i/f to a given credit limit. */ 83.410 - 83.411 -/* Messages to domain controller. */ 83.412 -#define CMSG_NETIF_BE_DRIVER_STATUS 32 83.413 - 83.414 -/* 83.415 - * Message request/response definitions for net-device messages. 83.416 - */ 83.417 - 83.418 -/* Non-specific 'okay' return. */ 83.419 -#define NETIF_BE_STATUS_OKAY 0 83.420 -/* Non-specific 'error' return. */ 83.421 -#define NETIF_BE_STATUS_ERROR 1 83.422 -/* The following are specific error returns. */ 83.423 -#define NETIF_BE_STATUS_INTERFACE_EXISTS 2 83.424 -#define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3 83.425 -#define NETIF_BE_STATUS_INTERFACE_CONNECTED 4 83.426 -#define NETIF_BE_STATUS_OUT_OF_MEMORY 5 83.427 -#define NETIF_BE_STATUS_MAPPING_ERROR 6 83.428 - 83.429 -/* This macro can be used to create an array of descriptive error strings. */ 83.430 -#define NETIF_BE_STATUS_ERRORS { \ 83.431 - "Okay", \ 83.432 - "Non-specific error", \ 83.433 - "Interface already exists", \ 83.434 - "Interface not found", \ 83.435 - "Interface is still connected", \ 83.436 - "Out of memory", \ 83.437 - "Could not map domain memory" } 83.438 - 83.439 -/* 83.440 - * CMSG_NETIF_BE_CREATE: 83.441 - * When the driver sends a successful response then the interface is fully 83.442 - * created. The controller will send a DOWN notification to the front-end 83.443 - * driver. 83.444 - */ 83.445 -typedef struct netif_be_create { 83.446 - /* IN */ 83.447 - domid_t domid; /* Domain attached to new interface. */ 83.448 - u32 netif_handle; /* Domain-specific interface handle. */ 83.449 - u8 mac[6]; 83.450 - u8 be_mac[6]; 83.451 - /* OUT */ 83.452 - u32 status; 83.453 -} netif_be_create_t; 83.454 - 83.455 -/* 83.456 - * CMSG_NETIF_BE_DESTROY: 83.457 - * When the driver sends a successful response then the interface is fully 83.458 - * torn down. The controller will send a DESTROYED notification to the 83.459 - * front-end driver. 83.460 - */ 83.461 -typedef struct netif_be_destroy { 83.462 - /* IN */ 83.463 - domid_t domid; /* Identify interface to be destroyed. */ 83.464 - u32 netif_handle; /* ...ditto... */ 83.465 - /* OUT */ 83.466 - u32 status; 83.467 -} netif_be_destroy_t; 83.468 - 83.469 -/* 83.470 - * CMSG_NETIF_BE_CREDITLIMIT: 83.471 - * Limit a virtual interface to "credit_bytes" bytes per "period_usec" 83.472 - * microseconds. 83.473 - */ 83.474 -typedef struct netif_be_creditlimit { 83.475 - /* IN */ 83.476 - domid_t domid; /* Domain attached to new interface. */ 83.477 - u32 netif_handle; /* Domain-specific interface handle. */ 83.478 - u32 credit_bytes; /* Vifs credit of bytes per period. */ 83.479 - u32 period_usec; /* Credit replenishment period. */ 83.480 - /* OUT */ 83.481 - u32 status; 83.482 -} netif_be_creditlimit_t; 83.483 - 83.484 -/* 83.485 - * CMSG_NETIF_BE_CONNECT: 83.486 - * When the driver sends a successful response then the interface is fully 83.487 - * connected. The controller will send a CONNECTED notification to the 83.488 - * front-end driver. 83.489 - */ 83.490 -typedef struct netif_be_connect { 83.491 - /* IN */ 83.492 - domid_t domid; /* Domain attached to new interface. */ 83.493 - u32 netif_handle; /* Domain-specific interface handle. */ 83.494 - unsigned long tx_shmem_frame;/* Page cont. tx shared comms window. */ 83.495 - int tx_shmem_ref; /* Grant reference for above */ 83.496 - unsigned long rx_shmem_frame;/* Page cont. rx shared comms window. */ 83.497 - int rx_shmem_ref; /* Grant reference for above */ 83.498 - u16 evtchn; /* Event channel for notifications. */ 83.499 - /* OUT */ 83.500 - u32 status; 83.501 -} netif_be_connect_t; 83.502 - 83.503 -/* 83.504 - * CMSG_NETIF_BE_DISCONNECT: 83.505 - * When the driver sends a successful response then the interface is fully 83.506 - * disconnected. The controller will send a DOWN notification to the front-end 83.507 - * driver. 83.508 - */ 83.509 -typedef struct netif_be_disconnect { 83.510 - /* IN */ 83.511 - domid_t domid; /* Domain attached to new interface. */ 83.512 - u32 netif_handle; /* Domain-specific interface handle. */ 83.513 - /* OUT */ 83.514 - u32 status; 83.515 -} netif_be_disconnect_t; 83.516 - 83.517 -/* 83.518 - * CMSG_NETIF_BE_DRIVER_STATUS: 83.519 - * Notify the domain controller that the back-end driver is DOWN or UP. 83.520 - * If the driver goes DOWN while interfaces are still UP, the domain 83.521 - * will automatically send DOWN notifications. 83.522 - */ 83.523 -typedef struct netif_be_driver_status { 83.524 - u32 status; /* NETIF_DRIVER_STATUS_??? */ 83.525 -} netif_be_driver_status_t; 83.526 - 83.527 - 83.528 - 83.529 -/****************************************************************************** 83.530 - * USB-INTERFACE FRONTEND DEFINITIONS 83.531 - */ 83.532 - 83.533 -/* Messages from domain controller to guest. */ 83.534 -#define CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED 0 83.535 - 83.536 -/* Messages from guest to domain controller. */ 83.537 -#define CMSG_USBIF_FE_DRIVER_STATUS_CHANGED 32 83.538 -#define CMSG_USBIF_FE_INTERFACE_CONNECT 33 83.539 -#define CMSG_USBIF_FE_INTERFACE_DISCONNECT 34 83.540 -/* 83.541 - * CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED: 83.542 - * Notify a guest about a status change on one of its block interfaces. 83.543 - * If the interface is DESTROYED or DOWN then the interface is disconnected: 83.544 - * 1. The shared-memory frame is available for reuse. 83.545 - * 2. Any unacknowledged messages pending on the interface were dropped. 83.546 - */ 83.547 -#define USBIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */ 83.548 -#define USBIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ 83.549 -#define USBIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */ 83.550 -typedef struct usbif_fe_interface_status_changed { 83.551 - u32 status; 83.552 - u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ 83.553 - domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */ 83.554 - u32 bandwidth; 83.555 - u32 num_ports; 83.556 -} usbif_fe_interface_status_changed_t; 83.557 - 83.558 -/* 83.559 - * CMSG_USBIF_FE_DRIVER_STATUS_CHANGED: 83.560 - * Notify the domain controller that the front-end driver is DOWN or UP. 83.561 - * When the driver goes DOWN then the controller will send no more 83.562 - * status-change notifications. 83.563 - * If the driver goes DOWN while interfaces are still UP, the domain 83.564 - * will automatically take the interfaces DOWN. 83.565 - * 83.566 - * NB. The controller should not send an INTERFACE_STATUS_CHANGED message 83.567 - * for interfaces that are active when it receives an UP notification. We 83.568 - * expect that the frontend driver will query those interfaces itself. 83.569 - */ 83.570 -#define USBIF_DRIVER_STATUS_DOWN 0 83.571 -#define USBIF_DRIVER_STATUS_UP 1 83.572 -typedef struct usbif_fe_driver_status_changed { 83.573 - /* IN */ 83.574 - u32 status; /* USBIF_DRIVER_STATUS_??? */ 83.575 -} usbif_fe_driver_status_changed_t; 83.576 - 83.577 -/* 83.578 - * CMSG_USBIF_FE_INTERFACE_CONNECT: 83.579 - * If successful, the domain controller will acknowledge with a 83.580 - * STATUS_CONNECTED message. 83.581 - */ 83.582 -typedef struct usbif_fe_interface_connect { 83.583 - unsigned long shmem_frame; 83.584 -} usbif_fe_interface_connect_t; 83.585 - 83.586 -/* 83.587 - * CMSG_USBIF_FE_INTERFACE_DISCONNECT: 83.588 - * If successful, the domain controller will acknowledge with a 83.589 - * STATUS_DISCONNECTED message. 83.590 - */ 83.591 -typedef struct usbif_fe_interface_disconnect { 83.592 - int dummy; /* make struct non-empty */ 83.593 -} usbif_fe_interface_disconnect_t; 83.594 - 83.595 - 83.596 -/****************************************************************************** 83.597 - * USB-INTERFACE BACKEND DEFINITIONS 83.598 - */ 83.599 - 83.600 -/* Messages from domain controller. */ 83.601 -#define CMSG_USBIF_BE_CREATE 0 /* Create a new block-device interface. */ 83.602 -#define CMSG_USBIF_BE_DESTROY 1 /* Destroy a block-device interface. */ 83.603 -#define CMSG_USBIF_BE_CONNECT 2 /* Connect i/f to remote driver. */ 83.604 -#define CMSG_USBIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */ 83.605 -#define CMSG_USBIF_BE_CLAIM_PORT 4 /* Claim host port for a domain. */ 83.606 -#define CMSG_USBIF_BE_RELEASE_PORT 5 /* Release host port. */ 83.607 -/* Messages to domain controller. */ 83.608 -#define CMSG_USBIF_BE_DRIVER_STATUS_CHANGED 32 83.609 - 83.610 -/* Non-specific 'okay' return. */ 83.611 -#define USBIF_BE_STATUS_OKAY 0 83.612 -/* Non-specific 'error' return. */ 83.613 -#define USBIF_BE_STATUS_ERROR 1 83.614 -/* The following are specific error returns. */ 83.615 -#define USBIF_BE_STATUS_INTERFACE_EXISTS 2 83.616 -#define USBIF_BE_STATUS_INTERFACE_NOT_FOUND 3 83.617 -#define USBIF_BE_STATUS_INTERFACE_CONNECTED 4 83.618 -#define USBIF_BE_STATUS_OUT_OF_MEMORY 7 83.619 -#define USBIF_BE_STATUS_MAPPING_ERROR 9 83.620 - 83.621 -/* This macro can be used to create an array of descriptive error strings. */ 83.622 -#define USBIF_BE_STATUS_ERRORS { \ 83.623 - "Okay", \ 83.624 - "Non-specific error", \ 83.625 - "Interface already exists", \ 83.626 - "Interface not found", \ 83.627 - "Interface is still connected", \ 83.628 - "Out of memory", \ 83.629 - "Could not map domain memory" } 83.630 - 83.631 -/* 83.632 - * CMSG_USBIF_BE_CREATE: 83.633 - * When the driver sends a successful response then the interface is fully 83.634 - * created. The controller will send a DOWN notification to the front-end 83.635 - * driver. 83.636 - */ 83.637 -typedef struct usbif_be_create { 83.638 - /* IN */ 83.639 - domid_t domid; /* Domain attached to new interface. */ 83.640 - /* OUT */ 83.641 - u32 status; 83.642 -} usbif_be_create_t; 83.643 - 83.644 -/* 83.645 - * CMSG_USBIF_BE_DESTROY: 83.646 - * When the driver sends a successful response then the interface is fully 83.647 - * torn down. The controller will send a DESTROYED notification to the 83.648 - * front-end driver. 83.649 - */ 83.650 -typedef struct usbif_be_destroy { 83.651 - /* IN */ 83.652 - domid_t domid; /* Identify interface to be destroyed. */ 83.653 - /* OUT */ 83.654 - u32 status; 83.655 -} usbif_be_destroy_t; 83.656 - 83.657 -/* 83.658 - * CMSG_USBIF_BE_CONNECT: 83.659 - * When the driver sends a successful response then the interface is fully 83.660 - * connected. The controller will send a CONNECTED notification to the 83.661 - * front-end driver. 83.662 - */ 83.663 -typedef struct usbif_be_connect { 83.664 - /* IN */ 83.665 - domid_t domid; /* Domain attached to new interface. */ 83.666 - unsigned long shmem_frame;/* Page cont. shared comms window. */ 83.667 - u32 evtchn; /* Event channel for notifications. */ 83.668 - u32 bandwidth; /* Bandwidth allocated for isoch / int - us 83.669 - * per 1ms frame (ie between 0 and 900 or 800 83.670 - * depending on USB version). */ 83.671 - /* OUT */ 83.672 - u32 status; 83.673 -} usbif_be_connect_t; 83.674 - 83.675 -/* 83.676 - * CMSG_USBIF_BE_DISCONNECT: 83.677 - * When the driver sends a successful response then the interface is fully 83.678 - * disconnected. The controller will send a DOWN notification to the front-end 83.679 - * driver. 83.680 - */ 83.681 -typedef struct usbif_be_disconnect { 83.682 - /* IN */ 83.683 - domid_t domid; /* Domain attached to new interface. */ 83.684 - /* OUT */ 83.685 - u32 status; 83.686 -} usbif_be_disconnect_t; 83.687 - 83.688 -/* 83.689 - * CMSG_USBIF_BE_DRIVER_STATUS_CHANGED: 83.690 - * Notify the domain controller that the back-end driver is DOWN or UP. 83.691 - * If the driver goes DOWN while interfaces are still UP, the controller 83.692 - * will automatically send DOWN notifications. 83.693 - */ 83.694 -typedef struct usbif_be_driver_status_changed { 83.695 - u32 status; /* USBIF_DRIVER_STATUS_??? */ 83.696 -} usbif_be_driver_status_changed_t; 83.697 - 83.698 -#define USB_PATH_LEN 16 83.699 - 83.700 -/* 83.701 - * CMSG_USBIF_BE_CLAIM_PORT: 83.702 - * Instruct the backend driver to claim any device plugged into the specified 83.703 - * host port and to allow the specified domain to control that port. 83.704 - */ 83.705 -typedef struct usbif_be_claim_port { 83.706 - /* IN */ 83.707 - domid_t domid; /* which domain */ 83.708 - u32 usbif_port; /* port on the virtual root hub */ 83.709 - u32 status; /* status of operation */ 83.710 - char path[USB_PATH_LEN]; /* Currently specified in the Linux style - may need to be 83.711 - * converted to some OS-independent format at some stage. */ 83.712 -} usbif_be_claim_port_t; 83.713 - 83.714 -/* 83.715 - * CMSG_USBIF_BE_RELEASE_PORT: 83.716 - * Instruct the backend driver to release any device plugged into the specified 83.717 - * host port. 83.718 - */ 83.719 -typedef struct usbif_be_release_port { 83.720 - char path[USB_PATH_LEN]; 83.721 -} usbif_be_release_port_t; 83.722 - 83.723 -/****************************************************************************** 83.724 - * SHUTDOWN DEFINITIONS 83.725 - */ 83.726 - 83.727 -/* 83.728 - * Subtypes for shutdown messages. 83.729 - */ 83.730 -#define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */ 83.731 -#define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */ 83.732 -#define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */ 83.733 - /* SHUTDOWN_suspend. */ 83.734 -#define CMSG_SHUTDOWN_SYSRQ 3 83.735 - 83.736 -typedef struct shutdown_sysrq { 83.737 - char key; /* sysrq key */ 83.738 -} shutdown_sysrq_t; 83.739 - 83.740 -/****************************************************************************** 83.741 - * VCPU HOTPLUG CONTROLS 83.742 - */ 83.743 - 83.744 -/* 83.745 - * Subtypes for shutdown messages. 83.746 - */ 83.747 -#define CMSG_VCPU_HOTPLUG_OFF 0 /* turn vcpu off */ 83.748 -#define CMSG_VCPU_HOTPLUG_ON 1 /* turn vcpu on */ 83.749 - 83.750 -/* 83.751 - * CMSG_VCPU_HOTPLUG: 83.752 - * Indicate which vcpu's state should change 83.753 - */ 83.754 -typedef struct vcpu_hotplug { 83.755 - u32 vcpu; /* VCPU's whose state will change */ 83.756 - u32 status; /* Return code indicates success or failure. */ 83.757 -} vcpu_hotplug_t; 83.758 - 83.759 -/****************************************************************************** 83.760 - * MEMORY CONTROLS 83.761 - */ 83.762 - 83.763 -#define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */ 83.764 - 83.765 -/* 83.766 - * CMSG_MEM_REQUEST: 83.767 - * Request that the domain change its memory reservation. 83.768 - */ 83.769 -typedef struct mem_request { 83.770 - /* OUT */ 83.771 - u32 target; /* Target memory reservation in pages. */ 83.772 - /* IN */ 83.773 - u32 status; /* Return code indicates success or failure. */ 83.774 -} mem_request_t; 83.775 - 83.776 - 83.777 -/****************************************************************************** 83.778 - * PDB INTERFACE DEFINITIONS 83.779 - */ 83.780 - 83.781 -#define CMSG_DEBUG_CONNECTION_STATUS 0 83.782 -typedef struct pdb_Connection { 83.783 -#define PDB_CONNECTION_STATUS_UP 1 83.784 -#define PDB_CONNECTION_STATUS_DOWN 2 83.785 - u32 status; 83.786 - unsigned long ring; /* status: UP */ 83.787 - u32 evtchn; /* status: UP */ 83.788 -} pdb_connection_t, *pdb_connection_p; 83.789 - 83.790 -#endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */
84.1 --- a/xen/include/public/io/ring.h Wed Sep 14 15:33:52 2005 -0600 84.2 +++ b/xen/include/public/io/ring.h Wed Sep 14 15:36:10 2005 -0600 84.3 @@ -87,7 +87,7 @@ struct __name##_back_ring { 84.4 /* Syntactic sugar */ \ 84.5 typedef struct __name##_sring __name##_sring_t; \ 84.6 typedef struct __name##_front_ring __name##_front_ring_t; \ 84.7 -typedef struct __name##_back_ring __name##_back_ring_t; 84.8 +typedef struct __name##_back_ring __name##_back_ring_t 84.9 84.10 /* 84.11 * Macros for manipulating rings.
85.1 --- a/xen/include/public/xen.h Wed Sep 14 15:33:52 2005 -0600 85.2 +++ b/xen/include/public/xen.h Wed Sep 14 15:36:10 2005 -0600 85.3 @@ -174,13 +174,13 @@ struct mmuext_op { 85.4 unsigned long mfn; 85.5 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ 85.6 unsigned long linear_addr; 85.7 - }; 85.8 + } arg1; 85.9 union { 85.10 /* SET_LDT */ 85.11 unsigned int nr_ents; 85.12 /* TLB_FLUSH_MULTI, INVLPG_MULTI */ 85.13 void *vcpumask; 85.14 - }; 85.15 + } arg2; 85.16 }; 85.17 #endif 85.18