Resolve a race condition whereby a buffer could be freed
by the SSR handler while being operated upon by the transfer
callback.
Change-Id: I5e62b04166b2a8a9867047574c7232739229c911
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
A race condition exists in MHI_UCI whereby a client could receive
a buffer, inconsistent with the return code from MHI.
Change-Id: I4a932ea608ce967c1588f092c60d03747bad2064
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Enable ftrace events in MHI for the tracing of power
state transitions.
Change-Id: I74373b7429c6d7316c4a66db141cc09e2a4418dd
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
The pending TRE iterator is not properly initialized
and checked against, leading to an incorrect number of
TREs getting processed.
CRs-Fixed: 748475
Change-Id: Ie8609edd1a89d8dc14bf781612357d7dc524f83a
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Enabled sanity check for LPM IOCTL in MHI. IOCTL should not
be called into MHI, if the device is not ready.
CRs-Fixed: 749894
Change-Id: I52627a94e70e3b17130653b7b73a86b417807842
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Reorder operations on MHI TRE to prevent a race condition
of publishing the TRE to the device before the TRE is fully
populated.
CRs-Fixed: 726655
Change-Id: Ide208c77c93f0e68eee0c6c304eaebc451028341
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
The doorbell value for the event ring must be sampled within
spinlock context or the value could be stale when written.
CRs-Fixed: 746401
Change-Id: I4eb5095f34b890e02fee48c22206afcbfd70a454
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
A timing window exists where M3 state transition is pending and
the doorbell does not get written out. The M3 process is then
cancelled, and no M0 event takes place to flush the doorbell out.
Remove setting the pending M3 flag until the transition is no
longer cancelable.
CRs-Fixed: 733632
Change-Id: I3b4dfe23d0ea4af69d2810a171c61dc60a6c2f8d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Enabled event ring context updates regardless of MHI
power state.
Change-Id: I910d056d53f7c940caea48546c206d4603e8a4b9
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
After a channel reset, any pending acks on that channel
will not be received from the device.
In this case they must be cleared in the channel reset
command handling.
CRs-Fixed: 733172
Change-Id: I5b7c525f7f532ed107caa020cde33ec1955ae618
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Resolve issue whereby a deadblock is encountered when trying
to put the interface down.
Change-Id: I757492fceff56014b28ec50307f6d84b1bb81889
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Fixed a race condition in MHI RmNet where the RX interrupt
could remain masked forever.
CRs-Fixed: 723355
Change-Id: I9606963b8b2d6d1cb125c0bc7be8610b06f67be3
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Fix race condition in MHI RmNet whereby the outbound
MHI ring could be empty while the network stack believes
it is full. This leads to a non recoverable data stall.
Add rwlock to ensure checks for full and empty conditions
are atomic.
CRs-Fixed: 733646
Change-Id: If54baa4be762a976d64213d0ec52e969f2497036
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Reset the pending packets counter in UCI when a client releases
the character device node.
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Change-Id: Ic3d83873ae207e76acbb9f60683b43cb30ff7c5b
Resolve issue regarding BHI image load process.
Interface will no longer be published to userspace
before local initialization is complete.
Register masks and retry mechanism are also cleaned up.
Change-Id: I05d87d4be5e9c05c6beb2b7b0c0234757b93097d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Add the msmzirc device in the list of supported PCI devices
by the MHI driver to enable to PCIe framework to probe MHI
in the event of discovering this device on the bus.
CRs-Fixed: 736039
Change-Id: I66eb5f67885d60c579c33c47ce696d66c6c428b5
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Remove the incorrect direct de-reference of device mapped
IO mememory and replace with kernel standard handlers.
CRs-Fixed: 728285
Change-Id: I0b3afe8a62369057b4a6b45b1a71bd9f5a52ce1d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Enable the MHI core driver for communication
between host and device using PCIe as an interconnect
and supporting MHI as the communication protocol.
The driver exposes several kernel space APIs
for use by other kernel entities to interface to
the PCIe device over MHI.
APIs for read and write and other notifications
are supported by this MHI driver.
Support for full power management and device reset
is also included.
CRs-Fixed: 689329
Change-Id: Ibc2fd7c2d5689001485f71b1133ada2c4ca236a9
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Add MHI RmNet driver to support exposure of an
MHI device as a network interface to the Linux
networking stack.
The MHI channels are exposed as a standard network
interface which supports the NAPI framework.
IOCTLs for setting MTU/MRU and LPM are also enabled.
CRs-Fixed: 689329
Change-Id: I9540c78acccec35aff4ee4dc36241c6f08cdf04c
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
The MHI UCI driver exposes MHI core functionality to
userspace by means of device nodes.
The UCI driver exposes a device node for a pair of unidirectional
MHI channels.
The supported system calls on the device nodes are read, write,
select/poll and RS232 IOCTLs.
CRs-Fixed: 689329
Change-Id: Iceab97dba7c3bbb4eb7bf0c4ab0c1eac8c5417e9
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
When a deferrable work (INIT_DEFERRABLE_WORK, etc.) is queued via
queue_delayed_work() it's probably intended to run the work item on any
CPU that isn't idle. However, we queue the work to run at a later time
by starting a deferrable timer that binds to whatever CPU the work is
queued on which is same with queue_delayed_work_on(smp_processor_id())
effectively.
As a result WORK_CPU_UNBOUND work items aren't really cpu unbound now.
In fact this is perfectly fine with UP kernel and also won't affect much a
system without dyntick with SMP kernel too as every cpus run timers
periodically. But on SMP systems with dyntick current implementation leads
deferrable timers not very scalable because the timer's base which has
queued the deferrable timer won't wake up till next non-deferrable timer
expires even though there are possible other non idle cpus are running
which are able to run expired deferrable timers.
The deferrable work is a good example of the current implementation's
victim like below.
INIT_DEFERRABLE_WORK(&dwork, fn);
CPU 0 CPU 1
queue_delayed_work(wq, &dwork, HZ);
queue_delayed_work_on(WORK_CPU_UNBOUND);
...
__mod_timer() -> queues timer to the
current cpu's timer
base.
...
tick_nohz_idle_enter() -> cpu enters idle.
A second later
cpu 0 is now in idle. cpu 1 exits idle or wasn't in idle so
now it's in active but won't
cpu 0 won't wake up till next handle cpu unbound deferrable timer
non-deferrable timer expires. as it's in cpu 0's timer base.
To make all cpu unbound deferrable timers are scalable, introduce a common
timer base which is only for cpu unbound deferrable timers to make those
are indeed cpu unbound so that can be scheduled by tick_do_timer_cpu.
This common timer fixes scalability issue of delayed work and all other cpu
unbound deferrable timer using implementations.
Change-Id: I8b6c57d8b6445a76fa02a8cb598a8ef22aef7200
CC: Thomas Gleixner <tglx@linutronix.de>
CC: John Stultz <john.stultz@linaro.org>
CC: Tejun Heo <tj@kernel.org>
[joonwoop@codeaurora.org: timer->base replaced with CPU index so get
the deferrable timer wheel from lock_timer_base() instead of
do_init_timer().]
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ADSP Loader is required for the audio probes and memlat governor
is crashing right now so we should keep it disabled for now.
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Different kernel version needs to use different kernel APIs for
hotplug. Add wrapper for CPU hotplug so that external module can be
used across different kernel releases.
Use device_online/offline() API for CPU hotplug.
Change-Id: Id21855f4ddc62bc9e9e6b45a856c245fd18d1514
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Some applications still include android_pmem.h although all the
functionality for it is gone from the kernel. Keep this header
file around until all such users have removed the include.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
of_flat_dt_get_machine_name() API is marked as __init so
machine_name should be made as an extern in-order to get
it accessed by the cpuinfo.c. In the earlier kernel revisions
the usage was restricted to the one file setup.c only and
due to which we didn't faced any issue.
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Updated APIs used in msm_rng to be built on kernel version 4.4.
Acked-by: Shabnam Aboughadareh <shabnama@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This snapshot is taken as of msm-3.18 commit e70ad0cd
(Promotion of kernel.lnx.3.18-151201.)
Acked-by: Shabnam Aboughadareh <shabnama@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
The perf event permission checks are necessary because they introduce
a security concern where one userspace task can monitor another task
and gain security related information. That concern doesn't exist for
kernel owned perf events since the kernel already has access to
everything. So, skip permission checks for kernel owned perf events.
Change-Id: I7121f5e03cf6ce8f0bfc9b5a69488efb80a97051
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
An incorrect pointer to the event was being passed, instead of
pointer to the remove event struct. Pass the correct pointer.
Change-Id: I7c35c5bb3a14d74a9b36c3d1dbd7af0bf80e7efe
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
Hotplug disables the pmu irq, but if counters are
running in the window before the CPU is hotplugged off
they can overflow and generate an interrupt. Because the
interrupt is disabled, this prevents the cpu from going
down.
Events are stopped during hotplug processing. However,
perf is hooked into the timer tick, and restarts enabled
events on every tick, even if they were stopped. Change
the event state to OFF to prevent this.
CPUs can still be power-collapsed while being hotplugged
off, but hotplug processing will save and restore the correct
state, so don't process power-collapse save/restore while
hotplug is in process.
Processing for stop reads the counters, so a separate call
is no longer needed. Start processing re-enables events so
the from_idle flag is not needed during pmu_enable.
Change-Id: I6a7f5b04955ebba8c4d76547f24e2be4071d7539
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
[satyap: merge conflict resolution and move changes in
arch/arm64/kernel/perf_event.c to drivers/perf/arm_pmu.c
to align with kernel 4.4]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Reset will overwrite registers written by
restore_pm_registers, so order the calls correctly.
Change-Id: I8210d61c2f4c2397efb2de801d94ed1d5aad480c
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
[satyap: merge conflict resolution and move changes in
arch/arm64/kernel/perf_event.c to drivers/perf/arm_pmu.c
to align with kernel 4.4]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
PMU irq is disabled when a cpu is hotplugged off
and perf is running. Using cpu_pmu->active_events
to determine if the pmu is running left a window
where it is decremented to 0 in hw_perf_event_destroy,
and then armpmu_release_hardware is called. If a cpu
is hotplugged off in this window it may not disable
its irq. Use a separate flag which is not cleared
until after the irq is released by all online cpus.
The variable needs to be tristate because of the possibility
of a cpu being hotplugged in during this window. In that
case it should not enable its irq when the pmu is being
shut down. Having the GOING_DOWN state allows correct
behavior for cpus both going down and coming up.
Change-Id: I934ba5dec34e681ce8defd7fa7e311b4a2a92c1a
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
[satyap: merge conflict resolution and move changes in
arch/arm64/kernel/perf_event.c to drivers/perf/arm_pmu.c
to align with kernel 4.4]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Add notifiers for hotplug and power collapse in perf events.
Preserve counters and user enables across these events.
Disable and enable interrupts across events.
This allows perf-events to be used in an environment where
cores are power collapsing and being hotplugged.
Change-Id: Id27ac3b1c0733677e0bc9740ce7534c3e5fdac7c
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
[satyap: merge conflict resolution and move changes in
arch/arm64/kernel/perf_event.c to drivers/perf/arm_pmu.c
to align with kernel 4.4]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
While porting kryo CPU PMU driver to kernel 4.4, some functionality
got dropped unintentionally. This commit adds the dropped functionality
back. Also, update driver to be compliant to kernel 4.4.
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Enable OPTIMIZE_FOR_SIZE for msmcobalt debug and perf.
defconfigs and also fix one of the warning in the
EDAC driver.
8996 defconfig is also auto-updated during the build.
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Instead of #ifdef, use the IS_ENABLED() macro which correctly
handles if the Kconfig symbol is built-in (=y) or a module (=m).
Also add missing MODULE_LICENSE and MODULE_DESCRIPTION to
f_diag.c to allow building as a module.
Signed-off-by: Jack Pham <jackp@codeaurora.org>
To allow msm_iommu kernel test compilation, add a
iommu_unmap_range declaration and the corresponding stub
function.
Change-Id: If80918cc01afa7d0df2673f4e1962989af26f4bf
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
msm_iommu kernel test has a dependency on
include/linux/msm_iommu_domains.h header file.
Add a snapshot of this file to allow msm_iommu kernel test
compilation.
Change-Id: I2c9b634bdc8a06e51d139fc610c9005d9c93f4ee
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
The function regulator_set_optimum_mode has been changed
to regulator_set_load from regulator code. Also rename
regulator_set_mode_check to follow naming convention.
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
Enable hbtp_input driver to support host based touch processing.
Change-Id: Id56beccb53a0c64210e318a3a0a7f1a8d5d2bc27
Signed-off-by: Jing Lin <jinglin@codeaurora.org>
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
Add support for the digital regulator in hbtp_input driver.
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
Change-Id: I315d4b4c985917e55823a3c3951f2bffb20b39e6