From patchwork Wed Oct 16 20:27:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1998252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hZoMW5QI; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=fB4uI0GT; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=ZsXa1sLs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XTMxR136Gz1xvV for ; Thu, 17 Oct 2024 07:28:43 +1100 (AEDT) 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=y+Jt0R21tIVVXu+7aYCnNDDfu7rzU7wp/ytvllVH+7A=; b=hZoMW5QIcQFge7 7HsI2nNs5FStznfParZkUMPyKQJQIldzwhqRtCvTwNA7/pxIgYbjcQ+E6z+MN2cgTbD47MsWfJzE/ O5VDxIZFWCJrUHK6Q8icnhrOEYL60RegZm0vcfByev344RdZAm2LcwdbEYKMlFmtISolC61B7JNux 1OlwTvKHsRsLD4tQ19M3HoEvzpCgak8DlFmYCW3dyxca4aEXw/UrgviquLgX0b5nsTpKt5x25Y43I j3Zsz6S3W/pKs368fw6fiiY7n6LrdflX6fK6kh+pvueQEFBsL9S8h9/tZWTfDF1HpVjSh4kp/hDuP TelcddOWnTbwEMeJnGEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1AdN-0000000Cwbd-3GrR; Wed, 16 Oct 2024 20:28:41 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1AdM-0000000CwZz-1Ob1 for kvm-riscv@bombadil.infradead.org; Wed, 16 Oct 2024 20:28:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=yDDaRB4PMyQ9/gql9k5VOFo/XTjSV8DD59ducmwypkQ=; b=fB4uI0GTRfSRkPj34F+Bmu/DFG OBFAyBDQmqK+2AXYO7/QNkxLbkLb7CUOV+GKvWGcC8fKkCj8vKh3QBCjExX7jjGbdZ0559VJ/USBR BbD4CtvfItc9qApG5XHipY7MVOHTu3gFCcnONWfbNrj4RvYz6BbXYuUP+hr5shXpDP/dblbYr7nR2 j7xo3NirXR+POVXt1G1CG90+u20O0gmfoQth8nQucWZdMgaJ4rl/RDv2n524+BLucUS80m70OCTep ccXN2uKXXDzNYtD4KIcoTJqFKofyQUwJI9lcU6Et8yU4xxS7LME22c6xB9rL+QonUpdqk+a03Ihsl KZ1NAg1Q==; Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1AdG-00000006u85-1zez for kvm-riscv@lists.infradead.org; Wed, 16 Oct 2024 20:28:38 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2e2e87153a3so157969a91.3 for ; Wed, 16 Oct 2024 13:28:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729110512; x=1729715312; 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=yDDaRB4PMyQ9/gql9k5VOFo/XTjSV8DD59ducmwypkQ=; b=ZsXa1sLs23oME9v/z1udNv/pPRLfT/SoKCvzO3ZE5w5ZEn9F87fisiHV8miy8T7qyJ bDwO25y0Cl+bcicNHPPR6AEtQVOoflNYYGvIGAj8gaVfK5QStSUdIxJbBX9QWyGxWkvC HkJJKwx5lI/Tt1pVdh80dVzB0HC9hHhtT8j/44bsoLyJCQ0UZLcYkBpcONKuPBhQqy+c FnhOOzyVoZl7NFPn1qlZ0Wc/4ouZdWLhtT++rx05u+dt4NFI2nQdolWYfsY6KOt1oK+Z SgRvdZlA2wnF1KJpPAScArgiFKqUw/Z7on8UcTNokoMkylvPtlnx7VmbgHmJH7faAdHt GSaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729110512; x=1729715312; 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=yDDaRB4PMyQ9/gql9k5VOFo/XTjSV8DD59ducmwypkQ=; b=Mql1oy7OeU0hqYh2RJ+NUZhUg8FoOUpMuyNxCK3QzPIi5yZR7LZuSR4aui+rn/pQy+ x1RjOk8K7qUCrnR25/RA/NFQIDKPFG8KZSfS3Dl7o3OCDNsoPpaLvWlbBnVfQ8IQNG2l I5vuOUKKdJufWwzEiPLb4PSSldVb2FHsrH6sVMaMe0TV63BXDmTQvlofQlo2I0IDAZOK G7lkgq5QT+ZRlzsUmRcBe0qvuGlBUzGR4e7NQrBNMvomPfhe7YsQRduaMKRKfFI88Cc4 Z947VZi0bRb+x+5C50mGRC8Q2Wy4qFijMCSG3JkpM8oc1czgjlpbBLzboBK8m6pCqkFa VYcw== X-Forwarded-Encrypted: i=1; AJvYcCUJrOkCrZk1xzi6gAifDZKcnczbsKjKzCtb99EbamFes/sIogScKNr0HxhXj8n0Na+4WjWUX6/lwFw=@lists.infradead.org X-Gm-Message-State: AOJu0YxEcgU+txB3jt3lo7vpt7fRR8H4oqLCMhBrKEuet88AQ2CP1T0u n22iu6Fhihbs8SmtCJbw+ijTcF5eJr4SgatoObQ/te9M7dbUV0GDyXbQjW5BDTQ= X-Google-Smtp-Source: AGHT+IGd95Nmg0ggJul1Nr8wTLHIFKzUNFoXxBz4pua5goLKaPs4AurYTi27dLM3qyJ4bgLA2nsYeA== X-Received: by 2002:a17:90a:644e:b0:2e2:ba35:3574 with SMTP id 98e67ed59e1d1-2e3152ca49bmr21323024a91.11.1729110511688; Wed, 16 Oct 2024 13:28:31 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e3e08f8f89sm228613a91.38.2024.10.16.13.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 13:28:31 -0700 (PDT) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: Catalin Marinas , Atish Patra , linux-kselftest@vger.kernel.org, Rob Herring , "Kirill A . Shutemov" , Shuah Khan , devicetree@vger.kernel.org, Anup Patel , linux-kernel@vger.kernel.org, Jonathan Corbet , kvm-riscv@lists.infradead.org, Conor Dooley , kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, Evgenii Stepanov , Charlie Jenkins , Krzysztof Kozlowski , Samuel Holland Subject: [PATCH v5 08/10] riscv: hwprobe: Export the Supm ISA extension Date: Wed, 16 Oct 2024 13:27:49 -0700 Message-ID: <20241016202814.4061541-9-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241016202814.4061541-1-samuel.holland@sifive.com> References: <20241016202814.4061541-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_212836_682804_0DB2F5E7 X-CRM114-Status: GOOD ( 13.23 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Supm is a virtual ISA extension defined in the RISC-V Pointer Masking specification, which indicates that pointer masking is available in U-mode. It can be provided by either Smnpm or Ssnpm, depending [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1030 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: kvm-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: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Supm is a virtual ISA extension defined in the RISC-V Pointer Masking specification, which indicates that pointer masking is available in U-mode. It can be provided by either Smnpm or Ssnpm, depending on which mode the kernel runs in. Userspace should not care about this distinction, so export Supm instead of either underlying extension. Hide the extension if the kernel was compiled without support for the pointer masking prctl() interface. Signed-off-by: Samuel Holland --- Changes in v5: - Update pointer masking spec version to 1.0 in hwprobe documentation Changes in v2: - New patch for v2 Documentation/arch/riscv/hwprobe.rst | 3 +++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 85b709257918..b9aec2e5bbd4 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -239,6 +239,9 @@ The following keys are defined: ratified in commit 98918c844281 ("Merge pull request #1217 from riscv/zawrs") of riscv-isa-manual. + * :c:macro:`RISCV_HWPROBE_EXT_SUPM`: The Supm extension is supported as + defined in version 1.0 of the RISC-V Pointer Masking extensions. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated. Returns similar values to :c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF`, but the key was mistakenly classified as a bitmask rather than a value. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 1e153cda57db..868ff41b93d6 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -72,6 +72,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZCF (1ULL << 46) #define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 47) #define RISCV_HWPROBE_EXT_ZAWRS (1ULL << 48) +#define RISCV_HWPROBE_EXT_SUPM (1ULL << 49) #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 cea0ca2bf2a2..0ac78e9f7c94 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -150,6 +150,9 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZFH); EXT_KEY(ZFHMIN); } + + if (IS_ENABLED(CONFIG_RISCV_ISA_SUPM)) + EXT_KEY(SUPM); #undef EXT_KEY }