[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <de4c715f-db47-70b5-91a7-a436bf3a1c1b@loongson.cn>
Date: Mon, 14 Jul 2025 17:57:18 +0800
From: Bibo Mao <maobibo@...ngson.cn>
To: Tianrui Zhao <zhaotianrui@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>
Cc: WANG Xuerui <kernel@...0n.name>, kvm@...r.kernel.org,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: KVM: Add some feature detection on host with
3C6000
Maybe it is too early to submit such patch :(
At least there is new CSR registers about AVEC feature which are not
saved and restored in vCPU context switch function. And the AVEC feature
in KVM is not tested also.
Regards
Bibo Mao
On 2025/7/7 上午11:51, Bibo Mao wrote:
> With 3C6000 hardware platform, hardware page table walking and avec
> features are supported on host. Here add these two feature detection
> on KVM host.
>
> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
> ---
> arch/loongarch/include/uapi/asm/kvm.h | 2 ++
> arch/loongarch/kvm/vm.c | 8 ++++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/arch/loongarch/include/uapi/asm/kvm.h b/arch/loongarch/include/uapi/asm/kvm.h
> index 5f354f5c6847..0b9feb6c0d53 100644
> --- a/arch/loongarch/include/uapi/asm/kvm.h
> +++ b/arch/loongarch/include/uapi/asm/kvm.h
> @@ -103,6 +103,8 @@ struct kvm_fpu {
> #define KVM_LOONGARCH_VM_FEAT_PMU 5
> #define KVM_LOONGARCH_VM_FEAT_PV_IPI 6
> #define KVM_LOONGARCH_VM_FEAT_PV_STEALTIME 7
> +#define KVM_LOONGARCH_VM_FEAT_PTW 8
> +#define KVM_LOONGARCH_VM_FEAT_AVEC 9
>
> /* Device Control API on vcpu fd */
> #define KVM_LOONGARCH_VCPU_CPUCFG 0
> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> index edccfc8c9cd8..728b24a62f1e 100644
> --- a/arch/loongarch/kvm/vm.c
> +++ b/arch/loongarch/kvm/vm.c
> @@ -146,6 +146,14 @@ static int kvm_vm_feature_has_attr(struct kvm *kvm, struct kvm_device_attr *attr
> if (kvm_pvtime_supported())
> return 0;
> return -ENXIO;
> + case KVM_LOONGARCH_VM_FEAT_PTW:
> + if (cpu_has_ptw)
> + return 0;
> + return -ENXIO;
> + case KVM_LOONGARCH_VM_FEAT_AVEC:
> + if (cpu_has_avecint)
> + return 0;
> + return -ENXIO;
> default:
> return -ENXIO;
> }
>
Powered by blists - more mailing lists