platform/kernel/linux-exynos.git
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

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

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

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

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>
7 years agoSmack: limited capability for changing process label
Zbigniew Jasinski [Mon, 19 Oct 2015 16:23:53 +0000 (18:23 +0200)]
Smack: limited capability for changing process label

This feature introduces new kernel interface:

- <smack_fs>/relabel-self - for setting transition labels list

This list is used to control smack label transition mechanism.
List is set by, and per process. Process can transit to new label only if
label is on the list. Only process with CAP_MAC_ADMIN capability can add
labels to this list. With this list, process can change it's label without
CAP_MAC_ADMIN but only once. After label changing, list is unset.

Changes in v2:
* use list_for_each_entry instead of _rcu during label write
* added missing description in security/Smack.txt

Changes in v3:
* squashed into one commit

Changes in v4:
* switch from global list to per-task list
* since the per-task list is accessed only by the task itself
  there is no need to use synchronization mechanisms on it

Changes in v5:
* change smackfs interface of relabel-self to the one used for onlycap
  multiple labels are accepted, separated by space, which
  replace the previous list upon write

Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack: pipefs fix in smack_d_instantiate
Roman Kubiak [Mon, 5 Oct 2015 10:27:16 +0000 (12:27 +0200)]
Smack: pipefs fix in smack_d_instantiate

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

Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack - Fix build error with bringup unconfigured
Casey Schaufler [Wed, 12 Aug 2015 18:56:02 +0000 (11:56 -0700)]
Smack - Fix build error with bringup unconfigured

The changes for mounting binary filesystems was allied
improperly, with the list of tokens being in an ifdef that
it shouldn't have been. Fix that, and a couple style issues
that were bothering me.

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoKernel threads excluded from smack checks
Roman Kubiak [Mon, 10 Aug 2015 14:54:25 +0000 (16:54 +0200)]
Kernel threads excluded from smack checks

Adds an ignore case for kernel tasks,
so that they can access all resources.

Since kernel worker threads are spawned with
floor label, they are severely restricted by
Smack policy. It is not an issue without onlycap,
as these processes also run with root,
so CAP_MAC_OVERRIDE kicks in. But with onlycap
turned on, there is no way to change the label
for these processes.

Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agosmack: allow mount opts setting over filesystems with binary mount data
Vivek Trivedi [Mon, 22 Jun 2015 10:06:06 +0000 (15:36 +0530)]
smack: allow mount opts setting over filesystems with binary mount data

Add support for setting smack mount labels(using smackfsdef, smackfsroot,
smackfshat, smackfsfloor, smackfstransmute) for filesystems with binary
mount data like NFS.

To achieve this, implement sb_parse_opts_str and sb_set_mnt_opts security
operations in smack LSM similar to SELinux.

Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack: allow multiple labels in onlycap
Rafal Krypa [Tue, 2 Jun 2015 09:23:48 +0000 (11:23 +0200)]
Smack: allow multiple labels in onlycap

Smack onlycap allows limiting of CAP_MAC_ADMIN and CAP_MAC_OVERRIDE to
processes running with the configured label. But having single privileged
label is not enough in some real use cases. On a complex system like Tizen,
there maybe few programs that need to configure Smack policy in run-time
and running them all with a single label is not always practical.
This patch extends onlycap feature for multiple labels. They are configured
in the same smackfs "onlycap" interface, separated by spaces.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
7 years agoSmack: fix seq operations in smackfs
Rafal Krypa [Thu, 21 May 2015 16:24:31 +0000 (18:24 +0200)]
Smack: fix seq operations in smackfs

Use proper RCU functions and read locking in smackfs seq_operations.

Smack gets away with not using proper RCU functions in smackfs, because
it never removes entries from these lists. But now one list will be
needed (with interface in smackfs) that will have both elements added and
removed to it.
This change will also help any future changes implementing removal of
unneeded entries from other Smack lists.

The patch also fixes handling of pos argument in smk_seq_start and
smk_seq_next. This fixes a bug in case when smackfs is read with a small
buffer:

Kernel panic - not syncing: Kernel mode fault at addr 0xfa0000011b
CPU: 0 PID: 1292 Comm: dd Not tainted 4.1.0-rc1-00012-g98179b8 #13
Stack:
 00000003 0000000d 7ff39e48 7f69fd00
 7ff39ce0 601ae4b0 7ff39d50 600e587b
 00000010 6039f690 7f69fd40 00612003
Call Trace:
 [<601ae4b0>] load2_seq_show+0x19/0x1d
 [<600e587b>] seq_read+0x168/0x331
 [<600c5943>] __vfs_read+0x21/0x101
 [<601a595e>] ? security_file_permission+0xf8/0x105
 [<600c5ec6>] ? rw_verify_area+0x86/0xe2
 [<600c5fc3>] vfs_read+0xa1/0x14c
 [<600c68e2>] SyS_read+0x57/0xa0
 [<6001da60>] handle_syscall+0x60/0x80
 [<6003087d>] userspace+0x442/0x548
 [<6001aa77>] ? interrupt_end+0x0/0x80
 [<6001daae>] ? copy_chunk_to_user+0x0/0x2b
 [<6002cb6b>] ? save_registers+0x1f/0x39
 [<60032ef7>] ? arch_prctl+0xf5/0x170
 [<6001a92d>] fork_handler+0x85/0x87

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
7 years agosmack: pass error code through pointers
Lukasz Pawelczyk [Mon, 20 Apr 2015 15:12:54 +0000 (17:12 +0200)]
smack: pass error code through pointers

This patch makes the following functions to use ERR_PTR() and related
macros to pass the appropriate error code through returned pointers:

smk_parse_smack()
smk_import_entry()
smk_fetch()

It also makes all the other functions that use them to handle the
error cases properly. This ways correct error codes from places
where they happened can be propagated to the user space if necessary.

Doing this it fixes a bug in onlycap and unconfined files
handling. Previously their content was cleared on any error from
smk_import_entry/smk_parse_smack, be it EINVAL (as originally intended)
or ENOMEM. Right now it only reacts on EINVAL passing other codes
properly to userspace.

Comments have been updated accordingly.

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
7 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.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / net: bcm4358: call vfs functions instead of direct file ops
Przemyslaw Marczak [Mon, 2 Nov 2015 14:16:27 +0000 (15:16 +0100)]
LOCAL / net: bcm4358: call vfs functions instead of direct file ops

After enable writing the card's MAC address to filesystem by:

commit: LOCAL / net: bcm4358: Enable the some configurations

in the driver's code for bcmdhd4358, filesystem access is required
to read/write some settings, especially the card's MAC address.

Instead of calling proper fs functions, a direct calls were used
to particular file operations methods.
Since read/write operations are deprecated, the present code without
null pointer checking, refers to null function pointers.
This causes kernel panic when runs wpa_supplicant application.

This commit moves the direct calls to proper function calls,
which fixes the panic issue.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL / arm64: defconfig: enable governers for devfreq
Joonyoung Shim [Mon, 2 Nov 2015 09:50:00 +0000 (18:50 +0900)]
LOCAL / arm64: defconfig: enable governers for devfreq

Enable powersave and userspace governers for devfreq.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoRevert "devfreq: Remove mutex deadlock caused by modification of update_devfreq()"
Joonyoung Shim [Mon, 2 Nov 2015 09:44:25 +0000 (18:44 +0900)]
Revert "devfreq: Remove mutex deadlock caused by modification of update_devfreq()"

This reverts commit 0d046ecc157975c44a1c837eae5dd7c420160968.

Refer commit 2bf9b157448b ("LOCAL / PM / devfreq: rollback mutex locking
for update_devfreq()"). Already it was used in exynos-next-4.0.4 branch.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoLOCAL / PM / devfreq: rollback mutex locking for update_devfreq()
Joonyoung Shim [Mon, 7 Sep 2015 07:42:31 +0000 (16:42 +0900)]
LOCAL / PM / devfreq: rollback mutex locking for update_devfreq()

Userspace, performance and powersave governers call update_devfreq()
with mutex locking. It causes nested mutex locking error.

I'm not sure that i should make a choice which reverting change that
includes mutex locking in update_devfreq() or removing mutex locking
before update_devfreq() is called on each governers.

IMHO, the upstream codes don't include mutex locking in update_devfreq()
so first option is better.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoinput: touchscreen: Add sysfs node for control power
Beomho Seo [Mon, 14 Sep 2015 11:57:56 +0000 (20:57 +0900)]
input: touchscreen: Add sysfs node for control power

This patch add sysfs node for control power.
User layer can control to use this node.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
7 years agodrm/exynos: fix waiting pageflip on i80 panel
Joonyoung Shim [Fri, 23 Oct 2015 02:43:44 +0000 (11:43 +0900)]
drm/exynos: fix waiting pageflip on i80 panel

If panel is use i80 interface, encoder should wait to complete prior
pageflip before encoder disables panel because te interrupt is happened
by panel.

Upstream Exynos DRM driver doesn't need this because Exynos atomic
commit procedures already does this job of waiting for pending updates
to finish. Refer the commit c4533665d819 ("drm/exynos: wait all planes
updates to finish") applied from v4.3-rc1

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[fix build issue because of removed pending_flip]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 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>
7 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>
7 years agoLOCAL / arm64: Enable configurations relevant to NAT tables
Jaehoon Chung [Tue, 20 Oct 2015 08:13:09 +0000 (17:13 +0900)]
LOCAL / arm64: Enable configurations relevant to NAT tables

To use iptables conmmand, enable the configurations relevant to NAT
tables.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL / net: bcm4358: Enable the some configurations
Jaehoon Chung [Fri, 16 Oct 2015 06:31:52 +0000 (15:31 +0900)]
LOCAL / net: bcm4358: Enable the some configurations

Enabled configurations related to write mac-address

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL / net: bcm4358: fix the compiler warning for broadcom driver
Jaehoon Chung [Wed, 30 Sep 2015 03:54:58 +0000 (12:54 +0900)]
LOCAL / net: bcm4358: fix the compiler warning for broadcom driver

Fixed the compiler warning for broadcom driver.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoarm64: dts: exynos5433-tm2: Fix buck[23] voltage reset during suspend
Krzysztof Kozlowski [Fri, 2 Oct 2015 08:02:14 +0000 (17:02 +0900)]
arm64: dts: exynos5433-tm2: Fix buck[23] voltage reset during suspend

Disable WRSTBI because it is pulled down triggering buck voltage warm
reset on each suspend to RAM.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agomfd: sec-core: Disable buck voltage reset on watchdog falling edge
Krzysztof Kozlowski [Fri, 2 Oct 2015 07:40:34 +0000 (16:40 +0900)]
mfd: sec-core: Disable buck voltage reset on watchdog falling edge

The WRSTBI bit (disabled by default but enabled by bootloader), when
set, is responsible for resetting voltages to default values of
certain bucks on falling edge of Warm Reset Input pin from AP.

However on some boards (with S2MPS13) the pin is pulled down so any
suspend will effectively trigger the reset of bucks supplying the power
to the little and big cores. In the same time when resuming, these bucks
must provide voltage greater or equal to voltage before suspend to match
the frequency chosen by cpufreq. If voltage (default value of voltage
after reset) is lower than one set by cpufreq before suspend, then
system will hang during resuming.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agomfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X
Krzysztof Kozlowski [Fri, 2 Oct 2015 07:46:40 +0000 (16:46 +0900)]
mfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X

Document a new Device Tree property 'samsung,s2mps11-wrstbi-ground'
indicating that WRSTBI pin of S2MPS13 PMIC is pulled down so
corresponding buck warm reset function should be disabled.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agomfd: sec-core: Dump PMIC revision to find out the HW
Krzysztof Kozlowski [Fri, 2 Oct 2015 01:10:52 +0000 (10:10 +0900)]
mfd: sec-core: Dump PMIC revision to find out the HW

There are different revisions of the same chipset. For example S2MPS13 has
more than 2 revisions. They differ slightly in regulator constraints.
Print the revision number to easily find which PMIC is used on the board.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / net: bcm4358: add the 'name_assigne_type' argument for add_virtual_intf
Jaehoon Chung [Tue, 22 Sep 2015 06:38:50 +0000 (15:38 +0900)]
LOCAL / net: bcm4358: add the 'name_assigne_type' argument for add_virtual_intf

Add the "unsigned char name_assign_type" at add_virtual_intf callback.
So fixed it for broadcom driver.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL / net: bcm4358: set wowlan_config for broadcom driver
Jaehoon Chung [Tue, 22 Sep 2015 05:29:04 +0000 (14:29 +0900)]
LOCAL / net: bcm4358: set wowlan_config for broadcom driver

Refer to commit 6abb9cb99f33b20c.
(cfg80211: make WoWLAN configuration available to drivers.)

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL / net: bcm4358: Disable wakelock configuration
Jaehoon Chung [Thu, 17 Sep 2015 05:40:23 +0000 (14:40 +0900)]
LOCAL / net: bcm4358: Disable wakelock configuration

Wakelock is android mechanisme. Tizen dosen't use it.
In addition, set to BCMPCIE_DISABLE_ASYNC_SUSPEND config.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agodevfreq: Remove mutex deadlock caused by modification of update_devfreq()
Jonghwa Lee [Mon, 21 Sep 2015 07:43:26 +0000 (16:43 +0900)]
devfreq: Remove mutex deadlock caused by modification of update_devfreq()

By commit 'd70aa318 PM: devfreq: Add the prototype of update_devfreq()~',
mutex locking is moved into update_devfreq(). So that any attempts to
acquire the mutex in outside causes deadlock. This patch removes mutex
lockings from where can cause deadlock potentially.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
7 years agoarm64: configs: defconfig: Enable CONFIG_DEVFREQ_GOV_PERFORMANCE
Jonghwa Lee [Mon, 21 Sep 2015 07:02:32 +0000 (16:02 +0900)]
arm64: configs: defconfig: Enable CONFIG_DEVFREQ_GOV_PERFORMANCE

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
7 years agolocal/net: bcm4358: fix netdevice notifier to use info struct
Seung-Woo Kim [Thu, 17 Sep 2015 09:32:20 +0000 (18:32 +0900)]
local/net: bcm4358: fix netdevice notifier to use info struct

After commit 351638e7deeed2ec8ce451b53d3 (net: pass info struct via netdevice notifier),
the struct netdev_notifier_info is passed to netdevice notifier.
So this patch fixes wl_cfg80211_netdev_notifier_call() to use the
info struct.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / ASoC: samsung: Add PM operation to ensure playback after PM suspend/resume
Inha Song [Thu, 17 Sep 2015 06:29:17 +0000 (15:29 +0900)]
LOCAL / ASoC: samsung: Add PM operation to ensure playback after PM suspend/resume

This patch add suspend/resume operation to ensure playback after
PM suspend/resume.

If you wakeup by the resume after entering to suspend during the playback,
We should be re-setup the codec's pll and sysclk to ensure codec operation.

Signed-off-by: Inha Song <ideal.song@samsung.com>
7 years agoLOCAL / mfd: arizona: Call the runtime PM function if the state is runtime resumed
Inha Song [Wed, 16 Sep 2015 03:21:36 +0000 (12:21 +0900)]
LOCAL / mfd: arizona: Call the runtime PM function if the state is runtime resumed

This patch call runtiem PM function manually if the state is runtime resumed
before enter suspend.

This case has occurred when wake-up by the resume after entering to
suspend during the playback.
$ aplay -> runtime_resume() -> suspend() -> resume()

In this case, Can occurred an error when enter suspend.
--
[   82.559234] PM: suspend of devices complete after 57.252 msecs
[   82.567978] arizona spi1.0: Failed to read IRQ status: -108
[   82.567989] arizona spi1.0: Failed to read main IRQ status: -108
[   82.568027] arizona spi1.0: Failed to read IRQ status: -108
[   82.568036] arizona spi1.0: Failed to read main IRQ status: -108
....
So, we should call runtime_suspend() manually when enter suspend
if the state is runtime resume.

Also should call runtime_resume() when wake-up by resume if the state
was runtime resume before entering suspend.

Signed-off-by: Inha Song <ideal.song@samsung.com>
7 years agothermal: consistently use int for trip temp
Wei Ni [Thu, 3 Mar 2016 09:33:46 +0000 (17:33 +0800)]
thermal: consistently use int for trip temp

The commit 17e8351a7739 consistently use int for temperature,
however it missed a few in trip temperature and thermal_core.

In current codes, the trip->temperature used "unsigned long"
and zone->temperature used"int", if the temperature is negative
value, it will get wrong result when compare temperature with
trip temperature.

This patch can fix it.

Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[backport from mainline to fix previous backported commit]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoRevert "Correct backport of fa3c776 ("Thermal: Ignore invalid trip points")"
Seung-Woo Kim [Fri, 30 Sep 2016 12:38:43 +0000 (21:38 +0900)]
Revert "Correct backport of fa3c776 ("Thermal: Ignore invalid trip points")"

This reverts commit 5640c4c37eee293451388cd5ee74dfed3a30f32d.

In this tree, the commit 17e8351a7739 ("thermal: consistently use
int for temperatures") is already backported, so this patch should
be reverted.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agothermal: consistently use int for temperatures
Sascha Hauer [Fri, 24 Jul 2015 06:12:54 +0000 (08:12 +0200)]
thermal: consistently use int for temperatures

The thermal code uses int, long and unsigned long for temperatures
in different places.

Using an unsigned type limits the thermal framework to positive
temperatures without need. Also several drivers currently will report
temperatures near UINT_MAX for temperatures below 0°C. This will probably
immediately shut the machine down due to overtemperature if started below
0°C.

'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
is above the melting point of all known materials.

Consistently use a plain 'int' for temperatures throughout the thermal code and
the drivers. This only changes the places in the drivers where the temperature
is passed around as pointer, when drivers internally use another type this is
not changed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Peter Feuerer <peter@piie.net>
Cc: Punit Agrawal <punit.agrawal@arm.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Peter Feuerer <peter@piie.net>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-acpi@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: lm-sensors@lm-sensors.org
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
7 years agoLOCAL/arm64: defconfig: replace legacy sec_nfc to s3fwrn5 driver
Seung-Woo Kim [Tue, 15 Sep 2015 08:34:33 +0000 (17:34 +0900)]
LOCAL/arm64: defconfig: replace legacy sec_nfc to s3fwrn5 driver

This patch replaces legacy sec_nfc driver to s3fwrn5 nfc driver.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoarm64: dts: exynos5433-tm2: add s3fwrn5 node
Robert Baldyga [Fri, 26 Jun 2015 13:24:04 +0000 (15:24 +0200)]
arm64: dts: exynos5433-tm2: add s3fwrn5 node

Add s3fwrn5 node for TM2 board to enable NFC feature.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
7 years agonfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip
Robert Baldyga [Thu, 20 Aug 2015 14:43:38 +0000 (16:43 +0200)]
nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip

Add driver for Samsung S3FWRN5 NFC controller.
S3FWRN5 is using NCI protocol and I2C communication interface.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
7 years agoNFC: nci: export nci_core_reset and nci_core_init
Robert Baldyga [Wed, 19 Aug 2015 13:19:40 +0000 (15:19 +0200)]
NFC: nci: export nci_core_reset and nci_core_init

Some drivers needs to have ability to reinit NCI core, for example after
updating firmware in setup() of post_setup() callback. This patch makes
nci_core_reset() and nci_core_init() functions public, to make it possible.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
7 years agoNFC: nci: Add post_setup handler
Robert Baldyga [Mon, 17 Aug 2015 11:54:13 +0000 (13:54 +0200)]
NFC: nci: Add post_setup handler

Some drivers require non-standard configuration after NCI_CORE_INIT
request, because they need to know ndev->manufact_specific_info or
ndev->manufact_id. This patch adds post_setup handler allowing to do
such custom configuration.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
7 years agoNFC: nci: Handle proprietary response and notifications
Samuel Ortiz [Sat, 6 Jun 2015 11:16:37 +0000 (13:16 +0200)]
NFC: nci: Handle proprietary response and notifications

Allow for drivers to explicitly define handlers for each
proprietary notifications and responses they expect to support.

Reviewed-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7 years agoNFC: nci: Add nci_prop_cmd allowing to send proprietary nci cmd
Christophe Ricard [Sat, 6 Jun 2015 11:16:41 +0000 (13:16 +0200)]
NFC: nci: Add nci_prop_cmd allowing to send proprietary nci cmd

Handle allowing to send proprietary nci commands anywhere in the nci
state machine.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7 years agoLOCAL / arm64: defconfig: disable smack permissive mode
Seung-Woo Kim [Wed, 9 Sep 2015 05:23:41 +0000 (14:23 +0900)]
LOCAL / arm64: defconfig: disable smack permissive mode

Tizen platform is finished for smack bringup, so this patch
disables smack permissive mode.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agos5p-mfc: use MFC_BUF_FLAG_EOS to identify last buffers in decoder capture queue
Andrzej Hajda [Thu, 3 Sep 2015 12:41:22 +0000 (14:41 +0200)]
s5p-mfc: use MFC_BUF_FLAG_EOS to identify last buffers in decoder capture queue

MFC driver never delivered EOS event to apps feeding constantly its capture
buffer with fresh buffers. The patch fixes it by marking last buffers returned
by MFC with MFC_BUF_FLAG_EOS flag and firing EOS event on de-queuing such
buffers.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agov4l2-compat-ioctl32: fix alignment for ARM64
Andrzej Hajda [Tue, 1 Sep 2015 11:52:38 +0000 (13:52 +0200)]
v4l2-compat-ioctl32: fix alignment for ARM64

Alignment/padding rules on AMD64 and ARM64 differs. To allow properly match
compatible ioctls on ARM64 kernels without breaking AMD64 some fields
should be aligned using compat_s64 type and in one case struct should be
unpacked.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agomisc: tizen_global_lock: apply uaccess
Seung-Woo Kim [Tue, 1 Sep 2015 12:41:14 +0000 (21:41 +0900)]
misc: tizen_global_lock: apply uaccess

This patch applies uaccess for user pointer to fix user memory
access.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agofimc-is: 6d1: add sentinel element to id table
Seung-Woo Kim [Tue, 1 Sep 2015 08:21:01 +0000 (17:21 +0900)]
fimc-is: 6d1: add sentinel element to id table

This patch adds sentinel element to id table to fix following out
of bounds access:
    ==================================================================
    BUG: KASan: out of bounds access in i2c_device_match+0xcc/0xf0 at addr ffffffc00120ee80
    Read of size 1 by task swapper/0/1
    page:ffffffbdc0848380 count:1 mapcount:0 mapping:          (null) index:0x0
    flags: 0x400(reserved)
    page dumped because: kasan: bad access detected
    Address belongs to variable sensor_6d1_idt+0x20/0x40
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3
    Hardware name: Samsung TM2 board (DT)
    Call trace:
    [<ffffffc00008bc58>] dump_backtrace+0x0/0x1d8
    [<ffffffc00008be40>] show_stack+0x10/0x20
    [<ffffffc000eee3a4>] dump_stack+0x80/0xd4
    [<ffffffc00021e4f0>] kasan_report_error+0x3e0/0x408
    [<ffffffc00021e9ec>] kasan_report+0x44/0x50
    [<ffffffc00021d8f0>] __asan_load1+0x78/0x80
    [<ffffffc000916b78>] i2c_device_match+0xc8/0xf0
    [<ffffffc0006d9d54>] __driver_attach+0x3c/0xd0
    [<ffffffc0006d6fac>] bus_for_each_dev+0xd4/0x138
    [<ffffffc0006d932c>] driver_attach+0x2c/0x40
    [<ffffffc0006d8dfc>] bus_add_driver+0x214/0x2e8
    [<ffffffc0006dab40>] driver_register+0xb0/0x1c0
    [<ffffffc000917fc0>] i2c_register_driver+0x48/0xc8
    [<ffffffc001795344>] sensor_6d1_load+0x18/0x24
    [<ffffffc000082ae4>] do_one_initcall+0xec/0x240
    [<ffffffc001755e50>] kernel_init_freeable+0x288/0x330
    [<ffffffc000eeab1c>] kernel_init+0xc/0xf0
    Memory state around the buggy address:
     ffffffc00120ed80: 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fa fa
     ffffffc00120ee00: fa fa fa fa 00 00 06 fa fa fa fa fa 00 00 00 00
    >ffffffc00120ee80: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
                       ^
     ffffffc00120ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc00120ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agofimc-is: fix wrong index access for dt child nodes
Seung-Woo Kim [Tue, 1 Sep 2015 07:59:03 +0000 (16:59 +0900)]
fimc-is: fix wrong index access for dt child nodes

This patch fixes wrong index access for dt child nodes. This fixes
following use after free:
    ==================================================================
    BUG: KASan: use after free in fimc_is_parse_children_dt+0x6c/0xe8 at addr ffffffc08d27ffa8
    Write of size 8 by task swapper/0/1
    page:ffffffbdc2b49fc0 count:0 mapcount:0 mapping:          (null) index:0x0
    flags: 0x0()
    page dumped because: kasan: bad access detected
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3
    Hardware name: Samsung TM2 board (DT)
    Call trace:
    [<ffffffc00008bc58>] dump_backtrace+0x0/0x1d8
    [<ffffffc00008be40>] show_stack+0x10/0x20
    [<ffffffc000eee3a4>] dump_stack+0x80/0xd4
    [<ffffffc00021e510>] kasan_report_error+0x400/0x408
    [<ffffffc00021e9ec>] kasan_report+0x44/0x50
    [<ffffffc00021d38c>] __asan_store8+0x94/0xb0
    [<ffffffc000991900>] fimc_is_parse_children_dt+0x68/0xe8
    [<ffffffc000959368>] fimc_is_probe+0xc0/0xed8
    [<ffffffc0006dc724>] platform_drv_probe+0x64/0xf8
    [<ffffffc0006d9ae8>] driver_probe_device+0x1f0/0x3a8
    [<ffffffc0006d9de0>] __driver_attach+0xc8/0xd0
    [<ffffffc0006d6fac>] bus_for_each_dev+0xd4/0x138
    [<ffffffc0006d932c>] driver_attach+0x2c/0x40
    [<ffffffc0006d8dfc>] bus_add_driver+0x214/0x2e8
    [<ffffffc0006dab40>] driver_register+0xb0/0x1c0
    [<ffffffc0006dc618>] __platform_driver_register+0xa8/0xb8
    [<ffffffc0017952c0>] fimc_is_driver_init+0x18/0x24
    [<ffffffc000082ae4>] do_one_initcall+0xec/0x240
    [<ffffffc001755e50>] kernel_init_freeable+0x288/0x330
    [<ffffffc000eeab1c>] kernel_init+0xc/0xf0
    Memory state around the buggy address:
     ffffffc08d27fe80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
     ffffffc08d27ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    >ffffffc08d27ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                      ^
     ffffffc08d280000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc08d280080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agophy: phy-exynos-mipi-video: Add sentinel element in match array
Seung-Woo Kim [Tue, 1 Sep 2015 07:51:56 +0000 (16:51 +0900)]
phy: phy-exynos-mipi-video: Add sentinel element in match array

This patch adds sentinel element in match array to fix following
out of bounds access:
    ==================================================================
    BUG: KASan: out of bounds access in __of_match_node+0x38/0xb8 at addr ffffffc001024010
    Read of size 1 by task swapper/0/1
    page:ffffffbdc0840900 count:1 mapcount:0 mapping:          (null) index:0x0
    flags: 0x400(reserved)
    page dumped because: kasan: bad access detected
    Address belongs to variable exynos_mipi_video_phy_of_match+0x190/0x3c0
    CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3
    Hardware name: Samsung TM2 board (DT)
    Call trace:
    [<ffffffc00008bc58>] dump_backtrace+0x0/0x1d8
    [<ffffffc00008be40>] show_stack+0x10/0x20
    [<ffffffc000eee3a4>] dump_stack+0x80/0xd4
    [<ffffffc00021e4f0>] kasan_report_error+0x3e0/0x408
    [<ffffffc00021e9ec>] kasan_report+0x44/0x50
    [<ffffffc00021d8f0>] __asan_load1+0x78/0x80
    [<ffffffc000a5aaa4>] __of_match_node+0x34/0xb8
    [<ffffffc000a5ab5c>] of_match_node+0x34/0x60
    [<ffffffc000a5d2cc>] of_match_device+0x2c/0x50
    [<ffffffc0006dcd58>] platform_match+0x68/0x130
    [<ffffffc0006d9d54>] __driver_attach+0x3c/0xd0
    [<ffffffc0006d6fac>] bus_for_each_dev+0xd4/0x138
    [<ffffffc0006d932c>] driver_attach+0x2c/0x40
    [<ffffffc0006d8dfc>] bus_add_driver+0x214/0x2e8
    [<ffffffc0006dab40>] driver_register+0xb0/0x1c0
    [<ffffffc0006dc618>] __platform_driver_register+0xa8/0xb8
    [<ffffffc0017855f4>] exynos_mipi_video_phy_driver_init+0x14/0x20
    [<ffffffc000082ae4>] do_one_initcall+0xec/0x240
    [<ffffffc001755e50>] kernel_init_freeable+0x288/0x330
    [<ffffffc000eeab1c>] kernel_init+0xc/0xf0
    Memory state around the buggy address:
     ffffffc001023f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc001023f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    >ffffffc001024000: 00 00 fa fa fa fa fa fa 00 00 00 fa fa fa fa fa
                             ^
     ffffffc001024080: 00 00 00 fa fa fa fa fa 00 00 00 01 fa fa fa fa
     ffffffc001024100: 00 00 06 fa fa fa fa fa 00 00 03 fa fa fa fa fa
    ==================================================================

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoextcon: max77843: add guard element in array
Seung-Woo Kim [Tue, 1 Sep 2015 07:42:44 +0000 (16:42 +0900)]
extcon: max77843: add guard element in array

This patch adds guard element in cable array to check last element.
This fixes following out of bounds access:
    ==================================================================
    BUG: KASan: out of bounds access in extcon_dev_register+0xc0/0x978 at addr ffffffc001bcc440
    Read of size 8 by task swapper/0/1
    page:ffffffbdc086f300 count:1 mapcount:0 mapping:          (null) index:0x0
    flags: 0x400(reserved)
    page dumped because: kasan: bad access detected
    Address belongs to variable max77843_extcon_cable+0x60/0xf00
    CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3
    Hardware name: Samsung TM2 board (DT)
    Call trace:
    [<ffffffc00008bc58>] dump_backtrace+0x0/0x1d8
    [<ffffffc00008be40>] show_stack+0x10/0x20
    [<ffffffc000eee3a4>] dump_stack+0x80/0xd4
    [<ffffffc00021e4f0>] kasan_report_error+0x3e0/0x408
    [<ffffffc00021e9ec>] kasan_report+0x44/0x50
    [<ffffffc00021d2dc>] __asan_load8+0x94/0xb0
    [<ffffffc000a78904>] extcon_dev_register+0xbc/0x978
    [<ffffffc000a791f8>] devm_extcon_dev_register+0x38/0x90
    [<ffffffc000a7cab8>] max77843_muic_probe+0x1e0/0x5f0
    [<ffffffc0006dc724>] platform_drv_probe+0x64/0xf8
    [<ffffffc0006d9ae8>] driver_probe_device+0x1f0/0x3a8
    [<ffffffc0006d9de0>] __driver_attach+0xc8/0xd0
    [<ffffffc0006d6fac>] bus_for_each_dev+0xd4/0x138
    [<ffffffc0006d932c>] driver_attach+0x2c/0x40
    [<ffffffc0006d8dfc>] bus_add_driver+0x214/0x2e8
    [<ffffffc0006dab40>] driver_register+0xb0/0x1c0
    [<ffffffc0006dc618>] __platform_driver_register+0xa8/0xb8
    [<ffffffc00179f6c0>] max77843_muic_init+0x14/0x20
    [<ffffffc000082ae4>] do_one_initcall+0xec/0x240
    [<ffffffc001755e50>] kernel_init_freeable+0x288/0x330
    [<ffffffc000eeab1c>] kernel_init+0xc/0xf0
    Memory state around the buggy address:
     ffffffc001bcc300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc001bcc380: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
    >ffffffc001bcc400: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
                                               ^
     ffffffc001bcc480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc001bcc500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / ARM: defconfig: Enable Mali400 R4P0 on Trats2
Krzysztof Kozlowski [Tue, 1 Sep 2015 04:19:07 +0000 (13:19 +0900)]
LOCAL / ARM: defconfig: Enable Mali400 R4P0 on Trats2

Enable Mali400 R4P0 drivers to utilize GPU.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: dts: Add GPU/G3D node to exynos4412-trats2
Krzysztof Kozlowski [Tue, 1 Sep 2015 04:13:47 +0000 (13:13 +0900)]
LOCAL / ARM: dts: Add GPU/G3D node to exynos4412-trats2

Enable usage of Mali400 on Trats2 board.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: defconfig: Enable Tizen Global Lock for Mali on Odroid-U3
Krzysztof Kozlowski [Tue, 18 Aug 2015 00:32:05 +0000 (09:32 +0900)]
LOCAL / ARM: defconfig: Enable Tizen Global Lock for Mali on Odroid-U3

Tizen Global Lock is needed for Mali400 R4P0 on Odroid-U3.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: defconfig: Enable Mali400 R4P0 on Odroid-U3
Krzysztof Kozlowski [Mon, 10 Aug 2015 01:00:15 +0000 (10:00 +0900)]
LOCAL / ARM: defconfig: Enable Mali400 R4P0 on Odroid-U3

Enable Mali400 to utilize GPU.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agodrm/exynos: Staticize local function in exynos_drm_gem.c
Krzysztof Kozlowski [Thu, 13 Aug 2015 02:00:15 +0000 (11:00 +0900)]
drm/exynos: Staticize local function in exynos_drm_gem.c

The exynos_drm_gem_mmap_buffer() is not used outside so make it static.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: defconfig: Enable SMACK permissive mode as workaround on Trats2
Krzysztof Kozlowski [Tue, 1 Sep 2015 03:55:12 +0000 (12:55 +0900)]
LOCAL / ARM: defconfig: Enable SMACK permissive mode as workaround on Trats2

Fix display/Xorg on Trats2 by using a workaround (SMACK permissive
mode).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: defconfig: Fix display on Trats2
Krzysztof Kozlowski [Tue, 1 Sep 2015 03:45:50 +0000 (12:45 +0900)]
LOCAL / ARM: defconfig: Fix display on Trats2

Enable config necessary for display/Xorg on Trats2: TIZEN_GLOBAL_LOCK

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agodrm/exynos: Remove unused vma field of exynos_drm_gem_obj
Krzysztof Kozlowski [Fri, 19 Jun 2015 05:23:29 +0000 (14:23 +0900)]
drm/exynos: Remove unused vma field of exynos_drm_gem_obj

The field 'vma' of 'exynos_drm_gem_obj' structure was introduced in
2a3098ff6c21 ("drm/exynos: add userptr feature for g2d module") but is
not referenced anywhere.

One instance of 'exynos_drm_gem_obj' may be mapped to multiple
user-space VMAs so 'vma' field does not look useful anyway.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: iommu: improve a check for non-iommu dma_ops
Marek Szyprowski [Wed, 3 Jun 2015 08:26:24 +0000 (10:26 +0200)]
drm/exynos: iommu: improve a check for non-iommu dma_ops

DRM Exynos driver is relying on dma-mapping internal structures when used
with IOMMU enabled. This patch partially hides dma-mapping internal things
by using proper get_dma_ops/set_dma_ops calls.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[k.kozlowski: Backport to 4.1]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agodrm/exynos: initialize VIDCON0 when fimd is disabled
Joonyoung Shim [Fri, 12 Jun 2015 08:27:16 +0000 (17:27 +0900)]
drm/exynos: initialize VIDCON0 when fimd is disabled

When the fimd is disabled by fimd_disable(), enabled overlay layers also
are disabled. If clocks for fimd are enabled by fimd_enable() on this
case, it can lead IOMMU page fault. The reason is that VIDCON0_ENVID and
VIDCON0_ENVID_F bits of VIDCON0 register are set still even though fimd
is disabled, so it may continue display output of prior when clocks for
fimd are enabled again.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[k.kozlowski: Backport to 4.1, rebasing required]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: defconfig: Fix boot hang on Trats2 around DRM
Krzysztof Kozlowski [Mon, 31 Aug 2015 09:19:54 +0000 (18:19 +0900)]
LOCAL / ARM: defconfig: Fix boot hang on Trats2 around DRM

Disabling framebuffer console fixes boot hang on Trats2 board after:
[    1.136523] [drm] Initialized drm 1.1.0 20060810
[    1.143789] exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops)
[    1.149944] exynos-drm exynos-drm: bound 11c80000.dsi (ops exynos_dsi_component_ops)
[    1.157366] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.163954] [drm] No driver support for vblank timestamp query.
[    1.169893] [drm] Initialized exynos 1.0.0 20110530 on minor 0

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoLOCAL / ARM: defconfig: Enable MAX77693 charger and haptic on Trats2
Krzysztof Kozlowski [Mon, 31 Aug 2015 09:18:36 +0000 (18:18 +0900)]
LOCAL / ARM: defconfig: Enable MAX77693 charger and haptic on Trats2

Enable the Maxim 77693 charger and input/haptic drivers in Trats2
defconfig.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoRevert "LOCAL / drm/exynos: fimd: Remove unused 'ret' variable"
Krzysztof Kozlowski [Mon, 31 Aug 2015 08:08:19 +0000 (17:08 +0900)]
Revert "LOCAL / drm/exynos: fimd: Remove unused 'ret' variable"

This reverts commit aacf1c3ffc5a1a1ba1d51e258b4af722d68c6407 to fix
build error (tizen_trats2_defconfig):
../drivers/gpu/drm/exynos/exynos_drm_fimd.c: In function ‘fimd_bind’:
../drivers/gpu/drm/exynos/exynos_drm_fimd.c:1037:3: error: ‘ret’ undeclared (first use in this function)
../drivers/gpu/drm/exynos/exynos_drm_fimd.c:1037:3: note: each undeclared identifier is reported only once for each function it appears in
make[5]: *** [drivers/gpu/drm/exynos/exynos_drm_fimd.o] Error 1

7 years agov4l2-compat-ioctl32: fix struct v4l2_event32 alignment
Andrzej Hajda [Fri, 21 Aug 2015 09:50:09 +0000 (11:50 +0200)]
v4l2-compat-ioctl32: fix struct v4l2_event32 alignment

Union v4l2_event::u is aligned to 8 bytes on arm32. On arm64 v4l2_event32::u
is aligned to 4 bytes. As a result structures v4l2_event and v4l2_event32 have
different sizes and VIDOC_DQEVENT ioctl does not work from arm32 apps running
on arm64 kernel. The patch fixes it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 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.

Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 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 ]---

Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 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.

Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: dts: exynos5433-tm2: add missing pinctrl states for fimc_is_ch1_i2c
Marek Szyprowski [Wed, 26 Aug 2015 13:05:35 +0000 (15:05 +0200)]
ARM: dts: exynos5433-tm2: add missing pinctrl states for fimc_is_ch1_i2c

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 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.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agolocal/pci: pcie-designware: call pci_bus_add_devices()
Jaehoon Chung [Thu, 20 Aug 2015 05:07:19 +0000 (14:07 +0900)]
local/pci: pcie-designware: call pci_bus_add_devices()

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL/ARM64: defconfig: enable support for fimc-is
Sylwester Nawrocki [Tue, 27 Jan 2015 17:41:42 +0000 (18:41 +0100)]
LOCAL/ARM64: defconfig: enable support for fimc-is

This patch enables fimc-is and its sub drivers.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agofimc-is: fixup for v4.1 rebase
Marek Szyprowski [Wed, 12 Aug 2015 08:29:23 +0000 (10:29 +0200)]
fimc-is: fixup for v4.1 rebase

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agofimc-is: get rid of struct v4l2_subdev_core_ops::init usage
Sylwester Nawrocki [Thu, 30 Jul 2015 04:21:48 +0000 (13:21 +0900)]
fimc-is: get rid of struct v4l2_subdev_core_ops::init usage

init is too limited to be used in this driver, it is deprecated
and usage of this callback should be removed anyway.
There is no device nodes for subdevs so ioctl is no exposed to
user space.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agofimc-is: Fix/add vidioc_querycap for several video nodes
Sylwester Nawrocki [Thu, 30 Jul 2015 01:55:38 +0000 (10:55 +0900)]
fimc-is: Fix/add vidioc_querycap for several video nodes

This allows us to get rid of a warning from v4l2-core.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>