From patchwork Wed Aug 14 11:45:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 2844412 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1130BF546 for ; Wed, 14 Aug 2013 11:46:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92A4A203AE for ; Wed, 14 Aug 2013 11:46:41 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DFE2203AC for ; Wed, 14 Aug 2013 11:46:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9ZX8-0000GL-Cb; Wed, 14 Aug 2013 11:46:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9ZX6-0006KH-22; Wed, 14 Aug 2013 11:46:32 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9ZX4-0006Jg-Db for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2013 11:46:30 +0000 Received: by mail-pb0-f49.google.com with SMTP id xb4so9270225pbc.22 for ; Wed, 14 Aug 2013 04:46:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=juGofOEIvMZlUmk19OxS14w02cqCui65dMsJoxlQso4=; b=Vg7D5OS77G8tJWLRXptY5Akn120p7JGpV58i5e9A1GZd3W5hAUdT7nszx8H9HZdNln StFBNUKbcKWKC+KyfaDwV9GQvG1xL0JVgjXxkpRQtd9UdqS/f5fJMMM70vmUx/df1Z4j ejKPrqJLgEXp1NG1clhSKNHe65BlsNgcDcMaW2vRUGJ0DAczlOnhC5HrE1P48yi4icDX t6fG3t1mvny1D04HPLKTqz6xJJFbKd7/S6hc6cIh6lw6m1s35hugflbcdEzKAAsoah9x rKmLCCNSN/+Z0we9aJAkrmrUD65XRyHZI/tPCWKGq2kVJ1hk6tbaqRzKizqkqJYL5H1O p86Q== X-Gm-Message-State: ALoCoQklTuPbHQ4yZAJCuY5ki5TkgTVx0tsmHdJTfBMpm1oCutu950M0y6Wjqw0DLzvEqk3X+bM7 X-Received: by 10.66.27.43 with SMTP id q11mr9250126pag.97.1376480767887; Wed, 14 Aug 2013 04:46:07 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id om2sm49792027pbc.30.2013.08.14.04.46.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 04:46:06 -0700 (PDT) From: Pranavkumar Sawargaonkar To: kvmarm@list.cs.columbia.edu Subject: [PATCH] ARM64: KVM: Fix coherent_icache_guest_page() for host with external L3-cache. Date: Wed, 14 Aug 2013 17:15:05 +0530 Message-Id: <1376480706-18642-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130814_074630_529455_78C89FFE X-CRM114-Status: GOOD ( 10.08 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, Anup Patel , patches@linaro.org, marc.zyngier@arm.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, Pranavkumar Sawargaonkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Systems with large external L3-cache (few MBs), might have dirty content belonging to the guest page in L3-cache. To tackle this, we need to flush such dirty content from d-cache so that guest will see correct contents of guest page when guest MMU is disabled. The patch fixes coherent_icache_guest_page() for external L3-cache. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- arch/arm64/include/asm/kvm_mmu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index efe609c..5129038 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -123,6 +123,8 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn) if (!icache_is_aliasing()) { /* PIPT */ unsigned long hva = gfn_to_hva(kvm, gfn); flush_icache_range(hva, hva + PAGE_SIZE); + /* Flush d-cache for systems with external caches. */ + __flush_dcache_area((void *) hva, PAGE_SIZE); } else if (!icache_is_aivivt()) { /* non ASID-tagged VIVT */ /* any kind of VIPT cache */ __flush_icache_all();