Cory Tusar [Wed, 10 Feb 2016 19:32:07 +0000 (14:32 -0500)]
misc: eeprom_93xx46: Add quirks to support Atmel AT93C46D device.
Atmel devices in this family have some quirks not found in other similar
chips - they do not support a sequential read of the entire EEPROM
contents, and the control word sent at the start of each operation
varies in bit length.
This commit adds quirk support to the driver and modifies the read
implementation to support non-sequential reads for consistency with
other misc/eeprom drivers.
Tested on a custom Freescale VF610-based platform, with an AT93C46D
device attached via dspi2. The spi-gpio driver was used to allow the
necessary non-byte-sized transfers.
Signed-off-by: Cory Tusar <cory.tusar@pid1solutions.com> Tested-by: Chris Healy <chris.healy@zii.aero> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The current code fails to nvmem_cell_drop(cells[0]) - even worse, if
the loop above fails already at i==0, we'll enter an essentially
infinite loop doing nvmem_cell_drop on cells[-1], cells[-2], ... which
is unlikely to end well.
Also, we're not freeing the temporary backing array cells on the error
path.
Arnd Bergmann [Mon, 25 Jan 2016 15:54:25 +0000 (16:54 +0100)]
char: nwbutton: avoid unused variable warning
When CONFIG_NWBUTTON_REBOOT is disabled, we get a warning about
an unused variable:
drivers/char/nwbutton.c:37:12: warning: 'reboot_count' defined but not used [-Wunused-variable]
static int reboot_count = NUM_PRESSES_REBOOT; /* Number of presses to reboot */
Using if(IS_ENABLED()) instead of #ifdef around the user makes the
code nicer to read and avoids the warning.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:18 +0000 (15:48 -0800)]
misc: mic: MIC host and card driver changes to enable VOP
This patch modifies the MIC host and card drivers to start using the
VOP driver. The MIC host and card drivers now implement the VOP bus
operations and register a VOP device on the VOP bus. MIC driver stack
documentation is also updated to include the new VOP driver.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:17 +0000 (15:48 -0800)]
misc: mic: Enable VOP debugfs and driver build
This patch moves the virtio specific debugfs hooks previously in
mic_debugfs.c in the MIC host driver into the VOP driver. The
Kconfig/Makefile is also updated to allow building the VOP driver.
Ashutosh Dixit [Mon, 8 Feb 2016 23:48:16 +0000 (15:48 -0800)]
misc: mic: Enable VOP card side functionality
This patch moves virtio functionality from the MIC card driver into a
separate hardware independent Virtio Over PCIe (VOP) driver. This
functionality was introduced in commit 2141c7c5ee67 ("Intel MIC Card
Driver Changes for Virtio Devices.") in
drivers/misc/mic/card/mic_virtio.c. Apart from being moved into a
separate driver the functionality is essentially unchanged. See the
above mentioned commit for a description of this functionality.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:15 +0000 (15:48 -0800)]
misc: mic: Enable VOP host side functionality
This patch moves virtio functionality from the MIC host driver into a
separate hardware independent Virtio Over PCIe (VOP) driver. This
functionality was introduced in commit f69bcbf3b4c4 ("Intel MIC Host
Driver Changes for Virtio Devices.") in
drivers/misc/mic/host/mic_virtio.c. Apart from being moved into a
separate driver the functionality is essentially unchanged. See the
above mentioned commit for a description of this functionality.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:14 +0000 (15:48 -0800)]
misc: mic: Add data structures for the VOP driver
This patch adds VOP driver data structures used in subsequent
patches. These data structures are refactored from similar data
structures used in the virtio parts of previous MIC host and card
drivers.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:13 +0000 (15:48 -0800)]
misc: mic: MIC VOP Bus
The Virtio Over PCIe (VOP) bus abstracts the low level hardware
details like interrupts and mapping remote memory so that the same VOP
driver can work without changes with different MIC host or card
drivers as long as the hardware bus operations are implemented. The
VOP driver registers itself on the VOP bus. The base PCIe drivers
implement the bus ops and register VOP devices on the bus, resulting
in the VOP driver being probed with the VOP devices. This allows the
VOP functionality to be shared between multiple generations of Intel
MIC products.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:12 +0000 (15:48 -0800)]
misc: mic: Remove MIC X100 card virtio functionality
This patch deletes the virtio functionality from the MIC X100 card
driver. A subsequent patch will re-enable this functionality by
consolidating the hardware independent logic in a new Virtio over PCIe
(VOP) driver.
Sudeep Dutt [Mon, 8 Feb 2016 23:48:11 +0000 (15:48 -0800)]
misc: mic: Remove MIC X100 host virtio functionality
This patch deletes the virtio functionality from the MIC X100 host
driver. A subsequent patch will re-enable this functionality by
consolidating the hardware independent logic in a new Virtio over PCIe
(VOP) driver.
Cory Tusar [Thu, 7 Jan 2016 03:55:01 +0000 (22:55 -0500)]
Documentation: devicetree: Add DT bindings to eeprom_93xx46 driver.
This commit documents bindings to be added to the eeprom_93xx46 driver
which will allow:
- Device word size and read-only attributes to be specified.
- A device-specific compatible string for use with Atmel AT93C46D
EEPROMs.
- Specifying a GPIO line to function as a 'select' or 'enable' signal
prior to accessing the EEPROM.
Signed-off-by: Cory Tusar <cory.tusar@pid1solutions.com> Acked-by: Rob Herring <robh@kernel.org> Tested-by: Chris Healy <chris.healy@zii.aero> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cory Tusar [Thu, 7 Jan 2016 03:55:00 +0000 (22:55 -0500)]
misc: eeprom_93xx46: Fix 16-bit read and write accesses.
Compatible at93xx46 devices from both Microchip and Atmel expect a
word-based address, regardless of whether the device is strapped for 8-
or 16-bit operation. However, the offset parameter passed in when
reading or writing at a specific location is always specified in terms
of bytes.
This commit fixes 16-bit read and write accesses by shifting the offset
parameter to account for this difference between a byte offset and a
word-based address.
The arg of ioctl in ppdev is the pointer of integer except the
timeval in PPSETTIME, PPGETTIME. Different size of timeval
is already supported by the previous patches. So, it is safe
to add compat support.
The y2038 issue for ppdev is changes of timeval in the ioctl
(PPSETTIME and PPGETTIME). The size of struct timeval changes from
8bytes to 16bytes due to the changes of time_t. It lead to the
changes of the command of ioctl, e.g. for PPGETTIME, We have:
on 32-bit (old): 0x80087095
on 32-bit (new): 0x80107095
on 64-bit : 0x80107095
This patch define these two ioctl commands to support the 32bit
and 64bit time_t application at the same time. And, introduce
pp_set_timeout to remove some duplicated code.
firmware: simplify dev_*() print messages for generic helpers
Simplify a few of the *generic* shared dev_warn() and dev_dbg()
print messages for three reasons:
0) Historically firmware_class code was added to help
get device driver firmware binaries but these days
request_firmware*() helpers are being repurposed for
general *system data* needed by the kernel.
1) This will also help generalize shared code as much as possible
later in the future in consideration for a new extensible firmware
API which will enable to separate usermode helper code out as much
as possible.
2) Kees Cook pointed out the the prints already have the device
associated as dev_*() helpers are used, that should help identify
the user and case in which the helpers are used. That should provide
enough context and simplifies the messages further.
v4: generalize debug/warn messages even further as suggested by
Kees Cook.
Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: David Howells <dhowells@redhat.com> Cc: Casey Schaufler <casey@schaufler-ca.com> Cc: Ming Lei <ming.lei@canonical.com> Cc: Takashi Iwai <tiwai@suse.de> Cc: Vojtěch Pavlík <vojtech@suse.cz> Cc: Kyle McMartin <kyle@kernel.org> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stephen Boyd [Wed, 18 Nov 2015 00:13:55 +0000 (16:13 -0800)]
spmi: pmic-arb: Support more than 128 peripherals
Add support for more than 128 peripherals by taking a lazy
caching approach to the mapping tables. Instead of reading and
caching the tables at boot given some fixed size, read them and
cache them on an as needed basis. We still assume a max size of
512 peripherals, trading off some space for simplicity.
Based on a patch by Gilad Avidov <gavidov@codeaurora.org> and
Sagar Dharia <sdharia@codeaurora.org>.
Andreas Kemnade [Mon, 4 Jan 2016 15:57:28 +0000 (16:57 +0100)]
omap_hdq: fix usecount handling
hdq_usecount was set to zero after a successful read, so
omap_hdq_put could not properly free resources which leads
e.g. to increasing usecounts in lsmod output
Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Reviewed-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
nvmem: core: return error for non word aligned access
nvmem providers have restrictions on register strides, so return error
when users attempt to read/write buffers with sizes which are less
than word size.
Without this patch the userspace would continue to try as it does not
get any error from the nvmem core, resulting in a hang or endless loop
in userspace.
This commit adds support for NXP LPC18xx EEPROM memory found in NXP
LPC185x/3x and LPC435x/3x/2x/1x devices.
EEPROM size is 16384 bytes and it can be entirely read and
written/erased with 1 word (4 bytes) granularity. The last page
(128 bytes) contains the EEPROM initialization data and is not writable.
Erase/program time is less than 3ms. The EEPROM device requires a
~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing
the system bus clock by the division factor, contained in the divider
register (minus 1 encoded).
EEPROM will be kept in Power Down mode except during read/write calls.
Ben Hutchings [Mon, 14 Dec 2015 14:29:23 +0000 (14:29 +0000)]
misc/bmp085: Enable building as a module
Commit 985087dbcb02 'misc: add support for bmp18x chips to the bmp085
driver' changed the BMP085 config symbol to a boolean. I see no
reason why the shared code cannot be built as a module, so change it
back to tristate.
Fixes: 985087dbcb02 ("misc: add support for bmp18x chips to the bmp085 driver") Cc: Eric Andersson <eric.andersson@unixphere.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Mon, 14 Dec 2015 01:07:14 +0000 (20:07 -0500)]
drivers/misc: make arm-charlcd.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
drivers/misc/Kconfig:config ARM_CHARLCD
drivers/misc/Kconfig: bool "ARM Ltd. Character LCD Driver"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and this driver did not have a ".remove"
function coded for non-modular drivers either.
Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
We don't replace module.h with init.h since the file already has that.
We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.
Sudip Mukherjee [Mon, 23 Nov 2015 11:54:32 +0000 (17:24 +0530)]
misc: mic: use common error path
Instead of calling release_firmware() on every error and then jumping
lets have a common release_firmware() in the error path.
This patch also fixes a memory leak where we missed release_firmware()
if mic_x100_load_command_line() fails.
Sudip Mukherjee [Mon, 23 Nov 2015 11:54:30 +0000 (17:24 +0530)]
misc: mic: return error properly
If request_firmware() succeeds then rc becomes 0. After that if the test
for strcmp() fails then we were jumping to label done: and returning rc.
But rc being 0 we returned success whereas we have failed here and we
were supposed to return an error.
Dan Carpenter [Tue, 15 Dec 2015 10:11:28 +0000 (13:11 +0300)]
mic_virtio: fix a timeout loop
After the loop we test "if (!retry)" to see if we timedout. The problem
is "retry--" is a post-op so retry will be -1 at the end of the loop. I
have fixed this by changing it to a pre-op instead.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ashutosh Dixit [Tue, 17 Nov 2015 23:55:37 +0000 (15:55 -0800)]
misc: mic: Fix crash when MIC reset is invoked in RESET_FAILED state
This patch fixes the following crash seen when MIC reset is invoked in
RESET_FAILED state due to device_del being called a second time on an
already deleted device:
The fix consists in realizing that because cosm_reset changes the
state to MIC_RESETTING, cosm_stop needs the previous state, before it
changed to MIC_RESETTING, to decide whether a hw_ops->stop had
previously been issued. This is now provided in a new cosm_device
member cdev->prev_state.
Currently, the character device write method allocates a temporary buffer
for user's data, but the user's data size is not sanitized and can cause
arbitrarily large allocations via kzalloc() or an integer overflow that
will then result in overwriting kernel memory.
This patch trims the input buffer size to avoid these issues.
Chunyan Zhang [Tue, 22 Dec 2015 15:25:20 +0000 (17:25 +0200)]
stm class: Fix an off-by-one in master array allocation
Since both sw_start and sw_end are master indices, the size of array
that holds them is sw_end - sw_start + 1, which the current code gets
wrong, allocating one item less than required.
This patch corrects the allocation size, avoiding potential slab
corruption.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
[alexander.shishkin@linux.intel.com: re-wrote the commit message] Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently, the list of stm_sources linked to an stm device is protected by
a spinlock, which also means that sources' .unlink() method is called under
this spinlock. However, this method may (and does) sleep, which means
trouble.
This patch slightly reworks locking around stm::link_list so that bits that
might_sleep() are called with a mutex held instead. Modification of this
list requires both mutex and spinlock to be held, while looking at the list
can be done under either mutex or spinlock.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Right now, if stm device removal has to unbind from a policy (that is,
an stm device that has STP policy, gets removed), it will trigger a
nested lock on the stm device's policy mutex.
This patch fixes the problem by moving the locking from the policy
unbinding to policy removal (configfs path), where it's actually needed;
the other caller of the policy unbinding function already takes the
mutex around the call.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Tue, 22 Dec 2015 15:25:17 +0000 (17:25 +0200)]
stm class: Select CONFIG_SRCU
The newly added STM code uses SRCU, but does not ensure that
this code is part of the kernel:
drivers/built-in.o: In function `stm_source_link_show':
include/linux/srcu.h:221: undefined reference to `__srcu_read_lock'
include/linux/srcu.h:238: undefined reference to `__srcu_read_unlock'
drivers/built-in.o: In function `stm_source_link_drop':
include/linux/srcu.h:221: undefined reference to `__srcu_read_lock'
include/linux/srcu.h:238: undefined reference to `__srcu_read_unlock'
This adds a Kconfig 'select' statement like all the other SRCU using
drivers have.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices") Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
stm class: Hide STM-specific options if STM is disabled
If STM=n, it doesn't make sense to ask about STM_DUMMY and
STM_SOURCE_CONSOLE support, which are not even built when enabled
anyway. Hence hide these options if STM=n.
Mathieu Poirier [Tue, 2 Feb 2016 21:14:01 +0000 (14:14 -0700)]
coresight: implementing 'cpu_id()' API
Other than plainly parsing the device tree there is no way to
know which CPU a tracer is affined to. As such adding an
interface to lookup the CPU field enclosed in the etm_drvdata
structure that was initialised at boot time.
Mathieu Poirier [Tue, 2 Feb 2016 21:14:00 +0000 (14:14 -0700)]
coresight: removing bind/unbind options from sysfs
The coresight drivers have absolutely no control over bind and unbind
operations triggered from sysfs. The operations simply can't be
cancelled or denied event when one or several tracing sessions are
under way. Since the memory associated to individual device is
invariably freed, the end result is a kernel crash when the path from
source to sink is travelled again as demonstrated here[1].
One solution could be to keep track of all the path (i.e tracing
session) that get created and iterate through the elements of those path
looking for the coresight device that is being removed. This proposition
doesn't scale well since there is no upper bound on the amount of
concurrent trace session that can be created.
With the above in mind, this patch prevent devices from being unbounded
from their driver by using the driver->suppress_bind_attr option. That way
trace sessions can be managed without fearing to loose devices.
Since device can't be removed anymore the xyz_remove() functions found in
each driver is also removed.
Mathieu Poirier [Tue, 2 Feb 2016 21:13:59 +0000 (14:13 -0700)]
coresight: remove csdev's link from topology
In function 'coresight_unregister()', all references to the csdev that
is being taken away need to be removed from the topology. Otherwise
building the next coresight path from source to sink may use memory
that has been released.
Mathieu Poirier [Tue, 2 Feb 2016 21:13:57 +0000 (14:13 -0700)]
coresight: coresight_unregister() function cleanup
In its current form the code never frees csdev->refcnt allocated
in coresight_register(). There is also a problem with csdev->conns
that is freed before device_unregister() rather than in the device
release function.
This patch addresses both issues by moving kfree(csdev->conns) to
coresight_device_release() and freeing csdev->refcnt, also in
the same function.
The locking in coresight_unregister() is not required as the only customers of
the function are drivers themselves when an initialisation failure has been
encoutered.
Jorgen Hansen [Thu, 12 Nov 2015 09:29:32 +0000 (01:29 -0800)]
VMCI: Use 32bit atomics for queue headers on X86_32
This change restricts the reading and setting of the head and tail
pointers on 32bit X86 to 32bit for both correctness and
performance reasons. On uniprocessor X86_32, the atomic64_read
may be implemented as a non-locked cmpxchg8b. This may result in
updates to the pointers done by the VMCI device being overwritten.
On MP systems, there is no such correctness issue, but using 32bit
atomics avoids the overhead of the locked 64bit operation. All this
is safe because the queue size on 32bit systems will never exceed
a 32bit value.
K. Y. Srinivasan [Thu, 28 Jan 2016 06:29:45 +0000 (22:29 -0800)]
Drivers: hv: vmbus: Give control over how the ring access is serialized
On the channel send side, many of the VMBUS
device drivers explicity serialize access to the
outgoing ring buffer. Give more control to the
VMBUS device drivers in terms how to serialize
accesss to the outgoing ring buffer.
The default behavior will be to aquire the
ring lock to preserve the current behavior.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Thu, 28 Jan 2016 06:29:44 +0000 (22:29 -0800)]
Drivers: hv: vmbus: Eliminate the spin lock on the read path
The function hv_ringbuffer_read() is called always on a pre-assigned
CPU. Each chnnel is bound to a specific CPU and this function is
always called on the CPU the channel is bound. There is no need to
acquire the spin lock; get rid of this overhead.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:43 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()
The hvsock driver needs this API to release all the resources related
to the channel.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:42 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add a per-channel rescind callback
This will be used by the coming hv_sock driver.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:41 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add a hvsock flag in struct hv_driver
Only the coming hv_sock driver has a "true" value for this flag.
We treat the hvsock offers/channels as special VMBus devices.
Since the hv_sock driver handles all the hvsock offers/channels, we need to
tweak vmbus_match() for hv_sock driver, so we introduce this flag.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:40 +0000 (22:29 -0800)]
Drivers: hv: vmbus: define a new VMBus message type for hvsock
A function to send the type of message is also added.
The coming net/hvsock driver will use this function to proactively request
the host to offer a VMBus channel for a new hvsock connection.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When the hvsock channel's outbound ringbuffer is full (i.e.,
hv_ringbuffer_write() returns -EAGAIN), we should avoid the unnecessary
signaling the host.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:38 +0000 (22:29 -0800)]
Drivers: hv: vmbus: define the new offer type for Hyper-V socket (hvsock)
A helper function is also added.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dexuan Cui [Thu, 28 Jan 2016 06:29:37 +0000 (22:29 -0800)]
Drivers: hv: vmbus: add a helper function to set a channel's pending send size
This will be used by the coming net/hvsock driver.
Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Kuznetsov [Thu, 28 Jan 2016 06:29:35 +0000 (22:29 -0800)]
Drivers: hv: vmbus: avoid scheduling in interrupt context in vmbus_initiate_unload()
We have to call vmbus_initiate_unload() on crash to make kdump work but
the crash can also be happening in interrupt (e.g. Sysrq + c results in
such) where we can't schedule or the following will happen:
[ 314.905786] bad: scheduling from the idle thread!
Just skipping the wait (and even adding some random wait here) won't help:
to make host-side magic working we're supposed to receive CHANNELMSG_UNLOAD
(and actually confirm the fact that we received it) but we can't use
interrupt-base path (vmbus_isr()-> vmbus_on_msg_dpc()). Implement a simple
busy wait ignoring all the other messages and use it if we're in an
interrupt context.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Kuznetsov [Thu, 28 Jan 2016 06:29:34 +0000 (22:29 -0800)]
Drivers: hv: vmbus: avoid infinite loop in init_vp_index()
When we pick a CPU to use for a new subchannel we try find a non-used one
on the appropriate NUMA node, we keep track of them with the
primary->alloced_cpus_in_node mask. Under normal circumstances we don't run
out of available CPUs but it is possible when we we don't initialize some
cpus in Linux, e.g. when we boot with 'nr_cpus=' limitation.
Avoid the infinite loop in init_vp_index() by checking that we still have
non-used CPUs in the alloced_cpus_in_node mask and resetting it in case
we don't.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Sat, 26 Dec 2015 04:00:30 +0000 (20:00 -0800)]
Drivers: hv: vmbus: Add vendor and device atttributes
Add vendor and device attributes to VMBUS devices. These will be used
by Hyper-V tools as well user-level RDMA libraries that will use the
vendor/device tuple to discover the RDMA device.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
K. Y. Srinivasan [Mon, 21 Dec 2015 23:12:20 +0000 (15:12 -0800)]
Drivers: hv: vmbus: Cleanup vmbus_set_event()
Cleanup vmbus_set_event() by inlining the hypercall to post
the event and since the return value of vmbus_set_event() is not checked,
make it void. As part of this cleanup, get rid of the function
hv_signal_event() as it is only callled from vmbus_set_event().
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Tue, 2 Feb 2016 09:48:09 +0000 (12:48 +0300)]
goldfish: locking bugs in goldfish_pipe_read_write()
We recently messed up the error handling here. We can return with the
pipe->lock held or sometimes we unlock twice by mistake.
Fixes: 2f3be88237a3 ('goldfish_pipe: Pin pages to memory while copying and other cleanups') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Mon, 19 Oct 2015 11:19:01 +0000 (14:19 +0300)]
misc: mic/scif: fix wrap around tests
Signed integer overflow is undefined. Also I added a check for
"(offset < 0)" in scif_unregister() because that makes it match the
other conditions and because I didn't want to subtract a negative.
Fixes: ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Mon, 1 Feb 2016 10:33:00 +0000 (11:33 +0100)]
staging: goldfish: use div64_s64 instead of do_div
The goldfish nand driver divides a signed 64-bit number (loff_t)
in multiple places using the do_div() function. This has always
been unreliable but now produces a compiler warning (since 4.5-rc1):
goldfish/goldfish_nand.c: In function 'goldfish_nand_erase':
goldfish/goldfish_nand.c:107:91: error: comparison of distinct pointer types lacks a cast [-Werror]
goldfish/goldfish_nand.c: In function 'goldfish_nand_read_oob':
goldfish/goldfish_nand.c:145:91: error: comparison of distinct pointer types lacks a cast [-Werror]
This changes the code to the equivalent div_s64{,_rem} that
works correctly for negative numbers (which we should never
get here).
The warning has shown up on ARM allmodconfig builds after the goldfish
bus driver has become visible on ARM.
mei: hbm: send immediate reply flag in enum request
Signal the FW that it can send an HBM enumeration answer immediately,
without waiting for FW initialization completion, meaning before
all the FW clients are ready and registered.
Organize enumeration response options to enum as a byproduct.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The reserved host clients can be obsoleted now, a portion of the
platforms is shipped without iAMT enabled, where the reservation is not
relevant and for platforms with iAMT dynamic allocation is sufficient.
Dropping reserved ids makes enumeration more flexible and generic
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The FW can initiate client disconnection only because an error
condition, hence it make sense to bump the debug message to the warning
level to have an entery in the log.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mei: fill file pointer in read cb for fixed address client
The read callback created from a flow control request for
a fixed address client have NULL in the file pointer.
Fill the file pointer using a data from a write callback.
This allows us to drop workaround introduced in:
commit eeabfcf5a92a ("mei: connection to fixed address clients from user-space")
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mei: discard replies from unconnected fixed address clients
A fixed address client in the FW doesn't have a notion of connection and
can send message after the file associated with it was already closed.
Silently discard such messages.
Add inline helpers to detect whether a message is hbm or intended for
a fixed address client
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>