Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9085428rwr; Thu, 11 May 2023 09:45:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xoEBXO2UtxxKm+5LRJwOO6vXe7ZrzFMZiS2kJJ9J9DGVADpe0XIUJ9xxl/AfJkIxeWAcH X-Received: by 2002:a05:6a20:1443:b0:101:41f8:7a17 with SMTP id a3-20020a056a20144300b0010141f87a17mr11374751pzi.20.1683823525525; Thu, 11 May 2023 09:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683823525; cv=none; d=google.com; s=arc-20160816; b=Z9eaOBOVWLphmw+izwdQHw2qU6N9bUA1F1u6CEo55QKLB9i+41vXqD5990dbl5MgBC Ot8ZEVQ7aYGa8vvgZkKJRhbJR+c6/IzRmv8uj/H7GnjAPnNkpe5V2VjNBOwy/P/Z+FfS LHmKLofEsqgghOVuxkEjbPFti5HyzBscKBLaafaIcD4VVRkwTob7dRZnvPjLsHLvbUJP mRHh9+uSva7ARTPwi5YJKY+jRMEAtRaPSg4/qaCylnZSlKle2EFe7rkQz/c7xCpAyQlY +YgxKw81xkhgI28Ge+04SV7IyKgST+vz0JzobUXin14rbLia+xW8HBlV09YKefPfOaWA 5sBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rWPj+0MEcU+bJjFDLtiKhJORofVGXZE+QDk7KaJWG9E=; b=CROvkJSF7ijiS8TUJFaY+gaZPq4odiaYikEsi6Woc4AUruTmoFf3Y6rXQN6fbtdE8r sEOkZmSYlE6tHnTQZ26rJuN/JttvxvoBb1dpWoXu50nLRl9O3maXDeBSRtS8+S3mP7MP 66wPhs2rZlRbJhLmN9AxqeC4oRXFNkMyZZ4rFy9jQzylZkaFbShvu797NNswGGk2tlNd AQYvmx3JmJOiLNdTtXihk1EOreyb13Vsti4DI+MKOKo1w92lmDhJcU7aMCsMrjlr26S0 TSjhb+b8aSW6BhyNotiTJXPwPvWYvyw+5bsCi7OXvw3zt6m6HIKLhcxMd7O7gkJtpIgl 36Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="UuPFreN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a63-20020a639042000000b0050309caf60esi7308911pge.750.2023.05.11.09.45.12; Thu, 11 May 2023 09:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="UuPFreN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238254AbjEKQkP (ORCPT + 99 others); Thu, 11 May 2023 12:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238706AbjEKQkK (ORCPT ); Thu, 11 May 2023 12:40:10 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E0667EFB for ; Thu, 11 May 2023 09:40:08 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f4ad71b00eso14530915e9.2 for ; Thu, 11 May 2023 09:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1683823207; x=1686415207; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rWPj+0MEcU+bJjFDLtiKhJORofVGXZE+QDk7KaJWG9E=; b=UuPFreN/sIyZvma3z9Xm6KxNZFcbh1TpDfsITGLUWBCWA6T4xHCFr5HuwlelWhANsc GODLbDYWSkjxpw1FlGH7zBZhqQl+PBnoza0HREbOpZD4TA496u22UD6bDXXczi7KYVpl vUHL3f5x4AXj97duCDa1dgEYjprlWsVyV+SBIS6xrVMPSwQcsV6kK8n5uf0FR6XnIuc4 bHtcnz/0qP1iI3PLzgpdryNpdPYlDZbySxQcLGTnHTgtAXoWs5v1mwmzllg9a6m64GLt EJC3fIG+NQH/j+vTbDoa5wKLgeATWhDm4OwK78ppk49kTcq7mfR/nc2WNPwoATtQv89M LAmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683823207; x=1686415207; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rWPj+0MEcU+bJjFDLtiKhJORofVGXZE+QDk7KaJWG9E=; b=DBWwzHil3O8HiOli9R7CoXWQQuX3EjmioVKSuL7WSH75PGKw2/9Epvm9pkhxDNKXYI AGN63/+IRgyoqe9UksQp5SDTScsWi6FL5caMc2RcFmFuj16RVi4dUVrR404kOnhsm6xF oGT2OXYtVl0Efsuwa65Vi3znG7gVnO+dP5wNT4A+9uGR3EEc0zsXI3RYT0jbbEzgDZ4o jPVuY1jX5hTpidOGzboqMMKIxtMPjOKoeBvvI7MVlA0nLYtrvbWEXsxn2ArB5KAnJPwB EZM6pCbygK9hHuvTDYCYJIIjlcfDtuQ2vI+dHRidNRVfpkK+0JEmpGxKEbGqj5znBVv3 op9w== X-Gm-Message-State: AC+VfDxeOyiT8xjSQtArR7dSVrhWPLsw2TZUbrgd37P91WXJI402xF1W XXTTQJ8LEuhUMQWR3xe2YZ4f4A== X-Received: by 2002:a1c:f20a:0:b0:3f1:819d:d050 with SMTP id s10-20020a1cf20a000000b003f1819dd050mr15055961wmc.37.1683823206802; Thu, 11 May 2023 09:40:06 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id 12-20020a05600c020c00b003f4b6bcbd8bsm4941659wmi.31.2023.05.11.09.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 09:40:06 -0700 (PDT) Date: Thu, 11 May 2023 18:40:05 +0200 From: Andrew Jones To: Haibo Xu Cc: xiaobo55x@gmail.com, Paolo Bonzini , Jonathan Corbet , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 1/2] riscv: kvm: Add KVM_GET_REG_LIST API support Message-ID: <20230511-d0a207eebb30fc88de875e4f@orel> References: <921fc2e1a91887170e277acb1b52df57480a5736.1683791148.git.haibo1.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <921fc2e1a91887170e277acb1b52df57480a5736.1683791148.git.haibo1.xu@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 11, 2023 at 05:22:48PM +0800, Haibo Xu wrote: > KVM_GET_REG_LIST API will return all registers that are available to > KVM_GET/SET_ONE_REG APIs. It's very useful to identify some platform > regression issue during VM migration. > > Since this API was already supported on arm64, it'd be straightforward > to enable it on riscv with similar code structure. > > Signed-off-by: Haibo Xu > --- > Documentation/virt/kvm/api.rst | 2 +- > arch/riscv/kvm/vcpu.c | 346 +++++++++++++++++++++++++++++++++ > 2 files changed, 347 insertions(+), 1 deletion(-) > > diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst > index add067793b90..280e89abd004 100644 > --- a/Documentation/virt/kvm/api.rst > +++ b/Documentation/virt/kvm/api.rst > @@ -3499,7 +3499,7 @@ VCPU matching underlying host. > --------------------- > > :Capability: basic > -:Architectures: arm64, mips > +:Architectures: arm64, mips, riscv > :Type: vcpu ioctl > :Parameters: struct kvm_reg_list (in/out) > :Returns: 0 on success; -1 on error > diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c > index 8bd9f2a8a0b9..fb8834e4fa15 100644 > --- a/arch/riscv/kvm/vcpu.c > +++ b/arch/riscv/kvm/vcpu.c > @@ -657,6 +657,334 @@ static int kvm_riscv_vcpu_set_reg_isa_ext(struct kvm_vcpu *vcpu, > return 0; > } > > +static inline unsigned long num_config_regs(void) > +{ > + return sizeof(struct kvm_riscv_config) / sizeof(unsigned long); We can't assume all config registers are present. For example, zicbom and zicboz block size registers are only present when their respective extensions are available. Thanks, drew