From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: WANG Xuerui <git@xen0n.name>, linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>, Tiezhu Yang <yangtiezhu@loongson.cn>
Subject: Re: [PATCH v2 RESEND 4/4] MIPS: emulate CPUCFG instruction on older Loongson64 cores
Date: Sun, 03 May 2020 23:50:09 +0800 [thread overview]
Message-ID: <3B0FE747-AE18-404B-9CD3-D3401634340C@flygoat.com> (raw)
In-Reply-To: <20200503105012.43246-1-git@xen0n.name>
于 2020年5月3日 GMT+08:00 下午6:50:13, WANG Xuerui <git@xen0n.name> 写到:
>CPUCFG is the instruction for querying processor characteristics on
>newer Loongson processors, much like CPUID of x86. Since the instruction
>is supposedly designed to provide a unified way to do feature detection
>(without having to, for example, parse /proc/cpuinfo which is too
>heavyweight), it is important to provide compatibility for older cores
>without native support. Fortunately, most of the fields can be
>synthesized without changes to semantics. Performance is not really big
>a concern, because feature detection logic is not expected to be
>invoked very often in typical userland applications.
>
>The instruction can't be emulated on LOONGSON_2EF cores, according to
>FlyGoat's experiments. Because the LWC2 opcode is assigned to other
>valid instructions on 2E and 2F, no RI exception is raised for us to
>intercept. So compatibility is only extended back furthest to
>Loongson-3A1000. Loongson-2K is covered too, as it is basically a remix
>of various blocks from the 3A/3B models from a kernel perspective.
>
>This is lightly based on Loongson's work on their Linux 3.10 fork, for
>being the authority on the right feature flags to fill in, where things
>aren't otherwise discoverable.
>
>Signed-off-by: WANG Xuerui <git@xen0n.name>
>Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Loongson-2K, 3B1500
>Cc: Huacai Chen <chenhc@lemote.com>
>Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
>Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
>---
Some random thoughts on that:
While cpucfg instruction would not be available on other MIPS
processors, and given that most distros are more willing to provide
general MIPS version instead of Loongson specified version, we'd better
provide user space programs a way to probe emulated/physical cpucfg support.
Looks like elf_hwcap would be a option? I've already added some flags about
Loongson's extension and now an extra HWCAP_LOONGSON_CPUCFG can cover everything.
>
>Resend because I forgot to include Jiaxun's review tags. Sorry for the
>noise.
>
> arch/mips/Kconfig | 11 ++
> arch/mips/include/asm/cpu-info.h | 9 ++
> .../include/asm/mach-loongson64/cpucfg-emul.h | 67 +++++++++
> arch/mips/kernel/cpu-probe.c | 129 ++++++++++++++++++
> arch/mips/kernel/traps.c | 45 ++++++
> arch/mips/loongson64/Makefile | 1 +
> arch/mips/loongson64/cpucfg-emul.c | 80 +++++++++++
> 7 files changed, 342 insertions(+)
> create mode 100644 arch/mips/include/asm/mach-loongson64/cpucfg-emul.h
> create mode 100644 arch/mips/loongson64/cpucfg-emul.c
--
Jiaxun Yang
next prev parent reply other threads:[~2020-05-03 15:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-02 13:38 [PATCH 0/4] CPUCFG emulation on older Loongson64 cores WANG Xuerui
2020-05-02 13:38 ` [PATCH 1/4] MIPS: Loongson64: fix typos in loongson_regs.h WANG Xuerui
2020-05-02 13:38 ` [PATCH 2/4] MIPS: Loongson64: define offsets and known revisions for some CPUCFG features WANG Xuerui
2020-05-02 13:38 ` [PATCH 3/4] MIPS: define more Loongson CP0.Config6 and CP0.Diag feature bits WANG Xuerui
2020-05-02 13:38 ` [PATCH 4/4] MIPS: emulate CPUCFG instruction on older Loongson64 cores WANG Xuerui
2020-05-02 13:59 ` Jiaxun Yang
2020-05-03 6:31 ` Huacai Chen
2020-05-03 7:58 ` Wang Xuerui
2020-05-03 8:25 ` Jiaxun Yang
2020-05-03 10:33 ` [PATCH v2 0/4] CPUCFG emulation " WANG Xuerui
2020-05-16 11:29 ` WANG Xuerui
2020-05-17 8:38 ` Thomas Bogendoerfer
2020-05-03 10:33 ` [PATCH v2 1/4] MIPS: Loongson64: fix typos in loongson_regs.h WANG Xuerui
2020-05-03 10:33 ` [PATCH v2 2/4] MIPS: Loongson64: define offsets and known revisions for some CPUCFG features WANG Xuerui
2020-05-03 10:33 ` [PATCH v2 3/4] MIPS: define more Loongson CP0.Config6 and CP0.Diag feature bits WANG Xuerui
2020-05-03 10:33 ` [PATCH v2 4/4] MIPS: emulate CPUCFG instruction on older Loongson64 cores WANG Xuerui
2020-05-03 10:50 ` [PATCH v2 RESEND " WANG Xuerui
2020-05-03 15:50 ` Jiaxun Yang [this message]
2020-05-04 5:25 ` WANG Xuerui
2020-05-04 6:58 ` Jiaxun Yang
2020-05-17 8:37 ` Thomas Bogendoerfer
2020-05-17 11:39 ` WANG Xuerui
2020-05-17 15:17 ` Thomas Bogendoerfer
2020-05-18 2:44 ` WANG Xuerui
2020-05-19 14:33 ` WANG Xuerui
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=3B0FE747-AE18-404B-9CD3-D3401634340C@flygoat.com \
--to=jiaxun.yang@flygoat.com \
--cc=chenhc@lemote.com \
--cc=git@xen0n.name \
--cc=linux-mips@vger.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 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.