From patchwork Mon Jun 1 22:09:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loc Ho X-Patchwork-Id: 6524861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8EAFAC0020 for ; Mon, 1 Jun 2015 22:12:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5D91200D0 for ; Mon, 1 Jun 2015 22:12:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6180203EB for ; Mon, 1 Jun 2015 22:12:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YzXuO-0004si-Jl; Mon, 01 Jun 2015 22:10:12 +0000 Received: from exprod5og120.obsmtp.com ([64.18.0.137] helo=mail-ie0-f176.google.com) by bombadil.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YzXuL-0003gr-8N for linux-arm-kernel@lists.infradead.org; Mon, 01 Jun 2015 22:10:10 +0000 Received: from mail-ie0-f176.google.com ([209.85.223.176]) (using TLSv1) by exprod5ob120.postini.com ([64.18.4.12]) with SMTP ID DSNKVWzYKtDdGe52N8TDRUHdBOGD7Wx0uh2/@postini.com; Mon, 01 Jun 2015 15:10:09 PDT Received: by ieclw1 with SMTP id lw1so24738464iec.3 for ; Mon, 01 Jun 2015 15:09:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aHXq6sbF3k3+MUpaBRh3FZIFAwdmWxUhG+4l0VR195E=; b=HASc0y5kb0pQnGzlZ/AD0Y80aBcjieG7stUqATbRZo5soFLFA1oK9Idpim+HQcgWU4 hamTprnTcAPa1ZODHqVvF9xr3rL+cGHI//1ipPMzuyVlJNRA9gmpgEfQZpdhFXkra688 dz9lbmYVBM6JKy33QbNvcogbdY5ebCQ+/707zQCKBGzkauXUR9e6IkfEALYdPWlWDwjh 7PorsElFpusMC5VnBIWf3scmhZ633ZjwxLHiTAwtzzXbumy9Tl1/XRDimkHt3h2aX6Y6 L0t6BVCwjc/aMx2/ekGzeRaTBo7o9XWfAcwy9Rj5XVbzqOcJMQ+w7onn9YjB1b/FcKvk UUFQ== X-Gm-Message-State: ALoCoQm2XqtcKbzPCbhMWjng+2203kQB34fQHcNWK+p8VRIvKAjx9wseWV54cu+3gZNVP3Xyz5PX3Wjk4qrU25Y5M0gm91N6qEN9CJGBtZ4dC0SsG2vhTi6B8HLSGHBy7vNZGCzb6YQGiX9aRiRqxiU9SGkbHCEiFKBxP2D/4FCRXWo+uQEXot8= X-Received: by 10.42.164.7 with SMTP id e7mr31243714icy.70.1433196585939; Mon, 01 Jun 2015 15:09:45 -0700 (PDT) X-Received: by 10.42.164.7 with SMTP id e7mr31243692icy.70.1433196585762; Mon, 01 Jun 2015 15:09:45 -0700 (PDT) Received: from localhost ([198.137.200.11]) by mx.google.com with ESMTPSA id a139sm11294888ioa.14.2015.06.01.15.09.44 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Jun 2015 15:09:44 -0700 (PDT) From: Loc Ho To: dougthompson@xmission.com, bp@alien8.de, mchehab@osg.samsung.com, arnd@arndb.de, robh+dt@kernel.org, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk Subject: [PATCH] edac: xgene: fix cpuid abuse Date: Mon, 1 Jun 2015 16:09:35 -0600 Message-Id: <1433196575-9455-1-git-send-email-lho@apm.com> X-Mailer: git-send-email 1.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150601_151009_354635_52154B44 X-CRM114-Status: GOOD ( 15.64 ) X-Spam-Score: -3.4 (---) Cc: devicetree@vger.kernel.org, jcm@redhat.com, patches@apm.com, Loc Ho , linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 The new x-gene EDAC driver incorrectly tried to figure out the version of one of its IP blocks by looking at the version of the CPU core, which is only vagely related. This removes the incorrect code and instead uses the version of the IP block in the compatible string where it belongs. Found using build testing on x86, which does not provide the arm64 cpuid interface. This version is based on Arnd original version. Signed-off-by: Loc Ho --- .../devicetree/bindings/edac/apm-xgene-edac.txt | 3 +- drivers/edac/xgene_edac.c | 55 +++----------------- 2 files changed, 10 insertions(+), 48 deletions(-) diff --git a/Documentation/devicetree/bindings/edac/apm-xgene-edac.txt b/Documentation/devicetree/bindings/edac/apm-xgene-edac.txt index 480911c..78edb80 100644 --- a/Documentation/devicetree/bindings/edac/apm-xgene-edac.txt +++ b/Documentation/devicetree/bindings/edac/apm-xgene-edac.txt @@ -25,7 +25,8 @@ Required properties for memory controller subnode: - memory-controller : Instance number of the memory controller. Required properties for PMD subnode: -- compatible : Shall be "apm,xgene-edac-pmd". +- compatible : Shall be "apm,xgene-edac-pmd" or + "apm,xgene-edac-pmd-v2". - reg : First resource shall be the PMD resource. - pmd-controller : Instance number of the PMD controller. diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c index b515857..14636e4 100644 --- a/drivers/edac/xgene_edac.c +++ b/drivers/edac/xgene_edac.c @@ -523,6 +523,7 @@ struct xgene_edac_pmd_ctx { struct edac_device_ctl_info *edac_dev; void __iomem *pmd_csr; u32 pmd; + int version; }; static void xgene_edac_pmd_l1_check(struct edac_device_ctl_info *edac_dev, @@ -784,50 +785,6 @@ static void xgene_edac_pmd_cpu_hw_cfg(struct edac_device_ctl_info *edac_dev, writel(0x00000101, pg_f + MEMERR_CPU_MMUECR_PAGE_OFFSET); } -static bool xgene_edac_pmd_l2c_version1(void) -{ - /* Check all chips with PMD L2C version 1 HW */ - #define REVIDR_MINOR_REV(revidr) ((revidr) & 0x00000007) - - switch (MIDR_VARIANT(read_cpuid_id())) { - case 0: - switch (MIDR_REVISION(read_cpuid_id())) { - case 0: - - switch (REVIDR_MINOR_REV(read_cpuid(REVIDR_EL1))) { - case 1: - case 2: - return true; - }; - break; - case 1: - if (REVIDR_MINOR_REV(read_cpuid(REVIDR_EL1)) == 1) - return true; - break; - } - break; - case 1: - switch (MIDR_REVISION(read_cpuid_id())) { - case 0: - switch (REVIDR_MINOR_REV(read_cpuid(REVIDR_EL1))) { - case 1: - return true; - }; - break; - case 1: - switch (REVIDR_MINOR_REV(read_cpuid(REVIDR_EL1))) { - case 1: - case 0: - return true; - }; - break; - } - break; - } - - return false; -} - static void xgene_edac_pmd_hw_cfg(struct edac_device_ctl_info *edac_dev) { struct xgene_edac_pmd_ctx *ctx = edac_dev->pvt_info; @@ -837,7 +794,7 @@ static void xgene_edac_pmd_hw_cfg(struct edac_device_ctl_info *edac_dev) /* Enable PMD memory error - MEMERR_L2C_L2ECR and L2C_L2RTOCR */ writel(0x00000703, pg_e + MEMERR_L2C_L2ECR_PAGE_OFFSET); /* Configure L2C HW request time out feature if supported */ - if (!xgene_edac_pmd_l2c_version1()) + if (ctx->version > 1) writel(0x00000119, pg_d + CPUX_L2C_L2RTOCR_PAGE_OFFSET); } @@ -956,7 +913,8 @@ static int xgene_edac_pmd_available(u32 efuse, int pmd) return (efuse & (1 << pmd)) ? 0 : 1; } -static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np) +static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np, + int version) { struct edac_device_ctl_info *edac_dev; struct xgene_edac_pmd_ctx *ctx; @@ -998,6 +956,7 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np) ctx->edac = edac; ctx->edac_dev = edac_dev; ctx->ddev = *edac->dev; + ctx->version = version; edac_dev->dev = &ctx->ddev; edac_dev->ctl_name = ctx->name; edac_dev->dev_name = ctx->name; @@ -1169,7 +1128,9 @@ static int xgene_edac_probe(struct platform_device *pdev) if (of_device_is_compatible(child, "apm,xgene-edac-mc")) xgene_edac_mc_add(edac, child); if (of_device_is_compatible(child, "apm,xgene-edac-pmd")) - xgene_edac_pmd_add(edac, child); + xgene_edac_pmd_add(edac, child, 1); + if (of_device_is_compatible(child, "apm,xgene-edac-pmd-v2")) + xgene_edac_pmd_add(edac, child, 2); } return 0;