All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] tools/intel_reg: Add option to skip forcewake
Date: Fri, 28 Aug 2015 18:16:04 +0300	[thread overview]
Message-ID: <87bndrxx3f.fsf@intel.com> (raw)
In-Reply-To: <1440773507-21799-3-git-send-email-mika.kuoppala@intel.com>

On Fri, 28 Aug 2015, Mika Kuoppala <mika.kuoppala@linux.intel.com> wrote:
> Sometimes we want to inspect the hardware as it is,
> without doing the forcewake before access. Add option to skip
> the forcewake dance.

This needs a manual page update.

Some trivial comments below, otherwise lgtm.

>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  tools/intel_reg.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/tools/intel_reg.c b/tools/intel_reg.c
> index b082555..c73b9ef 100644
> --- a/tools/intel_reg.c
> +++ b/tools/intel_reg.c
> @@ -70,12 +70,16 @@ struct config {
>  	/* spread out bits for convenience */
>  	bool binary;
>  
> +	/* dont take forcewake on register access */
> +	int nofw;

IMO should be a bool.


> +
>  	/* register spec */
>  	char *specfile;
>  	struct reg *regs;
>  	ssize_t regcount;
>  
>  	int verbosity;
> +

Superfluous whitespace change.

>  };
>  
>  /* port desc must have been set */
> @@ -409,7 +413,7 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
>  	if (config->mmiofile)
>  		intel_mmio_use_dump_file(config->mmiofile);
>  	else
> -		intel_register_access_init(config->pci_dev, 0, 0);
> +		intel_register_access_init(config->pci_dev, 0, config->nofw);
>  
>  	for (i = 1; i < argc; i++) {
>  		struct reg reg;
> @@ -439,7 +443,7 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
>  		return EXIT_FAILURE;
>  	}
>  
> -	intel_register_access_init(config->pci_dev, 0, 0);
> +	intel_register_access_init(config->pci_dev, 0, config->nofw);
>  
>  	for (i = 1; i < argc; i += 2) {
>  		struct reg reg;
> @@ -477,7 +481,7 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
>  	if (config->mmiofile)
>  		intel_mmio_use_dump_file(config->mmiofile);
>  	else
> -		intel_register_access_init(config->pci_dev, 0, 0);
> +		intel_register_access_init(config->pci_dev, 0, config->nofw);
>  
>  	for (i = 0; i < config->regcount; i++) {
>  		reg = &config->regs[i];
> @@ -637,6 +641,7 @@ static int intel_reg_help(struct config *config, int argc, char *argv[])
>  	printf(" --all          Decode registers for all known platforms\n");
>  	printf(" --binary       Binary dump registers\n");
>  	printf(" --verbose      Increase verbosity\n");
> +	printf(" --nofw         No forcewake on register access (DANGEROUS)\n");
>  	printf(" --quiet        Reduce verbosity\n");
>  
>  	printf("\n");
> @@ -769,6 +774,7 @@ enum opt {
>  	OPT_BINARY,
>  	OPT_SPEC,
>  	OPT_VERBOSE,
> +	OPT_NOFW,
>  	OPT_QUIET,
>  	OPT_HELP,
>  };
> @@ -781,6 +787,7 @@ int main(int argc, char *argv[])
>  	const struct command *command = NULL;
>  	struct config config = {
>  		.count = 1,
> +		.nofw = 0,

No need to initialize to zero.

>  	};
>  	bool help = false;
>  
> @@ -800,6 +807,7 @@ int main(int argc, char *argv[])
>  		/* options specific to read, dump and decode */
>  		{ "all",	no_argument,		NULL,	OPT_ALL },
>  		{ "binary",	no_argument,		NULL,	OPT_BINARY },
> +		{ "nofw",	no_argument,		NULL,	OPT_NOFW },
>  		{ 0 }
>  	};
>  
> @@ -846,6 +854,9 @@ int main(int argc, char *argv[])
>  		case OPT_BINARY:
>  			config.binary = true;
>  			break;
> +		case OPT_NOFW:
> +			config.nofw = 1;

= true;

> +			break;
>  		case OPT_VERBOSE:
>  			config.verbosity++;
>  			break;
> -- 
> 2.1.4
>

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-08-28 15:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 14:51 [PATCH 1/3] tools/intel_reg: Use pci device from config on write Mika Kuoppala
2015-08-28 14:51 ` [PATCH 2/3] lib: Optionally initialize mmio register access without forcewake Mika Kuoppala
2015-08-28 15:12   ` Jani Nikula
2015-08-28 15:44   ` Ville Syrjälä
2015-08-28 14:51 ` [PATCH 3/3] tools/intel_reg: Add option to skip forcewake Mika Kuoppala
2015-08-28 15:16   ` Jani Nikula [this message]
2015-08-28 15:16 ` [PATCH 1/3] tools/intel_reg: Use pci device from config on write Jani Nikula
2015-09-09 13:50   ` Thomas Wood

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=87bndrxx3f.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    /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.