From patchwork Fri Apr 12 04:11:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Jenkins X-Patchwork-Id: 13626798 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 D30F2C4345F for ; Fri, 12 Apr 2024 04:13:33 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Aeb9PE880c0PnT4p+faL6RxJZ0avgZxUjdk2BE7iNww=; b=29x4Q0XYUosKHp Jq7/EMBc0rwv0woRn0QJmTQF6vfnxFNkK2bldulUS9IRB68KMWsIZ7pdeioBlmX+QYpIpm5fk5Nda Vob6F1K9njFyRzHSLzYYTzgqnmu0Gj+j1VDxkZRx7UD6UKiw1VW5GIjnka9RMNEe/I10SWbalxNQj ceLNrNrOlj3J89HMnkJOpEGslRgOMwE42OB6wiWBBwqAp6a1lDoIRN8Yj9vdQ0OONZsWiVS0KupnL y5x4HfNQLHbIs2i38bXmQLqiFjOe7gI2W/2lVL27pg2/geaO0prCPduxIXYwoU03TkQUnqF/6Rv9I lXpIcjcIFzuRFsJgcxhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv8Hu-0000000FBYD-2Cwu; Fri, 12 Apr 2024 04:13:18 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv8Gb-0000000FAOZ-3IVt for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 04:12:02 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6ea26393116so439464a34.0 for ; Thu, 11 Apr 2024 21:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712895115; x=1713499915; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wwc/PeNyJDl6GgnW4cuopcphm/oVDetOGOo/hxv7XcM=; b=1noD3OSVhwvpcB+q0mTjv2FEyIG5ozxY3jRg2S06dUatvY7iJs3YNyZoIPKOWMWKQM DOilr8vA2L405z/MKCrtuJ5/7wOGC+3nwuy1HeIyUWoLXOEk/qfe+Ohj4Ww5drA3KI3v k08nIXQ/3gcLQuIFeMz+7CFzCDd9bv4g9b7ceY1ik/4k+Oe9zcd5mk9CHkgARnYyAvSu zLZA9i/wMWifQhEbjxVgt5K5jvJLlLjVv1BMHpWhbe1oOLJULo9LRDKJ0UsvdQ8+2xcR eTBRSzS66PR8r2G3xa6+e+flNMItrw3qnLRCfPGrhjHXBhmdqJ1OGs/Q9BcPOSXNT5MA Tzdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712895115; x=1713499915; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wwc/PeNyJDl6GgnW4cuopcphm/oVDetOGOo/hxv7XcM=; b=m8nBnN8M2U48AljPBV5RQj+ve756I6DYQ9JGIG0zalzSXsPFE37ARpW0R6j2B6dSGj I30KgcR6puS3/XZzTI3w1tz+auciLB4dyCEXScRBYqUBDbcVI+NqL4JjbagD9Rg/fDai Lk9jGWYyqx2K2tbiCQXjFPDYpPCUfH2D/3jIGLCtHk5HKXrJyftzH/hUd91qjT4eGQ5a NEu/RAg87x5szx5bU+6TCVZr1NRBfqoOFhw34Nc61e8FR6rgLNjT7xSayFCmpCAKeDmv Oz9eL30jzFD83bZ7UdFbesZk08XmKlHKUFVk4L/Ftzq6cGLRLG5rewxo0K+YZv9GGafa 7r8Q== X-Forwarded-Encrypted: i=1; AJvYcCXPiYwyPtJK5ihUPs3lYMOOBbu7iNsP30uNoWVqeSr39q4lJfMym+m36qIVD3gQ0QW4dTFvxbAbXuunWK1nXvLrVZt8yk81WxEtIs45fP0//M+khgE= X-Gm-Message-State: AOJu0YyGKks9e67mDqRgY2gHC9ROmNVBHTSUfH17BRE0i+KptkLZHy3n ww6fppBtmgWw/eyHhHi1s9YvZHpySkeDbQLlHNab/p69uEiz21DGnNuSHE3CWps= X-Google-Smtp-Source: AGHT+IFOYsbLF0F+gkJeOyJgzaCsQeEF3L5USkF2a5gefrMyQNupps7ab0ysCKPYkK28Wn8+LqBa1w== X-Received: by 2002:a05:6808:1b12:b0:3c5:f8b7:caca with SMTP id bx18-20020a0568081b1200b003c5f8b7cacamr1951974oib.0.1712895114722; Thu, 11 Apr 2024 21:11:54 -0700 (PDT) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id ka13-20020a056a00938d00b006e57247f4e5sm1949712pfb.8.2024.04.11.21.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 21:11:53 -0700 (PDT) From: Charlie Jenkins Date: Thu, 11 Apr 2024 21:11:18 -0700 Subject: [PATCH 12/19] riscv: Create xtheadvector file MIME-Version: 1.0 Message-Id: <20240411-dev-charlie-support_thead_vector_6_9-v1-12-4af9815ec746@rivosinc.com> References: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> In-Reply-To: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> To: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , Evan Green , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Jonathan Corbet , Shuah Khan Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712895091; l=1663; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=b+24lxxAnvlUN0+328A+gcU/U3wnp/aT5n2aF7/kAXA=; b=tBUd1KU9cHUGPbHmulFHg/OgKEnR6bzENCIMFD8J4yhd09ZA941LBjBGdCqnbgqxhCqWkN+bL 8o8eZ4Dh6iFALQU1B4pRcjyHGJQ2j6rg94+Lgm/1CBT+77zQ+CdfjUP X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_211158_059342_263F0C9A X-CRM114-Status: GOOD ( 12.67 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These definitions didn't fit anywhere nicely, so create a new file to house various xtheadvector instruction encodings. Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/xtheadvector.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/riscv/include/asm/xtheadvector.h b/arch/riscv/include/asm/xtheadvector.h new file mode 100644 index 000000000000..348263ea164c --- /dev/null +++ b/arch/riscv/include/asm/xtheadvector.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * Vector 0.7.1 as used for example on T-Head Xuantie cores, uses an older + * encoding for vsetvli (ta, ma vs. d1), so provide an instruction for + * vsetvli t4, x0, e8, m8, d1 + */ +#define THEAD_VSETVLI_T4X0E8M8D1 ".long 0x00307ed7\n\t" +#define THEAD_VSETVLI_X0X0E8M8D1 ".long 0x00307057\n\t" + +/* + * While in theory, the vector-0.7.1 vsb.v and vlb.v result in the same + * encoding as the standard vse8.v and vle8.v, compilers seem to optimize + * the call resulting in a different encoding and then using a value for + * the "mop" field that is not part of vector-0.7.1 + * So encode specific variants for vstate_save and _restore. + */ +#define THEAD_VSB_V_V0T0 ".long 0x02028027\n\t" +#define THEAD_VSB_V_V8T0 ".long 0x02028427\n\t" +#define THEAD_VSB_V_V16T0 ".long 0x02028827\n\t" +#define THEAD_VSB_V_V24T0 ".long 0x02028c27\n\t" +#define THEAD_VLB_V_V0T0 ".long 0x012028007\n\t" +#define THEAD_VLB_V_V8T0 ".long 0x012028407\n\t" +#define THEAD_VLB_V_V16T0 ".long 0x012028807\n\t" +#define THEAD_VLB_V_V24T0 ".long 0x012028c07\n\t"