mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Christian Gmeiner <christian.gmeiner@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>,
	etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel@ffwll.ch>,
	Russell King <linux+etnaviv@armlinux.org.uk>
Subject: Re: [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
Date: Fri, 13 Sep 2019 10:53:25 +0200	[thread overview]
Message-ID: <a4f36fed24c8c2a1e9228ee178fe16f2957b3ffb.camel@pengutronix.de> (raw)
In-Reply-To: <20190913055052.25599-2-christian.gmeiner@gmail.com>

On Fr, 2019-09-13 at 07:50 +0200, Christian Gmeiner wrote:
> Might be useful when debugging MMU exceptions.
> 
> Changes in V2:
>  - Use a static array of string for error message as suggested
>    by Lucas Stach.

Please move those changelogs below the 3 dashes, so they don't end up
in the commit message. They don't really add any value to the
persistent kernel history.

> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index d47d1a8e0219..b8cd85153fe0 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1351,6 +1351,15 @@ static void sync_point_worker(struct work_struct *work)
>  
>  static void dump_mmu_fault(struct etnaviv_gpu *gpu)
>  {
> +	static const char *errors[] = {
> +		"slave not present",
> +		"page not present",
> +		"write violation",
> +		"out of bound",
> +		"read security violation",
> +		"write security violation",
> +	};
> +
>  	u32 status_reg, status;
>  	int i;
>  
> @@ -1364,10 +1373,16 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
>  
>  	for (i = 0; i < 4; i++) {
>  		u32 address_reg;
> +		const char *error = "unknown state";
>  
>  		if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
>  			continue;
>  
> +		if (status < ARRAY_SIZE(errors))
> +			error = errors[status];

Huh? This won't work. The status register is a bitfield, not an integer
so you need to map the bit position to the array index via ffs() or
something like that.

Regards,
Lucas

> +
> +		dev_err_ratelimited(gpu->dev, "MMU %d %s\n", i, error);
> +
>  		if (gpu->sec_mode == ETNA_SEC_NONE)
>  			address_reg = VIVS_MMUv2_EXCEPTION_ADDR(i);
>  		else


      reply	other threads:[~2019-09-13  8:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13  5:50 [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb Christian Gmeiner
2019-09-13  5:50 ` [PATCH v2 2/2] drm/etnaviv: print MMU exception cause Christian Gmeiner
2019-09-13  8:53   ` Lucas Stach [this message]

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=a4f36fed24c8c2a1e9228ee178fe16f2957b3ffb.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=airlied@linux.ie \
    --cc=christian.gmeiner@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®