From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Huacai Chen <chenhc@lemote.com>
Cc: linux-mips@vger.kernel.org, Fuxin Zhang <zhangfx@lemote.com>,
Zhangjin Wu <wuzhangjin@gmail.com>,
Huacai Chen <chenhuacai@gmail.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>, chenj <chenj@lemote.com>
Subject: Re: [PATCH 1/2] MIPS: Loongson-3: Enable COP2 usage in kernel
Date: Wed, 29 Apr 2020 20:33:05 +0200 [thread overview]
Message-ID: <20200429183305.GB21234@alpha.franken.de> (raw)
In-Reply-To: <1588153121-28507-1-git-send-email-chenhc@lemote.com>
On Wed, Apr 29, 2020 at 05:38:40PM +0800, Huacai Chen wrote:
> From: chenj <chenj@lemote.com>
>
> Loongson-3's COP2 is Multi-Media coprocessor, it is disabled in kernel
> mode by default. However, gslq/gssq (16-bytes load/store instructions)
> overrides the instruction format of lwc2/swc2. If we wan't to use gslq/
> gssq for optimization in kernel, we should enable COP2 usage in kernel.
What aboout context switches ? Or is the copro only used by one kernel
driver ?
> diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
> index ce40fbf..0f71540 100644
> --- a/arch/mips/include/asm/mipsregs.h
> +++ b/arch/mips/include/asm/mipsregs.h
> @@ -386,6 +386,7 @@
> #define ST0_CU1 0x20000000
> #define ST0_CU2 0x40000000
> #define ST0_CU3 0x80000000
> +#define ST0_MM 0x40000000 /* Loongson-3 naming */
please use ST0_CU2, so everybody understands it's COO2
> @@ -450,7 +450,11 @@
> */
> .macro CLI
> mfc0 t0, CP0_STATUS
> +#ifdef CONFIG_CPU_LOONGSON64
> + li t1, ST0_CU0 | ST0_MM | STATMASK
> +#else
> li t1, ST0_CU0 | STATMASK
> +#endif
you are doing this three time in this file. How about doing
#ifdef CONFIG_CPU_LOONGSON64
#define ST0_MASK ST0_CU0 | ST0_CU2
#else
#define ST0_MASK ST0_CU0
#endif
and use ST0_MASK ?
> diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
> index 3b02ffe..cdac82d 100644
> --- a/arch/mips/kernel/head.S
> +++ b/arch/mips/kernel/head.S
> @@ -45,18 +45,34 @@
>
> .macro setup_c0_status_pri
> #ifdef CONFIG_64BIT
> +#ifdef CONFIG_CPU_LOONGSON64
> + setup_c0_status ST0_KX|ST0_MM 0
> +#else
> setup_c0_status ST0_KX 0
> +#endif
same thing here.
> --- a/arch/mips/kernel/r4k_switch.S
> +++ b/arch/mips/kernel/r4k_switch.S
> @@ -53,6 +53,9 @@
> nor a3, $0, a3
> and a2, a3
> or a2, t1
> +#ifdef CONFIG_CPU_LOONGSON64
> + or a2, ST0_MM
> +#endif
this looks wrong. If THERAD_STATUS is setup correct, you don't need
to mess with ST0_CU2 here.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2020-04-29 18:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 9:38 [PATCH 1/2] MIPS: Loongson-3: Enable COP2 usage in kernel Huacai Chen
2020-04-29 9:38 ` [PATCH 2/2] MIPS: Loongson-3: Calculate ra properly when unwinding the stack Huacai Chen
2020-04-29 18:33 ` Thomas Bogendoerfer [this message]
2020-04-30 7:54 ` [PATCH 1/2] MIPS: Loongson-3: Enable COP2 usage in kernel Huacai Chen
2020-05-01 0:44 ` Maciej W. Rozycki
2020-05-14 5:44 ` Huacai Chen
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=20200429183305.GB21234@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=chenhc@lemote.com \
--cc=chenhuacai@gmail.com \
--cc=chenj@lemote.com \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-mips@vger.kernel.org \
--cc=wuzhangjin@gmail.com \
--cc=zhangfx@lemote.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.