From patchwork Mon Sep 3 09:55:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Shawcroft X-Patchwork-Id: 181347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 532512C0094 for ; Mon, 3 Sep 2012 19:56:17 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1347270978; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=FFwF0hj jfSs/d9mLErvqYV8m4y8=; b=kLhQ9XEVZU/bvPqsjw8lsWd1ElZrwUnNSsPl7qH a9F1xfdn1EvO/7RFLnD6+yY0i9ptjNFtKs0PAWDAnv97w4sYNB/NCuXbMDXj4U+v kfIGcRtRWYWhohsbC4NXtIhIDevixMo/qCyqdoqSgCPoiiLTUUI57rKQVtvCYGoG chmg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:X-MC-Unique:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=txZ+oeQfOOpppakR5EYhqYGCXpG3rWaQ6KjA3z3l/8tBrpvfWXW9FWxbuGwUUx gvYrepcAeEhrzOUzYmLqUTGWfXhQyXs/lN2NUoURWWjtyD1hTTcRYjo8YK4IWj9F sDXpluE9VFsrM/C0gQiXZJAWI1ZmaS6hKYgHB1bdtOHuQ=; Received: (qmail 3485 invoked by alias); 3 Sep 2012 09:56:14 -0000 Received: (qmail 3477 invoked by uid 22791); 3 Sep 2012 09:56:14 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 Sep 2012 09:55:58 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 03 Sep 2012 10:55:57 +0100 Received: from [10.1.72.50] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 3 Sep 2012 10:58:00 +0100 Message-ID: <50447EAA.3080006@arm.com> Date: Mon, 03 Sep 2012 10:55:54 +0100 From: Marcus Shawcroft User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20 MIME-Version: 1.0 To: "gcc >> \"gcc-patches@gcc.gnu.org\"" Subject: [AArch64] cache CTR_EL0 in sync_cache_range() X-MC-Unique: 112090310555703201 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I've just committed the attached patch to cache the CTR_EL0 register between calls to sync_cache_range(). /Marcus 2012-09-03 Marcus Shawcroft * config/aarch64/sync-cache.c (__aarch64_sync_cache_range): Cache the ctr_el0 register. diff --git a/libgcc/config/aarch64/sync-cache.c b/libgcc/config/aarch64/sync-cache.c index 1636b94..d7b621e 100644 --- a/libgcc/config/aarch64/sync-cache.c +++ b/libgcc/config/aarch64/sync-cache.c @@ -21,14 +21,15 @@ void __aarch64_sync_cache_range (const void *base, const void *end) { - unsigned int cache_info = 0; - unsigned int icache_lsize; - unsigned int dcache_lsize; + unsigned icache_lsize; + unsigned dcache_lsize; + static unsigned int cache_info = 0; const char *address; - /* CTR_EL0 [3:0] contains log2 of icache line size in words. - CTR_EL0 [19:16] contains log2 of dcache line size in words. */ - asm volatile ("mrs\t%0, ctr_el0":"=r" (cache_info)); + if (! cache_info) + /* CTR_EL0 [3:0] contains log2 of icache line size in words. + CTR_EL0 [19:16] contains log2 of dcache line size in words. */ + asm volatile ("mrs\t%0, ctr_el0":"=r" (cache_info)); icache_lsize = 4 << (cache_info & 0xF); dcache_lsize = 4 << ((cache_info >> 16) & 0xF);