From patchwork Fri Dec 13 19:05:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 3342261 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 49CAAC0D4A for ; Fri, 13 Dec 2013 19:14:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F82F207D1 for ; Fri, 13 Dec 2013 19:14:23 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 2F4B8207B8 for ; Fri, 13 Dec 2013 19:14:22 +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 1VrYBm-0004B5-Lf; Fri, 13 Dec 2013 19:14:18 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrYBk-0006co-3e; Fri, 13 Dec 2013 19:14:16 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrYBh-0006bD-Br for linux-arm-kernel@lists.infradead.org; Fri, 13 Dec 2013 19:14:14 +0000 Received: by mail-wi0-f177.google.com with SMTP id cc10so1548011wib.10 for ; Fri, 13 Dec 2013 11:13:51 -0800 (PST) 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=mkhJM/CEqZ5FR8O9/uxZPW3mL9ajwX6fjO2FGEguXmM=; b=S3d3x3CXZ9gtUDc7VF6+8iUtxmUmNHzpnsKGY2S3IJJTh3sKtma81Fw+iczhOKTsqk j4tKSZEwwAH9Bz58R6QnNNRIuqLDe0aaH79qetV6Ix7zYseiN8/EPxKfYcNgEje+X4Px AUdPO0ZO1DOAPJPCiw1jkhWxonbYbCrBlvg7IenaYo9lT9lUPNhqlS4xKx+jw4GoeP68 ShFVGCjeartDjUWzAYIHvMxzHlNHnFAEEvRidnbenAH72De+VATPWmbefBowvaf6iWyR ZwVNPDtkVOdxdX84Blni63OfO7KLBsEqWttu3Q+sMsMX1ceG++O5DW6kNm/KpFPnXiOy 5uEw== X-Gm-Message-State: ALoCoQnUnV+2IXM5zAEV99UgGmFUgRRuTd1FzdwUZvx83QQbvWZr5IV574QOnHzzgrB3dzW5RTtA X-Received: by 10.180.21.244 with SMTP id y20mr4248589wie.37.1386961557642; Fri, 13 Dec 2013 11:05:57 -0800 (PST) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id o9sm289604wib.10.2013.12.13.11.05.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Dec 2013 11:05:56 -0800 (PST) From: Steve Capper To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/6] arm: mm: Adjust the parameters for __sync_icache_dcache Date: Fri, 13 Dec 2013 19:05:42 +0000 Message-Id: <1386961546-10061-3-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386961546-10061-1-git-send-email-steve.capper@linaro.org> References: <1386961546-10061-1-git-send-email-steve.capper@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131213_141413_528595_BC03BEBB X-CRM114-Status: GOOD ( 10.74 ) X-Spam-Score: -2.6 (--) Cc: deepak.saxena@linaro.org, linux@arm.linux.org.uk, patches@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, Steve Capper 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=-4.2 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 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 1571d12..1ffe488 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -225,11 +225,11 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd) #define pte_present_user(pte) (pte_present(pte) && (pte_val(pte) & L_PTE_USER)) #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, @@ -238,7 +238,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, unsigned long ext = 0; if (addr < TASK_SIZE && pte_present_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 6d5ba9a..549a5e1 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