Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2053528rwb; Sun, 15 Jan 2023 08:27:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXvKg0I1V/ROuId8OK6zYZSpT3JOcgJNt4yehKf5az7tAc99+B1z1m/L8UdMV7mPrXX2XYVV X-Received: by 2002:a17:906:1c89:b0:7c0:b3a3:9b70 with SMTP id g9-20020a1709061c8900b007c0b3a39b70mr81576008ejh.62.1673800042419; Sun, 15 Jan 2023 08:27:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673800042; cv=none; d=google.com; s=arc-20160816; b=MxWZxfjxyheJLmEFM47CbuXvV5/tp+S2h/e/wIZMgrVTR+ugaZ15CTu0O+mIbrnG8z rDQcuiAhGwfgcPyazcr99sV0pBOJK9tn3blmCOyDKxKQx7JU55dybI7//Npkhw9jrY98 MLjMtAjdcxnG+auM3AGndZHCwi6JlfbI+fYWBUzp8+V+BW8nYMQ1v4js1eIxdRvB3Tof yOB83QscOG9vsyv3xFwH2KkTBMRabOELq5kJKwjUDItB1a7WZOoRNo6B5ZaHzOxCwYLj GS3oy8cMvjYxWeppgJbb5zwP972YxdXY3D03OANjX7ufGqgqm21zgrP/+zOP4GTgLeIA uxQg== 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=TjD51clLEIKnL+uqyPrjPqGlvmWB9d163UMhrKaGerE=; b=iTVP8AtkQJm4gufX+LdffvcpkoQr699jk7o6HzcCryInXwPVQLo0YWiC6U8g2v/q29 MSKzT++yG992SVbZhC7ci3glI/efEaey9KHwhXu+FcyAEB9/lVzvJDS3RHzPGkmli9fA RnXFvFiqrnPH2A0DXVgjz0QGazfHppmaUwKcCXc+qfSknREi94depa+CZo06bEjYQnXA Wr6PiVid7IRKIrL/JoJyqMybG17Jl/JmOM0KrLr0yXG4kIMKFaYqy3acU9jLFWqyGmoZ wl3drsTt0iOM8dt5aVcIWWuYbI6brl2MoSAWoq2fU8tu9mhgKeW6LDDtFyfYNr0RlUnE W6yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uMU+GHWC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp16-20020a1709071b1000b007ae86742c37si3576256ejc.60.2023.01.15.08.27.09; Sun, 15 Jan 2023 08:27:22 -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=@kernel.org header.s=k20201202 header.b=uMU+GHWC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231365AbjAOQAk (ORCPT + 52 others); Sun, 15 Jan 2023 11:00:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbjAOQAa (ORCPT ); Sun, 15 Jan 2023 11:00:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0695D10AA3; Sun, 15 Jan 2023 08:00:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD5B2B80B86; Sun, 15 Jan 2023 16:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1EE3C433F1; Sun, 15 Jan 2023 16:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673798424; bh=MBqOT6Dn2xWnMUPTimSWb1S2FBQlANOrjBTxRpgF3Ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uMU+GHWCSYdVhoI7WVAMFlQhU+NeBibCeUvYzk/5xPRBFNdVnSTXTq5nmvqmd9zfH jgceZoufvIXcLgPp8P+BoOfDjoFaFQIcIyIuI3a+Afi2oLYMm0DcoJpdPhBbxGOhO6 ZSYa/0a+MqDRktdr+zNZbWkoZuM7Era1qguDFp+dzGnS4tnez1C2O28nUJSCbUAuD4 D4E40d5fJ1bx+NmHtqHpK9AOusV/70vPmEebxSEPOILwR5eJuJ7SBrIq1w1pw/36MI 53iXIS9qQATCgdrnhuqJqQxngloJ22yEK5AxOfLek12SoRfoYaCPnX0apV38RcyuvQ lyLMrd5kjGPRA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Heiko Stuebner , Conor Dooley , Andrew Jones Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: [PATCH v4 04/13] riscv: hwcap: make ISA extension ids can be used in asm Date: Sun, 15 Jan 2023 23:49:44 +0800 Message-Id: <20230115154953.831-5-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230115154953.831-1-jszhang@kernel.org> References: <20230115154953.831-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 So that ISA extensions can be used in assembly files, convert the multi-letter RISC-V ISA extension IDs enums to macros. In order to make them visible, move the #ifndef __ASSEMBLY__ guard to a later point in the header Signed-off-by: Jisheng Zhang Reviewed-by: Heiko Stuebner Reviewed-by: Andrew Jones Reviewed-by: Conor Dooley --- arch/riscv/include/asm/hwcap.h | 45 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 86328e3acb02..09a7767723f6 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -12,20 +12,6 @@ #include #include -#ifndef __ASSEMBLY__ -#include -/* - * This yields a mask that user programs can use to figure out what - * instruction set this cpu supports. - */ -#define ELF_HWCAP (elf_hwcap) - -enum { - CAP_HWCAP = 1, -}; - -extern unsigned long elf_hwcap; - #define RISCV_ISA_EXT_a ('a' - 'a') #define RISCV_ISA_EXT_c ('c' - 'a') #define RISCV_ISA_EXT_d ('d' - 'a') @@ -46,22 +32,33 @@ extern unsigned long elf_hwcap; #define RISCV_ISA_EXT_BASE 26 /* - * This enum represent the logical ID for each multi-letter RISC-V ISA extension. + * These macros represent the logical ID for each multi-letter RISC-V ISA extension. * The logical ID should start from RISCV_ISA_EXT_BASE and must not exceed * RISCV_ISA_EXT_MAX. 0-25 range is reserved for single letter * extensions while all the multi-letter extensions should define the next * available logical extension id. */ -enum riscv_isa_ext_id { - RISCV_ISA_EXT_SSCOFPMF = RISCV_ISA_EXT_BASE, - RISCV_ISA_EXT_SVPBMT, - RISCV_ISA_EXT_ZICBOM, - RISCV_ISA_EXT_ZIHINTPAUSE, - RISCV_ISA_EXT_SSTC, - RISCV_ISA_EXT_SVINVAL, - RISCV_ISA_EXT_ID_MAX +#define RISCV_ISA_EXT_SSCOFPMF 26 +#define RISCV_ISA_EXT_SVPBMT 27 +#define RISCV_ISA_EXT_ZICBOM 28 +#define RISCV_ISA_EXT_ZIHINTPAUSE 29 +#define RISCV_ISA_EXT_SSTC 30 +#define RISCV_ISA_EXT_SVINVAL 31 + +#ifndef __ASSEMBLY__ +#include +/* + * This yields a mask that user programs can use to figure out what + * instruction set this cpu supports. + */ +#define ELF_HWCAP (elf_hwcap) + +enum { + CAP_HWCAP = 1, }; -static_assert(RISCV_ISA_EXT_ID_MAX <= RISCV_ISA_EXT_MAX); + +extern unsigned long elf_hwcap; + /* * This enum represents the logical ID for each RISC-V ISA extension static -- 2.38.1