# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 72c5d8206d4882172d9ad1b0c6ad819130e3309f
# Parent fbf676a36ee44558d54db9ebb43a5fe7971d669d
# Parent 13d6d993d79724d86a0c9ac556a7f884baed98ae
merge with xen-unstable.hg
---
linux-2.6-xen-sparse/arch/ia64/xen/xen_ksyms.c | 12
tools/xentrace/tbctl.c | 26
README | 40
buildconfigs/linux-defconfig_xen0_x86_32 | 10
buildconfigs/linux-defconfig_xen0_x86_64 | 10
buildconfigs/linux-defconfig_xenU_x86_32 | 19
buildconfigs/linux-defconfig_xenU_x86_64 | 10
buildconfigs/linux-defconfig_xen_x86_32 | 12
buildconfigs/linux-defconfig_xen_x86_64 | 12
docs/man/xend-config.sxp.pod.5 | 2
docs/man/xm.pod.1 | 18
docs/man/xmdomain.cfg.pod.5 | 4
extras/mini-os/Makefile | 35
extras/mini-os/console/console.c | 10
extras/mini-os/include/mm.h | 90
+
extras/mini-os/include/types.h | 7
extras/mini-os/kernel.c | 22
extras/mini-os/mm.c | 72
-
extras/mini-os/traps.c | 36
extras/mini-os/x86_32.S | 8
extras/mini-os/x86_64.S | 3
linux-2.6-xen-sparse/arch/i386/kernel/fixup.c | 10
linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S | 10
linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c | 10
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c | 266
++--
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c | 11
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c | 10
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c | 10
linux-2.6-xen-sparse/arch/i386/mm/init-xen.c | 13
linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c | 10
linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c | 10
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c | 81
-
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c | 3
linux-2.6-xen-sparse/arch/ia64/xen/Makefile | 4
linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c | 7
linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S | 12
linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c | 257
+---
linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S | 16
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c | 73
-
linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c | 36
linux-2.6-xen-sparse/drivers/char/tpm/Kconfig | 9
linux-2.6-xen-sparse/drivers/char/tpm/Makefile | 3
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c | 15
linux-2.6-xen-sparse/drivers/xen/Kconfig | 16
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c | 14
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c | 21
linux-2.6-xen-sparse/drivers/xen/blkback/common.h | 19
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c | 29
linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c | 23
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c | 15
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c | 12
linux-2.6-xen-sparse/drivers/xen/blkfront/block.h | 10
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c | 10
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c | 10
linux-2.6-xen-sparse/drivers/xen/blktap/common.h | 10
linux-2.6-xen-sparse/drivers/xen/blktap/interface.c | 10
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c | 10
linux-2.6-xen-sparse/drivers/xen/char/mem.c | 10
linux-2.6-xen-sparse/drivers/xen/console/console.c | 14
linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c | 10
linux-2.6-xen-sparse/drivers/xen/core/evtchn.c | 22
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c | 12
linux-2.6-xen-sparse/drivers/xen/core/hypervisor_sysfs.c | 3
linux-2.6-xen-sparse/drivers/xen/core/reboot.c | 10
linux-2.6-xen-sparse/drivers/xen/core/skbuff.c | 10
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c | 52
linux-2.6-xen-sparse/drivers/xen/core/xen_proc.c | 10
linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c | 7
linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c | 13
linux-2.6-xen-sparse/drivers/xen/net_driver_util.c | 10
linux-2.6-xen-sparse/drivers/xen/netback/common.h | 18
linux-2.6-xen-sparse/drivers/xen/netback/interface.c | 33
linux-2.6-xen-sparse/drivers/xen/netback/loopback.c | 10
linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 23
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c | 13
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 521
+++-----
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c | 13
linux-2.6-xen-sparse/drivers/xen/tpmback/common.h | 12
linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c | 22
linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c | 14
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c | 12
linux-2.6-xen-sparse/drivers/xen/util.c | 10
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_backend_client.c | 10
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c | 11
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c | 10
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h | 10
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c | 10
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 19
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 10
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h | 10
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h | 2
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h | 3
linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h | 28
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h | 6
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h | 5
linux-2.6-xen-sparse/include/asm-x86_64/e820.h | 63
+
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h | 16
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h | 2
linux-2.6-xen-sparse/include/xen/balloon.h | 10
linux-2.6-xen-sparse/include/xen/driver_util.h | 10
linux-2.6-xen-sparse/include/xen/evtchn.h | 10
linux-2.6-xen-sparse/include/xen/foreign_page.h | 10
linux-2.6-xen-sparse/include/xen/gnttab.h | 10
linux-2.6-xen-sparse/include/xen/net_driver_util.h | 10
linux-2.6-xen-sparse/include/xen/public/evtchn.h | 10
linux-2.6-xen-sparse/include/xen/public/privcmd.h | 10
linux-2.6-xen-sparse/include/xen/xen_proc.h | 10
linux-2.6-xen-sparse/include/xen/xenbus.h | 10
patches/linux-2.6.16.13/xen-hotplug.patch | 9
patches/linux-2.6.16.13/xenoprof-generic.patch | 46
tools/examples/README | 13
tools/examples/external-device-migrate | 124
+-
tools/examples/network-bridge | 2
tools/examples/vtpm | 3
tools/examples/vtpm-common.sh | 120
+
tools/examples/xmexample.hvm | 4
tools/examples/xmexample1 | 4
tools/examples/xmexample2 | 4
tools/examples/xmexample3 | 4
tools/firmware/acpi/acpi_dsdt.asl | 10
tools/firmware/acpi/acpi_dsdt.c | 289
++--
tools/firmware/acpi/acpi_fadt.h | 4
tools/ioemu/hw/acpi.c | 178
++
tools/ioemu/hw/cirrus_vga.c | 151
++
tools/ioemu/hw/mc146818rtc.c | 25
tools/ioemu/hw/pc.c | 24
tools/ioemu/hw/pckbd.c | 153
+-
tools/ioemu/hw/serial.c | 1
tools/ioemu/hw/vga.c | 19
tools/ioemu/hw/vga_int.h | 2
tools/ioemu/target-i386-dm/Makefile | 2
tools/ioemu/vl.c | 208
---
tools/ioemu/vl.h | 30
tools/libxc/xc_acm.c | 33
tools/libxc/xc_linux_build.c | 46
tools/libxc/xc_load_elf.c | 69
-
tools/libxc/xc_ptrace.c | 211
+--
tools/libxc/xc_tbuf.c | 31
tools/libxc/xenctrl.h | 42
tools/libxc/xg_private.h | 5
tools/python/xen/lowlevel/acm/acm.c | 54
tools/python/xen/lowlevel/xc/xc.c | 7
tools/python/xen/xend/XendCheckpoint.py | 8
tools/python/xen/xend/XendDomain.py | 6
tools/python/xen/xend/XendDomainInfo.py | 34
tools/python/xen/xend/image.py | 27
tools/python/xen/xend/server/DevController.py | 8
tools/python/xen/xend/server/pciif.py | 25
tools/python/xen/xend/server/tpmif.py | 12
tools/security/Makefile | 4
tools/security/secpol_tool.c | 32
tools/tests/Makefile | 2
tools/vtpm/Makefile | 21
tools/vtpm/tpm_emulator.patch | 1
tools/vtpm/vtpm.patch | 163
--
tools/vtpm_manager/Rules.mk | 8
tools/vtpm_manager/manager/dmictl.c | 142
--
tools/vtpm_manager/manager/securestorage.c | 29
tools/vtpm_manager/manager/vtpm_ipc.c | 141
++
tools/vtpm_manager/manager/vtpm_ipc.h | 71
+
tools/vtpm_manager/manager/vtpm_lock.c | 63
+
tools/vtpm_manager/manager/vtpm_lock.h | 48
tools/vtpm_manager/manager/vtpm_manager.c | 602
----------
tools/vtpm_manager/manager/vtpm_manager.h | 36
tools/vtpm_manager/manager/vtpm_manager_handler.c | 455
+++++++
tools/vtpm_manager/manager/vtpmd.c | 309
++++-
tools/vtpm_manager/manager/vtpmpriv.h | 73
-
tools/xenmon/xenbaked.c | 99
-
tools/xenstore/xenstored_core.c | 17
tools/xenstore/xenstored_domain.c | 9
tools/xenstore/xenstored_domain.h | 2
tools/xenstore/xs_lib.c | 4
tools/xenstore/xs_lib.h | 2
tools/xentrace/Makefile | 2
tools/xentrace/setsize.c | 56
tools/xentrace/xentrace.8 | 75
+
tools/xentrace/xentrace.c | 43
tools/xentrace/xentrace_format | 6
tools/xm-test/configure.ac | 1
tools/xm-test/ramdisk/bin/create_disk_image | 7
tools/xm-test/tests/Makefile.am | 7
tools/xm-test/tests/block-integrity/01_block_device_read_verify.py | 62
+
tools/xm-test/tests/block-integrity/Makefile.am | 21
tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py | 87
+
tools/xm-test/tests/network/03_network_local_tcp_pos.py | 4
tools/xm-test/tests/network/04_network_local_udp_pos.py | 4
tools/xm-test/tests/network/06_network_dom0_tcp_pos.py | 2
tools/xm-test/tests/network/07_network_dom0_udp_pos.py | 2
tools/xm-test/tests/network/12_network_domU_tcp_pos.py | 2
tools/xm-test/tests/network/13_network_domU_udp_pos.py | 2
tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py | 61
-
tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py | 100
+
tools/xm-test/tests/vtpm/Makefile.am | 3
xen/arch/x86/dom0_ops.c | 21
xen/arch/x86/domain.c | 5
xen/arch/x86/hvm/hvm.c | 11
xen/arch/x86/hvm/i8259.c | 88
+
xen/arch/x86/hvm/platform.c | 4
xen/arch/x86/hvm/svm/intr.c | 17
xen/arch/x86/hvm/svm/svm.c | 342
+++--
xen/arch/x86/hvm/svm/vmcb.c | 42
xen/arch/x86/hvm/vmx/vmcs.c | 96
+
xen/arch/x86/hvm/vmx/vmx.c | 5
xen/arch/x86/mm.c | 35
xen/arch/x86/shadow.c | 24
xen/arch/x86/shadow32.c | 8
xen/arch/x86/shadow_public.c | 5
xen/arch/x86/x86_emulate.c | 4
xen/common/acm_ops.c | 282
++--
xen/common/elf.c | 83
-
xen/common/event_channel.c | 3
xen/include/asm-ia64/event.h | 17
xen/include/asm-x86/event.h | 6
xen/include/asm-x86/hvm/svm/svm.h | 8
xen/include/asm-x86/hvm/svm/vmcb.h | 1
xen/include/asm-x86/hvm/vmx/vmcs.h | 2
xen/include/asm-x86/hvm/vpic.h | 3
xen/include/public/acm_ops.h | 54
xen/include/public/arch-ia64.h | 79
-
xen/include/public/arch-x86_32.h | 36
xen/include/public/arch-x86_64.h | 29
xen/include/public/callback.h | 10
xen/include/public/dom0_ops.h | 205
++-
xen/include/public/event_channel.h | 99
-
xen/include/public/grant_table.h | 30
xen/include/public/hvm/ioreq.h | 26
xen/include/public/hvm/vmx_assist.h | 5
xen/include/public/io/blkif.h | 12
xen/include/public/io/netif.h | 32
xen/include/public/io/tpmif.h | 19
xen/include/public/memory.h | 48
xen/include/public/nmi.h | 5
xen/include/public/physdev.h | 45
xen/include/public/sched.h | 15
xen/include/public/vcpu.h | 10
xen/include/public/version.h | 15
xen/include/public/xen.h | 47
xen/include/public/xenoprof.h | 15
xen/include/xen/hypercall.h | 2
xen/include/xen/sched.h | 1
240 files changed, 5232 insertions(+), 4388 deletions(-)
diff -r fbf676a36ee4 -r 72c5d8206d48 README
--- a/README Mon May 22 08:53:26 2006 -0600
+++ b/README Mon May 22 14:13:38 2006 -0600
@@ -1,9 +1,9 @@
################################
- __ __ _____ ___
- \ \/ /___ _ __ |___ / / _ \
+ __ __ _____ ___
+ \ \/ /___ _ __ |___ / / _ \
\ // _ \ '_ \ |_ \| | | |
/ \ __/ | | | ___) | |_| |
- /_/\_\___|_| |_| |____(_)___/
+ /_/\_\___|_| |_| |____(_)___/
################################
@@ -66,14 +66,14 @@ 2. Configure your bootloader to boot Xen
The linux command line takes all the usual options, such as
root=<root-dev> to specify your usual root partition (e.g.,
- /dev/hda1).
+ /dev/hda1).
The Xen command line takes a number of optional arguments described
in the manual. The most common is 'dom0_mem=xxxM' which sets the
amount of memory to allocate for use by your initial virtual
machine (known as domain 0). Note that Xen itself reserves about
32MB memory for internal use, which is not available for allocation
- to virtual machines.
+ to virtual machines.
3. Reboot your system and select the "Xen 3.0 / XenLinux 2.6" menu
option. After booting Xen, Linux will start and your initialisation
@@ -86,7 +86,7 @@ release. Make sure you have all the foll
release. Make sure you have all the following installed, either by
visiting the project webpage or installing a pre-built package
provided by your Linux distributor:
- * GCC (preferably v3.2.x or v3.3.x; older versions are unsupported)
+ * GCC (preferably v3.2.x or v3.3.x; older versions are unsupported)
* GNU Make
* GNU Binutils
* Development install of zlib (e.g., zlib-dev)
@@ -122,19 +122,19 @@ 3. For the very first build, or if you w
# make world
# make install
- This will create and install onto the local machine. It will build
+ This will create and install onto the local machine. It will build
the xen binary (xen.gz), and a linux kernel and modules that can be
used in both dom0 and an unprivileged guest kernel (vmlinuz-2.6.x-xen),
the tools and the documentation.
- You can override the destination for make install by setting DESTDIR
+ You can override the destination for make install by setting DESTDIR
to some value.
- The make command line defaults to building the kernel vmlinuz-2.6.x-xen.
- You can override this default by specifying KERNELS=kernelname. For
- example, you can make two kernels - linux-2.6-xen0
- and linux-2.6-xenU - which are smaller builds containing only selected
- modules, intended primarily for developers that don't like to wait
+ The make command line defaults to building the kernel vmlinuz-2.6.x-xen.
+ You can override this default by specifying KERNELS=kernelname. For
+ example, you can make two kernels - linux-2.6-xen0
+ and linux-2.6-xenU - which are smaller builds containing only selected
+ modules, intended primarily for developers that don't like to wait
for a full -xen kernel to build. The -xenU kernel is particularly small,
as it does not contain any physical device drivers, and hence is
only useful for guest domains.
@@ -153,15 +153,15 @@ 4. To rebuild an existing tree without m
# make dist
This will build and install xen, kernels, tools, and
- docs into the local dist/ directory.
+ docs into the local dist/ directory.
- You can override the destination for make install by setting DISTDIR
+ You can override the destination for make install by setting DISTDIR
to some value.
- make install and make dist differ in that make install does the
- right things for your local machine (installing the appropriate
- version of hotplug or udev scripts, for example), but make dist
- includes all versions of those scripts, so that you can copy the dist
+ make install and make dist differ in that make install does the
+ right things for your local machine (installing the appropriate
+ version of hotplug or udev scripts, for example), but make dist
+ includes all versions of those scripts, so that you can copy the dist
directory to another machine and install from that distribution.
5. To rebuild a kernel with a modified config:
@@ -171,6 +171,6 @@ 5. To rebuild a kernel with a modified c
# make linux-2.6-xen-install
Depending on your config, you may need to use 'mkinitrd' to create
- an initial ram disk, just like a native system e.g.
+ an initial ram disk, just like a native system e.g.
# depmod 2.6.16-xen
# mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod
initrd-2.6.16-xen.img 2.6.16-xen
diff -r fbf676a36ee4 -r 72c5d8206d48 buildconfigs/linux-defconfig_xen0_x86_32
--- a/buildconfigs/linux-defconfig_xen0_x86_32 Mon May 22 08:53:26 2006 -0600
+++ b/buildconfigs/linux-defconfig_xen0_x86_32 Mon May 22 14:13:38 2006 -0600
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-xen0
-# Sat Apr 8 11:34:07 2006
+# Linux kernel version: 2.6.16.13-xen0
+# Thu May 11 17:06:31 2006
#
CONFIG_X86_32=y
CONFIG_SEMAPHORE_SLEEPERS=y
@@ -1309,7 +1309,7 @@ CONFIG_CRYPTO_CRC32C=m
#
# CONFIG_CRYPTO_DEV_PADLOCK is not set
CONFIG_XEN=y
-CONFIG_XEN_INTERFACE_VERSION=0x00030101
+CONFIG_XEN_INTERFACE_VERSION=0x00030202
#
# XEN
@@ -1330,10 +1330,12 @@ CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
# CONFIG_XEN_BLKDEV_TAP is not set
-# CONFIG_XEN_TPMDEV_FRONTEND is not set
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DISABLE_SERIAL=y
CONFIG_XEN_SYSFS=y
+CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
+CONFIG_XEN_COMPAT_030002=y
CONFIG_HAVE_ARCH_ALLOC_SKB=y
CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
diff -r fbf676a36ee4 -r 72c5d8206d48 buildconfigs/linux-defconfig_xen0_x86_64
--- a/buildconfigs/linux-defconfig_xen0_x86_64 Mon May 22 08:53:26 2006 -0600
+++ b/buildconfigs/linux-defconfig_xen0_x86_64 Mon May 22 14:13:38 2006 -0600
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-xen0
-# Thu Apr 13 14:58:29 2006
+# Linux kernel version: 2.6.16.13-xen0
+# Thu May 11 17:17:19 2006
#
CONFIG_X86_64=y
CONFIG_64BIT=y
@@ -1250,7 +1250,7 @@ CONFIG_CRYPTO_CRC32C=m
# Hardware crypto devices
#
CONFIG_XEN=y
-CONFIG_XEN_INTERFACE_VERSION=0x00030101
+CONFIG_XEN_INTERFACE_VERSION=0x00030202
#
# XEN
@@ -1271,10 +1271,12 @@ CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
# CONFIG_XEN_BLKDEV_TAP is not set
-# CONFIG_XEN_TPMDEV_FRONTEND is not set
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DISABLE_SERIAL=y
CONFIG_XEN_SYSFS=y
+CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
+CONFIG_XEN_COMPAT_030002=y
CONFIG_HAVE_ARCH_ALLOC_SKB=y
CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
diff -r fbf676a36ee4 -r 72c5d8206d48 buildconfigs/linux-defconfig_xenU_x86_32
--- a/buildconfigs/linux-defconfig_xenU_x86_32 Mon May 22 08:53:26 2006 -0600
+++ b/buildconfigs/linux-defconfig_xenU_x86_32 Mon May 22 14:13:38 2006 -0600
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-rc3-xen0
-# Thu Feb 16 22:53:43 2006
+# Linux kernel version: 2.6.16.13-xenU
+# Thu May 11 17:08:12 2006
#
CONFIG_X86_32=y
CONFIG_SEMAPHORE_SLEEPERS=y
@@ -617,11 +617,7 @@ CONFIG_DUMMY_CONSOLE=y
#
#
-# SN Devices
-#
-
-#
-# EDAC - error detection and reporting (RAS)
+# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
#
# CONFIG_EDAC is not set
@@ -852,7 +848,7 @@ CONFIG_CRYPTO_CRC32C=m
#
# CONFIG_CRYPTO_DEV_PADLOCK is not set
CONFIG_XEN=y
-CONFIG_NO_IDLE_HZ=y
+CONFIG_XEN_INTERFACE_VERSION=0x00030202
#
# XEN
@@ -862,12 +858,15 @@ CONFIG_XEN_UNPRIVILEGED_GUEST=y
# CONFIG_XEN_BACKEND is not set
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
-# CONFIG_XEN_TPMDEV_FRONTEND is not set
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DISABLE_SERIAL=y
CONFIG_XEN_SYSFS=y
+CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
+CONFIG_XEN_COMPAT_030002=y
CONFIG_HAVE_ARCH_ALLOC_SKB=y
CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
+CONFIG_NO_IDLE_HZ=y
#
# Library routines
@@ -883,4 +882,6 @@ CONFIG_X86_SMP=y
CONFIG_X86_SMP=y
CONFIG_X86_BIOS_REBOOT=y
CONFIG_X86_TRAMPOLINE=y
+CONFIG_X86_NO_TSS=y
+CONFIG_X86_NO_IDT=y
CONFIG_KTIME_SCALAR=y
diff -r fbf676a36ee4 -r 72c5d8206d48 buildconfigs/linux-defconfig_xenU_x86_64
--- a/buildconfigs/linux-defconfig_xenU_x86_64 Mon May 22 08:53:26 2006 -0600
+++ b/buildconfigs/linux-defconfig_xenU_x86_64 Mon May 22 14:13:38 2006 -0600
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-xenU
-# Thu Apr 13 14:59:16 2006
+# Linux kernel version: 2.6.16.13-xenU
+# Thu May 11 17:17:57 2006
#
CONFIG_X86_64=y
CONFIG_64BIT=y
@@ -1135,7 +1135,7 @@ CONFIG_CRYPTO_CRC32C=m
# Hardware crypto devices
#
CONFIG_XEN=y
-CONFIG_XEN_INTERFACE_VERSION=0x00030101
+CONFIG_XEN_INTERFACE_VERSION=0x00030202
#
# XEN
@@ -1145,10 +1145,12 @@ CONFIG_XEN_UNPRIVILEGED_GUEST=y
# CONFIG_XEN_BACKEND is not set
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
-# CONFIG_XEN_TPMDEV_FRONTEND is not set
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DISABLE_SERIAL=y
CONFIG_XEN_SYSFS=y
+CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
+CONFIG_XEN_COMPAT_030002=y
CONFIG_HAVE_ARCH_ALLOC_SKB=y
CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
diff -r fbf676a36ee4 -r 72c5d8206d48 buildconfigs/linux-defconfig_xen_x86_32
--- a/buildconfigs/linux-defconfig_xen_x86_32 Mon May 22 08:53:26 2006 -0600
+++ b/buildconfigs/linux-defconfig_xen_x86_32 Mon May 22 14:13:38 2006 -0600
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-xen
-# Thu Apr 20 17:07:18 2006
+# Linux kernel version: 2.6.16.13-xen
+# Thu May 11 17:11:00 2006
#
CONFIG_X86_32=y
CONFIG_SEMAPHORE_SLEEPERS=y
@@ -888,7 +888,7 @@ CONFIG_MTD_NAND_DISKONCHIP=m
# CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADVANCED is not set
CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS=0
CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE=y
-CONFIG_MTD_NAND_NANDSIM=y
+CONFIG_MTD_NAND_NANDSIM=m
#
# OneNAND Flash Device Drivers
@@ -3009,7 +3009,7 @@ CONFIG_CRYPTO_TEST=m
#
# CONFIG_CRYPTO_DEV_PADLOCK is not set
CONFIG_XEN=y
-CONFIG_XEN_INTERFACE_VERSION=0x00030101
+CONFIG_XEN_INTERFACE_VERSION=0x00030202
#
# XEN
@@ -3030,10 +3030,12 @@ CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
# CONFIG_XEN_BLKDEV_TAP is not set
-CONFIG_XEN_TPMDEV_FRONTEND=m
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DISABLE_SERIAL=y
CONFIG_XEN_SYSFS=y
+CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
+CONFIG_XEN_COMPAT_030002=y
CONFIG_HAVE_ARCH_ALLOC_SKB=y
CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
diff -r fbf676a36ee4 -r 72c5d8206d48 buildconfigs/linux-defconfig_xen_x86_64
--- a/buildconfigs/linux-defconfig_xen_x86_64 Mon May 22 08:53:26 2006 -0600
+++ b/buildconfigs/linux-defconfig_xen_x86_64 Mon May 22 14:13:38 2006 -0600
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-xen
-# Thu Apr 20 17:05:48 2006
+# Linux kernel version: 2.6.16.13-xen
+# Thu May 11 17:18:58 2006
#
CONFIG_X86_64=y
CONFIG_64BIT=y
@@ -840,7 +840,7 @@ CONFIG_MTD_NAND_DISKONCHIP=m
# CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADVANCED is not set
CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS=0
CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE=y
-CONFIG_MTD_NAND_NANDSIM=y
+CONFIG_MTD_NAND_NANDSIM=m
#
# OneNAND Flash Device Drivers
@@ -2841,7 +2841,7 @@ CONFIG_CRYPTO_TEST=m
# Hardware crypto devices
#
CONFIG_XEN=y
-CONFIG_XEN_INTERFACE_VERSION=0x00030101
+CONFIG_XEN_INTERFACE_VERSION=0x00030202
#
# XEN
@@ -2863,10 +2863,12 @@ CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
# CONFIG_XEN_BLKDEV_TAP is not set
-CONFIG_XEN_TPMDEV_FRONTEND=m
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DISABLE_SERIAL=y
CONFIG_XEN_SYSFS=y
+CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
+CONFIG_XEN_COMPAT_030002=y
CONFIG_HAVE_ARCH_ALLOC_SKB=y
CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
diff -r fbf676a36ee4 -r 72c5d8206d48 docs/man/xend-config.sxp.pod.5
--- a/docs/man/xend-config.sxp.pod.5 Mon May 22 08:53:26 2006 -0600
+++ b/docs/man/xend-config.sxp.pod.5 Mon May 22 14:13:38 2006 -0600
@@ -107,7 +107,7 @@ If the value is 0, all available CPUs wi
=item I<enable-dump>
A boolean value that tells xend whether or not core dumps of guest
-domains should be saved when a crash occurrs. Defaults to I<no>.
+domains should be saved when a crash occurs. Defaults to I<no>.
=item I<external-migration-tool>
diff -r fbf676a36ee4 -r 72c5d8206d48 docs/man/xm.pod.1
--- a/docs/man/xm.pod.1 Mon May 22 08:53:26 2006 -0600
+++ b/docs/man/xm.pod.1 Mon May 22 14:13:38 2006 -0600
@@ -27,12 +27,12 @@ each of those sub commands.
=head1 NOTES
-All B<xm> opperations rely upon the Xen control daemon, aka B<xend>.
+All B<xm> operations rely upon the Xen control daemon, aka B<xend>.
For any xm commands to run xend must also be running. For this reason
you should start xend as a service when your system first boots using
xen.
-Most B<xm> commands require root privledges to run due to the
+Most B<xm> commands require root privileges to run due to the
communications channels used to talk to the hypervisor. Running as
non root will return an error.
@@ -169,7 +169,7 @@ The domain is currently running on a CPU
=item B<b - blocked>
-The domain is blocked, and not running or runable. This can be caused
+The domain is blocked, and not running or runnable. This can be caused
because the domain is waiting on IO (a traditional wait state) or has
gone to sleep because there was nothing else for it to do.
@@ -260,7 +260,7 @@ careful when using this command on runni
Migrate a domain to another Host machine. B<Xend> must be running on
other host machine, it must be running the same version of xen, it
-must have the migration tcp port open and accepting connections from
+must have the migration TCP port open and accepting connections from
the source host, and there must be sufficient resources for the domain
to run (memory, disk, etc).
@@ -337,7 +337,7 @@ severed upon restore, as TCP timeouts ma
=item B<shutdown> I<[options]> I<domain-id>
Gracefully shuts down a domain. This coordinates with the domain OS
-to perform graceful shutdown, so there is no guaruntee that it will
+to perform graceful shutdown, so there is no guarantee that it will
succeed, and may take a variable length of time depending on what
services must be shutdown in the domain. The command returns
immediately after signally the domain unless that I<-w> flag is used.
@@ -573,11 +573,11 @@ B<PARAMETERS>
=item I<period>
-The normal EDF scheduling usage in nanosecs
+The normal EDF scheduling usage in nanoseconds
=item I<slice>
-The normal EDF scheduling usage in nanosecs
+The normal EDF scheduling usage in nanoseconds
FIXME: these are lame, should explain more.
@@ -726,7 +726,7 @@ circumstances this should actually work.
=item I<mac=macaddr>
-The MAC address that the domain will see on its ethernet device. If
+The MAC address that the domain will see on its Ethernet device. If
the device is not specified it will be randomly generated with the
00:16:3e vendor id prefix.
@@ -768,7 +768,7 @@ formatted as a list or as an S-Expressio
The Virtual Network interfaces for Xen.
-FIXME: This needs a lot more explaination, or it needs to be ripped
+FIXME: This needs a lot more explanation, or it needs to be ripped
out entirely.
=over 4
diff -r fbf676a36ee4 -r 72c5d8206d48 docs/man/xmdomain.cfg.pod.5
--- a/docs/man/xmdomain.cfg.pod.5 Mon May 22 08:53:26 2006 -0600
+++ b/docs/man/xmdomain.cfg.pod.5 Mon May 22 14:13:38 2006 -0600
@@ -80,7 +80,7 @@ An array of block device stanzas, in the
disk = [ "stanza1", "stanza2", ... ]
-Each stanza has 3 terms, seperated by commas,
+Each stanza has 3 terms, separated by commas,
"backend-dev,frontend-dev,mode".
=over 4
@@ -112,7 +112,7 @@ I<r> (read-only), I<w> (read/write).
=item B<vif>
-An arrray of virtual interface stanzas in the form:
+An array of virtual interface stanzas in the form:
vif = [ "stanza1", "stanza2", ... ]
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/Makefile Mon May 22 14:13:38 2006 -0600
@@ -1,4 +1,5 @@ debug ?= y
debug ?= y
+pae ?= n
include $(CURDIR)/../../Config.mk
@@ -6,18 +7,28 @@ override TARGET_ARCH := $(XEN_TARGET
override TARGET_ARCH := $(XEN_TARGET_ARCH)
# NB. '-Wcast-qual' is nasty, so I omitted it.
-CFLAGS := -fno-builtin -Wall -Werror -Iinclude/ -Wredundant-decls -Wno-format
+CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
+
+override CPPFLAGS := -Iinclude $(CPPFLAGS)
+ASFLAGS = -D__ASSEMBLY__
+
+LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
ifeq ($(TARGET_ARCH),x86_32)
CFLAGS += -m32 -march=i686
-LDFLAGS := -m elf_i386
+LDFLAGS += -m elf_i386
+endif
+
+ifeq ($(TARGET_ARCH)$(pae),x86_32y)
+CFLAGS += -DCONFIG_X86_PAE=1
+ASFLAGS += -DCONFIG_X86_PAE=1
endif
ifeq ($(TARGET_ARCH),x86_64)
CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
CFLAGS += -fno-asynchronous-unwind-tables
-LDFLAGS := -m elf_x86_64
+LDFLAGS += -m elf_x86_64
endif
ifeq ($(debug),y)
@@ -28,12 +39,12 @@ endif
TARGET := mini-os
-OBJS := $(TARGET_ARCH).o
-OBJS += $(patsubst %.c,%.o,$(wildcard *.c))
+HEAD := $(TARGET_ARCH).o
+OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
-
+
HDRS := $(wildcard include/*.h)
HDRS += $(wildcard include/xen/*.h)
@@ -44,21 +55,25 @@ links:
links:
[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
-$(TARGET): links $(OBJS)
- $(LD) -N -T minios-$(TARGET_ARCH).lds $(OBJS) -o $@.elf
+libminios.a: $(OBJS) $(HEAD)
+ ar r libminios.a $(HEAD) $(OBJS)
+
+$(TARGET): links libminios.a $(HEAD)
+ $(LD) $(LDFLAGS) $(HEAD) -L. -lminios -o $@.elf
gzip -f -9 -c $@.elf >$@.gz
.PHONY: clean
clean:
find . -type f -name '*.o' | xargs rm -f
rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
+ rm -f libminios.a
find . -type l | xargs rm -f
%.o: %.c $(HDRS) Makefile
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
%.o: %.S $(HDRS) Makefile
- $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
+ $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@
define all_sources
( find . -follow -name SCCS -prune -o -name '*.[chS]' -print )
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/console/console.c Mon May 22 14:13:38 2006 -0600
@@ -45,6 +45,10 @@
#include <xen/io/console.h>
+/* Copies all print output to the Xen emergency console apart
+ of standard dom0 handled console */
+#define USE_XEN_CONSOLE
+
/* Low level functions defined in xencons_ring.c */
extern int xencons_ring_init(void);
extern int xencons_ring_send(const char *data, unsigned len);
@@ -117,7 +121,9 @@ void print(int direct, const char *fmt,
(void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
return;
} else {
- if(!console_initialised)
+#ifndef USE_XEN_CONSOLE
+ if(!console_initialised)
+#endif
(void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
console_print(buf, strlen(buf));
@@ -128,7 +134,7 @@ void printk(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- print(1, fmt, args);
+ print(0, fmt, args);
va_end(args);
}
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/include/mm.h
--- a/extras/mini-os/include/mm.h Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/include/mm.h Mon May 22 14:13:38 2006 -0600
@@ -43,6 +43,8 @@
#if defined(__i386__)
+#if !defined(CONFIG_X86_PAE)
+
#define L2_PAGETABLE_SHIFT 22
#define L1_PAGETABLE_ENTRIES 1024
@@ -50,6 +52,30 @@
#define PADDR_BITS 32
#define PADDR_MASK (~0UL)
+
+#define UNMAPPED_PT_FRAMES 1
+#define PRIpte "08lx"
+typedef unsigned long pgentry_t;
+
+#else /* defined(CONFIG_X86_PAE) */
+
+#define L2_PAGETABLE_SHIFT 21
+#define L3_PAGETABLE_SHIFT 30
+
+#define L1_PAGETABLE_ENTRIES 512
+#define L2_PAGETABLE_ENTRIES 512
+#define L3_PAGETABLE_ENTRIES 4
+
+#define PADDR_BITS 44
+#define PADDR_MASK ((1ULL << PADDR_BITS)-1)
+
+#define L2_MASK ((1UL << L3_PAGETABLE_SHIFT) - 1)
+
+#define UNMAPPED_PT_FRAMES 2
+#define PRIpte "016llx"
+typedef uint64_t pgentry_t;
+
+#endif /* !defined(CONFIG_X86_PAE) */
#elif defined(__x86_64__)
@@ -81,6 +107,10 @@
#define L2_MASK ((1UL << L3_PAGETABLE_SHIFT) - 1)
#define L3_MASK ((1UL << L4_PAGETABLE_SHIFT) - 1)
+#define UNMAPPED_PT_FRAMES 3
+#define PRIpte "016lx"
+typedef unsigned long pgentry_t;
+
#endif
#define L1_MASK ((1UL << L2_PAGETABLE_SHIFT) - 1)
@@ -90,9 +120,11 @@
(((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
#define l2_table_offset(_a) \
(((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
#define l3_table_offset(_a) \
(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
+#endif
+#if defined(__x86_64__)
#define l4_table_offset(_a) \
(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
#endif
@@ -111,14 +143,21 @@
#if defined(__i386__)
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER)
+#if defined(CONFIG_X86_PAE)
+#define L3_PROT (_PAGE_PRESENT)
+#endif /* CONFIG_X86_PAE */
#elif defined(__x86_64__)
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#endif
-
+#endif /* __i386__ || __x86_64__ */
+
+#ifndef CONFIG_X86_PAE
#define PAGE_SIZE (1UL << L1_PAGETABLE_SHIFT)
+#else
+#define PAGE_SIZE (1ULL << L1_PAGETABLE_SHIFT)
+#endif
#define PAGE_SHIFT L1_PAGETABLE_SHIFT
#define PAGE_MASK (~(PAGE_SIZE-1))
@@ -129,36 +168,41 @@
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
+/* Definitions for machine and pseudophysical addresses. */
+#ifdef CONFIG_X86_PAE
+typedef unsigned long long paddr_t;
+typedef unsigned long long maddr_t;
+#else
+typedef unsigned long paddr_t;
+typedef unsigned long maddr_t;
+#endif
+
extern unsigned long *phys_to_machine_mapping;
+extern char _text, _etext, _edata, _end;
#define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
-static __inline__ unsigned long phys_to_machine(unsigned long phys)
-{
- unsigned long machine = pfn_to_mfn(phys >> L1_PAGETABLE_SHIFT);
- machine = (machine << L1_PAGETABLE_SHIFT) | (phys & ~PAGE_MASK);
- return machine;
-}
-
+static __inline__ maddr_t phys_to_machine(paddr_t phys)
+{
+ maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
+ machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
+ return machine;
+}
#define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)])
-static __inline__ unsigned long machine_to_phys(unsigned long machine)
-{
- unsigned long phys = mfn_to_pfn(machine >> L1_PAGETABLE_SHIFT);
- phys = (phys << L1_PAGETABLE_SHIFT) | (machine & ~PAGE_MASK);
- return phys;
-}
-
-#if defined(__x86_64__)
-#define VIRT_START 0xFFFFFFFF80000000UL
-#elif defined(__i386__)
-#define VIRT_START 0xC0000000UL
-#endif
+static __inline__ paddr_t machine_to_phys(maddr_t machine)
+{
+ paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT);
+ phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
+ return phys;
+}
+
+#define VIRT_START ((unsigned long)&_text)
#define to_phys(x) ((unsigned long)(x)-VIRT_START)
#define to_virt(x) ((void *)((unsigned long)(x)+VIRT_START))
#define virt_to_pfn(_virt) (PFN_DOWN(to_phys(_virt)))
#define mach_to_virt(_mach) (to_virt(machine_to_phys(_mach)))
-#define mfn_to_virt(_mfn) (mach_to_virt(_mfn << PAGE_SHIFT))
+#define mfn_to_virt(_mfn) (to_virt(mfn_to_pfn(_mfn) << PAGE_SHIFT))
#define pfn_to_virt(_pfn) (to_virt(_pfn << PAGE_SHIFT))
/* Pagetable walking. */
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/include/types.h
--- a/extras/mini-os/include/types.h Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/include/types.h Mon May 22 14:13:38 2006 -0600
@@ -43,14 +43,19 @@ typedef unsigned long long u_quad_t;
typedef unsigned long long u_quad_t;
typedef unsigned int uintptr_t;
+#if !defined(CONFIG_X86_PAE)
typedef struct { unsigned long pte_low; } pte_t;
+#else
+typedef struct { unsigned long pte_low, pte_high; } pte_t;
+#endif /* CONFIG_X86_PAE */
+
#elif defined(__x86_64__)
typedef long quad_t;
typedef unsigned long u_quad_t;
typedef unsigned long uintptr_t;
typedef struct { unsigned long pte; } pte_t;
-#endif
+#endif /* __i386__ || __x86_64__ */
typedef u8 uint8_t;
typedef s8 int8_t;
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/kernel.c Mon May 22 14:13:38 2006 -0600
@@ -63,7 +63,12 @@ void failsafe_callback(void);
extern char shared_info[PAGE_SIZE];
+#if !defined(CONFIG_X86_PAE)
#define __pte(x) ((pte_t) { (x) } )
+#else
+#define __pte(x) ({ unsigned long long _x = (x); \
+ ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
+#endif
static shared_info_t *map_shared_info(unsigned long pa)
{
@@ -71,7 +76,7 @@ static shared_info_t *map_shared_info(un
(unsigned long)shared_info, __pte(pa | 7), UVMF_INVLPG) )
{
printk("Failed to map shared_info!!\n");
- *(int*)0=0;
+ do_exit();
}
return (shared_info_t *)shared_info;
}
@@ -106,6 +111,12 @@ void setup_xen_features(void)
}
}
+/* This should be overridden by the application we are linked against. */
+__attribute__((weak)) int app_main(start_info_t *si)
+{
+ printk("Dummy main: start_info=%p\n", si);
+ return 0;
+}
/*
* INITIAL C ENTRY POINT.
@@ -120,6 +131,10 @@ void start_kernel(start_info_t *si)
/* WARN: don't do printk before here, it uses information from
shared_info. Use xprintk instead. */
memcpy(&start_info, si, sizeof(*si));
+
+ /* set up minimal memory infos */
+ phys_to_machine_mapping = (unsigned long *)start_info.mfn_list;
+
/* Grab the shared_info pointer and put it in a safe place. */
HYPERVISOR_shared_info = map_shared_info(start_info.shared_info);
@@ -165,12 +180,15 @@ void start_kernel(start_info_t *si)
/* Init the console driver. */
init_console();
- /* Init scheduler. */
+ /* Init scheduler. */
init_sched();
/* Init XenBus from a separate thread */
create_thread("init_xs", init_xs, NULL);
+ /* Call (possibly overridden) app_main() */
+ app_main(&start_info);
+
/* Everything initialised, start idle thread */
run_idle_thread();
}
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/mm.c
--- a/extras/mini-os/mm.c Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/mm.c Mon May 22 14:13:38 2006 -0600
@@ -50,7 +50,6 @@
unsigned long *phys_to_machine_mapping;
extern char *stack;
-extern char _text, _etext, _edata, _end;
extern void page_walk(unsigned long virt_addr);
/*********************
@@ -369,7 +368,7 @@ void new_pt_frame(unsigned long *pt_pfn,
void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
unsigned long offset, unsigned long level)
{
- unsigned long *tab = (unsigned long *)start_info.pt_base;
+ pgentry_t *tab = (pgentry_t *)start_info.pt_base;
unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn);
unsigned long prot_e, prot_t, pincmd;
mmu_update_t mmu_updates[1];
@@ -383,40 +382,45 @@ void new_pt_frame(unsigned long *pt_pfn,
as a page table page */
memset((unsigned long*)pfn_to_virt(*pt_pfn), 0, PAGE_SIZE);
- if (level == L1_FRAME)
- {
+ switch ( level )
+ {
+ case L1_FRAME:
prot_e = L1_PROT;
prot_t = L2_PROT;
pincmd = MMUEXT_PIN_L1_TABLE;
- }
-#if (defined __x86_64__)
- else if (level == L2_FRAME)
- {
+ break;
+#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
+ case L2_FRAME:
prot_e = L2_PROT;
prot_t = L3_PROT;
pincmd = MMUEXT_PIN_L2_TABLE;
- }
- else if (level == L3_FRAME)
- {
+ break;
+#endif
+#if defined(__x86_64__)
+ case L3_FRAME:
prot_e = L3_PROT;
prot_t = L4_PROT;
pincmd = MMUEXT_PIN_L3_TABLE;
- }
-#endif
- else
- {
+ break;
+#endif
+ default:
printk("new_pt_frame() called with invalid level number %d\n", level);
do_exit();
- }
+ break;
+ }
/* Update the entry */
-#if (defined __x86_64__)
+#if defined(__x86_64__)
tab = pte_to_virt(tab[l4_table_offset(pt_page)]);
tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
#endif
- mmu_updates[0].ptr = (tab[l2_table_offset(pt_page)] & PAGE_MASK) +
- sizeof(void *)* l1_table_offset(pt_page);
- mmu_updates[0].val = pfn_to_mfn(*pt_pfn) << PAGE_SHIFT |
+#if defined(CONFIG_X86_PAE)
+ tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
+#endif
+
+ mmu_updates[0].ptr = ((pgentry_t)tab[l2_table_offset(pt_page)] &
PAGE_MASK) +
+ sizeof(pgentry_t) * l1_table_offset(pt_page);
+ mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT |
(prot_e & ~_PAGE_RW);
if(HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF) < 0)
{
@@ -435,8 +439,8 @@ void new_pt_frame(unsigned long *pt_pfn,
/* Now fill the new page table page with entries.
Update the page directory as well. */
- mmu_updates[0].ptr = (prev_l_mfn << PAGE_SHIFT) + sizeof(void *) * offset;
- mmu_updates[0].val = pfn_to_mfn(*pt_pfn) << PAGE_SHIFT | prot_t;
+ mmu_updates[0].ptr = ((pgentry_t)prev_l_mfn << PAGE_SHIFT) +
sizeof(pgentry_t) * offset;
+ mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT | prot_t;
if(HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF) < 0)
{
printk("ERROR: mmu_update failed\n");
@@ -451,16 +455,13 @@ void build_pagetable(unsigned long *star
unsigned long start_address, end_address;
unsigned long pfn_to_map, pt_pfn = *start_pfn;
static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
- unsigned long *tab = (unsigned long *)start_info.pt_base;
+ pgentry_t *tab = (pgentry_t *)start_info.pt_base, page;
unsigned long mfn = pfn_to_mfn(virt_to_pfn(start_info.pt_base));
- unsigned long page, offset;
+ unsigned long offset;
int count = 0;
-#if defined(__x86_64__)
- pfn_to_map = (start_info.nr_pt_frames - 3) * L1_PAGETABLE_ENTRIES;
-#else
- pfn_to_map = (start_info.nr_pt_frames - 1) * L1_PAGETABLE_ENTRIES;
-#endif
+ pfn_to_map = (start_info.nr_pt_frames - UNMAPPED_PT_FRAMES) *
L1_PAGETABLE_ENTRIES;
+
start_address = (unsigned long)pfn_to_virt(pfn_to_map);
end_address = (unsigned long)pfn_to_virt(*max_pfn);
@@ -469,7 +470,7 @@ void build_pagetable(unsigned long *star
while(start_address < end_address)
{
- tab = (unsigned long *)start_info.pt_base;
+ tab = (pgentry_t *)start_info.pt_base;
mfn = pfn_to_mfn(virt_to_pfn(start_info.pt_base));
#if defined(__x86_64__)
@@ -481,6 +482,8 @@ void build_pagetable(unsigned long *star
page = tab[offset];
mfn = pte_to_mfn(page);
tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
+#endif
+#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
offset = l3_table_offset(start_address);
/* Need new L2 pt frame */
if(!(start_address & L2_MASK))
@@ -499,9 +502,9 @@ void build_pagetable(unsigned long *star
mfn = pte_to_mfn(page);
offset = l1_table_offset(start_address);
- mmu_updates[count].ptr = (mfn << PAGE_SHIFT) + sizeof(void *) * offset;
+ mmu_updates[count].ptr = ((pgentry_t)mfn << PAGE_SHIFT) +
sizeof(pgentry_t) * offset;
mmu_updates[count].val =
- pfn_to_mfn(pfn_to_map++) << PAGE_SHIFT | L1_PROT;
+ (pgentry_t)pfn_to_mfn(pfn_to_map++) << PAGE_SHIFT | L1_PROT;
count++;
if (count == L1_PAGETABLE_ENTRIES || pfn_to_map == *max_pfn)
{
@@ -558,9 +561,6 @@ void init_mm(void)
printk(" stack start: %p\n", &stack);
printk(" _end: %p\n", &_end);
- /* set up minimal memory infos */
- phys_to_machine_mapping = (unsigned long *)start_info.mfn_list;
-
/* First page follows page table pages and 3 more pages (store page etc) */
start_pfn = PFN_UP(to_phys(start_info.pt_base)) +
start_info.nr_pt_frames + 3;
@@ -570,7 +570,7 @@ void init_mm(void)
printk(" max_pfn: %lx\n", max_pfn);
build_pagetable(&start_pfn, &max_pfn);
-
+
/*
* now we can initialise the page allocator
*/
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/traps.c
--- a/extras/mini-os/traps.c Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/traps.c Mon May 22 14:13:38 2006 -0600
@@ -95,34 +95,47 @@ DO_ERROR(18, "machine check", machine_ch
void page_walk(unsigned long virt_address)
{
- unsigned long *tab = (unsigned long *)start_info.pt_base;
- unsigned long addr = virt_address, page;
+ pgentry_t *tab = (pgentry_t *)start_info.pt_base, page;
+ unsigned long addr = virt_address;
printk("Pagetable walk from virt %lx, base %lx:\n", virt_address,
start_info.pt_base);
#if defined(__x86_64__)
page = tab[l4_table_offset(addr)];
- tab = to_virt(mfn_to_pfn(pte_to_mfn(page)) << PAGE_SHIFT);
- printk(" L4 = %p (%p) [offset = %lx]\n", page, tab,
l4_table_offset(addr));
-
+ tab = pte_to_virt(page);
+ printk(" L4 = %"PRIpte" (%p) [offset = %lx]\n", page, tab,
l4_table_offset(addr));
+#endif
+#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
page = tab[l3_table_offset(addr)];
- tab = to_virt(mfn_to_pfn(pte_to_mfn(page)) << PAGE_SHIFT);
- printk(" L3 = %p (%p) [offset = %lx]\n", page, tab,
l3_table_offset(addr));
+ tab = pte_to_virt(page);
+ printk(" L3 = %"PRIpte" (%p) [offset = %lx]\n", page, tab,
l3_table_offset(addr));
#endif
page = tab[l2_table_offset(addr)];
- tab = to_virt(mfn_to_pfn(pte_to_mfn(page)) << PAGE_SHIFT);
- printk(" L2 = %p (%p) [offset = %lx]\n", page, tab,
l2_table_offset(addr));
+ tab = pte_to_virt(page);
+ printk(" L2 = %"PRIpte" (%p) [offset = %lx]\n", page, tab,
l2_table_offset(addr));
page = tab[l1_table_offset(addr)];
- printk(" L1 = %p (%p) [offset = %lx]\n", page, tab,
l1_table_offset(addr));
+ printk(" L1 = %"PRIpte" (%p) [offset = %lx]\n", page, tab,
l1_table_offset(addr));
}
#define read_cr2() \
(HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].arch.cr2)
+static int handling_pg_fault = 0;
+
void do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
unsigned long addr = read_cr2();
+ /* If we are already handling a page fault, and got another one
+ that means we faulted in pagetable walk. Continuing here would cause
+ a recursive fault */
+ if(handling_pg_fault)
+ {
+ printk("Page fault in pagetable walk (access to invalid memory?).\n");
+ do_exit();
+ }
+ handling_pg_fault = 1;
+
#if defined(__x86_64__)
printk("Page fault at linear address %p, rip %p, code %lx\n",
addr, regs->rip, error_code);
@@ -130,9 +143,12 @@ void do_page_fault(struct pt_regs *regs,
printk("Page fault at linear address %p, eip %p, code %lx\n",
addr, regs->eip, error_code);
#endif
+
dump_regs(regs);
page_walk(addr);
do_exit();
+ /* We should never get here ... but still */
+ handling_pg_fault = 0;
}
void do_general_protection(struct pt_regs *regs, long error_code)
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/x86_32.S
--- a/extras/mini-os/x86_32.S Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/x86_32.S Mon May 22 14:13:38 2006 -0600
@@ -4,9 +4,15 @@
.section __xen_guest
.ascii "GUEST_OS=Mini-OS"
.ascii ",XEN_VER=xen-3.0"
+ .ascii ",VIRT_BASE=0xc0000000" /* &_text from minios_x86_32.lds */
+ .ascii ",ELF_PADDR_OFFSET=0xc0000000"
.ascii ",HYPERCALL_PAGE=0x2"
+#ifdef CONFIG_X86_PAE
+ .ascii ",PAE=yes"
+#else
+ .ascii ",PAE=no"
+#endif
.ascii ",LOADER=generic"
- .ascii ",PT_MODE_WRITABLE"
.byte 0
.text
diff -r fbf676a36ee4 -r 72c5d8206d48 extras/mini-os/x86_64.S
--- a/extras/mini-os/x86_64.S Mon May 22 08:53:26 2006 -0600
+++ b/extras/mini-os/x86_64.S Mon May 22 14:13:38 2006 -0600
@@ -4,9 +4,10 @@
.section __xen_guest
.ascii "GUEST_OS=Mini-OS"
.ascii ",XEN_VER=xen-3.0"
+ .ascii ",VIRT_BASE=0xffffffff80000000" /* &_text from
minios_x86_64.lds */
+ .ascii ",ELF_PADDR_OFFSET=0xffffffff80000000"
.ascii ",HYPERCALL_PAGE=0x2"
.ascii ",LOADER=generic"
- .ascii ",PT_MODE_WRITABLE"
.byte 0
.text
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/kernel/fixup.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/fixup.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/fixup.c Mon May 22 14:13:38
2006 -0600
@@ -84,13 +84,3 @@ static int __init fixup_init(void)
return 0;
}
__initcall(fixup_init);
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S
--- a/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S Mon May 22 14:13:38
2006 -0600
@@ -23,6 +23,8 @@
#define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
#define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id
+#define VIRT_ENTRY_OFFSET 0x0
+.org VIRT_ENTRY_OFFSET
ENTRY(startup_32)
movl %esi,xen_start_info
cld
@@ -155,6 +157,14 @@ ENTRY(cpu_gdt_table)
.ascii ",XEN_VER=xen-3.0"
.ascii ",VIRT_BASE=0x"
utoa __PAGE_OFFSET
+#ifdef CONFIG_XEN_COMPAT_030002
+ .ascii ",ELF_PADDR_OFFSET=0x"
+ utoa __PAGE_OFFSET
+#else
+ .ascii ",ELF_PADDR_OFFSET=0x0"
+#endif /* !CONFIG_XEN_COMPAT_030002 */
+ .ascii ",VIRT_ENTRY=0x"
+ utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
.ascii ",HYPERCALL_PAGE=0x"
utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
.ascii ",FEATURES=writable_page_tables"
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c Mon May 22
14:13:38 2006 -0600
@@ -342,13 +342,3 @@ dma_sync_single_for_device(struct device
swiotlb_sync_single_for_device(dev, dma_handle, size,
direction);
}
EXPORT_SYMBOL(dma_sync_single_for_device);
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Mon May 22 14:13:38
2006 -0600
@@ -70,9 +70,6 @@
/* Forward Declaration. */
void __init find_max_pfn(void);
-
-/* Allows setting of maximum possible memory size */
-static unsigned long xen_override_max_pfn;
static int xen_panic_event(struct notifier_block *, unsigned long, void *);
static struct notifier_block xen_panic_block = {
@@ -399,6 +396,26 @@ start_info_t *xen_start_info;
start_info_t *xen_start_info;
EXPORT_SYMBOL(xen_start_info);
+static void __init add_memory_region(unsigned long long start,
+ unsigned long long size, int type)
+{
+ int x;
+
+ if (!efi_enabled) {
+ x = e820.nr_map;
+
+ if (x == E820MAX) {
+ printk(KERN_ERR "Ooops! Too many entries in the memory
map!\n");
+ return;
+ }
+
+ e820.map[x].addr = start;
+ e820.map[x].size = size;
+ e820.map[x].type = type;
+ e820.nr_map++;
+ }
+} /* add_memory_region */
+
static void __init limit_regions(unsigned long long size)
{
unsigned long long current_addr = 0;
@@ -442,27 +459,20 @@ static void __init limit_regions(unsigne
}
return;
}
-}
-
-static void __init add_memory_region(unsigned long long start,
- unsigned long long size, int type)
-{
- int x;
-
- if (!efi_enabled) {
- x = e820.nr_map;
-
- if (x == E820MAX) {
- printk(KERN_ERR "Ooops! Too many entries in the memory
map!\n");
- return;
- }
-
- e820.map[x].addr = start;
- e820.map[x].size = size;
- e820.map[x].type = type;
- e820.nr_map++;
- }
-} /* add_memory_region */
+#ifdef CONFIG_XEN
+ if (i==e820.nr_map && current_addr < size) {
+ /*
+ * The e820 map finished before our requested size so
+ * extend the final entry to the requested address.
+ */
+ --i;
+ if (e820.map[i].type == E820_RAM)
+ e820.map[i].size -= current_addr - size;
+ else
+ add_memory_region(current_addr, size - current_addr,
E820_RAM);
+ }
+#endif
+}
#define E820_DEBUG 1
@@ -492,7 +502,6 @@ static void __init print_memory_map(char
}
}
-#if 0
/*
* Sanitize the BIOS e820 map.
*
@@ -680,9 +689,13 @@ static int __init sanitize_e820_map(stru
*/
static int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
{
+#ifndef CONFIG_XEN
/* Only one memory region (or negative)? Ignore it */
if (nr_map < 2)
return -1;
+#else
+ BUG_ON(nr_map < 1);
+#endif
do {
unsigned long long start = biosmap->addr;
@@ -694,6 +707,7 @@ static int __init copy_e820_map(struct e
if (start > end)
return -1;
+#ifndef CONFIG_XEN
/*
* Some BIOSes claim RAM in the 640k - 1M region.
* Not right. Fix it up.
@@ -708,11 +722,11 @@ static int __init copy_e820_map(struct e
size = end - start;
}
}
+#endif
add_memory_region(start, size, type);
} while (biosmap++,--nr_map);
return 0;
}
-#endif
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
struct edd edd;
@@ -785,13 +799,8 @@ static void __init parse_cmdline_early (
unsigned long long mem_size;
mem_size = memparse(from+4, &from);
-#if 0
limit_regions(mem_size);
userdef=1;
-#else
- xen_override_max_pfn =
- (unsigned long)(mem_size>>PAGE_SHIFT);
-#endif
}
}
@@ -984,7 +993,6 @@ static void __init parse_cmdline_early (
}
}
-#if 0 /* !XEN */
/*
* Callback for efi_memory_walk.
*/
@@ -1036,21 +1044,6 @@ void __init find_max_pfn(void)
memory_present(0, start, end);
}
}
-#else
-/* We don't use the fake e820 because we need to respond to user override. */
-void __init find_max_pfn(void)
-{
- if (xen_override_max_pfn == 0) {
- max_pfn = xen_start_info->nr_pages;
- /* Default 8MB slack (to balance backend allocations). */
- max_pfn += 8 << (20 - PAGE_SHIFT);
- } else if (xen_override_max_pfn > xen_start_info->nr_pages) {
- max_pfn = xen_override_max_pfn;
- } else {
- max_pfn = xen_start_info->nr_pages;
- }
-}
-#endif /* XEN */
/*
* Determine low and high memory ranges:
@@ -1158,6 +1151,15 @@ static void __init register_bootmem_low_
*/
last_pfn = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
+#ifdef CONFIG_XEN
+ /*
+ * Truncate to the number of actual pages currently
+ * present.
+ */
+ if (last_pfn > xen_start_info->nr_pages)
+ last_pfn = xen_start_info->nr_pages;
+#endif
+
if (last_pfn > max_low_pfn)
last_pfn = max_low_pfn;
@@ -1351,83 +1353,33 @@ void __init remapped_pgdat_init(void)
* and also for regions reported as reserved by the e820.
*/
static void __init
-legacy_init_iomem_resources(struct resource *code_resource, struct resource
*data_resource)
+legacy_init_iomem_resources(struct e820entry *e820, int nr_map,
+ struct resource *code_resource,
+ struct resource *data_resource)
{
int i;
-#ifdef CONFIG_XEN
- dom0_op_t op;
- struct dom0_memory_map_entry *map;
- unsigned long gapstart, gapsize;
- unsigned long long last;
-#endif
-
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+
+#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
probe_roms();
#endif
-#ifdef CONFIG_XEN
- map = alloc_bootmem_low_pages(PAGE_SIZE);
- op.cmd = DOM0_PHYSICAL_MEMORY_MAP;
- set_xen_guest_handle(op.u.physical_memory_map.memory_map, map);
- op.u.physical_memory_map.max_map_entries =
- PAGE_SIZE / sizeof(struct dom0_memory_map_entry);
- BUG_ON(HYPERVISOR_dom0_op(&op));
-
- last = 0x100000000ULL;
- gapstart = 0x10000000;
- gapsize = 0x400000;
-
- for (i = op.u.physical_memory_map.nr_map_entries - 1; i >= 0; i--) {
+ for (i = 0; i < nr_map; i++) {
struct resource *res;
-
- if ((last > map[i].end) && ((last - map[i].end) > gapsize)) {
- gapsize = last - map[i].end;
- gapstart = map[i].end;
- }
- if (map[i].start < last)
- last = map[i].start;
-
- if (map[i].end > 0x100000000ULL)
+ if (e820[i].addr + e820[i].size > 0x100000000ULL)
continue;
res = alloc_bootmem_low(sizeof(struct resource));
- res->name = map[i].is_ram ? "System RAM" : "reserved";
- res->start = map[i].start;
- res->end = map[i].end - 1;
- res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
- request_resource(&iomem_resource, res);
- }
-
- free_bootmem(__pa(map), PAGE_SIZE);
-
- /*
- * Start allocating dynamic PCI memory a bit into the gap,
- * aligned up to the nearest megabyte.
- *
- * Question: should we try to pad it up a bit (do something
- * like " + (gapsize >> 3)" in there too?). We now have the
- * technology.
- */
- pci_mem_start = (gapstart + 0xfffff) & ~0xfffff;
-
- printk("Allocating PCI resources starting at %08lx (gap:
%08lx:%08lx)\n",
- pci_mem_start, gapstart, gapsize);
-#else
- for (i = 0; i < e820.nr_map; i++) {
- struct resource *res;
- if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
- continue;
- res = alloc_bootmem_low(sizeof(struct resource));
- switch (e820.map[i].type) {
+ switch (e820[i].type) {
case E820_RAM: res->name = "System RAM"; break;
case E820_ACPI: res->name = "ACPI Tables"; break;
case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
default: res->name = "reserved";
}
- res->start = e820.map[i].addr;
- res->end = res->start + e820.map[i].size - 1;
+ res->start = e820[i].addr;
+ res->end = res->start + e820[i].size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res);
- if (e820.map[i].type == E820_RAM) {
+#ifndef CONFIG_XEN
+ if (e820[i].type == E820_RAM) {
/*
* We don't know which RAM region contains kernel data,
* so we try it repeatedly and let the resource manager
@@ -1439,38 +1391,21 @@ legacy_init_iomem_resources(struct resou
request_resource(res, &crashk_res);
#endif
}
- }
-#endif
-}
-
-/*
- * Request address space for all standard resources
- */
-static void __init register_memory(void)
-{
-#ifndef CONFIG_XEN
+#endif
+ }
+}
+
+/*
+ * Locate a unused range of the physical address space below 4G which
+ * can be used for PCI mappings.
+ */
+static void __init
+e820_setup_gap(struct e820entry *e820, int nr_map)
+{
unsigned long gapstart, gapsize, round;
unsigned long long last;
-#endif
- int i;
-
- /* Nothing to do if not running in dom0. */
- if (!(xen_start_info->flags & SIF_INITDOMAIN))
- return;
-
- if (efi_enabled)
- efi_initialize_iomem_resources(&code_resource, &data_resource);
- else
- legacy_init_iomem_resources(&code_resource, &data_resource);
-
- /* EFI systems may still have VGA */
- request_resource(&iomem_resource, &video_ram_resource);
-
- /* request I/O space for devices used on all i[345]86 PCs */
- for (i = 0; i < STANDARD_IO_RESOURCES; i++)
- request_resource(&ioport_resource, &standard_io_resources[i]);
-
-#ifndef CONFIG_XEN
+ int i;
+
/*
* Search for the bigest gap in the low 32 bits of the e820
* memory space.
@@ -1478,10 +1413,10 @@ static void __init register_memory(void)
last = 0x100000000ull;
gapstart = 0x10000000;
gapsize = 0x400000;
- i = e820.nr_map;
+ i = nr_map;
while (--i >= 0) {
- unsigned long long start = e820.map[i].addr;
- unsigned long long end = start + e820.map[i].size;
+ unsigned long long start = e820[i].addr;
+ unsigned long long end = start + e820[i].size;
/*
* Since "last" is at most 4GB, we know we'll
@@ -1511,6 +1446,53 @@ static void __init register_memory(void)
printk("Allocating PCI resources starting at %08lx (gap:
%08lx:%08lx)\n",
pci_mem_start, gapstart, gapsize);
+}
+
+/*
+ * Request address space for all standard resources
+ */
+static void __init register_memory(void)
+{
+#ifdef CONFIG_XEN
+ struct e820entry *machine_e820;
+ struct xen_memory_map memmap;
+#endif
+ int i;
+
+ /* Nothing to do if not running in dom0. */
+ if (!(xen_start_info->flags & SIF_INITDOMAIN))
+ return;
+
+#ifdef CONFIG_XEN
+ machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
+
+ memmap.nr_entries = E820MAX;
+ set_xen_guest_handle(memmap.buffer, machine_e820);
+
+ BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
+
+ legacy_init_iomem_resources(machine_e820, memmap.nr_entries,
+ &code_resource, &data_resource);
+#else
+ if (efi_enabled)
+ efi_initialize_iomem_resources(&code_resource, &data_resource);
+ else
+ legacy_init_iomem_resources(e820.map, e820.nr_map,
+ &code_resource, &data_resource);
+#endif
+
+ /* EFI systems may still have VGA */
+ request_resource(&iomem_resource, &video_ram_resource);
+
+ /* request I/O space for devices used on all i[345]86 PCs */
+ for (i = 0; i < STANDARD_IO_RESOURCES; i++)
+ request_resource(&ioport_resource, &standard_io_resources[i]);
+
+#ifdef CONFIG_XEN
+ e820_setup_gap(machine_e820, memmap.nr_entries);
+ free_bootmem(__pa(machine_e820), PAGE_SIZE);
+#else
+ e820_setup_gap(e820.map, e820.nr_map);
#endif
}
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c Mon May 22 14:13:38
2006 -0600
@@ -191,6 +191,7 @@ swiotlb_init(void)
if (swiotlb_force == 1) {
swiotlb = 1;
} else if ((swiotlb_force != -1) &&
+ is_running_on_xen() &&
(xen_start_info->flags & SIF_INITDOMAIN)) {
/* Domain 0 always has a swiotlb. */
ram_end = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
@@ -662,13 +663,3 @@ EXPORT_SYMBOL(swiotlb_unmap_page);
EXPORT_SYMBOL(swiotlb_unmap_page);
EXPORT_SYMBOL(swiotlb_dma_mapping_error);
EXPORT_SYMBOL(swiotlb_dma_supported);
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c Mon May 22 14:13:38
2006 -0600
@@ -1085,13 +1085,3 @@ static int __init xen_sysctl_init(void)
return 0;
}
__initcall(xen_sysctl_init);
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Mon May 22 14:13:38
2006 -0600
@@ -412,13 +412,3 @@ int write_ldt_entry(void *ldt, int entry
mach_lp, (u64)entry_a | ((u64)entry_b<<32));
}
#endif
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/mm/init-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c Mon May 22 14:13:38
2006 -0600
@@ -228,6 +228,12 @@ static inline int page_kills_ppro(unsign
return 0;
}
+#else
+
+#define page_kills_ppro(p) 0
+
+#endif
+
extern int is_available_memory(efi_memory_desc_t *);
int page_is_ram(unsigned long pagenr)
@@ -268,13 +274,6 @@ int page_is_ram(unsigned long pagenr)
}
return 0;
}
-
-#else /* CONFIG_XEN */
-
-#define page_kills_ppro(p) 0
-#define page_is_ram(p) 1
-
-#endif
#ifdef CONFIG_HIGHMEM
pte_t *kmap_pte;
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Mon May 22 14:13:38
2006 -0600
@@ -478,13 +478,3 @@ void __init bt_iounmap(void *addr, unsig
}
#endif /* __i386__ */
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c Mon May 22 14:13:38
2006 -0600
@@ -640,13 +640,3 @@ void _arch_exit_mmap(struct mm_struct *m
(atomic_read(&mm->mm_count) == 1))
mm_unpin(mm);
}
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
--- a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c Mon May 22
14:13:38 2006 -0600
@@ -141,56 +141,40 @@ xenoprof_ovf_interrupt(int irq, void * d
}
-static void unbind_virq_cpu(void * info)
-{
- int cpu = smp_processor_id();
- if (ovf_irq[cpu] >= 0) {
- unbind_from_irqhandler(ovf_irq[cpu], NULL);
- ovf_irq[cpu] = -1;
- }
-}
-
-
static void unbind_virq(void)
{
- on_each_cpu(unbind_virq_cpu, NULL, 0, 1);
-}
-
-
-int bind_virq_error;
-
-static void bind_virq_cpu(void * info)
-{
- int result;
- int cpu = smp_processor_id();
-
- result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
- cpu,
- xenoprof_ovf_interrupt,
- SA_INTERRUPT,
- "xenoprof",
- NULL);
-
- if (result<0) {
- bind_virq_error = result;
- printk("xenoprof.c: binding VIRQ_XENOPROF to IRQ failed on CPU "
- "%d\n", cpu);
- } else {
- ovf_irq[cpu] = result;
+ int i;
+
+ for_each_cpu(i) {
+ if (ovf_irq[i] >= 0) {
+ unbind_from_irqhandler(ovf_irq[i], NULL);
+ ovf_irq[i] = -1;
+ }
}
}
static int bind_virq(void)
{
- bind_virq_error = 0;
- on_each_cpu(bind_virq_cpu, NULL, 0, 1);
- if (bind_virq_error) {
- unbind_virq();
- return bind_virq_error;
- } else {
- return 0;
- }
+ int i, result;
+
+ for_each_cpu(i) {
+ result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
+ i,
+ xenoprof_ovf_interrupt,
+ SA_INTERRUPT,
+ "xenoprof",
+ NULL);
+
+ if (result < 0) {
+ unbind_virq();
+ return result;
+ }
+
+ ovf_irq[i] = result;
+ }
+
+ return 0;
}
@@ -305,9 +289,13 @@ static int xenoprof_set_active(int * act
for (i=0; i<adomains; i++) {
domid = active_domains[i];
+ if (domid != active_domains[i]) {
+ ret = -EINVAL;
+ goto out;
+ }
ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid);
if (ret)
- return (ret);
+ goto out;
if (active_domains[i] == 0)
set_dom0 = 1;
}
@@ -316,8 +304,11 @@ static int xenoprof_set_active(int * act
domid = 0;
ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid);
}
-
- active_defined = 1;
+
+out:
+ if (ret)
+ HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL);
+ active_defined = !ret;
return ret;
}
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Mon May 22 14:13:38
2006 -0600
@@ -514,6 +514,9 @@ setup_arch (char **cmdline_p)
#ifdef CONFIG_XEN
if (running_on_xen) {
extern shared_info_t *HYPERVISOR_shared_info;
+ extern int xen_init (void);
+
+ xen_init ();
/* xen_start_info isn't setup yet, get the flags manually */
if (HYPERVISOR_shared_info->arch.flags & SIF_INITDOMAIN) {
diff -r fbf676a36ee4 -r 72c5d8206d48 linux-2.6-xen-sparse/arch/ia64/xen/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/xen/Makefile Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/Makefile Mon May 22 14:13:38
2006 -0600
@@ -2,7 +2,7 @@
# Makefile for Xen components
#
-obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o
xenconsole.o xen_ksyms.o
+obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o
xenconsole.o
obj-$(CONFIG_XEN_IA64_DOM0_VP) += hypervisor.o pci-dma-xen.o util.o
-pci-dma-xen-$(CONFIG_XEN_IA64_DOM0_VP) := ../../i386/kernel/pci-dma-xen.o
\ No newline at end of file
+pci-dma-xen-$(CONFIG_XEN_IA64_DOM0_VP) := ../../i386/kernel/pci-dma-xen.o
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c Mon May 22
14:13:38 2006 -0600
@@ -11,17 +11,20 @@ shared_info_t *HYPERVISOR_shared_info =
shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)XSI_BASE;
EXPORT_SYMBOL(HYPERVISOR_shared_info);
-static int initialized;
start_info_t *xen_start_info;
+
+int running_on_xen;
+EXPORT_SYMBOL(running_on_xen);
int xen_init(void)
{
+ static int initialized;
shared_info_t *s = HYPERVISOR_shared_info;
if (initialized)
return running_on_xen ? 0 : -1;
- if (!running_on_xen)
+ if (!is_running_on_xen())
return -1;
xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S Mon May 22 14:13:38
2006 -0600
@@ -7,12 +7,6 @@
#include <linux/config.h>
#include <asm/processor.h>
#include <asm/asmmacro.h>
-
- .data
- .align 8
- .globl running_on_xen
-running_on_xen:
- data4 0
#define isBP p3 // are we the Bootstrap Processor?
@@ -28,9 +22,3 @@ GLOBAL_ENTRY(early_xen_setup)
(p7) mov cr.iva=r10
br.ret.sptk.many rp;;
END(early_xen_setup)
-
-GLOBAL_ENTRY(is_running_on_xen)
- movl r9=running_on_xen;;
- ld4 r8=[r9]
- br.ret.sptk.many rp;;
-END(is_running_on_xen)
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c Mon May 22
14:13:38 2006 -0600
@@ -26,53 +26,34 @@
#include <asm/sections.h>
#include <xen/interface/memory.h>
-unsigned long pci_mem_start = 0xaeedbabe;
-
/*
* PFN of last memory page.
*/
unsigned long end_pfn;
EXPORT_SYMBOL(end_pfn);
-unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;
-unsigned long end_pfn_map;
-
-/*
- * Add a memory region to the kernel e820 map.
- */
-void __init add_memory_region(unsigned long start, unsigned long size, int
type)
-{
- int x = e820.nr_map;
-
- if (x == E820MAX) {
- printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
- return;
- }
-
- e820.map[x].addr = start;
- e820.map[x].size = size;
- e820.map[x].type = type;
- e820.nr_map++;
-}
-
-#ifndef CONFIG_XEN
/*
* end_pfn only includes RAM, while end_pfn_map includes all e820 entries.
* The direct mapping extends to end_pfn_map, so that we can directly access
* apertures, ACPI and other tables without having to play with fixmaps.
*/
+unsigned long end_pfn_map;
/*
* Last pfn which the user wants to use.
*/
-
+unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;
+
+#ifndef CONFIG_XEN
extern struct resource code_resource, data_resource;
+#endif
/* Check for some hardcoded bad areas that early boot is not allowed to touch
*/
static inline int bad_addr(unsigned long *addrp, unsigned long size)
{
unsigned long addr = *addrp, last = addr + size;
+#ifndef CONFIG_XEN
/* various gunk below that needed for SMP startup */
if (addr < 0x8000) {
*addrp = 0x8000;
@@ -100,9 +81,16 @@ static inline int bad_addr(unsigned long
return 1;
}
/* XXX ramdisk image here? */
+#else
+ if (last < (table_end<<PAGE_SHIFT)) {
+ *addrp = table_end << PAGE_SHIFT;
+ return 1;
+ }
+#endif
return 0;
}
+#ifndef CONFIG_XEN
int __init e820_mapped(unsigned long start, unsigned long end, unsigned type)
{
int i;
@@ -116,6 +104,7 @@ int __init e820_mapped(unsigned long sta
}
return 0;
}
+#endif
/*
* Find a free area in a specific range.
@@ -246,22 +235,23 @@ e820_hole_size(unsigned long start_pfn,
/*
* Mark e820 reserved areas as busy for the resource manager.
*/
-void __init e820_reserve_resources(void)
-{
- int i;
- for (i = 0; i < e820.nr_map; i++) {
+void __init e820_reserve_resources(struct e820entry *e820, int nr_map)
+{
+ int i;
+ for (i = 0; i < nr_map; i++) {
struct resource *res;
res = alloc_bootmem_low(sizeof(struct resource));
- switch (e820.map[i].type) {
+ switch (e820[i].type) {
case E820_RAM: res->name = "System RAM"; break;
case E820_ACPI: res->name = "ACPI Tables"; break;
case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
default: res->name = "reserved";
}
- res->start = e820.map[i].addr;
- res->end = res->start + e820.map[i].size - 1;
+ res->start = e820[i].addr;
+ res->end = res->start + e820[i].size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res);
+#ifndef CONFIG_XEN
if (e820.map[i].type == E820_RAM) {
/*
* We don't know which RAM region contains kernel data,
@@ -274,9 +264,27 @@ void __init e820_reserve_resources(void)
request_resource(res, &crashk_res);
#endif
}
- }
-}
-#endif /* CONFIG_XEN */
+#endif
+ }
+}
+
+/*
+ * Add a memory region to the kernel e820 map.
+ */
+void __init add_memory_region(unsigned long start, unsigned long size, int
type)
+{
+ int x = e820.nr_map;
+
+ if (x == E820MAX) {
+ printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
+ return;
+ }
+
+ e820.map[x].addr = start;
+ e820.map[x].size = size;
+ e820.map[x].type = type;
+ e820.nr_map++;
+}
void __init e820_print_map(char *who)
{
@@ -304,7 +312,6 @@ void __init e820_print_map(char *who)
}
}
-#ifndef CONFIG_XEN
/*
* Sanitize the BIOS e820 map.
*
@@ -491,9 +498,13 @@ static int __init sanitize_e820_map(stru
*/
static int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
{
+#ifndef CONFIG_XEN
/* Only one memory region (or negative)? Ignore it */
if (nr_map < 2)
return -1;
+#else
+ BUG_ON(nr_map < 1);
+#endif
do {
unsigned long start = biosmap->addr;
@@ -505,6 +516,7 @@ static int __init copy_e820_map(struct e
if (start > end)
return -1;
+#ifndef CONFIG_XEN
/*
* Some BIOSes claim RAM in the 640k - 1M region.
* Not right. Fix it up.
@@ -523,12 +535,14 @@ static int __init copy_e820_map(struct e
size = end - start;
}
}
+#endif
add_memory_region(start, size, type);
} while (biosmap++,--nr_map);
return 0;
}
+#ifndef CONFIG_XEN
void __init setup_memory_region(void)
{
char *who = "BIOS-e820";
@@ -562,104 +576,63 @@ void __init setup_memory_region(void)
#else /* CONFIG_XEN */
-extern unsigned long xen_override_max_pfn;
-extern union xen_start_info_union xen_start_info_union;
-
-unsigned long __init e820_end_of_ram(void)
-{
- unsigned long max_end_pfn;
-
- if (xen_override_max_pfn == 0) {
- max_end_pfn = xen_start_info->nr_pages;
- /* Default 8MB slack (to balance backend allocations). */
- max_end_pfn += 8 << (20 - PAGE_SHIFT);
- } else if (xen_override_max_pfn > xen_start_info->nr_pages) {
- max_end_pfn = xen_override_max_pfn;
- } else {
- max_end_pfn = xen_start_info->nr_pages;
- }
-
- return max_end_pfn;
-}
-
-unsigned long __init
-e820_hole_size(unsigned long start_pfn, unsigned long end_pfn)
-{
- return 0;
-}
-
-void __init e820_reserve_resources(void)
-{
- dom0_op_t op;
- struct dom0_memory_map_entry *map;
- unsigned long gapstart, gapsize, round, last;
- int i, found = 0;
-
- if (!(xen_start_info->flags & SIF_INITDOMAIN))
- return;
-
- map = alloc_bootmem_low_pages(PAGE_SIZE);
- op.cmd = DOM0_PHYSICAL_MEMORY_MAP;
- set_xen_guest_handle(op.u.physical_memory_map.memory_map, map);
- op.u.physical_memory_map.max_map_entries =
- PAGE_SIZE / sizeof(struct dom0_memory_map_entry);
- BUG_ON(HYPERVISOR_dom0_op(&op));
-
- last = 0x100000000ULL;
- gapstart = 0x10000000;
- gapsize = 0x400000;
-
- for (i = op.u.physical_memory_map.nr_map_entries - 1; i >= 0; i--) {
- struct resource *res;
-
- if ((last > map[i].end) && ((last - map[i].end) > gapsize)) {
- gapsize = last - map[i].end;
- gapstart = map[i].end;
- found = 1;
- }
- if (map[i].start < last)
- last = map[i].start;
-
- if (map[i].end > 0x100000000ULL)
- continue;
- res = alloc_bootmem_low(sizeof(struct resource));
- res->name = map[i].is_ram ? "System RAM" : "reserved";
- res->start = map[i].start;
- res->end = map[i].end - 1;
- res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
- request_resource(&iomem_resource, res);
- }
-
- free_bootmem(__pa(map), PAGE_SIZE);
-
- if (!found) {
- gapstart = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
- gapstart = (gapstart << PAGE_SHIFT) + 1024*1024;
- printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit
address range\n"
- KERN_ERR "PCI: Unassigned devices with 32bit resource
registers may break!\n");
- }
-
+void __init setup_memory_region(void)
+{
+ int rc;
+ struct xen_memory_map memmap;
/*
- * See how much we want to round up: start off with
- * rounding to the next 1MB area.
+ * This is rather large for a stack variable but this early in
+ * the boot process we know we have plenty slack space.
*/
- round = 0x100000;
- while ((gapsize >> 4) > round)
- round += round;
- /* Fun with two's complement */
- pci_mem_start = (gapstart + round) & -round;
-
- printk(KERN_INFO "Allocating PCI resources starting at %lx (gap:
%lx:%lx)\n",
- pci_mem_start, gapstart, gapsize);
-}
-
+ struct e820entry map[E820MAX];
+
+ memmap.nr_entries = E820MAX;
+ set_xen_guest_handle(memmap.buffer, map);
+
+ rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
+ if ( rc == -ENOSYS ) {
+ memmap.nr_entries = 1;
+ map[0].addr = 0ULL;
+ map[0].size = xen_start_info->nr_pages << PAGE_SHIFT;
+ /* 8MB slack (to balance backend allocations). */
+ map[0].size += 8 << 20;
+ map[0].type = E820_RAM;
+ rc = 0;
+ }
+ BUG_ON(rc);
+
+ sanitize_e820_map(map, (char *)&memmap.nr_entries);
+
+ BUG_ON(copy_e820_map(map, (char)memmap.nr_entries) < 0);
+
+ printk(KERN_INFO "BIOS-provided physical RAM map:\n");
+ e820_print_map("Xen");
+}
#endif
void __init parse_memopt(char *p, char **from)
{
+ int i;
+ unsigned long current_end;
+ unsigned long end;
+
end_user_pfn = memparse(p, from);
end_user_pfn >>= PAGE_SHIFT;
- xen_override_max_pfn = (unsigned long) end_user_pfn;
+
+ end = end_user_pfn<<PAGE_SHIFT;
+ i = e820.nr_map-1;
+ current_end = e820.map[i].addr + e820.map[i].size;
+
+ if (current_end < end) {
+ /*
+ * The e820 map ends before our requested size so
+ * extend the final entry to the requested address.
+ */
+ if (e820.map[i].type == E820_RAM)
+ e820.map[i].size = end - e820.map[i].addr;
+ else
+ add_memory_region(current_end, end - current_end,
E820_RAM);
+ }
}
void __init parse_memmapopt(char *p, char **from)
@@ -683,16 +656,17 @@ void __init parse_memmapopt(char *p, cha
p = *from;
}
+unsigned long pci_mem_start = 0xaeedbabe;
+
/*
* Search for the biggest gap in the low 32 bits of the e820
* memory space. We pass this space to PCI to assign MMIO resources
* for hotplug or unconfigured devices in.
* Hopefully the BIOS let enough space left.
*/
-__init void e820_setup_gap(void)
-{
-#ifndef CONFIG_XEN
- unsigned long gapstart, gapsize;
+__init void e820_setup_gap(struct e820entry *e820, int nr_map)
+{
+ unsigned long gapstart, gapsize, round;
unsigned long last;
int i;
int found = 0;
@@ -700,10 +674,10 @@ __init void e820_setup_gap(void)
last = 0x100000000ull;
gapstart = 0x10000000;
gapsize = 0x400000;
- i = e820.nr_map;
+ i = nr_map;
while (--i >= 0) {
- unsigned long long start = e820.map[i].addr;
- unsigned long long end = start + e820.map[i].size;
+ unsigned long long start = e820[i].addr;
+ unsigned long long end = start + e820[i].size;
/*
* Since "last" is at most 4GB, we know we'll
@@ -729,16 +703,15 @@ __init void e820_setup_gap(void)
}
/*
- * Start allocating dynamic PCI memory a bit into the gap,
- * aligned up to the nearest megabyte.
- *
- * Question: should we try to pad it up a bit (do something
- * like " + (gapsize >> 3)" in there too?). We now have the
- * technology.
+ * See how much we want to round up: start off with
+ * rounding to the next 1MB area.
*/
- pci_mem_start = (gapstart + 0xfffff) & ~0xfffff;
+ round = 0x100000;
+ while ((gapsize >> 4) > round)
+ round += round;
+ /* Fun with two's complement */
+ pci_mem_start = (gapstart + round) & -round;
printk(KERN_INFO "Allocating PCI resources starting at %lx (gap:
%lx:%lx)\n",
pci_mem_start, gapstart, gapsize);
-#endif
-}
+}
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Mon May 22
14:13:38 2006 -0600
@@ -24,6 +24,8 @@
.text
.code64
+#define VIRT_ENTRY_OFFSET 0x0
+.org VIRT_ENTRY_OFFSET
.globl startup_64
startup_64:
ENTRY(_start)
@@ -146,8 +148,18 @@ gdt_end:
.section __xen_guest
.ascii "GUEST_OS=linux,GUEST_VER=2.6"
.ascii ",XEN_VER=xen-3.0"
- .ascii ",VIRT_BASE=0x"; utoh __START_KERNEL_map
- .ascii ",HYPERCALL_PAGE=0x"; utoh (phys_hypercall_page >> PAGE_SHIFT)
+ .ascii ",VIRT_BASE=0x"
+ utoh __START_KERNEL_map
+#ifdef CONFIG_XEN_COMPAT_030002
+ .ascii ",ELF_PADDR_OFFSET=0x"
+ utoh __START_KERNEL_map
+#else
+ .ascii ",ELF_PADDR_OFFSET=0x0"
+#endif /* !CONFIG_XEN_COMPAT_030002 */
+ .ascii ",VIRT_ENTRY=0x"
+ utoh (__START_KERNEL_map + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
+ .ascii ",HYPERCALL_PAGE=0x"
+ utoh (phys_hypercall_page >> PAGE_SHIFT)
.ascii ",FEATURES=writable_page_tables"
.ascii "|writable_descriptor_tables"
.ascii "|auto_translated_physmap"
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Mon May 22
14:13:38 2006 -0600
@@ -76,8 +76,8 @@
#include <xen/features.h>
#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
-#define end_pfn_map end_pfn
#include <asm/mach-xen/setup_arch_post.h>
+#include <xen/interface/memory.h>
extern unsigned long start_pfn;
extern struct edid_info edid_info;
@@ -490,19 +490,6 @@ static __init void parse_cmdline_early (
}
#ifndef CONFIG_NUMA
-#ifdef CONFIG_XEN
-static void __init
-contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
-{
- unsigned long bootmap_size;
-
- bootmap_size = init_bootmem(start_pfn, end_pfn);
- free_bootmem(0, xen_start_info->nr_pages << PAGE_SHIFT);
- reserve_bootmem(HIGH_MEMORY,
- (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE-1)
- - HIGH_MEMORY);
-}
-#else
static void __init
contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
{
@@ -513,10 +500,13 @@ contig_initmem_init(unsigned long start_
if (bootmap == -1L)
panic("Cannot find bootmem map of size %ld\n",bootmap_size);
bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
+#ifdef CONFIG_XEN
+ e820_bootmem_free(NODE_DATA(0), 0,
xen_start_info->nr_pages<<PAGE_SHIFT);
+#else
e820_bootmem_free(NODE_DATA(0), 0, end_pfn << PAGE_SHIFT);
+#endif
reserve_bootmem(bootmap, bootmap_size);
}
-#endif /* !CONFIG_XEN */
#endif
/* Use inline assembly to define this because the nops are defined
@@ -636,6 +626,11 @@ void __init setup_arch(char **cmdline_p)
{
unsigned long kernel_end;
+#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
+ struct e820entry *machine_e820;
+ struct xen_memory_map memmap;
+#endif
+
#ifdef CONFIG_XEN
/* Register a call for panic conditions. */
notifier_chain_register(&panic_notifier_list, &xen_panic_block);
@@ -693,20 +688,18 @@ void __init setup_arch(char **cmdline_p)
rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
#endif
+#endif /* !CONFIG_XEN */
setup_memory_region();
copy_edd();
-#endif /* !CONFIG_XEN */
if (!MOUNT_ROOT_RDONLY)
root_mountflags &= ~MS_RDONLY;
init_mm.start_code = (unsigned long) &_text;
init_mm.end_code = (unsigned long) &_etext;
init_mm.end_data = (unsigned long) &_edata;
-#ifdef CONFIG_XEN
- init_mm.brk = start_pfn << PAGE_SHIFT;
-#else
- init_mm.brk = (unsigned long) &_end;
-
+ init_mm.brk = (unsigned long) &_end;
+
+#ifndef CONFIG_XEN
code_resource.start = virt_to_phys(&_text);
code_resource.end = virt_to_phys(&_etext)-1;
data_resource.start = virt_to_phys(&_etext);
@@ -735,12 +728,11 @@ void __init setup_arch(char **cmdline_p)
#endif
#ifdef CONFIG_NUMA
- numa_initmem_init(start_pfn, end_pfn);
+ numa_initmem_init(0, end_pfn);
#else
- contig_initmem_init(start_pfn, end_pfn);
-#endif
-
-#ifndef CONFIG_XEN
+ contig_initmem_init(0, end_pfn);
+#endif
+
/* Reserve direct mapping */
reserve_bootmem_generic(table_start << PAGE_SHIFT,
(table_end - table_start) << PAGE_SHIFT);
@@ -749,6 +741,10 @@ void __init setup_arch(char **cmdline_p)
kernel_end = round_up(__pa_symbol(&_end),PAGE_SIZE);
reserve_bootmem_generic(HIGH_MEMORY, kernel_end - HIGH_MEMORY);
+#ifdef CONFIG_XEN
+ /* reserve physmap, start info and initial page tables */
+ reserve_bootmem(kernel_end, (table_start<<PAGE_SHIFT)-kernel_end);
+#else
/*
* reserve physical page 0 - it's a special BIOS page on many boxes,
* enabling clean reboots, SMP operation, laptop functions.
@@ -933,13 +929,25 @@ void __init setup_arch(char **cmdline_p)
prefill_possible_map();
#endif
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
/*
* Request address space for all standard RAM and ROM resources
* and also for regions reported as reserved by the e820.
*/
+#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
probe_roms();
- e820_reserve_resources();
+ if (xen_start_info->flags & SIF_INITDOMAIN) {
+ machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
+
+ memmap.nr_entries = E820MAX;
+ set_xen_guest_handle(memmap.buffer, machine_e820);
+
+ BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map,
&memmap));
+
+ e820_reserve_resources(machine_e820, memmap.nr_entries);
+ }
+#elif !defined(CONFIG_XEN)
+ probe_roms();
+ e820_reserve_resources(e820.map, e820.nr_map);
#endif
request_resource(&iomem_resource, &video_ram_resource);
@@ -951,7 +959,14 @@ void __init setup_arch(char **cmdline_p)
request_resource(&ioport_resource, &standard_io_resources[i]);
}
- e820_setup_gap();
+#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
+ if (xen_start_info->flags & SIF_INITDOMAIN) {
+ e820_setup_gap(machine_e820, memmap.nr_entries);
+ free_bootmem(__pa(machine_e820), PAGE_SIZE);
+ }
+#elif !defined(CONFIG_XEN)
+ e820_setup_gap(e820.map, e820.nr_map);
+#endif
#ifdef CONFIG_GART_IOMMU
iommu_hole_init();
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c Mon May 22 14:13:38
2006 -0600
@@ -370,7 +370,7 @@ void __set_fixmap_user (enum fixed_addre
set_pte_phys(address, phys, prot, SET_FIXMAP_USER);
}
-unsigned long __initdata table_start, tables_space;
+unsigned long __initdata table_start, table_end;
unsigned long get_machine_pfn(unsigned long addr)
{
@@ -409,11 +409,17 @@ static inline int make_readonly(unsigned
{
int readonly = 0;
- /* Make old and new page tables read-only. */
+ /* Make new page tables read-only. */
+ if (!xen_feature(XENFEAT_writable_page_tables)
+ && (paddr >= (table_start << PAGE_SHIFT))
+ && (paddr < (table_end << PAGE_SHIFT)))
+ readonly = 1;
+ /* Make old page tables read-only. */
if (!xen_feature(XENFEAT_writable_page_tables)
&& (paddr >= (xen_start_info->pt_base - __START_KERNEL_map))
- && (paddr < ((table_start << PAGE_SHIFT) + tables_space)))
+ && (paddr < (start_pfn << PAGE_SHIFT)))
readonly = 1;
+
/*
* No need for writable mapping of kernel image. This also ensures that
* page and descriptor tables embedded inside don't have writable
@@ -544,7 +550,7 @@ void __init xen_init_pt(void)
mk_kernel_pgd(__pa_symbol(level3_user_pgt)));
}
-void __init extend_init_mapping(void)
+void __init extend_init_mapping(unsigned long tables_space)
{
unsigned long va = __START_KERNEL_map;
unsigned long phys, addr, *pte_page;
@@ -599,23 +605,23 @@ void __init extend_init_mapping(void)
static void __init find_early_table_space(unsigned long end)
{
- unsigned long puds, pmds, ptes;
+ unsigned long puds, pmds, ptes, tables;
puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
ptes = (end + PTE_SIZE - 1) >> PAGE_SHIFT;
- tables_space =
- round_up(puds * 8, PAGE_SIZE) +
+ tables = round_up(puds * 8, PAGE_SIZE) +
round_up(pmds * 8, PAGE_SIZE) +
round_up(ptes * 8, PAGE_SIZE);
- extend_init_mapping();
+ extend_init_mapping(tables);
table_start = start_pfn;
+ table_end = table_start + (tables>>PAGE_SHIFT);
early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n",
- end, table_start << PAGE_SHIFT, start_pfn << PAGE_SHIFT);
+ end, table_start << PAGE_SHIFT, table_end << PAGE_SHIFT);
}
/* Setup the direct mapping of the physical memory at PAGE_OFFSET.
@@ -660,7 +666,7 @@ void __meminit init_memory_mapping(unsig
set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
}
- BUG_ON(!after_bootmem && start_pfn != table_start + (tables_space >>
PAGE_SHIFT));
+ BUG_ON(!after_bootmem && start_pfn != table_end);
__flush_tlb_all();
}
@@ -1089,13 +1095,3 @@ int in_gate_area_no_task(unsigned long a
{
return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
}
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/char/tpm/Kconfig
--- a/linux-2.6-xen-sparse/drivers/char/tpm/Kconfig Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/Kconfig Mon May 22 14:13:38
2006 -0600
@@ -53,10 +53,9 @@ config TCG_XEN
tristate "XEN TPM Interface"
depends on TCG_TPM && XEN
---help---
- If you want to make TPM support available to a Xen
- user domain, say Yes and it will
- be accessible from within Linux. To compile this driver
- as a module, choose M here; the module will be called
- tpm_xen.
+ If you want to make TPM support available to a Xen user domain,
+ say Yes and it will be accessible from within Linux.
+ To compile this driver as a module, choose M here; the module
+ will be called tpm_xenu.
endmenu
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/char/tpm/Makefile
--- a/linux-2.6-xen-sparse/drivers/char/tpm/Makefile Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/Makefile Mon May 22 14:13:38
2006 -0600
@@ -8,4 +8,5 @@ obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
-obj-$(CONFIG_TCG_XEN) += tpm_xen.o tpm_vtpm.o
+obj-$(CONFIG_TCG_XEN) += tpm_xenu.o
+tpm_xenu-y = tpm_xen.o tpm_vtpm.o
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c Mon May 22 14:13:38
2006 -0600
@@ -416,7 +416,7 @@ static int tpmfront_suspend(struct xenbu
*/
interruptible_sleep_on_timeout(&tp->wait_q, 100);
}
- xenbus_switch_state(dev, XenbusStateClosed);
+ xenbus_switch_state(dev, XenbusStateClosing);
if (atomic_read(&tp->tx_busy)) {
/*
@@ -745,23 +745,12 @@ failexit:
static void __exit tpmif_exit(void)
{
+ exit_tpm_xenbus();
cleanup_vtpm();
tpm_private_put();
- exit_tpm_xenbus();
gnttab_free_grant_references(gref_head);
}
module_init(tpmif_init);
-module_exit(tpmif_exit);
MODULE_LICENSE("Dual BSD/GPL");
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48 linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig Mon May 22 08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig Mon May 22 14:13:38 2006 -0600
@@ -198,6 +198,22 @@ config XEN_SYSFS
help
Xen hypervisor attributes will show up under /sys/hypervisor/.
+choice
+ prompt "Xen version compatibility"
+ default XEN_COMPAT_030002_AND_LATER
+
+ config XEN_COMPAT_030002_AND_LATER
+ bool "3.0.2 and later"
+
+ config XEN_COMPAT_LATEST_ONLY
+ bool "no compatibility code"
+
+endchoice
+
+config XEN_COMPAT_030002
+ bool
+ default XEN_COMPAT_030002_AND_LATER
+
endmenu
config HAVE_ARCH_ALLOC_SKB
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon May 22
14:13:38 2006 -0600
@@ -468,8 +468,8 @@ static int __init balloon_init(void)
IPRINTK("Initialising balloon driver.\n");
- if (xen_init() < 0)
- return -1;
+ if (!is_running_on_xen())
+ return -ENODEV;
current_pages = min(xen_start_info->nr_pages, max_pfn);
totalram_pages = current_pages;
@@ -603,13 +603,3 @@ EXPORT_SYMBOL_GPL(balloon_dealloc_empty_
EXPORT_SYMBOL_GPL(balloon_dealloc_empty_page_range);
MODULE_LICENSE("Dual BSD/GPL");
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Mon May 22
14:13:38 2006 -0600
@@ -526,7 +526,7 @@ static int __init blkif_init(void)
struct page *page;
int i;
- if (xen_init() < 0)
+ if (!is_running_on_xen())
return -ENODEV;
mmap_pages = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST;
@@ -571,27 +571,10 @@ static int __init blkif_init(void)
list_add_tail(&pending_reqs[i].free_list, &pending_free);
blkif_xenbus_init();
- __unsafe(THIS_MODULE);
+
return 0;
}
module_init(blkif_init);
-static void blkif_exit(void)
-{
- BUG();
-}
-
-module_exit(blkif_exit);
-
MODULE_LICENSE("Dual BSD/GPL");
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Mon May 22 14:13:38
2006 -0600
@@ -34,6 +34,7 @@
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/vmalloc.h>
+#include <linux/wait.h>
#include <asm/io.h>
#include <asm/setup.h>
#include <asm/pgalloc.h>
@@ -90,21 +91,21 @@ typedef struct blkif_st {
int st_wr_req;
int st_oo_req;
- struct work_struct free_work;
+ wait_queue_head_t waiting_to_free;
grant_handle_t shmem_handle;
grant_ref_t shmem_ref;
} blkif_t;
-blkif_t *alloc_blkif(domid_t domid);
-void free_blkif_callback(blkif_t *blkif);
+blkif_t *blkif_alloc(domid_t domid);
+void blkif_free(blkif_t *blkif);
int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn);
#define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
#define blkif_put(_b) \
do { \
if (atomic_dec_and_test(&(_b)->refcnt)) \
- free_blkif_callback(_b); \
+ wake_up(&(_b)->waiting_to_free);\
} while (0)
/* Create a vbd. */
@@ -133,13 +134,3 @@ int blkif_schedule(void *arg);
int blkif_schedule(void *arg);
#endif /* __BLKIF__BACKEND__COMMON_H__ */
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Mon May 22
08:53:26 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Mon May 22
14:13:38 2006 -0600
@@ -35,7 +35,7 @@
static kmem_cache_t *blkif_cachep;
-blkif_t *alloc_blkif(domid_t domid)
+blkif_t *blkif_alloc(domid_t domid)
{
blkif_t *blkif;
@@ -49,6 +49,7 @@ blkif_t *alloc_blkif(domid_t domid)
atomic_set(&blkif->refcnt, 1);
init_waitqueue_head(&blkif->wq);
blkif->st_print = jiffies;
+ init_waitqueue_head(&blkif->waiting_to_free);
return blkif;
}
@@ -138,31 +139,23 @@ int blkif_map(blkif_t *blkif, unsigned l
return 0;
}
-static void free_blkif(void *arg)
+void blkif_free(blkif_t *blkif)
{
- blkif_t *blkif = (blkif_t *)arg;
+ atomic_dec(&blkif->refcnt);
+ wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
/* Already disconnected? */
- if (blkif->irq) {
+ if (blkif->irq)
unbind_from_irqhandler(blkif->irq, blkif);
- blkif->irq = 0;
- }
vbd_free(&blkif->vbd);
if (blkif->blk_ring.sring) {
unmap_frontend_page(blkif);
free_vm_area(blkif->blk_ring_area);
- blkif->blk_ring.sring = NULL;
}
kmem_cache_free(blkif_cachep, blkif);
-}
-
-void free_blkif_callback(blkif_t *blkif)
-{
- INIT_WORK(&blkif->free_work, free_blkif, (void *)blkif);
- schedule_work(&blkif->free_work);
}
void __init blkif_interface_init(void)
@@ -170,13 +163,3 @@ void __init blkif_interface_init(void)
blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t),
0, 0, NULL, NULL);
}
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
- * End:
- */
diff -r fbf676a36ee4 -r 72c5d8206d48
linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Mon May 22 08:53:26
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Mon May 22 14:13:38
2006 -0600
@@ -55,6 +55,7 @@ int vbd_create(blkif_t *blkif, blkif_vde
unsigned minor, int readonly)
{
struct vbd *vbd;
+ struct block_device *bdev;
vbd = &blkif->vbd;
vbd->handle = handle;
@@ -63,14 +64,16 @@ int vbd_create(blkif_t *blkif, blkif_vde
vbd->pdevice = MKDEV(major, minor);
- vbd->bdev = open_by_devnum(
- vbd->pdevice,
- vbd->readonly ? FMODE_READ : FMODE_WRITE);
- if (IS_ERR(vbd->bdev)) {
- DPRINTK("vbd_creat: device %08x doesn't exist.\n",
+ bdev = open_by_devnum(vbd->pdevice,
+ vbd->readonly ? FMODE_READ : FMODE_WRITE);
+
+ if (IS_ERR(bdev)) {
+ DPRINTK("vbd_creat: device %08x could not be opened.\n",
vbd->pdevice);
return -ENOENT;
}
+
+ vbd->bdev = bdev;
if (vbd->bdev->bd_disk == NULL) {
DPRINTK("vbd_creat: device %08x doesn't exist.\n",
@@ -114,13 +117,3 @@ int vbd_translate(struct phys_req *req,
out:
return rc;
}
-
-/*
- * Local variables:
- * c-file-style: "linux"
- * indent-tabs-mode: t
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8 |