From patchwork Fri Apr 19 13:53:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13636408 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 B858DC4345F for ; Fri, 19 Apr 2024 13:53:37 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ujyI2i1DwUlkqUGh8yaMTgKETft4KJa0IHqyiEZolDU=; b=duP0YiqBR/XfEd 3APJdec6OiqFwj8MSs6TYlwYfSy7KV/QS1X5SPw8Tq4eaAr2LkIxVjJvGMxDpLKXoTk9drtAquEX4 zy7pBGLJStHFBY/avEuFx/lmDagaA6WGidWpa2DVx+7V1yM9gZZak60edSOewK6VM8qPaTnikhPoZ /syWJbfwpRyDxwU1SHLV3/FmVOL1HX+8dGAZwjWyVT74bnb4LJ87d+3rkxfk6rsTZ674D/8jPHmAX c2hTkF193pcf/DUXmfOnUJKiCMzdZCluH5oaHaRHo0ZsefaymeFoWerDPht+HZjfkVq4jqsZ8RN7x ZTPgYSyBrFVxbc8GI3Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogG-00000005pEW-0wgp; Fri, 19 Apr 2024 13:53:32 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogB-00000005pBD-2iLR for linux-riscv@lists.infradead.org; Fri, 19 Apr 2024 13:53:29 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a55602507a9so244328766b.3 for ; Fri, 19 Apr 2024 06:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713534805; x=1714139605; darn=lists.infradead.org; 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=gDRrILn2Yb0nV2jBuOcECI8z5zE7jmWeMbNRJOqe+pg=; b=pUj22vMRhag1REdHBK4JXQsvCRs+Yc3ZxJrnFdOMKcbswlIDiY526dNJh3u2yeRRmv qeGczC1pyWaGY0S8LdY/cBud0UAYu3LSguMHv9BCg4MPeAR3a7tyDO/cU2fT9Tk15y/t qfYR1X/somfG3AbvcR1+b5CGmX/NKKhxgusky1+RNcEAZdAabyPvWu2bcqJZBi01szQI 1KYfx5hi1uwYayofufslGD26X/xu0lQWfUe9PUjYfQAvzO8DPlXkxJ/IlXn50EAqiGhN ur1+1yOa67Doj1hpabtNx9JUvKnH7sFcd/PoKDNeq8t6m06ZG62gi8HSM0BQ2PXjURkE D5GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534805; x=1714139605; 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=gDRrILn2Yb0nV2jBuOcECI8z5zE7jmWeMbNRJOqe+pg=; b=EOjc2XRI4jpfFZMpUNItlLh/aVoWCe7k2vYndPQsgvMcJzJMsJ0SFeDJZ6R2HLBqAM gtSuV259oPVzOwWM2d37/Q4ceRcKbllTGBVTJ5NGuexjIHRZJEii+TdTpEb0+WWD/1Bm dTruyQNBgupxq3QVUnHKvyr7LaFEz0hYtRDB8jaAXZglaCXFk4wKT4bGswEmTQxqjUf0 FUIGG0YtX5jSPv50EpedGwD7ZRC3ORAWvOoNqVH4VSqvFru+Lwt01jtEi/9bCvSYVZ1G Y1zN64V9QEmuImQ5mEfl+LlUg3LqdTqovMqwiE0PnwxlJnJcO2flAlE9u18dv2diH5bz S72Q== X-Gm-Message-State: AOJu0YxfIxppJdzWgcp2+W6nzP9Kl+cLCK59xrddFgSwC/+XsLLxhGsh Q37V0UIXM4XqAkRY67VZ4f1wo8FE4KNfZw+6n7KwOaOyKW9LSnkC8qiLU9KuVQYU5QC8cYOt/a6 Y91U= X-Google-Smtp-Source: AGHT+IFARVA4xqpRTy/M8TR2k0UEp7aiefGEX5Dkgqk03Yuv7B5CSdipP6x4sWl7IEmqFu/rmB4pkQ== X-Received: by 2002:a17:906:a24c:b0:a55:59e6:13f5 with SMTP id bi12-20020a170906a24c00b00a5559e613f5mr1771899ejb.26.1713534804765; Fri, 19 Apr 2024 06:53:24 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id f20-20020a17090624d400b00a5575cde7cdsm1948711ejb.220.2024.04.19.06.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:53:24 -0700 (PDT) From: Andrew Jones To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, anup@brainfault.org, atishp@atishpatra.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, christoph.muellner@vrull.eu, heiko@sntech.de, charlie@rivosinc.com, David.Laight@ACULAB.COM, parri.andrea@gmail.com, luxu.kernel@bytedance.com Subject: [PATCH v2 1/6] riscv: Provide a definition for 'pause' Date: Fri, 19 Apr 2024 15:53:23 +0200 Message-ID: <20240419135321.70781-9-ajones@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419135321.70781-8-ajones@ventanamicro.com> References: <20240419135321.70781-8-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_065327_718666_597C5303 X-CRM114-Status: GOOD ( 12.15 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org If we're going to provide the encoding for 'pause' in cpu_relax() anyway, then we can drop the toolchain checks and just always use it. The advantage of doing this is that other code that need pause don't need to also define it (yes, another use is coming). Add the definition to insn-def.h since it's an instruction definition and also because insn-def.h doesn't include much, so it's safe to include from asm/vdso/processor.h without concern for circular dependencies. Signed-off-by: Andrew Jones --- arch/riscv/Kconfig | 7 ------- arch/riscv/Makefile | 3 --- arch/riscv/include/asm/insn-def.h | 2 ++ arch/riscv/include/asm/vdso/processor.h | 8 ++------ 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index be09c8836d56..7427d8088337 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -639,13 +639,6 @@ config RISCV_ISA_ZICBOZ If you don't know what to do here, say Y. -config TOOLCHAIN_HAS_ZIHINTPAUSE - bool - default y - depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause) - depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause) - depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600 - config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI def_bool y # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 252d63942f34..f1792ac03335 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -75,9 +75,6 @@ else riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI) := $(riscv-march-y)_zicsr_zifencei endif -# Check if the toolchain supports Zihintpause extension -riscv-march-$(CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE) := $(riscv-march-y)_zihintpause - # Remove F,D,V from isa string for all. Keep extensions between "fd" and "v" by # matching non-v and non-multi-letter extensions out with the filter ([^v_]*) KBUILD_CFLAGS += -march=$(shell echo $(riscv-march-y) | sed -E 's/(rv32ima|rv64ima)fd([^v_]*)v?/\1\2/') diff --git a/arch/riscv/include/asm/insn-def.h b/arch/riscv/include/asm/insn-def.h index e27179b26086..64dffaa21bfa 100644 --- a/arch/riscv/include/asm/insn-def.h +++ b/arch/riscv/include/asm/insn-def.h @@ -196,4 +196,6 @@ INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0), \ RS1(base), SIMM12(4)) +#define RISCV_PAUSE ".4byte 0x100000f" + #endif /* __ASM_INSN_DEF_H */ diff --git a/arch/riscv/include/asm/vdso/processor.h b/arch/riscv/include/asm/vdso/processor.h index 96b65a5396df..8f383f05a290 100644 --- a/arch/riscv/include/asm/vdso/processor.h +++ b/arch/riscv/include/asm/vdso/processor.h @@ -5,6 +5,7 @@ #ifndef __ASSEMBLY__ #include +#include static inline void cpu_relax(void) { @@ -14,16 +15,11 @@ static inline void cpu_relax(void) __asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy)); #endif -#ifdef CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE /* * Reduce instruction retirement. * This assumes the PC changes. */ - __asm__ __volatile__ ("pause"); -#else - /* Encoding of the pause instruction */ - __asm__ __volatile__ (".4byte 0x100000F"); -#endif + __asm__ __volatile__ (RISCV_PAUSE); barrier(); } From patchwork Fri Apr 19 13:53:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13636410 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 B8B09C04FF6 for ; Fri, 19 Apr 2024 13:53:39 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p/zfyYPs3NRzb5ygzSehk17IxFn9fEPv1gJHHsuiqg4=; b=wMoZE44JQXP42b u/si7GuLoZmdI3VxiVomo+HcJ/jmcSDVu2d0y4iRkNJMCObLYcICXyUk2/r/UdPDal9x8PY+w/Uuu /Tp+3FJQPuqUHEDaj6AhGVh4Gu0rej3b0gVgxW6EmRdglBQfPfWOPnn+CcmYRLmSHTZ7jdBMXtxrV alZ69XEZsznq7Pv9moEEAMeLH2IAhiOqli20t2en7Wp3uRN46D0TIE3uLs0tssasUwU4D/g8rfWju 3TdhuFzOtqK7ZQAO4pO8MYTDF+maiLgAO+3uPhj4Q4DS5mKeRfiDGQQeyIE31l8Hf0Q+zdeuFw8Kw ZQhmKPNnmwFEsvEHok+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogK-00000005pHj-1kXO; Fri, 19 Apr 2024 13:53:36 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogC-00000005pBK-3YI8 for linux-riscv@lists.infradead.org; Fri, 19 Apr 2024 13:53:30 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a55602507a9so244332166b.3 for ; Fri, 19 Apr 2024 06:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713534806; x=1714139606; darn=lists.infradead.org; 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=QyU/aimoOzYSkB0vjF1tWwNaGtFimVg7sebvXAeBYyQ=; b=li1F486KOdsN9ScsG9xpKe1gyjDOBtY7Hu5dCtLZlVI2QegZBc0x6eWuVaWypqkqGY +Argc9+Q9CgI9LORtR2jZ9Psqz7F5PQ0Wg9Me9odV0bK5c3AQTVE6kN7ATlq7xEDm10/ OiQ3V+OC7AAN3XZXxLYqxxUgLMQ1LC/pP8rits5BP7mTF1JP3qapnazrdylAKtTmZB0P PtFjRJJTyNChX8kzEjP2sqdRYpZpqvSpthWTYWysTzAY+Uo2nbmTe5rtnGFws5eYUluQ nMNhLp+qC0atUOzT2JVhVATnWyfXn4dhiVhN7fVQfPFPgFm+gQXXh/vmqVPxdEzNqaWM blvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534806; x=1714139606; 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=QyU/aimoOzYSkB0vjF1tWwNaGtFimVg7sebvXAeBYyQ=; b=HznFECmZneuwdS0rOiZ9GSxbTDAKaac8dE6NbINqZsliRU+Ltj0Hz6hVZ+rXxnZbF4 2FkGyIwYsdbsI0ddc3flK+lT/49N6eR5r/GQdoFRZuqevNcnFCvgbgcdoPnjWcKF2TeN ZSw3QlzLv+HMu1c2mZsqL6Te32TUritHlrrWAe0qx/CsQuIcNngzhErbrMSYGMNonpIE dN3NszfPLVnZEN/gdGQdv65gc+REmcvVNQXFPzqbt2DXrQrjrlqIWJ3kaUYcsTXDbCv1 PJCCfTW234xA3N0TyaWB27HsVJqat8mK2JYVeqmzKP32NWDSo5hwEDXq6UKWQ+IejC6h kmKQ== X-Gm-Message-State: AOJu0YySV+euLO/WtgMySq95qz+XkhwMwcyD+5g13pJwVXnjX8S1voE1 dE68y+WNt2HNxuGGDf85s4kXINv/lsy13mAdVsjNjmsYYeUrO5bv6kAeayDJS6tziWeTyHZ5UNL FwhI= X-Google-Smtp-Source: AGHT+IH1EO2N38+RgiFvRKbqHN8RMDmj22wsb5kJW4Tn71jZ275QZBl4gl7wrF/9ir4IqqZ9rzm1eg== X-Received: by 2002:a17:906:1786:b0:a52:3eff:13f1 with SMTP id t6-20020a170906178600b00a523eff13f1mr1515498eje.2.1713534806253; Fri, 19 Apr 2024 06:53:26 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id s11-20020a170906bc4b00b00a522911e2aesm2213930ejv.124.2024.04.19.06.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:53:25 -0700 (PDT) From: Andrew Jones To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, anup@brainfault.org, atishp@atishpatra.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, christoph.muellner@vrull.eu, heiko@sntech.de, charlie@rivosinc.com, David.Laight@ACULAB.COM, parri.andrea@gmail.com, luxu.kernel@bytedance.com Subject: [PATCH v2 2/6] dt-bindings: riscv: Add Zawrs ISA extension description Date: Fri, 19 Apr 2024 15:53:24 +0200 Message-ID: <20240419135321.70781-10-ajones@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419135321.70781-8-ajones@ventanamicro.com> References: <20240419135321.70781-8-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_065328_947723_7208308A X-CRM114-Status: UNSURE ( 9.22 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add description for the Zawrs (Wait-on-Reservation-Set) ISA extension which was ratified in commit 98918c844281 of riscv-isa-manual. Signed-off-by: Andrew Jones --- .../devicetree/bindings/riscv/extensions.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 468c646247aa..584da2f539e5 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -177,6 +177,18 @@ properties: is supported as ratified at commit 5059e0ca641c ("update to ratified") of the riscv-zacas. + - const: zawrs + description: | + The Zawrs extension for entering a low-power state or for trapping + to a hypervisor while waiting on a store to a memory location, as + ratified in commit 98918c844281 ("Merge pull request #1217 from + riscv/zawrs") of riscv-isa-manual. Linux assumes that WRS.NTO will + either always eventually terminate the stall due to the reservation + set becoming invalid, implementation-specific other reasons, or + because a higher privilege level has configured it to cause an + illegal instruction exception after an implementation-specific + bounded time limit. + - const: zba description: | The standard Zba bit-manipulation extension for address generation From patchwork Fri Apr 19 13:53:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13636411 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 36DB4C4345F for ; Fri, 19 Apr 2024 13:53:43 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sGNnvc2gbFB1+ZfJaHJGXk3n8i29HMaO4e0cmg92SYA=; b=ggXojA7GXfESW0 rQIu95c/lMkTrCKtSVJfXhaabiVstHwblt3ORelIbvp4WYwf7puYjk6o9RcfC+nlwhVaZApaqCiOa vtTc6VQ2uWcaLV72qVsgFElvFMxxbmE0OU/g1vAFcPcWG2cKYMhrymJVqBkPrBmMr/atq5OEg/1tD ey0MVcU26tj0KvaXXrSRYvdqfyvq3JIpDgkeOEcdppMOepgyCBnB6q7fbc0Phv+K2SZ9DmtUmfurC BOQmSbGhxqhCVLyBSEXi4No3mJx5OD7p2+kkyuo8gOU3G3OwWGWrB4eEcTINQfpiNWoEAV1PBi8nJ YIIyzM01odqRKNpSCsyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogM-00000005pJA-126J; Fri, 19 Apr 2024 13:53:38 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogE-00000005pCR-28LN for linux-riscv@lists.infradead.org; Fri, 19 Apr 2024 13:53:32 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-571c22d9de4so2213632a12.3 for ; Fri, 19 Apr 2024 06:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713534808; x=1714139608; darn=lists.infradead.org; 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=nEizurJcSR1aY1vBLFtX+JNkUfZx2QKjVF6QEsuG1UY=; b=XR636xQoQ1f/dyBx1t2HsNEXwDFWXqZfCZJLETFuKaaDZwfx5Dtm2ec2YuSCcEjJZv 1z7q8x1ZEs0kc0Agh7cWuEeeM5LQhvFw8YIFTbPsCOtFLEP9Dc+S2AuxG7xQwZNzW6xq guWmIybbyvI/PVj1ZOuSer7P0M+ew9Qd1atJn6FQLBAJ0nji0u2b1jeA/y6d4PYbbwpM NTyCtkNL/DaQLT7LXuZG9OJNG4j/xMMs2RE12arMltHsEQFiQBYV6zW8Qx0WOJfzzMvj 9ybHQtVeI+0ivxW5jOceEu4+XhPaCNeV6DOyKJqj3x+9fb1KggjHQq4YfoeCXTweqUOu MTGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534808; x=1714139608; 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=nEizurJcSR1aY1vBLFtX+JNkUfZx2QKjVF6QEsuG1UY=; b=q3OcuKfGx0nd43Fwqm3tBAJIUiOkYBksdYoEHe+rj9k/rznvnJy6NPBSBGuquJIjDe UwLPcYYq1q3QC6+N7iyltsYGTsgfwT4FpH+G7Mq16gk6HmqhCxAC5gmZVD3WMRZWuyg9 Dj4mO5+Sb++FDrbgclOdxEfi8Ly3JYUy2pn0vCtRgTySEpm7sdtOXh9H067QcLwbieB/ wrX2egtF683VKtUSheXpL4NdlF85Or8TNfM2Y79vZhh4nFhRAmK0svPQY5IFza+PP6V8 JqYMQhU7Z1oWTPKEYt8tp/SX+J4DCsTAZpiYrMc6KE+6L+uAgeFODQaCIocssN0b9bB6 N8Xw== X-Gm-Message-State: AOJu0Yxs/uk6l1/XQr5IRxi54dntYu3VxHQSP7LQkgJKrIJoY9vOxfEG oadAvg0fQZi61FsGoqt6wda1JyJ1mBxu6evAUu7u9oPzQIOOQ3f/CQwxTTliMRbOhAQbTAHLfq9 O+qs= X-Google-Smtp-Source: AGHT+IGkQt2hO18a+SNSAYfEOPucXpHAMV1WR0RrkuDvLuCw0MpZGKjuj++zRhwHCrnJC9FEvEAlqg== X-Received: by 2002:a50:baad:0:b0:56e:323b:d7e7 with SMTP id x42-20020a50baad000000b0056e323bd7e7mr1751219ede.34.1713534807639; Fri, 19 Apr 2024 06:53:27 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id d6-20020a05640208c600b0056e72c4a330sm2148891edz.41.2024.04.19.06.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:53:27 -0700 (PDT) From: Andrew Jones To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, anup@brainfault.org, atishp@atishpatra.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, christoph.muellner@vrull.eu, heiko@sntech.de, charlie@rivosinc.com, David.Laight@ACULAB.COM, parri.andrea@gmail.com, luxu.kernel@bytedance.com Subject: [PATCH v2 3/6] riscv: Add Zawrs support for spinlocks Date: Fri, 19 Apr 2024 15:53:25 +0200 Message-ID: <20240419135321.70781-11-ajones@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419135321.70781-8-ajones@ventanamicro.com> References: <20240419135321.70781-8-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_065330_689051_DF2D410C X-CRM114-Status: GOOD ( 20.06 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Christoph Müllner RISC-V code uses the generic ticket lock implementation, which calls the macros smp_cond_load_relaxed() and smp_cond_load_acquire(). Introduce a RISC-V specific implementation of smp_cond_load_relaxed() which applies WRS.NTO of the Zawrs extension in order to reduce power consumption while waiting and allows hypervisors to enable guests to trap while waiting. smp_cond_load_acquire() doesn't need a RISC-V specific implementation as the generic implementation is based on smp_cond_load_relaxed() and smp_acquire__after_ctrl_dep() sufficiently provides the acquire semantics. This implementation is heavily based on Arm's approach which is the approach Andrea Parri also suggested. The Zawrs specification can be found here: https://github.com/riscv/riscv-zawrs/blob/main/zawrs.adoc Signed-off-by: Christoph Müllner Co-developed-by: Andrew Jones Signed-off-by: Andrew Jones --- arch/riscv/Kconfig | 13 ++++++++ arch/riscv/include/asm/barrier.h | 45 ++++++++++++++++++--------- arch/riscv/include/asm/cmpxchg.h | 51 +++++++++++++++++++++++++++++++ arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/include/asm/insn-def.h | 2 ++ arch/riscv/kernel/cpufeature.c | 1 + 6 files changed, 98 insertions(+), 15 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 7427d8088337..34bbe6b70546 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -578,6 +578,19 @@ config RISCV_ISA_V_PREEMPTIVE preemption. Enabling this config will result in higher memory consumption due to the allocation of per-task's kernel Vector context. +config RISCV_ISA_ZAWRS + bool "Zawrs extension support for more efficient busy waiting" + depends on RISCV_ALTERNATIVE + default y + help + The Zawrs extension defines instructions to be used in polling loops + which allow a hart to enter a low-power state or to trap to the + hypervisor while waiting on a store to a memory location. Enable the + use of these instructions in the kernel when the Zawrs extension is + detected at boot. + + If you don't know what to do here, say Y. + config TOOLCHAIN_HAS_ZBB bool default y diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h index 880b56d8480d..e1d9bf1deca6 100644 --- a/arch/riscv/include/asm/barrier.h +++ b/arch/riscv/include/asm/barrier.h @@ -11,6 +11,7 @@ #define _ASM_RISCV_BARRIER_H #ifndef __ASSEMBLY__ +#include #include #define nop() __asm__ __volatile__ ("nop") @@ -28,21 +29,6 @@ #define __smp_rmb() RISCV_FENCE(r, r) #define __smp_wmb() RISCV_FENCE(w, w) -#define __smp_store_release(p, v) \ -do { \ - compiletime_assert_atomic_type(*p); \ - RISCV_FENCE(rw, w); \ - WRITE_ONCE(*p, v); \ -} while (0) - -#define __smp_load_acquire(p) \ -({ \ - typeof(*p) ___p1 = READ_ONCE(*p); \ - compiletime_assert_atomic_type(*p); \ - RISCV_FENCE(r, rw); \ - ___p1; \ -}) - /* * This is a very specific barrier: it's currently only used in two places in * the kernel, both in the scheduler. See include/linux/spinlock.h for the two @@ -70,6 +56,35 @@ do { \ */ #define smp_mb__after_spinlock() RISCV_FENCE(iorw, iorw) +#define __smp_store_release(p, v) \ +do { \ + compiletime_assert_atomic_type(*p); \ + RISCV_FENCE(rw, w); \ + WRITE_ONCE(*p, v); \ +} while (0) + +#define __smp_load_acquire(p) \ +({ \ + typeof(*p) ___p1 = READ_ONCE(*p); \ + compiletime_assert_atomic_type(*p); \ + RISCV_FENCE(r, rw); \ + ___p1; \ +}) + +#ifdef CONFIG_RISCV_ISA_ZAWRS +#define smp_cond_load_relaxed(ptr, cond_expr) ({ \ + typeof(ptr) __PTR = (ptr); \ + __unqual_scalar_typeof(*ptr) VAL; \ + for (;;) { \ + VAL = READ_ONCE(*__PTR); \ + if (cond_expr) \ + break; \ + __cmpwait_relaxed(ptr, VAL); \ + } \ + (typeof(*ptr))VAL; \ +}) +#endif + #include #endif /* __ASSEMBLY__ */ diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h index 2fee65cc8443..0926ac7f4ca6 100644 --- a/arch/riscv/include/asm/cmpxchg.h +++ b/arch/riscv/include/asm/cmpxchg.h @@ -8,7 +8,10 @@ #include +#include #include +#include +#include #define __xchg_relaxed(ptr, new, size) \ ({ \ @@ -359,4 +362,52 @@ arch_cmpxchg_relaxed((ptr), (o), (n)); \ }) +#ifdef CONFIG_RISCV_ISA_ZAWRS +static __always_inline void __cmpwait(volatile void *ptr, + unsigned long val, + int size) +{ + unsigned long tmp; + + asm goto(ALTERNATIVE("j %l[no_zawrs]", "nop", + 0, RISCV_ISA_EXT_ZAWRS, 1) + : : : : no_zawrs); + + switch (size) { + case 4: + asm volatile( + " lr.w %0, %1\n" + " xor %0, %0, %2\n" + " bnez %0, 1f\n" + ZAWRS_WRS_NTO "\n" + "1:" + : "=&r" (tmp), "+A" (*(u32 *)ptr) + : "r" (val)); + break; +#if __riscv_xlen == 64 + case 8: + asm volatile( + " lr.d %0, %1\n" + " xor %0, %0, %2\n" + " bnez %0, 1f\n" + ZAWRS_WRS_NTO "\n" + "1:" + : "=&r" (tmp), "+A" (*(u64 *)ptr) + : "r" (val)); + break; +#endif + default: + BUILD_BUG(); + } + + return; + +no_zawrs: + asm volatile(RISCV_PAUSE : : : "memory"); +} + +#define __cmpwait_relaxed(ptr, val) \ + __cmpwait((ptr), (unsigned long)(val), sizeof(*(ptr))) +#endif + #endif /* _ASM_RISCV_CMPXCHG_H */ diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index e17d0078a651..5b358c3cf212 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,7 @@ #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 +#define RISCV_ISA_EXT_ZAWRS 75 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/include/asm/insn-def.h b/arch/riscv/include/asm/insn-def.h index 64dffaa21bfa..9a913010cdd9 100644 --- a/arch/riscv/include/asm/insn-def.h +++ b/arch/riscv/include/asm/insn-def.h @@ -197,5 +197,7 @@ RS1(base), SIMM12(4)) #define RISCV_PAUSE ".4byte 0x100000f" +#define ZAWRS_WRS_NTO ".4byte 0x00d00073" +#define ZAWRS_WRS_STO ".4byte 0x01d00073" #endif /* __ASM_INSN_DEF_H */ diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 3ed2359eae35..02de9eaa3f42 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -257,6 +257,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), __RISCV_ISA_EXT_DATA(zacas, RISCV_ISA_EXT_ZACAS), + __RISCV_ISA_EXT_DATA(zawrs, RISCV_ISA_EXT_ZAWRS), __RISCV_ISA_EXT_DATA(zfa, RISCV_ISA_EXT_ZFA), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN), From patchwork Fri Apr 19 13:53:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13636412 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 A338DC04FFE for ; Fri, 19 Apr 2024 13:53:45 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ku/dM+UMG3P45HdY6D/eFaPjNBj9S569EV/OEt/Kgk4=; b=WciMFFcl5zRLs+ HcyOj4FVHK5sNFGylk1Yskqw0N+vm8pTKMH+s03lm8kISlWpTfAoC8btH2V1+kcTh9CrfgUFwKznX 04tdoeGJEhgsaJNSej1QC8ZcpjvM0V7aK1Y6q5JEzNRPPXMrarGASE4mLJaGjCyFaX8Hl6csH0d9r /Aw6Ug2CMss7BYA+1Gkord0VndmqObd7fo1gMNZ4EK2QQ8gKUGr4oEgL/LGWHFERWl3bBc2R6dXBp 71LguNRzLZxw5PbIAZu3VV28O1HNuPD5fiemA6eiurZIb/PpZKnnn094/sZ7Kx/lzxPBGJMycALGK pBzF+Es6RX16DBBIJfoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogN-00000005pKS-3IZl; Fri, 19 Apr 2024 13:53:39 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogE-00000005pDB-2sJZ for linux-riscv@lists.infradead.org; Fri, 19 Apr 2024 13:53:33 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-56e1bbdb362so2384203a12.1 for ; Fri, 19 Apr 2024 06:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713534809; x=1714139609; darn=lists.infradead.org; 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=H50p08qn7uGf4Z9JFkdHi+jkfC6EZzcHo7CUifdDw3E=; b=jkTMq+lUez29P5iI8KDnDCnDdGRGoHPH1QyHweI1X/S9ICrkp/JxRPABkT3J4D5HxJ t78uy29HtxmzVvoHGbs2XrhjIyRJYSdeu55/CTsitbKpH4ICPYg69UqRpuAxQNZOhxpv cu3blu0srXcryG1twVepuPpPh76O6RutSUn/1xrv1k4/ZcYg+8ZKyqzn666VsPuiSP8n p45URqd22mYUVEKfQAyeR8EMHaSBNrZXFwjGFVFDgwk9NrB7aWl4z17yS1UkuC/D1PCJ DIia4vsAz52moEQx84WHqXmHnKotFiLbT04E9EhgH0q+oell2mAaoGl+Lf/wvpGim+DI dyHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534809; x=1714139609; 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=H50p08qn7uGf4Z9JFkdHi+jkfC6EZzcHo7CUifdDw3E=; b=qALFo/Bg1Yek7Wi0QuO5KNW1p33IdA5PduaxgImZ0XHO/5WZ4afK+sJI9eou3BJ/G8 2Tzu4NrCDGBfKbNiB3nFke4S0jTLXgXSk4vQgxfBZ6lI49JavO+7RtbXZ9jre5h8cdNB s7x5n8oRerzHchoNgtyAsdqHBLxZdQIgMdipgjrjkQ4bJYgSjuBjyu2Rr/ZdThr1muIO ehSpv/yWaFtGRW456bkNLcG2mTP6XD0tXzqd5/YuJQ/zNKZHiQbjN88FODJn6+gSbXSQ 7ej0em8Zx6zqChDaEWIcAWqvO3K/ISbV5LtgjA9AcQkx2vXpskifKQ9MIxt3DtkNha6r QIrg== X-Gm-Message-State: AOJu0YyH6N5q3K422ZpnWxRJvPW8hGd6xgkUyBcpUEHXqHMrIzla/1Ns 7dWAR8qtzkEA6egC8DcbC8+YARk/JrIGMvR/5j6km8sXhJibMNi2N5QksDf0DR4ddB+0rp8j8C2 +4yw= X-Google-Smtp-Source: AGHT+IGwM9ZfHrsnh6F6OY6TFGNn1gRJmjysMnGuYPZucZ7dMPAwOGkgddkO6TWYVH8+aMZLSHBk/A== X-Received: by 2002:a17:906:3645:b0:a55:75f7:435c with SMTP id r5-20020a170906364500b00a5575f7435cmr2058940ejb.16.1713534809405; Fri, 19 Apr 2024 06:53:29 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id q21-20020a170906771500b00a51d408d446sm2245772ejm.26.2024.04.19.06.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:53:28 -0700 (PDT) From: Andrew Jones To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, anup@brainfault.org, atishp@atishpatra.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, christoph.muellner@vrull.eu, heiko@sntech.de, charlie@rivosinc.com, David.Laight@ACULAB.COM, parri.andrea@gmail.com, luxu.kernel@bytedance.com Subject: [PATCH v2 4/6] riscv: hwprobe: export Zawrs ISA extension Date: Fri, 19 Apr 2024 15:53:26 +0200 Message-ID: <20240419135321.70781-12-ajones@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419135321.70781-8-ajones@ventanamicro.com> References: <20240419135321.70781-8-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_065330_802880_1E2297C8 X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Export Zawrs ISA extension through hwprobe. Signed-off-by: Andrew Jones --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index b2bcc9eed9aa..e072ce8285d8 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -188,6 +188,10 @@ The following keys are defined: manual starting from commit 95cf1f9 ("Add changes requested by Ved during signoff") + * :c:macro:`RISCV_HWPROBE_EXT_ZAWRS`: The Zawrs extension is supported as + ratified in commit 98918c844281 ("Merge pull request #1217 from + riscv/zawrs") of riscv-isa-manual. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 9f2a8e3ff204..a5fca3878a32 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -59,6 +59,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) +#define RISCV_HWPROBE_EXT_ZAWRS (1ULL << 36) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 8cae41a502dd..b86e3531a45a 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -111,6 +111,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZTSO); EXT_KEY(ZACAS); EXT_KEY(ZICOND); + EXT_KEY(ZAWRS); if (has_vector()) { EXT_KEY(ZVBB); From patchwork Fri Apr 19 13:53:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13636414 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 CB2D2C4345F for ; Fri, 19 Apr 2024 13:53:51 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6wTZK4nNPt0zcPsWWggPDlkGBDSv1b/gNDZzPTUmv6A=; b=kOE57sfiGlwO1t vQzFmwyQw/k4E+zo3aDB+JVeDHiA3gGjxwUuVKOfrVe/ZKYt14lUvjt2iLjh3I8MFKIj12sbBDPT7 J0gedEEnAJa4JJ0eXh2p0+yw2UgGdzoEiFM/Ro4kyFvbeEIHxUQNZ7fzu0yRXAYbadqJ2Cekil4LB Cu4Yplwgk2aziVPZ/f2yZdApngn2Oqp2iC9xyfofOvCwRWwCsvgzxfCqajJmd5M6V5YHPcP7cAIRP JCkLPKyLTI+JL/njDQcQAqAwDJl2az+aM/wU91XG925Qgmx3sdzTCT8iNjNynYbweRf7NDaJGcP8I RUDknWc4keBqVbB7obsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogU-00000005pRN-45SR; Fri, 19 Apr 2024 13:53:47 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogH-00000005pEH-1lW2 for linux-riscv@lists.infradead.org; Fri, 19 Apr 2024 13:53:36 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a526d0b2349so242106766b.3 for ; Fri, 19 Apr 2024 06:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713534811; x=1714139611; darn=lists.infradead.org; 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=v7Wus7+04U367SmPRgLRcagyxip4bNtqJZUWzPYUkwc=; b=dUEBOp8LUbJiZGLVk+KADS9F5Qkws32aICICcEubz26jGtaPCqVrIAu5fjvl64r8PX Cmm2X0U3l44xDBTFTfZjDVlh6ayuZExPoa0NPYlrj8Vo56z2sNaTpaWRdddkCHNNmE2v 34Z/UiF3c4i704TNexkIR26K/q0pljz7EXePFqZM3kFa3RhbL6WSv2WLSa8akjmvGnO2 ZspoayqXS9qL726+/BT7+Ux1YKks1TC/3/aZRGEDkp/qwzBfeak83NW7gV5d4UDHNPaT fjwMx3xqiHFAiHtIDrLjTLJI28Umq1R35aWVqsC5Yl05EBi1WXDidhGTzOE88wiwLa61 n7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534811; x=1714139611; 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=v7Wus7+04U367SmPRgLRcagyxip4bNtqJZUWzPYUkwc=; b=ZWU70nWOBbU4WBPGdAlMsESNrN3DgowzCd28XOWL7SMz6agGRAl7dL5rlXLJ2gbFJl +UjaNH4wPCauP8iBMWK9Poa9RLgP6KnOKqHgedJyAzGlNJIvgsI4/P3/p4IRZvL27e5Z 0bJHGZNAuLXMF5rOxcxC10lCol3CnjudjxsMlj4YNvCJDTwJIBAOTR4LVf7uf7kA5f4z AxMhajqld0cFopFsM8oaZKwAYi+NNSTYu/b9oSApP3fiTC9ANWXygNTRVJh55P8lDplL gn3/+Wrs4zixMcm/Sg10rG/qy/JalXkQItYxDKJsm0zfelvSc109tNo5nxj0KXNXBMeg qgZQ== X-Gm-Message-State: AOJu0YyWAjK4Za3o3F6cL7nuEvNQLbMFJePbJVfOjCVg6mVD5qLNkB/S qNBT1fohWqHgqGE1RER8DWxRTDCH3w7J3YFZW43MprI+9tRPx7NKfnbZ11oASh4LBFuER5xIECB tu00= X-Google-Smtp-Source: AGHT+IGW5DMzpQ1s7RJVHZYrIDlcwyg2slIg6T6KVtXyKcpiNBcc1wPNCm7ONf1zgIDtdYgJqAgZAw== X-Received: by 2002:a17:906:f8c5:b0:a55:5ddd:e5f6 with SMTP id lh5-20020a170906f8c500b00a555ddde5f6mr1513975ejb.28.1713534810779; Fri, 19 Apr 2024 06:53:30 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id t22-20020a1709063e5600b00a5209dc79c1sm2266768eji.146.2024.04.19.06.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:53:30 -0700 (PDT) From: Andrew Jones To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, anup@brainfault.org, atishp@atishpatra.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, christoph.muellner@vrull.eu, heiko@sntech.de, charlie@rivosinc.com, David.Laight@ACULAB.COM, parri.andrea@gmail.com, luxu.kernel@bytedance.com Subject: [PATCH v2 5/6] KVM: riscv: Support guest wrs.nto Date: Fri, 19 Apr 2024 15:53:27 +0200 Message-ID: <20240419135321.70781-13-ajones@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419135321.70781-8-ajones@ventanamicro.com> References: <20240419135321.70781-8-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_065333_567493_376C1BE4 X-CRM114-Status: GOOD ( 11.67 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org When a guest traps on wrs.nto, call kvm_vcpu_on_spin() to attempt to yield to the lock holding VCPU. Also extend the KVM ISA extension ONE_REG interface to allow KVM userspace to detect and enable the Zawrs extension for the Guest/VM. Signed-off-by: Andrew Jones --- arch/riscv/include/asm/kvm_host.h | 1 + arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu.c | 1 + arch/riscv/kvm/vcpu_insn.c | 15 +++++++++++++++ arch/riscv/kvm/vcpu_onereg.c | 2 ++ 5 files changed, 20 insertions(+) diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h index 484d04a92fa6..e27c56e44783 100644 --- a/arch/riscv/include/asm/kvm_host.h +++ b/arch/riscv/include/asm/kvm_host.h @@ -69,6 +69,7 @@ struct kvm_vcpu_stat { struct kvm_vcpu_stat_generic generic; u64 ecall_exit_stat; u64 wfi_exit_stat; + u64 wrs_exit_stat; u64 mmio_exit_user; u64 mmio_exit_kernel; u64 csr_exit_user; diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index b1c503c2959c..89ea06bd07c2 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -167,6 +167,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZFA, KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, + KVM_RISCV_ISA_EXT_ZAWRS, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index b5ca9f2e98ac..abcdc78671e0 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -25,6 +25,7 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { KVM_GENERIC_VCPU_STATS(), STATS_DESC_COUNTER(VCPU, ecall_exit_stat), STATS_DESC_COUNTER(VCPU, wfi_exit_stat), + STATS_DESC_COUNTER(VCPU, wrs_exit_stat), STATS_DESC_COUNTER(VCPU, mmio_exit_user), STATS_DESC_COUNTER(VCPU, mmio_exit_kernel), STATS_DESC_COUNTER(VCPU, csr_exit_user), diff --git a/arch/riscv/kvm/vcpu_insn.c b/arch/riscv/kvm/vcpu_insn.c index ee7215f4071f..97dec18e6989 100644 --- a/arch/riscv/kvm/vcpu_insn.c +++ b/arch/riscv/kvm/vcpu_insn.c @@ -16,6 +16,9 @@ #define INSN_MASK_WFI 0xffffffff #define INSN_MATCH_WFI 0x10500073 +#define INSN_MASK_WRS 0xffffffff +#define INSN_MATCH_WRS 0x00d00073 + #define INSN_MATCH_CSRRW 0x1073 #define INSN_MASK_CSRRW 0x707f #define INSN_MATCH_CSRRS 0x2073 @@ -203,6 +206,13 @@ static int wfi_insn(struct kvm_vcpu *vcpu, struct kvm_run *run, ulong insn) return KVM_INSN_CONTINUE_NEXT_SEPC; } +static int wrs_insn(struct kvm_vcpu *vcpu, struct kvm_run *run, ulong insn) +{ + vcpu->stat.wrs_exit_stat++; + kvm_vcpu_on_spin(vcpu, vcpu->arch.guest_context.sstatus & SR_SPP); + return KVM_INSN_CONTINUE_NEXT_SEPC; +} + struct csr_func { unsigned int base; unsigned int count; @@ -378,6 +388,11 @@ static const struct insn_func system_opcode_funcs[] = { .match = INSN_MATCH_WFI, .func = wfi_insn, }, + { + .mask = INSN_MASK_WRS, + .match = INSN_MATCH_WRS, + .func = wrs_insn, + }, }; static int system_opcode_insn(struct kvm_vcpu *vcpu, struct kvm_run *run, diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index f4a6124d25c9..67c5794af3b6 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -41,6 +41,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(SVNAPOT), KVM_ISA_EXT_ARR(SVPBMT), KVM_ISA_EXT_ARR(ZACAS), + KVM_ISA_EXT_ARR(ZAWRS), KVM_ISA_EXT_ARR(ZBA), KVM_ISA_EXT_ARR(ZBB), KVM_ISA_EXT_ARR(ZBC), @@ -120,6 +121,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_SVINVAL: case KVM_RISCV_ISA_EXT_SVNAPOT: case KVM_RISCV_ISA_EXT_ZACAS: + case KVM_RISCV_ISA_EXT_ZAWRS: case KVM_RISCV_ISA_EXT_ZBA: case KVM_RISCV_ISA_EXT_ZBB: case KVM_RISCV_ISA_EXT_ZBC: From patchwork Fri Apr 19 13:53:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13636413 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 5B10BC4345F for ; Fri, 19 Apr 2024 13:53:49 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6ZkcRJT0M/hgEokVuRrvc0cvw+oIgw/ujOmRqkvlb7E=; b=cfs6M3Dwi7YJB9 8FvlEzC3xTfmd0aTmeGJjyiZnh4xjykHzla/PImWFc2zKxsZzfxwzJ4bvL287M5Ih7GF1dVmWndYs hOuV58AZt4sIHYyA/rYAghpAHZ26Qn4QFSXPyMoMs/RdnGgcQc4DYxLlSYuPDCEI4meUfysn4KHFa n8y9v5zmZWgfbDJVlMaXnYgyVKKITaAbraGBnv8eYCINJP4zeNxExfzwa095ZIpBAE4aqBCo+0zCH Dcz0hOHXc3akx+b7I+v696mRov3/7JnUkxqTTU3nWii0cbg11HouAMez/yVFPrTL+tCvGUtYNPL23 Dvwks3whXzTz0puEc0yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogR-00000005pO8-4AE1; Fri, 19 Apr 2024 13:53:44 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxogI-00000005pEk-31hO for linux-riscv@lists.infradead.org; Fri, 19 Apr 2024 13:53:36 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a52223e004dso196700066b.2 for ; Fri, 19 Apr 2024 06:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713534812; x=1714139612; darn=lists.infradead.org; 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=L/o9GJYOsp32C4ZK5XVSIqlhvuJ+jgCOlcUd/wXUyPQ=; b=lXILVhBodE2N+sdutNRZP9t8S0KJ+rESe6Z/Jshe3kRWRXXFM8bHJ92hI4wn+kEHJW 41S1ED0P3/vjDhR7QUivDkHYNE7iGl+fLy9r+5qhKDFlIUXu8jAvJPPe9GZmaA7l9gYN WpWMv32fIJNyijyJPZ8EdwEbh7OEWNJLLdx58WkP9eXwXvzz4AixQNkChRBoPnZMHF56 PrWWuvXkKqGjqIatnt3Ag5gXeMTPFkqtnbbpYpJTH57oGR2Z1VRRpl0v9mt5LGjLmu6k yWApRjHXE6+LIw+yS/n0ErriEK8diZevg7gVoU8fV5G8wLSLawhq7zHFuKtJUQ4pnJo3 FsbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534812; x=1714139612; 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=L/o9GJYOsp32C4ZK5XVSIqlhvuJ+jgCOlcUd/wXUyPQ=; b=qPA5CwfIl7qTnoPs5OtavCU/aaVnGhQ+VY/QgP6rsN9olwe6ZfGJcaaBYBIPd5Hw74 3/HofIZOpRHRDETUoIVyKlZMeSVq8A8t3+jcwuOoWi+II2RPet/ykAkyntJDhBhgwEEQ 1dce1lmxg3rO5leRGul5gtF3mhVscEybGZZ+rCXVNQfrefPen8kvpmPI03ZKp2hxVxRl Xei1sMiHE6bGs3iIkImOSdwkWPAfRN5rsstGGNp6z8LbPSU/aekgTFScfBSHN5fl/PbL n3PPcoH5N7NGr01pVL05yfCGO3KM5NUnPPLaPX9iO4V2+9zyThJNE2idd4spKlXtu42r LAQw== X-Gm-Message-State: AOJu0Yz+DPOrwtcdshlhWq6qm6tfnSlMHDd08HaWChfbMnxqjmIyCTZ/ rVzs03PGTSyn7U6HuiJktd/5jTeM41c0sgBLhSVtbEYy85cIhR+v+cjd1KmJLS9vooF+rWRnzEk q6Jg= X-Google-Smtp-Source: AGHT+IGBQ9t0lRGzscQAhpOHuvu3T6H/3CaUBbGTMF7yl3wKq7mI9JkjJ8Ug9d+DetW6DEe2LgbkcA== X-Received: by 2002:a17:906:6d54:b0:a55:7837:b546 with SMTP id a20-20020a1709066d5400b00a557837b546mr1941644ejt.57.1713534812041; Fri, 19 Apr 2024 06:53:32 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id lk19-20020a170906cb1300b00a526418d0ebsm2233256ejb.74.2024.04.19.06.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:53:31 -0700 (PDT) From: Andrew Jones To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, anup@brainfault.org, atishp@atishpatra.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, christoph.muellner@vrull.eu, heiko@sntech.de, charlie@rivosinc.com, David.Laight@ACULAB.COM, parri.andrea@gmail.com, luxu.kernel@bytedance.com Subject: [PATCH v2 6/6] KVM: riscv: selftests: Add Zawrs extension to get-reg-list test Date: Fri, 19 Apr 2024 15:53:28 +0200 Message-ID: <20240419135321.70781-14-ajones@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419135321.70781-8-ajones@ventanamicro.com> References: <20240419135321.70781-8-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_065334_852651_D714E32B X-CRM114-Status: UNSURE ( 8.86 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org KVM RISC-V allows the Zawrs extension for the Guest/VM, so add it to the get-reg-list test. Signed-off-by: Andrew Jones --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index b882b7b9b785..8c4c27bd4b88 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -48,6 +48,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVNAPOT: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVPBMT: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZACAS: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZAWRS: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBB: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBC: @@ -413,6 +414,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(SVNAPOT), KVM_ISA_EXT_ARR(SVPBMT), KVM_ISA_EXT_ARR(ZACAS), + KVM_ISA_EXT_ARR(ZAWRS), KVM_ISA_EXT_ARR(ZBA), KVM_ISA_EXT_ARR(ZBB), KVM_ISA_EXT_ARR(ZBC), @@ -936,6 +938,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(svinval, SVINVAL); KVM_ISA_EXT_SIMPLE_CONFIG(svnapot, SVNAPOT); KVM_ISA_EXT_SIMPLE_CONFIG(svpbmt, SVPBMT); KVM_ISA_EXT_SIMPLE_CONFIG(zacas, ZACAS); +KVM_ISA_EXT_SIMPLE_CONFIG(zawrs, ZAWRS); KVM_ISA_EXT_SIMPLE_CONFIG(zba, ZBA); KVM_ISA_EXT_SIMPLE_CONFIG(zbb, ZBB); KVM_ISA_EXT_SIMPLE_CONFIG(zbc, ZBC); @@ -991,6 +994,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_svnapot, &config_svpbmt, &config_zacas, + &config_zawrs, &config_zba, &config_zbb, &config_zbc,