On 2023/7/14 18:10, bibo mao wrote:
在 2023/7/14 17:22, Huacai Chen 写道:
Hi, Bibo,
On Fri, Jul 14, 2023 at 3:45 PM bibo mao <maobibo@xxxxxxxxxxx> wrote:
在 2023/7/14 15:11, Huacai Chen 写道:
Hi, Tianrui,
On Thu, Jun 29, 2023 at 3:55 PM Tianrui Zhao <zhaotianrui@xxxxxxxxxxx> wrote:
Add LoongArch vcpu related header files, including vcpu csr
information, irq number defines, and some vcpu interfaces.
Reviewed-by: Bibo Mao <maobibo@xxxxxxxxxxx>
Signed-off-by: Tianrui Zhao <zhaotianrui@xxxxxxxxxxx>
---
arch/loongarch/include/asm/insn-def.h | 55 ++++++
arch/loongarch/include/asm/kvm_csr.h | 231 +++++++++++++++++++++++++
arch/loongarch/include/asm/kvm_vcpu.h | 97 +++++++++++
arch/loongarch/include/asm/loongarch.h | 20 ++-
arch/loongarch/kvm/trace.h | 168 ++++++++++++++++++
5 files changed, 566 insertions(+), 5 deletions(-)
create mode 100644 arch/loongarch/include/asm/insn-def.h
create mode 100644 arch/loongarch/include/asm/kvm_csr.h
create mode 100644 arch/loongarch/include/asm/kvm_vcpu.h
create mode 100644 arch/loongarch/kvm/trace.h
diff --git a/arch/loongarch/include/asm/insn-def.h b/arch/loongarch/include/asm/insn-def.h
new file mode 100644
index 000000000000..e285ee108fb0
--- /dev/null
+++ b/arch/loongarch/include/asm/insn-def.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ASM_INSN_DEF_H
+#define __ASM_INSN_DEF_H
+
+#include <linux/stringify.h>
+#include <asm/gpr-num.h>
+#include <asm/asm.h>
+
+#define INSN_STR(x) __stringify(x)
+#define CSR_RD_SHIFT 0
+#define CSR_RJ_SHIFT 5
+#define CSR_SIMM14_SHIFT 10
+#define CSR_OPCODE_SHIFT 24
As all needed instructions have already upstream in binutils now and
binutils 2.41 will be released soon, I suggest again to introduce
AS_HAS_LVZ_EXTENSION and make KVM depend on AS_HAS_LVZ_EXTENSION.
It is a good news that binutils 2.41 has supported LVZ assemble language.
we will add AS_HAS_LVZ_EXTENSION support, however KVM need not depend on
AS_HAS_LVZ_EXTENSION since bintuils 2.41 is not popularly used. yeap we
need write beautiful code, also we should write code with pratical usage.
1, For pure upstream: the CI toolchain comes from
https://mirrors.edge.kernel.org/pub/tools/crosstool/. Since binutils
2.41 will be released soon, CI toolchain will also be updated soon.
2, For community distributions, such as Fedora rawhide, Debian
unstable and Arch: they usually choose the latest released version, so
binutils 2.41 will be used quickly.
3, For downstream distributions, such as UOS and Kylin: if they choose
kernel as new as 6.6, they may probably choose binutils as new as
2.41; if they choose an LTS kernel (e.g., 6.1), they should backport
KVM support to the kernel, then they don't have any reason to not
backport LVZ instructions support to binutils.
commit 616500232e632dba8b03981eeccadacf2fbf1c30
Author: Huacai Chen <chenhuacai@xxxxxxxxxx>
Date: Thu Jun 29 20:58:43 2023
LoongArch: Add vector extensions support
Introduce AS_HAS_LSX_EXTENSION and AS_HAS_LASX_EXTENSION to avoid non-
vector toolchains complains unsupported instructions.
Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
The vector patch 616500232e63"Add vector extensions support" is merged
with any reviewed-by or acked, vector depends on AS_HAS_LSX, so it requires
all the patches obey this rule. I just think it bring thing to the wrong
way.
For the record: I've gone through (earlier versions of) the patch but
simply didn't have time to do so for that last revision, to confidently
give my R-b. As can be seen from the Git history and mailing list
archives, my LoongArch time was fully allocated to ClangBuiltLinux (and
by extension, LLVM/Clang) at that time. By the time I was able to
properly look at this LSX/LASX patch, it was already in loongarch-next,
so even if I replied it'd be too late.
And, to make it clear: I'm not opposing your upstreaming effort or
"conspiring against you" in any way. With all the replies I'm only
trying to explain why some code can be dropped so every upstream dev
will have to maintain less code paths and have an easier life.
--
WANG "xen0n" Xuerui
Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/