From patchwork Tue Feb 18 15:27:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 24891 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B626202B2 for ; Tue, 18 Feb 2014 15:28:58 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id c9sf32101767qcz.9 for ; Tue, 18 Feb 2014 07:28:58 -0800 (PST) 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:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=5fHgKWBZyZj1kgDoZowrVZ1ed2TCT+m0/BH4mSN+eHo=; b=VUedtkPhG86kGaI5bx891wMBAVH2jTrCRgnh9JWvOJrpFJeUwK2BDwhO+V65RZnQra 9Aj7z6XTlVk2hMqjEGC95PAF0h4T7rOUGCPY0MIZJN8O1PZzpWqYM7Vj/SIHlts/5lUT S5JkILRsxEICcPXe0Abapp/czDpjv38MJzxGTADff9UWEhepf9/V2MFBUYi8wRcxYEYV yJoc8gU8ft6inpGVif7RZwGtF/IAWF2t5W+2h2c5ak/t2gZXXonKtByir42KZcc5Q8QB /RwlB3i7IIun6Nbx60BMXuWv0XO55Dx3EcQk4ww7IfjJVipJlT7EU7jdcF1dDcfNWb7Q y4MQ== X-Gm-Message-State: ALoCoQlTr9eHO0RmJ12JrOL92t97g1WF7YmU0TrSgoSWv5VlWDiojk79LZ+U9Gl7JzSl/qpsBKtS X-Received: by 10.236.78.232 with SMTP id g68mr11769856yhe.19.1392737338069; Tue, 18 Feb 2014 07:28:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.195 with SMTP id 61ls1279649qgv.19.gmail; Tue, 18 Feb 2014 07:28:58 -0800 (PST) X-Received: by 10.52.160.233 with SMTP id xn9mr4845285vdb.48.1392737337982; Tue, 18 Feb 2014 07:28:57 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id eo4si5595435vdb.4.2014.02.18.07.28.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 07:28:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ld13so13135484vcb.18 for ; Tue, 18 Feb 2014 07:28:57 -0800 (PST) X-Received: by 10.52.179.198 with SMTP id di6mr18430132vdc.7.1392737337858; Tue, 18 Feb 2014 07:28:57 -0800 (PST) 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.220.174.196 with SMTP id u4csp225068vcz; Tue, 18 Feb 2014 07:28:57 -0800 (PST) X-Received: by 10.180.9.71 with SMTP id x7mr18348282wia.55.1392737336775; Tue, 18 Feb 2014 07:28:56 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id fh3si12396534wib.84.2014.02.18.07.28.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2014 07:28:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFmas-0005SW-VT; Tue, 18 Feb 2014 15:28:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFmam-0001Mh-Hz; Tue, 18 Feb 2014 15:28:16 +0000 Received: from mail-wg0-f41.google.com ([74.125.82.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFmaR-0001GJ-BR for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2014 15:27:57 +0000 Received: by mail-wg0-f41.google.com with SMTP id l18so3173062wgh.2 for ; Tue, 18 Feb 2014 07:27:33 -0800 (PST) X-Received: by 10.180.12.43 with SMTP id v11mr18204219wib.33.1392737253665; Tue, 18 Feb 2014 07:27:33 -0800 (PST) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id f3sm43028211wiv.2.2014.02.18.07.27.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2014 07:27:32 -0800 (PST) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, linux-mm@kvack.org Subject: [PATCH 2/5] arm: mm: Adjust the parameters for __sync_icache_dcache Date: Tue, 18 Feb 2014 15:27:12 +0000 Message-Id: <1392737235-27286-3-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1392737235-27286-1-git-send-email-steve.capper@linaro.org> References: <1392737235-27286-1-git-send-email-steve.capper@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140218_102755_496133_74B66B00 X-CRM114-Status: GOOD ( 11.90 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Steve Capper , arnd@arndb.de, catalin.marinas@arm.com, will.deacon@arm.com, dsaxena@linaro.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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 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 7d59b52..9b4ad36 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 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