Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1280121ybi; Fri, 14 Jun 2019 11:43:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4ylcYrVrvsSXyjCVlG4jxjGNVYj8KUjjIijOVJznqZHSG84q7tfDY4GH3PU28//GQspH7 X-Received: by 2002:a63:5d61:: with SMTP id o33mr7696422pgm.114.1560537821607; Fri, 14 Jun 2019 11:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560537821; cv=none; d=google.com; s=arc-20160816; b=V3HOxlK3ZYCwHuY7Ca4l/dTQAQcDqkhp5tS3yeScVZFEcsaE2Ve/pGxutz1lXFzjQJ 1O5d0QvUgpbF8CmWItMABLx6wsaWSsDLrcHA1hp7rTuGRgd5fcMQOXRSuUljxJjlsFml 5wO/jIH8ilzGa67dawLwY1REyflRthPEvt5KpoNZA24b/KZhsUTpH85Op6/msvYlZLXD /xDFHVeVJyAvOn6P7BqsY0Pf+MlnmBkD+Otxo0KUicbLomUVZfihT0B2qwdhJHtRamMw eKwIwnI3iaqRc+jSx2qli5jfXVuZuzOUlF8QDTbgfs65t2XfTGaut7Hvd3w+8gdwuTQ2 DDdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8jNYmU8ZmV5gIwr4Ka310b7ILZ/kXzFHtNRzAOhuJl0=; b=W8KJ4dL0Wpq0tqgrcH/hdZOgQKPIoiK6Mv0ydOnTLUCwsAa7HOHFnoBiTzjkw9Q134 jnjaXtJo6auCMPhuDth6qYqhbDWxb0HC4gibxQ4GpQylhV3TCZLsXsM9YN/bKsvx7QgI gjQbBJaP3xcfdkrgQPHPUPVewCeS9EZr823+3VPvM5//mnCQsXWLadjhMUyyMfcoLcOl B+Ma7a/LyDbw7NUmQPp9ev7AzOug6pDhA6VsF5GBw8auHU8box0jm5/MkkzKPPB2/vol I4mLKdw7qH4OnM5hSGXw9Y1ifwU8BIcJErCVbvsrnF9yC5pgpIT5c7Imm4e2DBvxt1Zk 3deQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=C0NQsVZP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si3038365plb.234.2019.06.14.11.43.26; Fri, 14 Jun 2019 11:43:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=C0NQsVZP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726213AbfFNSmD (ORCPT + 99 others); Fri, 14 Jun 2019 14:42:03 -0400 Received: from mail.skyhub.de ([5.9.137.197]:36162 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbfFNSmC (ORCPT ); Fri, 14 Jun 2019 14:42:02 -0400 Received: from zn.tnic (p200300EC2F097F008D9D08C27DC27982.dip0.t-ipconnect.de [IPv6:2003:ec:2f09:7f00:8d9d:8c2:7dc2:7982]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 046161EC0B6E; Fri, 14 Jun 2019 20:41:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1560537720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=8jNYmU8ZmV5gIwr4Ka310b7ILZ/kXzFHtNRzAOhuJl0=; b=C0NQsVZPSMQOsCQZIePl1XYxgcK+EV36NlMfVp2C0KbXgKRltAuIR0ItTT4RQmKqFeOGE8 JXa/UD6y8HGv4nOaRFf0vbY1qWZg0yPvhZyZztQQ4W960cP7PhqRSQfHBDD7NxWWHWzRRH K0iGHS6zCKoE72Ir8VmyUEjtfxxtsbc= Date: Fri, 14 Jun 2019 20:41:51 +0200 From: Borislav Petkov To: Shravan Kumar Ramani Cc: Mauro Carvalho Chehab , James Morse , Liming Sun , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/1] EDAC, mellanox: Add ECC support for BlueField DDR4 Message-ID: <20190614184151.GP2586@zn.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 02:35:53PM -0400, Shravan Kumar Ramani wrote: > Add ECC support for Mellanox BlueField SoC DDR controller. > This requires SMC to the running Arm Trusted Firmware to report > what is the current memory configuration. > > Signed-off-by: Shravan Kumar Ramani > --- > MAINTAINERS | 5 + > drivers/edac/Kconfig | 7 + > drivers/edac/Makefile | 1 + > drivers/edac/bluefield_edac.c | 404 ++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 417 insertions(+) > create mode 100644 drivers/edac/bluefield_edac.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 57f496c..9d04cc4 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5669,6 +5669,11 @@ S: Supported > F: drivers/edac/aspeed_edac.c > F: Documentation/devicetree/bindings/edac/aspeed-sdram-edac.txt > > +EDAC-BLUEFIELD > +M: Shravan Kumar Ramani > +S: Supported > +F: drivers/edac/bluefield_edac.c > + > EDAC-CALXEDA > M: Robert Richter > L: linux-edac@vger.kernel.org > diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig > index 5e2e034..43df551 100644 > --- a/drivers/edac/Kconfig > +++ b/drivers/edac/Kconfig > @@ -504,4 +504,11 @@ config EDAC_ASPEED > First, ECC must be configured in the bootloader. Then, this driver > will expose error counters via the EDAC kernel framework. > > +config EDAC_BLUEFIELD > + tristate "Mellanox BlueField Memory ECC" > + depends on ARM64 && ((MELLANOX_PLATFORM && ACPI) || COMPILE_TEST) > + help > + Support for error detection and correction on the > + Mellanox BlueField SoCs. > + > endif # EDAC > diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile > index 89ad4a84..0294a67 100644 > --- a/drivers/edac/Makefile > +++ b/drivers/edac/Makefile > @@ -84,3 +84,4 @@ obj-$(CONFIG_EDAC_XGENE) += xgene_edac.o > obj-$(CONFIG_EDAC_TI) += ti_edac.o > obj-$(CONFIG_EDAC_QCOM) += qcom_edac.o > obj-$(CONFIG_EDAC_ASPEED) += aspeed_edac.o > +obj-$(CONFIG_EDAC_BLUEFIELD) += bluefield_edac.o > diff --git a/drivers/edac/bluefield_edac.c b/drivers/edac/bluefield_edac.c > new file mode 100644 > index 0000000..9c69033 > --- /dev/null > +++ b/drivers/edac/bluefield_edac.c > @@ -0,0 +1,404 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Bluefield-specific EDAC driver. > + * > + * Copyright (c) 2019 Mellanox Technologies. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "edac_module.h" > + > +#define DRIVER_NAME "bluefield-edac" > + > +/* > + * Mellanox BlueField EMI (External Memory Interface) register definitions. > + */ > + > +#define MLXBF_EMI_DRAM_ECC_COUNT 0x340 > +#define MLXBF_EMI_DRAM_ECC_COUNT__LENGTH 0x0001 > + > +#define MLXBF_EMI_DRAM_ECC_COUNT__SINGLE_ERROR_COUNT_SHIFT 0 > +#define MLXBF_EMI_DRAM_ECC_COUNT__SINGLE_ERROR_COUNT_RMASK 0xffff > + > +#define MLXBF_EMI_DRAM_ECC_COUNT__DOUBLE_ERROR_COUNT_SHIFT 16 > +#define MLXBF_EMI_DRAM_ECC_COUNT__DOUBLE_ERROR_COUNT_RMASK 0xffff > + > +#define MLXBF_EMI_DRAM_ECC_ERROR 0x348 > + > +#define MLXBF_EMI_DRAM_ECC_ERROR__DRAM_ECC_SINGLE_SHIFT 0 > +#define MLXBF_EMI_DRAM_ECC_ERROR__DRAM_ECC_SINGLE_RMASK 0x1 > + > +#define MLXBF_EMI_DRAM_ECC_ERROR__DRAM_ECC_DOUBLE_SHIFT 16 > +#define MLXBF_EMI_DRAM_ECC_ERROR__DRAM_ECC_DOUBLE_RMASK 0x1 > + > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT 0x354 > + > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT__DRAM_ECC_FIRST_SHIFT 0 > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT__DRAM_ECC_FIRST_RMASK 0x1 > + > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT__EDGE_SEL_SHIFT 16 > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT__EDGE_SEL_RMASK 0xf > + > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT__START_SHIFT 24 > +#define MLXBF_EMI_DRAM_ECC_LATCH_SELECT__START_RMASK 0x1 > + > +#define MLXBF_EMI_DRAM_ERR_ADDR_0 0x358 > + > +#define MLXBF_EMI_DRAM_ERR_ADDR_1 0x37c > + > +#define MLXBF_EMI_DRAM_SYNDROM 0x35c > +#define MLXBF_EMI_DRAM_SYNDROM__LENGTH 0x0001 > + > +#define MLXBF_EMI_DRAM_SYNDROM__DERR_SHIFT 0 > +#define MLXBF_EMI_DRAM_SYNDROM__DERR_RMASK 0x1 > + > +#define MLXBF_EMI_DRAM_SYNDROM__SERR_SHIFT 1 > +#define MLXBF_EMI_DRAM_SYNDROM__SERR_RMASK 0x1 > + > +#define MLXBF_EMI_DRAM_SYNDROM__SYNDROM_SHIFT 16 > +#define MLXBF_EMI_DRAM_SYNDROM__SYNDROM_RMASK 0x3ff > + > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0 0x364 > + > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_BANK_SHIFT 0 > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_BANK_RMASK 0xf > + > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_LRANK_SHIFT 4 > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_LRANK_RMASK 0x3 > + > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_PRANK_SHIFT 8 > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_PRANK_RMASK 0x3 > + > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_EDGE_SHIFT 16 > +#define MLXBF_EMI_DRAM_ADDITIONAL_INFO_0__ERR_EDGE_RMASK 0xff So those are *excessively* long macro names. So long that they impair reading the code properly. Please shorten excessively. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.