diff mbox series

[v2,24/24] EDAC, ghes: Disable legacy API for ARM64

Message ID 20190624150758.6695-25-rrichter@marvell.com
State New
Headers show
Series EDAC, mc, ghes: Fixes and updates to improve memory error reporting | expand

Commit Message

Robert Richter June 24, 2019, 3:09 p.m. UTC
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@marvell.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(-)

-- 
2.20.1

Comments

James Morse June 26, 2019, 9:33 a.m. UTC | #1
On 24/06/2019 16:09, Robert Richter wrote:
> James Morse: "I'm all for removing/warning-its-broken it when

> ghes_edac is in use."


Thanks for taking that out of context. The very next word was 'but':
http://lore.kernel.org/r/c08290d8-3690-efa9-3bc7-37f8b1fdbfd4@arm.com

followed by details of the user-space that is still using this.


> 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


Not could. Are. Someone went and found them for you.


> use this interface that cannot be used any longer after a transition

> from x86 to arm64.
Robert Richter June 26, 2019, 10:11 a.m. UTC | #2
On 26.06.19 10:33:39, James Morse wrote:
> On 24/06/2019 16:09, Robert Richter wrote:

> > James Morse: "I'm all for removing/warning-its-broken it when

> > ghes_edac is in use."

> 

> Thanks for taking that out of context. The very next word was 'but':

> http://lore.kernel.org/r/c08290d8-3690-efa9-3bc7-37f8b1fdbfd4@arm.com

> 

> followed by details of the user-space that is still using this.

> 

> 

> > 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

> 

> Not could. Are. Someone went and found them for you.

> 

> 

> > use this interface that cannot be used any longer after a transition

> > from x86 to arm64.


Ok, thanks for clarifying.

-Robert
diff mbox series

Patch

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);