Skip to contentSkip to conversation

EDAC, dsm_edac: Wrap ACPI DSM methods for address translation

PATCH New Luck, Tony 1 participant 1 message Oct 8, 2018

Subsystems (2)
lore
Share & tools
lore

Luck, Tony

author maintainer
#0 lore raw

PATCH 4/5 EDAC, dsm_edac: Wrap ACPI DSM methods for address translation

Added linux-acpi list to Cc:

Quoted 8 lines · Borislav Petkov
Quoted 4 lines · Tony

It's like acpi_extlog.c in that it uses an ACPI DSM. Also related to error reporting. No, we aren't abandoning extlog, but it seems that fewer OEMs than we hoped are adopting eMCA and implementing the extended log in their BIOS.

Ok, but what is the difference with this DSM thing and why would OEMs use that? They get it for free from you? Or?

This shouldn't conflict with other BIOS "value add" code for firmware first mode, etc.

Yes, they get it for free with the reference/example BIOS code.

Quoted 7 lines
Quoted 5 lines

So I dropped Qiuxu's code into a blender and ran it on high for a few minutes. Below is an RFC patch (compiles, but otherwise untested) to see what things would looks like with a built in ACPI block with no registrations to EDAC core, or other stuff that is specific to the EDAC usage model.

Looks nice and clean to me.

Thanks!

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+int adxl_count;
+EXPORT_SYMBOL_GPL(adxl_count);

That's the length of the address components adxl_component_names array?

Yes. But see below.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+char **adxl_component_names;
+EXPORT_SYMBOL_GPL(adxl_component_names);

I guess I'm still unclear on how this is going to be used...

Comments added in new version to save people from mailing list archeology.

Quoted 11 lines

aha, the DSM replies with a bunch of components which map to the names and they'll get filled up by BIOS and the driver simply dumps them. Something along those lines at least.

So you don't need count if you NULL-terminate the names array, right?

So you can simply do

	kcalloc(cnt + 1, ...

and the last element will be NULL.

Good idea. Done in new version, and the EXPORT_SYMBOL_GPL(adxl_count) is gone.

Still untested ... Qiuxu, can you try this out please.

Rafael: Does this look like something you can merge (once we clean up any minor style stuff you find).

-Tony

drivers/acpi/Kconfig +10 -0
index dd1eea90f67f..327c93b51cb7 100644
@@ -498,6 +498,16 @@ config ACPI_EXTLOG
 	  driver adds support for that functionality with corresponding
 	  tracepoint which carries that information to userspace.
 
+config ACPI_ADXL
+	bool "Physical address to DIMM address translation"
+	def_bool n
+	help
+	  Enable interface that calls into BIOS using a DSM (device
+	  specific method) to convert system physical addresses
+	  to DIMM (socket, channel, rank, dimm, etc.).
+	  Only available on some servers.
+	  Used by newer EDAC drivers.
+
 menuconfig PMIC_OPREGION
 	bool "PMIC (Power Management Integrated Circuit) operation region support"
 	help
drivers/acpi/Makefile +3 -0
index 6d59aa109a91..edc039313cd6 100644
@@ -61,6 +61,9 @@ acpi-$(CONFIG_ACPI_LPIT)	+= acpi_lpit.o
 acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
 acpi-$(CONFIG_ACPI_WATCHDOG)	+= acpi_watchdog.o
 
+# Address translation
+acpi-$(CONFIG_ACPI_ADXL)	+= acpi_adxl.o
+
 # These are (potentially) separate modules
 
 # IPMI may be used by other drivers, so it has to initialise before them
drivers/acpi/acpi_adxl.c new file +179 -0

179 lines not on this page · raw message

include/linux/adxl.h new file +25 -0
new file mode 100644
index 000000000000..96d356a06e8b
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Address translation interface via ACPI DSM.
+ * Copyright (C) 2018 Intel Corporation
+ */
+
+#ifndef _LINUX_ADXL_H
+#define _LINUX_ADXL_H
+
+#ifdef CONFIG_ACPI_ADXL
+char **adxl_get_component_names(void);
+int adxl_decode(u64 addr, u64 component_values[]);
+#else
+static inline char **adxl_get_component_names(void)
+{
+	return NULL;
+}
+
+static inline int adxl_decode(u64 addr, u64 component_values[])
+{
+	return -EOPNOTSUPP;
+}
+#endif
+
+#endif /* _LINUX_ADXL_H */