x86: punit_atom: punit device state debug driver
Subsystems (2)
PATCH v3 1/1 x86: punit_atom: punit device state debug driver
v3
Fixed biggest blunder
consecutive read output
#cat /sys/kernel/debug/punit_atom# cat dev_power_state
PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0#/sys/kernel/debug/punit_atom# cat dev_power_state
PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0#cat /sys/kernel/debug/punit_atom# cat dev_power_state
PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0# cat /sys/kernel/debug/punit_atom# cat dev_power_state
PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0v2
Addressed Ingo Molnar's comments
- Fix commit message
- Added punit explanation
- Formatting comments
- Moved to arch/x86/platform/intel_mid
- changed the debugfs file name
v1
Based on review comments
- Changed to tristate instead of bool
- Moved config to kconfig.debug
- Added debug in module name
- Returning -ENXIO on debugfs file create error
v0:
Base version
Srinivas Pandruvada (1):
x86: punit_atom: punit device state debug driver
arch/x86/Kconfig.debug | 9 ++ arch/x86/platform/intel-mid/Makefile | 2 + arch/x86/platform/intel-mid/punit_atom_debug.c | 186 +++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 arch/x86/platform/intel-mid/punit_atom_debug.c
Signature · 1 line
1.9.1
PATCH v3 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 devices, which blocks the S0ix transitions on the platform. This is extremely useful during enabling PM on customer platforms and derivatives.
This submission is based on the submission from
Kumar P, Mahesh <mahesh.kumar.p.intel.com>.
https://lkml.org/lkml/2014/11/5/367
The changes done on top of the above submission:
- 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.
- 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.
- Added explanation for register and shift defines
- Will not create debugfs if the cpuid doesn't match
- Formatting changes to match compliance to coding convention
- Address review comments
--- arch/x86/Kconfig.debug | 9 ++ arch/x86/platform/intel-mid/Makefile | 2 + arch/x86/platform/intel-mid/punit_atom_debug.c | 186 +++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 arch/x86/platform/intel-mid/punit_atom_debug.c
arch/x86/Kconfig.debug +9 -0
@@ -336,4 +336,13 @@ config X86_DEBUG_STATIC_CPU_HAS If unsure, say N. +config PUNIT_ATOM_DEBUG + tristate "ATOM Punit debug driver" + 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 device is exposed as part of the debugfs interface. + endmenu
arch/x86/platform/intel-mid/Makefile +2 -0
@@ -5,3 +5,5 @@ obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o ifdef CONFIG_X86_INTEL_MID obj-$(CONFIG_SFI) += sfi.o device_libs/ endif + +obj-$(CONFIG_PUNIT_ATOM_DEBUG) += punit_atom_debug.o
arch/x86/platform/intel-mid/punit_atom_debug.c new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 5 lines · Srinivas Pandruvada
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 devices, which blocks the S0ix transitions on the platform. This is extremely useful during enabling PM on customer platforms and derivatives.
Looks mostly good. Small nits:
arch/x86/Kconfig.debug config X86_DEBUG_STATIC_CPU_HAS · line 342
Quoted 4 lines
arch/x86/Kconfig.debug +4
-0+config PUNIT_ATOM_DEBUG + tristate "ATOM Punit debug driver" + depends on DEBUG_FS + select IOSF_MBI
I suspect you could select DEBUG_FS as well? Half of the drivers seem to do that.
arch/x86/Kconfig.debug config X86_DEBUG_STATIC_CPU_HAS · line 346
Quoted 4 lines
arch/x86/Kconfig.debug +4
-0+ ---help--- + This is a debug driver, which gets the power states + of all Punit North Complex devices. The power states of + each device is exposed as part of the debugfs interface.
Might as well mention the path of the file? To keep people from guessing and so.
arch/x86/platform/intel-mid/punit_atom_debug.c line 84
Quoted 4 lines
arch/x86/platform/intel-mid/punit_atom_debug.c new file +4
-0+static int punit_dev_state_show (struct seq_file *seq_file,void *unused) +{ +u32 punit_pwr_status; +struct punit_device *punit_devp = punit_device;
You could stick stick 'punit_device' into s->private? You do that by passing it to debugfs_create_file(). That way you could avoid the fugly static allocation of 'punit_device' and its global setting in punit_atom_debug_init().
Quoted 6 lines
arch/x86/platform/intel-mid/punit_atom_debug.c new file +6
-0+int index; +int status; + +seq_puts (seq_file,"\n\nPUNIT NORTH COMPLEX DEVICES :\n" ); +while (punit_devp->name) { + status = iosf_mbi_read(PUNIT_PORT, BT_MBI_PMC_READ,
arch/x86/platform/intel-mid/punit_atom_debug.c line 100
Quoted 10 lines
arch/x86/platform/intel-mid/punit_atom_debug.c new file +10
-0+ punit_devp->reg, + &punit_pwr_status); +if (status) +seq_printf (seq_file,"%9s : Read Failed\n" , + punit_devp->name); +else { + index = (punit_pwr_status >> punit_devp->sss_pos) &3 ; +seq_printf (seq_file,"%9s : %s\n" , punit_devp->name, + dstates[index]); + }
We only use symmetric curly braces in the kernel.
arch/x86/platform/intel-mid/punit_atom_debug.c line 153
Quoted 9 lines
arch/x86/platform/intel-mid/punit_atom_debug.c new file +9
-0+#define ICPU (model, drv_data) \ + { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT,\ + (kernel_ulong_t)&drv_data } + +static const struct x86_cpu_id intel_punit_cpu_ids[] = { +ICPU (0x4c , punit_device_cht), +ICPU (0x37 , punit_device_byt), + {} +};
So should the models be listed in increasing order?
Also, I'd use decimal, as we do for models typically. Also, might as well mention which Intel Atom models those are: 22nm Atom "Silvermont" and 14nm Atom "Airmont", right?
Thanks,
Ingo
Quoted 4 lines · Srinivas Pandruvada
v3
Fixed biggest blunderconsecutive read output
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat dev_power_state
PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0
root@VALLEYVIEW-C0-PLATFORM:/sys/kernel/debug/punit_atom# cat
dev_power_state PUNIT NORTH COMPLEX DEVICES :
GFX RENDER : D0i3
GFX MEDIA : D0i3
DISPLAY : D0i3
VED : D0i3
ISP : D0i3
MIO : D0Quoted 30 lines
v2
Addressed Ingo Molnar's comments
- Fix commit message
- Added punit explanation
- Formatting comments
- Moved toarch/x86/platform/intel_mid
- changed the debugfs file namev1
Based on review comments
- Changed to tristate instead of bool
- Moved config to kconfig.debug
- Added debug in module name
- Returning-ENXIOon debugfs file create errorv0:
Base versionSrinivas Pandruvada (1):
x86:punit_atom: punit device state debug driverarch/x86/Kconfig.debug | 9 ++ arch/x86/platform/intel-mid/Makefile | 2 + arch/x86/platform/intel-mid/punit_atom_debug.c | 186 +++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 arch/x86/platform/intel-mid/punit_atom_debug.c