Re: [PATCH RESEND v8 2/2] PCI: hip: Add handling of HiSilicon HIP PCIe controller errors
Hi Shiju, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on pci/next] [also build test WARNING on linus/master v5.7-rc7] [cannot apply to pm/linux-next linux/master next-20200529] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Shiju-Jose/ACPI-APEI-Add-support-to-notify-the-vendor-specific-HW-errors/20200601-003936 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: i386-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot All warnings (new ones prefixed by >>, old ones prefixed by <<): drivers/pci/controller/pcie-hisi-error.c: In function 'hisi_pcie_handle_error': >> drivers/pci/controller/pcie-hisi-error.c:246:1: warning: the frame size of >> 1124 bytes is larger than 1024 bytes [-Wframe-larger-than=] 246 | } | ^ vim +246 drivers/pci/controller/pcie-hisi-error.c 181 182 static void hisi_pcie_handle_error(const struct hisi_pcie_error_data *error, 183 struct platform_device *pdev) 184 { 185 char buf[HISI_PCIE_ERR_INFO_SIZE]; 186 char *p = buf, *end = buf + sizeof(buf); 187 struct device *dev = >dev; 188 u32 i; 189 int rc; 190 191 if (error->val_bits == 0) { 192 dev_warn(dev, "%s: no valid error information\n", __func__); 193 return; 194 } 195 196 /* Logging */ 197 p += snprintf(p, end - p, "[ Table version=%d ", error->version); 198 if (error->val_bits & HISI_PCIE_LOCAL_VALID_SOC_ID) 199 p += snprintf(p, end - p, "SOC ID=%d ", error->soc_id); 200 201 if (error->val_bits & HISI_PCIE_LOCAL_VALID_SOCKET_ID) 202 p += snprintf(p, end - p, "socket ID=%d ", error->socket_id); 203 204 if (error->val_bits & HISI_PCIE_LOCAL_VALID_NIMBUS_ID) 205 p += snprintf(p, end - p, "nimbus ID=%d ", error->nimbus_id); 206 207 if (error->val_bits & HISI_PCIE_LOCAL_VALID_SUB_MODULE_ID) 208 p += snprintf(p, end - p, "sub module=%s ", 209 hisi_pcie_sub_module_name(error->sub_module_id)); 210 211 if (error->val_bits & HISI_PCIE_LOCAL_VALID_CORE_ID) 212 p += snprintf(p, end - p, "core ID=core%d ", error->core_id); 213 214 if (error->val_bits & HISI_PCIE_LOCAL_VALID_PORT_ID) 215 p += snprintf(p, end - p, "port ID=port%d ", error->port_id); 216 217 if (error->val_bits & HISI_PCIE_LOCAL_VALID_ERR_SEVERITY) 218 p += snprintf(p, end - p, "error severity=%s ", 219 hisi_pcie_error_severity(error->err_severity)); 220 221 if (error->val_bits & HISI_PCIE_LOCAL_VALID_ERR_TYPE) 222 p += snprintf(p, end - p, "error type=0x%x ", error->err_type); 223 224 p += snprintf(p, end - p, "]\n"); 225 dev_info(dev, "\nHISI : HIP : PCIe controller error\n"); 226 dev_info(dev, "%s\n", buf); 227 228 dev_info(dev, "Reg Dump:\n"); 229 for (i = 0; i < HISI_PCIE_ERR_MISC_REGS; i++) { 230 if (error->val_bits & 231 BIT_ULL(HISI_PCIE_LOCAL_VALID_ERR_MISC + i)) 232 dev_info(dev, 233 "ERR_MISC_%d=0x%x\n", i, error->err_misc[i]); 234 } 235 236 /* Recovery for the PCIe controller errors */ 237 if (error->err_severity == HISI_ERR_SEV_RECOVERABLE) { 238 /* try reset PCI port for the error recovery */ 239 rc = hisi_pcie_port_do_recovery(pdev, error->socket_id, 240 HISI_PCIE_PORT_ID(error->core_id, error->port_id)); 241 if (rc) { 242 dev_info(dev, "fail to do hisi pcie port reset\n"); 243 return; 244 } 245 } > 246 } 247 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH RESEND v8 2/2] PCI: hip: Add handling of HiSilicon HIP PCIe controller errors
From: Yicong Yang The HiSilicon HIP PCIe controller is capable of handling errors on root port and perform port reset separately at each root port. This patch add error handling driver for HIP PCIe controller to log and report recoverable errors. Perform root port reset and restore link status after the recovery. Following are some of the PCIe controller's recoverable errors 1. completion transmission timeout error. 2. CRS retry counter over the threshold error. 3. ECC 2 bit errors 4. AXI bresponse/rresponse errors etc. The driver placed in the drivers/pci/controller/ because the HIP PCIe controller does not use DWC ip. Signed-off-by: Yicong Yang Signed-off-by: Shiju Jose -- drivers/pci/controller/Kconfig | 8 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-hisi-error.c | 336 +++ 3 files changed, 345 insertions(+) create mode 100644 drivers/pci/controller/pcie-hisi-error.c --- drivers/pci/controller/Kconfig | 8 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-hisi-error.c | 321 +++ 3 files changed, 330 insertions(+) create mode 100644 drivers/pci/controller/pcie-hisi-error.c diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 91bfdb784829..7ba4b94f8604 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -258,6 +258,14 @@ config PCI_HYPERV_INTERFACE The Hyper-V PCI Interface is a helper driver allows other drivers to have a common interface with the Hyper-V PCI frontend driver. +config PCIE_HISI_ERR + depends on ARM64 || COMPILE_TEST + depends on ACPI + bool "HiSilicon HIP PCIe controller error handling driver" + help + Say Y here if you want error handling support + for the PCIe controller's errors on HiSilicon HIP SoCs + source "drivers/pci/controller/dwc/Kconfig" source "drivers/pci/controller/mobiveil/Kconfig" source "drivers/pci/controller/cadence/Kconfig" diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makefile index 158c59771824..ab3a528bf988 100644 --- a/drivers/pci/controller/Makefile +++ b/drivers/pci/controller/Makefile @@ -28,6 +28,7 @@ obj-$(CONFIG_PCIE_MEDIATEK) += pcie-mediatek.o obj-$(CONFIG_PCIE_TANGO_SMP8759) += pcie-tango.o obj-$(CONFIG_VMD) += vmd.o obj-$(CONFIG_PCIE_BRCMSTB) += pcie-brcmstb.o +obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o # pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW obj-y += dwc/ obj-y += mobiveil/ diff --git a/drivers/pci/controller/pcie-hisi-error.c b/drivers/pci/controller/pcie-hisi-error.c new file mode 100644 index ..7886df01fd8a --- /dev/null +++ b/drivers/pci/controller/pcie-hisi-error.c @@ -0,0 +1,321 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for handling the PCIe controller errors on + * HiSilicon HIP SoCs. + * + * Copyright (c) 2018-2019 HiSilicon Limited. + */ + +#include +#include +#include +#include +#include +#include +#include + +#defineHISI_PCIE_ERR_INFO_SIZE 1024 + +/* HISI PCIe controller error definitions */ +#define HISI_PCIE_ERR_MISC_REGS33 + +#define HISI_PCIE_SUB_MODULE_ID_AP 0 +#define HISI_PCIE_SUB_MODULE_ID_TL 1 +#define HISI_PCIE_SUB_MODULE_ID_MAC2 +#define HISI_PCIE_SUB_MODULE_ID_DL 3 +#define HISI_PCIE_SUB_MODULE_ID_SDI4 + +#define HISI_PCIE_LOCAL_VALID_VERSION BIT(0) +#define HISI_PCIE_LOCAL_VALID_SOC_ID BIT(1) +#define HISI_PCIE_LOCAL_VALID_SOCKET_IDBIT(2) +#define HISI_PCIE_LOCAL_VALID_NIMBUS_IDBIT(3) +#define HISI_PCIE_LOCAL_VALID_SUB_MODULE_IDBIT(4) +#define HISI_PCIE_LOCAL_VALID_CORE_ID BIT(5) +#define HISI_PCIE_LOCAL_VALID_PORT_ID BIT(6) +#define HISI_PCIE_LOCAL_VALID_ERR_TYPE BIT(7) +#define HISI_PCIE_LOCAL_VALID_ERR_SEVERITY BIT(8) +#define HISI_PCIE_LOCAL_VALID_ERR_MISC 9 + +#define HISI_ERR_SEV_RECOVERABLE 0 +#define HISI_ERR_SEV_FATAL 1 +#define HISI_ERR_SEV_CORRECTED 2 +#define HISI_ERR_SEV_NONE 3 + +static guid_t hisi_pcie_sec_type = GUID_INIT(0xB2889FC9, 0xE7D7, 0x4F9D, + 0xA8, 0x67, 0xAF, 0x42, 0xE9, 0x8B, 0xE7, 0x72); + +#define HISI_PCIE_CORE_ID(v) ((v) >> 3) +#define HISI_PCIE_PORT_ID(core, v) (((v) >> 1) + ((core) << 3)) +#define HISI_PCIE_CORE_PORT_ID(v)(((v) % 8) << 1) + +struct hisi_pcie_error_data { + u64 val_bits; + u8 version; + u8 soc_id; + u8 socket_id; + u8 nimbus_id; + u8 sub_module_id; + u8 core_id; + u8 port_id; + u8 err_severity; + u16 err_type; + u8 reserv[2]; + u32 err_misc[HISI_PCIE_ERR_MISC_REGS]; +}; + +struct hisi_pcie_error_private { + struct notifier_block