From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0AF1EC7115D for ; Fri, 20 Jun 2025 10:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To:Mime-Version: Message-Id:Date:From:Cc:To:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3FkS6SMfap1fG3EFzJ1I0Xpn23RFHqNwWM21EY3DzsU=; b=iD2CAzBPd+/vlL x2q8pl7ZcNoKm5vJvh7JT4KG/T3q+gvybzP24EbflDjKcZG4ZgvrV+ZI0CLvhOVHhAg41R8xKKNe2 LcYfxrlP/x6hN8kvIEK5eflA58Mxtrfnt1vG7mvlENY2xiOzvWQogkYOZL3Q989WRUeFFcNQQLBnT oHC6X8vdTZm5YpyPt4hDDgGOP+7/bLW+uCWpSNcB4UU7B89n403zkiQpiNZlh/WcdYWOysxH4t97B poOCa+9mIad9UrCbEp1shchup2OWNgzsaDut4nn6yddndzF4fea6EaQB5d8CV9jMh5ssQb1Ntlxt9 9JdjnyOh4/72uAkdtJdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uSZ6z-0000000FLlw-3n55; Fri, 20 Jun 2025 10:36:45 +0000 Received: from sg-3-13.ptr.tlmpb.com ([101.45.255.13]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uSYBL-0000000FCph-3AJk for linux-riscv@lists.infradead.org; Fri, 20 Jun 2025 09:37:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=lanxincomputing-com.20200927.dkim.feishu.cn; t=1750412220; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=oeXxAIqzohSWPmedTEZHs1J1ce2tPrIZS+IBTNkDcr8=; b=AF1ceC70Y+GV1+D5xXqF8udpzakQZUwAaNT0se6YcyniphkrwbqLYF07pg7LFWVsj6AXhn ucJsWNwhk0Pc2leTiU3TP4ZBO0g4f+bhz/5VpimV1wsuuPGV6k2pz9hDJGEoxrE7C7mDpo iBduWSrtu80KrA7BPBWMls5kAbnv8Md5ytYL/Jwu2SSRatUNpYL7ykWF4yEIdpdxAaQx/Q nVP91BdtnmUaNCozzGXNhqk3byAgjosMXepeX01JU7vEDOugHXFNEn50O1VHKIXNsR5YNo bOSZBeeGmtEeFPk5krB62IYteWYdUdyYO7h6qi2K/Bc48uRVg7XsYRo0eBo80w== Subject: Re: [PATCH 1/5] RISC-V: KVM: Provide UAPI for Zicbop block size X-Original-From: Nutty Liu X-Lms-Return-Path: Content-Language: en-US User-Agent: Mozilla Thunderbird To: , , , , , Cc: , , , From: "Nutty Liu" Date: Fri, 20 Jun 2025 17:36:55 +0800 Message-Id: <193a6972-2498-4661-8b76-4303819ca0b2@lanxincomputing.com> Mime-Version: 1.0 Received: from [127.0.0.1] ([180.165.3.105]) by smtp.feishu.cn with ESMTPS; Fri, 20 Jun 2025 17:36:57 +0800 In-Reply-To: <553bacc4f66e815975bb8ee0e4696397407b0a82.1750164414.git.zhouquan@iscas.ac.cn> References: <553bacc4f66e815975bb8ee0e4696397407b0a82.1750164414.git.zhouquan@iscas.ac.cn> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250620_023712_152750_2E9AC4C3 X-CRM114-Status: GOOD ( 14.77 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On 6/17/2025 9:10 PM, zhouquan@iscas.ac.cn wrote: > From: Quan Zhou > > 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 > --- > 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 Thanks, Nutty > + return -EINVAL; > + break; > case KVM_REG_RISCV_CONFIG_REG(mvendorid): > if (reg_val == vcpu->arch.mvendorid) > break; _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv