WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [xenppc-unstable] [POWERPC] merge with http://xenbits.xensource

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [POWERPC] merge with http://xenbits.xensource.com/xen-unstable.hg
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Aug 2006 19:31:23 +0000
Delivery-date: Mon, 14 Aug 2006 12:36:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 10f1113fd48939fefa3daaabdb0e9890f77a97b0
# Parent  39c113fb84aca68b902d96aba8a57b36c9f6d42a
# Parent  04e5e80be909c06737b84ce776028b5d60118406
[POWERPC] merge with http://xenbits.xensource.com/xen-unstable.hg
---
 linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c           |    2 
 linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c                 |    2 
 linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c                   |   18 
 linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c                     |    2 
 linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c                    |    8 
 linux-2.6-xen-sparse/arch/i386/mm/init-xen.c                        |    2 
 linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c                     |    6 
 linux-2.6-xen-sparse/arch/ia64/kernel/setup.c                       |    7 
 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c                     |    2 
 linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S                 |   12 
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c                 |   17 
 linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c                      |    2 
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c                     |    3 
 linux-2.6-xen-sparse/drivers/xen/console/console.c                  |   10 
 linux-2.6-xen-sparse/drivers/xen/core/cpu_hotplug.c                 |    2 
 linux-2.6-xen-sparse/drivers/xen/core/evtchn.c                      |    3 
 linux-2.6-xen-sparse/drivers/xen/core/skbuff.c                      |    3 
 linux-2.6-xen-sparse/drivers/xen/core/smpboot.c                     |   20 
 linux-2.6-xen-sparse/drivers/xen/netback/loopback.c                 |    2 
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c                  |  138 +-
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c                |    2 
 linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c                  |    2 
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c              |   15 
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h              |    2 
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c                |    2 
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c              |   24 
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h      |    7 
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h     |    1 
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h          |  160 ++
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h           |  129 --
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h |    1 
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h |   12 
 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h                  |    2 
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h    |    7 
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h        |  139 ++
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h         |  122 --
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h      |    1 
 linux-2.6-xen-sparse/include/xen/hvm.h                              |   17 
 linux-2.6-xen-sparse/mm/memory.c                                    |    5 
 linux-2.6-xen-sparse/net/core/dev.c                                 |   10 
 patches/linux-2.6.16.13/net-gso-4-kill-warnon.patch                 |   28 
 tools/firmware/hvmloader/Makefile                                   |    8 
 tools/firmware/hvmloader/hvmloader.c                                |   13 
 tools/firmware/hvmloader/hypercall.h                                |    2 
 tools/firmware/hvmloader/smbios.c                                   |  606 
++++++++++
 tools/firmware/hvmloader/smbios.h                                   |   38 
 tools/firmware/hvmloader/smbios_types.h                             |  182 +++
 tools/firmware/hvmloader/util.c                                     |   80 +
 tools/firmware/hvmloader/util.h                                     |   12 
 tools/firmware/rombios/rombios.c                                    |   45 
 tools/firmware/vmxassist/vmxassist.ld                               |   12 
 tools/libxc/xc_evtchn.c                                             |   11 
 tools/libxc/xc_hvm_build.c                                          |    6 
 tools/libxc/xenctrl.h                                               |    7 
 tools/python/xen/lowlevel/xc/xc.c                                   |   69 -
 xen/arch/ia64/vmx/mmio.c                                            |    2 
 xen/arch/ia64/vmx/vlsapic.c                                         |    2 
 xen/arch/ia64/vmx/vmx_init.c                                        |    5 
 xen/arch/ia64/vmx/vmx_vcpu.c                                        |    2 
 xen/arch/ia64/xen/domain.c                                          |    3 
 xen/arch/ia64/xen/hyperprivop.S                                     |    2 
 xen/arch/ia64/xen/vcpu.c                                            |    2 
 xen/arch/ia64/xen/xenasm.S                                          |    2 
 xen/arch/x86/hvm/platform.c                                         |    3 
 xen/common/grant_table.c                                            |    7 
 xen/include/asm-ia64/domain.h                                       |    2 
 xen/include/asm-ia64/event.h                                        |    2 
 xen/include/asm-ia64/linux-xen/asm/ptrace.h                         |    3 
 xen/include/asm-ia64/privop_stat.h                                  |    3 
 xen/include/asm-ia64/vcpu.h                                         |    3 
 xen/include/asm-ia64/vmx_platform.h                                 |    1 
 xen/include/asm-ia64/vmx_vpd.h                                      |    2 
 72 files changed, 1542 insertions(+), 544 deletions(-)

diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c Mon Aug 14 
15:21:30 2006 -0400
@@ -178,7 +178,7 @@ static int __init mtrr_init(void)
 {
        struct cpuinfo_x86 *c = &boot_cpu_data;
 
-       if (!(xen_start_info->flags & SIF_PRIVILEGED))
+       if (!is_initial_xendomain())
                return -ENODEV;
 
        if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c       Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c       Mon Aug 14 
15:21:30 2006 -0400
@@ -2480,7 +2480,7 @@ static int __init io_apic_bug_finalize(v
 {
        if(sis_apic_bug == -1)
                sis_apic_bug = 0;
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                dom0_op_t op = { .cmd = DOM0_PLATFORM_QUIRK };
                op.u.platform_quirk.quirk_id = sis_apic_bug ?
                        QUIRK_IOAPIC_BAD_REGSEL : QUIRK_IOAPIC_GOOD_REGSEL;
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Mon Aug 14 15:21:30 
2006 -0400
@@ -318,7 +318,7 @@ static void __init probe_roms(void)
        int           i;
 
        /* Nothing to do if not running in dom0. */
-       if (!(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!is_initial_xendomain())
                return;
 
        /* video rom */
@@ -1458,7 +1458,7 @@ static void __init register_memory(void)
        int           i;
 
        /* Nothing to do if not running in dom0. */
-       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
+       if (!is_initial_xendomain()) {
                legacy_init_iomem_resources(e820.map, e820.nr_map,
                                            &code_resource, &data_resource);
                return;
@@ -1618,7 +1618,7 @@ void __init setup_arch(char **cmdline_p)
 
        /* Force a quick death if the kernel panics (not domain 0). */
        extern int panic_timeout;
-       if (!panic_timeout && !(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!panic_timeout && !is_initial_xendomain())
                panic_timeout = 1;
 
        /* Register a call for panic conditions. */
@@ -1661,7 +1661,7 @@ void __init setup_arch(char **cmdline_p)
        }
        bootloader_type = LOADER_TYPE;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                /* This is drawn from a dump from vgacon:startup in
                 * standard Linux. */
                screen_info.orig_video_mode = 3; 
@@ -1788,7 +1788,7 @@ void __init setup_arch(char **cmdline_p)
        }
 #endif
 
-       if (xen_start_info->flags & SIF_INITDOMAIN)
+       if (is_initial_xendomain())
                dmi_scan_machine();
 
 #ifdef CONFIG_X86_GENERICARCH
@@ -1805,7 +1805,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 #ifdef CONFIG_ACPI
-       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
+       if (!is_initial_xendomain()) {
                printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
                acpi_disabled = 1;
                acpi_ht = 0;
@@ -1831,11 +1831,7 @@ void __init setup_arch(char **cmdline_p)
 
        register_memory();
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
-               if (!(xen_start_info->flags & SIF_PRIVILEGED))
-                       panic("Xen granted us console access "
-                             "but not privileged status");
-
+       if (is_initial_xendomain()) {
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
                if (!efi_enabled ||
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Mon Aug 14 15:21:30 
2006 -0400
@@ -199,7 +199,7 @@ swiotlb_init(void)
                swiotlb = 1;
        } else if ((swiotlb_force != -1) &&
                   is_running_on_xen() &&
-                  (xen_start_info->flags & SIF_INITDOMAIN)) {
+                  is_initial_xendomain()) {
                /* Domain 0 always has a swiotlb. */
                ram_end = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
                if (ram_end <= 0x7ffff)
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Mon Aug 14 15:21:30 
2006 -0400
@@ -470,8 +470,7 @@ int do_settimeofday(struct timespec *tv)
        sec = tv->tv_sec;
        __normalize_time(&sec, &nsec);
 
-       if ((xen_start_info->flags & SIF_INITDOMAIN) &&
-           !independent_wallclock) {
+       if (is_initial_xendomain() && !independent_wallclock) {
                op.cmd = DOM0_SETTIME;
                op.u.settime.secs        = sec;
                op.u.settime.nsecs       = nsec;
@@ -502,8 +501,7 @@ static void sync_xen_wallclock(unsigned 
        s64 nsec;
        dom0_op_t op;
 
-       if (!ntp_synced() || independent_wallclock ||
-           !(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!ntp_synced() || independent_wallclock || !is_initial_xendomain())
                return;
 
        write_seqlock_irq(&xtime_lock);
@@ -532,7 +530,7 @@ static int set_rtc_mmss(unsigned long no
 
        WARN_ON(irqs_disabled());
 
-       if (independent_wallclock || !(xen_start_info->flags & SIF_INITDOMAIN))
+       if (independent_wallclock || !is_initial_xendomain())
                return 0;
 
        /* gets recalled with irq locally disabled */
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/mm/init-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c      Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c      Mon Aug 14 15:21:30 
2006 -0400
@@ -566,7 +566,7 @@ void __init paging_init(void)
 
        /* Setup mapping of lower 1st MB */
        for (i = 0; i < NR_FIX_ISAMAPS; i++)
-               if (xen_start_info->flags & SIF_PRIVILEGED)
+               if (is_initial_xendomain())
                        set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
                else
                        __set_fixmap(FIX_ISAMAP_BEGIN - i,
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c   Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c   Mon Aug 14 15:21:30 
2006 -0400
@@ -121,7 +121,7 @@ int direct_remap_pfn_range(struct vm_are
                           domid_t  domid)
 {
        /* Same as remap_pfn_range(). */
-       vma->vm_flags |= VM_IO | VM_RESERVED;
+       vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
 
        if (domid == DOMID_SELF)
                return -EINVAL;
@@ -245,7 +245,7 @@ void __iomem * __ioremap(unsigned long p
        /*
         * Don't remap the low PCI/ISA area, it's always mapped..
         */
-       if (xen_start_info->flags & SIF_PRIVILEGED &&
+       if (is_initial_xendomain() &&
            phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
                return (void __iomem *) isa_bus_to_virt(phys_addr);
 
@@ -425,7 +425,7 @@ void __init *bt_ioremap(unsigned long ph
        /*
         * Don't remap the low PCI/ISA area, it's always mapped..
         */
-       if (xen_start_info->flags & SIF_PRIVILEGED &&
+       if (is_initial_xendomain() &&
            phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
                return isa_bus_to_virt(phys_addr);
 
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Mon Aug 14 15:21:30 
2006 -0400
@@ -545,12 +545,7 @@ setup_arch (char **cmdline_p)
                       "flags=0x%x\n", s->arch.start_info_pfn,
                       xen_start_info->nr_pages, xen_start_info->flags);
 
-               /* xen_start_info isn't setup yet, get the flags manually */
-               if (xen_start_info->flags & SIF_INITDOMAIN) {
-                       if (!(xen_start_info->flags & SIF_PRIVILEGED))
-                               panic("Xen granted us console access "
-                                     "but not privileged status");
-               } else {
+               if (!is_initial_xendomain()) {
                        extern int console_use_vt;
                        conswitchp = NULL;
                        console_use_vt = 0;
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Mon Aug 14 15:21:30 
2006 -0400
@@ -82,7 +82,7 @@ ia64_xenmem_reservation_op(unsigned long
                        //    of a non-privileged domain, 
                        if ((op == XENMEM_increase_reservation ||
                             op == XENMEM_populate_physmap) &&
-                           !(xen_start_info->flags & SIF_PRIVILEGED) &&
+                           !is_initial_xendomain() &&
                            reservation.extent_order > 0)
                                return ret;
                }
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S       Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S       Mon Aug 14 
15:21:30 2006 -0400
@@ -271,7 +271,7 @@ sysret_careful:
        CFI_RESTORE_STATE
        bt $TIF_NEED_RESCHED,%edx
        jnc sysret_signal
-        XEN_BLOCK_EVENTS(%rsi)        
+       XEN_UNBLOCK_EVENTS(%rsi)
        pushq %rdi
        CFI_ADJUST_CFA_OFFSET 8
        call schedule
@@ -295,7 +295,7 @@ 1:  movl $_TIF_NEED_RESCHED,%edi
 1:     movl $_TIF_NEED_RESCHED,%edi
        /* Use IRET because user could have changed frame. This
           works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
        jmp int_with_check
        
 badsys:
@@ -377,7 +377,7 @@ int_careful:
        call schedule
        popq %rdi
        CFI_ADJUST_CFA_OFFSET -8
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
        jmp int_with_check
 
        /* handle signals and tracing -- both require a full stack frame */
@@ -395,7 +395,7 @@ int_very_careful:
        popq %rdi
        CFI_ADJUST_CFA_OFFSET -8
        andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
        jmp int_restore_rest
        
 int_signal:
@@ -407,7 +407,7 @@ 1:  movl $_TIF_NEED_RESCHED,%edi
 1:     movl $_TIF_NEED_RESCHED,%edi    
 int_restore_rest:
        RESTORE_REST
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
        jmp int_with_check
        CFI_ENDPROC
                
@@ -535,8 +535,8 @@ retint_careful:
        call  schedule
        popq %rdi               
        CFI_ADJUST_CFA_OFFSET   -8
+       GET_THREAD_INFO(%rcx)
        XEN_BLOCK_EVENTS(%rsi)          
-       GET_THREAD_INFO(%rcx)
 /*     cli */
        jmp retint_check
        
diff -r 39c113fb84ac -r 10f1113fd489 
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 Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Mon Aug 14 
15:21:30 2006 -0400
@@ -639,7 +639,7 @@ void __init setup_arch(char **cmdline_p)
        kernel_end = 0;         /* dummy */
        screen_info = SCREEN_INFO;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                /* This is drawn from a dump from vgacon:startup in
                 * standard Linux. */
                screen_info.orig_video_mode = 3;
@@ -860,8 +860,7 @@ void __init setup_arch(char **cmdline_p)
 
        }
 
-       if ( ! (xen_start_info->flags & SIF_INITDOMAIN))
-       {
+       if (!is_initial_xendomain()) {
                acpi_disabled = 1;
 #ifdef  CONFIG_ACPI
                acpi_ht = 0;
@@ -910,7 +909,7 @@ void __init setup_arch(char **cmdline_p)
         */
 #if defined(CONFIG_XEN_PRIVILEGED_GUEST)
        probe_roms();
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
 
                memmap.nr_entries = E820MAX;
@@ -919,7 +918,7 @@ void __init setup_arch(char **cmdline_p)
                BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, 
&memmap));
 
                e820_reserve_resources(machine_e820, memmap.nr_entries);
-       } else if (!(xen_start_info->flags & SIF_INITDOMAIN))
+       } else
                e820_reserve_resources(e820.map, e820.nr_map);
 #elif defined(CONFIG_XEN)
        e820_reserve_resources(e820.map, e820.nr_map);
@@ -938,7 +937,7 @@ void __init setup_arch(char **cmdline_p)
        }
 
 #if defined(CONFIG_XEN_PRIVILEGED_GUEST)
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                e820_setup_gap(machine_e820, memmap.nr_entries);
                free_bootmem(__pa(machine_e820), PAGE_SIZE);
        }
@@ -957,11 +956,7 @@ void __init setup_arch(char **cmdline_p)
                set_iopl.iopl = 1;
                HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
 
-               if (xen_start_info->flags & SIF_INITDOMAIN) {
-                       if (!(xen_start_info->flags & SIF_PRIVILEGED))
-                               panic("Xen granted us console access "
-                                     "but not privileged status");
-                      
+               if (is_initial_xendomain()) {
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
                        conswitchp = &vga_con;
diff -r 39c113fb84ac -r 10f1113fd489 
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 Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c    Mon Aug 14 15:21:30 
2006 -0400
@@ -789,7 +789,7 @@ void __init paging_init(void)
 
        /* Setup mapping of lower 1st MB */
        for (i = 0; i < NR_FIX_ISAMAPS; i++)
-               if (xen_start_info->flags & SIF_PRIVILEGED)
+               if (is_initial_xendomain())
                        set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
                else
                        __set_fixmap(FIX_ISAMAP_BEGIN - i,
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Mon Aug 14 15:21:30 
2006 -0400
@@ -718,9 +718,8 @@ static int __init tpmif_init(void)
        long rc = 0;
        struct tpm_private *tp;
 
-       if ((xen_start_info->flags & SIF_INITDOMAIN)) {
+       if (is_initial_xendomain())
                return -EPERM;
-       }
 
        tp = tpm_private_get();
        if (!tp) {
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Mon Aug 14 
15:21:30 2006 -0400
@@ -188,7 +188,7 @@ static int __init xen_console_init(void)
        if (!is_running_on_xen())
                return __RETCODE;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_SERIAL;
                kcons_info.write = kcons_write_dom0;
@@ -247,7 +247,7 @@ void xencons_force_flush(void)
        int sz;
 
        /* Emergency console is synchronous, so there's nothing to flush. */
-       if (xen_start_info->flags & SIF_INITDOMAIN)
+       if (is_initial_xendomain())
                return;
 
        /* Spin until console data is flushed through to the daemon. */
@@ -318,7 +318,7 @@ static void __xencons_tx_flush(void)
        int sent, sz, work_done = 0;
 
        if (x_char) {
-               if (xen_start_info->flags & SIF_INITDOMAIN)
+               if (is_initial_xendomain())
                        kcons_write_dom0(NULL, &x_char, 1);
                else
                        while (x_char)
@@ -332,7 +332,7 @@ static void __xencons_tx_flush(void)
                sz = wp - wc;
                if (sz > (wbuf_size - WBUF_MASK(wc)))
                        sz = wbuf_size - WBUF_MASK(wc);
-               if (xen_start_info->flags & SIF_INITDOMAIN) {
+               if (is_initial_xendomain()) {
                        kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz);
                        wc += sz;
                } else {
@@ -622,7 +622,7 @@ static int __init xencons_init(void)
                return rc;
        }
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                xencons_priv_irq = bind_virq_to_irqhandler(
                        VIRQ_CONSOLE,
                        0,
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/core/cpu_hotplug.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/cpu_hotplug.c       Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/core/cpu_hotplug.c       Mon Aug 14 
15:21:30 2006 -0400
@@ -92,7 +92,7 @@ static int setup_cpu_watcher(struct noti
                .flags = XBWF_new_thread };
        (void)register_xenbus_watch(&cpu_watch);
 
-       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
+       if (!is_initial_xendomain()) {
                for_each_cpu(i)
                        vcpu_hotplug(i);
                printk(KERN_INFO "Brought up %ld CPUs\n",
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c    Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c    Mon Aug 14 15:21:30 
2006 -0400
@@ -840,8 +840,7 @@ void __init xen_init_IRQ(void)
 
 #ifdef RTC_IRQ
                /* If not domain 0, force our RTC driver to fail its probe. */
-               if ((i == RTC_IRQ) &&
-                   !(xen_start_info->flags & SIF_INITDOMAIN))
+               if ((i == RTC_IRQ) && !is_initial_xendomain())
                        continue;
 #endif
 
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/core/skbuff.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/skbuff.c    Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/core/skbuff.c    Mon Aug 14 15:21:30 
2006 -0400
@@ -121,8 +121,7 @@ static int __init skbuff_init(void)
        for (order = 0; order <= MAX_SKBUFF_ORDER; order++) {
                size = PAGE_SIZE << order;
                sprintf(name[order], "xen-skb-%lu", size);
-               if (is_running_on_xen() &&
-                   (xen_start_info->flags & SIF_PRIVILEGED))
+               if (is_running_on_xen() && is_initial_xendomain())
                        skbuff_order_cachep[order] = kmem_cache_create(
                                name[order], size, size, 0,
                                skbuff_ctor, skbuff_dtor);
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c   Mon Aug 14 10:03:58 
2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c   Mon Aug 14 15:21:30 
2006 -0400
@@ -255,7 +255,14 @@ void __init smp_prepare_cpus(unsigned in
 
        xen_smp_intr_init(0);
 
-       for_each_cpu_mask (cpu, cpu_possible_map) {
+       /* Restrict the possible_map according to max_cpus. */
+       while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
+               for (cpu = NR_CPUS-1; !cpu_isset(cpu, cpu_possible_map); cpu--)
+                       continue;
+               cpu_clear(cpu, cpu_possible_map);
+       }
+
+       for_each_cpu (cpu) {
                if (cpu == 0)
                        continue;
 
@@ -266,7 +273,8 @@ void __init smp_prepare_cpus(unsigned in
 #endif
                gdt_descr->address = get_zeroed_page(GFP_KERNEL);
                if (unlikely(!gdt_descr->address)) {
-                       printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu);
+                       printk(KERN_CRIT "CPU%d failed to allocate GDT\n",
+                              cpu);
                        continue;
                }
                gdt_descr->size = GDT_SIZE;
@@ -294,7 +302,7 @@ void __init smp_prepare_cpus(unsigned in
                irq_ctx_init(cpu);
 
 #ifdef CONFIG_HOTPLUG_CPU
-               if (xen_start_info->flags & SIF_INITDOMAIN)
+               if (is_initial_xendomain())
                        cpu_set(cpu, cpu_present_map);
 #else
                cpu_set(cpu, cpu_present_map);
@@ -304,12 +312,6 @@ void __init smp_prepare_cpus(unsigned in
        }
 
        init_xenbus_allowed_cpumask();
-
-       /* Currently, Xen gives no dynamic NUMA/HT info. */
-       for (cpu = 1; cpu < NR_CPUS; cpu++) {
-               cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
-               cpu_core_map[cpu]    = cpumask_of_cpu(cpu);
-       }
 
 #ifdef CONFIG_X86_IO_APIC
        /*
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c       Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c       Mon Aug 14 
15:21:30 2006 -0400
@@ -218,7 +218,7 @@ static int __init make_loopback(int i)
        return err;
 }
 
-static void __init clean_loopback(int i)
+static void __exit clean_loopback(int i)
 {
        struct net_device *dev1, *dev2;
        char dev_name[IFNAMSIZ];
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Aug 14 
15:21:30 2006 -0400
@@ -68,10 +68,6 @@ static struct timer_list net_timer;
 #define MAX_PENDING_REQS 256
 
 static struct sk_buff_head rx_queue;
-static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1];
-static mmu_update_t rx_mmu[NET_RX_RING_SIZE];
-static gnttab_transfer_t grant_rx_op[NET_RX_RING_SIZE];
-static unsigned char rx_notify[NR_IRQS];
 
 static unsigned long mmap_vstart;
 #define MMAP_VADDR(_req) (mmap_vstart + ((_req) * PAGE_SIZE))
@@ -314,11 +310,23 @@ int xen_network_done(void)
 }
 #endif
 
-static u16 netbk_gop_frag(netif_t *netif, struct page *page, int count, int i)
-{
-       multicall_entry_t *mcl = rx_mcl + count;
-       mmu_update_t *mmu = rx_mmu + count;
-       gnttab_transfer_t *gop = grant_rx_op + count;
+struct netrx_pending_operations {
+       unsigned trans_prod, trans_cons;
+       unsigned mmu_prod, mmu_cons;
+       unsigned mcl_prod, mcl_cons;
+       unsigned meta_prod, meta_cons;
+       mmu_update_t *mmu;
+       gnttab_transfer_t *trans;
+       multicall_entry_t *mcl;
+       struct netbk_rx_meta *meta;
+};
+
+static u16 netbk_gop_frag(netif_t *netif, struct page *page,
+                         int i, struct netrx_pending_operations *npo)
+{
+       mmu_update_t *mmu;
+       gnttab_transfer_t *gop;
+       multicall_entry_t *mcl;
        netif_rx_request_t *req;
        unsigned long old_mfn, new_mfn;
 
@@ -334,46 +342,53 @@ static u16 netbk_gop_frag(netif_t *netif
                 */
                set_phys_to_machine(page_to_pfn(page), new_mfn);
 
+               mcl = npo->mcl + npo->mcl_prod++;
                MULTI_update_va_mapping(mcl, (unsigned long)page_address(page),
                                        pfn_pte_ma(new_mfn, PAGE_KERNEL), 0);
 
+               mmu = npo->mmu + npo->mmu_prod++;
                mmu->ptr = ((maddr_t)new_mfn << PAGE_SHIFT) |
                        MMU_MACHPHYS_UPDATE;
                mmu->val = page_to_pfn(page);
        }
 
        req = RING_GET_REQUEST(&netif->rx, netif->rx.req_cons + i);
+       gop = npo->trans + npo->trans_prod++;
        gop->mfn = old_mfn;
        gop->domid = netif->domid;
        gop->ref = req->gref;
        return req->id;
 }
 
-static void netbk_gop_skb(struct sk_buff *skb, struct netbk_rx_meta *meta,
-                         int count)
+static void netbk_gop_skb(struct sk_buff *skb,
+                         struct netrx_pending_operations *npo)
 {
        netif_t *netif = netdev_priv(skb->dev);
        int nr_frags = skb_shinfo(skb)->nr_frags;
        int i;
        int extra;
-
-       meta[count].frag.page_offset = skb_shinfo(skb)->gso_type;
-       meta[count].frag.size = skb_shinfo(skb)->gso_size;
-       extra = !!meta[count].frag.size + 1;
+       struct netbk_rx_meta *head_meta, *meta;
+
+       head_meta = npo->meta + npo->meta_prod++;
+       head_meta->frag.page_offset = skb_shinfo(skb)->gso_type;
+       head_meta->frag.size = skb_shinfo(skb)->gso_size;
+       extra = !!head_meta->frag.size + 1;
 
        for (i = 0; i < nr_frags; i++) {
-               meta[++count].frag = skb_shinfo(skb)->frags[i];
-               meta[count].id = netbk_gop_frag(netif, meta[count].frag.page,
-                                               count, i + extra);
+               meta = npo->meta + npo->meta_prod++;
+               meta->frag = skb_shinfo(skb)->frags[i];
+               meta->id = netbk_gop_frag(netif, meta->frag.page,
+                                         i + extra, npo);
        }
 
        /*
         * This must occur at the end to ensure that we don't trash
         * skb_shinfo until we're done.
         */
-       meta[count - nr_frags].id = netbk_gop_frag(netif,
-                                                  virt_to_page(skb->data),
-                                                  count - nr_frags, 0);
+       head_meta->id = netbk_gop_frag(netif,
+                                      virt_to_page(skb->data),
+                                      0,
+                                      npo);
        netif->rx.req_cons += nr_frags + extra;
 }
 
@@ -385,22 +400,28 @@ static inline void netbk_free_pages(int 
                put_page(meta[i].frag.page);
 }
 
-static int netbk_check_gop(int nr_frags, domid_t domid, int count)
-{
-       multicall_entry_t *mcl = rx_mcl + count;
-       gnttab_transfer_t *gop = grant_rx_op + count;
+/* This is a twin to netbk_gop_skb.  Assume that netbk_gop_skb was
+   used to set up the operations on the top of
+   netrx_pending_operations, which have since been done.  Check that
+   they didn't give any errors and advance over them. */
+static int netbk_check_gop(int nr_frags, domid_t domid, int count,
+                          struct netrx_pending_operations *npo)
+{
+       multicall_entry_t *mcl;
+       gnttab_transfer_t *gop;
        int status = NETIF_RSP_OKAY;
        int i;
 
        for (i = 0; i <= nr_frags; i++) {
                if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+                       mcl = npo->mcl + npo->mcl_cons++;
                        /* The update_va_mapping() must not fail. */
                        BUG_ON(mcl->result != 0);
-                       mcl++;
-               }
-
+               }
+
+               gop = npo->trans + npo->trans_cons++;
                /* Check the reassignment error code. */
-               if (gop->status != 0) { 
+               if (gop->status != 0) {
                        DPRINTK("Bad status %d from grant transfer to DOM%u\n",
                                gop->status, domid);
                        /*
@@ -408,9 +429,8 @@ static int netbk_check_gop(int nr_frags,
                         * but that should be a fatal error anyway.
                         */
                        BUG_ON(gop->status == GNTST_bad_page);
-                       status = NETIF_RSP_ERROR; 
-               }
-               gop++;
+                       status = NETIF_RSP_ERROR;
+               }
        }
 
        return status;
@@ -449,8 +469,18 @@ static void net_rx_action(unsigned long 
         * Putting hundreds of bytes on the stack is considered rude.
         * Static works because a tasklet can only be on one CPU at any time.
         */
+       static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+3];
+       static mmu_update_t rx_mmu[NET_RX_RING_SIZE];
+       static gnttab_transfer_t grant_rx_op[NET_RX_RING_SIZE];
+       static unsigned char rx_notify[NR_IRQS];
        static u16 notify_list[NET_RX_RING_SIZE];
        static struct netbk_rx_meta meta[NET_RX_RING_SIZE];
+
+       struct netrx_pending_operations npo = {
+               mmu: rx_mmu,
+               trans: grant_rx_op,
+               mcl: rx_mcl,
+               meta: meta};
 
        skb_queue_head_init(&rxq);
 
@@ -471,7 +501,7 @@ static void net_rx_action(unsigned long 
                        break;
                }
 
-               netbk_gop_skb(skb, meta, count);
+               netbk_gop_skb(skb, &npo);
 
                count += nr_frags + 1;
 
@@ -486,8 +516,11 @@ static void net_rx_action(unsigned long 
                return;
 
        if (!xen_feature(XENFEAT_auto_translated_physmap)) {
-               mcl = rx_mcl + count;
-
+               BUG_ON(npo.mcl_prod == 0);
+
+               mcl = npo.mcl + npo.mcl_prod++;
+
+               BUG_ON(mcl[-1].op != __HYPERVISOR_update_va_mapping);
                mcl[-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
 
                mcl->op = __HYPERVISOR_mmu_update;
@@ -495,13 +528,17 @@ static void net_rx_action(unsigned long 
                mcl->args[1] = count;
                mcl->args[2] = 0;
                mcl->args[3] = DOMID_SELF;
-
-               ret = HYPERVISOR_multicall(rx_mcl, count + 1);
-               BUG_ON(ret != 0);
-       }
-
-       ret = HYPERVISOR_grant_table_op(GNTTABOP_transfer, grant_rx_op, count);
+       }
+
+       mcl = npo.mcl + npo.mcl_prod++;
+       mcl->op = __HYPERVISOR_grant_table_op;
+       mcl->args[0] = GNTTABOP_transfer;
+       mcl->args[1] = (unsigned long)grant_rx_op;
+       mcl->args[2] = npo.trans_prod;
+
+       ret = HYPERVISOR_multicall(npo.mcl, npo.mcl_prod);
        BUG_ON(ret != 0);
+       BUG_ON(mcl->result != 0);
 
        count = 0;
        while ((skb = __skb_dequeue(&rxq)) != NULL) {
@@ -515,10 +552,11 @@ static void net_rx_action(unsigned long 
                netif->stats.tx_bytes += skb->len;
                netif->stats.tx_packets++;
 
-               netbk_free_pages(nr_frags, meta + count + 1);
-               status = netbk_check_gop(nr_frags, netif->domid, count);
-
-               id = meta[count].id;
+               netbk_free_pages(nr_frags, meta + npo.meta_cons + 1);
+               status = netbk_check_gop(nr_frags, netif->domid, count,
+                                        &npo);
+
+               id = meta[npo.meta_cons].id;
                flags = nr_frags ? NETRXF_more_data : 0;
 
                if (skb->ip_summed == CHECKSUM_HW) /* local packet? */
@@ -532,7 +570,7 @@ static void net_rx_action(unsigned long 
 
                extra = NULL;
 
-               if (meta[count].frag.size) {
+               if (meta[npo.meta_cons].frag.size) {
                        struct netif_extra_info *gso =
                                (struct netif_extra_info *)
                                RING_GET_RESPONSE(&netif->rx,
@@ -543,7 +581,7 @@ static void net_rx_action(unsigned long 
                        else
                                resp->flags |= NETRXF_extra_info;
 
-                       gso->u.gso.size = meta[count].frag.size;
+                       gso->u.gso.size = meta[npo.meta_cons].frag.size;
                        gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
                        gso->u.gso.pad = 0;
                        gso->u.gso.features = 0;
@@ -553,7 +591,8 @@ static void net_rx_action(unsigned long 
                        extra = gso;
                }
 
-               netbk_add_frag_responses(netif, status, meta + count + 1,
+               netbk_add_frag_responses(netif, status,
+                                        meta + npo.meta_cons + 1,
                                         nr_frags);
 
                RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&netif->rx, ret);
@@ -569,7 +608,8 @@ static void net_rx_action(unsigned long 
 
                netif_put(netif);
                dev_kfree_skb(skb);
-               count += nr_frags + 1;
+
+               npo.meta_cons += nr_frags + 1;
        }
 
        while (notify_nr != 0) {
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Aug 14 
15:21:30 2006 -0400
@@ -1818,7 +1818,7 @@ static int __init netif_init(void)
        if (!is_running_on_xen())
                return -ENODEV;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN)
+       if (is_initial_xendomain())
                return 0;
 
        IPRINTK("Initialising virtual ethernet driver.\n");
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Mon Aug 14 
15:21:30 2006 -0400
@@ -246,7 +246,7 @@ static int capabilities_read(char *page,
        int len = 0;
        *page = 0;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN)
+       if (is_initial_xendomain())
                len = sprintf( page, "control_d\n" );
 
        *eof = 1;
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Mon Aug 14 
15:21:30 2006 -0400
@@ -47,11 +47,6 @@ static DECLARE_WORK(probe_work, xenbus_p
 
 DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
 
-static inline struct xenstore_domain_interface *xenstore_domain_interface(void)
-{
-       return mfn_to_virt(xen_start_info->store_mfn);
-}
-
 static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
 {
        if (unlikely(xenstored_ready == 0)) {
@@ -90,7 +85,7 @@ static const void *get_input_chunk(XENST
 
 int xb_write(const void *data, unsigned len)
 {
-       struct xenstore_domain_interface *intf = xenstore_domain_interface();
+       struct xenstore_domain_interface *intf = xen_store_interface;
        XENSTORE_RING_IDX cons, prod;
        int rc;
 
@@ -129,7 +124,7 @@ int xb_write(const void *data, unsigned 
                intf->req_prod += avail;
 
                /* This implies mb() before other side sees interrupt. */
-               notify_remote_via_evtchn(xen_start_info->store_evtchn);
+               notify_remote_via_evtchn(xen_store_evtchn);
        }
 
        return 0;
@@ -137,7 +132,7 @@ int xb_write(const void *data, unsigned 
 
 int xb_read(void *data, unsigned len)
 {
-       struct xenstore_domain_interface *intf = xenstore_domain_interface();
+       struct xenstore_domain_interface *intf = xen_store_interface;
        XENSTORE_RING_IDX cons, prod;
        int rc;
 
@@ -180,7 +175,7 @@ int xb_read(void *data, unsigned len)
                pr_debug("Finished read of %i bytes (%i to go)\n", avail, len);
 
                /* Implies mb(): they will see new header. */
-               notify_remote_via_evtchn(xen_start_info->store_evtchn);
+               notify_remote_via_evtchn(xen_store_evtchn);
        }
 
        return 0;
@@ -195,7 +190,7 @@ int xb_init_comms(void)
                unbind_from_irqhandler(xenbus_irq, &xb_waitq);
 
        err = bind_evtchn_to_irqhandler(
-               xen_start_info->store_evtchn, wake_waiting,
+               xen_store_evtchn, wake_waiting,
                0, "xenbus", &xb_waitq);
        if (err <= 0) {
                printk(KERN_ERR "XENBUS request irq failed %i\n", err);
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Mon Aug 14 
15:21:30 2006 -0400
@@ -39,5 +39,7 @@ int xb_read(void *data, unsigned len);
 int xb_read(void *data, unsigned len);
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;
+extern struct xenstore_domain_interface *xen_store_interface;
+extern int xen_store_evtchn;
 
 #endif /* _XENBUS_COMMS_H */
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Mon Aug 14 
15:21:30 2006 -0400
@@ -285,7 +285,7 @@ static int xenbus_dev_open(struct inode 
 {
        struct xenbus_dev_data *u;
 
-       if (xen_start_info->store_evtchn == 0)
+       if (xen_store_evtchn == 0)
                return -ENOENT;
 
        nonseekable_open(inode, filp);
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Aug 14 
15:21:30 2006 -0400
@@ -54,6 +54,10 @@
 
 #include "xenbus_comms.h"
 
+int xen_store_evtchn;
+struct xenstore_domain_interface *xen_store_interface;
+static unsigned long xen_store_mfn;
+
 extern struct mutex xenwatch_mutex;
 
 static struct notifier_block *xenstore_chain;
@@ -928,8 +932,7 @@ static int xsd_kva_mmap(struct file *fil
        if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
                return -EINVAL;
 
-       if (remap_pfn_range(vma, vma->vm_start,
-                           mfn_to_pfn(xen_start_info->store_mfn),
+       if (remap_pfn_range(vma, vma->vm_start, mfn_to_pfn(xen_store_mfn),
                            size, vma->vm_page_prot))
                return -EAGAIN;
 
@@ -941,7 +944,7 @@ static int xsd_kva_read(char *page, char
 {
        int len;
 
-       len  = sprintf(page, "0x%p", mfn_to_virt(xen_start_info->store_mfn));
+       len  = sprintf(page, "0x%p", xen_store_interface);
        *eof = 1;
        return len;
 }
@@ -951,12 +954,11 @@ static int xsd_port_read(char *page, cha
 {
        int len;
 
-       len  = sprintf(page, "%d", xen_start_info->store_evtchn);
+       len  = sprintf(page, "%d", xen_store_evtchn);
        *eof = 1;
        return len;
 }
 #endif
-
 
 static int __init xenbus_probe_init(void)
 {
@@ -985,7 +987,7 @@ static int __init xenbus_probe_init(void
                if (!page)
                        return -ENOMEM;
 
-               xen_start_info->store_mfn =
+               xen_store_mfn = xen_start_info->store_mfn =
                        pfn_to_mfn(virt_to_phys((void *)page) >>
                                   PAGE_SHIFT);
 
@@ -998,7 +1000,8 @@ static int __init xenbus_probe_init(void
                if (err == -ENOSYS)
                        goto err;
                BUG_ON(err);
-               xen_start_info->store_evtchn = alloc_unbound.port;
+               xen_store_evtchn = xen_start_info->store_evtchn =
+                       alloc_unbound.port;
 
 #ifdef CONFIG_PROC_FS
                /* And finally publish the above info in /proc/xen */
@@ -1014,8 +1017,13 @@ static int __init xenbus_probe_init(void
                if (xsd_port_intf)
                        xsd_port_intf->read_proc = xsd_port_read;
 #endif
-       } else
+       } else {
                xenstored_ready = 1;
+               xen_store_evtchn = xen_start_info->store_evtchn;
+               xen_store_mfn = xen_start_info->store_mfn;
+       }
+
+       xen_store_interface = mfn_to_virt(xen_store_mfn);
 
        /* Initialize the interface to xenstore. */
        err = xs_init();
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h    Mon Aug 
14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h    Mon Aug 
14 15:21:30 2006 -0400
@@ -354,6 +354,13 @@ HYPERVISOR_nmi_op(
        return _hypercall2(int, nmi_op, op, arg);
 }
 
+static inline unsigned long
+HYPERVISOR_hvm_op(
+    int op, void *arg)
+{
+    return _hypercall2(unsigned long, hvm_op, op, arg);
+}
+
 static inline int
 HYPERVISOR_callback_op(
        int cmd, void *arg)
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h   Mon Aug 
14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h   Mon Aug 
14 15:21:30 2006 -0400
@@ -58,6 +58,7 @@ extern shared_info_t *HYPERVISOR_shared_
 
 /* arch/xen/i386/kernel/setup.c */
 extern start_info_t *xen_start_info;
+#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
 
 /* arch/xen/kernel/evtchn.c */
 /* Force a proper event-channel callback from Xen. */
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Mon Aug 14 
15:21:30 2006 -0400
@@ -60,123 +60,6 @@
 #define clear_user_page(page, vaddr, pg)       clear_page(page)
 #define copy_user_page(to, from, vaddr, pg)    copy_page(to, from)
 
-/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
-#define INVALID_P2M_ENTRY      (~0UL)
-#define FOREIGN_FRAME_BIT      (1UL<<31)
-#define FOREIGN_FRAME(m)       ((m) | FOREIGN_FRAME_BIT)
-
-extern unsigned long *phys_to_machine_mapping;
-
-#undef machine_to_phys_mapping
-extern unsigned long *machine_to_phys_mapping;
-extern unsigned int   machine_to_phys_order;
-
-static inline unsigned long pfn_to_mfn(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return pfn;
-       return phys_to_machine_mapping[(unsigned int)(pfn)] &
-               ~FOREIGN_FRAME_BIT;
-}
-
-static inline int phys_to_machine_mapping_valid(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return 1;
-       return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
-}
-
-static inline unsigned long mfn_to_pfn(unsigned long mfn)
-{
-       extern unsigned long max_mapnr;
-       unsigned long pfn;
-
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return mfn;
-
-       if (unlikely((mfn >> machine_to_phys_order) != 0))
-               return max_mapnr;
-
-       /* The array access can fail (e.g., device space beyond end of RAM). */
-       asm (
-               "1:     movl %1,%0\n"
-               "2:\n"
-               ".section .fixup,\"ax\"\n"
-               "3:     movl %2,%0\n"
-               "       jmp  2b\n"
-               ".previous\n"
-               ".section __ex_table,\"a\"\n"
-               "       .align 4\n"
-               "       .long 1b,3b\n"
-               ".previous"
-               : "=r" (pfn)
-               : "m" (machine_to_phys_mapping[mfn]), "m" (max_mapnr) );
-
-       return pfn;
-}
-
-/*
- * We detect special mappings in one of two ways:
- *  1. If the MFN is an I/O page then Xen will set the m2p entry
- *     to be outside our maximum possible pseudophys range.
- *  2. If the MFN belongs to a different domain then we will certainly
- *     not have MFN in our p2m table. Conversely, if the page is ours,
- *     then we'll have p2m(m2p(MFN))==MFN.
- * If we detect a special mapping then it doesn't have a 'struct page'.
- * We force !pfn_valid() by returning an out-of-range pointer.
- *
- * NB. These checks require that, for any MFN that is not in our reservation,
- * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
- * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
- * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
- *
- * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
- *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
- *      require. In all the cases we care about, the FOREIGN_FRAME bit is
- *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
- */
-static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
-{
-       extern unsigned long max_mapnr;
-       unsigned long pfn = mfn_to_pfn(mfn);
-       if ((pfn < max_mapnr)
-           && !xen_feature(XENFEAT_auto_translated_physmap)
-           && (phys_to_machine_mapping[pfn] != mfn))
-               return max_mapnr; /* force !pfn_valid() */
-       return pfn;
-}
-
-static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap)) {
-               BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
-               return;
-       }
-       phys_to_machine_mapping[pfn] = mfn;
-}
-
-/* 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
-
-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;
-}
-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;
-}
-
 /*
  * These are used to make use of C type-checking..
  */
@@ -187,6 +70,8 @@ typedef struct { unsigned long long pmd;
 typedef struct { unsigned long long pmd; } pmd_t;
 typedef struct { unsigned long long pgd; } pgd_t;
 typedef struct { unsigned long long pgprot; } pgprot_t;
+#define pgprot_val(x)  ((x).pgprot)
+#include <asm/maddr.h>
 #define __pte(x) ({ unsigned long long _x = (x);        \
     if (_x & 1) _x = phys_to_machine(_x);               \
     ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
@@ -227,6 +112,8 @@ typedef struct { unsigned long pte_low; 
 typedef struct { unsigned long pte_low; } pte_t;
 typedef struct { unsigned long pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
+#define pgprot_val(x)  ((x).pgprot)
+#include <asm/maddr.h>
 #define boot_pte_t pte_t /* or would you rather have a typedef */
 #define pte_val(x)     (((x).pte_low & 1) ? machine_to_phys((x).pte_low) : \
                         (x).pte_low)
@@ -252,9 +139,6 @@ static inline unsigned long pgd_val(pgd_
 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 #endif
 
-#define pgprot_val(x)  ((x).pgprot)
-
-#define __pte_ma(x)    ((pte_t) { (x) } )
 #define __pgprot(x)    ((pgprot_t) { (x) } )
 
 #endif /* !__ASSEMBLY__ */
@@ -323,11 +207,6 @@ extern int page_is_ram(unsigned long pag
        ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-/* VIRT <-> MACHINE conversion */
-#define virt_to_machine(v)     (phys_to_machine(__pa(v)))
-#define virt_to_mfn(v)         (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
-#define mfn_to_virt(m)         (__va(mfn_to_pfn(m) << PAGE_SHIFT))
-
 #define __HAVE_ARCH_GATE_AREA 1
 
 #endif /* __KERNEL__ */
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h       
Mon Aug 14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h       
Mon Aug 14 15:21:30 2006 -0400
@@ -45,7 +45,6 @@
 
 #define pte_none(x)            (!(x).pte_low)
 #define pfn_pte(pfn, prot)     __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
-#define pfn_pte_ma(pfn, prot)  __pte_ma(((pfn) << PAGE_SHIFT) | 
pgprot_val(prot))
 #define pfn_pmd(pfn, prot)     __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
 
 /*
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h       
Mon Aug 14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h       
Mon Aug 14 15:21:30 2006 -0400
@@ -151,18 +151,6 @@ static inline int pte_none(pte_t pte)
 
 extern unsigned long long __supported_pte_mask;
 
-static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
-{
-       pte_t pte;
-
-       pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) | \
-                                       (pgprot_val(pgprot) >> 32);
-       pte.pte_high &= (__supported_pte_mask >> 32);
-       pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)) & \
-                                                       __supported_pte_mask;
-       return pte;
-}
-
 static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
 {
        return pfn_pte_ma(pfn_to_mfn(page_nr), pgprot);
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Mon Aug 14 
10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Mon Aug 14 
15:21:30 2006 -0400
@@ -58,6 +58,8 @@ extern int running_on_xen;
 
 extern shared_info_t *HYPERVISOR_shared_info;
 extern start_info_t *xen_start_info;
+
+#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
 
 void force_evtchn_callback(void);
 
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h  Mon Aug 
14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h  Mon Aug 
14 15:21:30 2006 -0400
@@ -355,6 +355,13 @@ HYPERVISOR_nmi_op(
        return _hypercall2(int, nmi_op, op, arg);
 }
 
+static inline unsigned long
+HYPERVISOR_hvm_op(
+    int op, void *arg)
+{
+    return _hypercall2(unsigned long, hvm_op, op, arg);
+}
+
 static inline int
 HYPERVISOR_callback_op(
        int cmd, void *arg)
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h       Mon Aug 
14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h       Mon Aug 
14 15:21:30 2006 -0400
@@ -7,7 +7,6 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <asm/bug.h>
-#include <xen/features.h>
 #endif
 #include <xen/interface/xen.h> 
 #include <xen/foreign_page.h>
@@ -69,6 +68,8 @@
 
 extern unsigned long end_pfn;
 
+#include <asm/maddr.h>
+
 void clear_page(void *);
 void copy_page(void *, void *);
 
@@ -77,118 +78,6 @@ void copy_page(void *, void *);
 
 #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | 
__GFP_ZERO, vma, vaddr)
 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
-
-/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
-#define INVALID_P2M_ENTRY      (~0UL)
-#define FOREIGN_FRAME_BIT      (1UL<<63)
-#define FOREIGN_FRAME(m)       ((m) | FOREIGN_FRAME_BIT)
-
-extern unsigned long *phys_to_machine_mapping;
-
-#undef machine_to_phys_mapping
-extern unsigned long *machine_to_phys_mapping;
-extern unsigned int   machine_to_phys_order;
-
-static inline unsigned long pfn_to_mfn(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return pfn;
-       return phys_to_machine_mapping[(unsigned int)(pfn)] &
-               ~FOREIGN_FRAME_BIT;
-}
-
-static inline int phys_to_machine_mapping_valid(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return 1;
-       return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
-}
-
-static inline unsigned long mfn_to_pfn(unsigned long mfn)
-{
-       unsigned long pfn;
-
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return mfn;
-
-       if (unlikely((mfn >> machine_to_phys_order) != 0))
-               return end_pfn;
-
-       /* The array access can fail (e.g., device space beyond end of RAM). */
-       asm (
-               "1:     movq %1,%0\n"
-               "2:\n"
-               ".section .fixup,\"ax\"\n"
-               "3:     movq %2,%0\n"
-               "       jmp  2b\n"
-               ".previous\n"
-               ".section __ex_table,\"a\"\n"
-               "       .align 8\n"
-               "       .quad 1b,3b\n"
-               ".previous"
-               : "=r" (pfn)
-               : "m" (machine_to_phys_mapping[mfn]), "m" (end_pfn) );
-
-       return pfn;
-}
-
-/*
- * We detect special mappings in one of two ways:
- *  1. If the MFN is an I/O page then Xen will set the m2p entry
- *     to be outside our maximum possible pseudophys range.
- *  2. If the MFN belongs to a different domain then we will certainly
- *     not have MFN in our p2m table. Conversely, if the page is ours,
- *     then we'll have p2m(m2p(MFN))==MFN.
- * If we detect a special mapping then it doesn't have a 'struct page'.
- * We force !pfn_valid() by returning an out-of-range pointer.
- *
- * NB. These checks require that, for any MFN that is not in our reservation,
- * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
- * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
- * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
- *
- * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
- *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
- *      require. In all the cases we care about, the FOREIGN_FRAME bit is
- *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
- */
-static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
-{
-       unsigned long pfn = mfn_to_pfn(mfn);
-       if ((pfn < end_pfn)
-           && !xen_feature(XENFEAT_auto_translated_physmap)
-           && (phys_to_machine_mapping[pfn] != mfn))
-               return end_pfn; /* force !pfn_valid() */
-       return pfn;
-}
-
-
-static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap)) {
-               BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
-               return;
-       }
-       phys_to_machine_mapping[pfn] = mfn;
-}
-
-/* Definitions for machine and pseudophysical addresses. */
-typedef unsigned long paddr_t;
-typedef unsigned long maddr_t;
-
-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;
-}
-
-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;
-}
 
 /*
  * These are used to make use of C type-checking..
@@ -227,8 +116,6 @@ static inline unsigned long pgd_val(pgd_
 }
 
 #define pgprot_val(x)  ((x).pgprot)
-
-#define __pte_ma(x)     ((pte_t) { (x) } )
 
 static inline pte_t __pte(unsigned long x)
 {
@@ -310,11 +197,6 @@ static inline pgd_t __pgd(unsigned long 
 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 
-/* VIRT <-> MACHINE conversion */
-#define virt_to_machine(v)     (phys_to_machine(__pa(v)))
-#define virt_to_mfn(v)         (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
-#define mfn_to_virt(m)         (__va(mfn_to_pfn(m) << PAGE_SHIFT))
-
 #define VM_DATA_DEFAULT_FLAGS \
        (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
         VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h    Mon Aug 
14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h    Mon Aug 
14 15:21:30 2006 -0400
@@ -312,7 +312,6 @@ static inline pte_t pfn_pte(unsigned lon
        return pte;
 }
 
-#define pfn_pte_ma(pfn, prot)  __pte_ma((((pfn) << PAGE_SHIFT) | 
pgprot_val(prot)) & __supported_pte_mask)
 /*
  * The following only work if pte_present() is true.
  * Undefined behaviour if not..
diff -r 39c113fb84ac -r 10f1113fd489 linux-2.6-xen-sparse/mm/memory.c
--- a/linux-2.6-xen-sparse/mm/memory.c  Mon Aug 14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/mm/memory.c  Mon Aug 14 15:21:30 2006 -0400
@@ -390,7 +390,7 @@ struct page *vm_normal_page(struct vm_ar
 
        if (vma->vm_flags & VM_PFNMAP) {
                unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT;
-               if (pfn == vma->vm_pgoff + off)
+               if ((pfn == vma->vm_pgoff + off) || !pfn_valid(pfn))
                        return NULL;
                if (!is_cow_mapping(vma->vm_flags))
                        return NULL;
@@ -405,8 +405,7 @@ struct page *vm_normal_page(struct vm_ar
         * Remove this test eventually!
         */
        if (unlikely(!pfn_valid(pfn))) {
-               if (!(vma->vm_flags & VM_RESERVED))
-                       print_bad_pte(vma, pte, addr);
+               print_bad_pte(vma, pte, addr);
                return NULL;
        }
 
diff -r 39c113fb84ac -r 10f1113fd489 linux-2.6-xen-sparse/net/core/dev.c
--- a/linux-2.6-xen-sparse/net/core/dev.c       Mon Aug 14 10:03:58 2006 -0400
+++ b/linux-2.6-xen-sparse/net/core/dev.c       Mon Aug 14 15:21:30 2006 -0400
@@ -1093,11 +1093,6 @@ int skb_checksum_help(struct sk_buff *sk
                goto out_set_summed;
 
        if (unlikely(skb_shinfo(skb)->gso_size)) {
-               static int warned;
-
-               WARN_ON(!warned);
-               warned = 1;
-
                /* Let GSO fix up the checksum. */
                goto out_set_summed;
        }
@@ -1147,11 +1142,6 @@ struct sk_buff *skb_gso_segment(struct s
        __skb_pull(skb, skb->mac_len);
 
        if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
-               static int warned;
-
-               WARN_ON(!warned);
-               warned = 1;
-
                if (skb_header_cloned(skb) &&
                    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
                        return ERR_PTR(err);
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/hvmloader/Makefile Mon Aug 14 15:21:30 2006 -0400
@@ -31,8 +31,6 @@ DEFINES  =-DDEBUG
 DEFINES  =-DDEBUG
 XENINC   =-I$(XEN_ROOT)/tools/libxc
 
-OBJECTS         = hvmloader.o acpi_madt.o 
-
 # Disable PIE/SSP if GCC supports them. They can break us.
 CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
 CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
@@ -42,7 +40,7 @@ CFLAGS  += $(DEFINES) -I. $(XENINC) -fno
 CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
 LDFLAGS  = -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
 
-SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c
+SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c
 OBJS = $(patsubst %.c,%.o,$(SRCS))
 
 .PHONY: all
@@ -54,7 +52,7 @@ hvmloader: roms.h $(SRCS)
        $(OBJCOPY) hvmloader.tmp hvmloader
        rm -f hvmloader.tmp
 
-roms.h:        ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin 
../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin
+roms.h:        ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin 
../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin 
../acpi/acpi.bin
        sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
        sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
        sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin 
>> roms.h
@@ -64,5 +62,5 @@ roms.h:       ../rombios/BIOS-bochs-latest ../
 .PHONY: clean
 clean:
        rm -f roms.h acpi.h
-       rm -f hvmloader hvmloader.tmp hvmloader.o $(OBJECTS)
+       rm -f hvmloader hvmloader.tmp hvmloader.o $(OBJS)
 
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/hvmloader/hvmloader.c      Mon Aug 14 15:21:30 2006 -0400
@@ -25,6 +25,7 @@
 #include "../acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
 #include "hypercall.h"
 #include "util.h"
+#include "smbios.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
 
@@ -116,15 +117,6 @@ check_amd(void)
 }
 
 static void
-cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
-{
-       __asm__ __volatile__(
-               "cpuid"
-               : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
-               : "0" (idx) );
-}
-
-static void
 wrmsr(uint32_t idx, uint64_t v)
 {
        __asm__ __volatile__(
@@ -209,6 +201,9 @@ main(void)
                }
        }
 
+       puts("Writing SMBIOS tables ...\n");
+       hvm_write_smbios_tables();
+
        if (check_amd()) {
                /* AMD implies this is SVM */
                 puts("SVM go ...\n");
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/hypercall.h
--- a/tools/firmware/hvmloader/hypercall.h      Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/hvmloader/hypercall.h      Mon Aug 14 15:21:30 2006 -0400
@@ -30,6 +30,8 @@
 
 #ifndef __HVMLOADER_HYPERCALL_H__
 #define __HVMLOADER_HYPERCALL_H__
+
+#include <xen/xen.h>
 
 /*
  * NB. Hypercall address needs to be relative to a linkage symbol for
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/hvmloader/util.c   Mon Aug 14 15:21:30 2006 -0400
@@ -20,6 +20,7 @@
 
 #include "../acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
 #include "util.h"
+#include <stdint.h>
 
 void outw(uint16_t addr, uint16_t val)
 {
@@ -94,3 +95,82 @@ void puts(const char *s)
        while (*s)
                outb(0xE9, *s++);
 }
+
+char *
+strcpy(char *dest, const char *src)
+{
+       char *p = dest;
+       while (*src)
+               *p++ = *src++;
+       *p = 0;
+       return dest;
+}
+
+char *
+strncpy(char *dest, const char *src, unsigned n)
+{
+       int i = 0;
+       char *p = dest;
+
+       /* write non-NUL characters from src into dest until we run
+          out of room in dest or encounter a NUL in src */
+       while (i < n && *src) {
+               *p++ = *src++;
+               ++i;
+       }
+
+       /* pad remaining bytes of dest with NUL bytes */
+       while (i < n) {
+               *p++ = 0;
+               ++i;
+       }
+
+       return dest;
+}
+
+unsigned
+strlen(const char *s)
+{
+       int i = 0;
+       while (*s++)
+               ++i;
+       return i;
+}
+
+void *
+memset(void *s, int c, unsigned n)
+{
+       uint8_t b = (uint8_t) c;
+       uint8_t *p = (uint8_t *)s;
+       int i;
+       for (i = 0; i < n; ++i)
+               *p++ = b;
+       return s;
+}
+
+int
+memcmp(const void *s1, const void *s2, unsigned n)
+{
+       unsigned i;
+       uint8_t *p1 = (uint8_t *) s1;
+       uint8_t *p2 = (uint8_t *) s2;
+
+       for (i = 0; i < n; ++i) {
+               if (p1[i] < p2[i])
+                       return -1;
+               else if (p1[i] > p2[i])
+                       return 1;
+       }
+
+       return 0;
+}
+
+void
+cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
+{
+       __asm__ __volatile__(
+               "cpuid"
+               : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+               : "0" (idx) );
+}
+
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h   Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/hvmloader/util.h   Mon Aug 14 15:21:30 2006 -0400
@@ -8,9 +8,21 @@ void outb(uint16_t addr, uint8_t val);
 /* I/O input */
 uint8_t inb(uint16_t addr);
 
+/* Do cpuid instruction, with operation 'idx' */
+void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
+           uint32_t *ecx, uint32_t *edx);
+
+/* Return number of vcpus. */
+int get_vcpu_nr(void);
+
 /* String and memory functions */
 int strcmp(const char *cs, const char *ct);
+char *strcpy(char *dest, const char *src);
+char *strncpy(char *dest, const char *src, unsigned n);
+unsigned strlen(const char *s);
+int memcmp(const void *s1, const void *s2, unsigned n);
 void *memcpy(void *dest, const void *src, unsigned n);
+void *memset(void *s, int c, unsigned n);
 char *itoa(char *a, unsigned int i);
 
 /* Debug output */
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/rombios/rombios.c  Mon Aug 14 15:21:30 2006 -0400
@@ -9443,6 +9443,43 @@ rom_scan_increment:
   mov  ds, ax
   ret
 
+#ifdef HVMASSIST
+
+; Copy the SMBIOS entry point over from 0x9f000, where hvmloader left it.
+; The entry point must be somewhere in 0xf0000-0xfffff on a 16-byte boundary,
+; but the tables themeselves can be elsewhere.
+smbios_init:
+  push ax
+  push cx
+  push es
+  push ds
+  push di
+  push si
+
+  mov cx, #0x001f ; 0x1f bytes to copy
+  mov ax, #0xf000
+  mov es, ax      ; destination segment is 0xf0000
+  mov di, smbios_entry_point ; destination offset
+  mov ax, #0x9f00
+  mov ds, ax      ; source segment is 0x9f000
+  mov si, #0x0000 ; source offset is 0
+  cld
+  rep
+    movsb
+
+  pop si
+  pop di
+  pop ds
+  pop es
+  pop cx
+  pop ax
+
+  ret
+
+#endif
+
+
+
 ;; for 'C' strings and other data, insert them here with
 ;; a the following hack:
 ;; DATA_SEG_DEFS_HERE
@@ -9724,6 +9761,7 @@ post_default_ints:
 
 #ifdef HVMASSIST
   call _copy_e820_table
+  call smbios_init
 #endif
 
   call rom_scan
@@ -10538,6 +10576,13 @@ dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 768 bytes
 dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 832 bytes
 dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 896 bytes
+
+.align 16
+smbios_entry_point:
+db 0,0,0,0,0,0,0,0 ; 8 bytes
+db 0,0,0,0,0,0,0,0 ; 16 bytes
+db 0,0,0,0,0,0,0,0 ; 24 bytes
+db 0,0,0,0,0,0,0   ; 31 bytes
 ASM_END
 
 #else // !HVMASSIST
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/vmxassist/vmxassist.ld
--- a/tools/firmware/vmxassist/vmxassist.ld     Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/firmware/vmxassist/vmxassist.ld     Mon Aug 14 15:21:30 2006 -0400
@@ -6,27 +6,27 @@ ENTRY(_start)
 
 SECTIONS
 {
+       _btext = .;
        .text TEXTADDR : 
        {
-               _btext = .;
                *(.text)
                *(.rodata)
                *(.rodata.*)
-               _etext = .;
        }
+       _etext = .;
 
+       _bdata = .;
        .data :
        {
-               _bdata = .;
                *(.data)
-               _edata = .;
        }
+       _edata = .;
 
+       _bbss = .;
        .bss :
        {
-               _bbss = .;
                *(.bss)
-               _ebss = .;
        }
+       _ebss = .;
 }
 
diff -r 39c113fb84ac -r 10f1113fd489 tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c   Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/libxc/xc_evtchn.c   Mon Aug 14 15:21:30 2006 -0400
@@ -49,14 +49,3 @@ int xc_evtchn_alloc_unbound(int xc_handl
 
     return rc;
 }
-
-
-int xc_evtchn_status(int xc_handle,
-                     uint32_t dom,
-                     evtchn_port_t port,
-                     xc_evtchn_status_t *status)
-{
-    status->dom  = (domid_t)dom;
-    status->port = port;
-    return do_evtchn_op(xc_handle, EVTCHNOP_status, status, sizeof(*status));
-}
diff -r 39c113fb84ac -r 10f1113fd489 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/libxc/xc_hvm_build.c        Mon Aug 14 15:21:30 2006 -0400
@@ -58,12 +58,12 @@ static void build_e820map(void *e820_pag
 
     /* XXX: Doesn't work for > 4GB yet */
     e820entry[nr_map].addr = 0x0;
-    e820entry[nr_map].size = 0x9F800;
+    e820entry[nr_map].size = 0x9F000;
     e820entry[nr_map].type = E820_RAM;
     nr_map++;
 
-    e820entry[nr_map].addr = 0x9F800;
-    e820entry[nr_map].size = 0x800;
+    e820entry[nr_map].addr = 0x9F000;
+    e820entry[nr_map].size = 0x1000;
     e820entry[nr_map].type = E820_RESERVED;
     nr_map++;
 
diff -r 39c113fb84ac -r 10f1113fd489 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/libxc/xenctrl.h     Mon Aug 14 15:21:30 2006 -0400
@@ -367,8 +367,6 @@ int xc_sched_credit_domain_get(int xc_ha
                                uint32_t domid,
                                struct sched_credit_adjdom *sdom);
 
-typedef evtchn_status_t xc_evtchn_status_t;
-
 /*
  * EVENT CHANNEL FUNCTIONS
  */
@@ -386,11 +384,6 @@ int xc_evtchn_alloc_unbound(int xc_handl
 int xc_evtchn_alloc_unbound(int xc_handle,
                             uint32_t dom,
                             uint32_t remote_dom);
-
-int xc_evtchn_status(int xc_handle,
-                     uint32_t dom, /* may be DOMID_SELF */
-                     evtchn_port_t port,
-                     xc_evtchn_status_t *status);
 
 int xc_physdev_pci_access_modify(int xc_handle,
                                  uint32_t domid,
diff -r 39c113fb84ac -r 10f1113fd489 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Mon Aug 14 10:03:58 2006 -0400
+++ b/tools/python/xen/lowlevel/xc/xc.c Mon Aug 14 15:21:30 2006 -0400
@@ -484,60 +484,6 @@ static PyObject *pyxc_evtchn_alloc_unbou
     return PyInt_FromLong(port);
 }
 
-static PyObject *pyxc_evtchn_status(XcObject *self,
-                                    PyObject *args,
-                                    PyObject *kwds)
-{
-    PyObject *dict;
-
-    uint32_t dom = DOMID_SELF;
-    int port, ret;
-    xc_evtchn_status_t status;
-
-    static char *kwd_list[] = { "port", "dom", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
-                                      &port, &dom) )
-        return NULL;
-
-    ret = xc_evtchn_status(self->xc_handle, dom, port, &status);
-    if ( ret != 0 )
-        return PyErr_SetFromErrno(xc_error);
-
-    switch ( status.status )
-    {
-    case EVTCHNSTAT_closed:
-        dict = Py_BuildValue("{s:s}", 
-                             "status", "closed");
-        break;
-    case EVTCHNSTAT_unbound:
-        dict = Py_BuildValue("{s:s}", 
-                             "status", "unbound");
-        break;
-    case EVTCHNSTAT_interdomain:
-        dict = Py_BuildValue("{s:s,s:i,s:i}", 
-                             "status", "interdomain",
-                             "dom", status.u.interdomain.dom,
-                             "port", status.u.interdomain.port);
-        break;
-    case EVTCHNSTAT_pirq:
-        dict = Py_BuildValue("{s:s,s:i}", 
-                             "status", "pirq",
-                             "irq", status.u.pirq);
-        break;
-    case EVTCHNSTAT_virq:
-        dict = Py_BuildValue("{s:s,s:i}", 
-                             "status", "virq",
-                             "irq", status.u.virq);
-        break;
-    default:
-        dict = Py_BuildValue("{}");
-        break;
-    }
-    
-    return dict;
-}
-
 static PyObject *pyxc_physdev_pci_access_modify(XcObject *self,
                                                 PyObject *args,
                                                 PyObject *kwds)
@@ -1140,21 +1086,6 @@ static PyMethodDef pyxc_methods[] = {
       " dom        [int]: Domain whose port space to allocate from.\n"
       " remote_dom [int]: Remote domain to accept connections from.\n\n"
       "Returns: [int] Unbound event-channel port.\n" },
-
-    { "evtchn_status", 
-      (PyCFunction)pyxc_evtchn_status, 
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Query the status of an event channel.\n"
-      " dom  [int, SELF]: Dom-id of one endpoint of the channel.\n"
-      " port [int]:       Port-id of one endpoint of the channel.\n\n"
-      "Returns: [dict] dictionary is empty on failure.\n"
-      " status [str]:  'closed', 'unbound', 'interdomain', 'pirq',"
-      " or 'virq'.\n"
-      "The following are returned if 'status' is 'interdomain':\n"
-      " dom  [int]: Dom-id of remote endpoint.\n"
-      " port [int]: Port-id of remote endpoint.\n"
-      "The following are returned if 'status' is 'pirq' or 'virq':\n"
-      " irq  [int]: IRQ number.\n" },
 
     { "physdev_pci_access_modify",
       (PyCFunction)pyxc_physdev_pci_access_modify,
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c  Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/vmx/mmio.c  Mon Aug 14 15:21:30 2006 -0400
@@ -33,7 +33,7 @@
 #include <asm/mm.h>
 #include <asm/vmx.h>
 #include <public/event_channel.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <linux/event.h>
 #include <xen/domain.h>
 /*
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c       Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/vmx/vlsapic.c       Mon Aug 14 15:21:30 2006 -0400
@@ -21,7 +21,7 @@
  */
 
 #include <linux/sched.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <asm/ia64_int.h>
 #include <asm/vcpu.h>
 #include <asm/regionreg.h>
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c      Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/vmx/vmx_init.c      Mon Aug 14 15:21:30 2006 -0400
@@ -41,15 +41,14 @@
 #include <asm/vmx_vcpu.h>
 #include <xen/lib.h>
 #include <asm/vmmu.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <public/hvm/ioreq.h>
+#include <public/event_channel.h>
 #include <asm/vmx_phy_mode.h>
 #include <asm/processor.h>
 #include <asm/vmx.h>
 #include <xen/mm.h>
-#include <public/arch-ia64.h>
 #include <asm/hvm/vioapic.h>
-#include <public/event_channel.h>
 #include <xen/event.h>
 #include <asm/vlsapic.h>
 
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/vmx/vmx_vcpu.c
--- a/xen/arch/ia64/vmx/vmx_vcpu.c      Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/vmx/vmx_vcpu.c      Mon Aug 14 15:21:30 2006 -0400
@@ -24,7 +24,7 @@
  */
 
 #include <xen/sched.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <asm/ia64_int.h>
 #include <asm/vmx_vcpu.h>
 #include <asm/regionreg.h>
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/xen/domain.c        Mon Aug 14 15:21:30 2006 -0400
@@ -35,14 +35,13 @@
 #include <asm/pgalloc.h>
 #include <asm/offsets.h>  /* for IA64_THREAD_INFO_SIZE */
 #include <asm/vcpu.h>   /* for function declarations */
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <xen/domain.h>
 #include <asm/vmx.h>
 #include <asm/vmx_vcpu.h>
 #include <asm/vmx_vpd.h>
 #include <asm/vmx_phy_mode.h>
 #include <asm/vhpt.h>
-#include <public/arch-ia64.h>
 #include <asm/tlbflush.h>
 #include <asm/regionreg.h>
 #include <asm/dom_fw.h>
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/xen/hyperprivop.S
--- a/xen/arch/ia64/xen/hyperprivop.S   Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/xen/hyperprivop.S   Mon Aug 14 15:21:30 2006 -0400
@@ -14,7 +14,7 @@
 #include <asm/system.h>
 #include <asm/debugger.h>
 #include <asm/asm-xsi-offsets.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 
 
 #define        _PAGE_PPN_MASK  0x0003fffffffff000 //asm/pgtable.h doesn't do 
assembly
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/xen/vcpu.c  Mon Aug 14 15:21:30 2006 -0400
@@ -7,7 +7,7 @@
  */
 
 #include <linux/sched.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <asm/ia64_int.h>
 #include <asm/vcpu.h>
 #include <asm/regionreg.h>
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/ia64/xen/xenasm.S
--- a/xen/arch/ia64/xen/xenasm.S        Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/ia64/xen/xenasm.S        Mon Aug 14 15:21:30 2006 -0400
@@ -11,7 +11,7 @@
 #include <asm/pgtable.h>
 #include <asm/vhpt.h>
 #include <asm/asm-xsi-offsets.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
        
 // Change rr7 to the passed value while ensuring
 // Xen is mapped into the new region.
diff -r 39c113fb84ac -r 10f1113fd489 xen/arch/x86/hvm/platform.c
--- a/xen/arch/x86/hvm/platform.c       Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/arch/x86/hvm/platform.c       Mon Aug 14 15:21:30 2006 -0400
@@ -462,7 +462,8 @@ static int hvm_decode(int realmode, unsi
                     return DECODE_success;
 
                 default:
-                    printf("%x, This opcode isn't handled yet!\n", *opcode);
+                    printf("%x/%x, This opcode isn't handled yet!\n",
+                           *opcode, ins_subtype);
                     return DECODE_failure;
             }
         }
diff -r 39c113fb84ac -r 10f1113fd489 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/common/grant_table.c  Mon Aug 14 15:21:30 2006 -0400
@@ -33,9 +33,10 @@
 #include <xen/domain_page.h>
 #include <acm/acm_hooks.h>
 
-/* The first to members of a grant entry are updated as a combined
- * pair.  The following union allows that to happen in an endian
- * neutral fashion. */
+/*
+ * The first two members of a grant entry are updated as a combined pair.
+ * The following union allows that to happen in an endian-neutral fashion.
+ */
 union grant_combo {
     uint32_t word;
     struct {
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/include/asm-ia64/domain.h     Mon Aug 14 15:21:30 2006 -0400
@@ -6,7 +6,7 @@
 #include <asm/vmx_vpd.h>
 #include <asm/vmmu.h>
 #include <asm/regionreg.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <asm/vmx_platform.h>
 #include <xen/list.h>
 #include <xen/cpumask.h>
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/event.h
--- a/xen/include/asm-ia64/event.h      Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/include/asm-ia64/event.h      Mon Aug 14 15:21:30 2006 -0400
@@ -9,7 +9,7 @@
 #ifndef __ASM_EVENT_H__
 #define __ASM_EVENT_H__
 
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 #include <asm/vcpu.h>
 
 static inline void vcpu_kick(struct vcpu *v)
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/linux-xen/asm/ptrace.h
--- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h       Mon Aug 14 10:03:58 
2006 -0400
+++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h       Mon Aug 14 15:21:30 
2006 -0400
@@ -96,7 +96,8 @@
  *
  */
 #ifdef XEN
-#include <public/arch-ia64.h>
+#include <xen/types.h>
+#include <public/xen.h>
 #define pt_regs cpu_user_regs
 
 /*  User regs at placed at the end of the vcpu area.
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/privop_stat.h
--- a/xen/include/asm-ia64/privop_stat.h        Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/include/asm-ia64/privop_stat.h        Mon Aug 14 15:21:30 2006 -0400
@@ -1,6 +1,7 @@
 #ifndef _XEN_UA64_PRIVOP_STAT_H
 #define _XEN_UA64_PRIVOP_STAT_H
-#include <public/arch-ia64.h>
+#include <xen/types.h>
+#include <public/xen.h>
 
 extern int dump_privop_counts_to_user(char *, int);
 extern int zero_privop_counts_to_user(char *, int);
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/vcpu.h
--- a/xen/include/asm-ia64/vcpu.h       Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/include/asm-ia64/vcpu.h       Mon Aug 14 15:21:30 2006 -0400
@@ -7,7 +7,8 @@
 #include <asm/fpu.h>
 #include <asm/tlb.h>
 #include <asm/ia64_int.h>
-#include <public/arch-ia64.h>
+#include <xen/types.h>
+#include <public/xen.h>
 typedef        unsigned long UINT64;
 typedef        unsigned int UINT;
 typedef        int BOOLEAN;
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/vmx_platform.h
--- a/xen/include/asm-ia64/vmx_platform.h       Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/include/asm-ia64/vmx_platform.h       Mon Aug 14 15:21:30 2006 -0400
@@ -21,7 +21,6 @@
 
 #include <public/xen.h>
 #include <public/hvm/params.h>
-#include <public/arch-ia64.h>
 #include <asm/hvm/vioapic.h>
 struct mmio_list;
 typedef struct virtual_platform_def {
diff -r 39c113fb84ac -r 10f1113fd489 xen/include/asm-ia64/vmx_vpd.h
--- a/xen/include/asm-ia64/vmx_vpd.h    Mon Aug 14 10:03:58 2006 -0400
+++ b/xen/include/asm-ia64/vmx_vpd.h    Mon Aug 14 15:21:30 2006 -0400
@@ -26,7 +26,7 @@
 
 #include <asm/vtm.h>
 #include <asm/vmx_platform.h>
-#include <public/arch-ia64.h>
+#include <public/xen.h>
 
 #define VPD_SHIFT      17      /* 128K requirement */
 #define VPD_SIZE       (1 << VPD_SHIFT)
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h        Mon Aug 
14 15:21:30 2006 -0400
@@ -0,0 +1,160 @@
+#ifndef _I386_MADDR_H
+#define _I386_MADDR_H
+
+#include <xen/features.h>
+#include <xen/interface/xen.h>
+
+/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
+#define INVALID_P2M_ENTRY      (~0UL)
+#define FOREIGN_FRAME_BIT      (1UL<<31)
+#define FOREIGN_FRAME(m)       ((m) | FOREIGN_FRAME_BIT)
+
+#ifdef CONFIG_XEN
+
+extern unsigned long *phys_to_machine_mapping;
+
+#undef machine_to_phys_mapping
+extern unsigned long *machine_to_phys_mapping;
+extern unsigned int   machine_to_phys_order;
+
+static inline unsigned long pfn_to_mfn(unsigned long pfn)
+{
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return pfn;
+       return phys_to_machine_mapping[(unsigned int)(pfn)] &
+               ~FOREIGN_FRAME_BIT;
+}
+
+static inline int phys_to_machine_mapping_valid(unsigned long pfn)
+{
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return 1;
+       return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
+}
+
+static inline unsigned long mfn_to_pfn(unsigned long mfn)
+{
+       extern unsigned long max_mapnr;
+       unsigned long pfn;
+
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return mfn;
+
+       if (unlikely((mfn >> machine_to_phys_order) != 0))
+               return max_mapnr;
+
+       /* The array access can fail (e.g., device space beyond end of RAM). */
+       asm (
+               "1:     movl %1,%0\n"
+               "2:\n"
+               ".section .fixup,\"ax\"\n"
+               "3:     movl %2,%0\n"
+               "       jmp  2b\n"
+               ".previous\n"
+               ".section __ex_table,\"a\"\n"
+               "       .align 4\n"
+               "       .long 1b,3b\n"
+               ".previous"
+               : "=r" (pfn)
+               : "m" (machine_to_phys_mapping[mfn]), "m" (max_mapnr) );
+
+       return pfn;
+}
+
+/*
+ * We detect special mappings in one of two ways:
+ *  1. If the MFN is an I/O page then Xen will set the m2p entry
+ *     to be outside our maximum possible pseudophys range.
+ *  2. If the MFN belongs to a different domain then we will certainly
+ *     not have MFN in our p2m table. Conversely, if the page is ours,
+ *     then we'll have p2m(m2p(MFN))==MFN.
+ * If we detect a special mapping then it doesn't have a 'struct page'.
+ * We force !pfn_valid() by returning an out-of-range pointer.
+ *
+ * NB. These checks require that, for any MFN that is not in our reservation,
+ * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
+ * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
+ * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
+ *
+ * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
+ *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
+ *      require. In all the cases we care about, the FOREIGN_FRAME bit is
+ *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
+ */
+static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
+{
+       extern unsigned long max_mapnr;
+       unsigned long pfn = mfn_to_pfn(mfn);
+       if ((pfn < max_mapnr)
+           && !xen_feature(XENFEAT_auto_translated_physmap)
+           && (phys_to_machine_mapping[pfn] != mfn))
+               return max_mapnr; /* force !pfn_valid() */
+       return pfn;
+}
+
+static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
+{
+       if (xen_feature(XENFEAT_auto_translated_physmap)) {
+               BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
+               return;
+       }
+       phys_to_machine_mapping[pfn] = mfn;
+}
+
+
+#else /* !CONFIG_XEN */
+
+#define pfn_to_mfn(pfn) (pfn)
+#define mfn_to_pfn(mfn) (mfn)
+#define mfn_to_local_pfn(mfn) (mfn)
+#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn))
+#define phys_to_machine_mapping_valid(pfn) (1)
+
+#endif /* !CONFIG_XEN */
+
+/* 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
+
+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;
+}
+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;
+}
+
+/* VIRT <-> MACHINE conversion */
+#define virt_to_machine(v)     (phys_to_machine(__pa(v)))
+#define virt_to_mfn(v)         (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
+#define mfn_to_virt(m)         (__va(mfn_to_pfn(m) << PAGE_SHIFT))
+
+#ifdef CONFIG_X86_PAE
+static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
+{
+       pte_t pte;
+
+       pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) | \
+                                       (pgprot_val(pgprot) >> 32);
+       pte.pte_high &= (__supported_pte_mask >> 32);
+       pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)) & \
+                                                       __supported_pte_mask;
+       return pte;
+}
+#else
+#define pfn_pte_ma(pfn, prot)  __pte_ma(((pfn) << PAGE_SHIFT) | 
pgprot_val(prot))
+#endif
+
+#define __pte_ma(x)    ((pte_t) { (x) } )
+
+#endif /* _I386_MADDR_H */
diff -r 39c113fb84ac -r 10f1113fd489 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h      Mon Aug 
14 15:21:30 2006 -0400
@@ -0,0 +1,139 @@
+#ifndef _X86_64_MADDR_H
+#define _X86_64_MADDR_H
+
+#include <xen/features.h>
+#include <xen/interface/xen.h>
+
+/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
+#define INVALID_P2M_ENTRY      (~0UL)
+#define FOREIGN_FRAME_BIT      (1UL<<63)
+#define FOREIGN_FRAME(m)       ((m) | FOREIGN_FRAME_BIT)
+
+#ifdef CONFIG_XEN
+
+extern unsigned long *phys_to_machine_mapping;
+
+#undef machine_to_phys_mapping
+extern unsigned long *machine_to_phys_mapping;
+extern unsigned int   machine_to_phys_order;
+
+static inline unsigned long pfn_to_mfn(unsigned long pfn)
+{
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return pfn;
+       return phys_to_machine_mapping[(unsigned int)(pfn)] &
+               ~FOREIGN_FRAME_BIT;
+}
+
+static inline int phys_to_machine_mapping_valid(unsigned long pfn)
+{
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return 1;
+       return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
+}
+
+static inline unsigned long mfn_to_pfn(unsigned long mfn)
+{
+       unsigned long pfn;
+
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return mfn;
+
+       if (unlikely((mfn >> machine_to_phys_order) != 0))
+               return end_pfn;
+
+       /* The array access can fail (e.g., device space beyond end of RAM). */
+       asm (
+               "1:     movq %1,%0\n"
+               "2:\n"
+               ".section .fixup,\"ax\"\n"
+               "3:     movq %2,%0\n"
+               "       jmp  2b\n"
+               ".previous\n"
+               ".section __ex_table,\"a\"\n"
+               "       .align 8\n"
+               "       .quad 1b,3b\n"
+               ".previous"
+               : "=r" (pfn)
+               : "m" (machine_to_phys_mapping[mfn]), "m" (end_pfn) );
+
+       return pfn;
+}
+
+/*
+ * We detect special mappings in one of two ways:
+ *  1. If the MFN is an I/O page then Xen will set the m2p entry
+ *     to be outside our maximum possible pseudophys range.
+ *  2. If the MFN belongs to a different domain then we will certainly
+ *     not have MFN in our p2m table. Conversely, if the page is ours,
+ *     then we'll have p2m(m2p(MFN))==MFN.
+ * If we detect a special mapping then it doesn't have a 'struct page'.
+ * We force !pfn_valid() by returning an out-of-range pointer.
+ *
+ * NB. These checks require that, for any MFN that is not in our reservation,
+ * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
+ * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
+ * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
+ *
+ * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
+ *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
+ *      require. In all the cases we care about, the FOREIGN_FRAME bit is
+ *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
+ */
+static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
+{
+       unsigned long pfn = mfn_to_pfn(mfn);
+       if ((pfn < end_pfn)
+           && !xen_feature(XENFEAT_auto_translated_physmap)
+           && (phys_to_machine_mapping[pfn] != mfn))
+               return end_pfn; /* force !pfn_valid() */
+       return pfn;
+}
+
+static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
+{
+       if (xen_feature(XENFEAT_auto_translated_physmap)) {
+               BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
+               return;
+       }
+       phys_to_machine_mapping[pfn] = mfn;
+}
+
+#else /* !CONFIG_XEN */
+
+#define pfn_to_mfn(pfn) (pfn)
+#define mfn_to_pfn(mfn) (mfn)
+#define mfn_to_local_pfn(mfn) (mfn)
+#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn))
+#define phys_to_machine_mapping_valid(pfn) (1)
+
+#endif /* !CONFIG_XEN */
+
+/* Definitions for machine and pseudophysical addresses. */
+typedef unsigned long paddr_t;
+typedef unsigned long maddr_t;
+
+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;
+}
+
+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;
+}
+
+/* VIRT <-> MACHINE conversion */
+#define virt_to_machine(v)     (phys_to_machine(__pa(v)))
+#define virt_to_mfn(v)         (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
+#define mfn_to_virt(m)         (__va(mfn_to_pfn(m) << PAGE_SHIFT))
+
+#define __pte_ma(x)     ((pte_t) { (x) } )
+#define pfn_pte_ma(pfn, prot)  __pte_ma((((pfn) << PAGE_SHIFT) | 
pgprot_val(prot)) & __supported_pte_mask)
+
+#endif /* _X86_64_MADDR_H */
+
diff -r 39c113fb84ac -r 10f1113fd489 linux-2.6-xen-sparse/include/xen/hvm.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/linux-2.6-xen-sparse/include/xen/hvm.h    Mon Aug 14 15:21:30 2006 -0400
@@ -0,0 +1,17 @@
+/* Simple wrappers around HVM functions */
+#ifndef XEN_HVM_H__
+#define XEN_HVM_H__
+
+#include <xen/interface/hvm/params.h>
+#include <asm/hypercall.h>
+
+static inline unsigned long hvm_get_parameter(int idx)
+{
+       struct xen_hvm_param xhv;
+
+       xhv.domid = DOMID_SELF;
+       xhv.index = idx;
+       return HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
+}
+
+#endif /* XEN_HVM_H__ */
diff -r 39c113fb84ac -r 10f1113fd489 
patches/linux-2.6.16.13/net-gso-4-kill-warnon.patch
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/linux-2.6.16.13/net-gso-4-kill-warnon.patch       Mon Aug 14 
15:21:30 2006 -0400
@@ -0,0 +1,29 @@
+508c578140642a641bb9b888369719c510ae2a00
+diff --git a/net/core/dev.c b/net/core/dev.c
+index e814a89..240773b 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -1087,11 +1087,6 @@ int skb_checksum_help(struct sk_buff *sk
+               goto out_set_summed;
+ 
+       if (unlikely(skb_shinfo(skb)->gso_size)) {
+-              static int warned;
+-
+-              WARN_ON(!warned);
+-              warned = 1;
+-
+               /* Let GSO fix up the checksum. */
+               goto out_set_summed;
+       }
+@@ -1141,11 +1136,6 @@ struct sk_buff *skb_gso_segment(struct s
+       __skb_pull(skb, skb->mac_len);
+ 
+       if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
+-              static int warned;
+-
+-              WARN_ON(!warned);
+-              warned = 1;
+-
+               if (skb_header_cloned(skb) &&
+                   (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
+                       return ERR_PTR(err);
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/smbios.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/smbios.c Mon Aug 14 15:21:30 2006 -0400
@@ -0,0 +1,606 @@
+/*
+ * smbios.c - Generate SMBIOS tables for Xen HVM domU's.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2006
+ *
+ * Authors: Andrew D. Ball <aball@xxxxxxxxxx>
+ */
+
+#include <stdint.h>
+#include <xen/version.h>
+#include <xen/hvm/e820.h>
+#include "smbios.h"
+#include "smbios_types.h"
+#include "util.h"
+#include "hypercall.h"
+
+/* write SMBIOS tables starting at 'start', without writing more
+   than 'max_size' bytes.
+
+   Return the number of bytes written
+*/
+static size_t
+write_smbios_tables(void *start, size_t max_size,
+                   uint32_t vcpus, uint64_t memsize,
+                   uint8_t uuid[16], char *xen_version,
+                   uint32_t xen_major_version, uint32_t xen_minor_version);
+
+static void
+get_cpu_manufacturer(char *buf, int len);
+static size_t
+smbios_table_size(uint32_t vcpus, const char *xen_version,
+                 const char *processor_manufacturer);
+static void *
+smbios_entry_point_init(void *start,
+                       uint16_t max_structure_size,
+                       uint16_t structure_table_length,
+                       uint32_t structure_table_address,
+                       uint16_t number_of_structures);
+static void *
+smbios_type_0_init(void *start, const char *xen_version,
+                  uint32_t xen_major_version, uint32_t xen_minor_version);
+static void *
+smbios_type_1_init(void *start, const char *xen_version, 
+                  uint8_t uuid[16]);
+static void *
+smbios_type_3_init(void *start);
+static void *
+smbios_type_4_init(void *start, unsigned int cpu_number,
+                  char *cpu_manufacturer);
+static void *
+smbios_type_16_init(void *start, uint32_t memory_size_mb);
+static void *
+smbios_type_17_init(void *start, uint32_t memory_size_mb);
+static void *
+smbios_type_19_init(void *start, uint32_t memory_size_mb);
+static void *
+smbios_type_20_init(void *start, uint32_t memory_size_mb);
+static void *
+smbios_type_32_init(void *start);
+void *
+smbios_type_127_init(void *start);
+
+static void
+get_cpu_manufacturer(char *buf, int len)
+{
+       char id[12];
+       uint32_t eax = 0;
+
+       cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8], (uint32_t 
*)&id[4]);
+
+       if (memcmp(id, "GenuineIntel", 12) == 0)
+               strncpy(buf, "Intel", len);
+       else if (memcmp(id, "AuthenticAMD", 12) == 0)
+               strncpy(buf, "AMD", len);
+       else
+               strncpy(buf, "unknown", len);
+}
+
+
+/* Calculate the size of the SMBIOS structure table.
+*/
+static size_t
+smbios_table_size(uint32_t vcpus, const char *xen_version,
+                 const char *processor_manufacturer)
+{
+       size_t size;
+
+       /* first compute size without strings or terminating 0 bytes */
+       size =  sizeof(struct smbios_type_0) + sizeof(struct smbios_type_1) +
+               sizeof(struct smbios_type_3) + sizeof(struct 
smbios_type_4)*vcpus +
+               sizeof(struct smbios_type_16) + sizeof(struct smbios_type_17) +
+               sizeof(struct smbios_type_19) + sizeof(struct smbios_type_20) +
+               sizeof(struct smbios_type_32) + sizeof(struct smbios_type_127);
+
+       /* 5 structures with no strings, 2 null bytes each */
+       size += 10;
+
+       /* Need to include 1 null byte per structure with strings (first
+          terminating null byte comes from the string terminator of the
+          last string). */
+       size += 4 + vcpus;
+
+       /* type 0: "Xen", xen_version, and release_date */
+       size += strlen("Xen") + strlen(xen_version) + 2;
+       /* type 1: "Xen", xen_version, "HVM domU" */
+       size += strlen("Xen") + strlen("HVM domU") + strlen(xen_version) + 3;
+       /* type 3: "Xen" */
+       size += strlen("Xen") + 1;
+       /* type 4: socket designation ("CPU n"), processor_manufacturer */
+       size += vcpus * (strlen("CPU n") + strlen(processor_manufacturer) + 2);
+       /* Make room for two-digit CPU numbers if necessary -- doesn't handle
+          vcpus > 99 */
+       if (vcpus > 9)
+               size += vcpus - 9;
+       /* type 17: device locator string ("DIMM 1") */
+       size += strlen("DIMM 1") + 1;
+
+       return size;
+}
+
+static size_t
+write_smbios_tables(void *start, size_t max_size,
+                   uint32_t vcpus, uint64_t memsize,
+                   uint8_t uuid[16], char *xen_version,
+                   uint32_t xen_major_version, uint32_t xen_minor_version)
+{
+       unsigned cpu_num;
+       void *p = start;
+       char cpu_manufacturer[15];
+       size_t structure_table_length;
+
+       get_cpu_manufacturer(cpu_manufacturer, 15);
+
+
+       structure_table_length = smbios_table_size(vcpus, xen_version,
+                                                  cpu_manufacturer);
+
+       if (structure_table_length + sizeof(struct smbios_entry_point) > 
max_size)
+               return 0;
+
+       p = smbios_entry_point_init(p, sizeof(struct smbios_type_4), 
+                                   structure_table_length,
+                                   (uint32_t)start + 
+                                   sizeof(struct smbios_entry_point),
+                                   9 + vcpus);
+
+       p = smbios_type_0_init(p, xen_version, xen_major_version,
+                              xen_minor_version);
+       p = smbios_type_1_init(p, xen_version, uuid);
+       p = smbios_type_3_init(p);
+       for (cpu_num = 1; cpu_num <= vcpus; ++cpu_num)
+               p = smbios_type_4_init(p, cpu_num, cpu_manufacturer);
+       p = smbios_type_16_init(p, memsize);
+       p = smbios_type_17_init(p, memsize);
+       p = smbios_type_19_init(p, memsize);
+       p = smbios_type_20_init(p, memsize);
+       p = smbios_type_32_init(p);
+       p = smbios_type_127_init(p);
+
+       return (size_t)((char*)p - (char*)start);
+}
+
+/* This tries to figure out how much pseudo-physical memory (in MB)
+   is allocated to the current domU.
+
+   It iterates through the e820 table, adding up the 'usable' and
+   'reserved' entries and rounding up to the nearest MB.
+
+   The e820map is not at e820 in hvmloader, so this uses the
+   E820_MAP_* constants from e820.h to pick it up where libxenguest
+   left it.
+ */
+static uint64_t
+get_memsize(void)
+{
+       struct e820entry *map = NULL;
+       uint8_t num_entries = 0;
+       uint64_t memsize = 0;
+       uint8_t i;
+
+       map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
+       num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
+
+       /* walk through e820map, ignoring any entries that aren't marked
+          as usable or reserved. */
+
+       for (i = 0; i < num_entries; i++) {
+               if (map->type == E820_RAM || map->type == E820_RESERVED)
+                       memsize += map->size;
+               map++;
+       }
+
+       /* Round up to the nearest MB.  The user specifies domU
+          pseudo-physical memory in megabytes, so not doing this
+          could easily lead to reporting one less MB than the user
+          specified. */
+       if (memsize & ((1<<20)-1))
+               memsize = (memsize >> 20) + 1;
+       else
+               memsize = (memsize >> 20);
+
+       return memsize;
+}
+
+void
+hvm_write_smbios_tables(void)
+{
+       uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
+                            not uint8_t[16]. ** */
+       uint16_t xen_major_version, xen_minor_version;
+       uint32_t xen_version;
+       char xen_extra_version[XEN_EXTRAVERSION_LEN];
+       /* guess conservatively on buffer length for Xen version string */
+       char xen_version_str[80];
+       /* temporary variables used to build up Xen version string */
+       char *p = NULL; /* points to next point of insertion */
+       unsigned len = 0; /* length of string already composed */
+       char *tmp = NULL; /* holds result of itoa() */
+       unsigned tmp_len; /* length of next string to add */
+
+       hypercall_xen_version(XENVER_guest_handle, uuid);
+
+       /* xen_version major and minor */
+       xen_version = hypercall_xen_version(XENVER_version, NULL);
+       xen_major_version = (uint16_t) (xen_version >> 16);
+       xen_minor_version = (uint16_t) xen_version;
+
+       hypercall_xen_version(XENVER_extraversion, xen_extra_version);
+
+       /* build up human-readable Xen version string */
+       p = xen_version_str;
+       len = 0;
+
+       itoa(tmp, xen_major_version);
+       tmp_len = strlen(tmp);
+       len += tmp_len;
+       if (len >= sizeof(xen_version_str))
+               goto error_out;
+       strcpy(p, tmp);
+       p += tmp_len;
+
+       len++;
+       if (len >= sizeof(xen_version_str))
+               goto error_out;
+       *p = '.';
+       p++;
+
+       itoa(tmp, xen_minor_version);
+       tmp_len = strlen(tmp);
+       len += tmp_len;
+       if (len >= sizeof(xen_version_str))
+               goto error_out;
+       strcpy(p, tmp);
+       p += tmp_len;
+
+       tmp_len = strlen(xen_extra_version);
+       len += tmp_len;
+       if (len >= sizeof(xen_version_str))
+               goto error_out;
+       strcpy(p, xen_extra_version);
+       p += tmp_len;
+
+       xen_version_str[sizeof(xen_version_str)-1] = '\0';
+
+       write_smbios_tables((void *) SMBIOS_PHYSICAL_ADDRESS,
+                           SMBIOS_SIZE_LIMIT, get_vcpu_nr(), get_memsize(),
+                           uuid, xen_version_str,
+                           xen_major_version, xen_minor_version);
+       return;
+
+ error_out:
+       puts("Could not write SMBIOS tables, error in hvmloader.c:"
+            "hvm_write_smbios_tables()\n");
+}
+
+
+static void *
+smbios_entry_point_init(void *start,
+                       uint16_t max_structure_size,
+                       uint16_t structure_table_length,
+                       uint32_t structure_table_address,
+                       uint16_t number_of_structures)
+{
+       uint8_t sum;
+       int i;
+       struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
+
+       strncpy(ep->anchor_string, "_SM_", 4);
+       ep->length = 0x1f;
+       ep->smbios_major_version = 2;
+       ep->smbios_minor_version = 4;
+       ep->max_structure_size = max_structure_size;
+       ep->entry_point_revision = 0;
+       memset(ep->formatted_area, 0, 5);
+       strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
+    
+       ep->structure_table_length = structure_table_length;
+       ep->structure_table_address = structure_table_address;
+       ep->number_of_structures = number_of_structures;
+       ep->smbios_bcd_revision = 0x24;
+
+       ep->checksum = 0;
+       ep->intermediate_checksum = 0;
+    
+       sum = 0;
+       for (i = 0; i < 0x10; ++i)
+               sum += ((int8_t *)start)[i];
+       ep->checksum = -sum;
+
+       sum = 0;
+       for (i = 0x10; i < ep->length; ++i)
+               sum += ((int8_t *)start)[i];
+       ep->intermediate_checksum = -sum;
+
+       return (char *)start + sizeof(struct smbios_entry_point);
+}
+
+/* Type 0 -- BIOS Information */
+static void *
+smbios_type_0_init(void *start, const char *xen_version,
+                  uint32_t xen_major_version, uint32_t xen_minor_version)
+{
+       struct smbios_type_0 *p = (struct smbios_type_0 *)start;
+    
+       p->header.type = 0;
+       p->header.length = sizeof(struct smbios_type_0);
+       p->header.handle = 0;
+    
+       p->vendor_str = 1;
+       p->version_str = 2;
+       p->starting_address_segment = 0xe800;
+       p->release_date_str = 0;
+       p->rom_size = 0;
+    
+       memset(p->characteristics, 0, 8);
+       p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
+       p->characteristics_extension_bytes[0] = 0;
+       p->characteristics_extension_bytes[1] = 0;
+    
+       p->major_release = (uint8_t) xen_major_version;
+       p->minor_release = (uint8_t) xen_minor_version;
+       p->embedded_controller_major = 0xff;
+       p->embedded_controller_minor = 0xff;
+
+       start += sizeof(struct smbios_type_0);
+       strcpy((char *)start, "Xen");
+       start += strlen("Xen") + 1;
+       strcpy((char *)start, xen_version);
+       start += strlen(xen_version) + 1;
+
+       *((uint8_t *)start) = 0;
+       return start + 1;
+}
+
+/* Type 1 -- System Information */
+static void *
+smbios_type_1_init(void *start, const char *xen_version, 
+                  uint8_t uuid[16])
+{
+       struct smbios_type_1 *p = (struct smbios_type_1 *)start;
+       p->header.type = 1;
+       p->header.length = sizeof(struct smbios_type_1);
+       p->header.handle = 0x100;
+
+       p->manufacturer_str = 1;
+       p->product_name_str = 2;
+       p->version_str = 3;
+       p->serial_number_str = 0;
+    
+       memcpy(p->uuid, uuid, 16);
+
+       p->wake_up_type = 0x06; /* power switch */
+       p->sku_str = 0;
+       p->family_str = 0;
+
+       start += sizeof(struct smbios_type_1);
+    
+       strcpy((char *)start, "Xen");
+       start += strlen("Xen") + 1;
+       strcpy((char *)start, "HVM domU");
+       start += strlen("HVM domU") + 1;
+       strcpy((char *)start, xen_version);
+       start += strlen(xen_version) + 1;
+       *((uint8_t *)start) = 0;
+    
+       return start+1; 
+}
+
+/* Type 3 -- System Enclosure */
+static void *
+smbios_type_3_init(void *start)
+{
+       struct smbios_type_3 *p = (struct smbios_type_3 *)start;
+    
+       p->header.type = 3;
+       p->header.length = sizeof(struct smbios_type_3);
+       p->header.handle = 0x300;
+
+       p->manufacturer_str = 1;
+       p->type = 0x01; /* other */
+       p->version_str = 0;
+       p->serial_number_str = 0;
+       p->asset_tag_str = 0;
+       p->boot_up_state = 0x03; /* safe */
+       p->power_supply_state = 0x03; /* safe */
+       p->thermal_state = 0x03; /* safe */
+       p->security_status = 0x02; /* unknown */
+
+       start += sizeof(struct smbios_type_3);
+    
+       strcpy((char *)start, "Xen");
+       start += strlen("Xen") + 1;
+       *((uint8_t *)start) = 0;
+       return start+1;
+}
+
+/* Type 4 -- Processor Information */
+static void *
+smbios_type_4_init(void *start, unsigned int cpu_number, char 
*cpu_manufacturer)
+{
+       char buf[80]; 
+       struct smbios_type_4 *p = (struct smbios_type_4 *)start;
+       uint32_t eax, ebx, ecx, edx;
+
+       p->header.type = 4;
+       p->header.length = sizeof(struct smbios_type_4);
+       p->header.handle = 0x400 + cpu_number;
+
+       p->socket_designation_str = 1;
+       p->processor_type = 0x03; /* CPU */
+       p->processor_family = 0x01; /* other */
+       p->manufacturer_str = 2;
+
+       cpuid(1, &eax, &ebx, &ecx, &edx);
+
+       p->cpuid[0] = eax;
+       p->cpuid[1] = edx;
+
+       p->version_str = 0;
+       p->voltage = 0;
+       p->external_clock = 0;
+
+       p->max_speed = 0; /* unknown */
+       p->current_speed = 0; /* unknown */
+
+       p->status = 0x41; /* socket populated, CPU enabled */
+       p->upgrade = 0x01; /* other */
+
+       start += sizeof(struct smbios_type_4);
+
+       strncpy(buf, "CPU ", sizeof(buf));
+       if ((sizeof(buf) - strlen("CPU ")) >= 3)
+               itoa(buf + strlen("CPU "), cpu_number);
+
+       strcpy((char *)start, buf);
+       start += strlen(buf) + 1;
+
+       strcpy((char *)start, cpu_manufacturer);
+       start += strlen(buf) + 1;
+
+       *((uint8_t *)start) = 0;
+       return start+1;
+}
+
+/* Type 16 -- Physical Memory Array */
+static void *
+smbios_type_16_init(void *start, uint32_t memsize)
+{
+       struct smbios_type_16 *p = (struct smbios_type_16*)start;
+
+       p->header.type = 16;
+       p->header.handle = 0x1000;
+       p->header.length = sizeof(struct smbios_type_16);
+    
+       p->location = 0x01; /* other */
+       p->use = 0x03; /* system memory */
+       p->error_correction = 0x01; /* other */
+       p->maximum_capacity = memsize * 1024;
+       p->memory_error_information_handle = 0xfffe; /* none provided */
+       p->number_of_memory_devices = 1;
+
+       start += sizeof(struct smbios_type_16);
+       *((uint16_t *)start) = 0;
+       return start + 2;
+}
+
+/* Type 17 -- Memory Device */
+static void *
+smbios_type_17_init(void *start, uint32_t memory_size_mb)
+{
+       struct smbios_type_17 *p = (struct smbios_type_17 *)start;
+    
+       p->header.type = 17;
+       p->header.length = sizeof(struct smbios_type_17);
+       p->header.handle = 0x1100;
+
+       p->physical_memory_array_handle = 0x1000;
+       p->total_width = 64;
+       p->data_width = 64;
+       /* truncate memory_size_mb to 16 bits and clear most significant
+          bit [indicates size in MB] */
+       p->size = (uint16_t) memory_size_mb & 0x7fff;
+       p->form_factor = 0x09; /* DIMM */
+       p->device_set = 0;
+       p->device_locator_str = 1;
+       p->bank_locator_str = 0;
+       p->memory_type = 0x07; /* RAM */
+       p->type_detail = 0;
+
+       start += sizeof(struct smbios_type_17);
+       strcpy((char *)start, "DIMM 1");
+       start += strlen("DIMM 1") + 1;
+       *((uint8_t *)start) = 0;
+
+       return start+1;
+}
+
+/* Type 19 -- Memory Array Mapped Address */
+static void *
+smbios_type_19_init(void *start, uint32_t memory_size_mb)
+{
+       struct smbios_type_19 *p = (struct smbios_type_19 *)start;
+    
+       p->header.type = 19;
+       p->header.length = sizeof(struct smbios_type_19);
+       p->header.handle = 0x1300;
+
+       p->starting_address = 0;
+       p->ending_address = (memory_size_mb-1) * 1024;
+       p->memory_array_handle = 0x1000;
+       p->partition_width = 1;
+
+       start += sizeof(struct smbios_type_19);
+       *((uint16_t *)start) = 0;
+       return start + 2;
+}
+
+/* Type 20 -- Memory Device Mapped Address */
+static void *
+smbios_type_20_init(void *start, uint32_t memory_size_mb)
+{
+       struct smbios_type_20 *p = (struct smbios_type_20 *)start;
+
+       p->header.type = 20;
+       p->header.length = sizeof(struct smbios_type_20);
+       p->header.handle = 0x1400;
+
+       p->starting_address = 0;
+       p->ending_address = (memory_size_mb-1)*1024;
+       p->memory_device_handle = 0x1100;
+       p->memory_array_mapped_address_handle = 0x1300;
+       p->partition_row_position = 1;
+       p->interleave_position = 0;
+       p->interleaved_data_depth = 0;
+
+       start += sizeof(struct smbios_type_20);
+
+       *((uint16_t *)start) = 0;
+       return start+2;
+}
+
+/* Type 32 -- System Boot Information */
+static void *
+smbios_type_32_init(void *start)
+{
+       struct smbios_type_32 *p = (struct smbios_type_32 *)start;
+
+       p->header.type = 32;
+       p->header.length = sizeof(struct smbios_type_32);
+       p->header.handle = 0x2000;
+       memset(p->reserved, 0, 6);
+       p->boot_status = 0; /* no errors detected */
+    
+       start += sizeof(struct smbios_type_32);
+       *((uint16_t *)start) = 0;
+       return start+2;
+}
+
+/* Type 127 -- End of Table */
+void *
+smbios_type_127_init(void *start)
+{
+       struct smbios_type_127 *p = (struct smbios_type_127 *)start;
+
+       p->header.type = 127;
+       p->header.length = sizeof(struct smbios_type_127);
+       p->header.handle = 0x7f00;
+
+       start += sizeof(struct smbios_type_127);
+       *((uint16_t *)start) = 0;
+       return start + 2;
+}
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/smbios.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/smbios.h Mon Aug 14 15:21:30 2006 -0400
@@ -0,0 +1,38 @@
+/*
+ * smbios.h - interface for Xen HVM SMBIOS generation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2006
+ *
+ * Authors: Andrew D. Ball <aball@xxxxxxxxxx>
+ */
+
+#ifndef SMBIOS_H
+#define SMBIOS_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+/* These constants must agree with the ACPI e820 memory map as defined
+   in tools/libxc/xc_hvm_build.c and the address the ROMBIOS pulls the
+   SMBIOS entry point from in the smbios_init subroutine.
+ */
+#define SMBIOS_PHYSICAL_ADDRESS 0x9f000
+#define SMBIOS_SIZE_LIMIT 0x800
+
+void hvm_write_smbios_tables(void);
+
+#endif /* SMBIOS_H */
diff -r 39c113fb84ac -r 10f1113fd489 tools/firmware/hvmloader/smbios_types.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/smbios_types.h   Mon Aug 14 15:21:30 2006 -0400
@@ -0,0 +1,182 @@
+/*
+ * smbios_types.h - data structure definitions for Xen HVM SMBIOS support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2006
+ *
+ * Authors: Andrew D. Ball <aball@xxxxxxxxxx>
+ *
+ * See the SMBIOS 2.4 spec for more detail:
+ *   http://www.dmtf.org/standards/smbios/
+ */
+
+#ifndef SMBIOS_TYPES_H
+#define SMBIOS_TYPES_H
+
+#include <stdint.h>
+
+/* SMBIOS entry point -- must be written to a 16-bit aligned address
+   between 0xf0000 and 0xfffff. 
+ */
+struct smbios_entry_point {
+       char anchor_string[4];
+       uint8_t checksum;
+       uint8_t length;
+       uint8_t smbios_major_version;
+       uint8_t smbios_minor_version;
+       uint16_t max_structure_size;
+       uint8_t entry_point_revision;
+       uint8_t formatted_area[5];
+       char intermediate_anchor_string[5];
+       uint8_t intermediate_checksum;
+       uint16_t structure_table_length;
+       uint32_t structure_table_address;
+       uint16_t number_of_structures;
+       uint8_t smbios_bcd_revision;
+} __attribute__ ((packed));
+
+/* This goes at the beginning of every SMBIOS structure. */
+struct smbios_structure_header {
+       uint8_t type;
+       uint8_t length;
+       uint16_t handle;
+} __attribute__ ((packed));
+
+/* SMBIOS type 0 - BIOS Information */
+struct smbios_type_0 {
+       struct smbios_structure_header header;
+       uint8_t vendor_str;
+       uint8_t version_str;
+       uint16_t starting_address_segment;
+       uint8_t release_date_str;
+       uint8_t rom_size; 
+       uint8_t characteristics[8];
+       uint8_t characteristics_extension_bytes[2];
+       uint8_t major_release;
+       uint8_t minor_release;
+       uint8_t embedded_controller_major;
+       uint8_t embedded_controller_minor;
+} __attribute__ ((packed));
+
+/* SMBIOS type 1 - System Information */
+struct smbios_type_1 {
+       struct smbios_structure_header header;
+       uint8_t manufacturer_str;
+       uint8_t product_name_str;
+       uint8_t version_str;
+       uint8_t serial_number_str;
+       uint8_t uuid[16];
+       uint8_t wake_up_type;
+       uint8_t sku_str;
+       uint8_t family_str;
+} __attribute__ ((packed));
+
+/* SMBIOS type 3 - System Enclosure */
+struct smbios_type_3 {
+       struct smbios_structure_header header;
+       uint8_t manufacturer_str;
+       uint8_t type;
+       uint8_t version_str;
+       uint8_t serial_number_str;
+       uint8_t asset_tag_str;
+       uint8_t boot_up_state;
+       uint8_t power_supply_state;
+       uint8_t thermal_state;
+       uint8_t security_status;
+} __attribute__ ((packed));
+
+/* SMBIOS type 4 - Processor Information */
+struct smbios_type_4 {
+       struct smbios_structure_header header;
+       uint8_t socket_designation_str;
+       uint8_t processor_type;
+       uint8_t processor_family;
+       uint8_t manufacturer_str;
+       uint32_t cpuid[2];
+       uint8_t version_str;
+       uint8_t voltage;
+       uint16_t external_clock;
+       uint16_t max_speed;
+       uint16_t current_speed;
+       uint8_t status;
+       uint8_t upgrade;
+} __attribute__ ((packed));
+
+/* SMBIOS type 16 - Physical Memory Array
+ *   Associated with one type 17 (Memory Device).
+ */
+struct smbios_type_16 {
+       struct smbios_structure_header header;
+       uint8_t location;
+       uint8_t use;
+       uint8_t error_correction;
+       uint32_t maximum_capacity;
+       uint16_t memory_error_information_handle;
+       uint16_t number_of_memory_devices;
+} __attribute__ ((packed));
+
+/* SMBIOS type 17 - Memory Device 
+ *   Associated with one type 19
+ */
+struct smbios_type_17 {
+       struct smbios_structure_header header;
+       uint16_t physical_memory_array_handle;
+       uint16_t memory_error_information_handle;
+       uint16_t total_width;
+       uint16_t data_width;
+       uint16_t size;
+       uint8_t form_factor;
+       uint8_t device_set;
+       uint8_t device_locator_str;
+       uint8_t bank_locator_str;
+       uint8_t memory_type;
+       uint16_t type_detail;
+} __attribute__ ((packed));
+
+/* SMBIOS type 19 - Memory Array Mapped Address */
+struct smbios_type_19 {
+       struct smbios_structure_header header;
+       uint32_t starting_address;
+       uint32_t ending_address;
+       uint16_t memory_array_handle;
+       uint8_t partition_width;
+} __attribute__ ((packed));
+
+/* SMBIOS type 20 - Memory Device Mapped Address */
+struct smbios_type_20 {
+       struct smbios_structure_header header;
+       uint32_t starting_address;
+       uint32_t ending_address;
+       uint16_t memory_device_handle;
+       uint16_t memory_array_mapped_address_handle;
+       uint8_t partition_row_position;
+       uint8_t interleave_position;
+       uint8_t interleaved_data_depth;
+} __attribute__ ((packed));
+
+/* SMBIOS type 32 - System Boot Information */
+struct smbios_type_32 {
+       struct smbios_structure_header header;
+       uint8_t reserved[6];
+       uint8_t boot_status;
+} __attribute__ ((packed));
+
+/* SMBIOS type 127 -- End-of-table */
+struct smbios_type_127 {
+       struct smbios_structure_header header;
+} __attribute__ ((packed));
+
+#endif /* SMBIOS_TYPES_H */

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>