From patchwork Fri Nov 20 09:13:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenhui zhao X-Patchwork-Id: 546854 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9DEE4140D5F for ; Fri, 20 Nov 2015 20:30:13 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3BE621A0066 for ; Fri, 20 Nov 2015 20:30:13 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org X-Greylist: delayed 847 seconds by postgrey-1.35 at bilbo; Fri, 20 Nov 2015 20:27:58 AEDT Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bbn0104.outbound.protection.outlook.com [157.56.111.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3D6651A0018 for ; Fri, 20 Nov 2015 20:27:58 +1100 (AEDT) Received: from BY2PR03CA001.namprd03.prod.outlook.com (10.255.93.18) by BY1PR03MB1482.namprd03.prod.outlook.com (10.162.210.140) with Microsoft SMTP Server (TLS) id 15.1.325.17; Fri, 20 Nov 2015 09:13:36 +0000 Received: from BN1BFFO11FD028.protection.gbl (10.255.93.4) by BY2PR03CA001.outlook.office365.com (10.255.93.18) with Microsoft SMTP Server (TLS) id 15.1.325.17 via Frontend Transport; Fri, 20 Nov 2015 09:13:36 +0000 Authentication-Results: spf=permerror (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; Received-SPF: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD028.mail.protection.outlook.com (10.58.144.91) with Microsoft SMTP Server (TLS) id 15.1.331.11 via Frontend Transport; Fri, 20 Nov 2015 09:13:35 +0000 Received: from localhost.localdomain ([10.193.20.174]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id tAK9DUPa015178; Fri, 20 Nov 2015 02:13:33 -0700 From: Chenhui Zhao To: Subject: [PATCH v3 2/6] powerpc/cache: add cache flush operation for various e500 Date: Fri, 20 Nov 2015 17:13:58 +0800 Message-ID: <1448010842-22345-2-git-send-email-chenhui.zhao@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448010842-22345-1-git-send-email-chenhui.zhao@freescale.com> References: <1448010842-22345-1-git-send-email-chenhui.zhao@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD028; 1:IDGFs1fakR15UdBgrp9GI3aCAPBipLO0BnoDqJpKUiJ5355hiytoNjRCIdbNiIbETmTHfuI0HUskkIWVZPw4QJH8CsnZBwa85csVemOH953KbJy95RysGjKuSzAKqKcCmxhE0Ma5Wtdv98N/hhvur65HqLHVcylZ0pGMIV0btLMvtKSWQCw8MQvQKrpEUmYRO70FWfFsiI2MAqvv00D7nQr5KAugEXJCQfif5YvN6pa6uGAozd8sZSBeeGy0l8eSicoNS3tL3dtHXlPuWfgV2vrbttHT5tzrXF681brX7BciTnDyE18n0W7MggsoBWD6AU4aP7NX9PxQpwbBjtJ175mxWeZ1hqAYJh2uO9CPdK3KSMeoA9hrL9dN+oOUW0MUsiuYWBcNomJ8dhr2Cq1mLkv+UuoWwWaNO+4gyaooys0= X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(199003)(189002)(69596002)(92566002)(586003)(11100500001)(5007970100001)(50226001)(47776003)(450100001)(5001960100002)(77096005)(229853001)(2351001)(189998001)(2950100001)(85326001)(97736004)(33646002)(5003940100001)(110136002)(86362001)(107886002)(50986999)(49486002)(87936001)(5008740100001)(6806005)(76176999)(106466001)(19580405001)(81156007)(36756003)(19580395003)(4001430100002)(50466002)(104016004)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR03MB1482; H:az84smr01.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1482; 2:hKfdnevVjd2eHchxjs/ItU4CjrNttOFXfhBVfiltSY0/OoGLJ2AeIcye78dia6iipGWP1rGIbZsdOyvaxN1dtBQbeziioDsVWTYWiePUZzzrrX7heC6t/mz/9B1cxvX1F6oZZcmkkrreBBv2/n8BxySuomHpphgQRYRWadcRajg=; 3:V6cwuAfT2bayAuicE40PpztZh8y53239KMxrVgXwp1UxaN1N0eIutLC4RDLwfkXkD3Px9v5IdskFOz5Q8U9HFBBdeHxKv4WOUm56NPEVnCeUA/s+3YOolpvab1ZbdhA06Rx992EMqDYrTBy3CqYu+bU06IqDDPuX/zJItlm8/a8RILoRZ+fBoUPbTQv6L4VRTI9I7xV3XNZCTVYdsQD6Kuej9JxZ/cZjjw90ThYOIKs=; 25:V5cyIOzDfNDV+y0PxuJur6RVw4Kr/hwPiPh9G82XP6yi8FR8S4MQXQP2m/fBiaBuZY9yGqvz9oKMNVJVqqi9P/3cvGeqNcsT1T5CDSw6E+vzuiOAz3ZVoqEHfB1VDGht1Qq6BizgkOCutohZQmZuBjnLeHGr3oQlJboR1NP06QpOBgNViG7WXndGqlAAR/qt6wZUPTCowoMcjWvYi9jOli/966tYeDcxEPRWb9uqR86PAxJy96U+x9qI2IGtAXp3KM3KAQaYMANumLu9yOIt0g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1482; X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1482; 20:cdlxmRCGnzP0pTm6+OzX+MCER0Kj/vyi82D1dOYsmyjngTLOE33fg28R+bbtNNPswJCWYWW0rhvSOWgmP3B7K6UwVayKPNPsPIK7Oi0NtmTQmD8qMxjeehwnRKM8xn7y4KMe535mgUAZOVutdAlNo2eGf1mXoJY0s7Jqe4+Mq3M5CRXiuWSwxb6APOPzpo7E/MC9qqPXvuFCi80REzT3yS05ecHoqfctq1OBW6dF5OzzybbCN6iOcK9jX1GDUaLr4apSHAPzDOtcijnYFRilHleFroCraiM8Owhm7IP+L9F10/rWZHNU5HGDrQPbChNpaQ8f9NoDkSv7dUJXWV02Aux8H822lVtMig3zdjEaQNM=; 4:BTA7IUwAXA9JmWb9Byh+QYwDFyTrP7b+EQpGwFYmEhIphVqYpu7CHQGtTBax+WjZd3as6FLH6WS8MlPf0jLcxE5WahMQtQ6xtQtc0J6gPDzwD5FAF7P+cgh/oA/uxgd0ph11uSQ3ArjoWrljnRLnmuJu104DqpL0aLrp6hiurqP7IG8lDP6OuyFl++mfkmnF0aaS/TXHd+AJM700xa7nyNh082c9XRgnNBsQ7+t6AooALOeB7GH2LJLOHXOGVSGcZpAUjuGSAhy2z7vuHRvU7CJivDkfy5C1NE/RJQBlTx03+iGhYCY5yiUBTkf5oZh0BZXbyhSgc/j7aKLjNZ+U3MIX73Zjw7jYmAe/0yevxv2oaC5S5mYJVf2qF7CuHJSxNgLdXzPfcOHji5ougdsLSw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:BY1PR03MB1482; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1482; X-Forefront-PRVS: 07665BE9D1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR03MB1482; 23:SKUjoCSrEzzY5OFzsLuZ7MzBKd0v2kF3QWK7BEUab?= =?us-ascii?Q?JVxJHP8MxTkbA3j2N1tn3IMv06FfaZyqNV7oo7eeA0ASsdynGyUJf13o/KxZ?= =?us-ascii?Q?7oUWVimFYalbZwR5LyFSnGe6YdamMZJHqT86Z860083hLmfi6/8ftlOQW0HI?= =?us-ascii?Q?Iw27mDWhVQguOtCX6uZZoPEbvqJ6UQ6UNxRoh8XgTkb7lSa/yzkHO7/ADT8n?= =?us-ascii?Q?jZqvGGijA4kHcBG1UWKVpKPTa9aI82qUZjfi3t1t4BNDdO1M/bE/jQ4vrjKz?= =?us-ascii?Q?BX7cNpdFWxZsOuyRwLkLF2pkvXJkANMaoNp6HQ2lHEC+FVohU0TgXBHwYxCG?= =?us-ascii?Q?H6k+WHOJhzdc/CEp7wDoJ6OlVm7ZC0lITm+GNEYbYHc3W+0JzdXkFpJIWJJo?= =?us-ascii?Q?cKUwVPoqPxzZE7103yEAy/7/f4xa8aycce5kv/QJDQoWe9euYqL9HkU2xz9f?= =?us-ascii?Q?S2NVSO+Ijo+OMUxlkZnsf1/goZ/XU0AnGpxi7+pyDao+xe6Ykv3gRhrlUeiI?= =?us-ascii?Q?cfbXr8AYDMSmGOe1/3N3HNPQNJv02Y3w3i9sv6d57kGqTZ4zdhg78ZbRhshS?= =?us-ascii?Q?rze4SAd/YqyoQLa95WFiTsLdG1oqcpEtEhi8HBxyTFDRGwhadrpYj7XsIPcW?= =?us-ascii?Q?Di+cAtIJvG/3u3DjfaanBlxT6PmsX9c927w8GMS+VvIWBm70/ZSECqo/0jR9?= =?us-ascii?Q?Woud+VlJxugObFEZSzQchF28GY09umyOk5w98CDpcvYxEUFQ3Zo0rmsGX3r0?= =?us-ascii?Q?aytvfdmgBD++fn7p4MljNWp4ARfBzbCWJb+ssv50gN24Xzm8YzjzITEPw2FI?= =?us-ascii?Q?TwXDpFMdY1BG0STfI9WTa+QO+DszFywOYlcMdnWdTDIx9h8kTLMxMW9Uotiz?= =?us-ascii?Q?58NSTQmG12+YuA5HUij4VSe55XwoRJlMsEe9u7sOhrr1vcXKWskxg9To5Uv+?= =?us-ascii?Q?OziUyLR4/arqRQ+eJ1MAzjIb0MpYEvHz6bHcKv5kqyQHEL6H/+s/JtrRBzfc?= =?us-ascii?Q?98SHGVF6fa6JUBnj9pM97fxknhnazWspYbMeYEG7LsrHMnBChdio7YsN/0xO?= =?us-ascii?Q?QMFnlNnwkyH0UsUXRJnnkftqa/mBvXcCEwBswUrQxGoSqVQPw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1482; 5:Xi3HPvvNQHAlOZpNRG5ZK1kRQWy5eMaJergxwCrOtXvfKdt9i2WZLZuPtBVz8FaBkWMNT+uwqMsmQ1FHIA1Dr1EWn0YcHkgQxkj54pe5po2d/z+TXEY/wcpq20mSFWy4RG//X+bMrtsIqjluE0DnUQ==; 24:2OZqWZIapQW3ZluRq47i+Cj8mDvCbLYfdk0hvjOV+ak32rT4u8sD8s+chqAd7XKylZxtg07yXYSIL19gAaLy0LQ5hsV91UEnyTUd1MPlEWM=; 20:vIW05TThihZiw3V0gQB/YCigiNK6tholC+HsGUCTnRtSTaejq30a84s3n6rD3wdGQPLhwd8uZ2ZzR3uYZm1VGQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 09:13:35.7383 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1482 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: scottwood@freescale.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Various e500 core have different cache architecture, so they need different cache flush operations. Therefore, add a callback function cpu_flush_caches to the struct cpu_spec. The cache flush operation for the specific kind of e500 is selected at init time. The callback function will flush all caches inside the current cpu. Signed-off-by: Chenhui Zhao Signed-off-by: Tang Yuantian --- Changes for v3: * remove unnecessary ifdef arch/powerpc/include/asm/cacheflush.h | 2 - arch/powerpc/include/asm/cputable.h | 8 +++ arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/cpu_setup_fsl_booke.S | 112 ++++++++++++++++++++++++++++++ arch/powerpc/kernel/cputable.c | 4 ++ arch/powerpc/kernel/head_fsl_booke.S | 74 -------------------- arch/powerpc/platforms/85xx/smp.c | 5 +- 7 files changed, 128 insertions(+), 78 deletions(-) diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h index 6229e6b..47add2e 100644 --- a/arch/powerpc/include/asm/cacheflush.h +++ b/arch/powerpc/include/asm/cacheflush.h @@ -30,8 +30,6 @@ extern void flush_dcache_page(struct page *page); #define flush_dcache_mmap_lock(mapping) do { } while (0) #define flush_dcache_mmap_unlock(mapping) do { } while (0) -extern void __flush_disable_L1(void); - extern void flush_icache_range(unsigned long, unsigned long); extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, unsigned long addr, diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index b118072..c25de2d 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -43,6 +43,11 @@ extern int machine_check_e500(struct pt_regs *regs); extern int machine_check_e200(struct pt_regs *regs); extern int machine_check_47x(struct pt_regs *regs); +extern void cpu_down_flush_e500v2(void); +extern void cpu_down_flush_e500mc(void); +extern void cpu_down_flush_e5500(void); +extern void cpu_down_flush_e6500(void); + /* NOTE WELL: Update identify_cpu() if fields are added or removed! */ struct cpu_spec { /* CPU is matched via (PVR & pvr_mask) == pvr_value */ @@ -59,6 +64,9 @@ struct cpu_spec { unsigned int icache_bsize; unsigned int dcache_bsize; + /* flush caches inside the current cpu */ + void (*cpu_down_flush)(void); + /* number of performance monitor counters */ unsigned int num_pmcs; enum powerpc_pmc_type pmc_type; diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 221d584..188e433 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -372,6 +372,7 @@ int main(void) DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore)); + DEFINE(CPU_DOWN_FLUSH, offsetof(struct cpu_spec, cpu_down_flush)); DEFINE(pbe_address, offsetof(struct pbe, address)); DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S index dddba3e..462aed9 100644 --- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S +++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S @@ -13,11 +13,13 @@ * */ +#include #include #include #include #include #include +#include _GLOBAL(__e500_icache_setup) mfspr r0, SPRN_L1CSR1 @@ -233,3 +235,113 @@ _GLOBAL(__setup_cpu_e5500) mtlr r5 blr #endif + +/* flush L1 date cache, it can apply to e500v2, e500mc and e5500 */ +_GLOBAL(flush_dcache_L1) + mfmsr r10 + wrteei 0 + + mfspr r3,SPRN_L1CFG0 + rlwinm r5,r3,9,3 /* Extract cache block size */ + twlgti r5,1 /* Only 32 and 64 byte cache blocks + * are currently defined. + */ + li r4,32 + subfic r6,r5,2 /* r6 = log2(1KiB / cache block size) - + * log2(number of ways) + */ + slw r5,r4,r5 /* r5 = cache block size */ + + rlwinm r7,r3,0,0xff /* Extract number of KiB in the cache */ + mulli r7,r7,13 /* An 8-way cache will require 13 + * loads per set. + */ + slw r7,r7,r6 + + /* save off HID0 and set DCFA */ + mfspr r8,SPRN_HID0 + ori r9,r8,HID0_DCFA@l + mtspr SPRN_HID0,r9 + isync + + LOAD_REG_IMMEDIATE(r6, KERNELBASE) + mr r4, r6 + mtctr r7 + +1: lwz r3,0(r4) /* Load... */ + add r4,r4,r5 + bdnz 1b + + msync + mr r4, r6 + mtctr r7 + +1: dcbf 0,r4 /* ...and flush. */ + add r4,r4,r5 + bdnz 1b + + /* restore HID0 */ + mtspr SPRN_HID0,r8 + isync + + wrtee r10 + + blr + +has_L2_cache: + /* skip L2 cache on P2040/P2040E as they have no L2 cache */ + mfspr r3, SPRN_SVR + /* shift right by 8 bits and clear E bit of SVR */ + rlwinm r4, r3, 24, ~0x800 + + lis r3, SVR_P2040@h + ori r3, r3, SVR_P2040@l + cmpw r4, r3 + beq 1f + + li r3, 1 + blr +1: + li r3, 0 + blr + +/* flush backside L2 cache */ +flush_backside_L2_cache: + mflr r10 + bl has_L2_cache + mtlr r10 + cmpwi r3, 0 + beq 2f + + /* Flush the L2 cache */ + mfspr r3, SPRN_L2CSR0 + ori r3, r3, L2CSR0_L2FL@l + msync + isync + mtspr SPRN_L2CSR0,r3 + isync + + /* check if it is complete */ +1: mfspr r3,SPRN_L2CSR0 + andi. r3, r3, L2CSR0_L2FL@l + bne 1b +2: + blr + +_GLOBAL(cpu_down_flush_e500v2) + mflr r0 + bl flush_dcache_L1 + mtlr r0 + blr + +_GLOBAL(cpu_down_flush_e500mc) +_GLOBAL(cpu_down_flush_e5500) + mflr r0 + bl flush_dcache_L1 + bl flush_backside_L2_cache + mtlr r0 + blr + +/* L1 Data Cache of e6500 contains no modified data, no flush is required */ +_GLOBAL(cpu_down_flush_e6500) + blr diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 7d80bfd..d65b45a 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -2023,6 +2023,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .cpu_setup = __setup_cpu_e500v2, .machine_check = machine_check_e500, .platform = "ppc8548", + .cpu_down_flush = cpu_down_flush_e500v2, }, #else { /* e500mc */ @@ -2042,6 +2043,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .cpu_setup = __setup_cpu_e500mc, .machine_check = machine_check_e500mc, .platform = "ppce500mc", + .cpu_down_flush = cpu_down_flush_e500mc, }, #endif /* CONFIG_PPC_E500MC */ #endif /* CONFIG_PPC32 */ @@ -2066,6 +2068,7 @@ static struct cpu_spec __initdata cpu_specs[] = { #endif .machine_check = machine_check_e500mc, .platform = "ppce5500", + .cpu_down_flush = cpu_down_flush_e5500, }, { /* e6500 */ .pvr_mask = 0xffff0000, @@ -2088,6 +2091,7 @@ static struct cpu_spec __initdata cpu_specs[] = { #endif .machine_check = machine_check_e500mc, .platform = "ppce6500", + .cpu_down_flush = cpu_down_flush_e6500, }, #endif /* CONFIG_PPC_E500MC */ #ifdef CONFIG_PPC32 diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index fffd1f9..709bc50 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S @@ -1075,80 +1075,6 @@ _GLOBAL(set_context) isync /* Force context change */ blr -_GLOBAL(flush_dcache_L1) - mfspr r3,SPRN_L1CFG0 - - rlwinm r5,r3,9,3 /* Extract cache block size */ - twlgti r5,1 /* Only 32 and 64 byte cache blocks - * are currently defined. - */ - li r4,32 - subfic r6,r5,2 /* r6 = log2(1KiB / cache block size) - - * log2(number of ways) - */ - slw r5,r4,r5 /* r5 = cache block size */ - - rlwinm r7,r3,0,0xff /* Extract number of KiB in the cache */ - mulli r7,r7,13 /* An 8-way cache will require 13 - * loads per set. - */ - slw r7,r7,r6 - - /* save off HID0 and set DCFA */ - mfspr r8,SPRN_HID0 - ori r9,r8,HID0_DCFA@l - mtspr SPRN_HID0,r9 - isync - - lis r4,KERNELBASE@h - mtctr r7 - -1: lwz r3,0(r4) /* Load... */ - add r4,r4,r5 - bdnz 1b - - msync - lis r4,KERNELBASE@h - mtctr r7 - -1: dcbf 0,r4 /* ...and flush. */ - add r4,r4,r5 - bdnz 1b - - /* restore HID0 */ - mtspr SPRN_HID0,r8 - isync - - blr - -/* Flush L1 d-cache, invalidate and disable d-cache and i-cache */ -_GLOBAL(__flush_disable_L1) - mflr r10 - bl flush_dcache_L1 /* Flush L1 d-cache */ - mtlr r10 - - mfspr r4, SPRN_L1CSR0 /* Invalidate and disable d-cache */ - li r5, 2 - rlwimi r4, r5, 0, 3 - - msync - isync - mtspr SPRN_L1CSR0, r4 - isync - -1: mfspr r4, SPRN_L1CSR0 /* Wait for the invalidate to finish */ - andi. r4, r4, 2 - bne 1b - - mfspr r4, SPRN_L1CSR1 /* Invalidate and disable i-cache */ - li r5, 2 - rlwimi r4, r5, 0, 3 - - mtspr SPRN_L1CSR1, r4 - isync - - blr - #ifdef CONFIG_SMP /* When we get here, r24 needs to hold the CPU # */ .globl __secondary_start diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c index 6b107ce..4a78416 100644 --- a/arch/powerpc/platforms/85xx/smp.c +++ b/arch/powerpc/platforms/85xx/smp.c @@ -139,7 +139,8 @@ static void smp_85xx_mach_cpu_die(void) mtspr(SPRN_TCR, 0); - __flush_disable_L1(); + cur_cpu_spec->cpu_down_flush(); + tmp = (mfspr(SPRN_HID0) & ~(HID0_DOZE|HID0_SLEEP)) | HID0_NAP; mtspr(SPRN_HID0, tmp); isync(); @@ -359,7 +360,7 @@ void mpc85xx_smp_kexec_cpu_down(int crash_shutdown, int secondary) local_irq_disable(); if (secondary) { - __flush_disable_L1(); + cur_cpu_spec->cpu_down_flush(); atomic_inc(&kexec_down_cpus); /* loop forever */ while (1);