From patchwork Tue Jan 9 17:00:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Chauhan X-Patchwork-Id: 1884582 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=0SHrGmHG; 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=S9gWo2WJ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=Lg1w4sVV; 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=opensbi-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 4T8fHp3QxZz1yPj for ; Wed, 10 Jan 2024 05:15:50 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=neJiJDK6Q/1D9wn6t5VumohE5lT0ktaz0da2t0wTeKQ=; b=0SHrGmHGX7CRxX wPQtZgLGt2yYwYgohQcc1InRGcI5+BHl8hh8aV94L8Zz/jl6vlQocz6KoDFzAqwTC5Lmfw6FgXvqP yUTZJ76XnqDxwhqWBk0EMxXRoWsvQidRKb2Lf9dxJb8hlGcbdcOate6/io+J+IrZF7JP9tdgiLmy2 2ySyOQlJjKBNVdKpTdjVVNYiRRfkLpTwsfyXljFHREiopDzIBG2lVqMSoGZCtERFOpwH1QjNUJvSB zGuyXilIMtWBfPP+jzsvI4xhQ48mtsCRYtXVZxWigDf1M1n61QjhfAWvp5gnOCLxiJbnGRJJUCzJ7 sFkxOQQLW8GU7W0wBCGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNGdV-0096oc-32; Tue, 09 Jan 2024 18:15:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNFSu-008w3p-1l for opensbi@bombadil.infradead.org; Tue, 09 Jan 2024 17:00:36 +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:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description; bh=Ia5SxkpwkutqJbS3w74gHegI9hnFxhHuO87zRZnXMOc=; b=S9gWo2WJ0UHDZnX0HOCaHCiI7w OmIivPsaqsI8JWUeDfpIx/07+2GMraI2zhMJbOK5VpJNQ+Bh7qiwNIFO9PYNLtgOUtl77BZF/svp5 3IsqSDGwcp+flVhZCApQUlVed4/qTljCRHnsJGo+QT37azqoJ9AjhNPgLrHxpQHFKyZO/mWqSR52h 351hasl83H3HC9fDrjPrnhWbz//DhYJMTMLb1Qs2n8kJKaG/p3dnoHR+qm1g7y2Z02Fz1/D5cszLk NfpJ9nWCjx/2hstyVK2IDINgkXHzbj1x3AyfBfadXlVKJPbVnu03YDkKY8eu0WBlGMmj8vqZeRWNb ZOGFMnOg==; Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNFSr-008n5q-13 for opensbi@lists.infradead.org; Tue, 09 Jan 2024 17:00:35 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d3fe03b6b7so5680765ad.1 for ; Tue, 09 Jan 2024 09:00:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1704819631; x=1705424431; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ia5SxkpwkutqJbS3w74gHegI9hnFxhHuO87zRZnXMOc=; b=Lg1w4sVVJv+m/E1DhSsu94cV02auPkcrOEe4r3cVZskybHtK2XNiHfdZpGr9wTMj5a VES9Xxp0Xt0xVSa4IlEEVNkJdPNJlWQFmCRKDmisRXNuxu3Ex1JIiucgdRGlm7m9AbOt Hy+xAzS6Kt28ZSEHfzFR9VppxmnhmbPXO0advWDP7TwhbnKmHSORQa2iOzVJOHlOkCBm fYPYDHcmo81L/u8BVvQ2yETK37R0kOacw6l2MsNO1S9RItwPHw91gNLQUKNUnFZzLs82 E5wwK0euAEATG/OXn6HbTN9WX5cXZ8EhKjIjtMb/840BG8F243MabxgX3rEFtFaCzPJ7 t4ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704819631; x=1705424431; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ia5SxkpwkutqJbS3w74gHegI9hnFxhHuO87zRZnXMOc=; b=RQwoM84RBBR3O3ulLrxpQFCspmBq1xCD6dfVkX3WDMe5Prc2YZSXTJaCvbDtxWv7tP GAn0SIjNf5iauh8PFRM+jeOnDPRQ/AhDUXZn03kxd9s5F82WTPNqN6ExSZhyZjeJKajn zyNTdXkjMxXH+NuCvyFTjAVhmFfZ+2YneMB9qfmxed88jWWzk9JA+xK8ING5H9jgulOV iIN7FF7QhYgdPzY8witafXJ68MHts6EvOAF6SVRr31sVLZr9+5GlGQkDg2HqF4wdLSI5 lMjfspKOABIZch+O+uAyBMmhsE/MlXNMS0pPztufS1LUxv1jFt/s3qZbzq2ryy+aOfvj Ck7w== X-Gm-Message-State: AOJu0Yzic6pCOEuC3AUodmDXBHzCsWaWrCBKR8JivcAthjssrzRd7LpZ vsHMg3iOOC0G6EnTXbKVtXjx7Y1P1wWXr4275FRVzTGHgjY= X-Google-Smtp-Source: AGHT+IHYQrGJX/eNB0HkUzCwrfc/QT7zien79sVp8JwG/gSm51QR1wT7NXJPAYSMQLZ++hJxlEeSyA== X-Received: by 2002:a17:902:ea07:b0:1d4:e1d9:84c with SMTP id s7-20020a170902ea0700b001d4e1d9084cmr10838652plg.5.1704819630637; Tue, 09 Jan 2024 09:00:30 -0800 (PST) Received: from brahaspati.localdomain ([49.37.250.161]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001d3dff2575fsm2024086plq.52.2024.01.09.09.00.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 09:00:30 -0800 (PST) From: Himanshu Chauhan To: opensbi@lists.infradead.org Subject: [PATCH v3 4/8] lib: sbi: Detect support of debug triggers Date: Tue, 9 Jan 2024 22:30:16 +0530 Message-Id: <20240109170020.1731282-5-hchauhan@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240109170020.1731282-1-hchauhan@ventanamicro.com> References: <20240109170020.1731282-1-hchauhan@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240109_170033_663542_6978CB88 X-CRM114-Status: UNSURE ( 9.24 ) X-CRM114-Notice: Please train this message. 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: Detect if debug triggers, sdtrig extension, is supported by the CPU. The support is detected by access traps and ISA string parsing. Signed-off-by: Himanshu Chauhan --- include/sbi/sbi_hart.h | 2 ++ lib/sbi/sbi_hart.c | 4 ++++ 2 files changed, 6 insertions(+) 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:62f listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Detect if debug triggers, sdtrig extension, is supported by the CPU. The support is detected by access traps and ISA string parsing. Signed-off-by: Himanshu Chauhan Reviewed-by: Anup Patel --- include/sbi/sbi_hart.h | 2 ++ lib/sbi/sbi_hart.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 47be251..10dc3df 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -53,6 +53,8 @@ enum sbi_hart_extensions { SBI_HART_EXT_ZICBOM, /** Hart has Svpbmt extension */ SBI_HART_EXT_SVPBMT, + /** Hart has debug trigger extension */ + SBI_HART_EXT_SDTRIG, /** Maximum index of Hart extension */ SBI_HART_EXT_MAX, diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 770fee0..a0ab0c6 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -657,6 +657,7 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = { __SBI_HART_EXT_DATA(zicboz, SBI_HART_EXT_ZICBOZ), __SBI_HART_EXT_DATA(zicbom, SBI_HART_EXT_ZICBOM), __SBI_HART_EXT_DATA(svpbmt, SBI_HART_EXT_SVPBMT), + __SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG), }; /** @@ -898,6 +899,9 @@ __pmp_skip: /* Detect if hart supports smcntrpmf */ __check_ext_csr(SBI_HART_PRIV_VER_1_12, CSR_MCYCLECFG, SBI_HART_EXT_SMCNTRPMF); + /* Detect if hart support sdtrig (debug triggers) */ + __check_ext_csr(SBI_HART_PRIV_VER_UNKNOWN, + CSR_TSELECT, SBI_HART_EXT_SDTRIG); #undef __check_ext_csr