mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: jeremy@goop.org
Cc: chrisw@sous-sol.org, sct@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, xen-ia64-devel@lists.xensource.com,
	eddie.dong@intel.com, yamahata@valinux.co.jp
Subject: [PATCH 10/12] xen: replace callers of alloc_vm_area()/free_vm_area() with xen_ prefixed one.
Date: Fri, 28 Mar 2008 20:40:16 +0900	[thread overview]
Message-ID: <1206704418191-git-send-email-yamahata@valinux.co.jp> (raw)
In-Reply-To: <12067044183207-git-send-email-yamahata@valinux.co.jp>

Don't use alloc_vm_area()/free_vm_area() directly, instead define
xen_alloc_vm_area()/xen_free_vm_area() and use them.

alloc_vm_area()/free_vm_area() are used to allocate/free area which
are for grant table mapping. Xen/x86 grant table is based on virtual
address so that alloc_vm_area()/free_vm_area() are suitable.
On the other hand Xen/ia64 (and Xen/powerpc) grant table is based on
pseudo physical address (guest physical address) so that allocation
should be done differently.
The original version of xenified Linux/IA64 have its own
allocate_vm_area()/free_vm_area() definitions which don't allocate vm area
contradictory to those names.
Now vanilla Linux already has its definitions so that it's impossible
to have IA64 definitions of allocate_vm_area()/free_vm_area().
Instead introduce xen_allocate_vm_area()/xen_free_vm_area() and use them.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 drivers/xen/grant-table.c          |    2 +-
 drivers/xen/xenbus/xenbus_client.c |    6 +++---
 include/asm-x86/xen/hypervisor.h   |    3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 95016fd..9fcde20 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -478,7 +478,7 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
 
 	if (shared == NULL) {
 		struct vm_struct *area;
-		area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
+		area = xen_alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
 		BUG_ON(area == NULL);
 		shared = area->addr;
 	}
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 9fd2f70..0f86b0f 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -399,7 +399,7 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
 
 	*vaddr = NULL;
 
-	area = alloc_vm_area(PAGE_SIZE);
+	area = xen_alloc_vm_area(PAGE_SIZE);
 	if (!area)
 		return -ENOMEM;
 
@@ -409,7 +409,7 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
 		BUG();
 
 	if (op.status != GNTST_okay) {
-		free_vm_area(area);
+		xen_free_vm_area(area);
 		xenbus_dev_fatal(dev, op.status,
 				 "mapping in shared page %d from domain %d",
 				 gnt_ref, dev->otherend_id);
@@ -508,7 +508,7 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
 		BUG();
 
 	if (op.status == GNTST_okay)
-		free_vm_area(area);
+		xen_free_vm_area(area);
 	else
 		xenbus_dev_error(dev, op.status,
 				 "unmapping page at handle %d error %d",
diff --git a/include/asm-x86/xen/hypervisor.h b/include/asm-x86/xen/hypervisor.h
index 767a361..31e526d 100644
--- a/include/asm-x86/xen/hypervisor.h
+++ b/include/asm-x86/xen/hypervisor.h
@@ -57,6 +57,9 @@ extern struct shared_info *HYPERVISOR_shared_info;
 extern struct start_info *xen_start_info;
 #define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
 
+#define xen_alloc_vm_area(size)	alloc_vm_area(size)
+#define xen_free_vm_area(area)	free_vm_area(area)
+
 /* arch/i386/mach-xen/evtchn.c */
 /* Force a proper event-channel callback from Xen. */
 extern void force_evtchn_callback(void);
-- 
1.5.3


  parent reply	other threads:[~2008-03-28 11:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-28 11:40 [PATCH 00/12] Xen arch portability patches (take 4) Isaku Yamahata
2008-03-28 11:40 ` [PATCH 01/12] xen: add missing __HYPERVISOR_arch_[0-7] definisions which ia64 needs Isaku Yamahata
2008-03-28 11:40 ` [PATCH 02/12] xen: add missing VIRQ_ARCH_[0-7] definitions which ia64/xen needs Isaku Yamahata
2008-03-28 11:40 ` [PATCH 03/12] xen: add missing definitions for xen grant table " Isaku Yamahata
2008-03-28 11:40 ` [PATCH 04/12] xen: add missing definitions in include/xen/interface/vcpu.h " Isaku Yamahata
2008-03-28 11:40 ` [PATCH 05/12] xen: move features.c from arch/x86/xen/features.c to drivers/xen Isaku Yamahata
2008-03-28 11:40 ` [PATCH 06/12] xen: Move events.c to drivers/xen for IA64/Xen support Isaku Yamahata
2008-03-28 11:40 ` [PATCH 07/12] Xen: Make events.c portable for ia64/xen support Isaku Yamahata
2008-03-28 20:27   ` Jeremy Fitzhardinge
2008-03-31  9:34     ` Isaku Yamahata
2008-03-28 11:40 ` [PATCH 08/12] xen: add resend_irq_on_evtchn() definition into events.c Isaku Yamahata
2008-03-28 20:29   ` Jeremy Fitzhardinge
2008-03-31  9:36     ` Isaku Yamahata
2008-03-28 11:40 ` [PATCH 09/12] xen: make include/xen/page.h portable moving those definitions under asm dir Isaku Yamahata
2008-03-28 20:41   ` Jeremy Fitzhardinge
2008-03-30 13:41     ` Avi Kivity
2008-03-28 11:40 ` Isaku Yamahata [this message]
2008-03-28 20:31   ` [PATCH 10/12] xen: replace callers of alloc_vm_area()/free_vm_area() with xen_ prefixed one Jeremy Fitzhardinge
2008-03-31 10:11     ` Isaku Yamahata
2008-03-28 11:40 ` [PATCH 11/12] xen: make grant table arch portable Isaku Yamahata
2008-03-28 11:40 ` [PATCH 12/12] xen: import arch generic part of xencomm Isaku Yamahata
2008-03-28 20:09   ` Jeremy Fitzhardinge
2008-03-31  9:49     ` Isaku Yamahata
2008-03-31 15:01       ` Jeremy Fitzhardinge

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=1206704418191-git-send-email-yamahata@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --cc=chrisw@sous-sol.org \
    --cc=eddie.dong@intel.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-ia64-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®