diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2008-04-02 13:54:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-24 17:57:32 -0400 |
commit | 8d3d2106c19f4e69f208f59fe484ca113fbb48b3 (patch) | |
tree | 060b83ab832af7a5ca4bb672673dd9262f0ba3bc /drivers | |
parent | 5f0ababbf49f12330effab932a18055a50f4c0a1 (diff) |
xen: make grant table arch portable
split out x86 specific part from grant-table.c and
allow ia64/xen specific initialization.
ia64/xen grant table is based on pseudo physical address
(guest physical address) unlike x86/xen. On ia64 init_mm
doesn't map identity straight mapped area.
ia64/xen specific grant table initialization is necessary.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/grant-table.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 3e02808c4055..52b6b41b909d 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -439,24 +439,6 @@ static inline unsigned int max_nr_grant_frames(void) | |||
439 | return xen_max; | 439 | return xen_max; |
440 | } | 440 | } |
441 | 441 | ||
442 | static int map_pte_fn(pte_t *pte, struct page *pmd_page, | ||
443 | unsigned long addr, void *data) | ||
444 | { | ||
445 | unsigned long **frames = (unsigned long **)data; | ||
446 | |||
447 | set_pte_at(&init_mm, addr, pte, mfn_pte((*frames)[0], PAGE_KERNEL)); | ||
448 | (*frames)++; | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | static int unmap_pte_fn(pte_t *pte, struct page *pmd_page, | ||
453 | unsigned long addr, void *data) | ||
454 | { | ||
455 | |||
456 | set_pte_at(&init_mm, addr, pte, __pte(0)); | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) | 442 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) |
461 | { | 443 | { |
462 | struct gnttab_setup_table setup; | 444 | struct gnttab_setup_table setup; |
@@ -480,17 +462,9 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx) | |||
480 | 462 | ||
481 | BUG_ON(rc || setup.status); | 463 | BUG_ON(rc || setup.status); |
482 | 464 | ||
483 | if (shared == NULL) { | 465 | rc = arch_gnttab_map_shared(frames, nr_gframes, max_nr_grant_frames(), |
484 | struct vm_struct *area; | 466 | &shared); |
485 | area = xen_alloc_vm_area(PAGE_SIZE * max_nr_grant_frames()); | ||
486 | BUG_ON(area == NULL); | ||
487 | shared = area->addr; | ||
488 | } | ||
489 | rc = apply_to_page_range(&init_mm, (unsigned long)shared, | ||
490 | PAGE_SIZE * nr_gframes, | ||
491 | map_pte_fn, &frames); | ||
492 | BUG_ON(rc); | 467 | BUG_ON(rc); |
493 | frames -= nr_gframes; /* adjust after map_pte_fn() */ | ||
494 | 468 | ||
495 | kfree(frames); | 469 | kfree(frames); |
496 | 470 | ||
@@ -506,10 +480,7 @@ static int gnttab_resume(void) | |||
506 | 480 | ||
507 | static int gnttab_suspend(void) | 481 | static int gnttab_suspend(void) |
508 | { | 482 | { |
509 | apply_to_page_range(&init_mm, (unsigned long)shared, | 483 | arch_gnttab_unmap_shared(shared, nr_grant_frames); |
510 | PAGE_SIZE * nr_grant_frames, | ||
511 | unmap_pte_fn, NULL); | ||
512 | |||
513 | return 0; | 484 | return 0; |
514 | } | 485 | } |
515 | 486 | ||