Skip to contentSkip to conversation

x86: punit_atom: punit device state debug driver

PATCH In review Srinivas Pandruvada 2 participants 3 messages Apr 24, 2015 – Apr 29, 2015 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: punit_atom: punit device state debug driver

The patch adds a debug driver, which dumps the power states of all the North complex (NC) devices. This debug interface is useful to figure out the NC IPs which blocks the S0ix transitions on the platform. This is extremely useful during enabling PM on customer platforms and derivatives.

This submission not a complete rewrite from the original submission from Kumar P, Mahesh <mahesh.kumar.p.intel.com>.
https://lkml.org/lkml/2014/11/5/367
The changes are:
- Dropped changes to config for PMC_ATOM, as PMC_ATOM is not just a debug driver as suggested by the change. It has additional power off interface also.
- Instead of just using nc ("North complex") use punit_.. similar to south complex PMC. All the interfaces exposed by this driver are provided by PUNIT.
- Removed pmc_config structure, as we don't need to predefine number of register, we want to dump. This way new register can be added without changing NC_NUM_DEVICES.
- prefixed function with punit_
- The debugfs directory will be punit_atom, which is NC equivalent of pmc_atom, which we already exposed by pmc_atom driver.

---
 arch/x86/Kconfig             |  10 +++
 arch/x86/kernel/Makefile     |   1 +
 arch/x86/kernel/punit_atom.c | 167 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 178 insertions(+)
 create mode 100644 arch/x86/kernel/punit_atom.c
arch/x86/Kconfig +10 -0
index b7d31ca..b8e6de6 100644
@@ -2578,6 +2578,16 @@ config PMC_ATOM
 	def_bool y
         depends on PCI
 
+config PUNIT_ATOM
+	bool "ATOM Punit debug driver"
+	def_bool n
+	depends on DEBUG_FS
+	select IOSF_MBI
+	---help---
+	  This is a debug driver, which gets the power states
+	  of all Punit North Complex devices.The power states of
+	  each IP is exposed as part of the debugfs interface.
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
arch/x86/kernel/Makefile +1 -0
index cdb1b70..8ee5fb3 100644
@@ -110,6 +110,7 @@ obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o
 obj-$(CONFIG_TRACING)			+= tracepoint.o
 obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
 obj-$(CONFIG_PMC_ATOM)			+= pmc_atom.o
+obj-$(CONFIG_PUNIT_ATOM)		+= punit_atom.o
 
 ###
 # 64 bit specific files
arch/x86/kernel/punit_atom.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

arch/x86/Kconfig config PMC_ATOM · line 2583

Quoted 6 lines · Srinivas Pandruvada
arch/x86/Kconfig +3 -0
 
+config PUNIT_ATOM
+	bool "ATOM Punit debug driver"
+	def_bool n

The kconfig tools will do what you mean here. But just
default n

is neater. And, moreover, even that is probably not needed, as n is the default anyway.

arch/x86/Kconfig config PMC_ATOM · line 2589

Quoted 6 lines
arch/x86/Kconfig +6 -0
+	depends on DEBUG_FS
+	select IOSF_MBI
+	---help---
+	  This is a debug driver, which gets the power states
+	  of all Punit North Complex devices.The power states of
+	  each IP is exposed as part of the debugfs interface.

(This menu will show up in menuconfig's main menu. Shouldn't this be put in some debug related menu?)

arch/x86/kernel/Makefile

Quoted 4 lines
arch/x86/kernel/Makefile +1 -0
 
+obj-$(CONFIG_PUNIT_ATOM)		+= punit_atom.o

PUNIT_ATOM is a bool symbol, so punit_atom.o will never be part of a module, correct?

arch/x86/kernel/punit_atom.c

Quoted 4 lines
arch/x86/kernel/punit_atom.c new file +1 -0
 
+#include <linux/module.h>

Is this include needed (except for the stuff that will be preprocessed away, see below)?

Quoted 1 line

+MODULE_DEVICE_TABLE(x86cpu, intel_punit_cpu_ids);

MODULE_DEVICE_TABLE will be preprocessed away for built-in code, according to include/linux/module.h.

arch/x86/kernel/punit_atom.c line 162

Quoted 6 lines
arch/x86/kernel/punit_atom.c new file +6 -0
+static void __exit punit_atom_exit(void)
+{
+	punit_dbgfs_unregister();
+}
+
+module_init(punit_atom_init);

According to include/linux/init.h this is equal to

	device_initcall(punit_atom_init);

for built-in code.

Quoted 1 line

+module_exit(punit_atom_exit);

Built-in only code will never call that function.

Quoted 1 line

+MODULE_AUTHOR("Kumar P, Mahesh <mahesh.kumar.p.intel.com>");

(<[email protected]>?)

arch/x86/kernel/punit_atom.c line 167

Quoted 2 lines
arch/x86/kernel/punit_atom.c new file +2 -0
+MODULE_DESCRIPTION("Driver for Punit devices states debugging");
+MODULE_LICENSE("GPL v2");

And these three macros will be effectively preprocessed away for built-in only code.

But, on the other hand, changing PUNIT_ATOM to tristate allows it to be built as a module (I just did that). So perhaps that was your intention?

Paul Bolle

#2 lore raw
Quoted 14 lines · Paul Bolle

arch/x86/Kconfig config PMC_ATOM · line 2583

Quoted 6 lines · Srinivas Pandruvada
arch/x86/Kconfig +3 -0
 
+config PUNIT_ATOM
+	bool "ATOM Punit debug driver"
+	def_bool n

The kconfig tools will do what you mean here. But just
default n

is neater. And, moreover, even that is probably not needed, as n is the default anyway.

Quoted 9 lines

arch/x86/Kconfig config PMC_ATOM · line 2589

Quoted 6 lines
arch/x86/Kconfig +6 -0
+	depends on DEBUG_FS
+	select IOSF_MBI
+	---help---
+	  This is a debug driver, which gets the power states
+	  of all Punit North Complex devices.The power states of
+	  each IP is exposed as part of the debugfs interface.

(This menu will show up in menuconfig's main menu. Shouldn't this be put in some debug related menu?)

The initial intention is to make a debug driver only, but there is possibility that some register setting be allowed from user space for PM decision. So leaving open this possibility to keep out of debug menus.

<snip>

Quoted 5 lines

And these three macros will be effectively preprocessed away for built-in only code.

But, on the other hand, changing PUNIT_ATOM to tristate allows it to be built as a module (I just did that). So perhaps that was your intention?

Making tristate makes sense. So I will send an update with this.

Thanks,
Srinivas

Quoted 4 lines

Paul Bolle