Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: "Gupta, Akshay" <Akshay.Gupta@amd.com>
To: Guenter Roeck <linux@roeck-us.net>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>
Cc: "corbet@lwn.net" <corbet@lwn.net>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"Chatradhi, Naveen Krishna" <NaveenKrishna.Chatradhi@amd.com>,
	"L k, Prathima" <Prathima.Lk@amd.com>,
	"Umarji, Anand" <Anand.Umarji@amd.com>,
	"Kevin.Tung@quantatw.com" <Kevin.Tung@quantatw.com>
Subject: Re: [PATCH v2 5/6] misc: amd-sbi: Add SBTSI ioctl register transfer interface
Date: Thu, 28 May 2026 11:19:20 +0530	[thread overview]
Message-ID: <ec31cb51-89f9-4c6a-bfa3-183dea782897@amd.com> (raw)
In-Reply-To: <54160fbb-01d9-400b-80f7-bf340997a8d0@roeck-us.net>


On 5/15/2026 7:41 PM, Guenter Roeck wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On 5/15/26 06:45, Akshay Gupta wrote:
>> From: Prathima <Prathima.Lk@amd.com>
>>
>> Implement IOCTL interface for SB-TSI driver to enable userspace access
>> to TSI register read/write operations through the AMD Advanced Platform
>> Management Link (APML) protocol.
>> Add an ioctl command (SBTSI_IOCTL_REG_XFER_CMD) that accepts a register
>> address, data byte, and direction flag. Serialize access with a mutex
>> shared between the hwmon and ioctl paths to prevent concurrent bus
>> transactions from corrupting register state.
>>
>> Reviewed-by: Akshay Gupta <Akshay.Gupta@amd.com>
>> Signed-off-by: Prathima <Prathima.Lk@amd.com>
>> ---
>> Changes since v1:
>> - Use of devm_mutex_init in place of mutex_init
>> - Use of guard_mutex in place of mutex_lock()/mutex_unlock()
>> - Use of devm_add_action_or_reset() for clean removal
>>
>>    drivers/hwmon/sbtsi_temp.c      |  6 +++
>>    drivers/misc/amd-sbi/tsi-core.c | 84 ++++++++++++++++++++++++++++++++-
>>    drivers/misc/amd-sbi/tsi-core.h | 15 ++++++
>>    drivers/misc/amd-sbi/tsi.c      | 20 ++++++--
>>    include/linux/misc/tsi.h        |  8 ++++
>>    include/uapi/misc/amd-apml.h    | 23 +++++++++
>>    6 files changed, 151 insertions(+), 5 deletions(-)
>>    create mode 100644 drivers/misc/amd-sbi/tsi-core.h
>>
>> diff --git a/drivers/hwmon/sbtsi_temp.c b/drivers/hwmon/sbtsi_temp.c
>> index d7ae986d824c..00e982f4c716 100644
>> --- a/drivers/hwmon/sbtsi_temp.c
>> +++ b/drivers/hwmon/sbtsi_temp.c
>> @@ -64,12 +64,15 @@ static inline void sbtsi_mc_to_reg(s32 temp, u8 *integer, u8 *decimal)
>>    /*
>>     * Read integer and decimal parts of an SB-TSI temperature register pair
>>     * The read order is determined by the ReadOrder bit to ensure atomic latching.
>> + * The mutex protects against concurrent access to the shared I2C/I3C bus by
>> + * the hwmon sysfs and a userspace ioctl
>>     */
>>    static int sbtsi_temp_read(struct sbtsi_data *data, u8 reg1, u8 reg2,
>>                           u8 *val1, u8 *val2)
>>    {
>>        int ret;
>>
>> +     guard(mutex)(&data->lock);
> I would suggest to hide this behind access functions such as sbtsi_lock(),
> sbtsi_unlock(), and the matching guard functions. That can be done in a
> separate patch; it should not be necessary to include hwmon in the patch
> introducing the ioctl.
>
> Thanks,
> Guenter

Thank you for the feedback, Guenter.

In the next version, we will address this by implementing the matching 
guard function in the ioctl patch and creating a new patch for hwmon.

>

  reply	other threads:[~2026-05-28  5:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 13:45 [PATCH v2 0/6] misc: amd-sbi: Refactor SBTSI driver with I3C support and ioctl interface Akshay Gupta
2026-05-15 13:45 ` [PATCH v2 1/6] hwmon/misc: amd-sbi: Move core sbtsi support from hwmon to misc Akshay Gupta
2026-05-15 14:22   ` sashiko-bot
2026-05-15 13:45 ` [PATCH v2 2/6] hwmon: sbtsi_temp: Refactor temperature register access into helpers Akshay Gupta
2026-05-15 13:45 ` [PATCH v2 3/6] hwmon/misc: amd-sbi: Move sbtsi register transfer to core abstraction Akshay Gupta
2026-05-15 13:45 ` [PATCH v2 4/6] misc: amd-sbi: Add support for SB-TSI over I3C Akshay Gupta
2026-05-15 15:33   ` sashiko-bot
2026-05-15 16:21     ` Guenter Roeck
2026-05-15 13:45 ` [PATCH v2 5/6] misc: amd-sbi: Add SBTSI ioctl register transfer interface Akshay Gupta
2026-05-15 14:11   ` Guenter Roeck
2026-05-28  5:49     ` Gupta, Akshay [this message]
2026-05-15 15:58   ` sashiko-bot
2026-05-15 13:45 ` [PATCH v2 6/6] docs: misc: amd-sbi: Document SBTSI userspace interface Akshay Gupta

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=ec31cb51-89f9-4c6a-bfa3-183dea782897@amd.com \
    --to=akshay.gupta@amd.com \
    --cc=Anand.Umarji@amd.com \
    --cc=Kevin.Tung@quantatw.com \
    --cc=NaveenKrishna.Chatradhi@amd.com \
    --cc=Prathima.Lk@amd.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=skhan@linuxfoundation.org \
    /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