From: Athira Rajeev <atrajeev@linux.ibm.com>
To: maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Cc: atrajeev@linux.ibm.com, disgoel@linux.vnet.ibm.com,
hbathini@linux.vnet.ibm.com, Aditya.Bodkhe1@ibm.com,
adubey@linux.ibm.com, skb99@linux.ibm.com, sshegde@linux.ibm.com,
riteshh@linux.ibm.com, Tejas.Manhas1@ibm.com
Subject: [PATCH 3/9] powerpc/pseries/htmdump: Add htm start support to htmdump module
Date: Fri, 14 Mar 2025 19:25:35 +0530 [thread overview]
Message-ID: <20250314135541.1831-4-atrajeev@linux.ibm.com> (raw)
In-Reply-To: <20250314135541.1831-1-atrajeev@linux.ibm.com>
Support starting of Hardware Trace Macro (HTM) function
via debugfs interface. Under debugfs folder
"/sys/kernel/debug/powerpc/htmdump", add file "htmstart".
The interface allows starting of htm via this file by
writing value "1". Also allows stopping of htm tracing by
writing value "0" to this file. Any other value returns
-EINVAL.
Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
---
arch/powerpc/platforms/pseries/htmdump.c | 48 ++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/htmdump.c b/arch/powerpc/platforms/pseries/htmdump.c
index c623836f7054..dafbe662fb3d 100644
--- a/arch/powerpc/platforms/pseries/htmdump.c
+++ b/arch/powerpc/platforms/pseries/htmdump.c
@@ -17,6 +17,7 @@ static u32 nodalchipindex;
static u32 coreindexonchip;
static u32 htmtype;
static u32 htmconfigure;
+static u32 htmstart;
static struct dentry *htmdump_debugfs_dir;
/*
@@ -151,7 +152,53 @@ static int htmconfigure_get(void *data, u64 *val)
return 0;
}
+static int htmstart_set(void *data, u64 val)
+{
+ long rc, ret;
+
+ /*
+ * value as 1: start HTM
+ * value as 0: stop HTM
+ * Return -EINVAL for other values.
+ */
+ if (val == 1) {
+ /*
+ * Invoke H_HTM call with:
+ * - operation as htm start (H_HTM_OP_START)
+ * - last three values are unused, hence set to zero
+ */
+ rc = htm_hcall_wrapper(nodeindex, nodalchipindex, coreindexonchip,
+ htmtype, H_HTM_OP_START, 0, 0, 0);
+
+ } else if (val == 0) {
+ /*
+ * Invoke H_HTM call with:
+ * - operation as htm stop (H_HTM_OP_STOP)
+ * - last three values are unused, hence set to zero
+ */
+ rc = htm_hcall_wrapper(nodeindex, nodalchipindex, coreindexonchip,
+ htmtype, H_HTM_OP_STOP, 0, 0, 0);
+ } else
+ return -EINVAL;
+
+ ret = htm_return_check(rc);
+ if (ret <= 0)
+ return ret;
+
+ /* Set htmstart if H_HTM_OP_START/H_HTM_OP_STOP operation succeeds */
+ htmstart = val;
+
+ return 0;
+}
+
+static int htmstart_get(void *data, u64 *val)
+{
+ *val = htmstart;
+ return 0;
+}
+
DEFINE_SIMPLE_ATTRIBUTE(htmconfigure_fops, htmconfigure_get, htmconfigure_set, "%llu\n");
+DEFINE_SIMPLE_ATTRIBUTE(htmstart_fops, htmstart_get, htmstart_set, "%llu\n");
static int htmdump_init_debugfs(void)
{
@@ -178,6 +225,7 @@ static int htmdump_init_debugfs(void)
* Debugfs interface files to control HTM operations:
*/
debugfs_create_file("htmconfigure", 0600, htmdump_debugfs_dir, NULL, &htmconfigure_fops);
+ debugfs_create_file("htmstart", 0600, htmdump_debugfs_dir, NULL, &htmstart_fops);
return 0;
}
--
2.43.5
next prev parent reply other threads:[~2025-03-14 13:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 13:55 [PATCH 0/9] Add support for configure and control of Hardware Trace Macro(HTM) Athira Rajeev
2025-03-14 13:55 ` [PATCH 1/9] powerpc/pseries/htmdump: Add htm_hcall_wrapper to integrate other htm operations Athira Rajeev
2025-03-14 13:55 ` [PATCH 2/9] powerpc/pseries/htmdump: Add htm configure support to htmdump module Athira Rajeev
2025-03-14 13:55 ` Athira Rajeev [this message]
2025-03-14 13:55 ` [PATCH 4/9] powerpc/pseries/htmdump: Add htm status " Athira Rajeev
2025-03-14 13:55 ` [PATCH 5/9] powerpc/pseries/htmdump: Add htm info " Athira Rajeev
2025-03-14 13:55 ` [PATCH 6/9] powerpc/pseries/htmdump: Add htm setup " Athira Rajeev
2025-03-14 13:55 ` [PATCH 7/9] powerpc/pseries/htmdump: Add htm flags " Athira Rajeev
2025-03-14 13:55 ` [PATCH 8/9] powerpc/pseries/htmdump: Add htm capabilities " Athira Rajeev
2025-03-14 13:55 ` [PATCH 9/9] powerpc/pseries/htmdump: Add documentation for H_HTM debugfs interface Athira Rajeev
2025-03-20 13:13 ` [PATCH 0/9] Add support for configure and control of Hardware Trace Macro(HTM) Venkat Rao Bagalkote
2025-03-20 14:51 ` Athira Rajeev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250314135541.1831-4-atrajeev@linux.ibm.com \
--to=atrajeev@linux.ibm.com \
--cc=Aditya.Bodkhe1@ibm.com \
--cc=Tejas.Manhas1@ibm.com \
--cc=adubey@linux.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=riteshh@linux.ibm.com \
--cc=skb99@linux.ibm.com \
--cc=sshegde@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).