From patchwork Tue Oct 22 01:57:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13844970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC538D1714E for ; Tue, 22 Oct 2024 01:59:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E4B56B00A4; Mon, 21 Oct 2024 21:59:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4934C6B00A5; Mon, 21 Oct 2024 21:59:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EA286B00A6; Mon, 21 Oct 2024 21:59:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0551E6B00A4 for ; Mon, 21 Oct 2024 21:59:33 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B83DCC1C6E for ; Tue, 22 Oct 2024 01:59:16 +0000 (UTC) X-FDA: 82699581258.02.4E2A90B Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf13.hostedemail.com (Postfix) with ESMTP id EC57B20016 for ; Tue, 22 Oct 2024 01:59:15 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=sifive.com header.s=google header.b=JmHjYkox; spf=pass (imf13.hostedemail.com: domain of samuel.holland@sifive.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=samuel.holland@sifive.com; dmarc=pass (policy=reject) header.from=sifive.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729562222; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bo8mvyzhNAGog51IrcbhLjSHRzC25xwCT3do7aV0R5s=; b=3QTtcruisQTCzhq8vz2jYtTyWUzwQiJk8RkYHctf067v/DdXCqwupkG0Q+F/4lHpverfe/ mz4qu0KuabtrZEx1dB4Sz2KP+psNuHxLbef9OOcEfH1bpKTlEmaMy3IVlesAlsXCtBRg92 ZpJOJjNdfzQKXKYyf6ZbI4QHI8rzvqk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729562222; a=rsa-sha256; cv=none; b=vvuaySmBfr0NWDvopUBScz9bwv/GgFdHfbFo4O6fEh4nEZ4OhGA4C98kZPlPuAr8kbqbYM CUduZ9FYCqraXWEgvMeiJcTcCkNVlmq7OhYguirGvjM8K2vYy/Rz2y+HjW15OdJetehq5M WIW2pZFdPLgCxoPa9ISD1lgWeCDBjS4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=sifive.com header.s=google header.b=JmHjYkox; spf=pass (imf13.hostedemail.com: domain of samuel.holland@sifive.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=samuel.holland@sifive.com; dmarc=pass (policy=reject) header.from=sifive.com Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7d916b6a73aso3193581a12.1 for ; Mon, 21 Oct 2024 18:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729562370; x=1730167170; darn=kvack.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=bo8mvyzhNAGog51IrcbhLjSHRzC25xwCT3do7aV0R5s=; b=JmHjYkoxG9Ai4Q3v1nCMdA89FrFUfwnR0pNt0xL7j4wTtN2G475UcfLOrTzpt/+cri cLRa1I7WBqRRnK6droxKOn7D6s49jbd+BKWjKV9PXoEymcuXYvz2YiNL8iNRx4NmSfYy LWjMHOWbPk6nmFuy9SUot4iHEnoqlY578cXHucuzX92JBpBajXTYs+iUvbNkzuwBvxuc q3oqyTSJ+ZT9frhS2RfmrS65rCMwJ+p/pj0oxhk3HTU0MfYoNZLJFqiNrKkzXW5Xo3Ut VKndHsz6qHeRG7Dv53HFT0vkMMUKB+mByJed839hGjJBucnifaqVMLEQjcvHIv6Dzp2s SeZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729562370; x=1730167170; 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=bo8mvyzhNAGog51IrcbhLjSHRzC25xwCT3do7aV0R5s=; b=YiX4GYaH4wTw6Ht1T791ANBh8IbdGRD7UqCJSRE/pduIfrN4BWAJo5o7exe+y5mjbP qGEy7MBfbUNCyBtcfn8gi//VLsgTccokQr+kcrWKZ+w1IGwJ12IB7LM8v/TbX7T3aMD9 5nrvMavW2K6FOd6RBkJkusH0SVnYH05qvB4zPsjgeJMR3gGM0XCLsgOzUKPwjJHgXZYK WFCkv8FmrYh27/z31KStWetf5c6VHuWJI26t0ZkqfuRhhhzAsfjTGR5AhLqt2oM2s9P8 uiIsrgGW6zVbB76hbAPvLkBLbRHEbRKQ/yfufEyU7lkU18bnw9SBOMWi3Fp97Sco4WS/ pByw== X-Forwarded-Encrypted: i=1; AJvYcCUsW1lBnAURK8Jqt+H6c54CHXSBPppHp+2zPQwOtWpRy/c4ywFjOLaydkkXkftTbe1S0TzcsUZkcA==@kvack.org X-Gm-Message-State: AOJu0YxxvB5Qkb2kMmiXZ2hhjM5t55zlti2y3CIWatXbL3TGXW5h16cH MQApXT0CusizecS7GNDUBCcyml+Dn3qq/wQ9gUrQDf0NwdTjtjhP0H1KTnxirtvLoyOIPxGqaTz 8 X-Google-Smtp-Source: AGHT+IGIGEeeGnC+KScU7RsGDXnOT3F+tOuXMVMoo+fGP2CQIBFtA2wtlRRoG48p3wyuBbKw6oUq4g== X-Received: by 2002:a05:6a20:b40b:b0:1d9:b78:2dd3 with SMTP id adf61e73a8af0-1d92c5100b6mr19225561637.26.1729562370603; Mon, 21 Oct 2024 18:59:30 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec132ffdcsm3600710b3a.46.2024.10.21.18.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 18:59:29 -0700 (PDT) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org, Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com Cc: llvm@lists.linux.dev, Catalin Marinas , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti , Will Deacon , Evgenii Stepanov , Andrew Morton , linux-arm-kernel@lists.infradead.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Samuel Holland Subject: [PATCH v2 8/9] riscv: Add SBI Firmware Features extension definitions Date: Mon, 21 Oct 2024 18:57:16 -0700 Message-ID: <20241022015913.3524425-9-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241022015913.3524425-1-samuel.holland@sifive.com> References: <20241022015913.3524425-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: EC57B20016 X-Stat-Signature: pcctgy1ru8qnm7u4xbfbghtw8os9e1yo X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729562355-672779 X-HE-Meta: U2FsdGVkX1/urSmgoL6P9gH69ejlVOrVMm+WefEjTTMlXHc1jie11NA3t3joBloyJCX0Z36OBakUERA3Y4hNskkHkTZtMIlAdF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xzHreQ7E+t141dBB5FqE677Ancf+4bMqeVev2Pz+mlz1r/PU/pEzdbLLioIJ6appyg072O65JGmQMJajICUR+nGNHrA5++BDu6lpLh5H0uAxXRkN97/hL/2AtozXRL9HHzrGrBQqCxDsA8iu7xY3cHzPQOnegpY6QqVKSXxnZ3PuKko+lKzImZyilKidVS0YRdLHSo1ELZTYyUjEkkghxQwSMSPCubPyAalmljKpmpikrRPOesLeIuaQ7sRqe7+yAMl68aDPkwX8zH8JKTjpQveVHXcvy5yObakQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Clément Léger Add necessary SBI definitions to use the FWFT extension. [Samuel: Add SBI_FWFT_POINTER_MASKING_PMLEN] Signed-off-by: Clément Léger Signed-off-by: Samuel Holland --- Changes in v2: - New patch for v2 arch/riscv/include/asm/sbi.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 98f631b051db..4a35c6ffe49f 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -34,6 +34,7 @@ enum sbi_ext_id { SBI_EXT_PMU = 0x504D55, SBI_EXT_DBCN = 0x4442434E, SBI_EXT_STA = 0x535441, + SBI_EXT_FWFT = 0x46574654, /* Experimentals extensions must lie within this range */ SBI_EXT_EXPERIMENTAL_START = 0x08000000, @@ -281,6 +282,33 @@ struct sbi_sta_struct { #define SBI_SHMEM_DISABLE -1 +/* SBI function IDs for FW feature extension */ +#define SBI_EXT_FWFT_SET 0x0 +#define SBI_EXT_FWFT_GET 0x1 + +enum sbi_fwft_feature_t { + SBI_FWFT_MISALIGNED_EXC_DELEG = 0x0, + SBI_FWFT_LANDING_PAD = 0x1, + SBI_FWFT_SHADOW_STACK = 0x2, + SBI_FWFT_DOUBLE_TRAP = 0x3, + SBI_FWFT_PTE_AD_HW_UPDATING = 0x4, + SBI_FWFT_POINTER_MASKING_PMLEN = 0x5, + SBI_FWFT_LOCAL_RESERVED_START = 0x6, + SBI_FWFT_LOCAL_RESERVED_END = 0x3fffffff, + SBI_FWFT_LOCAL_PLATFORM_START = 0x40000000, + SBI_FWFT_LOCAL_PLATFORM_END = 0x7fffffff, + + SBI_FWFT_GLOBAL_RESERVED_START = 0x80000000, + SBI_FWFT_GLOBAL_RESERVED_END = 0xbfffffff, + SBI_FWFT_GLOBAL_PLATFORM_START = 0xc0000000, + SBI_FWFT_GLOBAL_PLATFORM_END = 0xffffffff, +}; + +#define SBI_FWFT_GLOBAL_FEATURE_BIT (1 << 31) +#define SBI_FWFT_PLATFORM_FEATURE_BIT (1 << 30) + +#define SBI_FWFT_SET_FLAG_LOCK (1 << 0) + /* SBI spec version fields */ #define SBI_SPEC_VERSION_DEFAULT 0x1 #define SBI_SPEC_VERSION_MAJOR_SHIFT 24