Re: [PATCH v4 1/6] mfd: Add support for Loongson Security Module

From: Qunqin Zhao
Date: Wed Mar 12 2025 - 04:39:09 EST



在 2025/3/12 下午4:08, Lee Jones 写道:
On Wed, 26 Feb 2025, Qunqin Zhao wrote:

This driver supports Loongson Security Module, which provides the control
for it's hardware encryption acceleration child devices.

Co-developed-by: Yinggang Gu <guyinggang@xxxxxxxxxxx>
Signed-off-by: Yinggang Gu <guyinggang@xxxxxxxxxxx>
Signed-off-by: Qunqin Zhao <zhaoqunqin@xxxxxxxxxxx>
---
v3-v4: None

v2: Removed "ls6000se-sdf" device, added "ls6000se-tpm" device.
Passed dmamem size to SE firmware in se_init_hw() function.

drivers/mfd/Kconfig | 10 +
drivers/mfd/Makefile | 2 +
drivers/mfd/ls6000se.c | 374 +++++++++++++++++++++++++++++++++++
include/linux/mfd/ls6000se.h | 75 +++++++
4 files changed, 461 insertions(+)
create mode 100644 drivers/mfd/ls6000se.c
create mode 100644 include/linux/mfd/ls6000se.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d44c69bb3d..318fb113c1 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -2439,5 +2439,15 @@ config MFD_UPBOARD_FPGA
To compile this driver as a module, choose M here: the module will be
called upboard-fpga.
+config MFD_LS6000SE
+ tristate "Loongson Security Module Interface"
+ depends on LOONGARCH && ACPI
+ select MFD_CORE
+ help
+ The Loongson security module provides the control for hardware
+ encryption acceleration devices. Each device uses at least one
+ channel to interact with security module, and each channel may
+ have its own buffer provided by security module.
+
endmenu
endif
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 9220eaf7cf..9556de7715 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -294,3 +294,5 @@ obj-$(CONFIG_MFD_RSMU_I2C) += rsmu_i2c.o rsmu_core.o
obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o
obj-$(CONFIG_MFD_UPBOARD_FPGA) += upboard-fpga.o
+
+obj-$(CONFIG_MFD_LS6000SE) += ls6000se.o
diff --git a/drivers/mfd/ls6000se.c b/drivers/mfd/ls6000se.c
new file mode 100644
index 0000000000..24d76c2ffc
--- /dev/null
+++ b/drivers/mfd/ls6000se.c
[...]

+static const struct mfd_cell se_devs[] = {
+ { .name = "ls6000se-sdf" },
+ { .name = "ls6000se-tpm" },
+};
Where are the drivers for these devices? I don't see them anywhere.

I do see ls6000se-rng. How is that registered?

Oh.... I made a slip of the pen and wrote that  "ls6000se-sdf" not  "ls6000se-rng".  Will fix it in next version.

Driver for "ls6000se-tpm" is [PATCH v4 5/6].

Thanks for your comments.

BR, Qunqin.