cascardo/linux.git
7 years agonvmem: rockchip-efuse: update compatible strings for Rockchip efuse
Finley Xiao [Fri, 2 Sep 2016 09:14:26 +0000 (10:14 +0100)]
nvmem: rockchip-efuse: update compatible strings for Rockchip efuse

Rk3399-efuse is organized as 32bits by 32 one-time programmable electrical
fuses. The efuse of earlier SoCs are organized as 32bits by 8 one-time
programmable electrical fuses with random access interface.

Add different device tree compatible string for different SoCs to be able
to differentiate between the two. The old binding is of course preserved,
though deprecated.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: utils: Check VSS daemon is listening before a hot backup
Alex Ng [Fri, 2 Sep 2016 12:58:25 +0000 (05:58 -0700)]
Drivers: hv: utils: Check VSS daemon is listening before a hot backup

Hyper-V host will send a VSS_OP_HOT_BACKUP request to check if guest is
ready for a live backup/snapshot. The driver should respond to the check
only if the daemon is running and listening to requests. This allows the
host to fallback to standard snapshots in case the VSS daemon is not
running.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: utils: Continue to poll VSS channel after handling requests.
Alex Ng [Fri, 2 Sep 2016 12:58:24 +0000 (05:58 -0700)]
Drivers: hv: utils: Continue to poll VSS channel after handling requests.

Multiple VSS_OP_HOT_BACKUP requests may arrive in quick succession, even
though the host only signals once. The driver wass handling the first
request while ignoring the others in the ring buffer. We should poll the
VSS channel after handling a request to continue processing other requests.

Signed-off-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: Introduce a policy for controlling channel affinity
K. Y. Srinivasan [Fri, 2 Sep 2016 12:58:23 +0000 (05:58 -0700)]
Drivers: hv: Introduce a policy for controlling channel affinity

Introduce a mechanism to control how channels will be affinitized. We will
support two policies:

1. HV_BALANCED: All performance critical channels will be dstributed
evenly amongst all the available NUMA nodes. Once the Node is assigned,
we will assign the CPU based on a simple round robin scheme.

2. HV_LOCALIZED: Only the primary channels are distributed across all
NUMA nodes. Sub-channels will be in the same NUMA node as the primary
channel. This is the current behaviour.

The default policy will be the HV_BALANCED as it can minimize the remote
memory access on NUMA machines with applications that span NUMA nodes.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw()
Vitaly Kuznetsov [Fri, 2 Sep 2016 12:58:22 +0000 (05:58 -0700)]
Drivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw()

With wrap around mappings in place we can always provide drivers with
direct links to packets on the ring buffer, even when they wrap around.
Do the required updates to get_next_pkt_raw()/put_pkt_raw()

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Tested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: ring_buffer: use wrap around mappings in hv_copy{from, to}_ringbuffer()
Vitaly Kuznetsov [Fri, 2 Sep 2016 12:58:21 +0000 (05:58 -0700)]
Drivers: hv: ring_buffer: use wrap around mappings in hv_copy{from, to}_ringbuffer()

With wrap around mappings for ring buffers we can always use a single
memcpy() to do the job.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Tested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: ring_buffer: wrap around mappings for ring buffers
Vitaly Kuznetsov [Fri, 2 Sep 2016 12:58:20 +0000 (05:58 -0700)]
Drivers: hv: ring_buffer: wrap around mappings for ring buffers

Make it possible to always use a single memcpy() or to provide a direct
link to a packet on the ring buffer by creating virtual mapping for two
copies of the ring buffer with vmap(). Utilize currently empty
hv_ringbuffer_cleanup() to do the unmap.

While on it, replace sizeof(struct hv_ring_buffer) check
in hv_ringbuffer_init() with BUILD_BUG_ON() as it is a compile time check.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: cleanup vmbus_open() for wrap around mappings
Vitaly Kuznetsov [Fri, 2 Sep 2016 12:58:19 +0000 (05:58 -0700)]
Drivers: hv: cleanup vmbus_open() for wrap around mappings

In preparation for doing wrap around mappings for ring buffers cleanup
vmbus_open() function:
- check that ring sizes are PAGE_SIZE aligned (they are for all in-kernel
  drivers now);
- kfree(open_info) on error only after we kzalloc() it (not an issue as it
  is valid to call kfree(NULL);
- rename poorly named labels;
- use alloc_pages() instead of __get_free_pages() as we need struct page
  pointer for future.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: pch_uart: Add support for reading clock-frequency from DT
Zubair Lutfullah Kakakhel [Fri, 12 Aug 2016 11:48:54 +0000 (12:48 +0100)]
serial: pch_uart: Add support for reading clock-frequency from DT

The MIPS based Boston platform provides a 25MHz clock to the UART.

Enable the driver for MIPS and add support in the driver to read
the frequency from device tree.

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: pch_phub: Add UART_CLK quirk for Boston platform
Zubair Lutfullah Kakakhel [Fri, 12 Aug 2016 11:48:53 +0000 (12:48 +0100)]
misc: pch_phub: Add UART_CLK quirk for Boston platform

The EG20T has 4 UART blocks. The clock source for the UART block is
configured to receive a clock from an external pin by default.

An internal 25MHz clock in the EG20T can also be used as a clock source
for the clock.

The MIPS based Boston platform ties the external clock pin down and relies
on the internal clock source for the UART to function.

Boston is based on device tree.

Add a quirk to allow Boston to be detected via device tree and set the
correct clock source for UART.

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: pch_phub: Read prefetch value from device tree if passed
Zubair Lutfullah Kakakhel [Fri, 12 Aug 2016 11:48:52 +0000 (12:48 +0100)]
misc: pch_phub: Read prefetch value from device tree if passed

The default prefetch value for the eg20t device is hard coded to
0x000affaa.

Add support for an alternative to be read from DT if available

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agofix:memory:of_memory:add missing header dependencies
Baoyou Xie [Sat, 27 Aug 2016 17:31:28 +0000 (01:31 +0800)]
fix:memory:of_memory:add missing header dependencies

We get 2 warnings when biuld kernel with W=1:
drivers/memory/of_memory.c:30:30: warning: no previous prototype for 'of_get_min_tck' [-Wmissing-prototypes]
drivers/memory/of_memory.c:106:30: warning: no previous prototype for 'of_get_ddr_timings' [-Wmissing-prototypes]

In fact, these functions are declared in drivers/memory/of_memory.h
so this patch add missing header dependencies.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: char: mem: Check {read,write}_kmem() addresses
Robin Murphy [Wed, 1 Jun 2016 18:21:42 +0000 (19:21 +0100)]
drivers: char: mem: Check {read,write}_kmem() addresses

Arriving at read_kmem() with an offset representing a bogus kernel
address (e.g. 0 from a simple "cat /dev/kmem") leads to copy_to_user
faulting on the kernel-side read.

x86_64 happens to get away with this since the optimised implementation
uses "rep movs*", thus the user write (which is allowed to fault) and
the kernel read are the same instruction, the kernel-side fault falls
into the user-side fixup handler and the chain of events which
transpires ends up returning an error as one might expect, even if it's
an inappropriate -EFAULT. On other architectures, though, the read is
not covered by the fixup entry for the write, and we get a big scary
"Unable to hande kernel paging request..." dump.

The more typical use-case of mmap_kmem() has always (within living
memory at least) returned -EIO for addresses which don't satisfy
pfn_valid(), so let's make that consistent across {read,write}_kem()
too.

Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agochar: xillybus: Fix spelling mistake and comment
Eli Billauer [Fri, 24 Jun 2016 07:48:30 +0000 (10:48 +0300)]
char: xillybus: Fix spelling mistake and comment

This patch fixes two minor issues:

(1) An inaccurate comment
(2) A spelling mistake in dev_err message ("upgarde" -> "upgrade")

Reported-by: Joe Perches <joe@perches.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosnsc: check return value of class_create
Zhouyi Zhou [Wed, 10 Aug 2016 08:06:43 +0000 (16:06 +0800)]
snsc: check return value of class_create

 return value of class_create should be considered in
module init function.

Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agochar/mwave: remove custom BOOLEAN type
Arnd Bergmann [Mon, 27 Jun 2016 10:04:18 +0000 (12:04 +0200)]
char/mwave: remove custom BOOLEAN type

The mwave driver has its own macros for the BOOLEAN type and the
TRUE/FALSE values. This is redundant because the kernel already
has bool/true/false, and it clashes with the ACPI headers that
also define these types. The linux/acpi.h header is now included
implicitly from mwave through the mc146818rtc.h header, as
reported by Stephen Rothwell:

In file included from drivers/char/mwave/smapi.c:51:0:
drivers/char/mwave/smapi.h:52:0: warning: "TRUE" redefined
 #define TRUE 1
 ^
In file included from include/acpi/acpi.h:58:0,
                 from include/linux/acpi.h:33,
                 from include/linux/mc146818rtc.h:21,
                 from drivers/char/mwave/smapi.c:50:
include/acpi/actypes.h:438:0: note: this is the location of the previous definition
 #define TRUE                            (1 == 1)
 ^

This removes the private types from mwave and uses the standard
types instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Fixes: fd09cc80165c ("rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoppdev: use new parport device model
Sudip Mukherjee [Wed, 1 Jun 2016 12:20:08 +0000 (17:50 +0530)]
ppdev: use new parport device model

Modify ppdev driver to use the new parallel port device model.

Initially submitted and committed as:
e7223f186033 ("ppdev: use new parport device model")

But due to some regression it was reverted by:
1701f680407c ("Revert "ppdev: use new parport device model"")

Now that the original source of regression is fixed by:
bbca503b2ee0 ("parport: use subsys_initcall") we can again modify ppdev
to use device model.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoGenWQE: Change default access rights for device node
Frank Haverkamp [Wed, 29 Jun 2016 13:47:43 +0000 (15:47 +0200)]
GenWQE: Change default access rights for device node

Since it should always be ok for normal users to operate the accelerator,
it makes sense to change it in our driver, rather than adding udev rules
for all Linux distributions.

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomiscdevice: Use module_misc_device() macro
PrasannaKumar Muralidharan [Thu, 25 Aug 2016 17:00:50 +0000 (22:30 +0530)]
miscdevice: Use module_misc_device() macro

This patch removes module_init()/module_exit() from driver code by using
module_misc_device() macro. All modules in this patch has a print
statement which is removed when module_misc_device() macro is used.
If undesirable this patch can be dropped entirely, this is the only
purpose of making this as a separate patch.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomiscdevice: Add helper macro for misc device boilerplate
PrasannaKumar Muralidharan [Thu, 25 Aug 2016 17:00:49 +0000 (22:30 +0530)]
miscdevice: Add helper macro for misc device boilerplate

Many modules call misc_register and misc_deregister in its module init
and exit methods without any additional code. This ends up being
boilerplate. This patch adds helper macro module_misc_device(), that
replaces module_init()/ module_exit() with template functions.

This patch also converts drivers to use new macro.

Change since v1:
Add device.h include in miscdevice.h as module_driver macro was not
available from other include files in some architectures.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: retire the old BMP085 driver
Linus Walleij [Wed, 24 Aug 2016 14:38:52 +0000 (16:38 +0200)]
misc: retire the old BMP085 driver

Patches merged to the IIO BMP085 driver makes it fully compliant
with all features found in this old misc driver. Retire this old
driver in favor of the new one in the proper subsystem.

Cc: Jonathan Cameron <jic23@cam.ac.uk>
Cc: Marek Belisko <marek@goldelico.com>
Acked-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agover_linux: rename ver_linux.awk to ver_linux
Alexander Kapshuk [Mon, 22 Aug 2016 18:19:19 +0000 (21:19 +0300)]
ver_linux: rename ver_linux.awk to ver_linux

ver_linux.awk renamed to ver_linux.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agover_linux: shell implementation removed
Alexander Kapshuk [Mon, 22 Aug 2016 18:19:18 +0000 (21:19 +0300)]
ver_linux: shell implementation removed

The shell implementation removed. To be replaced with an all-awk implementation via consecutive patch.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agover_linux: complete awk implementation
Alexander Kapshuk [Mon, 22 Aug 2016 18:19:17 +0000 (21:19 +0300)]
ver_linux: complete awk implementation

The algorithm that extracts the version number of the utility being
queried, and prints the name of the utility and its version number is
currently implemented in awk. The code is used throughout the script,
making its use repetative. The proposed implementation confines the
algorithm in question to a function, which makes the script easier to
read overall, as well as considerably reduces the number of lines of
code. Every attempt has been made to retain the look and the format
generated by the current implementation.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: fix timeout_us parameter description
Wei Yongjun [Mon, 8 Aug 2016 13:52:41 +0000 (13:52 +0000)]
w1: fix timeout_us parameter description

Fix 'timeout_us' parameter description.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: w1: style corrections-pointers-blanklines-comparisons
Ben Werbowyj [Fri, 22 Jul 2016 04:33:35 +0000 (14:33 +1000)]
drivers: w1: style corrections-pointers-blanklines-comparisons

Correct pointer notations to include whitespace between
variable type and "*" character. Inserted blank line
after variable declatations at two locations.
Rearranged comparison within an if statment to have the
constant on the right-hand side.

Signed-off-by: Ben Werbowyj <ben.werbowyj@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: w1: removed assignment from within if statement
Ben Werbowyj [Fri, 22 Jul 2016 04:33:34 +0000 (14:33 +1000)]
drivers: w1: removed assignment from within if statement

Assignment of variable count removed from within an if statment.
This was done at two locations in the file.

Signed-off-by: Ben Werbowyj <ben.werbowyj@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: w1: style corrections for parenthesis and braces
Ben Werbowyj [Fri, 22 Jul 2016 04:33:33 +0000 (14:33 +1000)]
drivers: w1: style corrections for parenthesis and braces

Inserted whitespace between command and open parenthesis
at two locations. Removed new line between open brace and
command/declaration at two locations.

Signed-off-by: Ben Werbowyj <ben.werbowyj@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMAINTAINERS: Saying goodbye to Hans J. Koch
Benedikt Spranger [Mon, 8 Aug 2016 15:54:48 +0000 (17:54 +0200)]
MAINTAINERS: Saying goodbye to Hans J. Koch

We had to say goodbye when Hans passed away recently. Hans was a
free-software enthusiast and an active contributor. He was the main author
and maintainer of the UIO subsystem and contributed in various ways to the
Linux kernel as a professional and hobbyist. He is greatly missed.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agovme: Adding Fake VME driver
Martyn Welch [Thu, 7 Jul 2016 18:51:52 +0000 (19:51 +0100)]
vme: Adding Fake VME driver

This patch introduces a fake VME bridge driver. This driver currently
emulates a subset of the VME bridge functionality. This allows some VME
subsystem development and even some VME device driver development to be
carried out in the absence of a proper VME bus.

Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agovme: make core vme support explicitly non-modular
Paul Gortmaker [Sun, 3 Jul 2016 18:05:56 +0000 (14:05 -0400)]
vme: make core vme support explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/vme/Kconfig:menuconfig VME_BUS
drivers/vme/Kconfig:    bool "VME bridge support"

...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 replace module.h and moduleparam.h (unused) with init.h and also
export.h ; the latter since this file does export some syms.

Since this is a struct bus_type and not a platform_driver, we don't
have any ".suppress_bind_attrs" to be concerned about when we
drop the ".remove" code from this file.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Cc: Manohar Vanga <manohar.vanga@gmail.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agovme: Fix module autoload
Alessio Igor Bogani [Tue, 14 Jun 2016 14:36:55 +0000 (16:36 +0200)]
vme: Fix module autoload

These drivers have a PCI device ID table but the PCI module
alias information is not created so module autoloading won't work.

Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agovme: Update documentation to match api
Martyn Welch [Sun, 5 Jun 2016 20:35:45 +0000 (21:35 +0100)]
vme: Update documentation to match api

The vme_register_driver() api changed in commit 5d6abf379d73 ("staging:
vme: make match() driver specific to improve non-VME64x support") but the
documentation wasn't updated. Update the documentation to match the API.

Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agovme: change LM callback argument to void pointer
Aaron Sierra [Fri, 29 Apr 2016 21:41:02 +0000 (16:41 -0500)]
vme: change LM callback argument to void pointer

Make the location monitor callback function prototype more useful by
changing the argument from an integer to a void pointer.

All VME bridge drivers were simply passing the location monitor index
(e.g. 0-3) as the argument to these callbacks. It is much more useful
to pass back a pointer to data that the callback-registering driver
cares about.

There appear to be no in-kernel callers of vme_lm_attach (or
vme_lme_request for that matter), so this change only affects the VME
subsystem and bridge drivers.

This has been tested with Tsi148 hardware, but the CA91Cx42 changes
have only been compiled.

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>
7 years agoVMCI: use memdup_user().
Muhammad Falak R Wani [Fri, 20 May 2016 12:18:56 +0000 (17:48 +0530)]
VMCI: use memdup_user().

Use memdup_user to duplicate a memory region from user-space to
kernel-space, instead of open coding using kmalloc & copy_from_user.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomcb: remove sub-device handling code
Johannes Thumshirn [Fri, 26 Aug 2016 07:35:00 +0000 (09:35 +0200)]
mcb: remove sub-device handling code

The MEN Chameleon specification states that a chameleon FPGA can include a
bridge descriptor, which then opens up a new bus behind this bridge. MCB
included subdevice handling code in the core, but no support for bus
descriptors in the parser, due to a lack of hardware access.

As this is technically dead code, but it gets executed on a device add,
I've decided to remove it.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomcb: Introduce type safety for to_mcb_*
Johannes Thumshirn [Fri, 26 Aug 2016 07:34:59 +0000 (09:34 +0200)]
mcb: Introduce type safety for to_mcb_*

The to_mcb_{bus,device,driver}() macros lacked type safety, so convert them to
inline functions to enforce compile time type checking.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomcb: Added bar descriptor support for non PCI bus MCB carrier
Andreas Werner [Fri, 26 Aug 2016 07:34:58 +0000 (09:34 +0200)]
mcb: Added bar descriptor support for non PCI bus MCB carrier

Added support for the bar descriptor. This type is used for FPGAs
connect to the LPC or to a non PCI bus.

The Bar descriptor could have a maximum of 6 BARs. Each of the
devices within the FPGA could be mapped to a different BAR.
The BAR descriptor is comparable to the PCI header.

Signed-off-by: Andreas Werner <andreas.werner@men.de>
[ free bar descriptor in the non-error case ]
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomcb: Added support for LPC or non PCI based MCB carrier
Andreas Werner [Fri, 26 Aug 2016 07:34:57 +0000 (09:34 +0200)]
mcb: Added support for LPC or non PCI based MCB carrier

Add support for MCB bases FPGAs connected to the LPC or
non PCI Bus.

This driver currently supports the SC24 board. The FPGA
is connected to the LPC bus and is identified using the BIOS
DMI string.

Signed-off-by: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agouio: fix dmem_region_start computation
Jan Viktorin [Tue, 17 May 2016 09:22:17 +0000 (11:22 +0200)]
uio: fix dmem_region_start computation

The variable i contains a total number of resources (including
IORESOURCE_IRQ). However, we want the dmem_region_start to point
after the last resource of type IORESOURCE_MEM. The original behaviour
leads (very likely) to skipping several UIO mapping regions and makes
them useless. Fix this by computing dmem_region_start from the uiomem
which points to the last used UIO mapping.

Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation")

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: adding configurable start/stop filtering
Mathieu Poirier [Thu, 25 Aug 2016 21:19:18 +0000 (15:19 -0600)]
coresight: etm4x: adding configurable start/stop filtering

With this patch we add start/stop filtering as specified on
the perf cmd line.  When the IP matches the start address
trace generation gets triggered.  The stop condition is
achieved when the IP matches the stop address.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: adding configurable address range filtering
Mathieu Poirier [Thu, 25 Aug 2016 21:19:17 +0000 (15:19 -0600)]
coresight: etm4x: adding configurable address range filtering

This patch adds the capability to specify address ranges from
the perf cmd line using the --filter option.  If the IP
falls within the range(s) program flow traces are generated.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: configuring include/exclude function
Mathieu Poirier [Thu, 25 Aug 2016 21:19:16 +0000 (15:19 -0600)]
coresight: etm4x: configuring include/exclude function

The include/exclude function of a tracer is applicable to address
range and start/stop filters.  To avoid duplication and reuse code
moving the include/exclude configuration to a function of its own.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: adding range filter configuration function
Mathieu Poirier [Thu, 25 Aug 2016 21:19:15 +0000 (15:19 -0600)]
coresight: etm4x: adding range filter configuration function

Introducing a new function to do address range configuration
generic enough to work for any address range and any comparator.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: cleaning up default filter configuration
Mathieu Poirier [Thu, 25 Aug 2016 21:19:14 +0000 (15:19 -0600)]
coresight: etm4x: cleaning up default filter configuration

The default filter configuration was hard to read and included
some redundancy.  This patch attempts to stream line configuration
and improve readability.

No change of functionality is included.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: split default and filter configuration
Mathieu Poirier [Thu, 25 Aug 2016 21:19:13 +0000 (15:19 -0600)]
coresight: etm4x: split default and filter configuration

Splitting the steps involved in the configuration of a tracer.
The first part is generic and can be reused for both sysFS and
Perf methods.

The second part pertains to the configuration of filters
themselves where the source of the information used to
configure the filters will vary depending on the access
methods.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm-perf: configuring filters from perf core
Mathieu Poirier [Thu, 25 Aug 2016 21:19:12 +0000 (15:19 -0600)]
coresight: etm-perf: configuring filters from perf core

This patch implements the required API needed to access
and retrieve range and start/stop filters from the perf core.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: remove duplicated enumeration
Mathieu Poirier [Thu, 25 Aug 2016 21:19:11 +0000 (15:19 -0600)]
coresight: remove duplicated enumeration

Both ETMv3 and ETMv4 drivers are declaring an 'enum etm_addr_type',
creating reduncancy.

This patch removes the enumeration from the driver files and adds
it to a common header.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm-perf: pass struct perf_event to source::enable/disable()
Mathieu Poirier [Thu, 25 Aug 2016 21:19:10 +0000 (15:19 -0600)]
coresight: etm-perf: pass struct perf_event to source::enable/disable()

With this commit [1] address range filter information is now found
in the struct hw_perf_event::addr_filters.  As such pass the event
itself to the coresight_source::enable/disable() functions so that
both event attribute and filter can be accessible for configuration.

[1] 'commit 375637bc5249 ("perf/core: Introduce address range filtering")'

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: fix handling of ETM trace register access via sysfs
Sudeep Holla [Thu, 25 Aug 2016 21:19:09 +0000 (15:19 -0600)]
coresight: fix handling of ETM trace register access via sysfs

The ETM registers are classified into 2 categories: trace and management.
The core power domain contains most of the trace unit logic including
all(except TRCOSLAR and TRCOSLSR) the trace registers. The debug power
domain contains the external debugger interface including all management
registers.

This patch adds coresight unit specific function coresight_simple_func
which can be used for ETM trace registers by providing a ETM specific
read function which does smp cross call to ensure the trace core is
powered up before the register is accessed.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: request to retain power to the trace unit when active
Sudeep Holla [Thu, 25 Aug 2016 21:19:08 +0000 (15:19 -0600)]
coresight: etm4x: request to retain power to the trace unit when active

The Coresight ETMv4 architecture provides a way to request to keep the
power to the trace unit. This might help to collect the traces without
the need to disable the CPU power management(entering/exiting deeper
idle states).

Trace PowerDown Control Register provides powerup request bit which when
set requests the system to retain power to the trace unit and emulate
the powerdown request.

Typically, a trace unit drives a signal to the power controller to
request that the trace unit core power domain is powered up. However,
if the trace unit and the CPU are in the same power domain then the
implementation might combine the trace unit power up status with a
signal from the CPU.

This patch requests to retain power to the trace unit when active and
to remove when inactive. Note this change will only request but the
behaviour depends on the implementation. However, it matches the
exact behaviour expected when the external debugger is connected with
respect to CPU power states.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: tmc: Delete an unnecessary check before the function call "kfree"
Markus Elfring [Thu, 25 Aug 2016 21:19:07 +0000 (15:19 -0600)]
coresight: tmc: Delete an unnecessary check before the function call "kfree"

The kfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: remove duplicated include from coresight-etm4x.c
Wei Yongjun [Thu, 25 Aug 2016 21:19:06 +0000 (15:19 -0600)]
coresight: etm4x: remove duplicated include from coresight-etm4x.c

Remove duplicated include.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Use local coresight_desc instances
Suzuki K Poulose [Thu, 25 Aug 2016 21:19:05 +0000 (15:19 -0600)]
coresight: Use local coresight_desc instances

Each coresight device prepares a description for coresight_register()
in struct coresight_desc. Once we register the device, the description is
useless and can be freed. The coresight_desc is small enough (48bytes on
64bit)i to be allocated on the stack. Hence use an automatic variable to
avoid a needless dynamic allocation and wasting the memory(which will only
be free'd when the device is destroyed).

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Pratik Patel <pratikp@codeaurora.org>
Signed-off-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>
7 years agohwtracing: coresight: of_coresight: add missing of_node_put after calling of_parse_ph...
Peter Chen [Thu, 25 Aug 2016 21:19:04 +0000 (15:19 -0600)]
hwtracing: coresight: of_coresight: add missing of_node_put after calling of_parse_phandle

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Cc: linux-arm-kernel@lists.infradead.org
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight-etm3x: Add ARM ETM 3.5 Cortex-A5 peripheral ID
Olivier Schonken [Thu, 25 Aug 2016 21:19:03 +0000 (15:19 -0600)]
coresight-etm3x: Add ARM ETM 3.5 Cortex-A5 peripheral ID

Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: add PM runtime calls to coresight_simple_func()
Mathieu Poirier [Thu, 25 Aug 2016 21:19:02 +0000 (15:19 -0600)]
coresight: add PM runtime calls to coresight_simple_func()

It is mandatory to enable a coresight block's power domain before
trying to access management registers.  Otherwise the transaction
simply stalls, leading to a system hang.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: delay initialisation when children are missing
Mathieu Poirier [Thu, 25 Aug 2016 21:19:01 +0000 (15:19 -0600)]
coresight: delay initialisation when children are missing

Depending on when CoreSight device are discovered it is possible
that some IP block may be referencing devices that have not been
added to the bus yet.  The end result is missing nodes in the
CoreSight topology even when the devices are present and properly
initialised.

This patch solves the problem by asking the driver core to
try initialising the device at a later time when the children
of a CoreSight node are missing.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Add better messages for coresight_timeout
Suzuki K Poulose [Thu, 25 Aug 2016 21:19:00 +0000 (15:19 -0600)]
coresight: Add better messages for coresight_timeout

When we encounter a timeout waiting for a status change via
coresight_timeout, the caller always print the offset which
was tried. This is pretty much useless as it doesn't specify
the bit position we wait for. Also, one needs to lookup the
TRM to figure out, what was wrong. This patch changes all
such error messages to print something more meaningful.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-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>
7 years agocoresight: Cleanup TMC status check
Suzuki K Poulose [Thu, 25 Aug 2016 21:18:59 +0000 (15:18 -0600)]
coresight: Cleanup TMC status check

Use the defined symbol rather than hardcoding the value to
check whether the TMC buffer is full.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-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>
7 years agocoresight: etmv4: Fix ETMv4x peripheral ID table
Suzuki K Poulose [Thu, 25 Aug 2016 21:18:58 +0000 (15:18 -0600)]
coresight: etmv4: Fix ETMv4x peripheral ID table

This patch cleans up the peripheral id table for different ETMv4
implementations.

As per Cortex-A53 TRM, the ETM has following id values:

Peripheral ID0 0x5D 0xFE0
Peripheral ID1 0xB9 0xFE4
Peripheral ID2 0x4B 0xFE8
Peripheral ID3 0x00 0xFEC

where, PID2: has the following format:

[7:4]   Revision
[3]     JEDEC   0b1     res1. Indicates a JEP106 identity code is used
[2:0]   DES_1   0b011   ARM Limited. This is bits[6:4] of JEP106 ID code

The existing table entry checks only the bits [1:0], which is not
sufficient enough. Fix it to match bits [3:0], just like the other
entries do. While at it, correct the comment for A57 and the A53 entry.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-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>
7 years agocoresight: tmc: Limit the trace to available data
Suzuki K Poulose [Thu, 25 Aug 2016 21:18:57 +0000 (15:18 -0600)]
coresight: tmc: Limit the trace to available data

At present the ETF or ETR gives out the entire device
buffer, even if there is less or even no trace data
available. This patch limits the trace data given out to
the actual trace data collected.

Cc: mathieu.poirier@linaro.org
Signed-off-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>
7 years agocoresight: Fix csdev connections initialisation
Suzuki K Poulose [Thu, 25 Aug 2016 21:18:56 +0000 (15:18 -0600)]
coresight: Fix csdev connections initialisation

This is a cleanup patch.

coresight_device->conns holds an array to point to the devices
connected to the OUT ports of a component. Sinks, e.g ETR, do not
have an OUT port (nr_outport = 0), as it streams the trace to
memory via AXI.

At coresight_register() we do :

conns = kcalloc(csdev->nr_outport, sizeof(*conns), GFP_KERNEL);
if (!conns) {
ret = -ENOMEM;
goto err_kzalloc_conns;
}

For ETR, since the total size requested for kcalloc is zero, the return
value is, ZERO_SIZE_PTR ( != NULL). Hence, csdev->conns = ZERO_SIZE_PTR
which cannot be verified later to contain a valid pointer. The code which
accesses the csdev->conns is bounded by the csdev->nr_outport check,
hence we don't try to dereference the ZERO_SIZE_PTR. This patch cleans
up the csdev->conns initialisation to make sure we initialise it
properly(i.e, either NULL or valid conns array).

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-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>
7 years agocoresight: Consolidate error handling path for tmc_probe
Suzuki K Poulose [Thu, 25 Aug 2016 21:18:55 +0000 (15:18 -0600)]
coresight: Consolidate error handling path for tmc_probe

This patch cleans up the error handling path for tmc_probe
as a side effect of the removal of the spurious dma_free_coherent().

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-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>
7 years agocoresight: Remove erroneous dma_free_coherent in tmc_probe
Suzuki K Poulose [Thu, 25 Aug 2016 21:18:54 +0000 (15:18 -0600)]
coresight: Remove erroneous dma_free_coherent in tmc_probe

commit de5461970b3e9e194 ("coresight: tmc: allocating memory when needed")
removed the static allocation of buffer for the trace data in ETR mode in
tmc_probe. However it failed to remove the "devm_free_coherent" in
tmc_probe when the probe fails due to other reasons. This patch gets
rid of the incorrect dma_free_coherent() call.

Fixes: commit de5461970b3e9e194 ("coresight: tmc: allocating memory when needed")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-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>
7 years agocoresight: always use stashed trace id value in etm4_trace_id
Sudeep Holla [Thu, 25 Aug 2016 21:18:53 +0000 (15:18 -0600)]
coresight: always use stashed trace id value in etm4_trace_id

etm4_trace_id is not guaranteed to be executed on the CPU whose ETM is
being accessed. This leads to exception similar to below one if the
CPU whose ETM is being accessed is in deeper idle states. So it must
be executed on the CPU whose ETM is being accessed.

Unhandled fault: synchronous external abort (0x96000210) at 0xffff000008db4040
Internal error: : 96000210 [#1] PREEMPT SMP
Modules linked in:
CPU: 5 PID: 5979 Comm: etm.sh Not tainted 4.7.0-rc3 #159
Hardware name: ARM Juno development board (r2) (DT)
task: ffff80096dd34b00 ti: ffff80096dfe4000 task.ti: ffff80096dfe4000
PC is at etm4_trace_id+0x5c/0x90
LR is at etm4_trace_id+0x3c/0x90
Call trace:
 etm4_trace_id+0x5c/0x90
 coresight_id_match+0x78/0xa8
 bus_for_each_dev+0x60/0xa0
 coresight_enable+0xc0/0x1b8
 enable_source_store+0x3c/0x70
 dev_attr_store+0x18/0x28
 sysfs_kf_write+0x48/0x58
 kernfs_fop_write+0x14c/0x1e0
 __vfs_write+0x1c/0x100
 vfs_write+0xa0/0x1b8
 SyS_write+0x44/0xa0
 el0_svc_naked+0x24/0x28

However, TRCTRACEIDR is not guaranteed to hold the previous programmed
trace id if it enters deeper idle states. Further, the trace id that is
computed in etm4_init_trace_id is programmed into TRCTRACEIDR only in
etm4_enable_hw which happens much later in the sequence after
coresight_id_match is executed from enable_source_store.

This patch simplifies etm4_trace_id by returning the stashed trace id
value similar to etm4_cpu_id.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight-stm: support mmapping channel regions with mmio_addr
Chunyan Zhang [Thu, 25 Aug 2016 21:18:52 +0000 (15:18 -0600)]
coresight-stm: support mmapping channel regions with mmio_addr

CoreSight STM device allows direct mapping of the channel regions to
userspace for zero-copy writing. To support this ability, the STM
framework has provided a hook 'mmio_addr', this patch just implemented
this hook for CoreSight STM.

This patch also added an item into 'channel_space' to save the physical
base address of channel region which mmap operation needs to know.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: access conn->child_name only if it's initialised
Sudeep Holla [Thu, 25 Aug 2016 21:18:51 +0000 (15:18 -0600)]
coresight: access conn->child_name only if it's initialised

If the addition of the coresight devices get deferred, then there's a
window before child_name is populated by of_get_coresight_platform_data
from the respective component driver's probe and the attempted to access
the same from coresight_orphan_match resulting in kernel NULL pointer
dereference as below:

Unable to handle kernel NULL pointer dereference at virtual address 0x0
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 1038 Comm: kworker/0:1 Not tainted 4.7.0-rc3 #124
Hardware name: ARM Juno development board (r2) (DT)
Workqueue: events amba_deferred_retry_func
PC is at strcmp+0x1c/0x160
LR is at coresight_orphan_match+0x7c/0xd0
Call trace:
 strcmp+0x1c/0x160
 bus_for_each_dev+0x60/0xa0
 coresight_register+0x264/0x2e0
 tmc_probe+0x130/0x310
 amba_probe+0xd4/0x1c8
 driver_probe_device+0x22c/0x418
 __device_attach_driver+0xbc/0x158
 bus_for_each_drv+0x58/0x98
 __device_attach+0xc4/0x160
 device_initial_probe+0x10/0x18
 bus_probe_device+0x94/0xa0
 device_add+0x344/0x580
 amba_device_try_add+0x194/0x238
 amba_deferred_retry_func+0x48/0xd0
 process_one_work+0x118/0x378
 worker_thread+0x48/0x498
 kthread+0xd0/0xe8
 ret_from_fork+0x10/0x40

This patch adds a check for non-NULL conn->child_name before accessing
the same.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: balloon: Use available memory value in pressure report
Alex Ng [Wed, 24 Aug 2016 23:23:13 +0000 (16:23 -0700)]
Drivers: hv: balloon: Use available memory value in pressure report

Reports for available memory should use the si_mem_available() value.
The previous freeram value does not include available page cache memory.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: balloon: replace ha_region_mutex with spinlock
Vitaly Kuznetsov [Wed, 24 Aug 2016 23:23:12 +0000 (16:23 -0700)]
Drivers: hv: balloon: replace ha_region_mutex with spinlock

lockdep reports possible circular locking dependency when udev is used
for memory onlining:

 systemd-udevd/3996 is trying to acquire lock:
  ((memory_chain).rwsem){++++.+}, at: [<ffffffff810d137e>] __blocking_notifier_call_chain+0x4e/0xc0

 but task is already holding lock:
  (&dm_device.ha_region_mutex){+.+.+.}, at: [<ffffffffa015382e>] hv_memory_notifier+0x5e/0xc0 [hv_balloon]
 ...

which is probably a false positive because we take and release
ha_region_mutex from memory notifier chain depending on the arg. No real
deadlocks were reported so far (though I'm not really sure about
preemptible kernels...) but we don't really need to hold the mutex
for so long. We use it to protect ha_region_list (and its members) and the
num_pages_onlined counter. None of these operations require us to sleep
and nothing is slow, switch to using spinlock with interrupts disabled.

While on it, replace list_for_each -> list_for_each_entry as we actually
need entries in all these cases, drop meaningless list_empty() checks.

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>
7 years agoDrivers: hv: balloon: don't wait for ol_waitevent when memhp_auto_online is enabled
Vitaly Kuznetsov [Wed, 24 Aug 2016 23:23:11 +0000 (16:23 -0700)]
Drivers: hv: balloon: don't wait for ol_waitevent when memhp_auto_online is enabled

With the recently introduced in-kernel memory onlining
(MEMORY_HOTPLUG_DEFAULT_ONLINE) these is no point in waiting for pages
to come online in the driver and we can get rid of the waiting.

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>
7 years agoDrivers: hv: balloon: account for gaps in hot add regions
Vitaly Kuznetsov [Wed, 24 Aug 2016 23:23:10 +0000 (16:23 -0700)]
Drivers: hv: balloon: account for gaps in hot add regions

I'm observing the following hot add requests from the WS2012 host:

hot_add_req: start_pfn = 0x108200 count = 330752
hot_add_req: start_pfn = 0x158e00 count = 193536
hot_add_req: start_pfn = 0x188400 count = 239616

As the host doesn't specify hot add regions we're trying to create
128Mb-aligned region covering the first request, we create the 0x108000 -
0x160000 region and we add 0x108000 - 0x158e00 memory. The second request
passes the pfn_covered() check, we enlarge the region to 0x108000 -
0x190000 and add 0x158e00 - 0x188200 memory. The problem emerges with the
third request as it starts at 0x188400 so there is a 0x200 gap which is
not covered. As the end of our region is 0x190000 now it again passes the
pfn_covered() check were we just adjust the covered_end_pfn and make it
0x188400 instead of 0x188200 which means that we'll try to online
0x188200-0x188400 pages but these pages were never assigned to us and we
crash.

We can't react to such requests by creating new hot add regions as it may
happen that the whole suggested range falls into the previously identified
128Mb-aligned area so we'll end up adding nothing or create intersecting
regions and our current logic doesn't allow that. Instead, create a list of
such 'gaps' and check for them in the page online callback.

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>
7 years agoDrivers: hv: balloon: keep track of where ha_region starts
Vitaly Kuznetsov [Wed, 24 Aug 2016 23:23:09 +0000 (16:23 -0700)]
Drivers: hv: balloon: keep track of where ha_region starts

Windows 2012 (non-R2) does not specify hot add region in hot add requests
and the logic in hot_add_req() is trying to find a 128Mb-aligned region
covering the request. It may also happen that host's requests are not 128Mb
aligned and the created ha_region will start before the first specified
PFN. We can't online these non-present pages but we don't remember the real
start of the region.

This is a regression introduced by the commit 5abbbb75d733 ("Drivers: hv:
hv_balloon: don't lose memory when onlining order is not natural"). While
the idea of keeping the 'moving window' was wrong (as there is no guarantee
that hot add requests come ordered) we should still keep track of
covered_start_pfn. This is not a revert, the logic is different.

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>
7 years agoTools: hv: kvp: ensure kvp device fd is closed on exec
Vitaly Kuznetsov [Thu, 7 Jul 2016 01:24:10 +0000 (18:24 -0700)]
Tools: hv: kvp: ensure kvp device fd is closed on exec

KVP daemon does fork()/exec() (with popen()) so we need to close our fds
to avoid sharing them with child processes. The immediate implication of
not doing so I see is SELinux complaining about 'ip' trying to access
'/dev/vmbus/hv_kvp'.

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>
7 years agoDrivers: hv: vmbus: Implement a mechanism to tag the channel for low latency
K. Y. Srinivasan [Fri, 1 Jul 2016 23:26:37 +0000 (16:26 -0700)]
Drivers: hv: vmbus: Implement a mechanism to tag the channel for low latency

On Hyper-V, performance critical channels use the monitor
mechanism to signal the host when the guest posts mesages
for the host. This mechanism minimizes the hypervisor intercepts
and also makes the host more efficient in that each time the
host is woken up, it processes a batch of messages as opposed to
just one. The goal here is improve the throughput and this is at
the expense of increased latency.
Implement a mechanism to let the client driver decide if latency
is important.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: vmbus: Reduce the delay between retries in vmbus_post_msg()
K. Y. Srinivasan [Fri, 1 Jul 2016 23:26:36 +0000 (16:26 -0700)]
Drivers: hv: vmbus: Reduce the delay between retries in vmbus_post_msg()

The current delay between retries is unnecessarily high and is negatively
affecting the time it takes to boot the system.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: vmbus: Enable explicit signaling policy for NIC channels
K. Y. Srinivasan [Fri, 1 Jul 2016 23:26:35 +0000 (16:26 -0700)]
Drivers: hv: vmbus: Enable explicit signaling policy for NIC channels

For synthetic NIC channels, enable explicit signaling policy as netvsc wants to
explicitly control when the host is to be signaled.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDrivers: hv: vmbus: fix the race when querying & updating the percpu list
Dexuan Cui [Fri, 10 Jun 2016 01:47:24 +0000 (18:47 -0700)]
Drivers: hv: vmbus: fix the race when querying & updating the percpu list

There is a rare race when we remove an entry from the global list
hv_context.percpu_list[cpu] in hv_process_channel_removal() ->
percpu_channel_deq() -> list_del(): at this time, if vmbus_on_event() ->
process_chn_event() -> pcpu_relid2channel() is trying to query the list,
we can get the kernel fault.

Similarly, we also have the issue in the code path: vmbus_process_offer() ->
percpu_channel_enq().

We can resolve the issue by disabling the tasklet when updating the list.

The patch also moves vmbus_release_relid() to a later place where
the channel has been removed from the per-cpu and the global lists.

Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
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>
7 years agoDrivers: hv: utils: fix a race on userspace daemons registration
Vitaly Kuznetsov [Fri, 10 Jun 2016 00:08:57 +0000 (17:08 -0700)]
Drivers: hv: utils: fix a race on userspace daemons registration

Background: userspace daemons registration protocol for Hyper-V utilities
drivers has two steps:
1) daemon writes its own version to kernel
2) kernel reads it and replies with module version
at this point we consider the handshake procedure being completed and we
do hv_poll_channel() transitioning the utility device to HVUTIL_READY
state. At this point we're ready to handle messages from kernel.

When hvutil_transport is in HVUTIL_TRANSPORT_CHARDEV mode we have a
single buffer for outgoing message. hvutil_transport_send() puts to this
buffer and till the buffer is cleared with hvt_op_read() returns -EFAULT
to all consequent calls. Host<->guest protocol guarantees there is no more
than one request at a time and we will not get new requests till we reply
to the previous one so this single message buffer is enough.

Now to the race. When we finish negotiation procedure and send kernel
module version to userspace with hvutil_transport_send() it goes into the
above mentioned buffer and if the daemon is slow enough to read it from
there we can get a collision when a request from the host comes, we won't
be able to put anything to the buffer so the request will be lost. To
solve the issue we need to know when the negotiation is really done (when
the version message is read by the daemon) and transition to HVUTIL_READY
state after this happens. Implement a callback on read to support this.
Old style netlink communication is not affected by the change, we don't
really know when these messages are delivered but we don't have a single
message buffer there.

Reported-by: Barry Davis <barry_davis@stormagic.com>
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>
7 years agoDrivers: hv: get rid of timeout in vmbus_open()
Vitaly Kuznetsov [Fri, 10 Jun 2016 00:08:56 +0000 (17:08 -0700)]
Drivers: hv: get rid of timeout in vmbus_open()

vmbus_teardown_gpadl() can result in infinite wait when it is called on 5
second timeout in vmbus_open(). The issue is caused by the fact that gpadl
teardown operation won't ever succeed for an opened channel and the timeout
isn't always enough. As a guest, we can always trust the host to respond to
our request (and there is nothing we can do if it doesn'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>
7 years agoDrivers: hv: don't leak memory in vmbus_establish_gpadl()
Vitaly Kuznetsov [Sat, 4 Jun 2016 00:09:24 +0000 (17:09 -0700)]
Drivers: hv: don't leak memory in vmbus_establish_gpadl()

In some cases create_gpadl_header() allocates submessages but we never
free them.

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>
7 years agoDrivers: hv: get rid of redundant messagecount in create_gpadl_header()
Vitaly Kuznetsov [Sat, 4 Jun 2016 00:09:23 +0000 (17:09 -0700)]
Drivers: hv: get rid of redundant messagecount in create_gpadl_header()

We use messagecount only once in vmbus_establish_gpadl() to check if
it is safe to iterate through the submsglist. We can just initialize
the list header in all cases in create_gpadl_header() instead.

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>
7 years agoDrivers: hv: avoid vfree() on crash
Vitaly Kuznetsov [Sat, 4 Jun 2016 00:09:22 +0000 (17:09 -0700)]
Drivers: hv: avoid vfree() on crash

When we crash from NMI context (e.g. after NMI injection from host when
'sysctl -w kernel.unknown_nmi_panic=1' is set) we hit

    kernel BUG at mm/vmalloc.c:1530!

as vfree() is denied. While the issue could be solved with in_nmi() check
instead I opted for skipping vfree on all sorts of crashes to reduce the
amount of work which can cause consequent crashes. We don't really need to
free anything 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>
7 years agotile-srom: avoid krealloc(... __GFP_ZERO) pattern
Chris Metcalf [Thu, 28 Jul 2016 19:07:04 +0000 (15:07 -0400)]
tile-srom: avoid krealloc(... __GFP_ZERO) pattern

Joe Perches points out [1] that this pattern isn't currently safe.
This driver doesn't really need the zeroing semantic anyway;
by restructuring the code slightly we can initialize all the
fields of the structure up front instead.

[1] https://lkml.kernel.org/r/1469729491.3998.58.camel@perches.com

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: mic: scif: use vma_pages().
Muhammad Falak R Wani [Sat, 21 May 2016 13:11:38 +0000 (18:41 +0530)]
misc: mic: scif: use vma_pages().

Replace explicit computation of vma page count by a call to
vma_pages()

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDocumentation: mic: fix kernel version
Alexandre Belloni [Sun, 22 May 2016 13:39:19 +0000 (15:39 +0200)]
Documentation: mic: fix kernel version

v3.20 doesn't exist. heartbeat_enable was actually added in v4.4.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomic: remove unused function arg
Arnd Bergmann [Thu, 16 Jun 2016 11:38:24 +0000 (13:38 +0200)]
mic: remove unused function arg

When building with W=1, the __scif_rma_destroy_tcw function
causes a harmless warning about an argument variable that is
modified but not used:

drivers/misc/mic/scif/scif_dma.c: In function ‘__scif_rma_destroy_tcw’:
drivers/misc/mic/scif/scif_dma.c:118:27: error: parameter ‘ep’ set but not used [-Werror=unused-but-set-parameter]

In this case, we can just remove the argument, since all callers
are in the same file.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomei: amthif: fix deadlock in initialization during a reset
Alexander Usyskin [Mon, 25 Jul 2016 22:06:09 +0000 (01:06 +0300)]
mei: amthif: fix deadlock in initialization during a reset

The device lock was unnecessary obtained in bus rescan work before the
amthif client search.  That causes incorrect lock ordering and task
hang:
...
[88004.613213] INFO: task kworker/1:14:21832 blocked for more than 120 seconds.
...
[88004.645934] Workqueue: events mei_cl_bus_rescan_work
...

The correct lock order is
 cl_bus_lock
  device_lock
   me_clients_rwsem

Move device_lock into amthif init function that called
after me_clients_rwsem is released.

This fixes regression introduced by commit:
commit 025fb792bac3 ("mei: split amthif client init from end of clients enumeration")

Cc: <stable@vger.kernel.org> # 4.6+
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>
7 years agomei: drop unused file transaction states
Alexander Usyskin [Mon, 25 Jul 2016 22:06:08 +0000 (01:06 +0300)]
mei: drop unused file transaction states

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>
7 years agomei: amthif: drop mei_amthif_read
Alexander Usyskin [Mon, 25 Jul 2016 22:06:07 +0000 (01:06 +0300)]
mei: amthif: drop mei_amthif_read

mei_amthif_read have only one difference from mei_read, it is not
calling mei_read_start().
Make mei_read_start return immediately for amthif client and drop the
special mei_amthif_read function.

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>
7 years agomei: enqueue consecutive reads
Alexander Usyskin [Mon, 25 Jul 2016 22:06:06 +0000 (01:06 +0300)]
mei: enqueue consecutive reads

The FW supports only one pending read per host client, in order to
support  issuing of consecutive reads the driver  queues read requests
internally and send them to the firmware after pending 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>
7 years agomei: add wrapper for queuing control commands.
Tomas Winkler [Mon, 25 Jul 2016 22:06:05 +0000 (01:06 +0300)]
mei: add wrapper for queuing control commands.

Enclose the boiler plate code of allocating a control/hbm command cb
and enqueueing it onto ctrl_wr.list in a convenient wrapper
mei_cl_enqueue_ctrl_wr_cb().

This is a preparatory patch for enabling consecutive reads.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomei: use consistent naming for TX control flow credits
Tomas Winkler [Mon, 25 Jul 2016 22:06:04 +0000 (01:06 +0300)]
mei: use consistent naming for TX control flow credits

With the introduction of the receive control flow credits prefixed with
rx_ we add tx_ prefix to the variables and function used for tracking
the transmit control flow credits.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomei: rx flow control counter
Alexander Usyskin [Mon, 25 Jul 2016 22:06:03 +0000 (01:06 +0300)]
mei: rx flow control counter

Use RX flow control counter in the host client structure to
track the number of simultaneous outstanding reads.
This eliminates search in queues and makes ground for
enabling for parallel read.

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>
7 years agomei: prepare read cb for fixed address clients on the receive path only.
Alexander Usyskin [Mon, 25 Jul 2016 22:06:02 +0000 (01:06 +0300)]
mei: prepare read cb for fixed address clients on the receive path only.

The read callbacks for the fixed address clients, that don't have flow
control are built now on the receive path. In order to have a single
allocation place we remove the allocation from the read request.

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>
7 years agomei: drop redundant krealloc and checks in irq read
Alexander Usyskin [Mon, 25 Jul 2016 22:06:01 +0000 (01:06 +0300)]
mei: drop redundant krealloc and checks in irq read

The read callback is always prepared with MTU-sized buffer and the FW
can't send more than the MTU in one message.
Checking for buffer existence and krealloc to increase receive buffer
size are redundant and may be safely discarded.

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>
7 years agomei: amthif: drop mei_clear_lists function
Alexander Usyskin [Thu, 16 Jun 2016 14:58:59 +0000 (17:58 +0300)]
mei: amthif: drop mei_clear_lists function

Open code mei_clear_lists into its only caller mei_amthif_releas
and drop unused parameter 'dev' form from mei_clear_list function.

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>
7 years agomei: add read callback on demand for fixed_address clients
Alexander Usyskin [Thu, 16 Jun 2016 14:58:58 +0000 (17:58 +0300)]
mei: add read callback on demand for fixed_address clients

The Fixed address clients do not work with the flow control, and the
packet RX callback was allocated upon TX with anticipation of a
following RX. This won't work if the clients with unsolicited Rx. Rather
than preparing read callback upon a write we allocate one directly on
the reciev path if one doesn't exists.

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>
7 years agomei: add file pointer to the host client structure
Alexander Usyskin [Thu, 16 Jun 2016 14:58:57 +0000 (17:58 +0300)]
mei: add file pointer to the host client structure

Store the file associated with a client in the host client structure,
this enables dropping the special amthif client file pointer from struct
mei_device, and this is also a preparation for changing the way rx
packet allocation for fixed_address clients

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>
7 years agomei: move read cb to complete queue if not connected
Alexander Usyskin [Thu, 16 Jun 2016 14:58:56 +0000 (17:58 +0300)]
mei: move read cb to complete queue if not connected

Move read cb to the completion queue if a read finds out that client
is not connected. This expedite user space reader wake on error
condition.

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>