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]blkfront change to support unmodified linux
Date: Mon, 05 Sep 2005 13:41:11 +0800 [thread overview]
Message-ID: <431BDA77.4020205@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
This patch is to make blkfront can work both in xen-linux and in
unmodified guest which is shadow_model_translate enabled.
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/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -511,7 +511,7 @@
FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);
err = gnttab_grant_foreign_access(info->backend_id,
- virt_to_mfn(info->ring.sring), 0);
+ virt_to_xfn(info->ring.sring), 0);
if (err == -ENOSPC) {
free_page((unsigned long)info->ring.sring);
info->ring.sring = 0;
diff -r 287d36b46fa3 linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
@@ -101,7 +101,17 @@
* Change "struct page" to physical address.
*/
#define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) <<
PAGE_SHIFT)
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
#define page_to_phys(page) (phys_to_machine(page_to_pseudophys(page)))
+#else
+#define page_to_phys(page) (page_to_pseudophys(page))
+#endif
+
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
+#define virt_to_xfn(va) (virt_to_mfn(va))
+#else
+#define virt_to_xfn(va) (virt_to_phys(va) >> PAGE_SHIFT)
+#endif
#define bio_to_pseudophys(bio) (page_to_pseudophys(bio_page((bio))) + \
(unsigned long) bio_offset((bio)))
[-- Attachment #2: vbd-blkfront.patch --]
[-- Type: text/x-patch, Size: 1395 bytes --]
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Tue Aug 30 20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Fri Sep 2 22:47:27 2005
@@ -511,7 +511,7 @@
FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);
err = gnttab_grant_foreign_access(info->backend_id,
- virt_to_mfn(info->ring.sring), 0);
+ virt_to_xfn(info->ring.sring), 0);
if (err == -ENOSPC) {
free_page((unsigned long)info->ring.sring);
info->ring.sring = 0;
diff -r 287d36b46fa3 linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h Tue Aug 30 20:36:49 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h Fri Sep 2 22:47:27 2005
@@ -101,7 +101,17 @@
* Change "struct page" to physical address.
*/
#define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
#define page_to_phys(page) (phys_to_machine(page_to_pseudophys(page)))
+#else
+#define page_to_phys(page) (page_to_pseudophys(page))
+#endif
+
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
+#define virt_to_xfn(va) (virt_to_mfn(va))
+#else
+#define virt_to_xfn(va) (virt_to_phys(va) >> PAGE_SHIFT)
+#endif
#define bio_to_pseudophys(bio) (page_to_pseudophys(bio_page((bio))) + \
(unsigned long) bio_offset((bio)))
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2005-09-05 5:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-05 5:41 Xiaofeng Ling [this message]
2005-09-05 8:55 ` [PATCH]blkfront change to support unmodified linux Keir Fraser
2005-09-05 9:02 ` Xiaofeng Ling
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=431BDA77.4020205@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.