From: Xiaofeng Ling <xiaofeng.ling@intel.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>,
Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] make gnttab.c can be used in para-driver for unmodified guest
Date: Mon, 05 Sep 2005 17:09:40 +0800 [thread overview]
Message-ID: <431C0B54.8080300@intel.com> (raw)
make gnttab.c can be used in para-driver for unmodified guest
changes are:
1. export one more symbols, include more files
2. A different implementation for setup grant table share page
use ioremap to map the physical address returned by hypercall.
3. remove static for gnttab_init so that it can be called from
module init function in event channel pci driver.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
diff -r 287d36b46fa3 linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Tue Aug 30 20:36:49 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Fri Sep 2 22:47:27 2005
@@ -17,9 +17,13 @@
#include <asm/fixmap.h>
#include <asm/uaccess.h>
#include <asm-xen/xen_proc.h>
+#include <xen-public/xen.h>
#include <asm-xen/linux-public/privcmd.h>
#include <asm-xen/gnttab.h>
#include <asm-xen/synch_bitops.h>
+#ifndef CONFIG_XEN
+#include <asm/io.h>
+#endif
#if 1
#define ASSERT(_p) \
@@ -47,6 +51,7 @@
EXPORT_SYMBOL(gnttab_release_grant_reference);
EXPORT_SYMBOL(gnttab_grant_foreign_access_ref);
EXPORT_SYMBOL(gnttab_grant_foreign_transfer_ref);
+EXPORT_SYMBOL(gnttab_request_free_callback);
#define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * PAGE_SIZE /
sizeof(grant_entry_t))
#define GNTTAB_LIST_END (NR_GRANT_ENTRIES + 1)
@@ -404,9 +409,19 @@
gnttab_resume(void)
{
gnttab_setup_table_t setup;
+#ifdef CONFIG_XEN
+ int i;
unsigned long frames[NR_GRANT_FRAMES];
- int i;
-
+#else
+ unsigned long *frames;
+ unsigned long alloc_xen_mmio(unsigned long len);
+ frames = (unsigned long *)alloc_xen_mmio(PAGE_SIZE * NR_GRANT_FRAMES);
+ shared = ioremap((unsigned long)frames, PAGE_SIZE * NR_GRANT_FRAMES);
+ if(!shared){
+ printk("error to ioremap gnttab share frames\n");
+ return -1;
+ }
+#endif
setup.dom = DOMID_SELF;
setup.nr_frames = NR_GRANT_FRAMES;
setup.frame_list = frames;
@@ -414,8 +429,10 @@
BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1)
!= 0);
BUG_ON(setup.status != 0);
+#ifdef CONFIG_XEN
for ( i = 0; i < NR_GRANT_FRAMES; i++ )
set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
+#endif
return 0;
}
@@ -423,22 +440,27 @@
int
gnttab_suspend(void)
{
+#ifdef CONFIG_XEN
int i;
for ( i = 0; i < NR_GRANT_FRAMES; i++ )
clear_fixmap(FIX_GNTTAB_END - i);
-
+#else
+ iounmap(shared);
+#endif
return 0;
}
-static int __init
+int __init
gnttab_init(void)
{
int i;
BUG_ON(gnttab_resume());
+#ifdef CONFIG_XEN
shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
+#endif
for ( i = 0; i < NR_GRANT_ENTRIES; i++ )
gnttab_list[i] = i + 1;
reply other threads:[~2005-09-05 9:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=431C0B54.8080300@intel.com \
--to=xiaofeng.ling@intel.com \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=m+Ian.Pratt@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.