From: sashiko-bot@kernel.org
To: "Li Jun" <lijun01@kylinos.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] accel: habanalabs: pm: use DEFINE_SIMPLE_DEV_OPS for pm struct
Date: Fri, 21 Aug 2026 07:35:03 +0000 [thread overview]
Message-ID: <20260821073503.7017C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821031959.288264-1-lijun01@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Using `DEFINE_SIMPLE_DEV_PM_OPS` incorrectly maps the `.freeze` callback to the suspend function, causing the PCI device to be forced into D3hot during hibernation freeze.
--
--- Patch [1]: [PATCH v2] accel: habanalabs: pm: use DEFINE_SIMPLE_DEV_OPS for pm struct ---
commit 05b8c895a9d3a2cfea19ba9e2cdc13394fb870ce
Author: Li Jun <lijun01@kylinos.cn>
accel: habanalabs: pm: use DEFINE_SIMPLE_DEV_OPS for pm struct
This commit uses DEFINE_SIMPLE_DEV_PM_OPS to define hl_pm_ops and safely
handle PM callbacks without triggering compiler warnings when PM sleep is
disabled. It also implicitly adds callbacks for freeze, thaw, poweroff,
and restore.
> diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c
> index 220954d730136..7ec5aa7905f06 100644
> --- a/drivers/accel/habanalabs/common/habanalabs_drv.c
> +++ b/drivers/accel/habanalabs/common/habanalabs_drv.c
> @@ -1630,10 +1630,7 @@ static void hl_pci_reset_done(struct pci_dev *pdev)
> hl_device_reset(hdev, flags);
> }
>
> -static const struct dev_pm_ops hl_pm_ops = {
> - .suspend = hl_pmops_suspend,
> - .resume = hl_pmops_resume,
> -};
> +static DEFINE_SIMPLE_DEV_PM_OPS(hl_pm_ops, hl_pmops_suspend, hl_pmops_resume);
[Severity: High]
Does this map the .freeze callback to hl_pmops_suspend, which forces the
device into D3hot?
DEFINE_SIMPLE_DEV_PM_OPS implicitly sets the .freeze callback to
hl_pmops_suspend. When the user initiates hibernation, this callback is
invoked and eventually puts the device into D3hot:
drivers/accel/habanalabs/common/device.c:hl_device_suspend() {
...
pci_set_power_state(hdev->pdev, PCI_D3hot);
...
}
Will putting the PCI device into D3hot during the .freeze phase make its
configuration and memory space inaccessible, breaking the system-wide
hibernation image creation process?
> static const struct pci_error_handlers hl_pci_err_handler = {
> .error_detected = hl_pci_err_detected,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821031959.288264-1-lijun01@kylinos.cn?part=1
prev parent reply other threads:[~2026-08-21 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 3:19 [PATCH v2] accel: habanalabs: pm: use DEFINE_SIMPLE_DEV_OPS for pm struct Li Jun
2026-08-21 7:35 ` sashiko-bot [this message]
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=20260821073503.7017C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lijun01@kylinos.cn \
--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.