From patchwork Fri Jul 31 15:53:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 51791 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id DFEA122D9C for ; Fri, 31 Jul 2015 16:01:35 +0000 (UTC) Received: by wicmv11 with SMTP id mv11sf9739758wic.1 for ; Fri, 31 Jul 2015 09:01:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=qOrEy8+N41NL8oYWR8zJ02OQnGgeqQTDoamPyrZoytA=; b=gCdDqnLFSO5tk2fxTCATWgFsCcotmLWT5nbUGRZRGLUMzRbeBAgE234JDMWHP8qnCQ vNT/uJ8+NmkR8Q+X2VNicGQNYQIdBrjvDLsu7HBTJOW0B+FbOTO4/wOG9SvMpVlziiLm 97mcyTf7fPkCXbYYr+I084N0ekqduOPgFCAk9xEo3x8biJXIcvgY2QG2qCZRERFStdLK GkUH4u0k6VfNL8P1JB9dm8XAmr51QWPLfZCdU4dg6eT6uHRbIbSvafyk1CI7Hl80NwI7 4ts5i4+Jm/3/0xFpi8gFJ0QrA8mMnpIoZqWC0QzPVx17xMIrqlBRSrmi6H2NTt/36D/B q46w== X-Gm-Message-State: ALoCoQn3SayV1y/FdFdvsS3jbTTxsOOA7no6EZZX2mdsVa5OrnWVdIM+mfgFRATzFe3YmmekVm4l X-Received: by 10.194.219.234 with SMTP id pr10mr1170238wjc.2.1438358495227; Fri, 31 Jul 2015 09:01:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.136 with SMTP id dc8ls371309lad.101.gmail; Fri, 31 Jul 2015 09:01:35 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr3883725lbb.56.1438358495064; Fri, 31 Jul 2015 09:01:35 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id f10si4133555lam.75.2015.07.31.09.01.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 09:01:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lacct8 with SMTP id ct8so13837079lac.2 for ; Fri, 31 Jul 2015 09:01:34 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr3756522lbb.29.1438358494625; Fri, 31 Jul 2015 09:01:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp476063lba; Fri, 31 Jul 2015 09:01:33 -0700 (PDT) X-Received: by 10.140.232.11 with SMTP id d11mr5772818qhc.0.1438358492880; Fri, 31 Jul 2015 09:01:32 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 136si6326601qhc.102.2015.07.31.09.01.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Jul 2015 09:01:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:44974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCkV-0005Gr-Vr for patch@linaro.org; Fri, 31 Jul 2015 12:01:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCdp-0000z6-7L for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLCdg-0005uB-J3 for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:37 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:37257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCdg-0005u5-Dt for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:28 -0400 Received: by wibud3 with SMTP id ud3so37563675wib.0 for ; Fri, 31 Jul 2015 08:54:27 -0700 (PDT) X-Received: by 10.181.11.229 with SMTP id el5mr7535311wid.40.1438358067671; Fri, 31 Jul 2015 08:54:27 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id ul1sm7788359wjc.30.2015.07.31.08.54.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 08:54:27 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4C1463E1038; Fri, 31 Jul 2015 16:54:23 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, fred.konrad@greensocs.com Date: Fri, 31 Jul 2015 16:53:56 +0100 Message-Id: <1438358041-18021-7-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1438358041-18021-1-git-send-email-alex.bennee@linaro.org> References: <1438358041-18021-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.171 Cc: peter.maydell@linaro.org, drjones@redhat.com, kvm@vger.kernel.org, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Qemu-devel] [kvm-unit-tests PATCH v5 06/11] lib/arm: add flush_tlb_page mmu function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This introduces a new flush_tlb_page function which does exactly what you expect. It's going to be useful for the future TLB torture test. Signed-off-by: Alex Bennée --- lib/arm/asm/mmu.h | 11 +++++++++++ lib/arm64/asm/mmu.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/arm/asm/mmu.h b/lib/arm/asm/mmu.h index c1bd01c..2bb0cde 100644 --- a/lib/arm/asm/mmu.h +++ b/lib/arm/asm/mmu.h @@ -14,8 +14,11 @@ #define PTE_AF PTE_EXT_AF #define PTE_WBWA L_PTE_MT_WRITEALLOC +/* See B3.18.7 TLB maintenance operations */ + static inline void local_flush_tlb_all(void) { + /* TLBIALL */ asm volatile("mcr p15, 0, %0, c8, c7, 0" :: "r" (0)); dsb(); isb(); @@ -27,6 +30,14 @@ static inline void flush_tlb_all(void) local_flush_tlb_all(); } +static inline void flush_tlb_page(unsigned long vaddr) +{ + /* TLBIMVAA */ + asm volatile("mcr p15, 0, %0, c8, c7, 3" :: "r" (vaddr)); + dsb(); + isb(); +} + #include #endif /* __ASMARM_MMU_H_ */ diff --git a/lib/arm64/asm/mmu.h b/lib/arm64/asm/mmu.h index 18b4d6b..3bc31c9 100644 --- a/lib/arm64/asm/mmu.h +++ b/lib/arm64/asm/mmu.h @@ -19,6 +19,14 @@ static inline void flush_tlb_all(void) isb(); } +static inline void flush_tlb_page(unsigned long vaddr) +{ + unsigned long page = vaddr >> 12; + dsb(ishst); + asm("tlbi vaae1is, %0" :: "r" (page)); + dsb(ish); +} + #include #endif /* __ASMARM64_MMU_H_ */