From patchwork Wed Nov 6 13:02:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 3147231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3460C9F432 for ; Wed, 6 Nov 2013 13:03:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5ACF72047D for ; Wed, 6 Nov 2013 13:03:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19B0220483 for ; Wed, 6 Nov 2013 13:03:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ve2li-0007Xu-Lt; Wed, 06 Nov 2013 13:03:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ve2lg-0007gi-8K; Wed, 06 Nov 2013 13:03:32 +0000 Received: from mail-oa0-x232.google.com ([2607:f8b0:4003:c02::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ve2lc-0007g5-Hd for linux-arm-kernel@lists.infradead.org; Wed, 06 Nov 2013 13:03:29 +0000 Received: by mail-oa0-f50.google.com with SMTP id j17so2086567oag.37 for ; Wed, 06 Nov 2013 05:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Ts746+vBG5sebChfx7tlfvhwb9SNkj5WAYJ0liA6c6I=; b=THdme0phlPoZpkj8DKefmCWac6zZBlQslLlbSdAP116Jm/Y8bhCAY5Ksz4iX3hNMme 6tZ/0XwahKdHNwEITfExtlwAF0KORTCcHMx6iY8FGfQoB3ip16T7Wo2Yy0oLEyAuXOMW +YxTwpYm/1EJTY8RJe5ie/SDWHJQhtaWyajXauA9eUGyPAvZi8d4Qz7GdWrxS275iDm7 GPFRWh2j8EnqDyjAwG1FKdvgeg6iTsbd491NbGcdWZiFNAb0W+kQ0uHnf/Mcb/x79mql Gw+JJCmx9q2i/fiZuAGZnIZFIOirmIy+WRFLRbbDPhQbt/eR3F7UJw7Ja8YBmQ4Hr5Oi XrJg== X-Received: by 10.60.157.2 with SMTP id wi2mr2541193oeb.35.1383742981974; Wed, 06 Nov 2013 05:03:01 -0800 (PST) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPSA id ee7sm52430912oeb.5.2013.11.06.05.03.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 05:03:01 -0800 (PST) From: Rob Herring To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: enable EDAC on arm64 Date: Wed, 6 Nov 2013 07:02:24 -0600 Message-Id: <1383742944-28059-1-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131106_080328_656456_A3F7136A X-CRM114-Status: GOOD ( 16.03 ) X-Spam-Score: -1.8 (-) Cc: Catalin Marinas , Will Deacon , Rob Herring X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Herring Implement atomic_scrub and enable EDAC for arm64. Signed-off-by: Rob Herring Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/edac.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 arch/arm64/include/asm/edac.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7d70404..611f5f6 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -11,6 +11,7 @@ config ARM64 select BUILDTIME_EXTABLE_SORT select CLONE_BACKWARDS select COMMON_CLK + select EDAC_SUPPORT select GENERIC_CLOCKEVENTS select GENERIC_IOMAP select GENERIC_IRQ_PROBE diff --git a/arch/arm64/include/asm/edac.h b/arch/arm64/include/asm/edac.h new file mode 100644 index 0000000..ad81a7a --- /dev/null +++ b/arch/arm64/include/asm/edac.h @@ -0,0 +1,44 @@ +/* + * Copyright 2013 Calxeda, Inc. + * Based on PPC version Copyright 2007 MontaVista Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ +#ifndef ASM_EDAC_H +#define ASM_EDAC_H +/* + * ECC atomic, DMA, SMP and interrupt safe scrub function. + * Implements the per arch atomic_scrub() that EDAC use for software + * ECC scrubbing. It reads memory and then writes back the original + * value, allowing the hardware to detect and correct memory errors. + */ +static inline void atomic_scrub(void *va, u32 size) +{ + unsigned int *virt_addr = va; + unsigned int temp, temp2; + unsigned int i; + + for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) { + /* + * No need to check for store failure, another write means + * the scrubbing has effectively already been done for us. + */ + asm volatile("\n" + " ldxr %0, %2\n" + " stxr %w1, %0, %2\n" + : "=&r" (temp), "=&r" (temp2), "+Q" (virt_addr) + : : "cc"); + } +} + +#endif