From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C58C1A01C6 for ; Thu, 19 Dec 2024 18:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734633968; cv=none; b=dUw0vgr914ZcFbr73NgFzQgXn3vN9ARxwpqYQoxMkF5z2butXElLYpuGFCkhqWWGTAqvAZQkuv6ff7hTNLCqkViy5CFmi1Apae7FPV7pFJ0tPBOp/G9KcKVZZ2jl1T5j4I4OQqHrq/mr3ynCV8udSqQWuCYkWeI7NPtK7vWXv8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734633968; c=relaxed/simple; bh=Z14jIZ1frFfyd9YcTR6Ec+F1tmLX/tJjDWUXV4kA/LM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cbI0E2z26jFqLdw+tsHvFckyzVi5FIxHejNIVGq31e3OUhH8AUBDr0BYy07VvMH3n9oSM4R41abTUNwSVD1YwHUIgejrS9Hr92FMRshmx42YHEL8iGNUWgfcwWA9hzFs2D5F9rLrU1VZZhl7BHRdbb8licIJ9d51DR/586w7iH8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lixom.net; spf=none smtp.mailfrom=lixom.net; dkim=pass (2048-bit key) header.d=lixom-net.20230601.gappssmtp.com header.i=@lixom-net.20230601.gappssmtp.com header.b=HTcZdFzV; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lixom.net Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=lixom.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lixom-net.20230601.gappssmtp.com header.i=@lixom-net.20230601.gappssmtp.com header.b="HTcZdFzV" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-8019338c2b2so659956a12.3 for ; Thu, 19 Dec 2024 10:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20230601.gappssmtp.com; s=20230601; t=1734633961; x=1735238761; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=143UE/hj7ZBbFmrJrQEhrNzNTS4xZ3ycFkw9/SByLr8=; b=HTcZdFzVU1c6e690fNbRLkZp2Df/WQpEiZEgq2yTbQkDhmjNASobX4qYrAokFuS9XK n5xdxjuhthxdqIeZrYjViT8jOX0AWNj7Zk5+aG8pbH9rozfEVe3Gt45LgyFw3OWvo9lB RflSVfqUpJ22U1C4BcrEyYxZwLoyfNhfgyWQRNZtZSnsYXr2wJibZAZPvDGqB3nSFMS5 tcqDq6NpLL2j6vOX1oc4HBNy9g2fRzuf3BqzRSfZt1lFTK/qjzq7+uGfyONRrmp8Wqal 73gOY2ve6ALu9A+n8pg6tv55eBxgXsEgs0fFD9UYZ5BvBq5D7s+fwrloVXajKHpnJajQ yjBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734633961; x=1735238761; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=143UE/hj7ZBbFmrJrQEhrNzNTS4xZ3ycFkw9/SByLr8=; b=wce1jaE6ji1h+IA/7s+Z1Anw4edKDLUv7PM8I/Lz/0FxV2QGV6C+DyU3rAfTLUFdoY 0++oqlcJzBqGbSKDJCav2l6iN855W8wTDIvuw86xMnWPSGgGSCqL4gafvkkwRy6tPRf2 2ecDstX27Q/Ir2feYoZYjrEw5f269b5NFEM6ij76IeCMSTrxGmBBzf7uGXDDHwA8N2Vf K0lWW6Z7e/uBPdZe81OQ0KII9QbZyPtpHSwr8na9oU16UzD+v0ZQ0dn0KsxGDQmNd9f/ PUQvQTONuPzBA7o0+IE+Kxhqj1QxhACerprkn8kjMXu7CdBE8qvGHSmr0ot/R6MdkXGr uxOg== X-Forwarded-Encrypted: i=1; AJvYcCXo2mp5QITUTuADDTPW7QvcWJKIyW1d9FcLfXjf8c+Sdvf2FhQvgcOnlE9gpHo7+r5u7YSqSMFKU2gHEzA=@vger.kernel.org X-Gm-Message-State: AOJu0Ywy2chSxxOI6Hgl3mhfepbNixGAB9nn+gpgLLOkY3dZunvdeTmf ZDp/ZuAz7ZS6KdDFt4pRz4HrICAtOvKVxEWtkrxJHqpZ/fwRlfCYreeGRdLbjNxBgramEf3GI4p + X-Gm-Gg: ASbGncvF73Hi/eb5/1JYiBMKsZZwWy8t0yMAeEX5gjEHWu3zKWVLo0gwSnjShcKlBQ1 dBvHW0UbViLjP5+LLW2yQOtMPPxxY6OSk3CbdvPtX37K8khEa0lA1m5GFayDMzE/PXhv7rPk99x CPl4SoeUCYPciCw9jAR0T9eJsfhjeO0D9ODwDf6xtWkJ5fRV1rItnG/mNpy8Wv1gjNQm1/U7bbl q4oT2axgNZx9QHx0juRJ/2RuPZ9xL7+WpRNTj9x1fyWAzz/x+JdyQVXHeqmQVO0bEF6iwolzIcT 7nzwmlGRogzG6RMmjJTsnQ== X-Google-Smtp-Source: AGHT+IHltwFcMOgzCvC4uC3OMeWy2r9UnN99hknMrb2FwIvD3MZSxai/hpqEHlY9UehBsEN3dwGx+A== X-Received: by 2002:a05:6a21:3115:b0:1e1:af74:a235 with SMTP id adf61e73a8af0-1e5e0499fafmr257366637.24.1734633961250; Thu, 19 Dec 2024 10:46:01 -0800 (PST) Received: from localhost (99-152-116-91.lightspeed.sntcca.sbcglobal.net. [99.152.116.91]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fd4e2sm1633603b3a.169.2024.12.19.10.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 10:46:00 -0800 (PST) Date: Thu, 19 Dec 2024 10:45:46 -0800 From: Olof Johansson To: Aleksandar Rikalo Cc: linux-riscv@lists.infradead.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Jones , Christoph =?iso-8859-1?Q?M=FCllner?= , linux-kernel@vger.kernel.org, Djordje Todorovic Subject: Re: [PATCH] riscv: Fix the PAUSE Opcode for MIPS P8700. Message-ID: References: <20241218133340.51003-1-arikalo@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20241218133340.51003-1-arikalo@gmail.com> On Wed, Dec 18, 2024 at 02:33:40PM +0100, Aleksandar Rikalo wrote: > 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" This means that a kernel that's built for MIPS P8700 won't do the right thing on other platforms, i.e. single platform builds. That's not the right approach. It would make more sense to treat this as an errata with boot time patchup. -Olof