All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wladimir J. van der Laan" <laanwj@gmail.com>
To: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: etnaviv: mmu issue after end of address space reached?
Date: Sat, 10 Dec 2016 18:05:32 +0100	[thread overview]
Message-ID: <20161210170531.GA8923@amethyst.visucore.com> (raw)
In-Reply-To: <20161210114701.GE4766@amethyst.visucore.com>

> So the MMU fault is somehow specific to what I'm doing. Interesting.

I think I found the issue: the MMU "flush and sync" is not good enough in some
cases.

What the Vivante kernel driver does, for MMUv2, after mapping some kinds of
buffer objects (apparently those tagged INDEX and VERTEX, this includes shader
code and CL buffers) is 

- Send MMU flush command (like we do)
- Add a notify event "resume" (they hardwire event 29 for this)
- Add END command the command buffer so that the FE stops
- Remember where to continue

Then in the interrupt handler:

- If the "resume" notify event comes in
    - Wait for FE to be idle
    - Restart the FE to the remembered position

This is implemented in "pause" here http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c?id=77f61547834c4f127b44b13e43c59133a35880dc#n395
gcvPAGE_TABLE_DIRTY_BIT_FE is set here: http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c?id=77f61547834c4f127b44b13e43c59133a35880dc#n2176
endAfterFlushMmuCache is set here: http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c?id=77f61547834c4f127b44b13e43c59133a35880dc#n1259
The interrupt notification is handled here: http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c?id=77f61547834c4f127b44b13e43c59133a35880dc#n2224

I hacked this into the DRM driver and have been running my test for quite some time,
bumping against the tail end of the address range many times, without any MMU faults.

My proposal is to add a bo flag for buffers that need this kind of "hard" MMU
reset (this is not all of them, e.g. textures don't), and if their iova mapping
requires a MMU flush, do the above stop-and-start ritual (in case of MMUv2).

Wladimir
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-12-10 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-10 11:00 etnaviv: mmu issue after end of address space reached? Wladimir J. van der Laan
2016-12-10 11:47 ` Wladimir J. van der Laan
2016-12-10 17:05   ` Wladimir J. van der Laan [this message]
2016-12-12  9:25     ` Lucas Stach
2016-12-12  9:57       ` Wladimir J. van der Laan

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=20161210170531.GA8923@amethyst.visucore.com \
    --to=laanwj@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.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.