Re: [PATCH v4 05/21] soc: qcom: Add linux minidump smem backend driver support

Andy Shevchenko
2023-06-28T13:51:45Z

On Wed, Jun 28, 2023 at 3:35 PM Mukesh Ojha <quic_mojha@quicinc.com> wrote:
>
> Add shared memory based minidump backend driver and hook it
> with minidump core (qcom_minidump) by registering SMEM as
> backend device.

...

> help
> Enablement of core minidump feature is controlled from boot firmware
> - side, and this config allow linux to query minidump segments associated
> - with the remote processor and check its validity.
> + side, and this config allow linux to query and manages minidump

allows
Linux

> + table for remote processors as well as APSS.
> +
> + This config should be enabled if the low level minidump is implemented
> + as part of SMEM.

...

> +#include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> -#include <linux/io.h>

Yeah, the result of wrong order in the initial commit. Can you fix it there?

...

> -#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << 0)
> -#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0)
> +
> +#define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << 0)
> +#define MINIDUMP_REGION_INVALID ('I' << 24 | 'N' << 16 | 'V' << 8 | 'A' << 0)
> +#define MINIDUMP_REGION_INIT ('I' << 24 | 'N' << 16 | 'I' << 8 | 'T' << 0)
> +#define MINIDUMP_REGION_NOINIT 0
> +
> +#define MINIDUMP_SS_ENCR_REQ (0 << 24 | 'Y' << 16 | 'E' << 8 | 'S' << 0)
> +#define MINIDUMP_SS_ENCR_NOTREQ (0 << 24 | 0 << 16 | 'N' << 8 | 'R' << 0)
> +#define MINIDUMP_SS_ENCR_START ('S' << 24 | 'T' << 16 | 'R' << 8 | 'T' << 0)
> +#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << 0)
> +#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0)

For all these, please use format like

#define MINIDUMP_SS_ENCR_START 0x.... // STRT

...

> +static int smem_md_table_exit(struct minidump *md)
> +{
> + struct minidump_ss_data *mdss_data;
> +
> + mdss_data = md->apss_data;
> + memset(mdss_data->md_ss_toc,
> + cpu_to_le32(0), sizeof(struct minidump_subsystem));

Do you need cpu_to_le32() here?
Can this be on one line?

> + return 0;
> +}

...

> +

Unnecessary blank line.

> +module_platform_driver(qcom_minidump_smem_driver);

...

> + smem->minidump = platform_device_register_data(&pdev->dev, "qcom-minidump-smem",
> + PLATFORM_DEVID_NONE, NULL,
> + 0);

Why can't room on the previous line be used?

> + if (IS_ERR(smem->minidump))
> + dev_dbg(&pdev->dev, "failed to register minidump device\n");

--
With Best Regards,
Andy Shevchenko