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:
 <TY1PPFCDFFFA68A1D3B18B1133B8B28B1C6F332A@TY1PPFCDFFFA68A.apcprd02.prod.outlook.com>
Date: Thu, 21 Aug 2025 10:49:45 +0800
From: "Nutty.Liu" <nutty.liu@...mail.com>
To: fangyu.yu@...ux.alibaba.com, anup@...infault.org, atish.patra@...ux.dev,
 paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
 alex@...ti.fr
Cc: guoren@...nel.org, kvm@...r.kernel.org, kvm-riscv@...ts.infradead.org,
 linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read


On 8/20/2025 8:59 PM, fangyu.yu@...ux.alibaba.com wrote:
> From: "Guo Ren (Alibaba DAMO Academy)" <guoren@...nel.org>
>
> The HGATP has been set to zero in gstage_mode_detect(), so there
> is no need to save the old context. Unify the code convention
> with gstage_mode_detect().
>
> Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@...nel.org>
> Signed-off-by: Fangyu Yu <fangyu.yu@...ux.alibaba.com>
> ---
>   arch/riscv/kvm/vmid.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> index 5f33625f4070..abb1c2bf2542 100644
> --- a/arch/riscv/kvm/vmid.c
> +++ b/arch/riscv/kvm/vmid.c
> @@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
>   
>   void __init kvm_riscv_gstage_vmid_detect(void)
>   {
> -	unsigned long old;
> -
>   	/* Figure-out number of VMID bits in HW */
> -	old = csr_read(CSR_HGATP);
>   	csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
>   	vmid_bits = csr_read(CSR_HGATP);
>   	vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
>   	vmid_bits = fls_long(vmid_bits);
> -	csr_write(CSR_HGATP, old);
> +	csr_write(CSR_HGATP, 0);
Seems there is no need to set 'CSR_HGATP' as 0.
Otherwise,
Reviewed-by: Nutty Liu <nutty.liu@...mail.com>

Thanks,
Nutty
>   
>   	/* We polluted local TLB so flush all guest TLB */
>   	kvm_riscv_local_hfence_gvma_all();

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ