<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/include/drm/drm_vma_manager.h, branch linux-5.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2018-07-13T15:14:04Z</updated>
<entry>
<title>drm/i915: Prevent writing into a read-only object via a GGTT mmap</title>
<updated>2018-07-13T15:14:04Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2018-07-12T18:53:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3e977ac6179b39faa3c0eda5fce4f00663ae298d'/>
<id>urn:sha1:3e977ac6179b39faa3c0eda5fce4f00663ae298d</id>
<content type='text'>
If the user has created a read-only object, they should not be allowed
to circumvent the write protection by using a GGTT mmapping. Deny it.

Also most machines do not support read-only GGTT PTEs, so again we have
to reject attempted writes. Fortunately, this is known a priori, so we
can at least reject in the call to create the mmap (with a sanity check
in the fault handler).

v2: Check the vma-&gt;vm_flags during mmap() to allow readonly access.
v3: Remove VM_MAYWRITE to curtail mprotect()

Testcase: igt/gem_userptr_blits/readonly_mmap*
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Jon Bloomfield &lt;jon.bloomfield@intel.com&gt;
Cc: Joonas Lahtinen &lt;joonas.lahtinen@linux.intel.com&gt;
Cc: Matthew Auld &lt;matthew.william.auld@gmail.com&gt;
Cc: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Reviewed-by: Matthew Auld &lt;matthew.william.auld@gmail.com&gt; #v1
Reviewed-by: Jon Bloomfield &lt;jon.bloomfield@intel.com&gt;
Reviewed-by: Joonas Lahtinen &lt;joonas.lahtinen@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180712185315.3288-4-chris@chris-wilson.co.uk
</content>
</entry>
<entry>
<title>drm/vma-manager: drm_vma_node_start() constify argument</title>
<updated>2017-11-11T10:19:37Z</updated>
<author>
<name>Noralf Trønnes</name>
<email>noralf@tronnes.org</email>
</author>
<published>2017-11-07T19:13:37Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=bf38b0550359ee7a78244d17ed49d3c557cceb01'/>
<id>urn:sha1:bf38b0550359ee7a78244d17ed49d3c557cceb01</id>
<content type='text'>
Constify argument so functions calling into this take a const argument.

Reviewed-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Signed-off-by: Noralf Trønnes &lt;noralf@tronnes.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20171107191348.17555-2-noralf@tronnes.org
</content>
</entry>
<entry>
<title>drm: Extract drm_prime.h</title>
<updated>2017-03-09T15:18:02Z</updated>
<author>
<name>Daniel Vetter</name>
<email>daniel.vetter@ffwll.ch</email>
</author>
<published>2017-03-08T14:12:35Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c6bb9baa03b1ed413ebd449d9d7f9389fda1f309'/>
<id>urn:sha1:c6bb9baa03b1ed413ebd449d9d7f9389fda1f309</id>
<content type='text'>
Plus a little bit more documentation.

v2: Untangle the missing forward decls to make drm_prime|gem.h
free-standing.

Reviewed-by: Gustavo Padovan &lt;gustavo.padovan@collabora.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-3-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>drm: use drm_file to tag vm-bos</title>
<updated>2016-09-19T09:22:08Z</updated>
<author>
<name>David Herrmann</name>
<email>dh.herrmann@gmail.com</email>
</author>
<published>2016-09-01T12:48:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d9a1f0b4eb6080dc42bb6373ab9abb0314cea41e'/>
<id>urn:sha1:d9a1f0b4eb6080dc42bb6373ab9abb0314cea41e</id>
<content type='text'>
Rather than using "struct file*", use "struct drm_file*" as tag VM tag for
BOs. This will pave the way for "struct drm_file*" without any "struct
file*" back-pointer.

Signed-off-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-3-dh.herrmann@gmail.com
</content>
</entry>
<entry>
<title>drm: Convert drm_vma_manager to embedded interval-tree in drm_mm</title>
<updated>2016-08-08T08:05:17Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2016-08-03T15:04:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=db2395eccf0829de5eb54625167f6cbc3faa1418'/>
<id>urn:sha1:db2395eccf0829de5eb54625167f6cbc3faa1418</id>
<content type='text'>
Having added an interval-tree to struct drm_mm, we can replace the
auxiliary rb-tree inside the drm_vma_manager with it.

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/1470236651-678-2-git-send-email-chris@chris-wilson.co.uk
</content>
</entry>
<entry>
<title>drm/vma_manage: Drop has_offset</title>
<updated>2016-04-20T10:58:53Z</updated>
<author>
<name>Daniel Vetter</name>
<email>daniel.vetter@ffwll.ch</email>
</author>
<published>2016-03-30T09:40:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f74418a400c62f382228842fd0ce8a05f9069d8c'/>
<id>urn:sha1:f74418a400c62f382228842fd0ce8a05f9069d8c</id>
<content type='text'>
It's racy, creating mmap offsets is a slowpath, so better to remove it
to avoid drivers doing broken things.

The only user is i915, and it's ok there because everything (well
almost) is protected by dev-&gt;struct_mutex in i915-gem.

While at it add a note in the create_mmap_offset kerneldoc that
drivers must release it again. And then I also noticed that
drm_gem_object_release entirely lacks kerneldoc.

Cc: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/1459330852-27668-14-git-send-email-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>drm/gem: Use kref_get_unless_zero for the weak mmap references</title>
<updated>2015-10-19T09:00:44Z</updated>
<author>
<name>Daniel Vetter</name>
<email>daniel.vetter@ffwll.ch</email>
</author>
<published>2015-10-15T09:33:43Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2225cfe46bcc7558d9e371d1bc117df2df1fbacd'/>
<id>urn:sha1:2225cfe46bcc7558d9e371d1bc117df2df1fbacd</id>
<content type='text'>
Compared to wrapping the final kref_put with dev-&gt;struct_mutex this
allows us to only acquire the offset manager look both in the final
cleanup and in the lookup. Which has the upside that no locks leak out
of the core abstractions. But it means that we need to hold a
temporary reference to the object while checking mmap constraints, to
make sure the object doesn't disappear. Extended the critical region
would have worked too, but would result in more leaky locking.

Also, this is the final bit which required dev-&gt;struct_mutex in gem
core, now modern drivers can be completely struct_mutex free!

This needs a new drm_vma_offset_exact_lookup_locked and makes both
drm_vma_offset_exact_lookup and drm_vma_offset_lookup unused.

v2: Don't leak object references in failure paths (David).

v3: Add a comment from Chris explaining how the ordering works, with
the slight adjustment that I dropped any mention of struct_mutex since
with this patch it's now immaterial ot core gem.

Cc: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Reviewed-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Link: http://mid.gmane.org/1444901623-18918-1-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
</content>
</entry>
<entry>
<title>gpu/doc: Convert to markdown harder</title>
<updated>2015-10-16T13:50:59Z</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-10-12T07:10:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f71a6d6095782186c10c720d9ed813b68275d30d'/>
<id>urn:sha1:f71a6d6095782186c10c720d9ed813b68275d30d</id>
<content type='text'>
This snippet...

    * Lock VMA manager for extended lookups. Only *_locked() VMA function calls
    * are allowed while holding this lock. All other contexts are blocked from VMA
    * until the lock is released via drm_vma_offset_unlock_lookup().

...causes markdown-enabled kernel-doc to barf:

    debian/build/build-doc/Documentation/DocBook/gpu.aux.xml:3247: parser error : Opening and ending tag mismatch: emphasis line 3247 and function
       *&lt;function&gt;&lt;emphasis&gt;locked&lt;/function&gt; VMA function calls are allowed while
                                             ^
    /root/airlied/debian/build/build-doc/Documentation/DocBook/gpu.aux.xml:3249: parser error : Opening and ending tag mismatch: function line 3249 and emphasis
       released via &lt;function&gt;drm&lt;/emphasis&gt;vma_offset_unlock_lookup&lt;/function&gt;.
                                            ^
    unable to parse /root/airlied/debian/build/build-doc/Documentation/DocBook/gpu.aux.xml

A quick workaround is to replace *_locked() by X_locked().

Cc: Danilo Cesar Lemes de Paula &lt;danilo.cesar@collabora.co.uk&gt;
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
[danvet: Just drop the X_ too, the usual style is _unlocked, except
that _ seems to be what annoys markdown.]
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm: init TTM dev_mapping in ttm_bo_device_init()</title>
<updated>2014-03-16T11:23:42Z</updated>
<author>
<name>David Herrmann</name>
<email>dh.herrmann@gmail.com</email>
</author>
<published>2013-08-13T17:10:30Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=44d847b7439bdea0b6c5640446427daa3ebcc7fa'/>
<id>urn:sha1:44d847b7439bdea0b6c5640446427daa3ebcc7fa</id>
<content type='text'>
With dev-&gt;anon_inode we have a global address_space ready for operation
right from the beginning. Therefore, there is no need to do a delayed
setup with TTM. Instead, set dev_mapping during initialization in
ttm_bo_device_init() and remove any "if (dev_mapping)" conditions.

Cc: Dave Airlie &lt;airlied@redhat.com&gt;
Cc: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Cc: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
Cc: Alex Deucher &lt;alexdeucher@gmail.com&gt;
Cc: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
</content>
</entry>
<entry>
<title>drm/vma: add access management helpers</title>
<updated>2013-08-27T01:54:54Z</updated>
<author>
<name>David Herrmann</name>
<email>dh.herrmann@gmail.com</email>
</author>
<published>2013-08-25T16:28:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=88d7ebe59341dc3b82e662b80809694e3c6b3766'/>
<id>urn:sha1:88d7ebe59341dc3b82e662b80809694e3c6b3766</id>
<content type='text'>
The VMA offset manager uses a device-global address-space. Hence, any
user can currently map any offset-node they want. They only need to guess
the right offset. If we wanted per open-file offset spaces, we'd either
need VM_NONLINEAR mappings or multiple "struct address_space" trees. As
both doesn't really scale, we implement access management in the VMA
manager itself.

We use an rb-tree to store open-files for each VMA node. On each mmap
call, GEM, TTM or the drivers must check whether the current user is
allowed to map this file.

We add a separate lock for each node as there is no generic lock available
for the caller to protect the node easily.

As we currently don't know whether an object may be used for mmap(), we
have to do access management for all objects. If it turns out to slow down
handle creation/deletion significantly, we can optimize it in several
ways:
 - Most times only a single filp is added per bo so we could use a static
   "struct file *main_filp" which is checked/added/removed first before we
   fall back to the rbtree+drm_vma_offset_file.
   This could be even done lockless with rcu.
 - Let user-space pass a hint whether mmap() should be supported on the
   bo and avoid access-management if not.
 - .. there are probably more ideas once we have benchmarks ..

v2: add drm_vma_node_verify_access() helper

Signed-off-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
</feed>
