Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp327270rdb; Thu, 2 Nov 2023 05:07:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGusZrPhDRJSGZ1u48awbxIg/2LxH3T6cHP3HA7BI9cZFBWxDCut5Go9on+MB5APbJ/mPdL X-Received: by 2002:a17:90b:1d8b:b0:280:19ba:7816 with SMTP id pf11-20020a17090b1d8b00b0028019ba7816mr12669443pjb.10.1698926863559; Thu, 02 Nov 2023 05:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698926863; cv=none; d=google.com; s=arc-20160816; b=T6xWx6LCRxgNvNKXeeubSPPUomAbL+idVsx0XFSB6ezLjoINs2uXQ5gS90vscXRCHK 20AFje25rr6q0QR+pioaGBlhRSfwka+CcPdHQCY04Fp0hugZeJ+LAfvYDNp6kyUJUVKX ZpIlp54PV/ivFeYPCEORqoF2zo17238jbKTSCbqw7meNQ1OvE1dLsblOPoPfOucHxCf4 431qBMY6n7D8R32Tm+10aYZEcrKE/HlGsk9uHejZrjjhqhrVYNwjUYfwcbnFfKNA7fyz iwoR79v60qnlKWMJWgTP16GePgjbl06LvcVO4i3HbFztltdDSZ5KDdfI5SROQmMPDN7t lp5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=ftnYGlHohU4PgAvOLDfsNbFmXMcl+RaArmfMB/fCVZg=; fh=WxEQ060hcXMllTvwPjILVQRWExfoTCYVIJoFBeMGS9Y=; b=bHGxSadJ0GJPnXEpP6m/qHetS8dPqg2CW8zacxoCHbTcFi7gKIHYJ1R2w3V4ZSdlC7 RfEGlkolXeWvv8fY7qUkrPDuyvfW1PN44Dt+0pn0Zx4JuNoHXSPObp6mkuO4fPgz2UKa Er2+Cp9rJ4nL5AlkD+L6EAwAAdBCeUK9WkHt3bSCF/0KW8RKHcqpgFTK7ybTpQDiCGp0 IvDljqx+JDlf9xl2pBdeaAHhmxBUJk+BpzlPgrAOaqMDyikgCMIYvrXa9JMBA/fO/FEY EH2rwMMPpc+axADWsLvV1YxthDPt/FBbv749odnTJukz7j+udabQmPrfOHhGq+y7/MPt 2DOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=T+jOFR+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id oo18-20020a17090b1c9200b00252d84b7af0si2830403pjb.181.2023.11.02.05.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 05:07:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=T+jOFR+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 434DE8028FE7; Thu, 2 Nov 2023 05:07:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235564AbjKBMGg (ORCPT + 99 others); Thu, 2 Nov 2023 08:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235583AbjKBMEj (ORCPT ); Thu, 2 Nov 2023 08:04:39 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9007110F9 for ; Thu, 2 Nov 2023 05:02:07 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6c0f14d6875so860585b3a.1 for ; Thu, 02 Nov 2023 05:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1698926527; x=1699531327; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ftnYGlHohU4PgAvOLDfsNbFmXMcl+RaArmfMB/fCVZg=; b=T+jOFR+8YUBSxO12vO53oCoIukGFpca/JywKIajBwzf3v3VdE/wUsYzG32sjxJVR4c +9ZHUOvqPMaGaIUfoSClF44U8nOeXepH6kD0C8KwWbjmNLNzFOn0O47moht18tVoEDv6 99xwWaKryihz/Euxj8t6JhgQN6gbpmdkpE1LWIYQ/fIi36zj5dirgdtrMqxJd+1o4p1t XHsYpr21UJikwH2Cwa10hq/99llIbo33DGLTN34S7daCVPxEd7xF1IIowf13GdD3x4Eq WmmpP3yjZQT14KYBbf2q/PZ0E52hnxBNdw9d8U9YqtTK2gK5GWeT0SfdTeHit9XYfOfH mVXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698926527; x=1699531327; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ftnYGlHohU4PgAvOLDfsNbFmXMcl+RaArmfMB/fCVZg=; b=YyJOrRjHQ5qPg0ikJKFFghI8xGcavlM0P7tIUOOUE05eS4GnHLJJEX9dZDRJJWgw0B blxozWQwYoE5DsFkLFZ4HcLi5gRvH7nJawtMpPwVCGrmD10BYLu6MtAsEGP1yLVI5iJg PNpei0PqIkqeaOs7MH8ihRGW1QGdXFgbUj8m3vu2ol4SgqY0FscBWbQNG3n4sBlAC2AU Z/NeBoHfEDOQbPhd6A9RVAwWHpw/AUo/d5fTaqQLruGZmUyMHKmRHOKT0qe1003S771U jKbmmi4aliGSNkMC6WXDqr8DkN+8SuVoFEONPMXbien36280nHgHuibKRwuuO//KemkK 4xeg== X-Gm-Message-State: AOJu0YyCGfncD8QXr26oCsuQWZJpW3rv3OdNmHdcEA5YnewQJNmK3s2r q2KOd0pI+wOIeMFTB5+7JHfxmA== X-Received: by 2002:a17:902:d50d:b0:1cc:3875:e654 with SMTP id b13-20020a170902d50d00b001cc3875e654mr12967681plg.26.1698926526894; Thu, 02 Nov 2023 05:02:06 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id l12-20020a170902f68c00b001cc0f6028b8sm2969008plg.106.2023.11.02.05.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 05:02:06 -0700 (PDT) From: Yong-Xuan Wang To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org Cc: greentime.hu@sifive.com, vincent.chen@sifive.com, tjytimi@163.com, alex@ghiti.fr, conor.dooley@microchip.com, ajones@ventanamicro.com, Yong-Xuan Wang , Paolo Bonzini , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Haibo Xu , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/4] KVM: riscv: selftests: Add Svadu Extension to get-reg-list testt Date: Thu, 2 Nov 2023 12:01:25 +0000 Message-Id: <20231102120129.11261-5-yongxuan.wang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231102120129.11261-1-yongxuan.wang@sifive.com> References: <20231102120129.11261-1-yongxuan.wang@sifive.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 02 Nov 2023 05:07:38 -0700 (PDT) Update the get-reg-list test to test the Svadu Extension is available for guest OS. Signed-off-by: Yong-Xuan Wang --- .../testing/selftests/kvm/riscv/get-reg-list.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 9f99ea42f45f..972538d76f48 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -49,6 +49,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICSR: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIFENCEI: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIHPM: + case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SVADU: return true; /* AIA registers are always available when Ssaia can't be disabled */ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(siselect): @@ -340,6 +341,7 @@ static const char *isa_ext_id_to_str(__u64 id) "KVM_RISCV_ISA_EXT_ZICSR", "KVM_RISCV_ISA_EXT_ZIFENCEI", "KVM_RISCV_ISA_EXT_ZIHPM", + "KVM_RISCV_ISA_EXT_SVADU", }; if (reg_off >= ARRAY_SIZE(kvm_isa_ext_reg_name)) { @@ -700,6 +702,10 @@ static __u64 fp_d_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_D, }; +static __u64 svadu_regs[] = { + KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SVADU, +}; + #define BASE_SUBLIST \ {"base", .regs = base_regs, .regs_n = ARRAY_SIZE(base_regs), \ .skips_set = base_skips_set, .skips_set_n = ARRAY_SIZE(base_skips_set),} @@ -739,6 +745,9 @@ static __u64 fp_d_regs[] = { #define FP_D_REGS_SUBLIST \ {"fp_d", .feature = KVM_RISCV_ISA_EXT_D, .regs = fp_d_regs, \ .regs_n = ARRAY_SIZE(fp_d_regs),} +#define SVADU_REGS_SUBLIST \ + {"svadu", .feature = KVM_RISCV_ISA_EXT_SVADU, .regs = svadu_regs, \ + .regs_n = ARRAY_SIZE(svadu_regs),} static struct vcpu_reg_list h_config = { .sublists = { @@ -876,6 +885,14 @@ static struct vcpu_reg_list fp_d_config = { }, }; +static struct vcpu_reg_list svadu_config = { + .sublists = { + BASE_SUBLIST, + SVADU_REGS_SUBLIST, + {0}, + }, +}; + struct vcpu_reg_list *vcpu_configs[] = { &h_config, &zicbom_config, @@ -894,5 +911,6 @@ struct vcpu_reg_list *vcpu_configs[] = { &aia_config, &fp_f_config, &fp_d_config, + &svadu_config, }; int vcpu_configs_n = ARRAY_SIZE(vcpu_configs); -- 2.17.1