KVM: PPC: cache flush for kernel managed pages
authorBharat Bhushan <Bharat.Bhushan@freescale.com>
Thu, 25 Apr 2013 06:33:57 +0000 (06:33 +0000)
committerAlexander Graf <agraf@suse.de>
Fri, 26 Apr 2013 18:27:01 +0000 (20:27 +0200)
Kernel can only access pages which maps as memory.
So flush only the valid kernel pages.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/asm/kvm_ppc.h

index f589307..4794de6 100644 (file)
@@ -282,8 +282,15 @@ void kvmppc_init_lpid(unsigned long nr_lpids);
 
 static inline void kvmppc_mmu_flush_icache(pfn_t pfn)
 {
-       /* Clear i-cache for new pages */
        struct page *page;
+       /*
+        * We can only access pages that the kernel maps
+        * as memory. Bail out for unmapped ones.
+        */
+       if (!pfn_valid(pfn))
+               return;
+
+       /* Clear i-cache for new pages */
        page = pfn_to_page(pfn);
        if (!test_bit(PG_arch_1, &page->flags)) {
                flush_dcache_icache_page(page);