platform/kernel/linux-exynos.git
9 years agokmsg: introduce additional kmsg devices support 60/48460/5
Marcin Niesluchowski [Wed, 29 Apr 2015 17:37:05 +0000 (19:37 +0200)]
kmsg: introduce additional kmsg devices support

kmsg device provides operations on cyclic logging buffer used mainly
by kernel but also in userspace by privileged processes.

Additional kmsg devices keep the same log format but may be added
dynamically with custom size.

Change-Id: I52c28310197594888621000bb5be933173c3031d
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
9 years agoprintk: add one function for storing log in proper format 59/48459/3
Marcin Niesluchowski [Thu, 2 Jul 2015 14:54:51 +0000 (16:54 +0200)]
printk: add one function for storing log in proper format

Preparation commit for future changes purpose.

Separate code responsible for storing log message in proper format
from operations on consoles by putting it in another function.

Change-Id: I6d744bb83f8dd0e4ae5afe05bd082092e28082a9
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
9 years agoprintk: move code regarding log message storing format 58/48458/3
Marcin Niesluchowski [Thu, 2 Jul 2015 14:32:28 +0000 (16:32 +0200)]
printk: move code regarding log message storing format

Preparation commit for future changes purpose.

Moves some code responsible for storing log messages in proper format.

Change-Id: I1df4bb2c1f2e7643129ba73e7355a0cfb7d511ca
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
9 years agoprintk: guard the amount written per line by devkmsg_read() 57/48457/3
Tejun Heo [Thu, 14 May 2015 15:36:36 +0000 (11:36 -0400)]
printk: guard the amount written per line by devkmsg_read()

devkmsg_read() uses 8k buffer and assumes that the formatted output
message won't overrun which seems safe given LOG_LINE_MAX, the current
use of dict and the escaping method being used; however, we're
planning to use devkmsg formatting wider and accounting for the buffer
size properly isn't that complicated.

This patch defines CONSOLE_EXT_LOG_MAX as 8192 and updates
devkmsg_read() so that it limits output accordingly.

Change-Id: Ic8579ddcd55294a38561e9e8b28449c067600db1
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay@vrfy.org>
Cc: Petr Mladek <pmladek@suse.cz>
9 years agopackaging: enable KDBUS for odroidxu3 accepted/tizen/ivi/20160406.013407 accepted/tizen/mobile/20160406.013250 accepted/tizen/tv/20160406.013332 accepted/tizen/wearable/20160406.013348 submit/tizen/20160405.082219
Paul Osmialowski [Thu, 9 Jul 2015 16:27:32 +0000 (18:27 +0200)]
packaging: enable KDBUS for odroidxu3

CONFIG_KDBUS=y line added to odroidxu3_defconfig in the exact spot where it is
usually placed in .config file.

Change-Id: I019070af680aa8f1316cd2c2d069731d19f7c5b4
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: pool: use __vfs_read()
Sergei Zviagintsev [Thu, 23 Apr 2015 13:06:17 +0000 (15:06 +0200)]
kdbus: pool: use __vfs_read()

After commit 5d5d56897530 ("make new_sync_{read,write}() static")
->read() cannot be called directly.

kdbus_pool_slice_copy() leads to oops, which can be reproduced by
launching tools/testing/selftests/kdbus/kdbus-test -t message-quota:

[ 1167.146793] BUG: unable to handle kernel NULL pointer dereference at           (null)
[ 1167.147554] IP: [<          (null)>]           (null)
[ 1167.148670] PGD 3a9dd067 PUD 3a841067 PMD 0
[ 1167.149611] Oops: 0010 [#1] SMP
[ 1167.150088] Modules linked in: nfsv3 nfs kdbus lockd grace sunrpc
[ 1167.150771] CPU: 0 PID: 518 Comm: kdbus-test Not tainted 4.0.0-next-20150420-kdbus #62
[ 1167.150771] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 1167.150771] task: ffff88003daed120 ti: ffff88003a800000 task.ti: ffff88003a800000
[ 1167.150771] RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
[ 1167.150771] RSP: 0018:ffff88003a803bc0  EFLAGS: 00010286
[ 1167.150771] RAX: ffff8800377fb000 RBX: 00000000000201e8 RCX: ffff88003a803c00
[ 1167.150771] RDX: 0000000000000b40 RSI: ffff8800377fb4c0 RDI: ffff88003d815700
[ 1167.150771] RBP: ffff88003a803c48 R08: ffffffff8139e380 R09: ffff880039d80490
[ 1167.150771] R10: ffff88003a803a90 R11: 00000000000004c0 R12: 00000000002a24c0
[ 1167.150771] R13: 0000000000000b40 R14: ffff88003d815700 R15: ffffffff8139e460
[ 1167.150771] FS:  00007f41dccd4740(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
[ 1167.150771] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1167.150771] CR2: 0000000000000000 CR3: 000000003ccdf000 CR4: 00000000000007b0
[ 1167.150771] Stack:
[ 1167.150771]  ffffffffa0065497 ffff88003a803c10 00007ffffffff000 ffff88003aaa67c0
[ 1167.150771]  00000000000004c0 ffff88003aaa6870 ffff88003ca83300 ffffffffa006537d
[ 1167.150771]  00000000000201e8 ffffea0000ddfec0 ffff88003a803c20 0000000000000018
[ 1167.150771] Call Trace:
[ 1167.150771]  [<ffffffffa0065497>] ? kdbus_pool_slice_copy+0x127/0x200 [kdbus]
[ 1167.150771]  [<ffffffffa006537d>] ? kdbus_pool_slice_copy+0xd/0x200 [kdbus]
[ 1167.150771]  [<ffffffffa006670a>] kdbus_queue_entry_move+0xaa/0x180 [kdbus]
[ 1167.150771]  [<ffffffffa0059e64>] kdbus_conn_move_messages+0x1e4/0x2c0 [kdbus]
[ 1167.150771]  [<ffffffffa006234e>] kdbus_name_acquire+0x31e/0x390 [kdbus]
[ 1167.150771]  [<ffffffffa00625c5>] kdbus_cmd_name_acquire+0x125/0x130 [kdbus]
[ 1167.150771]  [<ffffffffa005db5d>] kdbus_handle_ioctl+0x4ed/0x610 [kdbus]
[ 1167.150771]  [<ffffffff811040e0>] do_vfs_ioctl+0x2e0/0x4e0
[ 1167.150771]  [<ffffffff81389750>] ? preempt_schedule_common+0x1f/0x3f
[ 1167.150771]  [<ffffffff8110431c>] SyS_ioctl+0x3c/0x80
[ 1167.150771]  [<ffffffff8138c36e>] system_call_fastpath+0x12/0x71
[ 1167.150771] Code:  Bad RIP value.
[ 1167.150771] RIP  [<          (null)>]           (null)
[ 1167.150771]  RSP <ffff88003a803bc0>
[ 1167.150771] CR2: 0000000000000000
[ 1167.168756] ---[ end trace a676bcfa75db5a96 ]---

Use __vfs_read() instead.

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agokdbus: disable all internal policy checks
Lukasz Skalski [Mon, 4 Jan 2016 14:59:07 +0000 (15:59 +0100)]
kdbus: disable all internal policy checks

Change-Id: I5ef09ea4e4389ca41a6ef7afda31fe3a8d9bc507
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
9 years agokdbus: Eliminate warning caused by lack of uapi/linux/kdbus.h inclusion
Paul Osmialowski [Thu, 3 Sep 2015 14:38:42 +0000 (16:38 +0200)]
kdbus: Eliminate warning caused by lack of uapi/linux/kdbus.h inclusion

metadata.h references struct kdbus_pids which is defined in
uapi/linux/kdbus.h

Normally, kdbus/metadata.h is included as one of many other headers
that eventually include uapi/linux/kdbus.h at some point.

When included alone, it causes warning. Also when kdbus/connection.h
is included alone (e.g. in smack_lsm.c) , the same warning is shown
as it includes kdbus/metadata.h.

This patch adds missing inclusion.

Change-Id: Id099e3e2f9e3389571ea9a2b21b1f901898960cd
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: Ability to run kdbus test by executable binary name
Paul Osmialowski [Wed, 29 Apr 2015 10:00:19 +0000 (12:00 +0200)]
kdbus: Ability to run kdbus test by executable binary name

With this applied, you can do following:

$ cp kdbus-test daemon
$ cp kdbus-test send

Then run 'daemon' in one shell session:

$ ./daemon --bus test

...and 'send' in another:

$ ./send --bus test

Useful for testing features introduced by previous patches.

Change-Id: Ic66355e664b7920736a0063b0ae6b456706d7d8d
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: selftests extended
Paul Osmialowski [Tue, 14 Apr 2015 13:55:09 +0000 (15:55 +0200)]
kdbus: selftests extended

The 'test-send' test case should connect to an already running test-daemon
which creates a bus with known name.

The main goal of this test case is to verify that messages as well as
file descriptors (opened with different open modes) can be transferred
properly.

In order to achieve its goals, this test case opens three files
(/tmp/kdbus-test-send.rd, /tmp/kdbus-test-send.wr,
/tmp/kdbus-test-send.rdwr) with three different open modes (O_RDONLY,
O_WRONLY, O_RDWR). If any of these files exists it is used 'as is',
otherwise it is created with some default content. Then this test tries
to send simple message followed by three messages each one of them
containing an array of opened file descriptors (single element array in the
first message, two element array in the second, three element array in the
third).

The ability to send array of file descriptors required changes in almost
all of the test case files.

Change-Id: I8b516458d8e8b786086b976aa2582ebeb4b173dc
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: TEST_CREATE_CONN now does no depend on TEST_CREATE_BUS
Paul Osmialowski [Wed, 29 Apr 2015 14:55:39 +0000 (16:55 +0200)]
kdbus: TEST_CREATE_CONN now does no depend on TEST_CREATE_BUS

Without this patch, it is impossible to specify test case able to
connect to a bus already created (e.g. by 'test-daemon' test case), you can
only specify:

1) TEST_CREATE_BUS which creates new bus, or
2) TEST_CREATE_CONN OR'ed with TEST_CREATE_BUS which creates new bus and
creates connection to it.

This patch adds the missing ability to specify TEST_CREATE_CONN alone.

It will be used by a new test case (will be added by separate commit) which
is supposed to connect to already started test-daemon case.

Change-Id: I10a4ccb76fa50a3b5f454f8e18031339f2f7d3d1
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agolsm: smack: smack callbacks for kdbus security hooks
Paul Osmialowski [Tue, 23 Jun 2015 14:11:46 +0000 (16:11 +0200)]
lsm: smack: smack callbacks for kdbus security hooks

This adds implementation of three smack callbacks sitting behind kdbus
security hooks as proposed by Karol Lewandowski.

Originates from:

git://git.infradead.org/users/pcmoore/selinux (branch: working-kdbus)
commit: fc3505d058c001fe72a6f66b833e0be5b2d118f3

https://github.com/lmctl/linux.git (branch: kdbus-lsm-v4.for-systemd-v212)
commit: 103c26fd27d1ec8c32d85dd3d85681f936ac66fb

Change-Id: I8f850ffdc8f2a5f38abde47f2996b6ff8defdc1f
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: use LSM hooks in kdbus code
Paul Osmialowski [Tue, 26 May 2015 10:00:33 +0000 (12:00 +0200)]
kdbus: use LSM hooks in kdbus code

Originates from:

https://github.com/lmctl/kdbus.git (branch: kdbus-lsm-v4.for-systemd-v212)
commit: aa0885489d19be92fa41c6f0a71df28763228a40

Change-Id: Ibcba82b35d22846c2593a42a0c66feda6a115a0f
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agolsm: kdbus security hooks
Paul Osmialowski [Tue, 26 May 2015 09:58:06 +0000 (11:58 +0200)]
lsm: kdbus security hooks

This is combination of work by Karol Lewandowski and Paul Moore
on LSM hooks for kdbus.

Originates from:

git://git.infradead.org/users/pcmoore/selinux (branch: working-kdbus)
commit: 7050f206a79564886938d0edc4e1e9da5972c72d

https://github.com/lmctl/linux.git (branch: kdbus-lsm-v4.for-systemd-v212)
commit: a9fe4c33b6e5ab25a243e0590df406aabb6add12

Change-Id: Ie55cd3eb6427542856d15ded7ba986712c2b9453
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agolsm: smack: Make ipc/kdbus includes visible so smack callbacks could see them
Paul Osmialowski [Tue, 26 May 2015 09:38:53 +0000 (11:38 +0200)]
lsm: smack: Make ipc/kdbus includes visible so smack callbacks could see them

Change-Id: I025bd8622a2667c0fe75736b16c7d3beae83f888
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agolsm: make security_file_receive available for external modules
Karol Lewandowski [Thu, 20 Feb 2014 16:54:38 +0000 (17:54 +0100)]
lsm: make security_file_receive available for external modules

This is required for using filedesc related LSM hooks in kdbus code
if it is built as a module.

Change-Id: I980b1938756761b260f88037e1073b26574bb37e
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
9 years agokdbus: disable internal kdbus policy
Lukasz Skalski [Mon, 24 Aug 2015 16:54:46 +0000 (18:54 +0200)]
kdbus: disable internal kdbus policy

Possibilities of connections to own, see and talk to well-known names
are already restricted by LSM hooks.

Change-Id: I62d86a506a85e6c48bdd3e0f8b11f1aa5a918c75
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
9 years agokdbus: do not append the same connection to the queue twice
Paul Osmialowski [Thu, 18 Jun 2015 15:29:11 +0000 (17:29 +0200)]
kdbus: do not append the same connection to the queue twice

As it was discussed on systemd ML [1], the same connection should be
queued up only once for a given well-known name.

[1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html

This commit fixes following issue:

[  243.364270] ------------[ cut here ]------------
[  243.364352] WARNING: CPU: 1 PID: 223 at ../ipc/kdbus/names.c:137 kdbus_name_entry_replace_owner+0x88/0x8c()
[  243.364408] Modules linked in:
[  243.364474] CPU: 1 PID: 223 Comm: kdbus-test Not tainted 4.0.0+ #1
[  243.364526] Hardware name: Foundation-v8A (DT)
[  243.364569] Call trace:
[  243.364639] [<ffff800000089d38>] dump_backtrace+0x0/0x12c
[  243.364718] [<ffff800000089e74>] show_stack+0x10/0x1c
[  243.364798] [<ffff8000006642f4>] dump_stack+0x74/0x98
[  243.364874] [<ffff8000000b282c>] warn_slowpath_common+0x98/0xd0
[  243.364951] [<ffff8000000b2928>] warn_slowpath_null+0x14/0x20
[  243.365026] [<ffff8000003cf7a4>] kdbus_name_entry_replace_owner+0x84/0x8c
[  243.365105] [<ffff8000003cf7e0>] kdbus_name_release_unlocked.isra.5+0x34/0x170
[  243.365183] [<ffff8000003d0554>] kdbus_cmd_name_release+0x1b8/0x1c8
[  243.365270] [<ffff8000003cbd28>] kdbus_handle_ioctl+0x5e0/0x690
[  243.365347] [<ffff8000001b3520>] do_vfs_ioctl+0x31c/0x5c0
[  243.365423] [<ffff8000001b3844>] SyS_ioctl+0x80/0x98
[  243.365473] ---[ end trace 5bf3630c98408d38 ]---

Change-Id: I469242f51c9b15e1701fc80962833e61575f360c
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: avoid the use of struct timespec
Arnd Bergmann [Fri, 10 Apr 2015 11:43:37 +0000 (13:43 +0200)]
kdbus: avoid the use of struct timespec

I did a routine check for new users of 'timespec', which we are trying to remove
from the kernel in order to survive y2038. kdbus came up and looks particularly
trivial to clean up.

This changes the three ktime_get_ts() variants used in kdbus to ktime_get_ns(),
which aside from removing timespec also simplifies the code and makes it
slightly more efficient by avoiding a two-way conversion.

Change-Id: Ia9a2da376609d8e0ec6e311e4c9f27ed3702350e
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation: kdbus: Fix typos
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:04 +0000 (13:08 +0300)]
Documentation: kdbus: Fix typos

Change-Id: Ie6272332da4189c3ea9ab851694307dd3abb2b99
Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation: kdbus: Fix description of KDBUS_SEND_SYNC_REPLY flag
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:05 +0000 (13:08 +0300)]
Documentation: kdbus: Fix description of KDBUS_SEND_SYNC_REPLY flag

Change-Id: I6f27bfb84682d278fdf0b76b84e65c5521be43d0
Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation: kdbus: Update list of ioctls which cause writing to receiver's pool
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:06 +0000 (13:08 +0300)]
Documentation: kdbus: Update list of ioctls which cause writing to receiver's pool

Add KDBUS_CMD_BUS_CREATOR_INFO.

Change-Id: I113c71482896d0a8490c105472110d5fac0b65d0
Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation: kdbus: Fix list of KDBUS_CMD_ENDPOINT_UPDATE errors
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:07 +0000 (13:08 +0300)]
Documentation: kdbus: Fix list of KDBUS_CMD_ENDPOINT_UPDATE errors

Remove EEXIST.

Change-Id: Ibb8ae36e822c436a384ef5d318befa9113405901
Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: uapi: Fix kernel-doc for enum kdbus_send_flags
Sergei Zviagintsev [Thu, 9 Apr 2015 10:11:01 +0000 (13:11 +0300)]
kdbus: uapi: Fix kernel-doc for enum kdbus_send_flags

Change-Id: Ie275fee2b7964190bffd86d63dbaaad07b45170d
Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoselftest/kdbus: enable cross compilation
Tyler Baker [Wed, 1 Apr 2015 23:20:16 +0000 (16:20 -0700)]
selftest/kdbus: enable cross compilation

Use the CC variable instead of hard coding gcc and include lib.mk.

Change-Id: Id77bffaf573e2ae9ded83fdc84d54c78b1188218
Signed-off-by: Tyler Baker <tyler.baker@linaro.org>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agosamples: kdbus: build kdbus-workers conditionally
Daniel Mack [Tue, 31 Mar 2015 13:11:34 +0000 (15:11 +0200)]
samples: kdbus: build kdbus-workers conditionally

Give the kdbus sample its own config switch and only build it if it's
explicitly switched on.

Change-Id: Ib51ce99a1800a07b2e14d8ed3076f6e9556bc981
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: Fix CONFIG_KDBUS help text
Daniel Mack [Tue, 24 Mar 2015 18:51:55 +0000 (19:51 +0100)]
kdbus: Fix CONFIG_KDBUS help text

Drop a left-over from the times when documentation lived in a
simple text file, which is no longer the case. Mention the
auto-generated man-pages and HTML files instead.

Change-Id: I9c2c665536149b7e171facdd8976c6d1dff6d132
Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: connection: fix handling of failed fget()
Daniel Mack [Tue, 17 Mar 2015 18:48:24 +0000 (19:48 +0100)]
kdbus: connection: fix handling of failed fget()

The patch 5fc8dd5c84fc: "kdbus: add connection, queue handling and
message validation code" from Sep 11, 2014, leads to the following
static checker warning:

ipc/kdbus/connection.c:2000 kdbus_cmd_send()
warn: 'cancel_fd' isn't an ERR_PTR

Fix this by checking for NULL pointers returned from fget().

Change-Id: Ibedba0331153b41ef535b79154ef5432e4bf0409
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: fix header guard name
Lucas De Marchi [Tue, 17 Mar 2015 12:21:42 +0000 (09:21 -0300)]
kdbus: fix header guard name

UAPI headers have a _UAPI_ as prefix, which is removed during
headers_install. If it's put as a suffix it will not be removed and will
be the only header with UAPI in the header guard macro.

Change-Id: I865bf183844d1df797ec99a3fffc95e4229a2504
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation/kdbus: replace 'reply_cookie' with 'cookie_reply'
Lukasz Skalski [Mon, 16 Mar 2015 09:35:08 +0000 (10:35 +0100)]
Documentation/kdbus: replace 'reply_cookie' with 'cookie_reply'

The member field is called 'cookie_reply', fix the documentation which
incorrectly used 'reply_cookie'.

Change-Id: I429e6f874dbf8519b7fa236537f4ad0d0401af75
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation/kdbus: support quiet builds
David Herrmann [Mon, 16 Mar 2015 09:17:12 +0000 (10:17 +0100)]
Documentation/kdbus: support quiet builds

Add support for quiet builds, just like Documentation/DocBook/Makefile
supports.

Change-Id: I88b209a29159828b50afd29d284dfd263cdbcdd0
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation/kdbus: fix out-of-tree builds
David Herrmann [Mon, 16 Mar 2015 09:17:11 +0000 (10:17 +0100)]
Documentation/kdbus: fix out-of-tree builds

Don't use $(obj) to access source files, but use $(srctree)/$(src)/
instead. This fixes build issues if you use O= with a directory other than
the source directory.

Change-Id: I7704357ae063b93a8902f4abdc6014ff497bd363
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agosamples/kdbus: drop wrong include
David Herrmann [Mon, 16 Mar 2015 09:17:10 +0000 (10:17 +0100)]
samples/kdbus: drop wrong include

There is no reason to use ./include/uapi/ directly from samples. If your
system headers are not up-to-date, you _need_ to run "make
headers-install" (which will install them to ./usr/ in your kernel tree)
before building the examples. Otherwise, you will get warnings and build
failures.

Once ./usr/ is updated with the correct headers, it contains everything we
need, so drop -Iinclude/uapi from the kdbus-workers CFLAGS.

Change-Id: I05517c534f46b2362e3eedccbf4043484541d600
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: fix minor typo in the walk-through example
Nicolas Iooss [Sun, 15 Mar 2015 05:13:08 +0000 (13:13 +0800)]
kdbus: fix minor typo in the walk-through example

s/receveiver/receiver/

Change-Id: Ibc3985ca9aae9cea69e1c3bc3236bb1d00ef308d
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: samples/kdbus: add -lrt
David Herrmann [Thu, 12 Mar 2015 16:27:31 +0000 (17:27 +0100)]
kdbus: samples/kdbus: add -lrt

On older systems -lrt is needed for clock_gettime(). Add it to
HOSTLOADLIBES of kdbus-workers so it builds fine on those systems.

Change-Id: I98d7f94b83ce37b77d85a79e6c14ff24110a4bd8
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoDocumentation: kdbus: fix location for generated files
Daniel Mack [Mon, 9 Mar 2015 17:00:46 +0000 (18:00 +0100)]
Documentation: kdbus: fix location for generated files

The generated files should reside in Documentation/kdbus, not in the
top-level of the source tree. Also add a .gitignore file and ignore
everything that was built from the XML files.

Change-Id: Iedb5f988fd7f539f8557e1fecb85d6ccf17f10ff
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add selftests
Daniel Mack [Sat, 13 Sep 2014 21:15:02 +0000 (23:15 +0200)]
kdbus: add selftests

This patch adds an extensive test suite for kdbus that checks the most
important code paths in the driver. The idea is to extend the test
suite over time.

Also, this code can serve as another example for how to use the kernel
API from userspace.

The code in the kdbus test suite makes use of the ioctl wrappers
provided by samples/kdbus/kdbus-api.h.

Change-Id: I9cac6c29c31faa5432b0f431a2f4e949b5e6422d
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add walk-through user space example
Daniel Mack [Thu, 26 Feb 2015 20:06:38 +0000 (21:06 +0100)]
kdbus: add walk-through user space example

Provide a walk-through example that explains how to use the low-level
ioctl API that kdbus offers. This example is meant to be useful for
developers who want to gain a in-depth understanding of how the kdbus
API works by reading a well-documented real-world example.

This program computes prime-numbers based on the sieve of Eratosthenes.
The master sets up a shared memory region and spawns workers which clear
out the non-primes. The master reacts to keyboard input and to
client-requests to control what each worker does. Note that this is in
no way meant as efficient way to compute primes. It should only serve as
example how a master/worker concept can be implemented with kdbus used
as control messages.

The main process is called the 'master'. It creates a new, private bus
which will be used between the master and its workers to communicate.
The master then spawns a fixed number of workers. Whenever a worker dies
(detected via SIGCHLD), the master spawns a new worker. When done, the
master waits for all workers to exit, prints a status report and exits
itself.

The master process does *not* keep track of its workers. Instead, this
example implements a PULL model. That is, the master acquires a
well-known name on the bus which each worker uses to request tasks from
the master. If there are no more tasks, the master will return an empty
task-list, which casues a worker to exit immediately.

As tasks can be computationally expensive, we support cancellation.
Whenever the master process is interrupted, it will drop its well-known
name on the bus. This causes kdbus to broadcast a name-change
notification. The workers check for broadcast messages regularly and
will exit if they receive one.

Change-Id: I67322b06f7e0b9e28126947a474d235d7791a01c
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add Makefile, Kconfig and MAINTAINERS entry
Daniel Mack [Thu, 11 Sep 2014 16:48:06 +0000 (18:48 +0200)]
kdbus: add Makefile, Kconfig and MAINTAINERS entry

This patch hooks up the build system to actually compile the files
added by previous patches. It also adds an entry to MAINTAINERS to
direct people to Greg KH, David Herrmann, Djalal Harouni and me for
questions and patches.

Change-Id: Ibd6c440501c0674245c3e9971b6b28d57a7d8c11
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add policy database implementation
Daniel Mack [Thu, 11 Sep 2014 17:00:43 +0000 (19:00 +0200)]
kdbus: add policy database implementation

This patch adds the policy database implementation.

A policy database restricts the possibilities of connections to own,
see and talk to well-known names. It can be associated with a bus
(through a policy holder connection) or a custom endpoint.

By default, buses have an empty policy database that is augmented on
demand when a policy holder connection is instantiated.

Policies are set through KDBUS_CMD_HELLO (when creating a policy
holder connection), KDBUS_CMD_CONN_UPDATE (when updating a policy
holder connection), KDBUS_CMD_EP_MAKE (creating a custom endpoint)
or KDBUS_CMD_EP_UPDATE (updating a custom endpoint). In all cases,
the name and policy access information is stored in items of type
KDBUS_ITEM_NAME and KDBUS_ITEM_POLICY_ACCESS.

See kdbus.policy(7) for more details.

Change-Id: I99ebd6dbec9ca7c4b8bd9609c40a0dea71d20a62
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add name registry implementation
Daniel Mack [Thu, 11 Sep 2014 17:00:00 +0000 (19:00 +0200)]
kdbus: add name registry implementation

This patch adds the name registry implementation.

Each bus instantiates a name registry to resolve well-known names
into unique connection IDs for message delivery. The registry will
be queried when a message is sent with kdbus_msg.dst_id set to
KDBUS_DST_ID_NAME, or when a registry dump is requested.

It's important to have this registry implemented in the kernel to
implement lookups and take-overs in a race-free way.

Change-Id: Ie03b0697a5dd2b50d04b69009f735b9b9cd8f6da
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add code for buses, domains and endpoints
Daniel Mack [Thu, 11 Sep 2014 16:59:39 +0000 (18:59 +0200)]
kdbus: add code for buses, domains and endpoints

Add the logic to handle the following entities:

Domain:
  A domain is an unamed object containing a number of buses. A
  domain is automatically created when an instance of kdbusfs
  is mounted, and destroyed when it is unmounted.
  Every domain offers its own 'control' device node to create
  buses. Domains are isolated from each other.

Bus:
  A bus is a named object inside a domain. Clients exchange messages
  over a bus. Multiple buses themselves have no connection to each
  other; messages can only be exchanged on the same bus. The default
  entry point to a bus, where clients establish the connection to, is
  the "bus" device node /sys/fs/kdbus/<bus name>/bus.  Common operating
  system setups create one "system bus" per system, and one "user
  bus" for every logged-in user. Applications or services may create
  their own private named buses.

Endpoint:
  An endpoint provides the device node to talk to a bus. Opening an
  endpoint creates a new connection to the bus to which the endpoint
  belongs. Every bus has a default endpoint called "bus". A bus can
  optionally offer additional endpoints with custom names to provide
  a restricted access to the same bus. Custom endpoints carry
  additional policy which can be used to give sandboxed processes
  only a locked-down, limited, filtered access to the same bus.

See kdbus(7), kdbus.bus(7), kdbus.endpoint(7) and kdbus.fs(7)
for more details.

Change-Id: Ia31004659d24b73f2180e4ff6155cdc9c2912e8d
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add code for notifications and matches
Daniel Mack [Thu, 11 Sep 2014 16:59:16 +0000 (18:59 +0200)]
kdbus: add code for notifications and matches

This patch adds code for matches and notifications.

Notifications are broadcast messages generated by the kernel, which
notify subscribes when connections are created or destroyed, when
well-known-names have been claimed, released or changed ownership,
or when reply messages have timed out.

Matches are used to tell the kernel driver which broadcast messages
a connection is interested in. Matches can either be specific on one
of the kernel-generated notification types, or carry a bloom filter
mask to match against a message from userspace. The latter is a way
to pre-filter messages from other connections in order to mitigate
unnecessary wakeups.

Change-Id: Ia5abbb8791b9029926f970afeb0639b4bb49fc1e
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add code to gather metadata
Daniel Mack [Thu, 11 Sep 2014 16:58:45 +0000 (18:58 +0200)]
kdbus: add code to gather metadata

A connection chooses which metadata it wants to have attached to each
message it receives with kdbus_cmd_hello.attach_flags. The metadata
will be attached as items to the messages. All metadata refers to
information about the sending task at sending time, unless otherwise
stated. Also, the metadata is copied, not referenced, so even if the
sending task doesn't exist anymore at the time the message is received,
the information is still preserved.

In traditional D-Bus, userspace tasks like polkit or journald make a
live lookup in procfs and sysfs to gain information about a sending
task. This is racy, of course, as in a a connection-less system like
D-Bus, the originating peer can go away immediately after sending the
message. As we're moving D-Bus prmitives into the kernel, we have to
provide the same semantics here, and inform the receiving peer on the
live credentials of the sending peer.

Metadata is collected at the following times.

 * When a bus is created (KDBUS_CMD_MAKE), information about the
   calling task is collected. This data is returned by the kernel
   via the KDBUS_CMD_BUS_CREATOR_INFO call.

 * When a connection is created (KDBUS_CMD_HELLO), information about
   the calling task is collected. Alternatively, a privileged
   connection may provide 'faked' information about credentials,
   PIDs and security labels which will be stored instead. This data
   is returned by the kernel as information on a connection
   (KDBUS_CMD_CONN_INFO). Only metadata that a connection allowed to
   be sent (by setting its bit in attach_flags_send) will be exported
   in this way.

 * When a message is sent (KDBUS_CMD_SEND), information about the
   sending task and the sending connection are collected. This
   metadata will be attached to the message when it arrives in the
   receiver's pool. If the connection sending the message installed
   faked credentials (see kdbus.connection(7)), the message will not
   be augmented by any information about the currently sending task.

Which metadata items are actually delivered depends on the following
sets and masks:

 (a) the system-wide kmod creds mask
     (module parameter 'attach_flags_mask')

 (b) the per-connection send creds mask, set by the connecting client

 (c) the per-connection receive creds mask, set by the connecting client

 (d) the per-bus minimal creds mask, set by the bus creator

 (e) the per-bus owner creds mask, set by the bus creator

 (f) the mask specified when querying creds of a bus peer

 (g) the mask specified when querying creds of a bus owner

With the following rules:

 [1] The creds attached to messages are determined as a & b & c.

 [2] When connecting to a bus (KDBUS_CMD_HELLO), and ~b & d != 0,
     the call will fail with, -1, and errno is set to ECONNREFUSED.

 [3] When querying creds of a bus peer, the creds returned
     are a & b & f.

 [4] When querying creds of a bus owner, the creds returned
     are a & e & g.

See kdbus.metadata(7) and kdbus.item(7) for more details on which
metadata can currently be attached to messages.

Change-Id: Iac5613506c5a3dd4045fa40caaf29687456d4144
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add node and filesystem implementation
Daniel Mack [Fri, 14 Nov 2014 08:59:08 +0000 (09:59 +0100)]
kdbus: add node and filesystem implementation

kdbusfs is a filesystem that will expose a fresh kdbus domain context
each time it is mounted. Per mount point, there will be a 'control'
node, which can be used to create buses. fs.c contains the
implementation of that pseudo-fs. Exported inodes of 'file' type have
their i_fop set to either kdbus_handle_control_ops or
kdbus_handle_ep_ops, depending on their type. The actual dispatching
of file operations is done from handle.c

node.c is an implementation of a kdbus object that has an id and
children, organized in an R/B tree. The tree is used by the filesystem
code for lookup and iterator functions, and to deactivate children
once the parent is deactivated. Every inode exported by kdbusfs is
backed by a kdbus_node, hence it is embedded in struct kdbus_ep,
struct kdbus_bus and struct kdbus_domain.

Change-Id: Id58f901f907569eb0ef9b77c0fb11a24c431acb5
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add connection, queue handling and message validation code
Daniel Mack [Thu, 11 Sep 2014 16:57:24 +0000 (18:57 +0200)]
kdbus: add connection, queue handling and message validation code

This patch adds code to create and destroy connections, to validate
incoming messages and to maintain the queue of messages that are
associated with a connection.

Note that connection and queue have a 1:1 relation, the code is only
split in two parts for cleaner separation and better readability.

Change-Id: I98c2a9f8a9e0999bff4d8ae63ae35f65c4ecd2ab
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add connection pool implementation
Daniel Mack [Thu, 11 Sep 2014 16:56:41 +0000 (18:56 +0200)]
kdbus: add connection pool implementation

A pool for data received from the kernel is installed for every
connection of the bus, and it is used to copy data from the kernel to
userspace clients, for messages and other information.

It is accessed when one of the following ioctls is issued:

  * KDBUS_CMD_MSG_RECV, to receive a message
  * KDBUS_CMD_NAME_LIST, to dump the name registry
  * KDBUS_CMD_CONN_INFO, to retrieve information on a connection

The offsets returned by either one of the aforementioned ioctls
describe offsets inside the pool. Internally, the pool is organized in
slices, that are dynamically allocated on demand. The overall size of
the pool is chosen by the connection when it connects to the bus with
KDBUS_CMD_HELLO.

In order to make the slice available for subsequent calls,
KDBUS_CMD_FREE has to be called on the offset.

To access the memory, the caller is expected to mmap() it to its task.

Change-Id: If4c201f8c0e20cfe403be0f0e76c966112260dd4
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add driver skeleton, ioctl entry points and utility functions
Daniel Mack [Thu, 11 Sep 2014 16:52:52 +0000 (18:52 +0200)]
kdbus: add driver skeleton, ioctl entry points and utility functions

Add the basic driver structure.

handle.c is the main ioctl command dispatcher that calls into other parts
of the driver.

main.c contains the code that creates the initial domain at startup, and
util.c has utility functions such as item iterators that are shared with
other files.

limits.h describes limits on things like maximum data structure sizes,
number of messages per users and suchlike. Some of the numbers currently
picked are rough ideas of what what might be sufficient and are probably
rather conservative.

Change-Id: I48b15c95f89f24bad0287be5aad2ac18e3e70326
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add uapi header file
Daniel Mack [Thu, 11 Sep 2014 16:38:06 +0000 (18:38 +0200)]
kdbus: add uapi header file

This patch adds the header file which describes the low-level
transport protocol used by various ioctls. The header file is located
in include/uapi/linux/ as it is shared between kernel and userspace,
and it only contains data structure definitions, enums and defines
for constants.

The low-level kernel API of kdbus is exposed through ioctls, employed
on nodes exposed by kdbusfs. We've chosen a ioctl-based implementation
over syscalls for various reaons:

 * The ioctls kdbus offers are completely specific to nodes exposed by
   kdbusfs and can not be applied to any other file descriptor in a
   system.

 * The file descriptors derived from opening nodes in kdbusfs can only be
   used for poll(), close() and the ioctls described in kdbus.h.

 * Not all systems will make use of kdbus eventually, and we want to
   make as many parts of the kernel optional at build time.

 * We want to build the kdbus code as module, which is impossible to
   do when implemented with syscalls.

 * The ioctl dispatching logic does not show up in our performance
   graphs; its overhead is negligible.

 * For development, being able to build, load and unload a separate
   module with a versioned name suffix is essential.

Change-Id: I22da2eecb1e18143ca0163763b288b94ceee92dd
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agokdbus: add documentation
Daniel Mack [Thu, 11 Sep 2014 19:50:47 +0000 (21:50 +0200)]
kdbus: add documentation

kdbus is a system for low-latency, low-overhead, easy to use
interprocess communication (IPC).

The interface to all functions in this driver is implemented via ioctls
on files exposed through a filesystem called 'kdbusfs'. The default
mount point of kdbusfs is /sys/fs/kdbus. This patch adds detailed
documentation about the kernel level API design.

This patch adds a set of comprehensive set of DocBook files which
can be turned into man-pages using 'make mandocs', or into HTML
files with 'make htmldocs'.

Change-Id: I27a6f5f5d951ce72f6187a58dcbd9d2c8a06ee26
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
9 years agoKEYS: Fix keyring ref leak in join_session_keyring()
Yevgeny Pats [Tue, 19 Jan 2016 22:09:04 +0000 (22:09 +0000)]
KEYS: Fix keyring ref leak in join_session_keyring()

This fixes CVE-2016-0728.

If a thread is asked to join as a session keyring the keyring that's already
set as its session, we leak a keyring reference.

This can be tested with the following program:

#include <stddef.h>
#include <stdio.h>
#include <sys/types.h>
#include <keyutils.h>

int main(int argc, const char *argv[])
{
int i = 0;
key_serial_t serial;

serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING,
"leaked-keyring");
if (serial < 0) {
perror("keyctl");
return -1;
}

if (keyctl(KEYCTL_SETPERM, serial,
   KEY_POS_ALL | KEY_USR_ALL) < 0) {
perror("keyctl");
return -1;
}

for (i = 0; i < 100; i++) {
serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING,
"leaked-keyring");
if (serial < 0) {
perror("keyctl");
return -1;
}
}

return 0;
}

If, after the program has run, there something like the following line in
/proc/keys:

3f3d898f I--Q---   100 perm 3f3f0000     0     0 keyring   leaked-keyring: empty

with a usage count of 100 * the number of times the program has been run,
then the kernel is malfunctioning.  If leaked-keyring has zero usages or
has been garbage collected, then the problem is fixed.

Change-Id: I08e8b8e929575583a94b6c84826c8f05e4dca075
Reported-by: Yevgeny Pats <yevgeny@perception-point.io>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Acked-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
[Backport from mainline commit 23567fd052a9abb6d67fe8e7a9ccdd9800a540f2 to resolve CVE-2016-0728]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agoBluetooth: hci_uart: Fix dereferencing of ERR_PTR
Chan-yeol Park [Wed, 17 Jun 2015 12:10:39 +0000 (21:10 +0900)]
Bluetooth: hci_uart: Fix dereferencing of ERR_PTR

If h4_recv_buf() return ERR_PTR instead sk_buff pointer, it should be
cleared once PTR_ERR is completed for the further dereference such as
h4_recv(), or h4_close().

Signed-off-by: Chan-yeol Park <chanyeol.park@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoclk: samsung: exynos5420: Add pll_rate_table and clock id for EPLL
Chanwoo Choi [Tue, 29 Dec 2015 01:42:39 +0000 (10:42 +0900)]
clk: samsung: exynos5420: Add pll_rate_table and clock id for EPLL

This patch add the clock id of EPLL to handle it on devicetree file
and the rate tables. EPLL is used as root clock of ASS (Audio Subsystem).

Change-Id: Iefcbd5ea4cb911a3b5d75888286926773a98af54
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
9 years agodrm/exynos: mixer: add experimental support for 1024x600@43Hz mode
Marek Szyprowski [Tue, 26 Jan 2016 08:45:13 +0000 (09:45 +0100)]
drm/exynos: mixer: add experimental support for 1024x600@43Hz mode

This patch adds experimental configuration data for HDMI PHY for 32MHz
pixel clock modes. This enables support for WaveShare 7inch HDMI LCD (C)
HDMI panel.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I2f711ef21ce21da58b8efaf6f6dd28c5e2d2e8fc

9 years agousb: gadget: composite: fill bcdUSB for any gadget max speed
Igor Kotrasinski [Thu, 20 Aug 2015 08:00:01 +0000 (10:00 +0200)]
usb: gadget: composite: fill bcdUSB for any gadget max speed

When handling device GET_DESCRIPTOR, composite gadget driver fills
the bcdUSB field only if the gadget supports USB 3.0. Otherwise
the field is left unfilled.

For consistency, set bcdUSB to 0x0200 for gadgets that don't
support superspeed.

It's correct to use 0x0200 for any setting that doesn't use
superspeed, since USB 2.0 devices can restrict themselves to
full speed only. It is NOT correct to use 0x0210, since BOS
descriptors are handled only if gadget_is_superspeed() is
satisfied, otherwise it results in a stall.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[Backported from mainline commit
5527e73305e8a9958b00331902a27514e62d539b]
Change-Id: Icd543a5b83c6b915be4ba54343ce979145f7e15d
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agousb: gadget: f_fs: do not set cancel function on synchronous {read,write}
Rui Miguel Silva [Mon, 18 May 2015 15:02:07 +0000 (16:02 +0100)]
usb: gadget: f_fs: do not set cancel function on synchronous {read,write}

do not try to set cancel function in synchronous operations in
ffs_epfile_{read,write}_iter.

Cc: <stable@vger.kernel.org> # v4.0+
Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[Backported from mainline commit
4088acf1e845aba35f30fb91dee10649edbd0e84]
Change-Id: Icd247a1b83a6b905be4aa54343ce979165f7e17d
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agodrm/exynos: fix imported dma-buf to be mapped
Joonyoung Shim [Tue, 22 Dec 2015 00:54:31 +0000 (09:54 +0900)]
drm/exynos: fix imported dma-buf to be mapped

The imported dma-buf should be mapped by sub-system exporting it.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[jy0922.shim: Be backported from upstream but not posted]

Change-Id: I59984d8111f058decf83afbda4d2df2e1edf305e

9 years agodrm/exynos: support mmap from dma-buf
Joonyoung Shim [Tue, 22 Dec 2015 00:50:10 +0000 (09:50 +0900)]
drm/exynos: support mmap from dma-buf

This allows exported dma-bufs to be mapped in exynos drm.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[jy0922.shim: Be backported from upstream but not posted]

Change-Id: Ic3bf3153707e2e57c1d930487428b6a83b96d658

9 years agodrm/exynos: remove call to drm_gem_free_mmap_offset()
Joonyoung Shim [Tue, 22 Dec 2015 00:35:55 +0000 (09:35 +0900)]
drm/exynos: remove call to drm_gem_free_mmap_offset()

The drm_gem_object_release() function already performs this cleanup,
so there is no reason to do it explicitly.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[jy0922.shim: Be backported from upstream]

Change-Id: I8dcac341340dd8dc31dbf528df2c537f22c6a701

9 years agomedia: s5p-mfc: set src_bufs_cnt with requested buffer for DMABUF and USERPTR
Seung-Woo Kim [Sat, 31 Oct 2015 08:24:54 +0000 (17:24 +0900)]
media: s5p-mfc: set src_bufs_cnt with requested buffer for DMABUF and USERPTR

During start_streaming of output, it checks src_bufs_cnt compared
with pb_count. But it is only meaningful for MMAP memory. So this
patch fixes to set src_bufs_cnt with requested buffer for non MMAP
memory.

Change-Id: Icd447f1b82a6b805be4aa54843ce979265f7e17d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agodrm: permit DRM_RENDER_ALLOW on DRM_IOCTL_GEM_FLINK
Joonyoung Shim [Tue, 6 Oct 2015 07:34:51 +0000 (16:34 +0900)]
drm: permit DRM_RENDER_ALLOW on DRM_IOCTL_GEM_FLINK

This permits DRM_RENDER_ALLOW on DRM_IOCTL_GEM_FLINK temporarily by
request of tizen platform until tizen platform uses dma-buf feature
fully.

Change-Id: I0431dba35655871c734611a9b53c39ec4f1bb26a
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agodrm/exynos: add DRM_EXYNOS_GEM_MAP ioctl
Joonyoung Shim [Fri, 2 Oct 2015 07:38:34 +0000 (16:38 +0900)]
drm/exynos: add DRM_EXYNOS_GEM_MAP ioctl

The commit d931589c01a2 ("drm/exynos: remove DRM_EXYNOS_GEM_MAP_OFFSET
ioctl") removed it same with the ioctl that this patch adds. The reason
that removed DRM_EXYNOS_GEM_MAP_OFFSET was we could use
DRM_IOCTL_MODE_MAP_DUMB. Both did exactly same thing.

Now we again will revive it as DRM_EXYNOS_GEM_MAP because of render
node. DRM_IOCTL_MODE_MAP_DUMB isn't permitted in render node.

Change-Id: I6900f89aa1f14ab06f56e257c4e77639cba8d5c7
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agoARM: dts: Fix wrong clock binding for sysmmu_fimd1_1 on exynos5420
Joonyoung Shim [Wed, 23 Sep 2015 07:41:55 +0000 (16:41 +0900)]
ARM: dts: Fix wrong clock binding for sysmmu_fimd1_1 on exynos5420

The sysmmu_fimd1_1 should bind the clock CLK_SMMU_FIMD1M1, not the clock
CLK_SMMU_FIMD1M0. CLK_SMMU_FIMD1M0 is a clock for the sysmmu_fimd1_0.

This wrong clock binding causes the problem that is blocked in iommu_map
function when IOMMU is enabled and exynos-drm driver tries to allocate
buffer via DMA mapping API on Odroid-XU3 board.

Change-Id: I030bbdad233446df59732a41260631dbdade0493
Fixes: b70045167815 ("ARM: dts: add sysmmu nodes for exynos5420")
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: <stable@vger.kernel.org> # v4.2
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
9 years agodrm/exynos: rotator: remove unnecessary cur_buf_id
Seung-Woo Kim [Mon, 31 Aug 2015 03:59:17 +0000 (12:59 +0900)]
drm/exynos: rotator: remove unnecessary cur_buf_id

After commit 2af026584c81faa37f26b86713d6331ddf70e3f3,
'drm/exynos: ipp: introduce last_buf_id', each driver do not need
to handler buf_id for the event. So this patch removes unnecessary
cur_buf_id from rotator.

Change-Id: Idd80765c41260ae6ce4488e56b0d4beaea76229a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agodrm/exynos: fimc: fix wrong buf_id access for dma channel
Seung-Woo Kim [Mon, 31 Aug 2015 03:07:55 +0000 (12:07 +0900)]
drm/exynos: fimc: fix wrong buf_id access for dma channel

For destination buffers, buf_id is valid only less than maximum
dest buffer count. So this patch fixes wrong buf_id access to
dma_channel.

Change-Id: I4c73ab90a2fc8e57ecb82f277d3d53c2e91b910a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agoARM: DTS: exynos5420: add GSCL block parent clock management to pm domain
Marek Szyprowski [Tue, 1 Sep 2015 09:23:09 +0000 (11:23 +0200)]
ARM: DTS: exynos5420: add GSCL block parent clock management to pm domain

Add support for restoring GSCALLER parent clocks configuration when GSCL
power domain is turned on.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
9 years agoclk: samsung: exynos5422: add missing parent GSCL block clocks
Marek Szyprowski [Tue, 1 Sep 2015 09:22:18 +0000 (11:22 +0200)]
clk: samsung: exynos5422: add missing parent GSCL block clocks

This patch adds clocks, which are required for preserving parent clock
configuration on GSCALLER power domain on/off.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
9 years agoclk: samsung: exynos5422: fix MFC clock hierarchy parent
Marek Szyprowski [Mon, 31 Aug 2015 11:52:43 +0000 (13:52 +0200)]
clk: samsung: exynos5422: fix MFC clock hierarchy parent

Proper source for MFC block is mout_user_aclk333 (in datasheet named
USER_MUX_ACLK_333), not the output of CLKDIV_ACLK_333 MUX.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
9 years agoARM: dma-mapping: add support for offset parameter in dma_mmap()
Marek Szyprowski [Fri, 28 Aug 2015 08:25:02 +0000 (10:25 +0200)]
ARM: dma-mapping: add support for offset parameter in dma_mmap()

IOMMU-based dma_mmap() implementation lacked proper support for offset
parameter used in mmap call (it always assumed that mapping starts from
offset zero). This patch adds support for offset parameter to IOMMU-based
implementation.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
CC: stable@vger.kernel.org # v3.6+
9 years agoARM: dma-mapping: add missing range check in dma_mmap()
Marek Szyprowski [Fri, 28 Aug 2015 08:24:11 +0000 (10:24 +0200)]
ARM: dma-mapping: add missing range check in dma_mmap()

dma_mmap() function in IOMMU-based dma-mapping implementation lacked
a check for valid range of mmap parameters (offset and buffer size), what
might have caused access beyond the allocated buffer. This patch fixes
this issue.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
CC: stable@vger.kernel.org # v3.6+
9 years agodrm/exynos: gsc: normalize invalid buf idx from userspace
Hyungwon Hwang [Mon, 24 Aug 2015 10:33:27 +0000 (19:33 +0900)]
drm/exynos: gsc: normalize invalid buf idx from userspace

At least in the one frame processing mode which is the only mode supported
by the current gsc driver, the buf idx is not meaningful for the driver.
Because only one address in the buffer is valid at a time, so it is OK to
convert the invalid buf idx from userspace to a valid idx, process the
frame, and return the result with original buf idx.

Change-Id: Ia56449498e90ae211d7ad0aaede5d48bdfec2d8b
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
9 years agodrm/exynos: ipp: introduce last_buf_id
Hyungwon Hwang [Wed, 26 Aug 2015 02:11:07 +0000 (11:11 +0900)]
drm/exynos: ipp: introduce last_buf_id

There is no reason to tie the buf idx from userspace and the real HW DMA
channel. So to separate them, the buf idx from userspace must be stored
to return the idx when the processing is done. This patch introduces
last_buf_id to store the current processing buf id for that purpose.

Change-Id: I74dd0c4c1ba59d3b94e6532dade6b5744c36b860
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
9 years agoARM: odroidxu3_defconfig: enable UACCESS_WITH_MEMCPY
Junghak Sung [Wed, 16 Sep 2015 06:23:34 +0000 (15:23 +0900)]
ARM: odroidxu3_defconfig: enable UACCESS_WITH_MEMCPY

Enable CONFIG_UACCESS_WITH_MEMCPY for odroid-xu3.
Fix an issue that sometimes TS data is broken when DVB demux pass the data
to user-space by using copy_to_user.

Change-Id: I7994f193871e70afe31df9c7abdd75b8909b587d
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
9 years agoARM: odroidxu3_defconfig: enable zram feature
Seung-Woo Kim [Mon, 7 Dec 2015 09:45:35 +0000 (18:45 +0900)]
ARM: odroidxu3_defconfig: enable zram feature

This patch enables zram feature which is used by Tizen resourced.

Change-Id: I3f35f1c53ce60d64263064ed9b5b8221e1b63bb4
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agoARM: odroidxu3_defconfig: enable CONFIG_USB_RTL8152
Joonyoung Shim [Tue, 25 Aug 2015 09:17:16 +0000 (18:17 +0900)]
ARM: odroidxu3_defconfig: enable CONFIG_USB_RTL8152

Enable CONFIG_USB_RTL8152 for Odroid-XU4.

Change-Id: Iab87b058f01c0b8cd376d1fa4d84099ab412ba9a
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agoARM: odroidxu3_defconfig: enable rt2x00 wifi usb drivers
Seung-Woo Kim [Mon, 6 Jul 2015 07:39:25 +0000 (16:39 +0900)]
ARM: odroidxu3_defconfig: enable rt2x00 wifi usb drivers

This patch enables rt2x00 wifi usb drivers to support rt5572n.

Change-Id: I1d7f9c71e9cb60c83986f4e90cb1edd7557333df
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agoARM: dts: Add Odroid-XU4 support
Joonyoung Shim [Tue, 25 Aug 2015 09:08:29 +0000 (18:08 +0900)]
ARM: dts: Add Odroid-XU4 support

The Odroid-XU4 is almost the same as XU3, except usb otg, DP, audio
codec and power monitoring sensors. This patch makes common dtsi file
and dts file for XU4.

We will add more features on dts for XU4 later.

Change-Id: I6536b9cfa4a4441e392bfe17011968be64c97b3e
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agoARM: odroidxu3_defconfig: disable CONFIG_RTC_DRV_S3C
Joonyoung Shim [Mon, 24 Aug 2015 07:52:32 +0000 (16:52 +0900)]
ARM: odroidxu3_defconfig: disable CONFIG_RTC_DRV_S3C

Odroid-XU3 board has two rtc devices - SoC rtc(rtc-s3c) and pmic rtc
(rtc-s5m), so two device nodes for rtc like /dev/rtc0 and /dev/rtc1 will
be created.

The pmic rtc can keep time via rtc backup battery, so tizen platform
will want to use pmic rtc than SoC rtc but it can't know which device
node is for pmic rtc.

This patch disables CONFIG_RTC_DRV_S3C, then tizen platform can use only
pmic rtc.

Change-Id: Ie4256d547c9263c6bcb0302aacd7fbd3b47a4048
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agortc: s5m: fix to update ctrl register
Joonyoung Shim [Fri, 21 Aug 2015 09:43:41 +0000 (18:43 +0900)]
rtc: s5m: fix to update ctrl register

According to datasheet, the S2MPS13X and S2MPS14X should update write
buffer via setting WUDR bit to high after ctrl register is written.

If not, ALARM interrupt of rtc-s5m doesn't happen first time when i use
tools/testing/selftests/timers/rtctest.c test program and hour format is
used to 12 hour mode in Odroid-XU3 board.

One more issue is the RTC doesn't keep time on Odroid-XU3 board when i
turn on board after power off even if RTC battery is connected. It can
be solved as setting WUDR & RUDR bits to high at the same time after
RTC_CTRL register is written. It's same with condition of only writing
ALARM registers, so this is for only S2MPS14 and we should set WUDR &
A_UDR bits to high on S2MPS13.

I can't find any reasonable description about this like fix from
datasheet, but can find similar codes from rtc driver source of
hardkernel kernel and vendor kernel.

Change-Id: I2ac1759847cb17c851ae297a19ded355ae90c4ce
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: <stable@vger.kernel.org> # v3.16
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
9 years agortc: s3c: fix disabled clocks for alarm
Joonyoung Shim [Tue, 11 Aug 2015 09:28:33 +0000 (18:28 +0900)]
rtc: s3c: fix disabled clocks for alarm

The clock enable/disable codes for alarm have been removed from
commit 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock
control") and the clocks are disabled even if alarm is set, so alarm
interrupt can't happen.

The s3c_rtc_setaie function can be called several times with 'enabled'
argument having same value, so it needs to check whether clocks are
enabled or not.

Change-Id: Ib8a59ae5f5e3409c8383ca3c8e4413bb625d6d44
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: <stable@vger.kernel.org> # v4.1
9 years agortc: s3c: remove unnecessary NULL assignment
Joonyoung Shim [Tue, 11 Aug 2015 10:29:11 +0000 (19:29 +0900)]
rtc: s3c: remove unnecessary NULL assignment

It's unnecessary the code that assigns info->rtc_clk to NULL in
s3c_rtc_remove.

Change-Id: I6a735e4fc010a208068305ee8ccd9c5f0cdaa6ad
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
9 years agortc: s3c: add missing clk control
Joonyoung Shim [Tue, 11 Aug 2015 07:15:53 +0000 (16:15 +0900)]
rtc: s3c: add missing clk control

It's missed to call clk_unprepare() about info->rtc_src_clk in
s3c_rtc_remove and to call clk_disable_unprepare about info->rtc_clk in
error routine of s3c_rtc_probe.

Change-Id: Ia338db2dd1be2d9fc21d3455f91fba1dbff01a89
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
9 years agoARM: dts: odroidxu3: Enable wake alarm of S2MPS11 RTC
Krzysztof Kozlowski [Sat, 30 May 2015 06:33:21 +0000 (15:33 +0900)]
ARM: dts: odroidxu3: Enable wake alarm of S2MPS11 RTC

The IRQB of S2MPS11 PMIC is wired to XEINT4 (GPX0-4) through pull-up
resistor.

Add interrupt properties and pinctrl configuration to enable RTC wake
alarm of rtc-s5m driver. This also removes a warning:
sec_pmic 4-0066: No interrupt specified, no interrupts

Change-Id: I3aa4d802ca9ff19f7b9cda2bbb178476aca19a9a
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
9 years agoARM: dts: add 'rtc_src' clock to rtc node for exynos5422-odroidxu3
Markus Reichl [Sun, 3 May 2015 16:34:29 +0000 (18:34 +0200)]
ARM: dts: add 'rtc_src' clock to rtc node for exynos5422-odroidxu3

The Exynos5422 SoC has a s3c6410 RTC where the source clock
is now a mandatory property.

This patch fixes probe failure of s3c-rtc on Odroid-XU3 boards.

Change-Id: Ie197965fb99f980deffddb96821f4c8a00bf69b8
Signed-off-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
9 years agoclk: samsung: Add bindings for 32kHz clocks from s2mps11
Markus Reichl [Tue, 31 Mar 2015 11:57:20 +0000 (13:57 +0200)]
clk: samsung: Add bindings for 32kHz clocks from s2mps11

This creates include/dt-bindings/clock/samsung,s2mps11.h with
the three 32kHz clock outputs from the s2mps11 mfd.

Change-Id: I2e6de74e55b980d56f192344d712f1caca1a7ed9
Signed-off-by: Markus Reichl <m.reichl@fivetechno.de>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
9 years agoARM: EXYNOS: use PS_HOLD based poweroff for all supported SoCs
Marek Szyprowski [Mon, 9 Feb 2015 07:25:41 +0000 (08:25 +0100)]
ARM: EXYNOS: use PS_HOLD based poweroff for all supported SoCs

PS_HOLD based power off procedure is common for all Exynos SoCs,
so use it for every Exynos SoCs.

Change-Id: I4c71a13430f088c9709fa6067b47a8da34f5da5e
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agoARM: dts: Add MSHC2 dt node for Exynos3250 SoC
Chanwoo Choi [Fri, 17 Jul 2015 11:22:27 +0000 (20:22 +0900)]
ARM: dts: Add MSHC2 dt node for Exynos3250 SoC

This patch add the MSHC2 (Mobile Storage Host Controller) devicetree node for
Exynos3250 SoC.

Change-Id: Ia8850063ad90b986b1371952c879676a608fe3f1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
9 years agoARM: dts: Add UART2 dt node for Exynos3250 SoC
Chanwoo Choi [Fri, 17 Jul 2015 05:49:08 +0000 (14:49 +0900)]
ARM: dts: Add UART2 dt node for Exynos3250 SoC

This patch add the uart2 devicetree node for Exynos3250 SoC.

Change-Id: I28dd84bc645e26f14b7d0c7d630870cc812dccd8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
9 years agoclk: samsung: exynos3250: Add MMC2 clock
Chanwoo Choi [Fri, 17 Jul 2015 11:48:38 +0000 (20:48 +0900)]
clk: samsung: exynos3250: Add MMC2 clock

This patch add the MMC2 clocks (mux, divider, gate) of Exynos3250 SoC.

Change-Id: Ib0c194e09f6ed171ba1a84a35a96f651b615666f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
9 years agoclk: samsung: exynos3250: Add UART2 clock
Chanwoo Choi [Fri, 17 Jul 2015 05:51:01 +0000 (14:51 +0900)]
clk: samsung: exynos3250: Add UART2 clock

This patch add the UART2 clocks (mux, divider, gate) of Exynos3250 SoC.

Change-Id: I5b013ed835a3985659f956b2bd3e64dbeeca7369
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
9 years agos5p-mfc: end-of-stream handling for newer encoders
Andrzej Hajda [Thu, 20 Aug 2015 12:35:23 +0000 (14:35 +0200)]
s5p-mfc: end-of-stream handling for newer encoders

MFC encoder supports end-of-stream handling for encoder
in version 5 of hardware. This patch adds it also for newer version.
It was successfully tested on MFC-v8.

Change-Id: I3b8c4eb93649c29d99693f585aa0c519541d7226
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agos5p-mfc: correct scratch buffer size of H.263 decoder
Andrzej Hajda [Thu, 13 Aug 2015 10:25:37 +0000 (12:25 +0200)]
s5p-mfc: correct scratch buffer size of H.263 decoder

Driver complains about too small scratch buffer size. After adjusting
it according to vendor code, decoding works.

Change-Id: I79c0153b2813ceebcb17d4fa2175663b736346f3
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
9 years agomedia: s5p-mfc: fix mfc context buffer size
Ingi Kim [Wed, 12 Aug 2015 00:09:35 +0000 (09:09 +0900)]
media: s5p-mfc: fix mfc context buffer size

When video file was decoded by H/W MFCv8. It occured IOMMU page fault
because of accessing abnormal memory of mfc ctx buf

So this patch supports buffer size of mfc context more.
Relevant page fault error is below.

[ 3524.617147] PAGE FAULT occurred at 0x10108000 by 11200000.sysmmu(Page table base: 0x6d86c000)
[ 3524.624192]  Lv1 entry: 0x6c27d001
[ 3524.627567]   Lv2 entry: 0x0
[ 3524.630482] ------------[ cut here ]------------
[ 3524.635020] kernel BUG at drivers/iommu/exynos-iommu.c:358!
[ 3524.640567] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[ 3524.646373] Modules linked in:
[ 3524.649410] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.0.0-00001-g0ff9b87-dirty #18
[ 3524.657117] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 3524.663184] task: c0e4aff0 ti: c0e3c000 task.ti: c0e3c000
[ 3524.668566] PC is at exynos_sysmmu_irq+0x1b8/0x2c4
[ 3524.673330] LR is at vprintk_emit+0x2b8/0x58c
[ 3524.677657] pc : [<c037cc78>]    lr : [<c00704a4>]    psr: 600d0193
[ 3524.677657] sp : c0e3dd90  ip : 00000000  fp : c0e3ddcc
[ 3524.689092] r10: ee29a110  r9 : 00000000  r8 : ee29a128
[ 3524.694292] r7 : ed812810  r6 : 10108000  r5 : ed86c000  r4 : 00000000
[ 3524.700791] r3 : c0ec9bd8  r2 : 00000000  r1 : 00000000  r0 : ed82ff00
[ 3524.707292] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[ 3524.714656] Control: 10c5387d  Table: 6b08c06a  DAC: 00000015
[ 3524.720375] Process swapper/0 (pid: 0, stack limit = 0xc0e3c210)
[ 3524.726354] Stack: (0xc0e3dd90 to 0xc0e3e000)
[ 3524.730689] dd80:                                     c0e3dd9c c0069d68 ee58c338 6d86c000
[ 3524.738836] dda0: ee58c338 ee298c40 ee2915a0 0000003b c0e64ef4 c0e3c000 00000000 00000000
[ 3524.746981] ddc0: c0e3de14 c0e3ddd0 c0071ef4 c037cacc ffffffff a00d0193 c0e3ddf4 ee291540
[ 3524.755126] dde0: c0ec793c c0ec7928 7fffffff ee291540 ee2915a0 ee298c40 c0e64ef4 ee004660
[ 3524.763272] de00: ee010800 c0e3df00 c0e3de34 c0e3de18 c0072138 c0071e9c 00020000 ee291540
[ 3524.771418] de20: ee2915a0 00000016 c0e3de4c c0e3de38 c0075130 c00720f8 0000003b ee028300
[ 3524.779563] de40: c0e3de64 c0e3de50 c0071450 c0075068 00000100 00000012 c0e3de8c c0e3de68
[ 3524.787708] de60: c030d240 c0071420 c030d19c 00000016 00000000 00000016 00000000 00000001
[ 3524.795854] de80: c0e3dea4 c0e3de90 c0071450 c030d1a8 00000092 c0e37a1c c0e3ded4 c0e3dea8
[ 3524.804000] dea0: c0071790 c0071420 c0e3df00 f000200c 00000016 c0e440a8 c0e3df00 f0002000
[ 3524.812145] dec0: c095bc8c 00000001 c0e3defc c0e3ded8 c0008730 c0071710 c0010d88 c0010d8c
[ 3524.820290] dee0: 600d0013 ffffffff c0e3df34 c0ec7eb4 c0e3df54 c0e3df00 c0014780 c00086fc
[ 3524.828436] df00: 00000001 00000000 00000000 c0020780 c0e3c000 c0e43530 00000000 00000000
[ 3524.836581] df20: c0ec7eb4 c095bc8c 00000001 c0e3df54 c0e3df58 c0e3df48 c0010d88 c0010d8c
[ 3524.844727] df40: 600d0013 ffffffff c0e3df94 c0e3df58 c0062690 c0010d50 c0ec75f0 00000001
[ 3524.852872] df60: c0e3df84 c0e4353c c0e39580 c0e43e84 c0e3c000 00000002 c0e3df58 c0e38b88
[ 3524.861018] df80: c0952b9c ffffffff c0e3dfac c0e3df98 c094d1b8 c00622d4 c0e3c000 c0e43e10
[ 3524.869163] dfa0: c0e3dff4 c0e3dfb0 c0d86d30 c094d130 ffffffff ffffffff c0d866f0 00000000
[ 3524.877309] dfc0: 00000000 c0df06d8 00000000 c0ee3f14 c0e434c0 c0df06d4 c0e4c20c 4000406a
[ 3524.885454] dfe0: 410fc073 00000000 00000000 c0e3dff8 40008074 c0d86970 00000000 00000000
[ 3524.893610] [<c037cc78>] (exynos_sysmmu_irq) from [<c0071ef4>] (handle_irq_event_percpu+0x64/0x25c)
[ 3524.902615] [<c0071ef4>] (handle_irq_event_percpu) from [<c0072138>] (handle_irq_event+0x4c/0x6c)
[ 3524.911454] [<c0072138>] (handle_irq_event) from [<c0075130>] (handle_level_irq+0xd4/0x14c)
[ 3524.919773] [<c0075130>] (handle_level_irq) from [<c0071450>] (generic_handle_irq+0x3c/0x4c)
[ 3524.928180] [<c0071450>] (generic_handle_irq) from [<c030d240>] (combiner_handle_cascade_irq+0xa4/0x110)
[ 3524.937624] [<c030d240>] (combiner_handle_cascade_irq) from [<c0071450>] (generic_handle_irq+0x3c/0x4c)
[ 3524.946981] [<c0071450>] (generic_handle_irq) from [<c0071790>] (__handle_domain_irq+0x8c/0xfc)
[ 3524.955646] [<c0071790>] (__handle_domain_irq) from [<c0008730>] (gic_handle_irq+0x40/0x78)
[ 3524.963966] [<c0008730>] (gic_handle_irq) from [<c0014780>] (__irq_svc+0x40/0x74)
[ 3524.971412] Exception stack(0xc0e3df00 to 0xc0e3df48)
[ 3524.976441] df00: 00000001 00000000 00000000 c0020780 c0e3c000 c0e43530 00000000 00000000
[ 3524.984586] df20: c0ec7eb4 c095bc8c 00000001 c0e3df54 c0e3df58 c0e3df48 c0010d88 c0010d8c
[ 3524.992729] df40: 600d0013 ffffffff
[ 3524.996205] [<c0014780>] (__irq_svc) from [<c0010d8c>] (arch_cpu_idle+0x48/0x4c)
[ 3525.003567] [<c0010d8c>] (arch_cpu_idle) from [<c0062690>] (cpu_startup_entry+0x3c8/0x4a4)
[ 3525.011805] [<c0062690>] (cpu_startup_entry) from [<c094d1b8>] (rest_init+0x94/0x98)
[ 3525.019516] [<c094d1b8>] (rest_init) from [<c0d86d30>] (start_kernel+0x3cc/0x3d8)
[ 3525.026963] Code: e34c30ec e5932004 e3520000 ca000018 (e7f001f2)
[ 3525.033028] ---[ end trace 71ed544f653b4d46 ]---

Change-Id: I5a65d9814dd79c1b62b89cf9f75929e122552d8e
Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
9 years agomedia: s5p-mfc: skip incomeplete frame
Donghwa Lee [Thu, 31 Jul 2014 06:01:59 +0000 (15:01 +0900)]
media: s5p-mfc: skip incomeplete frame

Currently, when incomplete frame is recieved in the middle of
decoding, driver have treated it to error, so src/dst queue and
clock are cleaned. Although it is obviously error case, it is need
to maintain video decoding in case of necessity. This patch
supports skip incomplete frame to next.

Change-Id: I328275a01d9f4bdfda55daf08a0e8b238ed7da5d
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agodrm/exynos: enable render node
Joonyoung Shim [Tue, 18 Aug 2015 04:42:09 +0000 (13:42 +0900)]
drm/exynos: enable render node

Enable render node by user side request.

Change-Id: I1436d9f8be6d9677244338f10087502bc63d5733
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agodrm/exynos: move order to register vidi kms driver
Joonyoung Shim [Wed, 15 Jul 2015 01:48:06 +0000 (10:48 +0900)]
drm/exynos: move order to register vidi kms driver

The vidi is virtual kms driver and now it is registered earlier than
actual hw kms drivers, so it will occupy crtc index 0. Some users
assume the condition yet that actual hw kms driver has crtc index 0.
It may or may not be matter but let's arrange register order.

Change-Id: Id3bbd0eeaf7ba2e584c21e39bb6971a483365ac9
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agodrm/exynos: remove SoC checking code
Andrzej Hajda [Mon, 8 Jun 2015 10:15:42 +0000 (12:15 +0200)]
drm/exynos: remove SoC checking code

SoC checking code is not necessary anymore, as exynos_drm_match_add and
exynos_drm_platform_probe already properly handles situation when there are
no Exynos DRM components.

Change-Id: Ifa313c98b5e6903dd8f8843fb9b861334bbdfe79
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Tested-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: fix broken component binding in case of multiple pipelines
Andrzej Hajda [Thu, 11 Jun 2015 14:23:37 +0000 (23:23 +0900)]
drm/exynos: fix broken component binding in case of multiple pipelines

In case there are multiple pipelines and deferred probe occurs, only components
of the first pipeline were bound. As a result only one pipeline was available.
The main cause of this issue was dynamic generation of component match table -
every component driver during probe registered itself on helper list, if there
was at least one pipeline present on this list component match table were
created without deferred components.
This patch removes this helper list, instead it creates match table from
existing devices requiring exynos_drm KMS drivers. This way match table do not
depend on probe/deferral order and contains all KMS components.
As a side effect patch makes the code cleaner and significantly smaller.

Change-Id: I9f09a22f1d1f54e989044b2a45c4344f4904261d
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: consolidate driver/device initialization code
Andrzej Hajda [Thu, 11 Jun 2015 14:20:52 +0000 (23:20 +0900)]
drm/exynos: consolidate driver/device initialization code

Code registering different drivers and simple platform devices was dispersed
across multiple sub-modules. This patch moves it to one place. As a result
initialization code is shorter and cleaner and should simplify further
development.

Change-Id: I4b9c2063d8bb85569538c0a00648f0d218057410
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agoarm: dma-mapping: fix off-by-one error in bitmap size check
Marek Szyprowski [Wed, 1 Jul 2015 12:43:54 +0000 (14:43 +0200)]
arm: dma-mapping: fix off-by-one error in bitmap size check

nr_bitmaps member of mapping structure stores the number of already
allocated bitmaps and it is interpreted as loop iterator (it starts from
0 not from 1), so a comparison against number of possible bitmap
extensions should include this fact. This patch fixes this by changing
the extension failure condition. This issue has been introduced by
commit 4d852ef8c2544ce21ae41414099a7504c61164a0 ("arm: dma-mapping: Add
support to extend DMA IOMMU mappings").

Reported-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
CC: stable@vger.kernel.org # v3.15+