mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Po-Wen Kao <powenkao@google.com>
To: linux-scsi@vger.kernel.org
Cc: Konstantin Vyshetsky <vkon@google.com>,
	Randall Huang <huangrandall@google.com>,
	 Alim Akhtar <alim.akhtar@samsung.com>,
	Bart Van Assche <bvanassche@acm.org>,
	 Bean Huo <beanhuo@micron.com>,
	Stanley Jhu <stanleyjhu@google.com>,
	 "James E . J . Bottomley"
	<James.Bottomley@HansenPartnership.com>,
	 "Martin K . Petersen" <mkp@kernel.org>,
	Peter Wang <peter.wang@mediatek.com>,
	 Can Guo <can.guo@oss.qualcomm.com>,
	linux-kernel@vger.kernel.org,  Brian Kao <powenkao@google.com>
Subject: [PATCH v3 0/3] scsi: ufs: core: Add debugfs for PA TFS/FEC error counters
Date: Wed, 25 Nov 2026 19:33:58 +0800	[thread overview]
Message-ID: <20261125113435.1426680-1-powenkao@google.com> (raw)

From: Brian Kao <powenkao@google.com>

This series exposes the MIPI UniPro v3.0 PA layer TFS/FEC error
counters (0x15C3-0x15C7) under debugfs:

  /sys/kernel/debug/ufshcd/<dev>/pa_err_stats/{host,device}/

Patch 1 fixes an existing teardown race by removing debugfs and
disabling debugfs_ee_work before scsi_remove_host() removes the WLUN.
Patch 2 defers debugfs creation until after device init while keeping
debugfs_ee_work initialization before IRQs are enabled. Patch 3 adds
the PA_TFS_* and UniPro 2.0/3.0 definitions and creates
pa_err_stats/{host,device}/ based on PA_LOCALVERINFO / PA_REMOTEVERINFO.

Changes in v3 (suggested by Bart Van Assche):
- Split the ufshcd_remove() teardown fix into patch 1 with Fixes and
  stable tags.
- Patch 2: Initialize debugfs_ee_work and debugfs_ee_rate_limit_ms
  before IRQs are enabled via ufs_debugfs_ee_init(), and document the
  later fault-injection attribute initialization.
- Patch 3: Gate host/ and device/ on UniPro version (PA_LOCALVERINFO /
  PA_REMOTEVERINFO >= UFS_UNIPRO_VER_3_0), merge the duplicated host
  and device attribute arrays into one via debugfs_create_file_aux_num(),
  update the hba_from_file() comment, and clarify the 64-bit read/reset
  comments.

Changes in v2:
- Defer ufs_debugfs_hba_init() until after device init (suggested by
  Peter Wang).
- Create pa_err_stats/host/ and device/ only when supported instead of
  returning -EOPNOTSUPP on read/write.

Link: https://lore.kernel.org/linux-scsi/20261124012951.3143833-1-powenkao@google.com/
Link: https://lore.kernel.org/linux-scsi/20261123025745.1743640-1-powenkao@google.com/

Brian Kao (3):
  scsi: ufs: core: Remove debugfs before removing SCSI host
  scsi: ufs: core: Defer debugfs init until after device init
  scsi: ufs: core: Add debugfs for PA TFS/FEC error counters

 drivers/ufs/core/ufs-debugfs.c | 244 ++++++++++++++++++++++++++++++++-
 drivers/ufs/core/ufs-debugfs.h |   2 +
 drivers/ufs/core/ufshcd.c      |   8 +-
 include/ufs/unipro.h           |   9 +-
 4 files changed, 252 insertions(+), 11 deletions(-)


base-commit: 08fec21faae44fe002467976befd68e6e62969b5
-- 
2.56.1.839.g22a8290db9-goog


             reply	other threads:[~2026-11-25 11:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 11:33 Po-Wen Kao [this message]
2026-11-25 11:33 ` [PATCH v3 1/3] scsi: ufs: core: Remove debugfs before removing SCSI host Po-Wen Kao
2026-11-25 11:34 ` [PATCH v3 2/3] scsi: ufs: core: Defer debugfs init until after device init Po-Wen Kao
2026-11-25 11:34 ` [PATCH v3 3/3] scsi: ufs: core: Add debugfs for PA TFS/FEC error counters Po-Wen Kao

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=20261125113435.1426680-1-powenkao@google.com \
    --to=powenkao@google.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=can.guo@oss.qualcomm.com \
    --cc=huangrandall@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=peter.wang@mediatek.com \
    --cc=stanleyjhu@google.com \
    --cc=vkon@google.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

all inboxes | Powered by JetHome®