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 f58930779ae8fc346555d4d6f707cd99d9cf72ca..4794de6ea3796a3c5294fc52f1c4b1e74812e2a6 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);