On Wed, Oct 02, 2019 at 04:37:41PM -0400, John David Anglin wrote: > On 2019-10-02 10:19 a.m., Thomas Bogendoerfer wrote: > > + pa = addr & IOVP_MASK; > > + mtsp(0,1); > > + asm("lci 0(%%sr1, %1), %0" : "=r" (ci) : "r" (__va(pa))); > I believe you can remove the mtsp and just use "lci 0(%1), %0" to load the coherence index. The space > registers sr4 to sr7 are always 0 in kernel. ok, good to know. while reading this I realized what the other hacks were for, which I didn't include in my first mail. diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 028ab6007873..e84c7652eb1b 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c @@ -66,7 +67,8 @@ static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) if (!page) page = ttm->dummy_read_page; - mem->pages[mem->page_count++] = page; + mem->pages[(ttm->num_pages - 1) - mem->page_count] = page; + mem->page_count++; } agp_be->mem = mem; diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index d0459b392e5e..4bb301cab128 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -571,8 +571,14 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, */ prot = ttm_io_prot(mem->placement, PAGE_KERNEL); map->bo_kmap_type = ttm_bo_map_vmap; + printk("vmap %p\n", ttm->pages[start_page]); +#if 0 map->virtual = vmap(ttm->pages + start_page, num_pages, 0, prot); +#else + map->virtual = kmap(ttm->pages[start_page]); +#endif + } return (!map->virtual) ? -ENOMEM : 0; } This is needed to be able to get the virtual address with __va(pa). Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]