Linux EDAC development
 help / color / mirror / Atom feed
From: Orange Kao <orange@aiven.io>
To: tony.luck@intel.com, qiuxu.zhuo@intel.com
Cc: bp@alien8.de, james.morse@arm.com, orange@kaosy.org,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	mchehab@kernel.org, rric@kernel.org
Subject: [PATCH 1/3] EDAC/igen6: Initialize edac_op_state according to the configuration data
Date: Wed,  6 Nov 2024 11:35:45 +0000	[thread overview]
Message-ID: <20241106114024.941659-2-orange@aiven.io> (raw)
In-Reply-To: <20241106114024.941659-1-orange@aiven.io>

From: Qiuxu Zhuo <qiuxu.zhuo@intel.com>

Currently, igen6_edac sets edac_op_state to EDAC_OPSTATE_NMI, while the
driver also supports memory errors reported from Machine Check. Initialize
edac_op_state to the correct value according to the configuration data
that the driver probed.

Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 drivers/edac/igen6_edac.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index 07dacf8c10be..fa488ba15059 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -1350,6 +1350,15 @@ static void unregister_err_handler(void)
 	unregister_nmi_handler(NMI_SERR, IGEN6_NMI_NAME);
 }
 
+static void opstate_set(struct res_config *cfg)
+{
+	/* Set the mode according to the configuration data. */
+	if (cfg->machine_check)
+		edac_op_state = EDAC_OPSTATE_INT;
+	else
+		edac_op_state = EDAC_OPSTATE_NMI;
+}
+
 static int igen6_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	u64 mchbar;
@@ -1367,6 +1376,8 @@ static int igen6_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (rc)
 		goto fail;
 
+	opstate_set(res_cfg);
+
 	for (i = 0; i < res_cfg->num_imc; i++) {
 		rc = igen6_register_mci(i, mchbar, pdev);
 		if (rc)
@@ -1450,8 +1461,6 @@ static int __init igen6_init(void)
 	if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
 		return -EBUSY;
 
-	edac_op_state = EDAC_OPSTATE_NMI;
-
 	rc = pci_register_driver(&igen6_driver);
 	if (rc)
 		return rc;
-- 
2.47.0


  reply	other threads:[~2024-11-06 11:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 11:35 [PATCH 0/3] EDAC/igen6: Add polling support and allow setting edac_op_state Orange Kao
2024-11-06 11:35 ` Orange Kao [this message]
2024-11-06 11:35 ` [PATCH 2/3] EDAC/igen6: Add polling support Orange Kao
2024-11-07 11:53   ` Zhuo, Qiuxu
2024-11-06 11:35 ` [PATCH 3/3] EDAC/igen6: Allow setting edac_op_state Orange Kao
2024-11-06 13:04   ` Zhuo, Qiuxu
2024-11-06 21:23     ` Orange Kao
2024-11-06 12:05 ` [PATCH 0/3] EDAC/igen6: Add polling support and allow " Borislav Petkov
2024-11-08 21:44 ` Tony Luck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241106114024.941659-2-orange@aiven.io \
    --to=orange@aiven.io \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=orange@kaosy.org \
    --cc=qiuxu.zhuo@intel.com \
    --cc=rric@kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox