From patchwork Wed Aug 14 11:47:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 2844413 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 21171BF546 for ; Wed, 14 Aug 2013 11:48:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00DD9203AE for ; Wed, 14 Aug 2013 11:48:35 +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 B6FF3203AC for ; Wed, 14 Aug 2013 11:48:33 +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 1V9ZZ1-0000nd-7n; Wed, 14 Aug 2013 11:48:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9ZYz-0006N2-3T; Wed, 14 Aug 2013 11:48:29 +0000 Received: from mail-pd0-f170.google.com ([209.85.192.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9ZYv-0006M3-V7 for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2013 11:48:26 +0000 Received: by mail-pd0-f170.google.com with SMTP id x10so6234918pdj.15 for ; Wed, 14 Aug 2013 04:48:04 -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=H4JmiRYc+I01GNYhW9K4f4XVVa8nnz0RWYUoUw2hDCxuI8BbSBlE3eX/3lp7JTVvZw ogOUrRMY89/JM0DwXL5n7NIjGS2qcuEFx9ca57Zk+dGy2eksoZya5wnBhc/1naCGnpEt mGIZPRXCH/KjsSqZh2L8IANZjHUrkmulpK23opfzRoxBVXvFXAyH5N4H/L1y/2iMbd53 uktPOJdy0nuLAPermdWdlgR+/aTN2RYBs1eX+0bISyqvpuSrjqFWhfxo0R1wgbhrDuTn xGVyhJ//CIxXI/QXcooBuyXIfoe3iQVugyIzb93bR2X4pFtPrgxBH63HbJPLia2K6eF2 Va7w== X-Gm-Message-State: ALoCoQlXVWkrX0jJ+UrW8ftusHMEGezVrLHOOzPv8rctnezvOeO9176SOG4BU54y4lU1Bf3lLXsA X-Received: by 10.67.5.132 with SMTP id cm4mr522342pad.186.1376480884618; Wed, 14 Aug 2013 04:48:04 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id nv6sm49838569pbc.6.2013.08.14.04.48.00 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 04:48:03 -0700 (PDT) From: Pranavkumar Sawargaonkar To: kvmarm@lists.cs.columbia.edu Subject: [PATCH] ARM64: KVM: Fix coherent_icache_guest_page() for host with external L3-cache. Date: Wed, 14 Aug 2013 17:17:12 +0530 Message-Id: <1376480832-18705-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_074826_082627_D286876D X-CRM114-Status: GOOD ( 10.45 ) X-Spam-Score: -1.9 (-) 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();