ia64/xen-unstable

changeset 8212:4146dbea47e1

Merged.
author emellor@leeni.uk.xensource.com
date Sat Dec 03 12:21:52 2005 +0000 (2005-12-03)
parents b20641d24272 8754277cec01
children 1c515c707296
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre	Sat Dec 03 12:21:27 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre	Sat Dec 03 12:21:52 2005 +0000
     1.3 @@ -40,13 +40,6 @@ cp arch/ia64/xen/drivers/coreMakefile dr
     1.4  cp arch/ia64/xen/drivers/xenia64_init.c drivers/xen/core
     1.5  cp arch/ia64/xen/drivers/evtchn_ia64.c drivers/xen/core
     1.6  
     1.7 -#this is a one-line change to avoid a nasty kernel crash resulting
     1.8 -#from a use of the FADT entry in the ACPI tree.  The fake ACPI
     1.9 -#tree that Xen sets up for guests has a NULL FADT.  This is a bug
    1.10 -#that needs to be fixed, at which point this can go away.  In the
    1.11 -#meantime, this file needs to be updated if the real motherboard.c is
    1.12 -cp arch/ia64/xen/drivers/motherboard.c drivers/acpi/motherboard.c
    1.13 -
    1.14  #still a few x86-ism's in various drivers/xen files, patch them
    1.15  #cd drivers/xen
    1.16  #if [ ! -e ia64.patch.semaphore ]
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/coreMakefile	Sat Dec 03 12:21:27 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/coreMakefile	Sat Dec 03 12:21:52 2005 +0000
     2.3 @@ -10,7 +10,7 @@ CPPFLAGS_vmlinux.lds += -U$(XENARCH)
     2.4  	@ln -fsn $(srctree)/arch/$(XENARCH)/kernel/vmlinux.lds.S $@
     2.5  
     2.6  
     2.7 -obj-y   := gnttab.o devmem.o
     2.8 +obj-y   := gnttab.o
     2.9  obj-$(CONFIG_PROC_FS) += xen_proc.o
    2.10  
    2.11  ifeq ($(ARCH),ia64)
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/motherboard.c	Sat Dec 03 12:21:27 2005 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,178 +0,0 @@
     3.4 -/* 
     3.5 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3.6 - *  This program is free software; you can redistribute it and/or modify
     3.7 - *  it under the terms of the GNU General Public License as published by
     3.8 - *  the Free Software Foundation; either version 2 of the License, or (at
     3.9 - *  your option) any later version.
    3.10 - *
    3.11 - *  This program is distributed in the hope that it will be useful, but
    3.12 - *  WITHOUT ANY WARRANTY; without even the implied warranty of
    3.13 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.14 - *  General Public License for more details.
    3.15 - *
    3.16 - *  You should have received a copy of the GNU General Public License along
    3.17 - *  with this program; if not, write to the Free Software Foundation, Inc.,
    3.18 - *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
    3.19 - *
    3.20 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3.21 - */
    3.22 -
    3.23 -/* Purpose: Prevent PCMCIA cards from using motherboard resources. */
    3.24 -
    3.25 -#include <linux/kernel.h>
    3.26 -#include <linux/init.h>
    3.27 -#include <linux/types.h>
    3.28 -#include <linux/pci.h>
    3.29 -#include <linux/ioport.h>
    3.30 -#include <asm/io.h>
    3.31 -
    3.32 -#include <acpi/acpi_bus.h>
    3.33 -#include <acpi/acpi_drivers.h>
    3.34 -
    3.35 -#define _COMPONENT		ACPI_SYSTEM_COMPONENT
    3.36 -ACPI_MODULE_NAME		("acpi_motherboard")
    3.37 -
    3.38 -/* Dell use PNP0C01 instead of PNP0C02 */
    3.39 -#define ACPI_MB_HID1			"PNP0C01"
    3.40 -#define ACPI_MB_HID2			"PNP0C02"
    3.41 -
    3.42 -/**
    3.43 - * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
    3.44 - * Doesn't care about the failure of 'request_region', since other may reserve 
    3.45 - * the io ports as well
    3.46 - */
    3.47 -#define IS_RESERVED_ADDR(base, len) \
    3.48 -	(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
    3.49 -	&& ((base) + (len) > PCIBIOS_MIN_IO))
    3.50 -
    3.51 -/*
    3.52 - * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
    3.53 - * the io ports if they really know they can use it, while
    3.54 - * still preventing hotplug PCI devices from using it. 
    3.55 - */
    3.56 -
    3.57 -static acpi_status
    3.58 -acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
    3.59 -{
    3.60 -	struct resource *requested_res = NULL;
    3.61 -
    3.62 -	ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
    3.63 -
    3.64 -	if (res->id == ACPI_RSTYPE_IO) {
    3.65 -		struct acpi_resource_io *io_res = &res->data.io;
    3.66 -
    3.67 -		if (io_res->min_base_address != io_res->max_base_address)
    3.68 -			return_VALUE(AE_OK);
    3.69 -		if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
    3.70 -			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
    3.71 -				io_res->min_base_address, 
    3.72 -				io_res->min_base_address + io_res->range_length));
    3.73 -			requested_res = request_region(io_res->min_base_address, 
    3.74 -				io_res->range_length, "motherboard");
    3.75 -		}
    3.76 -	} else if (res->id == ACPI_RSTYPE_FIXED_IO) {
    3.77 -		struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io;
    3.78 -
    3.79 -		if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) {
    3.80 -			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
    3.81 -				fixed_io_res->base_address, 
    3.82 -				fixed_io_res->base_address + fixed_io_res->range_length));
    3.83 -			requested_res = request_region(fixed_io_res->base_address, 
    3.84 -				fixed_io_res->range_length, "motherboard");
    3.85 -		}
    3.86 -	} else {
    3.87 -		/* Memory mapped IO? */
    3.88 -	}
    3.89 -
    3.90 -	if (requested_res)
    3.91 -		requested_res->flags &= ~IORESOURCE_BUSY;
    3.92 -	return_VALUE(AE_OK);
    3.93 -}
    3.94 -
    3.95 -static int acpi_motherboard_add (struct acpi_device *device)
    3.96 -{
    3.97 -	if (!device)
    3.98 -		return -EINVAL;
    3.99 -	acpi_walk_resources(device->handle, METHOD_NAME__CRS, 
   3.100 -		acpi_reserve_io_ranges, NULL);
   3.101 -
   3.102 -	return 0;
   3.103 -}
   3.104 -
   3.105 -static struct acpi_driver acpi_motherboard_driver1 = {
   3.106 -	.name =		"motherboard",
   3.107 -	.class =	"",
   3.108 -	.ids =		ACPI_MB_HID1,
   3.109 -	.ops =	{
   3.110 -		.add =		acpi_motherboard_add,
   3.111 -	},
   3.112 -};
   3.113 -
   3.114 -static struct acpi_driver acpi_motherboard_driver2 = {
   3.115 -	.name =		"motherboard",
   3.116 -	.class =	"",
   3.117 -	.ids =		ACPI_MB_HID2,
   3.118 -	.ops =	{
   3.119 -		.add =		acpi_motherboard_add,
   3.120 -	},
   3.121 -};
   3.122 -
   3.123 -static void __init
   3.124 -acpi_reserve_resources (void)
   3.125 -{
   3.126 -	if (!acpi_gbl_FADT) return;
   3.127 -	if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
   3.128 -		request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, 
   3.129 -			acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
   3.130 -
   3.131 -	if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
   3.132 -		request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
   3.133 -			acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
   3.134 -
   3.135 -	if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
   3.136 -		request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, 
   3.137 -			acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
   3.138 -
   3.139 -	if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
   3.140 -		request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, 
   3.141 -			acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
   3.142 -
   3.143 -	if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
   3.144 -		request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
   3.145 -			4, "PM_TMR");
   3.146 -
   3.147 -	if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
   3.148 -		request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
   3.149 -			acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
   3.150 -
   3.151 -	/* Length of GPE blocks must be a non-negative multiple of 2 */
   3.152 -
   3.153 -	if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
   3.154 -			!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
   3.155 -		request_region(acpi_gbl_FADT->xgpe0_blk.address,
   3.156 -			acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
   3.157 -
   3.158 -	if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
   3.159 -			!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
   3.160 -		request_region(acpi_gbl_FADT->xgpe1_blk.address,
   3.161 -			acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
   3.162 -}
   3.163 -
   3.164 -static int __init acpi_motherboard_init(void)
   3.165 -{
   3.166 -	acpi_bus_register_driver(&acpi_motherboard_driver1);
   3.167 -	acpi_bus_register_driver(&acpi_motherboard_driver2);
   3.168 -	/* 
   3.169 -	 * Guarantee motherboard IO reservation first
   3.170 -	 * This module must run after scan.c
   3.171 -	 */
   3.172 -	if (!acpi_disabled)
   3.173 -		acpi_reserve_resources ();
   3.174 -	return 0;
   3.175 -}
   3.176 -
   3.177 -/**
   3.178 - * Reserve motherboard resources after PCI claim BARs,
   3.179 - * but before PCI assign resources for uninitialized PCI devices
   3.180 - */
   3.181 -fs_initcall(acpi_motherboard_init);
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Sat Dec 03 12:21:27 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Sat Dec 03 12:21:52 2005 +0000
     4.3 @@ -560,7 +560,8 @@ irqreturn_t timer_interrupt(int irq, voi
     4.4  	}
     4.5  	while (!time_values_up_to_date(cpu));
     4.6  
     4.7 -	if (unlikely(delta < -1000000LL) || unlikely(delta_cpu < 0)) {
     4.8 +	if ((unlikely(delta < -1000000LL) || unlikely(delta_cpu < 0))
     4.9 +	    && printk_ratelimit()) {
    4.10  		printk("Timer ISR/%d: Time went backwards: "
    4.11  		       "delta=%lld cpu_delta=%lld shadow=%lld "
    4.12  		       "off=%lld processed=%lld cpu_processed=%lld\n",
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 03 12:21:27 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 03 12:21:52 2005 +0000
     5.3 @@ -296,22 +296,23 @@ static int do_block_io_op(blkif_t *blkif
     5.4  {
     5.5  	blkif_back_ring_t *blk_ring = &blkif->blk_ring;
     5.6  	blkif_request_t *req;
     5.7 -	RING_IDX i, rp;
     5.8 +	RING_IDX rc, rp;
     5.9  	int more_to_do = 0;
    5.10  
    5.11 +	rc = blk_ring->req_cons;
    5.12  	rp = blk_ring->sring->req_prod;
    5.13  	rmb(); /* Ensure we see queued requests up to 'rp'. */
    5.14  
    5.15 -	for (i = blk_ring->req_cons; 
    5.16 -	     (i != rp) && !RING_REQUEST_CONS_OVERFLOW(blk_ring, i);
    5.17 -	     i++) {
    5.18 +	while ((rc != rp) && !RING_REQUEST_CONS_OVERFLOW(blk_ring, rc)) {
    5.19  		if ((max_to_do-- == 0) ||
    5.20  		    (NR_PENDING_REQS == MAX_PENDING_REQS)) {
    5.21  			more_to_do = 1;
    5.22  			break;
    5.23  		}
    5.24 -        
    5.25 -		req = RING_GET_REQUEST(blk_ring, i);
    5.26 +
    5.27 +		req = RING_GET_REQUEST(blk_ring, rc);
    5.28 +		blk_ring->req_cons = ++rc; /* before make_response() */
    5.29 +
    5.30  		switch (req->operation) {
    5.31  		case BLKIF_OP_READ:
    5.32  		case BLKIF_OP_WRITE:
    5.33 @@ -327,7 +328,6 @@ static int do_block_io_op(blkif_t *blkif
    5.34  		}
    5.35  	}
    5.36  
    5.37 -	blk_ring->req_cons = i;
    5.38  	return more_to_do;
    5.39  }
    5.40  
     6.1 --- a/xen/arch/ia64/Makefile	Sat Dec 03 12:21:27 2005 +0000
     6.2 +++ b/xen/arch/ia64/Makefile	Sat Dec 03 12:21:52 2005 +0000
     6.3 @@ -69,6 +69,8 @@ asm-xsi-offsets.s: asm-xsi-offsets.c
     6.4  	[ -e $(BASEDIR)/include/asm-ia64/xen ] \
     6.5  	 || ln -s $(BASEDIR)/include/asm-ia64/linux $(BASEDIR)/include/asm-ia64/xen
     6.6  # Link to DM file in Xen for ia64/vti
     6.7 +	[ -e $(BASEDIR)/include/asm-ia64/vmx_vpic.h ] \
     6.8 +	 || ln -s ../../include/asm-x86/vmx_vpic.h $(BASEDIR)/include/asm-ia64/vmx_vpic.h
     6.9  	[ -e $(BASEDIR)/include/asm-ia64/vmx_vioapic.h ] \
    6.10  	 || ln -s ../../include/asm-x86/vmx_vioapic.h $(BASEDIR)/include/asm-ia64/vmx_vioapic.h
    6.11  	[ -e $(BASEDIR)/arch/ia64/vmx/vmx_vioapic.c ] \
     7.1 --- a/xen/arch/ia64/linux-xen/smp.c	Sat Dec 03 12:21:27 2005 +0000
     7.2 +++ b/xen/arch/ia64/linux-xen/smp.c	Sat Dec 03 12:21:52 2005 +0000
     7.3 @@ -56,7 +56,10 @@
     7.4  //Huh? This seems to be used on ia64 even if !CONFIG_SMP
     7.5  void flush_tlb_mask(cpumask_t mask)
     7.6  {
     7.7 +#ifdef CONFIG_SMP
     7.8 +    printf("flush_tlb_mask called, not implemented for SMP\n");
     7.9  	dummy();
    7.10 +#endif
    7.11  }
    7.12  //#if CONFIG_SMP || IA64
    7.13  #if CONFIG_SMP
     8.1 --- a/xen/arch/ia64/linux-xen/unaligned.c	Sat Dec 03 12:21:27 2005 +0000
     8.2 +++ b/xen/arch/ia64/linux-xen/unaligned.c	Sat Dec 03 12:21:52 2005 +0000
     8.3 @@ -378,7 +378,7 @@ get_rse_reg (struct pt_regs *regs, unsig
     8.4      if (ridx >= sof) {
     8.5          /* read of out-of-frame register returns an undefined value; 0 in our case.  */
     8.6          DPRINT("ignoring read from r%lu; only %lu registers are allocated!\n", r1, sof);
     8.7 -        panic("wrong stack register number");
     8.8 +        panic("wrong stack register number (iip=%p)\n", regs->cr_iip);
     8.9      }
    8.10  
    8.11      if (ridx < sor)
     9.1 --- a/xen/arch/ia64/tools/xelilo/elilo-3.4.11.xen.patch	Sat Dec 03 12:21:27 2005 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,402 +0,0 @@
     9.4 -<Sign-off: fred.yang@intel.com>
     9.5 -diff -Naur base/bootparams.c elilo/bootparams.c
     9.6 ---- base/bootparams.c	2005-09-20 19:51:07.000000000 -0700
     9.7 -+++ elilo/bootparams.c	2005-09-20 19:33:00.000000000 -0700
     9.8 -@@ -38,7 +38,7 @@
     9.9 -  * 	bp  : the address of the bootparams otherwise (opaque type)
    9.10 -  */
    9.11 - VOID *
    9.12 --create_boot_params(CHAR16 *args, memdesc_t *initrd, UINTN *cookie)
    9.13 -+create_boot_params(CHAR16 *args, memdesc_t *initrd, memdesc_t *vmcode, UINTN *cookie)
    9.14 - {
    9.15 - /* 
    9.16 -  * XXX: need cleanup
    9.17 -@@ -95,7 +95,7 @@
    9.18 - 	 */
    9.19 - 	Memset(bp, 0, BOOT_PARAM_MEMSIZE);
    9.20 - 
    9.21 --	if (sysdeps_create_boot_params(bp, cp, initrd, cookie) == -1) return 0;
    9.22 -+	if (sysdeps_create_boot_params(bp, cp, initrd, vmcode, cookie) == -1) return 0;
    9.23 - 
    9.24 - 	/*
    9.25 - 	 * Convert kernel command line args from UNICODE to ASCII and put them where
    9.26 -diff -Naur base/choosers/simple.c elilo/choosers/simple.c
    9.27 ---- base/choosers/simple.c	2005-09-20 19:51:07.000000000 -0700
    9.28 -+++ elilo/choosers/simple.c	2005-09-20 19:28:15.000000000 -0700
    9.29 -@@ -37,6 +37,7 @@
    9.30 - {
    9.31 - 	CHAR16 *desc;
    9.32 - 	CHAR16 initrd_name[CMDLINE_MAXLEN];
    9.33 -+	CHAR16 vmcode_name[CMDLINE_MAXLEN];
    9.34 - 	CHAR16 options_tmp[CMDLINE_MAXLEN];
    9.35 - 	CHAR16 options[CMDLINE_MAXLEN];
    9.36 - 	CHAR16 kname[FILENAME_MAXLEN];
    9.37 -@@ -46,9 +47,9 @@
    9.38 - 		Print(L"desc   : %s\n", desc);
    9.39 - 	}
    9.40 - 
    9.41 --	initrd_name[0] = options_tmp[0] = kname[0] = CHAR_NULL;
    9.42 -+	initrd_name[0] = vmcode_name[0] = options_tmp[0] = kname[0] = CHAR_NULL;
    9.43 - 
    9.44 --	if (find_label(name, kname, options_tmp, initrd_name) == -1) {
    9.45 -+	if (find_label(name, kname, options_tmp, initrd_name, vmcode_name) == -1) {
    9.46 - 		StrCpy(kname, name);
    9.47 - 		Print(L"\n");
    9.48 - 	}
    9.49 -@@ -56,6 +57,7 @@
    9.50 - 
    9.51 - 	Print(L"cmdline: %s %s\n", kname, options);
    9.52 - 	if (initrd_name[0]) Print(L"initrd : %s\n", initrd_name);
    9.53 -+	if (vmcode_name[0]) Print(L"vmcode : %s\n", vmcode_name);
    9.54 - }
    9.55 - 
    9.56 - static VOID
    9.57 -@@ -247,6 +249,7 @@
    9.58 - 	CHAR16 buffer[CMDLINE_MAXLEN];
    9.59 - 	CHAR16 alt_buffer[CMDLINE_MAXLEN];
    9.60 - 	CHAR16 initrd_name[CMDLINE_MAXLEN];
    9.61 -+	CHAR16 vmcode_name[CMDLINE_MAXLEN];
    9.62 - 	CHAR16 args[CMDLINE_MAXLEN];
    9.63 - 	CHAR16 devname[CMDLINE_MAXLEN];
    9.64 - 	CHAR16 dpath[FILENAME_MAXLEN];
    9.65 -@@ -259,7 +262,7 @@
    9.66 - 	display_message();
    9.67 - 
    9.68 - restart:
    9.69 --	initrd_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL;
    9.70 -+	initrd_name[0] = vmcode_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL;
    9.71 - 
    9.72 - 	/* reset per image loader options */
    9.73 - 	Memset(&elilo_opt.img_opt, 0, sizeof(elilo_opt.img_opt));
    9.74 -@@ -303,7 +306,7 @@
    9.75 - 	 * if no match is found, the args and initrd arguments may
    9.76 - 	 * still be modified by global options in the config file.
    9.77 - 	 */
    9.78 --	ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name);
    9.79 -+	ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name, vmcode_name);
    9.80 - 
    9.81 - 	/*
    9.82 - 	 * not found, so assume first argument is kernel name and
    9.83 -@@ -335,6 +338,10 @@
    9.84 - 		StrCpy(elilo_opt.initrd, initrd_name);
    9.85 - 	}
    9.86 - 
    9.87 -+	if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) {
    9.88 -+		StrCpy(elilo_opt.vmcode, vmcode_name);
    9.89 -+	}
    9.90 -+
    9.91 - 	VERB_PRT(1,  { Print(L"kernel     is  '%s'\n", kname);
    9.92 - 		       Print(L"arguments  are '%s'\n", args);
    9.93 - 			if (elilo_opt.initrd[0]) Print(L"initrd      is '%s'\n", elilo_opt.initrd);
    9.94 -diff -Naur base/choosers/textmenu.c elilo/choosers/textmenu.c
    9.95 ---- base/choosers/textmenu.c	2005-09-20 19:51:07.000000000 -0700
    9.96 -+++ elilo/choosers/textmenu.c	2005-09-20 19:28:29.000000000 -0700
    9.97 -@@ -358,6 +358,7 @@
    9.98 - #	define BOOT_IMG_STR	L"BOOT_IMAGE="
    9.99 - 	CHAR16 label[CMDLINE_MAXLEN];
   9.100 - 	CHAR16 initrd_name[CMDLINE_MAXLEN];
   9.101 -+	CHAR16 vmcode_name[CMDLINE_MAXLEN];
   9.102 - 	CHAR16 args[CMDLINE_MAXLEN];
   9.103 - 	CHAR16 devname[CMDLINE_MAXLEN];
   9.104 - 	CHAR16 dpath[FILENAME_MAXLEN];
   9.105 -@@ -412,9 +413,9 @@
   9.106 - 	 * still be modified by global options in the config file.
   9.107 - 	 */
   9.108 - 	if (label[0])
   9.109 --		ret = find_label(label, kname, args, initrd_name);
   9.110 -+		ret = find_label(label, kname, args, initrd_name, vmcode_name);
   9.111 - 	else
   9.112 --		ret = find_label(argv[index], kname, args, initrd_name);
   9.113 -+		ret = find_label(argv[index], kname, args, initrd_name, vmcode_name);
   9.114 - 
   9.115 - 	/*
   9.116 - 	 * not found, so assume first argument is kernel name and
   9.117 -@@ -448,6 +449,10 @@
   9.118 - 		StrCpy(elilo_opt.initrd, initrd_name);
   9.119 - 	}
   9.120 - 
   9.121 -+	if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) {
   9.122 -+		StrCpy(elilo_opt.vmcode, vmcode_name);
   9.123 -+	}
   9.124 -+
   9.125 - 	VERB_PRT(1,  { Print(L"kernel     is  '%s'\n", kname);
   9.126 - 		       Print(L"arguments  are '%s'\n", args);
   9.127 - 			if (elilo_opt.initrd[0]) Print(L"initrd      is '%s'\n", elilo_opt.initrd);
   9.128 -diff -Naur base/config.c elilo/config.c
   9.129 ---- base/config.c	2005-09-20 19:51:07.000000000 -0700
   9.130 -+++ elilo/config.c	2005-09-20 19:33:26.000000000 -0700
   9.131 -@@ -68,6 +68,7 @@
   9.132 - 	CHAR16	kname[FILENAME_MAXLEN];
   9.133 - 	CHAR16  options[MAX_STRING];
   9.134 - 	CHAR16	initrd[FILENAME_MAXLEN];
   9.135 -+	CHAR16	vmcode[FILENAME_MAXLEN];
   9.136 - 	CHAR16	root[FILENAME_MAXLEN];
   9.137 - 	CHAR16	fallback[MAX_STRING];
   9.138 - 	CHAR16	description[MAX_STRING];
   9.139 -@@ -93,6 +94,7 @@
   9.140 - typedef struct {
   9.141 - 	CHAR16		root[FILENAME_MAXLEN];	/* globally defined root fs */
   9.142 - 	CHAR16		initrd[FILENAME_MAXLEN];/* globally defined initrd  */
   9.143 -+	CHAR16		vmcode[FILENAME_MAXLEN];/* globally defined boot-time module  */
   9.144 - 	CHAR16		options[MAX_STRING];
   9.145 - 	CHAR16		default_image_name[MAX_STRING];
   9.146 - 	CHAR16		message_file[MAX_MESSAGES][FILENAME_MAXLEN]; 
   9.147 -@@ -144,6 +146,7 @@
   9.148 - {OPT_BOOL,	OPT_GLOBAL,	L"noedd30",	NULL,		NULL,			&global_config.edd30_no_force},
   9.149 - {OPT_CMD,	OPT_GLOBAL,	L"append",	NULL,		NULL,			global_config.options},
   9.150 - {OPT_FILE,	OPT_GLOBAL,	L"initrd",	NULL,		NULL,			global_config.initrd},
   9.151 -+{OPT_FILE,	OPT_GLOBAL,	L"vmm",		NULL,		NULL,			global_config.vmcode},
   9.152 - {OPT_FILE,	OPT_GLOBAL,	L"image",	do_image,	NULL,			opt_offsetof(kname)},
   9.153 - {OPT_BOOL,	OPT_GLOBAL,	L"checkalt",	NULL,		NULL,			&global_config.alt_check},
   9.154 - {OPT_STR,	OPT_GLOBAL,	L"chooser",	NULL,		check_chooser,		global_config.chooser},
   9.155 -@@ -168,6 +171,7 @@
   9.156 -     {OPT_CMD,	OPT_IMAGE,	L"append",	do_options,	NULL,	opt_offsetof(options)},
   9.157 -     {OPT_CMD,	OPT_IMAGE,	L"literal",	do_literal,	NULL,	NULL},
   9.158 -     {OPT_FILE,	OPT_IMAGE,	L"initrd",	NULL,		NULL,	opt_offsetof(initrd)},
   9.159 -+    {OPT_FILE,	OPT_IMAGE,	L"vmm",		NULL,		NULL,	opt_offsetof(vmcode)},
   9.160 -     {OPT_STR,	OPT_IMAGE,	L"label",	NULL,		NULL,	opt_offsetof(label)},
   9.161 -     {OPT_FILE,	OPT_IMAGE,	L"image",	do_image,	NULL,	opt_offsetof(kname)},
   9.162 -     {OPT_STR,	OPT_IMAGE,	L"description",	NULL,		NULL,	opt_offsetof(description)},
   9.163 -@@ -974,7 +978,7 @@
   9.164 - }
   9.165 - 
   9.166 - INTN
   9.167 --find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd)
   9.168 -+find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd, CHAR16 *vmcode)
   9.169 - {
   9.170 - 	boot_image_t *img;
   9.171 - 
   9.172 -@@ -1007,6 +1011,7 @@
   9.173 - 	if (global_config.readonly) StrCat(options, L" ro");
   9.174 - 
   9.175 - 	if (global_config.initrd[0]) StrCpy(initrd, global_config.initrd);
   9.176 -+	if (global_config.vmcode[0]) StrCpy(vmcode, global_config.vmcode);
   9.177 - 
   9.178 - 	/* make sure we don't get garbage here */
   9.179 - 	elilo_opt.sys_img_opts = NULL;
   9.180 -@@ -1044,12 +1049,17 @@
   9.181 - 	else if (global_config.initrd[0])
   9.182 - 		StrCpy(initrd, global_config.initrd);
   9.183 - 
   9.184 -+	if (img->vmcode[0]) 
   9.185 -+		StrCpy(vmcode, img->vmcode);
   9.186 -+	else if (global_config.vmcode[0])
   9.187 -+		StrCpy(vmcode, global_config.vmcode);
   9.188 -+
   9.189 - 	/*
   9.190 - 	 * point to architecture dependent options for this image
   9.191 - 	 */
   9.192 - 	elilo_opt.sys_img_opts = &img->sys_img_opts;
   9.193 - 
   9.194 --	DBG_PRT((L"label %s: kname=%s options=%s initrd=%s", img->label, kname, options, initrd));
   9.195 -+	DBG_PRT((L"label %s: kname=%s options=%s initrd=%s vmcode=%s", img->label, kname, options, initrd, vmcode));
   9.196 - 
   9.197 - 	return 0;
   9.198 - }
   9.199 -diff -Naur base/elilo.c elilo/elilo.c
   9.200 ---- base/elilo.c	2005-09-20 19:51:07.000000000 -0700
   9.201 -+++ elilo/elilo.c	2005-09-20 19:33:41.000000000 -0700
   9.202 -@@ -84,10 +84,23 @@
   9.203 - }
   9.204 - 
   9.205 - INTN
   9.206 --kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem)
   9.207 -+kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem, memdesc_t *mmem)
   9.208 - {
   9.209 - 
   9.210 - 	/*
   9.211 -+	 * Do the vm image switch here
   9.212 -+	 * if there is "vmm=" then elilo should load image specified
   9.213 -+	 *    in "vmm=" and then give the "image" to vmm as target kernel image
   9.214 -+	 */
   9.215 -+	if (elilo_opt.vmcode[0]) {
   9.216 -+		CHAR16 buffer[CMDLINE_MAXLEN];
   9.217 -+	VERB_PRT(1,Print(L"swapping vmm=%s with image=%s\n", elilo_opt.vmcode,
   9.218 -+			kname));
   9.219 -+		StrCpy(buffer, kname);
   9.220 -+		StrCpy(kname, elilo_opt.vmcode);
   9.221 -+		StrCpy(elilo_opt.vmcode, buffer);
   9.222 -+	}
   9.223 -+	/*
   9.224 - 	 * Now let's try to load the kernel !
   9.225 - 	 */
   9.226 - 	switch(do_kernel_load(kname, kd)) {
   9.227 -@@ -134,10 +147,32 @@
   9.228 - 				return ELILO_LOAD_RETRY;
   9.229 - 		}
   9.230 - 	}
   9.231 -+
   9.232 -+	if (elilo_opt.vmcode[0]) {
   9.233 -+
   9.234 -+		mmem->start_addr = 0; /* let the allocator decide */
   9.235 -+
   9.236 -+		switch(load_initrd(elilo_opt.vmcode, mmem)) {
   9.237 -+			case ELILO_LOAD_SUCCESS:
   9.238 -+				break;
   9.239 -+			case ELILO_LOAD_ERROR:
   9.240 -+				goto exit_error;
   9.241 -+			case ELILO_LOAD_ABORTED:
   9.242 -+				free_kmem();
   9.243 -+				/* we drop initrd in case we aborted the load */
   9.244 -+				elilo_opt.vmcode[0] = CHAR_NULL;
   9.245 -+				elilo_opt.prompt    = 1; 
   9.246 -+				elilo_opt.timeout   = ELILO_DEFAULT_TIMEOUT;
   9.247 -+				elilo_opt.delay     = 0;
   9.248 -+
   9.249 -+				return ELILO_LOAD_RETRY;
   9.250 -+		}
   9.251 -+	}
   9.252 - 	return ELILO_LOAD_SUCCESS;
   9.253 - exit_error:
   9.254 - 	free_kmem();
   9.255 - 	if (imem->start_addr) free(imem->start_addr);
   9.256 -+	if (mmem->start_addr) free(mmem->start_addr);
   9.257 - 
   9.258 - 	return ELILO_LOAD_ERROR;
   9.259 - }
   9.260 -@@ -152,7 +187,7 @@
   9.261 - 	UINTN cookie;
   9.262 - 	EFI_STATUS status = EFI_SUCCESS;
   9.263 - 	kdesc_t kd;
   9.264 --	memdesc_t imem;
   9.265 -+	memdesc_t imem, mmem;
   9.266 - 	INTN r;
   9.267 - 
   9.268 - 	/*
   9.269 -@@ -169,7 +204,7 @@
   9.270 - 
   9.271 - 		if (kernel_chooser(argv, argc, index, kname, cmdline_tmp) == -1) goto exit_error;
   9.272 - 
   9.273 --		switch (kernel_load(image, kname, &kd, &imem)) {
   9.274 -+		switch (kernel_load(image, kname, &kd, &imem, &mmem)) {
   9.275 - 			case ELILO_LOAD_SUCCESS: 
   9.276 - 				goto do_launch;
   9.277 - 			case ELILO_LOAD_ERROR:
   9.278 -@@ -187,7 +222,7 @@
   9.279 - 	close_devices();
   9.280 - 
   9.281 - 	/* No console output permitted after create_boot_params()! */
   9.282 --	if ((bp=create_boot_params(cmdline, &imem, &cookie)) == 0) goto error;
   9.283 -+	if ((bp=create_boot_params(cmdline, &imem, &mmem, &cookie)) == 0) goto error;
   9.284 - 
   9.285 - 	/* terminate bootservices */
   9.286 - 	status = BS->ExitBootServices(image, cookie);
   9.287 -@@ -221,6 +256,7 @@
   9.288 - 	Print(L"-v        verbose level(can appear multiple times)\n");
   9.289 - 	Print(L"-a        always check for alternate kernel image\n");
   9.290 - 	Print(L"-i file   load file as the initial ramdisk\n");
   9.291 -+	Print(L"-m file   load file as additional boot time vmm module\n");
   9.292 - 	Print(L"-C file   indicate the config file to use\n");
   9.293 - 	Print(L"-P        parse config file only (verify syntax)\n");
   9.294 - 	Print(L"-D        enable debug prints\n");
   9.295 -@@ -491,6 +527,13 @@
   9.296 - 				}
   9.297 - 				StrCpy(elilo_opt.initrd, Optarg);
   9.298 - 				break;
   9.299 -+			case 'm':
   9.300 -+				if (StrLen(Optarg) >= FILENAME_MAXLEN-1) {
   9.301 -+					Print(L"vmm module filename is limited to %d characters\n", FILENAME_MAXLEN);
   9.302 -+					goto do_exit;
   9.303 -+				}
   9.304 -+				StrCpy(elilo_opt.vmcode, Optarg);
   9.305 -+				break;
   9.306 - 			case 'C':
   9.307 - 				if (StrLen(Optarg) >= FILENAME_MAXLEN-1) {
   9.308 - 					Print(L"config filename is limited to %d characters\n", FILENAME_MAXLEN);
   9.309 -diff -Naur base/elilo.h elilo/elilo.h
   9.310 ---- base/elilo.h	2005-09-20 19:51:07.000000000 -0700
   9.311 -+++ elilo/elilo.h	2005-09-20 19:32:19.000000000 -0700
   9.312 -@@ -75,6 +75,7 @@
   9.313 - 	UINTN delay;		/* delay before booting the image */
   9.314 - 	UINTN verbose;		/* verbosity level [1-5] */
   9.315 - 	CHAR16 initrd[FILENAME_MAXLEN];		/* name of file for initial ramdisk */
   9.316 -+	CHAR16 vmcode[FILENAME_MAXLEN];	/* name of file for boot time module*/
   9.317 - 	UINT8 delay_set;	/* mark whether or not delay was specified on cmdline */
   9.318 - 	UINT8 edd30_on;		/* true is EDD30 variable is TRUE */
   9.319 - 	UINT8 edd30_no_force;	/* don't force EDD30 variable to true */
   9.320 -@@ -131,7 +132,7 @@
   9.321 - #endif
   9.322 - 
   9.323 - #define VERB_PRT(n,cmd) \
   9.324 --	{ if (elilo_opt.verbose >= (n)) { cmd; } }
   9.325 -+  { if (elilo_opt.verbose >= (n)) { cmd; } }
   9.326 - 
   9.327 - 
   9.328 - /* from alloc.c */
   9.329 -@@ -163,7 +164,7 @@
   9.330 - /* from config.c (more in config.h) */
   9.331 - extern EFI_STATUS read_config(CHAR16 *, INTN retry);
   9.332 - extern VOID print_config_options(VOID);
   9.333 --extern INTN find_label(CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *);
   9.334 -+extern INTN find_label(CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *);
   9.335 - extern VOID print_label_list(VOID);
   9.336 - extern INTN config_init(VOID);
   9.337 - extern CHAR16 *get_message_filename(INTN which);
   9.338 -@@ -178,7 +179,7 @@
   9.339 - extern INTN alternate_kernel(CHAR16 *, INTN);
   9.340 - 
   9.341 - /* from bootparams.c */
   9.342 --extern VOID *create_boot_params (CHAR16 *, memdesc_t *, UINTN *);
   9.343 -+extern VOID *create_boot_params (CHAR16 *, memdesc_t *, memdesc_t *, UINTN *);
   9.344 - extern VOID free_boot_params(VOID *bp);
   9.345 - 
   9.346 - /*
   9.347 -@@ -186,7 +187,7 @@
   9.348 -  */
   9.349 - 
   9.350 - 
   9.351 --extern INTN sysdeps_create_boot_params(boot_params_t *, CHAR8 *, memdesc_t *, UINTN *);
   9.352 -+extern INTN sysdeps_create_boot_params(boot_params_t *, CHAR8 *, memdesc_t *, memdesc_t *, UINTN *);
   9.353 - extern VOID sysdeps_free_boot_params(boot_params_t *);
   9.354 - extern INTN sysdeps_init(EFI_HANDLE dev);
   9.355 - extern INTN sysdeps_initrd_get_addr(kdesc_t *, memdesc_t *);
   9.356 -diff -Naur base/ia32/system.c elilo/ia32/system.c
   9.357 ---- base/ia32/system.c	2005-09-20 19:51:07.000000000 -0700
   9.358 -+++ elilo/ia32/system.c	2005-09-20 19:30:10.000000000 -0700
   9.359 -@@ -408,6 +408,7 @@
   9.360 - 	boot_params_t *bp,
   9.361 - 	CHAR8 *cmdline,
   9.362 - 	memdesc_t *initrd,
   9.363 -+	memdesc_t *vmcode, /* no use for ia32 now*/
   9.364 - 	UINTN *cookie)
   9.365 - {
   9.366 - 	mmap_desc_t mdesc;
   9.367 -diff -Naur base/ia64/sysdeps.h elilo/ia64/sysdeps.h
   9.368 ---- base/ia64/sysdeps.h	2005-09-20 19:51:07.000000000 -0700
   9.369 -+++ elilo/ia64/sysdeps.h	2005-09-20 19:29:07.000000000 -0700
   9.370 -@@ -65,8 +65,11 @@
   9.371 - 	UINTN initrd_start;		/* virtual address where the initial ramdisk begins */
   9.372 - 	UINTN initrd_size;		/* how big is the initial ramdisk */
   9.373 - 
   9.374 -+	UINTN vmcode_start;		/* virtual address where the boot time vmcode begins */
   9.375 -+	UINTN vmcode_size;		/* how big is the boot module */
   9.376 - 	UINTN loader_addr;		/* start address of boot loader */
   9.377 - 	UINTN loader_size;		/* size of loader code & data */
   9.378 -+
   9.379 - } boot_params_t;
   9.380 - 
   9.381 - typedef struct sys_img_options {
   9.382 -diff -Naur base/ia64/system.c elilo/ia64/system.c
   9.383 ---- base/ia64/system.c	2005-09-20 19:51:07.000000000 -0700
   9.384 -+++ elilo/ia64/system.c	2005-09-20 19:29:28.000000000 -0700
   9.385 -@@ -39,7 +39,7 @@
   9.386 -  * IA-64 specific boot paramters initialization routine
   9.387 -  */
   9.388 - INTN
   9.389 --sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd, UINTN *cookie)
   9.390 -+sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd, memdesc_t *vmcode, UINTN *cookie)
   9.391 - {
   9.392 - 	UINTN cols, rows;
   9.393 - 	SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
   9.394 -@@ -65,6 +65,11 @@
   9.395 - 	bp->command_line	= (UINTN)cmdline;
   9.396 - 	bp->initrd_start	= (UINTN) initrd->start_addr;
   9.397 - 	bp->initrd_size		= initrd->size;
   9.398 -+	DBG_PRT((L"Got initrd @ 0x%lx (%d bytes)", initrd->start_addr, initrd->size));
   9.399 -+
   9.400 -+	bp->vmcode_start	= (UINTN) vmcode->start_addr;
   9.401 -+	bp->vmcode_size		= vmcode->size;
   9.402 -+	DBG_PRT((L"Got vmcode @ 0x%lx (%d bytes)", vmcode->start_addr, vmcode->size));
   9.403 - 
   9.404 - 	/* fetch console parameters: */
   9.405 - 	conout = systab->ConOut;
    10.1 --- a/xen/arch/ia64/tools/xelilo/elilo.README	Sat Dec 03 12:21:27 2005 +0000
    10.2 +++ b/xen/arch/ia64/tools/xelilo/elilo.README	Sat Dec 03 12:21:52 2005 +0000
    10.3 @@ -1,35 +1,20 @@
    10.4 -Elilo update for Xen/ia64 HowTo   9/20/2005
    10.5 +Elilo update for Xen/ia64 HowTo   2005/12/01
    10.6 +
    10.7 +   Xen support is committed to ELILO CVS as of Dec 1, 2005.  This support
    10.8 +   should be in version 3.5pre2 when it is made available.  To build from
    10.9 +   source:
   10.10  
   10.11  1. Build the new elilo
   10.12 -	a. Get the elilo RPM
   10.13 -	http://fedora.mirrors.pair.com/linux/core/development/SRPMS/elilo-3.4-11.src.rpm
   10.14 -
   10.15 -	b. Get the elilo-3.4.11.xen.patch
   10.16 -
   10.17 -	c. Create elilo development tree
   10.18 -		> mkdir elilo
   10.19 -		> cd elilo
   10.20 -		> rpm2cpio ../elilo-3.4-11.src.rpm | cpio -div
   10.21 -		> tar xvfz elilo-3.4.tar.gz
   10.22 -		> cd elilo-3.4
   10.23 -		> // read elilo.spc for deatiled patch steps
   10.24 -		> patch -p1 < ../elilo-3.3a-makefile.patch
   10.25 -		> patch -p1 < ../elilo-3.4-debug.patch
   10.26 -		> patch -p2 < ../elilo-initrd-size-fix.patch
   10.27 -		> patch -p1 < ../elilo-argv-fix.patch
   10.28 -		> patch -p1 < ../elilo-kill-warnings.patch
   10.29 -		> patch -p1 < ../../elilo-3.4.11.xen.patch
   10.30 -		> make		<=== get the elilo.efi
   10.31 +	a. Get current elilo CVS from http://sourceforge.net/projects/elilo
   10.32 +	b. make (Note that gnu-efi is a build dependency)
   10.33  
   10.34  2. How to run with the new elilo.efi?
   10.35  	a. Example to run
   10.36  		modify elilo.conf with following entry
   10.37  
   10.38 -		image=XenoLinux.uncompressed
   10.39 +		image=XenoLinux.gz
   10.40          		label=xen
   10.41          		vmm=xen.gz
   10.42          		initrd=initrd-2.6.9-5.7.EL.img
   10.43          		read-only
   10.44 -        		append="com2=57600,8n1 console=com2 sched=bvt -- nomca console=ttyS1,576 00 console=tty0 root=/dev/sda3"
   10.45 -
   10.46 -
   10.47 +        		append="com2=57600,8n1 console=com2 sched=bvt -- nomca console=ttyS1,57600 console=tty0 root=/dev/sda3"
    11.1 Binary file xen/arch/ia64/tools/xelilo/xlilo.efi has changed
    12.1 --- a/xen/arch/ia64/vmx/vlsapic.c	Sat Dec 03 12:21:27 2005 +0000
    12.2 +++ b/xen/arch/ia64/vmx/vlsapic.c	Sat Dec 03 12:21:52 2005 +0000
    12.3 @@ -529,7 +529,7 @@ int vmx_check_pending_irq(VCPU *vcpu)
    12.4      int injected=0;
    12.5      uint64_t    isr;
    12.6      IA64_PSR    vpsr;
    12.7 -
    12.8 +    REGS *regs=vcpu_regs(vcpu);
    12.9      local_irq_save(spsr);
   12.10      h_pending = highest_pending_irq(vcpu);
   12.11      if ( h_pending == NULL_VECTOR ) goto chk_irq_exit;
   12.12 @@ -541,7 +541,7 @@ int vmx_check_pending_irq(VCPU *vcpu)
   12.13          isr = vpsr.val & IA64_PSR_RI;
   12.14          if ( !vpsr.ic )
   12.15              panic("Interrupt when IC=0\n");
   12.16 -        vmx_reflect_interruption(0,isr,0, 12 ); // EXT IRQ
   12.17 +        vmx_reflect_interruption(0,isr,0, 12, regs ); // EXT IRQ
   12.18          injected = 1;
   12.19      }
   12.20      else if ( mask == IRQ_MASKED_BY_INSVC ) {
   12.21 @@ -601,13 +601,13 @@ static void generate_exirq(VCPU *vcpu)
   12.22  {
   12.23      IA64_PSR    vpsr;
   12.24      uint64_t    isr;
   12.25 -    
   12.26 +    REGS *regs=vcpu_regs(vcpu);
   12.27      vpsr.val = vmx_vcpu_get_psr(vcpu);
   12.28      update_vhpi(vcpu, NULL_VECTOR);
   12.29      isr = vpsr.val & IA64_PSR_RI;
   12.30      if ( !vpsr.ic )
   12.31          panic("Interrupt when IC=0\n");
   12.32 -    vmx_reflect_interruption(0,isr,0, 12 ); // EXT IRQ
   12.33 +    vmx_reflect_interruption(0,isr,0, 12, regs); // EXT IRQ
   12.34  }
   12.35  
   12.36  vhpi_detection(VCPU *vcpu)
    13.1 --- a/xen/arch/ia64/vmx/vmmu.c	Sat Dec 03 12:21:27 2005 +0000
    13.2 +++ b/xen/arch/ia64/vmx/vmmu.c	Sat Dec 03 12:21:52 2005 +0000
    13.3 @@ -162,7 +162,7 @@ static thash_cb_t *init_domain_vhpt(stru
    13.4      vhpt->ht = THASH_VHPT;
    13.5      vhpt->vcpu = d;
    13.6      vhpt->hash_func = machine_thash;
    13.7 -    vs -= sizeof (vhpt_special);
    13.8 +    vcur -= sizeof (vhpt_special);
    13.9      vs = vcur;
   13.10  
   13.11      /* Setup guest pta */
   13.12 @@ -438,20 +438,23 @@ fetch_code(VCPU *vcpu, u64 gip, u64 *cod
   13.13      thash_data_t    *tlb;
   13.14      ia64_rr vrr;
   13.15      u64     mfn;
   13.16 -    
   13.17 +
   13.18      if ( !(VCPU(vcpu, vpsr) & IA64_PSR_IT) ) {   // I-side physical mode
   13.19          gpip = gip;
   13.20      }
   13.21      else {
   13.22          vmx_vcpu_get_rr(vcpu, gip, &vrr.rrval);
   13.23 -        tlb = vtlb_lookup_ex (vmx_vcpu_get_vtlb(vcpu), 
   13.24 +        tlb = vtlb_lookup_ex (vmx_vcpu_get_vtlb(vcpu),
   13.25                  vrr.rid, gip, ISIDE_TLB );
   13.26 -        if ( tlb == NULL ) panic("No entry found in ITLB\n");
   13.27 +        if( tlb == NULL )
   13.28 +             tlb = vtlb_lookup_ex (vmx_vcpu_get_vtlb(vcpu),
   13.29 +                vrr.rid, gip, DSIDE_TLB );
   13.30 +        if ( tlb == NULL ) panic("No entry found in ITLB and DTLB\n");
   13.31          gpip = (tlb->ppn << 12) | ( gip & (PSIZE(tlb->ps)-1) );
   13.32      }
   13.33      mfn = __gpfn_to_mfn(vcpu->domain, gpip >>PAGE_SHIFT);
   13.34      if ( mfn == INVALID_MFN ) return 0;
   13.35 -    
   13.36 + 
   13.37      mpa = (gpip & (PAGE_SIZE-1)) | (mfn<<PAGE_SHIFT);
   13.38      *code = *(u64*)__va(mpa);
   13.39      return 1;
    14.1 --- a/xen/arch/ia64/vmx/vmx_process.c	Sat Dec 03 12:21:27 2005 +0000
    14.2 +++ b/xen/arch/ia64/vmx/vmx_process.c	Sat Dec 03 12:21:52 2005 +0000
    14.3 @@ -47,13 +47,12 @@
    14.4  #include <asm/kregs.h>
    14.5  #include <asm/vmx.h>
    14.6  #include <asm/vmx_mm_def.h>
    14.7 +#include <asm/vmx_phy_mode.h>
    14.8  #include <xen/mm.h>
    14.9  /* reset all PSR field to 0, except up,mfl,mfh,pk,dt,rt,mc,it */
   14.10  #define INITIAL_PSR_VALUE_AT_INTERRUPTION 0x0000001808028034
   14.11  
   14.12  
   14.13 -extern struct ia64_sal_retval pal_emulator_static(UINT64);
   14.14 -extern struct ia64_sal_retval sal_emulator(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
   14.15  extern void rnat_consumption (VCPU *vcpu);
   14.16  #define DOMN_PAL_REQUEST    0x110000
   14.17  
   14.18 @@ -109,14 +108,15 @@ vmx_ia64_handle_break (unsigned long ifa
   14.19  	}
   14.20  #endif
   14.21  	if (iim == d->arch.breakimm) {
   14.22 -		struct ia64_sal_retval x;
   14.23 +		struct ia64_pal_retval y;
   14.24 +		struct sal_ret_values x;
   14.25  		switch (regs->r2) {
   14.26  		    case FW_HYPERCALL_PAL_CALL:
   14.27  			//printf("*** PAL hypercall: index=%d\n",regs->r28);
   14.28  			//FIXME: This should call a C routine
   14.29 -			x = pal_emulator_static(VCPU(v, vgr[12]));
   14.30 -			regs->r8 = x.status; regs->r9 = x.v0;
   14.31 -			regs->r10 = x.v1; regs->r11 = x.v2;
   14.32 +			y = pal_emulator_static(VCPU(v, vgr[12]));
   14.33 +			regs->r8 = y.status; regs->r9 = y.v0;
   14.34 +			regs->r10 = y.v1; regs->r11 = y.v2;
   14.35  #if 0
   14.36  			if (regs->r8)
   14.37  				printk("Failed vpal emulation, with index:0x%lx\n",
   14.38 @@ -130,8 +130,8 @@ vmx_ia64_handle_break (unsigned long ifa
   14.39  					 sal_param[2], sal_param[3],
   14.40  					 sal_param[4], sal_param[5],
   14.41  					 sal_param[6], sal_param[7]);
   14.42 -			regs->r8 = x.status; regs->r9 = x.v0;
   14.43 -			regs->r10 = x.v1; regs->r11 = x.v2;
   14.44 +			regs->r8 = x.r8; regs->r9 = x.r9;
   14.45 +			regs->r10 = x.r10; regs->r11 = x.r11;
   14.46  #if 0
   14.47  			if (regs->r8)
   14.48  				printk("Failed vsal emulation, with index:0x%lx\n",
   14.49 @@ -267,6 +267,12 @@ void leave_hypervisor_tail(struct pt_reg
   14.50  
   14.51  extern ia64_rr vmx_vcpu_rr(VCPU *vcpu,UINT64 vadr);
   14.52  
   14.53 +static int vmx_handle_lds(REGS* regs)
   14.54 +{
   14.55 +    regs->cr_ipsr |=IA64_PSR_ED;
   14.56 +    return IA64_FAULT;
   14.57 +}
   14.58 +
   14.59  /* We came here because the H/W VHPT walker failed to find an entry */
   14.60  void vmx_hpw_miss(u64 vadr , u64 vec, REGS* regs)
   14.61  {
   14.62 @@ -294,18 +300,19 @@ void vmx_hpw_miss(u64 vadr , u64 vec, RE
   14.63          return;
   14.64      }
   14.65  */
   14.66 -
   14.67 -    if((vec==1)&&(!vpsr.it)){
   14.68 -        physical_itlb_miss(v, vadr);
   14.69 -        return;
   14.70 -    }
   14.71 -    if((vec==2)&&(!vpsr.dt)){
   14.72 -        if(v->domain!=dom0&&__gpfn_is_io(v->domain,(vadr<<1)>>(PAGE_SHIFT+1))){
   14.73 -            emulate_io_inst(v,((vadr<<1)>>1),4);   //  UC
   14.74 -        }else{
   14.75 -            physical_dtlb_miss(v, vadr);
   14.76 +    if(is_physical_mode(v)&&(!(vadr<<1>>62))){
   14.77 +        if(vec==1){
   14.78 +            physical_itlb_miss(v, vadr);
   14.79 +            return;
   14.80          }
   14.81 -        return;
   14.82 +        if(vec==2){
   14.83 +            if(v->domain!=dom0&&__gpfn_is_io(v->domain,(vadr<<1)>>(PAGE_SHIFT+1))){
   14.84 +                emulate_io_inst(v,((vadr<<1)>>1),4);   //  UC
   14.85 +            }else{
   14.86 +                physical_dtlb_miss(v, vadr);
   14.87 +            }
   14.88 +            return;
   14.89 +        }
   14.90      }
   14.91      vrr = vmx_vcpu_rr(v, vadr);
   14.92      if(vec == 1) type = ISIDE_TLB;
   14.93 @@ -336,7 +343,8 @@ void vmx_hpw_miss(u64 vadr , u64 vec, RE
   14.94              } else{
   14.95                  if(misr.sp){
   14.96                      //TODO  lds emulation
   14.97 -                    panic("Don't support speculation load");
   14.98 +                    //panic("Don't support speculation load");
   14.99 +                    return vmx_handle_lds(regs);
  14.100                  }else{
  14.101                      nested_dtlb(v);
  14.102                      return IA64_FAULT;
  14.103 @@ -353,8 +361,9 @@ void vmx_hpw_miss(u64 vadr , u64 vec, RE
  14.104                      return IA64_FAULT;
  14.105                  }else{
  14.106                      if(misr.sp){
  14.107 -                        //TODO  lds emulation
  14.108 -                        panic("Don't support speculation load");
  14.109 +                    //TODO  lds emulation
  14.110 +                    //panic("Don't support speculation load");
  14.111 +                    return vmx_handle_lds(regs);
  14.112                      }else{
  14.113                          nested_dtlb(v);
  14.114                          return IA64_FAULT;
  14.115 @@ -367,8 +376,9 @@ void vmx_hpw_miss(u64 vadr , u64 vec, RE
  14.116                      return IA64_FAULT;
  14.117                  }else{
  14.118                      if(misr.sp){
  14.119 -                        //TODO  lds emulation
  14.120 -                        panic("Don't support speculation load");
  14.121 +                    //TODO  lds emulation
  14.122 +                    //panic("Don't support speculation load");
  14.123 +                    return vmx_handle_lds(regs);
  14.124                      }else{
  14.125                          nested_dtlb(v);
  14.126                          return IA64_FAULT;
    15.1 --- a/xen/arch/ia64/vmx/vmx_virt.c	Sat Dec 03 12:21:27 2005 +0000
    15.2 +++ b/xen/arch/ia64/vmx/vmx_virt.c	Sat Dec 03 12:21:52 2005 +0000
    15.3 @@ -835,6 +835,7 @@ IA64FAULT vmx_emul_mov_to_rr(VCPU *vcpu,
    15.4  
    15.5  IA64FAULT vmx_emul_mov_to_dbr(VCPU *vcpu, INST64 inst)
    15.6  {
    15.7 +    return IA64_NO_FAULT;
    15.8      u64 r3,r2;
    15.9  #ifdef  CHECK_FAULT
   15.10      IA64_PSR vpsr;
   15.11 @@ -858,6 +859,7 @@ IA64FAULT vmx_emul_mov_to_dbr(VCPU *vcpu
   15.12  
   15.13  IA64FAULT vmx_emul_mov_to_ibr(VCPU *vcpu, INST64 inst)
   15.14  {
   15.15 +    return IA64_NO_FAULT;
   15.16      u64 r3,r2;
   15.17  #ifdef  CHECK_FAULT
   15.18      IA64_PSR vpsr;
   15.19 @@ -1272,8 +1274,7 @@ IA64FAULT vmx_emul_mov_from_cr(VCPU *vcp
   15.20          case 74:return vmx_cr_get(cmcv);
   15.21          case 80:return vmx_cr_get(lrr0);
   15.22          case 81:return vmx_cr_get(lrr1);
   15.23 -        default:
   15.24 -            panic("Read reserved cr register");
   15.25 +        default: return IA64_NO_FAULT;
   15.26      }
   15.27  }
   15.28  
    16.1 --- a/xen/arch/ia64/vmx/vtlb.c	Sat Dec 03 12:21:27 2005 +0000
    16.2 +++ b/xen/arch/ia64/vmx/vtlb.c	Sat Dec 03 12:21:52 2005 +0000
    16.3 @@ -391,6 +391,7 @@ void vtlb_insert(thash_cb_t *hcb, thash_
    16.4  #if 1
    16.5      vrr=vmx_vcpu_rr(current, va);
    16.6      if (vrr.ps != entry->ps) {
    16.7 +        machine_tlb_insert(hcb->vcpu, entry);
    16.8  	printk("not preferred ps with va: 0x%lx\n", va);
    16.9  	return;
   16.10      }
    17.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Sat Dec 03 12:21:27 2005 +0000
    17.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Sat Dec 03 12:21:52 2005 +0000
    17.3 @@ -194,7 +194,29 @@ long arch_do_dom0_op(dom0_op_t *op, dom0
    17.4          }
    17.5      }
    17.6      break;
    17.7 +
    17.8 +    case DOM0_PHYSINFO:
    17.9 +    {
   17.10 +        dom0_physinfo_t *pi = &op->u.physinfo;
   17.11 +
   17.12 +        pi->threads_per_core = smp_num_siblings;
   17.13 +        pi->cores_per_socket = 1; // FIXME
   17.14 +        pi->sockets_per_node = 
   17.15 +            num_online_cpus() / (pi->threads_per_core * pi->cores_per_socket);
   17.16 +        pi->nr_nodes         = 1;
   17.17 +        pi->total_pages      = 99;  // FIXME
   17.18 +        pi->free_pages       = avail_domheap_pages();
   17.19 +        pi->cpu_khz          = 100;  // FIXME cpu_khz;
   17.20 +        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
   17.21 +        //memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
   17.22 +        ret = 0;
   17.23 +        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
   17.24 +	    ret = -EFAULT;
   17.25 +    }
   17.26 +    break;
   17.27 +
   17.28      default:
   17.29 +printf("arch_do_dom0_op: unrecognized dom0 op: %d!!!\n",op->cmd);
   17.30          ret = -ENOSYS;
   17.31  
   17.32      }
    18.1 --- a/xen/arch/ia64/xen/dom_fw.c	Sat Dec 03 12:21:27 2005 +0000
    18.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Sat Dec 03 12:21:52 2005 +0000
    18.3 @@ -13,11 +13,12 @@
    18.4  #include <asm/io.h>
    18.5  #include <asm/pal.h>
    18.6  #include <asm/sal.h>
    18.7 +#include <xen/compile.h>
    18.8  #include <xen/acpi.h>
    18.9  
   18.10  #include <asm/dom_fw.h>
   18.11  
   18.12 -struct ia64_boot_param *dom_fw_init(struct domain *, char *,int,char *,int);
   18.13 +static struct ia64_boot_param *dom_fw_init(struct domain *, char *,int,char *,int);
   18.14  extern unsigned long domain_mpa_to_imva(struct domain *,unsigned long mpaddr);
   18.15  extern struct domain *dom0;
   18.16  extern unsigned long dom0_start;
   18.17 @@ -55,15 +56,24 @@ void dom_efi_hypercall_patch(struct doma
   18.18  
   18.19  
   18.20  // builds a hypercall bundle at domain physical address
   18.21 -void dom_fw_hypercall_patch(struct domain *d, unsigned long paddr, unsigned long hypercall,unsigned long ret)
   18.22 +static void dom_fw_hypercall_patch(struct domain *d, unsigned long paddr, unsigned long hypercall,unsigned long ret)
   18.23  {
   18.24  	unsigned long imva;
   18.25  
   18.26 -	if (d == dom0) paddr += dom0_start;
   18.27  	imva = domain_mpa_to_imva(d,paddr);
   18.28  	build_hypercall_bundle(imva,d->arch.breakimm,hypercall,ret);
   18.29  }
   18.30  
   18.31 +static void dom_fw_pal_hypercall_patch(struct domain *d, unsigned long paddr)
   18.32 +{
   18.33 +	unsigned long *imva;
   18.34 +
   18.35 +	imva = (unsigned long *)domain_mpa_to_imva(d,paddr);
   18.36 +
   18.37 +	build_pal_hypercall_bundles (imva, d->arch.breakimm,
   18.38 +				      FW_HYPERCALL_PAL_CALL);
   18.39 +}
   18.40 +
   18.41  
   18.42  // FIXME: This is really a hack: Forcing the boot parameter block
   18.43  // at domain mpaddr 0 page, then grabbing only the low bits of the
   18.44 @@ -154,8 +164,6 @@ offtime (unsigned long t, efi_time_t *tp
   18.45  	return 1;
   18.46  }
   18.47  
   18.48 -extern struct ia64_pal_retval pal_emulator_static (unsigned long);
   18.49 -
   18.50  /* Macro to emulate SAL call using legacy IN and OUT calls to CF8, CFC etc.. */
   18.51  
   18.52  #define BUILD_CMD(addr)		((0x80000000 | (addr)) & ~3)
   18.53 @@ -292,11 +300,6 @@ xen_pal_emulator(unsigned long index, un
   18.54  	long status = -1;
   18.55  
   18.56  	if (running_on_sim) return pal_emulator_static(index);
   18.57 -	if (index >= PAL_COPY_PAL) {
   18.58 -		// build_hypercall_bundle needs to be modified to generate
   18.59 -		// a second bundle that conditionally does a br.ret
   18.60 -		panic("xen_pal_emulator: stacked calls not supported!!\n");
   18.61 -	}
   18.62  	printk("xen_pal_emulator: index=%d\n",index);
   18.63  	// pal code must be mapped by a TR when pal is called, however
   18.64  	// calls are rare enough that we will map it lazily rather than
   18.65 @@ -389,9 +392,26 @@ xen_pal_emulator(unsigned long index, un
   18.66  	    case PAL_VM_TR_READ:	/* FIXME: vcpu_get_tr?? */
   18.67  		printk("PAL_VM_TR_READ NOT IMPLEMENTED, IGNORED!\n");
   18.68  		break;
   18.69 -	    case PAL_HALT_INFO:		/* inappropriate info for guest? */
   18.70 -		printk("PAL_HALT_INFO NOT IMPLEMENTED, IGNORED!\n");
   18.71 +	    case PAL_HALT_INFO:
   18.72 +	        {
   18.73 +		    /* 1000 cycles to enter/leave low power state,
   18.74 +		       consumes 10 mW, implemented and cache/TLB coherent.  */
   18.75 +		    unsigned long res = 1000UL | (1000UL << 16) | (10UL << 32)
   18.76 +			    | (1UL << 61) | (1UL << 60);
   18.77 +		    if (copy_to_user ((void *)in1, &res, sizeof (res)))
   18.78 +			    status = PAL_STATUS_EINVAL;    
   18.79 +		    else
   18.80 +			    status = PAL_STATUS_SUCCESS;
   18.81 +	        }
   18.82  		break;
   18.83 +	    case PAL_HALT:
   18.84 +		    if (current->domain == dom0) {
   18.85 +			    printf ("Domain0 halts the machine\n");
   18.86 +			    (*efi.reset_system)(EFI_RESET_SHUTDOWN,0,0,NULL);
   18.87 +		    }
   18.88 +		    else
   18.89 +			    domain_shutdown (current->domain, 0);
   18.90 +		    break;
   18.91  	    default:
   18.92  		printk("xen_pal_emulator: UNIMPLEMENTED PAL CALL %d!!!!\n",
   18.93  				index);
   18.94 @@ -400,6 +420,7 @@ xen_pal_emulator(unsigned long index, un
   18.95  	return ((struct ia64_pal_retval) {status, r9, r10, r11});
   18.96  }
   18.97  
   18.98 +
   18.99  #define NFUNCPTRS 20
  18.100  
  18.101  void print_md(efi_memory_desc_t *md)
  18.102 @@ -437,29 +458,29 @@ acpi_update_lsapic (acpi_table_entry_hea
  18.103  	return 0;
  18.104  }
  18.105  
  18.106 +static u8
  18.107 +generate_acpi_checksum(void *tbl, unsigned long len)
  18.108 +{
  18.109 +	u8 *ptr, sum = 0;
  18.110 +
  18.111 +	for (ptr = tbl; len > 0 ; len--, ptr++)
  18.112 +		sum += *ptr;
  18.113 +
  18.114 +	return 0 - sum;
  18.115 +}
  18.116 +
  18.117  static int
  18.118  acpi_update_madt_checksum (unsigned long phys_addr, unsigned long size)
  18.119  {
  18.120 -	u8 checksum=0;
  18.121 -    	u8* ptr;
  18.122 -	int len;
  18.123  	struct acpi_table_madt* acpi_madt;
  18.124  
  18.125  	if (!phys_addr || !size)
  18.126  		return -EINVAL;
  18.127  
  18.128  	acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
  18.129 -	acpi_madt->header.checksum=0;
  18.130 +	acpi_madt->header.checksum = 0;
  18.131 +	acpi_madt->header.checksum = generate_acpi_checksum(acpi_madt, size);
  18.132  
  18.133 -    	/* re-calculate MADT checksum */
  18.134 -	ptr = (u8*)acpi_madt;
  18.135 -    	len = acpi_madt->header.length;
  18.136 -	while (len>0){
  18.137 -		checksum = (u8)( checksum + (*ptr++) );
  18.138 -		len--;
  18.139 -	}
  18.140 -    	acpi_madt->header.checksum = 0x0 - checksum;	
  18.141 -	
  18.142  	return 0;
  18.143  }
  18.144  
  18.145 @@ -473,8 +494,140 @@ void touch_acpi_table(void)
  18.146  	return;
  18.147  }
  18.148  
  18.149 +struct fake_acpi_tables {
  18.150 +	struct acpi20_table_rsdp rsdp;
  18.151 +	struct xsdt_descriptor_rev2 xsdt;
  18.152 +	u64 madt_ptr;
  18.153 +	struct fadt_descriptor_rev2 fadt;
  18.154 +	struct facs_descriptor_rev2 facs;
  18.155 +	struct acpi_table_header dsdt;
  18.156 +	u8 aml[16];
  18.157 +	struct acpi_table_madt madt;
  18.158 +	struct acpi_table_lsapic lsapic;
  18.159 +	u8 pm1a_evt_blk[4];
  18.160 +	u8 pm1a_cnt_blk[1];
  18.161 +	u8 pm_tmr_blk[4];
  18.162 +};
  18.163  
  18.164 -struct ia64_boot_param *
  18.165 +/* Create enough of an ACPI structure to make the guest OS ACPI happy. */
  18.166 +void
  18.167 +dom_fw_fake_acpi(struct fake_acpi_tables *tables)
  18.168 +{
  18.169 +	struct acpi20_table_rsdp *rsdp = &tables->rsdp;
  18.170 +	struct xsdt_descriptor_rev2 *xsdt = &tables->xsdt;
  18.171 +	struct fadt_descriptor_rev2 *fadt = &tables->fadt;
  18.172 +	struct facs_descriptor_rev2 *facs = &tables->facs;
  18.173 +	struct acpi_table_header *dsdt = &tables->dsdt;
  18.174 +	struct acpi_table_madt *madt = &tables->madt;
  18.175 +	struct acpi_table_lsapic *lsapic = &tables->lsapic;
  18.176 +
  18.177 +	memset(tables, 0, sizeof(struct fake_acpi_tables));
  18.178 +
  18.179 +	/* setup XSDT (64bit version of RSDT) */
  18.180 +	strncpy(xsdt->signature, XSDT_SIG, 4);
  18.181 +	/* XSDT points to both the FADT and the MADT, so add one entry */
  18.182 +	xsdt->length = sizeof(struct xsdt_descriptor_rev2) + sizeof(u64);
  18.183 +	xsdt->revision = 1;
  18.184 +	strcpy(xsdt->oem_id, "XEN");
  18.185 +	strcpy(xsdt->oem_table_id, "Xen/ia64");
  18.186 +	strcpy(xsdt->asl_compiler_id, "XEN");
  18.187 +	xsdt->asl_compiler_revision = (XEN_VERSION<<16)|(XEN_SUBVERSION);
  18.188 +
  18.189 +	xsdt->table_offset_entry[0] = dom_pa(fadt);
  18.190 +	tables->madt_ptr = dom_pa(madt);
  18.191 +
  18.192 +	xsdt->checksum = generate_acpi_checksum(xsdt, xsdt->length);
  18.193 +
  18.194 +	/* setup FADT */
  18.195 +	strncpy(fadt->signature, FADT_SIG, 4);
  18.196 +	fadt->length = sizeof(struct fadt_descriptor_rev2);
  18.197 +	fadt->revision = FADT2_REVISION_ID;
  18.198 +	strcpy(fadt->oem_id, "XEN");
  18.199 +	strcpy(fadt->oem_table_id, "Xen/ia64");
  18.200 +	strcpy(fadt->asl_compiler_id, "XEN");
  18.201 +	fadt->asl_compiler_revision = (XEN_VERSION<<16)|(XEN_SUBVERSION);
  18.202 +
  18.203 +	strncpy(facs->signature, FACS_SIG, 4);
  18.204 +	facs->version = 1;
  18.205 +	facs->length = sizeof(struct facs_descriptor_rev2);
  18.206 +
  18.207 +	fadt->xfirmware_ctrl = dom_pa(facs);
  18.208 +	fadt->Xdsdt = dom_pa(dsdt);
  18.209 +
  18.210 +	/*
  18.211 +	 * All of the below FADT entries are filled it to prevent warnings
  18.212 +	 * from sanity checks in the ACPI CA.  Emulate required ACPI hardware
  18.213 +	 * registers in system memory.
  18.214 +	 */
  18.215 +	fadt->pm1_evt_len = 4;
  18.216 +	fadt->xpm1a_evt_blk.address_space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY;
  18.217 +	fadt->xpm1a_evt_blk.register_bit_width = 8;
  18.218 +	fadt->xpm1a_evt_blk.address = dom_pa(&tables->pm1a_evt_blk);
  18.219 +	fadt->pm1_cnt_len = 1;
  18.220 +	fadt->xpm1a_cnt_blk.address_space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY;
  18.221 +	fadt->xpm1a_cnt_blk.register_bit_width = 8;
  18.222 +	fadt->xpm1a_cnt_blk.address = dom_pa(&tables->pm1a_cnt_blk);
  18.223 +	fadt->pm_tm_len = 4;
  18.224 +	fadt->xpm_tmr_blk.address_space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY;
  18.225 +	fadt->xpm_tmr_blk.register_bit_width = 8;
  18.226 +	fadt->xpm_tmr_blk.address = dom_pa(&tables->pm_tmr_blk);
  18.227 +
  18.228 +	fadt->checksum = generate_acpi_checksum(fadt, fadt->length);
  18.229 +
  18.230 +	/* setup RSDP */
  18.231 +	strncpy(rsdp->signature, RSDP_SIG, 8);
  18.232 +	strcpy(rsdp->oem_id, "XEN");
  18.233 +	rsdp->revision = 2; /* ACPI 2.0 includes XSDT */
  18.234 +	rsdp->length = sizeof(struct acpi20_table_rsdp);
  18.235 +	rsdp->xsdt_address = dom_pa(xsdt);
  18.236 +
  18.237 +	rsdp->checksum = generate_acpi_checksum(rsdp,
  18.238 +	                                        ACPI_RSDP_CHECKSUM_LENGTH);
  18.239 +	rsdp->ext_checksum = generate_acpi_checksum(rsdp, rsdp->length);
  18.240 +
  18.241 +	/* setup DSDT with trivial namespace. */ 
  18.242 +	strncpy(dsdt->signature, DSDT_SIG, 4);
  18.243 +	dsdt->revision = 1;
  18.244 +	dsdt->length = sizeof(struct acpi_table_header) + sizeof(tables->aml);
  18.245 +	strcpy(dsdt->oem_id, "XEN");
  18.246 +	strcpy(dsdt->oem_table_id, "Xen/ia64");
  18.247 +	strcpy(dsdt->asl_compiler_id, "XEN");
  18.248 +	dsdt->asl_compiler_revision = (XEN_VERSION<<16)|(XEN_SUBVERSION);
  18.249 +
  18.250 +	/* Trivial namespace, avoids ACPI CA complaints */
  18.251 +	tables->aml[0] = 0x10; /* Scope */
  18.252 +	tables->aml[1] = 0x12; /* length/offset to next object */
  18.253 +	strncpy(&tables->aml[2], "_SB_", 4);
  18.254 +
  18.255 +	/* The processor object isn't absolutely necessary, revist for SMP */
  18.256 +	tables->aml[6] = 0x5b; /* processor object */
  18.257 +	tables->aml[7] = 0x83;
  18.258 +	tables->aml[8] = 0x0b; /* next */
  18.259 +	strncpy(&tables->aml[9], "CPU0", 4);
  18.260 +
  18.261 +	dsdt->checksum = generate_acpi_checksum(dsdt, dsdt->length);
  18.262 +
  18.263 +	/* setup MADT */
  18.264 +	strncpy(madt->header.signature, APIC_SIG, 4);
  18.265 +	madt->header.revision = 2;
  18.266 +	madt->header.length = sizeof(struct acpi_table_madt) +
  18.267 +	                      sizeof(struct acpi_table_lsapic);
  18.268 +	strcpy(madt->header.oem_id, "XEN");
  18.269 +	strcpy(madt->header.oem_table_id, "Xen/ia64");
  18.270 +	strcpy(madt->header.asl_compiler_id, "XEN");
  18.271 +	madt->header.asl_compiler_revision = (XEN_VERSION<<16)|(XEN_SUBVERSION);
  18.272 +
  18.273 +	/* A single LSAPIC entry describes the CPU.  Revisit for SMP guests */
  18.274 +	lsapic->header.type = ACPI_MADT_LSAPIC;
  18.275 +	lsapic->header.length = sizeof(struct acpi_table_lsapic);
  18.276 +	lsapic->flags.enabled = 1;
  18.277 +
  18.278 +	madt->header.checksum = generate_acpi_checksum(madt,
  18.279 +	                                               madt->header.length);
  18.280 +	return;
  18.281 +}
  18.282 +
  18.283 +static struct ia64_boot_param *
  18.284  dom_fw_init (struct domain *d, char *args, int arglen, char *fw_mem, int fw_mem_size)
  18.285  {
  18.286  	efi_system_table_t *efi_systab;
  18.287 @@ -482,7 +635,6 @@ dom_fw_init (struct domain *d, char *arg
  18.288  	efi_config_table_t *efi_tables;
  18.289  	struct ia64_sal_systab *sal_systab;
  18.290  	efi_memory_desc_t *efi_memmap, *md;
  18.291 -	unsigned long *pal_desc, *sal_desc;
  18.292  	struct ia64_sal_desc_entry_point *sal_ed;
  18.293  	struct ia64_boot_param *bp;
  18.294  	unsigned long *pfn;
  18.295 @@ -490,7 +642,7 @@ dom_fw_init (struct domain *d, char *arg
  18.296  	char *cp, *cmd_line, *fw_vendor;
  18.297  	int i = 0;
  18.298  	unsigned long maxmem = (d->max_pages - d->arch.sys_pgnr) * PAGE_SIZE;
  18.299 -	unsigned long start_mpaddr = ((d==dom0)?dom0_start:0);
  18.300 +	const unsigned long start_mpaddr = ((d==dom0)?dom0_start:0);
  18.301  
  18.302  #	define MAKE_MD(typ, attr, start, end, abs) 	\	
  18.303  	do {						\
  18.304 @@ -513,13 +665,6 @@ dom_fw_init (struct domain *d, char *arg
  18.305  */
  18.306  	memset(fw_mem, 0, fw_mem_size);
  18.307  
  18.308 -#ifdef USE_PAL_EMULATOR
  18.309 -	pal_desc = (unsigned long *) &pal_emulator_static;
  18.310 -#else
  18.311 -	pal_desc = (unsigned long *) &xen_pal_emulator;
  18.312 -#endif
  18.313 -	sal_desc = (unsigned long *) &sal_emulator;
  18.314 -
  18.315  	cp = fw_mem;
  18.316  	efi_systab  = (void *) cp; cp += sizeof(*efi_systab);
  18.317  	efi_runtime = (void *) cp; cp += sizeof(*efi_runtime);
  18.318 @@ -562,7 +707,7 @@ dom_fw_init (struct domain *d, char *arg
  18.319  #define EFI_HYPERCALL_PATCH(tgt,call) do { \
  18.320      dom_efi_hypercall_patch(d,FW_HYPERCALL_##call##_PADDR,FW_HYPERCALL_##call); \
  18.321      tgt = dom_pa(pfn); \
  18.322 -    *pfn++ = FW_HYPERCALL_##call##_PADDR + ((d==dom0)?dom0_start:0); \
  18.323 +    *pfn++ = FW_HYPERCALL_##call##_PADDR + start_mpaddr; \
  18.324      *pfn++ = 0; \
  18.325      } while (0)
  18.326  
  18.327 @@ -620,6 +765,22 @@ dom_fw_init (struct domain *d, char *arg
  18.328  			i++;
  18.329  		}
  18.330  		printf("\n");
  18.331 +	} else {
  18.332 +		i = 1;
  18.333 +
  18.334 +		if ((unsigned long)fw_mem + fw_mem_size - (unsigned long)cp >=
  18.335 +		    sizeof(struct fake_acpi_tables)) {
  18.336 +			struct fake_acpi_tables *acpi_tables;
  18.337 +
  18.338 +			acpi_tables = (void *)cp;
  18.339 +			cp += sizeof(struct fake_acpi_tables);
  18.340 +			dom_fw_fake_acpi(acpi_tables);
  18.341 +
  18.342 +			efi_tables[i].guid = ACPI_20_TABLE_GUID;
  18.343 +			efi_tables[i].table = dom_pa(acpi_tables);
  18.344 +			printf(" ACPI 2.0=%0xlx",efi_tables[i].table);
  18.345 +			i++;
  18.346 +		}
  18.347  	}
  18.348  
  18.349  	/* fill in the SAL system table: */
  18.350 @@ -634,12 +795,10 @@ dom_fw_init (struct domain *d, char *arg
  18.351  
  18.352  	/* fill in an entry point: */
  18.353  	sal_ed->type = SAL_DESC_ENTRY_POINT;
  18.354 -#define FW_HYPERCALL_PATCH(tgt,call,ret) do { \
  18.355 -    dom_fw_hypercall_patch(d,FW_HYPERCALL_##call##_PADDR,FW_HYPERCALL_##call,ret); \
  18.356 -    tgt = FW_HYPERCALL_##call##_PADDR + ((d==dom0)?dom0_start:0); \
  18.357 -    } while (0)
  18.358 -	FW_HYPERCALL_PATCH(sal_ed->pal_proc,PAL_CALL,0);
  18.359 -	FW_HYPERCALL_PATCH(sal_ed->sal_proc,SAL_CALL,1);
  18.360 +	sal_ed->pal_proc = FW_HYPERCALL_PAL_CALL_PADDR + start_mpaddr;
  18.361 +	dom_fw_pal_hypercall_patch (d, sal_ed->pal_proc);
  18.362 +	sal_ed->sal_proc = FW_HYPERCALL_SAL_CALL_PADDR + start_mpaddr;
  18.363 +	dom_fw_hypercall_patch (d, sal_ed->sal_proc, FW_HYPERCALL_SAL_CALL, 1);
  18.364  	sal_ed->gp = 0;  // will be ignored
  18.365  
  18.366  	for (cp = (char *) sal_systab; cp < (char *) efi_memmap; ++cp)
    19.1 --- a/xen/arch/ia64/xen/domain.c	Sat Dec 03 12:21:27 2005 +0000
    19.2 +++ b/xen/arch/ia64/xen/domain.c	Sat Dec 03 12:21:52 2005 +0000
    19.3 @@ -165,7 +165,7 @@ void free_vcpu_struct(struct vcpu *v)
    19.4  
    19.5  static void init_switch_stack(struct vcpu *v)
    19.6  {
    19.7 -	struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
    19.8 +	struct pt_regs *regs = vcpu_regs (v);
    19.9  	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   19.10  	extern void ia64_ret_from_clone;
   19.11  
   19.12 @@ -253,7 +253,7 @@ void arch_do_createdomain(struct vcpu *v
   19.13  
   19.14  void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
   19.15  {
   19.16 -	struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
   19.17 +	struct pt_regs *regs = vcpu_regs (v);
   19.18  
   19.19  	printf("arch_getdomaininfo_ctxt\n");
   19.20  	c->regs = *regs;
   19.21 @@ -264,7 +264,7 @@ void arch_getdomaininfo_ctxt(struct vcpu
   19.22  
   19.23  int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
   19.24  {
   19.25 -	struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
   19.26 +	struct pt_regs *regs = vcpu_regs (v);
   19.27  	struct domain *d = v->domain;
   19.28  	int i, rc, ret;
   19.29  	unsigned long progress = 0;
   19.30 @@ -335,7 +335,7 @@ void new_thread(struct vcpu *v,
   19.31  	if (d == dom0) start_pc += dom0_start;
   19.32  #endif
   19.33  
   19.34 -	regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
   19.35 +	regs = vcpu_regs (v);
   19.36  	if (VMX_DOMAIN(v)) {
   19.37  		/* dt/rt/it:1;i/ic:1, si:1, vm/bn:1, ac:1 */
   19.38  		regs->cr_ipsr = 0x501008826008; /* Need to be expanded as macro */
    20.1 --- a/xen/arch/ia64/xen/hypercall.c	Sat Dec 03 12:21:27 2005 +0000
    20.2 +++ b/xen/arch/ia64/xen/hypercall.c	Sat Dec 03 12:21:52 2005 +0000
    20.3 @@ -18,8 +18,6 @@
    20.4  #include <public/sched.h>
    20.5  
    20.6  extern unsigned long translate_domain_mpaddr(unsigned long);
    20.7 -extern struct ia64_pal_retval xen_pal_emulator(UINT64,UINT64,UINT64,UINT64);
    20.8 -extern struct ia64_sal_retval sal_emulator(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
    20.9  
   20.10  unsigned long idle_when_pending = 0;
   20.11  unsigned long pal_halt_light_count = 0;
   20.12 @@ -28,8 +26,7 @@ int
   20.13  ia64_hypercall (struct pt_regs *regs)
   20.14  {
   20.15  	struct vcpu *v = (struct domain *) current;
   20.16 -	struct ia64_sal_retval x;
   20.17 -	struct ia64_pal_retval y;
   20.18 +	struct sal_ret_values x;
   20.19  	unsigned long *tv, *tc;
   20.20  	int pi;
   20.21  
   20.22 @@ -62,25 +59,33 @@ ia64_hypercall (struct pt_regs *regs)
   20.23  				pal_halt_light_count++;
   20.24  				do_sched_op(SCHEDOP_yield);
   20.25  			}
   20.26 -			//break;
   20.27 +			regs->r8 = 0;
   20.28 +			regs->r9 = 0;
   20.29 +			regs->r10 = 0;
   20.30 +			regs->r11 = 0;
   20.31  		}
   20.32 -		else if (regs->r28 >= PAL_COPY_PAL) {	/* FIXME */
   20.33 -			printf("stacked PAL hypercalls not supported\n");
   20.34 -			regs->r8 = -1;
   20.35 -			break;
   20.36 +		else {
   20.37 +			struct ia64_pal_retval y;
   20.38 +
   20.39 +			if (regs->r28 >= PAL_COPY_PAL)
   20.40 +				y = xen_pal_emulator
   20.41 +					(regs->r28, vcpu_get_gr (v, 33),
   20.42 +					 vcpu_get_gr (v, 34),
   20.43 +					 vcpu_get_gr (v, 35));
   20.44 +			else
   20.45 +				y = xen_pal_emulator(regs->r28,regs->r29,
   20.46 +						     regs->r30,regs->r31);
   20.47 +			regs->r8 = y.status; regs->r9 = y.v0;
   20.48 +			regs->r10 = y.v1; regs->r11 = y.v2;
   20.49  		}
   20.50 -		else y = xen_pal_emulator(regs->r28,regs->r29,
   20.51 -						regs->r30,regs->r31);
   20.52 -		regs->r8 = y.status; regs->r9 = y.v0;
   20.53 -		regs->r10 = y.v1; regs->r11 = y.v2;
   20.54  		break;
   20.55  	    case FW_HYPERCALL_SAL_CALL:
   20.56  		x = sal_emulator(vcpu_get_gr(v,32),vcpu_get_gr(v,33),
   20.57  			vcpu_get_gr(v,34),vcpu_get_gr(v,35),
   20.58  			vcpu_get_gr(v,36),vcpu_get_gr(v,37),
   20.59  			vcpu_get_gr(v,38),vcpu_get_gr(v,39));
   20.60 -		regs->r8 = x.status; regs->r9 = x.v0;
   20.61 -		regs->r10 = x.v1; regs->r11 = x.v2;
   20.62 +		regs->r8 = x.r8; regs->r9 = x.r9;
   20.63 +		regs->r10 = x.r10; regs->r11 = x.r11;
   20.64  		break;
   20.65  	    case FW_HYPERCALL_EFI_RESET_SYSTEM:
   20.66  		printf("efi.reset_system called ");
    21.1 --- a/xen/arch/ia64/xen/privop.c	Sat Dec 03 12:21:27 2005 +0000
    21.2 +++ b/xen/arch/ia64/xen/privop.c	Sat Dec 03 12:21:52 2005 +0000
    21.3 @@ -10,6 +10,7 @@
    21.4  #include <asm/vcpu.h>
    21.5  #include <asm/processor.h>
    21.6  #include <asm/delay.h>	// Debug only
    21.7 +#include <asm/dom_fw.h>
    21.8  //#include <debug.h>
    21.9  
   21.10  long priv_verbose=0;
   21.11 @@ -54,6 +55,39 @@ void build_hypercall_bundle(UINT64 *imva
   21.12  	*imva++ = bundle.i64[0]; *imva = bundle.i64[1];
   21.13  }
   21.14  
   21.15 +void build_pal_hypercall_bundles(UINT64 *imva, UINT64 brkimm, UINT64 hypnum)
   21.16 +{
   21.17 +	extern unsigned long pal_call_stub[];
   21.18 +	IA64_BUNDLE bundle;
   21.19 +	INST64_A5 slot_a5;
   21.20 +	INST64_M37 slot_m37;
   21.21 +
   21.22 +	/* The source of the hypercall stub is the pal_call_stub function
   21.23 +	   defined in xenasm.S.  */
   21.24 +
   21.25 +	/* Copy the first bundle and patch the hypercall number.  */
   21.26 +	bundle.i64[0] = pal_call_stub[0];
   21.27 +	bundle.i64[1] = pal_call_stub[1];
   21.28 +	slot_a5.inst = bundle.slot0;
   21.29 +	slot_a5.imm7b = hypnum;
   21.30 +	slot_a5.imm9d = hypnum >> 7;
   21.31 +	slot_a5.imm5c = hypnum >> 16;
   21.32 +	bundle.slot0 = slot_a5.inst;
   21.33 +	imva[0] = bundle.i64[0];
   21.34 +	imva[1] = bundle.i64[1];
   21.35 +	
   21.36 +	/* Copy the second bundle and patch the hypercall vector.  */
   21.37 +	bundle.i64[0] = pal_call_stub[2];
   21.38 +	bundle.i64[1] = pal_call_stub[3];
   21.39 +	slot_m37.inst = bundle.slot0;
   21.40 +	slot_m37.imm20a = brkimm;
   21.41 +	slot_m37.i = brkimm >> 20;
   21.42 +	bundle.slot0 = slot_m37.inst;
   21.43 +	imva[2] = bundle.i64[0];
   21.44 +	imva[3] = bundle.i64[1];
   21.45 +}
   21.46 +
   21.47 +
   21.48  /**************************************************************************
   21.49  Privileged operation emulation routines
   21.50  **************************************************************************/
    22.1 --- a/xen/arch/ia64/xen/process.c	Sat Dec 03 12:21:27 2005 +0000
    22.2 +++ b/xen/arch/ia64/xen/process.c	Sat Dec 03 12:21:52 2005 +0000
    22.3 @@ -33,8 +33,6 @@
    22.4  #include <xen/multicall.h>
    22.5  
    22.6  extern unsigned long vcpu_get_itir_on_fault(struct vcpu *, UINT64);
    22.7 -extern struct ia64_sal_retval pal_emulator_static(UINT64);
    22.8 -extern struct ia64_sal_retval sal_emulator(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
    22.9  
   22.10  extern unsigned long dom0_start, dom0_size;
   22.11  
    23.1 --- a/xen/arch/ia64/xen/vcpu.c	Sat Dec 03 12:21:27 2005 +0000
    23.2 +++ b/xen/arch/ia64/xen/vcpu.c	Sat Dec 03 12:21:52 2005 +0000
    23.3 @@ -33,7 +33,6 @@ typedef	union {
    23.4  
    23.5  // this def for vcpu_regs won't work if kernel stack is present
    23.6  //#define	vcpu_regs(vcpu) ((struct pt_regs *) vcpu->arch.regs
    23.7 -#define vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1)
    23.8  #define	PSCB(x,y)	VCPU(x,y)
    23.9  #define	PSCBX(x,y)	x->arch.y
   23.10  
    24.1 --- a/xen/arch/ia64/xen/xenasm.S	Sat Dec 03 12:21:27 2005 +0000
    24.2 +++ b/xen/arch/ia64/xen/xenasm.S	Sat Dec 03 12:21:52 2005 +0000
    24.3 @@ -516,3 +516,27 @@ GLOBAL_ENTRY(vhpt_insert)
    24.4  	br.ret.sptk.few rp
    24.5  	;;
    24.6  END(vhpt_insert)
    24.7 +
    24.8 +//  These instructions are copied in the domains.
    24.9 +//  This is the virtual PAL, which simply does an hypercall.
   24.10 +//  The size is 2 bunldes (32 Bytes).  It handles both static and stacked
   24.11 +//    convention.
   24.12 +//  If you modify this code, you have to modify dom_fw.h (for the size) and
   24.13 +//   dom_fw_pal_hypercall_patch.
   24.14 +GLOBAL_ENTRY(pal_call_stub)
   24.15 +	{
   24.16 +	 .mii
   24.17 +	addl r2=0x1000,r0	//  Hypercall number (Value is patched).
   24.18 +	mov r9=256
   24.19 +	;; 
   24.20 +	cmp.gtu p7,p8=r9,r28		/* r32 <= 255? */
   24.21 +	}
   24.22 +	{
   24.23 +	 .mbb
   24.24 +	break 0x1000	//  Hypercall vector (Value is patched).
   24.25 +(p7)	br.cond.sptk.few rp
   24.26 +(p8)	br.ret.sptk.few rp
   24.27 +	}
   24.28 +END(pal_call_stub)
   24.29 +
   24.30 +
    25.1 --- a/xen/arch/ia64/xen/xenmisc.c	Sat Dec 03 12:21:27 2005 +0000
    25.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Sat Dec 03 12:21:52 2005 +0000
    25.3 @@ -72,7 +72,7 @@ int grant_table_create(struct domain *d)
    25.4  void grant_table_destroy(struct domain *d) { return; }
    25.5  #endif
    25.6  
    25.7 -struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); }
    25.8 +struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
    25.9  
   25.10  void raise_actimer_softirq(void)
   25.11  {
   25.12 @@ -141,10 +141,12 @@ void init_percpu_info(void)
   25.13      //memset(percpu_info, 0, sizeof(percpu_info));
   25.14  }
   25.15  
   25.16 +#if 0
   25.17  void free_page_type(struct pfn_info *page, unsigned int type)
   25.18  {
   25.19  	dummy();
   25.20  }
   25.21 +#endif
   25.22  
   25.23  ///////////////////////////////
   25.24  //// misc memory stuff
    26.1 --- a/xen/arch/ia64/xen/xensetup.c	Sat Dec 03 12:21:27 2005 +0000
    26.2 +++ b/xen/arch/ia64/xen/xensetup.c	Sat Dec 03 12:21:52 2005 +0000
    26.3 @@ -289,6 +289,11 @@ printk("About to call init_xen_time()\n"
    26.4  printk("About to call ac_timer_init()\n");
    26.5      ac_timer_init();
    26.6  
    26.7 +#ifdef CONFIG_XEN_CONSOLE_INPUT	/* CONFIG_SERIAL_8250_CONSOLE=n in dom0! */
    26.8 +    initialize_keytable();
    26.9 +    serial_init_postirq();
   26.10 +#endif
   26.11 +
   26.12  #ifdef CONFIG_SMP
   26.13      if ( opt_nosmp )
   26.14      {
   26.15 @@ -407,7 +412,7 @@ printk("About to call init_trace_bufs()\
   26.16      init_trace_bufs();
   26.17  
   26.18      /* Give up the VGA console if DOM0 is configured to grab it. */
   26.19 -#ifndef IA64
   26.20 +#ifdef CONFIG_XEN_CONSOLE_INPUT	/* CONFIG_SERIAL_8250_CONSOLE=n in dom0! */
   26.21      console_endboot(cmdline && strstr(cmdline, "tty0"));
   26.22  #endif
   26.23  
    27.1 --- a/xen/include/asm-ia64/dom_fw.h	Sat Dec 03 12:21:27 2005 +0000
    27.2 +++ b/xen/include/asm-ia64/dom_fw.h	Sat Dec 03 12:21:52 2005 +0000
    27.3 @@ -35,6 +35,7 @@ extern unsigned long dom_fw_setup(struct
    27.4   * rp=b0 indicates the return point.
    27.5   *
    27.6   * A single hypercall is used for all PAL calls.
    27.7 + * The hypercall stub is pal_call_stub (xenasm.S).  Its size is 2 bundles.
    27.8   */
    27.9  
   27.10  #define FW_HYPERCALL_PAL_CALL_INDEX	0x80UL
   27.11 @@ -53,7 +54,7 @@ extern unsigned long dom_fw_setup(struct
   27.12   * A single hypercall is used for all SAL calls.
   27.13   */
   27.14  
   27.15 -#define FW_HYPERCALL_SAL_CALL_INDEX	0x81UL
   27.16 +#define FW_HYPERCALL_SAL_CALL_INDEX	0x82UL
   27.17  #define FW_HYPERCALL_SAL_CALL_PADDR	FW_HYPERCALL_PADDR(FW_HYPERCALL_SAL_CALL_INDEX)
   27.18  #define FW_HYPERCALL_SAL_CALL		0x1001UL
   27.19  
   27.20 @@ -117,3 +118,12 @@ extern unsigned long dom_fw_setup(struct
   27.21  #define FW_HYPERCALL_EFI_SET_VARIABLE_PADDR		FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_SET_VARIABLE_INDEX)
   27.22  #define FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT_PADDR	FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT_INDEX)
   27.23  #define FW_HYPERCALL_EFI_RESET_SYSTEM_PADDR		FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_RESET_SYSTEM_INDEX)
   27.24 +
   27.25 +extern struct ia64_pal_retval xen_pal_emulator(UINT64,UINT64,UINT64,UINT64);
   27.26 +extern struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, unsigned long in6, unsigned long in7);
   27.27 +extern struct ia64_pal_retval pal_emulator_static (unsigned long);
   27.28 +
   27.29 +extern void build_pal_hypercall_bundles(unsigned long *imva, unsigned long brkimm, unsigned long hypnum);
   27.30 +extern void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, UINT64 ret);
   27.31 +
   27.32 +
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/xen/include/asm-ia64/linux-xen/asm/cache.h	Sat Dec 03 12:21:52 2005 +0000
    28.3 @@ -0,0 +1,35 @@
    28.4 +#ifndef _ASM_IA64_CACHE_H
    28.5 +#define _ASM_IA64_CACHE_H
    28.6 +
    28.7 +#include <linux/config.h>
    28.8 +
    28.9 +/*
   28.10 + * Copyright (C) 1998-2000 Hewlett-Packard Co
   28.11 + *	David Mosberger-Tang <davidm@hpl.hp.com>
   28.12 + */
   28.13 +
   28.14 +/* Bytes per L1 (data) cache line.  */
   28.15 +#define L1_CACHE_SHIFT		CONFIG_IA64_L1_CACHE_SHIFT
   28.16 +#define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
   28.17 +
   28.18 +#define L1_CACHE_SHIFT_MAX 7	/* largest L1 which this arch supports */
   28.19 +
   28.20 +#ifdef XEN
   28.21 +# define SMP_CACHE_SHIFT	L1_CACHE_SHIFT
   28.22 +# define SMP_CACHE_BYTES	L1_CACHE_BYTES
   28.23 +#else
   28.24 +#ifdef CONFIG_SMP
   28.25 +# define SMP_CACHE_SHIFT	L1_CACHE_SHIFT
   28.26 +# define SMP_CACHE_BYTES	L1_CACHE_BYTES
   28.27 +#else
   28.28 +  /*
   28.29 +   * The "aligned" directive can only _increase_ alignment, so this is
   28.30 +   * safe and provides an easy way to avoid wasting space on a
   28.31 +   * uni-processor:
   28.32 +   */
   28.33 +# define SMP_CACHE_SHIFT	3
   28.34 +# define SMP_CACHE_BYTES	(1 << 3)
   28.35 +#endif
   28.36 +#endif
   28.37 +
   28.38 +#endif /* _ASM_IA64_CACHE_H */
    29.1 --- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h	Sat Dec 03 12:21:27 2005 +0000
    29.2 +++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h	Sat Dec 03 12:21:52 2005 +0000
    29.3 @@ -98,6 +98,19 @@
    29.4  #ifdef XEN
    29.5  #include <public/arch-ia64.h>
    29.6  #define pt_regs cpu_user_regs
    29.7 +
    29.8 +/*  User regs at placed at the end of the vcpu area.
    29.9 +    Convert a vcpu pointer to a regs pointer.
   29.10 +    Note: this is the same as ia64_task_regs, but it uses a Xen-friendly name.
   29.11 +*/
   29.12 +struct vcpu;
   29.13 +static inline struct cpu_user_regs *
   29.14 +vcpu_regs (struct vcpu *v)
   29.15 +{
   29.16 +  return (struct cpu_user_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
   29.17 +}
   29.18 +
   29.19 +
   29.20  #else
   29.21  struct pt_regs {
   29.22  	/* The following registers are saved by SAVE_MIN: */
    30.1 --- a/xen/include/asm-ia64/linux/asm/cache.h	Sat Dec 03 12:21:27 2005 +0000
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,30 +0,0 @@
    30.4 -#ifndef _ASM_IA64_CACHE_H
    30.5 -#define _ASM_IA64_CACHE_H
    30.6 -
    30.7 -#include <linux/config.h>
    30.8 -
    30.9 -/*
   30.10 - * Copyright (C) 1998-2000 Hewlett-Packard Co
   30.11 - *	David Mosberger-Tang <davidm@hpl.hp.com>
   30.12 - */
   30.13 -
   30.14 -/* Bytes per L1 (data) cache line.  */
   30.15 -#define L1_CACHE_SHIFT		CONFIG_IA64_L1_CACHE_SHIFT
   30.16 -#define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
   30.17 -
   30.18 -#define L1_CACHE_SHIFT_MAX 7	/* largest L1 which this arch supports */
   30.19 -
   30.20 -#ifdef CONFIG_SMP
   30.21 -# define SMP_CACHE_SHIFT	L1_CACHE_SHIFT
   30.22 -# define SMP_CACHE_BYTES	L1_CACHE_BYTES
   30.23 -#else
   30.24 -  /*
   30.25 -   * The "aligned" directive can only _increase_ alignment, so this is
   30.26 -   * safe and provides an easy way to avoid wasting space on a
   30.27 -   * uni-processor:
   30.28 -   */
   30.29 -# define SMP_CACHE_SHIFT	3
   30.30 -# define SMP_CACHE_BYTES	(1 << 3)
   30.31 -#endif
   30.32 -
   30.33 -#endif /* _ASM_IA64_CACHE_H */
    31.1 --- a/xen/include/asm-ia64/privop.h	Sat Dec 03 12:21:27 2005 +0000
    31.2 +++ b/xen/include/asm-ia64/privop.h	Sat Dec 03 12:21:52 2005 +0000
    31.3 @@ -100,6 +100,11 @@ typedef union U_INST64_M36 {
    31.4      struct { unsigned long qp:6, r1:7, :14, x6:6, x3:3, :1, major:4; }; 
    31.5  } INST64_M36;
    31.6  
    31.7 +typedef union U_INST64_M37 {
    31.8 +    IA64_INST inst;
    31.9 +    struct { unsigned long qp:6, imm20a:20,:1, x4:4,x2:2,x3:3, i:1, major:4; };
   31.10 +} INST64_M37;
   31.11 +
   31.12  typedef union U_INST64_M41 {
   31.13      IA64_INST inst;
   31.14      struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; }; 
   31.15 @@ -190,6 +195,7 @@ typedef union U_INST64 {
   31.16      INST64_M33 M33;	// mov from cr
   31.17      INST64_M35 M35;	// mov to psr
   31.18      INST64_M36 M36;	// mov from psr
   31.19 +    INST64_M37 M37;	// break.m
   31.20      INST64_M41 M41;	// translation cache insert
   31.21      INST64_M42 M42;	// mov to indirect reg/translation reg insert
   31.22      INST64_M43 M43;	// mov from indirect reg
    32.1 --- a/xen/include/asm-ia64/vmx_vcpu.h	Sat Dec 03 12:21:27 2005 +0000
    32.2 +++ b/xen/include/asm-ia64/vmx_vcpu.h	Sat Dec 03 12:21:52 2005 +0000
    32.3 @@ -44,8 +44,6 @@
    32.4  #define VRN7    0x7UL
    32.5  // for vlsapic
    32.6  #define  VLSAPIC_INSVC(vcpu, i) ((vcpu)->arch.insvc[i])
    32.7 -// this def for vcpu_regs won't work if kernel stack is present
    32.8 -#define	vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1)
    32.9  //#define	VMX_VPD(x,y)	((x)->arch.arch_vmx.vpd->y)
   32.10  
   32.11  #define VMX(x,y)  ((x)->arch.arch_vmx.y)
    33.1 --- a/xen/include/asm-ia64/xenpage.h	Sat Dec 03 12:21:27 2005 +0000
    33.2 +++ b/xen/include/asm-ia64/xenpage.h	Sat Dec 03 12:21:52 2005 +0000
    33.3 @@ -8,7 +8,7 @@
    33.4  #undef pfn_valid
    33.5  #undef page_to_pfn
    33.6  #undef pfn_to_page
    33.7 -# define pfn_valid(_pfn)		((_pfn) > max_page)
    33.8 +# define pfn_valid(_pfn)	((_pfn) < max_page)
    33.9  # define page_to_pfn(_page)	((unsigned long) ((_page) - frame_table))
   33.10  # define pfn_to_page(_pfn)	(frame_table + (_pfn))
   33.11  
    34.1 --- a/xen/include/public/io/blkif.h	Sat Dec 03 12:21:27 2005 +0000
    34.2 +++ b/xen/include/public/io/blkif.h	Sat Dec 03 12:21:52 2005 +0000
    34.3 @@ -10,6 +10,7 @@
    34.4  #define __XEN_PUBLIC_IO_BLKIF_H__
    34.5  
    34.6  #include "ring.h"
    34.7 +#include "../grant_table.h"
    34.8  
    34.9  /*
   34.10   * Front->back notifications: When enqueuing a new request, sending a
    35.1 --- a/xen/include/public/io/netif.h	Sat Dec 03 12:21:27 2005 +0000
    35.2 +++ b/xen/include/public/io/netif.h	Sat Dec 03 12:21:52 2005 +0000
    35.3 @@ -10,6 +10,7 @@
    35.4  #define __XEN_PUBLIC_IO_NETIF_H__
    35.5  
    35.6  #include "ring.h"
    35.7 +#include "../grant_table.h"
    35.8  
    35.9  /*
   35.10   * Note that there is *never* any need to notify the backend when enqueuing
    36.1 --- a/xen/include/public/io/tpmif.h	Sat Dec 03 12:21:27 2005 +0000
    36.2 +++ b/xen/include/public/io/tpmif.h	Sat Dec 03 12:21:52 2005 +0000
    36.3 @@ -16,6 +16,8 @@
    36.4  #ifndef __XEN_PUBLIC_IO_TPMIF_H__
    36.5  #define __XEN_PUBLIC_IO_TPMIF_H__
    36.6  
    36.7 +#include "../grant_table.h"
    36.8 +
    36.9  typedef struct {
   36.10      unsigned long addr;   /* Machine address of packet.   */
   36.11      grant_ref_t ref;      /* grant table access reference */