linux-stable/include/linux/einj-cxl.h
Ben Cheatham 12fb28ea6b EINJ: Add CXL error type support
Move CXL protocol error types from einj.c (now einj-core.c) to einj-cxl.c.
einj-cxl.c implements the necessary handling for CXL protocol error
injection and exposes an API for the CXL core to use said functionality,
while also allowing the EINJ module to be built without CXL support.
Because CXL error types targeting CXL 1.0/1.1 ports require special
handling, only allow them to be injected through the new cxl debugfs
interface (next commit) and return an error when attempting to inject
through the legacy interface.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
Link: https://lore.kernel.org/r/20240311142508.31717-3-Benjamin.Cheatham@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2024-03-12 23:08:29 -07:00

44 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* CXL protocol Error INJection support.
*
* Copyright (c) 2023 Advanced Micro Devices, Inc.
* All Rights Reserved.
*
* Author: Ben Cheatham <benjamin.cheatham@amd.com>
*/
#ifndef EINJ_CXL_H
#define EINJ_CXL_H
#include <linux/errno.h>
#include <linux/types.h>
struct pci_dev;
struct seq_file;
#if IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL)
int einj_cxl_available_error_type_show(struct seq_file *m, void *v);
int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type);
int einj_cxl_inject_rch_error(u64 rcrb, u64 type);
bool einj_cxl_is_initialized(void);
#else /* !IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL) */
static inline int einj_cxl_available_error_type_show(struct seq_file *m,
void *v)
{
return -ENXIO;
}
static inline int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type)
{
return -ENXIO;
}
static inline int einj_cxl_inject_rch_error(u64 rcrb, u64 type)
{
return -ENXIO;
}
static inline bool einj_cxl_is_initialized(void) { return false; }
#endif /* CONFIG_ACPI_APEI_EINJ_CXL */
#endif /* EINJ_CXL_H */