platform/adaptation/renesas_rcar/renesas_kernel.git
9 years agopackaging: Packaging updates for installation in boot partition 62/34662/1
Damian Hobson-Garcia [Wed, 28 Jan 2015 05:15:17 +0000 (14:15 +0900)]
packaging: Packaging updates for installation in boot partition

Various updates to make the kernel image more usable/familiar on
the Renesas plaform.  This is a squash commit of the following:
    packaging: Install uImage instead of vmlinuz when available
    packaging: Make initrd installation conditional
    packaging: Diable gummiboot section of post-install script
    packaging: Create link to "latest" kernel in /lib/modules
    packaging: Move upstream tag to .gbs.conf
    packaging: support modules

Change-Id: Ia5d6d853b1794fd28fa8bbc5f55178fb18ae26de

9 years agoEnable HDMI output for Renesas R-Car M2 platform 58/33958/1 accepted/tizen/ivi/20150120.050700 submit/tizen_ivi/20150120.015107
Damian Hobson-Garcia [Mon, 19 Jan 2015 08:19:12 +0000 (17:19 +0900)]
Enable HDMI output for Renesas R-Car M2 platform

Change-Id: I01a3ef4216136e0dc9a8ac057ee0fdf564bc6762

9 years agoi2c: gpio: OF gpio code does not handle defered probe case
Ben Dooks [Thu, 13 Mar 2014 14:37:38 +0000 (14:37 +0000)]
i2c: gpio: OF gpio code does not handle defered probe case

When using device-tree and the i2c-gpio driver is called before the
GPIO node has been probed then it needs to correctly defer the probe
instead of returning a permanent error that the gpio numbers are not
valid.

This fixes the following error:
/i2c@2: invalid GPIO pins, sda=-517/scl=-517

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit 40e7b1153a39e49715a1f75c654d8da66e3638c4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 1582407d7809605bc223583d35515829c2ab0071)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoRevert "ARM: shmobile: multiplatform: add Audo DMAC peri peri support on defconfig
Damian Hobson-Garcia [Tue, 16 Dec 2014 01:12:45 +0000 (10:12 +0900)]
Revert "ARM: shmobile: multiplatform: add Audo DMAC peri peri support on defconfig

This patch is adapdted from commit id 4ba67a304ed3ef52520b382dfef7ed6b1bd08014
from the Renesas snapshot in
https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas-backport.git.

Original commit message follows:

    Revert "ARM: shmobile: multiplatform: add Audo DMAC peri peri support on def

    This reverts commit 2315f9fce4da7df9362e4baeb5250d14ea48bf63.

    Unfortunately enabling RCAR_AUDMAC_PP support this patch breaks dmaengine
    support on R-Car Gen2 boards. This should be resolved by driver updates
    in v3.20. But v3.19 was too early for this defconfig change.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
    (cherry picked from commit b6f6383b98092a1759d19893875bba90c8d9f446)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Change-Id: Ie8ab7c7bf12458777418e915f50af625e1e6920d
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agopackaging: Only build for armv7l 34/33634/2 accepted/tizen_3.0_ivi tizen_3.0_ivi accepted/tizen/ivi/20150114.121045 submit/tizen_ivi/20150114.094404 tizen_3.0_ivi_release
Tony SIM [Tue, 13 Jan 2015 10:33:20 +0000 (18:33 +0800)]
packaging: Only build for armv7l

The Renesas platform is ARM based. It doesn't make sense to try to build
the kernel for IA.

Change-Id: I615566798c54ee7b9e812021a2ee28ff9ee4942c
Signed-off-by: Tony SIM <chinyeow.sim.xt@renesas.com>
9 years agoAdd packaging 30/31930/2 submit/tizen_ivi/20150108.095140
Damian Hobson-Garcia [Thu, 11 Dec 2014 10:09:10 +0000 (19:09 +0900)]
Add packaging

Change-Id: I339f7ff593894c681f3a8b3ba2932fde8e909a22

9 years agoAdd tizen_rcar-m2_defconfig 29/31929/2
Damian Hobson-Garcia [Fri, 12 Dec 2014 02:09:30 +0000 (11:09 +0900)]
Add tizen_rcar-m2_defconfig

Change-Id: I8d72caa827ce5ce540d8ddba740dcd37fb825327

9 years agodrm: rcar-du: Fix the DU register setting for Hsync 28/31928/1
Yoshihito Ogawa [Fri, 21 Nov 2014 02:55:22 +0000 (11:55 +0900)]
drm: rcar-du: Fix the DU register setting for Hsync

Change-Id: Ic5b2b7d00eca9e121d6f9ffa0f3d1bf4c221c303
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agodrm: rcar-du: Add procedure of memory width update 27/31927/1
Koji Matsuoka [Mon, 24 Mar 2014 05:40:01 +0000 (14:40 +0900)]
drm: rcar-du: Add procedure of memory width update

When the frame buffer is changed, there is a problem which memory width
is not updated. This problem is resolved by this patch.

Change-Id: Ifd581c28b285328a5b6977e5964136a3d22db374
Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agodrm: rcar-du: Add max resolution support 26/31926/1
Koji Matsuoka [Wed, 10 Dec 2014 02:53:05 +0000 (11:53 +0900)]
drm: rcar-du: Add max resolution support

Change-Id: I88997563d45f4f0c06ea0df746c0b8abf518f310
Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agodrm: rcar-du: Add interlaced mode support 25/31925/1
Koji Matsuoka [Mon, 24 Mar 2014 04:15:13 +0000 (13:15 +0900)]
drm: rcar-du: Add interlaced mode support

Change-Id: Ibbebf7ce4e740af149de25e448c98ca8ca7ed53b
Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSMACK: Fix wrong copy size
José Bollo [Mon, 15 Sep 2014 09:42:04 +0000 (11:42 +0200)]
SMACK: Fix wrong copy size

The function strncpy was copying an extra character 9
when i == len (what is possible via revoke interface).

Change-Id: Ic7452da05773e620a1d7bbc55e859c25a86c65f6
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
(cherry picked from commit 6c2772dd37934589785aa8baf83a18d300353f0e)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoperf tools: define _DEFAULT_SOURCE for glibc_2.20
Chanho Park [Fri, 12 Sep 2014 02:03:01 +0000 (11:03 +0900)]
perf tools: define _DEFAULT_SOURCE for glibc_2.20

_BSD_SOURCE was deprecated in favour of _DEFAULT_SOURCE since glibc
2.20[1]. To avoid build warning on glibc2.20, _DEFAULT_SOURCE should
also be defined.

[1]: https://sourceware.org/glibc/wiki/Release/2.20

Change-Id: I01a2849bb8642cbf5c875caf227ab05e6fa0fa41
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
(cherry picked from commit c92e952df3af842eaed9ed9a59392167bcbf1afc)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: Fix setting label on successful file open
Marcin Niesluchowski [Tue, 19 Aug 2014 12:26:32 +0000 (14:26 +0200)]
Smack: Fix setting label on successful file open

While opening with CAP_MAC_OVERRIDE file label is not set.
Other calls may access it after CAP_MAC_OVERRIDE is dropped from process.

Change-Id: I937d070e1c0cb251f4a0dd3291efbc94be3ca548
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Origin: git://git.gitorious.org/smack-next/kernel.git# smack-for-3.18
(cherry picked from commit 6047a807302a008d48bd2a4822025b725580c361)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: remove unneeded NULL-termination from securtity label
Konstantin Khlebnikov [Thu, 7 Aug 2014 16:52:49 +0000 (20:52 +0400)]
Smack: remove unneeded NULL-termination from securtity label

Values of extended attributes are stored as binary blobs. NULL-termination
of them isn't required. It just wastes disk space and confuses command-line
tools like getfattr because they have to print that zero byte at the end.

This patch removes terminating zero byte from initial security label in
smack_inode_init_security and cuts it out in function smack_inode_getsecurity
which is used by syscall getxattr. This change seems completely safe, because
function smk_parse_smack ignores everything after first zero byte.

Change-Id: I131879e36fc9e71b65857b46714ccd0e512fc83c
Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit a99ae8658f4402b6ecdd62cd5414e32356aa3025)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: handle zero-length security labels without panic
Konstantin Khlebnikov [Thu, 7 Aug 2014 16:52:43 +0000 (20:52 +0400)]
Smack: handle zero-length security labels without panic

Zero-length security labels are invalid but kernel should handle them.

This patch fixes kernel panic after setting zero-length security labels:

And after writing zero-length string into smackfs files syslog and onlycp:

The problem is caused by brain-damaged logic in function smk_parse_smack()
which takes pointer to buffer and its length but if length below or equal zero
it thinks that the buffer is zero-terminated. Unfortunately callers of this
function are widely used and proper fix requires serious refactoring.

Change-Id: I931735ccfaea4d8d2f0a98eacf8467f0a8359bc6
Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit ae5c52ea68b54756c3211e983ada23169b300474)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: fix behavior of smack_inode_listsecurity
Konstantin Khlebnikov [Thu, 7 Aug 2014 16:52:33 +0000 (20:52 +0400)]
Smack: fix behavior of smack_inode_listsecurity

Security operation ->inode_listsecurity is used for generating list of
available extended attributes for syscall listxattr. Currently it's used
only in nfs4 or if filesystem doesn't provide i_op->listxattr.

The list is the set of NULL-terminated names, one after the other.
This method must include zero byte at the and into result.

Also this function must return length even if string does not fit into
output buffer or it is NULL, see similar method in selinux and man listxattr.

Change-Id: I3ba4524fead6ef6ab0c93238fa8d422e6b155efb
Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit 6bbeb11e8fc578a098283670213c890407429588)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoWarning in scanf string typing
Toralf Förster [Sun, 27 Apr 2014 17:33:34 +0000 (19:33 +0200)]
Warning in scanf string typing

This fixes a warning about the mismatch of types between
the declared unsigned and integer.

Change-Id: Ie7170fa22c1f641b2990721b44059d399c92ffe6
Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit d4648ce67e6243f961aa02fe93295e370deaea0b)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: Verify read access on file open - v3
Casey Schaufler [Mon, 21 Apr 2014 18:10:26 +0000 (11:10 -0700)]
Smack: Verify read access on file open - v3

Smack believes that many of the operatons that can
be performed on an open file descriptor are read operations.
The fstat and lseek system calls are examples.
An implication of this is that files shouldn't be open
if the task doesn't have read access even if it has
write access and the file is being opened write only.

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

Change-Id: Iefff38549f9f2e242fd21fce42db067c4c4d8a12
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit 224937f155d693fe6a4b95583b7b72d41a90f51a)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: bidirectional UDS connect check
Casey Schaufler [Thu, 10 Apr 2014 23:37:08 +0000 (16:37 -0700)]
Smack: bidirectional UDS connect check

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

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

Change-Id: I0dd9124261cb66a364322ed88e9dcb3213157cb6
Signed-off-by: Casey Schuafler <casey@schaufler-ca.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit cb182c345b864d6a16f884efa118eb7d1d93427d)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: Correctly remove SMACK64TRANSMUTE attribute
Casey Schaufler [Thu, 10 Apr 2014 23:35:36 +0000 (16:35 -0700)]
Smack: Correctly remove SMACK64TRANSMUTE attribute

Sam Henderson points out that removing the SMACK64TRANSMUTE
attribute from a directory does not result in the directory
transmuting. This is because the inode flag indicating that
the directory is transmuting isn't cleared. The fix is a tad
less than trivial because smk_task and smk_mmap should have
been broken out, too.

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

Change-Id: Iae25080bfd0ec247391c997a59f3e2327423e33d
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit 965242f323fcfa32182059100c0f43db07767bfa)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agobugfix patch for SMACK
Pankaj Kumar [Fri, 13 Dec 2013 09:42:22 +0000 (15:12 +0530)]
bugfix patch for SMACK

1. In order to remove any SMACK extended attribute from a file, a user
should have CAP_MAC_ADMIN capability. But user without having this
capability is able to remove SMACK64MMAP security attribute.

2. While validating size and value of smack extended attribute in
smack_inode_setsecurity hook, wrong error code is returned.

Change-Id: Ib4b290150f4a003733f76cbb7ccc25d228310ecb
Signed-off-by: Pankaj Kumar <pamkaj.k2@samsung.com>
Signed-off-by: Himanshu Shukla <himanshu.sh@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit d66caaa90217949d67ad82c4ba731b98d02adf76)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: adds smackfs/ptrace interface
Lukasz Pawelczyk [Tue, 11 Mar 2014 16:07:06 +0000 (17:07 +0100)]
Smack: adds smackfs/ptrace interface

This allows to limit ptrace beyond the regular smack access rules.
It adds a smackfs/ptrace interface that allows smack to be configured
to require equal smack labels for PTRACE_MODE_ATTACH access.
See the changes in Documentation/security/Smack.txt below for details.

Change-Id: If5d887a86b8d05ac46c82e1e7e123b86a5d62ddb
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@partner.samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit a83c54f6fe32465181f24483f1f34685ad5a2466)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: unify all ptrace accesses in the smack
Lukasz Pawelczyk [Tue, 11 Mar 2014 16:07:05 +0000 (17:07 +0100)]
Smack: unify all ptrace accesses in the smack

The decision whether we can trace a process is made in the following
functions:
smack_ptrace_traceme()
smack_ptrace_access_check()
smack_bprm_set_creds() (in case the proces is traced)

This patch unifies all those decisions by introducing one function that
checks whether ptrace is allowed: smk_ptrace_rule_check().

This makes possible to actually trace with TRACEME where first the
TRACEME itself must be allowed and then exec() on a traced process.

Additional bugs fixed:
- The decision is made according to the mode parameter that is now correctly
  translated from PTRACE_MODE_* to MAY_* instead of being treated 1:1.
  PTRACE_MODE_READ requires MAY_READ.
  PTRACE_MODE_ATTACH requires MAY_READWRITE.
- Add a smack audit log in case of exec() refused by bprm_set_creds().
- Honor the PTRACE_MODE_NOAUDIT flag and don't put smack audit info
  in case this flag is set.

Change-Id: I14d6de0c11ce190e53788a0b4fc096471506c736
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@partner.samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit f76df42e30626b381554264132f4971dd784c375)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: fix the subject/object order in smack_ptrace_traceme()
Lukasz Pawelczyk [Tue, 11 Mar 2014 16:07:04 +0000 (17:07 +0100)]
Smack: fix the subject/object order in smack_ptrace_traceme()

The order of subject/object is currently reversed in
smack_ptrace_traceme(). It is currently checked if the tracee has a
capability to trace tracer and according to this rule a decision is made
whether the tracer will be allowed to trace tracee.

Change-Id: I70afd604b29e5d6515d042ab648b0513c1f77d7a
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@partner.samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit 65381c07573476a9bf9eb634cae836e8da0caa2e)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoMinor improvement of 'smack_sb_kern_mount'
José Bollo [Wed, 8 Jan 2014 14:53:05 +0000 (15:53 +0100)]
Minor improvement of 'smack_sb_kern_mount'

Fix a possible memory access fault when transmute is true and isp is NULL.

Change-Id: I29708ce54b96b34b440cf349e2b1891ea8d9d34f
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit c2d41b31fc60b8592c220d27f425a8214f473a90)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agosmack: fix key permission verification
Dmitry Kasatkin [Fri, 14 Mar 2014 17:44:49 +0000 (17:44 +0000)]
smack: fix key permission verification

For any keyring access type SMACK always used MAY_READWRITE access check.
It prevents reading the key with label "_", which should be allowed for anyone.

This patch changes default access check to MAY_READ and use MAY_READWRITE in only
appropriate cases.

Change-Id: Ie357956730df93058198e2df13ef307ce4e8f675
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit 424538354be6c42da48b302ef1ac939931599797)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoKEYS: Move the flags representing required permission to linux/key.h
David Howells [Fri, 14 Mar 2014 17:44:49 +0000 (17:44 +0000)]
KEYS: Move the flags representing required permission to linux/key.h

Move the flags representing required permission to linux/key.h as the perm
parameter of security_key_permission() is in terms of them - and not the
permissions mask flags used in key->perm.

Whilst we're at it:

 (1) Rename them to be KEY_NEED_xxx rather than KEY_xxx to avoid collisions
     with symbols in uapi/linux/input.h.

 (2) Don't use key_perm_t for a mask of required permissions, but rather limit
     it to the permissions mask attached to the key and arguments related
     directly to that.

Change-Id: Id9de84f93e5dd668a3b8ba00fc2440c6d6c6f988
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Origin: upstream
(cherry picked from commit 5ee6bcc6014f3d271be0db115e92144173c56726)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSMACK: Fix handling value==NULL in post setxattr
José Bollo [Thu, 3 Apr 2014 07:51:07 +0000 (09:51 +0200)]
SMACK: Fix handling value==NULL in post setxattr

The function `smack_inode_post_setxattr` is called each
time that a setxattr is done, for any value of name.
The kernel allow to put value==NULL when size==0
to set an empty attribute value. The systematic
call to smk_import_entry was causing the dereference
of a NULL pointer hence a KERNEL PANIC!

The problem can be produced easily by issuing the
command `setfattr -n user.data file` under bash prompt
when SMACK is active.

Moving the call to smk_import_entry as proposed by this
patch is correcting the behaviour because the function
smack_inode_post_setxattr is called for the SMACK's
attributes only if the function smack_inode_setxattr validated
the value and its size (what will not be the case when size==0).

It also has a benefical effect to not fill the smack hash
with garbage values coming from any extended attribute
write.

Change-Id: Iaf0039c2be9bccb6cee11c24a3b44d209101fe47
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
Signed-off-by: Stephane Desneux <stephane.desneux@open.eurogiciel.org>
(cherry picked from commit efb79bd970e6686e9508edc67565e16c98934bb9)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoSmack: Cgroup filesystem access
Casey Schaufler [Thu, 21 Nov 2013 08:55:10 +0000 (10:55 +0200)]
Smack: Cgroup filesystem access

The cgroup filesystems are not mounted using conventional
mechanisms. This prevents the use of mount options to
set Smack attributes. This patch makes the behavior
of cgroup filesystems compatable with the way systemd
uses them.

Change-Id: I1e0429f133db9e14117dc754d682dec08221354c
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
(cherry picked from commit 30b87ac2002207a5c6a74cd18d843bdb3b01fe92)

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
9 years agoMerge tag 'backport/v3.14.24-ltsi-rc1/mach-shmobile-for-hdmi-20141211' into backport... upstream upstream/snapshot3+hdmi
Simon Horman [Thu, 11 Dec 2014 04:38:30 +0000 (13:38 +0900)]
Merge tag 'backport/v3.14.24-ltsi-rc1/mach-shmobile-for-hdmi-20141211' into backport/v3.14.24-ltsi-rc1+v3.14.26/snapshot-merge+hdmi.wip

9 years agoMerge tag 'backport/v3.14.24-ltsi-rc1/rcar-du-for-hdmi-20141211' into backport/v3...
Simon Horman [Thu, 11 Dec 2014 04:36:36 +0000 (13:36 +0900)]
Merge tag 'backport/v3.14.24-ltsi-rc1/rcar-du-for-hdmi-20141211' into backport/v3.14.24-ltsi-rc1+v3.14.26/snapshot-merge.wip

9 years agoMerge tag 'backport/v3.14.24-ltsi-rc1/mach-shmobile-20141211' into backport/v3.14...
Simon Horman [Thu, 11 Dec 2014 04:36:36 +0000 (13:36 +0900)]
Merge tag 'backport/v3.14.24-ltsi-rc1/mach-shmobile-20141211' into backport/v3.14.24-ltsi-rc1+v3.14.26/snapshot-merge.wip

9 years agoARM: shmobile: marzen: Remove DU platform device
Laurent Pinchart [Thu, 27 Nov 2014 15:19:13 +0000 (17:19 +0200)]
ARM: shmobile: marzen: Remove DU platform device

Platform data support has been removed from the DU driver, drop DU
support from the legacy Marzen board file. The multiplatform DT-based
Marzen support should be used instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 5a0e9d72136d90f5456bcc465d318f49d3f45838)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: lager: Remove DU platform device
Laurent Pinchart [Thu, 27 Nov 2014 15:19:12 +0000 (17:19 +0200)]
ARM: shmobile: lager: Remove DU platform device

Platform data support has been removed from the DU driver, drop DU
support from the legacy Lager board file. The multiplatform DT-based
Lager support should be used instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 792c17cbe27484e3d9e1426005350d7a98fa25e5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
arch/arm/mach-shmobile/board-lager.c

9 years agoARM: shmobile: koelsch: Add DU HDMI output support
Laurent Pinchart [Sun, 26 Oct 2014 15:24:28 +0000 (17:24 +0200)]
ARM: shmobile: koelsch: Add DU HDMI output support

Add DT nodes for the ADV7511 HDMI encoder and its HDMI output connector
and configure the DISP pin group that drives the HDMI transmitter DE
pin.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(targeted at but not yet present in mainline)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: Add adv7511 encoder driver
Lars-Peter Clausen [Mon, 5 Mar 2012 15:30:57 +0000 (16:30 +0100)]
drm: Add adv7511 encoder driver

This patch adds a driver for the Analog Devices adv7511. The adv7511 is
a standalone HDMI transmitter chip. It features a HDMI output interface
on one end and video and audio input interfaces on the other.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 9c8af882bf1230bb85c1dbf67e0dde6888223ceb)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agovideo: Add ADV751[13] DT bindings documentation
Laurent Pinchart [Wed, 24 Sep 2014 19:09:46 +0000 (22:09 +0300)]
video: Add ADV751[13] DT bindings documentation

The ADV7511, ADV7511W and ADV7513 are HDMI audio and video transmitters
compatible with HDMI 1.4 and DVI 1.0. They're described in DT using the
OF graph bindings and a list of custom properties pertaining to the
input video bus configuration.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 53d7437acf641423e9bab3b97d95baca850d5159)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: Decouple EDID parsing from I2C adapter
Lars-Peter Clausen [Fri, 27 Apr 2012 09:11:58 +0000 (11:11 +0200)]
drm: Decouple EDID parsing from I2C adapter

The drm_get_edid() function performs direct I2C accesses to read EDID
blocks, assuming that the monitor DDC interface is directly connected to
the I2C bus. It can't thus be used with HDMI encoders that control the
DDC bus and expose EDID blocks through a different interface.

Refactor drm_do_get_edid() to take a block read callback function
instead of an I2C adapter, and export it for direct use by drivers.

As in the general case the DDC bus is accessible by the kernel at the
I2C level, drivers must make all reasonable efforts to expose it as an
I2C adapter and use drm_get_edid() instead of abusing this function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 18df89fef2d5c7cfd15ab898b17a292d00222b0c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
include/drm/drm_edid.h

9 years agodrm: rcar-du: Fix NULL encoder pointer dereference
Laurent Pinchart [Thu, 27 Nov 2014 12:49:07 +0000 (14:49 +0200)]
drm: rcar-du: Fix NULL encoder pointer dereference

The DRM connector's encoder pointer is managed internally by the DRM
core and set to NULL when the DRM connector is disconnected from the
CRTC it was attached to. This results in a NULL pointer dereference in
the HDMI connector functions when trying to call the associated slave
encoder's operations.

Fix this by retrieving the slave encoder pointer from the R-Car
connector structure instead of the DRM connector structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 4fcd01d0f34645710ac92d5523e26019428b0806)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: Add HDMI encoder and connector support
Laurent Pinchart [Sun, 30 Mar 2014 19:55:38 +0000 (21:55 +0200)]
drm: rcar-du: Add HDMI encoder and connector support

SoCs that integrate the DU have no internal HDMI encoder, support
external encoders only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 637e6194e0daf76e2c06cd78528e8d0a24eca3cd)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: Replace drm_encoder with drm_slave_encoder
Laurent Pinchart [Sun, 30 Mar 2014 23:52:01 +0000 (01:52 +0200)]
drm: rcar-du: Replace drm_encoder with drm_slave_encoder

DRM slave encoders require their associated struct drm_encoder instance
to be embedded in a struct drm_slave_encoder. This makes processing
encoders regardless of their types needlessly and painfully complex in
drivers that use a mix of slave encoders and custom encoders. Such a
driver will need to either create drm_slave_encoder instances that fake
their embedded encoder instance, or to turn all drm_encoder instances
into drm_slave_encoder instances.

Between the two evils, one must choose the lesser. Use drm_slave_encoder
everywhere.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 69746b4112e3c83442c1df59b7011ab3c5ed2d5a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: Replace direct DRM encoder access with cast macro
Laurent Pinchart [Sun, 30 Mar 2014 23:50:16 +0000 (01:50 +0200)]
drm: rcar-du: Replace direct DRM encoder access with cast macro

Add a new macro to downcast an rcar_du_encoder pointer to a drm_encoder
pointer and use it. This prepares for the replacement of the
rcar_drm_encoder encoder field with a drm_slave_encoder.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 4b96b70cfa465550eb9d7112c28e8b5a4093e022)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: Pass the encoder DT node to rcar_du_encoder_init()
Laurent Pinchart [Wed, 17 Sep 2014 11:41:57 +0000 (14:41 +0300)]
drm: rcar-du: Pass the encoder DT node to rcar_du_encoder_init()

The encoder DT node will be needed to register an external HDMI encoder.
Pass it to the rcar_du_encoder_init() function to prepare for HDMI
support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 3ea4d5ec68fa5dc489ee1e4fe3ff07e4ddf0459d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: Remove platform data support
Laurent Pinchart [Tue, 16 Sep 2014 23:07:52 +0000 (02:07 +0300)]
drm: rcar-du: Remove platform data support

All platforms now instantiate the DU through DT, platform data support
isn't needed anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 2378ad1228d2cdae0ea5448beb4fb2b42ebaf99c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: fix error return code
Julia Lawall [Sun, 23 Nov 2014 13:11:17 +0000 (14:11 +0100)]
drm: rcar-du: fix error return code

Propagate the error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 6512f5fb0a28e26f473085b890ada519e0f37d70)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm/rcar: gem: dumb: pitch is an output
Thierry Reding [Mon, 3 Nov 2014 11:08:24 +0000 (12:08 +0100)]
drm/rcar: gem: dumb: pitch is an output

When creating a dumb buffer object using the DRM_IOCTL_MODE_CREATE_DUMB
IOCTL, only the width, height, bpp and flags fields are inputs. The
caller is not guaranteed to zero out or set handle, pitch and size.
Drivers must not treat these values as possible inputs, otherwise they
may use uninitialized memory during the computation of the framebuffer
size.

The R-Car DU driver treats the pitch passed in from userspace as minimum
and will only overwrite it when the driver-computed pitch is larger,
allowing userspace to, intentionally or not, overallocate framebuffers.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 7e295a36b3af5d588e585e2300febbb191463939)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agogpu: drm: rcar-du: drop owner assignment from platform_drivers
Wolfram Sang [Mon, 20 Oct 2014 14:20:34 +0000 (16:20 +0200)]
gpu: drm: rcar-du: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit 8749393d361fa003a6b09152972043f6d6cd2b74)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: add register and unregister functions for connectors
Thomas Wood [Thu, 29 May 2014 15:57:41 +0000 (16:57 +0100)]
drm: add register and unregister functions for connectors

Introduce generic functions to register and unregister connectors. This
provides a common place to add and remove associated user space
interfaces.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 34ea3d386347cd6de4c2fa2491dd85c9e753e7e4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/gpu/drm/bridge/ptn3460.c
drivers/gpu/drm/exynos/exynos_dp_core.c
drivers/gpu/drm/exynos/exynos_drm_dpi.c
drivers/gpu/drm/exynos/exynos_drm_dsi.c
drivers/gpu/drm/exynos/exynos_drm_vidi.c
drivers/gpu/drm/exynos/exynos_hdmi.c
drivers/gpu/drm/gma500/cdv_intel_lvds.c
drivers/gpu/drm/gma500/oaktrail_lvds.c
drivers/gpu/drm/gma500/psb_intel_lvds.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/nouveau/nouveau_connector.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/staging/imx-drm/imx-drm-core.c

9 years agodrm: kerneldoc polish for drm_crtc.c
Daniel Vetter [Mon, 10 Mar 2014 20:33:02 +0000 (21:33 +0100)]
drm: kerneldoc polish for drm_crtc.c

- Standardized on "Returns:" Block.
- Sprinkle missing kerneldoc over all exported functions and all
  ioctls.
- Add a stern warning that driver's really shouldn't use
  drm_mode_group_init_legacy_group.
- Usual attempt at more consistency.
- Add warnings that drm_mode_object_get/put don't do refcounting,
  despite what the names might lead to believe.
- Try to clarify the framebuffer setup/cleanup functions wrt driver
  private framebuffers - I've fallen recently over this when reviewing
  i915 fbdev patches.
- Align function parameters where the kerneldoc has been updated.
- Most of the drm_get_*_name functions aren't thread safe. Add stern
  warnings where this is the case.

Since a lot of the functions in drm_crtc.c are boilerplate to handle
properties and create default sets of them it might be useful to
extract all that code into a new file drm_property.c. Especially since
properties will be used a lot more in the future.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit c8e32cc1219fc15135b696b726421571f68bd97e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/gpu/drm/drm_crtc.c

9 years agodrm: add pseudo filesystem for shared inodes
David Herrmann [Fri, 3 Jan 2014 13:09:47 +0000 (14:09 +0100)]
drm: add pseudo filesystem for shared inodes

Our current DRM design uses a single address_space for all users of the
same DRM device. However, there is no way to create an anonymous
address_space without an underlying inode. Therefore, we wait for the
first ->open() callback on a registered char-dev and take-over the inode
of the char-dev. This worked well so far, but has several drawbacks:
 - We screw with FS internals and rely on some non-obvious invariants like
   inode->i_mapping being the same as inode->i_data for char-devs.
 - We don't have any address_space prior to the first ->open() from
   user-space. This leads to ugly fallback code and we cannot allocate
   global objects early.

As pointed out by Al-Viro, fs/anon_inode.c is *not* supposed to be used by
drivers for anonymous inode-allocation. Therefore, this patch follows the
proposed alternative solution and adds a pseudo filesystem mount-point to
DRM. We can then allocate private inodes including a private address_space
for each DRM device at initialization time.

Note that we could use:
  sysfs_get_inode(sysfs_mnt->mnt_sb, drm_device->dev->kobj.sd);
to get access to the underlying sysfs-inode of a "struct device" object.
However, most of this information is currently hidden and it's not clear
whether this address_space is suitable for driver access. Thus, unless
linux allows anonymous address_space objects or driver-core provides a
public inode per device, we're left with our own private internal mount
point.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit 31bbe16f6d88622d6731fa2cb4ab38d57d844ac1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: provide device-refcount
David Herrmann [Wed, 29 Jan 2014 09:21:36 +0000 (10:21 +0100)]
drm: provide device-refcount

Lets not trick ourselves into thinking "drm_device" objects are not
ref-counted. That's just utterly stupid. We manage "drm_minor" objects on
each drm-device and each minor can have an unlimited number of open
handles. Each of these handles has the drm_minor (and thus the drm_device)
as private-data in the file-handle. Therefore, we may not destroy
"drm_device" until all these handles are closed.

It is *not* possible to reset all these pointers atomically and restrict
access to them, and this is *not* how this is done! Instead, we use
ref-counts to make sure the object is valid and not freed.

Note that we currently use "dev->open_count" for that, which is *exactly*
the same as a reference-count, just open coded. So this patch doesn't
change any semantics on DRM devices (well, this patch just introduces the
ref-count, anyway. Follow-up patches will replace open_count by it).

Also note that generic VFS revoke support could allow us to drop this
ref-count again. We could then just synchronously disable any fops->xy()
calls. However, this is not the case, yet, and no such patches are
in sight (and I seriously question the idea of dropping the ref-cnt
again).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit 099d1c290e2ebc3b798961a6c177c3aef5f0b789)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: Introduce drm_dev_set_unique()
Thierry Reding [Fri, 11 Apr 2014 13:23:00 +0000 (15:23 +0200)]
drm: Introduce drm_dev_set_unique()

Add a helper function that allows drivers to statically set the unique
name of the device. This will allow platform and USB drivers to get rid
of their DRM bus implementations and directly use drm_dev_alloc() and
drm_dev_register().

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit ca8e2ad71013049bc88a10b11d83712bfe56cdd4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: group dev-lifetime related members
David Herrmann [Tue, 28 Jan 2014 15:00:35 +0000 (16:00 +0100)]
drm: group dev-lifetime related members

These members are all managed by DRM-core, lets group them together so
they're not split across the whole device.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 45e212d20fdccaf958b194e95a23ad264188c59e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
include/drm/drmP.h

9 years agodrm: rip out dev->devname
Daniel Vetter [Sun, 3 Nov 2013 20:48:48 +0000 (21:48 +0100)]
drm: rip out dev->devname

This was only ever used to pretty-print the irq driver name. And on
kms systems due to set_version bonghits we never set up the prettier
name, ever. Which make this a bit pointless.

Also, we can always dig out the driver-instance/irq relationship
through other means, so this isn't that useful. So just rip it out to
simplify the set_version/set_busid insanity a bit.

Also delete the temporary busname from drm_pci_set_busid, it's now
unused.

v2: Rebase on top of the new host1x drm_bus for tegra.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 5829d1834e5486e83547f36576b160023c9609c2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/gpu/drm/drm_stub.c

9 years agodrm: Protect the master management with a drm_device::master_mutex v3
Thomas Hellstrom [Tue, 25 Feb 2014 18:57:44 +0000 (19:57 +0100)]
drm: Protect the master management with a drm_device::master_mutex v3

The master management was previously protected by the drm_device::struct_mutex.
In order to avoid locking order violations in a reworked dropped master
security check in the vmwgfx driver, break it out into a separate master_mutex.
Locking order is master_mutex -> struct_mutex.

Also remove drm_master::blocked since it's not used.

v2: Add an inline comment about what drm_device::master_mutex is protecting.
v3: Remove unneeded struct_mutex locks. Fix error returns in
    drm_setmaster_ioctl().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
(cherry picked from commit c996fd0b956450563454e7ccc97a82ca31f9d043)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/gpu/drm/drm_stub.c

9 years agodrm: Remove the minor master list
Thomas Hellstrom [Wed, 19 Feb 2014 13:37:44 +0000 (14:37 +0100)]
drm: Remove the minor master list

It doesn't appear to be used anywhere.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit a12cd0025cdc0b4d43b79249dbd8c266af284032)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: allocate minors early
David Herrmann [Wed, 29 Jan 2014 11:43:56 +0000 (12:43 +0100)]
drm: allocate minors early

Instead of waiting for device-registration, we now allocate minor-objects
during device allocation. The minors are not registered or assigned an ID.
This is still postponed to device-registration.

While at it, remove the superfluous output-parameter in drm_get_minor().

The reason for this early allocation is to make
dev->primary/control/render available atomically. So once the device is
alive, all of them are already set and we never have the situation where
one of them is set after another (they're either NULL or set, but never
changed). This will eventually allow us to reduce minor-ID allocation to
one base-ID instead of a single ID for each.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 05b701f6f60201c9906167351cce50db2e9db7ae)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/gpu/drm/drm_stub.c

9 years agodrm: Improve on minor type helpers v3
Thomas Hellstrom [Thu, 13 Mar 2014 10:07:44 +0000 (11:07 +0100)]
drm: Improve on minor type helpers v3

Add a drm_is_legacy() helper, constify argument to drm_is_render_client(),
and use / change helpers where appropriate.

v2: s/drm_is_legacy/drm_is_legacy_client/ and adapt to new code context.
v3: s/legacy_client/primary_client/

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 436830571eb9045d563979dc6185b1d5145ca4b6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: Have the crtc code only reference master from legacy nodes v2
Thomas Hellstrom [Thu, 13 Mar 2014 09:00:42 +0000 (10:00 +0100)]
drm: Have the crtc code only reference master from legacy nodes v2

control- and render nodes are intended to be master-less.

v2: Replace tests for !legacy with tests for !mode_group for readability.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit 09f308f7b675b692d1c0a451ff02f0fff7846c96)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: Make control nodes master-less v3
Thomas Hellstrom [Wed, 19 Feb 2014 13:21:48 +0000 (14:21 +0100)]
drm: Make control nodes master-less v3

Like for render-nodes, there is no point in maintaining the master concept
for control nodes, so set the struct drm_file::master pointer to NULL.

At the same time, make sure DRM_MASTER | DRM_CONTROL_ALLOW ioctls are always
allowed when called through the control node. Previously the caller also
needed to be master.

v2: Adapt to refactoring of ioctl permission check.
v3: Formatting of logical expression. Use drm_is_control_client() instead of
    drm_is_control().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit ac05dbc57ef2b8709bf48693bb25e16a63e8e71f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: Break out ioctl permission check to a separate function v2
Thomas Hellstrom [Thu, 13 Mar 2014 09:30:25 +0000 (10:30 +0100)]
drm: Break out ioctl permission check to a separate function v2

Helps reviewing and understanding these checks.
v2: Remove misplaced newlines.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit c2667355619572c9324916b62b4f6608a56de031)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm/irq: track the irq installed in drm_irq_install in dev->irq
Daniel Vetter [Mon, 16 Dec 2013 10:21:15 +0000 (11:21 +0100)]
drm/irq: track the irq installed in drm_irq_install in dev->irq

To get rid of the dev->bus->get_irq callback we need to pass in the
desired irq explicitly into drm_irq_install. To avoid having to do the
same for drm_irq_unistall just track it internally. That leaves
drivers with less room to botch things up.

v2: Add the hunk lost in an earlier patch to this one (Thierry).

v3: Fix up the totally fumbled logic in drm_irq_install and use the
local variable consistently. Spotted by both Thierry and Laurent.
Shame on me for failing to properly test the rebase version of this
patch ...

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 7c1a38e391745cca72627979e5e02924bed5b43d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: skip redundant minor-lookup in open path
David Herrmann [Wed, 29 Jan 2014 09:18:02 +0000 (10:18 +0100)]
drm: skip redundant minor-lookup in open path

The drm_open_helper() function is only used internally for drm_open() so
we can safely pass in the minor-object directly instead of the minor-id.
This way, we avoid the additional minor IDR lookup, which we already do
twice in drm_stub_open() and drm_open().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit f4aede2e3291896e7cb42755ecc5b6815b6cac97)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: use anon-inode instead of relying on cdevs
David Herrmann [Fri, 3 Jan 2014 13:24:19 +0000 (14:24 +0100)]
drm: use anon-inode instead of relying on cdevs

DRM drivers share a common address_space across all character-devices of a
single DRM device. This allows simple buffer eviction and mapping-control.
However, DRM core currently waits for the first ->open() on any char-dev
to mark the underlying inode as backing inode of the device. This delayed
initialization causes ugly conditions all over the place:
  if (dev->dev_mapping)
    do_sth();

To avoid delayed initialization and to stop reusing the inode of the
char-dev, we allocate an anonymous inode for each DRM device and reset
filp->f_mapping to it on ->open().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit 6796cb16c088905bf3af40548fda68c09e6f6ee5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: add minor-lookup/release helpers
David Herrmann [Wed, 29 Jan 2014 09:49:19 +0000 (10:49 +0100)]
drm: add minor-lookup/release helpers

Instead of accessing drm_minors_idr directly, this adds a small helper to
hide the internals. This will help us later to remove the drm_global_mutex
requirement for minor-lookup.

Furthermore, this also makes sure that minor->dev is always valid and
takes a reference-count to the device as long as the minor is used in an
open-file. This way, "struct file*"->private_data->dev is guaranteed to be
valid (which it has to, as we cannot reset it).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1616c525b98deb34b8f4b02eccf0ae3a1310fa27)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoMerge tag 'backport/v3.14.24-ltsi-rc1/micrel-20141210' into backport/v3.14.24-ltsi...
Simon Horman [Wed, 10 Dec 2014 04:54:00 +0000 (13:54 +0900)]
Merge tag 'backport/v3.14.24-ltsi-rc1/micrel-20141210' into backport/v3.14.24-ltsi-rc1+v3.14.26/snapshot-merge.wip

9 years agomicrel: fix masking off LED bits
Sergei Shtylyov [Tue, 18 Mar 2014 23:58:16 +0000 (02:58 +0300)]
micrel: fix masking off LED bits

Commit 20d8435a1cff (phy: micrel: add of configuration for LED mode) made the
obvious mistake when masking off  the LED mode bits: forgot to do a logical NOT
to the mask with which it ANDs the register value, so that unrelated bits are
cleared instead.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 28bdc499d647124fa5844453d35e6f5d1b3810dc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agophy: micrel: add of configuration for LED mode
Ben Dooks [Wed, 26 Feb 2014 11:48:00 +0000 (11:48 +0000)]
phy: micrel: add of configuration for LED mode

Add support for the led-mode property for the following PHYs
which have a single LED mode configuration value.

KSZ8001 and KSZ8041 which both use register 0x1e bits 15,14 and
KSZ8021, KSZ8031 and KSZ8051 which use register 0x1f bits 5,4
to control the LED configuration.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 20d8435a1cffa04992f1db6b199a5f0ccec2ff06)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoMerge tag 'v3.14.26' into backport/v3.14.24-ltsi-rc1+v3.14.26/snapshot-merge.wip
Simon Horman [Wed, 10 Dec 2014 00:41:35 +0000 (09:41 +0900)]
Merge tag 'v3.14.26' into backport/v3.14.24-ltsi-rc1+v3.14.26/snapshot-merge.wip

This is the 3.14.26 stable release

Conflicts:
Makefile

9 years agoLinux 3.14.26
Greg Kroah-Hartman [Sat, 6 Dec 2014 23:56:06 +0000 (15:56 -0800)]
Linux 3.14.26

9 years agonfs: Don't busy-wait on SIGKILL in __nfs_iocounter_wait
David Jeffery [Tue, 5 Aug 2014 15:19:42 +0000 (11:19 -0400)]
nfs: Don't busy-wait on SIGKILL in __nfs_iocounter_wait

commit 92a56555bd576c61b27a5cab9f38a33a1e9a1df5 upstream.

If a SIGKILL is sent to a task waiting in __nfs_iocounter_wait,
it will busy-wait or soft lockup in its while loop.
nfs_wait_bit_killable won't sleep, and the loop won't exit on
the error return.

Stop the busy-wait by breaking out of the loop when
nfs_wait_bit_killable returns an error.

Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
[ kamal: backport to 3.13-stable: context ]
Cc: Moritz Mühlenhoff <muehlenhoff@univention.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agox86: kvm: use alternatives for VMCALL vs. VMMCALL if kernel text is read-only
Paolo Bonzini [Mon, 22 Sep 2014 11:17:48 +0000 (13:17 +0200)]
x86: kvm: use alternatives for VMCALL vs. VMMCALL if kernel text is read-only

commit c1118b3602c2329671ad5ec8bdf8e374323d6343 upstream.

On x86_64, kernel text mappings are mapped read-only with CONFIG_DEBUG_RODATA.
In that case, KVM will fail to patch VMCALL instructions to VMMCALL
as required on AMD processors.

The failure mode is currently a divide-by-zero exception, which obviously
is a KVM bug that has to be fixed.  However, picking the right instruction
between VMCALL and VMMCALL will be faster and will help if you cannot upgrade
the hypervisor.

Reported-by: Chris Webb <chris@arachsys.com>
Tested-by: Chris Webb <chris@arachsys.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agobatman: fix a bogus warning from batadv_is_on_batman_iface()
Cong Wang [Thu, 22 May 2014 18:57:17 +0000 (11:57 -0700)]
batman: fix a bogus warning from batadv_is_on_batman_iface()

commit b6ed5498601df40489606dbc14a9c7011c16630b upstream.

batman tries to search dev->iflink to check if it's a batman interface,
but ->iflink could be 0, which is not a valid ifindex. It should just
avoid iflink == 0 case.

Reported-by: Jet Chen <jet.chen@intel.com>
Tested-by: Jet Chen <jet.chen@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Antonio Quartulli <antonio@open-mesh.com>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agopowerpc/powernv: Honor the generic "no_64bit_msi" flag
Benjamin Herrenschmidt [Tue, 7 Oct 2014 05:12:36 +0000 (16:12 +1100)]
powerpc/powernv: Honor the generic "no_64bit_msi" flag

commit 360743814c4082515581aa23ab1d8e699e1fbe88 upstream.

Instead of the arch specific quirk which we are deprecating
and that drivers don't understand.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agolocks: eliminate BUG() call when there's an unexpected lock on file close
Jeff Layton [Mon, 3 Feb 2014 17:13:07 +0000 (12:13 -0500)]
locks: eliminate BUG() call when there's an unexpected lock on file close

commit 8c3cac5e6a85f03602ffe09c44f14418699e31ec upstream.

A leftover lock on the list is surely a sign of a problem of some sort,
but it's not necessarily a reason to panic the box. Instead, just log a
warning with some info about the lock, and then delete it like we would
any other lock.

In the event that the filesystem declares a ->lock f_op, we may end up
leaking something, but that's generally preferable to an immediate
panic.

Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Markus Blank-Burian <burian@muenster.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agobitops: Fix shift overflow in GENMASK macros
Maxime COQUELIN [Thu, 6 Nov 2014 09:54:19 +0000 (10:54 +0100)]
bitops: Fix shift overflow in GENMASK macros

commit 00b4d9a14125f1e51874def2b9de6092e007412d upstream.

On some 32 bits architectures, including x86, GENMASK(31, 0) returns 0
instead of the expected ~0UL.

This is the same on some 64 bits architectures with GENMASK_ULL(63, 0).

This is due to an overflow in the shift operand, 1 << 32 for GENMASK,
1 << 64 for GENMASK_ULL.

Reported-by: Eric Paire <eric.paire@st.com>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: linux@rasmusvillemoes.dk
Cc: gong.chen@linux.intel.com
Cc: John Sullivan <jsrhbz@kanargh.force9.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Fixes: 10ef6b0dffe4 ("bitops: Introduce a more generic BITMASK macro")
Link: http://lkml.kernel.org/r/1415267659-10563-1-git-send-email-maxime.coquelin@st.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agogpu/radeon: Set flag to indicate broken 64-bit MSI
Benjamin Herrenschmidt [Fri, 3 Oct 2014 05:18:59 +0000 (15:18 +1000)]
gpu/radeon: Set flag to indicate broken 64-bit MSI

commit 91ed6fd2c383bb8f02d66e98b4a4d2f7207249dc upstream.

Some radeon ASICs don't support all 64 address bits of MSIs despite
advertising support for 64-bit MSIs in their configuration space.

This breaks on systems such as IBM POWER7/8, where 64-bit MSIs can
be assigned with some of the high address bits set.

This makes use of the newly introduced "no_64bit_msi" flag in structure
pci_dev to allow the MSI allocation code to fallback to 32-bit MSIs
on those adapters.

Adding Alex's review tag. Patch to the driver is identical to the
reviewed one, I dropped the arch/powerpc hunk rewrote the subject
and cset comment.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agodrm/radeon: fix endian swapping in vbios fetch for tdp table
Alex Deucher [Thu, 13 Nov 2014 00:17:02 +0000 (19:17 -0500)]
drm/radeon: fix endian swapping in vbios fetch for tdp table

commit 28731d5818ae25b92d1fb82fe0ac196e97102c1b upstream.

Value needs to be swapped on BE.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agobnx2fc: do not add shared skbs to the fcoe_rx_list
Maurizio Lombardi [Thu, 20 Nov 2014 10:17:33 +0000 (11:17 +0100)]
bnx2fc: do not add shared skbs to the fcoe_rx_list

commit 01a4cc4d0cd6a836c7b923760e8eb1cbb6a47258 upstream.

In some cases, the fcoe_rx_list may contains multiple instances
of the same skb (the so called "shared skbs").

the bnx2fc_l2_rcv thread is a loop that extracts a skb from the list,
modifies (and destroys) its content and then proceed to the next one.
The problem is that if the skb is shared, the remaining instances will
be corrupted.

The solution is to use skb_share_check() before adding the skb to the
fcoe_rx_list.

[ 6286.808725] ------------[ cut here ]------------
[ 6286.808729] WARNING: at include/scsi/fc_frame.h:173 bnx2fc_l2_rcv_thread+0x425/0x450 [bnx2fc]()
[ 6286.808748] Modules linked in: bnx2x(-) mdio dm_service_time bnx2fc cnic uio fcoe libfcoe 8021q garp stp mrp libfc llc scsi_transport_fc scsi_tgt sg iTCO_wdt iTCO_vendor_support coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul crc32c_intel e1000e ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper ptp cryptd hpilo serio_raw hpwdt lpc_ich pps_core ipmi_si pcspkr mfd_core ipmi_msghandler shpchp pcc_cpufreq mperf nfsd auth_rpcgss nfs_acl lockd sunrpc dm_multipath xfs libcrc32c ata_generic pata_acpi sd_mod crc_t10dif crct10dif_common mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit ata_piix drm_kms_helper ttm drm libata i2c_core hpsa dm_mirror dm_region_hash dm_log dm_mod [last unloaded: mdio]
[ 6286.808750] CPU: 3 PID: 1304 Comm: bnx2fc_l2_threa Not tainted 3.10.0-121.el7.x86_64 #1
[ 6286.808750] Hardware name: HP ProLiant DL120 G7, BIOS J01 07/01/2013
[ 6286.808752]  0000000000000000 000000000b36e715 ffff8800deba1e00 ffffffff815ec0ba
[ 6286.808753]  ffff8800deba1e38 ffffffff8105dee1 ffffffffa05618c0 ffff8801e4c81888
[ 6286.808754]  ffffe8ffff663868 ffff8801f402b180 ffff8801f56bc000 ffff8800deba1e48
[ 6286.808754] Call Trace:
[ 6286.808759]  [<ffffffff815ec0ba>] dump_stack+0x19/0x1b
[ 6286.808762]  [<ffffffff8105dee1>] warn_slowpath_common+0x61/0x80
[ 6286.808763]  [<ffffffff8105e00a>] warn_slowpath_null+0x1a/0x20
[ 6286.808765]  [<ffffffffa054f415>] bnx2fc_l2_rcv_thread+0x425/0x450 [bnx2fc]
[ 6286.808767]  [<ffffffffa054eff0>] ? bnx2fc_disable+0x90/0x90 [bnx2fc]
[ 6286.808769]  [<ffffffff81085aef>] kthread+0xcf/0xe0
[ 6286.808770]  [<ffffffff81085a20>] ? kthread_create_on_node+0x140/0x140
[ 6286.808772]  [<ffffffff815fc76c>] ret_from_fork+0x7c/0xb0
[ 6286.808773]  [<ffffffff81085a20>] ? kthread_create_on_node+0x140/0x140
[ 6286.808774] ---[ end trace c6cdb939184ccb4e ]---

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agonet/ping: handle protocol mismatching scenario
Jane Zhou [Mon, 24 Nov 2014 19:44:08 +0000 (11:44 -0800)]
net/ping: handle protocol mismatching scenario

commit 91a0b603469069cdcce4d572b7525ffc9fd352a6 upstream.

ping_lookup() may return a wrong sock if sk_buff's and sock's protocols
dont' match. For example, sk_buff's protocol is ETH_P_IPV6, but sock's
sk_family is AF_INET, in that case, if sk->sk_bound_dev_if is zero, a wrong
sock will be returned.
the fix is to "continue" the searching, if no matching, return NULL.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Jane Zhou <a17711@motorola.com>
Signed-off-by: Yiwei Zhao <gbjc64@motorola.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agonfsd: don't halt scanning the DRC LRU list when there's an RC_INPROG entry
Jeff Layton [Thu, 5 Jun 2014 13:45:00 +0000 (09:45 -0400)]
nfsd: don't halt scanning the DRC LRU list when there's an RC_INPROG entry

commit 1b19453d1c6abcfa7c312ba6c9f11a277568fc94 upstream.

Currently, the DRC cache pruner will stop scanning the list when it
hits an entry that is RC_INPROG. It's possible however for a call to
take a *very* long time. In that case, we don't want it to block other
entries from being pruned if they are expired or we need to trim the
cache to get back under the limit.

Fix the DRC cache pruner to just ignore RC_INPROG entries.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Cc: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agonfsd: Fix slot wake up race in the nfsv4.1 callback code
Trond Myklebust [Wed, 19 Nov 2014 17:47:50 +0000 (12:47 -0500)]
nfsd: Fix slot wake up race in the nfsv4.1 callback code

commit c6c15e1ed303ffc47e696ea1c9a9df1761c1f603 upstream.

The currect code for nfsd41_cb_get_slot() and nfsd4_cb_done() has no
locking in order to guarantee atomicity, and so allows for races of
the form.

Task 1                                  Task 2
======                                  ======
if (test_and_set_bit(0) != 0) {
                                        clear_bit(0)
                                        rpc_wake_up_next(queue)
        rpc_sleep_on(queue)
        return false;
}

This patch breaks the race condition by adding a retest of the bit
after the call to rpc_sleep_on().

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agonfsd: correctly define v4.2 support attributes
Christoph Hellwig [Sat, 8 Nov 2014 12:11:03 +0000 (13:11 +0100)]
nfsd: correctly define v4.2 support attributes

commit 6d0ba0432a5e10bc714ba9c5adc460e726e5fbb4 upstream.

Even when security labels are disabled we support at least the same
attributes as v4.1.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agort2x00: do not align payload on modern H/W
Stanislaw Gruszka [Tue, 11 Nov 2014 13:28:47 +0000 (14:28 +0100)]
rt2x00: do not align payload on modern H/W

commit cfd9167af14eb4ec21517a32911d460083ee3d59 upstream.

RT2800 and newer hardware require padding between header and payload if
header length is not multiple of 4.

For historical reasons we also align payload to to 4 bytes boundary, but
such alignment is not needed on modern H/W.

Patch fixes skb_under_panic problems reported from time to time:

https://bugzilla.kernel.org/show_bug.cgi?id=84911
https://bugzilla.kernel.org/show_bug.cgi?id=72471
http://marc.info/?l=linux-wireless&m=139108549530402&w=2
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1087591

Panic happened because we eat 4 bytes of skb headroom on each
(re)transmission when sending frame without the payload and the header
length not being multiple of 4 (i.e. QoS header has 26 bytes). On such
case because paylad_aling=2 is bigger than header_align=0 we increase
header_align by 4 bytes. To prevent that we could change the check to:

if (payload_length && payload_align > header_align)
header_align += 4;

but not aligning payload at all is more effective and alignment is not
really needed by H/W (that has been tested on OpenWrt project for few
years now).

Reported-and-tested-by: Antti S. Lankila <alankila@bel.fi>
Debugged-by: Antti S. Lankila <alankila@bel.fi>
Reported-by: Henrik Asp <solenskiner@gmail.com>
Originally-From: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agocan: dev: avoid calling kfree_skb() from interrupt context
Thomas Körper [Fri, 31 Oct 2014 06:33:54 +0000 (07:33 +0100)]
can: dev: avoid calling kfree_skb() from interrupt context

commit 5247a589c24022ab34e780039cc8000c48f2035e upstream.

ikfree_skb() is Called in can_free_echo_skb(), which might be called from (TX
Error) interrupt, which triggers the folloing warning:

[ 1153.360705] ------------[ cut here ]------------
[ 1153.360715] WARNING: CPU: 0 PID: 31 at net/core/skbuff.c:563 skb_release_head_state+0xb9/0xd0()
[ 1153.360772] Call Trace:
[ 1153.360778]  [<c167906f>] dump_stack+0x41/0x52
[ 1153.360782]  [<c105bb7e>] warn_slowpath_common+0x7e/0xa0
[ 1153.360784]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
[ 1153.360786]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
[ 1153.360788]  [<c105bc42>] warn_slowpath_null+0x22/0x30
[ 1153.360791]  [<c158b909>] skb_release_head_state+0xb9/0xd0
[ 1153.360793]  [<c158be90>] skb_release_all+0x10/0x30
[ 1153.360795]  [<c158bf06>] kfree_skb+0x36/0x80
[ 1153.360799]  [<f8486938>] ? can_free_echo_skb+0x28/0x40 [can_dev]
[ 1153.360802]  [<f8486938>] can_free_echo_skb+0x28/0x40 [can_dev]
[ 1153.360805]  [<f849a12c>] esd_pci402_interrupt+0x34c/0x57a [esd402]
[ 1153.360809]  [<c10a75b5>] handle_irq_event_percpu+0x35/0x180
[ 1153.360811]  [<c10a7623>] ? handle_irq_event_percpu+0xa3/0x180
[ 1153.360813]  [<c10a7731>] handle_irq_event+0x31/0x50
[ 1153.360816]  [<c10a9c7f>] handle_fasteoi_irq+0x6f/0x120
[ 1153.360818]  [<c10a9c10>] ? handle_edge_irq+0x110/0x110
[ 1153.360822]  [<c1011b61>] handle_irq+0x71/0x90
[ 1153.360823]  <IRQ>  [<c168152c>] do_IRQ+0x3c/0xd0
[ 1153.360829]  [<c1680b6c>] common_interrupt+0x2c/0x34
[ 1153.360834]  [<c107d277>] ? finish_task_switch+0x47/0xf0
[ 1153.360836]  [<c167c27b>] __schedule+0x35b/0x7e0
[ 1153.360839]  [<c10a5334>] ? console_unlock+0x2c4/0x4d0
[ 1153.360842]  [<c13df500>] ? n_tty_receive_buf_common+0x890/0x890
[ 1153.360845]  [<c10707b6>] ? process_one_work+0x196/0x370
[ 1153.360847]  [<c167c723>] schedule+0x23/0x60
[ 1153.360849]  [<c1070de1>] worker_thread+0x161/0x460
[ 1153.360852]  [<c1090fcf>] ? __wake_up_locked+0x1f/0x30
[ 1153.360854]  [<c1070c80>] ? rescuer_thread+0x2f0/0x2f0
[ 1153.360856]  [<c1074f01>] kthread+0xa1/0xc0
[ 1153.360859]  [<c1680401>] ret_from_kernel_thread+0x21/0x30
[ 1153.360861]  [<c1074e60>] ? kthread_create_on_node+0x110/0x110
[ 1153.360863] ---[ end trace 5ff83639cbb74b35 ]---

This patch replaces the kfree_skb() by dev_kfree_skb_any().

Signed-off-by: Thomas Körper <thomas.koerper@esd.eu>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoscsi: add Intel Multi-Flex to scsi scan blacklist
Christian Sünkenberg [Tue, 18 Nov 2014 19:23:32 +0000 (20:23 +0100)]
scsi: add Intel Multi-Flex to scsi scan blacklist

commit 1899045510ff109980d9cc34e330fd8ca3631871 upstream.

Intel Multi-Flex LUNs choke on REPORT SUPPORTED OPERATION CODES
resulting in sd_mod hanging for several minutes on startup.
The issue was introduced with WRITE SAME discovery heuristics.

Fixes: 5db44863b6eb ("[SCSI] sd: Implement support for WRITE SAME")
Signed-off-by: Christian Sünkenberg <christian.suenkenberg@hfg-karlsruhe.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agovhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT
Nicholas Bellinger [Wed, 8 Oct 2014 06:19:20 +0000 (06:19 +0000)]
vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT

commit ab8edab132829b26dd13db6caca3c242cce35dc1 upstream.

This patch addresses a bug where individual vhost-scsi configfs endpoint
groups can be removed from below while active exports to QEMU userspace
still exist, resulting in an OOPs.

It adds a configfs_depend_item() in vhost_scsi_set_endpoint() to obtain
an explicit dependency on se_tpg->tpg_group in order to prevent individual
vhost-scsi WWPN endpoints from being released via normal configfs methods
while an QEMU ioctl reference still exists.

Also, add matching configfs_undepend_item() in vhost_scsi_clear_endpoint()
to release the dependency, once QEMU's reference to the individual group
at /sys/kernel/config/target/vhost/$WWPN/$TPGT is released.

(Fix up vhost_scsi_clear_endpoint() error path - DanC)

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agospi: dw: Fix dynamic speed change.
Thor Thayer [Thu, 6 Nov 2014 19:54:27 +0000 (13:54 -0600)]
spi: dw: Fix dynamic speed change.

commit 0a8727e69778683495058852f783eeda141a754e upstream.

An IOCTL call that calls spi_setup() and then dw_spi_setup() will
overwrite the persisted last transfer speed. On each transfer, the
SPI speed is compared to the last transfer speed to determine if the
clock divider registers need to be updated (did the speed change?).
This bug was observed with the spidev driver using spi-config to
update the max transfer speed.

This fix: Don't overwrite the persisted last transaction clock speed
when updating the SPI parameters in dw_spi_setup(). On the next
transaction, the new speed won't match the persisted last speed
and the hardware registers will be updated.
On initialization, the persisted last transaction clock
speed will be 0 but will be updated after the first SPI
transaction.

Move zeroed clock divider check into clock change test because
chip->clk_div is zero on startup and would cause a divide-by-zero
error. The calculation was wrong as well (can't support odd #).

Reported-by: Vlastimil Setka <setka@vsis.cz>
Signed-off-by: Vlastimil Setka <setka@vsis.cz>
Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoiser-target: Disable TX completion interrupt coalescing
Nicholas Bellinger [Sun, 5 Oct 2014 09:13:03 +0000 (02:13 -0700)]
iser-target: Disable TX completion interrupt coalescing

commit 0d0f660d882c1c02748ced13966a2413aa5d6cc2 upstream.

This patch explicitly disables TX completion interrupt coalescing logic
in isert_put_response() and isert_put_datain() that was originally added
as an efficiency optimization in commit 95b60f07.

It has been reported that this change can trigger ABORT_TASK timeouts
under certain small block workloads, where disabling coalescing was
required for stability.  According to Sagi, this doesn't impact
overall performance, so go ahead and disable it for now.

Reported-by: Moussa Ba <moussaba@micron.com>
Reported-by: Sagi Grimberg <sagig@dev.mellanox.co.il>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoTarget/iser: Fix a wrong dereference in case discovery session is over iser
Sagi Grimberg [Tue, 10 Jun 2014 10:41:41 +0000 (13:41 +0300)]
Target/iser: Fix a wrong dereference in case discovery session is over iser

commit e0546fc1ba66c90cb38a5764357366267d3e58e4 upstream.

In case the discovery session is carried over iser, we can't
access the assumed network portal since the default portal is
used. In this case we don't really need to allocate the fastreg
pool, just prepare to the text pdu that will follow.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reported-by: Alex Tabachnik <alext@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoiser-target: Handle DEVICE_REMOVAL event on network portal listener correctly
Sagi Grimberg [Tue, 28 Oct 2014 20:45:03 +0000 (13:45 -0700)]
iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly

commit 3b726ae2de02a406cc91903f80132daee37b6f1b upstream.

In this case the cm_id->context is the isert_np, and the cm_id->qp
is NULL, so use that to distinct the cases.

Since we don't expect any other events on this cm_id we can
just return -1 for explicit termination of the cm_id by the
cma layer.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agotarget: Don't call TFO->write_pending if data_length == 0
Roland Dreier [Tue, 14 Oct 2014 21:16:24 +0000 (14:16 -0700)]
target: Don't call TFO->write_pending if data_length == 0

commit 885e7b0e181c14e4d0ddd26c688bad2b84c1ada9 upstream.

If an initiator sends a zero-length command (e.g. TEST UNIT READY) but
sets the transfer direction in the transport layer to indicate a
data-out phase, we still shouldn't try to transfer data.  At best it's
a NOP, and depending on the transport, we might crash on an
uninitialized sg list.

Reported-by: Craig Watson <craig.watson@vanguard-rugged.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agosrp-target: Retry when QP creation fails with ENOMEM
Bart Van Assche [Sun, 19 Oct 2014 15:05:33 +0000 (18:05 +0300)]
srp-target: Retry when QP creation fails with ENOMEM

commit ab477c1ff5e0a744c072404bf7db51bfe1f05b6e upstream.

It is not guaranteed to that srp_sq_size is supported
by the HCA. So if we failed to create the QP with ENOMEM,
try with a smaller srp_sq_size. Keep it up until we hit
MIN_SRPT_SQ_SIZE, then fail the connection.

Reported-by: Mark Lehrer <lehrer@gmail.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoInput: xpad - use proper endpoint type
Greg Kroah-Hartman [Tue, 25 Nov 2014 08:38:17 +0000 (00:38 -0800)]
Input: xpad - use proper endpoint type

commit a1f9a4072655843fc03186acbad65990cc05dd2d upstream.

The xpad wireless endpoint is not a bulk endpoint on my devices, but
rather an interrupt one, so the USB core complains when it is submitted.
I'm guessing that the author really did mean that this should be an
interrupt urb, but as there are a zillion different xpad devices out
there, let's cover out bases and handle both bulk and interrupt
endpoints just as easily.

Signed-off-by: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoInput: synaptics - adjust min/max on Thinkpad E540
Ben Sagal [Mon, 17 Nov 2014 01:23:40 +0000 (17:23 -0800)]
Input: synaptics - adjust min/max on Thinkpad E540

commit bce4f9e764c36bc35dd5c9cf9e057c09f422397d upstream.

The LEN2006 Synaptics touchpad (as found in Thinkpad E540) returns wrong
min max values.

touchpad-edge-detector output:
>  Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event6
>  Move one finger around the touchpad to detect the actual edges
>  Kernel says:    x [1472..5674], y [1408..4684]
>  Touchpad sends: x [1264..5675], y [1171..4688]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88211
Signed-off-by: Binyamin Sagal <bensagal@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoARM: 8226/1: cacheflush: get rid of restarting block
Vladimir Murzin [Thu, 27 Nov 2014 10:39:04 +0000 (11:39 +0100)]
ARM: 8226/1: cacheflush: get rid of restarting block

commit 3f4aa45ceea5789a4aade536acc27f2e0d3da5e1 upstream.

We cannot restart cacheflush safely if a process provides user-defined
signal handler and signal is pending. In this case -EINTR is returned
and it is expected that process re-invokes syscall. However, there are
a few problems with that:
 * looks like nobody bothers checking return value from cacheflush
 * but if it did, we don't provide the restart address for that, so the
   process has to use the same range again
 * ...and again, what might lead to looping forever

So, remove cacheflush restarting code and terminate cache flushing
as early as fatal signal is pending.

Reported-by: Chanho Min <chanho.min@lge.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoARM: 8222/1: mvebu: enable strex backoff delay
Thomas Petazzoni [Tue, 25 Nov 2014 17:43:15 +0000 (18:43 +0100)]
ARM: 8222/1: mvebu: enable strex backoff delay

commit 995ab5189d1d7264e79e665dfa032a19b3ac646e upstream.

Under extremely rare conditions, in an MPCore node consisting of at
least 3 CPUs, two CPUs trying to perform a STREX to data on the same
shared cache line can enter a livelock situation.

This patch enables the HW mechanism that overcomes the bug. This fixes
the incorrect setup of the STREX backoff delay bit due to a wrong
description in the specification.

Note that enabling the STREX backoff delay mechanism is done by
leaving the bit *cleared*, while the bit was currently being set by
the proc-v7.S code.

[Thomas: adapt to latest mainline, slightly reword the commit log, add
stable markers.]

Fixes: de4901933f6d ("arm: mm: Add support for PJ4B cpu and init routines")

Signed-off-by: Nadav Haklai <nadavh@marvell.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoARM: 8216/1: xscale: correct auxiliary register in suspend/resume
Dmitry Eremin-Solenikov [Fri, 21 Nov 2014 14:29:00 +0000 (15:29 +0100)]
ARM: 8216/1: xscale: correct auxiliary register in suspend/resume

commit ef59a20ba375aeb97b3150a118318884743452a8 upstream.

According to the manuals I have, XScale auxiliary register should be
reached with opc_2 = 1 instead of crn = 1. cpu_xscale_proc_init
correctly uses c1, c0, 1 arguments, but cpu_xscale_do_suspend and
cpu_xscale_do_resume use c1, c1, 0. Correct suspend/resume functions to
also use c1, c0, 1.

The issue was primarily noticed thanks to qemu reporing "unsupported
instruction" on the pxa suspend path. Confirmed in PXA210/250 and PXA255
XScale Core manuals and in PXA270 and PXA320 Developers Guides.

Harware tested by me on tosa (pxa255). Robert confirmed on pxa270 board.

Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoof/irq: Drop obsolete 'interrupts' vs 'interrupts-extended' text
Bjorn Helgaas [Sat, 1 Nov 2014 23:35:31 +0000 (17:35 -0600)]
of/irq: Drop obsolete 'interrupts' vs 'interrupts-extended' text

commit 66865de4314caca30598244b86817e774c188afa upstream.

a9ecdc0fdc54 ("of/irq: Fix lookup to use 'interrupts-extended' property
first") updated the description to say that:

  - Both 'interrupts' and 'interrupts-extended' may be present
  - Software should prefer 'interrupts-extended'
  - Software that doesn't comprehend 'interrupts-extended' may use
    'interrupts'

But there is still a paragraph at the end that prohibits having both and
says 'interrupts' should be preferred.

Remove the contradictory text.

Fixes: a9ecdc0fdc54 ("of/irq: Fix lookup to use 'interrupts-extended' property first")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>