* [PATCH AUTOSEL 5.11 26/52] clk: qcom: gdsc: Implement NO_RET_PERIPH flag [not found] <20210302115534.61800-1-sashal@kernel.org> @ 2021-03-02 11:55 ` Sasha Levin 2021-03-02 23:02 ` Stephen Boyd 0 siblings, 1 reply; 3+ messages in thread From: Sasha Levin @ 2021-03-02 11:55 UTC (permalink / raw) To: linux-kernel, stable Cc: AngeloGioacchino Del Regno, Stephen Boyd, Sasha Levin, linux-clk From: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> [ Upstream commit 785c02eb35009a4be6dbc68f4f7d916e90b7177d ] In some rare occasions, we want to only set the RETAIN_MEM bit, but not the RETAIN_PERIPH one: this is seen on at least SDM630/636/660's GPU-GX GDSC, where unsetting and setting back the RETAIN_PERIPH bit will generate chaos and panics during GPU suspend time (mainly, the chaos is unaligned access). For this reason, introduce a new NO_RET_PERIPH flag to the GDSC driver to address this corner case. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Link: https://lore.kernel.org/r/20210113183817.447866-8-angelogioacchino.delregno@somainline.org Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/clk/qcom/gdsc.c | 10 ++++++++-- drivers/clk/qcom/gdsc.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index af26e0695b86..51ed640e527b 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -183,7 +183,10 @@ static inline int gdsc_assert_reset(struct gdsc *sc) static inline void gdsc_force_mem_on(struct gdsc *sc) { int i; - u32 mask = RETAIN_MEM | RETAIN_PERIPH; + u32 mask = RETAIN_MEM; + + if (!(sc->flags & NO_RET_PERIPH)) + mask |= RETAIN_PERIPH; for (i = 0; i < sc->cxc_count; i++) regmap_update_bits(sc->regmap, sc->cxcs[i], mask, mask); @@ -192,7 +195,10 @@ static inline void gdsc_force_mem_on(struct gdsc *sc) static inline void gdsc_clear_mem_on(struct gdsc *sc) { int i; - u32 mask = RETAIN_MEM | RETAIN_PERIPH; + u32 mask = RETAIN_MEM; + + if (!(sc->flags & NO_RET_PERIPH)) + mask |= RETAIN_PERIPH; for (i = 0; i < sc->cxc_count; i++) regmap_update_bits(sc->regmap, sc->cxcs[i], mask, 0); diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h index bd537438c793..5bb396b344d1 100644 --- a/drivers/clk/qcom/gdsc.h +++ b/drivers/clk/qcom/gdsc.h @@ -42,7 +42,7 @@ struct gdsc { #define PWRSTS_ON BIT(2) #define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON) #define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) - const u8 flags; + const u16 flags; #define VOTABLE BIT(0) #define CLAMP_IO BIT(1) #define HW_CTRL BIT(2) @@ -51,6 +51,7 @@ struct gdsc { #define POLL_CFG_GDSCR BIT(5) #define ALWAYS_ON BIT(6) #define RETAIN_FF_ENABLE BIT(7) +#define NO_RET_PERIPH BIT(8) struct reset_controller_dev *rcdev; unsigned int *resets; unsigned int reset_count; -- 2.30.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 5.11 26/52] clk: qcom: gdsc: Implement NO_RET_PERIPH flag 2021-03-02 11:55 ` [PATCH AUTOSEL 5.11 26/52] clk: qcom: gdsc: Implement NO_RET_PERIPH flag Sasha Levin @ 2021-03-02 23:02 ` Stephen Boyd 2021-03-04 21:30 ` Sasha Levin 0 siblings, 1 reply; 3+ messages in thread From: Stephen Boyd @ 2021-03-02 23:02 UTC (permalink / raw) To: Sasha Levin, linux-kernel, stable Cc: AngeloGioacchino Del Regno, Sasha Levin, linux-clk Quoting Sasha Levin (2021-03-02 03:55:07) > From: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> > > [ Upstream commit 785c02eb35009a4be6dbc68f4f7d916e90b7177d ] > > In some rare occasions, we want to only set the RETAIN_MEM bit, but > not the RETAIN_PERIPH one: this is seen on at least SDM630/636/660's > GPU-GX GDSC, where unsetting and setting back the RETAIN_PERIPH bit > will generate chaos and panics during GPU suspend time (mainly, the > chaos is unaligned access). > > For this reason, introduce a new NO_RET_PERIPH flag to the GDSC > driver to address this corner case. Is there a patch that's going to use this in stable trees? On its own this patch doesn't make sense to backport. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> > Link: https://lore.kernel.org/r/20210113183817.447866-8-angelogioacchino.delregno@somainline.org > Signed-off-by: Stephen Boyd <sboyd@kernel.org> > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > drivers/clk/qcom/gdsc.c | 10 ++++++++-- > drivers/clk/qcom/gdsc.h | 3 ++- > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c > index af26e0695b86..51ed640e527b 100644 > --- a/drivers/clk/qcom/gdsc.c > +++ b/drivers/clk/qcom/gdsc.c > @@ -183,7 +183,10 @@ static inline int gdsc_assert_reset(struct gdsc *sc) > static inline void gdsc_force_mem_on(struct gdsc *sc) > { > int i; > - u32 mask = RETAIN_MEM | RETAIN_PERIPH; > + u32 mask = RETAIN_MEM; > + > + if (!(sc->flags & NO_RET_PERIPH)) > + mask |= RETAIN_PERIPH; > > for (i = 0; i < sc->cxc_count; i++) > regmap_update_bits(sc->regmap, sc->cxcs[i], mask, mask); > @@ -192,7 +195,10 @@ static inline void gdsc_force_mem_on(struct gdsc *sc) > static inline void gdsc_clear_mem_on(struct gdsc *sc) > { > int i; > - u32 mask = RETAIN_MEM | RETAIN_PERIPH; > + u32 mask = RETAIN_MEM; > + > + if (!(sc->flags & NO_RET_PERIPH)) > + mask |= RETAIN_PERIPH; > > for (i = 0; i < sc->cxc_count; i++) > regmap_update_bits(sc->regmap, sc->cxcs[i], mask, 0); > diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h > index bd537438c793..5bb396b344d1 100644 > --- a/drivers/clk/qcom/gdsc.h > +++ b/drivers/clk/qcom/gdsc.h > @@ -42,7 +42,7 @@ struct gdsc { > #define PWRSTS_ON BIT(2) > #define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON) > #define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) > - const u8 flags; > + const u16 flags; > #define VOTABLE BIT(0) > #define CLAMP_IO BIT(1) > #define HW_CTRL BIT(2) > @@ -51,6 +51,7 @@ struct gdsc { > #define POLL_CFG_GDSCR BIT(5) > #define ALWAYS_ON BIT(6) > #define RETAIN_FF_ENABLE BIT(7) > +#define NO_RET_PERIPH BIT(8) > struct reset_controller_dev *rcdev; > unsigned int *resets; > unsigned int reset_count; ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 5.11 26/52] clk: qcom: gdsc: Implement NO_RET_PERIPH flag 2021-03-02 23:02 ` Stephen Boyd @ 2021-03-04 21:30 ` Sasha Levin 0 siblings, 0 replies; 3+ messages in thread From: Sasha Levin @ 2021-03-04 21:30 UTC (permalink / raw) To: Stephen Boyd; +Cc: linux-kernel, stable, AngeloGioacchino Del Regno, linux-clk On Tue, Mar 02, 2021 at 03:02:25PM -0800, Stephen Boyd wrote: >Quoting Sasha Levin (2021-03-02 03:55:07) >> From: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> >> >> [ Upstream commit 785c02eb35009a4be6dbc68f4f7d916e90b7177d ] >> >> In some rare occasions, we want to only set the RETAIN_MEM bit, but >> not the RETAIN_PERIPH one: this is seen on at least SDM630/636/660's >> GPU-GX GDSC, where unsetting and setting back the RETAIN_PERIPH bit >> will generate chaos and panics during GPU suspend time (mainly, the >> chaos is unaligned access). >> >> For this reason, introduce a new NO_RET_PERIPH flag to the GDSC >> driver to address this corner case. > >Is there a patch that's going to use this in stable trees? On its own >this patch doesn't make sense to backport. Right, I'll also grab a59c16c80bd7 ("clk: qcom: gpucc-msm8998: Add resets, cxc, fix flags on gpu_gx_gdsc") for 5.10 and 5.11. Thanks! -- Thanks, Sasha ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-04 21:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210302115534.61800-1-sashal@kernel.org>
2021-03-02 11:55 ` [PATCH AUTOSEL 5.11 26/52] clk: qcom: gdsc: Implement NO_RET_PERIPH flag Sasha Levin
2021-03-02 23:02 ` Stephen Boyd
2021-03-04 21:30 ` Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox