ia64/xen-unstable

changeset 2799:3f929065a1d1

bitkeeper revision 1.1159.1.316 (418580d5gYF87eBU_ebP1s7cMleu3g)

Merge ssh://srg//auto/groups/xeno/BK/xeno.bk
into anvil.research:/home/irchomes/mwilli2/xen-dmesg-clear.bk
author mwilli2@anvil.research
date Mon Nov 01 00:18:29 2004 +0000 (2004-11-01)
parents 7aa5dc139305 0b62fc951ef8
children 5697adabb08f
files .rootkeys BitKeeper/etc/ignore COPYING README TODO docs/misc/blkif-drivers-explained.txt docs/src/interface.tex docs/src/user.tex extras/mini-os/Makefile extras/mini-os/h/events.h extras/mini-os/h/hypervisor.h extras/mini-os/h/os.h linux-2.4.27-xen-sparse/arch/xen/Makefile linux-2.4.27-xen-sparse/arch/xen/drivers/blkif/frontend/common.h linux-2.4.27-xen-sparse/arch/xen/kernel/pci-pc.c linux-2.4.27-xen-sparse/arch/xen/kernel/process.c linux-2.4.27-xen-sparse/arch/xen/kernel/setup.c linux-2.4.27-xen-sparse/arch/xen/kernel/time.c linux-2.4.27-xen-sparse/include/asm-xen/page.h linux-2.4.27-xen-sparse/include/asm-xen/segment.h linux-2.4.27-xen-sparse/mkbuildtree linux-2.6.9-xen-sparse/arch/xen/Makefile linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig linux-2.6.9-xen-sparse/arch/xen/i386/kernel/entry.S linux-2.6.9-xen-sparse/arch/xen/i386/kernel/head.S linux-2.6.9-xen-sparse/arch/xen/i386/kernel/ioport.c linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6.9-xen-sparse/arch/xen/i386/pci/direct.c linux-2.6.9-xen-sparse/arch/xen/i386/pci/irq.c linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6.9-xen-sparse/arch/xen/kernel/reboot.c linux-2.6.9-xen-sparse/drivers/xen/blkback/common.h linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h linux-2.6.9-xen-sparse/drivers/xen/console/console.c linux-2.6.9-xen-sparse/drivers/xen/netback/common.h linux-2.6.9-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6.9-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/page.h linux-2.6.9-xen-sparse/include/asm-xen/evtchn.h linux-2.6.9-xen-sparse/include/asm-xen/gnttab.h linux-2.6.9-xen-sparse/include/asm-xen/hypervisor.h linux-2.6.9-xen-sparse/mkbuildtree netbsd-2.0-xen-sparse/mkbuildtree netbsd-2.0-xen-sparse/sys/arch/xen/include/hypervisor.h netbsd-2.0-xen-sparse/sys/arch/xen/include/xen.h netbsd-2.0-xen-sparse/sys/arch/xen/xen/xenkbc.c tools/Make.defs tools/libxc/Makefile tools/libxc/xc.h tools/libxc/xc_domain.c tools/libxc/xc_evtchn.c tools/libxc/xc_linux_save.c tools/libxc/xc_misc.c tools/libxc/xc_private.h tools/misc/Makefile tools/python/setup.py tools/python/xen/lowlevel/xu/xu.c tools/xentrace/Makefile tools/xentrace/xentrace.c tools/xfrd/Makefile xen/COPYING xen/Makefile xen/Rules.mk xen/arch/x86/boot/x86_32.S xen/arch/x86/boot/x86_64.S xen/arch/x86/dom0_ops.c xen/arch/x86/pdb-stub.c xen/arch/x86/trampoline.S xen/arch/x86/x86_32/entry.S xen/common/debug-linux.c xen/common/debug.c xen/common/dom0_ops.c xen/common/domain.c xen/common/event_channel.c xen/common/kernel.c xen/common/physdev.c xen/common/sched_atropos.c xen/common/sched_rrobin.c xen/common/schedule.c xen/common/trace.c xen/include/asm-x86/mm.h xen/include/asm-x86/pdb.h xen/include/asm-x86/processor.h xen/include/hypervisor-ifs/COPYING xen/include/hypervisor-ifs/arch-x86_32.h xen/include/hypervisor-ifs/arch-x86_64.h xen/include/hypervisor-ifs/dom0_ops.h xen/include/hypervisor-ifs/event_channel.h xen/include/hypervisor-ifs/grant_table.h xen/include/hypervisor-ifs/hypervisor-if.h xen/include/hypervisor-ifs/io/blkif.h xen/include/hypervisor-ifs/io/domain_controller.h xen/include/hypervisor-ifs/io/netif.h xen/include/hypervisor-ifs/physdev.h xen/include/hypervisor-ifs/sched_ctl.h xen/include/hypervisor-ifs/trace.h xen/include/public/COPYING xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/event_channel.h xen/include/public/grant_table.h xen/include/public/io/blkif.h xen/include/public/io/domain_controller.h xen/include/public/io/netif.h xen/include/public/physdev.h xen/include/public/sched_ctl.h xen/include/public/trace.h xen/include/public/xen.h xen/include/xen/grant_table.h xen/include/xen/sched.h xen/include/xen/time.h xen/include/xen/trace.h
line diff
     1.1 --- a/.rootkeys	Mon Nov 01 00:14:22 2004 +0000
     1.2 +++ b/.rootkeys	Mon Nov 01 00:18:29 2004 +0000
     1.3 @@ -5,7 +5,6 @@ 3ddb79c9_hgSp-gsQm8HqWM_9W3B_A BitKeeper
     1.4  4177dbbfqsi01p2zgZa0geUOgScONw COPYING
     1.5  3eb788d6Kleck_Cut0ouGneviGzliQ Makefile
     1.6  3f5ef5a24IaQasQE2tyMxrfxskMmvw README
     1.7 -3f69d8abYB1vMyD_QVDvzxy5Zscf1A TODO
     1.8  3f9e7d53iC47UnlfORp9iC1vai6kWw docs/Makefile
     1.9  3f9e7d60PWZJeVh5xdnk0nLUdxlqEA docs/figs/xenlogo.eps
    1.10  418273f3YZUyGIrNbERVAPFeOd9gww docs/figs/xenserver.obj
    1.11 @@ -732,19 +731,19 @@ 404f1badfXZJZ2sU8sh9PS2EZvd19Q xen/inclu
    1.12  404f1bb86rAXB3aLS1vYdcqpJiEcyg xen/include/asm-x86/x86_64/ptrace.h
    1.13  40e1966azOJZfNI6Ilthe6Q-T3Hewg xen/include/asm-x86/x86_64/string.h
    1.14  404f1bc4tWkB9Qr8RkKtZGW5eMQzhw xen/include/asm-x86/x86_64/uaccess.h
    1.15 -400304fcmRQmDdFYEzDh0wcBba9alg xen/include/hypervisor-ifs/COPYING
    1.16 -404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/include/hypervisor-ifs/arch-x86_32.h
    1.17 -404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64.h
    1.18 -3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/hypervisor-ifs/dom0_ops.h
    1.19 -403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/hypervisor-ifs/event_channel.h
    1.20 -4121d149udGfSUGhn3k1ECz0bM31nQ xen/include/hypervisor-ifs/grant_table.h
    1.21 -3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
    1.22 -40f5623bqoi4GEoBiiUc6TZk1HjsMg xen/include/hypervisor-ifs/io/blkif.h
    1.23 -40dc4076pVeE1kEEWzcUaNZin65kCA xen/include/hypervisor-ifs/io/domain_controller.h
    1.24 -40f5623cTZ80EwjWUBlh44A9F9i_Lg xen/include/hypervisor-ifs/io/netif.h
    1.25 -4051db79512nOCGweabrFWO2M2h5ng xen/include/hypervisor-ifs/physdev.h
    1.26 -40589968wmhPmV5-ENbBYmMjnedgKw xen/include/hypervisor-ifs/sched_ctl.h
    1.27 -404f3d2eR2Owk-ZcGOx9ULGHg3nrww xen/include/hypervisor-ifs/trace.h
    1.28 +400304fcmRQmDdFYEzDh0wcBba9alg xen/include/public/COPYING
    1.29 +404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/include/public/arch-x86_32.h
    1.30 +404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/public/arch-x86_64.h
    1.31 +3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/public/dom0_ops.h
    1.32 +403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/public/event_channel.h
    1.33 +4121d149udGfSUGhn3k1ECz0bM31nQ xen/include/public/grant_table.h
    1.34 +40f5623bqoi4GEoBiiUc6TZk1HjsMg xen/include/public/io/blkif.h
    1.35 +40dc4076pVeE1kEEWzcUaNZin65kCA xen/include/public/io/domain_controller.h
    1.36 +40f5623cTZ80EwjWUBlh44A9F9i_Lg xen/include/public/io/netif.h
    1.37 +4051db79512nOCGweabrFWO2M2h5ng xen/include/public/physdev.h
    1.38 +40589968wmhPmV5-ENbBYmMjnedgKw xen/include/public/sched_ctl.h
    1.39 +404f3d2eR2Owk-ZcGOx9ULGHg3nrww xen/include/public/trace.h
    1.40 +3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/public/xen.h
    1.41  3e397e66m2tO3s-J8Jnr7Ws_tGoPTg xen/include/xen/ac_timer.h
    1.42  40715b2epYl2jBbxzz9CI2rgIca7Zg xen/include/xen/acpi.h
    1.43  3ddb79c0c0cX_DZE209-Bb-Rx1v-Aw xen/include/xen/cache.h
     2.1 --- a/BitKeeper/etc/ignore	Mon Nov 01 00:14:22 2004 +0000
     2.2 +++ b/BitKeeper/etc/ignore	Mon Nov 01 00:18:29 2004 +0000
     2.3 @@ -13,43 +13,13 @@ TAGS
     2.4  Twisted-1.3.0
     2.5  Twisted-1.3.0.tar.gz
     2.6  docs/*.aux
     2.7 +docs/*.dvi
     2.8  docs/*.log
     2.9  docs/*.pdf
    2.10  docs/*.ps
    2.11 -docs/*.dvi
    2.12  docs/*.toc
    2.13 +docs/figs/xenserver.eps
    2.14  docs/html/*
    2.15 -extras/mini-os/h/hypervisor-ifs
    2.16 -install
    2.17 -install/*
    2.18 -linux-*-xen0/*
    2.19 -linux-*-xenU/*
    2.20 -linux-xen-sparse
    2.21 -netbsd-*-xen0
    2.22 -netbsd-*-xenU
    2.23 -netbsd-*-tools
    2.24 -patches/*
    2.25 -tools/*/build/lib*/*.py
    2.26 -tools/balloon/balloon
    2.27 -tools/check/.*
    2.28 -tools/misc/miniterm/miniterm
    2.29 -tools/misc/xen_cpuperf
    2.30 -tools/web-shutdown.tap
    2.31 -tools/xentrace/xentrace
    2.32 -tools/xfrd/xfrd
    2.33 -xen/arch/x86/boot/mkelf32
    2.34 -xen/drivers/pci/classlist.h
    2.35 -xen/drivers/pci/devlist.h
    2.36 -xen/drivers/pci/gen-devlist
    2.37 -xen/figlet/figlet
    2.38 -xen/include/asm
    2.39 -xen/include/hypervisor-ifs/arch
    2.40 -xen/include/xen/compile.h
    2.41 -xen/tools/elf-reloc
    2.42 -xen/tools/figlet/figlet
    2.43 -xen/xen
    2.44 -xen/xen-syms
    2.45 -xen/xen.*
    2.46  docs/interface/WARNINGS
    2.47  docs/interface/images.pl
    2.48  docs/interface/images.tex
    2.49 @@ -78,4 +48,36 @@ docs/xend/internals.pl
    2.50  docs/xend/labels.pl
    2.51  docs/xend/xend.css
    2.52  docs/xend/xend.html
    2.53 -docs/figs/xenserver.eps
    2.54 +extras/mini-os/h/hypervisor-ifs
    2.55 +install
    2.56 +install/*
    2.57 +linux-*-xen0/*
    2.58 +linux-*-xenU/*
    2.59 +linux-xen-sparse
    2.60 +netbsd-*-tools
    2.61 +netbsd-*-xen0
    2.62 +netbsd-*-xenU
    2.63 +patches/*
    2.64 +pristine-*
    2.65 +tools/*/build/lib*/*.py
    2.66 +tools/balloon/balloon
    2.67 +tools/check/.*
    2.68 +tools/libxc/xen
    2.69 +tools/misc/miniterm/miniterm
    2.70 +tools/misc/xen_cpuperf
    2.71 +tools/web-shutdown.tap
    2.72 +tools/xentrace/xentrace
    2.73 +tools/xfrd/xfrd
    2.74 +xen/arch/x86/boot/mkelf32
    2.75 +xen/drivers/pci/classlist.h
    2.76 +xen/drivers/pci/devlist.h
    2.77 +xen/drivers/pci/gen-devlist
    2.78 +xen/figlet/figlet
    2.79 +xen/include/asm
    2.80 +xen/include/hypervisor-ifs/arch
    2.81 +xen/include/xen/compile.h
    2.82 +xen/tools/elf-reloc
    2.83 +xen/tools/figlet/figlet
    2.84 +xen/xen
    2.85 +xen/xen-syms
    2.86 +xen/xen.*
     3.1 --- a/COPYING	Mon Nov 01 00:14:22 2004 +0000
     3.2 +++ b/COPYING	Mon Nov 01 00:18:29 2004 +0000
     3.3 @@ -17,12 +17,11 @@ Xen guests, certain files in this reposi
     3.4  GPL when distributed separately or included in software packages
     3.5  outside this repository. Instead we specify a much more relaxed
     3.6  BSD-style license. Affected files include the Xen interface headers
     3.7 -(xen/include/hypervisor-ifs/COPYING), and various drivers, support
     3.8 -functions and header files within the Linux sparse source trees. In
     3.9 -all such cases, license terms are stated at the top of the file or in
    3.10 -a COPYING file in the same directory. Note that _any_ file that is
    3.11 -modified and then distributed within a Linux kernel is still subject
    3.12 -to the GNU GPL!
    3.13 +(xen/include/public/COPYING), and various drivers, support functions
    3.14 +and header files within the Linux sparse source trees. In all such
    3.15 +cases, license terms are stated at the top of the file or in a COPYING
    3.16 +file in the same directory. Note that _any_ file that is modified and
    3.17 +then distributed within a Linux kernel is still subject to the GNU GPL.
    3.18  
    3.19   -- Keir Fraser (on behalf of the Xen team)
    3.20  
     4.1 --- a/README	Mon Nov 01 00:14:22 2004 +0000
     4.2 +++ b/README	Mon Nov 01 00:18:29 2004 +0000
     4.3 @@ -11,7 +11,6 @@ University of Cambridge Computer Laborat
     4.4  29 October 2004
     4.5  
     4.6  http://www.cl.cam.ac.uk/netos/xen/
     4.7 -http://www.cl.cam.ac.uk/netos/xen/
     4.8  
     4.9  About the Xen Virtual Machine Monitor
    4.10  =====================================
     5.1 --- a/TODO	Mon Nov 01 00:14:22 2004 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,60 +0,0 @@
     5.4 -Future plans and enhancements
     5.5 -=============================
     5.6 -
     5.7 -For up-to-date details of features currently under implementation,
     5.8 -visit the Xen project roadmap at:
     5.9 -http://www.cl.cam.ac.uk/Research/SRG/netos/xen/roadmap.html
    5.10 -
    5.11 -IO enhancements
    5.12 ----------------
    5.13 -There are also a number of memory management enhancements that didn't
    5.14 -make this release: We have plans for a "universal buffer cache" that
    5.15 -enables otherwise unused system memory to be used by domains in a
    5.16 -read-only fashion.
    5.17 -
    5.18 -Disk scheduling
    5.19 ----------------
    5.20 -The current disk scheduler is rather simplistic (batch round robin),
    5.21 -and could be replaced by e.g. Cello if we have QoS isolation
    5.22 -problems. For most things it seems to work OK, but there's currently
    5.23 -no service differentiation or weighting.
    5.24 -
    5.25 -Improved load-balancing
    5.26 ------------------------
    5.27 -Currently, although Xen runs on SMP and SMT (hyperthreaded) machines,
    5.28 -the scheduling is far from smart -- domains are currently statically
    5.29 -assigned to a CPU when they are created (in a round robin fashion).
    5.30 -We'd like to see a user-space load-balancing daemon that can shift
    5.31 -domains between CPUs as their activity changes.
    5.32 -
    5.33 -Multiprocessor guest VMs
    5.34 -------------------------
    5.35 -Xen currently only supports uniprocessor guest OSes. We have designed
    5.36 -the Xen interface with MP guests in mind, and plan to build an MP
    5.37 -Linux guest in due course. Basically, an MP guest would consist of
    5.38 -multiple scheduling domains (one per CPU) sharing a single memory
    5.39 -protection domain. The only extra complexity for the Xen VM system is
    5.40 -ensuring that when a page transitions from holding a page table or
    5.41 -page directory to a write-able page, we must ensure that no other CPU
    5.42 -still has the page in its TLB to ensure memory system integrity.  One
    5.43 -other issue for supporting MP guests is that we'll need some sort of
    5.44 -CPU gang scheduler, which will require some research.
    5.45 -
    5.46 -Cluster management
    5.47 -------------------
    5.48 -There have been discussions regarding a unified cluster controller
    5.49 -for Xen deployments.  This would leverage the existing features of
    5.50 -Xen to present a uniform control interface for managing a cluster
    5.51 -as a pool of resources, rather than a set of completely distinct
    5.52 -machines.
    5.53 -
    5.54 -64-bit x86
    5.55 -----------
    5.56 -Xen can currently use up to 4GB of memory. It's possible for 32-bit
    5.57 -x86 machines to address up to 64GB, but it requires using a different
    5.58 -page table format that would be rather tedious to support. Our
    5.59 -preferred approach is to virtualize 64-bit x86 (x86/64), as supported
    5.60 -by modern AMD and Intel processors. The large address space provided
    5.61 -by a 64-bit execution model greatly simplifies support for large-memory
    5.62 -configurations. Our implementation for x86/64 is in progress and should
    5.63 -feature in our next major release.
     6.1 --- a/docs/misc/blkif-drivers-explained.txt	Mon Nov 01 00:14:22 2004 +0000
     6.2 +++ b/docs/misc/blkif-drivers-explained.txt	Mon Nov 01 00:18:29 2004 +0000
     6.3 @@ -244,8 +244,8 @@ records.  Pointers may only advance, and
     6.4  By adopting the convention that every request will receive a response,
     6.5  not all four pointers need be shared and flow control on the ring
     6.6  becomes very easy to manage.  Each domain manages its own
     6.7 -consumer pointer, and the two producer pointers are visible to both (Xen/include/hypervisor-ifs/io/blkif.h):
     6.8 -
     6.9 +consumer pointer, and the two producer pointers are visible to both
    6.10 +(xen/include/public/io/blkif.h):
    6.11  
    6.12  
    6.13  /* NB. Ring size must be small enough for sizeof(blkif_ring_t) <=PAGE_SIZE.*/
     7.1 --- a/docs/src/interface.tex	Mon Nov 01 00:14:22 2004 +0000
     7.2 +++ b/docs/src/interface.tex	Mon Nov 01 00:18:29 2004 +0000
     7.3 @@ -111,12 +111,16 @@ direct access to CR3 and is not permitte
     7.4  EFLAGS. Guest OSes use \emph{hypercalls} to invoke operations in Xen; 
     7.5  these are analagous to system calls but occur from ring 1 to ring 0. 
     7.6  
     7.7 +A list of all hypercalls is given in Appendix~\ref{a:hypercalls}. 
     7.8 +
     7.9 +
    7.10  
    7.11  \section{Exceptions}
    7.12  
    7.13 -The IDT is virtualised by submitting to Xen a table of trap handlers.
    7.14 -Most trap handlers are identical to native x86 handlers, although the
    7.15 -page-fault handler is somewhat different.
    7.16 +A virtual IDT is provided --- a domain can submit a table of trap
    7.17 +handlers to Xen via the {\tt set\_trap\_table()} hypercall.  Most trap
    7.18 +handlers are identical to native x86 handlers, although the page-fault
    7.19 +handler is somewhat different.
    7.20  
    7.21  
    7.22  \section{Interrupts and events}
    7.23 @@ -186,7 +190,8 @@ currently executing domain every 10ms.  
    7.24  timer event whenever a domain is scheduled; this allows the guest OS
    7.25  to adjust for the time that has passed while it has been inactive.  In
    7.26  addition, Xen allows each domain to request that they receive a timer
    7.27 -event sent at a specified system time.  Guest OSes may use this timer to
    7.28 +event sent at a specified system time by using the {\tt
    7.29 +set\_timer\_op()} hypercall.  Guest OSes may use this timer to
    7.30  implement timeout values when they block.
    7.31  
    7.32  
    7.33 @@ -199,7 +204,8 @@ hardware.
    7.34  
    7.35  \section{Memory Allocation}
    7.36  
    7.37 -Xen resides within a small fixed portion of physical memory and
    7.38 +
    7.39 +Xen resides within a small fixed portion of physical memory; it also
    7.40  reserves the top 64MB of every virtual address space. The remaining
    7.41  physical memory is available for allocation to domains at a page
    7.42  granularity.  Xen tracks the ownership and use of each page, which
    7.43 @@ -210,6 +216,52 @@ A guest OS may run a `balloon driver' to
    7.44  current memory allocation up to its limit. 
    7.45  
    7.46  
    7.47 +%% XXX SMH: I use machine and physical in the next section (which 
    7.48 +%% is kinda required for consistency with code); wonder if this 
    7.49 +%% section should use same terms? 
    7.50 +%%
    7.51 +%% Probably. 
    7.52 +%%
    7.53 +%% Merging this and below section at some point prob makes sense. 
    7.54 +
    7.55 +\section{Pseudo-Physical Memory}
    7.56 +
    7.57 +Since physical memory is allocated and freed on a page granularity,
    7.58 +there is no gaurantee that a domain will receive a contiguous stretch
    7.59 +of physical memory. However most operating systems do not have good
    7.60 +support for operating in a fragmented physical address space. To aid
    7.61 +porting such operating systems to run on top of Xen, we make a
    7.62 +distinction between \emph{machine memory} and \emph{pseduo-physical
    7.63 +memory}.
    7.64 +
    7.65 +Put simply, machine memory refers to the entire amount of memory
    7.66 +installed in the machine, including that reserved by Xen, in use by
    7.67 +various domains, or currently unallocated. We consider machine memory
    7.68 +to comprise a set of 4K \emph{machine page frames} numbered
    7.69 +consecutively starting from 0. Machine frame numbers mean the same
    7.70 +within Xen or any domain.
    7.71 +
    7.72 +Pseudo-physical memory, on the other hand, is a per-domain
    7.73 +abstraction. It allows a guest operating system to consider its memory
    7.74 +allocation to consist of a contiguous range of physical page frames
    7.75 +starting at physical frame 0, despite the fact that the underlying
    7.76 +machine page frames may be sparsely allocated and in any order.
    7.77 +
    7.78 +To achieve this, Xen maintains a globally readable {\it
    7.79 +machine-to-physical} table which records the mapping from machine page
    7.80 +frames to pseudo-physical ones. In addition, each domain is supplied
    7.81 +with a {\it physical-to-machine} table which performs the inverse
    7.82 +mapping. Clearly the machine-to-physical table has size proportional
    7.83 +to the amount of RAM installed in the machine, while each
    7.84 +physical-to-machine table has size proportional to the memory
    7.85 +allocation of the given domain.
    7.86 +
    7.87 +Architecture dependent code in guest operating systems can then use
    7.88 +the two tables to provide the abstraction of pseudo-physical
    7.89 +memory. In general, only certain specialized parts of the operating
    7.90 +system (such as page table management) needs to understand the
    7.91 +difference between machine and pseudo-physical addresses.
    7.92 +
    7.93  \section{Page Table Updates}
    7.94  
    7.95  In the default mode of operation, Xen enforces read-only access to
    7.96 @@ -280,43 +332,21 @@ Note also that, after registering the GD
    7.97  may be overwritten by Xen.
    7.98  \end{quote}
    7.99  
   7.100 -
   7.101 -XXX SMH: HERE 
   7.102 +The LDT is updated via the generic MMU update mechanism (i.e., via 
   7.103 +the {\tt mmu\_update()} hypercall. 
   7.104  
   7.105 -
   7.106 -\section{Pseudo-Physical Memory}
   7.107 +\section{Start of Day} 
   7.108  
   7.109 -The usual problem of external fragmentation means that a domain is
   7.110 -unlikely to receive a contiguous stretch of physical memory.  However,
   7.111 -most guest operating systems do not have built-in support for
   7.112 -operating in a fragmented physical address space e.g. Linux has to
   7.113 -have a one-to-one mapping for its physical memory.  There a notion of
   7.114 -{\it pseudo physical memory} is introdouced.  Xen maintains a {\it
   7.115 -real physical} to {\it pseudo physical} mapping which can be consulted
   7.116 -by every domain.  Additionally, at its start of day, a domain is
   7.117 -supplied a {\it pseudo physical} to {\it real physical} mapping which
   7.118 -it needs to keep updated itself.  From that moment onwards {\it pseudo
   7.119 -physical} addresses are used instead of discontiguous {\it real
   7.120 -physical} addresses.  Thus, the rest of the guest OS code has an
   7.121 -impression of operating in a contiguous address space.  Guest OS page
   7.122 -tables contain real physical addresses.  Mapping {\it pseudo physical}
   7.123 -to {\it real physical} addresses is needed on page table updates and
   7.124 -also on remapping memory regions with the guest OS.
   7.125 +The start-of-day environment for guest operating systems is rather
   7.126 +different to that provided by the underlying hardware. In particular,
   7.127 +the processor is already executing in protected mode with paging
   7.128 +enabled.
   7.129  
   7.130 -\section{start of day xxx}
   7.131 -
   7.132 -
   7.133 -Start-of-day issues such as building initial page tables
   7.134 -for a domain, loading its kernel image and so on are done by the {\it
   7.135 -domain builder} running in user-space in {\it domain0}.  Paging to
   7.136 -disk and swapping is handled by the guest operating systems
   7.137 -themselves, if they need it.
   7.138 -
   7.139 -The amount of memory required by the domain is passed to the hypervisor
   7.140 -as one of the parameters for new domain initialization by the domain builder.
   7.141 -
   7.142 -
   7.143 -
   7.144 +{\it Domain-0} is created and booted by Xen itself. For all subsequent
   7.145 +donains, the analogue of the boot-loader is the {\it domain builder},
   7.146 +user-space software running in {\it domain-0}. The domain builder 
   7.147 +is responsible for building the initial page tables for a domain  
   7.148 +and loading its kernel image at the appropriate virtual address. 
   7.149  
   7.150  
   7.151  
   7.152 @@ -458,11 +488,265 @@ of the CPU for each domain.  Round-robin
   7.153  Xen's internal scheduler API.
   7.154  
   7.155  More information on the characteristics and use of these schedulers is
   7.156 -available in { \tt Sched-HOWTO.txt }.
   7.157 +available in {\tt Sched-HOWTO.txt}.
   7.158 +
   7.159 +
   7.160 +
   7.161 +
   7.162 +\appendix
   7.163 +
   7.164 +%\newcommand{\hypercall}[1]{\vspace{5mm}{\large\sf #1}}
   7.165 +
   7.166 +
   7.167 +
   7.168 +
   7.169 +
   7.170 +\newcommand{\hypercall}[1]{\vspace{2mm}{\sf #1}}
   7.171 +
   7.172 +
   7.173 +
   7.174 +\hypercall{physdev\_op(void *physdev\_op)}
   7.175 +
   7.176 +
   7.177 +\hypercall{vm\_assist(unsigned int cmd, unsigned int type)}
   7.178 +
   7.179 +
   7.180 +
   7.181 +
   7.182 +\chapter{Xen Hypercalls}
   7.183 +\label{a:hypercalls}
   7.184 +
   7.185 +Hypercalls represent the procedural interface to Xen; this appendix 
   7.186 +categorizes and describes the current set of hypercalls. 
   7.187 +
   7.188 +\section{Invoking Hypercalls} 
   7.189 +
   7.190 +\hypercall{multicall(void *call\_list, int nr\_calls)}
   7.191 +
   7.192 +Execute a series of hypervisor calls
   7.193 +
   7.194 +
   7.195 +
   7.196 +
   7.197 +\section{Virtual CPU Setup} 
   7.198 +
   7.199 +\hypercall{set\_callbacks(unsigned long event\_selector, unsigned long
   7.200 +  event\_address, unsigned long failsafe\_selector, unsigned long
   7.201 +  failsafe\_address) }
   7.202 +
   7.203 +Register OS event processing routine.  In
   7.204 +Linux both the event\_selector and failsafe\_selector are the
   7.205 +kernel's CS.  The value event\_address specifies the address for an
   7.206 +interrupt handler dispatch routine and failsafe\_address specifies a
   7.207 +handler for application faults.
   7.208 +
   7.209 +\hypercall{set\_trap\_table(trap\_info\_t *table)} 
   7.210 +
   7.211 +Install trap handler table.
   7.212 +
   7.213 +
   7.214 +\hypercall{set\_fast\_trap(int idx)}
   7.215 +
   7.216 + install traps to allow guest OS to bypass hypervisor
   7.217 +
   7.218 +
   7.219 +
   7.220 +
   7.221 +\section{Scheduling} 
   7.222 +
   7.223 +
   7.224 +\hypercall{stack\_switch(unsigned long ss, unsigned long esp)} 
   7.225 +
   7.226 +Request context switch from hypervisor.
   7.227 +
   7.228 +
   7.229 +\hypercall{fpu\_taskswitch(void)} 
   7.230 +
   7.231 +Notify hypervisor that fpu registers needed to be save on context switch.
   7.232 +
   7.233 +
   7.234 +\hypercall{sched\_op(unsigned long op)} 
   7.235 +
   7.236 +Request scheduling operation from hypervisor. The options are: {\it
   7.237 +yield}, {\it block}, and {\it shutdown}.  {\it yield} keeps the
   7.238 +calling domain run-able but may cause a reschedule if other domains
   7.239 +are run-able.  {\it block} removes the calling domain from the run
   7.240 +queue and the domains sleeps until an event is delivered to it.  {\it
   7.241 +shutdown} is used to end the domain's execution and allows to specify
   7.242 +whether the domain should reboot, halt or suspend..
   7.243 +
   7.244 +\hypercall{set\_timer\_op(uint64\_t timeout)} 
   7.245 +
   7.246 +Request a timer event to be sent at the specified system time.
   7.247 +
   7.248 +
   7.249 +\section{Page Table Management} 
   7.250 +
   7.251 +\hypercall{mmu\_update(mmu\_update\_t *req, int count, int *success\_count)} 
   7.252 +
   7.253 +Update the page table for the domain. Updates can be batched.
   7.254 +success\_count will be updated to report the number of successfull
   7.255 +updates.  The update types are:
   7.256 +
   7.257 +{\it MMU\_NORMAL\_PT\_UPDATE}:
   7.258 +
   7.259 +{\it MMU\_MACHPHYS\_UPDATE}:
   7.260 +
   7.261 +{\it MMU\_EXTENDED\_COMMAND}:
   7.262 +
   7.263 +
   7.264 +\hypercall{update\_va\_mapping(unsigned long page\_nr, unsigned long val, unsigned long flags)}
   7.265 +
   7.266 +
   7.267 +\hypercall{update\_va\_mapping\_otherdomain(unsigned long page\_nr,
   7.268 +unsigned long val, unsigned long flags, uint16\_t domid)}
   7.269 +
   7.270 +
   7.271 +\section{Segmentation Support}
   7.272 +
   7.273 +
   7.274 +\hypercall{set\_gdt(unsigned long *frame\_list, int entries)} 
   7.275 +
   7.276 +Set the global descriptor table - virtualization for lgdt.
   7.277 +
   7.278 +
   7.279 +
   7.280 +\hypercall{update\_descriptor(unsigned long ma, unsigned long word1, unsigned long word2)} 
   7.281 +
   7.282 +
   7.283 +
   7.284 +
   7.285 +\section{Inter-Domain Communication}
   7.286 +
   7.287 +
   7.288 +\hypercall{event\_channel\_op(void *op)} 
   7.289 +
   7.290 +Inter-domain event-channel management.
   7.291 +
   7.292 +
   7.293 +\hypercall{grant\_table\_op(unsigned int cmd, void *uop, unsigned int count)}
   7.294 +
   7.295 +
   7.296 +
   7.297 +\section{Physical Memory Management}
   7.298 +
   7.299 +\hypercall{dom\_mem\_op(unsigned int op, unsigned long *extent\_list,
   7.300 +unsigned long nr\_extents, unsigned int extent\_order)}
   7.301 +
   7.302 +Increase or decrease memory reservations for guest OS
   7.303 +
   7.304 +
   7.305 +
   7.306 +
   7.307 +
   7.308 +
   7.309 +\section{Administrative Operations}
   7.310 +
   7.311 +
   7.312 +\hypercall{dom0\_op(dom0\_op\_t *op)} 
   7.313 +
   7.314 +Administrative domain operations for domain management. The options are:
   7.315 +
   7.316 +{\it DOM0\_CREATEDOMAIN}: create new domain, specifying the name and memory usage
   7.317 +in kilobytes.
   7.318 +
   7.319 +{\it DOM0\_CREATEDOMAIN}: create domain
   7.320 +
   7.321 +{\it DOM0\_PAUSEDOMAIN}: mark domain as unschedulable
   7.322 +
   7.323 +{\it DOM0\_UNPAUSEDOMAIN}: mark domain as schedulable
   7.324 +
   7.325 +{\it DOM0\_DESTROYDOMAIN}: deallocate resources associated with the domain
   7.326 +
   7.327 +{\it DOM0\_GETMEMLIST}: get list of pages used by the domain
   7.328 +
   7.329 +{\it DOM0\_SCHEDCTL}:
   7.330 +
   7.331 +{\it DOM0\_ADJUSTDOM}: adjust scheduling priorities for domain
   7.332 +
   7.333 +{\it DOM0\_BUILDDOMAIN}: do final guest OS setup for domain
   7.334 +
   7.335 +{\it DOM0\_GETDOMAINFO}: get statistics about the domain
   7.336 +
   7.337 +{\it DOM0\_GETPAGEFRAMEINFO}:
   7.338 +
   7.339 +{\it DOM0\_IOPL}: set IO privilege level
   7.340 +
   7.341 +{\it DOM0\_MSR}:
   7.342 +
   7.343 +{\it DOM0\_DEBUG}: interactively call pervasive debugger
   7.344 +
   7.345 +{\it DOM0\_SETTIME}: set system time
   7.346 +
   7.347 +{\it DOM0\_READCONSOLE}: read console content from hypervisor buffer ring
   7.348 +
   7.349 +{\it DOM0\_PINCPUDOMAIN}: pin domain to a particular CPU
   7.350 +
   7.351 +{\it DOM0\_GETTBUFS}: get information about the size and location of
   7.352 +                      the trace buffers (only on trace-buffer enabled builds)
   7.353 +
   7.354 +{\it DOM0\_PHYSINFO}: get information about the host machine
   7.355 +
   7.356 +{\it DOM0\_PCIDEV\_ACCESS}: modify PCI device access permissions
   7.357 +
   7.358 +{\it DOM0\_SCHED\_ID}: get the ID of the current Xen scheduler
   7.359 +
   7.360 +{\it DOM0\_SHADOW\_CONTROL}:
   7.361 +
   7.362 +{\it DOM0\_SETDOMAINNAME}: set the name of a domain
   7.363 +
   7.364 +{\it DOM0\_SETDOMAININITIALMEM}: set initial memory allocation of a domain
   7.365 +
   7.366 +{\it DOM0\_SETDOMAINMAXMEM}: set maximum memory allocation of a domain
   7.367 +
   7.368 +{\it DOM0\_GETPAGEFRAMEINFO2}:
   7.369 +
   7.370 +{\it DOM0\_SETDOMAINVMASSIST}: set domain VM assist options
   7.371 +
   7.372 +
   7.373 +
   7.374 +
   7.375 +\section{Miscellaneous Hypercalls} 
   7.376 +
   7.377 +
   7.378 +\hypercall{console\_io(int cmd, int count, char *str)}
   7.379 +
   7.380 +Interact with the console, operations are:
   7.381 +
   7.382 +{\it CONSOLEIO\_write}: Output count characters from buffer str.
   7.383 +
   7.384 +{\it CONSOLEIO\_read}: Input at most count characters into buffer str.
   7.385 +
   7.386 +
   7.387 +
   7.388 +\hypercall{set\_debugreg(int reg, unsigned long value)}
   7.389 +
   7.390 +set debug register reg to value
   7.391 +
   7.392 +
   7.393 +\hypercall{get\_debugreg(int reg)}
   7.394 +
   7.395 + get the debug register reg
   7.396 +
   7.397 +
   7.398 +\hypercall{xen\_version(int cmd)}
   7.399 +
   7.400 +Request Xen version number.
   7.401 +
   7.402 +
   7.403 +
   7.404 +
   7.405 +
   7.406 +
   7.407 +%% 
   7.408 +%% XXX SMH: not really sure how useful below is -- if it's still 
   7.409 +%% actually true, might be useful for someone wanting to write a 
   7.410 +%% new scheduler... not clear how many of them there are...
   7.411 +%%
   7.412  
   7.413  \begin{comment}
   7.414  
   7.415 -\section{Scheduling API}
   7.416 +\chapter{Scheduling API}  
   7.417  
   7.418  The scheduling API is used by both the schedulers described above and should
   7.419  also be used by any new schedulers.  It provides a generic interface and also
   7.420 @@ -514,7 +798,7 @@ this scheduler.
   7.421  \subsubsection{sched\_id}
   7.422  
   7.423  This is an integer that uniquely identifies this scheduler.  There should be a
   7.424 -macro corrsponding to this scheduler ID in {\tt <hypervisor-ifs/sched-if.h>}.
   7.425 +macro corrsponding to this scheduler ID in {\tt <xen/sched-if.h>}.
   7.426  
   7.427  \subsubsection{init\_scheduler}
   7.428  
   7.429 @@ -731,6 +1015,20 @@ This method should dump any private sett
   7.430  This function is called with interrupts disabled and the {\tt schedule\_lock}
   7.431  for the task's CPU held.
   7.432  
   7.433 +\end{comment} 
   7.434 +
   7.435 +
   7.436 +
   7.437 +
   7.438 +%%
   7.439 +%% XXX SMH: we probably should have something in here on debugging 
   7.440 +%% etc; this is a kinda developers manual and many devs seem to 
   7.441 +%% like debugging support :^) 
   7.442 +%% Possibly sanitize below, else wait until new xendbg stuff is in 
   7.443 +%% (and/or kip's stuff?) and write about that instead? 
   7.444 +%%
   7.445 +
   7.446 +\begin{comment} 
   7.447  
   7.448  \chapter{Debugging}
   7.449  
   7.450 @@ -795,196 +1093,9 @@ trace points, there is an example format
   7.451  For more information, see the manual pages for {\tt xentrace}, {\tt
   7.452  xentrace\_format} and {\tt xentrace\_cpusplit}.
   7.453  
   7.454 -
   7.455 -\appendix
   7.456 -
   7.457 -\newcommand{\hypercall}[1]{\vspace{5mm}{\large\sf #1}}
   7.458 -
   7.459 -\chapter{Xen Hypercalls}
   7.460 -
   7.461 -\hypercall{ set\_trap\_table(trap\_info\_t *table)} 
   7.462 -
   7.463 -Install trap handler table.
   7.464 -
   7.465 -
   7.466 -\hypercall{ mmu\_update(mmu\_update\_t *req, int count, int *success\_count)} 
   7.467 -
   7.468 -Update the page table for the domain. Updates can be batched.
   7.469 -success\_count will be updated to report the number of successfull
   7.470 -updates.  The update types are:
   7.471 -
   7.472 -{\it MMU\_NORMAL\_PT\_UPDATE}:
   7.473 -
   7.474 -{\it MMU\_MACHPHYS\_UPDATE}:
   7.475 -
   7.476 -{\it MMU\_EXTENDED\_COMMAND}:
   7.477 -
   7.478 -
   7.479 -\hypercall{ set\_gdt(unsigned long *frame\_list, int entries)} 
   7.480 -
   7.481 -Set the global descriptor table - virtualization for lgdt.
   7.482 -
   7.483 -
   7.484 -\hypercall{ stack\_switch(unsigned long ss, unsigned long esp)} 
   7.485 -
   7.486 -Request context switch from hypervisor.
   7.487 -
   7.488 -
   7.489 -\hypercall{ set\_callbacks(unsigned long event\_selector, unsigned long event\_address,
   7.490 -                        unsigned long failsafe\_selector, unsigned
   7.491 - long failsafe\_address) }
   7.492 -
   7.493 -Register OS event processing routine.  In
   7.494 -Linux both the event\_selector and failsafe\_selector are the
   7.495 -kernel's CS.  The value event\_address specifies the address for an
   7.496 -interrupt handler dispatch routine and failsafe\_address specifies a
   7.497 -handler for application faults.
   7.498 -
   7.499 -
   7.500 -\hypercall{ fpu\_taskswitch(void)} 
   7.501 -
   7.502 -Notify hypervisor that fpu registers needed to be save on context switch.
   7.503 -
   7.504 -
   7.505 -\hypercall{ sched\_op(unsigned long op)} 
   7.506 -
   7.507 -Request scheduling operation from hypervisor. The options are: {\it
   7.508 -yield}, {\it block}, and {\it shutdown}.  {\it yield} keeps the
   7.509 -calling domain run-able but may cause a reschedule if other domains
   7.510 -are run-able.  {\it block} removes the calling domain from the run
   7.511 -queue and the domains sleeps until an event is delivered to it.  {\it
   7.512 -shutdown} is used to end the domain's execution and allows to specify
   7.513 -whether the domain should reboot, halt or suspend..
   7.514 +\end{comment} 
   7.515  
   7.516  
   7.517 -\hypercall{ dom0\_op(dom0\_op\_t *op)} 
   7.518 -
   7.519 -Administrative domain operations for domain management. The options are:
   7.520 -
   7.521 -{\it DOM0\_CREATEDOMAIN}: create new domain, specifying the name and memory usage
   7.522 -in kilobytes.
   7.523 -
   7.524 -{\it DOM0\_CREATEDOMAIN}: create domain
   7.525 -
   7.526 -{\it DOM0\_PAUSEDOMAIN}: mark domain as unschedulable
   7.527 -
   7.528 -{\it DOM0\_UNPAUSEDOMAIN}: mark domain as schedulable
   7.529 -
   7.530 -{\it DOM0\_DESTROYDOMAIN}: deallocate resources associated with the domain
   7.531 -
   7.532 -{\it DOM0\_GETMEMLIST}: get list of pages used by the domain
   7.533 -
   7.534 -{\it DOM0\_SCHEDCTL}:
   7.535 -
   7.536 -{\it DOM0\_ADJUSTDOM}: adjust scheduling priorities for domain
   7.537 -
   7.538 -{\it DOM0\_BUILDDOMAIN}: do final guest OS setup for domain
   7.539 -
   7.540 -{\it DOM0\_GETDOMAINFO}: get statistics about the domain
   7.541 -
   7.542 -{\it DOM0\_GETPAGEFRAMEINFO}:
   7.543 -
   7.544 -{\it DOM0\_IOPL}: set IO privilege level
   7.545 -
   7.546 -{\it DOM0\_MSR}:
   7.547 -
   7.548 -{\it DOM0\_DEBUG}: interactively call pervasive debugger
   7.549 -
   7.550 -{\it DOM0\_SETTIME}: set system time
   7.551 -
   7.552 -{\it DOM0\_READCONSOLE}: read console content from hypervisor buffer ring
   7.553 -
   7.554 -{\it DOM0\_PINCPUDOMAIN}: pin domain to a particular CPU
   7.555 -
   7.556 -{\it DOM0\_GETTBUFS}: get information about the size and location of
   7.557 -                      the trace buffers (only on trace-buffer enabled builds)
   7.558 -
   7.559 -{\it DOM0\_PHYSINFO}: get information about the host machine
   7.560 -
   7.561 -{\it DOM0\_PCIDEV\_ACCESS}: modify PCI device access permissions
   7.562 -
   7.563 -{\it DOM0\_SCHED\_ID}: get the ID of the current Xen scheduler
   7.564 -
   7.565 -{\it DOM0\_SHADOW\_CONTROL}:
   7.566 -
   7.567 -{\it DOM0\_SETDOMAINNAME}: set the name of a domain
   7.568 -
   7.569 -{\it DOM0\_SETDOMAININITIALMEM}: set initial memory allocation of a domain
   7.570 -
   7.571 -{\it DOM0\_SETDOMAINMAXMEM}: set maximum memory allocation of a domain
   7.572 -
   7.573 -{\it DOM0\_GETPAGEFRAMEINFO2}:
   7.574 -
   7.575 -{\it DOM0\_SETDOMAINVMASSIST}: set domain VM assist options
   7.576 -
   7.577 -
   7.578 -\hypercall{ set\_debugreg(int reg, unsigned long value)}
   7.579 -
   7.580 -set debug register reg to value
   7.581  
   7.582  
   7.583 -\hypercall{ get\_debugreg(int reg)}
   7.584 -
   7.585 - get the debug register reg
   7.586 -
   7.587 -
   7.588 -\hypercall{ update\_descriptor(unsigned long ma, unsigned long word1, unsigned long word2)} 
   7.589 -
   7.590 -
   7.591 -\hypercall{ set\_fast\_trap(int idx)}
   7.592 -
   7.593 - install traps to allow guest OS to bypass hypervisor
   7.594 -
   7.595 -
   7.596 -\hypercall{ dom\_mem\_op(unsigned int op, unsigned long *extent\_list, unsigned long nr\_extents, unsigned int extent\_order)}
   7.597 -
   7.598 -Increase or decrease memory reservations for guest OS
   7.599 -
   7.600 -
   7.601 -\hypercall{ multicall(void *call\_list, int nr\_calls)}
   7.602 -
   7.603 -Execute a series of hypervisor calls
   7.604 -
   7.605 -
   7.606 -\hypercall{ update\_va\_mapping(unsigned long page\_nr, unsigned long val, unsigned long flags)}
   7.607 -
   7.608 -
   7.609 -\hypercall{ set\_timer\_op(uint64\_t timeout)} 
   7.610 -
   7.611 -Request a timer event to be sent at the specified system time.
   7.612 -
   7.613 -
   7.614 -\hypercall{ event\_channel\_op(void *op)} 
   7.615 -
   7.616 -Inter-domain event-channel management.
   7.617 -
   7.618 -
   7.619 -\hypercall{ xen\_version(int cmd)}
   7.620 -
   7.621 -Request Xen version number.
   7.622 -
   7.623 -
   7.624 -\hypercall{ console\_io(int cmd, int count, char *str)}
   7.625 -
   7.626 -Interact with the console, operations are:
   7.627 -
   7.628 -{\it CONSOLEIO\_write}: Output count characters from buffer str.
   7.629 -
   7.630 -{\it CONSOLEIO\_read}: Input at most count characters into buffer str.
   7.631 -
   7.632 -
   7.633 -\hypercall{ physdev\_op(void *physdev\_op)}
   7.634 -
   7.635 -
   7.636 -\hypercall{ grant\_table\_op(unsigned int cmd, void *uop, unsigned int count)}
   7.637 -
   7.638 -
   7.639 -\hypercall{ vm\_assist(unsigned int cmd, unsigned int type)}
   7.640 -
   7.641 -
   7.642 -\hypercall{ update\_va\_mapping\_otherdomain(unsigned long page\_nr, unsigned long val, unsigned long flags, uint16\_t domid)}
   7.643 -
   7.644 -
   7.645 -\end{comment}
   7.646 -
   7.647  \end{document}
     8.1 --- a/docs/src/user.tex	Mon Nov 01 00:14:22 2004 +0000
     8.2 +++ b/docs/src/user.tex	Mon Nov 01 00:18:29 2004 +0000
     8.3 @@ -1,7 +1,6 @@
     8.4  \documentclass[11pt,twoside,final,openright]{xenstyle}
     8.5 -\usepackage{a4,graphicx,setspace,times}
     8.6 -\setstretch{1.15}
     8.7 -%\input{style.tex}
     8.8 +\usepackage{a4,graphicx,parskip,setspace,times}
     8.9 +\setstretch{1.1}
    8.10  
    8.11  \begin{document}
    8.12  
    8.13 @@ -50,7 +49,7 @@ Contributions of material, suggestions a
    8.14  \renewcommand{\bottomfraction}{.8}
    8.15  \renewcommand{\textfraction}{.2}
    8.16  \renewcommand{\floatpagefraction}{.8}
    8.17 -\setstretch{1.15}
    8.18 +\setstretch{1.1}
    8.19  
    8.20  \newcommand{\path}[1]{{\tt #1}}
    8.21  
    8.22 @@ -80,7 +79,7 @@ The drawback of this approach is that it
    8.23  be {\em ported} to run on Xen.  This process is similar to a port of
    8.24  an operating system to a new hardware platform, although the process
    8.25  is simplified because the paravirtual machine architecture is very
    8.26 -similar to the underlying native hardware. Although operating system
    8.27 +similar to the underlying native hardware. Even though operating system
    8.28  kernels must explicitly support Xen, a key feature is that user space
    8.29  applications and libraries {\em do not} require modification.
    8.30  
    8.31 @@ -90,11 +89,6 @@ We expect that Xen support will ultimate
    8.32  official releases of Linux, NetBSD, FreeBSD and Dragonfly BSD. 
    8.33  Other OS ports, including Plan 9, are in progress.
    8.34  
    8.35 -%Even running multiple copies of Linux can be very useful, providing a
    8.36 -%means of containing faults to one OS image, providing performance
    8.37 -%isolation between the various OS instances and trying out multiple
    8.38 -%distros.
    8.39 -
    8.40  Possible usage scenarios for Xen include:
    8.41  \begin{description}
    8.42  \item [Kernel development.] Test and debug kernel modifications in a
    8.43 @@ -102,18 +96,18 @@ Possible usage scenarios for Xen include
    8.44        machine.
    8.45  \item [Multiple OS configurations.] Run multiple operating systems
    8.46        simultaneously, for instance for compatibility or QA purposes.
    8.47 -\item [Server consolidation.] Move multiple servers onto one box,
    8.48 -      provided performance and fault isolation at virtual machine
    8.49 -      boundaries.
    8.50 +\item [Server consolidation.] Move multiple servers onto one box
    8.51 +      with performance and fault isolation provided at virtual machine
    8.52 +      boundaries. 
    8.53  \item [Cluster computing.] Improve manageability and efficiency by
    8.54        running services in virtual machines, isolated from
    8.55 -      machine-specifics and load balance using live migration.
    8.56 +      machine-specifics; load balance using live migration.
    8.57  \item [High availability computing.] Run device drivers in sandboxed
    8.58        domains for increased robustness.
    8.59  \item [Hardware support for custom OSes.] Export drivers from a
    8.60 -      mainstream OS (e.g. Linux) with good hardware support
    8.61 +      mainstream OS (e.g. Linux) with wide-ranging hardware support
    8.62        to your custom OS, avoiding the need for you to port existing
    8.63 -      drivers to achieve good hardware support.
    8.64 +      drivers.
    8.65  \end{description}
    8.66  
    8.67  \section{Structure of a Xen-Based System}
    8.68 @@ -132,15 +126,15 @@ other domains and manages their virtual 
    8.69  suspend, resume and migration of virtual machines. Where one is
    8.70  required, the X server is also run in domain 0.
    8.71  
    8.72 -Within Domain 0, a process called `Xend' runs to manage the system.
    8.73 +Within Domain 0, a process called `xend' runs to manage the system.
    8.74  Xend is responsible for managing virtual machines and providing access
    8.75  to their consoles.  Commands are issued to Xend over an HTTP
    8.76  interface, either from a command-line tool or from a web browser.
    8.77  
    8.78  \section{Hardware Support}
    8.79  
    8.80 -Xen currently runs only on the x86 architecture (however, ports to other
    8.81 -architectures, including x86/64 and IA64, are in progress).
    8.82 +Xen currently runs only on the x86 architecture, although ports to other
    8.83 +architectures, including x86/64 and IA64, are in progress.
    8.84  Xen requires a `P6' or newer processor (e.g. Pentium Pro, Celeron,
    8.85  Pentium II, Pentium III, Pentium IV, Xeon, AMD Athlon, AMD Duron).
    8.86  Multiprocessor machines are supported, and we also have basic support
    8.87 @@ -152,7 +146,7 @@ mode.
    8.88  Xen can currently use up to 4GB of memory.  It is possible for x86
    8.89  machines to address up to 64GB of physical memory but there are no
    8.90  plans to support these systems.  The x86\_64 port is the planned route
    8.91 -to supporting more than 4GB of memory.
    8.92 +to supporting larger memory sizes. 
    8.93  
    8.94  Xen offloads most of the hardware support issues to the guest OS
    8.95  running in Domain 0.  Xen itself only contains code to detect and
    8.96 @@ -192,16 +186,15 @@ first public release (1.0) was made in O
    8.97  then, Xen has been extensively developed and is now used in production
    8.98  scenarios on multiple sites.
    8.99  
   8.100 -Xen 2.0 feature greatly enhanced hardware support, configuration
   8.101 +Xen 2.0 features greatly enhanced hardware support, configuration
   8.102  flexibility, usability and a larger complement of supported operating
   8.103 -systems. We think that Xen has the potential to become {\em the}
   8.104 -definitive open source virtualisation solution and will work to
   8.105 -conclusively achieve that position.
   8.106 +systems. This latest release takes Xen a step closer to becoming the 
   8.107 +definitive open source solution for virtualisation.
   8.108  
   8.109  \chapter{Installation}
   8.110  
   8.111  The Xen distribution includes three main components:  Xen itself,
   8.112 -utilities to convert a standard Linux tree to run on Xen and the
   8.113 +utilities to convert a standard Linux tree to run on Xen, and the
   8.114  userspace tools required to operate a Xen-based system.
   8.115  
   8.116  This manual describes how to install the Xen 2.0 distribution from
   8.117 @@ -216,7 +209,7 @@ operating system distribution.
   8.118  \item A working installation of the GRUB bootloader.
   8.119  \item An installation of Twisted v1.3 or above (see {\tt
   8.120  http://www.twistedmatrix.com}).  There may be a package available for
   8.121 -your distribution; alternatively it can be installed by running {\tt \#
   8.122 +your distribution; alternatively it can be installed by running {\tt
   8.123  make install-twisted} in the root of the Xen source tree.
   8.124  \item Python logging package (see {\tt http://www.red-dove.com/})
   8.125  \item The Linux bridge control tools (see {\tt
   8.126 @@ -235,9 +228,11 @@ available for your distribution.
   8.127  \section{Install Bitkeeper (Optional)}
   8.128  
   8.129  To fetch a local copy, first download the BitKeeper tools.
   8.130 -Download instructions must be obtained by filling out the provided
   8.131 -form at: \\ {\tt
   8.132 -http://www.bitmover.com/cgi-bin/download.cgi }
   8.133 +Download instructions can be obtained by filling out the provided
   8.134 +form at: 
   8.135 +\begin{quote} 
   8.136 +{\tt http://www.bitmover.com/cgi-bin/download.cgi}
   8.137 +\end{quote}
   8.138  
   8.139  The BitKeeper install program is designed to be run with X.  If X is
   8.140  not available, you can specify the install directory on the command
   8.141 @@ -247,8 +242,11 @@ line.
   8.142  
   8.143  \subsection{Using Bitkeeper}
   8.144  
   8.145 -The public master BK repository for the 2.0 release lives at: \\
   8.146 -{\tt bk://xen.bkbits.net/xen-2.0.bk}.  You can use Bitkeeper to
   8.147 +The public master BK repository for the 2.0 release lives at: 
   8.148 +\begin{quote}
   8.149 +{\tt bk://xen.bkbits.net/xen-2.0.bk}  
   8.150 +\end{quote} 
   8.151 +You can use Bitkeeper to
   8.152  download it and keep it updated with the latest features and fixes.
   8.153  
   8.154  Change to the directory in which you want to put the source code, then
   8.155 @@ -257,6 +255,7 @@ run:
   8.156  # bk clone bk://xen.bkbits.net/xen-2.0.bk
   8.157  \end{verbatim}
   8.158  
   8.159 +
   8.160  Under your current directory, a new directory named `xen-2.0.bk' has
   8.161  been created, which contains all the source code for the Xen
   8.162  hypervisor and the Xen tools.  The directory also contains `sparse' OS
   8.163 @@ -275,7 +274,8 @@ changes to the repository by running:
   8.164  The Xen source tree is also available in gzipped tarball form from the
   8.165  Xen downloads page:\\
   8.166  {\tt http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads.html}.
   8.167 -Prebuilt tarballs are also available from this page but are very large.
   8.168 +Prebuilt tarballs are also available from this page but are relatively
   8.169 + large.
   8.170  
   8.171  \section{The distribution}
   8.172  
   8.173 @@ -310,8 +310,8 @@ following:
   8.174  
   8.175  Inspect the Makefile if you want to see what goes on during a build.
   8.176  Building Xen and the tools is straightforward, but XenLinux is more
   8.177 -complicated.  The makefile needs a `pristine' Linux kernel tree which
   8.178 -it will then add the Xen architecture files to.  You can tell the
   8.179 +complicated.  The makefile needs a `pristine' Linux kernel tree to which
   8.180 +it will then add the Xen architecture files.  You can tell the
   8.181  makefile the location of the appropriate Linux compressed tar file by
   8.182  setting the LINUX\_SRC environment variable, e.g. \\
   8.183  \verb!# LINUX_SRC=/tmp/linux-2.6.8.1.tar.bz2 make world! \\ or by
   8.184 @@ -475,30 +475,36 @@ The first step in creating a new domain 
   8.185  filesystem for it to boot off.  Typically, this might be stored in a
   8.186  normal partition, an LVM or other volume manager partition, a disk
   8.187  file or on an NFS server.
   8.188 -
   8.189  A simple way to do this is simply to boot from your standard OS
   8.190  install CD and install the distribution into another partition on your
   8.191  hard drive.
   8.192  
   8.193 -{\em N.b } you can boot with Xen and XenLinux without installing any
   8.194 -special userspace tools but will need to have the prerequisites
   8.195 -described in Section~\ref{sec:prerequisites} and the Xen control tools
   8.196 -installed before you proceed.
   8.197 -
   8.198 -\section{From the web interface}
   8.199 +You can boot Xen and a single XenLinux instance without installing any
   8.200 +special user-space tools. To proceed further than this you will need
   8.201 +to install the prerequisites described in Section~\ref{sec:prerequisites}
   8.202 +and the Xen control tools. The control tools are installed by entering
   8.203 +the tools subdirectory of the repository and typing \\
   8.204 +\verb!# LINUX_SRC=/path/to/linux2.4/source make linux24! \\
   8.205  
   8.206 -Boot the Xen machine and start Xensv (see Chapter~\ref{cha:xensv} for
   8.207 -more details) using the command: \\
   8.208 -\verb_# xensv start_ \\
   8.209 -This will also start Xend (see Chapter~\ref{cha:xend} for more information).
   8.210 +To start the control daemon, type \\ \verb!# xend start! \\ If you
   8.211 +wish to start the daemon automatically, see the instructions in
   8.212 +Chapter~\ref{cha:xend}. Once the daemon is running, you can use the
   8.213 +{\tt xm} tool to monitor and maintain the domains running on your
   8.214 +system. This chapter provides only a brief tutorial: we provide full
   8.215 +details of the {\tt xm} tool in Chapter~\ref{cha:xm}. 
   8.216  
   8.217 -The domain management interface will then be available at {\tt
   8.218 -http://your\_machine:8080/}.  This provides a user friendly wizard for
   8.219 -starting domains and functions for managing running domains.
   8.220 -
   8.221 -\section{From the command line}
   8.222 -
   8.223 -Full details of the {\tt xm} tool are found in Chapter~\ref{cha:xm}.
   8.224 +%\section{From the web interface}
   8.225 +%
   8.226 +%Boot the Xen machine and start Xensv (see Chapter~\ref{cha:xensv} for
   8.227 +%more details) using the command: \\
   8.228 +%\verb_# xensv start_ \\
   8.229 +%This will also start Xend (see Chapter~\ref{cha:xend} for more information).
   8.230 +%
   8.231 +%The domain management interface will then be available at {\tt
   8.232 +%http://your\_machine:8080/}.  This provides a user friendly wizard for
   8.233 +%starting domains and functions for managing running domains.
   8.234 +%
   8.235 +%\section{From the command line}
   8.236  
   8.237  This example explains how to use the \path{xmdefconfig} file.  If you
   8.238  require a more complex setup, you will want to write a custom
     9.1 --- a/extras/mini-os/Makefile	Mon Nov 01 00:14:22 2004 +0000
     9.2 +++ b/extras/mini-os/Makefile	Mon Nov 01 00:18:29 2004 +0000
     9.3 @@ -14,16 +14,16 @@ TARGET := mini-os
     9.4  LOBJS := lib/malloc.o lib/math.o lib/printf.o lib/string.o 
     9.5  OBJS  := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
     9.6  
     9.7 -HINTF := h/hypervisor-ifs/hypervisor-if.h
     9.8 +HINTF := h/xen-public/xen.h
     9.9  HDRS  :=  h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h
    9.10  HDRS  += $(HINTF)
    9.11  
    9.12  default: $(TARGET)
    9.13  
    9.14 -hypervisor-ifs:
    9.15 -	ln -sf ../../../xen/include/hypervisor-ifs h/hypervisor-ifs
    9.16 +xen-public:
    9.17 +	[ -e h/xen-public] || ln -sf ../../../xen/include/public h/xen-public
    9.18  
    9.19 -$(TARGET): hypervisor-ifs head.o $(OBJS)
    9.20 +$(TARGET): xen-public head.o $(OBJS)
    9.21  	$(LD) -N -T minios.lds head.o $(OBJS) -o $@.elf
    9.22  	objcopy -R .note -R .comment $@.elf $@
    9.23  	gzip -f -9 -c $@ >$@.gz
    10.1 --- a/extras/mini-os/h/events.h	Mon Nov 01 00:14:22 2004 +0000
    10.2 +++ b/extras/mini-os/h/events.h	Mon Nov 01 00:18:29 2004 +0000
    10.3 @@ -20,7 +20,7 @@
    10.4  #ifndef _EVENTS_H_
    10.5  #define _EVENTS_H_
    10.6  
    10.7 -/* _EVENT_* are defined in hypervisor-if.h  */
    10.8 +/* _EVENT_* are defined in xen-public/xen.h  */
    10.9  #define EV_BLKDEV _EVENT_BLKDEV
   10.10  #define EV_TIMER  _EVENT_TIMER
   10.11  #define EV_DIE    _EVENT_DIE
    11.1 --- a/extras/mini-os/h/hypervisor.h	Mon Nov 01 00:14:22 2004 +0000
    11.2 +++ b/extras/mini-os/h/hypervisor.h	Mon Nov 01 00:18:29 2004 +0000
    11.3 @@ -11,9 +11,8 @@
    11.4  
    11.5  #include <types.h>
    11.6  
    11.7 -/* include the hypervisor interface */
    11.8 -#include <hypervisor-ifs/hypervisor-if.h>
    11.9 -#include "../../../tools/xu/lib/domain_controller.h"
   11.10 +#include <xen-public/xen.h>
   11.11 +#include <xen-public/io/domain_controller.h>
   11.12  
   11.13  /*
   11.14   * a placeholder for the start of day information passed up from the hypervisor
    12.1 --- a/extras/mini-os/h/os.h	Mon Nov 01 00:14:22 2004 +0000
    12.2 +++ b/extras/mini-os/h/os.h	Mon Nov 01 00:18:29 2004 +0000
    12.3 @@ -29,7 +29,7 @@
    12.4  
    12.5  
    12.6  /*
    12.7 - * these are also defined in hypervisor-if.h but can't be pulled in as
    12.8 + * these are also defined in xen-public/xen.h but can't be pulled in as
    12.9   * they are used in start of day assembly. Need to clean up the .h files
   12.10   * a bit more...
   12.11   */
   12.12 @@ -48,7 +48,7 @@
   12.13  #ifndef __ASSEMBLY__
   12.14  
   12.15  #include <types.h>
   12.16 -#include <hypervisor-ifs/hypervisor-if.h>
   12.17 +#include <xen-public/xen.h>
   12.18  
   12.19  
   12.20  /* this struct defines the way the registers are stored on the 
    13.1 --- a/linux-2.4.27-xen-sparse/arch/xen/Makefile	Mon Nov 01 00:14:22 2004 +0000
    13.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/Makefile	Mon Nov 01 00:18:29 2004 +0000
    13.3 @@ -127,7 +127,7 @@ archclean:
    13.4  	@$(MAKEBOOT) clean
    13.5  
    13.6  archmrproper:
    13.7 -	rm -f include/asm-xen/hypervisor-ifs/arch
    13.8 +	rm -f include/asm-xen/xen-public/arch
    13.9  
   13.10  archdep:
   13.11  	@$(MAKEBOOT) dep
    14.1 --- a/linux-2.4.27-xen-sparse/arch/xen/drivers/blkif/frontend/common.h	Mon Nov 01 00:14:22 2004 +0000
    14.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/drivers/blkif/frontend/common.h	Mon Nov 01 00:18:29 2004 +0000
    14.3 @@ -18,11 +18,11 @@
    14.4  #include <linux/hdreg.h>
    14.5  #include <linux/blkdev.h>
    14.6  #include <linux/major.h>
    14.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    14.8 +#include <asm/xen-public/xen.h>
    14.9  #include <asm/io.h>
   14.10  #include <asm/atomic.h>
   14.11  #include <asm/uaccess.h>
   14.12 -#include <asm-xen/hypervisor-ifs/io/blkif.h>
   14.13 +#include <asm/xen-public/io/blkif.h>
   14.14  
   14.15  #if 0
   14.16  #define DPRINTK(_f, _a...) printk ( KERN_ALERT _f , ## _a )
    15.1 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/pci-pc.c	Mon Nov 01 00:14:22 2004 +0000
    15.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/pci-pc.c	Mon Nov 01 00:18:29 2004 +0000
    15.3 @@ -18,8 +18,8 @@
    15.4  #include <asm/segment.h>
    15.5  #include <asm/io.h>
    15.6  
    15.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    15.8 -#include <asm/hypervisor-ifs/physdev.h>
    15.9 +#include <asm/xen-public/xen.h>
   15.10 +#include <asm/xen-public/physdev.h>
   15.11  
   15.12  #include "pci-i386.h"
   15.13  
    16.1 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/process.c	Mon Nov 01 00:14:22 2004 +0000
    16.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/process.c	Mon Nov 01 00:18:29 2004 +0000
    16.3 @@ -44,7 +44,7 @@
    16.4  #include <asm/desc.h>
    16.5  #include <asm/mmu_context.h>
    16.6  #include <asm/multicall.h>
    16.7 -#include <asm/hypervisor-ifs/dom0_ops.h>
    16.8 +#include <asm/xen-public/dom0_ops.h>
    16.9  
   16.10  #include <linux/irq.h>
   16.11  
    17.1 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/setup.c	Mon Nov 01 00:14:22 2004 +0000
    17.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/setup.c	Mon Nov 01 00:18:29 2004 +0000
    17.3 @@ -48,7 +48,7 @@ static int errno;
    17.4  #include <asm/mmu_context.h>
    17.5  #include <asm/ctrl_if.h>
    17.6  #include <asm/hypervisor.h>
    17.7 -#include <asm/hypervisor-ifs/dom0_ops.h>
    17.8 +#include <asm/xen-public/dom0_ops.h>
    17.9  #include <linux/netdevice.h>
   17.10  #include <linux/rtnetlink.h>
   17.11  #include <linux/tqueue.h>
   17.12 @@ -335,7 +335,7 @@ void __init setup_arch(char **cmdline_p)
   17.13       * and the bootmem bitmap. 
   17.14       * NB. There is definitely enough room for the bootmem bitmap in the
   17.15       * bootstrap page table. We are guaranteed to get >=512kB unused 'padding'
   17.16 -     * for our own use after all bootstrap elements (see hypervisor-if.h).
   17.17 +     * for our own use after all bootstrap elements (see asm/xen-public/xen.h).
   17.18       */
   17.19      boot_pfn = min((int)xen_start_info.nr_pages,lmax_low_pfn);
   17.20      bootmap_size = init_bootmem(start_pfn,boot_pfn);
    18.1 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c	Mon Nov 01 00:14:22 2004 +0000
    18.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c	Mon Nov 01 00:18:29 2004 +0000
    18.3 @@ -52,7 +52,7 @@
    18.4  
    18.5  #include <asm/div64.h>
    18.6  #include <asm/hypervisor.h>
    18.7 -#include <asm/hypervisor-ifs/dom0_ops.h>
    18.8 +#include <asm/xen-public/dom0_ops.h>
    18.9  
   18.10  #include <linux/mc146818rtc.h>
   18.11  #include <linux/kernel.h>
    19.1 --- a/linux-2.4.27-xen-sparse/include/asm-xen/page.h	Mon Nov 01 00:14:22 2004 +0000
    19.2 +++ b/linux-2.4.27-xen-sparse/include/asm-xen/page.h	Mon Nov 01 00:18:29 2004 +0000
    19.3 @@ -12,7 +12,7 @@
    19.4  #include <linux/config.h>
    19.5  #include <linux/string.h>
    19.6  #include <asm/types.h>
    19.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    19.8 +#include <asm/xen-public/xen.h>
    19.9  
   19.10  #ifdef CONFIG_XEN_SCRUB_PAGES
   19.11  #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
    20.1 --- a/linux-2.4.27-xen-sparse/include/asm-xen/segment.h	Mon Nov 01 00:14:22 2004 +0000
    20.2 +++ b/linux-2.4.27-xen-sparse/include/asm-xen/segment.h	Mon Nov 01 00:18:29 2004 +0000
    20.3 @@ -4,7 +4,7 @@
    20.4  #ifndef __ASSEMBLY__
    20.5  #include <linux/types.h>
    20.6  #endif
    20.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    20.8 +#include <asm/xen-public/xen.h>
    20.9  
   20.10  #define __KERNEL_CS	FLAT_RING1_CS
   20.11  #define __KERNEL_DS	FLAT_RING1_DS
    21.1 --- a/linux-2.4.27-xen-sparse/mkbuildtree	Mon Nov 01 00:14:22 2004 +0000
    21.2 +++ b/linux-2.4.27-xen-sparse/mkbuildtree	Mon Nov 01 00:18:29 2004 +0000
    21.3 @@ -107,11 +107,11 @@ set ${RS}/../linux-2.6.*-xen-sparse
    21.4  LINUX_26="$1"
    21.5  
    21.6  
    21.7 -# Create links to the shared definitions of the hypervisor interface
    21.8 -rm -rf ${AD}/include/asm-xen/hypervisor-ifs
    21.9 -mkdir  ${AD}/include/asm-xen/hypervisor-ifs
   21.10 -cd     ${AD}/include/asm-xen/hypervisor-ifs
   21.11 -relative_lndir ../../../${RS}/../xen/include/hypervisor-ifs
   21.12 +# Create links to the shared definitions of the Xen interfaces.
   21.13 +rm -rf ${AD}/include/asm-xen/xen-public
   21.14 +mkdir  ${AD}/include/asm-xen/xen-public
   21.15 +cd     ${AD}/include/asm-xen/xen-public
   21.16 +relative_lndir ../../../${RS}/../xen/include/public
   21.17  
   21.18  # Create a link to the shared definitions for the control interface
   21.19  cd ${AD}/include/asm-xen
    22.1 --- a/linux-2.6.9-xen-sparse/arch/xen/Makefile	Mon Nov 01 00:14:22 2004 +0000
    22.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/Makefile	Mon Nov 01 00:18:29 2004 +0000
    22.3 @@ -33,16 +33,16 @@ include/asm-xen/asm:
    22.4  	@echo '  SYMLINK $@ -> include/asm-xen/asm-$(XENARCH)'
    22.5  	@ln -fsn asm-$(XENARCH) $@
    22.6  
    22.7 -include/asm-xen/asm-$(XENARCH)/hypervisor-ifs:
    22.8 -	@echo '  SYMLINK $@ -> include/asm-xen/hypervisor-ifs'
    22.9 -	@ln -fsn ../hypervisor-ifs $@
   22.10 +include/asm-xen/asm-$(XENARCH)/xen-public:
   22.11 +	@echo '  SYMLINK $@ -> include/asm-xen/xen-public'
   22.12 +	@ln -fsn ../xen-public $@
   22.13  
   22.14  arch/xen/arch:
   22.15  	@rm -f $@
   22.16  	@ln -fsn $(XENARCH) $@
   22.17  
   22.18  prepare: include/.asm-ignore include/asm-xen/asm \
   22.19 -	include/asm-xen/asm-$(XENARCH)/hypervisor-ifs \
   22.20 +	include/asm-xen/asm-$(XENARCH)/xen-public \
   22.21  	arch/xen/arch ;
   22.22  
   22.23  all: vmlinuz
   22.24 @@ -64,6 +64,7 @@ dist:
   22.25  archclean:
   22.26  	@if [ -e arch/xen/arch ]; then $(MAKE) $(clean)=arch/xen/arch; fi;
   22.27  	@rm -f arch/xen/arch include/.asm-ignore include/asm-xen/asm
   22.28 +	@rm -f vmlinux-stripped vmlinuz
   22.29  
   22.30  define archhelp
   22.31    echo  '* vmlinuz	- Compressed kernel image'
    23.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Mon Nov 01 00:14:22 2004 +0000
    23.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Mon Nov 01 00:18:29 2004 +0000
    23.3 @@ -1,5 +1,7 @@
    23.4  #
    23.5  # Automatically generated make config: don't edit
    23.6 +# Linux kernel version: 2.6.9-xen0
    23.7 +# Sun Oct 31 21:30:07 2004
    23.8  #
    23.9  CONFIG_XEN=y
   23.10  CONFIG_ARCH_XEN=y
   23.11 @@ -33,6 +35,7 @@ CONFIG_BROKEN_ON_SMP=y
   23.12  #
   23.13  # General setup
   23.14  #
   23.15 +CONFIG_LOCALVERSION=""
   23.16  CONFIG_SWAP=y
   23.17  CONFIG_SYSVIPC=y
   23.18  # CONFIG_POSIX_MQUEUE is not set
   23.19 @@ -53,6 +56,8 @@ CONFIG_IOSCHED_AS=y
   23.20  CONFIG_IOSCHED_DEADLINE=y
   23.21  CONFIG_IOSCHED_CFQ=y
   23.22  # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
   23.23 +CONFIG_SHMEM=y
   23.24 +# CONFIG_TINY_SHMEM is not set
   23.25  
   23.26  #
   23.27  # Loadable module support
   23.28 @@ -113,10 +118,6 @@ CONFIG_HAVE_DEC_LOCK=y
   23.29  # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
   23.30  #
   23.31  CONFIG_PCI=y
   23.32 -# CONFIG_PCI_GOBIOS is not set
   23.33 -# CONFIG_PCI_GOMMCONFIG is not set
   23.34 -CONFIG_PCI_GODIRECT=y
   23.35 -# CONFIG_PCI_GOANY is not set
   23.36  CONFIG_PCI_DIRECT=y
   23.37  CONFIG_PCI_LEGACY_PROC=y
   23.38  # CONFIG_PCI_NAMES is not set
   23.39 @@ -203,6 +204,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
   23.40  # CONFIG_BLK_DEV_XD is not set
   23.41  # CONFIG_BLK_CPQ_DA is not set
   23.42  CONFIG_BLK_CPQ_CISS_DA=y
   23.43 +# CONFIG_CISS_SCSI_TAPE is not set
   23.44  # CONFIG_BLK_DEV_DAC960 is not set
   23.45  # CONFIG_BLK_DEV_UMEM is not set
   23.46  CONFIG_BLK_DEV_LOOP=y
   23.47 @@ -250,7 +252,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
   23.48  # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
   23.49  CONFIG_IDEDMA_PCI_AUTO=y
   23.50  # CONFIG_IDEDMA_ONLYDISK is not set
   23.51 -CONFIG_BLK_DEV_ADMA=y
   23.52  # CONFIG_BLK_DEV_AEC62XX is not set
   23.53  # CONFIG_BLK_DEV_ALI15X3 is not set
   23.54  # CONFIG_BLK_DEV_AMD74XX is not set
   23.55 @@ -321,7 +322,6 @@ CONFIG_SCSI_AACRAID=y
   23.56  CONFIG_SCSI_AIC7XXX=y
   23.57  CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
   23.58  CONFIG_AIC7XXX_RESET_DELAY_MS=15000
   23.59 -# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
   23.60  CONFIG_AIC7XXX_DEBUG_ENABLE=y
   23.61  CONFIG_AIC7XXX_DEBUG_MASK=0
   23.62  CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
   23.63 @@ -329,7 +329,6 @@ CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
   23.64  CONFIG_SCSI_AIC79XX=y
   23.65  CONFIG_AIC79XX_CMDS_PER_DEVICE=32
   23.66  CONFIG_AIC79XX_RESET_DELAY_MS=15000
   23.67 -# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
   23.68  # CONFIG_AIC79XX_ENABLE_RD_STRM is not set
   23.69  CONFIG_AIC79XX_DEBUG_ENABLE=y
   23.70  CONFIG_AIC79XX_DEBUG_MASK=0
   23.71 @@ -337,7 +336,8 @@ CONFIG_AIC79XX_REG_PRETTY_PRINT=y
   23.72  # CONFIG_SCSI_DPT_I2O is not set
   23.73  # CONFIG_SCSI_ADVANSYS is not set
   23.74  # CONFIG_SCSI_IN2000 is not set
   23.75 -CONFIG_SCSI_MEGARAID=y
   23.76 +# CONFIG_MEGARAID_NEWGEN is not set
   23.77 +# CONFIG_MEGARAID_LEGACY is not set
   23.78  CONFIG_SCSI_SATA=y
   23.79  # CONFIG_SCSI_SATA_SVW is not set
   23.80  CONFIG_SCSI_ATA_PIIX=y
   23.81 @@ -412,6 +412,7 @@ CONFIG_BLK_DEV_MD=y
   23.82  # CONFIG_MD_LINEAR is not set
   23.83  CONFIG_MD_RAID0=y
   23.84  CONFIG_MD_RAID1=y
   23.85 +# CONFIG_MD_RAID10 is not set
   23.86  CONFIG_MD_RAID5=y
   23.87  # CONFIG_MD_RAID6 is not set
   23.88  # CONFIG_MD_MULTIPATH is not set
   23.89 @@ -463,6 +464,7 @@ CONFIG_IP_PNP_DHCP=y
   23.90  # CONFIG_INET_AH is not set
   23.91  # CONFIG_INET_ESP is not set
   23.92  # CONFIG_INET_IPCOMP is not set
   23.93 +# CONFIG_INET_TUNNEL is not set
   23.94  
   23.95  #
   23.96  # IP: Virtual Server Configuration
   23.97 @@ -477,6 +479,8 @@ CONFIG_BRIDGE_NETFILTER=y
   23.98  # IP: Netfilter Configuration
   23.99  #
  23.100  CONFIG_IP_NF_CONNTRACK=m
  23.101 +CONFIG_IP_NF_CT_ACCT=y
  23.102 +# CONFIG_IP_NF_CT_PROTO_SCTP is not set
  23.103  CONFIG_IP_NF_FTP=m
  23.104  # CONFIG_IP_NF_IRC is not set
  23.105  # CONFIG_IP_NF_TFTP is not set
  23.106 @@ -502,18 +506,20 @@ CONFIG_IP_NF_IPTABLES=m
  23.107  # CONFIG_IP_NF_MATCH_CONNTRACK is not set
  23.108  # CONFIG_IP_NF_MATCH_OWNER is not set
  23.109  # CONFIG_IP_NF_MATCH_PHYSDEV is not set
  23.110 +# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
  23.111 +# CONFIG_IP_NF_MATCH_REALM is not set
  23.112 +# CONFIG_IP_NF_MATCH_SCTP is not set
  23.113 +# CONFIG_IP_NF_MATCH_COMMENT is not set
  23.114  # CONFIG_IP_NF_FILTER is not set
  23.115 -# CONFIG_IP_NF_NAT is not set
  23.116 -# CONFIG_IP_NF_MANGLE is not set
  23.117  # CONFIG_IP_NF_TARGET_LOG is not set
  23.118  # CONFIG_IP_NF_TARGET_ULOG is not set
  23.119  # CONFIG_IP_NF_TARGET_TCPMSS is not set
  23.120 +# CONFIG_IP_NF_NAT is not set
  23.121 +# CONFIG_IP_NF_MANGLE is not set
  23.122 +# CONFIG_IP_NF_RAW is not set
  23.123  # CONFIG_IP_NF_ARPTABLES is not set
  23.124  # CONFIG_IP_NF_COMPAT_IPCHAINS is not set
  23.125  # CONFIG_IP_NF_COMPAT_IPFWADM is not set
  23.126 -# CONFIG_IP_NF_RAW is not set
  23.127 -# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
  23.128 -# CONFIG_IP_NF_MATCH_REALM is not set
  23.129  
  23.130  #
  23.131  # Bridge: Netfilter Configuration
  23.132 @@ -718,6 +724,7 @@ CONFIG_SERIO_I8042=y
  23.133  CONFIG_SERIO_SERPORT=y
  23.134  # CONFIG_SERIO_CT82C710 is not set
  23.135  # CONFIG_SERIO_PCIPS2 is not set
  23.136 +# CONFIG_SERIO_RAW is not set
  23.137  
  23.138  #
  23.139  # Input Device Drivers
  23.140 @@ -758,7 +765,6 @@ CONFIG_HW_CONSOLE=y
  23.141  CONFIG_UNIX98_PTYS=y
  23.142  CONFIG_LEGACY_PTYS=y
  23.143  CONFIG_LEGACY_PTY_COUNT=256
  23.144 -# CONFIG_QIC02_TAPE is not set
  23.145  
  23.146  #
  23.147  # IPMI
  23.148 @@ -936,6 +942,7 @@ CONFIG_LOCKD_V4=y
  23.149  CONFIG_EXPORTFS=m
  23.150  CONFIG_SUNRPC=y
  23.151  # CONFIG_RPCSEC_GSS_KRB5 is not set
  23.152 +# CONFIG_RPCSEC_GSS_SPKM3 is not set
  23.153  # CONFIG_SMB_FS is not set
  23.154  # CONFIG_CIFS is not set
  23.155  # CONFIG_NCP_FS is not set
  23.156 @@ -1008,6 +1015,7 @@ CONFIG_CRYPTO_MD5=m
  23.157  CONFIG_CRYPTO_SHA1=m
  23.158  # CONFIG_CRYPTO_SHA256 is not set
  23.159  # CONFIG_CRYPTO_SHA512 is not set
  23.160 +# CONFIG_CRYPTO_WP512 is not set
  23.161  CONFIG_CRYPTO_DES=m
  23.162  # CONFIG_CRYPTO_BLOWFISH is not set
  23.163  # CONFIG_CRYPTO_TWOFISH is not set
    24.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig	Mon Nov 01 00:14:22 2004 +0000
    24.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig	Mon Nov 01 00:18:29 2004 +0000
    24.3 @@ -1,5 +1,7 @@
    24.4  #
    24.5  # Automatically generated make config: don't edit
    24.6 +# Linux kernel version: 2.6.9-xen0
    24.7 +# Sun Oct 31 21:32:23 2004
    24.8  #
    24.9  CONFIG_XEN=y
   24.10  CONFIG_ARCH_XEN=y
   24.11 @@ -32,6 +34,7 @@ CONFIG_BROKEN_ON_SMP=y
   24.12  #
   24.13  # General setup
   24.14  #
   24.15 +CONFIG_LOCALVERSION=""
   24.16  CONFIG_SWAP=y
   24.17  CONFIG_SYSVIPC=y
   24.18  # CONFIG_POSIX_MQUEUE is not set
   24.19 @@ -51,6 +54,8 @@ CONFIG_IOSCHED_AS=y
   24.20  CONFIG_IOSCHED_DEADLINE=y
   24.21  CONFIG_IOSCHED_CFQ=y
   24.22  # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
   24.23 +CONFIG_SHMEM=y
   24.24 +# CONFIG_TINY_SHMEM is not set
   24.25  
   24.26  #
   24.27  # Loadable module support
   24.28 @@ -180,9 +185,7 @@ CONFIG_BLK_DEV_SD=m
   24.29  #
   24.30  # SCSI low-level drivers
   24.31  #
   24.32 -# CONFIG_SCSI_AIC7XXX_OLD is not set
   24.33  # CONFIG_SCSI_SATA is not set
   24.34 -# CONFIG_SCSI_EATA_PIO is not set
   24.35  # CONFIG_SCSI_DEBUG is not set
   24.36  
   24.37  #
   24.38 @@ -217,6 +220,7 @@ CONFIG_IP_PNP=y
   24.39  # CONFIG_INET_AH is not set
   24.40  # CONFIG_INET_ESP is not set
   24.41  # CONFIG_INET_IPCOMP is not set
   24.42 +# CONFIG_INET_TUNNEL is not set
   24.43  # CONFIG_IPV6 is not set
   24.44  # CONFIG_NETFILTER is not set
   24.45  
   24.46 @@ -379,6 +383,7 @@ CONFIG_LOCKD_V4=y
   24.47  # CONFIG_EXPORTFS is not set
   24.48  CONFIG_SUNRPC=y
   24.49  # CONFIG_RPCSEC_GSS_KRB5 is not set
   24.50 +# CONFIG_RPCSEC_GSS_SPKM3 is not set
   24.51  # CONFIG_SMB_FS is not set
   24.52  # CONFIG_CIFS is not set
   24.53  # CONFIG_NCP_FS is not set
   24.54 @@ -451,6 +456,7 @@ CONFIG_CRYPTO_MD5=m
   24.55  # CONFIG_CRYPTO_SHA1 is not set
   24.56  # CONFIG_CRYPTO_SHA256 is not set
   24.57  # CONFIG_CRYPTO_SHA512 is not set
   24.58 +# CONFIG_CRYPTO_WP512 is not set
   24.59  # CONFIG_CRYPTO_DES is not set
   24.60  # CONFIG_CRYPTO_BLOWFISH is not set
   24.61  # CONFIG_CRYPTO_TWOFISH is not set
    25.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/entry.S	Mon Nov 01 00:14:22 2004 +0000
    25.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/entry.S	Mon Nov 01 00:18:29 2004 +0000
    25.3 @@ -48,7 +48,7 @@
    25.4  #include <asm/smp.h>
    25.5  #include <asm/page.h>
    25.6  #include "irq_vectors.h"
    25.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    25.8 +#include <asm/xen-public/xen.h>
    25.9  
   25.10  #define nr_syscalls ((syscall_table_size)/4)
   25.11  
    26.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/head.S	Mon Nov 01 00:14:22 2004 +0000
    26.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/head.S	Mon Nov 01 00:18:29 2004 +0000
    26.3 @@ -15,7 +15,7 @@
    26.4  #include <asm/segment.h>
    26.5  #include <asm/thread_info.h>
    26.6  #include <asm/asm_offsets.h>
    26.7 -#include <asm/hypervisor-ifs/arch-x86_32.h>
    26.8 +#include <asm/xen-public/arch-x86_32.h>
    26.9  
   26.10  /*
   26.11   * References to members of the new_cpu_data structure.
    27.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/ioport.c	Mon Nov 01 00:14:22 2004 +0000
    27.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/ioport.c	Mon Nov 01 00:18:29 2004 +0000
    27.3 @@ -8,7 +8,7 @@
    27.4  #include <linux/smp_lock.h>
    27.5  #include <linux/stddef.h>
    27.6  #include <linux/slab.h>
    27.7 -#include <asm/hypervisor-ifs/dom0_ops.h>
    27.8 +#include <asm/xen-public/dom0_ops.h>
    27.9  
   27.10  asmlinkage long sys_iopl(unsigned int new_io_pl)
   27.11  {
    28.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c	Mon Nov 01 00:14:22 2004 +0000
    28.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c	Mon Nov 01 00:18:29 2004 +0000
    28.3 @@ -47,7 +47,7 @@
    28.4  #include <asm/irq.h>
    28.5  #include <asm/desc.h>
    28.6  #include <asm-xen/multicall.h>
    28.7 -#include <asm/hypervisor-ifs/dom0_ops.h>
    28.8 +#include <asm/xen-public/dom0_ops.h>
    28.9  #ifdef CONFIG_MATH_EMULATION
   28.10  #include <asm/math_emu.h>
   28.11  #endif
    29.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/pci/direct.c	Mon Nov 01 00:14:22 2004 +0000
    29.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/pci/direct.c	Mon Nov 01 00:18:29 2004 +0000
    29.3 @@ -6,8 +6,8 @@
    29.4  #include <linux/init.h>
    29.5  #include "pci.h"
    29.6  
    29.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    29.8 -#include <asm/hypervisor-ifs/physdev.h>
    29.9 +#include <asm/xen-public/xen.h>
   29.10 +#include <asm/xen-public/physdev.h>
   29.11  
   29.12  /*
   29.13   * Functions for accessing PCI configuration space with type xen accesses
    30.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/pci/irq.c	Mon Nov 01 00:14:22 2004 +0000
    30.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/pci/irq.c	Mon Nov 01 00:18:29 2004 +0000
    30.3 @@ -19,8 +19,8 @@
    30.4  
    30.5  #include "pci.h"
    30.6  
    30.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    30.8 -#include <asm/hypervisor-ifs/physdev.h>
    30.9 +#include <asm/xen-public/xen.h>
   30.10 +#include <asm/xen-public/physdev.h>
   30.11  
   30.12  /*
   30.13   * Never use: 0, 1, 2 (timer, keyboard, and cascade)
    31.1 --- a/linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c	Mon Nov 01 00:14:22 2004 +0000
    31.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c	Mon Nov 01 00:18:29 2004 +0000
    31.3 @@ -38,8 +38,8 @@
    31.4  #include <asm/system.h>
    31.5  #include <asm/ptrace.h>
    31.6  #include <asm/synch_bitops.h>
    31.7 -#include <asm/hypervisor-ifs/event_channel.h>
    31.8 -#include <asm/hypervisor-ifs/physdev.h>
    31.9 +#include <asm/xen-public/event_channel.h>
   31.10 +#include <asm/xen-public/physdev.h>
   31.11  #include <asm-xen/ctrl_if.h>
   31.12  #include <asm-xen/hypervisor.h>
   31.13  
    32.1 --- a/linux-2.6.9-xen-sparse/arch/xen/kernel/reboot.c	Mon Nov 01 00:14:22 2004 +0000
    32.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/kernel/reboot.c	Mon Nov 01 00:18:29 2004 +0000
    32.3 @@ -12,7 +12,7 @@ static int errno;
    32.4  #include <asm/mmu_context.h>
    32.5  #include <asm-xen/ctrl_if.h>
    32.6  #include <asm-xen/hypervisor.h>
    32.7 -#include <asm-xen/hypervisor-ifs/dom0_ops.h>
    32.8 +#include <asm-xen/xen-public/dom0_ops.h>
    32.9  #include <asm-xen/suspend.h>
   32.10  #include <asm-xen/queues.h>
   32.11  
    33.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/blkback/common.h	Mon Nov 01 00:14:22 2004 +0000
    33.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/blkback/common.h	Mon Nov 01 00:18:29 2004 +0000
    33.3 @@ -14,7 +14,7 @@
    33.4  #include <asm/pgalloc.h>
    33.5  #include <asm-xen/ctrl_if.h>
    33.6  #include <asm-xen/hypervisor.h>
    33.7 -#include <asm-xen/hypervisor-ifs/io/blkif.h>
    33.8 +#include <asm-xen/xen-public/io/blkif.h>
    33.9  
   33.10  #if 0
   33.11  #define ASSERT(_p) \
    34.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h	Mon Nov 01 00:14:22 2004 +0000
    34.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h	Mon Nov 01 00:18:29 2004 +0000
    34.3 @@ -44,8 +44,8 @@
    34.4  #include <linux/blkdev.h>
    34.5  #include <linux/major.h>
    34.6  #include <linux/devfs_fs_kernel.h>
    34.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    34.8 -#include <asm-xen/hypervisor-ifs/io/blkif.h>
    34.9 +#include <asm/xen-public/xen.h>
   34.10 +#include <asm-xen/xen-public/io/blkif.h>
   34.11  #include <asm/io.h>
   34.12  #include <asm/atomic.h>
   34.13  #include <asm/uaccess.h>
    35.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/console/console.c	Mon Nov 01 00:14:22 2004 +0000
    35.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/console/console.c	Mon Nov 01 00:18:29 2004 +0000
    35.3 @@ -47,7 +47,7 @@
    35.4  #include <asm/io.h>
    35.5  #include <asm/irq.h>
    35.6  #include <asm/uaccess.h>
    35.7 -#include <asm/hypervisor-ifs/event_channel.h>
    35.8 +#include <asm/xen-public/event_channel.h>
    35.9  #include <asm-xen/hypervisor.h>
   35.10  #include <asm-xen/evtchn.h>
   35.11  #include <asm-xen/ctrl_if.h>
    36.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/netback/common.h	Mon Nov 01 00:14:22 2004 +0000
    36.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/netback/common.h	Mon Nov 01 00:18:29 2004 +0000
    36.3 @@ -15,7 +15,7 @@
    36.4  #include <linux/netdevice.h>
    36.5  #include <linux/etherdevice.h>
    36.6  #include <asm-xen/ctrl_if.h>
    36.7 -#include <asm-xen/hypervisor-ifs/io/netif.h>
    36.8 +#include <asm-xen/xen-public/io/netif.h>
    36.9  #include <asm/io.h>
   36.10  #include <asm/pgalloc.h>
   36.11  
    37.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/netfront/netfront.c	Mon Nov 01 00:14:22 2004 +0000
    37.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/netfront/netfront.c	Mon Nov 01 00:18:29 2004 +0000
    37.3 @@ -44,7 +44,7 @@
    37.4  #include <asm/io.h>
    37.5  #include <asm-xen/evtchn.h>
    37.6  #include <asm-xen/ctrl_if.h>
    37.7 -#include <asm-xen/hypervisor-ifs/io/netif.h>
    37.8 +#include <asm-xen/xen-public/io/netif.h>
    37.9  #include <asm/page.h>
   37.10  
   37.11  #include <net/arp.h>
    38.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/privcmd/privcmd.c	Mon Nov 01 00:14:22 2004 +0000
    38.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/privcmd/privcmd.c	Mon Nov 01 00:18:29 2004 +0000
    38.3 @@ -26,7 +26,7 @@
    38.4  #include <asm/uaccess.h>
    38.5  #include <asm/tlb.h>
    38.6  #include <asm-xen/proc_cmd.h>
    38.7 -#include <asm/hypervisor-ifs/dom0_ops.h>
    38.8 +#include <asm/xen-public/dom0_ops.h>
    38.9  #include <asm-xen/xen_proc.h>
   38.10  
   38.11  static struct proc_dir_entry *privcmd_intf;
    39.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/page.h	Mon Nov 01 00:14:22 2004 +0000
    39.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/page.h	Mon Nov 01 00:18:29 2004 +0000
    39.3 @@ -15,7 +15,7 @@
    39.4  #include <linux/config.h>
    39.5  #include <linux/string.h>
    39.6  #include <linux/types.h>
    39.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    39.8 +#include <asm/xen-public/xen.h>
    39.9  
   39.10  #ifdef CONFIG_XEN_SCRUB_PAGES
   39.11  #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
    40.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/evtchn.h	Mon Nov 01 00:14:22 2004 +0000
    40.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/evtchn.h	Mon Nov 01 00:18:29 2004 +0000
    40.3 @@ -35,7 +35,7 @@
    40.4  #include <asm-xen/hypervisor.h>
    40.5  #include <asm/ptrace.h>
    40.6  #include <asm/synch_bitops.h>
    40.7 -#include <asm/hypervisor-ifs/event_channel.h>
    40.8 +#include <asm/xen-public/event_channel.h>
    40.9  
   40.10  /*
   40.11   * LOW-LEVEL DEFINITIONS
    41.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/gnttab.h	Mon Nov 01 00:14:22 2004 +0000
    41.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/gnttab.h	Mon Nov 01 00:18:29 2004 +0000
    41.3 @@ -14,7 +14,7 @@
    41.4  
    41.5  #include <linux/config.h>
    41.6  #include <asm-xen/hypervisor.h>
    41.7 -#include <asm-xen/hypervisor-ifs/grant_table.h>
    41.8 +#include <asm-xen/xen-public/grant_table.h>
    41.9  
   41.10  int
   41.11  gnttab_grant_foreign_access(
    42.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/hypervisor.h	Mon Nov 01 00:14:22 2004 +0000
    42.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/hypervisor.h	Mon Nov 01 00:18:29 2004 +0000
    42.3 @@ -33,9 +33,9 @@
    42.4  #include <linux/types.h>
    42.5  #include <linux/kernel.h>
    42.6  #include <linux/version.h>
    42.7 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    42.8 -#include <asm/hypervisor-ifs/dom0_ops.h>
    42.9 -#include <asm/hypervisor-ifs/io/domain_controller.h>
   42.10 +#include <asm/xen-public/xen.h>
   42.11 +#include <asm/xen-public/dom0_ops.h>
   42.12 +#include <asm/xen-public/io/domain_controller.h>
   42.13  #include <asm/ptrace.h>
   42.14  #include <asm/page.h>
   42.15  
    43.1 --- a/linux-2.6.9-xen-sparse/mkbuildtree	Mon Nov 01 00:14:22 2004 +0000
    43.2 +++ b/linux-2.6.9-xen-sparse/mkbuildtree	Mon Nov 01 00:18:29 2004 +0000
    43.3 @@ -103,9 +103,9 @@ relative_lndir ${RS}
    43.4  rm -f mkbuildtree
    43.5  
    43.6  
    43.7 -# Create links to the shared definitions of the hypervisor interface
    43.8 -rm -rf ${AD}/include/asm-xen/hypervisor-ifs
    43.9 -mkdir  ${AD}/include/asm-xen/hypervisor-ifs
   43.10 -cd     ${AD}/include/asm-xen/hypervisor-ifs
   43.11 -relative_lndir ../../../${RS}/../xen/include/hypervisor-ifs
   43.12 +# Create links to the shared definitions of the Xen interfaces.
   43.13 +rm -rf ${AD}/include/asm-xen/xen-public
   43.14 +mkdir  ${AD}/include/asm-xen/xen-public
   43.15 +cd     ${AD}/include/asm-xen/xen-public
   43.16 +relative_lndir ../../../${RS}/../xen/include/public
   43.17  
    44.1 --- a/netbsd-2.0-xen-sparse/mkbuildtree	Mon Nov 01 00:14:22 2004 +0000
    44.2 +++ b/netbsd-2.0-xen-sparse/mkbuildtree	Mon Nov 01 00:18:29 2004 +0000
    44.3 @@ -103,11 +103,11 @@ relative_lndir ${RS}
    44.4  rm -f mkbuildtree
    44.5  
    44.6  
    44.7 -# Create links to the shared definitions of the hypervisor interface
    44.8 -rm -rf ${AD}/sys/arch/xen/include/hypervisor-ifs
    44.9 -mkdir  ${AD}/sys/arch/xen/include/hypervisor-ifs
   44.10 -cd     ${AD}/sys/arch/xen/include/hypervisor-ifs
   44.11 -relative_lndir ../../../../../${RS}/../xen/include/hypervisor-ifs
   44.12 +# Create links to the shared definitions of the Xen interface
   44.13 +rm -rf ${AD}/sys/arch/xen/include/xen-public
   44.14 +mkdir  ${AD}/sys/arch/xen/include/xen-public
   44.15 +cd     ${AD}/sys/arch/xen/include/xen-public
   44.16 +relative_lndir ../../../../../${RS}/../xen/include/public
   44.17  
   44.18  # Remove files which don't exist anymore
   44.19  rm -rf ${AD}/sys/arch/xen/xen/events.c
    45.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/include/hypervisor.h	Mon Nov 01 00:14:22 2004 +0000
    45.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/include/hypervisor.h	Mon Nov 01 00:18:29 2004 +0000
    45.3 @@ -54,12 +54,12 @@ struct xen_npx_attach_args {
    45.4  
    45.5  /* include the hypervisor interface */
    45.6  #include <sys/systm.h>
    45.7 -#include <machine/hypervisor-ifs/hypervisor-if.h>
    45.8 -#include <machine/hypervisor-ifs/dom0_ops.h>
    45.9 -#include <machine/hypervisor-ifs/event_channel.h>
   45.10 -#include <machine/hypervisor-ifs/io/domain_controller.h>
   45.11 -#include <machine/hypervisor-ifs/io/netif.h>
   45.12 -#include <machine/hypervisor-ifs/io/blkif.h>
   45.13 +#include <machine/xen-public/xen.h>
   45.14 +#include <machine/xen-public/dom0_ops.h>
   45.15 +#include <machine/xen-public/event_channel.h>
   45.16 +#include <machine/xen-public/io/domain_controller.h>
   45.17 +#include <machine/xen-public/io/netif.h>
   45.18 +#include <machine/xen-public/io/blkif.h>
   45.19  
   45.20  #undef u8
   45.21  #undef u16
    46.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/include/xen.h	Mon Nov 01 00:14:22 2004 +0000
    46.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/include/xen.h	Mon Nov 01 00:18:29 2004 +0000
    46.3 @@ -85,7 +85,7 @@ void vprintk(const char *, va_list);
    46.4  
    46.5  
    46.6  /*
    46.7 - * these are also defined in hypervisor-if.h but can't be pulled in as
    46.8 + * these are also defined in xen-public/xen.h but can't be pulled in as
    46.9   * they are used in start of day assembly. Need to clean up the .h files
   46.10   * a bit more...
   46.11   */
    47.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/xen/xenkbc.c	Mon Nov 01 00:14:22 2004 +0000
    47.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/xen/xenkbc.c	Mon Nov 01 00:18:29 2004 +0000
    47.3 @@ -74,7 +74,7 @@
    47.4  #include <machine/xenkbcvar.h>
    47.5  #include <machine/xen.h>
    47.6  #include <machine/hypervisor.h>
    47.7 -#include <machine/hypervisor-ifs/kbd.h>
    47.8 +#include <machine/xen-public/kbd.h>
    47.9  #include <machine/evtchn.h>
   47.10  
   47.11  #define	KBC_DELAY	DELAY(1000)
    48.1 --- a/tools/Make.defs	Mon Nov 01 00:14:22 2004 +0000
    48.2 +++ b/tools/Make.defs	Mon Nov 01 00:18:29 2004 +0000
    48.3 @@ -1,5 +1,5 @@
    48.4  #  -*- mode: Makefile; -*-
    48.5 -XEN_HYPERVISOR_IFS = $(XEN_ROOT)/xen/include/hypervisor-ifs
    48.6 +XEN_HYPERVISOR_IFS = $(XEN_ROOT)/xen/include/public
    48.7  XEN_LINUX_INCLUDE  = $(XEN_ROOT)/linux-xen-sparse/include
    48.8  XEN_XC             = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
    48.9  XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
    49.1 --- a/tools/libxc/Makefile	Mon Nov 01 00:14:22 2004 +0000
    49.2 +++ b/tools/libxc/Makefile	Mon Nov 01 00:18:29 2004 +0000
    49.3 @@ -8,9 +8,6 @@ CC       = gcc
    49.4  XEN_ROOT = ../..
    49.5  include $(XEN_ROOT)/tools/Make.defs
    49.6  
    49.7 -vpath %.h      $(XEN_HYPERVISOR_IFS)
    49.8 -INCLUDES += -I $(XEN_HYPERVISOR_IFS)
    49.9 -
   49.10  vpath %h       $(XEN_LINUX_INCLUDE)
   49.11  INCLUDES += -I $(XEN_LINUX_INCLUDE)
   49.12  
   49.13 @@ -44,7 +41,7 @@ OBJS     = $(patsubst %.c,%.o,$(SRCS))
   49.14  
   49.15  LIB      = libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
   49.16  
   49.17 -all: check-for-zlib $(LIB)
   49.18 +all: check-for-zlib mk-symlinks $(LIB)
   49.19  
   49.20  check-for-zlib:
   49.21  	@if [ ! -e /usr/include/zlib.h ]; then \
   49.22 @@ -54,6 +51,9 @@ check-for-zlib:
   49.23  	false; \
   49.24  	fi
   49.25  
   49.26 +mk-symlinks:
   49.27 +	[ -e xen ] || ln -sf $(XEN_HYPERVISOR_IFS) xen
   49.28 +
   49.29  install: all
   49.30  	mkdir -p $(prefix)/usr/lib
   49.31  	mkdir -p $(prefix)/usr/include
   49.32 @@ -61,9 +61,7 @@ install: all
   49.33  	install -m0644 xc.h $(prefix)/usr/include
   49.34  
   49.35  clean:
   49.36 -	$(RM) *.a *.so *.o *.rpm $(LIB)
   49.37 -	$(RM) *~
   49.38 -	$(RM) $(DEPS)
   49.39 +	$(RM) *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) xen
   49.40  
   49.41  rpm: all
   49.42  	rm -rf staging
    50.1 --- a/tools/libxc/xc.h	Mon Nov 01 00:14:22 2004 +0000
    50.2 +++ b/tools/libxc/xc.h	Mon Nov 01 00:18:29 2004 +0000
    50.3 @@ -3,7 +3,7 @@
    50.4   * 
    50.5   * A library for low-level access to the Xen control interfaces.
    50.6   * 
    50.7 - * Copyright (c) 2003, K A Fraser.
    50.8 + * Copyright (c) 2003-2004, K A Fraser.
    50.9   */
   50.10  
   50.11  #ifndef __XC_H__
   50.12 @@ -18,6 +18,12 @@ typedef signed short       s16;
   50.13  typedef signed long        s32;
   50.14  typedef signed long long   s64;
   50.15  
   50.16 +#include "xen/xen.h"
   50.17 +#include "xen/dom0_ops.h"
   50.18 +#include "xen/event_channel.h"
   50.19 +#include "xen/sched_ctl.h"
   50.20 +#include "xen/io/domain_controller.h"
   50.21 +
   50.22  /* Obtain or relinquish a handle on the 'xc' library. */
   50.23  int xc_interface_open(void);
   50.24  int xc_interface_close(int xc_handle);
   50.25 @@ -34,14 +40,7 @@ typedef struct {
   50.26      unsigned long max_memkb;
   50.27  } xc_dominfo_t;
   50.28  
   50.29 -typedef struct xc_shadow_control_stats_st
   50.30 -{
   50.31 -    unsigned long fault_count;
   50.32 -    unsigned long dirty_count;
   50.33 -    unsigned long dirty_net_count;     
   50.34 -    unsigned long dirty_block_count;     
   50.35 -} xc_shadow_control_stats_t;
   50.36 -
   50.37 +typedef dom0_getdomaininfo_t xc_domaininfo_t;
   50.38  int xc_domain_create(int xc_handle, 
   50.39                       unsigned int mem_kb, 
   50.40                       int cpu,
   50.41 @@ -60,10 +59,18 @@ int xc_domain_getinfo(int xc_handle,
   50.42                        u32 first_domid, 
   50.43                        unsigned int max_doms,
   50.44                        xc_dominfo_t *info);
   50.45 +int xc_domain_getfullinfo(int xc_handle,
   50.46 +                          u32 domid,
   50.47 +                          xc_domaininfo_t *info,
   50.48 +                          full_execution_context_t *ctxt);
   50.49  int xc_domain_setcpuweight(int xc_handle,
   50.50                             u32 domid,
   50.51                             float weight);
   50.52 +long long xc_domain_get_cpu_usage(int xc_handle,
   50.53 +                                  domid_t domid);
   50.54  
   50.55 +
   50.56 +typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
   50.57  int xc_shadow_control(int xc_handle,
   50.58                        u32 domid, 
   50.59                        unsigned int sop,
   50.60 @@ -125,27 +132,7 @@ int xc_rrobin_global_set(int xc_handle, 
   50.61  
   50.62  int xc_rrobin_global_get(int xc_handle, u64 *slice);
   50.63  
   50.64 -#define DOMID_SELF              (0x7FF0U)
   50.65 -#define DOMID_IO                (0x7FF1U)
   50.66 -#define DOMID_XEN               (0x7FF2U)
   50.67 -
   50.68 -typedef struct {
   50.69 -#define EVTCHNSTAT_closed       0  /* Chennel is not in use.                 */
   50.70 -#define EVTCHNSTAT_unbound      1  /* Channel is not bound to a source.      */
   50.71 -#define EVTCHNSTAT_interdomain  2  /* Channel is connected to remote domain. */
   50.72 -#define EVTCHNSTAT_pirq         3  /* Channel is bound to a phys IRQ line.   */
   50.73 -#define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
   50.74 -    int status;
   50.75 -    union {
   50.76 -        struct {
   50.77 -            u32 dom;
   50.78 -            int port;
   50.79 -        } interdomain;
   50.80 -        int pirq;
   50.81 -        int virq;
   50.82 -    } u;
   50.83 -} xc_evtchn_status_t;
   50.84 -
   50.85 +typedef evtchn_status_t xc_evtchn_status_t;
   50.86  int xc_evtchn_alloc_unbound(int xc_handle,
   50.87                              u32 dom,
   50.88                              int *port);
   50.89 @@ -179,14 +166,7 @@ int xc_readconsolering(int xc_handle,
   50.90                         unsigned int max_chars, 
   50.91                         int clear);
   50.92  
   50.93 -typedef struct {
   50.94 -    int ht_per_core;
   50.95 -    int cores;
   50.96 -    unsigned long total_pages;
   50.97 -    unsigned long free_pages;
   50.98 -    unsigned long cpu_khz;
   50.99 -} xc_physinfo_t;
  50.100 -
  50.101 +typedef dom0_physinfo_t xc_physinfo_t;
  50.102  int xc_physinfo(int xc_handle,
  50.103                  xc_physinfo_t *info);
  50.104  
    51.1 --- a/tools/libxc/xc_domain.c	Mon Nov 01 00:14:22 2004 +0000
    51.2 +++ b/tools/libxc/xc_domain.c	Mon Nov 01 00:18:29 2004 +0000
    51.3 @@ -120,16 +120,21 @@ int xc_domain_getinfo(int xc_handle,
    51.4  
    51.5  int xc_domain_getfullinfo(int xc_handle,
    51.6                            u32 domid,
    51.7 -                          dom0_op_t *op,
    51.8 -                          full_execution_context_t *ctxt )
    51.9 +                          xc_domaininfo_t *info,
   51.10 +                          full_execution_context_t *ctxt)
   51.11  {
   51.12      int rc;
   51.13 -    op->cmd = DOM0_GETDOMAININFO;
   51.14 -    op->u.getdomaininfo.domain = (domid_t)domid;
   51.15 -    op->u.getdomaininfo.ctxt = ctxt;
   51.16 +    dom0_op_t op;
   51.17 +
   51.18 +    op.cmd = DOM0_GETDOMAININFO;
   51.19 +    op.u.getdomaininfo.domain = (domid_t)domid;
   51.20 +    op.u.getdomaininfo.ctxt = ctxt;
   51.21  
   51.22 -    rc = do_dom0_op(xc_handle, op);
   51.23 -    if ( ((u16)op->u.getdomaininfo.domain != domid) && rc > 0 )
   51.24 +    rc = do_dom0_op(xc_handle, &op);
   51.25 +
   51.26 +    memcpy(info, &op.u.getdomaininfo, sizeof(*info));
   51.27 +
   51.28 +    if ( ((u16)op.u.getdomaininfo.domain != domid) && rc > 0 )
   51.29          return -ESRCH;
   51.30      else
   51.31          return rc;
    52.1 --- a/tools/libxc/xc_evtchn.c	Mon Nov 01 00:14:22 2004 +0000
    52.2 +++ b/tools/libxc/xc_evtchn.c	Mon Nov 01 00:18:29 2004 +0000
    52.3 @@ -134,21 +134,7 @@ int xc_evtchn_status(int xc_handle,
    52.4      op.u.status.port = port;
    52.5     
    52.6      if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
    52.7 -    {
    52.8 -        switch ( status->status = op.u.status.status )
    52.9 -        {
   52.10 -        case EVTCHNSTAT_interdomain:
   52.11 -            status->u.interdomain.dom  = (u16)op.u.status.u.interdomain.dom;
   52.12 -            status->u.interdomain.port = op.u.status.u.interdomain.port;
   52.13 -            break;
   52.14 -        case EVTCHNSTAT_pirq:
   52.15 -            status->u.pirq = op.u.status.u.pirq;
   52.16 -            break;
   52.17 -        case EVTCHNSTAT_virq:
   52.18 -            status->u.virq = op.u.status.u.virq;
   52.19 -            break;
   52.20 -        }
   52.21 -    }
   52.22 +        memcpy(status, &op.u.status, sizeof(*status));
   52.23      
   52.24      return rc;
   52.25  }
    53.1 --- a/tools/libxc/xc_linux_save.c	Mon Nov 01 00:14:22 2004 +0000
    53.2 +++ b/tools/libxc/xc_linux_save.c	Mon Nov 01 00:18:29 2004 +0000
    53.3 @@ -319,9 +319,9 @@ static int analysis_phase( int xc_handle
    53.4  }
    53.5  
    53.6  
    53.7 -int suspend_and_state( int xc_handle, XcIOContext *ioctxt,		      
    53.8 -		       dom0_op_t *op,
    53.9 -		       full_execution_context_t *ctxt )
   53.10 +int suspend_and_state(int xc_handle, XcIOContext *ioctxt,		      
   53.11 +                      xc_domaininfo_t *info,
   53.12 +                      full_execution_context_t *ctxt)
   53.13  {
   53.14      int i=0;
   53.15      
   53.16 @@ -329,26 +329,26 @@ int suspend_and_state( int xc_handle, Xc
   53.17  
   53.18  retry:
   53.19  
   53.20 -    if ( xc_domain_getfullinfo( xc_handle, ioctxt->domain, op, ctxt) )
   53.21 +    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, info, ctxt) )
   53.22      {
   53.23  	xcio_error(ioctxt, "Could not get full domain info");
   53.24  	return -1;
   53.25      }
   53.26  
   53.27 -    if ( (op->u.getdomaininfo.flags & 
   53.28 -	  ( DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT) ))
   53.29 -	 == ( DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT) ))
   53.30 +    if ( (info->flags & 
   53.31 +          (DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT))) ==
   53.32 +         (DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT)) )
   53.33      {
   53.34  	return 0; // success
   53.35      }
   53.36  
   53.37 -    if ( op->u.getdomaininfo.flags & DOMFLAGS_PAUSED )
   53.38 +    if ( info->flags & DOMFLAGS_PAUSED )
   53.39      {
   53.40  	// try unpausing domain, wait, and retest	
   53.41  	xc_domain_unpause( xc_handle, ioctxt->domain );
   53.42  
   53.43  	xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%lx)",
   53.44 -		   op->u.getdomaininfo.flags);
   53.45 +		   info->flags);
   53.46  	usleep(10000);  // 10ms
   53.47  
   53.48  	goto retry;
   53.49 @@ -358,20 +358,21 @@ retry:
   53.50      if( ++i < 100 )
   53.51      {
   53.52  	xcio_error(ioctxt, "Retry suspend domain (%lx)",
   53.53 -		   op->u.getdomaininfo.flags);
   53.54 +		   info->flags);
   53.55  	usleep(10000);  // 10ms	
   53.56  	goto retry;
   53.57      }
   53.58  
   53.59      xcio_error(ioctxt, "Unable to suspend domain. (%lx)",
   53.60 -	       op->u.getdomaininfo.flags);
   53.61 +	       info->flags);
   53.62  
   53.63      return -1;
   53.64  }
   53.65  
   53.66  int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
   53.67  {
   53.68 -    dom0_op_t op;
   53.69 +    xc_domaininfo_t info;
   53.70 +
   53.71      int rc = 1, i, j, k, last_iter, iter = 0;
   53.72      unsigned long mfn;
   53.73      u32 domid = ioctxt->domain;
   53.74 @@ -441,12 +442,12 @@ int xc_linux_save(int xc_handle, XcIOCon
   53.75          return 1;
   53.76      }
   53.77  
   53.78 -    if ( xc_domain_getfullinfo( xc_handle, domid, &op, &ctxt) )
   53.79 +    if ( xc_domain_getfullinfo( xc_handle, domid, &info, &ctxt) )
   53.80      {
   53.81          xcio_error(ioctxt, "Could not get full domain info");
   53.82          goto out;
   53.83      }
   53.84 -    shared_info_frame = op.u.getdomaininfo.shared_info_frame;
   53.85 +    shared_info_frame = info.shared_info_frame;
   53.86  
   53.87      /* A cheesy test to see whether the domain contains valid state. */
   53.88      if ( ctxt.pt_base == 0 ){
   53.89 @@ -454,7 +455,7 @@ int xc_linux_save(int xc_handle, XcIOCon
   53.90          goto out;
   53.91      }
   53.92      
   53.93 -    nr_pfns = op.u.getdomaininfo.max_pages; 
   53.94 +    nr_pfns = info.max_pages; 
   53.95  
   53.96      /* cheesy sanity check */
   53.97      if ( nr_pfns > 1024*1024 ){
   53.98 @@ -536,10 +537,10 @@ int xc_linux_save(int xc_handle, XcIOCon
   53.99  
  53.100          last_iter = 1;
  53.101  
  53.102 -	if ( suspend_and_state( xc_handle, ioctxt, &op, &ctxt) )
  53.103 +	if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
  53.104  	{
  53.105  	    xcio_error(ioctxt, "Domain appears not to have suspended: %lx",
  53.106 -		       op.u.getdomaininfo.flags);
  53.107 +		       info.flags);
  53.108  	    goto out;
  53.109  	}
  53.110  
  53.111 @@ -900,17 +901,17 @@ int xc_linux_save(int xc_handle, XcIOCon
  53.112                  DPRINTF("Start last iteration\n");
  53.113                  last_iter = 1;
  53.114  
  53.115 -		if ( suspend_and_state( xc_handle, ioctxt, &op, &ctxt) )
  53.116 +		if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
  53.117  		{
  53.118  		    xcio_error(ioctxt, "Domain appears not to have suspended: %lx",
  53.119 -			       op.u.getdomaininfo.flags);
  53.120 +			       info.flags);
  53.121  		    goto out;
  53.122  		}
  53.123  
  53.124  		xcio_info(ioctxt,
  53.125                            "SUSPEND flags %08lx shinfo %08lx eip %08lx "
  53.126 -                          "esi %08lx\n", op.u.getdomaininfo.flags,
  53.127 -                          op.u.getdomaininfo.shared_info_frame,
  53.128 +                          "esi %08lx\n",info.flags,
  53.129 +                          info.shared_info_frame,
  53.130                            ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
  53.131              } 
  53.132  
    54.1 --- a/tools/libxc/xc_misc.c	Mon Nov 01 00:14:22 2004 +0000
    54.2 +++ b/tools/libxc/xc_misc.c	Mon Nov 01 00:18:29 2004 +0000
    54.3 @@ -52,18 +52,14 @@ int xc_physinfo(int xc_handle,
    54.4  {
    54.5      int ret;
    54.6      dom0_op_t op;
    54.7 -    dom0_physinfo_t *got_info = &op.u.physinfo;
    54.8      
    54.9      op.cmd = DOM0_PHYSINFO;
   54.10      op.interface_version = DOM0_INTERFACE_VERSION;
   54.11  
   54.12 -    if((ret = do_dom0_op(xc_handle, &op))) return ret;
   54.13 +    if ( (ret = do_dom0_op(xc_handle, &op)) != 0 )
   54.14 +        return ret;
   54.15  
   54.16 -    put_info->ht_per_core = got_info->ht_per_core;
   54.17 -    put_info->cores       = got_info->cores;
   54.18 -    put_info->total_pages = got_info->total_pages;
   54.19 -    put_info->free_pages  = got_info->free_pages;
   54.20 -    put_info->cpu_khz     = got_info->cpu_khz;
   54.21 +    memcpy(put_info, &op.u.physinfo, sizeof(*put_info));
   54.22  
   54.23      return 0;
   54.24  }
    55.1 --- a/tools/libxc/xc_private.h	Mon Nov 01 00:14:22 2004 +0000
    55.2 +++ b/tools/libxc/xc_private.h	Mon Nov 01 00:18:29 2004 +0000
    55.3 @@ -16,13 +16,6 @@
    55.4  
    55.5  #include "xc.h"
    55.6  
    55.7 -/* from xen/include/hypervisor-ifs */
    55.8 -#include <hypervisor-if.h>
    55.9 -#include <dom0_ops.h>
   55.10 -#include <event_channel.h>
   55.11 -#include <sched_ctl.h>
   55.12 -#include <io/domain_controller.h>
   55.13 -
   55.14  #include <asm-xen/proc_cmd.h>
   55.15  
   55.16  
   55.17 @@ -193,15 +186,8 @@ typedef struct mfn_mapper {
   55.18      
   55.19  } mfn_mapper_t;
   55.20  
   55.21 -long long  xc_domain_get_cpu_usage( int xc_handle, domid_t domid );
   55.22 -
   55.23  #include "xc_io.h"
   55.24  
   55.25 -int xc_domain_getfullinfo(int xc_handle,
   55.26 -                          u32 domid,
   55.27 -                          dom0_op_t *op,
   55.28 -                          full_execution_context_t *ctxt );
   55.29 -
   55.30  unsigned long xc_get_m2p_start_mfn ( int xc_handle );
   55.31  
   55.32  #endif /* __XC_PRIVATE_H__ */
    56.1 --- a/tools/misc/Makefile	Mon Nov 01 00:14:22 2004 +0000
    56.2 +++ b/tools/misc/Makefile	Mon Nov 01 00:18:29 2004 +0000
    56.3 @@ -5,7 +5,6 @@ include $(XEN_ROOT)/tools/Make.defs
    56.4  CC         = gcc
    56.5  CFLAGS     = -Wall -O3 
    56.6  
    56.7 -INCLUDES += -I $(XEN_HYPERVISOR_IFS)
    56.8  INCLUDES += -I $(XEN_LINUX_INCLUDE)
    56.9  INCLUDES += -I $(XEN_XC)
   56.10  INCLUDES += -I $(XEN_LIBXC)
    57.1 --- a/tools/python/setup.py	Mon Nov 01 00:14:22 2004 +0000
    57.2 +++ b/tools/python/setup.py	Mon Nov 01 00:18:29 2004 +0000
    57.3 @@ -7,8 +7,7 @@ XEN_ROOT = "../.."
    57.4  extra_compile_args  = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
    57.5  
    57.6  
    57.7 -include_dirs = [ XEN_ROOT + "/xen/include/hypervisor-ifs",
    57.8 -                 XEN_ROOT + "/linux-xen-sparse/include",
    57.9 +include_dirs = [ XEN_ROOT + "/linux-xen-sparse/include",
   57.10                   XEN_ROOT + "/tools/python/xen/lowlevel/xu",
   57.11                   XEN_ROOT + "/tools/libxc",
   57.12                   XEN_ROOT + "/tools/libxutil",
    58.1 --- a/tools/python/xen/lowlevel/xu/xu.c	Mon Nov 01 00:14:22 2004 +0000
    58.2 +++ b/tools/python/xen/lowlevel/xu/xu.c	Mon Nov 01 00:18:29 2004 +0000
    58.3 @@ -23,8 +23,8 @@
    58.4  #include <signal.h>
    58.5  #include <xc.h>
    58.6  
    58.7 -#include <hypervisor-if.h>
    58.8 -#include <io/domain_controller.h>
    58.9 +#include <xen/xen.h>
   58.10 +#include <xen/io/domain_controller.h>
   58.11  
   58.12  #include <asm-xen/proc_cmd.h>
   58.13  
    59.1 --- a/tools/xentrace/Makefile	Mon Nov 01 00:14:22 2004 +0000
    59.2 +++ b/tools/xentrace/Makefile	Mon Nov 01 00:18:29 2004 +0000
    59.3 @@ -5,7 +5,6 @@ include $(XEN_ROOT)/tools/Make.defs
    59.4  CC       = gcc
    59.5  CFLAGS   = -Wall -Werror -O3
    59.6  
    59.7 -CFLAGS  += -I $(XEN_HYPERVISOR_IFS)
    59.8  CFLAGS  += -I $(XEN_LINUX_INCLUDE)
    59.9  CFLAGS  += -I $(XEN_XC)
   59.10  CFLAGS  += -I $(XEN_LIBXC)
    60.1 --- a/tools/xentrace/xentrace.c	Mon Nov 01 00:14:22 2004 +0000
    60.2 +++ b/tools/xentrace/xentrace.c	Mon Nov 01 00:18:29 2004 +0000
    60.3 @@ -22,9 +22,7 @@
    60.4  #include <signal.h>
    60.5  
    60.6  #include "xc_private.h"
    60.7 -
    60.8 -/* from xen/include/hypervisor-ifs */
    60.9 -#include <trace.h>
   60.10 +#include <xen/trace.h>
   60.11  
   60.12  extern FILE *stderr;
   60.13  
    61.1 --- a/tools/xfrd/Makefile	Mon Nov 01 00:14:22 2004 +0000
    61.2 +++ b/tools/xfrd/Makefile	Mon Nov 01 00:18:29 2004 +0000
    61.3 @@ -9,9 +9,6 @@ include $(XEN_ROOT)/tools/Make.defs
    61.4  
    61.5  XFRD_INSTALL_DIR = /usr/sbin
    61.6  
    61.7 -vpath %.h      $(XEN_HYPERVISOR_IFS)
    61.8 -INCLUDES += -I $(XEN_HYPERVISOR_IFS)
    61.9 -
   61.10  vpath %h       $(XEN_LINUX_INCLUDE)
   61.11  INCLUDES += -I $(XEN_LINUX_INCLUDE)
   61.12  
    62.1 --- a/xen/COPYING	Mon Nov 01 00:14:22 2004 +0000
    62.2 +++ b/xen/COPYING	Mon Nov 01 00:18:29 2004 +0000
    62.3 @@ -10,9 +10,9 @@ virtual machine monitor) is copyrighted 
    62.4  wrote it.
    62.5  
    62.6  Further note that the guest-OS interfacing header files, which
    62.7 -includes all files within the subdirectory include/hypervisor-ifs, are
    62.8 +includes all files within the subdirectory include/public, are
    62.9  *not* covered by the GPL but by a much weaker license:
   62.10 - include/hypervisor-ifs/COPYING
   62.11 + include/public/COPYING
   62.12  
   62.13  Also note that the only valid version of the GPL as far as Xen is
   62.14  concerned is _this_ particular version of the license (i.e., *only*
    63.1 --- a/xen/Makefile	Mon Nov 01 00:14:22 2004 +0000
    63.2 +++ b/xen/Makefile	Mon Nov 01 00:18:29 2004 +0000
    63.3 @@ -22,6 +22,10 @@ install: $(TARGET)
    63.4  	mkdir -p $(prefix)/boot
    63.5  	install -m0644 $(TARGET).gz $(prefix)/boot
    63.6  	install -m0644 $(TARGET)-syms $(prefix)/boot
    63.7 +	mkdir -p $(prefix)/usr/include/xen/io
    63.8 +	install -m0644 include/public/*.h $(prefix)/usr/include/xen
    63.9 +	install -m0644 include/public/io/*.h $(prefix)/usr/include/xen/io
   63.10 +	install -m0644 include/public/COPYING $(prefix)/usr/include/xen
   63.11  
   63.12  dist: $(TARGET)
   63.13  	$(MAKE) prefix=`pwd`/../install dist=yes install
    64.1 --- a/xen/Rules.mk	Mon Nov 01 00:14:22 2004 +0000
    64.2 +++ b/xen/Rules.mk	Mon Nov 01 00:18:29 2004 +0000
    64.3 @@ -18,7 +18,7 @@ TARGET_SUBARCH  ?= $(COMPILE_SUBARCH)
    64.4  TARGET  := $(BASEDIR)/xen
    64.5  HDRS    := $(wildcard $(BASEDIR)/include/xen/*.h)
    64.6  HDRS    += $(wildcard $(BASEDIR)/include/scsi/*.h)
    64.7 -HDRS    += $(wildcard $(BASEDIR)/include/hypervisor-ifs/*.h)
    64.8 +HDRS    += $(wildcard $(BASEDIR)/include/public/*.h)
    64.9  HDRS    += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
   64.10  HDRS    += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
   64.11  # compile.h is always regenerated, but other files shouldn't be rebuilt
    65.1 --- a/xen/arch/x86/boot/x86_32.S	Mon Nov 01 00:14:22 2004 +0000
    65.2 +++ b/xen/arch/x86/boot/x86_32.S	Mon Nov 01 00:18:29 2004 +0000
    65.3 @@ -1,5 +1,5 @@
    65.4  #include <xen/config.h>
    65.5 -#include <hypervisor-ifs/hypervisor-if.h>
    65.6 +#include <public/xen.h>
    65.7  #include <asm/page.h>
    65.8  
    65.9  #define  SECONDARY_CPU_FLAG 0xA5A5A5A5
    66.1 --- a/xen/arch/x86/boot/x86_64.S	Mon Nov 01 00:14:22 2004 +0000
    66.2 +++ b/xen/arch/x86/boot/x86_64.S	Mon Nov 01 00:18:29 2004 +0000
    66.3 @@ -1,5 +1,5 @@
    66.4  #include <xen/config.h>
    66.5 -#include <hypervisor-ifs/hypervisor-if.h>
    66.6 +#include <public/xen.h>
    66.7  #include <asm/page.h>
    66.8  #include <asm/msr.h>
    66.9  
    67.1 --- a/xen/arch/x86/dom0_ops.c	Mon Nov 01 00:14:22 2004 +0000
    67.2 +++ b/xen/arch/x86/dom0_ops.c	Mon Nov 01 00:18:29 2004 +0000
    67.3 @@ -10,7 +10,7 @@
    67.4  #include <xen/types.h>
    67.5  #include <xen/lib.h>
    67.6  #include <xen/mm.h>
    67.7 -#include <hypervisor-ifs/dom0_ops.h>
    67.8 +#include <public/dom0_ops.h>
    67.9  #include <xen/sched.h>
   67.10  #include <xen/event.h>
   67.11  #include <asm/domain_page.h>
   67.12 @@ -19,7 +19,7 @@
   67.13  #include <xen/trace.h>
   67.14  #include <xen/console.h>
   67.15  #include <asm/shadow.h>
   67.16 -#include <hypervisor-ifs/sched_ctl.h>
   67.17 +#include <public/sched_ctl.h>
   67.18  
   67.19  #define TRC_DOM0OP_ENTER_BASE  0x00020000
   67.20  #define TRC_DOM0OP_LEAVE_BASE  0x00030000
    68.1 --- a/xen/arch/x86/pdb-stub.c	Mon Nov 01 00:14:22 2004 +0000
    68.2 +++ b/xen/arch/x86/pdb-stub.c	Mon Nov 01 00:18:29 2004 +0000
    68.3 @@ -44,9 +44,6 @@ static int remote_debug;
    68.4  static char pdb_in_buffer[PDB_BUFMAX];
    68.5  static char pdb_out_buffer[PDB_BUFMAX];
    68.6  static char pdb_buffer[PDB_BUFMAX];
    68.7 -static int  pdb_in_buffer_ptr;
    68.8 -static unsigned char  pdb_in_checksum;
    68.9 -static unsigned char  pdb_xmit_checksum;
   68.10  
   68.11  struct pdb_context pdb_ctx;
   68.12  int pdb_continue_thread = 0;
    69.1 --- a/xen/arch/x86/trampoline.S	Mon Nov 01 00:14:22 2004 +0000
    69.2 +++ b/xen/arch/x86/trampoline.S	Mon Nov 01 00:18:29 2004 +0000
    69.3 @@ -16,7 +16,7 @@
    69.4   */
    69.5  
    69.6  #include <xen/config.h>
    69.7 -#include <hypervisor-ifs/hypervisor-if.h>
    69.8 +#include <public/xen.h>
    69.9  #include <asm/page.h>
   69.10  
   69.11  #ifdef CONFIG_SMP
    70.1 --- a/xen/arch/x86/x86_32/entry.S	Mon Nov 01 00:14:22 2004 +0000
    70.2 +++ b/xen/arch/x86/x86_32/entry.S	Mon Nov 01 00:18:29 2004 +0000
    70.3 @@ -59,7 +59,7 @@
    70.4  #include <xen/config.h>
    70.5  #include <xen/errno.h>
    70.6  #include <xen/softirq.h>
    70.7 -#include <hypervisor-ifs/hypervisor-if.h>
    70.8 +#include <public/xen.h>
    70.9  
   70.10  EBX		= 0x00
   70.11  ECX		= 0x04
    71.1 --- a/xen/common/debug-linux.c	Mon Nov 01 00:14:22 2004 +0000
    71.2 +++ b/xen/common/debug-linux.c	Mon Nov 01 00:18:29 2004 +0000
    71.3 @@ -13,7 +13,7 @@
    71.4  #include <xen/config.h>
    71.5  #include <xen/types.h>
    71.6  #include <xen/lib.h>
    71.7 -#include <hypervisor-ifs/dom0_ops.h>
    71.8 +#include <public/dom0_ops.h>
    71.9  #include <asm/pdb.h>
   71.10  
   71.11  /* from linux/sched.h */
    72.1 --- a/xen/common/debug.c	Mon Nov 01 00:14:22 2004 +0000
    72.2 +++ b/xen/common/debug.c	Mon Nov 01 00:18:29 2004 +0000
    72.3 @@ -7,7 +7,7 @@
    72.4  #include <xen/config.h>
    72.5  #include <xen/types.h>
    72.6  #include <xen/lib.h>
    72.7 -#include <hypervisor-ifs/dom0_ops.h>
    72.8 +#include <public/dom0_ops.h>
    72.9  #include <xen/sched.h>
   72.10  #include <xen/event.h>
   72.11  #include <asm/page.h>
    73.1 --- a/xen/common/dom0_ops.c	Mon Nov 01 00:14:22 2004 +0000
    73.2 +++ b/xen/common/dom0_ops.c	Mon Nov 01 00:18:29 2004 +0000
    73.3 @@ -10,7 +10,7 @@
    73.4  #include <xen/types.h>
    73.5  #include <xen/lib.h>
    73.6  #include <xen/mm.h>
    73.7 -#include <hypervisor-ifs/dom0_ops.h>
    73.8 +#include <public/dom0_ops.h>
    73.9  #include <xen/sched.h>
   73.10  #include <xen/event.h>
   73.11  #include <asm/domain_page.h>
   73.12 @@ -18,7 +18,7 @@
   73.13  #include <xen/trace.h>
   73.14  #include <xen/console.h>
   73.15  #include <asm/shadow.h>
   73.16 -#include <hypervisor-ifs/sched_ctl.h>
   73.17 +#include <public/sched_ctl.h>
   73.18  
   73.19  #define TRC_DOM0OP_ENTER_BASE  0x00020000
   73.20  #define TRC_DOM0OP_LEAVE_BASE  0x00030000
    74.1 --- a/xen/common/domain.c	Mon Nov 01 00:14:22 2004 +0000
    74.2 +++ b/xen/common/domain.c	Mon Nov 01 00:18:29 2004 +0000
    74.3 @@ -14,7 +14,7 @@
    74.4  #include <xen/time.h>
    74.5  #include <xen/console.h>
    74.6  #include <asm/shadow.h>
    74.7 -#include <hypervisor-ifs/dom0_ops.h>
    74.8 +#include <public/dom0_ops.h>
    74.9  #include <asm/domain_page.h>
   74.10  
   74.11  /* Both these structures are protected by the tasklist_lock. */
    75.1 --- a/xen/common/event_channel.c	Mon Nov 01 00:14:22 2004 +0000
    75.2 +++ b/xen/common/event_channel.c	Mon Nov 01 00:18:29 2004 +0000
    75.3 @@ -23,8 +23,8 @@
    75.4  #include <xen/event.h>
    75.5  #include <xen/irq.h>
    75.6  
    75.7 -#include <hypervisor-ifs/hypervisor-if.h>
    75.8 -#include <hypervisor-ifs/event_channel.h>
    75.9 +#include <public/xen.h>
   75.10 +#include <public/event_channel.h>
   75.11  
   75.12  #define INIT_EVENT_CHANNELS   16
   75.13  #define MAX_EVENT_CHANNELS  1024
    76.1 --- a/xen/common/kernel.c	Mon Nov 01 00:14:22 2004 +0000
    76.2 +++ b/xen/common/kernel.c	Mon Nov 01 00:18:29 2004 +0000
    76.3 @@ -24,7 +24,7 @@
    76.4  #include <asm/io.h>
    76.5  #include <asm/uaccess.h>
    76.6  #include <asm/domain_page.h>
    76.7 -#include <hypervisor-ifs/dom0_ops.h>
    76.8 +#include <public/dom0_ops.h>
    76.9  
   76.10  unsigned long xenheap_phys_end;
   76.11  
    77.1 --- a/xen/common/physdev.c	Mon Nov 01 00:14:22 2004 +0000
    77.2 +++ b/xen/common/physdev.c	Mon Nov 01 00:18:29 2004 +0000
    77.3 @@ -26,8 +26,8 @@
    77.4  #include <xen/irq.h>
    77.5  #include <xen/event.h>
    77.6  #include <asm/pci.h>
    77.7 -#include <hypervisor-ifs/hypervisor-if.h>
    77.8 -#include <hypervisor-ifs/physdev.h>
    77.9 +#include <public/xen.h>
   77.10 +#include <public/physdev.h>
   77.11  
   77.12  /* Called by PHYSDEV_PCI_INITIALISE_DEVICE to finalise IRQ routing. */
   77.13  extern void pcibios_enable_irq(struct pci_dev *dev);
    78.1 --- a/xen/common/sched_atropos.c	Mon Nov 01 00:14:22 2004 +0000
    78.2 +++ b/xen/common/sched_atropos.c	Mon Nov 01 00:18:29 2004 +0000
    78.3 @@ -20,7 +20,7 @@
    78.4  #include <xen/time.h>
    78.5  #include <xen/sched.h>
    78.6  #include <xen/sched-if.h>
    78.7 -#include <hypervisor-ifs/sched_ctl.h>
    78.8 +#include <public/sched_ctl.h>
    78.9  #include <xen/trace.h>
   78.10  
   78.11  #define ATROPOS_TASK_UNBLOCKED 16
    79.1 --- a/xen/common/sched_rrobin.c	Mon Nov 01 00:14:22 2004 +0000
    79.2 +++ b/xen/common/sched_rrobin.c	Mon Nov 01 00:18:29 2004 +0000
    79.3 @@ -6,7 +6,7 @@
    79.4  
    79.5  #include <xen/sched.h>
    79.6  #include <xen/sched-if.h>
    79.7 -#include <hypervisor-ifs/sched_ctl.h>
    79.8 +#include <public/sched_ctl.h>
    79.9  #include <xen/ac_timer.h>
   79.10  #include <xen/softirq.h>
   79.11  #include <xen/time.h>
    80.1 --- a/xen/common/schedule.c	Mon Nov 01 00:14:22 2004 +0000
    80.2 +++ b/xen/common/schedule.c	Mon Nov 01 00:18:29 2004 +0000
    80.3 @@ -26,7 +26,7 @@
    80.4  #include <xen/sched-if.h>
    80.5  #include <xen/softirq.h>
    80.6  #include <xen/trace.h>
    80.7 -#include <hypervisor-ifs/sched_ctl.h>
    80.8 +#include <public/sched_ctl.h>
    80.9  
   80.10  /*#define WAKE_HISTO*/
   80.11  /*#define BLOCKTIME_HISTO*/
    81.1 --- a/xen/common/trace.c	Mon Nov 01 00:14:22 2004 +0000
    81.2 +++ b/xen/common/trace.c	Mon Nov 01 00:18:29 2004 +0000
    81.3 @@ -13,7 +13,7 @@
    81.4   * it's possible to reconstruct a chronological record of trace events.
    81.5   *
    81.6   * See also include/xen/trace.h and the dom0 op in
    81.7 - * include/hypervisor-ifs/dom0_ops.h
    81.8 + * include/public/dom0_ops.h
    81.9   */
   81.10  
   81.11  #include <xen/config.h>
   81.12 @@ -26,7 +26,7 @@
   81.13  #include <xen/trace.h>
   81.14  #include <xen/errno.h>
   81.15  #include <asm/atomic.h>
   81.16 -#include <hypervisor-ifs/dom0_ops.h>
   81.17 +#include <public/dom0_ops.h>
   81.18  
   81.19  /* Pointers to the meta-data objects for all system trace buffers */
   81.20  struct t_buf *t_bufs[NR_CPUS];
    82.1 --- a/xen/include/asm-x86/mm.h	Mon Nov 01 00:14:22 2004 +0000
    82.2 +++ b/xen/include/asm-x86/mm.h	Mon Nov 01 00:18:29 2004 +0000
    82.3 @@ -14,7 +14,7 @@
    82.4  #include <asm/flushtlb.h>
    82.5  #include <asm/io.h>
    82.6  
    82.7 -#include <hypervisor-ifs/hypervisor-if.h>
    82.8 +#include <public/xen.h>
    82.9  
   82.10  /*
   82.11   * Per-page-frame information.
    83.1 --- a/xen/include/asm-x86/pdb.h	Mon Nov 01 00:14:22 2004 +0000
    83.2 +++ b/xen/include/asm-x86/pdb.h	Mon Nov 01 00:18:29 2004 +0000
    83.3 @@ -14,8 +14,8 @@
    83.4  
    83.5  #include <asm/ptrace.h>
    83.6  #include <xen/list.h>
    83.7 -#include <hypervisor-ifs/dom0_ops.h>
    83.8 -#include <hypervisor-ifs/hypervisor-if.h>                   /* for domain id */
    83.9 +#include <public/dom0_ops.h>
   83.10 +#include <public/xen.h>                   /* for domain id */
   83.11  
   83.12  extern int pdb_initialized;
   83.13  extern int pdb_com_port;
    84.1 --- a/xen/include/asm-x86/processor.h	Mon Nov 01 00:14:22 2004 +0000
    84.2 +++ b/xen/include/asm-x86/processor.h	Mon Nov 01 00:18:29 2004 +0000
    84.3 @@ -15,7 +15,7 @@
    84.4  #include <asm/pdb.h>
    84.5  #include <xen/config.h>
    84.6  #include <xen/spinlock.h>
    84.7 -#include <hypervisor-ifs/hypervisor-if.h>
    84.8 +#include <public/xen.h>
    84.9  
   84.10  struct domain;
   84.11  
    85.1 --- a/xen/include/hypervisor-ifs/COPYING	Mon Nov 01 00:14:22 2004 +0000
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,28 +0,0 @@
    85.4 -XEN NOTICE
    85.5 -==========
    85.6 -
    85.7 -This copyright applies to all files within this subdirectory. All
    85.8 -other files in the Xen source distribution are covered by version 2 of
    85.9 -the GNU General Public License.
   85.10 -
   85.11 - -- Keir Fraser (on behalf of the Xen team)
   85.12 -
   85.13 -=====================================================================
   85.14 -
   85.15 -Permission is hereby granted, free of charge, to any person obtaining a copy
   85.16 -of this software and associated documentation files (the "Software"), to
   85.17 -deal in the Software without restriction, including without limitation the
   85.18 -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   85.19 -sell copies of the Software, and to permit persons to whom the Software is
   85.20 -furnished to do so, subject to the following conditions:
   85.21 -
   85.22 -The above copyright notice and this permission notice shall be included in
   85.23 -all copies or substantial portions of the Software.
   85.24 -
   85.25 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
   85.26 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
   85.27 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
   85.28 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
   85.29 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
   85.30 -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
   85.31 -DEALINGS IN THE SOFTWARE.
    86.1 --- a/xen/include/hypervisor-ifs/arch-x86_32.h	Mon Nov 01 00:14:22 2004 +0000
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,141 +0,0 @@
    86.4 -/******************************************************************************
    86.5 - * arch-i386/hypervisor-if.h
    86.6 - * 
    86.7 - * Guest OS interface to x86 32-bit Xen.
    86.8 - */
    86.9 -
   86.10 -#ifndef __HYPERVISOR_IF_I386_H__
   86.11 -#define __HYPERVISOR_IF_I386_H__
   86.12 -
   86.13 -/*
   86.14 - * Pointers and other address fields inside interface structures are padded to
   86.15 - * 64 bits. This means that field alignments aren't different between 32- and
   86.16 - * 64-bit architectures. 
   86.17 - */
   86.18 -/* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
   86.19 -#define __MEMORY_PADDING(_X) u32 __pad_ ## _X
   86.20 -#define _MEMORY_PADDING(_X)  __MEMORY_PADDING(_X)
   86.21 -#define MEMORY_PADDING       _MEMORY_PADDING(__LINE__)
   86.22 -
   86.23 -/*
   86.24 - * SEGMENT DESCRIPTOR TABLES
   86.25 - */
   86.26 -/*
   86.27 - * A number of GDT entries are reserved by Xen. These are not situated at the
   86.28 - * start of the GDT because some stupid OSes export hard-coded selector values
   86.29 - * in their ABI. These hard-coded values are always near the start of the GDT,
   86.30 - * so Xen places itself out of the way.
   86.31 - * 
   86.32 - * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
   86.33 - * and LAST_RESERVED_GDT_ENTRY are reserved).
   86.34 - */
   86.35 -#define NR_RESERVED_GDT_ENTRIES    40
   86.36 -#define FIRST_RESERVED_GDT_ENTRY   256
   86.37 -#define LAST_RESERVED_GDT_ENTRY    \
   86.38 -  (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
   86.39 -
   86.40 -
   86.41 -/*
   86.42 - * These flat segments are in the Xen-private section of every GDT. Since these
   86.43 - * are also present in the initial GDT, many OSes will be able to avoid
   86.44 - * installing their own GDT.
   86.45 - */
   86.46 -#define FLAT_RING1_CS 0x0819    /* GDT index 259 */
   86.47 -#define FLAT_RING1_DS 0x0821    /* GDT index 260 */
   86.48 -#define FLAT_RING3_CS 0x082b    /* GDT index 261 */
   86.49 -#define FLAT_RING3_DS 0x0833    /* GDT index 262 */
   86.50 -
   86.51 -#define FLAT_GUESTOS_CS FLAT_RING1_CS
   86.52 -#define FLAT_GUESTOS_DS FLAT_RING1_DS
   86.53 -#define FLAT_USER_CS    FLAT_RING3_CS
   86.54 -#define FLAT_USER_DS    FLAT_RING3_DS
   86.55 -
   86.56 -/* And the trap vector is... */
   86.57 -#define TRAP_INSTR "int $0x82"
   86.58 -
   86.59 -
   86.60 -/*
   86.61 - * Virtual addresses beyond this are not modifiable by guest OSes. The 
   86.62 - * machine->physical mapping table starts at this address, read-only.
   86.63 - */
   86.64 -#define HYPERVISOR_VIRT_START (0xFC000000UL)
   86.65 -#ifndef machine_to_phys_mapping
   86.66 -#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
   86.67 -#endif
   86.68 -
   86.69 -#ifndef __ASSEMBLY__
   86.70 -
   86.71 -/* NB. Both the following are 32 bits each. */
   86.72 -typedef unsigned long memory_t;   /* Full-sized pointer/address/memory-size. */
   86.73 -typedef unsigned long cpureg_t;   /* Full-sized register.                    */
   86.74 -
   86.75 -/*
   86.76 - * Send an array of these to HYPERVISOR_set_trap_table()
   86.77 - */
   86.78 -#define TI_GET_DPL(_ti)      ((_ti)->flags & 3)
   86.79 -#define TI_GET_IF(_ti)       ((_ti)->flags & 4)
   86.80 -#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
   86.81 -#define TI_SET_IF(_ti,_if)   ((_ti)->flags |= ((!!(_if))<<2))
   86.82 -typedef struct {
   86.83 -    u8       vector;  /* 0: exception vector                              */
   86.84 -    u8       flags;   /* 1: 0-3: privilege level; 4: clear event enable?  */
   86.85 -    u16      cs;      /* 2: code selector                                 */
   86.86 -    memory_t address; /* 4: code address                                  */
   86.87 -} PACKED trap_info_t; /* 8 bytes */
   86.88 -
   86.89 -typedef struct
   86.90 -{
   86.91 -    unsigned long ebx;
   86.92 -    unsigned long ecx;
   86.93 -    unsigned long edx;
   86.94 -    unsigned long esi;
   86.95 -    unsigned long edi;
   86.96 -    unsigned long ebp;
   86.97 -    unsigned long eax;
   86.98 -    unsigned long ds;
   86.99 -    unsigned long es;
  86.100 -    unsigned long fs;
  86.101 -    unsigned long gs;
  86.102 -    unsigned long _unused;
  86.103 -    unsigned long eip;
  86.104 -    unsigned long cs;
  86.105 -    unsigned long eflags;
  86.106 -    unsigned long esp;
  86.107 -    unsigned long ss;
  86.108 -} PACKED execution_context_t;
  86.109 -
  86.110 -typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
  86.111 -
  86.112 -/*
  86.113 - * The following is all CPU context. Note that the i387_ctxt block is filled 
  86.114 - * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
  86.115 - */
  86.116 -typedef struct {
  86.117 -#define ECF_I387_VALID (1<<0)
  86.118 -    unsigned long flags;
  86.119 -    execution_context_t cpu_ctxt;           /* User-level CPU registers     */
  86.120 -    char          fpu_ctxt[256];            /* User-level FPU registers     */
  86.121 -    trap_info_t   trap_ctxt[256];           /* Virtual IDT                  */
  86.122 -    unsigned int  fast_trap_idx;            /* "Fast trap" vector offset    */
  86.123 -    unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
  86.124 -    unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
  86.125 -    unsigned long guestos_ss, guestos_esp;  /* Virtual TSS (only SS1/ESP1)  */
  86.126 -    unsigned long pt_base;                  /* CR3 (pagetable base)         */
  86.127 -    unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
  86.128 -    unsigned long event_callback_cs;        /* CS:EIP of event callback     */
  86.129 -    unsigned long event_callback_eip;
  86.130 -    unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
  86.131 -    unsigned long failsafe_callback_eip;
  86.132 -} PACKED full_execution_context_t;
  86.133 -
  86.134 -typedef struct {
  86.135 -    u64 mfn_to_pfn_start;      /* MFN of start of m2p table */
  86.136 -    u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that 
  86.137 -				  make up p2m table */
  86.138 -} PACKED arch_shared_info_t;
  86.139 -
  86.140 -#define ARCH_HAS_FAST_TRAP
  86.141 -
  86.142 -#endif
  86.143 -
  86.144 -#endif
    87.1 --- a/xen/include/hypervisor-ifs/arch-x86_64.h	Mon Nov 01 00:14:22 2004 +0000
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,134 +0,0 @@
    87.4 -/******************************************************************************
    87.5 - * arch-x86_64/hypervisor-if.h
    87.6 - * 
    87.7 - * Guest OS interface to AMD x86-64 bit Xen.
    87.8 - */
    87.9 -
   87.10 -#ifndef __HYPERVISOR_IF_X86_64_H__
   87.11 -#define __HYPERVISOR_IF_X86_64_H__
   87.12 -
   87.13 -/* Pointers are naturally 64 bits in this architecture; no padding needed. */
   87.14 -#define _MEMORY_PADDING(_X)
   87.15 -#define MEMORY_PADDING 
   87.16 -
   87.17 -/*
   87.18 - * SEGMENT DESCRIPTOR TABLES
   87.19 - */
   87.20 -/*
   87.21 - * A number of GDT entries are reserved by Xen. These are not situated at the
   87.22 - * start of the GDT because some stupid OSes export hard-coded selector values
   87.23 - * in their ABI. These hard-coded values are always near the start of the GDT,
   87.24 - * so Xen places itself out of the way.
   87.25 - * 
   87.26 - * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
   87.27 - * and LAST_RESERVED_GDT_ENTRY are reserved).
   87.28 - */
   87.29 -#define NR_RESERVED_GDT_ENTRIES    40 
   87.30 -#define FIRST_RESERVED_GDT_ENTRY   256
   87.31 -#define LAST_RESERVED_GDT_ENTRY    \
   87.32 -  (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
   87.33 -
   87.34 -/*
   87.35 - * 64-bit segment selectors
   87.36 - * These flat segments are in the Xen-private section of every GDT. Since these
   87.37 - * are also present in the initial GDT, many OSes will be able to avoid
   87.38 - * installing their own GDT.
   87.39 - */
   87.40 -
   87.41 -#define FLAT_RING3_CS32 0x0823  /* GDT index 260 */
   87.42 -#define FLAT_RING3_CS64 0x082b  /* GDT index 261 */
   87.43 -#define FLAT_RING3_DS   0x0833  /* GDT index 262 */
   87.44 -
   87.45 -#define FLAT_GUESTOS_DS   FLAT_RING3_DS
   87.46 -#define FLAT_GUESTOS_CS   FLAT_RING3_CS64
   87.47 -#define FLAT_GUESTOS_CS32 FLAT_RING3_CS32
   87.48 -
   87.49 -#define FLAT_USER_DS      FLAT_RING3_DS
   87.50 -#define FLAT_USER_CS      FLAT_RING3_CS64
   87.51 -#define FLAT_USER_CS32    FLAT_RING3_CS32
   87.52 -
   87.53 -/* And the trap vector is... */
   87.54 -#define TRAP_INSTR "syscall"
   87.55 -
   87.56 -/* The machine->physical mapping table starts at this address, read-only. */
   87.57 -#ifndef machine_to_phys_mapping
   87.58 -#define machine_to_phys_mapping ((unsigned long *)0xffff810000000000ULL)
   87.59 -#endif
   87.60 -
   87.61 -#ifndef __ASSEMBLY__
   87.62 -
   87.63 -/* NB. Both the following are 64 bits each. */
   87.64 -typedef unsigned long memory_t;   /* Full-sized pointer/address/memory-size. */
   87.65 -typedef unsigned long cpureg_t;   /* Full-sized register.                    */
   87.66 -
   87.67 -/*
   87.68 - * Send an array of these to HYPERVISOR_set_trap_table()
   87.69 - */
   87.70 -#define TI_GET_DPL(_ti)      ((_ti)->flags & 3)
   87.71 -#define TI_GET_IF(_ti)       ((_ti)->flags & 4)
   87.72 -#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
   87.73 -#define TI_SET_IF(_ti,_if)   ((_ti)->flags |= ((!!(_if))<<2))
   87.74 -typedef struct {
   87.75 -    u8       vector;  /* 0: exception vector                              */
   87.76 -    u8       flags;   /* 1: 0-3: privilege level; 4: clear event enable?  */
   87.77 -    u16      cs;      /* 2: code selector                                 */
   87.78 -    u32      __pad;   /* 4 */
   87.79 -    memory_t address; /* 8: code address                                  */
   87.80 -} PACKED trap_info_t; /* 16 bytes */
   87.81 -
   87.82 -typedef struct
   87.83 -{
   87.84 -    unsigned long r15;
   87.85 -    unsigned long r14;
   87.86 -    unsigned long r13;
   87.87 -    unsigned long r12;
   87.88 -    unsigned long rbp;
   87.89 -    unsigned long rbx;
   87.90 -    unsigned long r11;
   87.91 -    unsigned long r10;
   87.92 -    unsigned long r9;
   87.93 -    unsigned long r8;
   87.94 -    unsigned long rax;
   87.95 -    unsigned long rcx;
   87.96 -    unsigned long rdx;
   87.97 -    unsigned long rsi;
   87.98 -    unsigned long rdi;
   87.99 -    unsigned long rip;
  87.100 -    unsigned long cs;
  87.101 -    unsigned long eflags;
  87.102 -    unsigned long rsp;
  87.103 -    unsigned long ss;
  87.104 -} PACKED execution_context_t;
  87.105 -
  87.106 -typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
  87.107 -
  87.108 -/*
  87.109 - * The following is all CPU context. Note that the i387_ctxt block is filled 
  87.110 - * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
  87.111 - */
  87.112 -typedef struct {
  87.113 -#define ECF_I387_VALID (1<<0)
  87.114 -    unsigned long flags;
  87.115 -    execution_context_t cpu_ctxt;           /* User-level CPU registers     */
  87.116 -    char          fpu_ctxt[512];            /* User-level FPU registers     */
  87.117 -    trap_info_t   trap_ctxt[256];           /* Virtual IDT                  */
  87.118 -    unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
  87.119 -    unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
  87.120 -    unsigned long guestos_ss, guestos_esp;  /* Virtual TSS (only SS1/ESP1)  */
  87.121 -    unsigned long pt_base;                  /* CR3 (pagetable base)         */
  87.122 -    unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
  87.123 -    unsigned long event_callback_cs;        /* CS:EIP of event callback     */
  87.124 -    unsigned long event_callback_eip;
  87.125 -    unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
  87.126 -    unsigned long failsafe_callback_eip;
  87.127 -} PACKED full_execution_context_t;
  87.128 -
  87.129 -typedef struct {
  87.130 -    u64 mfn_to_pfn_start;      /* MFN of start of m2p table */
  87.131 -    u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that 
  87.132 -				  make up p2m table */
  87.133 -} PACKED arch_shared_info_t;
  87.134 -
  87.135 -#endif /* !__ASSEMBLY__ */
  87.136 -
  87.137 -#endif /* __HYPERVISOR_IF_H__ */
    88.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Mon Nov 01 00:14:22 2004 +0000
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,372 +0,0 @@
    88.4 -/******************************************************************************
    88.5 - * dom0_ops.h
    88.6 - * 
    88.7 - * Process command requests from domain-0 guest OS.
    88.8 - * 
    88.9 - * Copyright (c) 2002-2003, B Dragovic
   88.10 - * Copyright (c) 2002-2004, K Fraser
   88.11 - */
   88.12 -
   88.13 -
   88.14 -#ifndef __DOM0_OPS_H__
   88.15 -#define __DOM0_OPS_H__
   88.16 -
   88.17 -#include "hypervisor-if.h"
   88.18 -#include "sched_ctl.h"
   88.19 -
   88.20 -/*
   88.21 - * Make sure you increment the interface version whenever you modify this file!
   88.22 - * This makes sure that old versions of dom0 tools will stop working in a
   88.23 - * well-defined way (rather than crashing the machine, for instance).
   88.24 - */
   88.25 -#define DOM0_INTERFACE_VERSION   0xAAAA0019
   88.26 -
   88.27 -/************************************************************************/
   88.28 -
   88.29 -#define DOM0_GETMEMLIST        2
   88.30 -typedef struct {
   88.31 -    /* IN variables. */
   88.32 -    domid_t       domain;             /*  0 */
   88.33 -    u16           __pad0;
   88.34 -    u32           __pad1;
   88.35 -    memory_t      max_pfns;           /*  8 */
   88.36 -    MEMORY_PADDING;
   88.37 -    void         *buffer;             /* 16 */
   88.38 -    MEMORY_PADDING;
   88.39 -    /* OUT variables. */
   88.40 -    memory_t      num_pfns;           /* 24 */
   88.41 -    MEMORY_PADDING;
   88.42 -} PACKED dom0_getmemlist_t; /* 32 bytes */
   88.43 -
   88.44 -#define DOM0_SCHEDCTL          6
   88.45 - /* struct sched_ctl_cmd is from sched-ctl.h   */
   88.46 -typedef struct sched_ctl_cmd dom0_schedctl_t;
   88.47 -
   88.48 -#define DOM0_ADJUSTDOM         7
   88.49 -/* struct sched_adjdom_cmd is from sched-ctl.h */
   88.50 -typedef struct sched_adjdom_cmd dom0_adjustdom_t;
   88.51 -
   88.52 -#define DOM0_CREATEDOMAIN      8
   88.53 -typedef struct {
   88.54 -    /* IN parameters. */
   88.55 -    memory_t     memory_kb;           /*  0 */
   88.56 -    MEMORY_PADDING;
   88.57 -    u32          cpu;                 /*  8 */
   88.58 -    u32          __pad0;              /* 12 */
   88.59 -    /* IN/OUT parameters. */
   88.60 -    /* If 0, domain is allocated. If non-zero use it unless in use. */
   88.61 -    domid_t      domain;              /* 16 */
   88.62 -    u16          __pad1;
   88.63 -    /* OUT parameters. */
   88.64 -} PACKED dom0_createdomain_t; /* 20 bytes */
   88.65 -
   88.66 -#define DOM0_DESTROYDOMAIN     9
   88.67 -typedef struct {
   88.68 -    /* IN variables. */
   88.69 -    domid_t      domain;              /*  0 */
   88.70 -    u16          __pad;
   88.71 -} PACKED dom0_destroydomain_t; /* 4 bytes */
   88.72 -
   88.73 -#define DOM0_PAUSEDOMAIN      10
   88.74 -typedef struct {
   88.75 -    /* IN parameters. */
   88.76 -    domid_t domain;                   /*  0 */
   88.77 -    u16     __pad;
   88.78 -} PACKED dom0_pausedomain_t; /* 4 bytes */
   88.79 -
   88.80 -#define DOM0_UNPAUSEDOMAIN    11
   88.81 -typedef struct {
   88.82 -    /* IN parameters. */
   88.83 -    domid_t domain;                   /*  0 */
   88.84 -    u16     __pad;
   88.85 -} PACKED dom0_unpausedomain_t; /* 4 bytes */
   88.86 -
   88.87 -#define DOM0_GETDOMAININFO    12
   88.88 -typedef struct {
   88.89 -    /* IN variables. */
   88.90 -    domid_t  domain;                  /*  0 */ /* NB. IN/OUT variable. */
   88.91 -    u16     __pad;
   88.92 -    /* OUT variables. */
   88.93 -#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
   88.94 -#define DOMFLAGS_CRASHED   (1<<1) /* Crashed domain; frozen for postmortem.  */
   88.95 -#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut itself down.      */
   88.96 -#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
   88.97 -#define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
   88.98 -#define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
   88.99 -#define DOMFLAGS_CPUMASK      255 /* CPU to which this domain is bound.      */
  88.100 -#define DOMFLAGS_CPUSHIFT       8
  88.101 -#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
  88.102 -#define DOMFLAGS_SHUTDOWNSHIFT 16
  88.103 -    u32      flags;                   /*  4 */
  88.104 -    full_execution_context_t *ctxt;   /*  8 */ /* NB. IN/OUT variable. */
  88.105 -    MEMORY_PADDING;
  88.106 -    memory_t tot_pages;               /* 16 */
  88.107 -    MEMORY_PADDING;
  88.108 -    memory_t max_pages;               /* 24 */
  88.109 -    MEMORY_PADDING;
  88.110 -    memory_t shared_info_frame;       /* 32: MFN of shared_info struct */
  88.111 -    MEMORY_PADDING;
  88.112 -    u64      cpu_time;                /* 40 */
  88.113 -} PACKED dom0_getdomaininfo_t; /* 48 bytes */
  88.114 -
  88.115 -#define DOM0_BUILDDOMAIN      13
  88.116 -typedef struct {
  88.117 -    /* IN variables. */
  88.118 -    domid_t                 domain;   /*  0 */
  88.119 -    u16                     __pad0;   /*  2 */
  88.120 -    u32                     __pad1;   /*  4 */
  88.121 -    /* IN/OUT parameters */
  88.122 -    full_execution_context_t *ctxt;   /*  8 */
  88.123 -    MEMORY_PADDING;
  88.124 -} PACKED dom0_builddomain_t; /* 16 bytes */
  88.125 -
  88.126 -#define DOM0_IOPL             14
  88.127 -typedef struct {
  88.128 -    domid_t domain;                   /*  0 */
  88.129 -    u16     __pad;
  88.130 -    u32     iopl;                     /*  4 */
  88.131 -} PACKED dom0_iopl_t; /* 8 bytes */
  88.132 -
  88.133 -#define DOM0_MSR              15
  88.134 -typedef struct {
  88.135 -    /* IN variables. */
  88.136 -    u32 write;                        /*  0 */
  88.137 -    u32 cpu_mask;                     /*  4 */
  88.138 -    u32 msr;                          /*  8 */
  88.139 -    u32 in1;                          /* 12 */
  88.140 -    u32 in2;                          /* 16 */
  88.141 -    /* OUT variables. */
  88.142 -    u32 out1;                         /* 20 */
  88.143 -    u32 out2;                         /* 24 */
  88.144 -} PACKED dom0_msr_t; /* 28 bytes */
  88.145 -
  88.146 -#define DOM0_DEBUG            16
  88.147 -typedef struct {
  88.148 -    /* IN variables. */
  88.149 -    domid_t domain;                   /*  0 */
  88.150 -    u8  opcode;                       /*  2 */
  88.151 -    u8  __pad;
  88.152 -    u32 in1;                          /*  4 */
  88.153 -    u32 in2;                          /*  8 */
  88.154 -    u32 in3;                          /* 12 */
  88.155 -    u32 in4;                          /* 16 */
  88.156 -    /* OUT variables. */
  88.157 -    u32 status;                       /* 20 */
  88.158 -    u32 out1;                         /* 24 */
  88.159 -    u32 out2;                         /* 28 */
  88.160 -} PACKED dom0_debug_t; /* 32 bytes */
  88.161 -
  88.162 -/*
  88.163 - * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
  88.164 - * 1 January, 1970 if the current system time was <system_time>.
  88.165 - */
  88.166 -#define DOM0_SETTIME          17
  88.167 -typedef struct {
  88.168 -    /* IN variables. */
  88.169 -    u32 secs;                         /*  0 */
  88.170 -    u32 usecs;                        /*  4 */
  88.171 -    u64 system_time;                  /*  8 */
  88.172 -} PACKED dom0_settime_t; /* 16 bytes */
  88.173 -
  88.174 -#define DOM0_GETPAGEFRAMEINFO 18
  88.175 -#define NOTAB 0         /* normal page */
  88.176 -#define L1TAB (1<<28)
  88.177 -#define L2TAB (2<<28)
  88.178 -#define L3TAB (3<<28)
  88.179 -#define L4TAB (4<<28)
  88.180 -#define LPINTAB  (1<<31)
  88.181 -#define XTAB  (0xf<<28) /* invalid page */
  88.182 -#define LTAB_MASK XTAB
  88.183 -#define LTABTYPE_MASK (0x7<<28)
  88.184 -
  88.185 -typedef struct {
  88.186 -    /* IN variables. */
  88.187 -    memory_t pfn;          /*  0: Machine page frame number to query.       */
  88.188 -    MEMORY_PADDING;
  88.189 -    domid_t domain;        /*  8: To which domain does the frame belong?    */
  88.190 -    u16     __pad;
  88.191 -    /* OUT variables. */
  88.192 -    /* Is the page PINNED to a type? */
  88.193 -    u32 type;              /* 12: see above type defs */
  88.194 -} PACKED dom0_getpageframeinfo_t; /* 16 bytes */
  88.195 -
  88.196 -/*
  88.197 - * Read console content from Xen buffer ring.
  88.198 - */
  88.199 -#define DOM0_READCONSOLE      19
  88.200 -typedef struct {
  88.201 -    memory_t str;                     /*  0 */
  88.202 -    MEMORY_PADDING;
  88.203 -    u32      count;                   /*  8 */
  88.204 -    u32      cmd;                     /* 12 */
  88.205 -} PACKED dom0_readconsole_t; /* 16 bytes */
  88.206 -
  88.207 -/* 
  88.208 - * Pin Domain to a particular CPU  (use -1 to unpin)
  88.209 - */
  88.210 -#define DOM0_PINCPUDOMAIN     20
  88.211 -typedef struct {
  88.212 -    /* IN variables. */
  88.213 -    domid_t      domain;              /*  0 */
  88.214 -    u16          __pad;
  88.215 -    s32          cpu;                 /*  4: -1 implies unpin */
  88.216 -} PACKED dom0_pincpudomain_t; /* 8 bytes */
  88.217 -
  88.218 -/* Get trace buffers machine base address */
  88.219 -#define DOM0_GETTBUFS         21
  88.220 -typedef struct {
  88.221 -    /* OUT variables */
  88.222 -    memory_t mach_addr;   /*  0: location of the trace buffers       */
  88.223 -    MEMORY_PADDING;
  88.224 -    u32      size;        /*  8: size of each trace buffer, in bytes */
  88.225 -} PACKED dom0_gettbufs_t; /* 12 bytes */
  88.226 -
  88.227 -/*
  88.228 - * Get physical information about the host machine
  88.229 - */
  88.230 -#define DOM0_PHYSINFO         22
  88.231 -typedef struct {
  88.232 -    u32      ht_per_core;             /*  0 */
  88.233 -    u32      cores;                   /*  4 */
  88.234 -    u32      cpu_khz;                 /*  8 */
  88.235 -    u32      __pad;                   /* 12 */
  88.236 -    memory_t total_pages;             /* 16 */
  88.237 -    MEMORY_PADDING;
  88.238 -    memory_t free_pages;              /* 24 */
  88.239 -    MEMORY_PADDING;
  88.240 -} PACKED dom0_physinfo_t; /* 32 bytes */
  88.241 -
  88.242 -/* 
  88.243 - * Allow a domain access to a physical PCI device
  88.244 - */
  88.245 -#define DOM0_PCIDEV_ACCESS    23
  88.246 -typedef struct {
  88.247 -    /* IN variables. */
  88.248 -    domid_t      domain;              /*  0 */
  88.249 -    u16          __pad;
  88.250 -    u32          bus;                 /*  4 */
  88.251 -    u32          dev;                 /*  8 */
  88.252 -    u32          func;                /* 12 */
  88.253 -    u32          enable;              /* 16 */
  88.254 -} PACKED dom0_pcidev_access_t; /* 20 bytes */
  88.255 -
  88.256 -/*
  88.257 - * Get the ID of the current scheduler.
  88.258 - */
  88.259 -#define DOM0_SCHED_ID        24
  88.260 -typedef struct {
  88.261 -    /* OUT variable */
  88.262 -    u32 sched_id;                     /*  0 */
  88.263 -} PACKED dom0_sched_id_t; /* 4 bytes */
  88.264 -
  88.265 -/* 
  88.266 - * Control shadow pagetables operation
  88.267 - */
  88.268 -#define DOM0_SHADOW_CONTROL  25
  88.269 -
  88.270 -#define DOM0_SHADOW_CONTROL_OP_OFF         0
  88.271 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
  88.272 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
  88.273 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
  88.274 -#define DOM0_SHADOW_CONTROL_OP_FLUSH       10     /* table ops */
  88.275 -#define DOM0_SHADOW_CONTROL_OP_CLEAN       11
  88.276 -#define DOM0_SHADOW_CONTROL_OP_PEEK        12
  88.277 -
  88.278 -typedef struct dom0_shadow_control
  88.279 -{
  88.280 -    u32 fault_count;
  88.281 -    u32 dirty_count;
  88.282 -    u32 dirty_net_count;     
  88.283 -    u32 dirty_block_count;     
  88.284 -} dom0_shadow_control_stats_t;
  88.285 -
  88.286 -typedef struct {
  88.287 -    /* IN variables. */
  88.288 -    domid_t        domain;            /*  0 */
  88.289 -    u16            __pad;
  88.290 -    u32            op;                /*  4 */
  88.291 -    unsigned long *dirty_bitmap;      /*  8: pointer to locked buffer */
  88.292 -    MEMORY_PADDING;
  88.293 -    /* IN/OUT variables. */
  88.294 -    memory_t       pages;  /* 16: size of buffer, updated with actual size */
  88.295 -    MEMORY_PADDING;
  88.296 -    /* OUT variables. */
  88.297 -    dom0_shadow_control_stats_t stats;
  88.298 -} PACKED dom0_shadow_control_t;
  88.299 -
  88.300 -#define DOM0_SETDOMAININITIALMEM   27
  88.301 -typedef struct {
  88.302 -    /* IN variables. */
  88.303 -    domid_t     domain;               /*  0 */
  88.304 -    u16         __pad0;
  88.305 -    u32         __pad1;
  88.306 -    memory_t    initial_memkb;        /*  8 */
  88.307 -    MEMORY_PADDING;
  88.308 -} PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
  88.309 -
  88.310 -#define DOM0_SETDOMAINMAXMEM   28
  88.311 -typedef struct {
  88.312 -    /* IN variables. */
  88.313 -    domid_t     domain;               /*  0 */
  88.314 -    u16         __pad0;
  88.315 -    u32         __pad1;
  88.316 -    memory_t    max_memkb;            /*  8 */
  88.317 -    MEMORY_PADDING;
  88.318 -} PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
  88.319 -
  88.320 -#define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
  88.321 -typedef struct {
  88.322 -    /* IN variables. */
  88.323 -    domid_t  domain;                  /*  0 */
  88.324 -    u16      __pad0;
  88.325 -    u32      __pad1;
  88.326 -    memory_t num;                     /*  8 */
  88.327 -    MEMORY_PADDING;
  88.328 -    /* IN/OUT variables. */
  88.329 -    unsigned long *array;             /* 16 */
  88.330 -    MEMORY_PADDING;
  88.331 -} PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
  88.332 -
  88.333 -#define DOM0_SETDOMAINVMASSIST   30
  88.334 -typedef struct {
  88.335 -    /* IN variables. */
  88.336 -    domid_t      domain;              /*  0 */
  88.337 -    u16          __pad0;
  88.338 -    u32          cmd;                 /*  4: vm_assist cmd */
  88.339 -    u32          type;                /*  8: vm_assist cmd */
  88.340 -} PACKED dom0_setdomainvmassist_t; /* 12 bytes */
  88.341 -
  88.342 -typedef struct {
  88.343 -    u32 cmd;                          /* 0 */
  88.344 -    u32 interface_version;            /* 4 */ /* DOM0_INTERFACE_VERSION */
  88.345 -    union {                           /* 8 */
  88.346 -	u32                      dummy[18]; /* 72 bytes */
  88.347 -        dom0_createdomain_t      createdomain;
  88.348 -        dom0_pausedomain_t       pausedomain;
  88.349 -        dom0_unpausedomain_t     unpausedomain;
  88.350 -        dom0_destroydomain_t     destroydomain;
  88.351 -        dom0_getmemlist_t        getmemlist;
  88.352 -        dom0_schedctl_t          schedctl;
  88.353 -        dom0_adjustdom_t         adjustdom;
  88.354 -        dom0_builddomain_t       builddomain;
  88.355 -        dom0_getdomaininfo_t     getdomaininfo;
  88.356 -        dom0_getpageframeinfo_t  getpageframeinfo;
  88.357 -        dom0_iopl_t              iopl;
  88.358 -	dom0_msr_t               msr;
  88.359 -	dom0_debug_t             debug;
  88.360 -	dom0_settime_t           settime;
  88.361 -	dom0_readconsole_t	 readconsole;
  88.362 -	dom0_pincpudomain_t      pincpudomain;
  88.363 -        dom0_gettbufs_t          gettbufs;
  88.364 -        dom0_physinfo_t          physinfo;
  88.365 -        dom0_pcidev_access_t     pcidev_access;
  88.366 -        dom0_sched_id_t          sched_id;
  88.367 -	dom0_shadow_control_t    shadow_control;
  88.368 -	dom0_setdomaininitialmem_t setdomaininitialmem;
  88.369 -	dom0_setdomainmaxmem_t   setdomainmaxmem;
  88.370 -	dom0_getpageframeinfo2_t getpageframeinfo2;
  88.371 -	dom0_setdomainvmassist_t setdomainvmassist;
  88.372 -    } PACKED u;
  88.373 -} PACKED dom0_op_t; /* 80 bytes */
  88.374 -
  88.375 -#endif /* __DOM0_OPS_H__ */
    89.1 --- a/xen/include/hypervisor-ifs/event_channel.h	Mon Nov 01 00:14:22 2004 +0000
    89.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.3 @@ -1,161 +0,0 @@
    89.4 -/******************************************************************************
    89.5 - * event_channel.h
    89.6 - * 
    89.7 - * Event channels between domains.
    89.8 - * 
    89.9 - * Copyright (c) 2003-2004, K A Fraser.
   89.10 - */
   89.11 -
   89.12 -#ifndef __HYPERVISOR_IFS__EVENT_CHANNEL_H__
   89.13 -#define __HYPERVISOR_IFS__EVENT_CHANNEL_H__
   89.14 -
   89.15 -/*
   89.16 - * EVTCHNOP_alloc_unbound: Allocate a fresh local port and prepare
   89.17 - * it for binding to <dom>.
   89.18 - */
   89.19 -#define EVTCHNOP_alloc_unbound    6
   89.20 -typedef struct {
   89.21 -    /* IN parameters */
   89.22 -    domid_t dom;                      /*  0 */
   89.23 -    u16     __pad;
   89.24 -    /* OUT parameters */
   89.25 -    u32     port;                     /*  4 */
   89.26 -} PACKED evtchn_alloc_unbound_t; /* 8 bytes */
   89.27 -
   89.28 -/*
   89.29 - * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
   89.30 - * <dom1> and <dom2>. Either <port1> or <port2> may be wildcarded by setting to
   89.31 - * zero. On successful return both <port1> and <port2> are filled in and
   89.32 - * <dom1,port1> is fully bound to <dom2,port2>.
   89.33 - * 
   89.34 - * NOTES:
   89.35 - *  1. A wildcarded port is allocated from the relevant domain's free list
   89.36 - *     (i.e., some port that was previously EVTCHNSTAT_closed). However, if the
   89.37 - *     remote port pair is already fully bound then a port is not allocated,
   89.38 - *     and instead the existing local port is returned to the caller.
   89.39 - *  2. If the caller is unprivileged then <dom1> must be DOMID_SELF.
   89.40 - *  3. If the caller is unprivileged and <dom2,port2> is EVTCHNSTAT_closed
   89.41 - *     then <dom2> must be DOMID_SELF.
   89.42 - *  4. If either port is already bound then it must be bound to the other
   89.43 - *     specified domain and port (if not wildcarded).
   89.44 - *  5. If either port is awaiting binding (EVTCHNSTAT_unbound) then it must
   89.45 - *     be awaiting binding to the other domain, and the other port pair must
   89.46 - *     be closed or unbound.
   89.47 - */
   89.48 -#define EVTCHNOP_bind_interdomain 0
   89.49 -typedef struct {
   89.50 -    /* IN parameters. */
   89.51 -    domid_t dom1, dom2;               /*  0,  2 */
   89.52 -    /* IN/OUT parameters. */
   89.53 -    u32     port1, port2;             /*  4,  8 */
   89.54 -} PACKED evtchn_bind_interdomain_t; /* 12 bytes */
   89.55 -
   89.56 -/*
   89.57 - * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
   89.58 - * NOTES:
   89.59 - *  1. A virtual IRQ may be bound to at most one event channel per domain.
   89.60 - */
   89.61 -#define EVTCHNOP_bind_virq        1
   89.62 -typedef struct {
   89.63 -    /* IN parameters. */
   89.64 -    u32 virq;                         /*  0 */
   89.65 -    /* OUT parameters. */
   89.66 -    u32 port;                         /*  4 */
   89.67 -} PACKED evtchn_bind_virq_t; /* 8 bytes */
   89.68 -
   89.69 -/*
   89.70 - * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
   89.71 - * NOTES:
   89.72 - *  1. A physical IRQ may be bound to at most one event channel per domain.
   89.73 - *  2. Only a sufficiently-privileged domain may bind to a physical IRQ.
   89.74 - */
   89.75 -#define EVTCHNOP_bind_pirq        2
   89.76 -typedef struct {
   89.77 -    /* IN parameters. */
   89.78 -    u32 pirq;                         /*  0 */
   89.79 -#define BIND_PIRQ__WILL_SHARE 1
   89.80 -    u32 flags; /* BIND_PIRQ__* */     /*  4 */
   89.81 -    /* OUT parameters. */
   89.82 -    u32 port;                         /*  8 */
   89.83 -} PACKED evtchn_bind_pirq_t; /* 12 bytes */
   89.84 -
   89.85 -/*
   89.86 - * EVTCHNOP_close: Close the communication channel which has an endpoint at
   89.87 - * <dom, port>. If the channel is interdomain then the remote end is placed in
   89.88 - * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
   89.89 - * NOTES:
   89.90 - *  1. <dom> may be specified as DOMID_SELF.
   89.91 - *  2. Only a sufficiently-privileged domain may close an event channel
   89.92 - *     for which <dom> is not DOMID_SELF.
   89.93 - */
   89.94 -#define EVTCHNOP_close            3
   89.95 -typedef struct {
   89.96 -    /* IN parameters. */
   89.97 -    domid_t dom;                      /*  0 */
   89.98 -    u16     __pad;
   89.99 -    u32     port;                     /*  4 */
  89.100 -    /* No OUT parameters. */
  89.101 -} PACKED evtchn_close_t; /* 8 bytes */
  89.102 -
  89.103 -/*
  89.104 - * EVTCHNOP_send: Send an event to the remote end of the channel whose local
  89.105 - * endpoint is <DOMID_SELF, local_port>.
  89.106 - */
  89.107 -#define EVTCHNOP_send             4
  89.108 -typedef struct {
  89.109 -    /* IN parameters. */
  89.110 -    u32     local_port;               /*  0 */
  89.111 -    /* No OUT parameters. */
  89.112 -} PACKED evtchn_send_t; /* 4 bytes */
  89.113 -
  89.114 -/*
  89.115 - * EVTCHNOP_status: Get the current status of the communication channel which
  89.116 - * has an endpoint at <dom, port>.
  89.117 - * NOTES:
  89.118 - *  1. <dom> may be specified as DOMID_SELF.
  89.119 - *  2. Only a sufficiently-privileged domain may obtain the status of an event
  89.120 - *     channel for which <dom> is not DOMID_SELF.
  89.121 - */
  89.122 -#define EVTCHNOP_status           5
  89.123 -typedef struct {
  89.124 -    /* IN parameters */
  89.125 -    domid_t dom;                      /*  0 */
  89.126 -    u16     __pad;
  89.127 -    u32     port;                     /*  4 */
  89.128 -    /* OUT parameters */
  89.129 -#define EVTCHNSTAT_closed       0  /* Channel is not in use.                 */
  89.130 -#define EVTCHNSTAT_unbound      1  /* Channel is waiting interdom connection.*/
  89.131 -#define EVTCHNSTAT_interdomain  2  /* Channel is connected to remote domain. */
  89.132 -#define EVTCHNSTAT_pirq         3  /* Channel is bound to a phys IRQ line.   */
  89.133 -#define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
  89.134 -    u32     status;                   /*  8 */
  89.135 -    union {                           /* 12 */
  89.136 -        struct {
  89.137 -            domid_t dom;                              /* 12 */
  89.138 -        } PACKED unbound; /* EVTCHNSTAT_unbound */
  89.139 -        struct {
  89.140 -            domid_t dom;                              /* 12 */
  89.141 -            u16     __pad;
  89.142 -            u32     port;                             /* 16 */
  89.143 -        } PACKED interdomain; /* EVTCHNSTAT_interdomain */
  89.144 -        u32 pirq;      /* EVTCHNSTAT_pirq        */   /* 12 */
  89.145 -        u32 virq;      /* EVTCHNSTAT_virq        */   /* 12 */
  89.146 -    } PACKED u;
  89.147 -} PACKED evtchn_status_t; /* 20 bytes */
  89.148 -
  89.149 -typedef struct {
  89.150 -    u32 cmd; /* EVTCHNOP_* */         /*  0 */
  89.151 -    u32 __reserved;                   /*  4 */
  89.152 -    union {                           /*  8 */
  89.153 -        evtchn_alloc_unbound_t    alloc_unbound;
  89.154 -        evtchn_bind_interdomain_t bind_interdomain;
  89.155 -        evtchn_bind_virq_t        bind_virq;
  89.156 -        evtchn_bind_pirq_t        bind_pirq;
  89.157 -        evtchn_close_t            close;
  89.158 -        evtchn_send_t             send;
  89.159 -        evtchn_status_t           status;
  89.160 -        u8                        __dummy[24];
  89.161 -    } PACKED u;
  89.162 -} PACKED evtchn_op_t; /* 32 bytes */
  89.163 -
  89.164 -#endif /* __HYPERVISOR_IFS__EVENT_CHANNEL_H__ */
    90.1 --- a/xen/include/hypervisor-ifs/grant_table.h	Mon Nov 01 00:14:22 2004 +0000
    90.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.3 @@ -1,251 +0,0 @@
    90.4 -/******************************************************************************
    90.5 - * grant_table.h
    90.6 - * 
    90.7 - * Interface for granting foreign access to page frames, and receiving
    90.8 - * page-ownership transfers.
    90.9 - * 
   90.10 - * Copyright (c) 2004, K A Fraser
   90.11 - */
   90.12 -
   90.13 -#ifndef __HYPERVISOR_IFS_GRANT_TABLE_H__
   90.14 -#define __HYPERVISOR_IFS_GRANT_TABLE_H__
   90.15 -
   90.16 -
   90.17 -/***********************************
   90.18 - * GRANT TABLE REPRESENTATION
   90.19 - */
   90.20 -
   90.21 -/* Some rough guidelines on accessing and updating grant-table entries
   90.22 - * in a concurrency-safe manner. For more information, Linux contains a
   90.23 - * reference implementation for guest OSes (arch/xen/kernel/grant_table.c).
   90.24 - * 
   90.25 - * NB. WMB is a no-op on current-generation x86 processors. However, a
   90.26 - *     compiler barrier will still be required.
   90.27 - * 
   90.28 - * Introducing a valid entry into the grant table:
   90.29 - *  1. Write ent->domid.
   90.30 - *  2. Write ent->frame:
   90.31 - *      GTF_permit_access:   Frame to which access is permitted.
   90.32 - *      GTF_accept_transfer: Pseudo-phys frame slot being filled by new
   90.33 - *                           frame, or zero if none.
   90.34 - *  3. Write memory barrier (WMB).
   90.35 - *  4. Write ent->flags, inc. valid type.
   90.36 - * 
   90.37 - * Invalidating an unused GTF_permit_access entry:
   90.38 - *  1. flags = ent->flags.
   90.39 - *  2. Observe that !(flags & (GTF_reading|GTF_writing)).
   90.40 - *  3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
   90.41 - *  NB. No need for WMB as reuse of entry is control-dependent on success of
   90.42 - *      step 3, and all architectures guarantee ordering of ctrl-dep writes.
   90.43 - *
   90.44 - * Invalidating an in-use GTF_permit_access entry:
   90.45 - *  This cannot be done directly. Request assistance from the domain controller
   90.46 - *  which can set a timeout on the use of a grant entry and take necessary
   90.47 - *  action. (NB. This is not yet implemented!).
   90.48 - * 
   90.49 - * Invalidating an unused GTF_accept_transfer entry:
   90.50 - *  1. flags = ent->flags.
   90.51 - *  2. Observe that !(flags & GTF_transfer_committed). [*]
   90.52 - *  3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
   90.53 - *  NB. No need for WMB as reuse of entry is control-dependent on success of
   90.54 - *      step 3, and all architectures guarantee ordering of ctrl-dep writes.
   90.55 - *  [*] If GTF_transfer_committed is set then the grant entry is 'committed'.
   90.56 - *      The guest must /not/ modify the grant entry until the address of the
   90.57 - *      transferred frame is written. It is safe for the guest to spin waiting
   90.58 - *      for this to occur (detect by observing GTF_transfer_completed in
   90.59 - *      ent->flags).
   90.60 - *
   90.61 - * Invalidating a committed GTF_accept_transfer entry:
   90.62 - *  1. Wait for (ent->flags & GTF_transfer_completed).
   90.63 - *
   90.64 - * Changing a GTF_permit_access from writable to read-only:
   90.65 - *  Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
   90.66 - * 
   90.67 - * Changing a GTF_permit_access from read-only to writable:
   90.68 - *  Use SMP-safe bit-setting instruction.
   90.69 - */
   90.70 -
   90.71 -/*
   90.72 - * A grant table comprises a packed array of grant entries in one or more
   90.73 - * page frames shared between Xen and a guest.
   90.74 - * [XEN]: This field is written by Xen and read by the sharing guest.
   90.75 - * [GST]: This field is written by the guest and read by Xen.
   90.76 - */
   90.77 -typedef struct {
   90.78 -    /* GTF_xxx: various type and flag information.  [XEN,GST] */
   90.79 -    u16     flags;      /* 0 */
   90.80 -    /* The domain being granted foreign privileges. [GST] */
   90.81 -    domid_t domid;      /* 2 */
   90.82 -    /*
   90.83 -     * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
   90.84 -     * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
   90.85 -     */
   90.86 -    u32     frame;      /* 4 */
   90.87 -} PACKED grant_entry_t; /* 8 bytes */
   90.88 -
   90.89 -/*
   90.90 - * Type of grant entry.
   90.91 - *  GTF_invalid: This grant entry grants no privileges.
   90.92 - *  GTF_permit_access: Allow @domid to map/access @frame.
   90.93 - *  GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
   90.94 - *                       to this guest. Xen writes the page number to @frame.
   90.95 - */
   90.96 -#define GTF_invalid         (0U<<0)
   90.97 -#define GTF_permit_access   (1U<<0)
   90.98 -#define GTF_accept_transfer (2U<<0)
   90.99 -#define GTF_type_mask       (3U<<0)
  90.100 -
  90.101 -/*
  90.102 - * Subflags for GTF_permit_access.
  90.103 - *  GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
  90.104 - *  GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
  90.105 - *  GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
  90.106 - */
  90.107 -#define _GTF_readonly       (2)
  90.108 -#define GTF_readonly        (1U<<_GTF_readonly)
  90.109 -#define _GTF_reading        (3)
  90.110 -#define GTF_reading         (1U<<_GTF_reading)
  90.111 -#define _GTF_writing        (4)
  90.112 -#define GTF_writing         (1U<<_GTF_writing)
  90.113 -
  90.114 -/*
  90.115 - * Subflags for GTF_accept_transfer:
  90.116 - *  GTF_transfer_committed: Xen sets this flag to indicate that it is committed
  90.117 - *      to transferring ownership of a page frame. When a guest sees this flag
  90.118 - *      it must /not/ modify the grant entry until GTF_transfer_completed is
  90.119 - *      set by Xen.
  90.120 - *  GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
  90.121 - *      after reading GTF_transfer_committed. Xen will always write the frame
  90.122 - *      address, followed by ORing this flag, in a timely manner.
  90.123 - */
  90.124 -#define _GTF_transfer_committed (2)
  90.125 -#define GTF_transfer_committed  (1U<<_GTF_transfer_committed)
  90.126 -#define _GTF_transfer_completed (3)
  90.127 -#define GTF_transfer_completed  (1U<<_GTF_transfer_completed)
  90.128 -
  90.129 -
  90.130 -/***********************************
  90.131 - * GRANT TABLE QUERIES AND USES
  90.132 - */
  90.133 -
  90.134 -/*
  90.135 - * Reference to a grant entry in a specified domain's grant table.
  90.136 - */
  90.137 -typedef u16 grant_ref_t;
  90.138 -
  90.139 -/*
  90.140 - * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
  90.141 - * by devices and/or host CPUs. If successful, <handle> is a tracking number
  90.142 - * that must be presented later to destroy the mapping(s). On error, <handle>
  90.143 - * is a negative status code.
  90.144 - * NOTES:
  90.145 - *  1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
  90.146 - *     via which I/O devices may access the granted frame.
  90.147 - *  2. If GNTPIN_map_for_host is specified then a mapping will be added at
  90.148 - *     virtual address <host_virt_addr> in the current address space.
  90.149 - *  3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
  90.150 - *     host mapping is destroyed by other means then it is *NOT* guaranteed
  90.151 - *     to be accounted to the correct grant reference!
  90.152 - */
  90.153 -#define GNTTABOP_map_grant_ref        0
  90.154 -typedef struct {
  90.155 -    /* IN parameters. */
  90.156 -    memory_t    host_virt_addr;       /*  0 */
  90.157 -    MEMORY_PADDING;
  90.158 -    domid_t     dom;                  /*  8 */
  90.159 -    grant_ref_t ref;                  /* 10 */
  90.160 -    u16         flags;                /* 12: GNTMAP_* */
  90.161 -    /* OUT parameters. */
  90.162 -    s16         handle;               /* 14: +ve: handle; -ve: GNTST_* */
  90.163 -    memory_t    dev_bus_addr;         /* 16 */
  90.164 -    MEMORY_PADDING;
  90.165 -} PACKED gnttab_map_grant_ref_t; /* 24 bytes */
  90.166 -
  90.167 -/*
  90.168 - * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
  90.169 - * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
  90.170 - * field is ignored. If non-zero, they must refer to a device/host mapping
  90.171 - * that is tracked by <handle>
  90.172 - * NOTES:
  90.173 - *  1. The call may fail in an undefined manner if either mapping is not
  90.174 - *     tracked by <handle>.
  90.175 - *  3. After executing a batch of unmaps, it is guaranteed that no stale
  90.176 - *     mappings will remain in the device or host TLBs.
  90.177 - */
  90.178 -#define GNTTABOP_unmap_grant_ref      1
  90.179 -typedef struct {
  90.180 -    /* IN parameters. */
  90.181 -    memory_t    host_virt_addr;       /*  0 */
  90.182 -    MEMORY_PADDING;
  90.183 -    memory_t    dev_bus_addr;         /*  8 */
  90.184 -    MEMORY_PADDING;
  90.185 -    u16         handle;               /* 16 */
  90.186 -    /* OUT parameters. */
  90.187 -    s16         status;               /* 18: GNTST_* */
  90.188 -    u32         __pad;
  90.189 -} PACKED gnttab_unmap_grant_ref_t; /* 24 bytes */
  90.190 -
  90.191 -/*
  90.192 - * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
  90.193 - * <nr_frames> pages. The frame addresses are written to the <frame_list>.
  90.194 - * Only <nr_frames> addresses are written, even if the table is larger.
  90.195 - * NOTES:
  90.196 - *  1. <dom> may be specified as DOMID_SELF.
  90.197 - *  2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
  90.198 - *  3. Xen may not support more than a single grant-table page per domain.
  90.199 - */
  90.200 -#define GNTTABOP_setup_table          2
  90.201 -typedef struct {
  90.202 -    /* IN parameters. */
  90.203 -    domid_t     dom;                  /*  0 */
  90.204 -    u16         nr_frames;            /*  2 */
  90.205 -    u16         __pad;
  90.206 -    /* OUT parameters. */
  90.207 -    s16         status;               /*  6: GNTST_* */
  90.208 -    unsigned long *frame_list;        /*  8 */
  90.209 -    MEMORY_PADDING;
  90.210 -} PACKED gnttab_setup_table_t; /* 16 bytes */
  90.211 -
  90.212 -/*
  90.213 - * Bitfield values for update_pin_status.flags.
  90.214 - */
  90.215 - /* Map the grant entry for access by I/O devices. */
  90.216 -#define _GNTMAP_device_map      (0)
  90.217 -#define GNTMAP_device_map       (1<<_GNTMAP_device_map)
  90.218 - /* Map the grant entry for access by host CPUs. */
  90.219 -#define _GNTMAP_host_map        (1)
  90.220 -#define GNTMAP_host_map         (1<<_GNTMAP_host_map)
  90.221 - /* Accesses to the granted frame will be restricted to read-only access. */
  90.222 -#define _GNTMAP_readonly        (2)
  90.223 -#define GNTMAP_readonly         (1<<_GNTMAP_readonly)
  90.224 - /*
  90.225 -  * GNTMAP_host_map subflag:
  90.226 -  *  0 => The host mapping is usable only by the guest OS.
  90.227 -  *  1 => The host mapping is usable by guest OS + current application.
  90.228 -  */
  90.229 -#define _GNTMAP_application_map (3)
  90.230 -#define GNTMAP_application_map  (1<<_GNTMAP_application_map)
  90.231 -
  90.232 -/*
  90.233 - * Values for error status returns. All errors are -ve.
  90.234 - */
  90.235 -#define GNTST_okay             (0)
  90.236 -#define GNTST_general_error    (-1) /* General undefined error.              */
  90.237 -#define GNTST_bad_domain       (-2) /* Unrecognsed domain id.                */
  90.238 -#define GNTST_bad_gntref       (-3) /* Unrecognised or inappropriate gntref. */
  90.239 -#define GNTST_bad_handle       (-3) /* Unrecognised or inappropriate handle. */
  90.240 -#define GNTST_no_device_space  (-4) /* Out of space in I/O MMU.              */
  90.241 -#define GNTST_permission_denied (-5) /* Not enough privilege for operation.  */
  90.242 -
  90.243 -#define GNTTABOP_error_msgs {                   \
  90.244 -    "okay",                                     \
  90.245 -    "undefined error",                          \
  90.246 -    "unrecognised domain id",                   \
  90.247 -    "invalid grant reference",                  \
  90.248 -    "invalid mapping handle",                   \
  90.249 -    "no spare translation slot in the I/O MMU", \
  90.250 -    "permission denied"                         \
  90.251 -}
  90.252 -        
  90.253 -
  90.254 -#endif /* __HYPERVISOR_IFS_GRANT_TABLE_H__ */
    91.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Mon Nov 01 00:14:22 2004 +0000
    91.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.3 @@ -1,425 +0,0 @@
    91.4 -/******************************************************************************
    91.5 - * hypervisor-if.h
    91.6 - * 
    91.7 - * Guest OS interface to Xen.
    91.8 - * 
    91.9 - * Copyright (c) 2004, K A Fraser
   91.10 - */
   91.11 -
   91.12 -#ifndef __HYPERVISOR_IF_H__
   91.13 -#define __HYPERVISOR_IF_H__
   91.14 -
   91.15 -/* GCC-specific way to pack structure definitions (no implicit padding). */
   91.16 -#define PACKED __attribute__ ((packed))
   91.17 -
   91.18 -#if defined(__i386__)
   91.19 -#include "arch-x86_32.h"
   91.20 -#elif defined(__x86_64__)
   91.21 -#include "arch-x86_64.h"
   91.22 -#else
   91.23 -#error "Unsupported architecture"
   91.24 -#endif
   91.25 -
   91.26 -/*
   91.27 - * HYPERVISOR "SYSTEM CALLS"
   91.28 - */
   91.29 -
   91.30 -/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
   91.31 -#define __HYPERVISOR_set_trap_table        0
   91.32 -#define __HYPERVISOR_mmu_update            1
   91.33 -#define __HYPERVISOR_set_gdt               2
   91.34 -#define __HYPERVISOR_stack_switch          3
   91.35 -#define __HYPERVISOR_set_callbacks         4
   91.36 -#define __HYPERVISOR_fpu_taskswitch        5
   91.37 -#define __HYPERVISOR_sched_op              6
   91.38 -#define __HYPERVISOR_dom0_op               7
   91.39 -#define __HYPERVISOR_set_debugreg          8
   91.40 -#define __HYPERVISOR_get_debugreg          9
   91.41 -#define __HYPERVISOR_update_descriptor    10
   91.42 -#define __HYPERVISOR_set_fast_trap        11
   91.43 -#define __HYPERVISOR_dom_mem_op           12
   91.44 -#define __HYPERVISOR_multicall            13
   91.45 -#define __HYPERVISOR_update_va_mapping    14
   91.46 -#define __HYPERVISOR_set_timer_op         15
   91.47 -#define __HYPERVISOR_event_channel_op     16
   91.48 -#define __HYPERVISOR_xen_version          17
   91.49 -#define __HYPERVISOR_console_io           18
   91.50 -#define __HYPERVISOR_physdev_op           19
   91.51 -#define __HYPERVISOR_grant_table_op       20
   91.52 -#define __HYPERVISOR_vm_assist            21
   91.53 -#define __HYPERVISOR_update_va_mapping_otherdomain 22
   91.54 -
   91.55 -/*
   91.56 - * MULTICALLS
   91.57 - * 
   91.58 - * Multicalls are listed in an array, with each element being a fixed size 
   91.59 - * (BYTES_PER_MULTICALL_ENTRY). Each is of the form (op, arg1, ..., argN)
   91.60 - * where each element of the tuple is a machine word. 
   91.61 - */
   91.62 -#define ARGS_PER_MULTICALL_ENTRY 8
   91.63 -
   91.64 -
   91.65 -/* 
   91.66 - * VIRTUAL INTERRUPTS
   91.67 - * 
   91.68 - * Virtual interrupts that a guest OS may receive from the hypervisor.
   91.69 - */
   91.70 -#define VIRQ_MISDIRECT  0  /* Catch-all interrupt for unbound VIRQs.      */
   91.71 -#define VIRQ_TIMER      1  /* Timebase update, and/or requested timeout.  */
   91.72 -#define VIRQ_DEBUG      2  /* Request guest to dump debug info.           */
   91.73 -#define VIRQ_CONSOLE    3  /* (DOM0) bytes received on emergency console. */
   91.74 -#define VIRQ_DOM_EXC    4  /* (DOM0) Exceptional event for some domain.   */
   91.75 -#define VIRQ_PARITY_ERR 5  /* (DOM0) NMI parity error.                    */
   91.76 -#define VIRQ_IO_ERR     6  /* (DOM0) NMI I/O error.                       */
   91.77 -#define NR_VIRQS        7
   91.78 -
   91.79 -/*
   91.80 - * MMU-UPDATE REQUESTS
   91.81 - * 
   91.82 - * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
   91.83 - * ptr[1:0] specifies the appropriate MMU_* command.
   91.84 - * 
   91.85 - * FOREIGN DOMAIN (FD)
   91.86 - * -------------------
   91.87 - *  Some commands recognise an explicitly-declared foreign domain,
   91.88 - *  in which case they will operate with respect to the foreigner rather than
   91.89 - *  the calling domain. Where the FD has some effect, it is described below.
   91.90 - * 
   91.91 - * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
   91.92 - * Updates an entry in a page table. If updating an L1 table, and the new
   91.93 - * table entry is valid/present, the mapped frame must belong to the FD, if
   91.94 - * an FD has been specified. If attempting to map an I/O page then the
   91.95 - * caller assumes the privilege of the FD.
   91.96 - * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
   91.97 - * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
   91.98 - * ptr[:2]  -- Machine address of the page-table entry to modify.
   91.99 - * val      -- Value to write.
  91.100 - * 
  91.101 - * ptr[1:0] == MMU_MACHPHYS_UPDATE:
  91.102 - * Updates an entry in the machine->pseudo-physical mapping table.
  91.103 - * ptr[:2]  -- Machine address within the frame whose mapping to modify.
  91.104 - *             The frame must belong to the FD, if one is specified.
  91.105 - * val      -- Value to write into the mapping entry.
  91.106 - *  
  91.107 - * ptr[1:0] == MMU_EXTENDED_COMMAND:
  91.108 - * val[7:0] -- MMUEXT_* command.
  91.109 - * 
  91.110 - *   val[7:0] == MMUEXT_(UN)PIN_*_TABLE:
  91.111 - *   ptr[:2]  -- Machine address of frame to be (un)pinned as a p.t. page.
  91.112 - *               The frame must belong to the FD, if one is specified.
  91.113 - * 
  91.114 - *   val[7:0] == MMUEXT_NEW_BASEPTR:
  91.115 - *   ptr[:2]  -- Machine address of new page-table base to install in MMU.
  91.116 - * 
  91.117 - *   val[7:0] == MMUEXT_TLB_FLUSH:
  91.118 - *   No additional arguments.
  91.119 - * 
  91.120 - *   val[7:0] == MMUEXT_INVLPG:
  91.121 - *   ptr[:2]  -- Linear address to be flushed from the TLB.
  91.122 - * 
  91.123 - *   val[7:0] == MMUEXT_FLUSH_CACHE:
  91.124 - *   No additional arguments. Writes back and flushes cache contents.
  91.125 - * 
  91.126 - *   val[7:0] == MMUEXT_SET_LDT:
  91.127 - *   ptr[:2]  -- Linear address of LDT base (NB. must be page-aligned).
  91.128 - *   val[:8]  -- Number of entries in LDT.
  91.129 - * 
  91.130 - *   val[7:0] == MMUEXT_TRANSFER_PAGE:
  91.131 - *   val[31:16] -- Domain to whom page is to be transferred.
  91.132 - *   (val[15:8],ptr[9:2]) -- 16-bit reference into transferee's grant table.
  91.133 - *   ptr[:12]  -- Page frame to be reassigned to the FD.
  91.134 - *                (NB. The frame must currently belong to the calling domain).
  91.135 - * 
  91.136 - *   val[7:0] == MMUEXT_SET_FOREIGNDOM:
  91.137 - *   val[31:16] -- Domain to set as the Foreign Domain (FD).
  91.138 - *                 (NB. DOMID_SELF is not recognised)
  91.139 - *                 If FD != DOMID_IO then the caller must be privileged.
  91.140 - * 
  91.141 - *   val[7:0] == MMUEXT_CLEAR_FOREIGNDOM:
  91.142 - *   Clears the FD.
  91.143 - * 
  91.144 - *   val[7:0] == MMUEXT_REASSIGN_PAGE:
  91.145 - *   ptr[:2]  -- A machine address within the page to be reassigned to the FD.
  91.146 - *               (NB. page must currently belong to the calling domain).
  91.147 - */
  91.148 -#define MMU_NORMAL_PT_UPDATE     0 /* checked '*ptr = val'. ptr is MA.       */
  91.149 -#define MMU_MACHPHYS_UPDATE      2 /* ptr = MA of frame to modify entry for  */
  91.150 -#define MMU_EXTENDED_COMMAND     3 /* least 8 bits of val demux further      */
  91.151 -#define MMUEXT_PIN_L1_TABLE      0 /* ptr = MA of frame to pin               */
  91.152 -#define MMUEXT_PIN_L2_TABLE      1 /* ptr = MA of frame to pin               */
  91.153 -#define MMUEXT_PIN_L3_TABLE      2 /* ptr = MA of frame to pin               */
  91.154 -#define MMUEXT_PIN_L4_TABLE      3 /* ptr = MA of frame to pin               */
  91.155 -#define MMUEXT_UNPIN_TABLE       4 /* ptr = MA of frame to unpin             */
  91.156 -#define MMUEXT_NEW_BASEPTR       5 /* ptr = MA of new pagetable base         */
  91.157 -#define MMUEXT_TLB_FLUSH         6 /* ptr = NULL                             */
  91.158 -#define MMUEXT_INVLPG            7 /* ptr = VA to invalidate                 */
  91.159 -#define MMUEXT_FLUSH_CACHE       8
  91.160 -#define MMUEXT_SET_LDT           9 /* ptr = VA of table; val = # entries     */
  91.161 -#define MMUEXT_SET_FOREIGNDOM   10 /* val[31:16] = dom                       */
  91.162 -#define MMUEXT_CLEAR_FOREIGNDOM 11
  91.163 -#define MMUEXT_TRANSFER_PAGE    12 /* ptr = MA of frame; val[31:16] = dom    */
  91.164 -#define MMUEXT_REASSIGN_PAGE    13
  91.165 -#define MMUEXT_CMD_MASK        255
  91.166 -#define MMUEXT_CMD_SHIFT         8
  91.167 -
  91.168 -/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
  91.169 -#define UVMF_FLUSH_TLB          1 /* Flush entire TLB. */
  91.170 -#define UVMF_INVLPG             2 /* Flush the VA mapping being updated. */
  91.171 -
  91.172 -
  91.173 -/*
  91.174 - * Commands to HYPERVISOR_sched_op().
  91.175 - */
  91.176 -#define SCHEDOP_yield           0   /* Give up the CPU voluntarily.       */
  91.177 -#define SCHEDOP_block           1   /* Block until an event is received.  */
  91.178 -#define SCHEDOP_shutdown        2   /* Stop executing this domain.        */
  91.179 -#define SCHEDOP_cmdmask       255   /* 8-bit command. */
  91.180 -#define SCHEDOP_reasonshift     8   /* 8-bit reason code. (SCHEDOP_shutdown) */
  91.181 -
  91.182 -/*
  91.183 - * Commands to HYPERVISOR_console_io().
  91.184 - */
  91.185 -#define CONSOLEIO_write         0
  91.186 -#define CONSOLEIO_read          1
  91.187 -
  91.188 -/*
  91.189 - * Commands to HYPERVISOR_dom_mem_op().
  91.190 - */
  91.191 -#define MEMOP_increase_reservation 0
  91.192 -#define MEMOP_decrease_reservation 1
  91.193 -
  91.194 -/*
  91.195 - * Commands to HYPERVISOR_vm_assist().
  91.196 - */
  91.197 -#define VMASST_CMD_enable                0
  91.198 -#define VMASST_CMD_disable               1
  91.199 -#define VMASST_TYPE_4gb_segments         0
  91.200 -#define VMASST_TYPE_4gb_segments_notify  1
  91.201 -#define VMASST_TYPE_writable_pagetables  2
  91.202 -#define MAX_VMASST_TYPE 2
  91.203 -
  91.204 -#ifndef __ASSEMBLY__
  91.205 -
  91.206 -typedef u16 domid_t;
  91.207 -
  91.208 -/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
  91.209 -#define DOMID_FIRST_RESERVED (0x7FF0U)
  91.210 -
  91.211 -/* DOMID_SELF is used in certain contexts to refer to oneself. */
  91.212 -#define DOMID_SELF (0x7FF0U)
  91.213 -
  91.214 -/*
  91.215 - * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
  91.216 - * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
  91.217 - * is useful to ensure that no mappings to the OS's own heap are accidentally
  91.218 - * installed. (e.g., in Linux this could cause havoc as reference counts
  91.219 - * aren't adjusted on the I/O-mapping code path).
  91.220 - * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
  91.221 - * be specified by any calling domain.
  91.222 - */
  91.223 -#define DOMID_IO   (0x7FF1U)
  91.224 -
  91.225 -/*
  91.226 - * DOMID_XEN is used to allow privileged domains to map restricted parts of
  91.227 - * Xen's heap space (e.g., the machine_to_phys table).
  91.228 - * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
  91.229 - * the caller is privileged.
  91.230 - */
  91.231 -#define DOMID_XEN  (0x7FF2U)
  91.232 -
  91.233 -/*
  91.234 - * Send an array of these to HYPERVISOR_mmu_update().
  91.235 - * NB. The fields are natural pointer/address size for this architecture.
  91.236 - */
  91.237 -typedef struct
  91.238 -{
  91.239 -    memory_t ptr;    /* Machine address of PTE. */
  91.240 -    memory_t val;    /* New contents of PTE.    */
  91.241 -} PACKED mmu_update_t;
  91.242 -
  91.243 -/*
  91.244 - * Send an array of these to HYPERVISOR_multicall().
  91.245 - * NB. The fields are natural register size for this architecture.
  91.246 - */
  91.247 -typedef struct
  91.248 -{
  91.249 -    cpureg_t op;
  91.250 -    cpureg_t args[7];
  91.251 -} PACKED multicall_entry_t;
  91.252 -
  91.253 -/* Event channel endpoints per domain. */
  91.254 -#define NR_EVENT_CHANNELS 1024
  91.255 -
  91.256 -/* No support for multi-processor guests. */
  91.257 -#define MAX_VIRT_CPUS 1
  91.258 -
  91.259 -/*
  91.260 - * Xen/guestos shared data -- pointer provided in start_info.
  91.261 - * NB. We expect that this struct is smaller than a page.
  91.262 - */
  91.263 -typedef struct shared_info_st
  91.264 -{
  91.265 -    /*
  91.266 -     * Per-VCPU information goes here. This will be cleaned up more when Xen 
  91.267 -     * actually supports multi-VCPU guests.
  91.268 -     */
  91.269 -    struct {
  91.270 -        /*
  91.271 -         * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
  91.272 -         * a pending notification for a particular VCPU. It is then cleared 
  91.273 -         * by the guest OS /before/ checking for pending work, thus avoiding
  91.274 -         * a set-and-check race. Note that the mask is only accessed by Xen
  91.275 -         * on the CPU that is currently hosting the VCPU. This means that the
  91.276 -         * pending and mask flags can be updated by the guest without special
  91.277 -         * synchronisation (i.e., no need for the x86 LOCK prefix).
  91.278 -         * This may seem suboptimal because if the pending flag is set by
  91.279 -         * a different CPU then an IPI may be scheduled even when the mask
  91.280 -         * is set. However, note:
  91.281 -         *  1. The task of 'interrupt holdoff' is covered by the per-event-
  91.282 -         *     channel mask bits. A 'noisy' event that is continually being
  91.283 -         *     triggered can be masked at source at this very precise
  91.284 -         *     granularity.
  91.285 -         *  2. The main purpose of the per-VCPU mask is therefore to restrict
  91.286 -         *     reentrant execution: whether for concurrency control, or to
  91.287 -         *     prevent unbounded stack usage. Whatever the purpose, we expect
  91.288 -         *     that the mask will be asserted only for short periods at a time,
  91.289 -         *     and so the likelihood of a 'spurious' IPI is suitably small.
  91.290 -         * The mask is read before making an event upcall to the guest: a
  91.291 -         * non-zero mask therefore guarantees that the VCPU will not receive
  91.292 -         * an upcall activation. The mask is cleared when the VCPU requests
  91.293 -         * to block: this avoids wakeup-waiting races.
  91.294 -         */
  91.295 -        u8 evtchn_upcall_pending;
  91.296 -        u8 evtchn_upcall_mask;
  91.297 -        u8 pad0, pad1;
  91.298 -    } PACKED vcpu_data[MAX_VIRT_CPUS];  /*   0 */
  91.299 -
  91.300 -    /*
  91.301 -     * A domain can have up to 1024 "event channels" on which it can send
  91.302 -     * and receive asynchronous event notifications. There are three classes
  91.303 -     * of event that are delivered by this mechanism:
  91.304 -     *  1. Bi-directional inter- and intra-domain connections. Domains must
  91.305 -     *     arrange out-of-band to set up a connection (usually the setup
  91.306 -     *     is initiated and organised by a privileged third party such as
  91.307 -     *     software running in domain 0).
  91.308 -     *  2. Physical interrupts. A domain with suitable hardware-access
  91.309 -     *     privileges can bind an event-channel port to a physical interrupt
  91.310 -     *     source.
  91.311 -     *  3. Virtual interrupts ('events'). A domain can bind an event-channel
  91.312 -     *     port to a virtual interrupt source, such as the virtual-timer
  91.313 -     *     device or the emergency console.
  91.314 -     * 
  91.315 -     * Event channels are addressed by a "port index" between 0 and 1023.
  91.316 -     * Each channel is associated with two bits of information:
  91.317 -     *  1. PENDING -- notifies the domain that there is a pending notification
  91.318 -     *     to be processed. This bit is cleared by the guest.
  91.319 -     *  2. MASK -- if this bit is clear then a 0->1 transition of PENDING
  91.320 -     *     will cause an asynchronous upcall to be scheduled. This bit is only
  91.321 -     *     updated by the guest. It is read-only within Xen. If a channel
  91.322 -     *     becomes pending while the channel is masked then the 'edge' is lost
  91.323 -     *     (i.e., when the channel is unmasked, the guest must manually handle
  91.324 -     *     pending notifications as no upcall will be scheduled by Xen).
  91.325 -     * 
  91.326 -     * To expedite scanning of pending notifications, any 0->1 pending
  91.327 -     * transition on an unmasked channel causes a corresponding bit in a
  91.328 -     * 32-bit selector to be set. Each bit in the selector covers a 32-bit
  91.329 -     * word in the PENDING bitfield array.
  91.330 -     */
  91.331 -    u32 evtchn_pending[32];             /*   4 */
  91.332 -    u32 evtchn_pending_sel;             /* 132 */
  91.333 -    u32 evtchn_mask[32];                /* 136 */
  91.334 -
  91.335 -    /*
  91.336 -     * Time: The following abstractions are exposed: System Time, Clock Time,
  91.337 -     * Domain Virtual Time. Domains can access Cycle counter time directly.
  91.338 -     */
  91.339 -    u64                cpu_freq;        /* 264: CPU frequency (Hz).          */
  91.340 -
  91.341 -    /*
  91.342 -     * The following values are updated periodically (and not necessarily
  91.343 -     * atomically!). The guest OS detects this because 'time_version1' is
  91.344 -     * incremented just before updating these values, and 'time_version2' is
  91.345 -     * incremented immediately after. See the Xen-specific Linux code for an
  91.346 -     * example of how to read these values safely (arch/xen/kernel/time.c).
  91.347 -     */
  91.348 -    u32                time_version1;   /* 272 */
  91.349 -    u32                time_version2;   /* 276 */
  91.350 -    tsc_timestamp_t    tsc_timestamp;   /* TSC at last update of time vals.  */
  91.351 -    u64                system_time;     /* Time, in nanosecs, since boot.    */
  91.352 -    u32                wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
  91.353 -    u32                wc_usec;         /* Usecs 00:00:00 UTC, Jan 1, 1970.  */
  91.354 -    u64                domain_time;     /* Domain virtual time, in nanosecs. */
  91.355 -
  91.356 -    /*
  91.357 -     * Timeout values:
  91.358 -     * Allow a domain to specify a timeout value in system time and 
  91.359 -     * domain virtual time.
  91.360 -     */
  91.361 -    u64                wall_timeout;    /* 312 */
  91.362 -    u64                domain_timeout;  /* 320 */
  91.363 -
  91.364 -    arch_shared_info_t arch;
  91.365 -
  91.366 -} PACKED shared_info_t;
  91.367 -
  91.368 -/*
  91.369 - * Start-of-day memory layout for the initial domain (DOM0):
  91.370 - *  1. The domain is started within contiguous virtual-memory region.
  91.371 - *  2. The contiguous region begins and ends on an aligned 4MB boundary.
  91.372 - *  3. The region start corresponds to the load address of the OS image.
  91.373 - *     If the load address is not 4MB aligned then the address is rounded down.
  91.374 - *  4. This the order of bootstrap elements in the initial virtual region:
  91.375 - *      a. relocated kernel image
  91.376 - *      b. initial ram disk              [mod_start, mod_len]
  91.377 - *      c. list of allocated page frames [mfn_list, nr_pages]
  91.378 - *      d. bootstrap page tables         [pt_base, CR3 (x86)]
  91.379 - *      e. start_info_t structure        [register ESI (x86)]
  91.380 - *      f. bootstrap stack               [register ESP (x86)]
  91.381 - *  5. Bootstrap elements are packed together, but each is 4kB-aligned.
  91.382 - *  6. The initial ram disk may be omitted.
  91.383 - *  7. The list of page frames forms a contiguous 'pseudo-physical' memory
  91.384 - *     layout for the domain. In particular, the bootstrap virtual-memory
  91.385 - *     region is a 1:1 mapping to the first section of the pseudo-physical map.
  91.386 - *  8. All bootstrap elements are mapped read-writable for the guest OS. The
  91.387 - *     only exception is the bootstrap page table, which is mapped read-only.
  91.388 - *  9. There is guaranteed to be at least 512kB padding after the final
  91.389 - *     bootstrap element. If necessary, the bootstrap virtual region is
  91.390 - *     extended by an extra 4MB to ensure this.
  91.391 - */
  91.392 -
  91.393 -#define MAX_CMDLINE 256
  91.394 -typedef struct {
  91.395 -    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */
  91.396 -    memory_t nr_pages;        /*  0: Total pages allocated to this domain. */
  91.397 -    _MEMORY_PADDING(A);
  91.398 -    memory_t shared_info;     /*  8: MACHINE address of shared info struct.*/
  91.399 -    _MEMORY_PADDING(B);
  91.400 -    u32      flags;           /* 16: SIF_xxx flags.                        */
  91.401 -    u16      domain_controller_evtchn; /* 20 */
  91.402 -    u16      __pad;
  91.403 -    /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).      */
  91.404 -    memory_t pt_base;         /* 24: VIRTUAL address of page directory.    */
  91.405 -    _MEMORY_PADDING(C);
  91.406 -    memory_t nr_pt_frames;    /* 32: Number of bootstrap p.t. frames.      */
  91.407 -    _MEMORY_PADDING(D);
  91.408 -    memory_t mfn_list;        /* 40: VIRTUAL address of page-frame list.   */
  91.409 -    _MEMORY_PADDING(E);
  91.410 -    memory_t mod_start;       /* 48: VIRTUAL address of pre-loaded module. */
  91.411 -    _MEMORY_PADDING(F);
  91.412 -    memory_t mod_len;         /* 56: Size (bytes) of pre-loaded module.    */
  91.413 -    _MEMORY_PADDING(G);
  91.414 -    u8 cmd_line[MAX_CMDLINE]; /* 64 */
  91.415 -} PACKED start_info_t; /* 320 bytes */
  91.416 -
  91.417 -/* These flags are passed in the 'flags' field of start_info_t. */
  91.418 -#define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
  91.419 -#define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
  91.420 -#define SIF_BLK_BE_DOMAIN (1<<4)  /* Is this a block backend domain? */
  91.421 -#define SIF_NET_BE_DOMAIN (1<<5)  /* Is this a net backend domain? */
  91.422 -
  91.423 -/* For use in guest OSes. */
  91.424 -extern shared_info_t *HYPERVISOR_shared_info;
  91.425 -
  91.426 -#endif /* !__ASSEMBLY__ */
  91.427 -
  91.428 -#endif /* __HYPERVISOR_IF_H__ */
    92.1 --- a/xen/include/hypervisor-ifs/io/blkif.h	Mon Nov 01 00:14:22 2004 +0000
    92.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.3 @@ -1,115 +0,0 @@
    92.4 -/******************************************************************************
    92.5 - * blkif.h
    92.6 - * 
    92.7 - * Unified block-device I/O interface for Xen guest OSes.
    92.8 - * 
    92.9 - * Copyright (c) 2003-2004, Keir Fraser
   92.10 - */
   92.11 -
   92.12 -#ifndef __SHARED_BLKIF_H__
   92.13 -#define __SHARED_BLKIF_H__
   92.14 -
   92.15 -#define blkif_vdev_t   u16
   92.16 -#define blkif_sector_t u64
   92.17 -
   92.18 -#define BLKIF_OP_READ      0
   92.19 -#define BLKIF_OP_WRITE     1
   92.20 -#define BLKIF_OP_PROBE     2
   92.21 -
   92.22 -/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <= PAGE_SIZE. */
   92.23 -#define BLKIF_RING_SIZE        64
   92.24 -
   92.25 -/*
   92.26 - * Maximum scatter/gather segments per request.
   92.27 - * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
   92.28 - * NB. This could be 12 if the ring indexes weren't stored in the same page.
   92.29 - */
   92.30 -#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
   92.31 -
   92.32 -typedef struct {
   92.33 -    u8             operation;    /*  0: BLKIF_OP_???                         */
   92.34 -    u8             nr_segments;  /*  1: number of segments                   */
   92.35 -    blkif_vdev_t   device;       /*  2: only for read/write requests         */
   92.36 -    unsigned long  id;           /*  4: private guest value, echoed in resp  */
   92.37 -    blkif_sector_t sector_number;    /* start sector idx on disk (r/w only)  */
   92.38 -    /* @f_a_s[2:0]=last_sect ; @f_a_s[5:3]=first_sect ; @f_a_s[:12]=frame.   */
   92.39 -    /* @first_sect: first sector in frame to transfer (inclusive).           */
   92.40 -    /* @last_sect: last sector in frame to transfer (inclusive).             */
   92.41 -    /* @frame: machine page frame number.                                    */
   92.42 -    unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   92.43 -} PACKED blkif_request_t;
   92.44 -
   92.45 -#define blkif_first_sect(_fas) (((_fas)>>3)&7)
   92.46 -#define blkif_last_sect(_fas)  ((_fas)&7)
   92.47 -
   92.48 -typedef struct {
   92.49 -    unsigned long   id;              /* copied from request */
   92.50 -    u8              operation;       /* copied from request */
   92.51 -    s16             status;          /* BLKIF_RSP_???       */
   92.52 -} PACKED blkif_response_t;
   92.53 -
   92.54 -#define BLKIF_RSP_ERROR  -1 /* non-specific 'error' */
   92.55 -#define BLKIF_RSP_OKAY    0 /* non-specific 'okay'  */
   92.56 -
   92.57 -/*
   92.58 - * We use a special capitalised type name because it is _essential_ that all 
   92.59 - * arithmetic on indexes is done on an integer type of the correct size.
   92.60 - */
   92.61 -typedef u32 BLKIF_RING_IDX;
   92.62 -
   92.63 -/*
   92.64 - * Ring indexes are 'free running'. That is, they are not stored modulo the
   92.65 - * size of the ring buffer. The following macro converts a free-running counter
   92.66 - * into a value that can directly index a ring-buffer array.
   92.67 - */
   92.68 -#define MASK_BLKIF_IDX(_i) ((_i)&(BLKIF_RING_SIZE-1))
   92.69 -
   92.70 -typedef struct {
   92.71 -    BLKIF_RING_IDX req_prod;  /*  0: Request producer. Updated by front-end. */
   92.72 -    BLKIF_RING_IDX resp_prod; /*  4: Response producer. Updated by back-end. */
   92.73 -    union {                   /*  8 */
   92.74 -        blkif_request_t  req;
   92.75 -        blkif_response_t resp;
   92.76 -    } PACKED ring[BLKIF_RING_SIZE];
   92.77 -} PACKED blkif_ring_t;
   92.78 -
   92.79 -
   92.80 -/*
   92.81 - * BLKIF_OP_PROBE:
   92.82 - * The request format for a probe request is constrained as follows:
   92.83 - *  @operation   == BLKIF_OP_PROBE
   92.84 - *  @nr_segments == size of probe buffer in pages
   92.85 - *  @device      == unused (zero)
   92.86 - *  @id          == any value (echoed in response message)
   92.87 - *  @sector_num  == unused (zero)
   92.88 - *  @frame_and_sects == list of page-sized buffers.
   92.89 - *                       (i.e., @first_sect == 0, @last_sect == 7).
   92.90 - * 
   92.91 - * The response is a list of vdisk_t elements copied into the out-of-band
   92.92 - * probe buffer. On success the response status field contains the number
   92.93 - * of vdisk_t elements.
   92.94 - */
   92.95 -
   92.96 -/* XXX SMH: Type values below are chosen to match ide_xxx in Linux ide.h. */
   92.97 -#define VDISK_TYPE_FLOPPY  0x00
   92.98 -#define VDISK_TYPE_TAPE    0x01
   92.99 -#define VDISK_TYPE_CDROM   0x05
  92.100 -#define VDISK_TYPE_OPTICAL 0x07
  92.101 -#define VDISK_TYPE_DISK    0x20 
  92.102 -
  92.103 -#define VDISK_TYPE_MASK    0x3F
  92.104 -#define VDISK_TYPE(_x)     ((_x) & VDISK_TYPE_MASK) 
  92.105 -
  92.106 -/* The top two bits of the type field encode various flags. */
  92.107 -#define VDISK_FLAG_RO      0x40
  92.108 -#define VDISK_FLAG_VIRT    0x80
  92.109 -#define VDISK_READONLY(_x) ((_x) & VDISK_FLAG_RO)
  92.110 -#define VDISK_VIRTUAL(_x)  ((_x) & VDISK_FLAG_VIRT) 
  92.111 -
  92.112 -typedef struct {
  92.113 -    blkif_sector_t capacity;     /*  0: Size in terms of 512-byte sectors.   */
  92.114 -    blkif_vdev_t   device;       /*  8: Device number (opaque 16 bit value). */
  92.115 -    u16            info;         /* 10: Device type and flags (VDISK_*).     */
  92.116 -} PACKED vdisk_t; /* 12 bytes */
  92.117 -
  92.118 -#endif /* __SHARED_BLKIF_H__ */
    93.1 --- a/xen/include/hypervisor-ifs/io/domain_controller.h	Mon Nov 01 00:14:22 2004 +0000
    93.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.3 @@ -1,578 +0,0 @@
    93.4 -/******************************************************************************
    93.5 - * domain_controller.h
    93.6 - * 
    93.7 - * Interface to server controller (e.g., 'xend'). This header file defines the 
    93.8 - * interface that is shared with guest OSes.
    93.9 - * 
   93.10 - * Copyright (c) 2004, K A Fraser
   93.11 - */
   93.12 -
   93.13 -#ifndef __DOMAIN_CONTROLLER_H__
   93.14 -#define __DOMAIN_CONTROLLER_H__
   93.15 -
   93.16 -
   93.17 -/*
   93.18 - * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
   93.19 - * interpreted by control software to determine the appropriate action. These 
   93.20 - * are only really advisories: the controller can actually do as it likes.
   93.21 - */
   93.22 -#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
   93.23 -#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
   93.24 -#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
   93.25 -
   93.26 -
   93.27 -/*
   93.28 - * CONTROLLER MESSAGING INTERFACE.
   93.29 - */
   93.30 -
   93.31 -typedef struct {
   93.32 -    u8 type;     /*  0: echoed in response */
   93.33 -    u8 subtype;  /*  1: echoed in response */
   93.34 -    u8 id;       /*  2: echoed in response */
   93.35 -    u8 length;   /*  3: number of bytes in 'msg' */
   93.36 -    u8 msg[60];  /*  4: type-specific message data */
   93.37 -} PACKED control_msg_t; /* 64 bytes */
   93.38 -
   93.39 -#define CONTROL_RING_SIZE 8
   93.40 -typedef u32 CONTROL_RING_IDX;
   93.41 -#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
   93.42 -
   93.43 -typedef struct {
   93.44 -    control_msg_t tx_ring[CONTROL_RING_SIZE];   /*    0: guest -> controller */
   93.45 -    control_msg_t rx_ring[CONTROL_RING_SIZE];   /*  512: controller -> guest */
   93.46 -    CONTROL_RING_IDX tx_req_prod, tx_resp_prod; /* 1024, 1028 */
   93.47 -    CONTROL_RING_IDX rx_req_prod, rx_resp_prod; /* 1032, 1036 */
   93.48 -} PACKED control_if_t; /* 1040 bytes */
   93.49 -
   93.50 -/*
   93.51 - * Top-level command types.
   93.52 - */
   93.53 -#define CMSG_CONSOLE        0  /* Console                 */
   93.54 -#define CMSG_BLKIF_BE       1  /* Block-device backend    */
   93.55 -#define CMSG_BLKIF_FE       2  /* Block-device frontend   */
   93.56 -#define CMSG_NETIF_BE       3  /* Network-device backend  */
   93.57 -#define CMSG_NETIF_FE       4  /* Network-device frontend */
   93.58 -#define CMSG_SHUTDOWN       6  /* Shutdown messages       */
   93.59 -#define CMSG_MEM_REQUEST    7  /* Memory reservation reqs */
   93.60 -
   93.61 -
   93.62 -/******************************************************************************
   93.63 - * CONSOLE DEFINITIONS
   93.64 - */
   93.65 -
   93.66 -/*
   93.67 - * Subtypes for console messages.
   93.68 - */
   93.69 -#define CMSG_CONSOLE_DATA       0
   93.70 -
   93.71 -
   93.72 -/******************************************************************************
   93.73 - * BLOCK-INTERFACE FRONTEND DEFINITIONS
   93.74 - */
   93.75 -
   93.76 -/* Messages from domain controller to guest. */
   93.77 -#define CMSG_BLKIF_FE_INTERFACE_STATUS           0
   93.78 -
   93.79 -/* Messages from guest to domain controller. */
   93.80 -#define CMSG_BLKIF_FE_DRIVER_STATUS             32
   93.81 -#define CMSG_BLKIF_FE_INTERFACE_CONNECT         33
   93.82 -#define CMSG_BLKIF_FE_INTERFACE_DISCONNECT      34
   93.83 -#define CMSG_BLKIF_FE_INTERFACE_QUERY           35
   93.84 -
   93.85 -/* These are used by both front-end and back-end drivers. */
   93.86 -#define blkif_vdev_t   u16
   93.87 -#define blkif_pdev_t   u16
   93.88 -#define blkif_sector_t u64
   93.89 -
   93.90 -/*
   93.91 - * CMSG_BLKIF_FE_INTERFACE_STATUS:
   93.92 - *  Notify a guest about a status change on one of its block interfaces.
   93.93 - *  If the interface is DESTROYED or DOWN then the interface is disconnected:
   93.94 - *   1. The shared-memory frame is available for reuse.
   93.95 - *   2. Any unacknowledged messages pending on the interface were dropped.
   93.96 - */
   93.97 -#define BLKIF_INTERFACE_STATUS_CLOSED       0 /* Interface doesn't exist.    */
   93.98 -#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
   93.99 -#define BLKIF_INTERFACE_STATUS_CONNECTED    2 /* Exists and is connected.    */
  93.100 -#define BLKIF_INTERFACE_STATUS_CHANGED      3 /* A device has been added or removed. */
  93.101 -typedef struct {
  93.102 -    u32 handle; /*  0 */
  93.103 -    u32 status; /*  4 */
  93.104 -    u16 evtchn; /*  8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
  93.105 -    domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
  93.106 -} PACKED blkif_fe_interface_status_t; /* 12 bytes */
  93.107 -
  93.108 -/*
  93.109 - * CMSG_BLKIF_FE_DRIVER_STATUS:
  93.110 - *  Notify the domain controller that the front-end driver is DOWN or UP.
  93.111 - *  When the driver goes DOWN then the controller will send no more
  93.112 - *  status-change notifications.
  93.113 - *  If the driver goes DOWN while interfaces are still UP, the domain
  93.114 - *  will automatically take the interfaces DOWN.
  93.115 - * 
  93.116 - *  NB. The controller should not send an INTERFACE_STATUS_CHANGED message
  93.117 - *  for interfaces that are active when it receives an UP notification. We
  93.118 - *  expect that the frontend driver will query those interfaces itself.
  93.119 - */
  93.120 -#define BLKIF_DRIVER_STATUS_DOWN   0
  93.121 -#define BLKIF_DRIVER_STATUS_UP     1
  93.122 -typedef struct {
  93.123 -    /* IN */
  93.124 -    u32 status;        /*  0: BLKIF_DRIVER_STATUS_??? */
  93.125 -    /* OUT */
  93.126 -    /* Driver should query interfaces [0..max_handle]. */
  93.127 -    u32 max_handle;    /*  4 */
  93.128 -} PACKED blkif_fe_driver_status_t; /* 8 bytes */
  93.129 -
  93.130 -/*
  93.131 - * CMSG_BLKIF_FE_INTERFACE_CONNECT:
  93.132 - *  If successful, the domain controller will acknowledge with a
  93.133 - *  STATUS_CONNECTED message.
  93.134 - */
  93.135 -typedef struct {
  93.136 -    u32      handle;      /*  0 */
  93.137 -    u32      __pad;
  93.138 -    memory_t shmem_frame; /*  8 */
  93.139 -    MEMORY_PADDING;
  93.140 -} PACKED blkif_fe_interface_connect_t; /* 16 bytes */
  93.141 -
  93.142 -/*
  93.143 - * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
  93.144 - *  If successful, the domain controller will acknowledge with a
  93.145 - *  STATUS_DISCONNECTED message.
  93.146 - */
  93.147 -typedef struct {
  93.148 -    u32 handle; /*  0 */
  93.149 -} PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
  93.150 -
  93.151 -/*
  93.152 - * CMSG_BLKIF_FE_INTERFACE_QUERY:
  93.153 - */
  93.154 -typedef struct {
  93.155 -    /* IN */
  93.156 -    u32 handle; /*  0 */
  93.157 -    /* OUT */
  93.158 -    u32 status; /*  4 */
  93.159 -    u16 evtchn; /*  8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
  93.160 -    domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
  93.161 -} PACKED blkif_fe_interface_query_t; /* 12 bytes */
  93.162 -
  93.163 -
  93.164 -/******************************************************************************
  93.165 - * BLOCK-INTERFACE BACKEND DEFINITIONS
  93.166 - */
  93.167 -
  93.168 -/* Messages from domain controller. */
  93.169 -#define CMSG_BLKIF_BE_CREATE      0  /* Create a new block-device interface. */
  93.170 -#define CMSG_BLKIF_BE_DESTROY     1  /* Destroy a block-device interface.    */
  93.171 -#define CMSG_BLKIF_BE_CONNECT     2  /* Connect i/f to remote driver.        */
  93.172 -#define CMSG_BLKIF_BE_DISCONNECT  3  /* Disconnect i/f from remote driver.   */
  93.173 -#define CMSG_BLKIF_BE_VBD_CREATE  4  /* Create a new VBD for an interface.   */
  93.174 -#define CMSG_BLKIF_BE_VBD_DESTROY 5  /* Delete a VBD from an interface.      */
  93.175 -#define CMSG_BLKIF_BE_VBD_GROW    6  /* Append an extent to a given VBD.     */
  93.176 -#define CMSG_BLKIF_BE_VBD_SHRINK  7  /* Remove last extent from a given VBD. */
  93.177 -
  93.178 -/* Messages to domain controller. */
  93.179 -#define CMSG_BLKIF_BE_DRIVER_STATUS 32
  93.180 -
  93.181 -/*
  93.182 - * Message request/response definitions for block-device messages.
  93.183 - */
  93.184 -
  93.185 -typedef struct {
  93.186 -    blkif_sector_t sector_start;   /*  0 */
  93.187 -    blkif_sector_t sector_length;  /*  8 */
  93.188 -    blkif_pdev_t   device;         /* 16 */
  93.189 -    u16            __pad;          /* 18 */
  93.190 -} PACKED blkif_extent_t; /* 20 bytes */
  93.191 -
  93.192 -/* Non-specific 'okay' return. */
  93.193 -#define BLKIF_BE_STATUS_OKAY                0
  93.194 -/* Non-specific 'error' return. */
  93.195 -#define BLKIF_BE_STATUS_ERROR               1
  93.196 -/* The following are specific error returns. */
  93.197 -#define BLKIF_BE_STATUS_INTERFACE_EXISTS    2
  93.198 -#define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
  93.199 -#define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
  93.200 -#define BLKIF_BE_STATUS_VBD_EXISTS          5
  93.201 -#define BLKIF_BE_STATUS_VBD_NOT_FOUND       6
  93.202 -#define BLKIF_BE_STATUS_OUT_OF_MEMORY       7
  93.203 -#define BLKIF_BE_STATUS_EXTENT_NOT_FOUND    8
  93.204 -#define BLKIF_BE_STATUS_MAPPING_ERROR       9
  93.205 -
  93.206 -/* This macro can be used to create an array of descriptive error strings. */
  93.207 -#define BLKIF_BE_STATUS_ERRORS {    \
  93.208 -    "Okay",                         \
  93.209 -    "Non-specific error",           \
  93.210 -    "Interface already exists",     \
  93.211 -    "Interface not found",          \
  93.212 -    "Interface is still connected", \
  93.213 -    "VBD already exists",           \
  93.214 -    "VBD not found",                \
  93.215 -    "Out of memory",                \
  93.216 -    "Extent not found for VBD",     \
  93.217 -    "Could not map domain memory" }
  93.218 -
  93.219 -/*
  93.220 - * CMSG_BLKIF_BE_CREATE:
  93.221 - *  When the driver sends a successful response then the interface is fully
  93.222 - *  created. The controller will send a DOWN notification to the front-end
  93.223 - *  driver.
  93.224 - */
  93.225 -typedef struct { 
  93.226 -    /* IN */
  93.227 -    domid_t    domid;         /*  0: Domain attached to new interface.   */
  93.228 -    u16        __pad;
  93.229 -    u32        blkif_handle;  /*  4: Domain-specific interface handle.   */
  93.230 -    /* OUT */
  93.231 -    u32        status;        /*  8 */
  93.232 -} PACKED blkif_be_create_t; /* 12 bytes */
  93.233 -
  93.234 -/*
  93.235 - * CMSG_BLKIF_BE_DESTROY:
  93.236 - *  When the driver sends a successful response then the interface is fully
  93.237 - *  torn down. The controller will send a DESTROYED notification to the
  93.238 - *  front-end driver.
  93.239 - */
  93.240 -typedef struct { 
  93.241 -    /* IN */
  93.242 -    domid_t    domid;         /*  0: Identify interface to be destroyed. */
  93.243 -    u16        __pad;
  93.244 -    u32        blkif_handle;  /*  4: ...ditto...                         */
  93.245 -    /* OUT */
  93.246 -    u32        status;        /*  8 */
  93.247 -} PACKED blkif_be_destroy_t; /* 12 bytes */
  93.248 -
  93.249 -/*
  93.250 - * CMSG_BLKIF_BE_CONNECT:
  93.251 - *  When the driver sends a successful response then the interface is fully
  93.252 - *  connected. The controller will send a CONNECTED notification to the
  93.253 - *  front-end driver.
  93.254 - */
  93.255 -typedef struct { 
  93.256 -    /* IN */
  93.257 -    domid_t    domid;         /*  0: Domain attached to new interface.   */
  93.258 -    u16        __pad;
  93.259 -    u32        blkif_handle;  /*  4: Domain-specific interface handle.   */
  93.260 -    memory_t   shmem_frame;   /*  8: Page cont. shared comms window.     */
  93.261 -    MEMORY_PADDING;
  93.262 -    u32        evtchn;        /* 16: Event channel for notifications.    */
  93.263 -    /* OUT */
  93.264 -    u32        status;        /* 20 */
  93.265 -} PACKED blkif_be_connect_t;  /* 24 bytes */
  93.266 -
  93.267 -/*
  93.268 - * CMSG_BLKIF_BE_DISCONNECT:
  93.269 - *  When the driver sends a successful response then the interface is fully
  93.270 - *  disconnected. The controller will send a DOWN notification to the front-end
  93.271 - *  driver.
  93.272 - */
  93.273 -typedef struct { 
  93.274 -    /* IN */
  93.275 -    domid_t    domid;         /*  0: Domain attached to new interface.   */
  93.276 -    u16        __pad;
  93.277 -    u32        blkif_handle;  /*  4: Domain-specific interface handle.   */
  93.278 -    /* OUT */
  93.279 -    u32        status;        /*  8 */
  93.280 -} PACKED blkif_be_disconnect_t; /* 12 bytes */
  93.281 -
  93.282 -/* CMSG_BLKIF_BE_VBD_CREATE */
  93.283 -typedef struct { 
  93.284 -    /* IN */
  93.285 -    domid_t    domid;         /*  0: Identify blkdev interface.          */
  93.286 -    u16        __pad;
  93.287 -    u32        blkif_handle;  /*  4: ...ditto...                         */
  93.288 -    blkif_vdev_t vdevice;     /*  8: Interface-specific id for this VBD. */
  93.289 -    u16        readonly;      /* 10: Non-zero -> VBD isn't writable.     */
  93.290 -    /* OUT */
  93.291 -    u32        status;        /* 12 */
  93.292 -} PACKED blkif_be_vbd_create_t; /* 16 bytes */
  93.293 -
  93.294 -/* CMSG_BLKIF_BE_VBD_DESTROY */
  93.295 -typedef struct {
  93.296 -    /* IN */
  93.297 -    domid_t    domid;         /*  0: Identify blkdev interface.          */
  93.298 -    u16        __pad0;        /*  2 */
  93.299 -    u32        blkif_handle;  /*  4: ...ditto...                         */
  93.300 -    blkif_vdev_t vdevice;     /*  8: Interface-specific id of the VBD.   */
  93.301 -    u16        __pad1;        /* 10 */
  93.302 -    /* OUT */
  93.303 -    u32        status;        /* 12 */
  93.304 -} PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
  93.305 -
  93.306 -/* CMSG_BLKIF_BE_VBD_GROW */
  93.307 -typedef struct { 
  93.308 -    /* IN */
  93.309 -    domid_t    domid;         /*  0: Identify blkdev interface.          */
  93.310 -    u16        __pad0;        /*  2 */
  93.311 -    u32        blkif_handle;  /*  4: ...ditto...                         */
  93.312 -    blkif_extent_t extent;    /*  8: Physical extent to append to VBD.   */
  93.313 -    blkif_vdev_t vdevice;     /* 28: Interface-specific id of the VBD.   */
  93.314 -    u16        __pad1;        /* 30 */
  93.315 -    /* OUT */
  93.316 -    u32        status;        /* 32 */
  93.317 -} PACKED blkif_be_vbd_grow_t; /* 36 bytes */
  93.318 -
  93.319 -/* CMSG_BLKIF_BE_VBD_SHRINK */
  93.320 -typedef struct { 
  93.321 -    /* IN */
  93.322 -    domid_t    domid;         /*  0: Identify blkdev interface.          */
  93.323 -    u16        __pad0;        /*  2 */
  93.324 -    u32        blkif_handle;  /*  4: ...ditto...                         */
  93.325 -    blkif_vdev_t vdevice;     /*  8: Interface-specific id of the VBD.   */
  93.326 -    u16        __pad1;        /* 10 */
  93.327 -    /* OUT */
  93.328 -    u32        status;        /* 12 */
  93.329 -} PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
  93.330 -
  93.331 -/*
  93.332 - * CMSG_BLKIF_BE_DRIVER_STATUS:
  93.333 - *  Notify the domain controller that the back-end driver is DOWN or UP.
  93.334 - *  If the driver goes DOWN while interfaces are still UP, the controller
  93.335 - *  will automatically send DOWN notifications.
  93.336 - */
  93.337 -typedef struct {
  93.338 -    u32        status;        /*  0: BLKIF_DRIVER_STATUS_??? */
  93.339 -} PACKED blkif_be_driver_status_t; /* 4 bytes */
  93.340 -
  93.341 -
  93.342 -/******************************************************************************
  93.343 - * NETWORK-INTERFACE FRONTEND DEFINITIONS
  93.344 - */
  93.345 -
  93.346 -/* Messages from domain controller to guest. */
  93.347 -#define CMSG_NETIF_FE_INTERFACE_STATUS   0
  93.348 -
  93.349 -/* Messages from guest to domain controller. */
  93.350 -#define CMSG_NETIF_FE_DRIVER_STATUS             32
  93.351 -#define CMSG_NETIF_FE_INTERFACE_CONNECT         33
  93.352 -#define CMSG_NETIF_FE_INTERFACE_DISCONNECT      34
  93.353 -#define CMSG_NETIF_FE_INTERFACE_QUERY           35
  93.354 -
  93.355 -/*
  93.356 - * CMSG_NETIF_FE_INTERFACE_STATUS:
  93.357 - *  Notify a guest about a status change on one of its network interfaces.
  93.358 - *  If the interface is CLOSED or DOWN then the interface is disconnected:
  93.359 - *   1. The shared-memory frame is available for reuse.
  93.360 - *   2. Any unacknowledged messgaes pending on the interface were dropped.
  93.361 - */
  93.362 -#define NETIF_INTERFACE_STATUS_CLOSED       0 /* Interface doesn't exist.    */
  93.363 -#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
  93.364 -#define NETIF_INTERFACE_STATUS_CONNECTED    2 /* Exists and is connected.    */
  93.365 -#define NETIF_INTERFACE_STATUS_CHANGED      3 /* A device has been added or removed. */
  93.366 -typedef struct {
  93.367 -    u32        handle; /*  0 */
  93.368 -    u32        status; /*  4 */
  93.369 -    u16        evtchn; /*  8: status == NETIF_INTERFACE_STATUS_CONNECTED */
  93.370 -    u8         mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
  93.371 -    domid_t    domid;  /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
  93.372 -} PACKED netif_fe_interface_status_t; /* 18 bytes */
  93.373 -
  93.374 -/*
  93.375 - * CMSG_NETIF_FE_DRIVER_STATUS:
  93.376 - *  Notify the domain controller that the front-end driver is DOWN or UP.
  93.377 - *  When the driver goes DOWN then the controller will send no more
  93.378 - *  status-change notifications.
  93.379 - *  If the driver goes DOWN while interfaces are still UP, the domain
  93.380 - *  will automatically take the interfaces DOWN.
  93.381 - * 
  93.382 - *  NB. The controller should not send an INTERFACE_STATUS message
  93.383 - *  for interfaces that are active when it receives an UP notification. We
  93.384 - *  expect that the frontend driver will query those interfaces itself.
  93.385 - */
  93.386 -#define NETIF_DRIVER_STATUS_DOWN   0
  93.387 -#define NETIF_DRIVER_STATUS_UP     1
  93.388 -typedef struct {
  93.389 -    /* IN */
  93.390 -    u32        status;        /*  0: NETIF_DRIVER_STATUS_??? */
  93.391 -    /* OUT */
  93.392 -    /* Driver should query interfaces [0..max_handle]. */
  93.393 -    u32        max_handle;    /*  4 */
  93.394 -} PACKED netif_fe_driver_status_t; /* 8 bytes */
  93.395 -
  93.396 -/*
  93.397 - * CMSG_NETIF_FE_INTERFACE_CONNECT:
  93.398 - *  If successful, the domain controller will acknowledge with a
  93.399 - *  STATUS_CONNECTED message.
  93.400 - */
  93.401 -typedef struct {
  93.402 -    u32        handle;         /*  0 */
  93.403 -    u32        __pad;          /*  4 */
  93.404 -    memory_t   tx_shmem_frame; /*  8 */
  93.405 -    MEMORY_PADDING;
  93.406 -    memory_t   rx_shmem_frame; /* 16 */
  93.407 -    MEMORY_PADDING;
  93.408 -} PACKED netif_fe_interface_connect_t; /* 24 bytes */
  93.409 -
  93.410 -/*
  93.411 - * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
  93.412 - *  If successful, the domain controller will acknowledge with a
  93.413 - *  STATUS_DISCONNECTED message.
  93.414 - */
  93.415 -typedef struct {
  93.416 -    u32        handle;        /*  0 */
  93.417 -} PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
  93.418 -
  93.419 -/*
  93.420 - * CMSG_NETIF_FE_INTERFACE_QUERY:
  93.421 - */
  93.422 -typedef struct {
  93.423 -    /* IN */
  93.424 -    u32        handle; /*  0 */
  93.425 -    /* OUT */
  93.426 -    u32        status; /*  4 */
  93.427 -    u16        evtchn; /*  8: status == NETIF_INTERFACE_STATUS_CONNECTED */
  93.428 -    u8         mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
  93.429 -    domid_t    domid;  /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
  93.430 -} PACKED netif_fe_interface_query_t; /* 18 bytes */
  93.431 -
  93.432 -
  93.433 -/******************************************************************************
  93.434 - * NETWORK-INTERFACE BACKEND DEFINITIONS
  93.435 - */
  93.436 -
  93.437 -/* Messages from domain controller. */
  93.438 -#define CMSG_NETIF_BE_CREATE      0  /* Create a new net-device interface. */
  93.439 -#define CMSG_NETIF_BE_DESTROY     1  /* Destroy a net-device interface.    */
  93.440 -#define CMSG_NETIF_BE_CONNECT     2  /* Connect i/f to remote driver.        */
  93.441 -#define CMSG_NETIF_BE_DISCONNECT  3  /* Disconnect i/f from remote driver.   */
  93.442 -
  93.443 -/* Messages to domain controller. */
  93.444 -#define CMSG_NETIF_BE_DRIVER_STATUS 32
  93.445 -
  93.446 -/*
  93.447 - * Message request/response definitions for net-device messages.
  93.448 - */
  93.449 -
  93.450 -/* Non-specific 'okay' return. */
  93.451 -#define NETIF_BE_STATUS_OKAY                0
  93.452 -/* Non-specific 'error' return. */
  93.453 -#define NETIF_BE_STATUS_ERROR               1
  93.454 -/* The following are specific error returns. */
  93.455 -#define NETIF_BE_STATUS_INTERFACE_EXISTS    2
  93.456 -#define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
  93.457 -#define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
  93.458 -#define NETIF_BE_STATUS_OUT_OF_MEMORY       5
  93.459 -#define NETIF_BE_STATUS_MAPPING_ERROR       6
  93.460 -
  93.461 -/* This macro can be used to create an array of descriptive error strings. */
  93.462 -#define NETIF_BE_STATUS_ERRORS {    \
  93.463 -    "Okay",                         \
  93.464 -    "Non-specific error",           \
  93.465 -    "Interface already exists",     \
  93.466 -    "Interface not found",          \
  93.467 -    "Interface is still connected", \
  93.468 -    "Out of memory",                \
  93.469 -    "Could not map domain memory" }
  93.470 -
  93.471 -/*
  93.472 - * CMSG_NETIF_BE_CREATE:
  93.473 - *  When the driver sends a successful response then the interface is fully
  93.474 - *  created. The controller will send a DOWN notification to the front-end
  93.475 - *  driver.
  93.476 - */
  93.477 -typedef struct { 
  93.478 -    /* IN */
  93.479 -    domid_t    domid;         /*  0: Domain attached to new interface.   */
  93.480 -    u16        __pad0;        /*  2 */
  93.481 -    u32        netif_handle;  /*  4: Domain-specific interface handle.   */
  93.482 -    u8         mac[6];        /*  8 */
  93.483 -    u16        __pad1;        /* 14 */
  93.484 -    /* OUT */
  93.485 -    u32        status;        /* 16 */
  93.486 -} PACKED netif_be_create_t; /* 20 bytes */
  93.487 -
  93.488 -/*
  93.489 - * CMSG_NETIF_BE_DESTROY:
  93.490 - *  When the driver sends a successful response then the interface is fully
  93.491 - *  torn down. The controller will send a DESTROYED notification to the
  93.492 - *  front-end driver.
  93.493 - */
  93.494 -typedef struct { 
  93.495 -    /* IN */
  93.496 -    domid_t    domid;         /*  0: Identify interface to be destroyed. */
  93.497 -    u16        __pad;
  93.498 -    u32        netif_handle;  /*  4: ...ditto...                         */
  93.499 -    /* OUT */
  93.500 -    u32   status;             /*  8 */
  93.501 -} PACKED netif_be_destroy_t; /* 12 bytes */
  93.502 -
  93.503 -/*
  93.504 - * CMSG_NETIF_BE_CONNECT:
  93.505 - *  When the driver sends a successful response then the interface is fully
  93.506 - *  connected. The controller will send a CONNECTED notification to the
  93.507 - *  front-end driver.
  93.508 - */
  93.509 -typedef struct { 
  93.510 -    /* IN */
  93.511 -    domid_t    domid;          /*  0: Domain attached to new interface.   */
  93.512 -    u16        __pad0;         /*  2 */
  93.513 -    u32        netif_handle;   /*  4: Domain-specific interface handle.   */
  93.514 -    memory_t   tx_shmem_frame; /*  8: Page cont. tx shared comms window.  */
  93.515 -    MEMORY_PADDING;
  93.516 -    memory_t   rx_shmem_frame; /* 16: Page cont. rx shared comms window.  */
  93.517 -    MEMORY_PADDING;
  93.518 -    u16        evtchn;         /* 24: Event channel for notifications.    */
  93.519 -    u16        __pad1;         /* 26 */
  93.520 -    /* OUT */
  93.521 -    u32        status;         /* 28 */
  93.522 -} PACKED netif_be_connect_t; /* 32 bytes */
  93.523 -
  93.524 -/*
  93.525 - * CMSG_NETIF_BE_DISCONNECT:
  93.526 - *  When the driver sends a successful response then the interface is fully
  93.527 - *  disconnected. The controller will send a DOWN notification to the front-end
  93.528 - *  driver.
  93.529 - */
  93.530 -typedef struct { 
  93.531 -    /* IN */
  93.532 -    domid_t    domid;         /*  0: Domain attached to new interface.   */
  93.533 -    u16        __pad;
  93.534 -    u32        netif_handle;  /*  4: Domain-specific interface handle.   */
  93.535 -    /* OUT */
  93.536 -    u32        status;        /*  8 */
  93.537 -} PACKED netif_be_disconnect_t; /* 12 bytes */
  93.538 -
  93.539 -/*
  93.540 - * CMSG_NETIF_BE_DRIVER_STATUS:
  93.541 - *  Notify the domain controller that the back-end driver is DOWN or UP.
  93.542 - *  If the driver goes DOWN while interfaces are still UP, the domain
  93.543 - *  will automatically send DOWN notifications.
  93.544 - */
  93.545 -typedef struct {
  93.546 -    u32        status;        /*  0: NETIF_DRIVER_STATUS_??? */
  93.547 -} PACKED netif_be_driver_status_t; /* 4 bytes */
  93.548 -
  93.549 -
  93.550 -/******************************************************************************
  93.551 - * SHUTDOWN DEFINITIONS
  93.552 - */
  93.553 -
  93.554 -/*
  93.555 - * Subtypes for shutdown messages.
  93.556 - */
  93.557 -#define CMSG_SHUTDOWN_POWEROFF  0   /* Clean shutdown (SHUTDOWN_poweroff).   */
  93.558 -#define CMSG_SHUTDOWN_REBOOT    1   /* Clean shutdown (SHUTDOWN_reboot).     */
  93.559 -#define CMSG_SHUTDOWN_SUSPEND   2   /* Create suspend info, then             */
  93.560 -                                    /* SHUTDOWN_suspend.                     */
  93.561 -
  93.562 -
  93.563 -/******************************************************************************
  93.564 - * MEMORY CONTROLS
  93.565 - */
  93.566 -
  93.567 -#define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
  93.568 -
  93.569 -/*
  93.570 - * CMSG_MEM_REQUEST:
  93.571 - *  Request that the domain change its memory reservation.
  93.572 - */
  93.573 -typedef struct {
  93.574 -    /* OUT */
  93.575 -    u32 target;       /* 0: Target memory reservation in pages.       */
  93.576 -    /* IN  */
  93.577 -    u32 status;       /* 4: Return code indicates success or failure. */
  93.578 -} PACKED mem_request_t; /* 8 bytes */
  93.579 -
  93.580 -
  93.581 -#endif /* __DOMAIN_CONTROLLER_H__ */
    94.1 --- a/xen/include/hypervisor-ifs/io/netif.h	Mon Nov 01 00:14:22 2004 +0000
    94.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.3 @@ -1,92 +0,0 @@
    94.4 -/******************************************************************************
    94.5 - * netif.h
    94.6 - * 
    94.7 - * Unified network-device I/O interface for Xen guest OSes.
    94.8 - * 
    94.9 - * Copyright (c) 2003-2004, Keir Fraser
   94.10 - */
   94.11 -
   94.12 -#ifndef __SHARED_NETIF_H__
   94.13 -#define __SHARED_NETIF_H__
   94.14 -
   94.15 -typedef struct {
   94.16 -    memory_t addr;   /*  0: Machine address of packet.  */
   94.17 -    MEMORY_PADDING;
   94.18 -    u16      id;     /*  8: Echoed in response message. */
   94.19 -    u16      size;   /* 10: Packet size in bytes.       */
   94.20 -} PACKED netif_tx_request_t; /* 12 bytes */
   94.21 -
   94.22 -typedef struct {
   94.23 -    u16      id;     /*  0 */
   94.24 -    s8       status; /*  2 */
   94.25 -    u8       __pad;  /*  3 */
   94.26 -} PACKED netif_tx_response_t; /* 4 bytes */
   94.27 -
   94.28 -typedef struct {
   94.29 -    u16       id;    /*  0: Echoed in response message.        */
   94.30 -} PACKED netif_rx_request_t; /* 2 bytes */
   94.31 -
   94.32 -typedef struct {
   94.33 -    memory_t addr;   /*  0: Machine address of packet.              */
   94.34 -    MEMORY_PADDING;
   94.35 -    u16      id;     /*  8:  */
   94.36 -    s16      status; /* 10: -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
   94.37 -} PACKED netif_rx_response_t; /* 12 bytes */
   94.38 -
   94.39 -/*
   94.40 - * We use a special capitalised type name because it is _essential_ that all 
   94.41 - * arithmetic on indexes is done on an integer type of the correct size.
   94.42 - */
   94.43 -typedef u32 NETIF_RING_IDX;
   94.44 -
   94.45 -/*
   94.46 - * Ring indexes are 'free running'. That is, they are not stored modulo the
   94.47 - * size of the ring buffer. The following macros convert a free-running counter
   94.48 - * into a value that can directly index a ring-buffer array.
   94.49 - */
   94.50 -#define MASK_NETIF_RX_IDX(_i) ((_i)&(NETIF_RX_RING_SIZE-1))
   94.51 -#define MASK_NETIF_TX_IDX(_i) ((_i)&(NETIF_TX_RING_SIZE-1))
   94.52 -
   94.53 -#define NETIF_TX_RING_SIZE 256
   94.54 -#define NETIF_RX_RING_SIZE 256
   94.55 -
   94.56 -/* This structure must fit in a memory page. */
   94.57 -typedef struct {
   94.58 -    /*
   94.59 -     * Frontend places packets into ring at tx_req_prod.
   94.60 -     * Frontend receives event when tx_resp_prod passes tx_event.
   94.61 -     * 'req_cons' is a shadow of the backend's request consumer -- the frontend
   94.62 -     * may use it to determine if all queued packets have been seen by the
   94.63 -     * backend.
   94.64 -     */
   94.65 -    NETIF_RING_IDX req_prod;       /*  0 */
   94.66 -    NETIF_RING_IDX req_cons;       /*  4 */
   94.67 -    NETIF_RING_IDX resp_prod;      /*  8 */
   94.68 -    NETIF_RING_IDX event;          /* 12 */
   94.69 -    union {                        /* 16 */
   94.70 -        netif_tx_request_t  req;
   94.71 -        netif_tx_response_t resp;
   94.72 -    } PACKED ring[NETIF_TX_RING_SIZE];
   94.73 -} PACKED netif_tx_interface_t;
   94.74 -
   94.75 -/* This structure must fit in a memory page. */
   94.76 -typedef struct {
   94.77 -    /*
   94.78 -     * Frontend places empty buffers into ring at rx_req_prod.
   94.79 -     * Frontend receives event when rx_resp_prod passes rx_event.
   94.80 -     */
   94.81 -    NETIF_RING_IDX req_prod;       /*  0 */
   94.82 -    NETIF_RING_IDX resp_prod;      /*  4 */
   94.83 -    NETIF_RING_IDX event;          /*  8 */
   94.84 -    union {                        /* 12 */
   94.85 -        netif_rx_request_t  req;
   94.86 -        netif_rx_response_t resp;
   94.87 -    } PACKED ring[NETIF_RX_RING_SIZE];
   94.88 -} PACKED netif_rx_interface_t;
   94.89 -
   94.90 -/* Descriptor status values */
   94.91 -#define NETIF_RSP_DROPPED         -2
   94.92 -#define NETIF_RSP_ERROR           -1
   94.93 -#define NETIF_RSP_OKAY             0
   94.94 -
   94.95 -#endif
    95.1 --- a/xen/include/hypervisor-ifs/physdev.h	Mon Nov 01 00:14:22 2004 +0000
    95.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.3 @@ -1,80 +0,0 @@
    95.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    95.5 - ****************************************************************************
    95.6 - * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
    95.7 - * (c) 2004 - Keir Fraser - University of Cambridge
    95.8 - ****************************************************************************
    95.9 - * Description: Interface for domains to access physical devices on the PCI bus
   95.10 - */
   95.11 -
   95.12 -#ifndef __HYPERVISOR_IFS_PHYSDEV_H__
   95.13 -#define __HYPERVISOR_IFS_PHYSDEV_H__
   95.14 -
   95.15 -/* Commands to HYPERVISOR_physdev_op() */
   95.16 -#define PHYSDEVOP_PCI_CFGREG_READ       0
   95.17 -#define PHYSDEVOP_PCI_CFGREG_WRITE      1
   95.18 -#define PHYSDEVOP_PCI_INITIALISE_DEVICE 2
   95.19 -#define PHYSDEVOP_PCI_PROBE_ROOT_BUSES  3
   95.20 -#define PHYSDEVOP_IRQ_UNMASK_NOTIFY     4
   95.21 -#define PHYSDEVOP_IRQ_STATUS_QUERY      5
   95.22 -
   95.23 -/* Read from PCI configuration space. */
   95.24 -typedef struct {
   95.25 -    /* IN */
   95.26 -    u32 bus;                          /*  0 */
   95.27 -    u32 dev;                          /*  4 */
   95.28 -    u32 func;                         /*  8 */
   95.29 -    u32 reg;                          /* 12 */
   95.30 -    u32 len;                          /* 16 */
   95.31 -    /* OUT */
   95.32 -    u32 value;                        /* 20 */
   95.33 -} PACKED physdevop_pci_cfgreg_read_t; /* 24 bytes */
   95.34 -
   95.35 -/* Write to PCI configuration space. */
   95.36 -typedef struct {
   95.37 -    /* IN */
   95.38 -    u32 bus;                          /*  0 */
   95.39 -    u32 dev;                          /*  4 */
   95.40 -    u32 func;                         /*  8 */
   95.41 -    u32 reg;                          /* 12 */
   95.42 -    u32 len;                          /* 16 */
   95.43 -    u32 value;                        /* 20 */
   95.44 -} PACKED physdevop_pci_cfgreg_write_t; /* 24 bytes */
   95.45 -
   95.46 -/* Do final initialisation of a PCI device (e.g., last-moment IRQ routing). */
   95.47 -typedef struct {
   95.48 -    /* IN */
   95.49 -    u32 bus;                          /*  0 */
   95.50 -    u32 dev;                          /*  4 */
   95.51 -    u32 func;                         /*  8 */
   95.52 -} PACKED physdevop_pci_initialise_device_t; /* 12 bytes */
   95.53 -
   95.54 -/* Find the root buses for subsequent scanning. */
   95.55 -typedef struct {
   95.56 -    /* OUT */
   95.57 -    u32 busmask[256/32];              /*  0 */
   95.58 -} PACKED physdevop_pci_probe_root_buses_t; /* 32 bytes */
   95.59 -
   95.60 -typedef struct {
   95.61 -    /* IN */
   95.62 -    u32 irq;                          /*  0 */
   95.63 -    /* OUT */
   95.64 -/* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
   95.65 -#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
   95.66 -    u32 flags;                        /*  4 */
   95.67 -} PACKED physdevop_irq_status_query_t; /* 8 bytes */
   95.68 -
   95.69 -typedef struct _physdev_op_st 
   95.70 -{
   95.71 -    u32 cmd;                          /*  0 */
   95.72 -    u32 __pad;                        /*  4 */
   95.73 -    union {                           /*  8 */
   95.74 -        physdevop_pci_cfgreg_read_t       pci_cfgreg_read;
   95.75 -        physdevop_pci_cfgreg_write_t      pci_cfgreg_write;
   95.76 -        physdevop_pci_initialise_device_t pci_initialise_device;
   95.77 -        physdevop_pci_probe_root_buses_t  pci_probe_root_buses;
   95.78 -        physdevop_irq_status_query_t      irq_status_query;
   95.79 -        u8                                __dummy[32];
   95.80 -    } PACKED u;
   95.81 -} PACKED physdev_op_t; /* 40 bytes */
   95.82 -
   95.83 -#endif /* __HYPERVISOR_IFS_PHYSDEV_H__ */
    96.1 --- a/xen/include/hypervisor-ifs/sched_ctl.h	Mon Nov 01 00:14:22 2004 +0000
    96.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.3 @@ -1,70 +0,0 @@
    96.4 -/**
    96.5 - * Generic scheduler control interface.
    96.6 - *
    96.7 - * Mark Williamson, (C) 2004 Intel Research Cambridge
    96.8 - */
    96.9 -
   96.10 -#ifndef __SCHED_CTL_H__
   96.11 -#define __SCHED_CTL_H__
   96.12 -
   96.13 -/* Scheduler types */
   96.14 -#define SCHED_BVT      0
   96.15 -#define SCHED_ATROPOS  2
   96.16 -#define SCHED_RROBIN   3
   96.17 -
   96.18 -/* these describe the intended direction used for a scheduler control or domain
   96.19 - * command */
   96.20 -#define SCHED_INFO_PUT 0
   96.21 -#define SCHED_INFO_GET 1
   96.22 -
   96.23 -/*
   96.24 - * Generic scheduler control command - used to adjust system-wide scheduler
   96.25 - * parameters
   96.26 - */
   96.27 -struct sched_ctl_cmd
   96.28 -{
   96.29 -    u32 sched_id;                     /*  0 */
   96.30 -    u32 direction;                    /*  4 */
   96.31 -    union {                           /*  8 */
   96.32 -        struct bvt_ctl
   96.33 -        {
   96.34 -            /* IN variables. */
   96.35 -            u32 ctx_allow;            /*  8: context switch allowance */
   96.36 -        } PACKED bvt;
   96.37 -
   96.38 -        struct rrobin_ctl
   96.39 -        {
   96.40 -            /* IN variables */
   96.41 -            u64 slice;                /*  8: round robin time slice */
   96.42 -        } PACKED rrobin;
   96.43 -    } PACKED u;
   96.44 -} PACKED; /* 16 bytes */
   96.45 -
   96.46 -struct sched_adjdom_cmd
   96.47 -{
   96.48 -    u32     sched_id;                 /*  0 */
   96.49 -    u32     direction;                /*  4 */
   96.50 -    domid_t domain;                   /*  8 */
   96.51 -    u16     __pad0;
   96.52 -    u32     __pad1;
   96.53 -    union {                           /* 16 */
   96.54 -        struct bvt_adjdom
   96.55 -        {
   96.56 -            u32 mcu_adv;            /* 16: mcu advance: inverse of weight */
   96.57 -            u32 warpback;           /* 20: warp? */
   96.58 -            s32 warpvalue;          /* 24: warp value */
   96.59 -            long long warpl;        /* 32: warp limit */
   96.60 -            long long warpu;        /* 40: unwarp time requirement */
   96.61 -        } PACKED bvt;
   96.62 -
   96.63 -        struct atropos_adjdom
   96.64 -        {
   96.65 -            u64 nat_period; /* 16 */
   96.66 -            u64 nat_slice;  /* 24 */
   96.67 -            u64 latency;    /* 32 */
   96.68 -            u32 xtratime;   /* 36 */
   96.69 -        } PACKED atropos;
   96.70 -    } PACKED u;
   96.71 -} PACKED; /* 40 bytes */
   96.72 -
   96.73 -#endif /* __SCHED_CTL_H__ */
    97.1 --- a/xen/include/hypervisor-ifs/trace.h	Mon Nov 01 00:14:22 2004 +0000
    97.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.3 @@ -1,31 +0,0 @@
    97.4 -/******************************************************************************
    97.5 - * include/hypervisor-ifs/trace.h
    97.6 - */
    97.7 -
    97.8 -#ifndef __HYPERVISOR_IFS_TRACE_H__
    97.9 -#define __HYPERVISOR_IFS_TRACE_H__
   97.10 -
   97.11 -/* This structure represents a single trace buffer record. */
   97.12 -struct t_rec {
   97.13 -    u64 cycles;               /* 64 bit cycle counter timestamp */
   97.14 -    u32 event;                /* 32 bit event ID                */
   97.15 -    u32 d1, d2, d3, d4, d5;   /* event data items               */
   97.16 -};
   97.17 -
   97.18 -/*
   97.19 - * This structure contains the metadata for a single trace buffer.  The head
   97.20 - * field, indexes into an array of struct t_rec's.
   97.21 - */
   97.22 -struct t_buf {
   97.23 -    unsigned long data;      /* pointer to data area.  machine address
   97.24 -                              * for convenience in user space code           */
   97.25 -
   97.26 -    unsigned long size;      /* size of the data area, in t_recs             */
   97.27 -    unsigned long head;      /* array index of the most recent record        */
   97.28 -
   97.29 -    /* Xen-private elements follow... */
   97.30 -    struct t_rec *head_ptr; /* pointer to the head record                    */
   97.31 -    struct t_rec *vdata;    /* virtual address pointer to data               */
   97.32 -};
   97.33 -
   97.34 -#endif /* __HYPERVISOR_IFS_TRACE_H__ */
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/xen/include/public/COPYING	Mon Nov 01 00:18:29 2004 +0000
    98.3 @@ -0,0 +1,28 @@
    98.4 +XEN NOTICE
    98.5 +==========
    98.6 +
    98.7 +This copyright applies to all files within this subdirectory. All
    98.8 +other files in the Xen source distribution are covered by version 2 of
    98.9 +the GNU General Public License.
   98.10 +
   98.11 + -- Keir Fraser (on behalf of the Xen team)
   98.12 +
   98.13 +=====================================================================
   98.14 +
   98.15 +Permission is hereby granted, free of charge, to any person obtaining a copy
   98.16 +of this software and associated documentation files (the "Software"), to
   98.17 +deal in the Software without restriction, including without limitation the
   98.18 +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   98.19 +sell copies of the Software, and to permit persons to whom the Software is
   98.20 +furnished to do so, subject to the following conditions:
   98.21 +
   98.22 +The above copyright notice and this permission notice shall be included in
   98.23 +all copies or substantial portions of the Software.
   98.24 +
   98.25 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
   98.26 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
   98.27 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
   98.28 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
   98.29 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
   98.30 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
   98.31 +DEALINGS IN THE SOFTWARE.
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/xen/include/public/arch-x86_32.h	Mon Nov 01 00:18:29 2004 +0000
    99.3 @@ -0,0 +1,141 @@
    99.4 +/******************************************************************************
    99.5 + * arch-x86_32.h
    99.6 + * 
    99.7 + * Guest OS interface to x86 32-bit Xen.
    99.8 + */
    99.9 +
   99.10 +#ifndef __XEN_PUBLIC_ARCH_X86_32_H__
   99.11 +#define __XEN_PUBLIC_ARCH_X86_32_H__
   99.12 +
   99.13 +/*
   99.14 + * Pointers and other address fields inside interface structures are padded to
   99.15 + * 64 bits. This means that field alignments aren't different between 32- and
   99.16 + * 64-bit architectures. 
   99.17 + */
   99.18 +/* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
   99.19 +#define __MEMORY_PADDING(_X) u32 __pad_ ## _X
   99.20 +#define _MEMORY_PADDING(_X)  __MEMORY_PADDING(_X)
   99.21 +#define MEMORY_PADDING       _MEMORY_PADDING(__LINE__)
   99.22 +
   99.23 +/*
   99.24 + * SEGMENT DESCRIPTOR TABLES
   99.25 + */
   99.26 +/*
   99.27 + * A number of GDT entries are reserved by Xen. These are not situated at the
   99.28 + * start of the GDT because some stupid OSes export hard-coded selector values
   99.29 + * in their ABI. These hard-coded values are always near the start of the GDT,
   99.30 + * so Xen places itself out of the way.
   99.31 + * 
   99.32 + * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
   99.33 + * and LAST_RESERVED_GDT_ENTRY are reserved).
   99.34 + */
   99.35 +#define NR_RESERVED_GDT_ENTRIES    40
   99.36 +#define FIRST_RESERVED_GDT_ENTRY   256
   99.37 +#define LAST_RESERVED_GDT_ENTRY    \
   99.38 +  (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
   99.39 +
   99.40 +
   99.41 +/*
   99.42 + * These flat segments are in the Xen-private section of every GDT. Since these
   99.43 + * are also present in the initial GDT, many OSes will be able to avoid
   99.44 + * installing their own GDT.
   99.45 + */
   99.46 +#define FLAT_RING1_CS 0x0819    /* GDT index 259 */
   99.47 +#define FLAT_RING1_DS 0x0821    /* GDT index 260 */
   99.48 +#define FLAT_RING3_CS 0x082b    /* GDT index 261 */
   99.49 +#define FLAT_RING3_DS 0x0833    /* GDT index 262 */
   99.50 +
   99.51 +#define FLAT_GUESTOS_CS FLAT_RING1_CS
   99.52 +#define FLAT_GUESTOS_DS FLAT_RING1_DS
   99.53 +#define FLAT_USER_CS    FLAT_RING3_CS
   99.54 +#define FLAT_USER_DS    FLAT_RING3_DS
   99.55 +
   99.56 +/* And the trap vector is... */
   99.57 +#define TRAP_INSTR "int $0x82"
   99.58 +
   99.59 +
   99.60 +/*
   99.61 + * Virtual addresses beyond this are not modifiable by guest OSes. The 
   99.62 + * machine->physical mapping table starts at this address, read-only.
   99.63 + */
   99.64 +#define HYPERVISOR_VIRT_START (0xFC000000UL)
   99.65 +#ifndef machine_to_phys_mapping
   99.66 +#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
   99.67 +#endif
   99.68 +
   99.69 +#ifndef __ASSEMBLY__
   99.70 +
   99.71 +/* NB. Both the following are 32 bits each. */
   99.72 +typedef unsigned long memory_t;   /* Full-sized pointer/address/memory-size. */
   99.73 +typedef unsigned long cpureg_t;   /* Full-sized register.                    */
   99.74 +
   99.75 +/*
   99.76 + * Send an array of these to HYPERVISOR_set_trap_table()
   99.77 + */
   99.78 +#define TI_GET_DPL(_ti)      ((_ti)->flags & 3)
   99.79 +#define TI_GET_IF(_ti)       ((_ti)->flags & 4)
   99.80 +#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
   99.81 +#define TI_SET_IF(_ti,_if)   ((_ti)->flags |= ((!!(_if))<<2))
   99.82 +typedef struct {
   99.83 +    u8       vector;  /* 0: exception vector                              */
   99.84 +    u8       flags;   /* 1: 0-3: privilege level; 4: clear event enable?  */
   99.85 +    u16      cs;      /* 2: code selector                                 */
   99.86 +    memory_t address; /* 4: code address                                  */
   99.87 +} PACKED trap_info_t; /* 8 bytes */
   99.88 +
   99.89 +typedef struct
   99.90 +{
   99.91 +    unsigned long ebx;
   99.92 +    unsigned long ecx;
   99.93 +    unsigned long edx;
   99.94 +    unsigned long esi;
   99.95 +    unsigned long edi;
   99.96 +    unsigned long ebp;
   99.97 +    unsigned long eax;
   99.98 +    unsigned long ds;
   99.99 +    unsigned long es;
  99.100 +    unsigned long fs;
  99.101 +    unsigned long gs;
  99.102 +    unsigned long _unused;
  99.103 +    unsigned long eip;
  99.104 +    unsigned long cs;
  99.105 +    unsigned long eflags;
  99.106 +    unsigned long esp;
  99.107 +    unsigned long ss;
  99.108 +} PACKED execution_context_t;
  99.109 +
  99.110 +typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
  99.111 +
  99.112 +/*
  99.113 + * The following is all CPU context. Note that the i387_ctxt block is filled 
  99.114 + * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
  99.115 + */
  99.116 +typedef struct {
  99.117 +#define ECF_I387_VALID (1<<0)
  99.118 +    unsigned long flags;
  99.119 +    execution_context_t cpu_ctxt;           /* User-level CPU registers     */
  99.120 +    char          fpu_ctxt[256];            /* User-level FPU registers     */
  99.121 +    trap_info_t   trap_ctxt[256];           /* Virtual IDT                  */
  99.122 +    unsigned int  fast_trap_idx;            /* "Fast trap" vector offset    */
  99.123 +    unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
  99.124 +    unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
  99.125 +    unsigned long guestos_ss, guestos_esp;  /* Virtual TSS (only SS1/ESP1)  */
  99.126 +    unsigned long pt_base;                  /* CR3 (pagetable base)         */
  99.127 +    unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
  99.128 +    unsigned long event_callback_cs;        /* CS:EIP of event callback     */
  99.129 +    unsigned long event_callback_eip;
  99.130 +    unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
  99.131 +    unsigned long failsafe_callback_eip;
  99.132 +} PACKED full_execution_context_t;
  99.133 +
  99.134 +typedef struct {
  99.135 +    u64 mfn_to_pfn_start;      /* MFN of start of m2p table */
  99.136 +    u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that 
  99.137 +				  make up p2m table */
  99.138 +} PACKED arch_shared_info_t;
  99.139 +
  99.140 +#define ARCH_HAS_FAST_TRAP
  99.141 +
  99.142 +#endif
  99.143 +
  99.144 +#endif
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/xen/include/public/arch-x86_64.h	Mon Nov 01 00:18:29 2004 +0000
   100.3 @@ -0,0 +1,134 @@
   100.4 +/******************************************************************************
   100.5 + * arch-x86_64.h
   100.6 + * 
   100.7 + * Guest OS interface to x86 64-bit Xen.
   100.8 + */
   100.9 +
  100.10 +#ifndef __XEN_PUBLIC_ARCH_X86_64_H__
  100.11 +#define __XEN_PUBLIC_ARCH_X86_64_H__
  100.12 +
  100.13 +/* Pointers are naturally 64 bits in this architecture; no padding needed. */
  100.14 +#define _MEMORY_PADDING(_X)
  100.15 +#define MEMORY_PADDING 
  100.16 +
  100.17 +/*
  100.18 + * SEGMENT DESCRIPTOR TABLES
  100.19 + */
  100.20 +/*
  100.21 + * A number of GDT entries are reserved by Xen. These are not situated at the
  100.22 + * start of the GDT because some stupid OSes export hard-coded selector values
  100.23 + * in their ABI. These hard-coded values are always near the start of the GDT,
  100.24 + * so Xen places itself out of the way.
  100.25 + * 
  100.26 + * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
  100.27 + * and LAST_RESERVED_GDT_ENTRY are reserved).
  100.28 + */
  100.29 +#define NR_RESERVED_GDT_ENTRIES    40 
  100.30 +#define FIRST_RESERVED_GDT_ENTRY   256
  100.31 +#define LAST_RESERVED_GDT_ENTRY    \
  100.32 +  (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
  100.33 +
  100.34 +/*
  100.35 + * 64-bit segment selectors
  100.36 + * These flat segments are in the Xen-private section of every GDT. Since these
  100.37 + * are also present in the initial GDT, many OSes will be able to avoid
  100.38 + * installing their own GDT.
  100.39 + */
  100.40 +
  100.41 +#define FLAT_RING3_CS32 0x0823  /* GDT index 260 */
  100.42 +#define FLAT_RING3_CS64 0x082b  /* GDT index 261 */
  100.43 +#define FLAT_RING3_DS   0x0833  /* GDT index 262 */
  100.44 +
  100.45 +#define FLAT_GUESTOS_DS   FLAT_RING3_DS
  100.46 +#define FLAT_GUESTOS_CS   FLAT_RING3_CS64
  100.47 +#define FLAT_GUESTOS_CS32 FLAT_RING3_CS32
  100.48 +
  100.49 +#define FLAT_USER_DS      FLAT_RING3_DS
  100.50 +#define FLAT_USER_CS      FLAT_RING3_CS64
  100.51 +#define FLAT_USER_CS32    FLAT_RING3_CS32
  100.52 +
  100.53 +/* And the trap vector is... */
  100.54 +#define TRAP_INSTR "syscall"
  100.55 +
  100.56 +/* The machine->physical mapping table starts at this address, read-only. */
  100.57 +#ifndef machine_to_phys_mapping
  100.58 +#define machine_to_phys_mapping ((unsigned long *)0xffff810000000000ULL)
  100.59 +#endif
  100.60 +
  100.61 +#ifndef __ASSEMBLY__
  100.62 +
  100.63 +/* NB. Both the following are 64 bits each. */
  100.64 +typedef unsigned long memory_t;   /* Full-sized pointer/address/memory-size. */
  100.65 +typedef unsigned long cpureg_t;   /* Full-sized register.                    */
  100.66 +
  100.67 +/*
  100.68 + * Send an array of these to HYPERVISOR_set_trap_table()
  100.69 + */
  100.70 +#define TI_GET_DPL(_ti)      ((_ti)->flags & 3)
  100.71 +#define TI_GET_IF(_ti)       ((_ti)->flags & 4)
  100.72 +#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
  100.73 +#define TI_SET_IF(_ti,_if)   ((_ti)->flags |= ((!!(_if))<<2))
  100.74 +typedef struct {
  100.75 +    u8       vector;  /* 0: exception vector                              */
  100.76 +    u8       flags;   /* 1: 0-3: privilege level; 4: clear event enable?  */
  100.77 +    u16      cs;      /* 2: code selector                                 */
  100.78 +    u32      __pad;   /* 4 */
  100.79 +    memory_t address; /* 8: code address                                  */
  100.80 +} PACKED trap_info_t; /* 16 bytes */
  100.81 +
  100.82 +typedef struct
  100.83 +{
  100.84 +    unsigned long r15;
  100.85 +    unsigned long r14;
  100.86 +    unsigned long r13;
  100.87 +    unsigned long r12;
  100.88 +    unsigned long rbp;
  100.89 +    unsigned long rbx;
  100.90 +    unsigned long r11;
  100.91 +    unsigned long r10;
  100.92 +    unsigned long r9;
  100.93 +    unsigned long r8;
  100.94 +    unsigned long rax;
  100.95 +    unsigned long rcx;
  100.96 +    unsigned long rdx;
  100.97 +    unsigned long rsi;
  100.98 +    unsigned long rdi;
  100.99 +    unsigned long rip;
 100.100 +    unsigned long cs;
 100.101 +    unsigned long eflags;
 100.102 +    unsigned long rsp;
 100.103 +    unsigned long ss;
 100.104 +} PACKED execution_context_t;
 100.105 +
 100.106 +typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
 100.107 +
 100.108 +/*
 100.109 + * The following is all CPU context. Note that the i387_ctxt block is filled 
 100.110 + * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
 100.111 + */
 100.112 +typedef struct {
 100.113 +#define ECF_I387_VALID (1<<0)
 100.114 +    unsigned long flags;
 100.115 +    execution_context_t cpu_ctxt;           /* User-level CPU registers     */
 100.116 +    char          fpu_ctxt[512];            /* User-level FPU registers     */
 100.117 +    trap_info_t   trap_ctxt[256];           /* Virtual IDT                  */
 100.118 +    unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
 100.119 +    unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
 100.120 +    unsigned long guestos_ss, guestos_esp;  /* Virtual TSS (only SS1/ESP1)  */
 100.121 +    unsigned long pt_base;                  /* CR3 (pagetable base)         */
 100.122 +    unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
 100.123 +    unsigned long event_callback_cs;        /* CS:EIP of event callback     */
 100.124 +    unsigned long event_callback_eip;
 100.125 +    unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
 100.126 +    unsigned long failsafe_callback_eip;
 100.127 +} PACKED full_execution_context_t;
 100.128 +
 100.129 +typedef struct {
 100.130 +    u64 mfn_to_pfn_start;      /* MFN of start of m2p table */
 100.131 +    u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that 
 100.132 +				  make up p2m table */
 100.133 +} PACKED arch_shared_info_t;
 100.134 +
 100.135 +#endif /* !__ASSEMBLY__ */
 100.136 +
 100.137 +#endif
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/xen/include/public/dom0_ops.h	Mon Nov 01 00:18:29 2004 +0000
   101.3 @@ -0,0 +1,372 @@
   101.4 +/******************************************************************************
   101.5 + * dom0_ops.h
   101.6 + * 
   101.7 + * Process command requests from domain-0 guest OS.
   101.8 + * 
   101.9 + * Copyright (c) 2002-2003, B Dragovic
  101.10 + * Copyright (c) 2002-2004, K Fraser
  101.11 + */
  101.12 +
  101.13 +
  101.14 +#ifndef __XEN_PUBLIC_DOM0_OPS_H__
  101.15 +#define __XEN_PUBLIC_DOM0_OPS_H__
  101.16 +
  101.17 +#include "xen.h"
  101.18 +#include "sched_ctl.h"
  101.19 +
  101.20 +/*
  101.21 + * Make sure you increment the interface version whenever you modify this file!
  101.22 + * This makes sure that old versions of dom0 tools will stop working in a
  101.23 + * well-defined way (rather than crashing the machine, for instance).
  101.24 + */
  101.25 +#define DOM0_INTERFACE_VERSION   0xAAAA0019
  101.26 +
  101.27 +/************************************************************************/
  101.28 +
  101.29 +#define DOM0_GETMEMLIST        2
  101.30 +typedef struct {
  101.31 +    /* IN variables. */
  101.32 +    domid_t       domain;             /*  0 */
  101.33 +    u16           __pad0;
  101.34 +    u32           __pad1;
  101.35 +    memory_t      max_pfns;           /*  8 */
  101.36 +    MEMORY_PADDING;
  101.37 +    void         *buffer;             /* 16 */
  101.38 +    MEMORY_PADDING;
  101.39 +    /* OUT variables. */
  101.40 +    memory_t      num_pfns;           /* 24 */
  101.41 +    MEMORY_PADDING;
  101.42 +} PACKED dom0_getmemlist_t; /* 32 bytes */
  101.43 +
  101.44 +#define DOM0_SCHEDCTL          6
  101.45 + /* struct sched_ctl_cmd is from sched-ctl.h   */
  101.46 +typedef struct sched_ctl_cmd dom0_schedctl_t;
  101.47 +
  101.48 +#define DOM0_ADJUSTDOM         7
  101.49 +/* struct sched_adjdom_cmd is from sched-ctl.h */
  101.50 +typedef struct sched_adjdom_cmd dom0_adjustdom_t;
  101.51 +
  101.52 +#define DOM0_CREATEDOMAIN      8
  101.53 +typedef struct {
  101.54 +    /* IN parameters. */
  101.55 +    memory_t     memory_kb;           /*  0 */
  101.56 +    MEMORY_PADDING;
  101.57 +    u32          cpu;                 /*  8 */
  101.58 +    u32          __pad0;              /* 12 */
  101.59 +    /* IN/OUT parameters. */
  101.60 +    /* If 0, domain is allocated. If non-zero use it unless in use. */
  101.61 +    domid_t      domain;              /* 16 */
  101.62 +    u16          __pad1;
  101.63 +    /* OUT parameters. */
  101.64 +} PACKED dom0_createdomain_t; /* 20 bytes */
  101.65 +
  101.66 +#define DOM0_DESTROYDOMAIN     9
  101.67 +typedef struct {
  101.68 +    /* IN variables. */
  101.69 +    domid_t      domain;              /*  0 */
  101.70 +    u16          __pad;
  101.71 +} PACKED dom0_destroydomain_t; /* 4 bytes */
  101.72 +
  101.73 +#define DOM0_PAUSEDOMAIN      10
  101.74 +typedef struct {
  101.75 +    /* IN parameters. */
  101.76 +    domid_t domain;                   /*  0 */
  101.77 +    u16     __pad;
  101.78 +} PACKED dom0_pausedomain_t; /* 4 bytes */
  101.79 +
  101.80 +#define DOM0_UNPAUSEDOMAIN    11
  101.81 +typedef struct {
  101.82 +    /* IN parameters. */
  101.83 +    domid_t domain;                   /*  0 */
  101.84 +    u16     __pad;
  101.85 +} PACKED dom0_unpausedomain_t; /* 4 bytes */
  101.86 +
  101.87 +#define DOM0_GETDOMAININFO    12
  101.88 +typedef struct {
  101.89 +    /* IN variables. */
  101.90 +    domid_t  domain;                  /*  0 */ /* NB. IN/OUT variable. */
  101.91 +    u16     __pad;
  101.92 +    /* OUT variables. */
  101.93 +#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
  101.94 +#define DOMFLAGS_CRASHED   (1<<1) /* Crashed domain; frozen for postmortem.  */
  101.95 +#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut itself down.      */
  101.96 +#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
  101.97 +#define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
  101.98 +#define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
  101.99 +#define DOMFLAGS_CPUMASK      255 /* CPU to which this domain is bound.      */
 101.100 +#define DOMFLAGS_CPUSHIFT       8
 101.101 +#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
 101.102 +#define DOMFLAGS_SHUTDOWNSHIFT 16
 101.103 +    u32      flags;                   /*  4 */
 101.104 +    full_execution_context_t *ctxt;   /*  8 */ /* NB. IN/OUT variable. */
 101.105 +    MEMORY_PADDING;
 101.106 +    memory_t tot_pages;               /* 16 */
 101.107 +    MEMORY_PADDING;
 101.108 +    memory_t max_pages;               /* 24 */
 101.109 +    MEMORY_PADDING;
 101.110 +    memory_t shared_info_frame;       /* 32: MFN of shared_info struct */
 101.111 +    MEMORY_PADDING;
 101.112 +    u64      cpu_time;                /* 40 */
 101.113 +} PACKED dom0_getdomaininfo_t; /* 48 bytes */
 101.114 +
 101.115 +#define DOM0_BUILDDOMAIN      13
 101.116 +typedef struct {
 101.117 +    /* IN variables. */
 101.118 +    domid_t                 domain;   /*  0 */
 101.119 +    u16                     __pad0;   /*  2 */
 101.120 +    u32                     __pad1;   /*  4 */
 101.121 +    /* IN/OUT parameters */
 101.122 +    full_execution_context_t *ctxt;   /*  8 */
 101.123 +    MEMORY_PADDING;
 101.124 +} PACKED dom0_builddomain_t; /* 16 bytes */
 101.125 +
 101.126 +#define DOM0_IOPL             14
 101.127 +typedef struct {
 101.128 +    domid_t domain;                   /*  0 */
 101.129 +    u16     __pad;
 101.130 +    u32     iopl;                     /*  4 */
 101.131 +} PACKED dom0_iopl_t; /* 8 bytes */
 101.132 +
 101.133 +#define DOM0_MSR              15
 101.134 +typedef struct {
 101.135 +    /* IN variables. */
 101.136 +    u32 write;                        /*  0 */
 101.137 +    u32 cpu_mask;                     /*  4 */
 101.138 +    u32 msr;                          /*  8 */
 101.139 +    u32 in1;                          /* 12 */
 101.140 +    u32 in2;                          /* 16 */
 101.141 +    /* OUT variables. */
 101.142 +    u32 out1;                         /* 20 */
 101.143 +    u32 out2;                         /* 24 */
 101.144 +} PACKED dom0_msr_t; /* 28 bytes */
 101.145 +
 101.146 +#define DOM0_DEBUG            16
 101.147 +typedef struct {
 101.148 +    /* IN variables. */
 101.149 +    domid_t domain;                   /*  0 */
 101.150 +    u8  opcode;                       /*  2 */
 101.151 +    u8  __pad;
 101.152 +    u32 in1;                          /*  4 */
 101.153 +    u32 in2;                          /*  8 */
 101.154 +    u32 in3;                          /* 12 */
 101.155 +    u32 in4;                          /* 16 */
 101.156 +    /* OUT variables. */
 101.157 +    u32 status;                       /* 20 */
 101.158 +    u32 out1;                         /* 24 */
 101.159 +    u32 out2;                         /* 28 */
 101.160 +} PACKED dom0_debug_t; /* 32 bytes */
 101.161 +
 101.162 +/*
 101.163 + * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
 101.164 + * 1 January, 1970 if the current system time was <system_time>.
 101.165 + */
 101.166 +#define DOM0_SETTIME          17
 101.167 +typedef struct {
 101.168 +    /* IN variables. */
 101.169 +    u32 secs;                         /*  0 */
 101.170 +    u32 usecs;                        /*  4 */
 101.171 +    u64 system_time;                  /*  8 */
 101.172 +} PACKED dom0_settime_t; /* 16 bytes */
 101.173 +
 101.174 +#define DOM0_GETPAGEFRAMEINFO 18
 101.175 +#define NOTAB 0         /* normal page */
 101.176 +#define L1TAB (1<<28)
 101.177 +#define L2TAB (2<<28)
 101.178 +#define L3TAB (3<<28)
 101.179 +#define L4TAB (4<<28)
 101.180 +#define LPINTAB  (1<<31)
 101.181 +#define XTAB  (0xf<<28) /* invalid page */
 101.182 +#define LTAB_MASK XTAB
 101.183 +#define LTABTYPE_MASK (0x7<<28)
 101.184 +
 101.185 +typedef struct {
 101.186 +    /* IN variables. */
 101.187 +    memory_t pfn;          /*  0: Machine page frame number to query.       */
 101.188 +    MEMORY_PADDING;
 101.189 +    domid_t domain;        /*  8: To which domain does the frame belong?    */
 101.190 +    u16     __pad;
 101.191 +    /* OUT variables. */
 101.192 +    /* Is the page PINNED to a type? */
 101.193 +    u32 type;              /* 12: see above type defs */
 101.194 +} PACKED dom0_getpageframeinfo_t; /* 16 bytes */
 101.195 +
 101.196 +/*
 101.197 + * Read console content from Xen buffer ring.
 101.198 + */
 101.199 +#define DOM0_READCONSOLE      19
 101.200 +typedef struct {
 101.201 +    memory_t str;                     /*  0 */
 101.202 +    MEMORY_PADDING;
 101.203 +    u32      count;                   /*  8 */
 101.204 +    u32      cmd;                     /* 12 */
 101.205 +} PACKED dom0_readconsole_t; /* 16 bytes */
 101.206 +
 101.207 +/* 
 101.208 + * Pin Domain to a particular CPU  (use -1 to unpin)
 101.209 + */
 101.210 +#define DOM0_PINCPUDOMAIN     20
 101.211 +typedef struct {
 101.212 +    /* IN variables. */
 101.213 +    domid_t      domain;              /*  0 */
 101.214 +    u16          __pad;
 101.215 +    s32          cpu;                 /*  4: -1 implies unpin */
 101.216 +} PACKED dom0_pincpudomain_t; /* 8 bytes */
 101.217 +
 101.218 +/* Get trace buffers machine base address */
 101.219 +#define DOM0_GETTBUFS         21
 101.220 +typedef struct {
 101.221 +    /* OUT variables */
 101.222 +    memory_t mach_addr;   /*  0: location of the trace buffers       */
 101.223 +    MEMORY_PADDING;
 101.224 +    u32      size;        /*  8: size of each trace buffer, in bytes */
 101.225 +} PACKED dom0_gettbufs_t; /* 12 bytes */
 101.226 +
 101.227 +/*
 101.228 + * Get physical information about the host machine
 101.229 + */
 101.230 +#define DOM0_PHYSINFO         22
 101.231 +typedef struct {
 101.232 +    u32      ht_per_core;             /*  0 */
 101.233 +    u32      cores;                   /*  4 */
 101.234 +    u32      cpu_khz;                 /*  8 */
 101.235 +    u32      __pad;                   /* 12 */
 101.236 +    memory_t total_pages;             /* 16 */
 101.237 +    MEMORY_PADDING;
 101.238 +    memory_t free_pages;              /* 24 */
 101.239 +    MEMORY_PADDING;
 101.240 +} PACKED dom0_physinfo_t; /* 32 bytes */
 101.241 +
 101.242 +/* 
 101.243 + * Allow a domain access to a physical PCI device
 101.244 + */
 101.245 +#define DOM0_PCIDEV_ACCESS    23
 101.246 +typedef struct {
 101.247 +    /* IN variables. */
 101.248 +    domid_t      domain;              /*  0 */
 101.249 +    u16          __pad;
 101.250 +    u32          bus;                 /*  4 */
 101.251 +    u32          dev;                 /*  8 */
 101.252 +    u32          func;                /* 12 */
 101.253 +    u32          enable;              /* 16 */
 101.254 +} PACKED dom0_pcidev_access_t; /* 20 bytes */
 101.255 +
 101.256 +/*
 101.257 + * Get the ID of the current scheduler.
 101.258 + */
 101.259 +#define DOM0_SCHED_ID        24
 101.260 +typedef struct {
 101.261 +    /* OUT variable */
 101.262 +    u32 sched_id;                     /*  0 */
 101.263 +} PACKED dom0_sched_id_t; /* 4 bytes */
 101.264 +
 101.265 +/* 
 101.266 + * Control shadow pagetables operation
 101.267 + */
 101.268 +#define DOM0_SHADOW_CONTROL  25
 101.269 +
 101.270 +#define DOM0_SHADOW_CONTROL_OP_OFF         0
 101.271 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
 101.272 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
 101.273 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
 101.274 +#define DOM0_SHADOW_CONTROL_OP_FLUSH       10     /* table ops */
 101.275 +#define DOM0_SHADOW_CONTROL_OP_CLEAN       11
 101.276 +#define DOM0_SHADOW_CONTROL_OP_PEEK        12
 101.277 +
 101.278 +typedef struct dom0_shadow_control
 101.279 +{
 101.280 +    u32 fault_count;
 101.281 +    u32 dirty_count;
 101.282 +    u32 dirty_net_count;     
 101.283 +    u32 dirty_block_count;     
 101.284 +} dom0_shadow_control_stats_t;
 101.285 +
 101.286 +typedef struct {
 101.287 +    /* IN variables. */
 101.288 +    domid_t        domain;            /*  0 */
 101.289 +    u16            __pad;
 101.290 +    u32            op;                /*  4 */
 101.291 +    unsigned long *dirty_bitmap;      /*  8: pointer to locked buffer */
 101.292 +    MEMORY_PADDING;
 101.293 +    /* IN/OUT variables. */
 101.294 +    memory_t       pages;  /* 16: size of buffer, updated with actual size */
 101.295 +    MEMORY_PADDING;
 101.296 +    /* OUT variables. */
 101.297 +    dom0_shadow_control_stats_t stats;
 101.298 +} PACKED dom0_shadow_control_t;
 101.299 +
 101.300 +#define DOM0_SETDOMAININITIALMEM   27
 101.301 +typedef struct {
 101.302 +    /* IN variables. */
 101.303 +    domid_t     domain;               /*  0 */
 101.304 +    u16         __pad0;
 101.305 +    u32         __pad1;
 101.306 +    memory_t    initial_memkb;        /*  8 */
 101.307 +    MEMORY_PADDING;
 101.308 +} PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
 101.309 +
 101.310 +#define DOM0_SETDOMAINMAXMEM   28
 101.311 +typedef struct {
 101.312 +    /* IN variables. */
 101.313 +    domid_t     domain;               /*  0 */
 101.314 +    u16         __pad0;
 101.315 +    u32         __pad1;
 101.316 +    memory_t    max_memkb;            /*  8 */
 101.317 +    MEMORY_PADDING;
 101.318 +} PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
 101.319 +
 101.320 +#define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
 101.321 +typedef struct {
 101.322 +    /* IN variables. */
 101.323 +    domid_t  domain;                  /*  0 */
 101.324 +    u16      __pad0;
 101.325 +    u32      __pad1;
 101.326 +    memory_t num;                     /*  8 */
 101.327 +    MEMORY_PADDING;
 101.328 +    /* IN/OUT variables. */
 101.329 +    unsigned long *array;             /* 16 */
 101.330 +    MEMORY_PADDING;
 101.331 +} PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
 101.332 +
 101.333 +#define DOM0_SETDOMAINVMASSIST   30
 101.334 +typedef struct {
 101.335 +    /* IN variables. */
 101.336 +    domid_t      domain;              /*  0 */
 101.337 +    u16          __pad0;
 101.338 +    u32          cmd;                 /*  4: vm_assist cmd */
 101.339 +    u32          type;                /*  8: vm_assist cmd */
 101.340 +} PACKED dom0_setdomainvmassist_t; /* 12 bytes */
 101.341 +
 101.342 +typedef struct {
 101.343 +    u32 cmd;                          /* 0 */
 101.344 +    u32 interface_version;            /* 4 */ /* DOM0_INTERFACE_VERSION */
 101.345 +    union {                           /* 8 */
 101.346 +	u32                      dummy[18]; /* 72 bytes */
 101.347 +        dom0_createdomain_t      createdomain;
 101.348 +        dom0_pausedomain_t       pausedomain;
 101.349 +        dom0_unpausedomain_t     unpausedomain;
 101.350 +        dom0_destroydomain_t     destroydomain;
 101.351 +        dom0_getmemlist_t        getmemlist;
 101.352 +        dom0_schedctl_t          schedctl;
 101.353 +        dom0_adjustdom_t         adjustdom;
 101.354 +        dom0_builddomain_t       builddomain;
 101.355 +        dom0_getdomaininfo_t     getdomaininfo;
 101.356 +        dom0_getpageframeinfo_t  getpageframeinfo;
 101.357 +        dom0_iopl_t              iopl;
 101.358 +	dom0_msr_t               msr;
 101.359 +	dom0_debug_t             debug;
 101.360 +	dom0_settime_t           settime;
 101.361 +	dom0_readconsole_t	 readconsole;
 101.362 +	dom0_pincpudomain_t      pincpudomain;
 101.363 +        dom0_gettbufs_t          gettbufs;
 101.364 +        dom0_physinfo_t          physinfo;
 101.365 +        dom0_pcidev_access_t     pcidev_access;
 101.366 +        dom0_sched_id_t          sched_id;
 101.367 +	dom0_shadow_control_t    shadow_control;
 101.368 +	dom0_setdomaininitialmem_t setdomaininitialmem;
 101.369 +	dom0_setdomainmaxmem_t   setdomainmaxmem;
 101.370 +	dom0_getpageframeinfo2_t getpageframeinfo2;
 101.371 +	dom0_setdomainvmassist_t setdomainvmassist;
 101.372 +    } PACKED u;
 101.373 +} PACKED dom0_op_t; /* 80 bytes */
 101.374 +
 101.375 +#endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/xen/include/public/event_channel.h	Mon Nov 01 00:18:29 2004 +0000
   102.3 @@ -0,0 +1,161 @@
   102.4 +/******************************************************************************
   102.5 + * event_channel.h
   102.6 + * 
   102.7 + * Event channels between domains.
   102.8 + * 
   102.9 + * Copyright (c) 2003-2004, K A Fraser.
  102.10 + */
  102.11 +
  102.12 +#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
  102.13 +#define __XEN_PUBLIC_EVENT_CHANNEL_H__
  102.14 +
  102.15 +/*
  102.16 + * EVTCHNOP_alloc_unbound: Allocate a fresh local port and prepare
  102.17 + * it for binding to <dom>.
  102.18 + */
  102.19 +#define EVTCHNOP_alloc_unbound    6
  102.20 +typedef struct {
  102.21 +    /* IN parameters */
  102.22 +    domid_t dom;                      /*  0 */
  102.23 +    u16     __pad;
  102.24 +    /* OUT parameters */
  102.25 +    u32     port;                     /*  4 */
  102.26 +} PACKED evtchn_alloc_unbound_t; /* 8 bytes */
  102.27 +
  102.28 +/*
  102.29 + * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
  102.30 + * <dom1> and <dom2>. Either <port1> or <port2> may be wildcarded by setting to
  102.31 + * zero. On successful return both <port1> and <port2> are filled in and
  102.32 + * <dom1,port1> is fully bound to <dom2,port2>.
  102.33 + * 
  102.34 + * NOTES:
  102.35 + *  1. A wildcarded port is allocated from the relevant domain's free list
  102.36 + *     (i.e., some port that was previously EVTCHNSTAT_closed). However, if the
  102.37 + *     remote port pair is already fully bound then a port is not allocated,
  102.38 + *     and instead the existing local port is returned to the caller.
  102.39 + *  2. If the caller is unprivileged then <dom1> must be DOMID_SELF.
  102.40 + *  3. If the caller is unprivileged and <dom2,port2> is EVTCHNSTAT_closed
  102.41 + *     then <dom2> must be DOMID_SELF.
  102.42 + *  4. If either port is already bound then it must be bound to the other
  102.43 + *     specified domain and port (if not wildcarded).
  102.44 + *  5. If either port is awaiting binding (EVTCHNSTAT_unbound) then it must
  102.45 + *     be awaiting binding to the other domain, and the other port pair must
  102.46 + *     be closed or unbound.
  102.47 + */
  102.48 +#define EVTCHNOP_bind_interdomain 0
  102.49 +typedef struct {
  102.50 +    /* IN parameters. */
  102.51 +    domid_t dom1, dom2;               /*  0,  2 */
  102.52 +    /* IN/OUT parameters. */
  102.53 +    u32     port1, port2;             /*  4,  8 */
  102.54 +} PACKED evtchn_bind_interdomain_t; /* 12 bytes */
  102.55 +
  102.56 +/*
  102.57 + * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
  102.58 + * NOTES:
  102.59 + *  1. A virtual IRQ may be bound to at most one event channel per domain.
  102.60 + */
  102.61 +#define EVTCHNOP_bind_virq        1
  102.62 +typedef struct {
  102.63 +    /* IN parameters. */
  102.64 +    u32 virq;                         /*  0 */
  102.65 +    /* OUT parameters. */
  102.66 +    u32 port;                         /*  4 */
  102.67 +} PACKED evtchn_bind_virq_t; /* 8 bytes */
  102.68 +
  102.69 +/*
  102.70 + * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
  102.71 + * NOTES:
  102.72 + *  1. A physical IRQ may be bound to at most one event channel per domain.
  102.73 + *  2. Only a sufficiently-privileged domain may bind to a physical IRQ.
  102.74 + */
  102.75 +#define EVTCHNOP_bind_pirq        2
  102.76 +typedef struct {
  102.77 +    /* IN parameters. */
  102.78 +    u32 pirq;                         /*  0 */
  102.79 +#define BIND_PIRQ__WILL_SHARE 1
  102.80 +    u32 flags; /* BIND_PIRQ__* */     /*  4 */
  102.81 +    /* OUT parameters. */
  102.82 +    u32 port;                         /*  8 */
  102.83 +} PACKED evtchn_bind_pirq_t; /* 12 bytes */
  102.84 +
  102.85 +/*
  102.86 + * EVTCHNOP_close: Close the communication channel which has an endpoint at
  102.87 + * <dom, port>. If the channel is interdomain then the remote end is placed in
  102.88 + * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
  102.89 + * NOTES:
  102.90 + *  1. <dom> may be specified as DOMID_SELF.
  102.91 + *  2. Only a sufficiently-privileged domain may close an event channel
  102.92 + *     for which <dom> is not DOMID_SELF.
  102.93 + */
  102.94 +#define EVTCHNOP_close            3
  102.95 +typedef struct {
  102.96 +    /* IN parameters. */
  102.97 +    domid_t dom;                      /*  0 */
  102.98 +    u16     __pad;
  102.99 +    u32     port;                     /*  4 */
 102.100 +    /* No OUT parameters. */
 102.101 +} PACKED evtchn_close_t; /* 8 bytes */
 102.102 +
 102.103 +/*
 102.104 + * EVTCHNOP_send: Send an event to the remote end of the channel whose local
 102.105 + * endpoint is <DOMID_SELF, local_port>.
 102.106 + */
 102.107 +#define EVTCHNOP_send             4
 102.108 +typedef struct {
 102.109 +    /* IN parameters. */
 102.110 +    u32     local_port;               /*  0 */
 102.111 +    /* No OUT parameters. */
 102.112 +} PACKED evtchn_send_t; /* 4 bytes */
 102.113 +
 102.114 +/*
 102.115 + * EVTCHNOP_status: Get the current status of the communication channel which
 102.116 + * has an endpoint at <dom, port>.
 102.117 + * NOTES:
 102.118 + *  1. <dom> may be specified as DOMID_SELF.
 102.119 + *  2. Only a sufficiently-privileged domain may obtain the status of an event
 102.120 + *     channel for which <dom> is not DOMID_SELF.
 102.121 + */
 102.122 +#define EVTCHNOP_status           5
 102.123 +typedef struct {
 102.124 +    /* IN parameters */
 102.125 +    domid_t dom;                      /*  0 */
 102.126 +    u16     __pad;
 102.127 +    u32     port;                     /*  4 */
 102.128 +    /* OUT parameters */
 102.129 +#define EVTCHNSTAT_closed       0  /* Channel is not in use.                 */
 102.130 +#define EVTCHNSTAT_unbound      1  /* Channel is waiting interdom connection.*/
 102.131 +#define EVTCHNSTAT_interdomain  2  /* Channel is connected to remote domain. */
 102.132 +#define EVTCHNSTAT_pirq         3  /* Channel is bound to a phys IRQ line.   */
 102.133 +#define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
 102.134 +    u32     status;                   /*  8 */
 102.135 +    union {                           /* 12 */
 102.136 +        struct {
 102.137 +            domid_t dom;                              /* 12 */
 102.138 +        } PACKED unbound; /* EVTCHNSTAT_unbound */
 102.139 +        struct {
 102.140 +            domid_t dom;                              /* 12 */
 102.141 +            u16     __pad;
 102.142 +            u32     port;                             /* 16 */
 102.143 +        } PACKED interdomain; /* EVTCHNSTAT_interdomain */
 102.144 +        u32 pirq;      /* EVTCHNSTAT_pirq        */   /* 12 */
 102.145 +        u32 virq;      /* EVTCHNSTAT_virq        */   /* 12 */
 102.146 +    } PACKED u;
 102.147 +} PACKED evtchn_status_t; /* 20 bytes */
 102.148 +
 102.149 +typedef struct {
 102.150 +    u32 cmd; /* EVTCHNOP_* */         /*  0 */
 102.151 +    u32 __reserved;                   /*  4 */
 102.152 +    union {                           /*  8 */
 102.153 +        evtchn_alloc_unbound_t    alloc_unbound;
 102.154 +        evtchn_bind_interdomain_t bind_interdomain;
 102.155 +        evtchn_bind_virq_t        bind_virq;
 102.156 +        evtchn_bind_pirq_t        bind_pirq;
 102.157 +        evtchn_close_t            close;
 102.158 +        evtchn_send_t             send;
 102.159 +        evtchn_status_t           status;
 102.160 +        u8                        __dummy[24];
 102.161 +    } PACKED u;
 102.162 +} PACKED evtchn_op_t; /* 32 bytes */
 102.163 +
 102.164 +#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/xen/include/public/grant_table.h	Mon Nov 01 00:18:29 2004 +0000
   103.3 @@ -0,0 +1,251 @@
   103.4 +/******************************************************************************
   103.5 + * grant_table.h
   103.6 + * 
   103.7 + * Interface for granting foreign access to page frames, and receiving
   103.8 + * page-ownership transfers.
   103.9 + * 
  103.10 + * Copyright (c) 2004, K A Fraser
  103.11 + */
  103.12 +
  103.13 +#ifndef __XEN_PUBLIC_GRANT_TABLE_H__
  103.14 +#define __XEN_PUBLIC_GRANT_TABLE_H__
  103.15 +
  103.16 +
  103.17 +/***********************************
  103.18 + * GRANT TABLE REPRESENTATION
  103.19 + */
  103.20 +
  103.21 +/* Some rough guidelines on accessing and updating grant-table entries
  103.22 + * in a concurrency-safe manner. For more information, Linux contains a
  103.23 + * reference implementation for guest OSes (arch/xen/kernel/grant_table.c).
  103.24 + * 
  103.25 + * NB. WMB is a no-op on current-generation x86 processors. However, a
  103.26 + *     compiler barrier will still be required.
  103.27 + * 
  103.28 + * Introducing a valid entry into the grant table:
  103.29 + *  1. Write ent->domid.
  103.30 + *  2. Write ent->frame:
  103.31 + *      GTF_permit_access:   Frame to which access is permitted.
  103.32 + *      GTF_accept_transfer: Pseudo-phys frame slot being filled by new
  103.33 + *                           frame, or zero if none.
  103.34 + *  3. Write memory barrier (WMB).
  103.35 + *  4. Write ent->flags, inc. valid type.
  103.36 + * 
  103.37 + * Invalidating an unused GTF_permit_access entry:
  103.38 + *  1. flags = ent->flags.
  103.39 + *  2. Observe that !(flags & (GTF_reading|GTF_writing)).
  103.40 + *  3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
  103.41 + *  NB. No need for WMB as reuse of entry is control-dependent on success of
  103.42 + *      step 3, and all architectures guarantee ordering of ctrl-dep writes.
  103.43 + *
  103.44 + * Invalidating an in-use GTF_permit_access entry:
  103.45 + *  This cannot be done directly. Request assistance from the domain controller
  103.46 + *  which can set a timeout on the use of a grant entry and take necessary
  103.47 + *  action. (NB. This is not yet implemented!).
  103.48 + * 
  103.49 + * Invalidating an unused GTF_accept_transfer entry:
  103.50 + *  1. flags = ent->flags.
  103.51 + *  2. Observe that !(flags & GTF_transfer_committed). [*]
  103.52 + *  3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
  103.53 + *  NB. No need for WMB as reuse of entry is control-dependent on success of
  103.54 + *      step 3, and all architectures guarantee ordering of ctrl-dep writes.
  103.55 + *  [*] If GTF_transfer_committed is set then the grant entry is 'committed'.
  103.56 + *      The guest must /not/ modify the grant entry until the address of the
  103.57 + *      transferred frame is written. It is safe for the guest to spin waiting
  103.58 + *      for this to occur (detect by observing GTF_transfer_completed in
  103.59 + *      ent->flags).
  103.60 + *
  103.61 + * Invalidating a committed GTF_accept_transfer entry:
  103.62 + *  1. Wait for (ent->flags & GTF_transfer_completed).
  103.63 + *
  103.64 + * Changing a GTF_permit_access from writable to read-only:
  103.65 + *  Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
  103.66 + * 
  103.67 + * Changing a GTF_permit_access from read-only to writable:
  103.68 + *  Use SMP-safe bit-setting instruction.
  103.69 + */
  103.70 +
  103.71 +/*
  103.72 + * A grant table comprises a packed array of grant entries in one or more
  103.73 + * page frames shared between Xen and a guest.
  103.74 + * [XEN]: This field is written by Xen and read by the sharing guest.
  103.75 + * [GST]: This field is written by the guest and read by Xen.
  103.76 + */
  103.77 +typedef struct {
  103.78 +    /* GTF_xxx: various type and flag information.  [XEN,GST] */
  103.79 +    u16     flags;      /* 0 */
  103.80 +    /* The domain being granted foreign privileges. [GST] */
  103.81 +    domid_t domid;      /* 2 */
  103.82 +    /*
  103.83 +     * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
  103.84 +     * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
  103.85 +     */
  103.86 +    u32     frame;      /* 4 */
  103.87 +} PACKED grant_entry_t; /* 8 bytes */
  103.88 +
  103.89 +/*
  103.90 + * Type of grant entry.
  103.91 + *  GTF_invalid: This grant entry grants no privileges.
  103.92 + *  GTF_permit_access: Allow @domid to map/access @frame.
  103.93 + *  GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
  103.94 + *                       to this guest. Xen writes the page number to @frame.
  103.95 + */
  103.96 +#define GTF_invalid         (0U<<0)
  103.97 +#define GTF_permit_access   (1U<<0)
  103.98 +#define GTF_accept_transfer (2U<<0)
  103.99 +#define GTF_type_mask       (3U<<0)
 103.100 +
 103.101 +/*
 103.102 + * Subflags for GTF_permit_access.
 103.103 + *  GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
 103.104 + *  GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
 103.105 + *  GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
 103.106 + */
 103.107 +#define _GTF_readonly       (2)
 103.108 +#define GTF_readonly        (1U<<_GTF_readonly)
 103.109 +#define _GTF_reading        (3)
 103.110 +#define GTF_reading         (1U<<_GTF_reading)
 103.111 +#define _GTF_writing        (4)
 103.112 +#define GTF_writing         (1U<<_GTF_writing)
 103.113 +
 103.114 +/*
 103.115 + * Subflags for GTF_accept_transfer:
 103.116 + *  GTF_transfer_committed: Xen sets this flag to indicate that it is committed
 103.117 + *      to transferring ownership of a page frame. When a guest sees this flag
 103.118 + *      it must /not/ modify the grant entry until GTF_transfer_completed is
 103.119 + *      set by Xen.
 103.120 + *  GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
 103.121 + *      after reading GTF_transfer_committed. Xen will always write the frame
 103.122 + *      address, followed by ORing this flag, in a timely manner.
 103.123 + */
 103.124 +#define _GTF_transfer_committed (2)
 103.125 +#define GTF_transfer_committed  (1U<<_GTF_transfer_committed)
 103.126 +#define _GTF_transfer_completed (3)
 103.127 +#define GTF_transfer_completed  (1U<<_GTF_transfer_completed)
 103.128 +
 103.129 +
 103.130 +/***********************************
 103.131 + * GRANT TABLE QUERIES AND USES
 103.132 + */
 103.133 +
 103.134 +/*
 103.135 + * Reference to a grant entry in a specified domain's grant table.
 103.136 + */
 103.137 +typedef u16 grant_ref_t;
 103.138 +
 103.139 +/*
 103.140 + * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
 103.141 + * by devices and/or host CPUs. If successful, <handle> is a tracking number
 103.142 + * that must be presented later to destroy the mapping(s). On error, <handle>
 103.143 + * is a negative status code.
 103.144 + * NOTES:
 103.145 + *  1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
 103.146 + *     via which I/O devices may access the granted frame.
 103.147 + *  2. If GNTPIN_map_for_host is specified then a mapping will be added at
 103.148 + *     virtual address <host_virt_addr> in the current address space.
 103.149 + *  3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
 103.150 + *     host mapping is destroyed by other means then it is *NOT* guaranteed
 103.151 + *     to be accounted to the correct grant reference!
 103.152 + */
 103.153 +#define GNTTABOP_map_grant_ref        0
 103.154 +typedef struct {
 103.155 +    /* IN parameters. */
 103.156 +    memory_t    host_virt_addr;       /*  0 */
 103.157 +    MEMORY_PADDING;
 103.158 +    domid_t     dom;                  /*  8 */
 103.159 +    grant_ref_t ref;                  /* 10 */
 103.160 +    u16         flags;                /* 12: GNTMAP_* */
 103.161 +    /* OUT parameters. */
 103.162 +    s16         handle;               /* 14: +ve: handle; -ve: GNTST_* */
 103.163 +    memory_t    dev_bus_addr;         /* 16 */
 103.164 +    MEMORY_PADDING;
 103.165 +} PACKED gnttab_map_grant_ref_t; /* 24 bytes */
 103.166 +
 103.167 +/*
 103.168 + * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
 103.169 + * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
 103.170 + * field is ignored. If non-zero, they must refer to a device/host mapping
 103.171 + * that is tracked by <handle>
 103.172 + * NOTES:
 103.173 + *  1. The call may fail in an undefined manner if either mapping is not
 103.174 + *     tracked by <handle>.
 103.175 + *  3. After executing a batch of unmaps, it is guaranteed that no stale
 103.176 + *     mappings will remain in the device or host TLBs.
 103.177 + */
 103.178 +#define GNTTABOP_unmap_grant_ref      1
 103.179 +typedef struct {
 103.180 +    /* IN parameters. */
 103.181 +    memory_t    host_virt_addr;       /*  0 */
 103.182 +    MEMORY_PADDING;
 103.183 +    memory_t    dev_bus_addr;         /*  8 */
 103.184 +    MEMORY_PADDING;
 103.185 +    u16         handle;               /* 16 */
 103.186 +    /* OUT parameters. */
 103.187 +    s16         status;               /* 18: GNTST_* */
 103.188 +    u32         __pad;
 103.189 +} PACKED gnttab_unmap_grant_ref_t; /* 24 bytes */
 103.190 +
 103.191 +/*
 103.192 + * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
 103.193 + * <nr_frames> pages. The frame addresses are written to the <frame_list>.
 103.194 + * Only <nr_frames> addresses are written, even if the table is larger.
 103.195 + * NOTES:
 103.196 + *  1. <dom> may be specified as DOMID_SELF.
 103.197 + *  2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
 103.198 + *  3. Xen may not support more than a single grant-table page per domain.
 103.199 + */
 103.200 +#define GNTTABOP_setup_table          2
 103.201 +typedef struct {
 103.202 +    /* IN parameters. */
 103.203 +    domid_t     dom;                  /*  0 */
 103.204 +    u16         nr_frames;            /*  2 */
 103.205 +    u16         __pad;
 103.206 +    /* OUT parameters. */
 103.207 +    s16         status;               /*  6: GNTST_* */
 103.208 +    unsigned long *frame_list;        /*  8 */
 103.209 +    MEMORY_PADDING;
 103.210 +} PACKED gnttab_setup_table_t; /* 16 bytes */
 103.211 +
 103.212 +/*
 103.213 + * Bitfield values for update_pin_status.flags.
 103.214 + */
 103.215 + /* Map the grant entry for access by I/O devices. */
 103.216 +#define _GNTMAP_device_map      (0)
 103.217 +#define GNTMAP_device_map       (1<<_GNTMAP_device_map)
 103.218 + /* Map the grant entry for access by host CPUs. */
 103.219 +#define _GNTMAP_host_map        (1)
 103.220 +#define GNTMAP_host_map         (1<<_GNTMAP_host_map)
 103.221 + /* Accesses to the granted frame will be restricted to read-only access. */
 103.222 +#define _GNTMAP_readonly        (2)
 103.223 +#define GNTMAP_readonly         (1<<_GNTMAP_readonly)
 103.224 + /*
 103.225 +  * GNTMAP_host_map subflag:
 103.226 +  *  0 => The host mapping is usable only by the guest OS.
 103.227 +  *  1 => The host mapping is usable by guest OS + current application.
 103.228 +  */
 103.229 +#define _GNTMAP_application_map (3)
 103.230 +#define GNTMAP_application_map  (1<<_GNTMAP_application_map)
 103.231 +
 103.232 +/*
 103.233 + * Values for error status returns. All errors are -ve.
 103.234 + */
 103.235 +#define GNTST_okay             (0)
 103.236 +#define GNTST_general_error    (-1) /* General undefined error.              */
 103.237 +#define GNTST_bad_domain       (-2) /* Unrecognsed domain id.                */
 103.238 +#define GNTST_bad_gntref       (-3) /* Unrecognised or inappropriate gntref. */
 103.239 +#define GNTST_bad_handle       (-3) /* Unrecognised or inappropriate handle. */
 103.240 +#define GNTST_no_device_space  (-4) /* Out of space in I/O MMU.              */
 103.241 +#define GNTST_permission_denied (-5) /* Not enough privilege for operation.  */
 103.242 +
 103.243 +#define GNTTABOP_error_msgs {                   \
 103.244 +    "okay",                                     \
 103.245 +    "undefined error",                          \
 103.246 +    "unrecognised domain id",                   \
 103.247 +    "invalid grant reference",                  \
 103.248 +    "invalid mapping handle",                   \
 103.249 +    "no spare translation slot in the I/O MMU", \
 103.250 +    "permission denied"                         \
 103.251 +}
 103.252 +        
 103.253 +
 103.254 +#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/xen/include/public/io/blkif.h	Mon Nov 01 00:18:29 2004 +0000
   104.3 @@ -0,0 +1,115 @@
   104.4 +/******************************************************************************
   104.5 + * blkif.h
   104.6 + * 
   104.7 + * Unified block-device I/O interface for Xen guest OSes.
   104.8 + * 
   104.9 + * Copyright (c) 2003-2004, Keir Fraser
  104.10 + */
  104.11 +
  104.12 +#ifndef __XEN_PUBLIC_IO_BLKIF_H__
  104.13 +#define __XEN_PUBLIC_IO_BLKIF_H__
  104.14 +
  104.15 +#define blkif_vdev_t   u16
  104.16 +#define blkif_sector_t u64
  104.17 +
  104.18 +#define BLKIF_OP_READ      0
  104.19 +#define BLKIF_OP_WRITE     1
  104.20 +#define BLKIF_OP_PROBE     2
  104.21 +
  104.22 +/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <= PAGE_SIZE. */
  104.23 +#define BLKIF_RING_SIZE        64
  104.24 +
  104.25 +/*
  104.26 + * Maximum scatter/gather segments per request.
  104.27 + * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
  104.28 + * NB. This could be 12 if the ring indexes weren't stored in the same page.
  104.29 + */
  104.30 +#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
  104.31 +
  104.32 +typedef struct {
  104.33 +    u8             operation;    /*  0: BLKIF_OP_???                         */
  104.34 +    u8             nr_segments;  /*  1: number of segments                   */
  104.35 +    blkif_vdev_t   device;       /*  2: only for read/write requests         */
  104.36 +    unsigned long  id;           /*  4: private guest value, echoed in resp  */
  104.37 +    blkif_sector_t sector_number;    /* start sector idx on disk (r/w only)  */
  104.38 +    /* @f_a_s[2:0]=last_sect ; @f_a_s[5:3]=first_sect ; @f_a_s[:12]=frame.   */
  104.39 +    /* @first_sect: first sector in frame to transfer (inclusive).           */
  104.40 +    /* @last_sect: last sector in frame to transfer (inclusive).             */
  104.41 +    /* @frame: machine page frame number.                                    */
  104.42 +    unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
  104.43 +} PACKED blkif_request_t;
  104.44 +
  104.45 +#define blkif_first_sect(_fas) (((_fas)>>3)&7)
  104.46 +#define blkif_last_sect(_fas)  ((_fas)&7)
  104.47 +
  104.48 +typedef struct {
  104.49 +    unsigned long   id;              /* copied from request */
  104.50 +    u8              operation;       /* copied from request */
  104.51 +    s16             status;          /* BLKIF_RSP_???       */
  104.52 +} PACKED blkif_response_t;
  104.53 +
  104.54 +#define BLKIF_RSP_ERROR  -1 /* non-specific 'error' */
  104.55 +#define BLKIF_RSP_OKAY    0 /* non-specific 'okay'  */
  104.56 +
  104.57 +/*
  104.58 + * We use a special capitalised type name because it is _essential_ that all 
  104.59 + * arithmetic on indexes is done on an integer type of the correct size.
  104.60 + */
  104.61 +typedef u32 BLKIF_RING_IDX;
  104.62 +
  104.63 +/*
  104.64 + * Ring indexes are 'free running'. That is, they are not stored modulo the
  104.65 + * size of the ring buffer. The following macro converts a free-running counter
  104.66 + * into a value that can directly index a ring-buffer array.
  104.67 + */
  104.68 +#define MASK_BLKIF_IDX(_i) ((_i)&(BLKIF_RING_SIZE-1))
  104.69 +
  104.70 +typedef struct {
  104.71 +    BLKIF_RING_IDX req_prod;  /*  0: Request producer. Updated by front-end. */
  104.72 +    BLKIF_RING_IDX resp_prod; /*  4: Response producer. Updated by back-end. */
  104.73 +    union {                   /*  8 */
  104.74 +        blkif_request_t  req;
  104.75 +        blkif_response_t resp;
  104.76 +    } PACKED ring[BLKIF_RING_SIZE];
  104.77 +} PACKED blkif_ring_t;
  104.78 +
  104.79 +
  104.80 +/*
  104.81 + * BLKIF_OP_PROBE:
  104.82 + * The request format for a probe request is constrained as follows:
  104.83 + *  @operation   == BLKIF_OP_PROBE
  104.84 + *  @nr_segments == size of probe buffer in pages
  104.85 + *  @device      == unused (zero)
  104.86 + *  @id          == any value (echoed in response message)
  104.87 + *  @sector_num  == unused (zero)
  104.88 + *  @frame_and_sects == list of page-sized buffers.
  104.89 + *                       (i.e., @first_sect == 0, @last_sect == 7).
  104.90 + * 
  104.91 + * The response is a list of vdisk_t elements copied into the out-of-band
  104.92 + * probe buffer. On success the response status field contains the number
  104.93 + * of vdisk_t elements.
  104.94 + */
  104.95 +
  104.96 +/* XXX SMH: Type values below are chosen to match ide_xxx in Linux ide.h. */
  104.97 +#define VDISK_TYPE_FLOPPY  0x00
  104.98 +#define VDISK_TYPE_TAPE    0x01
  104.99 +#define VDISK_TYPE_CDROM   0x05
 104.100 +#define VDISK_TYPE_OPTICAL 0x07
 104.101 +#define VDISK_TYPE_DISK    0x20 
 104.102 +
 104.103 +#define VDISK_TYPE_MASK    0x3F
 104.104 +#define VDISK_TYPE(_x)     ((_x) & VDISK_TYPE_MASK) 
 104.105 +
 104.106 +/* The top two bits of the type field encode various flags. */
 104.107 +#define VDISK_FLAG_RO      0x40
 104.108 +#define VDISK_FLAG_VIRT    0x80
 104.109 +#define VDISK_READONLY(_x) ((_x) & VDISK_FLAG_RO)
 104.110 +#define VDISK_VIRTUAL(_x)  ((_x) & VDISK_FLAG_VIRT) 
 104.111 +
 104.112 +typedef struct {
 104.113 +    blkif_sector_t capacity;     /*  0: Size in terms of 512-byte sectors.   */
 104.114 +    blkif_vdev_t   device;       /*  8: Device number (opaque 16 bit value). */
 104.115 +    u16            info;         /* 10: Device type and flags (VDISK_*).     */
 104.116 +} PACKED vdisk_t; /* 12 bytes */
 104.117 +
 104.118 +#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/xen/include/public/io/domain_controller.h	Mon Nov 01 00:18:29 2004 +0000
   105.3 @@ -0,0 +1,578 @@
   105.4 +/******************************************************************************
   105.5 + * domain_controller.h
   105.6 + * 
   105.7 + * Interface to server controller (e.g., 'xend'). This header file defines the 
   105.8 + * interface that is shared with guest OSes.
   105.9 + * 
  105.10 + * Copyright (c) 2004, K A Fraser
  105.11 + */
  105.12 +
  105.13 +#ifndef __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__
  105.14 +#define __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__
  105.15 +
  105.16 +
  105.17 +/*
  105.18 + * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
  105.19 + * interpreted by control software to determine the appropriate action. These 
  105.20 + * are only really advisories: the controller can actually do as it likes.
  105.21 + */
  105.22 +#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
  105.23 +#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
  105.24 +#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
  105.25 +
  105.26 +
  105.27 +/*
  105.28 + * CONTROLLER MESSAGING INTERFACE.
  105.29 + */
  105.30 +
  105.31 +typedef struct {
  105.32 +    u8 type;     /*  0: echoed in response */
  105.33 +    u8 subtype;  /*  1: echoed in response */
  105.34 +    u8 id;       /*  2: echoed in response */
  105.35 +    u8 length;   /*  3: number of bytes in 'msg' */
  105.36 +    u8 msg[60];  /*  4: type-specific message data */
  105.37 +} PACKED control_msg_t; /* 64 bytes */
  105.38 +
  105.39 +#define CONTROL_RING_SIZE 8
  105.40 +typedef u32 CONTROL_RING_IDX;
  105.41 +#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
  105.42 +
  105.43 +typedef struct {
  105.44 +    control_msg_t tx_ring[CONTROL_RING_SIZE];   /*    0: guest -> controller */
  105.45 +    control_msg_t rx_ring[CONTROL_RING_SIZE];   /*  512: controller -> guest */
  105.46 +    CONTROL_RING_IDX tx_req_prod, tx_resp_prod; /* 1024, 1028 */
  105.47 +    CONTROL_RING_IDX rx_req_prod, rx_resp_prod; /* 1032, 1036 */
  105.48 +} PACKED control_if_t; /* 1040 bytes */
  105.49 +
  105.50 +/*
  105.51 + * Top-level command types.
  105.52 + */
  105.53 +#define CMSG_CONSOLE        0  /* Console                 */
  105.54 +#define CMSG_BLKIF_BE       1  /* Block-device backend    */
  105.55 +#define CMSG_BLKIF_FE       2  /* Block-device frontend   */
  105.56 +#define CMSG_NETIF_BE       3  /* Network-device backend  */
  105.57 +#define CMSG_NETIF_FE       4  /* Network-device frontend */
  105.58 +#define CMSG_SHUTDOWN       6  /* Shutdown messages       */
  105.59 +#define CMSG_MEM_REQUEST    7  /* Memory reservation reqs */
  105.60 +
  105.61 +
  105.62 +/******************************************************************************
  105.63 + * CONSOLE DEFINITIONS
  105.64 + */
  105.65 +
  105.66 +/*
  105.67 + * Subtypes for console messages.
  105.68 + */
  105.69 +#define CMSG_CONSOLE_DATA       0
  105.70 +
  105.71 +
  105.72 +/******************************************************************************
  105.73 + * BLOCK-INTERFACE FRONTEND DEFINITIONS
  105.74 + */
  105.75 +
  105.76 +/* Messages from domain controller to guest. */
  105.77 +#define CMSG_BLKIF_FE_INTERFACE_STATUS           0
  105.78 +
  105.79 +/* Messages from guest to domain controller. */
  105.80 +#define CMSG_BLKIF_FE_DRIVER_STATUS             32
  105.81 +#define CMSG_BLKIF_FE_INTERFACE_CONNECT         33
  105.82 +#define CMSG_BLKIF_FE_INTERFACE_DISCONNECT      34
  105.83 +#define CMSG_BLKIF_FE_INTERFACE_QUERY           35
  105.84 +
  105.85 +/* These are used by both front-end and back-end drivers. */
  105.86 +#define blkif_vdev_t   u16
  105.87 +#define blkif_pdev_t   u16
  105.88 +#define blkif_sector_t u64
  105.89 +
  105.90 +/*
  105.91 + * CMSG_BLKIF_FE_INTERFACE_STATUS:
  105.92 + *  Notify a guest about a status change on one of its block interfaces.
  105.93 + *  If the interface is DESTROYED or DOWN then the interface is disconnected:
  105.94 + *   1. The shared-memory frame is available for reuse.
  105.95 + *   2. Any unacknowledged messages pending on the interface were dropped.
  105.96 + */
  105.97 +#define BLKIF_INTERFACE_STATUS_CLOSED       0 /* Interface doesn't exist.    */
  105.98 +#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
  105.99 +#define BLKIF_INTERFACE_STATUS_CONNECTED    2 /* Exists and is connected.    */
 105.100 +#define BLKIF_INTERFACE_STATUS_CHANGED      3 /* A device has been added or removed. */
 105.101 +typedef struct {
 105.102 +    u32 handle; /*  0 */
 105.103 +    u32 status; /*  4 */
 105.104 +    u16 evtchn; /*  8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
 105.105 +    domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
 105.106 +} PACKED blkif_fe_interface_status_t; /* 12 bytes */
 105.107 +
 105.108 +/*
 105.109 + * CMSG_BLKIF_FE_DRIVER_STATUS:
 105.110 + *  Notify the domain controller that the front-end driver is DOWN or UP.
 105.111 + *  When the driver goes DOWN then the controller will send no more
 105.112 + *  status-change notifications.
 105.113 + *  If the driver goes DOWN while interfaces are still UP, the domain
 105.114 + *  will automatically take the interfaces DOWN.
 105.115 + * 
 105.116 + *  NB. The controller should not send an INTERFACE_STATUS_CHANGED message
 105.117 + *  for interfaces that are active when it receives an UP notification. We
 105.118 + *  expect that the frontend driver will query those interfaces itself.
 105.119 + */
 105.120 +#define BLKIF_DRIVER_STATUS_DOWN   0
 105.121 +#define BLKIF_DRIVER_STATUS_UP     1
 105.122 +typedef struct {
 105.123 +    /* IN */
 105.124 +    u32 status;        /*  0: BLKIF_DRIVER_STATUS_??? */
 105.125 +    /* OUT */
 105.126 +    /* Driver should query interfaces [0..max_handle]. */
 105.127 +    u32 max_handle;    /*  4 */
 105.128 +} PACKED blkif_fe_driver_status_t; /* 8 bytes */
 105.129 +
 105.130 +/*
 105.131 + * CMSG_BLKIF_FE_INTERFACE_CONNECT:
 105.132 + *  If successful, the domain controller will acknowledge with a
 105.133 + *  STATUS_CONNECTED message.
 105.134 + */
 105.135 +typedef struct {
 105.136 +    u32      handle;      /*  0 */
 105.137 +    u32      __pad;
 105.138 +    memory_t shmem_frame; /*  8 */
 105.139 +    MEMORY_PADDING;
 105.140 +} PACKED blkif_fe_interface_connect_t; /* 16 bytes */
 105.141 +
 105.142 +/*
 105.143 + * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
 105.144 + *  If successful, the domain controller will acknowledge with a
 105.145 + *  STATUS_DISCONNECTED message.
 105.146 + */
 105.147 +typedef struct {
 105.148 +    u32 handle; /*  0 */
 105.149 +} PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
 105.150 +
 105.151 +/*
 105.152 + * CMSG_BLKIF_FE_INTERFACE_QUERY:
 105.153 + */
 105.154 +typedef struct {
 105.155 +    /* IN */
 105.156 +    u32 handle; /*  0 */
 105.157 +    /* OUT */
 105.158 +    u32 status; /*  4 */
 105.159 +    u16 evtchn; /*  8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
 105.160 +    domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
 105.161 +} PACKED blkif_fe_interface_query_t; /* 12 bytes */
 105.162 +
 105.163 +
 105.164 +/******************************************************************************
 105.165 + * BLOCK-INTERFACE BACKEND DEFINITIONS
 105.166 + */
 105.167 +
 105.168 +/* Messages from domain controller. */
 105.169 +#define CMSG_BLKIF_BE_CREATE      0  /* Create a new block-device interface. */
 105.170 +#define CMSG_BLKIF_BE_DESTROY     1  /* Destroy a block-device interface.    */
 105.171 +#define CMSG_BLKIF_BE_CONNECT     2  /* Connect i/f to remote driver.        */
 105.172 +#define CMSG_BLKIF_BE_DISCONNECT  3  /* Disconnect i/f from remote driver.   */
 105.173 +#define CMSG_BLKIF_BE_VBD_CREATE  4  /* Create a new VBD for an interface.   */
 105.174 +#define CMSG_BLKIF_BE_VBD_DESTROY 5  /* Delete a VBD from an interface.      */
 105.175 +#define CMSG_BLKIF_BE_VBD_GROW    6  /* Append an extent to a given VBD.     */
 105.176 +#define CMSG_BLKIF_BE_VBD_SHRINK  7  /* Remove last extent from a given VBD. */
 105.177 +
 105.178 +/* Messages to domain controller. */
 105.179 +#define CMSG_BLKIF_BE_DRIVER_STATUS 32
 105.180 +
 105.181 +/*
 105.182 + * Message request/response definitions for block-device messages.
 105.183 + */
 105.184 +
 105.185 +typedef struct {
 105.186 +    blkif_sector_t sector_start;   /*  0 */
 105.187 +    blkif_sector_t sector_length;  /*  8 */
 105.188 +    blkif_pdev_t   device;         /* 16 */
 105.189 +    u16            __pad;          /* 18 */
 105.190 +} PACKED blkif_extent_t; /* 20 bytes */
 105.191 +
 105.192 +/* Non-specific 'okay' return. */
 105.193 +#define BLKIF_BE_STATUS_OKAY                0
 105.194 +/* Non-specific 'error' return. */
 105.195 +#define BLKIF_BE_STATUS_ERROR               1
 105.196 +/* The following are specific error returns. */
 105.197 +#define BLKIF_BE_STATUS_INTERFACE_EXISTS    2
 105.198 +#define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
 105.199 +#define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
 105.200 +#define BLKIF_BE_STATUS_VBD_EXISTS          5
 105.201 +#define BLKIF_BE_STATUS_VBD_NOT_FOUND       6
 105.202 +#define BLKIF_BE_STATUS_OUT_OF_MEMORY       7
 105.203 +#define BLKIF_BE_STATUS_EXTENT_NOT_FOUND    8
 105.204 +#define BLKIF_BE_STATUS_MAPPING_ERROR       9
 105.205 +
 105.206 +/* This macro can be used to create an array of descriptive error strings. */
 105.207 +#define BLKIF_BE_STATUS_ERRORS {    \
 105.208 +    "Okay",                         \
 105.209 +    "Non-specific error",           \
 105.210 +    "Interface already exists",     \
 105.211 +    "Interface not found",          \
 105.212 +    "Interface is still connected", \
 105.213 +    "VBD already exists",           \
 105.214 +    "VBD not found",                \
 105.215 +    "Out of memory",                \
 105.216 +    "Extent not found for VBD",     \
 105.217 +    "Could not map domain memory" }
 105.218 +
 105.219 +/*
 105.220 + * CMSG_BLKIF_BE_CREATE:
 105.221 + *  When the driver sends a successful response then the interface is fully
 105.222 + *  created. The controller will send a DOWN notification to the front-end
 105.223 + *  driver.
 105.224 + */
 105.225 +typedef struct { 
 105.226 +    /* IN */
 105.227 +    domid_t    domid;         /*  0: Domain attached to new interface.   */
 105.228 +    u16        __pad;
 105.229 +    u32        blkif_handle;  /*  4: Domain-specific interface handle.   */
 105.230 +    /* OUT */
 105.231 +    u32        status;        /*  8 */
 105.232 +} PACKED blkif_be_create_t; /* 12 bytes */
 105.233 +
 105.234 +/*
 105.235 + * CMSG_BLKIF_BE_DESTROY:
 105.236 + *  When the driver sends a successful response then the interface is fully
 105.237 + *  torn down. The controller will send a DESTROYED notification to the
 105.238 + *  front-end driver.
 105.239 + */
 105.240 +typedef struct { 
 105.241 +    /* IN */
 105.242 +    domid_t    domid;         /*  0: Identify interface to be destroyed. */
 105.243 +    u16        __pad;
 105.244 +    u32        blkif_handle;  /*  4: ...ditto...                         */
 105.245 +    /* OUT */
 105.246 +    u32        status;        /*  8 */
 105.247 +} PACKED blkif_be_destroy_t; /* 12 bytes */
 105.248 +
 105.249 +/*
 105.250 + * CMSG_BLKIF_BE_CONNECT:
 105.251 + *  When the driver sends a successful response then the interface is fully
 105.252 + *  connected. The controller will send a CONNECTED notification to the
 105.253 + *  front-end driver.
 105.254 + */
 105.255 +typedef struct { 
 105.256 +    /* IN */
 105.257 +    domid_t    domid;         /*  0: Domain attached to new interface.   */
 105.258 +    u16        __pad;
 105.259 +    u32        blkif_handle;  /*  4: Domain-specific interface handle.   */
 105.260 +    memory_t   shmem_frame;   /*  8: Page cont. shared comms window.     */
 105.261 +    MEMORY_PADDING;
 105.262 +    u32        evtchn;        /* 16: Event channel for notifications.    */
 105.263 +    /* OUT */
 105.264 +    u32        status;        /* 20 */
 105.265 +} PACKED blkif_be_connect_t;  /* 24 bytes */
 105.266 +
 105.267 +/*
 105.268 + * CMSG_BLKIF_BE_DISCONNECT:
 105.269 + *  When the driver sends a successful response then the interface is fully
 105.270 + *  disconnected. The controller will send a DOWN notification to the front-end
 105.271 + *  driver.
 105.272 + */
 105.273 +typedef struct { 
 105.274 +    /* IN */
 105.275 +    domid_t    domid;         /*  0: Domain attached to new interface.   */
 105.276 +    u16        __pad;
 105.277 +    u32        blkif_handle;  /*  4: Domain-specific interface handle.   */
 105.278 +    /* OUT */
 105.279 +    u32        status;        /*  8 */
 105.280 +} PACKED blkif_be_disconnect_t; /* 12 bytes */
 105.281 +
 105.282 +/* CMSG_BLKIF_BE_VBD_CREATE */
 105.283 +typedef struct { 
 105.284 +    /* IN */
 105.285 +    domid_t    domid;         /*  0: Identify blkdev interface.          */
 105.286 +    u16        __pad;
 105.287 +    u32        blkif_handle;  /*  4: ...ditto...                         */
 105.288 +    blkif_vdev_t vdevice;     /*  8: Interface-specific id for this VBD. */
 105.289 +    u16        readonly;      /* 10: Non-zero -> VBD isn't writable.     */
 105.290 +    /* OUT */
 105.291 +    u32        status;        /* 12 */
 105.292 +} PACKED blkif_be_vbd_create_t; /* 16 bytes */
 105.293 +
 105.294 +/* CMSG_BLKIF_BE_VBD_DESTROY */
 105.295 +typedef struct {
 105.296 +    /* IN */
 105.297 +    domid_t    domid;         /*  0: Identify blkdev interface.          */
 105.298 +    u16        __pad0;        /*  2 */
 105.299 +    u32        blkif_handle;  /*  4: ...ditto...                         */
 105.300 +    blkif_vdev_t vdevice;     /*  8: Interface-specific id of the VBD.   */
 105.301 +    u16        __pad1;        /* 10 */
 105.302 +    /* OUT */
 105.303 +    u32        status;        /* 12 */
 105.304 +} PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
 105.305 +
 105.306 +/* CMSG_BLKIF_BE_VBD_GROW */
 105.307 +typedef struct { 
 105.308 +    /* IN */
 105.309 +    domid_t    domid;         /*  0: Identify blkdev interface.          */
 105.310 +    u16        __pad0;        /*  2 */
 105.311 +    u32        blkif_handle;  /*  4: ...ditto...                         */
 105.312 +    blkif_extent_t extent;    /*  8: Physical extent to append to VBD.   */
 105.313 +    blkif_vdev_t vdevice;     /* 28: Interface-specific id of the VBD.   */
 105.314 +    u16        __pad1;        /* 30 */
 105.315 +    /* OUT */
 105.316 +    u32        status;        /* 32 */
 105.317 +} PACKED blkif_be_vbd_grow_t; /* 36 bytes */
 105.318 +
 105.319 +/* CMSG_BLKIF_BE_VBD_SHRINK */
 105.320 +typedef struct { 
 105.321 +    /* IN */
 105.322 +    domid_t    domid;         /*  0: Identify blkdev interface.          */
 105.323 +    u16        __pad0;        /*  2 */
 105.324 +    u32        blkif_handle;  /*  4: ...ditto...                         */
 105.325 +    blkif_vdev_t vdevice;     /*  8: Interface-specific id of the VBD.   */
 105.326 +    u16        __pad1;        /* 10 */
 105.327 +    /* OUT */
 105.328 +    u32        status;        /* 12 */
 105.329 +} PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
 105.330 +
 105.331 +/*
 105.332 + * CMSG_BLKIF_BE_DRIVER_STATUS:
 105.333 + *  Notify the domain controller that the back-end driver is DOWN or UP.
 105.334 + *  If the driver goes DOWN while interfaces are still UP, the controller
 105.335 + *  will automatically send DOWN notifications.
 105.336 + */
 105.337 +typedef struct {
 105.338 +    u32        status;        /*  0: BLKIF_DRIVER_STATUS_??? */
 105.339 +} PACKED blkif_be_driver_status_t; /* 4 bytes */
 105.340 +
 105.341 +
 105.342 +/******************************************************************************
 105.343 + * NETWORK-INTERFACE FRONTEND DEFINITIONS
 105.344 + */
 105.345 +
 105.346 +/* Messages from domain controller to guest. */
 105.347 +#define CMSG_NETIF_FE_INTERFACE_STATUS   0
 105.348 +
 105.349 +/* Messages from guest to domain controller. */
 105.350 +#define CMSG_NETIF_FE_DRIVER_STATUS             32
 105.351 +#define CMSG_NETIF_FE_INTERFACE_CONNECT         33
 105.352 +#define CMSG_NETIF_FE_INTERFACE_DISCONNECT      34
 105.353 +#define CMSG_NETIF_FE_INTERFACE_QUERY           35
 105.354 +
 105.355 +/*
 105.356 + * CMSG_NETIF_FE_INTERFACE_STATUS:
 105.357 + *  Notify a guest about a status change on one of its network interfaces.
 105.358 + *  If the interface is CLOSED or DOWN then the interface is disconnected:
 105.359 + *   1. The shared-memory frame is available for reuse.
 105.360 + *   2. Any unacknowledged messgaes pending on the interface were dropped.
 105.361 + */
 105.362 +#define NETIF_INTERFACE_STATUS_CLOSED       0 /* Interface doesn't exist.    */
 105.363 +#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
 105.364 +#define NETIF_INTERFACE_STATUS_CONNECTED    2 /* Exists and is connected.    */
 105.365 +#define NETIF_INTERFACE_STATUS_CHANGED      3 /* A device has been added or removed. */
 105.366 +typedef struct {
 105.367 +    u32        handle; /*  0 */
 105.368 +    u32        status; /*  4 */
 105.369 +    u16        evtchn; /*  8: status == NETIF_INTERFACE_STATUS_CONNECTED */
 105.370 +    u8         mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
 105.371 +    domid_t    domid;  /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
 105.372 +} PACKED netif_fe_interface_status_t; /* 18 bytes */
 105.373 +
 105.374 +/*
 105.375 + * CMSG_NETIF_FE_DRIVER_STATUS:
 105.376 + *  Notify the domain controller that the front-end driver is DOWN or UP.
 105.377 + *  When the driver goes DOWN then the controller will send no more
 105.378 + *  status-change notifications.
 105.379 + *  If the driver goes DOWN while interfaces are still UP, the domain
 105.380 + *  will automatically take the interfaces DOWN.
 105.381 + * 
 105.382 + *  NB. The controller should not send an INTERFACE_STATUS message
 105.383 + *  for interfaces that are active when it receives an UP notification. We
 105.384 + *  expect that the frontend driver will query those interfaces itself.
 105.385 + */
 105.386 +#define NETIF_DRIVER_STATUS_DOWN   0
 105.387 +#define NETIF_DRIVER_STATUS_UP     1
 105.388 +typedef struct {
 105.389 +    /* IN */
 105.390 +    u32        status;        /*  0: NETIF_DRIVER_STATUS_??? */
 105.391 +    /* OUT */
 105.392 +    /* Driver should query interfaces [0..max_handle]. */
 105.393 +    u32        max_handle;    /*  4 */
 105.394 +} PACKED netif_fe_driver_status_t; /* 8 bytes */
 105.395 +
 105.396 +/*
 105.397 + * CMSG_NETIF_FE_INTERFACE_CONNECT:
 105.398 + *  If successful, the domain controller will acknowledge with a
 105.399 + *  STATUS_CONNECTED message.
 105.400 + */
 105.401 +typedef struct {
 105.402 +    u32        handle;         /*  0 */
 105.403 +    u32        __pad;          /*  4 */
 105.404 +    memory_t   tx_shmem_frame; /*  8 */
 105.405 +    MEMORY_PADDING;
 105.406 +    memory_t   rx_shmem_frame; /* 16 */
 105.407 +    MEMORY_PADDING;
 105.408 +} PACKED netif_fe_interface_connect_t; /* 24 bytes */
 105.409 +
 105.410 +/*
 105.411 + * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
 105.412 + *  If successful, the domain controller will acknowledge with a
 105.413 + *  STATUS_DISCONNECTED message.
 105.414 + */
 105.415 +typedef struct {
 105.416 +    u32        handle;        /*  0 */
 105.417 +} PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
 105.418 +
 105.419 +/*
 105.420 + * CMSG_NETIF_FE_INTERFACE_QUERY:
 105.421 + */
 105.422 +typedef struct {
 105.423 +    /* IN */
 105.424 +    u32        handle; /*  0 */
 105.425 +    /* OUT */
 105.426 +    u32        status; /*  4 */
 105.427 +    u16        evtchn; /*  8: status == NETIF_INTERFACE_STATUS_CONNECTED */
 105.428 +    u8         mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
 105.429 +    domid_t    domid;  /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
 105.430 +} PACKED netif_fe_interface_query_t; /* 18 bytes */
 105.431 +
 105.432 +
 105.433 +/******************************************************************************
 105.434 + * NETWORK-INTERFACE BACKEND DEFINITIONS
 105.435 + */
 105.436 +
 105.437 +/* Messages from domain controller. */
 105.438 +#define CMSG_NETIF_BE_CREATE      0  /* Create a new net-device interface. */
 105.439 +#define CMSG_NETIF_BE_DESTROY     1  /* Destroy a net-device interface.    */
 105.440 +#define CMSG_NETIF_BE_CONNECT     2  /* Connect i/f to remote driver.        */
 105.441 +#define CMSG_NETIF_BE_DISCONNECT  3  /* Disconnect i/f from remote driver.   */
 105.442 +
 105.443 +/* Messages to domain controller. */
 105.444 +#define CMSG_NETIF_BE_DRIVER_STATUS 32
 105.445 +
 105.446 +/*
 105.447 + * Message request/response definitions for net-device messages.
 105.448 + */
 105.449 +
 105.450 +/* Non-specific 'okay' return. */
 105.451 +#define NETIF_BE_STATUS_OKAY                0
 105.452 +/* Non-specific 'error' return. */
 105.453 +#define NETIF_BE_STATUS_ERROR               1
 105.454 +/* The following are specific error returns. */
 105.455 +#define NETIF_BE_STATUS_INTERFACE_EXISTS    2
 105.456 +#define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
 105.457 +#define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
 105.458 +#define NETIF_BE_STATUS_OUT_OF_MEMORY       5
 105.459 +#define NETIF_BE_STATUS_MAPPING_ERROR       6
 105.460 +
 105.461 +/* This macro can be used to create an array of descriptive error strings. */
 105.462 +#define NETIF_BE_STATUS_ERRORS {    \
 105.463 +    "Okay",                         \
 105.464 +    "Non-specific error",           \
 105.465 +    "Interface already exists",     \
 105.466 +    "Interface not found",          \
 105.467 +    "Interface is still connected", \
 105.468 +    "Out of memory",                \
 105.469 +    "Could not map domain memory" }
 105.470 +
 105.471 +/*
 105.472 + * CMSG_NETIF_BE_CREATE:
 105.473 + *  When the driver sends a successful response then the interface is fully
 105.474 + *  created. The controller will send a DOWN notification to the front-end
 105.475 + *  driver.
 105.476 + */
 105.477 +typedef struct { 
 105.478 +    /* IN */
 105.479 +    domid_t    domid;         /*  0: Domain attached to new interface.   */
 105.480 +    u16        __pad0;        /*  2 */
 105.481 +    u32        netif_handle;  /*  4: Domain-specific interface handle.   */
 105.482 +    u8         mac[6];        /*  8 */
 105.483 +    u16        __pad1;        /* 14 */
 105.484 +    /* OUT */
 105.485 +    u32        status;        /* 16 */
 105.486 +} PACKED netif_be_create_t; /* 20 bytes */
 105.487 +
 105.488 +/*
 105.489 + * CMSG_NETIF_BE_DESTROY:
 105.490 + *  When the driver sends a successful response then the interface is fully
 105.491 + *  torn down. The controller will send a DESTROYED notification to the
 105.492 + *  front-end driver.
 105.493 + */
 105.494 +typedef struct { 
 105.495 +    /* IN */
 105.496 +    domid_t    domid;         /*  0: Identify interface to be destroyed. */
 105.497 +    u16        __pad;
 105.498 +    u32        netif_handle;  /*  4: ...ditto...                         */
 105.499 +    /* OUT */
 105.500 +    u32   status;             /*  8 */
 105.501 +} PACKED netif_be_destroy_t; /* 12 bytes */
 105.502 +
 105.503 +/*
 105.504 + * CMSG_NETIF_BE_CONNECT:
 105.505 + *  When the driver sends a successful response then the interface is fully
 105.506 + *  connected. The controller will send a CONNECTED notification to the
 105.507 + *  front-end driver.
 105.508 + */
 105.509 +typedef struct { 
 105.510 +    /* IN */
 105.511 +    domid_t    domid;          /*  0: Domain attached to new interface.   */
 105.512 +    u16        __pad0;         /*  2 */
 105.513 +    u32        netif_handle;   /*  4: Domain-specific interface handle.   */
 105.514 +    memory_t   tx_shmem_frame; /*  8: Page cont. tx shared comms window.  */
 105.515 +    MEMORY_PADDING;
 105.516 +    memory_t   rx_shmem_frame; /* 16: Page cont. rx shared comms window.  */
 105.517 +    MEMORY_PADDING;
 105.518 +    u16        evtchn;         /* 24: Event channel for notifications.    */
 105.519 +    u16        __pad1;         /* 26 */
 105.520 +    /* OUT */
 105.521 +    u32        status;         /* 28 */
 105.522 +} PACKED netif_be_connect_t; /* 32 bytes */
 105.523 +
 105.524 +/*
 105.525 + * CMSG_NETIF_BE_DISCONNECT:
 105.526 + *  When the driver sends a successful response then the interface is fully
 105.527 + *  disconnected. The controller will send a DOWN notification to the front-end
 105.528 + *  driver.
 105.529 + */
 105.530 +typedef struct { 
 105.531 +    /* IN */
 105.532 +    domid_t    domid;         /*  0: Domain attached to new interface.   */
 105.533 +    u16        __pad;
 105.534 +    u32        netif_handle;  /*  4: Domain-specific interface handle.   */
 105.535 +    /* OUT */
 105.536 +    u32        status;        /*  8 */
 105.537 +} PACKED netif_be_disconnect_t; /* 12 bytes */
 105.538 +
 105.539 +/*
 105.540 + * CMSG_NETIF_BE_DRIVER_STATUS:
 105.541 + *  Notify the domain controller that the back-end driver is DOWN or UP.
 105.542 + *  If the driver goes DOWN while interfaces are still UP, the domain
 105.543 + *  will automatically send DOWN notifications.
 105.544 + */
 105.545 +typedef struct {
 105.546 +    u32        status;        /*  0: NETIF_DRIVER_STATUS_??? */
 105.547 +} PACKED netif_be_driver_status_t; /* 4 bytes */
 105.548 +
 105.549 +
 105.550 +/******************************************************************************
 105.551 + * SHUTDOWN DEFINITIONS
 105.552 + */
 105.553 +
 105.554 +/*
 105.555 + * Subtypes for shutdown messages.
 105.556 + */
 105.557 +#define CMSG_SHUTDOWN_POWEROFF  0   /* Clean shutdown (SHUTDOWN_poweroff).   */
 105.558 +#define CMSG_SHUTDOWN_REBOOT    1   /* Clean shutdown (SHUTDOWN_reboot).     */
 105.559 +#define CMSG_SHUTDOWN_SUSPEND   2   /* Create suspend info, then             */
 105.560 +                                    /* SHUTDOWN_suspend.                     */
 105.561 +
 105.562 +
 105.563 +/******************************************************************************
 105.564 + * MEMORY CONTROLS
 105.565 + */
 105.566 +
 105.567 +#define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
 105.568 +
 105.569 +/*
 105.570 + * CMSG_MEM_REQUEST:
 105.571 + *  Request that the domain change its memory reservation.
 105.572 + */
 105.573 +typedef struct {
 105.574 +    /* OUT */
 105.575 +    u32 target;       /* 0: Target memory reservation in pages.       */
 105.576 +    /* IN  */
 105.577 +    u32 status;       /* 4: Return code indicates success or failure. */
 105.578 +} PACKED mem_request_t; /* 8 bytes */
 105.579 +
 105.580 +
 105.581 +#endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/xen/include/public/io/netif.h	Mon Nov 01 00:18:29 2004 +0000
   106.3 @@ -0,0 +1,92 @@
   106.4 +/******************************************************************************
   106.5 + * netif.h
   106.6 + * 
   106.7 + * Unified network-device I/O interface for Xen guest OSes.
   106.8 + * 
   106.9 + * Copyright (c) 2003-2004, Keir Fraser
  106.10 + */
  106.11 +
  106.12 +#ifndef __XEN_PUBLIC_IO_NETIF_H__
  106.13 +#define __XEN_PUBLIC_IO_NETIF_H__
  106.14 +
  106.15 +typedef struct {
  106.16 +    memory_t addr;   /*  0: Machine address of packet.  */
  106.17 +    MEMORY_PADDING;
  106.18 +    u16      id;     /*  8: Echoed in response message. */
  106.19 +    u16      size;   /* 10: Packet size in bytes.       */
  106.20 +} PACKED netif_tx_request_t; /* 12 bytes */
  106.21 +
  106.22 +typedef struct {
  106.23 +    u16      id;     /*  0 */
  106.24 +    s8       status; /*  2 */
  106.25 +    u8       __pad;  /*  3 */
  106.26 +} PACKED netif_tx_response_t; /* 4 bytes */
  106.27 +
  106.28 +typedef struct {
  106.29 +    u16       id;    /*  0: Echoed in response message.        */
  106.30 +} PACKED netif_rx_request_t; /* 2 bytes */
  106.31 +
  106.32 +typedef struct {
  106.33 +    memory_t addr;   /*  0: Machine address of packet.              */
  106.34 +    MEMORY_PADDING;
  106.35 +    u16      id;     /*  8:  */
  106.36 +    s16      status; /* 10: -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
  106.37 +} PACKED netif_rx_response_t; /* 12 bytes */
  106.38 +
  106.39 +/*
  106.40 + * We use a special capitalised type name because it is _essential_ that all 
  106.41 + * arithmetic on indexes is done on an integer type of the correct size.
  106.42 + */
  106.43 +typedef u32 NETIF_RING_IDX;
  106.44 +
  106.45 +/*
  106.46 + * Ring indexes are 'free running'. That is, they are not stored modulo the
  106.47 + * size of the ring buffer. The following macros convert a free-running counter
  106.48 + * into a value that can directly index a ring-buffer array.
  106.49 + */
  106.50 +#define MASK_NETIF_RX_IDX(_i) ((_i)&(NETIF_RX_RING_SIZE-1))
  106.51 +#define MASK_NETIF_TX_IDX(_i) ((_i)&(NETIF_TX_RING_SIZE-1))
  106.52 +
  106.53 +#define NETIF_TX_RING_SIZE 256
  106.54 +#define NETIF_RX_RING_SIZE 256
  106.55 +
  106.56 +/* This structure must fit in a memory page. */
  106.57 +typedef struct {
  106.58 +    /*
  106.59 +     * Frontend places packets into ring at tx_req_prod.
  106.60 +     * Frontend receives event when tx_resp_prod passes tx_event.
  106.61 +     * 'req_cons' is a shadow of the backend's request consumer -- the frontend
  106.62 +     * may use it to determine if all queued packets have been seen by the
  106.63 +     * backend.
  106.64 +     */
  106.65 +    NETIF_RING_IDX req_prod;       /*  0 */
  106.66 +    NETIF_RING_IDX req_cons;       /*  4 */
  106.67 +    NETIF_RING_IDX resp_prod;      /*  8 */
  106.68 +    NETIF_RING_IDX event;          /* 12 */
  106.69 +    union {                        /* 16 */
  106.70 +        netif_tx_request_t  req;
  106.71 +        netif_tx_response_t resp;
  106.72 +    } PACKED ring[NETIF_TX_RING_SIZE];
  106.73 +} PACKED netif_tx_interface_t;
  106.74 +
  106.75 +/* This structure must fit in a memory page. */
  106.76 +typedef struct {
  106.77 +    /*
  106.78 +     * Frontend places empty buffers into ring at rx_req_prod.
  106.79 +     * Frontend receives event when rx_resp_prod passes rx_event.
  106.80 +     */
  106.81 +    NETIF_RING_IDX req_prod;       /*  0 */
  106.82 +    NETIF_RING_IDX resp_prod;      /*  4 */
  106.83 +    NETIF_RING_IDX event;          /*  8 */
  106.84 +    union {                        /* 12 */
  106.85 +        netif_rx_request_t  req;
  106.86 +        netif_rx_response_t resp;
  106.87 +    } PACKED ring[NETIF_RX_RING_SIZE];
  106.88 +} PACKED netif_rx_interface_t;
  106.89 +
  106.90 +/* Descriptor status values */
  106.91 +#define NETIF_RSP_DROPPED         -2
  106.92 +#define NETIF_RSP_ERROR           -1
  106.93 +#define NETIF_RSP_OKAY             0
  106.94 +
  106.95 +#endif
   107.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.2 +++ b/xen/include/public/physdev.h	Mon Nov 01 00:18:29 2004 +0000
   107.3 @@ -0,0 +1,80 @@
   107.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
   107.5 + ****************************************************************************
   107.6 + * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
   107.7 + * (c) 2004 - Keir Fraser - University of Cambridge
   107.8 + ****************************************************************************
   107.9 + * Description: Interface for domains to access physical devices on the PCI bus
  107.10 + */
  107.11 +
  107.12 +#ifndef __XEN_PUBLIC_PHYSDEV_H__
  107.13 +#define __XEN_PUBLIC_PHYSDEV_H__
  107.14 +
  107.15 +/* Commands to HYPERVISOR_physdev_op() */
  107.16 +#define PHYSDEVOP_PCI_CFGREG_READ       0
  107.17 +#define PHYSDEVOP_PCI_CFGREG_WRITE      1
  107.18 +#define PHYSDEVOP_PCI_INITIALISE_DEVICE 2
  107.19 +#define PHYSDEVOP_PCI_PROBE_ROOT_BUSES  3
  107.20 +#define PHYSDEVOP_IRQ_UNMASK_NOTIFY     4
  107.21 +#define PHYSDEVOP_IRQ_STATUS_QUERY      5
  107.22 +
  107.23 +/* Read from PCI configuration space. */
  107.24 +typedef struct {
  107.25 +    /* IN */
  107.26 +    u32 bus;                          /*  0 */
  107.27 +    u32 dev;                          /*  4 */
  107.28 +    u32 func;                         /*  8 */
  107.29 +    u32 reg;                          /* 12 */
  107.30 +    u32 len;                          /* 16 */
  107.31 +    /* OUT */
  107.32 +    u32 value;                        /* 20 */
  107.33 +} PACKED physdevop_pci_cfgreg_read_t; /* 24 bytes */
  107.34 +
  107.35 +/* Write to PCI configuration space. */
  107.36 +typedef struct {
  107.37 +    /* IN */
  107.38 +    u32 bus;                          /*  0 */
  107.39 +    u32 dev;                          /*  4 */
  107.40 +    u32 func;                         /*  8 */
  107.41 +    u32 reg;                          /* 12 */
  107.42 +    u32 len;                          /* 16 */
  107.43 +    u32 value;                        /* 20 */
  107.44 +} PACKED physdevop_pci_cfgreg_write_t; /* 24 bytes */
  107.45 +
  107.46 +/* Do final initialisation of a PCI device (e.g., last-moment IRQ routing). */
  107.47 +typedef struct {
  107.48 +    /* IN */
  107.49 +    u32 bus;                          /*  0 */
  107.50 +    u32 dev;                          /*  4 */
  107.51 +    u32 func;                         /*  8 */
  107.52 +} PACKED physdevop_pci_initialise_device_t; /* 12 bytes */
  107.53 +
  107.54 +/* Find the root buses for subsequent scanning. */
  107.55 +typedef struct {
  107.56 +    /* OUT */
  107.57 +    u32 busmask[256/32];              /*  0 */
  107.58 +} PACKED physdevop_pci_probe_root_buses_t; /* 32 bytes */
  107.59 +
  107.60 +typedef struct {
  107.61 +    /* IN */
  107.62 +    u32 irq;                          /*  0 */
  107.63 +    /* OUT */
  107.64 +/* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
  107.65 +#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
  107.66 +    u32 flags;                        /*  4 */
  107.67 +} PACKED physdevop_irq_status_query_t; /* 8 bytes */
  107.68 +
  107.69 +typedef struct _physdev_op_st 
  107.70 +{
  107.71 +    u32 cmd;                          /*  0 */
  107.72 +    u32 __pad;                        /*  4 */
  107.73 +    union {                           /*  8 */
  107.74 +        physdevop_pci_cfgreg_read_t       pci_cfgreg_read;
  107.75 +        physdevop_pci_cfgreg_write_t      pci_cfgreg_write;
  107.76 +        physdevop_pci_initialise_device_t pci_initialise_device;
  107.77 +        physdevop_pci_probe_root_buses_t  pci_probe_root_buses;
  107.78 +        physdevop_irq_status_query_t      irq_status_query;
  107.79 +        u8                                __dummy[32];
  107.80 +    } PACKED u;
  107.81 +} PACKED physdev_op_t; /* 40 bytes */
  107.82 +
  107.83 +#endif /* __XEN_PUBLIC_PHYSDEV_H__ */
   108.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.2 +++ b/xen/include/public/sched_ctl.h	Mon Nov 01 00:18:29 2004 +0000
   108.3 @@ -0,0 +1,70 @@
   108.4 +/**
   108.5 + * Generic scheduler control interface.
   108.6 + *
   108.7 + * Mark Williamson, (C) 2004 Intel Research Cambridge
   108.8 + */
   108.9 +
  108.10 +#ifndef __XEN_PUBLIC_SCHED_CTL_H__
  108.11 +#define __XEN_PUBLIC_SCHED_CTL_H__
  108.12 +
  108.13 +/* Scheduler types */
  108.14 +#define SCHED_BVT      0
  108.15 +#define SCHED_ATROPOS  2
  108.16 +#define SCHED_RROBIN   3
  108.17 +
  108.18 +/* these describe the intended direction used for a scheduler control or domain
  108.19 + * command */
  108.20 +#define SCHED_INFO_PUT 0
  108.21 +#define SCHED_INFO_GET 1
  108.22 +
  108.23 +/*
  108.24 + * Generic scheduler control command - used to adjust system-wide scheduler
  108.25 + * parameters
  108.26 + */
  108.27 +struct sched_ctl_cmd
  108.28 +{
  108.29 +    u32 sched_id;                     /*  0 */
  108.30 +    u32 direction;                    /*  4 */
  108.31 +    union {                           /*  8 */
  108.32 +        struct bvt_ctl
  108.33 +        {
  108.34 +            /* IN variables. */
  108.35 +            u32 ctx_allow;            /*  8: context switch allowance */
  108.36 +        } PACKED bvt;
  108.37 +
  108.38 +        struct rrobin_ctl
  108.39 +        {
  108.40 +            /* IN variables */
  108.41 +            u64 slice;                /*  8: round robin time slice */
  108.42 +        } PACKED rrobin;
  108.43 +    } PACKED u;
  108.44 +} PACKED; /* 16 bytes */
  108.45 +
  108.46 +struct sched_adjdom_cmd
  108.47 +{
  108.48 +    u32     sched_id;                 /*  0 */
  108.49 +    u32     direction;                /*  4 */
  108.50 +    domid_t domain;                   /*  8 */
  108.51 +    u16     __pad0;
  108.52 +    u32     __pad1;
  108.53 +    union {                           /* 16 */
  108.54 +        struct bvt_adjdom
  108.55 +        {
  108.56 +            u32 mcu_adv;            /* 16: mcu advance: inverse of weight */
  108.57 +            u32 warpback;           /* 20: warp? */
  108.58 +            s32 warpvalue;          /* 24: warp value */
  108.59 +            long long warpl;        /* 32: warp limit */
  108.60 +            long long warpu;        /* 40: unwarp time requirement */
  108.61 +        } PACKED bvt;
  108.62 +
  108.63 +        struct atropos_adjdom
  108.64 +        {
  108.65 +            u64 nat_period; /* 16 */
  108.66 +            u64 nat_slice;  /* 24 */
  108.67 +            u64 latency;    /* 32 */
  108.68 +            u32 xtratime;   /* 36 */
  108.69 +        } PACKED atropos;
  108.70 +    } PACKED u;
  108.71 +} PACKED; /* 40 bytes */
  108.72 +
  108.73 +#endif /* __XEN_PUBLIC_SCHED_CTL_H__ */
   109.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.2 +++ b/xen/include/public/trace.h	Mon Nov 01 00:18:29 2004 +0000
   109.3 @@ -0,0 +1,31 @@
   109.4 +/******************************************************************************
   109.5 + * trace.h
   109.6 + */
   109.7 +
   109.8 +#ifndef __XEN_PUBLIC_TRACE_H__
   109.9 +#define __XEN_PUBLIC_TRACE_H__
  109.10 +
  109.11 +/* This structure represents a single trace buffer record. */
  109.12 +struct t_rec {
  109.13 +    u64 cycles;               /* 64 bit cycle counter timestamp */
  109.14 +    u32 event;                /* 32 bit event ID                */
  109.15 +    u32 d1, d2, d3, d4, d5;   /* event data items               */
  109.16 +};
  109.17 +
  109.18 +/*
  109.19 + * This structure contains the metadata for a single trace buffer.  The head
  109.20 + * field, indexes into an array of struct t_rec's.
  109.21 + */
  109.22 +struct t_buf {
  109.23 +    unsigned long data;      /* pointer to data area.  machine address
  109.24 +                              * for convenience in user space code           */
  109.25 +
  109.26 +    unsigned long size;      /* size of the data area, in t_recs             */
  109.27 +    unsigned long head;      /* array index of the most recent record        */
  109.28 +
  109.29 +    /* Xen-private elements follow... */
  109.30 +    struct t_rec *head_ptr; /* pointer to the head record                    */
  109.31 +    struct t_rec *vdata;    /* virtual address pointer to data               */
  109.32 +};
  109.33 +
  109.34 +#endif /* __XEN_PUBLIC_TRACE_H__ */
   110.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.2 +++ b/xen/include/public/xen.h	Mon Nov 01 00:18:29 2004 +0000
   110.3 @@ -0,0 +1,425 @@
   110.4 +/******************************************************************************
   110.5 + * xen.h
   110.6 + * 
   110.7 + * Guest OS interface to Xen.
   110.8 + * 
   110.9 + * Copyright (c) 2004, K A Fraser
  110.10 + */
  110.11 +
  110.12 +#ifndef __XEN_PUBLIC_XEN_H__
  110.13 +#define __XEN_PUBLIC_XEN_H__
  110.14 +
  110.15 +/* GCC-specific way to pack structure definitions (no implicit padding). */
  110.16 +#define PACKED __attribute__ ((packed))
  110.17 +
  110.18 +#if defined(__i386__)
  110.19 +#include "arch-x86_32.h"
  110.20 +#elif defined(__x86_64__)
  110.21 +#include "arch-x86_64.h"
  110.22 +#else
  110.23 +#error "Unsupported architecture"
  110.24 +#endif
  110.25 +
  110.26 +/*
  110.27 + * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
  110.28 + */
  110.29 +
  110.30 +/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
  110.31 +#define __HYPERVISOR_set_trap_table        0
  110.32 +#define __HYPERVISOR_mmu_update            1
  110.33 +#define __HYPERVISOR_set_gdt               2
  110.34 +#define __HYPERVISOR_stack_switch          3
  110.35 +#define __HYPERVISOR_set_callbacks         4
  110.36 +#define __HYPERVISOR_fpu_taskswitch        5
  110.37 +#define __HYPERVISOR_sched_op              6
  110.38 +#define __HYPERVISOR_dom0_op               7
  110.39 +#define __HYPERVISOR_set_debugreg          8
  110.40 +#define __HYPERVISOR_get_debugreg          9
  110.41 +#define __HYPERVISOR_update_descriptor    10
  110.42 +#define __HYPERVISOR_set_fast_trap        11
  110.43 +#define __HYPERVISOR_dom_mem_op           12
  110.44 +#define __HYPERVISOR_multicall            13
  110.45 +#define __HYPERVISOR_update_va_mapping    14
  110.46 +#define __HYPERVISOR_set_timer_op         15
  110.47 +#define __HYPERVISOR_event_channel_op     16
  110.48 +#define __HYPERVISOR_xen_version          17
  110.49 +#define __HYPERVISOR_console_io           18
  110.50 +#define __HYPERVISOR_physdev_op           19
  110.51 +#define __HYPERVISOR_grant_table_op       20
  110.52 +#define __HYPERVISOR_vm_assist            21
  110.53 +#define __HYPERVISOR_update_va_mapping_otherdomain 22
  110.54 +
  110.55 +/*
  110.56 + * MULTICALLS
  110.57 + * 
  110.58 + * Multicalls are listed in an array, with each element being a fixed size 
  110.59 + * (BYTES_PER_MULTICALL_ENTRY). Each is of the form (op, arg1, ..., argN)
  110.60 + * where each element of the tuple is a machine word. 
  110.61 + */
  110.62 +#define ARGS_PER_MULTICALL_ENTRY 8
  110.63 +
  110.64 +
  110.65 +/* 
  110.66 + * VIRTUAL INTERRUPTS
  110.67 + * 
  110.68 + * Virtual interrupts that a guest OS may receive from Xen.
  110.69 + */
  110.70 +#define VIRQ_MISDIRECT  0  /* Catch-all interrupt for unbound VIRQs.      */
  110.71 +#define VIRQ_TIMER      1  /* Timebase update, and/or requested timeout.  */
  110.72 +#define VIRQ_DEBUG      2  /* Request guest to dump debug info.           */
  110.73 +#define VIRQ_CONSOLE    3  /* (DOM0) bytes received on emergency console. */
  110.74 +#define VIRQ_DOM_EXC    4  /* (DOM0) Exceptional event for some domain.   */
  110.75 +#define VIRQ_PARITY_ERR 5  /* (DOM0) NMI parity error.                    */
  110.76 +#define VIRQ_IO_ERR     6  /* (DOM0) NMI I/O error.                       */
  110.77 +#define NR_VIRQS        7
  110.78 +
  110.79 +/*
  110.80 + * MMU-UPDATE REQUESTS
  110.81 + * 
  110.82 + * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
  110.83 + * ptr[1:0] specifies the appropriate MMU_* command.
  110.84 + * 
  110.85 + * FOREIGN DOMAIN (FD)
  110.86 + * -------------------
  110.87 + *  Some commands recognise an explicitly-declared foreign domain,
  110.88 + *  in which case they will operate with respect to the foreigner rather than
  110.89 + *  the calling domain. Where the FD has some effect, it is described below.
  110.90 + * 
  110.91 + * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
  110.92 + * Updates an entry in a page table. If updating an L1 table, and the new
  110.93 + * table entry is valid/present, the mapped frame must belong to the FD, if
  110.94 + * an FD has been specified. If attempting to map an I/O page then the
  110.95 + * caller assumes the privilege of the FD.
  110.96 + * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
  110.97 + * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
  110.98 + * ptr[:2]  -- Machine address of the page-table entry to modify.
  110.99 + * val      -- Value to write.
 110.100 + * 
 110.101 + * ptr[1:0] == MMU_MACHPHYS_UPDATE:
 110.102 + * Updates an entry in the machine->pseudo-physical mapping table.
 110.103 + * ptr[:2]  -- Machine address within the frame whose mapping to modify.
 110.104 + *             The frame must belong to the FD, if one is specified.
 110.105 + * val      -- Value to write into the mapping entry.
 110.106 + *  
 110.107 + * ptr[1:0] == MMU_EXTENDED_COMMAND:
 110.108 + * val[7:0] -- MMUEXT_* command.
 110.109 + * 
 110.110 + *   val[7:0] == MMUEXT_(UN)PIN_*_TABLE:
 110.111 + *   ptr[:2]  -- Machine address of frame to be (un)pinned as a p.t. page.
 110.112 + *               The frame must belong to the FD, if one is specified.
 110.113 + * 
 110.114 + *   val[7:0] == MMUEXT_NEW_BASEPTR:
 110.115 + *   ptr[:2]  -- Machine address of new page-table base to install in MMU.
 110.116 + * 
 110.117 + *   val[7:0] == MMUEXT_TLB_FLUSH:
 110.118 + *   No additional arguments.
 110.119 + * 
 110.120 + *   val[7:0] == MMUEXT_INVLPG:
 110.121 + *   ptr[:2]  -- Linear address to be flushed from the TLB.
 110.122 + * 
 110.123 + *   val[7:0] == MMUEXT_FLUSH_CACHE:
 110.124 + *   No additional arguments. Writes back and flushes cache contents.
 110.125 + * 
 110.126 + *   val[7:0] == MMUEXT_SET_LDT:
 110.127 + *   ptr[:2]  -- Linear address of LDT base (NB. must be page-aligned).
 110.128 + *   val[:8]  -- Number of entries in LDT.
 110.129 + * 
 110.130 + *   val[7:0] == MMUEXT_TRANSFER_PAGE:
 110.131 + *   val[31:16] -- Domain to whom page is to be transferred.
 110.132 + *   (val[15:8],ptr[9:2]) -- 16-bit reference into transferee's grant table.
 110.133 + *   ptr[:12]  -- Page frame to be reassigned to the FD.
 110.134 + *                (NB. The frame must currently belong to the calling domain).
 110.135 + * 
 110.136 + *   val[7:0] == MMUEXT_SET_FOREIGNDOM:
 110.137 + *   val[31:16] -- Domain to set as the Foreign Domain (FD).
 110.138 + *                 (NB. DOMID_SELF is not recognised)
 110.139 + *                 If FD != DOMID_IO then the caller must be privileged.
 110.140 + * 
 110.141 + *   val[7:0] == MMUEXT_CLEAR_FOREIGNDOM:
 110.142 + *   Clears the FD.
 110.143 + * 
 110.144 + *   val[7:0] == MMUEXT_REASSIGN_PAGE:
 110.145 + *   ptr[:2]  -- A machine address within the page to be reassigned to the FD.
 110.146 + *               (NB. page must currently belong to the calling domain).
 110.147 + */
 110.148 +#define MMU_NORMAL_PT_UPDATE     0 /* checked '*ptr = val'. ptr is MA.       */
 110.149 +#define MMU_MACHPHYS_UPDATE      2 /* ptr = MA of frame to modify entry for  */
 110.150 +#define MMU_EXTENDED_COMMAND     3 /* least 8 bits of val demux further      */
 110.151 +#define MMUEXT_PIN_L1_TABLE      0 /* ptr = MA of frame to pin               */
 110.152 +#define MMUEXT_PIN_L2_TABLE      1 /* ptr = MA of frame to pin               */
 110.153 +#define MMUEXT_PIN_L3_TABLE      2 /* ptr = MA of frame to pin               */
 110.154 +#define MMUEXT_PIN_L4_TABLE      3 /* ptr = MA of frame to pin               */
 110.155 +#define MMUEXT_UNPIN_TABLE       4 /* ptr = MA of frame to unpin             */
 110.156 +#define MMUEXT_NEW_BASEPTR       5 /* ptr = MA of new pagetable base         */
 110.157 +#define MMUEXT_TLB_FLUSH         6 /* ptr = NULL                             */
 110.158 +#define MMUEXT_INVLPG            7 /* ptr = VA to invalidate                 */
 110.159 +#define MMUEXT_FLUSH_CACHE       8
 110.160 +#define MMUEXT_SET_LDT           9 /* ptr = VA of table; val = # entries     */
 110.161 +#define MMUEXT_SET_FOREIGNDOM   10 /* val[31:16] = dom                       */
 110.162 +#define MMUEXT_CLEAR_FOREIGNDOM 11
 110.163 +#define MMUEXT_TRANSFER_PAGE    12 /* ptr = MA of frame; val[31:16] = dom    */
 110.164 +#define MMUEXT_REASSIGN_PAGE    13
 110.165 +#define MMUEXT_CMD_MASK        255
 110.166 +#define MMUEXT_CMD_SHIFT         8
 110.167 +
 110.168 +/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
 110.169 +#define UVMF_FLUSH_TLB          1 /* Flush entire TLB. */
 110.170 +#define UVMF_INVLPG             2 /* Flush the VA mapping being updated. */
 110.171 +
 110.172 +
 110.173 +/*
 110.174 + * Commands to HYPERVISOR_sched_op().
 110.175 + */
 110.176 +#define SCHEDOP_yield           0   /* Give up the CPU voluntarily.       */
 110.177 +#define SCHEDOP_block           1   /* Block until an event is received.  */
 110.178 +#define SCHEDOP_shutdown        2   /* Stop executing this domain.        */
 110.179 +#define SCHEDOP_cmdmask       255   /* 8-bit command. */
 110.180 +#define SCHEDOP_reasonshift     8   /* 8-bit reason code. (SCHEDOP_shutdown) */
 110.181 +
 110.182 +/*
 110.183 + * Commands to HYPERVISOR_console_io().
 110.184 + */
 110.185 +#define CONSOLEIO_write         0
 110.186 +#define CONSOLEIO_read          1
 110.187 +
 110.188 +/*
 110.189 + * Commands to HYPERVISOR_dom_mem_op().
 110.190 + */
 110.191 +#define MEMOP_increase_reservation 0
 110.192 +#define MEMOP_decrease_reservation 1
 110.193 +
 110.194 +/*
 110.195 + * Commands to HYPERVISOR_vm_assist().
 110.196 + */
 110.197 +#define VMASST_CMD_enable                0
 110.198 +#define VMASST_CMD_disable               1
 110.199 +#define VMASST_TYPE_4gb_segments         0
 110.200 +#define VMASST_TYPE_4gb_segments_notify  1
 110.201 +#define VMASST_TYPE_writable_pagetables  2
 110.202 +#define MAX_VMASST_TYPE 2
 110.203 +
 110.204 +#ifndef __ASSEMBLY__
 110.205 +
 110.206 +typedef u16 domid_t;
 110.207 +
 110.208 +/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
 110.209 +#define DOMID_FIRST_RESERVED (0x7FF0U)
 110.210 +
 110.211 +/* DOMID_SELF is used in certain contexts to refer to oneself. */
 110.212 +#define DOMID_SELF (0x7FF0U)
 110.213 +
 110.214 +/*
 110.215 + * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
 110.216 + * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
 110.217 + * is useful to ensure that no mappings to the OS's own heap are accidentally
 110.218 + * installed. (e.g., in Linux this could cause havoc as reference counts
 110.219 + * aren't adjusted on the I/O-mapping code path).
 110.220 + * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
 110.221 + * be specified by any calling domain.
 110.222 + */
 110.223 +#define DOMID_IO   (0x7FF1U)
 110.224 +
 110.225 +/*
 110.226 + * DOMID_XEN is used to allow privileged domains to map restricted parts of
 110.227 + * Xen's heap space (e.g., the machine_to_phys table).
 110.228 + * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
 110.229 + * the caller is privileged.
 110.230 + */
 110.231 +#define DOMID_XEN  (0x7FF2U)
 110.232 +
 110.233 +/*
 110.234 + * Send an array of these to HYPERVISOR_mmu_update().
 110.235 + * NB. The fields are natural pointer/address size for this architecture.
 110.236 + */
 110.237 +typedef struct
 110.238 +{
 110.239 +    memory_t ptr;    /* Machine address of PTE. */
 110.240 +    memory_t val;    /* New contents of PTE.    */
 110.241 +} PACKED mmu_update_t;
 110.242 +
 110.243 +/*
 110.244 + * Send an array of these to HYPERVISOR_multicall().
 110.245 + * NB. The fields are natural register size for this architecture.
 110.246 + */
 110.247 +typedef struct
 110.248 +{
 110.249 +    cpureg_t op;
 110.250 +    cpureg_t args[7];
 110.251 +} PACKED multicall_entry_t;
 110.252 +
 110.253 +/* Event channel endpoints per domain. */
 110.254 +#define NR_EVENT_CHANNELS 1024
 110.255 +
 110.256 +/* No support for multi-processor guests. */
 110.257 +#define MAX_VIRT_CPUS 1
 110.258 +
 110.259 +/*
 110.260 + * Xen/guestos shared data -- pointer provided in start_info.
 110.261 + * NB. We expect that this struct is smaller than a page.
 110.262 + */
 110.263 +typedef struct shared_info_st
 110.264 +{
 110.265 +    /*
 110.266 +     * Per-VCPU information goes here. This will be cleaned up more when Xen 
 110.267 +     * actually supports multi-VCPU guests.
 110.268 +     */
 110.269 +    struct {
 110.270 +        /*
 110.271 +         * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
 110.272 +         * a pending notification for a particular VCPU. It is then cleared 
 110.273 +         * by the guest OS /before/ checking for pending work, thus avoiding
 110.274 +         * a set-and-check race. Note that the mask is only accessed by Xen
 110.275 +         * on the CPU that is currently hosting the VCPU. This means that the
 110.276 +         * pending and mask flags can be updated by the guest without special
 110.277 +         * synchronisation (i.e., no need for the x86 LOCK prefix).
 110.278 +         * This may seem suboptimal because if the pending flag is set by
 110.279 +         * a different CPU then an IPI may be scheduled even when the mask
 110.280 +         * is set. However, note:
 110.281 +         *  1. The task of 'interrupt holdoff' is covered by the per-event-
 110.282 +         *     channel mask bits. A 'noisy' event that is continually being
 110.283 +         *     triggered can be masked at source at this very precise
 110.284 +         *     granularity.
 110.285 +         *  2. The main purpose of the per-VCPU mask is therefore to restrict
 110.286 +         *     reentrant execution: whether for concurrency control, or to
 110.287 +         *     prevent unbounded stack usage. Whatever the purpose, we expect
 110.288 +         *     that the mask will be asserted only for short periods at a time,
 110.289 +         *     and so the likelihood of a 'spurious' IPI is suitably small.
 110.290 +         * The mask is read before making an event upcall to the guest: a
 110.291 +         * non-zero mask therefore guarantees that the VCPU will not receive
 110.292 +         * an upcall activation. The mask is cleared when the VCPU requests
 110.293 +         * to block: this avoids wakeup-waiting races.
 110.294 +         */
 110.295 +        u8 evtchn_upcall_pending;
 110.296 +        u8 evtchn_upcall_mask;
 110.297 +        u8 pad0, pad1;
 110.298 +    } PACKED vcpu_data[MAX_VIRT_CPUS];  /*   0 */
 110.299 +
 110.300 +    /*
 110.301 +     * A domain can have up to 1024 "event channels" on which it can send
 110.302 +     * and receive asynchronous event notifications. There are three classes
 110.303 +     * of event that are delivered by this mechanism:
 110.304 +     *  1. Bi-directional inter- and intra-domain connections. Domains must
 110.305 +     *     arrange out-of-band to set up a connection (usually the setup
 110.306 +     *     is initiated and organised by a privileged third party such as
 110.307 +     *     software running in domain 0).
 110.308 +     *  2. Physical interrupts. A domain with suitable hardware-access
 110.309 +     *     privileges can bind an event-channel port to a physical interrupt
 110.310 +     *     source.
 110.311 +     *  3. Virtual interrupts ('events'). A domain can bind an event-channel
 110.312 +     *     port to a virtual interrupt source, such as the virtual-timer
 110.313 +     *     device or the emergency console.
 110.314 +     * 
 110.315 +     * Event channels are addressed by a "port index" between 0 and 1023.
 110.316 +     * Each channel is associated with two bits of information:
 110.317 +     *  1. PENDING -- notifies the domain that there is a pending notification
 110.318 +     *     to be processed. This bit is cleared by the guest.
 110.319 +     *  2. MASK -- if this bit is clear then a 0->1 transition of PENDING
 110.320 +     *     will cause an asynchronous upcall to be scheduled. This bit is only
 110.321 +     *     updated by the guest. It is read-only within Xen. If a channel
 110.322 +     *     becomes pending while the channel is masked then the 'edge' is lost
 110.323 +     *     (i.e., when the channel is unmasked, the guest must manually handle
 110.324 +     *     pending notifications as no upcall will be scheduled by Xen).
 110.325 +     * 
 110.326 +     * To expedite scanning of pending notifications, any 0->1 pending
 110.327 +     * transition on an unmasked channel causes a corresponding bit in a
 110.328 +     * 32-bit selector to be set. Each bit in the selector covers a 32-bit
 110.329 +     * word in the PENDING bitfield array.
 110.330 +     */
 110.331 +    u32 evtchn_pending[32];             /*   4 */
 110.332 +    u32 evtchn_pending_sel;             /* 132 */
 110.333 +    u32 evtchn_mask[32];                /* 136 */
 110.334 +
 110.335 +    /*
 110.336 +     * Time: The following abstractions are exposed: System Time, Clock Time,
 110.337 +     * Domain Virtual Time. Domains can access Cycle counter time directly.
 110.338 +     */
 110.339 +    u64                cpu_freq;        /* 264: CPU frequency (Hz).          */
 110.340 +
 110.341 +    /*
 110.342 +     * The following values are updated periodically (and not necessarily
 110.343 +     * atomically!). The guest OS detects this because 'time_version1' is
 110.344 +     * incremented just before updating these values, and 'time_version2' is
 110.345 +     * incremented immediately after. See the Xen-specific Linux code for an
 110.346 +     * example of how to read these values safely (arch/xen/kernel/time.c).
 110.347 +     */
 110.348 +    u32                time_version1;   /* 272 */
 110.349 +    u32                time_version2;   /* 276 */
 110.350 +    tsc_timestamp_t    tsc_timestamp;   /* TSC at last update of time vals.  */
 110.351 +    u64                system_time;     /* Time, in nanosecs, since boot.    */
 110.352 +    u32                wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
 110.353 +    u32                wc_usec;         /* Usecs 00:00:00 UTC, Jan 1, 1970.  */
 110.354 +    u64                domain_time;     /* Domain virtual time, in nanosecs. */
 110.355 +
 110.356 +    /*
 110.357 +     * Timeout values:
 110.358 +     * Allow a domain to specify a timeout value in system time and 
 110.359 +     * domain virtual time.
 110.360 +     */
 110.361 +    u64                wall_timeout;    /* 312 */
 110.362 +    u64                domain_timeout;  /* 320 */
 110.363 +
 110.364 +    arch_shared_info_t arch;
 110.365 +
 110.366 +} PACKED shared_info_t;
 110.367 +
 110.368 +/*
 110.369 + * Start-of-day memory layout for the initial domain (DOM0):
 110.370 + *  1. The domain is started within contiguous virtual-memory region.
 110.371 + *  2. The contiguous region begins and ends on an aligned 4MB boundary.
 110.372 + *  3. The region start corresponds to the load address of the OS image.
 110.373 + *     If the load address is not 4MB aligned then the address is rounded down.
 110.374 + *  4. This the order of bootstrap elements in the initial virtual region:
 110.375 + *      a. relocated kernel image
 110.376 + *      b. initial ram disk              [mod_start, mod_len]
 110.377 + *      c. list of allocated page frames [mfn_list, nr_pages]
 110.378 + *      d. bootstrap page tables         [pt_base, CR3 (x86)]
 110.379 + *      e. start_info_t structure        [register ESI (x86)]
 110.380 + *      f. bootstrap stack               [register ESP (x86)]
 110.381 + *  5. Bootstrap elements are packed together, but each is 4kB-aligned.
 110.382 + *  6. The initial ram disk may be omitted.
 110.383 + *  7. The list of page frames forms a contiguous 'pseudo-physical' memory
 110.384 + *     layout for the domain. In particular, the bootstrap virtual-memory
 110.385 + *     region is a 1:1 mapping to the first section of the pseudo-physical map.
 110.386 + *  8. All bootstrap elements are mapped read-writable for the guest OS. The
 110.387 + *     only exception is the bootstrap page table, which is mapped read-only.
 110.388 + *  9. There is guaranteed to be at least 512kB padding after the final
 110.389 + *     bootstrap element. If necessary, the bootstrap virtual region is
 110.390 + *     extended by an extra 4MB to ensure this.
 110.391 + */
 110.392 +
 110.393 +#define MAX_CMDLINE 256
 110.394 +typedef struct {
 110.395 +    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */
 110.396 +    memory_t nr_pages;        /*  0: Total pages allocated to this domain. */
 110.397 +    _MEMORY_PADDING(A);
 110.398 +    memory_t shared_info;     /*  8: MACHINE address of shared info struct.*/
 110.399 +    _MEMORY_PADDING(B);
 110.400 +    u32      flags;           /* 16: SIF_xxx flags.                        */
 110.401 +    u16      domain_controller_evtchn; /* 20 */
 110.402 +    u16      __pad;
 110.403 +    /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).      */
 110.404 +    memory_t pt_base;         /* 24: VIRTUAL address of page directory.    */
 110.405 +    _MEMORY_PADDING(C);
 110.406 +    memory_t nr_pt_frames;    /* 32: Number of bootstrap p.t. frames.      */
 110.407 +    _MEMORY_PADDING(D);
 110.408 +    memory_t mfn_list;        /* 40: VIRTUAL address of page-frame list.   */
 110.409 +    _MEMORY_PADDING(E);
 110.410 +    memory_t mod_start;       /* 48: VIRTUAL address of pre-loaded module. */
 110.411 +    _MEMORY_PADDING(F);
 110.412 +    memory_t mod_len;         /* 56: Size (bytes) of pre-loaded module.    */
 110.413 +    _MEMORY_PADDING(G);
 110.414 +    u8 cmd_line[MAX_CMDLINE]; /* 64 */
 110.415 +} PACKED start_info_t; /* 320 bytes */
 110.416 +
 110.417 +/* These flags are passed in the 'flags' field of start_info_t. */
 110.418 +#define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
 110.419 +#define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 110.420 +#define SIF_BLK_BE_DOMAIN (1<<4)  /* Is this a block backend domain? */
 110.421 +#define SIF_NET_BE_DOMAIN (1<<5)  /* Is this a net backend domain? */
 110.422 +
 110.423 +/* For use in guest OSes. */
 110.424 +extern shared_info_t *HYPERVISOR_shared_info;
 110.425 +
 110.426 +#endif /* !__ASSEMBLY__ */
 110.427 +
 110.428 +#endif /* __XEN_PUBLIC_XEN_H__ */
   111.1 --- a/xen/include/xen/grant_table.h	Mon Nov 01 00:14:22 2004 +0000
   111.2 +++ b/xen/include/xen/grant_table.h	Mon Nov 01 00:18:29 2004 +0000
   111.3 @@ -26,7 +26,7 @@
   111.4  
   111.5  #include <xen/config.h>
   111.6  #include <xen/mm.h>
   111.7 -#include <hypervisor-ifs/grant_table.h>
   111.8 +#include <public/grant_table.h>
   111.9  
  111.10  /* Active grant entry - used for shadowing GTF_permit_access grants. */
  111.11  typedef struct {
  111.12 @@ -68,7 +68,7 @@ typedef struct {
  111.13  
  111.14  /* Per-domain grant information. */
  111.15  typedef struct {
  111.16 -    /* Shared grant table (see include/hypervisor-ifs/grant_table.h). */
  111.17 +    /* Shared grant table (see include/public/grant_table.h). */
  111.18      grant_entry_t        *shared;
  111.19      /* Active grant table. */
  111.20      active_grant_entry_t *active;
   112.1 --- a/xen/include/xen/sched.h	Mon Nov 01 00:14:22 2004 +0000
   112.2 +++ b/xen/include/xen/sched.h	Mon Nov 01 00:18:29 2004 +0000
   112.3 @@ -10,8 +10,8 @@
   112.4  #include <xen/smp.h>
   112.5  #include <asm/page.h>
   112.6  #include <asm/processor.h>
   112.7 -#include <hypervisor-ifs/hypervisor-if.h>
   112.8 -#include <hypervisor-ifs/dom0_ops.h>
   112.9 +#include <public/xen.h>
  112.10 +#include <public/dom0_ops.h>
  112.11  #include <xen/list.h>
  112.12  #include <xen/time.h>
  112.13  #include <xen/ac_timer.h>
   113.1 --- a/xen/include/xen/time.h	Mon Nov 01 00:14:22 2004 +0000
   113.2 +++ b/xen/include/xen/time.h	Mon Nov 01 00:18:29 2004 +0000
   113.3 @@ -28,7 +28,7 @@
   113.4  #define __XEN_TIME_H__
   113.5  
   113.6  #include <xen/types.h>
   113.7 -#include <hypervisor-ifs/hypervisor-if.h>
   113.8 +#include <public/xen.h>
   113.9  
  113.10  extern int init_xen_time();
  113.11  
   114.1 --- a/xen/include/xen/trace.h	Mon Nov 01 00:14:22 2004 +0000
   114.2 +++ b/xen/include/xen/trace.h	Mon Nov 01 00:18:29 2004 +0000
   114.3 @@ -15,13 +15,13 @@
   114.4   * Access to the trace buffers is via a dom0 hypervisor op and analysis of
   114.5   * trace buffer contents can then be performed using a userland tool.
   114.6   *
   114.7 - * See also common/trace.c and the dom0 op in include/hypervisor-ifs/dom0_ops.h
   114.8 + * See also common/trace.c and the dom0 op in include/public/dom0_ops.h
   114.9   */
  114.10  
  114.11  #ifndef __XEN_TRACE_H__
  114.12  #define __XEN_TRACE_H__
  114.13  
  114.14 -#include <hypervisor-ifs/trace.h>
  114.15 +#include <public/trace.h>
  114.16  
  114.17  #ifdef TRACE_BUFFER
  114.18  
  114.19 @@ -32,7 +32,7 @@
  114.20  #include <asm/atomic.h>
  114.21  #include <asm/current.h>
  114.22  #include <asm/msr.h>
  114.23 -#include <hypervisor-ifs/dom0_ops.h>
  114.24 +#include <public/dom0_ops.h>
  114.25  
  114.26  /* Used to initialise trace buffer functionality */
  114.27  void init_trace_bufs(void);