From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: hdegoede@redhat.com, markgross@kernel.org,
ilpo.jarvinen@linux.intel.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] platform/x86/intel/tpmi: Add debugfs interface
Date: Thu, 13 Jul 2023 19:48:11 +0300 [thread overview]
Message-ID: <ZLAqyzaFaF1BUIdZ@smile.fi.intel.com> (raw)
In-Reply-To: <20230712225950.171326-3-srinivas.pandruvada@linux.intel.com>
On Wed, Jul 12, 2023 at 03:59:49PM -0700, Srinivas Pandruvada wrote:
> Add debugfs interface for debugging TPMI configuration and register
> contents. This shows PFS (PM Feature structure) for each TPMI device.
>
> For each feature, show full register contents and allow to modify
> register at an offset.
>
> This debugfs interface is not present on locked down kernel with no
> DEVMEM access and without CAP_SYS_RAWIO permission.
...
> + for (i = 0; i < tpmi_info->feature_count; ++i) {
As I explained in the discussion in previous version the preincrement is rising
unneeded attention when there is nothing special about it.
> + pfs = &tpmi_info->tpmi_features[i];
> + ret = tpmi_read_feature_status(tpmi_info, pfs->pfs_header.tpmi_id, &locked,
> + &disabled);
> + if (ret) {
> + locked = 'U';
> + disabled = 'U';
> + } else {
> + disabled = disabled ? 'Y' : 'N';
> + locked = locked ? 'Y' : 'N';
> + }
> + seq_printf(s, "0x%02x\t\t0x%02x\t\t0x%04x\t\t0x%04x\t\t0x%02x\t\t0x%08x\t%c\t%c\n",
> + pfs->pfs_header.tpmi_id, pfs->pfs_header.num_entries,
> + pfs->pfs_header.entry_size, pfs->pfs_header.cap_offset,
> + pfs->pfs_header.attribute, pfs->vsec_offset, locked, disabled);
> + }
...
> + for (count = 0; count < pfs->pfs_header.num_entries; ++count) {
Ditto.
> + seq_printf(s, "TPMI Instance:%d offset:0x%x\n", count, off);
> +
> + mem = ioremap(off, size);
> + if (!mem) {
> + ret = -ENOMEM;
> + break;
> + }
> +
> + memcpy_fromio(buffer, mem, size);
> +
> + seq_hex_dump(s, " ", DUMP_PREFIX_OFFSET, row_size, sizeof(u32), buffer, size,
> + false);
> +
> + iounmap(mem);
> +
> + off += size;
> + }
...
> + for (i = 0; i < tpmi_info->feature_count; ++i) {
Ditto.
> + struct intel_tpmi_pm_feature *pfs;
> + struct dentry *dir;
> +
> + pfs = &tpmi_info->tpmi_features[i];
> + snprintf(name, sizeof(name), "tpmi-id-%02x", pfs->pfs_header.tpmi_id);
> + dir = debugfs_create_dir(name, tpmi_info->dbgfs_dir);
> +
> + debugfs_create_file("mem_dump", 0444, dir, pfs, &tpmi_mem_dump_fops);
> + debugfs_create_file("mem_write", 0644, dir, pfs, &mem_write_ops);
> + }
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-07-13 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 22:59 [PATCH v3 0/3] TPMI control and debugfs support Srinivas Pandruvada
2023-07-12 22:59 ` [PATCH v3 1/3] platform/x86/intel/tpmi: Read feature control status Srinivas Pandruvada
2023-07-13 16:44 ` Andy Shevchenko
2023-07-12 22:59 ` [PATCH v3 2/3] platform/x86/intel/tpmi: Add debugfs interface Srinivas Pandruvada
2023-07-13 16:48 ` Andy Shevchenko [this message]
2023-07-12 22:59 ` [PATCH v3 3/3] doc: TPMI: Add debugfs documentation Srinivas Pandruvada
2023-07-13 16:48 ` [PATCH v3 0/3] TPMI control and debugfs support Andy Shevchenko
2023-07-14 13:27 ` Hans de Goede
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=ZLAqyzaFaF1BUIdZ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.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
Powered by JetHome