From: Guenter Roeck <linux@roeck-us.net>
To: sashiko-reviews@lists.linux.dev, Jihong Min <hurryman2212@gmail.com>
Cc: linux-pci@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v5 2/2] hwmon: add AMD Promontory 21 xHCI temperature sensor support
Date: Wed, 13 May 2026 18:13:02 -0700 [thread overview]
Message-ID: <831850c4-af36-4323-87f0-3add11da9583@roeck-us.net> (raw)
In-Reply-To: <20260514010045.D9B52C19425@smtp.kernel.org>
On 5/13/26 18:00, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Using readb() on a 32-bit PCIe MMIO vendor data register may cause unsupported request faults.
> --
>
> commit 9f079250f98377be1d241f6f3c08a14ae44d8785
> Author: Jihong Min <hurryman2212@gmail.com>
>
> hwmon: add AMD Promontory 21 xHCI temperature sensor support
>
> Add an auxiliary-bus hwmon driver for the temperature sensor exposed by
> AMD Promontory 21 (PROM21) xHCI PCI functions.
>
>> diff --git a/drivers/hwmon/prom21-xhci.c b/drivers/hwmon/prom21-xhci.c
>> new file mode 100644
>> index 0000000000000..7124824a1f5ed
>> --- /dev/null
>> +++ b/drivers/hwmon/prom21-xhci.c
>
> [ ... ]
>
>> +static int prom21_xhci_read_temp_raw_restore_index(struct prom21_xhci *hwmon,
>> + u8 *raw)
>> +{
>> + struct device *dev = &hwmon->pdev->dev;
>> + u32 index;
>> + u8 data;
>> + int ret;
>> +
>> + ret = prom21_xhci_pm_get(hwmon);
>> + if (ret)
>> + return ret;
>> +
>> + index = readl(hwmon->regs + PROM21_XHCI_INDEX_OFFSET);
>> + /* Select the PROM21 temperature register through the vendor index. */
>> + writel(PROM21_XHCI_TEMP_SELECTOR,
>> + hwmon->regs + PROM21_XHCI_INDEX_OFFSET);
>> + data = readb(hwmon->regs + PROM21_XHCI_DATA_OFFSET);
>
> Is it safe to use readb() on this 32-bit PCIe MMIO vendor data register?
>
> Many PCIe controllers and peripheral MMIO implementations strictly require
> 32-bit transactions. Issuing an 8-bit read can result in a PCIe unsupported
> request, which may return 0xff or trigger a fatal PCIe error.
>
> Could this instead use readl() and mask out the lowest 8 bits?
>
Good question. Any reason for using readb() instead of readl() ?
Thanks,
Guenter
>> + /* Restore the previous vendor index register value. */
>> + writel(index, hwmon->regs + PROM21_XHCI_INDEX_OFFSET);
>> + readl(hwmon->regs + PROM21_XHCI_INDEX_OFFSET);
>
next prev parent reply other threads:[~2026-05-14 1:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 21:39 [PATCH v5 0/2] AMD Promontory 21 xHCI temperature sensor support Jihong Min
2026-05-12 21:39 ` [PATCH v5 1/2] usb: xhci-pci: add AMD Promontory 21 PCI glue Jihong Min
2026-05-14 0:40 ` sashiko-bot
2026-05-14 1:20 ` Guenter Roeck
2026-05-14 13:38 ` Jihong Min
2026-05-14 13:44 ` Jihong Min
2026-05-15 1:49 ` Guenter Roeck
2026-05-14 14:29 ` Jihong Min
2026-05-14 19:22 ` Guenter Roeck
2026-05-12 21:39 ` [PATCH v5 2/2] hwmon: add AMD Promontory 21 xHCI temperature sensor support Jihong Min
2026-05-14 1:00 ` sashiko-bot
2026-05-14 1:13 ` Guenter Roeck [this message]
2026-05-12 21:49 ` [PATCH v5 0/2] " Jihong Min
2026-05-13 14:48 ` Mario Limonciello
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=831850c4-af36-4323-87f0-3add11da9583@roeck-us.net \
--to=linux@roeck-us.net \
--cc=hurryman2212@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).