diff -r a7aae84b171f -r 8e86098d98b8 linux-2.6-xen-sparse/drivers/xen/xenidc/Makefile
--- a/linux-2.6-xen-sparse/drivers/xen/xenidc/Makefile	Sun Nov 20 14:54:45 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenidc/Makefile	Sun Nov 20 17:28:25 2005
@@ -8,3 +8,5 @@
 xenidc-objs += xenidc_remote_buffer_reference.o
 xenidc-objs += xenidc_concatenate.o
 xenidc-objs += xenidc_wrapping.o
+xenidc-objs += xenidc_grant_table.o
+xenidc-objs += xenidc_vaddress.o
diff -r a7aae84b171f -r 8e86098d98b8 linux-2.6-xen-sparse/include/asm-xen/xenidc_remote_buffer_reference.h
--- a/linux-2.6-xen-sparse/include/asm-xen/xenidc_remote_buffer_reference.h	Sun Nov 20 14:54:45 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenidc_remote_buffer_reference.h	Sun Nov 20 17:28:25 2005
@@ -39,7 +39,8 @@
 
 typedef u32 xenidc_remote_buffer_reference_type;
 
-#define XENIDC_REMOTE_BUFFER_REFERENCE_TYPE_NULL 0
+#define XENIDC_REMOTE_BUFFER_REFERENCE_TYPE_NULL        0
+#define XENIDC_REMOTE_BUFFER_REFERENCE_TYPE_GRANT_TABLE 1
 
 #define XENIDC_REMOTE_BUFFER_REFERENCE_ACCESS_FLAGS_READ  1
 #define XENIDC_REMOTE_BUFFER_REFERENCE_ACCESS_FLAGS_WRITE 2
diff -r a7aae84b171f -r 8e86098d98b8 linux-2.6-xen-sparse/drivers/xen/xenidc/xenidc_grant_table.c
--- /dev/null	Sun Nov 20 14:54:45 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenidc/xenidc_grant_table.c	Sun Nov 20 17:28:25 2005
@@ -0,0 +1,335 @@
+/*****************************************************************************/
+/* Xen inter-domain communication grant table remote buffer reference type.  */
+/*                                                                           */
+/* Copyright (c) 2005 Harry Butterworth IBM Corporation                      */
+/*                                                                           */
+/* 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                   */
+/*                                                                           */
+/*****************************************************************************/
+/*****************************************************************************/
+/* Based on                                                                  */
+/*                                                                           */
+/* arch/xen/drivers/blkback/blkback.c                                        */
+/*                                                                           */
+/* original copyright notice follows...                                      */
+/*****************************************************************************/
+/******************************************************************************
+ * arch/xen/drivers/blkif/backend/main.c
+ * 
+ * Back-end of the driver for virtual block devices. This portion of the
+ * driver exports a 'unified' block-device interface that can be accessed
+ * by any operating system that implements a compatible front end. A 
+ * reference front-end implementation can be found in:
+ *  arch/xen/drivers/blkif/frontend
+ * 
+ * Copyright (c) 2003-2004, Keir Fraser & Steve Hand
+ * Copyright (c) 2005, Christopher Clark
+ */
+
+#include <asm-xen/xenidc_grant_table.h>
+#include <linux/module.h>
+#include "xenidc_trace.h"
+
+static int xenidc_grant_table_calculate_map_resources
+    (xenidc_buffer_mappable_class * class,
+     xenidc_remote_buffer_reference * rbr,
+     xenidc_address * address, xenidc_buffer_resource_list * list) {
+	trace();
+
+	{
+		int invalid_request = 0;
+
+		if ((rbr->byte_offset + rbr->byte_count)
+		    < (XENIDC_GRANT_TABLE_REFERENCE_COUNT * PAGE_SIZE)
+		    ) {
+			*list = xenidc_buffer_resource_list_null();
+
+			list->pages = 1;
+
+			list->empty_page_ranges = 1;
+
+			{
+				unsigned long first_page =
+				    rbr->byte_offset / PAGE_SIZE;
+				unsigned long final_page =
+				    (rbr->byte_offset + rbr->byte_count -
+				     1) / PAGE_SIZE;
+
+				list->empty_page_range_page_count =
+				    final_page - first_page + 1;
+			}
+		} else {
+			invalid_request = 1;
+		}
+
+		return invalid_request;
+	}
+}
+
+typedef struct xenidc_grant_table_mapping_context_struct
+ xenidc_grant_table_mapping_context;
+
+struct xenidc_grant_table_mapping_context_struct {
+	xenidc_buffer_mappable_class *class;
+	xenidc_buffer_resource_provider *provider;
+	unsigned long page_count;
+	unsigned long mmap_vaddress;
+	int16_t handle[XENIDC_GRANT_TABLE_REFERENCE_COUNT];
+};
+
+static void xenidc_grant_table_unmap_rbr
+    (xenidc_buffer_mappable_class ** context_in);
+
+static xenidc_buffer_mappable_class **xenidc_grant_table_map_rbr
+    (xenidc_buffer_mappable_class * class,
+     xenidc_remote_buffer_reference * rbr,
+     xenidc_address * address,
+     xenidc_buffer_resource_provider * provider,
+     void **mapping, int access_flags) {
+	trace();
+
+	{
+		xenidc_grant_table_mapping_context *context =
+		    xenidc_buffer_resource_provider_allocate_page(provider);
+
+		struct gnttab_map_grant_ref map
+		    [XENIDC_GRANT_TABLE_REFERENCE_COUNT];
+
+		unsigned long first_page = rbr->byte_offset / PAGE_SIZE;
+		unsigned long final_page =
+		    (rbr->byte_offset + rbr->byte_count - 1) / PAGE_SIZE;
+
+		context->class = class;
+
+		context->provider = provider;
+
+		context->page_count = final_page - first_page + 1;
+
+		context->mmap_vaddress =
+		    xenidc_buffer_resource_provider_allocate_empty_page_range
+		    (provider, context->page_count);
+
+		{
+			int i;
+
+			for (i = 0; i < context->page_count; i++) {
+				map[i].host_addr =
+				    context->mmap_vaddress + (i * PAGE_SIZE);
+				map[i].dom =
+				    xenidc_address_query_remote_domain_id
+				    (address);
+				map[i].ref =
+				    ((xenidc_grant_table_base *)&rbr->base)->
+				    reference[first_page + i];
+				map[i].flags =
+				    GNTMAP_host_map |
+				    (((access_flags &
+				       XENIDC_REMOTE_BUFFER_REFERENCE_ACCESS_FLAGS_WRITE)
+				      == 0)
+				     ? GNTMAP_readonly : 0);
+			}
+		}
+
+		{
+			int error = HYPERVISOR_grant_table_op
+			    (GNTTABOP_map_grant_ref, map, context->page_count);
+
+			BUG_ON(error);
+		}
+
+		{
+			int error = 0;
+
+			{
+				int i;
+
+				for (i = 0; i < context->page_count; i++) {
+					context->handle[i] = map[i].handle;
+
+					if (unlikely(map[i].handle < 0)) {
+						error = 1;
+					}
+				}
+			}
+
+			if (!error) {
+				int i;
+
+				for (i = 0; i < context->page_count; i++) {
+					set_phys_to_machine
+					    (__pa
+					     (context->mmap_vaddress +
+					      (i * PAGE_SIZE))
+					     >> PAGE_SHIFT,
+					     FOREIGN_FRAME(map[i].
+							   dev_bus_addr >>
+							   PAGE_SHIFT)
+					    );
+				}
+			} else {
+				xenidc_grant_table_unmap_rbr(&context->class);
+
+				context = NULL;
+			}
+		}
+
+		if (context != NULL) {
+			*mapping =
+			    (void *)(context->mmap_vaddress +
+				     (rbr->byte_offset % PAGE_SIZE));
+
+			return &context->class;
+		} else {
+			return NULL;
+		}
+	}
+}
+
+static void xenidc_grant_table_unmap_rbr
+    (xenidc_buffer_mappable_class ** context_in) {
+	trace();
+
+	{
+		xenidc_grant_table_mapping_context *context = container_of
+		    (context_in, xenidc_grant_table_mapping_context, class);
+
+		{
+			struct gnttab_unmap_grant_ref unmap
+			    [XENIDC_GRANT_TABLE_REFERENCE_COUNT];
+
+			int i;
+			int j;
+
+			for (i = 0, j = 0; i < context->page_count; i++) {
+				if (context->handle[i] >= 0) {
+					unmap[j].host_addr =
+					    context->mmap_vaddress +
+					    (i * PAGE_SIZE);
+					unmap[j].dev_bus_addr = 0;
+					unmap[j].handle = context->handle[i];
+
+					j++;
+				}
+			}
+
+			if (j != 0) {
+				int error = HYPERVISOR_grant_table_op
+				    (GNTTABOP_unmap_grant_ref, unmap, j);
+
+				BUG_ON(error);
+			}
+
+			for (i = 0; i < context->page_count; i++) {
+				/* Tidy this up to avoid                                     */
+				/* BUG_ON(phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY); */
+				/* in balloon.c                                              */
+
+				set_phys_to_machine
+				    (__pa
+				     (context->mmap_vaddress + (i * PAGE_SIZE))
+				     >> PAGE_SHIFT, INVALID_P2M_ENTRY);
+			}
+		}
+
+		xenidc_buffer_resource_provider_free_empty_page_range
+		    (context->provider, context->mmap_vaddress);
+
+		xenidc_buffer_resource_provider_free_page
+		    (context->provider, context);
+	}
+}
+
+static void xenidc_grant_table_init(void)
+{
+	trace();
+
+	{
+		static DEFINE_RWLOCK(xenidc_grant_table_lock);
+
+		unsigned long flags;
+
+		read_lock_irqsave(&xenidc_grant_table_lock, flags);
+
+		{
+			static int initialised = 0;
+
+			if (!initialised) {
+				read_unlock_irqrestore
+				    (&xenidc_grant_table_lock, flags);
+
+				write_lock_irqsave
+				    (&xenidc_grant_table_lock, flags);
+
+				if (!initialised) {
+					static xenidc_buffer_mappable_class
+					    xenidc_grant_table_mappable_class;
+
+					xenidc_remote_buffer_reference_register_buffer_mappable_class
+					    (&xenidc_grant_table_mappable_class,
+					     XENIDC_REMOTE_BUFFER_REFERENCE_TYPE_GRANT_TABLE,
+					     xenidc_grant_table_calculate_map_resources,
+					     xenidc_grant_table_map_rbr,
+					     xenidc_grant_table_unmap_rbr);
+
+					initialised = 1;
+				}
+
+				write_unlock_irqrestore
+				    (&xenidc_grant_table_lock, flags);
+
+				read_lock_irqsave
+				    (&xenidc_grant_table_lock, flags);
+			}
+		}
+
+		read_unlock_irqrestore(&xenidc_grant_table_lock, flags);
+	}
+}
+
+xenidc_buffer_resource_list xenidc_grant_table_calculate_buffer_resource_list
+    (xenidc_buffer_byte_count byte_count,
+     xenidc_buffer_byte_count byte_alignment) {
+	trace();
+
+	xenidc_grant_table_init();
+
+	{
+		xenidc_buffer_resource_list list =
+		    xenidc_buffer_resource_list_null();
+
+		if (byte_count > 0) {
+			list.pages = 1;
+			list.empty_page_ranges = 1;
+
+			{
+				xenidc_buffer_byte_count requested_page_count =
+				    ((((byte_alignment % PAGE_SIZE) +
+				       byte_count - 1)
+				      / PAGE_SIZE)
+				     + 1);
+
+				list.empty_page_range_page_count =
+				    ((requested_page_count
+				      < XENIDC_GRANT_TABLE_REFERENCE_COUNT)
+				     ? requested_page_count
+				     : XENIDC_GRANT_TABLE_REFERENCE_COUNT);
+			}
+		}
+
+		return list;
+	}
+}
+
+EXPORT_SYMBOL(xenidc_grant_table_calculate_buffer_resource_list);
diff -r a7aae84b171f -r 8e86098d98b8 linux-2.6-xen-sparse/drivers/xen/xenidc/xenidc_vaddress.c
--- /dev/null	Sun Nov 20 14:54:45 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenidc/xenidc_vaddress.c	Sun Nov 20 17:28:25 2005
@@ -0,0 +1,364 @@
+/*****************************************************************************/
+/* Xen inter-domain communication vaddress local buffer reference type.      */
+/*                                                                           */
+/* Copyright (c) 2005 Harry Butterworth IBM Corporation                      */
+/*                                                                           */
+/* 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                   */
+/*                                                                           */
+/*****************************************************************************/
+
+#include <asm-xen/xenidc_grant_table.h>
+#include <asm-xen/xenidc_vaddress.h>
+#include <linux/module.h>
+#include <linux/timer.h>
+#include "xenidc_trace.h"
+
+static xenidc_buffer_type xenidc_vaddress_type;
+
+static void xenidc_vaddress_copy_in_or_out
+    (xenidc_buffer_concrete_class * class,
+     xenidc_local_buffer_reference * lbr,
+     void *buffer, xenidc_buffer_byte_count byte_count, int out) {
+	trace();
+
+	if (out) {
+		memcpy(buffer, ((char *)lbr->base) + lbr->byte_offset,
+		       byte_count);
+	} else {
+		memcpy(((char *)lbr->base) + lbr->byte_offset, buffer,
+		       byte_count);
+	}
+}
+
+static void xenidc_vaddress_zero
+    (xenidc_buffer_concrete_class * class,
+     xenidc_local_buffer_reference * lbr) {
+	trace();
+
+	memset(((char *)lbr->base) + lbr->byte_offset, 0, lbr->byte_count);
+}
+
+static int xenidc_vaddress_calculate_rbr_resources
+    (xenidc_buffer_concrete_class * class,
+     xenidc_local_buffer_reference * lbr,
+     xenidc_address * address, xenidc_buffer_resource_list * list) {
+	trace();
+
+	*list = xenidc_buffer_resource_list_null();
+
+	{
+		unsigned long first_page =
+		    (((unsigned long)(((char *)lbr->base) + lbr->byte_offset))
+		     / PAGE_SIZE);
+
+		unsigned long final_page = (((unsigned long)
+					     (((char *)lbr->base) +
+					      lbr->byte_offset +
+					      lbr->byte_count - 1)
+					    )
+					    / PAGE_SIZE);
+
+		list->pages = 1;
+		list->grant_references = final_page - first_page + 1;
+
+		return
+		    (list->grant_references
+		     > XENIDC_GRANT_TABLE_REFERENCE_COUNT);
+	}
+}
+
+typedef struct xenidc_vaddress_rbr_context_struct xenidc_vaddress_rbr_context;
+
+struct xenidc_vaddress_rbr_context_struct {
+	xenidc_buffer_concrete_class *class;
+	xenidc_buffer_resource_provider *provider;
+	struct timer_list timer;
+	xenidc_callback *callback;
+	int domain_id;
+	int count;
+	grant_ref_t reference[XENIDC_GRANT_TABLE_REFERENCE_COUNT];
+};
+
+static xenidc_buffer_concrete_class **xenidc_vaddress_create_rbr
+    (xenidc_buffer_concrete_class * class,
+     xenidc_local_buffer_reference * lbr,
+     xenidc_address * address,
+     xenidc_buffer_resource_provider * provider,
+     xenidc_remote_buffer_reference * rbr, int access_flags) {
+	trace();
+
+	{
+		xenidc_vaddress_rbr_context *context =
+		    (xenidc_vaddress_rbr_context *)
+		    xenidc_buffer_resource_provider_allocate_page(provider);
+
+		context->class = class;
+		context->provider = provider;
+
+		context->domain_id =
+		    xenidc_address_query_remote_domain_id(address);
+
+		memset(rbr, 0, sizeof(*rbr));
+
+		rbr->type = XENIDC_REMOTE_BUFFER_REFERENCE_TYPE_GRANT_TABLE;
+
+		{
+			int i = 0;
+
+			unsigned long page =
+			    (((unsigned long)(((char *)lbr->base) +
+					      lbr->byte_offset))
+			     & PAGE_MASK);
+
+			unsigned long final_page = (((unsigned long)
+						     (((char *)lbr->base) +
+						      lbr->byte_offset +
+						      lbr->byte_count - 1)
+						    )
+						    & PAGE_MASK);
+
+			for (;;) {
+				((xenidc_grant_table_base *) & rbr->base)->
+				    reference[i] = context->reference[i] =
+				    xenidc_buffer_resource_provider_allocate_grant_reference
+				    (provider);
+
+				gnttab_grant_foreign_access_ref
+				    (context->reference[i],
+				     context->domain_id,
+				     virt_to_mfn(page),
+				     ((access_flags
+				       &
+				       XENIDC_LOCAL_BUFFER_REFERENCE_ACCESS_FLAGS_WRITE)
+				      == 0)
+				     ? 1 : 0);
+
+				i++;
+
+				if (page == final_page) {
+					break;
+				}
+
+				page += PAGE_SIZE;
+			}
+
+			context->count = i;
+		}
+
+		rbr->byte_offset =
+		    (unsigned long)(((char *)lbr->base) + lbr->byte_offset) &
+		    ~PAGE_MASK;
+
+		rbr->byte_count = lbr->byte_count;
+
+		return &context->class;
+	}
+}
+
+static void xenidc_vaddress_retry_revoke_rbr
+    (xenidc_vaddress_rbr_context * context);
+
+static void xenidc_vaddress_revoke_rbr
+    (xenidc_buffer_concrete_class ** context_in, xenidc_callback * callback) {
+	trace();
+
+	{
+		xenidc_vaddress_rbr_context *context =
+		    container_of(context_in, xenidc_vaddress_rbr_context,
+				 class);
+
+		context->callback = callback;
+
+		xenidc_vaddress_retry_revoke_rbr(context);
+	}
+}
+
+static void xenidc_vaddress_retry_revoke_rbr
+    (xenidc_vaddress_rbr_context * context) {
+	trace();
+
+	{
+		int i = 0;
+
+		while (i != context->count) {
+			if (gnttab_end_foreign_access_ref
+			    (context->reference[i], 0)) {
+				xenidc_buffer_resource_provider_free_grant_reference
+				    (context->provider, context->reference[i]
+				    );
+
+				{
+					int j;
+
+					for (j = i + 1; j < context->count; j++) {
+						context->reference[j - 1] =
+						    context->reference[j];
+					}
+				}
+
+				--context->count;
+			} else {
+				i++;
+			}
+		}
+
+		if (context->count == 0) {
+			xenidc_callback *callback = context->callback;
+
+			xenidc_buffer_resource_provider_free_page
+			    (context->provider, context);
+
+			xenidc_callback_success(callback);
+		} else {
+			printk
+			    (KERN_WARNING
+			     "xenidc_vaddress_revoke_rbr failed to end foreign access "
+			     "granted to domain id %d.  Will retry in 5 seconds.\n",
+			     context->domain_id);
+
+			init_timer(&context->timer);
+
+			context->timer.data = (unsigned long)context;
+			context->timer.expires = jiffies + (5 * HZ);
+			context->timer.function = (void (*)(unsigned long))
+			    xenidc_vaddress_retry_revoke_rbr;
+
+			add_timer(&context->timer);
+		}
+	}
+}
+
+static void xenidc_vaddress_copy
+    (xenidc_buffer_copy_class * class,
+     xenidc_local_buffer_reference * target,
+     xenidc_local_buffer_reference * source,
+     xenidc_buffer_byte_count byte_count) {
+	trace();
+
+	memcpy
+	    (((char *)target->base) + target->byte_offset,
+	     ((char *)source->base) + source->byte_offset, byte_count);
+}
+
+static void xenidc_vaddress_init(void)
+{
+	trace();
+
+	{
+		static DEFINE_RWLOCK(xenidc_vaddress_lock);
+
+		unsigned long flags;
+
+		read_lock_irqsave(&xenidc_vaddress_lock, flags);
+
+		{
+			static int initialised = 0;
+
+			if (!initialised) {
+				read_unlock_irqrestore
+				    (&xenidc_vaddress_lock, flags);
+
+				write_lock_irqsave
+				    (&xenidc_vaddress_lock, flags);
+
+				if (!initialised) {
+					static xenidc_buffer_concrete_class
+					    xenidc_vaddress_concrete_class;
+
+					static xenidc_buffer_copy_class
+					    xenidc_vaddress_copy_class;
+
+					xenidc_vaddress_type =
+					    xenidc_local_buffer_reference_register_buffer_concrete_class
+					    (&xenidc_vaddress_concrete_class,
+					     xenidc_vaddress_copy_in_or_out,
+					     xenidc_vaddress_zero,
+					     xenidc_vaddress_calculate_rbr_resources,
+					     xenidc_vaddress_create_rbr,
+					     xenidc_vaddress_revoke_rbr);
+
+					xenidc_local_buffer_reference_register_buffer_copy_class
+					    (&xenidc_vaddress_copy_class,
+					     xenidc_vaddress_type,
+					     xenidc_vaddress_type,
+					     xenidc_vaddress_copy);
+
+					initialised = 1;
+				}
+
+				write_unlock_irqrestore
+				    (&xenidc_vaddress_lock, flags);
+
+				read_lock_irqsave(&xenidc_vaddress_lock, flags);
+			}
+		}
+
+		read_unlock_irqrestore(&xenidc_vaddress_lock, flags);
+	}
+}
+
+xenidc_buffer_resource_list xenidc_vaddress_calculate_buffer_resource_list
+    (xenidc_buffer_byte_count byte_count,
+     xenidc_buffer_byte_count byte_alignment) {
+	trace();
+
+	xenidc_vaddress_init();
+
+	{
+		xenidc_buffer_resource_list list =
+		    xenidc_buffer_resource_list_null();
+
+		if (byte_count > 0) {
+			list.pages = 1;
+
+			{
+				xenidc_buffer_byte_count requested_page_count =
+				    ((((byte_alignment % PAGE_SIZE) +
+				       byte_count - 1)
+				      / PAGE_SIZE)
+				     + 1);
+
+				list.grant_references =
+				    ((requested_page_count
+				      < XENIDC_GRANT_TABLE_REFERENCE_COUNT)
+				     ? requested_page_count
+				     : XENIDC_GRANT_TABLE_REFERENCE_COUNT);
+			}
+		}
+
+		return list;
+	}
+}
+
+xenidc_local_buffer_reference xenidc_vaddress_create_lbr
+    (void *address, xenidc_buffer_byte_count byte_count) {
+	trace();
+
+	xenidc_vaddress_init();
+
+	{
+		xenidc_local_buffer_reference lbr;
+
+		lbr.type = xenidc_vaddress_type;
+		lbr.base = address;
+		lbr.byte_offset = 0;
+		lbr.byte_count = byte_count;
+
+		return lbr;
+	}
+}
+
+EXPORT_SYMBOL(xenidc_vaddress_calculate_buffer_resource_list);
+EXPORT_SYMBOL(xenidc_vaddress_create_lbr);
diff -r a7aae84b171f -r 8e86098d98b8 linux-2.6-xen-sparse/include/asm-xen/xenidc_grant_table.h
--- /dev/null	Sun Nov 20 14:54:45 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenidc_grant_table.h	Sun Nov 20 17:28:25 2005
@@ -0,0 +1,64 @@
+/*****************************************************************************/
+/* Support for remote buffer references of type grant-table.                 */
+/*                                                                           */
+/* Copyright (c) 2005 Harry Butterworth IBM Corporation                      */
+/*                                                                           */
+/* 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                   */
+/*                                                                           */
+/*****************************************************************************/
+/*                                                                           */
+/* This type of remote buffer reference is used for example for granting     */
+/* access to vaddress type local buffers of up-to 16 pages when the remote   */
+/* domain is on the same physical node. At the time of writing this comment  */
+/* this meets all the requirements of the only client of xenidc so this is   */
+/* the only type of remote buffer reference.                                 */
+/* Other types would be required for larger buffers (perhaps a type which    */
+/* used a grant-reference to reference a table of grant-references in the    */
+/* remote domain).  Other types would also be required for domains on remote */
+/* nodes.                                                                    */
+
+#ifndef XENIDC_GRANT_TABLE_H
+#define XENIDC_GRANT_TABLE_H
+
+#include <asm-xen/gnttab.h>
+#include "xenidc_remote_buffer_reference.h"
+
+/* At the moment, the vaddress type lbr code just creates these directly.    */
+/* If more lbr types start to create rbrs of this type we'd want to move the */
+/* common code into the .c file and provide an interface for creation here.  */
+/*                                                                           */
+/* The interface for mapping these rbrs is registered with the remote buffer */
+/* reference code.                                                           */
+
+#define XENIDC_GRANT_TABLE_REFERENCE_COUNT \
+( XENIDC_REMOTE_BUFFER_REFERENCE_BASE_BYTE_COUNT / sizeof( grant_ref_t ) )
+
+typedef struct xenidc_grant_table_base_struct xenidc_grant_table_base;
+
+struct xenidc_grant_table_base_struct
+{
+    grant_ref_t reference[ XENIDC_GRANT_TABLE_REFERENCE_COUNT ];
+};
+
+/* xenidc_grant_table_calculate_buffer_resource_list returns the worst-case  */
+/* resource requirements for mapping an RBR of type grant_table into the     */
+/* local address space given the size and alignment specified.               */
+
+extern xenidc_buffer_resource_list
+    xenidc_grant_table_calculate_buffer_resource_list
+    (xenidc_buffer_byte_count byte_count,
+     xenidc_buffer_byte_count byte_alignment);
+
+#endif
diff -r a7aae84b171f -r 8e86098d98b8 linux-2.6-xen-sparse/include/asm-xen/xenidc_vaddress.h
--- /dev/null	Sun Nov 20 14:54:45 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenidc_vaddress.h	Sun Nov 20 17:28:25 2005
@@ -0,0 +1,44 @@
+/*****************************************************************************/
+/* Support for local buffer references of type vaddress which represent      */
+/* buffers in the kernel virtual address space.                              */
+/*                                                                           */
+/* Copyright (c) 2005 Harry Butterworth IBM Corporation                      */
+/*                                                                           */
+/* 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                   */
+/*                                                                           */
+/*****************************************************************************/
+
+#ifndef XENIDC_VADDRESS_H
+#define XENIDC_VADDRESS_H
+
+#include "xenidc_local_buffer_reference.h"
+
+/* xenidc_vaddress_calculate_buffer_resource_list calculates the worst-case  */
+/* resource requirements for creating an RBR from an LBR of type vaddress of */
+/* size and alignment as specified.                                          */
+
+extern xenidc_buffer_resource_list
+    xenidc_vaddress_calculate_buffer_resource_list
+    (xenidc_buffer_byte_count byte_count,
+     xenidc_buffer_byte_count byte_alignment);
+
+/* xenidc_vaddress_create_lbr returns an LBR of type vaddress which          */
+/* references the extent of the kernel virtual address space described by    */
+/* the parameters.                                                           */
+
+extern xenidc_local_buffer_reference xenidc_vaddress_create_lbr
+    (void *address, xenidc_buffer_byte_count byte_count);
+
+#endif