Quoting Matthew Auld (2020-01-02 11:39:41)
> On Thu, 2 Jan 2020 at 10:38, Chris Wilson <[email protected]> wrote:
> >
> > Create a vmap for discontinguous lmem objects to support
> > i915_gem_object_pin_map().
> 
> Yes, please.
> 
> >
> > Signed-off-by: Chris Wilson <[email protected]>
> > Cc: Matthew Auld <[email protected]>
> > ---
> 
> [snip]
> 
> > @@ -288,12 +284,28 @@ static void *i915_gem_object_map(struct 
> > drm_i915_gem_object *obj,
> >                 pgprot = pgprot_writecombine(PAGE_KERNEL_IO);
> >                 break;
> >         }
> > -       addr = vmap(pages, n_pages, 0, pgprot);
> >
> > -       if (pages != stack_pages)
> > -               kvfree(pages);
> > +       if (i915_gem_object_has_struct_page(obj)) {
> > +               struct sgt_iter iter;
> > +               struct page *page;
> > +               pte_t **ptes = mem;
> > +
> > +               for_each_sgt_page(page, iter, sgt)
> > +                       **ptes++ = mk_pte(page, pgprot);
> > +       } else {
> > +               const resource_size_t iomap = obj->mm.region->iomap.base;
> > +               struct sgt_iter iter;
> > +               dma_addr_t addr;
> > +               pte_t **ptes = mem;
> > +
> > +               for_each_sgt_daddr(addr, iter, sgt)
> 
> addr -= region.start; for poor old fake local-memory.

Positive? I wasn't sure since we are using the physical address and not
a mapping within the mapping?

It's hard to tell, since so long as the address exists we can read/write
to it, and only later pay the consequences of corrupting someone else's
memory.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to