Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp378525rwb; Thu, 12 Jan 2023 07:20:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXtA/MDiramYaBXDu0ntVHNtiorE5oNf1MB10mSuGRLOHrWjkTf+TyDLGA3Ika34Vca1Y8l9 X-Received: by 2002:a05:6a20:13a0:b0:9d:efbe:a0f5 with SMTP id w32-20020a056a2013a000b0009defbea0f5mr118684998pzh.5.1673536841993; Thu, 12 Jan 2023 07:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673536841; cv=none; d=google.com; s=arc-20160816; b=UAlEIwlls3kDSTe414f1kN5N5E3bB8hd1hf0iiecy69mNqXiLLKqeSJ0fz7fOOVFaZ kuoC/AEZcL/Ld0wTSEn3+Vl25KuKyWhWtfHad1/yCKHVpbEdVGX6iMvU0Ae/Pr+u3A+s iMG/SSUkf6S7w47uGQrDCftl1aiwz1cZNLF8FXskkuOB1sWK1I8s5/FDOi178f14eJuC MBGt7CH8N5ilmfuj04OGRiyrCnVGzPS7l8kFG6BUJ9ijKr5Y8HK46aWcEn0OTXStqTBE BtCqGk9QBGx7cpCOWQ/Hb/SVj3u5EXUD3Uhbpc6aPstLdLkNP7kSihwks+Ub5GSzHr2W CwGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wjWQ9F0LaanvIi9SVaFlkrqw0WGzFdxUF931tj4YTWo=; b=b2OyEpBmGw60D6+ETOYKHJCPZIA3FO3NW89i3v/7xSr3LkITbxfJDPE7qap+a+iYZ6 PDzR7zR+wZhHSIreCJwI3qANb/I24xuUFUHn5I8vjInPDHErhwaeHzlSFtmXmoLWsLic kWHgtPndAPclKQnqNuxv0qtweKexJ/0/KUoh8ParB7NZSAOn7BvGzWdocDeWCA7wjm72 8v6HkpDdyX51AxQkS7OIOBPfnLVnNZl4t/l0wtGpS6GAnMNYI3W8PaiVkqvPyl/beLbv 3rVLPSyb5P/zH529bbdyNvbU99I6cb3p/FwfKksykFIVXSql37kT7ai4D4cErdd98TgL 6u0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="T+9X/H4J"; 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 n10-20020a635c4a000000b0047811809072si17809475pgm.92.2023.01.12.07.20.34; Thu, 12 Jan 2023 07:20:41 -0800 (PST) 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="T+9X/H4J"; 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 S232975AbjALOD5 (ORCPT + 51 others); Thu, 12 Jan 2023 09:03:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234090AbjALODk (ORCPT ); Thu, 12 Jan 2023 09:03:40 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A77B45274A for ; Thu, 12 Jan 2023 06:03:33 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id o8-20020a17090a9f8800b00223de0364beso23656470pjp.4 for ; Thu, 12 Jan 2023 06:03:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wjWQ9F0LaanvIi9SVaFlkrqw0WGzFdxUF931tj4YTWo=; b=T+9X/H4J/G3JlwF9psZ/cWzPV07niIG+bOZMhVU214/rAQWZSLhMuBw5PuaNrOyaiV oqNriOfX2cRc1DkYlgZq4HYRQbTaH5XagEPPtJ3krBvxRJEhA3JCjlUbuB7DUnDXQUuI 7MyPPjJ/vUwaVOW+hGCKlfcUqEFjFT5g2Dly6RCyg51Sgpc+d2G/Xa4t6nP/Aqtd7J98 Xt5v20IOdlplskt/PUCFRCi4wP2INn335nSmKdFV8gLZ5tJMMFu4xdEUnaVpHAzhcSo4 ZThl76vGl/Um6/ilm2ElYvHQOegLNry4OHmaaLOO5h6UcJgxFxVS7+wyL8gGR+kuUSCl Y7Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=wjWQ9F0LaanvIi9SVaFlkrqw0WGzFdxUF931tj4YTWo=; b=aPG+QjNL+4Q8Q6L/xiutdLPW55zxG1k3cUYtUnBnyhC1wj+Uu/VSDWW2gtRFDxLTa6 HaMWZoYJj9ZLNUgxuuUjZsla2/cLlaMaXpd/4qcI0G1Np3qtD6lsbUtYNKplaxePmw7s op16SkXDiUMx/WmToL8sCE8Hzax/mLnAUFgsA5dAU8Z+s9+/fZbCGxrJVNBOK6ncNSZg Kyx31Pkl00YCtb0jb6nI69peRL1OpY/0Le02KM9WZm3lbA+/TlQBRWHBMRh5Tz0VwNIM ymQVpoUUR5/w7Ot8mLZjHtKBj+zOoeExlpXkkM+YQWSuF4DsYYXnq6Dfewqezz74RkJ1 vo5w== X-Gm-Message-State: AFqh2kpu6+5TTm7cof3vqWrY4NrEortdtD5MCPefSBnxqC8Au5VEGDCh ArZpnPhr81Gp7eXT3Xf+IrwpoA== X-Received: by 2002:a17:902:ba12:b0:194:4016:11ac with SMTP id j18-20020a170902ba1200b00194401611acmr10522106pls.30.1673532213046; Thu, 12 Jan 2023 06:03:33 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id d11-20020a170902cecb00b001925016e34bsm12351455plg.79.2023.01.12.06.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 06:03:32 -0800 (PST) From: Anup Patel To: Paolo Bonzini , Atish Patra Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH 2/7] RISC-V: Detect AIA CSRs from ISA string Date: Thu, 12 Jan 2023 19:32:59 +0530 Message-Id: <20230112140304.1830648-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112140304.1830648-1-apatel@ventanamicro.com> References: <20230112140304.1830648-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 We have two extension names for AIA ISA support: Smaia (M-mode AIA CSRs) and Ssaia (S-mode AIA CSRs). We extend the ISA string parsing to detect Smaia and Ssaia extensions. Signed-off-by: Anup Patel --- arch/riscv/include/asm/hwcap.h | 8 ++++++++ arch/riscv/kernel/cpu.c | 2 ++ arch/riscv/kernel/cpufeature.c | 2 ++ 3 files changed, 12 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 86328e3acb02..c649e85ed7bb 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -59,10 +59,18 @@ enum riscv_isa_ext_id { RISCV_ISA_EXT_ZIHINTPAUSE, RISCV_ISA_EXT_SSTC, RISCV_ISA_EXT_SVINVAL, + RISCV_ISA_EXT_SSAIA, + RISCV_ISA_EXT_SMAIA, RISCV_ISA_EXT_ID_MAX }; static_assert(RISCV_ISA_EXT_ID_MAX <= RISCV_ISA_EXT_MAX); +#ifdef CONFIG_RISCV_M_MODE +#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SMAIA +#else +#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SSAIA +#endif + /* * This enum represents the logical ID for each RISC-V ISA extension static * keys. We can use static key to optimize code path if some ISA extensions diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 1b9a5a66e55a..a215ec929160 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -162,6 +162,8 @@ arch_initcall(riscv_cpuinfo_init); * extensions by an underscore. */ static struct riscv_isa_ext_data isa_ext_arr[] = { + __RISCV_ISA_EXT_DATA(smaia, RISCV_ISA_EXT_SMAIA), + __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), __RISCV_ISA_EXT_DATA(sscofpmf, RISCV_ISA_EXT_SSCOFPMF), __RISCV_ISA_EXT_DATA(sstc, RISCV_ISA_EXT_SSTC), __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 93e45560af30..3c5b51f519d5 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -228,6 +228,8 @@ void __init riscv_fill_hwcap(void) SET_ISA_EXT_MAP("zihintpause", RISCV_ISA_EXT_ZIHINTPAUSE); SET_ISA_EXT_MAP("sstc", RISCV_ISA_EXT_SSTC); SET_ISA_EXT_MAP("svinval", RISCV_ISA_EXT_SVINVAL); + SET_ISA_EXT_MAP("smaia", RISCV_ISA_EXT_SMAIA); + SET_ISA_EXT_MAP("ssaia", RISCV_ISA_EXT_SSAIA); } #undef SET_ISA_EXT_MAP } -- 2.34.1