mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: "santino.wang" <santino.wang@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, light.chen@mediatek.com,
	Fred-WY.Chen@mediatek.com, arnab.layek@mediatek.com
Subject: Re: [RFC PATCH 01/11] soc: mediatek: dram-ecc: add the DRAM ECC driver skeleton
Date: Mon, 2 Nov 2026 14:41:21 +0100	[thread overview]
Message-ID: <9742cc0b-e371-4ca1-9ca0-ca3451c39310@kernel.org> (raw)
In-Reply-To: <20261102092334.138759-2-santino.wang@mediatek.com>

On 02/11/2026 10:23, santino.wang wrote:
> From: Santino Wang <santino.wang@mediatek.com>
> 
> On the MediaTek mt8992 SoC the secure firmware (ATF) owns the DRAM
> controller ECC interrupts and reports each corrected (CE) or
> uncorrectable (UCE) error to the OS as an ACPI GHES record. The
> following patches add the driver that consumes those records.
> 
> Add only the module skeleton here: the Kconfig entry, the Makefiles, a
> class device that the later patches attach their sysfs attributes to,
> and the MAINTAINERS entry.
> 
> Signed-off-by: Santino Wang <santino.wang@mediatek.com>
> ---
>  MAINTAINERS                                   |  9 ++++
>  drivers/soc/mediatek/Kconfig                  |  2 +
>  drivers/soc/mediatek/Makefile                 |  1 +
>  drivers/soc/mediatek/dram-ecc/Kconfig         | 16 ++++++
>  drivers/soc/mediatek/dram-ecc/Makefile        |  3 ++
>  drivers/soc/mediatek/dram-ecc/core/Makefile   |  6 +++
>  drivers/soc/mediatek/dram-ecc/core/main.c     | 53 +++++++++++++++++++
>  .../soc/mediatek/dram-ecc/core/mtk_dram_ecc.h | 24 +++++++++
>  8 files changed, 114 insertions(+)
>  create mode 100644 drivers/soc/mediatek/dram-ecc/Kconfig
>  create mode 100644 drivers/soc/mediatek/dram-ecc/Makefile
>  create mode 100644 drivers/soc/mediatek/dram-ecc/core/Makefile
>  create mode 100644 drivers/soc/mediatek/dram-ecc/core/main.c
>  create mode 100644 drivers/soc/mediatek/dram-ecc/core/mtk_dram_ecc.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index aaf2825ac945..e7d25be97f24 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -17026,6 +17026,15 @@ S:	Maintained
>  F:	Documentation/devicetree/bindings/dma/mediatek,*
>  F:	drivers/dma/mediatek/
>  
> +MEDIATEK DRAM ECC DRIVER
> +M:	Santino Wang <santino.wang@mediatek.com>
> +L:	linux-kernel@vger.kernel.org
> +L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
> +L:	linux-mediatek@lists.infradead.org (moderated for non-subscribers)
> +S:	Maintained
> +F:	drivers/soc/mediatek/dram-ecc/
> +F:	include/uapi/linux/mtk_dram_ecc_netlink.h
> +
>  MEDIATEK ETHERNET DRIVER
>  M:	Felix Fietkau <nbd@nbd.name>
>  M:	Lorenzo Bianconi <lorenzo@kernel.org>
> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
> index d7293977f06e..91aed7d29be0 100644
> --- a/drivers/soc/mediatek/Kconfig
> +++ b/drivers/soc/mediatek/Kconfig
> @@ -89,4 +89,6 @@ config MTK_SOCINFO
>  	  information about the SoC to the userspace including the
>  	  manufacturer name, marketing name and soc name.
>  
> +source "drivers/soc/mediatek/dram-ecc/Kconfig"
> +
>  endmenu
> diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
> index 0665573e3c4b..880342bed606 100644
> --- a/drivers/soc/mediatek/Makefile
> +++ b/drivers/soc/mediatek/Makefile
> @@ -9,3 +9,4 @@ obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
>  obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o
>  obj-$(CONFIG_MTK_SVS) += mtk-svs.o
>  obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.o
> +obj-y += dram-ecc/
> diff --git a/drivers/soc/mediatek/dram-ecc/Kconfig b/drivers/soc/mediatek/dram-ecc/Kconfig
> new file mode 100644
> index 000000000000..c015c66635b2
> --- /dev/null
> +++ b/drivers/soc/mediatek/dram-ecc/Kconfig
> @@ -0,0 +1,16 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +# MediaTek DRAM ECC error handling driver
> +# See plat/mediatek/drivers/dram_ecc/ in ATF for the SMC handler side.
> +#
> +
> +# core/ -> mtk_dram_ecc.ko
> +config MTK_DRAM_ECC
> +	tristate "MediaTek DRAM ECC Error Handling Driver"
> +	depends on HAVE_ARM_SMCCC && ACPI_APEI_GHES
> +	default m
> +	help
> +	  Driver for MediaTek DRAM ECC runtime error handling. It works
> +	  with the secure firmware (ATF), which owns the DRAM controller
> +	  ECC interrupts and reports each corrected or uncorrectable
> +	  error to the OS as an ACPI GHES record.

Why is EDAC-like driver outside of edac subsystem? drivers/soc/ is not a
dumping ground.

> +
> +static int __init mtk_dram_ecc_init(void)
> +{
> +	int ret;
> +
> +	mtk_dram_ecc_class = class_create("mtk-dram-ecc");
> +	if (IS_ERR(mtk_dram_ecc_class))
> +		return PTR_ERR(mtk_dram_ecc_class);
> +
> +	mtk_dram_ecc_dev = device_create(mtk_dram_ecc_class, NULL,
> +					 MKDEV(0, 0), &mtk_ecc_data,
> +					 "mtk-dram-ecc0");
> +	if (IS_ERR(mtk_dram_ecc_dev)) {
> +		ret = PTR_ERR(mtk_dram_ecc_dev);
> +		goto err_class;
> +	}
> +
> +	dev_info(mtk_dram_ecc_dev, "initialized\n");

No, that's not a code style which exists in upstream.

> +	return 0;
> +
> +err_class:
> +	class_destroy(mtk_dram_ecc_class);
> +	return ret;
> +}
> +
> +static void __exit mtk_dram_ecc_exit(void)
> +{
> +	device_destroy(mtk_dram_ecc_class, MKDEV(0, 0));
> +	class_destroy(mtk_dram_ecc_class);
> +}
> +
Best regards,
Krzysztof

  reply	other threads:[~2026-11-02 13:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  9:23 [RFC PATCH 00/11] soc: mediatek: add a DRAM ECC error handling driver santino.wang
2026-11-02  9:23 ` [RFC PATCH 01/11] soc: mediatek: dram-ecc: add the DRAM ECC driver skeleton santino.wang
2026-11-02 13:41   ` Krzysztof Kozlowski [this message]
2026-11-02  9:23 ` [RFC PATCH 02/11] soc: mediatek: dram-ecc: add the SMC interface to the secure firmware santino.wang
2026-11-02  9:23 ` [RFC PATCH 03/11] soc: mediatek: dram-ecc: add tracepoints santino.wang
2026-11-02  9:23 ` [RFC PATCH 04/11] soc: mediatek: dram-ecc: handle GHES vendor records from the firmware santino.wang
2026-11-02  9:23 ` [RFC PATCH 05/11] soc: mediatek: dram-ecc: add error counters and the address lists santino.wang
2026-11-02 13:42   ` Krzysztof Kozlowski
2026-11-02  9:23 ` [RFC PATCH 06/11] soc: mediatek: dram-ecc: keep error counters across boots santino.wang
2026-11-02  9:23 ` [RFC PATCH 07/11] soc: mediatek: dram-ecc: add containment policy and storm protection santino.wang
2026-11-02  9:23 ` [RFC PATCH 08/11] soc: mediatek: dram-ecc: add the corrected error leaky bucket santino.wang
2026-11-02  9:23 ` [RFC PATCH 09/11] soc: mediatek: dram-ecc: add a generic netlink event interface santino.wang
2026-11-02  9:23 ` [RFC PATCH 10/11] soc: mediatek: dram-ecc: report an uncorrectable error of the previous boot santino.wang
2026-11-02 13:44   ` Krzysztof Kozlowski
2026-11-02  9:23 ` [RFC PATCH 11/11] Documentation: ABI: add the sysfs attributes of the MediaTek DRAM ECC driver santino.wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9742cc0b-e371-4ca1-9ca0-ca3451c39310@kernel.org \
    --to=krzk@kernel.org \
    --cc=Fred-WY.Chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=arnab.layek@mediatek.com \
    --cc=light.chen@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=santino.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®