mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
ACPI: APEI: GHES: Add NVIDIA vendor CPER record handler
Add support for decoding NVIDIA-specific CPER sections delivered via the APEI GHES vendor record notifier chain. NVIDIA hardware generates vendor-specific CPER sections containing error signatures and diagnostic register dumps. This implementation registers a notifier_block with the GHES vendor record notifier and decodes these sections, printing error details via dev_info(). The driver binds to ACPI device NVDA2012, present on NVIDIA server platforms. The NVIDIA CPER section contains a fixed header with error metadata (signature, error type, severity, socket) followed by variable-length register address-value pairs for hardware diagnostics. This work is based on libcper [1]. Example output: nvidia-ghes NVDA2012:00: NVIDIA CPER section, error_data_length: 544 nvidia-ghes NVDA2012:00: signature: CMET-INFO nvidia-ghes NVDA2012:00: error_type: 0 nvidia-ghes NVDA2012:00: error_instance: 0 nvidia-ghes NVDA2012:00: severity: 3 nvidia-ghes NVDA2012:00: socket: 0 nvidia-ghes NVDA2012:00: number_regs: 32 nvidia-ghes NVDA2012:00: instance_base: 0x0000000000000000 nvidia-ghes NVDA2012:00: register[0]: address=0x8000000100000000 value=0x0000000100000000 https://github.com/openbmc/libcper/commit/683e055061ce [1] Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com> [ rjw: Changelog edits ] Link: https://patch.msgid.link/20260330094203.38022-4-kaihengf@nvidia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
35bdb5dbac
commit
d7610855b0
|
|
@ -18919,6 +18919,12 @@ S: Maintained
|
|||
F: drivers/video/fbdev/nvidia/
|
||||
F: drivers/video/fbdev/riva/
|
||||
|
||||
NVIDIA GHES VENDOR CPER RECORD HANDLER
|
||||
M: Kai-Heng Feng <kaihengf@nvidia.com>
|
||||
L: linux-acpi@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/acpi/apei/nvidia-ghes.c
|
||||
|
||||
NVIDIA VRS RTC DRIVER
|
||||
M: Shubhi Garg <shgarg@nvidia.com>
|
||||
L: linux-tegra@vger.kernel.org
|
||||
|
|
|
|||
|
|
@ -74,6 +74,20 @@ config ACPI_APEI_EINJ_CXL
|
|||
|
||||
If unsure say 'n'
|
||||
|
||||
config ACPI_APEI_GHES_NVIDIA
|
||||
tristate "NVIDIA GHES vendor record handler"
|
||||
depends on ACPI_APEI_GHES
|
||||
help
|
||||
Support for decoding NVIDIA-specific CPER sections delivered via
|
||||
the APEI GHES vendor record notifier chain. Registers a handler
|
||||
for the NVIDIA section GUID and logs error signatures, severity,
|
||||
socket, and diagnostic register address-value pairs.
|
||||
|
||||
Enable on NVIDIA server platforms (e.g. DGX, HGX) that expose
|
||||
ACPI device NVDA2012 in their firmware tables.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config ACPI_APEI_ERST_DEBUG
|
||||
tristate "APEI Error Record Serialization Table (ERST) Debug Support"
|
||||
depends on ACPI_APEI
|
||||
|
|
|
|||
|
|
@ -10,5 +10,6 @@ obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o
|
|||
einj-y := einj-core.o
|
||||
einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o
|
||||
obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o
|
||||
obj-$(CONFIG_ACPI_APEI_GHES_NVIDIA) += ghes-nvidia.o
|
||||
|
||||
apei-y := apei-base.o hest.o erst.o bert.o
|
||||
|
|
|
|||
149
drivers/acpi/apei/ghes-nvidia.c
Normal file
149
drivers/acpi/apei/ghes-nvidia.c
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* NVIDIA GHES vendor record handler
|
||||
*
|
||||
* Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/uuid.h>
|
||||
#include <acpi/ghes.h>
|
||||
|
||||
static const guid_t nvidia_sec_guid =
|
||||
GUID_INIT(0x6d5244f2, 0x2712, 0x11ec,
|
||||
0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86);
|
||||
|
||||
struct cper_sec_nvidia {
|
||||
char signature[16];
|
||||
__le16 error_type;
|
||||
__le16 error_instance;
|
||||
u8 severity;
|
||||
u8 socket;
|
||||
u8 number_regs;
|
||||
u8 reserved;
|
||||
__le64 instance_base;
|
||||
struct {
|
||||
__le64 addr;
|
||||
__le64 val;
|
||||
} regs[] __counted_by(number_regs);
|
||||
};
|
||||
|
||||
struct nvidia_ghes_private {
|
||||
struct notifier_block nb;
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
static void nvidia_ghes_print_error(struct device *dev,
|
||||
const struct cper_sec_nvidia *nvidia_err,
|
||||
size_t error_data_length, bool fatal)
|
||||
{
|
||||
const char *level = fatal ? KERN_ERR : KERN_INFO;
|
||||
size_t min_size;
|
||||
|
||||
dev_printk(level, dev, "signature: %.16s\n", nvidia_err->signature);
|
||||
dev_printk(level, dev, "error_type: %u\n", le16_to_cpu(nvidia_err->error_type));
|
||||
dev_printk(level, dev, "error_instance: %u\n", le16_to_cpu(nvidia_err->error_instance));
|
||||
dev_printk(level, dev, "severity: %u\n", nvidia_err->severity);
|
||||
dev_printk(level, dev, "socket: %u\n", nvidia_err->socket);
|
||||
dev_printk(level, dev, "number_regs: %u\n", nvidia_err->number_regs);
|
||||
dev_printk(level, dev, "instance_base: 0x%016llx\n",
|
||||
le64_to_cpu(nvidia_err->instance_base));
|
||||
|
||||
if (nvidia_err->number_regs == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Validate that all registers fit within error_data_length.
|
||||
* Each register pair is two little-endian u64s.
|
||||
*/
|
||||
min_size = struct_size(nvidia_err, regs, nvidia_err->number_regs);
|
||||
if (error_data_length < min_size) {
|
||||
dev_err(dev, "Invalid number_regs %u (section size %zu, need %zu)\n",
|
||||
nvidia_err->number_regs, error_data_length, min_size);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < nvidia_err->number_regs; i++)
|
||||
dev_printk(level, dev, "register[%d]: address=0x%016llx value=0x%016llx\n",
|
||||
i, le64_to_cpu(nvidia_err->regs[i].addr),
|
||||
le64_to_cpu(nvidia_err->regs[i].val));
|
||||
}
|
||||
|
||||
static int nvidia_ghes_notify(struct notifier_block *nb,
|
||||
unsigned long event, void *data)
|
||||
{
|
||||
struct acpi_hest_generic_data *gdata = data;
|
||||
struct nvidia_ghes_private *priv;
|
||||
const struct cper_sec_nvidia *nvidia_err;
|
||||
guid_t sec_guid;
|
||||
|
||||
import_guid(&sec_guid, gdata->section_type);
|
||||
if (!guid_equal(&sec_guid, &nvidia_sec_guid))
|
||||
return NOTIFY_DONE;
|
||||
|
||||
priv = container_of(nb, struct nvidia_ghes_private, nb);
|
||||
|
||||
if (acpi_hest_get_error_length(gdata) < sizeof(*nvidia_err)) {
|
||||
dev_err(priv->dev, "Section too small (%d < %zu)\n",
|
||||
acpi_hest_get_error_length(gdata), sizeof(*nvidia_err));
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
nvidia_err = acpi_hest_get_payload(gdata);
|
||||
|
||||
if (event >= GHES_SEV_RECOVERABLE)
|
||||
dev_err(priv->dev, "NVIDIA CPER section, error_data_length: %u\n",
|
||||
acpi_hest_get_error_length(gdata));
|
||||
else
|
||||
dev_info(priv->dev, "NVIDIA CPER section, error_data_length: %u\n",
|
||||
acpi_hest_get_error_length(gdata));
|
||||
|
||||
nvidia_ghes_print_error(priv->dev, nvidia_err, acpi_hest_get_error_length(gdata),
|
||||
event >= GHES_SEV_RECOVERABLE);
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int nvidia_ghes_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct nvidia_ghes_private *priv;
|
||||
int ret;
|
||||
|
||||
priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
*priv = (struct nvidia_ghes_private) {
|
||||
.nb.notifier_call = nvidia_ghes_notify,
|
||||
.dev = &pdev->dev,
|
||||
};
|
||||
|
||||
ret = devm_ghes_register_vendor_record_notifier(&pdev->dev, &priv->nb);
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"Failed to register NVIDIA GHES vendor record notifier\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct acpi_device_id nvidia_ghes_acpi_match[] = {
|
||||
{ "NVDA2012" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(acpi, nvidia_ghes_acpi_match);
|
||||
|
||||
static struct platform_driver nvidia_ghes_driver = {
|
||||
.driver = {
|
||||
.name = "nvidia-ghes",
|
||||
.acpi_match_table = nvidia_ghes_acpi_match,
|
||||
},
|
||||
.probe = nvidia_ghes_probe,
|
||||
};
|
||||
module_platform_driver(nvidia_ghes_driver);
|
||||
|
||||
MODULE_AUTHOR("Kai-Heng Feng <kaihengf@nvidia.com>");
|
||||
MODULE_DESCRIPTION("NVIDIA GHES vendor CPER record handler");
|
||||
MODULE_LICENSE("GPL");
|
||||
Loading…
Reference in New Issue
Block a user