profile/mobile/platform/kernel/linux-3.10-sc7730.git
8 years agogator: Merge gator version 5.23.1 86/57086/3
Hyeongsik Min [Fri, 15 Jan 2016 00:51:03 +0000 (09:51 +0900)]
gator: Merge gator version 5.23.1

Updated gator driver/daemon version from 5.20 to 5.23.1
Newer version supports ttrace annotation

Change-Id: If863ab4ccfd429cb8735635ed812823da8915f8d
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
8 years agostaging/ion: fix build warnings accepted/tizen/mobile/20160113.050904 submit/tizen/20160113.015730
Joonyoung Shim [Wed, 13 Jan 2016 00:44:54 +0000 (09:44 +0900)]
staging/ion: fix build warnings

This fixed below warnings.

include/video/ion_sprd.h:128:7: warning: ‘struct ion_handle’ declared inside parameter list
include/video/ion_sprd.h:128:7: warning: its scope is only this definition or declaration, which is probably not what you want
include/video/ion_sprd.h:129:29: warning: ‘struct ion_handle’ declared inside parameter list

drivers/staging/android/ion/ion.h:126:13: warning: ‘struct drm_gem_object’ declared inside parameter list
drivers/staging/android/ion/ion.h:126:13: warning: its scope is only this definition or declaration, which is probably not what you want

Change-Id: If51462fad12a1f7d20777835b39b1a276149cef1
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agostaging/ion: decrease gem reference count in release of dma-buf
Joonyoung Shim [Tue, 12 Jan 2016 02:03:42 +0000 (11:03 +0900)]
staging/ion: decrease gem reference count in release of dma-buf

Gem reference count is increased hen dma-buf is exported, so release
of dma-buf should decrease gem reference count.

Change-Id: Id298ea79aa14908860e5d87527813994dfdb790d
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agodrm/sprd: include correct ion.h header file in sprd_drm
Rohit kumar [Wed, 6 Jan 2016 09:24:11 +0000 (14:54 +0530)]
drm/sprd: include correct ion.h header file in sprd_drm

This patch updates sprd_drm to include staging/ion header
file instead of include/linux/ion.h as we are now using
staging ion driver.

Change-Id: I799c8553aa43278ecab85bc55d518b572b5ef9ea
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agostaging/ion: sync ion.h with include/linux/ion.h
Rohit kumar [Tue, 12 Jan 2016 09:34:07 +0000 (15:04 +0530)]
staging/ion: sync ion.h with include/linux/ion.h

Change-Id: I7961603a6f9615cf7768841edf0168461b477007
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agoRevert "TizenYoung23gdtv: drm: add ion.h."
Rohit kumar [Tue, 12 Jan 2016 09:32:31 +0000 (15:02 +0530)]
Revert "TizenYoung23gdtv: drm: add ion.h."

This reverts commit 4748300326836a2f632b60f8ec8d8cf01f2b4f85.

8 years agodrm/sprd: use prime dma-buf to convert fd and gem handle
Joonyoung Shim [Thu, 10 Dec 2015 10:10:52 +0000 (19:10 +0900)]
drm/sprd: use prime dma-buf to convert fd and gem handle

The sprd drm driver used specific functions to convert fd and gem handle
but they don't support some mechanism of prime dma-buf functions like
reusing of handle exported already, so use prime dma-buf functions.

Change-Id: Ieb591944015bfab0cb15cc21d714f70bffe4b18c
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoTizen: ion: Fix dma_buf refcount issue in get_ion_handle_from_dmabuf
Rohit kumar [Mon, 11 Jan 2016 09:50:13 +0000 (15:20 +0530)]
Tizen: ion: Fix dma_buf refcount issue in get_ion_handle_from_dmabuf

Change-Id: If9eef4cc5dcdf89e89af062a56607b01e3640c25
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agostaging/ion: Add support to get ion handle from dma buf
Rohit kumar [Tue, 22 Dec 2015 04:14:51 +0000 (09:44 +0530)]
staging/ion: Add support to get ion handle from dma buf

Currently we can only import dma buf fd's to get ion_handle.
Adding support to import dma buf handles to support kernel
use cases.

Change-Id: I85b6027b6b142e3f91bce51b717e408530d5523c
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agodrm/sprd: fix locking usage
Joonyoung Shim [Mon, 11 Jan 2016 03:08:13 +0000 (12:08 +0900)]
drm/sprd: fix locking usage

This fixes locking usage made by backporting patchse to solve dma-buf
issue.

Change-Id: I99c3792cecc5e9974b1fb7c321d8c963de411ea4
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agodrm/sprd: fix build errors
Joonyoung Shim [Mon, 11 Jan 2016 02:57:17 +0000 (11:57 +0900)]
drm/sprd: fix build errors

This fixes build errors made by backporting patchse to solve dma-buf
issue.

Change-Id: I855c8a98a8b6d1ea9119a51c5249ee470052d076
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agodrm/prime: Always add exported buffers to the handle cache
Daniel Vetter [Wed, 14 Aug 2013 22:02:49 +0000 (00:02 +0200)]
drm/prime: Always add exported buffers to the handle cache

... not only when the dma-buf is freshly created. In contrived
examples someone else could have exported/imported the dma-buf already
and handed us the gem object with a flink name. If such on object gets
reexported as a dma_buf we won't have it in the handle cache already,
which breaks the guarantee that for dma-buf imports we always hand
back an existing handle if there is one.

This is exercised by igt/prime_self_import/with_one_bo_two_files

Now if we extend the locked sections just a notch more we can also
plug th racy buf/handle cache setup in handle_to_fd:

If evil userspace races a concurrent gem close against a prime export
operation we can end up tearing down the gem handle before the dma buf
handle cache is set up. When handle_to_fd gets around to adding the
handle to the cache there will be no one left to clean it up,
effectily leaking the bo (and the dma-buf, since the handle cache
holds a ref on the dma-buf):

Thread A Thread B

handle_to_fd:

lookup gem object from handle
creates new dma_buf

gem_close on the same handle
obj->dma_buf is set, but file priv buf
handle cache has no entry

obj->handle_count drops to 0

drm_prime_add_buf_handle sets up the handle cache

-> We have a dma-buf reference in the handle cache, but since the
handle_count of the gem object already dropped to 0 no on will clean
it up. When closing the drm device fd we'll hit the WARN_ON in
drm_prime_destroy_file_private.

The important change is to extend the critical section of the
filp->prime.lock to cover the gem handle lookup. This serializes with
a concurrent gem handle close.

This leak is exercised by igt/prime_self_import/export-vs-gem_close-race

Change-Id: I19ceb9107a318dc299eb103df4042684f0a4252e
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: make drm_prime_lookup_buf_handle static
Daniel Vetter [Wed, 14 Aug 2013 22:02:48 +0000 (00:02 +0200)]
drm/prime: make drm_prime_lookup_buf_handle static

... and move it to the top of the function to avoid a forward
declaration.

Change-Id: I1e8ce7ca0bd845ff10d72da56a6a992f3eca75ac
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: Simplify drm_gem_remove_prime_handles
Daniel Vetter [Wed, 14 Aug 2013 22:02:47 +0000 (00:02 +0200)]
drm/prime: Simplify drm_gem_remove_prime_handles

with the reworking semantics and locking of the obj->dma_buf pointer
this pointer is always set as long as there's still a gem handle
around and a dma_buf associated with this gem object.

Also, the per file-priv lookup-cache for dma-buf importing is also
unified between foreign and native objects.

Hence we don't need to special case the clean any more and can simply
drop the clause which only runs for foreing objects, i.e. with
obj->import_attach set.

Note that with this change (actually with the previous one to always
set up obj->dma_buf even for foreign objects) it is no longer required
to set obj->import_attach when importing a foreing object. So update
comments accordingly, too.

Change-Id: If153ff3c09c4380b86497d7cb26b5b02b40ec020
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: proper locking+refcounting for obj->dma_buf link
Daniel Vetter [Wed, 14 Aug 2013 22:02:46 +0000 (00:02 +0200)]
drm/prime: proper locking+refcounting for obj->dma_buf link

The export dma-buf cache is semantically similar to an flink name. So
semantically it makes sense to treat it the same and remove the name
(i.e. the dma_buf pointer) and its references when the last gem handle
disappears.

Again we need to be careful, but double so: Not just could someone
race and export with a gem close ioctl (so we need to recheck
obj->handle_count again when assigning the new name), but multiple
exports can also race against each another. This is prevented by
holding the dev->object_name_lock across the entire section which
touches obj->dma_buf.

With the new scheme we also need to reinstate the obj->dma_buf link at
import time (in case the only reference userspace has held in-between
was through the dma-buf fd and not through any native gem handle). For
simplicity we don't check whether it's a native object but
unconditionally set up that link - with the new scheme of removing the
obj->dma_buf reference when the last handle disappears we can do that.

To make it clear that this is not just for exported buffers anymore
als rename it from export_dma_buf to dma_buf.

To make sure that now one can race a fd_to_handle or handle_to_fd with
gem_close we use the same tricks as in flink of extending the
dev->object_name_locking critical section. With this change we finally
have a guaranteed 1:1 relationship (at least for native objects)
between gem objects and dma-bufs, even accounting for races (which can
happen since the dma-buf itself holds a reference while in-flight).

This prevent igt/prime_self_import/export-vs-gem_close-race from
Oopsing the kernel. There is still a leak though since the per-file
priv dma-buf/handle cache handling is racy. That will be fixed in a
later patch.

v2: Remove the bogus dma_buf_put from the export_and_register_object
failure path if we've raced with the handle count dropping to 0.

Change-Id: I89173f8802ccc12fbf48f053a7701c114e92692b
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: completely close gem_open vs. gem_close races
Daniel Vetter [Wed, 14 Aug 2013 22:02:45 +0000 (00:02 +0200)]
drm/gem: completely close gem_open vs. gem_close races

The gem flink name holds a reference onto the object itself, and this
self-reference would prevent an flink'ed object from every being
freed. To break that loop we remove the flink name when the last
userspace handle disappears, i.e. when obj->handle_count reaches 0.

Now in gem_open we drop the dev->object_name_lock between the flink
name lookup and actually adding the handle. This means a concurrent
gem_close of the last handle could result in the flink name getting
reaped right inbetween, i.e.

Thread 1 Thread 2
gem_open gem_close

flink -> obj lookup
handle_count drops to 0
remove flink name
create_handle
handle_count++

If someone now flinks this object again, we'll get a new flink name.

We can close this race by removing the lock dropping and making the
entire lookup+handle_create sequence atomic. Unfortunately to still be
able to share the handle_create logic this requires a
handle_create_tail function which drops the lock - we can't hold the
object_name_lock while calling into a driver's ->gem_open callback.

Note that for flink fixing this race isn't really important, since
racing gem_open against gem_close is clearly a userspace bug. And no
matter how the race ends, we won't leak any references.

But with dma-buf where the userspace dma-buf fd itself is refcounted
this is a valid sequence and hence we should fix it. Therefore this
patch here is just a warm-up exercise (and for consistency between
flink buffer sharing and dma-buf buffer sharing with self-imports).

Also note that this extension of the critical section in gem_open
protected by dev->object_name_lock only works because it's now a
mutex: A spinlock would conflict with the potential memory allocation
in idr_preload().

This is exercises by igt/gem_flink_race/flink_name.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[jy0922.shim: fix up fuzz to apply]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Change-Id: I7fc3ffb1a77b2b5ca7e04a38c26ccd3a73b67f62

8 years agodrm/gem: switch dev->object_name_lock to a mutex
Daniel Vetter [Wed, 14 Aug 2013 22:02:44 +0000 (00:02 +0200)]
drm/gem: switch dev->object_name_lock to a mutex

I want to wrap the creation of a dma-buf from a gem object in it,
so that the obj->export_dma_buf cache can be atomically filled in.

Instead of creating a new mutex just for that variable I've figured
I can reuse the existing dev->object_name_lock, especially since
the new semantics will exactly mirror the flink obj->name already
protected by that lock.

v2: idr_preload/idr_preload_end is now an atomic section, so need to
move the mutex locking outside.

[airlied: fix up conflict with patch to make debugfs use lock]

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[jy0922.shim: fix up fuzz to apply]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Change-Id: Iffcd6e849d13b7c79bbd6571c92bcdd4f45f3a69

8 years agodrm/prime: clarify logic a bit in drm_gem_prime_fd_to_handle
Daniel Vetter [Wed, 14 Aug 2013 22:02:43 +0000 (00:02 +0200)]
drm/prime: clarify logic a bit in drm_gem_prime_fd_to_handle

if (!ret) implies that ret == 0, so no need to clear it again. And
explicitly check for ret == 0 to indicate that we're checking an errno
integer.

Change-Id: Ica8aaed3a759dd0c8f7cfa87977e7b74aaddda85
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: shrink critical section protected by prime lock
Daniel Vetter [Wed, 14 Aug 2013 22:02:42 +0000 (00:02 +0200)]
drm/prime: shrink critical section protected by prime lock

When exporting a gem object as a dma-buf the critical section for the
per-fd prime lock is just the adding (and in case of errors, removing)
of the handle to the per-fd lookup cache.

So restrict the critical section to just that part of the function.

This simplifies later reordering.

Change-Id: I6e571c0ae6d1aa5840781cc38a7637d01ed8849a
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: use proper pointer in drm_gem_prime_handle_to_fd
Daniel Vetter [Wed, 14 Aug 2013 22:02:41 +0000 (00:02 +0200)]
drm/prime: use proper pointer in drm_gem_prime_handle_to_fd

Part of the function uses the properly-typed dmabuf variable, the
other an untyped void *buf. Kill the later.

Change-Id: I93a9d67a8106b9fa9933c78967c445f0c1709817
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: make drm_gem_object_handle_unreference_unlocked static
Daniel Vetter [Wed, 14 Aug 2013 22:02:39 +0000 (00:02 +0200)]
drm/gem: make drm_gem_object_handle_unreference_unlocked static

No one outside of drm should use this, the official interfaces are
drm_gem_handle_create and drm_gem_handle_delete. The handle refcounting
is purely an implementation detail of gem.

Change-Id: I48c8bb42b1c5c48df39c9722fd1ce8836cf99257
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: fix error path in drm_gem_prime_fd_to_handle
Daniel Vetter [Wed, 14 Aug 2013 22:02:38 +0000 (00:02 +0200)]
drm/prime: fix error path in drm_gem_prime_fd_to_handle

handle_unreference only clears up the obj->name and the reference,
but would leave a dangling handle in the idr. The right thing
to do is to call handle_delete.

Change-Id: I69134c470800d5be810892d8bae77a5c5bac6dc9
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: fix up flink name create race
Daniel Vetter [Wed, 14 Aug 2013 22:02:37 +0000 (00:02 +0200)]
drm/gem: fix up flink name create race

This is the 2nd attempt, I've always been a bit dissatisified with the
tricky nature of the first one:

http://lists.freedesktop.org/archives/dri-devel/2012-July/025451.html

The issue is that the flink ioctl can race with calling gem_close on
the last gem handle. In that case we'll end up with a zero handle
count, but an flink name (and it's corresponding reference). Which
results in a neat space leak.

In my first attempt I've solved this by rechecking the handle count.
But fundamentally the issue is that ->handle_count isn't your usual
refcount - it can be resurrected from 0 among other things.

For those special beasts atomic_t often suggest way more ordering that
it actually guarantees. To prevent being tricked by those hairy
semantics take the easy way out and simply protect the handle with the
existing dev->object_name_lock.

With that change implemented it's dead easy to fix the flink vs. gem
close reace: When we try to create the name we simply have to check
whether there's still officially a gem handle around and if not refuse
to create the flink name. Since the handle count decrement and flink
name destruction is now also protected by that lock the reace is gone
and we can't ever leak the flink reference again.

Outside of the drm core only the exynos driver looks at the handle
count, and tbh I have no idea why (it's just for debug dmesg output
luckily).

I've considered inlining the drm_gem_object_handle_free, but I plan to
add more name-like things (like the exported dma_buf) to this scheme,
so it's clearer to leave the handle freeing in its own function.

This is exercised by the new gem_flink_race i-g-t testcase, which on
my snb leaks gem objects at a rate of roughly 1k objects/s.

v2: Fix up the error path handling in handle_create and make it more
robust by simply calling object_handle_unreference.

v3: Fix up the handle_unreference logic bug - atomic_dec_and_test
retursn 1 for 0. Oops.

v4: Squash in inlining of drm_gem_object_handle_reference as suggested
by Dave Airlie and add a note that we now have a testcase.

Change-Id: I90ff5be7d2e1d8fead0ef333932424a5b037d4af
Cc: Dave Airlie <airlied@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: Remove stale prototypes
Lespiau, Damien [Mon, 19 Aug 2013 23:53:03 +0000 (00:53 +0100)]
drm: Remove stale prototypes

A few prototypes have been left in the headers, their function friends
long gone.

Change-Id: I3ad468d6c4152ed104f0b7173cfd2a2833e54d18
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: fix locking in gem debugfs/procfs file
Daniel Vetter [Thu, 8 Aug 2013 13:41:33 +0000 (15:41 +0200)]
drm: fix locking in gem debugfs/procfs file

The idr is protected with our spinlock, if we don't hold that nothing
prevents the gem objects from disappearing from under us.

Change-Id: Ib56e27c3eb86cde0211c6f6b14e9ea2c2fb698aa
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: WARN about unbalanced handle refcounts
Daniel Vetter [Wed, 14 Aug 2013 22:02:36 +0000 (00:02 +0200)]
drm/gem: WARN about unbalanced handle refcounts

Trying to drop a reference we don't have is a pretty serious bug.
Trying to paper over it is an even worse offense.

So scream into dmesg with a big WARN in case that ever happens.

Change-Id: I42eea2ec5f5a83ed9c2bdc99ce86f258f0e3d3c8
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: remove bogus NULL check from drm_gem_object_handle_unreference_unlocked
Daniel Vetter [Wed, 14 Aug 2013 22:02:35 +0000 (00:02 +0200)]
drm/gem: remove bogus NULL check from drm_gem_object_handle_unreference_unlocked

Calling this function with a NULL object is simply a bug, so papering
over a NULL object not a good idea.

Change-Id: I412d7ced57a75fd5281d05d584092df9bc420408
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: move drm_gem_object_handle_unreference_unlocked into drm_gem.c
Daniel Vetter [Wed, 14 Aug 2013 22:02:34 +0000 (00:02 +0200)]
drm/gem: move drm_gem_object_handle_unreference_unlocked into drm_gem.c

We have three callers of this function now and it's neither
performance critical nor really small. So an inline function feels
like overkill and unecessarily separates the different parts of the
code.

Since all callers of drm_gem_object_handle_free are now in drm_gem.c
we can make that static (and remove the unused EXPORT_SYMBOL). To
avoid a forward declaration move it (and drm_gem_object_free_bug) up a
bit.

Change-Id: I383dd0f8a20c28e587fda7f511bb43aabae03cd2
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: add a bit of documentation about gem_obj->import_attach
Daniel Vetter [Wed, 14 Aug 2013 22:02:33 +0000 (00:02 +0200)]
drm/prime: add a bit of documentation about gem_obj->import_attach

Lifetime rules seem to be solid around ->import_attach. So this patch
just properly documents them.

Note that pointing directly at the attachment might have issues for
devices that have multiple struct device *dev parts constituting the
logical gpu and so might need multiple attachment points. Similarly
for drm devices which don't need a dma attachment at all (like udl).

But fixing that up is material for different patches.

Change-Id: Ibac8872b498dbe91e42707dcc0d96121b5773cfb
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: remove cargo-cult locking from map_sg helper
Daniel Vetter [Wed, 14 Aug 2013 22:02:32 +0000 (00:02 +0200)]
drm/prime: remove cargo-cult locking from map_sg helper

I've checked both implementations (radeon/nouveau) and they both grab
the page array from ttm simply by dereferencing it and then wrapping
it up with drm_prime_pages_to_sg in the callback and map it with
dma_map_sg (in the helper).

Only the grabbing of the underlying page array is anything we need to
be concerned about, and either those pages are pinned independently,
or we're screwed no matter what.

And indeed, nouveau/radeon pin the backing storage in their
attach/detach functions.

Since I've created this patch cma prime support for dma_buf was added.
drm_gem_cma_prime_get_sg_table only calls kzalloc and the creates&maps
the sg table with dma_get_sgtable. It doesn't touch any gem object
state otherwise. So the cma helpers also look safe.

The only thing we might claim it does is prevent concurrent mapping of
dma_buf attachments. But a) that's not allowed and b) the current code
is racy already since it checks whether the sg mapping exists _before_
grabbing the lock.

So the dev->struct_mutex locking here does absolutely nothing useful,
but only distracts. Remove it.

This should also help Maarten's work to eventually pin the backing
storage more dynamically by preventing locking inversions around
dev->struct_mutex.

v2: Add analysis for recently added cma helper prime code.

Change-Id: Ifa09dc3603791b1a361bba18e1ea8c3a2b916d20
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: use common drm_gem_dmabuf_release in i915/exynos drivers
Daniel Vetter [Wed, 14 Aug 2013 22:02:30 +0000 (00:02 +0200)]
drm: use common drm_gem_dmabuf_release in i915/exynos drivers

Note that this is slightly tricky since both drivers store their
native objects in dma_buf->priv. But both also embed the base
drm_gem_object at the first position, so the implicit cast is ok.

To use the release helper we need to export it, too.

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[jy0922.shim: fix up confliction to apply]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Change-Id: Ie2ac40780efe29ca1ece8c3a85ac46e74f0af3d0

8 years agodrm/gem: remove drm_gem_object_handle_unreference
Daniel Vetter [Tue, 16 Jul 2013 07:11:56 +0000 (09:11 +0200)]
drm/gem: remove drm_gem_object_handle_unreference

It's unused, everyone is using the _unlocked variant only.

Change-Id: I4d1d2c19ea11023144d490be6f31804be8f8610f
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
8 years agodrm/gem: simplify object initialization
David Herrmann [Thu, 11 Jul 2013 09:56:32 +0000 (11:56 +0200)]
drm/gem: simplify object initialization

drm_gem_object_init() and drm_gem_private_object_init() do exactly the
same (except for shmem alloc) so make the first use the latter to reduce
code duplication.

Also drop the return code from drm_gem_private_object_init(). It seems
unlikely that we will extend it any time soon so no reason to keep it
around. This simplifies code paths in drivers, too.

Last but not least, fix gma500 to call drm_gem_object_release() before
freeing objects that were allocated via drm_gem_private_object_init().
That isn't actually necessary for now, but might be in the future.

Change-Id: I8c23aa0239061192c4c8b69f76c7ec125b7a8705
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
8 years agodrm/cma: remove GEM CMA specific dma_buf functionality
Joonyoung Shim [Fri, 28 Jun 2013 05:24:55 +0000 (14:24 +0900)]
drm/cma: remove GEM CMA specific dma_buf functionality

We can use prime helpers instead.

Change-Id: I36b746d983c29d2b1c4af2cc2b844cab701b2ece
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/cma: add low-level hook functions to use prime helpers
Joonyoung Shim [Fri, 28 Jun 2013 05:24:54 +0000 (14:24 +0900)]
drm/cma: add low-level hook functions to use prime helpers

Instead of using the dma_buf functionality for GEM CMA, we can use prime
helpers if we can provide low-level hook functions for GEM CMA.

Change-Id: Ia5f70596d842fb3f539c7eb9f6f7ce467943c844
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: add mmap function to prime helpers
Joonyoung Shim [Fri, 28 Jun 2013 05:24:53 +0000 (14:24 +0900)]
drm: add mmap function to prime helpers

This adds to call low-level mmap() from prime helpers.

Change-Id: I964a481a729c7d9dd23a9d55e2a4ec08091ca5a5
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: fix sgt NULL checking
Joonyoung Shim [Thu, 4 Jul 2013 07:19:12 +0000 (16:19 +0900)]
drm/prime: fix sgt NULL checking

The drm_gem_map_detach() can be called with sgt is NULL.

Change-Id: I2a422a1bf92333e60de902ab048048f0b4c754dc
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: fix up handle_to_fd ioctl return value
Daniel Vetter [Tue, 2 Jul 2013 07:18:39 +0000 (09:18 +0200)]
drm/prime: fix up handle_to_fd ioctl return value

In

commit da34242e5e0638312130f5bd5d2d277afbc6f806
Author: YoungJun Cho <yj44.cho@samsung.com>
Date:   Wed Jun 26 10:21:42 2013 +0900

    drm/prime: add return check for dma_buf_fd

the failure case handling was fixed up. But in the case when we
already had the buffer exported it changed the return value:
Previously we've return 0 on success, now we return the fd.

This ABI change has been caught by i-g-t/prime_self_import/with_one_bo.

Change-Id: I8c6173851e379d5d9ad66b78260b4701665e0eda
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66436
Cc: YoungJun Cho <yj44.cho@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: lu hua <huax.lu@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: add return check for dma_buf_fd
YoungJun Cho [Wed, 26 Jun 2013 01:21:42 +0000 (10:21 +0900)]
drm/prime: add return check for dma_buf_fd

The dma_buf_fd() can return error when it fails to prepare fd,
so the dma_buf needs to be put.

Change-Id: I70f2d15415ef7d02c21b83ce6fbc06958daa5e6f
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: reorder drm_prime_add_buf_handle and remove prototype
Seung-Woo Kim [Wed, 26 Jun 2013 01:21:41 +0000 (10:21 +0900)]
drm/prime: reorder drm_prime_add_buf_handle and remove prototype

Change-Id: Ice6b0e4838b7a4adcd41d6c7fd85db1520f47466
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: fix to put an exported dma_buf for adding handle failure
YoungJun Cho [Wed, 26 Jun 2013 01:21:40 +0000 (10:21 +0900)]
drm/prime: fix to put an exported dma_buf for adding handle failure

When drm_prime_add_buf_handle() returns failure for an exported
dma_buf, the dma_buf was already allocated and its refcount was
increased, so it needs to be put.

Change-Id: Ib28d3feaed21dc71b7f90632e7fd3cec2a1198b8
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: support to cache mapping
Joonyoung Shim [Wed, 19 Jun 2013 06:03:05 +0000 (15:03 +0900)]
drm/prime: support to cache mapping

The drm prime also can support it like GEM CMA supports to cache
mapping. It doesn't allow multiple mappings for one attachment.

Change-Id: Ia73a42efed8ff7c4df7ec7475ec71f433483e87a
[airlied: rebased on top of other prime changes]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: replace NULL with error value in drm_prime_pages_to_sg
YoungJun Cho [Mon, 24 Jun 2013 07:40:53 +0000 (16:40 +0900)]
drm/prime: replace NULL with error value in drm_prime_pages_to_sg

Instead of NULL, error value is casted with ERR_PTR() for
drm_prime_pages_to_sg() and IS_ERR_OR_NULL() macro is replaced
with IS_ERR() macro for drm_gem_map_dma_buf().

Change-Id: Ibe9bd92bbf98c297fa2a7350a7295db3948e492f
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: fix to check return of dma_map_sg in prime helper
YoungJun Cho [Mon, 24 Jun 2013 06:34:21 +0000 (15:34 +0900)]
drm/prime: fix to check return of dma_map_sg in prime helper

The dma_map_sg(), in map_dma_buf callback operation of prime helper,
can return 0 when it fails to map, so it needs to release related
resources.

Change-Id: Iccceea70885a38e3f6e8eb5c67a11503442c6233
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/gem: add mutex lock when using drm_gem_mmap_obj
YoungJun Cho [Wed, 26 Jun 2013 23:39:58 +0000 (08:39 +0900)]
drm/gem: add mutex lock when using drm_gem_mmap_obj

The drm_gem_mmap_obj() has to be protected with dev->struct_mutex,
but some caller functions do not. So it adds mutex lock to missing
callers and adds assertion to check whether drm_gem_mmap_obj() is
called with mutex lock or not.

Change-Id: I14bc4ff6ca3bbb263548e1dfc791b83ddebd1f73
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/cma: Cocci spatch "ptr_ret.spatch"
Thomas Meyer [Sat, 1 Jun 2013 09:56:46 +0000 (09:56 +0000)]
drm/cma: Cocci spatch "ptr_ret.spatch"

Change-Id: I99278935542e7a39fbd387871f473d4050d4c9c1
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/prime: Cocci spatch "err_cast.spatch"
Thomas Meyer [Sat, 1 Jun 2013 10:09:27 +0000 (10:09 +0000)]
drm/prime: Cocci spatch "err_cast.spatch"

Change-Id: I0bef77cfc5aaf26379d8da5cf1cc77a155bebffc
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: Cocci spatch "memdup.spatch"
Thomas Meyer [Wed, 22 May 2013 21:06:30 +0000 (21:06 +0000)]
drm: Cocci spatch "memdup.spatch"

Change-Id: Id4720067545bd7aa7cc5e1d8866edc234a4d21a6
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: move pinning/unpinning to buffer attach
Maarten Lankhorst [Tue, 9 Apr 2013 07:52:54 +0000 (09:52 +0200)]
drm: move pinning/unpinning to buffer attach

This allows importing bo's to own device to work without requiring that the buffer is pinned in GART.

Change-Id: If20aa4e1a112118901baa4110ccb19d68b2a5ea5
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: add unpin function to prime helpers
Maarten Lankhorst [Tue, 9 Apr 2013 07:18:44 +0000 (09:18 +0200)]
drm: add unpin function to prime helpers

Prevents buffers from being pinned forever.

Change-Id: Ifee56b3eb72bf4c5e349e0daf5ebf3156c096247
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: GEM CMA: Add DRM PRIME support
Laurent Pinchart [Sun, 17 Feb 2013 00:57:30 +0000 (01:57 +0100)]
drm: GEM CMA: Add DRM PRIME support

Change-Id: Ib62164dfdbafad48053ecbc0b447aa3c9dc81482
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agodrm: GEM CMA: Split object mapping into GEM mapping and CMA mapping
Laurent Pinchart [Tue, 16 Apr 2013 12:32:34 +0000 (14:32 +0200)]
drm: GEM CMA: Split object mapping into GEM mapping and CMA mapping

The CMA-specific mapping code will be used to implement dma-buf mmap
support.

Change-Id: I8c60b83683b72bc9d5ba352b6c72e111bed86b83
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agodrm: GEM CMA: Split object creation into object alloc and DMA memory alloc
Laurent Pinchart [Sun, 17 Feb 2013 00:54:26 +0000 (01:54 +0100)]
drm: GEM CMA: Split object creation into object alloc and DMA memory alloc

This allows creating a GEM CMA object without an associated DMA memory
buffer, and will be used to implement DRM PRIME support.

Change-Id: I9e9e25f7323829939dae993bb7b343e3dfdd8014
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agodrm/omap: Use drm_gem_mmap_obj() to implement dma-buf mmap
Laurent Pinchart [Tue, 16 Apr 2013 12:21:23 +0000 (14:21 +0200)]
drm/omap: Use drm_gem_mmap_obj() to implement dma-buf mmap

The dma-buf mmap code was copied from the GEM mmap implementation.
Replace it with the new drm_gem_mmap_obj() function.

Change-Id: I5dd5b285891debd85f458b66e0f3778d8dcec8d5
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agodrm/gem: Split drm_gem_mmap() into object search and object mapping
Laurent Pinchart [Tue, 16 Apr 2013 12:14:52 +0000 (14:14 +0200)]
drm/gem: Split drm_gem_mmap() into object search and object mapping

The drm_gem_mmap() function first finds the GEM object to be mapped
based on the fake mmap offset and then maps the object. Split the object
mapping code into a standalone drm_gem_mmap_obj() function that can be
used to implement dma-buf mmap() operations.

Change-Id: I0be7c06a06dad981ea5f2e7dddbf55e47301bf31
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agoRevert "gpu/drm: Allow drm_prime_add_buf_handle to use outside drm_prime.c"
Joonyoung Shim [Fri, 8 Jan 2016 07:15:44 +0000 (16:15 +0900)]
Revert "gpu/drm: Allow drm_prime_add_buf_handle to use outside drm_prime.c"

This reverts commit e3bc8acb9541c75789cc486aeff1bd51124676ff.

8 years agoRevert "drm/prime: resolve race for drm_gem_prime_handle_to_fd()"
Joonyoung Shim [Fri, 8 Jan 2016 07:15:34 +0000 (16:15 +0900)]
Revert "drm/prime: resolve race for drm_gem_prime_handle_to_fd()"

This reverts commit cf0ea65cd31feb199d78b15ab0fbcedde852019f.

8 years agoRevert "drm/sprd: Avoid dma_buf creation on every prime_handle_fd()"
Joonyoung Shim [Fri, 8 Jan 2016 07:15:26 +0000 (16:15 +0900)]
Revert "drm/sprd: Avoid dma_buf creation on every prime_handle_fd()"

This reverts commit 9b842ab3914d407545fb2903adedb617e6dd4923.

8 years agoRevert "drm/sprd: Add lookup for gem_handle/dma_buf"
Joonyoung Shim [Fri, 8 Jan 2016 07:15:16 +0000 (16:15 +0900)]
Revert "drm/sprd: Add lookup for gem_handle/dma_buf"

This reverts commit 826db2d77c3fe927c9218cbddddfbf1ead8d2486.

8 years agoSmack: type confusion in smak sendmsg() handler 04/56704/2
Roman Kubiak [Thu, 17 Dec 2015 12:24:35 +0000 (13:24 +0100)]
Smack: type confusion in smak sendmsg() handler

Smack security handler for sendmsg() syscall
is vulnerable to type confusion issue what
can allow to privilege escalation into root
or cause denial of service.

A malicious attacker can create socket of one
type for example AF_UNIX and pass is into
sendmsg() function ensuring that this is
AF_INET socket.

Remedy
Do not trust user supplied data.
Proposed fix below.

Change-Id: I6d8b3a3eb9560c0e6d6bfef59e56d6ec659e2d3d
Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Signed-off-by: Mateusz Fruba <m.fruba@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
[Backport from linux-next of v4.5-rc]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agospec: copy modules instead of move 36/56536/1 accepted/tizen/mobile/20160111.225744 submit/tizen/20160111.073817
Seung-Woo Kim [Mon, 11 Jan 2016 05:36:34 +0000 (14:36 +0900)]
spec: copy modules instead of move

This patch copy modules to proper directory instead of move to
install two sets of modules.

Change-Id: I1d6c44cf8ebbfb44bf99c821cf3b1f6d7f2f5825
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agospec: remove unnecessary version from package name 35/56535/1
Seung-Woo Kim [Mon, 11 Jan 2016 05:33:03 +0000 (14:33 +0900)]
spec: remove unnecessary version from package name

There was unnecessary and wrong date and commit id in the package
name, so this patch removes it.

Change-Id: I14ed31d71dc7e1c0a95c843563dadf500f5958c2
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoSmack: File receive for sockets 99/55799/2 accepted/tizen/mobile/20151230.114529 submit/tizen/20151230.013941
Casey Schaufler [Mon, 7 Dec 2015 22:34:32 +0000 (14:34 -0800)]
Smack: File receive for sockets

The existing file receive hook checks for access on
the file inode even for UDS. This is not right, as
the inode is not used by Smack to make access checks
for sockets. This change checks for an appropriate
access relationship between the receiving (current)
process and the socket. If the process can't write
to the socket's send label or the socket's receive
label can't write to the process fail.

This will allow the legitimate cases, where the
socket sender and socket receiver can freely communicate.
Only strangly set socket labels should cause a problem.

Change-Id: Id37df53243264ac843f9c6693ba99aba9779f05e
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
[backport to 3.10 from smack-next commit 79be093500791cc25cc31bcaec5a4db62e21497b]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agosmack: Add missing logging in bidirectional UDS connect check 98/55798/2
Rafal Krypa [Thu, 8 Jan 2015 17:52:45 +0000 (18:52 +0100)]
smack: Add missing logging in bidirectional UDS connect check

During UDS connection check, both sides are checked for write access to
the other side. But only the first check is performed with audit support.
The second one didn't produce any audit logs. This simple patch fixes that.

Change-Id: I8f98910cec80687a18debfac818b50c9b0a9ddbd
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
[Backport from mainline to 3.10]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agosmack: Fix a bidirectional UDS connect check typo 97/55797/2
Zbigniew Jasinski [Mon, 29 Dec 2014 14:34:58 +0000 (15:34 +0100)]
smack: Fix a bidirectional UDS connect check typo

The 54e70ec5eb090193b03e69d551fa6771a5a217c4 commit introduced a
bidirectional check that should have checked for mutual WRITE access
between two labels. Due to a typo subject's OUT label is checked with
object's OUT. Should be OUT to IN.

Change-Id: I020748ac01bb12ed421be4ee20ab8d922c3399fe
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
[Backport from mainline to 3.10]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoFix a bidirectional UDS connect check typo 96/55796/2
Lukasz Pawelczyk [Fri, 29 Aug 2014 15:02:54 +0000 (17:02 +0200)]
Fix a bidirectional UDS connect check typo

The 54e70ec5eb090193b03e69d551fa6771a5a217c4 commit introduced a
bidirectional check that should have checked for mutual WRITE access
between two labels. Due to a typo the second check was incorrect.

Change-Id: I0ea34a529bc37e71c7342fe42b6d1c003837c5cd
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
[Backport from mainline to 3.10]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoSmack: bidirectional UDS connect check 95/55795/2
Casey Schaufler [Thu, 10 Apr 2014 23:37:08 +0000 (16:37 -0700)]
Smack: bidirectional UDS connect check

Smack IPC policy requires that the sender have write access
to the receiver. UDS streams don't do per-packet checks. The
only check is done at connect time. The existing code checks
if the connecting process can write to the other, but not the
other way around. This change adds a check that the other end
can write to the connecting process.

Targeted for git://git.gitorious.org/smack-next/kernel.git

Change-Id: Ibecf37e5644f66885acc02ae0ee96f8009a0b5fa
Signed-off-by: Casey Schuafler <casey@schaufler-ca.com>
[Backport from mainline to 3.10]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agodrm/sprd: Add lookup for gem_handle/dma_buf 42/55142/1 accepted/tizen/mobile/20151223.235519 submit/tizen/20151223.042011
Rohit kumar [Thu, 17 Dec 2015 06:42:26 +0000 (12:12 +0530)]
drm/sprd: Add lookup for gem_handle/dma_buf

This patch add support for translation gem_handle to dma_buf
and vice-versa. This allow us to have single gem_obj/gem_handle
associated with a buffer.It will be used in prime_fd_to_handle
and prime_handle_to_fd conversion.

Change-Id: I7333a08939112fa8e926a122b765a162e4f1811f
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agodrm/sprd: Avoid dma_buf creation on every prime_handle_fd() 41/55141/1
Rohit kumar [Wed, 16 Dec 2015 12:47:24 +0000 (18:17 +0530)]
drm/sprd: Avoid dma_buf creation on every prime_handle_fd()

This patch stores the dma_buf associated with the gem_object in
obj->export_dma_buf and reuse it in prime_handle_to_fd().

Change-Id: I679b3eed769d334ed39392e9c7c4011cc2652fbc
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agodrm/prime: resolve race for drm_gem_prime_handle_to_fd() 40/55140/1
YoungJun Cho [Tue, 4 Feb 2014 07:24:35 +0000 (16:24 +0900)]
drm/prime: resolve race for drm_gem_prime_handle_to_fd()

This patch resolves race for drm_gem_prime_handle_to_fd().
There could be a race when drm_gem_prime_handle_to_fd() is
requested during __fput() is executed with same dmabuf.

Change-Id: I8ab68a7184ce974ded84c75a7805b9aa1d021ee2
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agogpu/drm: Allow drm_prime_add_buf_handle to use outside drm_prime.c 39/55139/1
Rohit kumar [Wed, 16 Dec 2015 05:21:19 +0000 (10:51 +0530)]
gpu/drm: Allow drm_prime_add_buf_handle to use outside drm_prime.c

Make drm_prime_add_buf_handle non-static to use it from other files.

Change-Id: I95e9442deca42adbe8a1293588f82391ac46556d
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
8 years agoSmack: pipefs fix in smack_d_instantiate 86/54486/1 accepted/tizen/mobile/20151217.093234 submit/tizen/20151217.041356
Roman Kubiak [Mon, 5 Oct 2015 10:27:16 +0000 (12:27 +0200)]
Smack: pipefs fix in smack_d_instantiate

This fix writes the task label when
smack_d_instantiate is called, before the
label of the superblock was written on the
pipe's inode.

Change-Id: I3d4fcf5b8e652d6f2abfe5ef0dfd96306f2c8219
Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agosmack: introduce a special case for tmpfs in smack_d_instantiate() 85/54485/1
Łukasz Stelmach [Tue, 16 Dec 2014 15:53:08 +0000 (16:53 +0100)]
smack: introduce a special case for tmpfs in smack_d_instantiate()

Files created with __shmem_file_stup() appear to have somewhat fake
dentries which make them look like root directories and not get
the label the current process or ("*") star meant for tmpfs files.

Change-Id: Id97004f2a5090cee9c16778109d849d433bd39c9
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoARM: dts: sc7730: add Performance Monitoring Unit(PMU) node 53/53653/2
Geunsik Lim [Fri, 4 Dec 2015 00:45:40 +0000 (09:45 +0900)]
ARM: dts: sc7730: add Performance Monitoring Unit(PMU) node

This patch is to support perf command with performance monitoring
unit (PMU) of SC7730S CPU on Z3 device. If you want to monitor
hardware information such as cpu cycles, insns per cycle, cache miss,
and branches, you must enable this patch.

For example,
sh-3.2# uname -a
Linux localhost 3.10.65-00016-g465f771-dirty #2-Tizen SMP PREEMPT Fri Dec 4 08:38:31 KST 2015 armv7l GNU/Linux

sh-3.2#
sh-3.2# perf list | grep "Hardware event"
  cpu-cycles OR cycles                               [Hardware event]
  instructions                                       [Hardware event]
  cache-references                                   [Hardware event]
  cache-misses                                       [Hardware event]
  branch-instructions OR branches                    [Hardware event]
  branch-misses                                      [Hardware event]
  bus-cycles                                         [Hardware event]
  stalled-cycles-frontend OR idle-cycles-frontend    [Hardware event]
  stalled-cycles-backend OR idle-cycles-backend      [Hardware event]
  ref-cycles                                         [Hardware event]
sh-3.2#
sh-3.2#
sh-3.2# perf stat ls

 Performance counter stats for 'ls':

          5.950928 task-clock                #    0.666 CPUs utilized
                 5 context-switches          #    0.840 K/sec
                 0 cpu-migrations            #    0.000 K/sec
               224 page-faults               #    0.038 M/sec
           5962814 cycles                    #    1.002 GHz
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
           1629441 instructions              #    0.27  insns per cycle
            197736 branches                  #   33.228 M/sec
             55299 branch-misses             #   27.97% of all branches

       0.008941650 seconds time elapsed
sh-3.2#
sh-3.2# perf record -a
^C (Press Ctrl + C key)
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.947 MB perf.data (~41368 samples) ]

sh-3.2# cat /proc/sys/kernel/kptr_restrict
2
sh-3.2# echo 0 > /proc/sys/kernel/kptr_restrict
sh-3.2# cat /proc/sys/kernel/kptr_restrict
0

sh-3.2# perf report
Samples: 2K of event 'cycles', Event count (approx.): 331006766
13.53%          swapper  [kernel.kallsyms]           [k] sc_enter_idle
  8.59%          swapper  [kernel.kallsyms]           [k] tick_nohz_idle_exit
  7.67%    enlightenment  libc-2.20-2014.11.so        [.] 0x000bdf34
  4.92%          swapper  [kernel.kallsyms]           [k] _raw_spin_unlock_irq
  4.61%    enlightenment  [kernel.kallsyms]           [k] _raw_spin_unlock_irqr
  4.11%    enlightenment  [kernel.kallsyms]           [k] user_exit
  3.98%    enlightenment  [kernel.kallsyms]           [k] _raw_spin_unlock_irq
  2.94%          swapper  [kernel.kallsyms]           [k] tick_nohz_idle_enter
  1.83%  tizenstoreservi  [kernel.kallsyms]           [k] _raw_spin_unlock_irq
  1.61%    enlightenment  libecore.so.1.13.0          [.] 0x0000ba3c
  1.00%    enlightenment  libpthread-2.20-2014.11.so  [.] recvmsg
  0.89%    enlightenment  libeo.so.1.13.0             [.] _eo_call_resolve
  0.75%    enlightenment  [kernel.kallsyms]           [k] fget_light
  0.74%    enlightenment  [kernel.kallsyms]           [k] __gptimer_clocksource
  0.73%    enlightenment  libpthread-2.20-2014.11.so  [.] 0x00009db0
  0.72%  tizenstoreservi  libc-2.20-2014.11.so        [.] 0x000d9fa8
  0.70%    enlightenment  libeo.so.1.13.0             [.] eo_data_scope_get
  0.65%    enlightenment  [kernel.kallsyms]           [k] do_select
  0.64%    enlightenment  libecore_x.so.1.13.0        [.] 0x000322c6
  0.64%    enlightenment  libeo.so.1.13.0             [.] _eo_do_start
  0.59%  cloud-pdm-serve  [kernel.kallsyms]           [k] _raw_spin_unlock_irq
  0.55%    enlightenment  enlightenment               [.] 0x00051120

sh-3.2#

Change-Id: Icc16380e3dc7027d45b7a6a202c589375d68b255
Reported-by: Geunsik Lim <geunsik.lim@samsung.com>
Tested-by: Geunsik Lim <geunsik.lim@samsung.com>
Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
Signed-off-by: Congfu Zhao <Congfu.Zhao@spreadtrum.com>
CC: Vishnu Pratap Singh <vishnu.ps@samsung.com>
CC: Manjunatha Achar <a.manjunatha@samsung.com>
CC: Rajkumar Chandrasekar <c.rajkumar@samsung.com>
CC: Pintu Kumar <pintu.k@samsung.com>
CC: MyungJoo Ham <myungjoo.ham@samsung.com>
8 years agoserial: sprd: Fix wrong console output on tty port 1 40/52340/2 accepted/tizen/mobile/20151127.070411 submit/tizen/20151127.043104
Joonyoung Shim [Mon, 23 Nov 2015 02:49:31 +0000 (11:49 +0900)]
serial: sprd: Fix wrong console output on tty port 1

Now, tty port 1 for serial console has a problem that serial console
output shows like ����������������������������������������.

The reason is by the function that resets the serial port in shutdown().
This patch reverts it to old codes instead of reset for tty port 1.

Change-Id: I83817394bda9226e2d35e9072dfde616d6d9a24f
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agokernel: swap-modules: remove swap-modules codes 15/52515/4
Hyeongsik Min [Tue, 24 Nov 2015 04:52:50 +0000 (13:52 +0900)]
kernel: swap-modules: remove swap-modules codes

swap-modules will be loaded as a kernel module

Change-Id: I28d8d5c9fc7f2f8cb218f8b59bd322899db51232
Signen-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
8 years agoARM: tizen_tm1_defconfig: Enable missing features related with CGROUPS 21/52721/1
Joonyoung Shim [Thu, 26 Nov 2015 07:12:32 +0000 (16:12 +0900)]
ARM: tizen_tm1_defconfig: Enable missing features related with CGROUPS

CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y

Especially, the security manager needs CONFIG_CPUSETS and
CONFIG_PROC_PID_CPUSET.

Change-Id: Idd49d81fabc937eb259e0654502681e358d90e19
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: tizen_tm1_defconfig: Enable namespaces 55/52255/1 accepted/tizen/mobile/20151122.234211 submit/tizen/20151120.082818
Joonyoung Shim [Fri, 20 Nov 2015 07:26:18 +0000 (16:26 +0900)]
ARM: tizen_tm1_defconfig: Enable namespaces

To fix that systemd-hostnamed is failed.

Change-Id: I95efe13133bec30a69d12699d627cd0554e35d4f
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoarm: config: tm1: enable netfilter multiport configuration 30/52130/1 accepted/tizen/mobile/20151119.232244 submit/tizen/20151119.092412
Jaehoon Chung [Thu, 19 Nov 2015 08:14:20 +0000 (17:14 +0900)]
arm: config: tm1: enable netfilter multiport configuration

Enable the multiport.
Previous config is wrong. Re-commit this patch.

Change-Id: Ie2b38a4c2aaa922dfcd1fd3de47fc781bda7c5b3
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
8 years agoRevert "arm: config: tm1: enable netfilter multiport configuration" 29/52129/1
Jaehoon Chung [Thu, 19 Nov 2015 08:13:24 +0000 (17:13 +0900)]
Revert "arm: config: tm1: enable netfilter multiport configuration"

This reverts commit 908f8b80a3eadca0a9515f71a3c1ab739c74e0a9.

Change-Id: I1563acc745813075494c427b496cf0fda1af8c17

8 years agoBATTERY: Add missing get_property() of some property 06/52106/2
Joonyoung Shim [Thu, 19 Nov 2015 03:03:26 +0000 (12:03 +0900)]
BATTERY: Add missing get_property() of some property

The property of power should be implemented both get_property() and
set_property() but some property has only set_property() and it causes
some problem on tizen_3.0 platform like belows.

[   15.804351]  [3:systemd-journal:  188] power_supply sec-charger: driver failed to report `voltage_max' property: -22
[   27.924804]  [3:systemd-journal:  188] power_supply sec-fuelgauge: driver failed to report `status' property: -22
[   28.080047]  [3:systemd-journal:  179] power_supply sec-fuelgauge: driver failed to report `charge_full' property: -22
[   20.704162]  [0:systemd-journal:  180] power_supply sec-fuelgauge: driver failed to report `present' property: -22
[   19.580261]  [1:systemd-journal:  181] power_supply sec-fuelgauge: driver failed to report `energy_now' property: -22
[   20.989288]  [2:systemd-journal:  167] power_supply sec-fuelgauge: driver failed to report `temp' property: -22
[   20.832183]  [2:systemd-journal:  177] power_supply sec-fuelgauge: driver failed to report `temp_ambient' property: -22

This is workaround so driver should implement get_property() exactly
later.

Change-Id: I9d9650b748bdb73ae3149f0c4709908d0c0bb962
Signed-off-by: Min Kang <min1023.kang@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agonet: wirelss: sc2331: Apply the tethering APIs patch 25/52125/1
Jaehoon Chung [Thu, 19 Nov 2015 02:53:02 +0000 (11:53 +0900)]
net: wirelss: sc2331: Apply the tethering APIs patch

Applied tethering APIs patch received from spreadtrum.
(This is related with MAC control.)

Change-Id: I992d810fb3e2813dd77ba3e0684c73e58a2d2a75
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
8 years agoarm: config: tm1: enable netfilter multiport configuration 24/52124/1
Jaehoon Chung [Thu, 19 Nov 2015 01:12:02 +0000 (10:12 +0900)]
arm: config: tm1: enable netfilter multiport configuration

Enable CONFIG_NETFILTER_XT_MATCH_MULTIPORT.

Change-Id: I0a504c030549880f88e27c887216bfa4dde14010
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
8 years agoUpdate from product codes
Joonyoung Shim [Mon, 16 Nov 2015 08:37:19 +0000 (17:37 +0900)]
Update from product codes

Until commit 5cfebdc36f5b88225c4f8c032f7cf511ebba1cc5

Change-Id: I0f838df8640acefc0cdecd628e7c7cd10360d78f
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agospec: fix badness problem by rpmlint
Joonyoung Shim [Fri, 13 Nov 2015 08:32:42 +0000 (17:32 +0900)]
spec: fix badness problem by rpmlint

Errors:

[  978s] RPMLINT report:
[  978s] ===============
[  978s] qemu: Unsupported syscall: 311
[ 1870s] (none): E: badness 6147800 exceeds threshold 2000, aborting.

Badness cases:

E: spurious-executable-perm (Badness: 50)
E: non-standard-group (Badness: 200)
E: license-placeholder-not-allowed (Badness: 200)
E: invalid-license (Badness: 200)
E: group-placeholder-not-allowed (Badness: 200)
E: files-duplicated-waste (Badness: 100)
E: dir-or-file-in-tmp (Badness: 200)

Changes:

- Fix licenses and group tags
- s/var\/tmp/boot/
- add command in %install of spec
find %{buildroot}/boot/kernel/ -name "*.h" -exec chmod 644 {} \;

Change-Id: Idf55ca574cf7d15453a23ebb72cf717778ed75d6
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agospec: do not check target_name
Inki Dae [Thu, 12 Nov 2015 10:38:34 +0000 (19:38 +0900)]
spec: do not check target_name

Now public Tizen 3.0 doesn't support target name
so the relevant script should be removed to build
kernel.

Change-Id: I21ea402c2274e76b2fd197bca1505413a4616b0a
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agotizen 2.4 release
jk7744.park [Sat, 24 Oct 2015 09:15:53 +0000 (18:15 +0900)]
tizen 2.4 release

8 years agoInitial empty repository
Jeonghoon Jeon [Fri, 23 Oct 2015 09:43:19 +0000 (02:43 -0700)]
Initial empty repository