From patchwork Wed Dec 18 13:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aleksandar Rikalo X-Patchwork-Id: 13913709 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 2B545E77187 for ; Wed, 18 Dec 2024 13:33:56 +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: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:In-Reply-To:References: List-Owner; bh=yXIelB7sEaBiT7CL2gREWJlS1v88RCJHPJKNoy1JFHs=; b=2ZpM6n33JxyRv2 4BY/FGAM8gu+5gq9eW5kTPpa4PeSfnknXfgG5vgQYQkH6TNoQ/KCikkmKAa/djblZkQbcDlIIq6JP KajsHAphtTurkYT9DJVPtGF/cl81NweeojDWHdN5jjtTtTmsYo/Sn5+C9tqE8FTX7NhfbujpsfIm+ DZX7fUX5JgTLvooYPT8U6ZHdIDJeJbOVbowhReWuTNu4agscnJd/csGJd9cKD5+Y40/xomX7jVJh4 wzlUaRtxANHKs8DqTSpLAeCAGoBYr7n1V7jeqJTVZzs+Yu0bP0uwP5uAozbYUBLc1r7q7uXmAIeJQ geU4K8vnVNPv1e7GBL/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNuBQ-0000000GjxK-3cJz; Wed, 18 Dec 2024 13:33:48 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNuBO-0000000Gjwb-1TuJ for linux-riscv@lists.infradead.org; Wed, 18 Dec 2024 13:33:47 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d3f65844deso10714613a12.0 for ; Wed, 18 Dec 2024 05:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734528824; x=1735133624; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=F04qCBUVVoN6U8u4xH7kBwCsJkFMNNfZymSECrRf1P8=; b=TwyKxJumHaHGl91byfC4MgOGpCxnFS7y3yrtKiuRRABnbItYkGJgVyk7Guw7dZPjdr /NXR8OvnkzUTzm6bgAlAGCOrIuvXSTGaFMQWQ/Q8ShzIUBBhveERPplsWOVS6/4g8299 KVlFLHNkgZsBSOHzPtC1HYwhT/yS5VAzq9jxNAv/03QdX5Ljn6Nfzr0qNVnv1BNq+73M 4ZZr9YH+R9SRiwsUsq9ARzcpp/h3EC2WCspmtVRCm3L/QPHZdi8iIy9QON38cPk2C3LU CINgETU82mri9Xh83Hh3nndTqUaOdlNn4KkiW0uUvcM4zvWjFHq9ThpUVp4rWtmMmx4p IAjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734528824; x=1735133624; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F04qCBUVVoN6U8u4xH7kBwCsJkFMNNfZymSECrRf1P8=; b=MFt+SaQqot4AA2ueVj0Rd3lxYDOh4kvxSDxk23rLbj0gI9YziXYiy+FNg+J78FrzCs l7M+vYXlPW1SJ363I9OyyiNXQc6PHBBjbmqvs96NINBWd5IaoRp1OtMTaGuhNHioEjFo 5JeBomTzoo6hxDMUurgfZb36xMx+mKzrwc+I9tQLGlVaBZ2WLWIowlrAplhxGfNRiu4F RcS+oeRSzcxertX8wMJndyM3viEB4Rdr1eBU9ljO4lCXXNdLMk3rptBv0UbCwZtlS6X/ dl5Umc2xSNecdbulECukILChvF3PtQyTRCM8iyKFV1d/cdj01EJph5DBX3jWJ84ZFwib bi7A== X-Gm-Message-State: AOJu0Yw2XszjowWFP+YDVrnV5JI/srZyz71d+F3+wneMF4A26tmfd482 5GLQHQ5TOAhusZGQx1tKNEFg5PV4UKnYdOyP16zQnKrODMCkQRnrORZCvABX7YY= X-Gm-Gg: ASbGncvP8I/Ha6LeCP/4neWQf8FeTokk78yQBw2pNrcPSGnd+FqvO1yfl7CTePRc8zM +8/dV7y/pq0N5jIGg0uvddqOkfJirE3JdkAbbpQp/1vm7oz/cqFidwncV2L0DWuwM5YacVHmdnJ XL6B2e44/Zez4r6+jpzk5/14MH1r320DQPSlzydl+3QQRpKNDNbVGDWUqVSchVznwHlA9jFWmQv 7fsTCXsMHtuFffpIQB3cdOxtnNBGOU0ExPErWlo0QfUb0HBoPtUye4eTIjzn46WhQ== X-Google-Smtp-Source: AGHT+IHvX5X6BqHRSMeBGrCGLrIORFdCEP7U5u82MX7KqOksIbsBDW9rkN+UXFaQ/V6EmbhAHdKVrg== X-Received: by 2002:a17:906:309a:b0:aac:d8:13d1 with SMTP id a640c23a62f3a-aac00d813f8mr82990466b.13.1734528823548; Wed, 18 Dec 2024 05:33:43 -0800 (PST) Received: from localhost.localdomain ([79.175.114.8]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab96005f89sm562706166b.35.2024.12.18.05.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 05:33:42 -0800 (PST) From: Aleksandar Rikalo To: linux-riscv@lists.infradead.org Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Jones , =?utf-8?q?Christoph_M=C3=BCllner?= , Aleksandar Rikalo , linux-kernel@vger.kernel.org, Djordje Todorovic Subject: [PATCH] riscv: Fix the PAUSE Opcode for MIPS P8700. Date: Wed, 18 Dec 2024 14:33:40 +0100 Message-Id: <20241218133340.51003-1-arikalo@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241218_053346_407850_BC1D87DA X-CRM114-Status: UNSURE ( 9.58 ) 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 From: Raj Vishwanathan4 The riscv MIPS P8700 uses a different opcode for PAUSE. It is a ‘hint’ encoding of the SLLI instruction, with rd=0, rs1=0 and imm=5. It will behave as a NOP instruction if no additional behavior beyond that of SLLI is implemented. Signed-off-by: Raj Vishwanathan4 Signed-off-by: Aleksandar Rikalo --- arch/riscv/Kconfig | 12 ++++++++++++ arch/riscv/include/asm/insn-def.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index d4a7ca0388c0..07a77fa0a014 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -716,6 +716,18 @@ config RISCV_ISA_ZACAS If you don't know what to do here, say Y. +config RISCV_MIPS_P8700_PAUSE_OPCODE_FIX + bool "Fix the PAUSE Opcode for MIPS P8700" + default n + help + The RISCV MIPS P8700 uses a different opcode for PAUSE. + It is a 'hint' encoding of the SLLI instruction, + with rd=0, rs1=0 and imm=5. It will behave as a NOP + instruction if no additional behavior beyond that of + SLLI is implemented. + + If you are not using the P8700 processor, say n. + config TOOLCHAIN_HAS_ZBB bool default y diff --git a/arch/riscv/include/asm/insn-def.h b/arch/riscv/include/asm/insn-def.h index 9a913010cdd9..793eedde3516 100644 --- a/arch/riscv/include/asm/insn-def.h +++ b/arch/riscv/include/asm/insn-def.h @@ -196,7 +196,12 @@ INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0), \ RS1(base), SIMM12(4)) +#ifndef CONFIG_RISCV_MIPS_P8700_PAUSE_OPCODE_FIX #define RISCV_PAUSE ".4byte 0x100000f" +#else +#define RISCV_PAUSE ".4byte 0x00501013" +#endif + #define ZAWRS_WRS_NTO ".4byte 0x00d00073" #define ZAWRS_WRS_STO ".4byte 0x01d00073"