From patchwork Tue Apr 23 06:39:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 2475711 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0842140106 for ; Tue, 23 Apr 2013 06:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755837Ab3DWGh6 (ORCPT ); Tue, 23 Apr 2013 02:37:58 -0400 Received: from co9ehsobe001.messaging.microsoft.com ([207.46.163.24]:22452 "EHLO co9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755754Ab3DWGhh (ORCPT ); Tue, 23 Apr 2013 02:37:37 -0400 Received: from mail100-co9-R.bigfish.com (10.236.132.225) by CO9EHSOBE016.bigfish.com (10.236.130.79) with Microsoft SMTP Server id 14.1.225.23; Tue, 23 Apr 2013 06:37:35 +0000 Received: from mail100-co9 (localhost [127.0.0.1]) by mail100-co9-R.bigfish.com (Postfix) with ESMTP id 6D708840077; Tue, 23 Apr 2013 06:37:35 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zzzz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1082kzz8275bhz2dh2a8h668h839hd24he5bhf0ah107ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1155h) Received: from mail100-co9 (localhost.localdomain [127.0.0.1]) by mail100-co9 (MessageSwitch) id 1366699054327534_8424; Tue, 23 Apr 2013 06:37:34 +0000 (UTC) Received: from CO9EHSMHS006.bigfish.com (unknown [10.236.132.234]) by mail100-co9.bigfish.com (Postfix) with ESMTP id 4DE2E78005E; Tue, 23 Apr 2013 06:37:34 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS006.bigfish.com (10.236.130.16) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 23 Apr 2013 06:37:34 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Tue, 23 Apr 2013 06:37:33 +0000 Received: from freescale.com ([10.232.15.72]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with SMTP id r3N6bNLY016127; Mon, 22 Apr 2013 23:37:29 -0700 Received: by freescale.com (sSMTP sendmail emulation); Tue, 23 Apr 2013 12:09:33 +0530 From: Bharat Bhushan To: , , , CC: Bharat Bhushan Subject: [PATCH] KVM : PPC : cache flush for kernel managed pages Date: Tue, 23 Apr 2013 12:09:32 +0530 Message-ID: <1366699172-25260-1-git-send-email-bharat.bhushan@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Kernel should only try flushing pages which are managed by kernel. pfn_to_page will returns junk struct page for pages not managed by kernel, so if kernel will try to flush direct mapped memory or direct assigned device mapping then it will work on junk struct page. Signed-off-by: Bharat Bhushan --- arch/powerpc/kvm/e500_mmu_host.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c index 1c6a9d7..e07da21 100644 --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c @@ -455,7 +455,8 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, ref, gvaddr, stlbe); /* Clear i-cache for new pages */ - kvmppc_mmu_flush_icache(pfn); + if (pfn_valid(pfn)) + kvmppc_mmu_flush_icache(pfn); /* Drop refcount on page, so that mmu notifiers can clear it */ kvm_release_pfn_clean(pfn);