* [PATCH V3 0/3] memory: tegra: Restore MC state on system resume
@ 2026-04-30 9:51 Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 1/3] memory: tegra: Make ->resume() callback return void Ashish Mhetre
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Ashish Mhetre @ 2026-04-30 9:51 UTC (permalink / raw)
To: krzk, thierry.reding, jonathanh
Cc: ketanp, linux-kernel, linux-tegra, Ashish Mhetre
The tegra-mc platform driver does not register any dev_pm_ops, so the
SoC-specific ->resume() is never invoked (e.g. tegra186_mc_resume) on
system wake. On Tegra186 and later this means MC client Stream-ID
override registers are not reprogrammed, and clients behind the ARM
SMMU fault on the first DMA after resume.
Patch 1 makes the SoC-level ->resume() callback return void, since the
sole implementation never fails. This simplifies the wrapper added in
the next patch.
Patch 2 registers a dev_pm_ops on the tegra-mc driver and routes the
system resume callback into mc->soc->ops->resume() so the existing SID
restore path runs again on wake.
Patch 3 factors the existing intmask programming out of
tegra_mc_probe() into a helper and reuses it from the resume path so
the MC interrupt mask state, which is also lost across SC7, is
restored on wake too.
Changes in V3:
- New patch 1 to change the SoC ->resume() callback return type from
int to void, so the wrapper in patch 2 does not need to deal with
an err value that is always 0. (Jon Hunter)
- Patches 2 and 3 simplified accordingly, no other functional change.
Changes in V2:
- Split the original single patch into two - register the PM ops and
reprogram the MC interrupt masks on resume.
Ashish Mhetre (3):
memory: tegra: Make ->resume() callback return void
memory: tegra: Wire up system sleep PM ops
memory: tegra: Restore MC interrupt masks on resume
drivers/memory/tegra/mc.c | 37 ++++++++++++++++++++++++++-------
drivers/memory/tegra/tegra186.c | 4 +---
include/soc/tegra/mc.h | 2 +-
3 files changed, 32 insertions(+), 11 deletions(-)
--
2.50.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH V3 1/3] memory: tegra: Make ->resume() callback return void
2026-04-30 9:51 [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Ashish Mhetre
@ 2026-04-30 9:52 ` Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 2/3] memory: tegra: Wire up system sleep PM ops Ashish Mhetre
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Ashish Mhetre @ 2026-04-30 9:52 UTC (permalink / raw)
To: krzk, thierry.reding, jonathanh
Cc: ketanp, linux-kernel, linux-tegra, Ashish Mhetre
tegra186_mc_resume() is the only implementation of the SoC ->resume()
op in struct tegra_mc_ops, and it can never fail as the SID override
loop has no error path. The int return value is therefore not used.
Change the prototype to return void so callers do not need to deal
with a value that is always 0. If a future SoC needs to report
failure from resume, an int return type can be reintroduced then.
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
drivers/memory/tegra/tegra186.c | 4 +---
include/soc/tegra/mc.h | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index 91d56165605f..579d058da220 100644
--- a/drivers/memory/tegra/tegra186.c
+++ b/drivers/memory/tegra/tegra186.c
@@ -154,7 +154,7 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
return 0;
}
-static int tegra186_mc_resume(struct tegra_mc *mc)
+static void tegra186_mc_resume(struct tegra_mc *mc)
{
#if IS_ENABLED(CONFIG_IOMMU_API)
unsigned int i;
@@ -165,8 +165,6 @@ static int tegra186_mc_resume(struct tegra_mc *mc)
tegra186_mc_client_sid_override(mc, client, client->sid);
}
#endif
-
- return 0;
}
const struct tegra_mc_ops tegra186_mc_ops = {
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
index e6da035d1306..25d465d70493 100644
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -164,7 +164,7 @@ struct tegra_mc_ops {
*/
int (*probe)(struct tegra_mc *mc);
void (*remove)(struct tegra_mc *mc);
- int (*resume)(struct tegra_mc *mc);
+ void (*resume)(struct tegra_mc *mc);
int (*probe_device)(struct tegra_mc *mc, struct device *dev);
};
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V3 2/3] memory: tegra: Wire up system sleep PM ops
2026-04-30 9:51 [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 1/3] memory: tegra: Make ->resume() callback return void Ashish Mhetre
@ 2026-04-30 9:52 ` Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume Ashish Mhetre
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Ashish Mhetre @ 2026-04-30 9:52 UTC (permalink / raw)
To: krzk, thierry.reding, jonathanh
Cc: ketanp, linux-kernel, linux-tegra, Ashish Mhetre
The tegra-mc platform driver does not register any dev_pm_ops, so the
SoC-specific ->resume() is never invoked (e.g. tegra186_mc_resume) on
system wake. On Tegra186 and later this means MC client Stream-ID
override registers are not reprogrammed, and clients behind the ARM
SMMU fault on the first DMA after resume.
Register a dev_pm_ops on the tegra-mc driver and route the system
resume callback into mc->soc->ops->resume() so the existing SID
restore path runs again on wake.
No suspend callback is needed as the resume path reprograms all MC
state from the static SoC tables, so there is nothing to save.
Fixes: fe3b082a6eb8 ("memory: tegra: Add SID override programming for MC clients")
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
drivers/memory/tegra/mc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index d620660da331..64e41338cdf2 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -13,6 +13,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/tegra-icc.h>
@@ -1010,10 +1011,23 @@ static void tegra_mc_sync_state(struct device *dev)
icc_sync_state(dev);
}
+static int tegra_mc_resume(struct device *dev)
+{
+ struct tegra_mc *mc = dev_get_drvdata(dev);
+
+ if (mc->soc->ops && mc->soc->ops->resume)
+ mc->soc->ops->resume(mc);
+
+ return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(tegra_mc_pm_ops, NULL, tegra_mc_resume);
+
static struct platform_driver tegra_mc_driver = {
.driver = {
.name = "tegra-mc",
.of_match_table = tegra_mc_of_match,
+ .pm = pm_sleep_ptr(&tegra_mc_pm_ops),
.suppress_bind_attrs = true,
.sync_state = tegra_mc_sync_state,
},
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume
2026-04-30 9:51 [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 1/3] memory: tegra: Make ->resume() callback return void Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 2/3] memory: tegra: Wire up system sleep PM ops Ashish Mhetre
@ 2026-04-30 9:52 ` Ashish Mhetre
2026-04-30 11:42 ` Jon Hunter
2026-05-01 10:29 ` [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Jon Hunter
2026-05-04 17:48 ` Krzysztof Kozlowski
4 siblings, 1 reply; 8+ messages in thread
From: Ashish Mhetre @ 2026-04-30 9:52 UTC (permalink / raw)
To: krzk, thierry.reding, jonathanh
Cc: ketanp, linux-kernel, linux-tegra, Ashish Mhetre
The MC interrupt mask registers lose their state across SC7. Without
re-applying them on resume, MC interrupts that were enabled at probe
remain masked after wake, so any post-resume MC error goes unreported.
Factor the existing intmask programming out of tegra_mc_probe() into
tegra_mc_setup_intmask() and reuse it from the system resume callback
so the mask state is restored on wake.
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
drivers/memory/tegra/mc.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index 64e41338cdf2..cfcfc7291106 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -911,6 +911,19 @@ static void tegra_mc_num_channel_enabled(struct tegra_mc *mc)
}
}
+static void tegra_mc_setup_intmask(struct tegra_mc *mc)
+{
+ unsigned int i;
+
+ for (i = 0; i < mc->soc->num_intmasks; i++) {
+ if (mc->soc->num_channels)
+ mc_ch_writel(mc, MC_BROADCAST_CHANNEL, mc->soc->intmasks[i].mask,
+ mc->soc->intmasks[i].reg);
+ else
+ mc_writel(mc, mc->soc->intmasks[i].mask, mc->soc->intmasks[i].reg);
+ }
+}
+
static int tegra_mc_probe(struct platform_device *pdev)
{
struct tegra_mc *mc;
@@ -971,13 +984,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
}
}
- for (i = 0; i < mc->soc->num_intmasks; i++) {
- if (mc->soc->num_channels)
- mc_ch_writel(mc, MC_BROADCAST_CHANNEL, mc->soc->intmasks[i].mask,
- mc->soc->intmasks[i].reg);
- else
- mc_writel(mc, mc->soc->intmasks[i].mask, mc->soc->intmasks[i].reg);
- }
+ tegra_mc_setup_intmask(mc);
}
if (mc->soc->reset_ops) {
@@ -1018,6 +1025,8 @@ static int tegra_mc_resume(struct device *dev)
if (mc->soc->ops && mc->soc->ops->resume)
mc->soc->ops->resume(mc);
+ tegra_mc_setup_intmask(mc);
+
return 0;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume
2026-04-30 9:52 ` [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume Ashish Mhetre
@ 2026-04-30 11:42 ` Jon Hunter
2026-05-01 9:26 ` Krzysztof Kozlowski
0 siblings, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2026-04-30 11:42 UTC (permalink / raw)
To: Ashish Mhetre, krzk, thierry.reding; +Cc: ketanp, linux-kernel, linux-tegra
On 30/04/2026 10:52, Ashish Mhetre wrote:
> The MC interrupt mask registers lose their state across SC7. Without
SC7 may not mean anything to anyone that is not familiar with Tegra. I
often refer to this as 'Tegra low power suspend state (aka. SC7)'. Or we
can just simply say 'suspend' instead of 'SC7'.
Krzysztof, do you want use to clarify this and update the commit message?
> re-applying them on resume, MC interrupts that were enabled at probe
> remain masked after wake, so any post-resume MC error goes unreported.
>
> Factor the existing intmask programming out of tegra_mc_probe() into
> tegra_mc_setup_intmask() and reuse it from the system resume callback
> so the mask state is restored on wake.
>
> Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
> ---
> drivers/memory/tegra/mc.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
> index 64e41338cdf2..cfcfc7291106 100644
> --- a/drivers/memory/tegra/mc.c
> +++ b/drivers/memory/tegra/mc.c
> @@ -911,6 +911,19 @@ static void tegra_mc_num_channel_enabled(struct tegra_mc *mc)
> }
> }
>
> +static void tegra_mc_setup_intmask(struct tegra_mc *mc)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < mc->soc->num_intmasks; i++) {
> + if (mc->soc->num_channels)
> + mc_ch_writel(mc, MC_BROADCAST_CHANNEL, mc->soc->intmasks[i].mask,
> + mc->soc->intmasks[i].reg);
> + else
> + mc_writel(mc, mc->soc->intmasks[i].mask, mc->soc->intmasks[i].reg);
> + }
> +}
> +
> static int tegra_mc_probe(struct platform_device *pdev)
> {
> struct tegra_mc *mc;
> @@ -971,13 +984,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
> }
> }
>
> - for (i = 0; i < mc->soc->num_intmasks; i++) {
> - if (mc->soc->num_channels)
> - mc_ch_writel(mc, MC_BROADCAST_CHANNEL, mc->soc->intmasks[i].mask,
> - mc->soc->intmasks[i].reg);
> - else
> - mc_writel(mc, mc->soc->intmasks[i].mask, mc->soc->intmasks[i].reg);
> - }
> + tegra_mc_setup_intmask(mc);
> }
>
> if (mc->soc->reset_ops) {
> @@ -1018,6 +1025,8 @@ static int tegra_mc_resume(struct device *dev)
> if (mc->soc->ops && mc->soc->ops->resume)
> mc->soc->ops->resume(mc);
>
> + tegra_mc_setup_intmask(mc);
> +
> return 0;
> }
>
Otherwise this looks good to me.
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume
2026-04-30 11:42 ` Jon Hunter
@ 2026-05-01 9:26 ` Krzysztof Kozlowski
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-01 9:26 UTC (permalink / raw)
To: Jon Hunter, Ashish Mhetre, thierry.reding
Cc: ketanp, linux-kernel, linux-tegra
On 30/04/2026 13:42, Jon Hunter wrote:
>
> On 30/04/2026 10:52, Ashish Mhetre wrote:
>> The MC interrupt mask registers lose their state across SC7. Without
>
> SC7 may not mean anything to anyone that is not familiar with Tegra. I
> often refer to this as 'Tegra low power suspend state (aka. SC7)'. Or we
> can just simply say 'suspend' instead of 'SC7'.
>
> Krzysztof, do you want use to clarify this and update the commit message?
I can adjust it while applying.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3 0/3] memory: tegra: Restore MC state on system resume
2026-04-30 9:51 [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Ashish Mhetre
` (2 preceding siblings ...)
2026-04-30 9:52 ` [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume Ashish Mhetre
@ 2026-05-01 10:29 ` Jon Hunter
2026-05-04 17:48 ` Krzysztof Kozlowski
4 siblings, 0 replies; 8+ messages in thread
From: Jon Hunter @ 2026-05-01 10:29 UTC (permalink / raw)
To: Ashish Mhetre, krzk, thierry.reding; +Cc: ketanp, linux-kernel, linux-tegra
On 30/04/2026 10:51, Ashish Mhetre wrote:
> The tegra-mc platform driver does not register any dev_pm_ops, so the
> SoC-specific ->resume() is never invoked (e.g. tegra186_mc_resume) on
> system wake. On Tegra186 and later this means MC client Stream-ID
> override registers are not reprogrammed, and clients behind the ARM
> SMMU fault on the first DMA after resume.
>
> Patch 1 makes the SoC-level ->resume() callback return void, since the
> sole implementation never fails. This simplifies the wrapper added in
> the next patch.
>
> Patch 2 registers a dev_pm_ops on the tegra-mc driver and routes the
> system resume callback into mc->soc->ops->resume() so the existing SID
> restore path runs again on wake.
>
> Patch 3 factors the existing intmask programming out of
> tegra_mc_probe() into a helper and reuses it from the resume path so
> the MC interrupt mask state, which is also lost across SC7, is
> restored on wake too.
>
> Changes in V3:
> - New patch 1 to change the SoC ->resume() callback return type from
> int to void, so the wrapper in patch 2 does not need to deal with
> an err value that is always 0. (Jon Hunter)
> - Patches 2 and 3 simplified accordingly, no other functional change.
>
> Changes in V2:
> - Split the original single patch into two - register the PM ops and
> reprogram the MC interrupt masks on resume.
>
> Ashish Mhetre (3):
> memory: tegra: Make ->resume() callback return void
> memory: tegra: Wire up system sleep PM ops
> memory: tegra: Restore MC interrupt masks on resume
>
> drivers/memory/tegra/mc.c | 37 ++++++++++++++++++++++++++-------
> drivers/memory/tegra/tegra186.c | 4 +---
> include/soc/tegra/mc.h | 2 +-
> 3 files changed, 32 insertions(+), 11 deletions(-)
>
For the series ...
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Thanks!
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3 0/3] memory: tegra: Restore MC state on system resume
2026-04-30 9:51 [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Ashish Mhetre
` (3 preceding siblings ...)
2026-05-01 10:29 ` [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Jon Hunter
@ 2026-05-04 17:48 ` Krzysztof Kozlowski
4 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-04 17:48 UTC (permalink / raw)
To: thierry.reding, jonathanh, Ashish Mhetre
Cc: ketanp, linux-kernel, linux-tegra
On Thu, 30 Apr 2026 09:51:59 +0000, Ashish Mhetre wrote:
> The tegra-mc platform driver does not register any dev_pm_ops, so the
> SoC-specific ->resume() is never invoked (e.g. tegra186_mc_resume) on
> system wake. On Tegra186 and later this means MC client Stream-ID
> override registers are not reprogrammed, and clients behind the ARM
> SMMU fault on the first DMA after resume.
>
> Patch 1 makes the SoC-level ->resume() callback return void, since the
> sole implementation never fails. This simplifies the wrapper added in
> the next patch.
>
> [...]
Applied, thanks!
[1/3] memory: tegra: Make ->resume() callback return void
https://git.kernel.org/krzk/linux-mem-ctrl/c/4f42beeb9796e24e8009c46d1a2d676803e5ab24
[2/3] memory: tegra: Wire up system sleep PM ops
https://git.kernel.org/krzk/linux-mem-ctrl/c/2411c8d1e3e09910e94bab0d0a2c071fbc8a9e7b
[3/3] memory: tegra: Restore MC interrupt masks on resume
https://git.kernel.org/krzk/linux-mem-ctrl/c/35934fd08d17071c5ae0e99b95258f61f0cff763
Best regards,
--
Krzysztof Kozlowski <krzk@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-05-04 17:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 9:51 [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 1/3] memory: tegra: Make ->resume() callback return void Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 2/3] memory: tegra: Wire up system sleep PM ops Ashish Mhetre
2026-04-30 9:52 ` [PATCH V3 3/3] memory: tegra: Restore MC interrupt masks on resume Ashish Mhetre
2026-04-30 11:42 ` Jon Hunter
2026-05-01 9:26 ` Krzysztof Kozlowski
2026-05-01 10:29 ` [PATCH V3 0/3] memory: tegra: Restore MC state on system resume Jon Hunter
2026-05-04 17:48 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox