Andrew-CT Chen [Mon, 7 Dec 2015 10:57:49 +0000 (10:57 +0000)]
dt-bindings: add document of mediatek efuse driver
Add Mediatek MT8173 EFUSE Devicetree binding file
Signed-off-by: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ariel D'Alessandro [Mon, 7 Dec 2015 10:57:39 +0000 (10:57 +0000)]
nvmem: NXP LPC18xx EEPROM memory NVMEM driver
This commit adds support for NXP LPC18xx EEPROM memory found in NXP
LPC185x/3x and LPC435x/3x/2x/1x devices.
EEPROM size is 16384 bytes and it can be entirely read and
written/erased with 1 word (4 bytes) granularity. The last page
(128 bytes) contains the EEPROM initialization data and is not writable.
Erase/program time is less than 3ms. The EEPROM device requires a
~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing
the system bus clock by the division factor, contained in the divider
register (minus 1 encoded).
EEPROM will be kept in Power Down mode except during read/write calls.
Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ariel D'Alessandro [Mon, 7 Dec 2015 10:57:27 +0000 (10:57 +0000)]
DT: nvmem: Add NXP LPC18xx EEPROM memory binding documentation
Add the devicetree binding document for NXP LPC18xx EEPROM memory.
Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geliang Tang [Wed, 13 Jan 2016 15:30:08 +0000 (23:30 +0800)]
misc: c2port: use kobj_to_dev()
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geliang Tang [Wed, 13 Jan 2016 15:30:09 +0000 (23:30 +0800)]
misc: cxl: use kobj_to_dev()
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geliang Tang [Wed, 13 Jan 2016 15:30:11 +0000 (23:30 +0800)]
misc: eeprom: use kobj_to_dev()
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geliang Tang [Mon, 28 Dec 2015 15:00:16 +0000 (23:00 +0800)]
misc: apds990x, bh1770glc, lis3lv02d: use to_i2c_client
Use to_i2c_client() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Hutchings [Mon, 14 Dec 2015 14:29:23 +0000 (14:29 +0000)]
misc/bmp085: Enable building as a module
Commit
985087dbcb02 'misc: add support for bmp18x chips to the bmp085
driver' changed the BMP085 config symbol to a boolean. I see no
reason why the shared code cannot be built as a module, so change it
back to tristate.
Fixes:
985087dbcb02 ("misc: add support for bmp18x chips to the bmp085 driver")
Cc: Eric Andersson <eric.andersson@unixphere.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Mon, 14 Dec 2015 01:07:14 +0000 (20:07 -0500)]
drivers/misc: make arm-charlcd.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
drivers/misc/Kconfig:config ARM_CHARLCD
drivers/misc/Kconfig: bool "ARM Ltd. Character LCD Driver"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and this driver did not have a ".remove"
function coded for non-modular drivers either.
Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
We don't replace module.h with init.h since the file already has that.
We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Burton [Mon, 30 Nov 2015 16:21:35 +0000 (16:21 +0000)]
misc: pch_phub: allow build on MIPS platforms
Allow the pch_phub driver to be build on MIPS platforms, in preparation
for its use on the MIPS Boston board.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Fri, 20 Nov 2015 09:53:50 +0000 (15:23 +0530)]
misc: st_core: remove unreachable code
The pr_debug() will never be executed.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthias Lange [Fri, 29 Jan 2016 12:27:56 +0000 (13:27 +0100)]
scripts: fix typo in ver_linux
Signed-off-by: Matthias Lange <matthias.lange@kernkonzept.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Mon, 23 Nov 2015 11:54:32 +0000 (17:24 +0530)]
misc: mic: use common error path
Instead of calling release_firmware() on every error and then jumping
lets have a common release_firmware() in the error path.
This patch also fixes a memory leak where we missed release_firmware()
if mic_x100_load_command_line() fails.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Mon, 23 Nov 2015 11:54:31 +0000 (17:24 +0530)]
misc: mic: return error directly
Instead of jumping to a label and then returning from there lets return
directly.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Mon, 23 Nov 2015 11:54:30 +0000 (17:24 +0530)]
misc: mic: return error properly
If request_firmware() succeeds then rc becomes 0. After that if the test
for strcmp() fails then we were jumping to label done: and returning rc.
But rc being 0 we returned success whereas we have failed here and we
were supposed to return an error.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Mon, 23 Nov 2015 11:54:29 +0000 (17:24 +0530)]
misc: mic: remove unneeded debug message
>From the error path we are printing an error message with dev_err(). No
need to print almost same message with dev_dbg().
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Tue, 15 Dec 2015 10:11:28 +0000 (13:11 +0300)]
mic_virtio: fix a timeout loop
After the loop we test "if (!retry)" to see if we timedout. The problem
is "retry--" is a post-op so retry will be -1 at the end of the loop. I
have fixed this by changing it to a pre-op instead.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ashutosh Dixit [Tue, 17 Nov 2015 23:55:37 +0000 (15:55 -0800)]
misc: mic: Fix crash when MIC reset is invoked in RESET_FAILED state
This patch fixes the following crash seen when MIC reset is invoked in
RESET_FAILED state due to device_del being called a second time on an
already deleted device:
[<
ffffffff813b2295>] device_del+0x45/0x1d0
[<
ffffffff813b243e>] device_unregister+0x1e/0x60
[<
ffffffffa040f1c2>] scif_unregister_device+0x12/0x20 [scif_bus]
[<
ffffffffa042f75a>] cosm_stop+0xaa/0xe0 [mic_cosm]
[<
ffffffffa042f844>] cosm_reset_trigger_work+0x14/0x20 [mic_cosm]
The fix consists in realizing that because cosm_reset changes the
state to MIC_RESETTING, cosm_stop needs the previous state, before it
changed to MIC_RESETTING, to decide whether a hw_ops->stop had
previously been issued. This is now provided in a new cosm_device
member cdev->prev_state.
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Shishkin [Tue, 22 Dec 2015 15:25:23 +0000 (17:25 +0200)]
intel_th: pci: Add Broxton SOC support
This adds Intel(R) Trace Hub PCI ID for Broxton SOC.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Shishkin [Tue, 22 Dec 2015 15:25:22 +0000 (17:25 +0200)]
intel_th: pci: Add Apollo Lake SOC support
This adds Intel(R) Trace Hub PCI ID for Apollo Lake SOC.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Shishkin [Tue, 22 Dec 2015 15:25:21 +0000 (17:25 +0200)]
stm class: Prevent user-controllable allocations
Currently, the character device write method allocates a temporary buffer
for user's data, but the user's data size is not sanitized and can cause
arbitrarily large allocations via kzalloc() or an integer overflow that
will then result in overwriting kernel memory.
This patch trims the input buffer size to avoid these issues.
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chunyan Zhang [Tue, 22 Dec 2015 15:25:20 +0000 (17:25 +0200)]
stm class: Fix an off-by-one in master array allocation
Since both sw_start and sw_end are master indices, the size of array
that holds them is sw_end - sw_start + 1, which the current code gets
wrong, allocating one item less than required.
This patch corrects the allocation size, avoiding potential slab
corruption.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
[alexander.shishkin@linux.intel.com: re-wrote the commit message]
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Shishkin [Tue, 22 Dec 2015 15:25:19 +0000 (17:25 +0200)]
stm class: Fix link list locking
Currently, the list of stm_sources linked to an stm device is protected by
a spinlock, which also means that sources' .unlink() method is called under
this spinlock. However, this method may (and does) sleep, which means
trouble.
This patch slightly reworks locking around stm::link_list so that bits that
might_sleep() are called with a mutex held instead. Modification of this
list requires both mutex and spinlock to be held, while looking at the list
can be done under either mutex or spinlock.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Shishkin [Tue, 22 Dec 2015 15:25:18 +0000 (17:25 +0200)]
stm class: Fix locking in unbinding policy path
Right now, if stm device removal has to unbind from a policy (that is,
an stm device that has STP policy, gets removed), it will trigger a
nested lock on the stm device's policy mutex.
This patch fixes the problem by moving the locking from the policy
unbinding to policy removal (configfs path), where it's actually needed;
the other caller of the policy unbinding function already takes the
mutex around the call.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Tue, 22 Dec 2015 15:25:17 +0000 (17:25 +0200)]
stm class: Select CONFIG_SRCU
The newly added STM code uses SRCU, but does not ensure that
this code is part of the kernel:
drivers/built-in.o: In function `stm_source_link_show':
include/linux/srcu.h:221: undefined reference to `__srcu_read_lock'
include/linux/srcu.h:238: undefined reference to `__srcu_read_unlock'
drivers/built-in.o: In function `stm_source_link_drop':
include/linux/srcu.h:221: undefined reference to `__srcu_read_lock'
include/linux/srcu.h:238: undefined reference to `__srcu_read_unlock'
This adds a Kconfig 'select' statement like all the other SRCU using
drivers have.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes:
7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Tue, 22 Dec 2015 15:25:16 +0000 (17:25 +0200)]
intel_th: INTEL_TH should depend on HAS_DMA
If NO_DMA=y:
ERROR: "dma_free_coherent" [drivers/hwtracing/intel_th/intel_th_msu.ko] undefined!
ERROR: "dma_alloc_coherent" [drivers/hwtracing/intel_th/intel_th_msu.ko] undefined!
ERROR: "dma_supported" [drivers/hwtracing/intel_th/intel_th.ko] undefined!
Add a dependency on HAS_DMA to fix this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Tue, 22 Dec 2015 15:25:15 +0000 (17:25 +0200)]
stm class: Hide STM-specific options if STM is disabled
If STM=n, it doesn't make sense to ask about STM_DUMMY and
STM_SOURCE_CONSOLE support, which are not even built when enabled
anyway. Hence hide these options if STM=n.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:14:01 +0000 (14:14 -0700)]
coresight: implementing 'cpu_id()' API
Other than plainly parsing the device tree there is no way to
know which CPU a tracer is affined to. As such adding an
interface to lookup the CPU field enclosed in the etm_drvdata
structure that was initialised at boot time.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:14:00 +0000 (14:14 -0700)]
coresight: removing bind/unbind options from sysfs
The coresight drivers have absolutely no control over bind and unbind
operations triggered from sysfs. The operations simply can't be
cancelled or denied event when one or several tracing sessions are
under way. Since the memory associated to individual device is
invariably freed, the end result is a kernel crash when the path from
source to sink is travelled again as demonstrated here[1].
One solution could be to keep track of all the path (i.e tracing
session) that get created and iterate through the elements of those path
looking for the coresight device that is being removed. This proposition
doesn't scale well since there is no upper bound on the amount of
concurrent trace session that can be created.
With the above in mind, this patch prevent devices from being unbounded
from their driver by using the driver->suppress_bind_attr option. That way
trace sessions can be managed without fearing to loose devices.
Since device can't be removed anymore the xyz_remove() functions found in
each driver is also removed.
[1]. http://www.spinics.net/lists/arm-kernel/msg474952.html
Reported-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:13:59 +0000 (14:13 -0700)]
coresight: remove csdev's link from topology
In function 'coresight_unregister()', all references to the csdev that
is being taken away need to be removed from the topology. Otherwise
building the next coresight path from source to sink may use memory
that has been released.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:13:58 +0000 (14:13 -0700)]
coresight: release reference taken by 'bus_find_device()'
The reference count taken by function bus_find_device() needs
to be released if a child device is found, something this patch
is adding.
Reported-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:13:57 +0000 (14:13 -0700)]
coresight: coresight_unregister() function cleanup
In its current form the code never frees csdev->refcnt allocated
in coresight_register(). There is also a problem with csdev->conns
that is freed before device_unregister() rather than in the device
release function.
This patch addresses both issues by moving kfree(csdev->conns) to
coresight_device_release() and freeing csdev->refcnt, also in
the same function.
Reported-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:13:56 +0000 (14:13 -0700)]
coresight: fixing lockdep error
On some platform the following lockdep error occurs when doing simple
manipulations:
[ 23.197021]
[ 23.198608] ======================================================
[ 23.205078] [ INFO: possible circular locking dependency detected ]
[ 23.211639] 4.4.0-rc8-00025-gbbf360b #172 Not tainted
[ 23.216918] -------------------------------------------------------
[ 23.223480] sh/858 is trying to acquire lock:
[ 23.228057] (coresight_mutex){+.+.+.}, at: [<
c0415d40>] coresight_enable+0x1c/0x1b4
[ 23.236206]
[ 23.236206] but task is already holding lock:
[ 23.242309] (s_active#52){++++.+}, at: [<
c01d4b40>] kernfs_fop_write+0x5c/0x1c0
[ 23.250122]
[ 23.250122] which lock already depends on the new lock.
[ 23.250122]
[ 23.258697]
[ 23.258697] the existing dependency chain (in reverse order) is:
[ 23.266510]
-> #1 (s_active#52){++++.+}:
[ 23.270843] [<
c01d30ec>] __kernfs_remove+0x294/0x35c
[ 23.276672] [<
c01d3e44>] kernfs_remove_by_name_ns+0x44/0x8c
[ 23.283172] [<
c01d6318>] remove_files+0x3c/0x84
[ 23.288543] [<
c01d66b4>] sysfs_remove_group+0x48/0x9c
[ 23.294494] [<
c01d6734>] sysfs_remove_groups+0x2c/0x3c
[ 23.300506] [<
c030b658>] device_remove_attrs+0x5c/0x74
[ 23.306549] [<
c030c290>] device_del+0x110/0x218
[ 23.311950] [<
c030c3c4>] device_unregister+0x2c/0x6c
[ 23.317779] [<
c04156d8>] coresight_unregister+0x30/0x40
[ 23.323883] [<
c041a290>] etm_probe+0x228/0x2e8
[ 23.329193] [<
c02bc760>] amba_probe+0xe4/0x160
[ 23.334503] [<
c0310540>] driver_probe_device+0x23c/0x480
[ 23.340728] [<
c0310820>] __driver_attach+0x9c/0xa0
[ 23.346374] [<
c030e400>] bus_for_each_dev+0x70/0xa4
[ 23.352142] [<
c030fcf4>] driver_attach+0x24/0x28
[ 23.357604] [<
c030f86c>] bus_add_driver+0x1e0/0x278
[ 23.363372] [<
c0310d48>] driver_register+0x80/0x100
[ 23.369110] [<
c02bc508>] amba_driver_register+0x58/0x5c
[ 23.375244] [<
c0749514>] etm_driver_init+0x18/0x1c
[ 23.380889] [<
c0009918>] do_one_initcall+0xc4/0x20c
[ 23.386657] [<
c0715e7c>] kernel_init_freeable+0x160/0x208
[ 23.392974] [<
c052d7fc>] kernel_init+0x18/0xf0
[ 23.398254] [<
c0010850>] ret_from_fork+0x14/0x24
[ 23.403747]
-> #0 (coresight_mutex){+.+.+.}:
[ 23.408447] [<
c008ed60>] lock_acquire+0xe4/0x210
[ 23.413909] [<
c0530a30>] mutex_lock_nested+0x74/0x450
[ 23.419860] [<
c0415d40>] coresight_enable+0x1c/0x1b4
[ 23.425689] [<
c0416030>] enable_source_store+0x58/0x68
[ 23.431732] [<
c030b358>] dev_attr_store+0x20/0x2c
[ 23.437286] [<
c01d55e8>] sysfs_kf_write+0x50/0x54
[ 23.442871] [<
c01d4ba8>] kernfs_fop_write+0xc4/0x1c0
[ 23.448699] [<
c015b60c>] __vfs_write+0x34/0xe4
[ 23.454040] [<
c015bf38>] vfs_write+0x98/0x174
[ 23.459228] [<
c015c7a8>] SyS_write+0x4c/0xa8
[ 23.464355] [<
c00107c0>] ret_fast_syscall+0x0/0x1c
[ 23.470031]
[ 23.470031] other info that might help us debug this:
[ 23.470031]
[ 23.478393] Possible unsafe locking scenario:
[ 23.478393]
[ 23.484619] CPU0 CPU1
[ 23.489349] ---- ----
[ 23.494079] lock(s_active#52);
[ 23.497497] lock(coresight_mutex);
[ 23.503906] lock(s_active#52);
[ 23.509918] lock(coresight_mutex);
[ 23.513702]
[ 23.513702] *** DEADLOCK ***
[ 23.513702]
[ 23.519897] 3 locks held by sh/858:
[ 23.523529] #0: (sb_writers#7){.+.+.+}, at: [<
c015ec38>] __sb_start_write+0xa8/0xd4
[ 23.531799] #1: (&of->mutex){+.+...}, at: [<
c01d4b38>] kernfs_fop_write+0x54/0x1c0
[ 23.539916] #2: (s_active#52){++++.+}, at: [<
c01d4b40>] kernfs_fop_write+0x5c/0x1c0
[ 23.548156]
[ 23.548156] stack backtrace:
[ 23.552734] CPU: 0 PID: 858 Comm: sh Not tainted 4.4.0-rc8-00025-gbbf360b #172
[ 23.560302] Hardware name: Generic OMAP4 (Flattened Device Tree)
[ 23.566589] Backtrace:
[ 23.569152] [<
c00154d4>] (dump_backtrace) from [<
c00156d0>] (show_stack+0x18/0x1c)
[ 23.577087] r7:
ed4b8570 r6:
c0936400 r5:
c07ae71c r4:
00000000
[ 23.583038] [<
c00156b8>] (show_stack) from [<
c027e69c>] (dump_stack+0x98/0xc0)
[ 23.590606] [<
c027e604>] (dump_stack) from [<
c008a750>] (print_circular_bug+0x21c/0x33c)
[ 23.599090] r5:
c0939d60 r4:
c0936400
[ 23.602874] [<
c008a534>] (print_circular_bug) from [<
c008e370>] (__lock_acquire+0x1c98/0x1d88)
[ 23.611877] r10:
00000003 r9:
c0fd7a5c r8:
ed4b8550 r7:
ed4b8570 r6:
ed4b8000 r5:
c0ff69e4
[ 23.620117] r4:
c0936400 r3:
ed4b8550
[ 23.623901] [<
c008c6d8>] (__lock_acquire) from [<
c008ed60>] (lock_acquire+0xe4/0x210)
[ 23.632080] r10:
00000000 r9:
00000000 r8:
60000013 r7:
c07cb7b4 r6:
00000001 r5:
00000000
[ 23.640350] r4:
00000000
[ 23.643005] [<
c008ec7c>] (lock_acquire) from [<
c0530a30>] (mutex_lock_nested+0x74/0x450)
[ 23.651458] r10:
ecc0bf80 r9:
edbe7dcc r8:
ed4b8000 r7:
c0fd7a5c r6:
c0415d40 r5:
00000000
[ 23.659729] r4:
c07cb780
[ 23.662384] [<
c05309bc>] (mutex_lock_nested) from [<
c0415d40>] (coresight_enable+0x1c/0x1b4)
[ 23.671234] r10:
ecc0bf80 r9:
edbe7dcc r8:
ed733c00 r7:
00000000 r6:
ed733c00 r5:
00000002
[ 23.679473] r4:
ed762140
[ 23.682128] [<
c0415d24>] (coresight_enable) from [<
c0416030>] (enable_source_store+0x58/0x68)
[ 23.691070] r7:
00000000 r6:
ed733c00 r5:
00000002 r4:
ed762160
[ 23.697052] [<
c0415fd8>] (enable_source_store) from [<
c030b358>] (dev_attr_store+0x20/0x2c)
[ 23.705780] r5:
edbe7dc0 r4:
c0415fd8
[ 23.709533] [<
c030b338>] (dev_attr_store) from [<
c01d55e8>] (sysfs_kf_write+0x50/0x54)
[ 23.717834] r5:
edbe7dc0 r4:
c030b338
[ 23.721618] [<
c01d5598>] (sysfs_kf_write) from [<
c01d4ba8>] (kernfs_fop_write+0xc4/0x1c0)
[ 23.730163] r7:
00000000 r6:
00000000 r5:
00000002 r4:
edbe7dc0
[ 23.736145] [<
c01d4ae4>] (kernfs_fop_write) from [<
c015b60c>] (__vfs_write+0x34/0xe4)
[ 23.744323] r10:
00000000 r9:
ecc0a000 r8:
c0010964 r7:
ecc0bf80 r6:
00000002 r5:
c01d4ae4
[ 23.752593] r4:
ee385a40
[ 23.755249] [<
c015b5d8>] (__vfs_write) from [<
c015bf38>] (vfs_write+0x98/0x174)
[ 23.762908] r9:
ecc0a000 r8:
c0010964 r7:
ecc0bf80 r6:
000ab0d8 r5:
00000002 r4:
ee385a40
[ 23.771057] [<
c015bea0>] (vfs_write) from [<
c015c7a8>] (SyS_write+0x4c/0xa8)
[ 23.778442] r8:
c0010964 r7:
00000002 r6:
000ab0d8 r5:
ee385a40 r4:
ee385a40
[ 23.785522] [<
c015c75c>] (SyS_write) from [<
c00107c0>] (ret_fast_syscall+0x0/0x1c)
[ 23.793457] r7:
00000004 r6:
00000001 r5:
000ab0d8 r4:
00000002
[ 23.799652] coresight-etb10
54162000.etb: ETB enabled
[ 23.805084] coresight-funnel
54164000.funnel: FUNNEL inport 0 enabled
[ 23.811859] coresight-replicator
44000000.ocp:replicator: REPLICATOR enabled
[ 23.819335] coresight-funnel
54158000.funnel: FUNNEL inport 0 enabled
[ 23.826110] coresight-etm3x
5414c000.ptm: ETM tracing enabled
The locking in coresight_unregister() is not required as the only customers of
the function are drivers themselves when an initialisation failure has been
encoutered.
Reported-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 2 Feb 2016 21:13:55 +0000 (14:13 -0700)]
coresight: fixing indentation problem
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jorgen Hansen [Thu, 12 Nov 2015 09:29:32 +0000 (01:29 -0800)]
VMCI: Use 32bit atomics for queue headers on X86_32
This change restricts the reading and setting of the head and tail
pointers on 32bit X86 to 32bit for both correctness and
performance reasons. On uniprocessor X86_32, the atomic64_read
may be implemented as a non-locked cmpxchg8b. This may result in
updates to the pointers done by the VMCI device being overwritten.
On MP systems, there is no such correctness issue, but using 32bit
atomics avoids the overhead of the locked 64bit operation. All this
is safe because the queue size on 32bit systems will never exceed
a 32bit value.
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Thu, 28 Jan 2016 06:29:45 +0000 (22:29 -0800)]
Drivers: hv: vmbus: Give control over how the ring access is serialized
On the channel send side, many of the VMBUS
device drivers explicity serialize access to the
outgoing ring buffer. Give more control to the
VMBUS device drivers in terms how to serialize
accesss to the outgoing ring buffer.
The default behavior will be to aquire the
ring lock to preserve the current behavior.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Thu, 28 Jan 2016 06:29:44 +0000 (22:29 -0800)]
Drivers: hv: vmbus: Eliminate the spin lock on the read path
The function hv_ringbuffer_read() is called always on a pre-assigned
CPU. Each chnnel is bound to a specific CPU and this function is
always called on the CPU the channel is bound. There is no need to
acquire the spin lock; get rid of this overhead.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:43 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()
The hvsock driver needs this API to release all the resources related
to the channel.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:42 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add a per-channel rescind callback
This will be used by the coming hv_sock driver.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:41 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add a hvsock flag in struct hv_driver
Only the coming hv_sock driver has a "true" value for this flag.
We treat the hvsock offers/channels as special VMBus devices.
Since the hv_sock driver handles all the hvsock offers/channels, we need to
tweak vmbus_match() for hv_sock driver, so we introduce this flag.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:40 +0000 (22:29 -0800)]
Drivers: hv: vmbus: define a new VMBus message type for hvsock
A function to send the type of message is also added.
The coming net/hvsock driver will use this function to proactively request
the host to offer a VMBus channel for a new hvsock connection.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:39 +0000 (22:29 -0800)]
Drivers: hv: vmbus: vmbus_sendpacket_ctl: hvsock: avoid unnecessary signaling
When the hvsock channel's outbound ringbuffer is full (i.e.,
hv_ringbuffer_write() returns -EAGAIN), we should avoid the unnecessary
signaling the host.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:38 +0000 (22:29 -0800)]
Drivers: hv: vmbus: define the new offer type for Hyper-V socket (hvsock)
A helper function is also added.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:37 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add a helper function to set a channel's pending send size
This will be used by the coming net/hvsock driver.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Kuznetsov [Thu, 28 Jan 2016 06:29:36 +0000 (22:29 -0800)]
Drivers: hv: vmbus: don't manipulate with clocksources on crash
clocksource_change_rating() involves mutex usage and can't be called
in interrupt context. It also makes sense to avoid doing redundant work
on crash.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Kuznetsov [Thu, 28 Jan 2016 06:29:35 +0000 (22:29 -0800)]
Drivers: hv: vmbus: avoid scheduling in interrupt context in vmbus_initiate_unload()
We have to call vmbus_initiate_unload() on crash to make kdump work but
the crash can also be happening in interrupt (e.g. Sysrq + c results in
such) where we can't schedule or the following will happen:
[ 314.905786] bad: scheduling from the idle thread!
Just skipping the wait (and even adding some random wait here) won't help:
to make host-side magic working we're supposed to receive CHANNELMSG_UNLOAD
(and actually confirm the fact that we received it) but we can't use
interrupt-base path (vmbus_isr()-> vmbus_on_msg_dpc()). Implement a simple
busy wait ignoring all the other messages and use it if we're in an
interrupt context.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Kuznetsov [Thu, 28 Jan 2016 06:29:34 +0000 (22:29 -0800)]
Drivers: hv: vmbus: avoid infinite loop in init_vp_index()
When we pick a CPU to use for a new subchannel we try find a non-used one
on the appropriate NUMA node, we keep track of them with the
primary->alloced_cpus_in_node mask. Under normal circumstances we don't run
out of available CPUs but it is possible when we we don't initialize some
cpus in Linux, e.g. when we boot with 'nr_cpus=' limitation.
Avoid the infinite loop in init_vp_index() by checking that we still have
non-used CPUs in the alloced_cpus_in_node mask and resetting it in case
we don't.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kamal Mostafa [Thu, 28 Jan 2016 06:29:33 +0000 (22:29 -0800)]
tools/hv: Use include/uapi with __EXPORTED_HEADERS__
Use the local uapi headers to keep in sync with "recently" added #define's
(e.g. VSS_OP_REGISTER1).
Fixes:
3eb2094c59e8 ("Adding makefile for tools/hv")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Sat, 26 Dec 2015 04:00:30 +0000 (20:00 -0800)]
Drivers: hv: vmbus: Add vendor and device atttributes
Add vendor and device attributes to VMBUS devices. These will be used
by Hyper-V tools as well user-level RDMA libraries that will use the
vendor/device tuple to discover the RDMA device.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Mon, 21 Dec 2015 23:12:20 +0000 (15:12 -0800)]
Drivers: hv: vmbus: Cleanup vmbus_set_event()
Cleanup vmbus_set_event() by inlining the hypercall to post
the event and since the return value of vmbus_set_event() is not checked,
make it void. As part of this cleanup, get rid of the function
hv_signal_event() as it is only callled from vmbus_set_event().
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Tue, 2 Feb 2016 09:48:09 +0000 (12:48 +0300)]
goldfish: locking bugs in goldfish_pipe_read_write()
We recently messed up the error handling here. We can return with the
pipe->lock held or sometimes we unlock twice by mistake.
Fixes:
2f3be88237a3 ('goldfish_pipe: Pin pages to memory while copying and other cleanups')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eric Biggers [Sat, 12 Dec 2015 02:09:16 +0000 (20:09 -0600)]
misc: mic: fix incorrect use of error codes in SCIF DMA driver
The error code passed to ERR_PTR() always should be negated. Also, the
return value of scif_add_mmu_notifier() was never checked.
Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geliang Tang [Mon, 16 Nov 2015 13:46:31 +0000 (21:46 +0800)]
misc: mic/scif: use list_next_entry instead of list_entry_next
list_next_entry has been defined in list.h, so I replace list_entry_next
with it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Mon, 19 Oct 2015 11:19:01 +0000 (14:19 +0300)]
misc: mic/scif: fix wrap around tests
Signed integer overflow is undefined. Also I added a check for
"(offset < 0)" in scif_unregister() because that makes it match the
other conditions and because I didn't want to subtract a negative.
Fixes:
ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Christian Colic [Thu, 19 Nov 2015 08:47:24 +0000 (09:47 +0100)]
staging: goldfish: (coding style) Rewrite comparisons to NULL as "!data->reg_base"
Rewrite comparisons to NULL "data->reg_base == NULL" as "!data->reg_base" to conform to checkpatch.
Signed-off-by: Christian Colic <colic.christian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Christian Colic [Thu, 19 Nov 2015 08:38:21 +0000 (09:38 +0100)]
staging: goldfish: (coding style) Add spaces around the "+" to conform to checkpatch
Added a space around the "+" at: "reg_base+addr2" to clear up a checkpatch check.
Signed-off-by: Christian Colic <colic.christian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Mon, 1 Feb 2016 10:33:00 +0000 (11:33 +0100)]
staging: goldfish: use div64_s64 instead of do_div
The goldfish nand driver divides a signed 64-bit number (loff_t)
in multiple places using the do_div() function. This has always
been unreliable but now produces a compiler warning (since 4.5-rc1):
goldfish/goldfish_nand.c: In function 'goldfish_nand_erase':
goldfish/goldfish_nand.c:107:91: error: comparison of distinct pointer types lacks a cast [-Werror]
goldfish/goldfish_nand.c: In function 'goldfish_nand_read_oob':
goldfish/goldfish_nand.c:145:91: error: comparison of distinct pointer types lacks a cast [-Werror]
This changes the code to the equivalent div_s64{,_rem} that
works correctly for negative numbers (which we should never
get here).
The warning has shown up on ARM allmodconfig builds after the goldfish
bus driver has become visible on ARM.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes:
bd2f348db503 ("goldfish: refactor goldfish platform configs")
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:43 +0000 (23:35 +0200)]
mei: split amthif client init from end of clients enumeration
The amthif FW client can appear after the end of client enumeration.
Amthif host client initialization is done now at FW client discovery
time.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:42 +0000 (23:35 +0200)]
mei: hbm: send immediate reply flag in enum request
Signal the FW that it can send an HBM enumeration answer immediately,
without waiting for FW initialization completion, meaning before
all the FW clients are ready and registered.
Organize enumeration response options to enum as a byproduct.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:41 +0000 (23:35 +0200)]
mei: bus: run rescan on me_clients list change
Since clients can be now added and removed during runtime
we need to run bus rescan whenever me_clients list is modified.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:40 +0000 (23:35 +0200)]
mei: drop reserved host client ids
The reserved host clients can be obsoleted now, a portion of the
platforms is shipped without iAMT enabled, where the reservation is not
relevant and for platforms with iAMT dynamic allocation is sufficient.
Dropping reserved ids makes enumeration more flexible and generic
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:39 +0000 (23:35 +0200)]
mei: hbm: warn about fw-initiated disconnect
The FW can initiate client disconnection only because an error
condition, hence it make sense to bump the debug message to the warning
level to have an entery in the log.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:38 +0000 (23:35 +0200)]
mei: fixed address clients for the new platforms
Enable by default connection to fixed address clients
from user-space for skylake and newer platform.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:37 +0000 (23:35 +0200)]
mei: fill file pointer in read cb for fixed address client
The read callback created from a flow control request for
a fixed address client have NULL in the file pointer.
Fill the file pointer using a data from a write callback.
This allows us to drop workaround introduced in:
commit
eeabfcf5a92a ("mei: connection to fixed address clients from user-space")
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:36 +0000 (23:35 +0200)]
mei: discard replies from unconnected fixed address clients
A fixed address client in the FW doesn't have a notion of connection and
can send message after the file associated with it was already closed.
Silently discard such messages.
Add inline helpers to detect whether a message is hbm or intended for
a fixed address client
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:35 +0000 (23:35 +0200)]
mei: clean write queues and wake waiters on disconnect
Clean write and write_waiting queues in disconnect.
Requests in those queues are stale and processing will lead to
fat warnings.
In multi thread operations on disconnect and in FW disconnect case -
write/read/event waiters should end wait and return error.
Wake all waiters for disconnecting client to achieve that.
Drop wake all and write queue clean on reset,
as now we waking all waiters and cleaning write queues on disconnect.
No need to do it twice.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:34 +0000 (23:35 +0200)]
mei: wake blocked write on link reset
In case of link reset all blocked writes should be interrupted.
Note, that currently blocking write is used only through bus layer.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:33 +0000 (23:35 +0200)]
mei: drop superfluous closing bracket from write traces
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:32 +0000 (23:35 +0200)]
mei: bus: check if the device is enabled before data transfer
The bus data transfer interface was missing the check if the device is
in enabled state, this may lead to stack corruption during link reset.
Cc: <stable@vger.kernel.org> #4.0
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:31 +0000 (23:35 +0200)]
mei: bus: fix notification event delivery
Call wake_up cl->ev_wait only in case there is no bus client registered
to the event notification.
Second, since we don't have exclusive waiter wake_up_interruptible_all
is not used correctly here.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:30 +0000 (23:35 +0200)]
mei: bus: fix RX event scheduling
In this particular case this more correct and safer to check if the RX
event is set in the event mask rather than query waitqueue_active
Since the check is already performed in the mei_cl_bus_rx_event
function, it is just required to check for its return value.
Second, since we don't have exclusive waiter wake_up_interruptible_all
is not used correctly here.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:29 +0000 (23:35 +0200)]
mei: amthif: interrupt reader on link reset
In case of link reset all waiting readers should be interrupted.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:28 +0000 (23:35 +0200)]
mei: amthif: use rx_wait queue also for amthif client
Switch using cl->rx_wait wait queue also for amthif, there is nothing
special about amthif in that matter in Rx flow.
The cl->wait is reserved for hbm flows and asynchronous events
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:27 +0000 (23:35 +0200)]
mei: amthif: drop parameter validation from mei_amthif_write
Remove duplicated parameter validation from mei_amthif_write functions,
The parameter check is already performed by the caller function
mei_write
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:26 +0000 (23:35 +0200)]
mei: amthif: replace amthif_rd_complete_list with rd_completed
Now when we have per client rd_completed list we can remove
the amthif specific amthif_rd_complete_list.
In addition in the function mei_amthif_read do not loop over the
rd_completed list like the original code as the code path is unlocked.
Reviewed-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:25 +0000 (23:35 +0200)]
mei: amthif: allow only one request at a time
A next amthif write can be executed only after the previous one has
completed.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:24 +0000 (23:35 +0200)]
mei: rename variable names 'file_object' to fp
The driver uses three names file, fp, and file_object for
struct file type. To improve code clarity and adjust to my taste
rename file_object to more common and shorter fp.
Reviewed-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:23 +0000 (23:35 +0200)]
mei: constify struct file pointer
The struct file file pointer is used as an opaque handle to for a
connected client, for this part the pointer should be immutable and
should be set to count.
Reviewed-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:22 +0000 (23:35 +0200)]
mei: amthif: don't drop read packets on timeout
Since the driver now uses a list for storing read packets instead of
single variable a pending read is no longer blocking other connections.
A pending read will be discarded up the file closure.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:21 +0000 (23:35 +0200)]
mei: amthif: don't copy from an empty buffer
If empty message come from FW (buf_idx == 0) then the current code will
still try to copy data from not filled buffer to the user-space,
instead the code should behave the same as when end of a message
has been reached, clean resources and return 0
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:20 +0000 (23:35 +0200)]
mei: call stop on failed char device register
If registering of character device failed stop the device properly.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 21:35:19 +0000 (23:35 +0200)]
mei: fix possible integer overflow issue
There is a possible integer overflow following by a buffer overflow
when accumulating messages coming from the FW to compose a full payload.
Occurrence of wrap around has to be prevented for next message size
calculation.
For unsigned integer the addition overflow has occurred when the
result is smaller than one of the arguments.
To simplify the fix, the types of buf.size and buf_idx are set to the
same width, namely size_t also to be aligned with the type of length
parameter in file read/write ops.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:18 +0000 (23:35 +0200)]
mei: debugfs: allow hbm features list dump in earlier stages
HBM features list is ready while sending enumerate request and
enumerating clients, output it to debugfs in these states too.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Sun, 7 Feb 2016 21:35:17 +0000 (23:35 +0200)]
mei: debugfs: adjust active clients print buffer
In case of many active host clients clients (41 and more) 1K buffer
is not enough for full information print.
Calculate buffer size according to real clients number.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 20:46:51 +0000 (22:46 +0200)]
mei: trace pci configuration space io
Use tracing events also for reading and writing pci configuration space
<debugfs>/tracing/events/mei/mei_pci_reg_{read,write}
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 20:46:50 +0000 (22:46 +0200)]
watchdog: mei_wdt: re-register device on event
For Intel SKL platform the ME device can inform the host via
asynchronous notification that the watchdog feature was activated
on the device. The activation doesn't require reboot.
In that case the driver registers the watchdog device with the kernel.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 20:46:49 +0000 (22:46 +0200)]
watchdog: mei_wdt: add activation debugfs entry
Add entry for displaying whether the device has activated or
deactivated watchdog fw application.
cat <debugfs>/mei_wdt/activation
activated | deactivated
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Sun, 7 Feb 2016 20:46:48 +0000 (22:46 +0200)]
watchdog: mei_wdt: register wd device only if required
For Intel Broadwell and newer platforms, the ME device can inform
the host whether the watchdog functionality is activated or not.
If the watchdog functionality is not activated then the watchdog interface
can be not registered and eliminate unnecessary pings and hence lower the
power consumption by avoiding waking up the device.
The feature can be deactivated also without reboot
in that case the watchdog device should be unregistered at runtime.
The information regarding the deactivation is reported
in the ping response command. In runtime case the unregistration
has to be run from a worker so that the ping initiated by the watchdog
core completes. Otherwise the flow will deadlock on watchdog
core mutex which both ping and unregistration acquire.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Thu, 7 Jan 2016 22:49:24 +0000 (00:49 +0200)]
mei: bus: whitelist the watchdog client
The iAMT WD client has to be whitelisted sice it has two connections
and is filtered out by number_of_connections fixup.
Also the API has changed for BDW and SKL but firmware haven't updated
the protocol version.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Thu, 7 Jan 2016 22:49:23 +0000 (00:49 +0200)]
watchdog: mei_wdt: add status debugfs entry
Add entry for displaying current watchdog internal state
cat <debugfs>/mei_wdt/state
IDLE|START|RUNNING|STOPPING
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Thu, 7 Jan 2016 22:49:22 +0000 (00:49 +0200)]
watchdog: mei_wdt: implement MEI iAMT watchdog driver
Create a driver with the generic watchdog interface
for the MEI iAMT watchdog device.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Thu, 7 Jan 2016 22:49:21 +0000 (00:49 +0200)]
mei: wd: drop the watchdog code from the core mei driver
Instead of integrating the iAMT watchdog in the mei core driver
we will create a watchdog device on the mei client bus and
create a driver for it.
This patch removes the watchdog code from the mei core driver.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Thu, 7 Jan 2016 12:46:39 +0000 (14:46 +0200)]
mei: drop nfc leftovers from the mei driver
We left few function prototypes in the header file after
moving nfc logic to bus.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Thu, 7 Jan 2016 12:46:37 +0000 (14:46 +0200)]
mei: always copy the read buffer if data is ready
Copy completed callback content to the user space
if we have such callback ready in the beginning of the read.
Simplify offset processing logic as byproduct.
This is a refinement for:
commit
139aacf757fc ("mei: fix read after read scenario")
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Usyskin [Thu, 7 Jan 2016 12:46:36 +0000 (14:46 +0200)]
mei: prevent queuing new flow control credit.
The MEI FW can receive only one flow control for read.
Currently the driver only checks if a flow control credit was already
sent and read is pending in the rd_pending queue, but it also has to
check if flow control credit already queued in the write control queue
to prevent sending more than one flow control credits.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tomas Winkler [Thu, 7 Jan 2016 12:46:34 +0000 (14:46 +0200)]
mei: bus: remove redundant uuid string in debug messages
Remove uuid from the debug messages in bus-fixup.c
as this is already part of the device name.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shraddha Barke [Wed, 20 Jan 2016 21:08:53 +0000 (02:38 +0530)]
Staging: goldfish: goldfish_nand: Add DMA Support using dmam_alloc_coherent
Function nand_setup_cmd_params has 2 goals-
-Initialize the cmd_params field so that it can be used to send and read
commands from the device.
-Get a bus address for the allocated memory to transfer to the device.
Replace the combination of devm_kzalloc and _pa() with dmam_alloc_coherent.
Coherent mapping guarantees that the device and CPU are in sync.
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jason Hu [Wed, 6 Jan 2016 14:06:55 +0000 (14:06 +0000)]
goldfish: Enable ACPI-based enumeration for android pipe
Add ACPI binding to the android pipe driver
Signed-off-by: Jason Hu <jia-cheng.hu@intel.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Yu Ning [Wed, 6 Jan 2016 14:06:40 +0000 (14:06 +0000)]
goldfish_pipe: Pass physical addresses to the device if supported
For reading and writing guest user space buffers, currently the kernel
sends the guest virtual address of the buffer to the pipe device. This
virtual address has to be first converted to a guest physical address.
Doing this translation on the QEMU side is inefficient and requires
additional handling when KVM is enabled, whose implementation would
either incur intrusive changes to QEMU's KVM support code or suffer
from poor performance, see commit
08c7228c50f8 ("x86-kvm: only sync
SREGS when doing address translation") of $AOSP/external/qemu for
details, and thus should be avoided if possible.
There is a TODO comment in hw/misc/android_pipe.c in the new Android
emulator source tree ($AOSP/external/qemu-android) which requests that
the translation be done on the kernel side and that physical addresses
be passed to the device instead of virtual ones. Once the QEMU-side
implementation is done, the kernel will need to support both the new
paddr-based pipe device and the old vaddr-based one (which will
continue to be used by the classic emulator). This patch achieves that
by leveraging the device version register available in the new device.
See https://android-review.googlesource.com/128280 for the QEMU-side
patch.
In addition, use the mmap semaphore (in read mode) to safeguard the
call to get_user_pages().
Signed-off-by: Yu Ning <yu.ning@intel.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Miodrag Dinic [Wed, 6 Jan 2016 14:06:08 +0000 (14:06 +0000)]
Enable platform support for Goldfish virtual devices
Enable CONFIG_GOLDFISH for MIPS platforms.
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>