mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maulik Shah <maulik.shah@oss.qualcomm.com>
To: Abel Vesa <abel.vesa@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Abel Vesa <abelvesa@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] soc: qcom: rpmh-rsc: Write the sleep and wake sets again after hibernation
Date: Mon, 30 Nov 2026 10:49:13 +0530	[thread overview]
Message-ID: <ee89da6e-7705-488e-b3c3-edd114bc0eed@oss.qualcomm.com> (raw)
In-Reply-To: <20261120-soc-qcom-rpmh-rsc-restore-hibernation-v1-1-3ffd45c9c55a@oss.qualcomm.com>



On 20-11-2026 20:38, Abel Vesa wrote:
> +/*
> + * A hibernation image is restored by another kernel, which filled the sleep
> + * and wake TCSes with its own votes. Our cache still says they hold ours, so
> + * rpmh_flush() would never write them again and the next power collapse would
> + * use what the other kernel left behind. Write them again before that.
> + */
> +static int rpmh_rsc_restore_early(struct device *dev)
> +{
> +	struct rsc_drv *drv = dev_get_drvdata(dev);
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&drv->client.cache_lock, flags);
> +	drv->client.dirty = true;
> +	spin_unlock_irqrestore(&drv->client.cache_lock, flags);
> +
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops rpmh_rsc_pm_ops = {
> +	.restore_early = pm_sleep_ptr(rpmh_rsc_restore_early),
> +};

Its very likely that client would have already send a new/updated vote before the restore_early phase,
for example, PCIe maps its .restore_noirq same as .resume_noirq,

qcom_pcie_resume_noirq()   → icc_enable()    → qcom_icc_set()    → qcom_icc_bcm_voter_commit()    → rpmh_invalidate()
would have updated dirty cache flag. So this callback be needed to be moved to .restore_noirq stage or even before actual voting re-starts
or the idle low power mode happens.

For the RSCs using the CPU PM notifier fallback (not using power-domains property), When the saved image resumes
cpuidle gets enabled in syscore stage.

syscore_resume() => pm_sleep_enable_secondary_cpus() => cpuidle_resume(),

If all CPUs enter idle while device restoration is pending, the last CPU can therefore reach rpmh_rsc_cpu_pm_callback()
and rpmh_flush() while the restored dirty flag is still false.

so need to re-set this dirty flag in the syscore ops, resume callback.

Thanks,
Maulik

      parent reply	other threads:[~2026-11-30  5:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:08 Abel Vesa
2026-11-26 14:39 ` Konrad Dybcio
2026-11-30  5:19 ` Maulik Shah [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=ee89da6e-7705-488e-b3c3-edd114bc0eed@oss.qualcomm.com \
    --to=maulik.shah@oss.qualcomm.com \
    --cc=abel.vesa@oss.qualcomm.com \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®