All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "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: Thu, 14 May 2026 01:00:45 +0000	[thread overview]
Message-ID: <20260514010045.D9B52C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260512213910.871859-3-hurryman2212@gmail.com>

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?

> +	/* Restore the previous vendor index register value. */
> +	writel(index, hwmon->regs + PROM21_XHCI_INDEX_OFFSET);
> +	readl(hwmon->regs + PROM21_XHCI_INDEX_OFFSET);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260512213910.871859-1-hurryman2212@gmail.com?part=2

  reply	other threads:[~2026-05-14  1:00 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 [this message]
2026-05-14  1:13     ` Guenter Roeck
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=20260514010045.D9B52C19425@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.