lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKMK7uFyKd71w4H8nFk=WPSHL3KMwQ6kLwAMXTd_TAkrkJ++KQ@mail.gmail.com>
Date:   Wed, 7 Aug 2019 10:28:00 +0200
From:   Daniel Vetter <daniel@...ll.ch>
To:     Gerd Hoffmann <kraxel@...hat.com>
Cc:     dri-devel <dri-devel@...ts.freedesktop.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] drm: add gem ttm helpers

On Wed, Aug 7, 2019 at 9:29 AM Gerd Hoffmann <kraxel@...hat.com> wrote:
>
> > > +/**
> > > + * drm_gem_ttm_mmap_offset() - Returns a GEM ttm object's mmap offset
> > > + * @gbo:   the GEM ttm object
> > > + *
> > > + * See drm_vma_node_offset_addr() for more information.
> > > + *
> > > + * Returns:
> > > + * The buffer object's offset for userspace mappings on success, or
> > > + * 0 if no offset is allocated.
> > > + */
> > > +u64 drm_gem_ttm_mmap_offset(struct ttm_buffer_object *bo)
> > > +{
> > > +   return drm_vma_node_offset_addr(&bo->base.vma_node);
> >
> > Why do we need a new one here, can't we use the existing gem
> > implementation for this (there really should only be one I hope, but I
> > didn't check).
>
> Havn't found one.

It got reverted out again:

commit 415d2e9e07574d3de63b8df77dc686e0ebf64865
Author: Rob Herring <robh@...nel.org>
Date:   Wed Jul 3 16:38:50 2019 -0600

    Revert "drm/gem: Rename drm_gem_dumb_map_offset() to drm_gem_map_offset()"


> But maybe we don't need this as separate function and can simply move
> the drm_vma_node_offset_addr() call into
> drm_gem_ttm_driver_dumb_mmap_offset().
>
> > > +int drm_gem_ttm_driver_dumb_mmap_offset(struct drm_file *file,
> > > +                                    struct drm_device *dev,
> > > +                                    uint32_t handle, uint64_t *offset)
> > > +{
> > > +   struct drm_gem_object *gem;
> > > +   struct ttm_buffer_object *bo;
> > > +
> > > +   gem = drm_gem_object_lookup(file, handle);
> > > +   if (!gem)
> > > +           return -ENOENT;
> > > +
> > > +   bo = drm_gem_ttm_of_gem(gem);
> > > +   *offset = drm_gem_ttm_mmap_offset(bo);
> > > +
> > > +   drm_gem_object_put_unlocked(gem);
> > > +
> > > +   return 0;
> > > +}
> > > +EXPORT_SYMBOL(drm_gem_ttm_driver_dumb_mmap_offset);
> >
> > Same for this, you're just upcasting to ttm_bo and then downcasting to
> > gem_bo again ... I think just a series to roll out the existing gem
> > helpers everywhere should work?
>
> I don't think so.  drm_gem_dumb_map_offset() calls
> drm_gem_create_mmap_offset(), which I think is not correct for ttm
> objects because ttm_bo_init() handles vma_node initialization.

More code to unify first? This should work exactly the same way for
all gem based drivers I think ... Only tricky bit is making sure
vmwgfx keeps working correctly.
-Daniel

>
> cheers,
>   Gerd
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ