From: Hollis Blanchard <hollisb@us.ibm.com>
To: Keir Fraser <keir.fraser@xensource.com>
Cc: xen-devel@lists.xensource.com, xen-ppc-devel@lists.xensource.com
Subject: [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code
Date: Thu, 05 Jul 2007 16:08:44 -0500 [thread overview]
Message-ID: <3ece3641ec01362c4333.1183669724@localhost> (raw)
In-Reply-To: <patchbomb.1183669719@localhost>
3 files changed, 28 insertions(+), 18 deletions(-)
arch/ia64/xen/hypervisor.c | 5 +++++
drivers/xen/core/gnttab.c | 39 +++++++++++++++++++++------------------
include/xen/gnttab.h | 2 ++
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183669279 18000
# Node ID 3ece3641ec01362c4333c74688a7f04ae4706ba4
# Parent 4d8b8e9dd58e1de258d7418f5dabf694501b1bd8
[XEN][LINUX] Refactor grant table allocation into arch-specific code.
In the future, x86 code should be moved out of drivers/xen/
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 4d8b8e9dd58e -r 3ece3641ec01 arch/ia64/xen/hypervisor.c
--- a/arch/ia64/xen/hypervisor.c Thu Jul 05 16:01:18 2007 -0500
+++ b/arch/ia64/xen/hypervisor.c Thu Jul 05 16:01:19 2007 -0500
@@ -408,6 +408,11 @@ __xen_destroy_contiguous_region(unsigned
#include <linux/mm.h>
#include <xen/interface/xen.h>
#include <xen/gnttab.h>
+
+void *arch_gnttab_alloc_shared(unsigned long *frames)
+{
+ return __va(frames[0] << PAGE_SHIFT);
+}
static void
gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
diff -r 4d8b8e9dd58e -r 3ece3641ec01 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c Thu Jul 05 16:01:18 2007 -0500
+++ b/drivers/xen/core/gnttab.c Thu Jul 05 16:01:19 2007 -0500
@@ -430,7 +430,8 @@ static inline unsigned int max_nr_grant_
#ifdef CONFIG_XEN
-#ifndef __ia64__
+#ifdef __x86__
+/* XXX Move this code. */
static int map_pte_fn(pte_t *pte, struct page *pmd_page,
unsigned long addr, void *data)
{
@@ -448,7 +449,22 @@ static int unmap_pte_fn(pte_t *pte, stru
set_pte_at(&init_mm, addr, pte, __pte(0));
return 0;
}
-#endif
+
+void *arch_gnttab_alloc_shared(unsigned long *frames)
+{
+ unsigned long *_frames = frames;
+ struct vm_struct *area;
+
+ area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
+ BUG_ON(area == NULL);
+
+ rc = apply_to_page_range(&init_mm, (unsigned long)area->addr,
+ PAGE_SIZE * nr_gframes,
+ map_pte_fn, &_frames);
+ BUG_ON(rc);
+ return area->addr;
+}
+#endif /* __x86__ */
static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{
@@ -473,21 +489,8 @@ static int gnttab_map(unsigned int start
BUG_ON(rc || setup.status);
-#ifndef __ia64__
- if (shared == NULL) {
- struct vm_struct *area;
- area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
- BUG_ON(area == NULL);
- shared = area->addr;
- }
- rc = apply_to_page_range(&init_mm, (unsigned long)shared,
- PAGE_SIZE * nr_gframes,
- map_pte_fn, &frames);
- BUG_ON(rc);
- frames -= nr_gframes; /* adjust after map_pte_fn() */
-#else
- shared = __va(frames[0] << PAGE_SHIFT);
-#endif
+ if (shared == NULL)
+ shared = arch_gnttab_alloc_shared(frames);
kfree(frames);
@@ -623,7 +626,7 @@ int gnttab_resume(void)
int gnttab_suspend(void)
{
-#ifndef __ia64__
+#ifdef CONFIG_X86
apply_to_page_range(&init_mm, (unsigned long)shared,
PAGE_SIZE * nr_grant_frames,
unmap_pte_fn, NULL);
diff -r 4d8b8e9dd58e -r 3ece3641ec01 include/xen/gnttab.h
--- a/include/xen/gnttab.h Thu Jul 05 16:01:18 2007 -0500
+++ b/include/xen/gnttab.h Thu Jul 05 16:01:19 2007 -0500
@@ -117,6 +117,8 @@ int gnttab_suspend(void);
int gnttab_suspend(void);
int gnttab_resume(void);
+void *arch_gnttab_alloc_shared(unsigned long *frames);
+
static inline void
gnttab_set_map_op(struct gnttab_map_grant_ref *map, maddr_t addr,
uint32_t flags, grant_ref_t ref, domid_t domid)
next prev parent reply other threads:[~2007-07-05 21:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-05 21:08 [PATCH 0 of 6] PowerPC Linux patches Hollis Blanchard
2007-07-05 21:08 ` [PATCH 1 of 6] [XEN][LINUX] Add Kconfig option for the balloon driver Hollis Blanchard
2007-07-05 21:08 ` [PATCH 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_* Hollis Blanchard
2007-07-05 21:08 ` [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure Hollis Blanchard
2007-07-05 21:29 ` Keir Fraser
2007-07-05 21:35 ` [XenPPC] " Hollis Blanchard
2007-07-05 21:44 ` Keir Fraser
2007-07-05 21:52 ` Hollis Blanchard
2007-07-05 21:08 ` [PATCH 4 of 6] [XEN][LINUX] #ifdef x86-specific alloc_vm_area() Hollis Blanchard
2007-07-05 21:38 ` Keir Fraser
2007-07-05 21:08 ` Hollis Blanchard [this message]
2007-07-05 21:08 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
2007-07-05 21:35 ` Keir Fraser
2007-07-05 21:41 ` [PATCH 0 of 6] PowerPC Linux patches Keir Fraser
2007-07-05 21:54 ` [XenPPC] " Hollis Blanchard
-- strict thread matches above, loose matches on Subject: below --
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
2007-07-05 22:27 ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code Hollis Blanchard
2007-07-06 13:16 ` Keir Fraser
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=3ece3641ec01362c4333.1183669724@localhost \
--to=hollisb@us.ibm.com \
--cc=keir.fraser@xensource.com \
--cc=xen-devel@lists.xensource.com \
--cc=xen-ppc-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.