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] [thread-next>] [day] [month] [year] [list]
Message-Id: <193a6972-2498-4661-8b76-4303819ca0b2@lanxincomputing.com>
Date: Fri, 20 Jun 2025 17:36:55 +0800
From: "Nutty Liu" <liujingqi@...xincomputing.com>
To: <zhouquan@...as.ac.cn>, <anup@...infault.org>, <ajones@...tanamicro.com>, 
	<atishp@...shpatra.org>, <paul.walmsley@...ive.com>, 
	<palmer@...belt.com>
Cc: <linux-kernel@...r.kernel.org>, <linux-riscv@...ts.infradead.org>, 
	<kvm@...r.kernel.org>, <kvm-riscv@...ts.infradead.org>
Subject: Re: [PATCH 1/5] RISC-V: KVM: Provide UAPI for Zicbop block size

On 6/17/2025 9:10 PM, zhouquan@...as.ac.cn wrote:
> From: Quan Zhou <zhouquan@...as.ac.cn>
>
> We're about to allow guests to use the Zicbop extension.
> KVM userspace needs to know the cache block size in order to
> properly advertise it to the guest. Provide a virtual config
> register for userspace to get it with the GET_ONE_REG API, but
> setting it cannot be supported, so disallow SET_ONE_REG.
>
> Signed-off-by: Quan Zhou <zhouquan@...as.ac.cn>
> ---
>   arch/riscv/include/uapi/asm/kvm.h |  1 +
>   arch/riscv/kvm/vcpu_onereg.c      | 11 +++++++++++
>   2 files changed, 12 insertions(+)
>
> diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h
> index 5f59fd226cc5..0863ca178066 100644
> --- a/arch/riscv/include/uapi/asm/kvm.h
> +++ b/arch/riscv/include/uapi/asm/kvm.h
> @@ -55,6 +55,7 @@ struct kvm_riscv_config {
>   	unsigned long mimpid;
>   	unsigned long zicboz_block_size;
>   	unsigned long satp_mode;
> +	unsigned long zicbop_block_size;
>   };
>   
>   /* CORE registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
> diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c
> index 2e1b646f0d61..b08a22eaa7a7 100644
> --- a/arch/riscv/kvm/vcpu_onereg.c
> +++ b/arch/riscv/kvm/vcpu_onereg.c
> @@ -256,6 +256,11 @@ static int kvm_riscv_vcpu_get_reg_config(struct kvm_vcpu *vcpu,
>   			return -ENOENT;
>   		reg_val = riscv_cboz_block_size;
>   		break;
> +	case KVM_REG_RISCV_CONFIG_REG(zicbop_block_size):
> +		if (!riscv_isa_extension_available(vcpu->arch.isa, ZICBOP))
> +			return -ENOENT;
> +		reg_val = riscv_cbop_block_size;
> +		break;
>   	case KVM_REG_RISCV_CONFIG_REG(mvendorid):
>   		reg_val = vcpu->arch.mvendorid;
>   		break;
> @@ -347,6 +352,12 @@ static int kvm_riscv_vcpu_set_reg_config(struct kvm_vcpu *vcpu,
>   		if (reg_val != riscv_cboz_block_size)
>   			return -EINVAL;
>   		break;
> +	case KVM_REG_RISCV_CONFIG_REG(zicbop_block_size):
> +		if (!riscv_isa_extension_available(vcpu->arch.isa, ZICBOP))
> +			return -ENOENT;
> +		if (reg_val != riscv_cbop_block_size)

Seems "riscv_cbop_block_size" has not been declared.
Otherwise,
Reviewed-by: Nutty Liu<liujingqi@...xincomputing.com>

Thanks,
Nutty

> +			return -EINVAL;
> +		break;
>   	case KVM_REG_RISCV_CONFIG_REG(mvendorid):
>   		if (reg_val == vcpu->arch.mvendorid)
>   			break;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ