* [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
@ 2022-05-20 7:41 ` Hitomi Hasegawa
0 siblings, 0 replies; 11+ messages in thread
From: Hitomi Hasegawa @ 2022-05-20 7:41 UTC (permalink / raw)
To: linux-arm-kernel, soc
Cc: arnd, olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders, hasegawa-hitomi
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-hasegawa-hitomi@fujitsu.com/
V3: https://lore.kernel.org/linux-arm-kernel/20220331092235.3000787-1-hasegawa-hitomi@fujitsu.com/
V2: https://lore.kernel.org/linux-arm-kernel/20220304064324.331217-3-hasegawa-hitomi@fujitsu.com/
V1: https://lore.kernel.org/linux-arm-kernel/20220218092010.1327309-1-hasegawa-hitomi@fujitsu.com/
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
@ 2022-05-20 7:41 ` Hitomi Hasegawa
0 siblings, 0 replies; 11+ messages in thread
From: Hitomi Hasegawa @ 2022-05-20 7:41 UTC (permalink / raw)
To: linux-arm-kernel, soc
Cc: arnd, olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders, hasegawa-hitomi
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-hasegawa-hitomi@fujitsu.com/
V3: https://lore.kernel.org/linux-arm-kernel/20220331092235.3000787-1-hasegawa-hitomi@fujitsu.com/
V2: https://lore.kernel.org/linux-arm-kernel/20220304064324.331217-3-hasegawa-hitomi@fujitsu.com/
V1: https://lore.kernel.org/linux-arm-kernel/20220218092010.1327309-1-hasegawa-hitomi@fujitsu.com/
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 1/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
2022-05-20 7:41 ` Hitomi Hasegawa
@ 2022-05-20 7:41 ` Hitomi Hasegawa
-1 siblings, 0 replies; 11+ messages in thread
From: Hitomi Hasegawa @ 2022-05-20 7:41 UTC (permalink / raw)
To: linux-arm-kernel, soc
Cc: arnd, olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders, hasegawa-hitomi
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.
Signed-off-by: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
---
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
diff --git a/MAINTAINERS b/MAINTAINERS
index cd0f68d4a34a..dc35c81ba917 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <hasegawa-hitomi@fujitsu.com>
+S: Supported
+F: drivers/soc/fujitsu/a64fx-diag.c
+
A8293 MEDIA DRIVER
M: Antti Palosaari <crope@iki.fi>
L: linux-media@vger.kernel.org
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index a8562678c437..e10eb27e1e7e 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -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"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index adb30c2d4fea..b12b0b03ad47 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -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/
diff --git a/drivers/soc/fujitsu/Kconfig b/drivers/soc/fujitsu/Kconfig
new file mode 100644
index 000000000000..56275b44b293
--- /dev/null
+++ b/drivers/soc/fujitsu/Kconfig
@@ -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
diff --git a/drivers/soc/fujitsu/Makefile b/drivers/soc/fujitsu/Makefile
new file mode 100644
index 000000000000..945bc1c14ad0
--- /dev/null
+++ b/drivers/soc/fujitsu/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_A64FX_DIAG) += a64fx-diag.o
diff --git a/drivers/soc/fujitsu/a64fx-diag.c b/drivers/soc/fujitsu/a64fx-diag.c
new file mode 100644
index 000000000000..d87f348427bf
--- /dev/null
+++ b/drivers/soc/fujitsu/a64fx-diag.c
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A64FX diag driver.
+ * Copyright (c) 2022 Fujitsu Ltd.
+ */
+
+#include <linux/acpi.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#define A64FX_DIAG_IRQ 1
+#define BMC_DIAG_INTERRUPT_ENABLE 0x40
+#define BMC_DIAG_INTERRUPT_STATUS 0x44
+#define BMC_DIAG_INTERRUPT_MASK BIT(31)
+
+struct a64fx_diag_priv {
+ void __iomem *mmsc_reg_base;
+ int irq;
+ bool has_nmi;
+};
+
+static irqreturn_t a64fx_diag_handler_nmi(int irq, void *dev_id)
+{
+ nmi_panic(NULL, "a64fx_diag: interrupt received\n");
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t a64fx_diag_handler_irq(int irq, void *dev_id)
+{
+ panic("a64fx_diag: interrupt received\n");
+
+ return IRQ_HANDLED;
+}
+
+static void a64fx_diag_interrupt_clear(struct a64fx_diag_priv *priv)
+{
+ void __iomem *diag_status_reg_addr;
+ u32 mmsc;
+
+ diag_status_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_STATUS;
+ mmsc = readl(diag_status_reg_addr);
+ if (mmsc & BMC_DIAG_INTERRUPT_MASK)
+ writel(BMC_DIAG_INTERRUPT_MASK, diag_status_reg_addr);
+}
+
+static void a64fx_diag_interrupt_enable(struct a64fx_diag_priv *priv)
+{
+ void __iomem *diag_enable_reg_addr;
+ u32 mmsc;
+
+ diag_enable_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_ENABLE;
+ mmsc = readl(diag_enable_reg_addr);
+ if (!(mmsc & BMC_DIAG_INTERRUPT_MASK)) {
+ mmsc |= BMC_DIAG_INTERRUPT_MASK;
+ writel(mmsc, diag_enable_reg_addr);
+ }
+}
+
+static void a64fx_diag_interrupt_disable(struct a64fx_diag_priv *priv)
+{
+ void __iomem *diag_enable_reg_addr;
+ u32 mmsc;
+
+ diag_enable_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_ENABLE;
+ mmsc = readl(diag_enable_reg_addr);
+ if (mmsc & BMC_DIAG_INTERRUPT_MASK) {
+ mmsc &= ~BMC_DIAG_INTERRUPT_MASK;
+ writel(mmsc, diag_enable_reg_addr);
+ }
+}
+
+static int a64fx_diag_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct a64fx_diag_priv *priv;
+ unsigned long irq_flags;
+ int ret;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (priv == NULL)
+ return -ENOMEM;
+
+ priv->mmsc_reg_base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(priv->mmsc_reg_base))
+ return PTR_ERR(priv->mmsc_reg_base);
+
+ priv->irq = platform_get_irq(pdev, A64FX_DIAG_IRQ);
+ if (priv->irq < 0)
+ return priv->irq;
+
+ platform_set_drvdata(pdev, priv);
+
+ irq_flags = IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_AUTOEN |
+ IRQF_NO_THREAD;
+ ret = request_nmi(priv->irq, &a64fx_diag_handler_nmi, irq_flags,
+ "a64fx_diag_nmi", NULL);
+ if (ret) {
+ ret = request_irq(priv->irq, &a64fx_diag_handler_irq,
+ irq_flags, "a64fx_diag_irq", NULL);
+ if (ret) {
+ dev_err(dev, "cannot register IRQ %d\n", ret);
+ return ret;
+ }
+ enable_irq(priv->irq);
+ } else {
+ enable_nmi(priv->irq);
+ priv->has_nmi = true;
+ }
+
+ a64fx_diag_interrupt_clear(priv);
+ a64fx_diag_interrupt_enable(priv);
+
+ return 0;
+}
+
+static int a64fx_diag_remove(struct platform_device *pdev)
+{
+ struct a64fx_diag_priv *priv = platform_get_drvdata(pdev);
+
+ a64fx_diag_interrupt_disable(priv);
+ a64fx_diag_interrupt_clear(priv);
+
+ if (priv->has_nmi)
+ free_nmi(priv->irq, NULL);
+ else
+ free_irq(priv->irq, NULL);
+
+ return 0;
+}
+
+static const struct acpi_device_id a64fx_diag_acpi_match[] = {
+ { "FUJI2007", 0 },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, a64fx_diag_acpi_match);
+
+
+static struct platform_driver a64fx_diag_driver = {
+ .driver = {
+ .name = "a64fx_diag_driver",
+ .acpi_match_table = ACPI_PTR(a64fx_diag_acpi_match),
+ },
+ .probe = a64fx_diag_probe,
+ .remove = a64fx_diag_remove,
+};
+
+module_platform_driver(a64fx_diag_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>");
+MODULE_DESCRIPTION("A64FX diag driver");
--
2.27.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v5 1/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
@ 2022-05-20 7:41 ` Hitomi Hasegawa
0 siblings, 0 replies; 11+ messages in thread
From: Hitomi Hasegawa @ 2022-05-20 7:41 UTC (permalink / raw)
To: linux-arm-kernel, soc
Cc: arnd, olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders, hasegawa-hitomi
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.
Signed-off-by: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
---
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
diff --git a/MAINTAINERS b/MAINTAINERS
index cd0f68d4a34a..dc35c81ba917 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <hasegawa-hitomi@fujitsu.com>
+S: Supported
+F: drivers/soc/fujitsu/a64fx-diag.c
+
A8293 MEDIA DRIVER
M: Antti Palosaari <crope@iki.fi>
L: linux-media@vger.kernel.org
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index a8562678c437..e10eb27e1e7e 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -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"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index adb30c2d4fea..b12b0b03ad47 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -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/
diff --git a/drivers/soc/fujitsu/Kconfig b/drivers/soc/fujitsu/Kconfig
new file mode 100644
index 000000000000..56275b44b293
--- /dev/null
+++ b/drivers/soc/fujitsu/Kconfig
@@ -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
diff --git a/drivers/soc/fujitsu/Makefile b/drivers/soc/fujitsu/Makefile
new file mode 100644
index 000000000000..945bc1c14ad0
--- /dev/null
+++ b/drivers/soc/fujitsu/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_A64FX_DIAG) += a64fx-diag.o
diff --git a/drivers/soc/fujitsu/a64fx-diag.c b/drivers/soc/fujitsu/a64fx-diag.c
new file mode 100644
index 000000000000..d87f348427bf
--- /dev/null
+++ b/drivers/soc/fujitsu/a64fx-diag.c
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A64FX diag driver.
+ * Copyright (c) 2022 Fujitsu Ltd.
+ */
+
+#include <linux/acpi.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#define A64FX_DIAG_IRQ 1
+#define BMC_DIAG_INTERRUPT_ENABLE 0x40
+#define BMC_DIAG_INTERRUPT_STATUS 0x44
+#define BMC_DIAG_INTERRUPT_MASK BIT(31)
+
+struct a64fx_diag_priv {
+ void __iomem *mmsc_reg_base;
+ int irq;
+ bool has_nmi;
+};
+
+static irqreturn_t a64fx_diag_handler_nmi(int irq, void *dev_id)
+{
+ nmi_panic(NULL, "a64fx_diag: interrupt received\n");
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t a64fx_diag_handler_irq(int irq, void *dev_id)
+{
+ panic("a64fx_diag: interrupt received\n");
+
+ return IRQ_HANDLED;
+}
+
+static void a64fx_diag_interrupt_clear(struct a64fx_diag_priv *priv)
+{
+ void __iomem *diag_status_reg_addr;
+ u32 mmsc;
+
+ diag_status_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_STATUS;
+ mmsc = readl(diag_status_reg_addr);
+ if (mmsc & BMC_DIAG_INTERRUPT_MASK)
+ writel(BMC_DIAG_INTERRUPT_MASK, diag_status_reg_addr);
+}
+
+static void a64fx_diag_interrupt_enable(struct a64fx_diag_priv *priv)
+{
+ void __iomem *diag_enable_reg_addr;
+ u32 mmsc;
+
+ diag_enable_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_ENABLE;
+ mmsc = readl(diag_enable_reg_addr);
+ if (!(mmsc & BMC_DIAG_INTERRUPT_MASK)) {
+ mmsc |= BMC_DIAG_INTERRUPT_MASK;
+ writel(mmsc, diag_enable_reg_addr);
+ }
+}
+
+static void a64fx_diag_interrupt_disable(struct a64fx_diag_priv *priv)
+{
+ void __iomem *diag_enable_reg_addr;
+ u32 mmsc;
+
+ diag_enable_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_ENABLE;
+ mmsc = readl(diag_enable_reg_addr);
+ if (mmsc & BMC_DIAG_INTERRUPT_MASK) {
+ mmsc &= ~BMC_DIAG_INTERRUPT_MASK;
+ writel(mmsc, diag_enable_reg_addr);
+ }
+}
+
+static int a64fx_diag_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct a64fx_diag_priv *priv;
+ unsigned long irq_flags;
+ int ret;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (priv == NULL)
+ return -ENOMEM;
+
+ priv->mmsc_reg_base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(priv->mmsc_reg_base))
+ return PTR_ERR(priv->mmsc_reg_base);
+
+ priv->irq = platform_get_irq(pdev, A64FX_DIAG_IRQ);
+ if (priv->irq < 0)
+ return priv->irq;
+
+ platform_set_drvdata(pdev, priv);
+
+ irq_flags = IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_AUTOEN |
+ IRQF_NO_THREAD;
+ ret = request_nmi(priv->irq, &a64fx_diag_handler_nmi, irq_flags,
+ "a64fx_diag_nmi", NULL);
+ if (ret) {
+ ret = request_irq(priv->irq, &a64fx_diag_handler_irq,
+ irq_flags, "a64fx_diag_irq", NULL);
+ if (ret) {
+ dev_err(dev, "cannot register IRQ %d\n", ret);
+ return ret;
+ }
+ enable_irq(priv->irq);
+ } else {
+ enable_nmi(priv->irq);
+ priv->has_nmi = true;
+ }
+
+ a64fx_diag_interrupt_clear(priv);
+ a64fx_diag_interrupt_enable(priv);
+
+ return 0;
+}
+
+static int a64fx_diag_remove(struct platform_device *pdev)
+{
+ struct a64fx_diag_priv *priv = platform_get_drvdata(pdev);
+
+ a64fx_diag_interrupt_disable(priv);
+ a64fx_diag_interrupt_clear(priv);
+
+ if (priv->has_nmi)
+ free_nmi(priv->irq, NULL);
+ else
+ free_irq(priv->irq, NULL);
+
+ return 0;
+}
+
+static const struct acpi_device_id a64fx_diag_acpi_match[] = {
+ { "FUJI2007", 0 },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, a64fx_diag_acpi_match);
+
+
+static struct platform_driver a64fx_diag_driver = {
+ .driver = {
+ .name = "a64fx_diag_driver",
+ .acpi_match_table = ACPI_PTR(a64fx_diag_acpi_match),
+ },
+ .probe = a64fx_diag_probe,
+ .remove = a64fx_diag_remove,
+};
+
+module_platform_driver(a64fx_diag_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>");
+MODULE_DESCRIPTION("A64FX diag driver");
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
2022-05-20 7:41 ` Hitomi Hasegawa
@ 2022-06-09 7:48 ` hasegawa-hitomi
-1 siblings, 0 replies; 11+ messages in thread
From: hasegawa-hitomi @ 2022-06-09 7:48 UTC (permalink / raw)
To: linux-arm-kernel, soc
Cc: arnd, olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders
Hi
Do you have any comment?
> 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
> a-hitomi@fujitsu.com/
> V3:
> https://lore.kernel.org/linux-arm-kernel/20220331092235.3000787-1-hasegaw
> a-hitomi@fujitsu.com/
> V2:
> https://lore.kernel.org/linux-arm-kernel/20220304064324.331217-3-hasegawa
> -hitomi@fujitsu.com/
> V1:
> https://lore.kernel.org/linux-arm-kernel/20220218092010.1327309-1-hasegaw
> a-hitomi@fujitsu.com/
>
>
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
@ 2022-06-09 7:48 ` hasegawa-hitomi
0 siblings, 0 replies; 11+ messages in thread
From: hasegawa-hitomi @ 2022-06-09 7:48 UTC (permalink / raw)
To: linux-arm-kernel, soc
Cc: arnd, olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders
Hi
Do you have any comment?
> 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
> a-hitomi@fujitsu.com/
> V3:
> https://lore.kernel.org/linux-arm-kernel/20220331092235.3000787-1-hasegaw
> a-hitomi@fujitsu.com/
> V2:
> https://lore.kernel.org/linux-arm-kernel/20220304064324.331217-3-hasegawa
> -hitomi@fujitsu.com/
> V1:
> https://lore.kernel.org/linux-arm-kernel/20220218092010.1327309-1-hasegaw
> a-hitomi@fujitsu.com/
>
>
> 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
2022-05-20 7:41 ` Hitomi Hasegawa
@ 2022-06-16 9:02 ` hasegawa-hitomi
-1 siblings, 0 replies; 11+ messages in thread
From: hasegawa-hitomi @ 2022-06-16 9:02 UTC (permalink / raw)
To: Arnd Bergmann
Cc: olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders, soc, linux-arm-kernel
Hi Arnd,
There seems to be no comment in particular, but what should I do
in order to be accepted?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
@ 2022-06-16 9:02 ` hasegawa-hitomi
0 siblings, 0 replies; 11+ messages in thread
From: hasegawa-hitomi @ 2022-06-16 9:02 UTC (permalink / raw)
To: Arnd Bergmann
Cc: olof, catalin.marinas, will, sumit.garg, gregkh, jirislaby,
daniel.thompson, dianders, soc, linux-arm-kernel
Hi Arnd,
There seems to be no comment in particular, but what should I do
in order to be accepted?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
2022-06-16 9:02 ` hasegawa-hitomi
@ 2022-07-18 11:39 ` Arnd Bergmann
-1 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2022-07-18 11:39 UTC (permalink / raw)
To: hasegawa-hitomi
Cc: Arnd Bergmann, olof, catalin.marinas, will, sumit.garg, gregkh,
jirislaby, daniel.thompson, dianders, soc, linux-arm-kernel
On Thu, Jun 16, 2022 at 11:02 AM hasegawa-hitomi@fujitsu.com
<hasegawa-hitomi@fujitsu.com> wrote:
>
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
@ 2022-07-18 11:39 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2022-07-18 11:39 UTC (permalink / raw)
To: hasegawa-hitomi
Cc: Arnd Bergmann, olof, catalin.marinas, will, sumit.garg, gregkh,
jirislaby, daniel.thompson, dianders, soc, linux-arm-kernel
On Thu, Jun 16, 2022 at 11:02 AM hasegawa-hitomi@fujitsu.com
<hasegawa-hitomi@fujitsu.com> wrote:
>
> 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver
2022-05-20 7:41 ` Hitomi Hasegawa
` (3 preceding siblings ...)
(?)
@ 2022-07-19 14:10 ` patchwork-bot+linux-soc
-1 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+linux-soc @ 2022-07-19 14:10 UTC (permalink / raw)
To: hasegawa-hitomi; +Cc: soc
Hello:
This patch was applied to soc/soc.git (for-next)
by Arnd Bergmann <arnd@arndb.de>:
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.
>
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-07-19 14:10 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 7:41 [PATCH v5 0/1] soc: fujitsu: Add A64FX diagnostic interrupt driver Hitomi Hasegawa
2022-05-20 7:41 ` Hitomi Hasegawa
2022-05-20 7:41 ` [PATCH v5 1/1] " Hitomi Hasegawa
2022-05-20 7:41 ` Hitomi Hasegawa
2022-06-09 7:48 ` [PATCH v5 0/1] " hasegawa-hitomi
2022-06-09 7:48 ` hasegawa-hitomi
2022-06-16 9:02 ` hasegawa-hitomi
2022-06-16 9:02 ` hasegawa-hitomi
2022-07-18 11:39 ` Arnd Bergmann
2022-07-18 11:39 ` Arnd Bergmann
2022-07-19 14:10 ` patchwork-bot+linux-soc
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.