diff options
Diffstat (limited to 'arch/powerpc/mm/mem.c')
-rw-r--r-- | arch/powerpc/mm/mem.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 59736317bf0e..0f594d774bf7 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <linux/gfp.h> | ||
25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
26 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
27 | #include <linux/stddef.h> | 28 | #include <linux/stddef.h> |
@@ -32,6 +33,7 @@ | |||
32 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
33 | #include <linux/suspend.h> | 34 | #include <linux/suspend.h> |
34 | #include <linux/lmb.h> | 35 | #include <linux/lmb.h> |
36 | #include <linux/hugetlb.h> | ||
35 | 37 | ||
36 | #include <asm/pgalloc.h> | 38 | #include <asm/pgalloc.h> |
37 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
@@ -47,6 +49,7 @@ | |||
47 | #include <asm/sparsemem.h> | 49 | #include <asm/sparsemem.h> |
48 | #include <asm/vdso.h> | 50 | #include <asm/vdso.h> |
49 | #include <asm/fixmap.h> | 51 | #include <asm/fixmap.h> |
52 | #include <asm/swiotlb.h> | ||
50 | 53 | ||
51 | #include "mmu_decl.h" | 54 | #include "mmu_decl.h" |
52 | 55 | ||
@@ -319,6 +322,11 @@ void __init mem_init(void) | |||
319 | struct page *page; | 322 | struct page *page; |
320 | unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize; | 323 | unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize; |
321 | 324 | ||
325 | #ifdef CONFIG_SWIOTLB | ||
326 | if (ppc_swiotlb_enable) | ||
327 | swiotlb_init(1); | ||
328 | #endif | ||
329 | |||
322 | num_physpages = lmb.memory.size >> PAGE_SHIFT; | 330 | num_physpages = lmb.memory.size >> PAGE_SHIFT; |
323 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); | 331 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); |
324 | 332 | ||
@@ -417,18 +425,26 @@ EXPORT_SYMBOL(flush_dcache_page); | |||
417 | 425 | ||
418 | void flush_dcache_icache_page(struct page *page) | 426 | void flush_dcache_icache_page(struct page *page) |
419 | { | 427 | { |
428 | #ifdef CONFIG_HUGETLB_PAGE | ||
429 | if (PageCompound(page)) { | ||
430 | flush_dcache_icache_hugepage(page); | ||
431 | return; | ||
432 | } | ||
433 | #endif | ||
420 | #ifdef CONFIG_BOOKE | 434 | #ifdef CONFIG_BOOKE |
421 | void *start = kmap_atomic(page, KM_PPC_SYNC_ICACHE); | 435 | { |
422 | __flush_dcache_icache(start); | 436 | void *start = kmap_atomic(page, KM_PPC_SYNC_ICACHE); |
423 | kunmap_atomic(start, KM_PPC_SYNC_ICACHE); | 437 | __flush_dcache_icache(start); |
438 | kunmap_atomic(start, KM_PPC_SYNC_ICACHE); | ||
439 | } | ||
424 | #elif defined(CONFIG_8xx) || defined(CONFIG_PPC64) | 440 | #elif defined(CONFIG_8xx) || defined(CONFIG_PPC64) |
425 | /* On 8xx there is no need to kmap since highmem is not supported */ | 441 | /* On 8xx there is no need to kmap since highmem is not supported */ |
426 | __flush_dcache_icache(page_address(page)); | 442 | __flush_dcache_icache(page_address(page)); |
427 | #else | 443 | #else |
428 | __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT); | 444 | __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT); |
429 | #endif | 445 | #endif |
430 | |||
431 | } | 446 | } |
447 | |||
432 | void clear_user_page(void *page, unsigned long vaddr, struct page *pg) | 448 | void clear_user_page(void *page, unsigned long vaddr, struct page *pg) |
433 | { | 449 | { |
434 | clear_page(page); | 450 | clear_page(page); |
@@ -485,13 +501,13 @@ EXPORT_SYMBOL(flush_icache_user_range); | |||
485 | * This must always be called with the pte lock held. | 501 | * This must always be called with the pte lock held. |
486 | */ | 502 | */ |
487 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, | 503 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, |
488 | pte_t pte) | 504 | pte_t *ptep) |
489 | { | 505 | { |
490 | #ifdef CONFIG_PPC_STD_MMU | 506 | #ifdef CONFIG_PPC_STD_MMU |
491 | unsigned long access = 0, trap; | 507 | unsigned long access = 0, trap; |
492 | 508 | ||
493 | /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */ | 509 | /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */ |
494 | if (!pte_young(pte) || address >= TASK_SIZE) | 510 | if (!pte_young(*ptep) || address >= TASK_SIZE) |
495 | return; | 511 | return; |
496 | 512 | ||
497 | /* We try to figure out if we are coming from an instruction | 513 | /* We try to figure out if we are coming from an instruction |