Skip to contentSkip to conversation

soc: fujitsu: Add A64FX diagnostic interrupt driver

PATCH Applied Hitomi Hasegawa 3 participants 6 messages May 20, 2022 – Jul 19, 2022 A64FX diag driver

lore
Share & tools
lore

Hitomi Hasegawa

author maintainer
#0 lore raw

v5 cover soc: fujitsu: Add A64FX diagnostic interrupt driver

The interrupt is set using pseudo-NMI if it is available. Arm has a diagnostic interrupt feature called "Arm Generic Diagnostic Dump and Reset device", but the A64FX does not support this feature and instead has its own device definition.

I tested on FX700:

$ echo HARDLOCKUP > /sys/kernel/debug/provoke-crash/DIRECT
[   86.259226] lkdtm: Performing direct entry HARDLOCKUP
:
:

Send the "chassis power diag" command from the management server using ipmitool, the following message is shown:

[  138.433544] Kernel panic - not syncing: a64fx_diag: interrupt received

:
:

Changes in V5:
- Fixing issues raised by Jiri and Greg.

Changes in V4:
- Call the panic function instead of sysrq. Prepare a handler for each NMI/IRQ and call nmi_panic()/panic() respectively (as in v1).
- Fixing other issues raised by Greg.

Changes in V3:
- Exclude Sumit's patch.
- Retest in v5.17.

Changes in V2:
- Include Sumit's patch.
- The handler calls handle_sysrq() to use the sysrq feature to cause a panic.
- request_nmi() and request_irq() now use the same handler, and the function name of the handler has also changed.
- Use readl()/writel() instead of readl_relaxed()/writel_relaxed().

V4: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

Hitomi Hasegawa (1):
soc: fujitsu: Add A64FX diagnostic interrupt driver

 MAINTAINERS                      |   5 +
 drivers/soc/Kconfig              |   1 +
 drivers/soc/Makefile             |   1 +
 drivers/soc/fujitsu/Kconfig      |  16 ++++
 drivers/soc/fujitsu/Makefile     |   3 +
 drivers/soc/fujitsu/a64fx-diag.c | 154 +++++++++++++++++++++++++++++++
 6 files changed, 180 insertions(+)
 create mode 100644 drivers/soc/fujitsu/Kconfig
 create mode 100644 drivers/soc/fujitsu/Makefile
 create mode 100644 drivers/soc/fujitsu/a64fx-diag.c
Signature · 1 line
2.27.0
author maintainer
#1 lore raw

PATCH v5 1/1 soc: fujitsu: Add A64FX diagnostic interrupt driver

Register the NMI/IRQ corresponding to the A64FX's device definition dedicated to diagnostic interrupts, so that when this interrupt is sent using the BMC, it causes a panic. This can be used to obtain a kernel dump.

---
 MAINTAINERS                      |   5 +
 drivers/soc/Kconfig              |   1 +
 drivers/soc/Makefile             |   1 +
 drivers/soc/fujitsu/Kconfig      |  16 ++++
 drivers/soc/fujitsu/Makefile     |   3 +
 drivers/soc/fujitsu/a64fx-diag.c | 154 +++++++++++++++++++++++++++++++
 6 files changed, 180 insertions(+)
 create mode 100644 drivers/soc/fujitsu/Kconfig
 create mode 100644 drivers/soc/fujitsu/Makefile
 create mode 100644 drivers/soc/fujitsu/a64fx-diag.c
MAINTAINERS +5 -0
index cd0f68d4a34a..dc35c81ba917 100644
@@ -241,6 +241,11 @@ F:	include/trace/events/9p.h
 F:	include/uapi/linux/virtio_9p.h
 F:	net/9p/
 
+A64FX DIAG DRIVER
+M:	Hitomi Hasegawa <[email protected]>
+S:	Supported
+F:	drivers/soc/fujitsu/a64fx-diag.c
+
 A8293 MEDIA DRIVER
 M:	Antti Palosaari <[email protected]>
 L:	[email protected]
drivers/soc/Kconfig +1 -0
index a8562678c437..e10eb27e1e7e 100644
@@ -9,6 +9,7 @@ source "drivers/soc/atmel/Kconfig"
 source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/canaan/Kconfig"
 source "drivers/soc/fsl/Kconfig"
+source "drivers/soc/fujitsu/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/litex/Kconfig"
drivers/soc/Makefile +1 -0
index adb30c2d4fea..b12b0b03ad47 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_SOC_CANAAN)	+= canaan/
 obj-$(CONFIG_ARCH_DOVE)		+= dove/
 obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
+obj-y				+= fujitsu/
 obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
 obj-y				+= imx/
 obj-y				+= ixp4xx/
drivers/soc/fujitsu/Kconfig new file +16 -0
new file mode 100644
index 000000000000..56275b44b293
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menu "fujitsu SoC drivers"
+
+config A64FX_DIAG
+	tristate "A64FX diag driver"
+	depends on ARM64
+	depends on ACPI
+	help
+	  Say Y here if you want to enable diag interrupt on Fujitsu A64FX.
+	  This driver enables BMC's diagnostic requests and enables
+	  A64FX-specific interrupts. This allows administrators to obtain
+	  kernel dumps via diagnostic requests using ipmitool, etc.
+
+	  If unsure, say N.
+
+endmenu
drivers/soc/fujitsu/Makefile new file +3 -0
new file mode 100644
index 000000000000..945bc1c14ad0
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_A64FX_DIAG)	+= a64fx-diag.o
drivers/soc/fujitsu/a64fx-diag.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.27.0
author maintainer
#2 lore raw
In reply to Hitomi Hasegawa

Hi

Do you have any comment?

Quoted 67 lines

The interrupt is set using pseudo-NMI if it is available. Arm has a diagnostic interrupt feature called "Arm Generic Diagnostic Dump and Reset device", but the A64FX does not support this feature and instead has its own device definition.

I tested on FX700:

$ echo HARDLOCKUP > /sys/kernel/debug/provoke-crash/DIRECT
[   86.259226] lkdtm: Performing direct entry HARDLOCKUP
:
:

Send the "chassis power diag" command from the management server using ipmitool, the following message is shown:

[  138.433544] Kernel panic - not syncing: a64fx_diag: interrupt received

:
:

Changes in V5:
- Fixing issues raised by Jiri and Greg.

Changes in V4:
- Call the panic function instead of sysrq. Prepare a handler for each NMI/IRQ and call nmi_panic()/panic() respectively (as in v1).
- Fixing other issues raised by Greg.

Changes in V3:
- Exclude Sumit's patch.
- Retest in v5.17.

Changes in V2:
- Include Sumit's patch.
- The handler calls handle_sysrq() to use the sysrq feature to cause a panic.
- request_nmi() and request_irq() now use the same handler, and the function name of the handler has also changed.
- Use readl()/writel() instead of readl_relaxed()/writel_relaxed().

V4:
https://lore.kernel.org/linux-arm-kernel/20220511062113.2645747-1-hasegaw
[email protected]/
V3:
https://lore.kernel.org/linux-arm-kernel/20220331092235.3000787-1-hasegaw
[email protected]/
V2:
https://lore.kernel.org/linux-arm-kernel/20220304064324.331217-3-hasegawa
[email protected]/
V1:
https://lore.kernel.org/linux-arm-kernel/20220218092010.1327309-1-hasegaw
[email protected]/

Hitomi Hasegawa (1):
soc: fujitsu: Add A64FX diagnostic interrupt driver

 MAINTAINERS                      |   5 +
 drivers/soc/Kconfig              |   1 +
 drivers/soc/Makefile             |   1 +
 drivers/soc/fujitsu/Kconfig      |  16 ++++
 drivers/soc/fujitsu/Makefile     |   3 +
 drivers/soc/fujitsu/a64fx-diag.c | 154
+++++++++++++++++++++++++++++++
 6 files changed, 180 insertions(+)
 create mode 100644 drivers/soc/fujitsu/Kconfig  create mode 100644

drivers/soc/fujitsu/Makefile create mode 100644
drivers/soc/fujitsu/a64fx-diag.c

--
2.27.0

#4 lore raw
Quoted 5 lines · On Thu, Jun 16, 2022 at 11:02 AM [email protected]…

Hi Arnd,

There seems to be no comment in particular, but what should I do in order to be accepted?

Sorry for the delay, I was planning to apply it last month and it fell through the cracks.
Found it again while going through my backlog and applied your patch to the arm/drivers branch of the soc tree. It should be part of the linu-next tree from tomorrow and my pull requests for the coming merge window.

Arnd

#5 lore raw
In reply to Hitomi Hasegawa
This patch was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:

Hello:

This patch was applied to soc/soc.git (for-next)
by Arnd Bergmann <[email protected]>:

Quoted 5 lines · On Fri, 20 May 2022 16:41:18 +0900 you wrote:

The interrupt is set using pseudo-NMI if it is available. Arm has a diagnostic interrupt feature called "Arm Generic Diagnostic Dump and Reset device", but the A64FX does not support this feature and instead has its own device definition.

Quoted 7 lines

I tested on FX700:

$ echo HARDLOCKUP > /sys/kernel/debug/provoke-crash/DIRECT
[   86.259226] lkdtm: Performing direct entry HARDLOCKUP
:
:

[...]

Here is the summary with links:
- [v5,1/1] soc: fujitsu: Add A64FX diagnostic interrupt driver

    https://git.kernel.org/soc/soc/c/64f89dfaa4f1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html