Andreas Werner [Tue, 3 May 2016 10:42:00 +0000 (12:42 +0200)]
mcb: Fixed bar number assignment for the gdd
The bar number is found in reg2 within the gdd. Therefore
we need to change the assigment from reg1 to reg2 which
is the correct location.
Signed-off-by: Andreas Werner <andreas.werner@men.de> Fixes: '3764e82e5' drivers: Introduce MEN Chameleon Bus Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Werner [Tue, 3 May 2016 10:42:01 +0000 (12:42 +0200)]
mcb: Replace ioremap and request_region with the devm version
Replaced ioremap with devm_ioremap and request_mem_region with
devm_request_mem_region. This makes the code much more cleaner.
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>
The mcb_bus structure previously was released in mcb_release_bus. This lead to
the following warning on module unload:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 2032 at drivers/base/core.c:251 device_release+0x73/0x90
Device 'mcb:0' does not have a release() function, it is broken and must be fixed.
Modules linked in: men_z135_uart mcb_pci(-) mcb
CPU: 1 PID: 2032 Comm: rmmod Not tainted 4.6.0-rc4+ #3
Hardware name: N/A N/A/COMe-mBTi10, BIOS MVV1R921 X64 10/14/2015 0000028600000286c0117de4c12d6f16c0117e2cc18be0d3c0117dfcc104f6e1 000000fbf5ccbe08f5ccbe00f5c64600c0117e18c104f7280000000900000000 c0117e10c18db674c0117e2cc0117e3cc13ce5c3c18be0d3000000fbc18db674
Call Trace:
[<c12d6f16>] dump_stack+0x47/0x61
[<c104f6e1>] __warn+0xc1/0xe0
[<c104f728>] warn_slowpath_fmt+0x28/0x30
[<c13ce5c3>] device_release+0x73/0x90
[<c12d92e4>] kobject_release+0x34/0x80
[<c12d929d>] ? kobject_del+0x2d/0x40
[<c12d9205>] kobject_put+0x25/0x50
[<c13ce77f>] put_device+0xf/0x20
[<c13d114b>] klist_devices_put+0xb/0x10
[<c1752673>] klist_next+0x73/0xf0
[<c13d1140>] ? unbind_store+0x100/0x100
[<f8a23370>] ? mcb_bus_add_devices+0x30/0x30 [mcb]
[<c13d0a81>] bus_for_each_dev+0x51/0x80
[<f8a23319>] mcb_release_bus+0x19/0x40 [mcb]
[<f8a23370>] ? mcb_bus_add_devices+0x30/0x30 [mcb]
[<f8a2b033>] mcb_pci_remove+0x13/0x20 [mcb_pci]
[<c130d358>] pci_device_remove+0x28/0xb0
[<c13d201b>] __device_release_driver+0x7b/0x110
[<c13d2847>] driver_detach+0x87/0x90
[<c13d1b9b>] bus_remove_driver+0x3b/0x80
[<c13d2ed0>] driver_unregister+0x20/0x50
[<c130be53>] pci_unregister_driver+0x13/0x60
[<f8a2b1f4>] mcb_pci_driver_exit+0xd/0xf [mcb_pci]
[<c10be588>] SyS_delete_module+0x138/0x200
[<c1159208>] ? ____fput+0x8/0x10
[<c1068054>] ? task_work_run+0x74/0x90
[<c1001879>] do_fast_syscall_32+0x69/0x120
[<c1757597>] sysenter_past_esp+0x40/0x6a
---[ end trace 1ed34c2aa3019875 ]---
Release a mcb_bus' memory on the device's release callback, to avoid above
warning.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Export information about the bus stored in the FPGA's header to userspace via
sysfs, instead of hiding it in pr_debug()s from everyone.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The mcb bus' device member wasn't correctly initialized and thus wasn't placed
correctly into the driver model.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 3 May 2016 17:34:00 +0000 (11:34 -0600)]
coresight: configuring ETF in FIFO mode when acting as link
When part of a path but not identified as a sink, the EFT has to
be configured as a link and placed in HW FIFO mode. As such when
enabling a path, call the right configuration function based on
the role the ETF if playing in this trace run.
Mathieu Poirier [Tue, 3 May 2016 17:33:57 +0000 (11:33 -0600)]
coresight: tmc: keep track of memory width
Accessing the HW configuration register each time the memory
width is needed simply doesn't make sense. It is much more
efficient to read the value once and keep a reference for
later use.
Mathieu Poirier [Tue, 3 May 2016 17:33:56 +0000 (11:33 -0600)]
coresight: tmc: make sysFS and Perf mode mutually exclusive
The sysFS and Perf access methods can't be allowed to interfere
with one another. As such introducing guards to access
functions that prevents moving forward if a TMC is already
being used.
Mathieu Poirier [Tue, 3 May 2016 17:33:55 +0000 (11:33 -0600)]
coresight: tmc: dump system memory content only when needed
Calling tmc_etf/etr_dump_hw() is required only when operating from
sysFS. When working from Perf, the system memory is harvested
from the AUX trace API.
Mathieu Poirier [Tue, 3 May 2016 17:33:54 +0000 (11:33 -0600)]
coresight: tmc: adding mode of operation for link/sinks
Moving tmc_drvdata::enable to a local_t mode. That way the
sink interface is aware of it's orgin and the foundation for
mutual exclusion between the sysFS and Perf interface can be
laid out.
Mathieu Poirier [Tue, 3 May 2016 17:33:53 +0000 (11:33 -0600)]
coresight: tmc: getting rid of multiple read access
Allowing multiple readers to access the trace data simultaniously
via sysFS provides no shortage of opportunity for race condition,
mandates two variable to be maintained (drvdata::read_count and
drvdata::reading), makes the code complex and provide little
advantages, if any.
This patch streamlines the read process by restricting trace data
access to a single user. That way drvdata::read_count can
be eliminated and race conditions (along with faulty error handling)
in function tmc_open() and tmc_release() eliminated.
Mathieu Poirier [Tue, 3 May 2016 17:33:52 +0000 (11:33 -0600)]
coresight: tmc: allocating memory when needed
In it's current form the TMC probe() function allocates
trace buffer memory at boot time, event if coresight isn't
used. This is highly inefficient since trace buffers can
occupy a lot of memory that could be used otherwised.
This patch allocates trace buffers on the fly, when the
coresight subsystem is solicited. Allocated buffers are
released when traces are read using the device descriptors
under /dev.
Mathieu Poirier [Tue, 3 May 2016 17:33:50 +0000 (11:33 -0600)]
coresight: tmc: splitting driver in ETB/ETF and ETR components
The TMC block can operate in 3 modes (ETB, ETF and ETR) and accessed
via two interfaces (sysFS and Perf). That makes 6 mode to cover, which
is way too much coupling for a single file.
This patch splits the original TMC driver in 2 halves, one for ETB/ETF
and another one for ETR mode. A common core is kept for functionality
common to all 3 modes.
Mathieu Poirier [Tue, 3 May 2016 17:33:49 +0000 (11:33 -0600)]
coresight: tmc: cleaning up header file
This patch first move the TMC_STS_TMCREADY_BIT and
TMC_FFCR_FLUSHMAN_BIT defines to their respective section.
It also removes TMC_FFCR_FLUSHMAN, since the same result
can easily be obtained using the BIT() macro.
In their current implementation the tmc_read_prepare/unprepare()
are a lump of if/else that is difficult to read. This patch is
alleviating that by using a switch statement. The latter also
allows for a better control on the error path.
Mathieu Poirier [Tue, 3 May 2016 17:33:45 +0000 (11:33 -0600)]
coresight: tmc: waiting for TMCReady bit before programming
According to the TRM before programming the TMC in circular
buffer mode (and that for any configuration, ETB, ETR, ETF),
the TMCReady bit in the status register has to be set.
This patch adds a check to make sure the state machine is in
a state where it can be configured, and complains otherwise.
Mathieu Poirier [Tue, 3 May 2016 17:33:44 +0000 (11:33 -0600)]
coresight: tmc: modifying naming convention
According to the TMC architectural state machine, the 'stopped'
state is reached when bit 2 (TMCReady) of the TMC Status register
turns to '1'. The code is correct but the naming convention isn't.
The 'Triggered' bit occupies position '1' of the TMC Status register
and has nothing to do with the indication of the TMC entering the
stopped state. As such renaming function "tmc_wait_for_triggered()"
and changing the #define to reflect what the code is really doing.
This patch has no effect other than clarifying the semantic.
Mathieu Poirier [Tue, 3 May 2016 17:33:43 +0000 (11:33 -0600)]
coresight: tmc: adding sysFS management entries
Adding management registers that convey implementation
specific characteristics. Those are useful for trace
configuration and collection along with general trouble
shooting.
Pratik Patel [Tue, 3 May 2016 17:33:40 +0000 (11:33 -0600)]
coresight: stm: adding driver for CoreSight STM component
This driver adds support for the STM CoreSight IP block, allowing any
system compoment (HW or SW) to log and aggregate messages via a
single entity.
The CoreSight STM exposes an application defined number of channels
called stimulus port. Configuration is done using entries in sysfs
and channels made available to userspace via configfs.
Signed-off-by: Pratik Patel <pratikp@codeaurora.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Michael Williams <michael.williams@arm.com> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mathieu Poirier [Tue, 3 May 2016 17:33:39 +0000 (11:33 -0600)]
coresight: stm: Bindings for System Trace Macrocell
The System Trace Macrocell (STM) is an IP block falling under the
CoreSight umbrella. It's main purpose it so expose stimulus channels
to any system component for the purpose of information logging.
Bindings for this IP block adds a couple of items to the current
mandatory definition for CoreSight components.
Mathieu Poirier [Tue, 3 May 2016 17:33:38 +0000 (11:33 -0600)]
coresight: adding path for STM device
>From a core framework point of view an STM device is a source that is
treated the same way as any other tracers. Unlike tracers though STM
devices are not associated with a CPU. As such it doesn't make sense
to associate the path from an STM device to its sink with a per-cpu
variable as it is done for tracers.
This patch simply adds another global variable to keep STM paths and the
processing in coresight_enable/disable() is updated to deal with STM
devices properly.
stm class: Support devices that override software assigned masters
Some STM devices adjust software assigned master numbers depending on
the trace source and its runtime state and whatnot. This patch adds
a sysfs attribute to inform the trace-side software that master numbers
assigned to software sources will not match those in the STP stream,
so that, for example, master/channel allocation policy can be adjusted
accordingly.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Sen [Sun, 1 May 2016 21:23:33 +0000 (23:23 +0200)]
w1: add ability to set (SRAM) and store (EEPROM) configuration for temp sensors like DS18B20
Since many temperature sensors come "preconfigured" with a lower
precision, people are stuck at that precision when running on a kernel
based device (unlike the Dallas 1Wire library for e.g. Arduino, which
supports writing the configuration/scratchpad). This patch adds write
support for the scratchpad/precision registers via w1_slave sysfs.
Signed-off-by: Ben Sen <0.x29a.0@gmail.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Presumably we never use the default: case statement which prints a
warning message. But my static checker complains that if we do, we will
hit an uninitialized variable warning.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marek Szyprowski [Fri, 15 Apr 2016 09:13:32 +0000 (11:13 +0200)]
drivers: amba: properly handle devices with power domains
To read pid/cid registers, the probed device need to be properly turned on.
When it is inside a power domain, the bus code should ensure that the
given power domain is enabled before trying to access device's registers.
However in some cases power domain (or clocks) might not be yet available.
Returning -EPROBE_DEFER is not a solution in such case, because callers
don't handle this special error code. Instead such devices are added to the
special list and their registration is retried from periodic worker until
all resources are available.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Daniel Wagner [Fri, 15 Apr 2016 08:22:27 +0000 (10:22 +0200)]
ti-st: Fix complete_all() wrong usage
complete_all() should only be called once, doing it twice is a clear bug.
8565adbc8214 ("drivers/misc/ti-st: fix read fw version cmd") added the
additional complete_all() call. Since we call complete_all() when
leaving the function we can drop the complete_all() call inside
true branch of the if statement.
Dan Carpenter [Wed, 13 Apr 2016 06:45:11 +0000 (09:45 +0300)]
ARM: qcom: silence an uninitialized variable warning
It's harmless but, if "enable" isn't set, then we pass uninitialized
values to qcom_coincell_chgr_config(). The values aren't used, but
let's silence the warning anyway.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Tim Bird <tim.bird@sonymobile.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
According to full-history-linux commit d3794f4fa7c3edc3 ("[PATCH] M68k
update (part 25)"), port operations are allowed on m68k if CONFIG_ISA is
defined.
However, commit 153dcc54df826d2f ("[PATCH] mem driver: fix conditional
on isa i/o support") accidentally changed an "||" into an "&&",
disabling it completely on m68k. This logic was retained when
introducing the DEVPORT symbol in commit 4f911d64e04a44c4 ("Make
/dev/port conditional on config symbol").
Drop the bogus dependency on !M68K to fix this.
Fixes: 153dcc54df826d2f ("[PATCH] mem driver: fix conditional on isa i/o support") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Tested-by: Al Stone <ahs3@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
coresight: removing gratuitous boot time log messages
Removing boot time log for drivers that don't report useful information
other than they came up properly. The same information can be found in
sysFS once the system has booted and as such doesn't provide any value
in the boot log.
Reported-by: Mark Brown <broonie@linaro.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The sysFS "status" entry conveys a wealth of information about
the status of the HW but goes agains the sysFS rule of one topic
per file.
This patch rectify the situation by adding read-only entries for
each of the field formaly displayed by "status". The ABI
documentation is kept up to date.
coresight: moving coresight_simple_func() to header file
Macro "coresight_simple_func()" can be used by several drivers.
As such making the structure type generic and moving to a
globally available header file. That way individual drivers
can use the functionality by simply specifying the structure
they need to work with.
coresight: etm4x: moving etm_drvdata::enable to atomic field
Similarly to ETMv3, moving etmv4_drvdata::enable to an atomic
type that gives the 'mode' of a tracer and prevents multiple,
simultanious access by different subsystems.
coresight: etm4x: unlocking tracers in default arch init
As with the ETMv3.x driver, calling 'smp_call_function_single()'
twice in a row is highly ineffective. As such moving function
'etm4_os_unlock()' before the default initialisation takes
place, which results in the same outcome.
Splitting and updating the default initialisation for each etmv4
configuration so that it can be called at the beginning of each
session rather than initialisation time only.
Since the trace ID isn't expected to change with every session,
moving it with the default tracer initialisation.
Similar to what was done on etm3x, splitting driver structure
etmv4_drvdata in two. One half is concerned with the HW
characteristics that are generally static in nature. The other
half deals with user configuration and will change from one
trace session to another.
No gain/loss of functionality is incurred from this patch.
coresight: etm4x: adding config and traceid registers
Adding new sysFS management interface to query the configuration
and the traceid registers. Both are required to convey information
to the perf cmd line tools when using ETMv4 tracers as PMU.
coresight: etm4x: moving sysFS entries to a dedicated file
As with the etm3x driver, sysFS entries are big enough to justify
their own file. As such moving all sysFS related declarations to
a dedicated location.
No gain/loss of functionality is incurred from this patch.
Every new architecture has to add itself to the growing list of those
that do not support the legacy PC RTC driver.
This replaces the long list of architectures that don't support it
with a shorter list of those that do.
The list is taken from those architectures that have a non-empty
asm/mc146818rtc.h header file and were not explicitly blacklisted
or select RTC_LIB.
Alpha and Loongson64 can already choose between this driver and
an rtc-class based one. mn10300 is actually the only architecture
now that still requires this driver, and that should be fairly
easy to change to use rtc-cmos if we want to kill off rtc.ko
for good.
Mark Brown [Wed, 20 Apr 2016 09:16:36 +0000 (10:16 +0100)]
eeprom: 93xx46: Fix SPI device leak
The 93xx46 driver is using spi_dev_get() apparently just to take a copy
of the SPI device used to instantiate it but never calls spi_dev_put()
to free it. Since the device is guaranteed to exist between probe() and
remove() there should be no need for the driver to take an extra
reference to it so fix the leak by just using a straight assignment.
Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mark Brown [Wed, 20 Apr 2016 09:16:35 +0000 (10:16 +0100)]
eeprom: at25: Fix SPI device leak
The at25 driver is using spi_dev_get() apparently just to take a copy
of the SPI device used to instantiate it but never calls spi_dev_put()
to free it. Since the device is guaranteed to exist between probe() and
remove() there should be no need for the driver to take an extra
reference to it so fix the leak by just using a straight assignment.
Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit enables the active pullup (APU bit) by default for
the DS2482 1-Wire master.
>From the DS2482 datasheet:
"The APU bit controls whether an active pullup (controlled slew-rate
transistor) or a passive pullup (Rwpu resistor) will be used to drive
a 1-Wire line from low to high. When APU = 0, active pullup is disabled
(resistor mode). Active Pullup should always be selected unless there is
only a single slave on the 1-Wire line."
According to the module author, Ben Gardner:
"It doesn't look like active pullup would cause any hurt if there
is only a single slave."
And my tests with multiple and single slaves on 1-Wire bus
confirms that.
This active pullup can be manually disabled using the introduced
module parameter:
active_pullup = 0
nvmem uses regmap_raw_read/write apis to read/write data from providers,
regmap raw apis stopped working with recent kernels which removed raw
accessors on mmio bus. This resulted in broken nvmem for providers
which are based on regmap mmio bus. This issue can be fixed temporarly
by moving to other regmap apis, but we might hit same issue in future.
Moving to interfaces based on read/write callbacks from providers would
be more robust.
This patch removes regmap dependency from nvmem and introduces
read/write callbacks from the providers.
Without this patch nvmem providers like qfprom based on regmap mmio
bus would not work.
Aaron Sierra [Sun, 24 Apr 2016 20:11:38 +0000 (15:11 -0500)]
vme: add vme_init_bridge for common bridge init
Consolidate vme_bridge structure setup that every bridge was required
to do itself. This came about because .irq_mtx is only used within the
VME core, but was required to be setup externally.
This returns the structure passed in to support shorthand like this:
We set host_specified_ha_region = true on certain request but this is a
global state which stays 'true' forever. We need to reset it when we
receive a request where ha_region is not specified. I did not see any
real issues, the bug was found by code inspection.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Drivers: hv: balloon: don't crash when memory is added in non-sorted order
When we iterate through all HA regions in handle_pg_range() we have an
assumption that all these regions are sorted in the list and the
'start_pfn >= has->end_pfn' check is enough to find the proper region.
Unfortunately it's not the case with WS2016 where host can hot-add regions
in a different order. We end up modifying the wrong HA region and crashing
later on pages online. Modify the check to make sure we found the region
we were searching for while iterating. Fix the same check in pfn_covered()
as well.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Drivers: hv: vmbus: handle various crash scenarios
Kdump keeps biting. Turns out CHANNELMSG_UNLOAD_RESPONSE is always
delivered to the CPU which was used for initial contact or to CPU0
depending on host version. vmbus_wait_for_unload() doesn't account for
the fact that in case we're crashing on some other CPU we won't get the
CHANNELMSG_UNLOAD_RESPONSE message and our wait on the current CPU will
never end.
Do the following:
1) Check for completion_done() in the loop. In case interrupt handler is
still alive we'll get the confirmation we need.
2) Read message pages for all CPUs message page as we're unsure where
CHANNELMSG_UNLOAD_RESPONSE is going to be delivered to. We can race with
still-alive interrupt handler doing the same, add cmpxchg() to
vmbus_signal_eom() to not lose CHANNELMSG_UNLOAD_RESPONSE message.
3) Cleanup message pages on all CPUs. This is required (at least for the
current CPU as we're clearing CPU0 messages now but we may want to bring
up additional CPUs on crash) as new messages won't be delivered till we
consume what's pending. On boot we'll place message pages somewhere else
and we won't be able to read stale messages.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Hyper-V VMs can be replicated to another hosts and there is a feature to
set different IP for replicas, it is called 'Failover TCP/IP'. When
such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message as soon
as we finish negotiation procedure. The problem is that it can happen (and
it actually happens) before userspace daemon connects and we reply with
HV_E_FAIL to the message. As there are no repetitions we fail to set the
requested IP.
Solve the issue by postponing our reply to the negotiation message till
userspace daemon is connected. We can't wait too long as there is a
host-side timeout (cca. 75 seconds) and if we fail to reply in this time
frame the whole KVP service will become inactive. The solution is not
ideal - if it takes userspace daemon more than 60 seconds to connect
IP Failover will still fail but I don't see a solution with our current
separation between kernel and userspace parts.
Other two modules (VSS and FCOPY) don't require such delay, leave them
untouched.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
misc: sram: fix check of devm_ioremap*() return value
Both devm_ioremap() and devm_ioremap_wc() functions return either
a pointer to valid iomem region or NULL, check for IS_ERR() is improper
and may result in oops on error path. Now on error -ENOMEM is returned.
Fixes: 0ab163ad1ea0 ("misc: sram: switch to ioremap_wc from ioremap") Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Mon, 7 Mar 2016 11:35:50 +0000 (17:05 +0530)]
spmi: do not use bus internal data
The variable p is a data structure which is used by the driver core
internally and it is not expected that busses will be directly accessing
these driver core internal only data.
A control message reply may not be received if either a link reset has
occurred or disconnection is initiated by the FW.
In the both cases the client state will be set straight to DISCONNECTED
and the driver will wait till timeout.
Adding DISCONNECTED state in the waiting condition will release the
client from the stall.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When a message is received and amthif client is not in reading state
the message is ignored and left dangling in the queue. This may happen
after one of the amthif host connections is closed w/o completing the
reading. Another client will pick up a wrong message on next read
attempt which will lead to link reset.
To prevent this the driver has to properly discard the message when
amthif client is not in reading state.
Cc: <stable@vger.kernel.org> #4.2+ Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Global me_client_index is used only during the enumeration process and
can be effectively replaced by me_addr data from the last enumeration
response as we always enumerate clients in the increasing order.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If devm_add_action() fails we are explicitly calling dma_unmap_single(),
pci_unmap_single() and kfree(). Lets use the helper
devm_add_action_or_reset() and return directly in case of error, as we
know that the cleanup function has been already called by the helper if
there was any error. At that same time remove the variable rc which
becomes unused now.
drivers:hv: Separate out frame buffer logic when picking MMIO range
Simplify the logic that picks MMIO ranges by pulling out the
logic related to trying to lay frame buffer claim on top of where
the firmware placed the frame buffer.
Signed-off-by: Jake Oshins <jakeo@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers:hv: Record MMIO range in use by frame buffer
Later in the boot sequence, we need to figure out which memory
ranges can be given out to various paravirtual drivers. The
hyperv_fb driver should, ideally, be placed right on top of
the frame buffer, without some other device getting plopped on
top of this range in the meantime. Recording this now allows
that to be guaranteed.
Signed-off-by: Jake Oshins <jakeo@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers:hv: Track allocations of children of hv_vmbus in private resource tree
This patch changes vmbus_allocate_mmio() and vmbus_free_mmio() so
that when child paravirtual devices allocate memory-mapped I/O
space, they allocate it privately from a resource tree pointed
at by hyperv_mmio and also by the public resource tree
iomem_resource. This allows the region to be marked as "busy"
in the private tree, but a "bridge window" in the public tree,
guaranteeing that no two bridge windows will overlap each other
but while also allowing the PCI device children of the bridge
windows to overlap that window.
One might conclude that this belongs in the pnp layer, rather
than in this driver. Rafael Wysocki, the maintainter of the
pnp layer, has previously asked that we not modify the pnp layer
as it is considered deprecated. This patch is thus essentially
a workaround.
Signed-off-by: Jake Oshins <jakeo@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers:hv: Make a function to free mmio regions through vmbus
This patch introduces a function that reverses everything
done by vmbus_allocate_mmio(). Existing code just called
release_mem_region(). Future patches in this series
require a more complex sequence of actions, so this function
is introduced to wrap those actions.
Signed-off-by: Jake Oshins <jakeo@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers:hv: Lock access to hyperv_mmio resource tree
In existing code, this tree of resources is created
in single-threaded code and never modified after it is
created, and thus needs no locking. This patch introduces
a semaphore for tree access, as other patches in this
series introduce run-time modifications of this resource
tree which can happen on multiple threads.
Signed-off-by: Jake Oshins <jakeo@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Drivers: hv: vmbus: Implement APIs to support "in place" consumption of vmbus packets
Implement APIs for in-place consumption of vmbus packets. Currently, each
packet is copied and processed one at a time and as part of processing
each packet we potentially may signal the host (if it is waiting for
room to produce a packet).
These APIs help batched in-place processing of vmbus packets.
We also optimize host signaling by having a separate API to signal
the end of in-place consumption. With netvsc using these APIs,
on an iperf run on average I see about 20X reduction in checks to
signal the host.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Drivers: hv: vmbus: Use READ_ONCE() to read variables that are volatile
Use the READ_ONCE macro to access variabes that can change asynchronously.
This is the recommended mechanism for dealing with "unsafe" compiler
optimizations.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()
On the consumer side, we have interrupt driven flow management of the
producer. It is sufficient to base the signaling decision on the
amount of space that is available to write after the read is complete.
The current code samples the previous available space and uses this
in making the signaling decision. This state can be stale and is
unnecessary. Since the state can be stale, we end up not signaling
the host (when we should) and this can result in a hang. Fix this
problem by removing the unnecessary check. I would like to thank
Arseney Romanenko <arseneyr@microsoft.com> for pointing out this issue.
Also, issue a full memory barrier before making the signaling descision
to correctly deal with potential reordering of the write (read index)
followed by the read of pending_sz.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Tested-by: Dexuan Cui <decui@microsoft.com> Cc: <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The drivers which depends on parport may sometimes try to iniitialize
and register with parport bus even before parport has actually
registered with the device layer.
The simplest solution is to mark the init function as subsys_initcall()
and load the parport before the other drivers loads.