platform/kernel/linux-exynos.git
5 years agoporting: add libcap for selftests sandbox/klewandowski/kdbus-legacy-for-4.14-wip
Karol Lewandowski [Tue, 13 Aug 2019 14:17:31 +0000 (16:17 +0200)]
porting: add libcap for selftests

Change-Id: I3689832114222f3182abf2223855ce425546eaa5

5 years agokdbus porting: disable cgroup metadata
Karol Lewandowski [Thu, 8 Aug 2019 18:17:30 +0000 (20:17 +0200)]
kdbus porting: disable cgroup metadata

Collecting has been done using task_cgroup_path() whose usage
seem to have changed in incompatible way.

Disable for now.

Change-Id: Ic6eb21ad9333615655856e090f4e94a7ef53c5b7

5 years agokdbus: 4.14 port: use constant salt
Karol Lewandowski [Thu, 8 Aug 2019 17:48:13 +0000 (19:48 +0200)]
kdbus: 4.14 port: use constant salt

Suggested-by: Adrian Szyndela
Change-Id: I3160c724e9fd8c772381591e447bf46c9ca73157

5 years agokdbus: Adjust for linux v4.14
Karol Lewandowski [Thu, 8 Aug 2019 10:52:02 +0000 (12:52 +0200)]
kdbus: Adjust for linux v4.14

Change-Id: Ib04f90501a01ed820b499c11962a02798bdd8866

5 years agokdbus: allowing sending replies even if NO_EXPECT_REPLY is set
Lukasz Skalski [Wed, 20 Jul 2016 16:21:25 +0000 (18:21 +0200)]
kdbus: allowing sending replies even if NO_EXPECT_REPLY is set

Change-Id: I34427f381957dd8d366e9e4d837d5a2a34a39cc1

5 years agokdbus: allow unix domain socket fd passing
Konrad Lipinski [Fri, 15 Jul 2016 11:15:05 +0000 (13:15 +0200)]
kdbus: allow unix domain socket fd passing

Change-Id: Ifafec44da924ec8ed677629606c92a45e7171636

5 years agoincreate KDBUS_CONN_MAX_REQUESTS_PENDING to 1024 from 128
INSUN PYO [Wed, 29 Jun 2016 05:04:09 +0000 (14:04 +0900)]
increate KDBUS_CONN_MAX_REQUESTS_PENDING to 1024 from 128

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I82e1d634c88f2e86a29e7f5d50ce5226943c2e54

5 years agolocal / arm64: tm2: Enable kdbus driver
Karol Lewandowski [Thu, 29 Oct 2015 12:06:19 +0000 (13:06 +0100)]
local / arm64: tm2: Enable kdbus driver

kdbus IPC will be only used when appropriate userspace is installed.

Change-Id: I411c2088a7fa3be553603b9ba3a5e89374206eee
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
5 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>
5 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.

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
5 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.

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
5 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.

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
5 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.

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
5 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 ]---

Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
5 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.

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>
5 years agoDocumentation: kdbus: Fix typos
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:04 +0000 (13:08 +0300)]
Documentation: kdbus: Fix typos

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>
5 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

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>
5 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.

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>
5 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.

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>
5 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

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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().

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>
5 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.

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>
5 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'.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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/

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>
5 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.

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>
5 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.

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>
5 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: Id826fd271c1dabf0b3f7e4531e18a5668d21a4cf
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>
5 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: Ia6499b144cb0bcd6b66a8a12da65402c5df314c3
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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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.

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>
5 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: Iaaa75a624f3d561f2d820a5f2551ca0ac0f97e39
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>
5 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: Ia508f1e66f60465083969d94be169da194fc9500
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>
5 years agonetfilter: xt_owner: bail out with EINVAL in case of unsupported flags 09/209209/1 accepted/tizen/unified/20190705.110609 submit/tizen/20190705.061120
Pablo Neira Ayuso [Fri, 7 Jun 2019 14:37:30 +0000 (16:37 +0200)]
netfilter: xt_owner: bail out with EINVAL in case of unsupported flags

Reject flags that are not supported with EINVAL.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to apply supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I92f1bd37788cc71088112770bb1b4071dfe8f3fd

5 years agonetfilter: xt_owner: Add supplementary groups option 08/209208/1
Lukasz Pawelczyk [Fri, 10 May 2019 11:46:22 +0000 (13:46 +0200)]
netfilter: xt_owner: Add supplementary groups option

The XT_OWNER_SUPPL_GROUPS flag causes GIDs specified with XT_OWNER_GID
to be also checked in the supplementary groups of a process.

f_cred->group_info cannot be modified during its lifetime and f_cred
holds a reference to it so it's safe to use.

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to apply supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ie2e4c64388b4c64794ebc73de9bacf206eb46173

6 years agoARM: defconfig: enable I-Cache line size workaround on Exynos systems 53/206253/1 accepted/tizen/unified/20190611.110428 submit/tizen/20190611.014400
Marek Szyprowski [Wed, 15 May 2019 10:58:27 +0000 (12:58 +0200)]
ARM: defconfig: enable I-Cache line size workaround on Exynos systems

All Exynos big.LITTLE system suffer from I-Cache line size mismatch between
CPU cores, so enable workaround for it in exynos_defconfig and
tizen_odroid_defconfig.

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

6 years agoARM: Add workaround for I-Cache line size mismatch between CPU cores 52/206252/1
Marek Szyprowski [Wed, 15 May 2019 07:53:55 +0000 (09:53 +0200)]
ARM: Add workaround for I-Cache line size mismatch between CPU cores

Some big.LITTLE systems have mismatch of I-Cache line size between
LITTLE and big cores. This patch adds workaround for proper I-Cache
support on such systems. Without it, some code (typically self-modifying)
might suffer from random SIGILL failures.

Similar workaround exists for ARM64 architecture, added by commit
116c81f427ff ("arm64: Work around systems with mismatched cache line
sizes").

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

6 years agogpu: drm: exynos: Add extcon notification for hdmi connection 46/205546/1 accepted/tizen/unified/20190508.111058 submit/tizen/20190507.092632
Dongwoo Lee [Tue, 17 Oct 2017 23:21:05 +0000 (08:21 +0900)]
gpu: drm: exynos: Add extcon notification for hdmi connection

Currently, hdmi connection generates only uevent by drm core. In
addition, it has no information about connection state. But, Tizen
starts TV-out behavior along with extcon uevent. To this end, this
patch will add extcon notification for hdmi connection.

Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
[sw0312.kim: port to v4.14]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I20a2d13deff07e566ce4f50c7fc64600ce10ca9f

6 years agoARM: configs: tizen_odroid: enable squashfs 43/204743/1 accepted/tizen/unified/20190426.110522 submit/tizen/20190426.054810
Seung-Woo Kim [Fri, 26 Apr 2019 05:05:27 +0000 (14:05 +0900)]
ARM: configs: tizen_odroid: enable squashfs

Tizen web engine uses squashfs for its libraray update. Enable
squashfs and related options.

Change-Id: Id9a25c46642598d0927a4304f6813dbbd64f68b1
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoarm64: configs: tizen_tm2_defconfig: enable squashfs 42/204742/1
Seung-Woo Kim [Fri, 26 Apr 2019 05:03:43 +0000 (14:03 +0900)]
arm64: configs: tizen_tm2_defconfig: enable squashfs

Tizen web engine uses squashfs for its libraray update. Enable
squashfs and related options.

Change-Id: Id2f7640cf6007b280bb6daef3c42484e8b4a04ef
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoclocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansion 29/203229/1
Mark Rutland [Mon, 16 Oct 2017 15:28:39 +0000 (16:28 +0100)]
clocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansion

Our ctags mangling script can't handle newlines inside of a
DEFINE_PER_CPU(), leading to an annoying message whenever tags are
built:

  ctags: Warning: drivers/clocksource/arm_arch_timer.c:302: null expansion of name pattern "\1"

This was dealt with elsewhere in commit:

  25528213fe9f75f4 ("tags: Fix DEFINE_PER_CPU expansions")

... by ensuring each DEFINE_PER_CPU() was contained on a single line,
even where this would violate the usual code style (checkpatch warnings
and all).

Let's do the same for the arch timer driver, and get rid of the
distraction.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[sw0312.kim: cherry-pick mainline commit a7fb4577bbe3 to resolve warning on ctags build]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id79bac4d2450f30c21b50cdf0de1be7fb3b1bbec

6 years agosoc: samsung: Split ASV drivers into ARM and ARM64 parts 44/202444/1 accepted/tizen/unified/20190330.030053 submit/tizen/20190329.020226
Sylwester Nawrocki [Thu, 28 Mar 2019 11:07:49 +0000 (12:07 +0100)]
soc: samsung: Split ASV drivers into ARM and ARM64 parts

This fixes build error with tizen_odroid_defconfig related to missing
MTD symbols required by exynos5433-asv.c driver.

The Exynos5433 ASV driver has dependency on MTD, to avoid inheriting this
dependency by the Exynos5422 ASV driver split Exynos ASV drivers into ARM
and ARM64 parts, similarly as it is done for the PMU.
This also has an advantage that we don't need to include ARM ASV drivers on
ARM64 SoCs and we can build only ARM ASV drivers for ARM SoCs.

Change-Id: I3d647b784f936dcb535632e4ee15a7d571d7a131
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoarm64: configs: tizen_tm2_defconfig: Enable MTD_EXYNOS_OTP 54/202354/1
Sylwester Nawrocki [Wed, 27 Mar 2019 11:39:55 +0000 (12:39 +0100)]
arm64: configs: tizen_tm2_defconfig: Enable MTD_EXYNOS_OTP

Enable MTD_EXYNOS_OTP which is required for the ASV driver on Exynos5433.

Change-Id: I6b176856405ea38c51436e73d5aa4df80c79f6b1
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoarm64: exynos: Enable ASV driver for ARCH_EXYNOS 51/200151/4
Sylwester Nawrocki [Wed, 30 Jan 2019 15:55:01 +0000 (16:55 +0100)]
arm64: exynos: Enable ASV driver for ARCH_EXYNOS

Enable ASV driver for Exynos5433 SoC.

Change-Id: I2870b83f909425356be2391ac5e534a773cd8db8
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agosoc: samsung: Add ASV support for Exynos5433 SoC 50/200150/4
Sylwester Nawrocki [Wed, 30 Jan 2019 17:16:08 +0000 (18:16 +0100)]
soc: samsung: Add ASV support for Exynos5433 SoC

This patch adds Adaptive Supply Voltage support or the Cortex A53
and the Cortex A57 clusters. There is no Adaptive Body Bias handling
added yet.

Change-Id: I07190bf3614428292594b42bb8a1fb60a7b3ae63
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoarm64: dts: Add Exynos5433 SoC OTP device node 54/200754/3
Sylwester Nawrocki [Fri, 1 Mar 2019 14:19:43 +0000 (15:19 +0100)]
arm64: dts: Add Exynos5433 SoC OTP device node

Change-Id: I8bcd9955c3cff940150bff10da564c3b9f477952
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoarm64: dts: exynos: Update Exynos5433 CHIPID node 46/200146/4
Sylwester Nawrocki [Wed, 30 Jan 2019 15:53:06 +0000 (16:53 +0100)]
arm64: dts: exynos: Update Exynos5433 CHIPID node

Extend the register region to also cover the ASV table region
and add reg entries for the ABB registers region.

Change-Id: I64704397a0cd12cb9a019b83f45fd23890da458b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agomtd: Add exynos OTP memory driver 48/200148/4
Sylwester Nawrocki [Fri, 1 Mar 2019 14:18:15 +0000 (15:18 +0100)]
mtd: Add exynos OTP memory driver

This patch adds driver for Exynos5433 OTP memory.  Access to the OTP
memory is required, among others, to support the Adaptive Supply Voltage
feature.

Partially based on code from Android SM-N910C_LL_Opensource kernel.

Change-Id: If85363f1626d622f1559757eb06fd950e214e5ab
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agosoc: samsung: chipid: Add ABB register region read helper 45/200145/4
Sylwester Nawrocki [Wed, 30 Jan 2019 15:24:13 +0000 (16:24 +0100)]
soc: samsung: chipid: Add ABB register region read helper

This patch adds helper functions for accessing the ABB block
registers needed by the ASV driver.

Change-Id: Ida2ea622136c1abea2caffaee00b5400a8efba7d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agosoc: samsung: chipid: Update DT bindings documentation 44/200144/4
Sylwester Nawrocki [Mon, 18 Feb 2019 16:37:38 +0000 (17:37 +0100)]
soc: samsung: chipid: Update DT bindings documentation

Document "samsung,exynos5433-chipid" compatible and add description
of 'reg' property for Exynos5433.

Change-Id: I9f22c76aabd46ea7aa31cfbecbb64131914e9938
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agosoc: samsung: chipid: Add exynos_chipid_read_bits() function 42/200142/4
Sylwester Nawrocki [Wed, 30 Jan 2019 14:57:56 +0000 (15:57 +0100)]
soc: samsung: chipid: Add exynos_chipid_read_bits() function

Add register read helper function needed by the ASV driver.

Change-Id: I90ec78cff58ac7ff424a50309e83d37605e7cbc7
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: samsung: Add CLK_IGNORE_UNUSED for Exynos5433 ABB, ASV_TB clocks 53/200753/3
Sylwester Nawrocki [Fri, 1 Mar 2019 15:44:21 +0000 (16:44 +0100)]
clk: samsung: Add CLK_IGNORE_UNUSED for Exynos5433 ABB, ASV_TB clocks

Prevent disabling these clocks by the kernel until proper support
is added to the ASV driver.

With current code this patch is not necessarily required, because
exynos_asv_init() is being called before unused clocks get disabled
by clk core. However, things may break when the timings change
for any reason.

This patch has been tested after changing initcall type in exynos-asv.c:

-late_initcall(exynos_asv_init)
+late_initcall_sync(exynos_asv_init)

Change-Id: I513ff391bece219318020c0bcca07e2a7938a175
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agosoc: samsung: asv: Print error code when adding an OPP fails 49/200149/3
Sylwester Nawrocki [Wed, 30 Jan 2019 17:17:23 +0000 (18:17 +0100)]
soc: samsung: asv: Print error code when adding an OPP fails

Log error code from devm_pm_opp_add() to make any errors easier
to debug.

Change-Id: If418320565f1efc14d16242d8b166bea07353c54
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agosoc: samsung: asv: Wait until OPP gets released before adding new one 52/200752/2
Sylwester Nawrocki [Fri, 1 Mar 2019 15:30:16 +0000 (16:30 +0100)]
soc: samsung: asv: Wait until OPP gets released before adding new one

There is currently no check whether an OPP is actually removed before
attempting to add an replacement OPP. In situations when and OPP is
referenced when we try to remove it and it is not already removed at
the time of return from the dev_pm_opp_remove() call subsequent
dev_pm_opp_add() invocation will fail. To avoid that add a polling loop
with timeout as a barrier before adding new OPP.

This patch should also prevent related cpufreq core issues as indicated
by logs as follows.

exynos_asv_update_cpu_opp cpu4 opp5, freq: 2000 missing
exynos5433_asv_opp_get_voltage: arm,cortex-a57: [6] freq: 1900, voltage: 1262500 -> 1187500
cpu cpu4: _opp_add: duplicate OPPs detected. Existing: freq: 1900000000, volt: 1262500,
enabled: 1. New: freq: 1900000000, volt: 1187500, enabled: 1
exynos_asv_update_cpu_opp: Failed to add OPP 1900000000 Hz/1187500 uV for cpu4 (-17)

cpu cpu4: dev_pm_opp_set_rate: failed to find OPP for freq 1900000000 (-34)
exynos5433_asv_opp_get_voltage: arm,cortex-a57: [9] freq: 1600, voltage: 1137500 -> 1062500
cpufreq: __target_index: Failed to change cpu frequency: -34

Change-Id: Ibf6a568cabbd5380952d97f93d27ac59f1db125b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agodrm/exynos/mixer: fix MIXER shadow registry synchronisation code 04/201804/1
Andrzej Hajda [Tue, 19 Mar 2019 13:05:11 +0000 (14:05 +0100)]
drm/exynos/mixer: fix MIXER shadow registry synchronisation code

MIXER on Exynos5 SoCs uses different synchronisation method than Exynos4
to update internal state (shadow registers).
Apparently the driver implements it incorrectly. The rule should be
as follows:
- do not request updating registers until previous request was finished,
  ie. MXR_CFG_LAYER_UPDATE_COUNT must be 0.
- before setting registers synchronisation on VSYNC should be turned off,
  ie. MXR_STATUS_SYNC_ENABLE should be reset,
- after finishing MXR_STATUS_SYNC_ENABLE should be set again.
The patch hopefully implements it correctly.
Below sample kernel log from page fault caused by the bug:

[   25.670038] exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0x2247b800
[   25.677888] ------------[ cut here ]------------
[   25.682164] kernel BUG at ../drivers/iommu/exynos-iommu.c:450!
[   25.687971] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   25.693778] Modules linked in:
[   25.696816] CPU: 5 PID: 1553 Comm: fb-release_test Not tainted 5.0.0-rc7-01157-g5f86b1566bdd #136
[   25.705646] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   25.711710] PC is at exynos_sysmmu_irq+0x1c0/0x264
[   25.716470] LR is at lock_is_held_type+0x44/0x64

v2: added missing MXR_CFG_LAYER_UPDATE bit setting in mixer_enable_sync

Reported-by: Marian Mihailescu <mihailescu2m@gmail.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Change-Id: Idd49412e699350a7ea3a98ef7f925924e0ddf1ff

6 years agodrm/exynos/mixer: fix synchronization check in interlaced mode 03/201803/1
Andrzej Hajda [Fri, 2 Feb 2018 15:11:22 +0000 (16:11 +0100)]
drm/exynos/mixer: fix synchronization check in interlaced mode

In case of interlace mode video processor registers and mixer config
register must be check to ensure internal state is in sync with shadow
registers.
This patch fixes page-faults in interlaced mode.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[backport of mainline commit 2eced8e917b060587fc8ed46df41c364957a5050]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8b09ed165101a7dcccd1d6e7338e0216a27f4481

6 years agoARM: dts: exynos: Increase minimal ACLK400_DISP1 frequency on Exynos542x 02/201802/1
Marek Szyprowski [Tue, 19 Mar 2019 12:58:06 +0000 (13:58 +0100)]
ARM: dts: exynos: Increase minimal ACLK400_DISP1 frequency on Exynos542x

ACLK400_DISP1 bus feeds some internal buses of the display subsystem, some
of which are also related to TV/Mixer hardware modules. When that bus
is set to 120MHz, Exynos Mixer is not able to properly handle two XRGB
display planes at FullHD-60MHz. DMA underrun happens, which in turn might
result in reading data out of the configured buffer, what causes IOMMU
page fault and kernel panic.

This change fixes the following IOMMU fault, observed, when 2 Mixer planes
were enabled:

exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0x20fe9000
------------[ cut here ]------------
kernel BUG at ../drivers/iommu/exynos-iommu.c:450!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.0.0-00003-g1b03088168ea #149
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
PC is at exynos_sysmmu_irq+0x1c0/0x264
LR is at lock_is_held_type+0x44/0x64
...

Reported-by: Marian Mihailescu <mihailescu2m@gmail.com>
Fixes: 5d99cc59a3c6 ("ARM: dts: exynos: Move Exynos5250 and Exynos5420 nodes under soc")
Fixes: b04a62d3ade3 ("ARM: dts: exynos: Add bus nodes using VDD_INT for Exynos542x SoC")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3d2f341f5e89d4631401f653d0ad9e36f26f45ad

6 years agoASoC: samsung: odroid: Change rfs value to 256 59/201059/4
Jaechul Lee [Thu, 7 Mar 2019 23:42:55 +0000 (08:42 +0900)]
ASoC: samsung: odroid: Change rfs value to 256

rfs is set 256 as a default value in I2S module. Due to clock rate
setting rounding errors with rfs=512 playback is almost twice faster
than original speed when the device is opened with 44.1k samplerate.
pulseaudio that uses 44.1k sinks can't play the sound properly.

Change-Id: I21d5553e36dcbf00802230cf1c60f5fb7df1056d
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agoASoS: samsung: odroid: Fix clock configuration for 44100 sample rate 25/201125/1
Sylwester Nawrocki [Fri, 8 Mar 2019 15:36:38 +0000 (16:36 +0100)]
ASoS: samsung: odroid: Fix clock configuration for 44100 sample rate

After commit fbeec965b8d1c ("ASoC: samsung: odroid: Fix 32000 sample
rate handling") due to clock rounding error CODEC master clock frequency
is being set to 20070401 Hz instead of 22579000 Hz.
This results in too fast actual sample rate for fs=44100, e.g. 2 kHz tone
has really 3555 Hz frequency (2000 Hz * 20070401/22579000 * 2).

Fix this by increasing correction passed to clk_set_rate() to take into
account inaccuracy of EPLL frequency properly.

Change-Id: I8d08bec8e70394421c115bde1d511b730885bbe2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoARM: dts: exynos: Fix audio routing on exynos5422-odroidxu3 30/200830/1
Sylwester Nawrocki [Mon, 4 Mar 2019 16:18:32 +0000 (17:18 +0100)]
ARM: dts: exynos: Fix audio routing on exynos5422-odroidxu3

Add missing audio routing entry for the capture stream, this change
is required to fix audio recording on Odroid XU3.

Change-Id: I8db68ab3e097a0f3cfd07224016e4704e57c6635
Fixes: 885b005d232c ("ARM: dts: exynos: Add support for secondary DAI to Odroid XU3")
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoASoC: samsung: i2s: Fix DAPM routes for capture stream 29/200829/1
Sylwester Nawrocki [Mon, 4 Mar 2019 16:17:14 +0000 (17:17 +0100)]
ASoC: samsung: i2s: Fix DAPM routes for capture stream

This patch sets missing stream_name of capture part of the DAI driver
so we can define DAPM routing properly also for the capture stream.

Fixes: 64aba9bca5bd ("ASoC: samsung: i2s: Add widgets and routes for DPCM support")
Change-Id: I7ac244afcd74d92cf92da1d9d7d9606285ea0360
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoARM: dts: exynos: Add support for secondary DAI to Odroid XU4 55/197855/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:42 +0000 (19:03 +0100)]
ARM: dts: exynos: Add support for secondary DAI to Odroid XU4

This patch extends DAPM routing and adds secondary CPU DAI entry
to support the secondary audio PCM interface on Odroid XU4.

Change-Id: Id20d2a064f5d29c4edf349e9a968864a48a11b46
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 years agoARM: dts: exynos: Add support for secondary DAI to Odroid XU3 54/197854/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:41 +0000 (19:03 +0100)]
ARM: dts: exynos: Add support for secondary DAI to Odroid XU3

This patch extends DAPM routing and adds secondary CPU DAI entry
to support the secondary audio PCM interface on Odroid XU3.

Change-Id: I2efb8eca9418554482194a2c54aa6b6ca674d5c2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 years agoLOCAL: ASoC: temporary workaround for i2s/prepare_lock deadlock 46/200646/2
Marek Szyprowski [Wed, 27 Feb 2019 10:47:39 +0000 (11:47 +0100)]
LOCAL: ASoC: temporary workaround for i2s/prepare_lock deadlock

This reverts commit 00ffa8a3b1a60a89ab0ef5ae1d8e41269c30a3bd.

Change-Id: I396b1250a748fdb8219abf6d0bf71c5fab119658
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
6 years agoASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag 59/197859/6
Sylwester Nawrocki [Thu, 14 Feb 2019 15:45:55 +0000 (16:45 +0100)]
ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag

There is now no users of this flag so remove it together with
related code.  The chan_name field of snd_dmaengine_dai_dma_data
data structure is not removed as it is still in use by the PXA
platform.

Change-Id: Ia8bb6022ce7c5e85abb7c5410459130666785f45
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: odroid: Prevent uninitialized variable use 45/200645/2
Sylwester Nawrocki [Thu, 21 Feb 2019 09:42:28 +0000 (10:42 +0100)]
ASoC: samsung: odroid: Prevent uninitialized variable use

This addresses an issue pointed out by compiler warning:

sound/soc/samsung/odroid.c: In function ‘odroid_audio_probe’:
sound/soc/samsung/odroid.c:298:22: warning: ‘cpu_dai’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis");
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I39c6dd0a1aa5ec68bfc17c895988c21a1a34733e
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: odroid: Fix of_node refcount unbalance 44/200644/2
Sylwester Nawrocki [Wed, 20 Feb 2019 11:06:07 +0000 (12:06 +0100)]
ASoC: samsung: odroid: Fix of_node refcount unbalance

In odroid_audio_probe() some OF nodes are left without reference count
decrease after use. Fix it by ensuring required of_node_calls() are done
before exiting probe.

Change-Id: Ifbcb6294331acc59028e675d8ab1143394508d66
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization 43/200643/2
Sylwester Nawrocki [Tue, 19 Feb 2019 15:19:41 +0000 (16:19 +0100)]
ASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization

On some SoCs (e.g. Exynos5433) there are multiple "IIS multi audio
interfaces" and the driver will try to register there multiple times
same platform device for the secondary FIFO, which of course fails
miserably.  To fix this we derive the secondary platform device name
from the primary device name. The secondary device name will now
be <primary_dev_name>-sec instead of fixed "samsung-i2s-sec".

The fixed platform_device_id table entry is removed as the secondary
device name is now dynamic and device/driver matching is done through
driver_override.

Change-Id: I49ed3e20279af198cdce11c08cc11bd6536dddad
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Fix secondary platform device unregistration 42/200642/2
Sylwester Nawrocki [Tue, 19 Feb 2019 15:19:40 +0000 (16:19 +0100)]
ASoC: samsung: i2s: Fix secondary platform device unregistration

This fixes unregistration of the secondary platform device so all
resources are properly released.  Additionally the removal sequence
is corrected so it is in reverse order comparing to probe sequence.
The test against NULL priv->pdev_sec is removed as it is not necessary.

Change-Id: If325e11b4109fbc61fbb2df3ac012f2c1e9f0cb5
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: odroid: Add missing DAPM routes 41/200641/2
Sylwester Nawrocki [Fri, 15 Feb 2019 12:04:22 +0000 (13:04 +0100)]
ASoC: samsung: odroid: Add missing DAPM routes

With old DTS there will be missing DAPM routes linking BE with CODECs.
Add those routes in the card driver so sound works properly on Odroid
XU3/4 also without DTS updates enabling the secondary PCM.

Change-Id: I0a2a8e59859cdaf46da0563e30278dc9a8fe2376
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: odroid: Ensure proper sample rate on pri/sec PCM 40/200640/2
Sylwester Nawrocki [Thu, 14 Feb 2019 16:00:11 +0000 (17:00 +0100)]
ASoC: samsung: odroid: Ensure proper sample rate on pri/sec PCM

Currently when playing sound with different sample rates actual
sample rate will be determined by audio stream which starts first
on either primary or secondary PCM. The audio root clock will be
configured appropriately only for the first stream. As the hardware
is limited to same sample rate on both interfaces we need to disallow
streams with different sample rates. It is done by this patch by
returning error in FE hw_params if there is already active stream
running with different sample rate.

Change-Id: I643d02d38acf20a7711ba5930e6bceceeaafc087
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Prevent potential NULL platform data dereference 39/200639/2
Sylwester Nawrocki [Thu, 14 Feb 2019 15:58:40 +0000 (16:58 +0100)]
ASoC: samsung: i2s: Prevent potential NULL platform data dereference

When np is NULL i2s_pdata could also be NULL but i2s_pdata is now being
dereferenced without proper check. Fix this and shorten the error message
so we don't exceed 80 characters limit.

Change-Id: I5d5b14ff953d4a2617500f50e81eb459d56a6e4f
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Convert to SPDX License Indentifier 38/200638/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:47 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Convert to SPDX License Indentifier

Replace GPL v2.0 license statements with SPDX license identifier.

Change-Id: Iaf0ae489d7d55dc949ba70e956afe3642cdfaeb4
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Comments clean up 37/200637/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:46 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Comments clean up

Spelling error fixes, upper/lower case letter changes.

Change-Id: Id1060cbb859c6da4480a0dd6f676a6614b64da8c
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Mark expected switch fall-through 36/200636/2
Gustavo A. R. Silva [Fri, 3 Aug 2018 16:33:57 +0000 (11:33 -0500)]
ASoC: samsung: i2s: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Change-Id: I030b163708ab40f17cf500cff7a8f326b890b7f5
Addresses-Coverity-ID: 1381093 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition 35/200635/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:45 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition

Change indentation so this macro definition spans 2 rows and looks
more consistent with surrounding code.

Change-Id: I747acdce454a660c637d29ab34450081e02084d2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage 34/200634/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:44 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage

If the probe call is on the primary DAI we can use 'other' in place of
i2s->sec_dai, if the probe call is on the secondary DAI we can use 'i2s'
in place of other->sec_dai.

While at it fix one whitespace issue.

Change-Id: Idbe9190d87f628f4d8fab77dbdbe433c8cd7825d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: Specify DMA channel names through custom DMA config 47/199147/3
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:41 +0000 (10:37 +0100)]
ASoC: samsung: Specify DMA channel names through custom DMA config

This is a part of conversion of Samsung platforms to use the custom DMA
config for specifying DMA channel names, in addition to passing custom
DMA device for the secondary CPU DAI's "PCM" component for some variants
of the I2S controller.

We also don't set the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME any more
as setting it wouldn't allow to specify DMA channels through the custom
DMA config.

Change-Id: Ia7e4da88746788c6fd56e1781160328bdaa224b8
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Get rid of a static spinlock 52/197852/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:39 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Get rid of a static spinlock

This patch makes the spinlock serializing access to the primary/secondary
PCM a per I2S controller lock, rather than a global one. There is no need
to have a global lock across multiple I2S controllers in the SoC.

Change-Id: I6b56296ce45e219ed5f37af85fd352ff51af617a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: odroid: Add support for secondary CPU DAI 53/197853/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:40 +0000 (10:37 +0100)]
ASoC: samsung: odroid: Add support for secondary CPU DAI

This patch adds DPCM links in order to support the secondary I2S interface.
For the secondary PCM interface to be actually available one more entry
should be added to the sound-dai property in sound/cpu node in DT.
The changes in driver are done in a way so we are backwards compatible
with existing DTS/DTB, i.e. if the cpu sound-dai property contains only
one entry only one PCM will be registered.

Change-Id: I7bc789cf1d025b168fd3411f24f4015016025bb2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Move quirks data to common driver data structure 51/197851/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:38 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move quirks data to common driver data structure

The quirk flags are common for the primary and the secondary DAI
so move respective field from struct i2s_dai to common driver data
structure.

Change-Id: I27506c48b3faa8c344535c6749b534c6c11901e7
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Move IP variant data to common driver data structure 50/197850/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:37 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move IP variant data to common driver data structure

The IP variant data is another thing common for both DAIs, move it
to the driver's common data structure.

Change-Id: Id83d14a38d6c5d0d4d25dfd0ca8332e88315d271
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure 49/197849/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:36 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure

As we now have the 'priv' pointer in most of the places we can use
priv->lock directly, dropping extra indirection in the SFR region
spinlock access.

Change-Id: Ic137ee120aa1871a9d2142eaee9f9292e2c0f25f
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Move SFR pointer to common driver data structure 48/197848/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:35 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move SFR pointer to common driver data structure

The SFR region is common for both DAIs so move related data structure
field from struct i2s_dai to the common driver data structure.

Change-Id: I2080a75f0a49f431ee37fa4488ed13ae8fd26b12
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Move registers cache to common driver data structure 47/197847/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:27 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move registers cache to common driver data structure

There is no need to keep the PM suspend/resume register cache separate
for each DAI as those registers are common, move related i2s_dai data
structure to the driver's common data structure.  This will allow us
to simplify the code a little eventually and to make it easier to follow.

Change-Id: I91919c337611dc69983d2ee346e988f2e93d0695
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Move opclk data to common driver data structure 46/197846/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:26 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move opclk data to common driver data structure

The clock for generating I2S signals is also common for both CPU DAIs
so move it to the driver's common data structure.

Change-Id: Ia8320f1e9ab0c02d113bb73002cd4ae98caec7e8
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: samsung: i2s: Move core clk to the driver common data structure 45/197845/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:25 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move core clk to the driver common data structure

The core clock is also common for both CPU DAIs so move it to
the driver's private data structure.

Change-Id: Ib6f2975bd34a8cfba20faaa9e51be88b6a41bc30
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>