[PATCH v4 2/2] soc: mediatek: add mtk-devapc driver

Chun-Kuang Hu chunkuang.hu at kernel.org
Fri Jul 31 20:12:56 EDT 2020


Hi, Neal:

This patch is for "mediatek,mt6779-devapc", so I think commit title
should show the SoC ID.

Neal Liu <neal.liu at mediatek.com> 於 2020年7月29日 週三 下午4:29寫道:
>
> MediaTek bus fabric provides TrustZone security support and data
> protection to prevent slaves from being accessed by unexpected
> masters.
> The security violation is logged and sent to the processor for
> further analysis or countermeasures.
>
> Any occurrence of security violation would raise an interrupt, and
> it will be handled by mtk-devapc driver. The violation
> information is printed in order to find the murderer.
>
> Signed-off-by: Neal Liu <neal.liu at mediatek.com>
> ---

[snip]

> +
> +struct mtk_devapc_context {
> +       struct device *dev;
> +       u32 vio_idx_num;
> +       void __iomem *devapc_pd_base;
> +       struct mtk_devapc_vio_info *vio_info;
> +       const struct mtk_devapc_pd_offset *offset;
> +       const struct mtk_devapc_vio_dbgs *vio_dbgs;
> +};

I think this structure should separate the constant part. The constant part is:

struct mtk_devapc_data {
    const u32 vio_idx_num;
    const struct mtk_devapc_pd_offset *offset; /* I would like to
remove struct mtk_devapc_pd_offset and directly put its member into
this structure */
    const struct mtk_devapc_vio_dbgs *vio_dbgs; /* This may disappear */
};

And the context is:

struct mtk_devapc_context {
    struct device *dev;
    void __iomem *devapc_pd_base;
    const struct mtk_devapc_data *data;
};

So when you define this, you would not waste memory to store non-constant data.

static const struct mtk_devapc_data devapc_mt6779 = {
 .vio_idx_num = 510,
 .offset = &mt6779_pd_offset,
 .vio_dbgs = &mt6779_vio_dbgs,
};

Regards,
Chun-Kuang.

> +
> +#endif /* __MTK_DEVAPC_H__ */
> --
> 1.7.9.5
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek



More information about the Linux-mediatek mailing list