aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-08-31 18:23:28 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-08-31 18:23:28 +0100
commit5bfcf44bb87e78e1f48661c4fdd8a73754cab126 (patch)
tree33cc3bd4fdb5a900140162b8652ef41fd9337ee4
parentd34bad56fc582e1ee1428970db0b6da3714a3aaf (diff)
downloadxen-5bfcf44bb87e78e1f48661c4fdd8a73754cab126.tar.gz
xen-5bfcf44bb87e78e1f48661c4fdd8a73754cab126.tar.bz2
xen-5bfcf44bb87e78e1f48661c4fdd8a73754cab126.zip
[LINUX] Remove vm_map_xen_pages(), clean up __direct_remap_page_range.
Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r--linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c42
-rw-r--r--linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c51
2 files changed, 36 insertions, 57 deletions
diff --git a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
index 446cbd6901..2fac26719c 100644
--- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
+++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
@@ -22,15 +22,6 @@
#define ISA_START_ADDRESS 0x0
#define ISA_END_ADDRESS 0x100000
-#if 0 /* not PAE safe */
-/* These hacky macros avoid phys->machine translations. */
-#define __direct_pte(x) ((pte_t) { (x) } )
-#define __direct_mk_pte(page_nr,pgprot) \
- __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
-#define direct_mk_pte_phys(physpage, pgprot) \
- __direct_mk_pte((physpage) >> PAGE_SHIFT, pgprot)
-#endif
-
static int direct_remap_area_pte_fn(pte_t *pte,
struct page *pmd_page,
unsigned long address,
@@ -66,17 +57,16 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
for (i = 0; i < size; i += PAGE_SIZE) {
if ((v - u) == (PAGE_SIZE / sizeof(mmu_update_t))) {
- /* Fill in the PTE pointers. */
+ /* Flush a full batch after filling in the PTE ptrs. */
rc = apply_to_page_range(mm, start_address,
address - start_address,
direct_remap_area_pte_fn, &w);
if (rc)
goto out;
- w = u;
rc = -EFAULT;
if (HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0)
goto out;
- v = u;
+ v = w = u;
start_address = address;
}
@@ -92,7 +82,7 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
}
if (v != u) {
- /* get the ptep's filled in */
+ /* Final batch. */
rc = apply_to_page_range(mm, start_address,
address - start_address,
direct_remap_area_pte_fn, &w);
@@ -179,32 +169,6 @@ int touch_pte_range(struct mm_struct *mm,
EXPORT_SYMBOL(touch_pte_range);
-void *vm_map_xen_pages (unsigned long maddr, int vm_size, pgprot_t prot)
-{
- int error;
-
- struct vm_struct *vma;
- vma = get_vm_area (vm_size, VM_IOREMAP);
-
- if (vma == NULL) {
- printk ("ioremap.c,vm_map_xen_pages(): "
- "Failed to get VMA area\n");
- return NULL;
- }
-
- error = direct_kernel_remap_pfn_range((unsigned long) vma->addr,
- maddr >> PAGE_SHIFT, vm_size,
- prot, DOMID_SELF );
- if (error == 0) {
- return vma->addr;
- } else {
- printk ("ioremap.c,vm_map_xen_pages(): "
- "Failed to map xen shared pages into kernel space\n");
- return NULL;
- }
-}
-EXPORT_SYMBOL(vm_map_xen_pages);
-
/*
* Does @address reside within a non-highmem page that is local to this virtual
* machine (i.e., not an I/O page, nor a memory page belonging to another VM).
diff --git a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
index 34f4d97260..de6ef0862e 100644
--- a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
+++ b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -34,8 +34,6 @@
static int xenoprof_start(void);
static void xenoprof_stop(void);
-void * vm_map_xen_pages(unsigned long maddr, int vm_size, pgprot_t prot);
-
static int xenoprof_enabled = 0;
static unsigned int num_events = 0;
static int is_primary = 0;
@@ -373,9 +371,9 @@ static int xenoprof_set_passive(int * p_domains,
{
int ret;
int i, j;
- int vm_size;
int npages;
struct xenoprof_buf *buf;
+ struct vm_struct *area;
pgprot_t prot = __pgprot(_KERNPG_TABLE);
if (!is_primary)
@@ -391,20 +389,30 @@ static int xenoprof_set_passive(int * p_domains,
for (i = 0; i < pdoms; i++) {
passive_domains[i].domain_id = p_domains[i];
passive_domains[i].max_samples = 2048;
- ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive, &passive_domains[i]);
+ ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive,
+ &passive_domains[i]);
if (ret)
- return ret;
+ goto out;
npages = (passive_domains[i].bufsize * passive_domains[i].nbuf - 1) / PAGE_SIZE + 1;
- vm_size = npages * PAGE_SIZE;
- p_shared_buffer[i] = (char *)vm_map_xen_pages(passive_domains[i].buf_maddr,
- vm_size, prot);
- if (!p_shared_buffer[i]) {
+ area = get_vm_area(npages * PAGE_SIZE, VM_IOREMAP);
+ if (area == NULL) {
ret = -ENOMEM;
goto out;
}
+ ret = direct_kernel_remap_pfn_range(
+ (unsigned long)area->addr,
+ passive_domains[i].buf_maddr >> PAGE_SHIFT,
+ npages * PAGE_SIZE, prot, DOMID_SELF);
+ if (ret) {
+ vunmap(area->addr);
+ goto out;
+ }
+
+ p_shared_buffer[i] = area->addr;
+
for (j = 0; j < passive_domains[i].nbuf; j++) {
buf = (struct xenoprof_buf *)
&p_shared_buffer[i][j * passive_domains[i].bufsize];
@@ -473,11 +481,9 @@ static int using_xenoprof;
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
struct xenoprof_init init;
- struct xenoprof_buf * buf;
- int vm_size;
- int npages;
- int ret;
- int i;
+ struct xenoprof_buf *buf;
+ int npages, ret, i;
+ struct vm_struct *area;
init.max_samples = 16;
ret = HYPERVISOR_xenoprof_op(XENOPROF_init, &init);
@@ -495,15 +501,24 @@ int __init oprofile_arch_init(struct oprofile_operations * ops)
num_events = OP_MAX_COUNTER;
npages = (init.bufsize * nbuf - 1) / PAGE_SIZE + 1;
- vm_size = npages * PAGE_SIZE;
- shared_buffer = (char *)vm_map_xen_pages(init.buf_maddr,
- vm_size, prot);
- if (!shared_buffer) {
+ area = get_vm_area(npages * PAGE_SIZE, VM_IOREMAP);
+ if (area == NULL) {
ret = -ENOMEM;
goto out;
}
+ ret = direct_kernel_remap_pfn_range(
+ (unsigned long)area->addr,
+ init.buf_maddr >> PAGE_SHIFT,
+ npages * PAGE_SIZE, prot, DOMID_SELF);
+ if (ret) {
+ vunmap(area->addr);
+ goto out;
+ }
+
+ shared_buffer = area->addr;
+
for (i=0; i< nbuf; i++) {
buf = (struct xenoprof_buf*)
&shared_buffer[i * init.bufsize];