From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09323C433E0 for ; Fri, 12 Mar 2021 10:34:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F88664EF6 for ; Fri, 12 Mar 2021 10:34:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F88664EF6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 61D058D0347; Fri, 12 Mar 2021 05:34:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F3358D0346; Fri, 12 Mar 2021 05:34:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 493CE8D0347; Fri, 12 Mar 2021 05:34:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 2B4BD8D0317 for ; Fri, 12 Mar 2021 05:34:41 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D99F6181D75C5 for ; Fri, 12 Mar 2021 10:34:40 +0000 (UTC) X-FDA: 77910863520.01.CC84C0B Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by imf19.hostedemail.com (Postfix) with ESMTP id 893D290009F1 for ; Fri, 12 Mar 2021 10:34:37 +0000 (UTC) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1lKf7u-0007WV-00; Fri, 12 Mar 2021 11:34:38 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 406CCC1D54; Fri, 12 Mar 2021 11:24:10 +0100 (CET) Date: Fri, 12 Mar 2021 11:24:10 +0100 From: Thomas Bogendoerfer To: Huang Pei Cc: ambrosehua@gmail.com, Bibo Mao , linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Huacai Chen , Jinyang He Subject: Re: [PATCH 1/2] MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling Message-ID: <20210312102410.GA7027@alpha.franken.de> References: <20210309080210.25561-1-huangpei@loongson.cn> <20210309080210.25561-2-huangpei@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210309080210.25561-2-huangpei@loongson.cn> User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: 49wscpxx7bcq6mtsagocnattya7srskk X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 893D290009F1 Received-SPF: none (alpha.franken.de>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=elvis.franken.de; client-ip=193.175.24.41 X-HE-DKIM-Result: none/none X-HE-Tag: 1615545277-269336 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Mar 09, 2021 at 04:02:09PM +0800, Huang Pei wrote: > +. LOONGSON64 use 0x98xx_xxxx_xxxx_xxxx as xphys cached > > +. let CONFIG_MIPS_PGD_C0_CONTEXT depend on 64bit > > +. cast CAC_BASE into u64 to silence warning on MIPS32 > > CP0 Context has enough room for wraping pgd into its 41-bit PTEBase field. > > +. For XPHYS, the trick is that pgd is 4kB aligned, and the PABITS <= 48, > only save 48 - 12 + 5(for bit[63:59]) = 41 bits, aka. : > > bit[63:59] | 0000 0000 000 | bit[47:12] | 0000 0000 0000 > > +. for CKSEG0, only save 29 - 12 = 17 bits you are explaining what you are doing, but not why you are doing this. So why are you doing this ? > # > # Set to y for ptrace access to watch registers. > diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c > index a7521b8f7658..591cfa0fca02 100644 > --- a/arch/mips/mm/tlbex.c > +++ b/arch/mips/mm/tlbex.c > @@ -848,8 +848,8 @@ void build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, > /* Clear lower 23 bits of context. */ > uasm_i_dins(p, ptr, 0, 0, 23); > > - /* 1 0 1 0 1 << 6 xkphys cached */ > - uasm_i_ori(p, ptr, ptr, 0x540); > + /* insert bit[63:59] of CAC_BASE into bit[11:6] of ptr */ > + uasm_i_ori(p, ptr, ptr, ((u64)(CAC_BASE) >> 53)); you want to use bits 63..59 but picking bits 63..53 with this. While bits 58..53 are probably 0, wouldn't it make also sense to mask them out ? > uasm_i_drotr(p, ptr, ptr, 11); > #elif defined(CONFIG_SMP) > UASM_i_CPUID_MFC0(p, ptr, SMP_CPUID_REG); > @@ -1164,8 +1164,9 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, > > if (pgd_reg == -1) { > vmalloc_branch_delay_filled = 1; > - /* 1 0 1 0 1 << 6 xkphys cached */ > - uasm_i_ori(p, ptr, ptr, 0x540); > + /* insert bit[63:59] of CAC_BASE into bit[11:6] of ptr */ > + uasm_i_ori(p, ptr, ptr, ((u64)(CAC_BASE) >> 53)); > + > uasm_i_drotr(p, ptr, ptr, 11); > } > > @@ -1292,7 +1293,6 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, > > return rv; > } > - > /* why are you removing this empty line ? I'd prefer that it stays there... > * For a 64-bit kernel, we are using the 64-bit XTLB refill exception > * because EXL == 0. If we wrap, we can also use the 32 instruction > -- > 2.17.1 -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]