WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [HVM] pv drivers: Allocate hypercall area

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM] pv drivers: Allocate hypercall area as an executable region.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 08 Sep 2006 21:00:24 +0000
Delivery-date: Fri, 08 Sep 2006 14:00:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 655281bca306a06bbc88bcb19a7a603fc4b5684b
# Parent  8013b84df1ac0810ff7de34dcafcd6b36b4bd664
[HVM] pv drivers: Allocate hypercall area as an executable region.
We have to use __vmalloc() and __PAGE_KERNEL because vmalloc_exec()
and PAGE_KERNEL_EXEC are not exported to modules.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c |   32 +++++++--------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff -r 8013b84df1ac -r 655281bca306 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Fri Sep 08 
18:55:53 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Fri Sep 08 
19:15:11 2006 +0100
@@ -17,6 +17,7 @@
  * Place - Suite 330, Boston, MA 02111-1307 USA.
  *
  */
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -25,6 +26,8 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/interrupt.h>
+#include <linux/vmalloc.h>
+#include <linux/mm.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -47,7 +50,6 @@ MODULE_DESCRIPTION("Xen platform PCI dev
 MODULE_DESCRIPTION("Xen platform PCI device");
 MODULE_LICENSE("GPL");
 
-
 unsigned long *phys_to_machine_mapping;
 EXPORT_SYMBOL(phys_to_machine_mapping);
 
@@ -118,7 +120,7 @@ unsigned long alloc_xen_mmio(unsigned lo
 /* Lifted from hvmloader.c */
 static int get_hypercall_stubs(void)
 {
-       uint32_t eax, ebx, ecx, edx, pages, msr, order, i;
+       uint32_t eax, ebx, ecx, edx, pages, msr, i;
        char signature[13];
 
        cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
@@ -141,22 +143,22 @@ static int get_hypercall_stubs(void)
 
        cpuid(0x40000002, &pages, &msr, &ecx, &edx);
 
-       i = pages - 1;
-       for (order = 0; i != 0; order++)
-               i >>= 1;
-
-       printk(KERN_INFO "Hypercall area is %u pages (order %u allocation)\n",
-              pages, order);
-
-       hypercall_stubs = (void *)__get_free_pages(GFP_KERNEL, order);
+       printk(KERN_INFO "Hypercall area is %u pages.\n", pages);
+
+       /* Use __vmalloc() because vmalloc_exec() is not an exported symbol. */
+       /* PAGE_KERNEL_EXEC also is not exported, hence we use PAGE_KERNEL. */
+       /* hypercall_stubs = vmalloc_exec(pages * PAGE_SIZE); */
+       hypercall_stubs = __vmalloc(pages * PAGE_SIZE,
+                                   GFP_KERNEL | __GFP_HIGHMEM,
+                                   __pgprot(__PAGE_KERNEL & ~_PAGE_NX));
        if (hypercall_stubs == NULL)
                return -ENOMEM;
 
-       for (i = 0; i < pages; i++)
-               wrmsrl(msr,
-                      virt_to_phys(hypercall_stubs) +  /* base address      */
-                      (i << PAGE_SHIFT) +              /* offset of page @i */
-                      i);                              /* request page @i   */
+       for (i = 0; i < pages; i++) {
+               unsigned long pfn;
+               pfn = vmalloc_to_pfn((char *)hypercall_stubs + i*PAGE_SIZE);
+               wrmsrl(msr, ((u64)pfn << PAGE_SHIFT) + i);
+       }
 
        return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [HVM] pv drivers: Allocate hypercall area as an executable region., Xen patchbot-unstable <=