linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Huang Pei <huangpei@loongson.cn>
Cc: ambrosehua@gmail.com, Bibo Mao <maobibo@loongson.cn>,
	linux-mips@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-mm@kvack.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Paul Burton <paulburton@kernel.org>,
	Li Xuefeng <lixuefeng@loongson.cn>,
	Yang Tiezhu <yangtiezhu@loongson.cn>,
	Gao Juxin <gaojuxin@loongson.cn>,
	Huacai Chen <chenhuacai@loongson.cn>,
	Jinyang He <hejinyang@loongson.cn>
Subject: Re: [PATCH] MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling
Date: Sun, 14 Mar 2021 14:09:00 +0100	[thread overview]
Message-ID: <20210314130900.GB5165@alpha.franken.de> (raw)
In-Reply-To: <20210313013927.26733-2-huangpei@loongson.cn>

On Sat, Mar 13, 2021 at 09:39:27AM +0800, Huang Pei wrote:
> +. LOONGSON64 use 0x98xx_xxxx_xxxx_xxxx as xphys cached, instread of
> 0xa8xx_xxxx_xxxx_xxxx
> 
> +. 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 <= 53,
> only save 53 - 12 = 41 bits, aka :
> 
>    bit[63:59] | 0000 00 |  bit[53:12] | 0000 0000 0000
> 
> +. for CKSEG0, only save 29 - 12 = 17 bits
> 
> when switching pgd, only need to save bit[53:12] or bit[28:12] into
> CP0 Context's bit[63:23], see folling asm generated at run time
> 
> tlbmiss_handler_setup_pgd:
> 	.set	push
> 	.set	noreorder
> 
> 	dsra	a2, a0, 29
> 	move	a3, a0
> 	dins	a0, zero, 29, 35
> 	daddiu	a2, a2, 4	//for CKSEG0, a2 from 0xfffffffffffffffc
> 				//into 0
> 
> 	movn	a0, a3, a2
> 	dsll	a0, a0, 11
> 	jr	ra
> 	dmtc0	a0, CP0_CONTEXT
> 
> 	.set	pop
> 
> when using it on page walking
> 
> 	dmfc0	k0, CP0_CONTEXT
> 	dins	k0, zero, 0, 23	         // zero badv2
> 	ori	k0, k0, (CAC_BASE >> 53) // *prefix* with bit[63:59]
> 	drotr	k0, k0, 11		 // kick it in the right place
> 
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
> ---
>  arch/mips/Kconfig    | 3 ++-
>  arch/mips/mm/tlbex.c | 9 +++++----
>  2 files changed, 7 insertions(+), 5 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]


  reply	other threads:[~2021-03-14 13:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13  1:39 [PATCH V5] MIPS: clean up MIPS_PGD_C0_CONTEXT Huang Pei
2021-03-13  1:39 ` [PATCH] MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling Huang Pei
2021-03-14 13:09   ` Thomas Bogendoerfer [this message]
2021-03-14 13:06 ` [PATCH V5] MIPS: clean up MIPS_PGD_C0_CONTEXT Thomas Bogendoerfer
  -- strict thread matches above, loose matches on Subject: below --
2021-02-27  6:19 [PATCH V2] MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT Huang Pei
2021-02-27  6:19 ` [PATCH] MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling Huang Pei
2021-02-28 23:00   ` Maciej W. Rozycki
2021-03-04  1:06     ` Huang Pei
2021-03-04  1:40       ` Maciej W. Rozycki
2021-03-05  7:13         ` Huang Pei
2021-03-07 20:54           ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210314130900.GB5165@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=ambrosehua@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=gaojuxin@loongson.cn \
    --cc=hejinyang@loongson.cn \
    --cc=huangpei@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lixuefeng@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=paulburton@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).