On Wed, Feb 11, 2015 at 5:03 PM, Ilia Mirkin <imirkin@xxxxxxxxxxxx> wrote: > On Wed, Feb 11, 2015 at 2:21 AM, Alexandre Courbot <gnurou@xxxxxxxxx> wrote: >> Let GK20A's instmem take advantage of the IOMMU if it is present. Having >> an IOMMU means that instmem is no longer allocated using the DMA API, >> but instead obtained through page_alloc and made contiguous to the GPU >> by IOMMU mappings. >> >> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx> >> --- >> drm/nouveau/nvkm/subdev/instmem/gk20a.c | 272 ++++++++++++++++++++++++++++---- >> 1 file changed, 241 insertions(+), 31 deletions(-) >> >> diff --git a/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drm/nouveau/nvkm/subdev/instmem/gk20a.c >> index 4c8af6e..a20b93c 100644 >> --- a/drm/nouveau/nvkm/subdev/instmem/gk20a.c >> +++ b/drm/nouveau/nvkm/subdev/instmem/gk20a.c >> @@ -20,12 +20,32 @@ >> * DEALINGS IN THE SOFTWARE. >> */ >> >> +/* >> + * GK20A does not have dedicated video memory, and to accurately represent this >> + * fact Nouveau will not create a RAM device for it. Therefore its instmem >> + * implementation must be done directly on top of system memory, while providing >> + * coherent read and write operations. >> + * >> + * Instmem can be allocated through two means: >> + * 1) If a IOMMU mapping has been probed, the IOMMU API is used to make memory > > an IOMMU mapping > >> + * pages contiguous to the GPU. This is the preferred way. >> + * 2) If no IOMMU mapping is probed, the DMA API is used to allocated physically > > to allocate physically Both fixed, thanks! > >> + * contiguous memory. >> + * >> + * In both cases CPU read and writes are performed using PRAMIN (i.e. using the >> + * GPU path) to ensure these operations are coherent for the GPU. This allows us >> + * to use more "relaxed" allocation parameters when using the DMA API, since we >> + * never need a kernel mapping. >> + */ > > Er yeah... obviously ignore my comments about sharing nv50_instmem_priv stuff. Yeah, actually these functions are not even supposed to stay in the long term. I am using them because it solves the coherency issues, but later I'd like to replace them with a temporary coherent CPU mapping if I can figure out a way to do it... Thanks for the review! -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html