Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1412515ybl; Thu, 22 Aug 2019 14:13:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXN0uCL+NhPBBeLwzE270uoZbnyAdFwjo4HlMsvgnm0IEilU3C1eY6rMaZoBKdIDmR5vZb X-Received: by 2002:a17:90a:db06:: with SMTP id g6mr1780789pjv.60.1566508385841; Thu, 22 Aug 2019 14:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566508385; cv=none; d=google.com; s=arc-20160816; b=xnG24yt2Pm9r6Tu+HrMv99S31ESns7lUCGquLDtlCaB76DfLALKMaUXxU5oM6RZ1Ov qiGrZyRpYuTEmpRjVL5Owfo0tiTnk0eTjLT8IRxexVbvZS4xUiGpZFwbloM+B6us5IGb MqT6vW0bxxDOnOBOFMHT1MtLIUEMCs7Oa/SwDlTb7ZJn6KQ/tlSMgT3gqTiANzzXnqHu 0D1zIkihY4LG0l6A5wwilL+rKF8P3HWcXpTiD5ar3FHhkvIpFW4tEv1t/7JNriStX8/V C8eRsX6nsR4GmuhODIfTkftcMYcM0g5cb+s8uVoi3Mc/PqC7UuCDFVGsOuo3Ix9ZyOIK yPcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=fR+AWYhg9o2kTt90WywbhNpAk6dzkKReMMYjF2367WI=; b=OhF7ADHVXtt6V3+50RHs0uaLvrXWArNv+LkmmDa6sZFeNnq69ERX5qmFtrUcwV0eP5 qknv0afbmGdSm7D/SSfwoiLoXPHvF0FHHxMQIC1zncGwkfSCa8qpvkCVWXN4gVwObcT3 fkNzR5Y3NN70b6yYZZp6U/yQuigw45RknUZVjJej7fQI3s9vqEyWwSkgnH9Ev1itMtOS 0WMXz1NPcYe4VQSxx7Bw/y9BIz45D+RchzdrzXEUBBxdruo06QkXzN91+m03IrCYsM+j GDsW6CtZRGGyg4dI4B2I8NRJxRFxl6C0T2pxegHAB6yxoEqCgRa1cfCQqOvJLxeCE1v3 H0BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=DrWCV0j4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh6si531327plb.285.2019.08.22.14.12.50; Thu, 22 Aug 2019 14:13:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=DrWCV0j4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390046AbfHVQeK (ORCPT + 99 others); Thu, 22 Aug 2019 12:34:10 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:31680 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390023AbfHVQeI (ORCPT ); Thu, 22 Aug 2019 12:34:08 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46DqqJ5zxfz9v0d8; Thu, 22 Aug 2019 18:34:04 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=DrWCV0j4; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id e168W99EZapQ; Thu, 22 Aug 2019 18:34:04 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 46DqqJ4vtyz9v0d3; Thu, 22 Aug 2019 18:34:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1566491644; bh=fR+AWYhg9o2kTt90WywbhNpAk6dzkKReMMYjF2367WI=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=DrWCV0j4gigv3GB01uMeAW+8aeCcs73VDNT3xMu6+rtPnYiVCIhMp6TV/AhM9KrpS WDyEshtwN0aLKPZaLKODTLds7F+lfSvyL8bMC9Tm3LuVnnduBkMiBdyMdH6Nf0Ygyy /NBeq3GT2Mt9KEgUNdOz7FA1JH+VHdnQRs4SiGLI= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 628D78B84C; Thu, 22 Aug 2019 18:34:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id gdMggsL6Kg-L; Thu, 22 Aug 2019 18:34:06 +0200 (CEST) Received: from pc16032vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 216538B81D; Thu, 22 Aug 2019 18:34:06 +0200 (CEST) Received: by pc16032vm.idsi0.si.c-s.fr (Postfix, from userid 0) id EC1116B730; Thu, 22 Aug 2019 16:34:05 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 5/8] powerpc/vdso32: Don't read cache line size from the datapage on PPC32. To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 22 Aug 2019 16:34:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On PPC32, the cache lines have a fixed size known at build time. Don't read it from the datapage. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/vdso_datapage.h | 4 ---- arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/kernel/vdso.c | 5 ----- arch/powerpc/kernel/vdso32/cacheflush.S | 23 +++++++++++++++++++++++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h index 2ccb938d8544..869df2f43400 100644 --- a/arch/powerpc/include/asm/vdso_datapage.h +++ b/arch/powerpc/include/asm/vdso_datapage.h @@ -106,10 +106,6 @@ struct vdso_data { __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ __u32 hrtimer_res; /* hrtimer resolution */ __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ - __u32 dcache_block_size; /* L1 d-cache block size */ - __u32 icache_block_size; /* L1 i-cache block size */ - __u32 dcache_log_block_size; /* L1 d-cache log block size */ - __u32 icache_log_block_size; /* L1 i-cache log block size */ }; #endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 6279053967fd..b6328a90cad7 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -388,11 +388,11 @@ int main(void) OFFSET(STAMP_XTIME, vdso_data, stamp_xtime); OFFSET(STAMP_SEC_FRAC, vdso_data, stamp_sec_fraction); OFFSET(CLOCK_HRTIMER_RES, vdso_data, hrtimer_res); +#ifdef CONFIG_PPC64 OFFSET(CFG_ICACHE_BLOCKSZ, vdso_data, icache_block_size); OFFSET(CFG_DCACHE_BLOCKSZ, vdso_data, dcache_block_size); OFFSET(CFG_ICACHE_LOGBLOCKSZ, vdso_data, icache_log_block_size); OFFSET(CFG_DCACHE_LOGBLOCKSZ, vdso_data, dcache_log_block_size); -#ifdef CONFIG_PPC64 OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); OFFSET(TVAL64_TV_SEC, timeval, tv_sec); OFFSET(TVAL64_TV_USEC, timeval, tv_usec); diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index d60598113a9f..87d43e43e2e7 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c @@ -750,11 +750,6 @@ static int __init vdso_init(void) */ vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT; DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages); -#else - vdso_data->dcache_block_size = L1_CACHE_BYTES; - vdso_data->dcache_log_block_size = L1_CACHE_SHIFT; - vdso_data->icache_block_size = L1_CACHE_BYTES; - vdso_data->icache_log_block_size = L1_CACHE_SHIFT; #endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S index e9453837e4ee..b9340a89984e 100644 --- a/arch/powerpc/kernel/vdso32/cacheflush.S +++ b/arch/powerpc/kernel/vdso32/cacheflush.S @@ -9,6 +9,7 @@ #include #include #include +#include #include "datapage.h" @@ -24,28 +25,44 @@ */ V_FUNCTION_BEGIN(__kernel_sync_dicache) .cfi_startproc +#ifdef CONFIG_PPC64 mflr r12 .cfi_register lr,r12 get_datapage r10, r0 mtlr r12 +#endif +#ifdef CONFIG_PPC64 lwz r7,CFG_DCACHE_BLOCKSZ(r10) addi r5,r7,-1 +#else + li r5, L1_CACHE_BYTES - 1 +#endif andc r6,r3,r5 /* round low to line bdy */ subf r8,r6,r4 /* compute length */ add r8,r8,r5 /* ensure we get enough */ +#ifdef CONFIG_PPC64 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) srw. r8,r8,r9 /* compute line count */ +#else + srwi. r8, r8, L1_CACHE_SHIFT + mr r7, r6 +#endif crclr cr0*4+so beqlr /* nothing to do? */ mtctr r8 1: dcbst 0,r6 +#ifdef CONFIG_PPC64 add r6,r6,r7 +#else + addi r6, r6, L1_CACHE_BYTES +#endif bdnz 1b sync /* Now invalidate the instruction cache */ +#ifdef CONFIG_PPC64 lwz r7,CFG_ICACHE_BLOCKSZ(r10) addi r5,r7,-1 andc r6,r3,r5 /* round low to line bdy */ @@ -55,9 +72,15 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) srw. r8,r8,r9 /* compute line count */ crclr cr0*4+so beqlr /* nothing to do? */ +#endif mtctr r8 +#ifdef CONFIG_PPC64 2: icbi 0,r6 add r6,r6,r7 +#else +2: icbi 0, r7 + addi r7, r7, L1_CACHE_BYTES +#endif bdnz 2b isync li r3,0 -- 2.13.3