lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H4GeBYBNLq6w6W5aj+kUWQacJmNnkwB5uL_jVQNKMtCTw@mail.gmail.com>
Date: Fri, 29 Aug 2025 18:09:03 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Bibo Mao <maobibo@...ngson.cn>
Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>, WANG Xuerui <kernel@...0n.name>, kvm@...r.kernel.org, 
	loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: KVM: Add PTW feature detection on 3C6000 host

Applied, thanks.


Huacai

On Tue, Aug 26, 2025 at 11:35 AM Bibo Mao <maobibo@...ngson.cn> wrote:
>
> With 3C6000 hardware platform, hardware page table walking(PTW) features
> is supported on host. Here add this feature detection on KVM host.
>
> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
> ---
>  arch/loongarch/include/uapi/asm/kvm.h | 1 +
>  arch/loongarch/kvm/vcpu.c             | 2 ++
>  arch/loongarch/kvm/vm.c               | 4 ++++
>  3 files changed, 7 insertions(+)
>
> diff --git a/arch/loongarch/include/uapi/asm/kvm.h b/arch/loongarch/include/uapi/asm/kvm.h
> index 5f354f5c6847..57ba1a563bb1 100644
> --- a/arch/loongarch/include/uapi/asm/kvm.h
> +++ b/arch/loongarch/include/uapi/asm/kvm.h
> @@ -103,6 +103,7 @@ 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
>
>  /* Device Control API on vcpu fd */
>  #define KVM_LOONGARCH_VCPU_CPUCFG      0
> diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
> index ce478151466c..9c802f7103c6 100644
> --- a/arch/loongarch/kvm/vcpu.c
> +++ b/arch/loongarch/kvm/vcpu.c
> @@ -680,6 +680,8 @@ static int _kvm_get_cpucfg_mask(int id, u64 *v)
>                         *v |= CPUCFG2_ARMBT;
>                 if (cpu_has_lbt_mips)
>                         *v |= CPUCFG2_MIPSBT;
> +               if (cpu_has_ptw)
> +                       *v |= CPUCFG2_PTW;
>
>                 return 0;
>         case LOONGARCH_CPUCFG3:
> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> index edccfc8c9cd8..a49b1c1a3dd1 100644
> --- a/arch/loongarch/kvm/vm.c
> +++ b/arch/loongarch/kvm/vm.c
> @@ -146,6 +146,10 @@ 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;
>         default:
>                 return -ENXIO;
>         }
> --
> 2.39.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ