All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, linux-kernel@vger.kernel.org, pebolle@tiscali.nl,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v1] x86: punit_atom: punit device state debug driver
Date: Sat, 2 May 2015 08:00:51 +0200	[thread overview]
Message-ID: <20150502060050.GA10932@gmail.com> (raw)
In-Reply-To: <1430521630-19788-2-git-send-email-srinivas.pandruvada@linux.intel.com>


* Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> wrote:

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

Looks useful.

> 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

This sentence does not parse. Did you mean 'is a complete rewrite'?

> +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 IP is exposed as part of the debugfs interface.

What is an 'IP'?

Also:

      s/devices.The
       /devices. The

> +
>  endmenu
> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> index cdb1b70..2ecbd55 100644
> --- a/arch/x86/kernel/Makefile
> +++ b/arch/x86/kernel/Makefile
> @@ -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_DEBUG)		+= punit_atom_debug.o
>  
>  ###
>  # 64 bit specific files
> diff --git a/arch/x86/kernel/punit_atom_debug.c b/arch/x86/kernel/punit_atom_debug.c

Please put this somewhere suitable in arch/x86/platform/.

> +/*
> + * Intel SOC Punit device state debug driver
> + * Copyright (c) 2015, Intel Corporation.

Would be nice to add a blurb about what 'Intel SOC Punit' systems are. 
There doesn't seem to be anything in the kernel source about it, so 
you have a golden opportunity here.

> +#define PUNIT_PORT		0x04
> +#define PWRGT_STATUS		0x61 /* Power gate status reg */
> +#define VED_SS_PM0		0x32 /* Subsystem config/status Video */
> +#define ISP_SS_PM0		0x39 /* Subsystem config/status ISP */
> +#define MIO_SS_PM		0x3B /* Subsystem config/status MIO */
> +#define SSS_SHIFT		24
> +#define RENDER_POS		0
> +#define MEDIA_POS		2
> +#define VLV_DISPLAY_POS		6
> +#define CHT_DSP_SSS		0x36 /* Subsystem config/status DSP */
> +#define CHT_DSP_SSS_POS		16

All the magic constants need some explanation for humans, not just 
some.

> +static const struct punit_device punit_device_byt[] = {
> +	{ "GFX RENDER", PWRGT_STATUS, RENDER_POS },
> +	{ "GFX MEDIA", PWRGT_STATUS, MEDIA_POS },
> +	{ "DISPLAY", PWRGT_STATUS, VLV_DISPLAY_POS },
> +	{ "VED", VED_SS_PM0, SSS_SHIFT},
> +	{ "ISP", ISP_SS_PM0, SSS_SHIFT},
> +	{ "MIO", MIO_SS_PM, SSS_SHIFT},
> +	{ NULL}
> +};
> +
> +static const struct punit_device punit_device_cht[] = {
> +	{ "GFX RENDER", PWRGT_STATUS, RENDER_POS },
> +	{ "GFX MEDIA", PWRGT_STATUS, MEDIA_POS },
> +	{ "DSP", CHT_DSP_SSS,  CHT_DSP_SSS_POS },
> +	{ "VED", VED_SS_PM0, SSS_SHIFT},
> +	{ "ISP", ISP_SS_PM0, SSS_SHIFT},
> +	{ "MIO", MIO_SS_PM, SSS_SHIFT},
> +	{ NULL}
> +};

Please align such initialization tables vertically, like you did here:

> +static const struct file_operations punit_dev_state_ops = {
> +	.open		= punit_dev_state_open,
> +	.read		= seq_read,
> +	.llseek		= seq_lseek,
> +	.release	= single_release,
> +};


> +	punit_dbg_file = debugfs_create_dir("punit_atom", NULL);
> +	if (!punit_dbg_file)
> +		return -ENXIO;
> +
> +	dev_state = debugfs_create_file("dev_state", S_IFREG | S_IRUGO,
> +					 punit_dbg_file, NULL,
> +					 &punit_dev_state_ops);

So why isn't something that is declaradly a power state dump, called 
"power_state" or "dev_power_state"?

> +MODULE_AUTHOR("Kumar P, Mahesh <mahesh.kumar.p.intel.com>");
> +MODULE_DESCRIPTION("Driver for Punit devices states debugging");
> +MODULE_LICENSE("GPL v2");

Btw., you can have multiple MODULE_AUTHOR() lines, so you can credit
yourself as well. Take a look at drivers/net/wireless/at76c50x-usb.c's 
MODULE_AUTHOR() for grins.

Thanks,

	Ingo

  reply	other threads:[~2015-05-02  6:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 23:07 [PATCH v1] x86: punit_atom: punit device state debug driver Srinivas Pandruvada
2015-05-01 23:07 ` Srinivas Pandruvada
2015-05-02  6:00   ` Ingo Molnar [this message]
2015-05-02  8:56     ` Borislav Petkov
2015-05-04 18:17     ` Srinivas Pandruvada
2015-05-05 17:29     ` Srinivas Pandruvada
2015-05-06 10:16       ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150502060050.GA10932@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pebolle@tiscali.nl \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.