From patchwork Wed Apr 16 11:46:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 4000271 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 55597BFF02 for ; Wed, 16 Apr 2014 11:49:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87D8020272 for ; Wed, 16 Apr 2014 11:49:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A4982024C for ; Wed, 16 Apr 2014 11:49:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaOJL-0005Nd-Ag; Wed, 16 Apr 2014 11:47:27 +0000 Received: from mail-wi0-f181.google.com ([209.85.212.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaOJ9-0005GM-6e for linux-arm-kernel@lists.infradead.org; Wed, 16 Apr 2014 11:47:15 +0000 Received: by mail-wi0-f181.google.com with SMTP id hm4so1217821wib.8 for ; Wed, 16 Apr 2014 04:46:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vBUGR3uln41IIoYAUqR7C06SpiTAjSEfGtB9RLozTr0=; b=VVHUSoWJQQEefXKcttN/1ycfxKaY3x7ZUn2ju+Dd2S0MQUeL3c3aq0CWD20XeI7Q2f +2ornF+OrCM1Q2YUyUyFEAquzdG5145AoVKeqG/T2/C03pJzr0d1LOLRxljjS6jlIRLJ OiKxNMoOubXkUsmk6+X0tafNE4c/YoT6P5ECIkcDERxRDHtC732z7s3WTY41FKEMiotY 12B7IbDDH/U9vOzDBdo9aTdggvBXtliGltekG3sqS96ughNZYDxMaHnXxE9Z2BRxnEsM SYLOZZtwtvsfmDMPfqOTCrMkwKLBIwD6Hb9LjSbPK6Segi2cd6x3K8yQbFEOr3WZN13L 8EtA== X-Gm-Message-State: ALoCoQnaphsSsiXFyIvY/M9scQp9GmYx6DdRQtAxZTUlHYMEo7deyaoPOU3uTCnHm1c5Btw2n3g1 X-Received: by 10.194.204.199 with SMTP id la7mr6704463wjc.4.1397648813292; Wed, 16 Apr 2014 04:46:53 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id mw4sm24116996wib.12.2014.04.16.04.46.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Apr 2014 04:46:52 -0700 (PDT) From: Steve Capper To: linux@arm.linux.org.uk, akpm@linux-foundation.org Subject: [PATCH V2 2/5] arm: mm: Adjust the parameters for __sync_icache_dcache Date: Wed, 16 Apr 2014 12:46:40 +0100 Message-Id: <1397648803-15961-3-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1397648803-15961-1-git-send-email-steve.capper@linaro.org> References: <1397648803-15961-1-git-send-email-steve.capper@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140416_044715_431202_4A3872AE X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -0.7 (/) Cc: Steve Capper , catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, gerald.schaefer@de.ibm.com, linux-arm-kernel@lists.infradead.org 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=-2.6 required=5.0 tests=BAYES_00,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 Rather than take a pte_t as an input, break this down to the pfn and whether or not the memory is executable. This allows us to use this function for ptes and pmds. Signed-off-by: Steve Capper --- arch/arm/include/asm/pgtable.h | 6 +++--- arch/arm/mm/flush.c | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 5478e5d..3a9c238 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -228,11 +228,11 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd) (pte_valid(pte) && (pte_val(pte) & L_PTE_USER) && pte_young(pte)) #if __LINUX_ARM_ARCH__ < 6 -static inline void __sync_icache_dcache(pte_t pteval) +static inline void __sync_icache_dcache(unsigned long pfn, int exec); { } #else -extern void __sync_icache_dcache(pte_t pteval); +extern void __sync_icache_dcache(unsigned long pfn, int exec); #endif static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, @@ -241,7 +241,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, unsigned long ext = 0; if (addr < TASK_SIZE && pte_valid_user(pteval)) { - __sync_icache_dcache(pteval); + __sync_icache_dcache(pte_pfn(pteval), pte_exec(pteval)); ext |= PTE_EXT_NG; } diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 3387e60..df0d5ca 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c @@ -232,16 +232,15 @@ static void __flush_dcache_aliases(struct address_space *mapping, struct page *p } #if __LINUX_ARM_ARCH__ >= 6 -void __sync_icache_dcache(pte_t pteval) +void __sync_icache_dcache(unsigned long pfn, int exec) { - unsigned long pfn; struct page *page; struct address_space *mapping; - if (cache_is_vipt_nonaliasing() && !pte_exec(pteval)) + if (cache_is_vipt_nonaliasing() && !exec) /* only flush non-aliasing VIPT caches for exec mappings */ return; - pfn = pte_pfn(pteval); + if (!pfn_valid(pfn)) return; @@ -254,7 +253,7 @@ void __sync_icache_dcache(pte_t pteval) if (!test_and_set_bit(PG_dcache_clean, &page->flags)) __flush_dcache_page(mapping, page); - if (pte_exec(pteval)) + if (exec) __flush_icache_all(); } #endif