[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190624150758.6695-25-rrichter@marvell.com>
Date: Mon, 24 Jun 2019 15:09:44 +0000
From: Robert Richter <rrichter@...vell.com>
To: Borislav Petkov <bp@...en8.de>, James Morse <james.morse@....com>,
"Mauro Carvalho Chehab" <mchehab@...nel.org>
CC: "linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Robert Richter <rrichter@...vell.com>
Subject: [PATCH v2 24/24] EDAC, ghes: Disable legacy API for ARM64
James Morse: "I'm all for removing/warning-its-broken it when
ghes_edac is in use."
Let's just disable legacy API for the ghes driver on arm64. Though, I
don't agree with it as there still could be some userland tools that
use this interface that cannot be used any longer after a transition
from x86 to arm64. I leave that decision up to James.
Signed-off-by: Robert Richter <rrichter@...vell.com>
---
drivers/edac/edac_mc.c | 34 +++++++++++++++++++++++++++-------
drivers/edac/edac_mc.h | 7 +++++++
drivers/edac/ghes_edac.c | 4 +++-
3 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 9383a1179b83..d7a120d7e304 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -276,16 +276,11 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems)
return (void *)(((unsigned long)ptr) + align - r);
}
-static void _edac_mc_free(struct mem_ctl_info *mci)
+static void _edac_mc_free_legacy(struct mem_ctl_info *mci)
{
- int i, chn, row;
+ int chn, row;
struct csrow_info *csr;
- if (mci->dimms) {
- for (i = 0; i < mci->tot_dimms; i++)
- kfree(mci->dimms[i]);
- kfree(mci->dimms);
- }
if (mci->csrows) {
for (row = 0; row < mci->nr_csrows; row++) {
csr = mci->csrows[row];
@@ -300,9 +295,34 @@ static void _edac_mc_free(struct mem_ctl_info *mci)
}
kfree(mci->csrows);
}
+}
+
+static void _edac_mc_free(struct mem_ctl_info *mci)
+{
+ int i;
+
+ if (mci->dimms) {
+ for (i = 0; i < mci->tot_dimms; i++)
+ kfree(mci->dimms[i]);
+ kfree(mci->dimms);
+ }
+
+ _edac_mc_free_legacy(mci);
+
kfree(mci);
}
+void edac_mc_disable_legacy_api(struct mem_ctl_info *mci)
+{
+#ifdef CONFIG_EDAC_LEGACY_SYSFS
+ _edac_mc_free_legacy(mci);
+ mci->nr_csrows = 0;
+ mci->num_cschannel = 0;
+ mci->csrows = NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(edac_mc_disable_legacy_api);
+
struct mem_ctl_info *__edac_mc_alloc(unsigned mc_num,
unsigned dimm_num,
unsigned n_layers,
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
index e8215847f853..d1bacc5f47f5 100644
--- a/drivers/edac/edac_mc.h
+++ b/drivers/edac/edac_mc.h
@@ -270,6 +270,13 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
const char *msg,
const char *other_detail);
+/**
+ * edac_mc_disable_legacy_api() - Disable legacy sysfs API
+ *
+ * @mci: a struct mem_ctl_info pointer
+ */
+void edac_mc_disable_legacy_api(struct mem_ctl_info *mci);
+
/*
* edac misc APIs
*/
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 714623204232..804e48773f66 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -780,7 +780,9 @@ ghes_edac_register_one(int nid, struct ghes *ghes, struct device *parent)
mci->dev_name = dev_name(dev);
mem_info_prepare_mci(mci);
-
+#ifdef CONFIG_ARM64
+ edac_mc_disable_legacy_api(mci);
+#endif
rc = edac_mc_add_mc(mci);
if (rc < 0) {
pr_err("Can't register at EDAC core (%d)\n", rc);
--
2.20.1
Powered by blists - more mailing lists