Skip to contentSkip to conversation

platform/x86: intel_pmc_core: export platform global_reset via sysfs.

PATCH Superseded Tomas Winkler 1 participant 1 message Apr 2, 2021

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 platform/x86: intel_pmc_core: export platform global_reset via sysfs.

From: Tamar Mashiah <[email protected]>

During PCH manufacturing a global reset has to be induced in order for configuration changes take affect upon following platform reset. This setting was commonly done by accessing PMC registers via /dev/mem but due to security concern /dev/mem access is much restricted, hence the reason for exposing this setting via dedicated sysfs interface. To prevent post manufacturing abuse the register is protected by hardware locking.

The register in MMIO space is defined for Cannon Lake and newer PCHs.

---
V2:
1. Add locking for reading the ET3 register (Andy)
2. Fix few style issues (Andy)
V3:
1. Resend

 .../ABI/testing/sysfs-platform-intel-pmc      | 11 +++
 MAINTAINERS                                   |  1 +
 drivers/platform/x86/intel_pmc_core.c         | 97 +++++++++++++++++++
 drivers/platform/x86/intel_pmc_core.h         |  6 ++
 4 files changed, 115 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-intel-pmc
Documentation/ABI/testing/sysfs-platform-intel-pmc new file +11 -0
new file mode 100644
index 000000000000..7ce00e77fbcd
@@ -0,0 +1,11 @@
+What:		/sys/devices/platform/<platform>/global_reset
+Date:		Apr 2021
+KernelVersion:	5.13
+Contact:	"Tomas Winkler" <[email protected]>
+Description:
+		Display global reset setting bits for PMC.
+			* bit 31 - global reset is locked
+			* bit 20 - global reset is set
+		Writing bit 20 value to the global_reset will induce
+		a platform global reset upon consequent platform reset.
+		in case the register is not locked.
MAINTAINERS +1 -0
index 04f68e0cda64..618676eba8c8 100644
@@ -9166,6 +9166,7 @@ M:	Rajneesh Bhardwaj <[email protected]>
 M:	David E Box <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/ABI/testing/sysfs-platform-intel-pmc
 F:	drivers/platform/x86/intel_pmc_core*
 
 INTEL PMIC GPIO DRIVERS
drivers/platform/x86/intel_pmc_core.c +97 -0

127 lines not on this page · raw message

drivers/platform/x86/intel_pmc_core.h +6 -0
index f33cd2c34835..98ebdfe57138 100644
@@ -200,6 +200,11 @@ enum ppfear_regs {
 #define TGL_LPM_STATUS_OFFSET			0x1C3C
 #define TGL_LPM_LIVE_STATUS_OFFSET		0x1C5C
 
+/* Extended Test Mode Register 3 (CNL and later) */
+#define ETR3_OFFSET				0x1048
+#define ETR3_CF9GR				BIT(20)
+#define ETR3_CF9LOCK				BIT(31)
+
 const char *tgl_lpm_modes[] = {
 	"S0i2.0",
 	"S0i2.1",
@@ -263,6 +268,7 @@ struct pmc_reg_map {
 	const u32 lpm_residency_offset;
 	const u32 lpm_status_offset;
 	const u32 lpm_live_status_offset;
+	const u32 etr3_offset;
 };
 
 /**
Signature · 1 line
2.26.3