From patchwork Wed Jan 18 15:09:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 45338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2399488wrn; Wed, 18 Jan 2023 07:28:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXs/ZLweWMz3enLIHlHM/0I88zDoRZdtZ/oxCu5SXQu3H5q++y7UlDHMlAaGKCjX6zyCnANl X-Received: by 2002:a05:6a20:7da2:b0:b8:5a85:632c with SMTP id v34-20020a056a207da200b000b85a85632cmr10174615pzj.60.1674055689409; Wed, 18 Jan 2023 07:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674055689; cv=none; d=google.com; s=arc-20160816; b=p4UwtDfEnB3yxVUX9fS1lolHl18bFJJYg5JPh5U2wfXAR9aCNZK08IOtKNOtSddKfI LDYzmjuFxZCNFCxAq+xY2sXROnxJGPegr2Z4mLsS9ebxfE3zUGDrAzaTA/MzW12YR5vF jFEtSOHRY75DdViZbyBN55aLLxiUeT6tXBEyQwSUXsF329nK/Nk766IXcWdfVln7y/zS O0VLakJ7Xr5p4As4SXc1xrbbRZizye7QUvaDYMxyAoNsV93+GL0/Kdqo0IyPdUW69saJ jdxGmO5fy//4ZJA/VzSA8k36gN/IpEX+V4g1y2InRcaeF1vBXEylJ9+aLhzvCHR/dxAO CCug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cBoPP7la/ua1BtGy3Yfc6n2eJd1xV8oYEaGxzVQpNAQ=; b=xnIaoU0jhG9RlSs3QrFB83ZXSHmRQIUEv4pu1hbrUtH5FuEhRZRRoot75K/yrZ+gmS MAtx/fwsFdFQkF93T8GoSeMWZLCIcf2xL/hJO9nvLNmBmepjwgi8eKFs82W7BTkDHYa2 tY321rMRSI5NyhJlRbQ32KyJH0RWAzv3ir6xatixm92lwFFE0H2IdfQ3vdOaHzwMg2lZ xyTFLsMdURhf2oywL+k/0kgLb3aeWg5JcWmjPD5OGNoaNgbRDGqm6MPYJZkuw57MOSZm BHTJAp0qXbw9csOaLFAFE4wT6miOaknANXy30i9e5O6/GvzKwVr87c4JuaqSYSQK8sYq Hz2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZnK7pMoF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h191-20020a6383c8000000b0048e54a7f366si3060375pge.587.2023.01.18.07.27.57; Wed, 18 Jan 2023 07:28:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZnK7pMoF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229771AbjARPOd (ORCPT + 99 others); Wed, 18 Jan 2023 10:14:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbjARPM6 (ORCPT ); Wed, 18 Jan 2023 10:12:58 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B689346140 for ; Wed, 18 Jan 2023 07:10:43 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id 127so9139196pfe.4 for ; Wed, 18 Jan 2023 07:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cBoPP7la/ua1BtGy3Yfc6n2eJd1xV8oYEaGxzVQpNAQ=; b=ZnK7pMoFfj0Q4BnzQsiP1CHVWDjNgmQ8FXq58kmPVMdFll8MoE2KqeWeaIkeHTxYcW pwh9KGanvj7rvTSLAnkb5rUQqwvSNiBFDNNGyNmjMAVkdmaAYiqYhV2ka1dCnSboam4u VJvTrvdoN0pF1Ao4FXUphf3oeNOooK63ysbEBNDG6gUDyiHWUqSIsnIOP3qMU8Zlpbrh FpK/HyQnSOX6/2wRb5/xS3aV7xjx3v1weSO93quF+CxQT1CNIRX5GuAfYHB2KzjOp0Dt FhiFmW2gYVMyvGl3urrSTNsMWdAP61fWiiki98tWc66HGc7ZoxelMGV3vkopeVi4Al+c lbbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cBoPP7la/ua1BtGy3Yfc6n2eJd1xV8oYEaGxzVQpNAQ=; b=NzSNldgHvTkG0donBVhA8TmCz7IrzaS9rgojQJqvuBlsLx82r0Ohle9aveZyaK0SKT 59pcUtj79nOxajJJIqmXCCNCHiF33A1OtbgZC83AV9+sjlPS1ihe0ZBDsVxyMRh0cz9L UTAmRuDsHyBizBoEQjJ2BeHb6iwfdQuIBhG7U84MAo7XTcUiNbkWfbRFAz+WzVV+HlD+ hUfkFyCA8tEgDOnpgtw2ZFhgfE8MHs04+IbdzB/qqS2bkZ8Z8rYzg3lLC8gxdKzbcb0Y FyWWf7Hz4ZeB4aswsAZ0+j//CeqKMRWV9lYE2kI4TrEiyXF8l4XLugNRVpg+fqweRKpK YTGA== X-Gm-Message-State: AFqh2krBtAXfUOW22F9ScZXyviT/9nJq5buqZkJmU/dGHKmc6VrjT94q uh8MOYzYamRDEoctKbaT1CxH X-Received: by 2002:aa7:854f:0:b0:58b:b9ce:cda1 with SMTP id y15-20020aa7854f000000b0058bb9cecda1mr7521532pfn.28.1674054642343; Wed, 18 Jan 2023 07:10:42 -0800 (PST) Received: from localhost.localdomain ([27.111.75.61]) by smtp.gmail.com with ESMTPSA id i15-20020aa796ef000000b0058d9623e7f1sm6721544pfq.73.2023.01.18.07.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 07:10:41 -0800 (PST) From: Manivannan Sadhasivam To: andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, bp@alien8.de, tony.luck@intel.com Cc: quic_saipraka@quicinc.com, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, james.morse@arm.com, mchehab@kernel.org, rric@kernel.org, linux-edac@vger.kernel.org, quic_ppareek@quicinc.com, luca.weiss@fairphone.com, ahalaney@redhat.com, steev@kali.org, Manivannan Sadhasivam Subject: [PATCH v6 16/17] qcom: llcc/edac: Support polling mode for ECC handling Date: Wed, 18 Jan 2023 20:39:03 +0530 Message-Id: <20230118150904.26913-17-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230118150904.26913-1-manivannan.sadhasivam@linaro.org> References: <20230118150904.26913-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755374618835534989?= X-GMAIL-MSGID: =?utf-8?q?1755374618835534989?= Not all Qcom platforms support IRQ mode for ECC handling. For those platforms, the current EDAC driver will not be probed due to missing ECC IRQ in devicetree. So add support for polling mode so that the EDAC driver can be used on all Qcom platforms supporting LLCC. The polling delay of 5000ms is chosen based on Qcom downstream/vendor driver. Reported-by: Luca Weiss Tested-by: Luca Weiss Tested-by: Steev Klimaszewski # Thinkpad X13s Tested-by: Andrew Halaney # sa8540p-ride Signed-off-by: Manivannan Sadhasivam Reviewed-by: Borislav Petkov (AMD) --- drivers/edac/qcom_edac.c | 50 +++++++++++++++++++++--------------- drivers/soc/qcom/llcc-qcom.c | 13 +++++----- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/drivers/edac/qcom_edac.c b/drivers/edac/qcom_edac.c index 1d3cc1930a74..265e0fb39bc7 100644 --- a/drivers/edac/qcom_edac.c +++ b/drivers/edac/qcom_edac.c @@ -76,6 +76,8 @@ #define DRP0_INTERRUPT_ENABLE BIT(6) #define SB_DB_DRP_INTERRUPT_ENABLE 0x3 +#define ECC_POLL_MSEC 5000 + enum { LLCC_DRAM_CE = 0, LLCC_DRAM_UE, @@ -283,8 +285,7 @@ dump_syn_reg(struct edac_device_ctl_info *edev_ctl, int err_type, u32 bank) return ret; } -static irqreturn_t -llcc_ecc_irq_handler(int irq, void *edev_ctl) +static irqreturn_t llcc_ecc_irq_handler(int irq, void *edev_ctl) { struct edac_device_ctl_info *edac_dev_ctl = edev_ctl; struct llcc_drv_data *drv = edac_dev_ctl->dev->platform_data; @@ -328,6 +329,11 @@ llcc_ecc_irq_handler(int irq, void *edev_ctl) return irq_rc; } +static void llcc_ecc_check(struct edac_device_ctl_info *edev_ctl) +{ + llcc_ecc_irq_handler(0, edev_ctl); +} + static int qcom_llcc_edac_probe(struct platform_device *pdev) { struct llcc_drv_data *llcc_driv_data = pdev->dev.platform_data; @@ -355,29 +361,31 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev) edev_ctl->ctl_name = "llcc"; edev_ctl->panic_on_ue = LLCC_ERP_PANIC_ON_UE; - rc = edac_device_add_device(edev_ctl); - if (rc) - goto out_mem; - - platform_set_drvdata(pdev, edev_ctl); - - /* Request for ecc irq */ + /* Check if LLCC driver has passed ECC IRQ */ ecc_irq = llcc_driv_data->ecc_irq; - if (ecc_irq < 0) { - rc = -ENODEV; - goto out_dev; - } - rc = devm_request_irq(dev, ecc_irq, llcc_ecc_irq_handler, + if (ecc_irq > 0) { + /* Use interrupt mode if IRQ is available */ + rc = devm_request_irq(dev, ecc_irq, llcc_ecc_irq_handler, IRQF_TRIGGER_HIGH, "llcc_ecc", edev_ctl); - if (rc) - goto out_dev; + if (!rc) { + edac_op_state = EDAC_OPSTATE_INT; + goto irq_done; + } + } - return rc; + /* Fall back to polling mode otherwise */ + edev_ctl->poll_msec = ECC_POLL_MSEC; + edev_ctl->edac_check = llcc_ecc_check; + edac_op_state = EDAC_OPSTATE_POLL; -out_dev: - edac_device_del_device(edev_ctl->dev); -out_mem: - edac_device_free_ctl_info(edev_ctl); +irq_done: + rc = edac_device_add_device(edev_ctl); + if (rc) { + edac_device_free_ctl_info(edev_ctl); + return rc; + } + + platform_set_drvdata(pdev, edev_ctl); return rc; } diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index 72f3f2a9aaa0..7b7c5a38bac6 100644 --- a/drivers/soc/qcom/llcc-qcom.c +++ b/drivers/soc/qcom/llcc-qcom.c @@ -1011,13 +1011,12 @@ static int qcom_llcc_probe(struct platform_device *pdev) goto err; drv_data->ecc_irq = platform_get_irq_optional(pdev, 0); - if (drv_data->ecc_irq >= 0) { - llcc_edac = platform_device_register_data(&pdev->dev, - "qcom_llcc_edac", -1, drv_data, - sizeof(*drv_data)); - if (IS_ERR(llcc_edac)) - dev_err(dev, "Failed to register llcc edac driver\n"); - } + + llcc_edac = platform_device_register_data(&pdev->dev, + "qcom_llcc_edac", -1, drv_data, + sizeof(*drv_data)); + if (IS_ERR(llcc_edac)) + dev_err(dev, "Failed to register llcc edac driver\n"); return 0; err: