[PATCH 2/2] drm/etnaviv: print MMU exception cause
Christian Gmeiner
christian.gmeiner at gmail.com
Fri Sep 6 13:57:26 UTC 2019
Am Fr., 6. Sept. 2019 um 12:55 Uhr schrieb Lucas Stach <l.stach at pengutronix.de>:
>
> On Fr, 2019-09-06 at 12:03 +0200, Christian Gmeiner wrote:
> > Might be useful when debugging MMU exceptions.
> >
> > Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> > ---
> > drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 26
> > ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > index d47d1a8e0219..aa878dd05860 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > @@ -1364,10 +1364,36 @@ static void dump_mmu_fault(struct etnaviv_gpu
> > *gpu)
> >
> > for (i = 0; i < 4; i++) {
> > u32 address_reg;
> > + const char *error;
> >
> > if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK <<
> > (i * 4))))
> > continue;
> >
> > + switch (status) {
> > + case MMU_EXCEPTION_SLAVE_NOT_PRESENT:
> > + error = "slave not present";
> > + break;
> > + case MMU_EXCEPTION_PAGE_NOT_PRESENT:
> > + error = "page not present";
> > + break;
> > + case MMU_EXCEPTION_WRITE_VIOLATION:
> > + error = "write violation";
> > + break;
> > + case MMU_EXCEPTION_OUT_OF_BOUND:
> > + error = "out of bound";
> > + break;
> > + case MMU_EXCEPTION_READ_SECURITY_VIOLATION:
> > + error = "read security violation";
> > + break;
> > + case MMU_EXCEPTION_WRITE_SECURITY_VIOLATION:
> > + error = "write security violation";
> > + break;
> > + default:
> > + error = "unknown state";
> > + break;
> > + }
>
> As the exception status is a nice contiguous set of bits, I think this
> could be simplified into a static array of strings. The error message
> could then just use the bit position to index into the array.
>
I like the idea .. will be done in V2. Thanks for your quick review!
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info/privacypolicy
More information about the dri-devel
mailing list