[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63b68574-4af7-3524-4fc7-edac7ec82d84@xen0n.name>
Date: Fri, 14 Jul 2023 18:09:29 +0800
From: WANG Xuerui <kernel@...0n.name>
To: bibo mao <maobibo@...ngson.cn>, Huacai Chen <chenhuacai@...nel.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
loongarch@...ts.linux.dev, Jens Axboe <axboe@...nel.dk>,
Mark Brown <broonie@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>,
Xi Ruoyao <xry111@...111.site>, hejinyang@...ngson.cn,
Tianrui Zhao <zhaotianrui@...ngson.cn>
Subject: Re: [PATCH v16 05/30] LoongArch: KVM: Add vcpu related header files
On 2023/7/14 17:58, bibo mao wrote:
>
>
> 在 2023/7/14 17:22, Huacai Chen 写道:
>> Hi, Bibo,
>>
>> On Fri, Jul 14, 2023 at 3:45 PM bibo mao <maobibo@...ngson.cn> wrote:
>>>
>>>
>>>
>>> 在 2023/7/14 15:11, Huacai Chen 写道:
>>>> Hi, Tianrui,
>>>>
>>>> On Thu, Jun 29, 2023 at 3:55 PM Tianrui Zhao <zhaotianrui@...ngson.cn> wrote:
>>>>>
>>>>> Add LoongArch vcpu related header files, including vcpu csr
>>>>> information, irq number defines, and some vcpu interfaces.
>>>>>
>>>>> Reviewed-by: Bibo Mao <maobibo@...ngson.cn>
>>>>> Signed-off-by: Tianrui Zhao <zhaotianrui@...ngson.cn>
>>>>> ---
>>>>> 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.
>>
>> Huacai
> If so, could you post patch to x86 or riscv to remove hardcode binary
> assemble code? If x86 or riscv agree, I do not object.
Don't panic my friend, and generally please don't (figuratively) point
finger at people :)
As a newcomer architecture, I'd argue we're in a different position than
them. The other arches already have a sizable group of developers
running existing systems from some time ago, so the cumulative migration
cost may be too high for them to drop the compatibility code path.
But AFAIK the LoongArch ecosystem simply doesn't have comparable number
of infra developers (to the point that most of the prominent maintainers
and coders can be reached in some <5 WeChat groups), and they invariably
update the dev rigs frequently, so the migration cost for us should be
significantly lower. (While the total number of LoongArch end-users and
app developers may be higher, I expect some 5000~10000 of them, most of
them don't compile their own kernels. So it's really just the kernel and
distro devs.)
--
WANG "xen0n" Xuerui
Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Powered by blists - more mailing lists