2022-04-28 00:49:42

by Guilherme G. Piccoli

[permalink] [raw]
Subject: [PATCH 06/30] soc: bcm: brcmstb: Document panic notifier action and remove useless header

The panic notifier of this driver is very simple code-wise, just a memory
write to a special position with some numeric code. But this is not clear
from the semantic point-of-view, and there is no public documentation
about that either.

After discussing this in the mailing-lists [0] and having Florian explained
it very well, this patch just document that in the code for the future
generations asking the same questions. Also, it removes a useless header.

[0] https://lore.kernel.org/lkml/[email protected]

Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
Cc: Brian Norris <[email protected]>
Cc: Doug Berger <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Justin Chen <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Markus Mayer <[email protected]>
Signed-off-by: Guilherme G. Piccoli <[email protected]>
---
drivers/soc/bcm/brcmstb/pm/pm-arm.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
index 3cbb165d6e30..870686ae042b 100644
--- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
@@ -25,7 +25,6 @@
#include <linux/kernel.h>
#include <linux/memblock.h>
#include <linux/module.h>
-#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/panic_notifier.h>
@@ -664,7 +663,20 @@ static void __iomem *brcmstb_ioremap_match(const struct of_device_id *matches,

return of_io_request_and_map(dn, index, dn->full_name);
}
-
+/*
+ * The AON is a small domain in the SoC that can retain its state across
+ * various system wide sleep states and specific reset conditions; the
+ * AON DATA RAM is a small RAM of a few words (< 1KB) which can store
+ * persistent information across such events.
+ *
+ * The purpose of the below panic notifier is to help with notifying
+ * the bootloader that a panic occurred and so that it should try its
+ * best to preserve the DRAM contents holding that buffer for recovery
+ * by the kernel as opposed to wiping out DRAM clean again.
+ *
+ * Reference: comment from Florian Fainelli, at
+ * https://lore.kernel.org/lkml/[email protected]
+ */
static int brcmstb_pm_panic_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
--
2.36.0


2022-05-03 00:15:03

by Guilherme G. Piccoli

[permalink] [raw]
Subject: Re: [PATCH 06/30] soc: bcm: brcmstb: Document panic notifier action and remove useless header

On 02/05/2022 12:38, Florian Fainelli wrote:
> [...]
> Acked-by: Florian Fainelli <[email protected]>
>
> Likewise, I am not sure if the Fixes tag is necessary here.

Perfect Florian, thanks! I'll add your Acked-by tag and remove the
fixes for V2 =)
Cheers,


Guilherme

2022-05-03 00:27:31

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH 06/30] soc: bcm: brcmstb: Document panic notifier action and remove useless header



On 4/27/2022 3:49 PM, Guilherme G. Piccoli wrote:
> The panic notifier of this driver is very simple code-wise, just a memory
> write to a special position with some numeric code. But this is not clear
> from the semantic point-of-view, and there is no public documentation
> about that either.
>
> After discussing this in the mailing-lists [0] and having Florian explained
> it very well, this patch just document that in the code for the future
> generations asking the same questions. Also, it removes a useless header.
>
> [0] https://lore.kernel.org/lkml/[email protected]
>
> Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
> Cc: Brian Norris <[email protected]>
> Cc: Doug Berger <[email protected]>
> Cc: Florian Fainelli <[email protected]>
> Cc: Justin Chen <[email protected]>
> Cc: Lee Jones <[email protected]>
> Cc: Markus Mayer <[email protected]>
> Signed-off-by: Guilherme G. Piccoli <[email protected]>

Acked-by: Florian Fainelli <[email protected]>

Likewise, I am not sure if the Fixes tag is necessary here.
--
Florian