platform/kernel/linux-exynos.git
8 years agomcb: Implement bus->dev.release callback
Johannes Thumshirn [Tue, 3 May 2016 10:42:03 +0000 (12:42 +0200)]
mcb: Implement bus->dev.release callback

The mcb_bus structure previously was released in mcb_release_bus. This lead to
the following warning on module unload:

------------[ cut here ]------------
WARNING: CPU: 1 PID: 2032 at drivers/base/core.c:251 device_release+0x73/0x90
Device 'mcb:0' does not have a release() function, it is broken and must be fixed.
Modules linked in: men_z135_uart mcb_pci(-) mcb
CPU: 1 PID: 2032 Comm: rmmod Not tainted 4.6.0-rc4+ #3
Hardware name: N/A N/A/COMe-mBTi10, BIOS MVV1R921 X64 10/14/2015
 00000286 00000286 c0117de4 c12d6f16 c0117e2c c18be0d3 c0117dfc c104f6e1
 000000fb f5ccbe08 f5ccbe00 f5c64600 c0117e18 c104f728 00000009 00000000
 c0117e10 c18db674 c0117e2c c0117e3c c13ce5c3 c18be0d3 000000fb c18db674
Call Trace:
 [<c12d6f16>] dump_stack+0x47/0x61
 [<c104f6e1>] __warn+0xc1/0xe0
 [<c104f728>] warn_slowpath_fmt+0x28/0x30
 [<c13ce5c3>] device_release+0x73/0x90
 [<c12d92e4>] kobject_release+0x34/0x80
 [<c12d929d>] ? kobject_del+0x2d/0x40
 [<c12d9205>] kobject_put+0x25/0x50
 [<c13ce77f>] put_device+0xf/0x20
 [<c13d114b>] klist_devices_put+0xb/0x10
 [<c1752673>] klist_next+0x73/0xf0
 [<c13d1140>] ? unbind_store+0x100/0x100
 [<f8a23370>] ? mcb_bus_add_devices+0x30/0x30 [mcb]
 [<c13d0a81>] bus_for_each_dev+0x51/0x80
 [<f8a23319>] mcb_release_bus+0x19/0x40 [mcb]
 [<f8a23370>] ? mcb_bus_add_devices+0x30/0x30 [mcb]
 [<f8a2b033>] mcb_pci_remove+0x13/0x20 [mcb_pci]
 [<c130d358>] pci_device_remove+0x28/0xb0
 [<c13d201b>] __device_release_driver+0x7b/0x110
 [<c13d2847>] driver_detach+0x87/0x90
 [<c13d1b9b>] bus_remove_driver+0x3b/0x80
 [<c13d2ed0>] driver_unregister+0x20/0x50
 [<c130be53>] pci_unregister_driver+0x13/0x60
 [<f8a2b1f4>] mcb_pci_driver_exit+0xd/0xf [mcb_pci]
 [<c10be588>] SyS_delete_module+0x138/0x200
 [<c1159208>] ? ____fput+0x8/0x10
 [<c1068054>] ? task_work_run+0x74/0x90
 [<c1001879>] do_fast_syscall_32+0x69/0x120
 [<c1757597>] sysenter_past_esp+0x40/0x6a
---[ end trace 1ed34c2aa3019875 ]---

Release a mcb_bus' memory on the device's release callback, to avoid above
warning.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reported-by: Andreas Werner <andreas.werner@men.de>
Tested-by: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomcb: export bus information via sysfs
Johannes Thumshirn [Tue, 3 May 2016 07:46:23 +0000 (09:46 +0200)]
mcb: export bus information via sysfs

Export information about the bus stored in the FPGA's header to userspace via
sysfs, instead of hiding it in pr_debug()s from everyone.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Andreas Werner <andreas.werner@men.de>
Tested-by: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomcb: Correctly initialize the bus's device
Johannes Thumshirn [Tue, 3 May 2016 07:46:22 +0000 (09:46 +0200)]
mcb: Correctly initialize the bus's device

The mcb bus' device member wasn't correctly initialized and thus wasn't placed
correctly into the driver model.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Andreas Werner <andreas.werner@men.de>
Tested-by: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomei: bus: call mei_cl_read_start under device lock
Alexander Usyskin [Tue, 3 May 2016 22:54:21 +0000 (18:54 -0400)]
mei: bus: call mei_cl_read_start under device lock

Ensure that mei_cl_read_start is called under the device lock
also in the bus layer. The function updates global ctrl_wr_list
which should be locked.

Cc: <stable@vger.kernel.org> #4.4+
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>
8 years agocoresight: etb10: adjust read pointer only when needed
Mathieu Poirier [Tue, 3 May 2016 17:34:01 +0000 (11:34 -0600)]
coresight: etb10: adjust read pointer only when needed

The read pointer (read_ptr) needs to be adjusted only if its value
has gone beyond the length of the memory buffer.

Reported-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: configuring ETF in FIFO mode when acting as link
Mathieu Poirier [Tue, 3 May 2016 17:34:00 +0000 (11:34 -0600)]
coresight: configuring ETF in FIFO mode when acting as link

When part of a path but not identified as a sink, the EFT has to
be configured as a link and placed in HW FIFO mode.  As such when
enabling a path, call the right configuration function based on
the role the ETF if playing in this trace run.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: implementing TMC-ETF AUX space API
Mathieu Poirier [Tue, 3 May 2016 17:33:59 +0000 (11:33 -0600)]
coresight: tmc: implementing TMC-ETF AUX space API

This patch implement the AUX area interfaces required to
use the TMC (configured as an ETF) from the Perf sub-system.

The heuristic is heavily borrowed from the ETB10 implementation.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: moving struct cs_buffers to header file
Mathieu Poirier [Tue, 3 May 2016 17:33:58 +0000 (11:33 -0600)]
coresight: moving struct cs_buffers to header file

That way we can re-use the structure in other drivers.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: keep track of memory width
Mathieu Poirier [Tue, 3 May 2016 17:33:57 +0000 (11:33 -0600)]
coresight: tmc: keep track of memory width

Accessing the HW configuration register each time the memory
width is needed simply doesn't make sense.  It is much more
efficient to read the value once and keep a reference for
later use.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: make sysFS and Perf mode mutually exclusive
Mathieu Poirier [Tue, 3 May 2016 17:33:56 +0000 (11:33 -0600)]
coresight: tmc: make sysFS and Perf mode mutually exclusive

The sysFS and Perf access methods can't be allowed to interfere
with one another.  As such introducing guards to access
functions that prevents moving forward if a TMC is already
being used.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: dump system memory content only when needed
Mathieu Poirier [Tue, 3 May 2016 17:33:55 +0000 (11:33 -0600)]
coresight: tmc: dump system memory content only when needed

Calling tmc_etf/etr_dump_hw() is required only when operating from
sysFS.  When working from Perf, the system memory is harvested
from the AUX trace API.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: adding mode of operation for link/sinks
Mathieu Poirier [Tue, 3 May 2016 17:33:54 +0000 (11:33 -0600)]
coresight: tmc: adding mode of operation for link/sinks

Moving tmc_drvdata::enable to a local_t mode.  That way the
sink interface is aware of it's orgin and the foundation for
mutual exclusion between the sysFS and Perf interface can be
laid out.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: getting rid of multiple read access
Mathieu Poirier [Tue, 3 May 2016 17:33:53 +0000 (11:33 -0600)]
coresight: tmc: getting rid of multiple read access

Allowing multiple readers to access the trace data simultaniously
via sysFS provides no shortage of opportunity for race condition,
mandates two variable to be maintained (drvdata::read_count and
drvdata::reading), makes the code complex and provide little
advantages, if any.

This patch streamlines the read process by restricting trace data
access to a single user.  That way drvdata::read_count can
be eliminated and race conditions (along with faulty error handling)
in function tmc_open() and tmc_release() eliminated.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: allocating memory when needed
Mathieu Poirier [Tue, 3 May 2016 17:33:52 +0000 (11:33 -0600)]
coresight: tmc: allocating memory when needed

In it's current form the TMC probe() function allocates
trace buffer memory at boot time, event if coresight isn't
used.  This is highly inefficient since trace buffers can
occupy a lot of memory that could be used otherwised.

This patch allocates trace buffers on the fly, when the
coresight subsystem is solicited.  Allocated buffers are
released when traces are read using the device descriptors
under /dev.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: making prepare/unprepare functions generic
Mathieu Poirier [Tue, 3 May 2016 17:33:51 +0000 (11:33 -0600)]
coresight: tmc: making prepare/unprepare functions generic

Dealing with HW related matters in tmc_read_prepare/unprepare
becomes convoluted when many cases need to be handled distinctively.

As such moving processing related to HW setup to individual driver
files and keep the core driver generic.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: splitting driver in ETB/ETF and ETR components
Mathieu Poirier [Tue, 3 May 2016 17:33:50 +0000 (11:33 -0600)]
coresight: tmc: splitting driver in ETB/ETF and ETR components

The TMC block can operate in 3 modes (ETB, ETF and ETR) and accessed
via two interfaces (sysFS and Perf).  That makes 6 mode to cover, which
is way too much coupling for a single file.

This patch splits the original TMC driver in 2 halves, one for ETB/ETF
and another one for ETR mode.  A common core is kept for functionality
common to all 3 modes.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: cleaning up header file
Mathieu Poirier [Tue, 3 May 2016 17:33:49 +0000 (11:33 -0600)]
coresight: tmc: cleaning up header file

This patch first move the TMC_STS_TMCREADY_BIT and
TMC_FFCR_FLUSHMAN_BIT defines to their respective section.
It also removes TMC_FFCR_FLUSHMAN, since the same result
can easily be obtained using the BIT() macro.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: introducing new header file
Mathieu Poirier [Tue, 3 May 2016 17:33:48 +0000 (11:33 -0600)]
coresight: tmc: introducing new header file

The amount of #define, enumeration and structure definition
is big enough to justify moving them to a new header file.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: clearly define number of transfers per burst
Mathieu Poirier [Tue, 3 May 2016 17:33:47 +0000 (11:33 -0600)]
coresight: tmc: clearly define number of transfers per burst

This patch makes the name of the define reflect the amount of
data tranfers per burst, in this case 16.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: re-implementing tmc_read_prepare/unprepare() functions
Mathieu Poirier [Tue, 3 May 2016 17:33:46 +0000 (11:33 -0600)]
coresight: tmc: re-implementing tmc_read_prepare/unprepare() functions

In their current implementation the tmc_read_prepare/unprepare()
are a lump of if/else that is difficult to read.  This patch is
alleviating that by using a switch statement.  The latter also
allows for a better control on the error path.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: waiting for TMCReady bit before programming
Mathieu Poirier [Tue, 3 May 2016 17:33:45 +0000 (11:33 -0600)]
coresight: tmc: waiting for TMCReady bit before programming

According to the TRM before programming the TMC in circular
buffer mode (and that for any configuration, ETB, ETR, ETF),
the TMCReady bit in the status register has to be set.

This patch adds a check to make sure the state machine is in
a state where it can be configured, and complains otherwise.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: modifying naming convention
Mathieu Poirier [Tue, 3 May 2016 17:33:44 +0000 (11:33 -0600)]
coresight: tmc: modifying naming convention

According to the TMC architectural state machine, the 'stopped'
state is reached when bit 2 (TMCReady) of the TMC Status register
turns to '1'.  The code is correct but the naming convention isn't.

The 'Triggered' bit occupies position '1' of the TMC Status register
and has nothing to do with the indication of the TMC entering the
stopped state. As such renaming function "tmc_wait_for_triggered()"
and changing the #define to reflect what the code is really doing.

This patch has no effect other than clarifying the semantic.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: tmc: adding sysFS management entries
Mathieu Poirier [Tue, 3 May 2016 17:33:43 +0000 (11:33 -0600)]
coresight: tmc: adding sysFS management entries

Adding management registers that convey implementation
specific characteristics.  Those are useful for trace
configuration and collection along with general trouble
shooting.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: add tracer ID for A72 Maia processor.
Li Pengcheng [Tue, 3 May 2016 17:33:42 +0000 (11:33 -0600)]
coresight: etm4x: add tracer ID for A72 Maia processor.

This patch adds a cellID for the ETMv4 tracer found on
HiSillicon's A72 Maia processor.

Signed-off-by: Li Pengcheng <lipengcheng8@huawei.com>
Signed-off-by: Li Zhong <lizhong11@hisilicon.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etb10: fixing the right amount of words to read
Mathieu Poirier [Tue, 3 May 2016 17:33:41 +0000 (11:33 -0600)]
coresight: etb10: fixing the right amount of words to read

This patch rectifies the amount of words to read when the internal
buffer is deemed bigger than the amount of space available in the
perf ring buffer.

The amount to read is set to the amount of space in the perf ring
buffer rather than being subtracted by it.

Reported-by: Suzuki K Poulose <Suzuki.Poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: stm: adding driver for CoreSight STM component
Pratik Patel [Tue, 3 May 2016 17:33:40 +0000 (11:33 -0600)]
coresight: stm: adding driver for CoreSight STM component

This driver adds support for the STM CoreSight IP block, allowing any
system compoment (HW or SW) to log and aggregate messages via a
single entity.

The CoreSight STM exposes an application defined number of channels
called stimulus port.  Configuration is done using entries in sysfs
and channels made available to userspace via configfs.

Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Michael Williams <michael.williams@arm.com>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: stm: Bindings for System Trace Macrocell
Mathieu Poirier [Tue, 3 May 2016 17:33:39 +0000 (11:33 -0600)]
coresight: stm: Bindings for System Trace Macrocell

The System Trace Macrocell (STM) is an IP block falling under the
CoreSight umbrella.  It's main purpose it so expose stimulus channels
to any system component for the purpose of information logging.

Bindings for this IP block adds a couple of items to the current
mandatory definition for CoreSight components.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: adding path for STM device
Mathieu Poirier [Tue, 3 May 2016 17:33:38 +0000 (11:33 -0600)]
coresight: adding path for STM device

>From a core framework point of view an STM device is a source that is
treated the same way as any other tracers.  Unlike tracers though STM
devices are not associated with a CPU.  As such it doesn't make sense
to associate the path from an STM device to its sink with a per-cpu
variable as it is done for tracers.

This patch simply adds another global variable to keep STM paths and the
processing in coresight_enable/disable() is updated to deal with STM
devices properly.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostm class: Support devices that override software assigned masters
Alexander Shishkin [Tue, 3 May 2016 17:33:37 +0000 (11:33 -0600)]
stm class: Support devices that override software assigned masters

Some STM devices adjust software assigned master numbers depending on
the trace source and its runtime state and whatnot. This patch adds
a sysfs attribute to inform the trace-side software that master numbers
assigned to software sources will not match those in the STP stream,
so that, for example, master/channel allocation policy can be adjusted
accordingly.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: modify q_support type
Li Pengcheng [Tue, 3 May 2016 17:33:36 +0000 (11:33 -0600)]
coresight: etm4x: modify q_support type

Because this operation exceed the range of boolean,
so we should modify q_support to unit8 bit.
drvdata->q_support = BMVAL(etmidr0, 15, 16)

Signed-off-by: Li Pengcheng <lipengcheng8@huawei.com>
Signed-off-by: Li Zhong <lizhong11@hisilicon.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: no need to do the forced type conversion
Li Pengcheng [Tue, 3 May 2016 17:33:35 +0000 (11:33 -0600)]
coresight: no need to do the forced type conversion

activated and enable are already unsigned type,
no need to change them to unsigned.

Signed-off-by: Li Pengcheng <lipengcheng8@huawei.com>
Signed-off-by: Li Zhong <lizhong11@hisilicon.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agow1: add ability to set (SRAM) and store (EEPROM) configuration for temp sensors like...
Ben Sen [Sun, 1 May 2016 21:23:33 +0000 (23:23 +0200)]
w1: add ability to set (SRAM) and store (EEPROM) configuration for temp sensors like DS18B20

Since many temperature sensors come "preconfigured" with a lower
precision, people are stuck at that precision when running on a kernel
based device (unlike the Dallas 1Wire library for e.g. Arduino, which
supports writing the configuration/scratchpad). This patch adds write
support for the scratchpad/precision registers via w1_slave sysfs.

Signed-off-by: Ben Sen <0.x29a.0@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomemory: of_memory: Silence uninitialized variable warning
Dan Carpenter [Fri, 15 Apr 2016 14:50:32 +0000 (17:50 +0300)]
memory: of_memory: Silence uninitialized variable warning

Presumably we never use the default: case statement which prints a
warning message.  But my static checker complains that if we do, we will
hit an uninitialized variable warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers: amba: properly handle devices with power domains
Marek Szyprowski [Fri, 15 Apr 2016 09:13:32 +0000 (11:13 +0200)]
drivers: amba: properly handle devices with power domains

To read pid/cid registers, the probed device need to be properly turned on.
When it is inside a power domain, the bus code should ensure that the
given power domain is enabled before trying to access device's registers.
However in some cases power domain (or clocks) might not be yet available.
Returning -EPROBE_DEFER is not a solution in such case, because callers
don't handle this special error code. Instead such devices are added to the
special list and their registration is retried from periodic worker until
all resources are available.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoti-st: Fix complete_all() wrong usage
Daniel Wagner [Fri, 15 Apr 2016 08:22:27 +0000 (10:22 +0200)]
ti-st: Fix complete_all() wrong usage

complete_all() should only be called once, doing it twice is a clear bug.

8565adbc8214 ("drivers/misc/ti-st: fix read fw version cmd") added the
additional complete_all() call. Since we call complete_all() when
leaving the function we can drop the complete_all() call inside
true branch of the if statement.

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Pavan Savoy <pavan_savoy@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoARM: qcom: silence an uninitialized variable warning
Dan Carpenter [Wed, 13 Apr 2016 06:45:11 +0000 (09:45 +0300)]
ARM: qcom: silence an uninitialized variable warning

It's harmless but, if "enable" isn't set, then we pass uninitialized
values to qcom_coincell_chgr_config().  The values aren't used, but
let's silence the warning anyway.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Tim Bird <tim.bird@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agochar: Drop bogus dependency of DEVPORT on !M68K
Geert Uytterhoeven [Mon, 11 Apr 2016 08:40:55 +0000 (10:40 +0200)]
char: Drop bogus dependency of DEVPORT on !M68K

According to full-history-linux commit d3794f4fa7c3edc3 ("[PATCH] M68k
update (part 25)"), port operations are allowed on m68k if CONFIG_ISA is
defined.

However, commit 153dcc54df826d2f ("[PATCH] mem driver: fix conditional
on isa i/o support") accidentally changed an "||" into an "&&",
disabling it completely on m68k. This logic was retained when
introducing the DEVPORT symbol in commit 4f911d64e04a44c4 ("Make
/dev/port conditional on config symbol").

Drop the bogus dependency on !M68K to fix this.

Fixes: 153dcc54df826d2f ("[PATCH] mem driver: fix conditional on isa i/o support")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Al Stone <ahs3@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: removing gratuitous boot time log messages
Mathieu Poirier [Tue, 5 Apr 2016 17:53:52 +0000 (11:53 -0600)]
coresight: removing gratuitous boot time log messages

Removing boot time log for drivers that don't report useful information
other than they came up properly.  The same information can be found in
sysFS once the system has booted and as such doesn't provide any value
in the boot log.

Reported-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etb10: splitting sysFS "status" entry
Mathieu Poirier [Tue, 5 Apr 2016 17:53:51 +0000 (11:53 -0600)]
coresight: etb10: splitting sysFS "status" entry

The sysFS "status" entry conveys a wealth of information about
the status of the HW but goes agains the sysFS rule of one topic
per file.

This patch rectify the situation by adding read-only entries for
each of the field formaly displayed by "status".  The ABI
documentation is kept up to date.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: moving coresight_simple_func() to header file
Mathieu Poirier [Tue, 5 Apr 2016 17:53:50 +0000 (11:53 -0600)]
coresight: moving coresight_simple_func() to header file

Macro "coresight_simple_func()" can be used by several drivers.
As such making the structure type generic and moving to a
globally available header file.  That way individual drivers
can use the functionality by simply specifying the structure
they need to work with.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: implementing the perf PMU API
Mathieu Poirier [Tue, 5 Apr 2016 17:53:49 +0000 (11:53 -0600)]
coresight: etm4x: implementing the perf PMU API

Adding a set of API allowing the Perf core to treat ETMv4
tracers like other PMUs.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: implementing user/kernel mode tracing
Mathieu Poirier [Tue, 5 Apr 2016 17:53:48 +0000 (11:53 -0600)]
coresight: etm4x: implementing user/kernel mode tracing

Adding new mode to limit tracing to kernel or user space.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: moving etm_drvdata::enable to atomic field
Mathieu Poirier [Tue, 5 Apr 2016 17:53:47 +0000 (11:53 -0600)]
coresight: etm4x: moving etm_drvdata::enable to atomic field

Similarly to ETMv3, moving etmv4_drvdata::enable to an atomic
type that gives the 'mode' of a tracer and prevents multiple,
simultanious access by different subsystems.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: unlocking tracers in default arch init
Mathieu Poirier [Tue, 5 Apr 2016 17:53:46 +0000 (11:53 -0600)]
coresight: etm4x: unlocking tracers in default arch init

As with the ETMv3.x driver, calling 'smp_call_function_single()'
twice in a row is highly ineffective.  As such moving function
'etm4_os_unlock()' before the default initialisation takes
place, which results in the same outcome.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: splitting etmv4 default configuration
Mathieu Poirier [Tue, 5 Apr 2016 17:53:45 +0000 (11:53 -0600)]
coresight: etm4x: splitting etmv4 default configuration

Splitting and updating the default initialisation for each etmv4
configuration so that it can be called at the beginning of each
session rather than initialisation time only.

Since the trace ID isn't expected to change with every session,
moving it with the default tracer initialisation.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: splitting struct etmv4_drvdata
Mathieu Poirier [Tue, 5 Apr 2016 17:53:44 +0000 (11:53 -0600)]
coresight: etm4x: splitting struct etmv4_drvdata

Similar to what was done on etm3x, splitting driver structure
etmv4_drvdata in two.  One half is concerned with the HW
characteristics that are generally static in nature.  The other
half deals with user configuration and will change from one
trace session to another.

No gain/loss of functionality is incurred from this patch.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: adding config and traceid registers
Mathieu Poirier [Tue, 5 Apr 2016 17:53:43 +0000 (11:53 -0600)]
coresight: etm4x: adding config and traceid registers

Adding new sysFS management interface to query the configuration
and the traceid registers.  Both are required to convey information
to the perf cmd line tools when using ETMv4 tracers as PMU.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocoresight: etm4x: moving sysFS entries to a dedicated file
Mathieu Poirier [Tue, 5 Apr 2016 17:53:42 +0000 (11:53 -0600)]
coresight: etm4x: moving sysFS entries to a dedicated file

As with the etm3x driver, sysFS entries are big enough to justify
their own file. As such moving all sysFS related declarations to
a dedicated location.

No gain/loss of functionality is incurred from this patch.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocheckkconfigsymbols.py: Fix typo in help message
Andreas Ziegler [Thu, 31 Mar 2016 07:24:29 +0000 (09:24 +0200)]
checkkconfigsymbols.py: Fix typo in help message

Fix a typo in the help message for the -d parameter by removing one 'm'.

Signed-off-by: Andreas Ziegler <andreas.ziegler@fau.de>
Acked-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agouio: add missing error codes
Dan Carpenter [Fri, 1 Apr 2016 11:04:23 +0000 (14:04 +0300)]
uio: add missing error codes

My static checker complains that "ret" could be uninitialized at the
end, which is true but it's more likely that it would be set to zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agochar/rtc: replace blacklist with whitelist
Arnd Bergmann [Wed, 27 Apr 2016 19:45:01 +0000 (21:45 +0200)]
char/rtc: replace blacklist with whitelist

Every new architecture has to add itself to the growing list of those
that do not support the legacy PC RTC driver.

This replaces the long list of architectures that don't support it
with a shorter list of those that do.

The list is taken from those architectures that have a non-empty
asm/mc146818rtc.h header file and were not explicitly blacklisted
or select RTC_LIB.

Alpha and Loongson64 can already choose between this driver and
an rtc-class based one. mn10300 is actually the only architecture
now that still requires this driver, and that should be fairly
easy to change to use rtc-cmos if we want to kill off rtc.ko
for good.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agow1: silence an uninitialized variable warning
Dan Carpenter [Thu, 14 Apr 2016 09:35:48 +0000 (12:35 +0300)]
w1: silence an uninitialized variable warning

If kstrtoint() returns -ERANGE then "tmp" is uninitialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Evgeniy Polaykov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoeeprom: 93xx46: Fix SPI device leak
Mark Brown [Wed, 20 Apr 2016 09:16:36 +0000 (10:16 +0100)]
eeprom: 93xx46: Fix SPI device leak

The 93xx46 driver is using spi_dev_get() apparently just to take a copy
of the SPI device used to instantiate it but never calls spi_dev_put()
to free it.  Since the device is guaranteed to exist between probe() and
remove() there should be no need for the driver to take an extra
reference to it so fix the leak by just using a straight assignment.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoeeprom: at25: Fix SPI device leak
Mark Brown [Wed, 20 Apr 2016 09:16:35 +0000 (10:16 +0100)]
eeprom: at25: Fix SPI device leak

The at25 driver is using spi_dev_get() apparently just to take a copy
of the SPI device used to instantiate it but never calls spi_dev_put()
to free it.  Since the device is guaranteed to exist between probe() and
remove() there should be no need for the driver to take an extra
reference to it so fix the leak by just using a straight assignment.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agow1: Spelling s/minmum/minimum/
Geert Uytterhoeven [Mon, 14 Mar 2016 15:31:37 +0000 (16:31 +0100)]
w1: Spelling s/minmum/minimum/

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agow1: enable active pullup for DS2482 by default
Mariusz Bialonczyk [Tue, 29 Mar 2016 16:41:38 +0000 (18:41 +0200)]
w1: enable active pullup for DS2482 by default

This commit enables the active pullup (APU bit) by default for
the DS2482 1-Wire master.

>From the DS2482 datasheet:
"The APU bit controls whether an active pullup (controlled slew-rate
transistor) or a passive pullup (Rwpu resistor) will be used to drive
a 1-Wire line from low to high. When APU = 0, active pullup is disabled
(resistor mode). Active Pullup should always be selected unless there is
only a single slave on the 1-Wire line."

According to the module author, Ben Gardner:
"It doesn't look like active pullup would cause any hurt if there
is only a single slave."
And my tests with multiple and single slaves on 1-Wire bus
confirms that.

This active pullup can be manually disabled using the introduced
module parameter:
  active_pullup = 0

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: 93xx46: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:16 +0000 (20:28 +0100)]
nvmem: 93xx46: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: lpc18xx-eeprom: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:14 +0000 (20:28 +0100)]
nvmem: lpc18xx-eeprom: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: imx-ocotp: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:13 +0000 (20:28 +0100)]
nvmem: imx-ocotp: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: rockchip-efuse: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:11 +0000 (20:28 +0100)]
nvmem: rockchip-efuse: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: sunxi-sid: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:10 +0000 (20:28 +0100)]
nvmem: sunxi-sid: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: vif610-ocotp: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:09 +0000 (20:28 +0100)]
nvmem: vif610-ocotp: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: qfprom: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:08 +0000 (20:28 +0100)]
nvmem: qfprom: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback instead of
regmap.

Reported-by: Rajendra Nayak <rjendra@qti.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoeeprom: at25: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:07 +0000 (20:28 +0100)]
eeprom: at25: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback instead
of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoeeprom: at24: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:06 +0000 (20:28 +0100)]
eeprom: at24: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback instead
of regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: core: remove regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:05 +0000 (20:28 +0100)]
nvmem: core: remove regmap dependency

nvmem uses regmap_raw_read/write apis to read/write data from providers,
regmap raw apis stopped working with recent kernels which removed raw
accessors on mmio bus. This resulted in broken nvmem for providers
which are based on regmap mmio bus. This issue can be fixed temporarly
by moving to other regmap apis, but we might hit same issue in future.
Moving to interfaces based on read/write callbacks from providers would
be more robust.

This patch removes regmap dependency from nvmem and introduces
read/write callbacks from the providers.

Without this patch nvmem providers like qfprom based on regmap mmio
bus would not work.

Reported-by: Rajendra Nayak <rjendra@qti.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agovme: add vme_init_bridge for common bridge init
Aaron Sierra [Sun, 24 Apr 2016 20:11:38 +0000 (15:11 -0500)]
vme: add vme_init_bridge for common bridge init

Consolidate vme_bridge structure setup that every bridge was required
to do itself. This came about because .irq_mtx is only used within the
VME core, but was required to be setup externally.

This returns the structure passed in to support shorthand like this:

    bridge = vme_init_bridge(&priv->bridge);

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agonvmem: Fix build error of missing devm_ioremap_resource on UM
Krzysztof Kozlowski [Thu, 31 Mar 2016 10:07:03 +0000 (11:07 +0100)]
nvmem: Fix build error of missing devm_ioremap_resource on UM

The devres.o gets linked if HAS_IOMEM is present so on ARCH=um
allyesconfig (COMPILE_TEST) failed on many files with:

drivers/built-in.o: In function `mtk_thermal_probe':
mtk_thermal.c:(.text+0x394618): undefined reference to `devm_ioremap_resource'

The users of devm_ioremap_resource() which are compile-testable should
depend on HAS_IOMEM.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agovme: trivial spelling and capitalization fixes
Aaron Sierra [Thu, 21 Apr 2016 16:18:22 +0000 (11:18 -0500)]
vme: trivial spelling and capitalization fixes

Fix a typo in the spurious interrupt warning and consistently capitalize
VME, PCI, and DMA acronyms.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agotools: hv: lsvmbus: add pci pass-through UUID
Vitaly Kuznetsov [Sun, 1 May 2016 02:21:37 +0000 (19:21 -0700)]
tools: hv: lsvmbus: add pci pass-through UUID

lsvmbus keeps its own copy of all VMBus UUIDs, add PCIe pass-through
device there to not report 'Unknown' for such devices.

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>
8 years agoDrivers: hv: balloon: reset host_specified_ha_region
Vitaly Kuznetsov [Sun, 1 May 2016 02:21:36 +0000 (19:21 -0700)]
Drivers: hv: balloon: reset host_specified_ha_region

We set host_specified_ha_region = true on certain request but this is a
global state which stays 'true' forever. We need to reset it when we
receive a request where ha_region is not specified. I did not see any
real issues, the bug was found by code inspection.

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>
8 years agoDrivers: hv: balloon: don't crash when memory is added in non-sorted order
Vitaly Kuznetsov [Sun, 1 May 2016 02:21:35 +0000 (19:21 -0700)]
Drivers: hv: balloon: don't crash when memory is added in non-sorted order

When we iterate through all HA regions in handle_pg_range() we have an
assumption that all these regions are sorted in the list and the
'start_pfn >= has->end_pfn' check is enough to find the proper region.
Unfortunately it's not the case with WS2016 where host can hot-add regions
in a different order. We end up modifying the wrong HA region and crashing
later on pages online. Modify the check to make sure we found the region
we were searching for while iterating. Fix the same check in pfn_covered()
as well.

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>
8 years agoDrivers: hv: vmbus: handle various crash scenarios
Vitaly Kuznetsov [Sun, 1 May 2016 02:21:34 +0000 (19:21 -0700)]
Drivers: hv: vmbus: handle various crash scenarios

Kdump keeps biting. Turns out CHANNELMSG_UNLOAD_RESPONSE is always
delivered to the CPU which was used for initial contact or to CPU0
depending on host version. vmbus_wait_for_unload() doesn't account for
the fact that in case we're crashing on some other CPU we won't get the
CHANNELMSG_UNLOAD_RESPONSE message and our wait on the current CPU will
never end.

Do the following:
1) Check for completion_done() in the loop. In case interrupt handler is
   still alive we'll get the confirmation we need.

2) Read message pages for all CPUs message page as we're unsure where
   CHANNELMSG_UNLOAD_RESPONSE is going to be delivered to. We can race with
   still-alive interrupt handler doing the same, add cmpxchg() to
   vmbus_signal_eom() to not lose CHANNELMSG_UNLOAD_RESPONSE message.

3) Cleanup message pages on all CPUs. This is required (at least for the
   current CPU as we're clearing CPU0 messages now but we may want to bring
   up additional CPUs on crash) as new messages won't be delivered till we
   consume what's pending. On boot we'll place message pages somewhere else
   and we won't be able to read stale messages.

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>
8 years agoDrivers: hv: kvp: fix IP Failover
Vitaly Kuznetsov [Sun, 1 May 2016 02:21:33 +0000 (19:21 -0700)]
Drivers: hv: kvp: fix IP Failover

Hyper-V VMs can be replicated to another hosts and there is a feature to
set different IP for replicas, it is called 'Failover TCP/IP'. When
such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message as soon
as we finish negotiation procedure. The problem is that it can happen (and
it actually happens) before userspace daemon connects and we reply with
HV_E_FAIL to the message. As there are no repetitions we fail to set the
requested IP.

Solve the issue by postponing our reply to the negotiation message till
userspace daemon is connected. We can't wait too long as there is a
host-side timeout (cca. 75 seconds) and if we fail to reply in this time
frame the whole KVP service will become inactive. The solution is not
ideal - if it takes userspace daemon more than 60 seconds to connect
IP Failover will still fail but I don't see a solution with our current
separation between kernel and userspace parts.

Other two modules (VSS and FCOPY) don't require such delay, leave them
untouched.

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>
8 years agomisc: sram: fix check of devm_ioremap*() return value
Vladimir Zapolskiy [Wed, 23 Mar 2016 02:52:45 +0000 (04:52 +0200)]
misc: sram: fix check of devm_ioremap*() return value

Both devm_ioremap() and devm_ioremap_wc() functions return either
a pointer to valid iomem region or NULL, check for IS_ERR() is improper
and may result in oops on error path. Now on error -ENOMEM is returned.

Fixes: 0ab163ad1ea0 ("misc: sram: switch to ioremap_wc from ioremap")
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agospmi: do not use bus internal data
Sudip Mukherjee [Mon, 7 Mar 2016 11:35:50 +0000 (17:05 +0530)]
spmi: do not use bus internal data

The variable p is a data structure which is used by the driver core
internally and it is not expected that busses will be directly accessing
these driver core internal only data.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomei: fix waiting for wr_ctrl for corner cases.
Alexander Usyskin [Wed, 20 Apr 2016 15:03:55 +0000 (11:03 -0400)]
mei: fix waiting for wr_ctrl for corner cases.

A control message reply may not be received if either a link reset has
occurred or disconnection is initiated by the FW.
In the both cases the client state will be set straight to DISCONNECTED
and the driver will wait till timeout.
Adding DISCONNECTED state in the waiting condition will release the
client from the stall.

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>
8 years agomei: don't clean control queues on notify request timeout
Alexander Usyskin [Wed, 20 Apr 2016 15:03:54 +0000 (11:03 -0400)]
mei: don't clean control queues on notify request timeout

Timeout on notify request is not a fatal condition, and actually
cleaning control queues will disrupt other control flows of the
same 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>
8 years agomei: amthif: discard not read messages
Alexander Usyskin [Sun, 17 Apr 2016 16:16:04 +0000 (12:16 -0400)]
mei: amthif: discard not read messages

When a message is received and amthif client is not in reading state
the message is ignored and left dangling in the queue. This may happen
after one of the amthif host connections is closed w/o completing the
reading. Another client will pick up a wrong message on next read
attempt which will lead to link reset.
To prevent this the driver has to properly discard the message when
amthif client is not in reading state.

Cc: <stable@vger.kernel.org> #4.2+
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>
8 years agomei: fix NULL dereferencing during FW initiated disconnection
Alexander Usyskin [Sun, 17 Apr 2016 16:16:03 +0000 (12:16 -0400)]
mei: fix NULL dereferencing during FW initiated disconnection

In the case when disconnection is initiated from the FW
the driver is flushing items from the write control list while
iterating over it:

mei_irq_write_handler()
    list_for_each_entry_safe(ctrl_wr_list)         <-- outer loop
         mei_cl_irq_disconnect_rsp()
             mei_cl_set_disconnected()
                 mei_io_list_flush(ctrl_wr_list)   <-- destorying list

We move the list flushing to the completion routine.

Cc: <stable@vger.kernel.org> #4.2+
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>
8 years agomei: drop global me_client_index
Alexander Usyskin [Sun, 17 Apr 2016 16:16:02 +0000 (12:16 -0400)]
mei: drop global me_client_index

Global me_client_index is used only during the enumeration process and
can be effectively replaced by me_addr data from the last enumeration
response as we always enumerate clients in the increasing order.

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>
8 years agomei: do not pin module if cldrv->probe() failed
Alexey Khoroshilov [Fri, 1 Apr 2016 20:53:01 +0000 (23:53 +0300)]
mei: do not pin module if cldrv->probe() failed

If cldrv->probe() failed in mei_cl_device_probe(),
the mei module is left pinned.

The patch moves __module_get(THIS_MODULE) after cldrv->probe().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agochar: xillybus: use devm_add_action_or_reset
Sudip Mukherjee [Sat, 30 Apr 2016 16:13:20 +0000 (17:13 +0100)]
char: xillybus: use devm_add_action_or_reset

If devm_add_action() fails we are explicitly calling dma_unmap_single(),
pci_unmap_single() and kfree(). Lets use the helper
devm_add_action_or_reset() and return directly in case of error, as we
know that the cleanup function has been already called by the helper if
there was any error. At that same time remove the variable rc which
becomes unused now.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Separate out frame buffer logic when picking MMIO range
Jake Oshins [Tue, 5 Apr 2016 17:22:56 +0000 (10:22 -0700)]
drivers:hv: Separate out frame buffer logic when picking MMIO range

Simplify the logic that picks MMIO ranges by pulling out the
logic related to trying to lay frame buffer claim on top of where
the firmware placed the frame buffer.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Record MMIO range in use by frame buffer
Jake Oshins [Tue, 5 Apr 2016 17:22:55 +0000 (10:22 -0700)]
drivers:hv: Record MMIO range in use by frame buffer

Later in the boot sequence, we need to figure out which memory
ranges can be given out to various paravirtual drivers.  The
hyperv_fb driver should, ideally, be placed right on top of
the frame buffer, without some other device getting plopped on
top of this range in the meantime.  Recording this now allows
that to be guaranteed.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Track allocations of children of hv_vmbus in private resource tree
Jake Oshins [Tue, 5 Apr 2016 17:22:54 +0000 (10:22 -0700)]
drivers:hv: Track allocations of children of hv_vmbus in private resource tree

This patch changes vmbus_allocate_mmio() and vmbus_free_mmio() so
that when child paravirtual devices allocate memory-mapped I/O
space, they allocate it privately from a resource tree pointed
at by hyperv_mmio and also by the public resource tree
iomem_resource.  This allows the region to be marked as "busy"
in the private tree, but a "bridge window" in the public tree,
guaranteeing that no two bridge windows will overlap each other
but while also allowing the PCI device children of the bridge
windows to overlap that window.

One might conclude that this belongs in the pnp layer, rather
than in this driver.  Rafael Wysocki, the maintainter of the
pnp layer, has previously asked that we not modify the pnp layer
as it is considered deprecated.  This patch is thus essentially
a workaround.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Reverse order of resources in hyperv_mmio
Jake Oshins [Tue, 5 Apr 2016 17:22:53 +0000 (10:22 -0700)]
drivers:hv: Reverse order of resources in hyperv_mmio

A patch later in this series allocates child nodes
in this resource tree.  For that to work, this tree
needs to be sorted in ascending order.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Use new vmbus_mmio_free() from client drivers.
Jake Oshins [Tue, 5 Apr 2016 17:22:52 +0000 (10:22 -0700)]
drivers:hv: Use new vmbus_mmio_free() from client drivers.

This patch modifies all the callers of vmbus_mmio_allocate()
to call vmbus_mmio_free() instead of release_mem_region().

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Make a function to free mmio regions through vmbus
Jake Oshins [Tue, 5 Apr 2016 17:22:51 +0000 (10:22 -0700)]
drivers:hv: Make a function to free mmio regions through vmbus

This patch introduces a function that reverses everything
done by vmbus_allocate_mmio().  Existing code just called
release_mem_region().  Future patches in this series
require a more complex sequence of actions, so this function
is introduced to wrap those actions.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers:hv: Lock access to hyperv_mmio resource tree
Jake Oshins [Tue, 5 Apr 2016 17:22:50 +0000 (10:22 -0700)]
drivers:hv: Lock access to hyperv_mmio resource tree

In existing code, this tree of resources is created
in single-threaded code and never modified after it is
created, and thus needs no locking.  This patch introduces
a semaphore for tree access, as other patches in this
series introduce run-time modifications of this resource
tree which can happen on multiple threads.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Implement APIs to support "in place" consumption of vmbus packets
K. Y. Srinivasan [Sun, 3 Apr 2016 00:59:51 +0000 (17:59 -0700)]
Drivers: hv: vmbus: Implement APIs to support "in place" consumption of vmbus packets

Implement APIs for in-place consumption of vmbus packets. Currently, each
packet is copied and processed one at a time and as part of processing
each packet we potentially may signal the host (if it is waiting for
room to produce a packet).

These APIs help batched in-place processing of vmbus packets.
We also optimize host signaling by having a separate API to signal
the end of in-place consumption. With netvsc using these APIs,
on an iperf run on average I see about 20X reduction in checks to
signal the host.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Move some ring buffer functions to hyperv.h
K. Y. Srinivasan [Sun, 3 Apr 2016 00:59:50 +0000 (17:59 -0700)]
Drivers: hv: vmbus: Move some ring buffer functions to hyperv.h

In preparation for implementing APIs for in-place consumption of VMBUS
packets, movve some ring buffer functionality into hyperv.h

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Export the vmbus_set_event() API
K. Y. Srinivasan [Sun, 3 Apr 2016 00:59:49 +0000 (17:59 -0700)]
Drivers: hv: vmbus: Export the vmbus_set_event() API

In preparation for moving some ring buffer functionality out of the
vmbus driver, export the API for signaling the host.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Use the new virt_xx barrier code
K. Y. Srinivasan [Sun, 3 Apr 2016 00:59:48 +0000 (17:59 -0700)]
Drivers: hv: vmbus: Use the new virt_xx barrier code

Use the virt_xx barriers that have been defined for use in virtual machines.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Use READ_ONCE() to read variables that are volatile
K. Y. Srinivasan [Sun, 3 Apr 2016 00:59:47 +0000 (17:59 -0700)]
Drivers: hv: vmbus: Use READ_ONCE() to read variables that are volatile

Use the READ_ONCE macro to access variabes that can change asynchronously.
This is the recommended mechanism for dealing with "unsafe" compiler
optimizations.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Introduce functions for estimating room in the ring buffer
K. Y. Srinivasan [Sun, 3 Apr 2016 00:59:46 +0000 (17:59 -0700)]
Drivers: hv: vmbus: Introduce functions for estimating room in the ring buffer

Introduce separate functions for estimating how much can be read from
and written to the ring buffer.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoDrivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()
K. Y. Srinivasan [Sat, 2 Apr 2016 23:17:38 +0000 (16:17 -0700)]
Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()

On the consumer side, we have interrupt driven flow management of the
producer. It is sufficient to base the signaling decision on the
amount of space that is available to write after the read is complete.
The current code samples the previous available space and uses this
in making the signaling decision. This state can be stale and is
unnecessary. Since the state can be stale, we end up not signaling
the host (when we should) and this can result in a hang. Fix this
problem by removing the unnecessary check. I would like to thank
Arseney Romanenko <arseneyr@microsoft.com> for pointing out this issue.

Also, issue a full memory barrier before making the signaling descision
to correctly deal with potential reordering of the write (read index)
followed by the read of pending_sz.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Tested-by: Dexuan Cui <decui@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoparport: use subsys_initcall
Sudip Mukherjee [Tue, 12 Apr 2016 15:26:10 +0000 (20:56 +0530)]
parport: use subsys_initcall

The drivers which depends on parport may sometimes try to iniitialize
and register with parport bus even before parport has actually
registered with the device layer.
The simplest solution is to mark the init function as subsys_initcall()
and load the parport before the other drivers loads.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomisc: mic: Remove return statements from void functions
Amitoj Kaur Chawla [Fri, 18 Mar 2016 19:10:58 +0000 (00:40 +0530)]
misc: mic: Remove return statements from void functions

Return statements at the end of void functions are useless.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
identifier f;
expression e;
@@
void f(...) {
<...
- return
  e;
...>
}
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomisc: mic: silence uninitialized variable warning
Dan Carpenter [Wed, 13 Apr 2016 06:47:42 +0000 (09:47 +0300)]
misc: mic: silence uninitialized variable warning

My static checker complains that we still use "mark" even when the
_scif_fence_mark() call fails so it can be uninitialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>