If clients use custom serialization functions, then they may need to
define a version for deserialization support for log extraction.
Add client version support.
Change-Id: Id135f06d4142de39275b5d0caab88708d5496b5e
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Use pin control standard macros to check the pin
control handle in the platform device structure.
Change-Id: I1710ca253446876096759b7cd120d1e5b82f3ab3
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Smd tty device index read by old device tree label causing the
clean-up code to exit abruptly and resulting in a crash during
re-registration with fall back option.
Read the smd tty device index with proper label and do the clean-up
complete.
CRs-Fixed: 669452
Change-Id: Ib317a035e51ca8040b199bc1a9986b731e59410d
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Increase the receive efficiency by providing more DMA resources
and avoiding changing ready for receive line when not necessary.
CRs-Fixed: 648827
Change-Id: Ieebb761cb71373a696a82feb69fdd1e206d1d659
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Make sure clock-off request completes before closing the port to
avoid unclocked hardware access.
CRs-Fixed: 648827
Change-Id: I953a06c104830c5515551d5edc4dd9c9a037203f
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
The tty atomic_write_lock does not provide an exclusion guarantee for
the tty driver if the termios settings are LECHO & !OPOST. And since
it is unexpected and not allowed to call TTY buffer helpers like
tty_insert_flip_string concurrently, this may lead to crashes when
concurrect writers call pty_write. In that case the following two
writers:
* the ECHOing from a workqueue and
* pty_write from the process
race and can overflow the corresponding TTY buffer like follows.
If we look into tty_insert_flip_string_fixed_flag, there is:
int space = __tty_buffer_request_room(port, goal, flags);
struct tty_buffer *tb = port->buf.tail;
...
memcpy(char_buf_ptr(tb, tb->used), chars, space);
...
tb->used += space;
so the race of the two can result in something like this:
A B
__tty_buffer_request_room
__tty_buffer_request_room
memcpy(buf(tb->used), ...)
tb->used += space;
memcpy(buf(tb->used), ...) ->BOOM
B's memcpy is past the tty_buffer due to the previous A's tb->used
increment.
Since the N_TTY line discipline input processing can output
concurrently with a tty write, obtain the N_TTY ldisc output_lock to
serialize echo output with normal tty writes. This ensures the tty
buffer helper tty_insert_flip_string is not called concurrently and
everything is fine.
Note that this is nicely reproducible by an ordinary user using
forkpty and some setup around that (raw termios + ECHO). And it is
present in kernels at least after commit
d945cb9cce (pty: Rework the pty layer to
use the normal buffering logic) in 2.6.31-rc3.
js: add more info to the commit log
js: switch to bool
js: lock unconditionally
js: lock only the tty->ops->write call
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I9e235db6ec2bb950f26bd8a23f6145dab5dc0a15
Git-commit: 4291086b1f081b869c6d79e5b7441633dc3ace00
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Avijit Kanti Das <avijitnsec@codeaurora.org>
Move required logs from DEBUG level to INFO level
and reduce the tx/rx data to be logged only first and
last 10 bytes in INFO level.
CRs-Fixed: 593862
Change-Id: I8e01ae77f7da3386fc77713b28443b19c0704eb0
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
commit 4291086b1f081b869c6d79e5b7441633dc3ace00 upstream.
The tty atomic_write_lock does not provide an exclusion guarantee for
the tty driver if the termios settings are LECHO & !OPOST. And since
it is unexpected and not allowed to call TTY buffer helpers like
tty_insert_flip_string concurrently, this may lead to crashes when
concurrect writers call pty_write. In that case the following two
writers:
* the ECHOing from a workqueue and
* pty_write from the process
race and can overflow the corresponding TTY buffer like follows.
If we look into tty_insert_flip_string_fixed_flag, there is:
int space = __tty_buffer_request_room(port, goal, flags);
struct tty_buffer *tb = port->buf.tail;
...
memcpy(char_buf_ptr(tb, tb->used), chars, space);
...
tb->used += space;
so the race of the two can result in something like this:
A B
__tty_buffer_request_room
__tty_buffer_request_room
memcpy(buf(tb->used), ...)
tb->used += space;
memcpy(buf(tb->used), ...) ->BOOM
B's memcpy is past the tty_buffer due to the previous A's tb->used
increment.
Since the N_TTY line discipline input processing can output
concurrently with a tty write, obtain the N_TTY ldisc output_lock to
serialize echo output with normal tty writes. This ensures the tty
buffer helper tty_insert_flip_string is not called concurrently and
everything is fine.
Note that this is nicely reproducible by an ordinary user using
forkpty and some setup around that (raw termios + ECHO). And it is
present in kernels at least after commit
d945cb9cce (pty: Rework the pty layer to
use the normal buffering logic) in 2.6.31-rc3.
js: add more info to the commit log
js: switch to bool
js: lock unconditionally
js: lock only the tty->ops->write call
References: CVE-2014-0196
Reported-and-tested-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit b790f210fe8423eff881b2a8a93ba5dbc45534d0 upstream.
The sleep function was updated to put the serial port to sleep only when necessary.
This appears to resolve the errant behavior of the driver as described in
Kernel Bug 61961 – "My Exar Corp. XR17C/D152 Dual PCI UART modem does not
work with 3.8.0".
Signed-off-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 501fed45b7e8836ee9373f4d31e2d85e3db6103a upstream.
When 'console=hvc0' is specified to the kernel parameter in x86 KVM guest,
hvc console is setup within a kthread. However, that will cause SEGV
and the boot will fail when the driver is builtin to the kernel,
because currently hvc_console_setup() is annotated with '__init'. This
patch removes '__init' to boot the guest successfully with 'console=hvc0'.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit f76a1cbed18c86e2d192455f0daebb48458965f3 upstream.
Commit 3e6c6f630a ("Delay creation of
khcvd thread") moved the call of hvc_init from being a device_initcall
into hvc_alloc, and used a non-null hvc_driver as indication of whether
hvc_init had already been called.
The problem with this is that hvc_driver is only assigned a value
at the bottom of hvc_init, and so there is a window where multiple
hvc_alloc calls can be in progress at the same time and hence try
and call hvc_init multiple times. Previously the use of device_init
guaranteed that hvc_init was only called once.
This manifests itself as sporadic instances of two hvc_init calls
racing each other, and with the loser of the race getting -EBUSY
from tty_register_driver() and hence that virtual console fails:
Couldn't register hvc console driver
virtio-ports vport0p1: error -16 allocating hvc for port
Here we add an atomic_t to guarantee we'll never run hvc_init twice.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 3e6c6f630a ("Delay creation of khcvd thread")
Reported-by: Jim Somerville <Jim.Somerville@windriver.com>
Tested-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 723abd87f6e536f1353c8f64f621520bc29523a3 upstream.
The 'active' sysfs attribute should refer to the currently active tty
devices the console is running on, not the currently active console. The
console structure doesn't refer to any device in sysfs, only the tty the
console is running on has. So we need to print out the tty names in
'active', not the console names.
There is one special-case, which is tty0. If the console is directed to
it, we want 'tty0' to show up in the file, so user-space knows that the
messages get forwarded to the active VT. The ->device() callback would
resolve tty0, though. Hence, treat it special and don't call into the VT
layer to resolve it (plymouth is known to depend on it).
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Kay Sievers <kay@vrfy.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If client initiates a Tx operation when UART clocks are
Off, the driver should not attempt to send data, as this
would result in interacting with unclocked hardware. Add
support to detect this condition and avoid writing to an
unclocked device.
Add a null check after memory allocation.
CRs-Fixed: 629870
Change-Id: I001516e731e73881a29d768d9fb1bf759f3419b9
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Enhance IPC logging in the UART driver by removing the redundant
data.
Change-Id: I201a0e0b165745423ef769211d09778e9517118c
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Ensure that the port configuration, data transfer activities
occur when hardware resources are available by voting for them
as the client may call shutdown and clock off asynchronously.
CRs-Fixed: 616127
Change-Id: I7ab171c2176589a54b839cfee8bb33840b55abed
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
In the smux local loopback unit tests, the get_rx_buff_retry_auto
test fails due to a retry counter being tested prior to waiting
for an smux write completion. This causes the event to be detected
in the next loop, which causes the rx retry watermark to be greater
than the maximum retry, which causes a false unit test failure.
Move counter increment to after the smux write completion.
Change-Id: Iee5d296b4dc38eae5ceb4eb45343b10f00ce37fa
Signed-off-by: Steven Cahail <scahail@codeaurora.org>
Add support for pinctrl apis to get and configure GPIOs
in HS UART driver.
CRs-Fixed: 620014
Change-Id: I07a65dabf77283242df06fa4392d8d7e0d0b16e8
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Handle address pointers appropriately in different architectures
and move platform data to architecture independent directory.
Client modules are changed to include the header from new location.
CRs-Fixed: 647392
Change-Id: I23bf3986b8fdb0337a528038c79535b919226128
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Remove support for all pre BLSP Hardware such as Data Mover
DMA and GSBI. Clean up all checks for non BLSP hardware and
refactor the code.
CRs-Fixed: 647392
Change-Id: I2df3d036b0ce4a16d5a693059ca4bc51f17eef85
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
SMD_TTY driver holds a wakeup source for 500ms to provide enough time
to notify the user client waiting for data. However, when system is in
suspend state the 500ms timer may not be sufficient to notify the
user clients because in some cases system resume of devices and tasks
is taking more time and this causes delay in client notification.
Register for PM_SUSPEND_PREPARE and PM_POST_SUSPEND events to track
system suspend and resume state and then notify the clients after system
resume completes.
CRs-Fixed: 613589
Change-Id: Iffb2ecb1c58f46e0c4a745cdcce2fb717ea2ece8
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
The following commits have been reverted from this merge, as they are
known to introduce new bugs and are currently incompatible with our
audio implementation. Investigation of these commits is ongoing, and
they are expected to be brought in at a later time:
86e6de7 ALSA: compress: fix drain calls blocking other compress functions (v6)
16442d4 ALSA: compress: fix drain calls blocking other compress functions
This merge commit also includes a change in block, necessary for
compilation. Upstream has modified elevator_init_fn to prevent race
conditions, requring updates to row_init_queue and test_init_queue.
* commit 'v3.10.28': (1964 commits)
Linux 3.10.28
ARM: 7938/1: OMAP4/highbank: Flush L2 cache before disabling
drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
serial: amba-pl011: use port lock to guard control register access
mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL
md/raid5: Fix possible confusion when multiple write errors occur.
md/raid10: fix two bugs in handling of known-bad-blocks.
md/raid10: fix bug when raid10 recovery fails to recover a block.
md: fix problem when adding device to read-only array with bitmap.
drm/i915: fix DDI PLLs HW state readout code
nilfs2: fix segctor bug that causes file system corruption
thp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only
ftrace/x86: Load ftrace_ops in parameter not the variable holding it
SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()
writeback: Fix data corruption on NFS
hwmon: (coretemp) Fix truncated name of alarm attributes
vfs: In d_path don't call d_dname on a mount point
staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()
staging: comedi: addi_apci_1032: fix subdevice type/flags bug
mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully
GFS2: Increase i_writecount during gfs2_setattr_chown
perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h
perf scripting perl: Fix build error on Fedora 12
ARM: 7815/1: kexec: offline non panic CPUs on Kdump panic
Linux 3.10.27
sched: Guarantee new group-entities always have weight
sched: Fix hrtimer_cancel()/rq->lock deadlock
sched: Fix cfs_bandwidth misuse of hrtimer_expires_remaining
sched: Fix race on toggling cfs_bandwidth_used
x86, fpu, amd: Clear exceptions in AMD FXSAVE workaround
netfilter: nf_nat: fix access to uninitialized buffer in IRC NAT helper
SCSI: sd: Reduce buffer size for vpd request
intel_pstate: Add X86_FEATURE_APERFMPERF to cpu match parameters.
mac80211: move "bufferable MMPDU" check to fix AP mode scan
ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS
ACPI / TPM: fix memory leak when walking ACPI namespace
mfd: rtsx_pcr: Disable interrupts before cancelling delayed works
clk: exynos5250: fix sysmmu_mfc{l,r} gate clocks
clk: samsung: exynos5250: Add CLK_IGNORE_UNUSED flag for the sysreg clock
clk: samsung: exynos4: Correct SRC_MFC register
clk: clk-divider: fix divisor > 255 bug
ahci: add PCI ID for Marvell 88SE9170 SATA controller
parisc: Ensure full cache coherency for kmap/kunmap
drm/nouveau/bios: make jump conditional
ARM: shmobile: mackerel: Fix coherent DMA mask
ARM: shmobile: armadillo: Fix coherent DMA mask
ARM: shmobile: kzm9g: Fix coherent DMA mask
ARM: dts: exynos5250: Fix MDMA0 clock number
ARM: fix "bad mode in ... handler" message for undefined instructions
ARM: fix footbridge clockevent device
net: Loosen constraints for recalculating checksum in skb_segment()
bridge: use spin_lock_bh() in br_multicast_set_hash_max
netpoll: Fix missing TXQ unlock and and OOPS.
net: llc: fix use after free in llc_ui_recvmsg
virtio-net: fix refill races during restore
virtio_net: don't leak memory or block when too many frags
virtio-net: make all RX paths handle errors consistently
virtio_net: fix error handling for mergeable buffers
vlan: Fix header ops passthru when doing TX VLAN offload.
net: rose: restore old recvmsg behavior
rds: prevent dereference of a NULL device
ipv6: always set the new created dst's from in ip6_rt_copy
net: fec: fix potential use after free
hamradio/yam: fix info leak in ioctl
drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
net: inet_diag: zero out uninitialized idiag_{src,dst} fields
ip_gre: fix msg_name parsing for recvfrom/recvmsg
net: unix: allow bind to fail on mutex lock
ipv6: fix illegal mac_header comparison on 32bit
netvsc: don't flush peers notifying work during setting mtu
tg3: Initialize REG_BASE_ADDR at PCI config offset 120 to 0
net: unix: allow set_peek_off to fail
net: drop_monitor: fix the value of maxattr
ipv6: don't count addrconf generated routes against gc limit
packet: fix send path when running with proto == 0
virtio: delete napi structures from netdev before releasing memory
macvtap: signal truncated packets
tun: update file current position
macvtap: update file current position
macvtap: Do not double-count received packets
rds: prevent BUG_ON triggered on congestion update to loopback
net: do not pretend FRAGLIST support
IPv6: Fixed support for blackhole and prohibit routes
HID: Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue""
gpio-rcar: R-Car GPIO IRQ share interrupt
clocksource: em_sti: Set cpu_possible_mask to fix SMP broadcast
irqchip: renesas-irqc: Fix irqc_probe error handling
Linux 3.10.26
sh: add EXPORT_SYMBOL(min_low_pfn) and EXPORT_SYMBOL(max_low_pfn) to sh_ksyms_32.c
ext4: fix bigalloc regression
arm64: Use Normal NonCacheable memory for writecombine
arm64: Do not flush the D-cache for anonymous pages
arm64: Avoid cache flushing in flush_dcache_page()
ARM: KVM: arch_timers: zero CNTVOFF upon return to host
ARM: hyp: initialize CNTVOFF to zero
clocksource: arch_timer: use virtual counters
arm64: Remove unused cpu_name ascii in arch/arm64/mm/proc.S
arm64: dts: Reserve the memory used for secondary CPU release address
arm64: check for number of arguments in syscall_get/set_arguments()
arm64: fix possible invalid FPSIMD initialization state
...
Change-Id: Ia0e5d71b536ab49ec3a1179d59238c05bdd03106
Signed-off-by: Ian Maund <imaund@codeaurora.org>
UART Core is showing inconsistent behaviour in firing
Stale Timeout Interrupt. Stale Timeout is not happening
at some points. After programming the BCR register the
Stale Timeout is happening as expected.
Also fix the BCR register offset to avoid instablilities when
console is disabled.
CRs-Fixed: 590176, 628523
Change-Id: I5a2522b87fe0951cad80e56f8f880c214d2d3bb5
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Removing code dependency on the flag and check the
circular buffer directly and make sure that spin lock is taken
appropriately in the tx lower half.
This avoids the condition that can cause
1. tx lower half
2. submit tx command
to race.
CRs-Fixed: 621210
Change-Id: I344a72c3eb9770391576fa0e8f0a8da1ee50ea5b
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
IRQs are disabled/enabled twice in the clock off and
clock on operations. This patch removes the extra irq
operations.
Change-Id: I4325bfe8792b1f97f232ac26c17ab17c4ddffa6e
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Moves bus scaling code to architecture independant directory
for platform drivers.
Change-Id: Ie0d5b104882d1534fae262af85e99cc09a56ab04
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
XO shutdown doesn't happen as long as the
uart port is kept open even though uart clocks
are switched off. This is because the uart core
interrupt is configured in port open and free'd
in port close.
To avoid this issue uart irq is disabled and
enabled in clock off and clock on respectively.
CRs-Fixed: 606931
Change-Id: I8a8b733b860bfc373fc38c9550955d571d3a70bf
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
smd_tty_close currently has a variable that depends on a race
condition with tty_port_open. This causes a null-pointer dereference
when the same port is simultaneously being opened/closed.
Use data from a static array instead of the variable to eliminate
the race condition.
CRs-Fixed: 624398
Change-Id: Ie55d37feaadd3a15f64e18501cd3af19145dbc8e
Signed-off-by: Steven Cahail <scahail@codeaurora.org>
Keeping UART IRQ enabled all the time will gate XO shutdown in idle
power collapse. Instead, handle enable/disable of irq within clk on/off
functions. Also, making sure that wakeup irq is enabled before uart irq
is disabled.
CRs-Fixed: 606758
Change-Id: I5726fe6811e735ff3dac8d88ea86fd50fda0a61e
Signed-off-by: Girish S Ghongdemath <girishsg@codeaurora.org>
As per the Hardware Data Book recommendation the
TX FIFO watermark level should not be zero.
Hence programing the TX FIFO watermark level to
4 to avoid corner cases
CRs-Fixed: 621214
Change-Id: Icee051bd37c389f31a010b51ffaf5d46854306b5
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Current implementation of wake locks wait for
around 500msec while releasing the wakelock. This
prevents the system suspend for that much time after
the rx operation is done to ensure that all the data
delivered to the client before system suspend.
But some clients may take care of this in their
implementation. In this case uart driver no need to
wait before releasing the wakelock.
Hence, given the control to the client as a dtsi entry
to take decision on waiting before releasing the wakelock.
Change-Id: Ie32a0b76899963e7700ba378906fa4f9b3fa3ba4
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
commit 0930b0950a8996aa88b0d2ba4bb2bab27cc36bc7 upstream.
\E[3J console code (secure clear screen) needs to update_screen(vc)
in order to write-through blanks into off-screen video memory.
This has been removed accidentally in 3.6 by:
commit 81732c3b2f
Author: Jean-François Moine <moinejf@free.fr>
Date: Thu Sep 6 19:24:13 2012 +0200
tty vt: Fix line garbage in virtual console on command line edition
Signed-off-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 3ac06b905655b3ef2fd2196bab36e4587e1e4e4f upstream.
3GPP TS 07.10 states in section 5.4.6.3.7:
"The length byte contains the value 2 or 3 ... depending on the break
signal." The break byte is optional and if it is sent, the length is
3. In fact the driver was not able to work with modems that send this
break byte in their modem status control message. If the modem just
sends the break byte if it is really set, then weird things might
happen.
The code for deconding the modem status to the internal linux
presentation in gsm_process_modem has already a big comment about
this 2 or 3 byte length thing and it is already able to decode the
brk, but the code calling the gsm_process_modem function in
gsm_control_modem does not encode it and hand it over the right way.
This patch fixes this.
Without this fix if the modem sends the brk byte in it's modem status
control message the driver will hang when opening a muxed channel.
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge the second phase of support needed for the 8916
target into msm-3.10. This includes a couple hundred upstream
patches for ARM64 support, as well as 8916 specific driver
development.
* origin/tmp-branch: (211 commits)
ARM: dts: msmplutonium: Update the cpu release address
Revert "arm64: Fix memory shareability attribute for ioremap_wc/cache"
clocksource: arch_timer: Do not register arch_sys_counter twice
xtensa: adjust boot parameters address when INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is selected
sched_clock: Add support for >32 bit sched_clock
sched_clock: Use an hrtimer instead of timer
sched_clock: Use seqcount instead of rolling our own
clocksource: Extract max nsec calculation into separate function
ARM: sched_clock: Load cycle count after epoch stabilizes
sched_clock: Make ARM's sched_clock generic for all architectures
of: move of_get_cpu_node implementation to DT core library
of: introduce common FDT machine related functions
of: Introduce common early_init_dt_scan
mm: allow pgtable_page_ctor() to fail
of: only include prom.h on sparc
mm: introduce helper function mem_init_print_info() to simplify mem_init()
mm: use a dedicated lock to protect totalram_pages and zone->managed_pages
KVM: Move gfn_to_index to x86 specific code
ARM: KVM: move GIC/timer code to a common location
arm64: mm: Fix PMD_SECT_PROT_NONE definition
...
Conflicts:
arch/arm/mach-msm/board-8226.c
arch/arm/mach-msm/board-8610.c
arch/arm64/kernel/asm-offsets.c
arch/arm64/kernel/fpsimd.c
arch/arm64/kernel/setup.c
Change-Id: I289996bc18d8a2782906e7db1171b48e3ee46a73
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
Currently, the functions smd_tty_add_driver and smd_tty_remove_driver
compare the channel name of the driver being added or removed to the
device name of already-registered drivers before completing the add
or remove. This is incorrect and causes driver removal to fail.
Compare the device name of the driver being added or removed instead
of the channel name in both functions (smd_tty_remove_driver and
smd_tty_add_driver).
Change-Id: I6a844428a57d0934ff9a4d7f7311cc933b2a1b80
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
The current implementation of smd_tty_remove_driver does not check to
see if a matching driver instance is found before attempting to
unregister the driver. This could lead to a silent failure or an attempt
to remove a driver that does not exist.
Add a flag that indicates if a matching driver is found in the list
before removal is attempted. If no drivers are found, an error message
is logged.
Change-Id: I30f067b11dbe736ae065c5d4fbe30ca5c0645bb6
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Upstream prefers existing drivers be converted to support multiplatform
kernels. This requires drivers to be located in generic functionality
directories instead of specific mach directories.
Move the smd and smsm drivers to the drivers/soc/qcom location to support
multiplatform.
Change-Id: I7f2e990341f0f34e336e71bd3b06a7c2a46d8bc1
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Git-commit: 0244ad004a54e39308d495fee0a2e637f8b5c317
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[imaund@codeaurora.org: resolve merge conflicts]
Signed-off-by: Ian Maund <imaund@codeaurora.org>
of_match_device passes the hardware version
information as a void pointer. Changing the type to
unsigned long to scale to different architectures.
Address the change in location of header files.
Change-Id: I80c6afb8f6c8bfc40b1f3312b9c1797a7ad48340
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Race Condition:
==============
CPU 0:
1.) Rx BAM pipe got disconnected during Baud Rate Cnfg
2.) Rx tasklet got scheduled
3.) Tasklet is issuing Rx command to BAM
4.) BAM API aquired spinlock and accessed Null Pointer
This lead to Null Pointer Access and Crash
CPU 1:
5.) As part of baud rate configuration process CPU 1
called BAM Rx Connect API
6.) BAM API is trying acquire Spinlock
7.) Spinlock is not released by CPU0
This lead to BUG ON
Fix:
===
During Baud Rate Configuration, if Rx command is queued
set the flag for not issuing any Rx command to BAM
Adding rx_cmd_exec variable to avoid command getting
queued twice without callback for the first
Change-Id: I800180cba22b1d0326147a21f175d06e4641f6c4
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
commit 3685f19e07802ec4207b52465c408f185b66490e upstream.
Tegra chips have 4 or 5 identical UART modules embedded. UARTs C..E have
their MODEM-control signals tied off to a static state. However UARTs A
and B can optionally route those signals to/from package pins, depending
on the exact pinmux configuration.
When these signals are not routed to package pins, false interrupts may
trigger either temporarily, or permanently, all while not showing up in
the IIR; it will read as NO_INT. This will eventually lead to the UART
IRQ being disabled due to unhandled interrupts. When this happens, the
kernel may print e.g.:
irq 68: nobody cared (try booting with the "irqpoll" option)
In order to prevent this, enable UART_BUG_NOMSR. This prevents
UART_IER_MSI from being enabled, which prevents the false interrupts
from triggering.
In practice, this is not needed under any of the following conditions:
* On Tegra chips after Tegra30, since the HW bug has apparently been
fixed.
* On UARTs C..E since their MODEM control signals are tied to the correct
static state which doesn't trigger the issue.
* On UARTs A..B if the MODEM control signals are routed out to package
pins, since they will then carry valid signals.
However, we ignore these exceptions for now, since they are only relevant
if a board actually hooks up more than a 4-wire UART, and no currently
supported board does this. If we ever support a board that does, we can
refine the algorithm that enables UART_BUG_NOMSR to take those exceptions
into account, and/or read a flag from DT/... that indicates that the
board has hooked up and pinmux'd more than a 4-wire UART.
Reported-by: Olof Johansson <olof@lixom.net> # autotester
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 9c5320f8d7d9a2cf623e65d50e1113f34d9b9eb1 upstream.
Fix the initialisation of older Quatech serial cards which are fitted with
the AMCC PCI Matchmaker interface chip.
Signed-off-by: Jonathan Woithe (jwoithe@just42.net)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 0cc7c6c7916b1b6f34350ff1473b80b9f7e459c0 upstream.
Interrupts were being cleaned up late in the shutdown handler, it is possible
that an interrupt can occur and schedule a tasklet that runs after the port is
cleaned up. There is a null dereference due to this race condition with the
following stacktrace:
[<c02092b0>] (atmel_tasklet_func+0x514/0x814) from [<c001fd34>] (tasklet_action+0x70/0xa8)
[<c001fd34>] (tasklet_action+0x70/0xa8) from [<c001f60c>] (__do_softirq+0x90/0x144)
[<c001f60c>] (__do_softirq+0x90/0x144) from [<c001fa18>] (irq_exit+0x40/0x4c)
[<c001fa18>] (irq_exit+0x40/0x4c) from [<c000e298>] (handle_IRQ+0x64/0x84)
[<c000e298>] (handle_IRQ+0x64/0x84) from [<c000d6c0>] (__irq_svc+0x40/0x50)
[<c000d6c0>] (__irq_svc+0x40/0x50) from [<c0208060>] (atmel_rx_dma_release+0x88/0xb8)
[<c0208060>] (atmel_rx_dma_release+0x88/0xb8) from [<c0209740>] (atmel_shutdown+0x104/0x160)
[<c0209740>] (atmel_shutdown+0x104/0x160) from [<c0205e8c>] (uart_port_shutdown+0x2c/0x38)
Signed-off-by: Marek Roszko <mark.roszko@gmail.com>
Acked-by: Leilei Zhao <leilei.zhao@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove the sps header file from older location as sps
driver and clients need to use new header file from
new location include/linux.
Resolve the warnings/errors from client drivers due to
new sps header changes.
Change-Id: I1cdb87756abf3425a9bb5d8bf89cd1aa03a01716
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
Add inline qualifier for wait_for_xmitr() according to its
declaration.
Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
Change-Id: If1b4754feef743f83e8411e532608223d8c73608
SMD APIs may be called before probe() has a had a chance to initialize
the driver. In such cases, EPROBE_DEFER should be returned to the caller
to indicate SMD needs more time to probe.
Change the public APIs to detect the current status of probe() and return
EPROBE_DEFER if necessary.
Change-Id: I243f56c3aa6afdce22192f17bcbae9377242d116
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
We need to disable RX PIPE interrupt to avoid any
race condition between sps_disconnect and bam_isr
CRs-Fixed: 606112
Change-Id: Id5192668d7001b1e3021b1751e7d818316722d5c
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Assert the RFR line during clock off and de-assert
it after the clock off is successful. This is to avoid
the data to be coming from the client during clock off.
Change-Id: I6cad22a63ebd3cfaa20c52445584829b382b7e3a
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Initialize the tty_flush_recieve to default value during
Port Open to avoid a corner case where Tx bytes may get queued
twice by UART in the absence of initialization.
Corner Case:
UART client calls uart_flush_buffer() API to flush the
data on Tx while UART Tx is in middle of operation.
If client immediately calls UART Port close followed by UART Tx
after Port-Open, it may result in queueing same bytes twice
CRs-Fixed: 590459
Change-Id: Ied9d33265060e1fde7fc98e29f58d3eff6ddc3c4
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Due to race conditions in clock off and clock on sequence
BAM RX descriptor doesn't get queued or may get queued multiple
times. These issues may showup when the client issues rapid clock-on
clock-off operations.
This patch optimizes clock-off sequence while synchronizing clock
off/on with the BAM RX callback (In BAM RX callback, Forcestale
is not issued for every BAM RX callback).
CRs-Fixed: 601140
Change-Id: I882bb57b597f5789daa5fef33a4bc8da174110d0
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
clock path vote is needed for core and iface vote,
so remove it after these votes are removed, and
make sure clock path vote/unvote are balanced by
removing unnecessary clock path vote
CRs-Fixed: 606403
Change-Id: I2ca2ef1cac3f0aacb7d21eb4da8bed3d39e0158c
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Add defensive checks in the APIs exposed to clients
and tty layer to avoid unclocked access
CRs-Fixed: 593860
Change-Id: Ibb80b18143a3b90156a7043fd66d4097f7c073e1
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Follow the hardware sequence of enabling
RX_ERROR_CHAR_OFF and RX_BREAK_ZERO_CHAR_OFF in
MR2 register, for not allowing the Break and
parity/frame Error characters into Rx FIFO.
CRs-Fixed: 538141
Change-Id: I24f73eea456c4cb2a68b1655bcd5426426ca7d97
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Implement TX callflow to be in accordance with HW spec and make
sure TXEMT clock off logic is correct. On receiver side, issue
force stale interrupt and make sure upper layer get bytes upto
size of RX buffer
CRs-Fixed: 575119
Change-Id: Iee469b0ba489386b571a86897b62eae84ff34ca5
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Architectural changes in the ARM Linux kernel require moving
some MSM specific headers related to the peripheral image
loader and the subsystem restart drivers to include/soc/qcom.
subsystem_restart.h is used by external modules and thus
leave a proxy in include/soc/qcom for now. Once external modules
switch over to this new include path, the header in the
old location can be deleted.
Change-Id: I0680dc34481d09170ce2609259c5318a9e6dbf37
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
commit fe43390702a1b5741fdf217063b05c7612b38303 upstream.
When the pl011 is being used for a console, pl011_console_write forces
the control register (CR) to enable the UART for transmission and then
restores this to the original value afterwards. It does this while
holding the port lock.
Unfortunately, when the uart is started or shutdown - say in response to
userland using the serial device for a terminal - then this updates the
control register without any locking.
This means we can have
pl011_console_write Save CR
pl011_startup Initialise CR, e.g. enable receive
pl011_console_write Restore old CR with receive not enabled
this result is a serial port which doesn't respond to any input.
A similar race in reverse could happen when the device is shutdown.
We can fix these problems by taking the port lock when updating CR.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
msm_smd_tty includes <mach/socinfo.h> but does not use the socinfo API.
msm_smd_tty does use <mach/socinfo.h> as a means to include <linux/of.h>.
Remove the unnecessary socinfo.h include and properly include of.h.
Change-Id: Iddc7a12d42527a7e150600110f6750b044669d14
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
commit d24c195f90cb1adb178d26d84c722d4b9e551e05 upstream.
Newer Intel PCHs with LPSS have the same Designware controllers than
Haswell but ACPI IDs are different. Add these IDs to the driver list.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a upstream.
When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0"
on the kernel command line, it crashes with:
Unable to handle kernel NULL pointer dereference at virtual address (null)
Oops: 00000000
PC: [<0013ad28>] __pmz_startup+0x32/0x2a0
...
Call Trace: [<002c5d3e>] pmz_console_setup+0x64/0xe4
The normal tty driver doesn't crash, because init_pmz() checks
pmz_ports_count again after calling pmz_probe().
In the serial console initialization path, pmz_console_init() doesn't do
this, causing the driver to crash later.
Add a check for pmz_ports_count to fix this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the way the UART nodes are enumerated when
aliases are used to identify the nodes. The atomic variable that
used to hold the next available node number was incorrectly being
incremented and if that number were to hold a number that was also
used in an alias, the probe would fail. This patch corrects it.
It also removes the atomic variable and introduces two apis to set
and get the next device number and this logic is protected by a mutex.
Change-Id: Iaee655603b527f3283e1f12d90b1220e9315b529
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
In the msm_hs_tx_empty() API, accessing wrong register offset
macro UARTDM_SR_ADDR.This leading to the unexpected issues
The right register offset macro is UART_DM_SR.
Also the msm_hs_request_clock_off() API is accessing wrong
register macro UARTDM_IMR instead of UART_DM_IMR.
This patch places the right macros at respective points.
CRs-Fixed: 583426
Change-Id: I0eb966adedc44b8e611da318b6d8f4a9279e95a7
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Upstream prefers existing drivers be converted to support multiplatform
kernels. This requires drivers to be located in generic functionality
directories instead of specific mach directories.
Move the smd_tty driver to the drivers/tty/serial location to support
multiplatform.
Change-Id: Ia5cb5f98ca07817900470252b21e47622bf23ee9
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
Upstream prefers existing drivers be converted to support multiplatform
kernels. This requires drivers to be located in generic functionality
directories instead of specific mach directories.
Move the ipc_logging driver to the kernel/trace location to support
multiplatform.
Change-Id: I8b217f2c13254814e9dfa95f46308150f1fc2a1b
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
This patch allocates the msm_hs_port structures
dynamically during probe and cleans up during exit.
The msm_hs_get_uart_port function now looks up the
uart_state data structure to find the right uart_port.
Change-Id: I3876959eb41173d2115d2c1acfc612b75ca2e46a
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Crash is seen in the dump_uart_hs_registers()
function due to improper array offset passed to
access the registers. This patch corrects the
array index during the register access.
CRs-Fixed: 576874
Change-Id: Iba54b72cefa01ff855b17e981aa4dd2886126003
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Do not use panic() when tx operation timeouts, which
leads to kernel panic causing crash.
Instead of panic which effects the driver stability,
resetting the transmitter will work good and keep
transmitting the data.
CRs-Fixed: 578961
Change-Id: I3449cf152cecb1d557b24f770e4fb71e1f2bde00
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.
A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.
Some files which support planned functionality or are
useful in debugging have been excluded from this reap.
Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
A corner case is occuring, that performing un-clock register
access and leading to Kernel Crash
Corner Case:
When system is in suspend state, Tx operation is getting called
from the client driver by a fflush system call.
To overcome this case, added a conditional check in the driver
while Tx operation. If system is in suspend state, return back
immediately.
CRs-Fixed: 570113
Change-Id: Idab06cbb49610dd36146fd22714ef20c63000ba5
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
This change fixes the clock voting logic when the port is closed and
prevents the clock votes from going negative. Clocks are voted for when
the port is being closed and the conditional unvote based on the clock
state will always be true if the earlier vote is not downvoted before
this check is done. This change also protects agains erroneous, unbalanced
client votes, leading to instabilities.
CRs-Fixed: 550668
Change-Id: I391ac69601314757821b3ffb931a00647a64c583
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
platform_get_irq_by_name function returns -ENXIO upon failure.
The return code should be checked for this error code to detect
failures.
CRs-Fixed: 566710
Change-Id: I95b601edf457a19ad8f617700697fae9b5db0f1f
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Upstream has removed <asm/system.h> so remove it from legacy uses. As all
the platforms we support utilize device tree we no longer need to include
<asm/mach-types.h>.
Change-Id: I8e53b1fd96ad26711fae59f081a8892f8bb184b7
Signed-off-by: Kumar Gala <galak@codeaurora.org>
commit d969de8d83401683420638c8107dcfedb2146f37 upstream.
Due to missing braces on an if statement, in presence of a device_node a
port was always assigned -1, regardless of any alias entries in the
device tree. Conversely, if device_node was NULL, an unitialized port
ended up being used.
This patch adds the missing braces, fixing the issues.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch enables IPC Logging in the high speed UART driver.
The logs are available under sysfs. Log level can be changed by
changing the mask provided in /sys/module.
This patch prints UART Registers while
1)Port Open
2)Port Configuration
3)Rx/Tx Flow
4)Handling ISR and
Prints Tx/Rx Data and Count
Change-Id: I7540f2c4c981271a72cf5a1ffe313ceb53a60867
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
This change disables the RFR line during set_termios call so that
the remote side does not send data during this call and thus prevents
data omission and corruption.
CRs-Fixed: 557659
Change-Id: I0708168b858a42d102ad3e5ebcbd6ca33943c8b1
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
commit a9fbf4d591da6cd1d3eaab826c7c15f77fc8f6a3 upstream.
Commit d0380e6c3c (early_printk:
consolidate random copies of identical code) added in 3.10 introduced
a check for con->index == -1 in early_console_register().
Initialize index to -1 for the xenboot console so earlyprintk=xen
works again.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 19b85cfb190eb9980eaf416bff96aef4159a430e upstream.
Fix tty_kref leak when tty_buffer_request room fails in dma-rx path.
Note that the tty ref isn't really needed anymore, but as the leak has
always been there, fixing it before removing should makes it easier to
backport the fix.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit fc0919c68cb2f75bb1af759315f9d7e2a9443c28 upstream.
Fix tty-kref leak introduced by commit 384e301e ("pch_uart: fix a
deadlock when pch_uart as console") which never put its tty reference.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 5cec7bf699c61d14f0538345076480bb8c8ebfbb upstream.
Commit 'e7f3880cd9b98c5bf9391ae7acdec82b75403776'
tty: Fix recursive deadlock in tty_perform_flush()
introduced a regression where tcflush() does not generate
SIGTTOU for background process groups.
Make sure ioctl(TCFLSH) calls tty_check_change() when
invoked from the line discipline.
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 03e1261778cca782d41a3d8e3945ca88cf93e01e upstream.
Starting from v3.10 (probably commit f91e2590410b: "tty: Signal
foreground group processes in hangup") disassociate_ctty() sends SIGCONT
if tty && on_exit. This breaks LSB test-suite, in particular test8 in
_exit.c and test40 in sigcon5.c.
Put the "!on_exit" check back to restore the old behaviour.
Review by Peter Hurley:
"Yes, this regression was introduced by me in that commit. The effect
of the regression is that ptys will receive a SIGCONT when, in similar
circumstances, ttys would not.
The fact that two test vectors accidentally tripped over this
regression suggests that some other apps may as well.
Thanks for catching this"
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Karel Srot <ksrot@redhat.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Crash observed due to the race condition with bam
rx pipe during sps_disconnect and sps_transfer_one
operations executed at the same time on two CPUs.
Because of this race condition rx bam descriptor
pointer becomes NULL and accessing of this pointer
leads to crash.
This patch waits for sps_transfer_one function to
complete, if it is in progress, before calling
sps_disconnect function from the set_termios.
CRs-Fixed: 534029
Change-Id: I7581062a17a3dc7ede8eb58e4d25e3b517812ab2
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
commit d220980b701d838560a70de691b53be007e99e78 upstream.
This solves a problem observed in kexec'ed kernel where 200ms timeout is
too short and bootconsole fails to initialize. Console did eventually
become workable but much later into the boot process.
Observed timeout was around 260ms, but I decided to make it a little bigger
for more reliability.
This has been tested on Power7 machine with Petitboot as a primary
bootloader and PowerNV firmware.
Signed-off-by: Eugene Surovegin <surovegin@google.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This reverts commit e6cb90d673242898da86271f40a3fcd1729ba9d9.
This causes compilation failures because the TTY layer has been
rewritten to hide most of these fields.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
hsl_read and hsl_write both directly call ioread32/iowrite32, which
leads to either a __raw_readl or __raw_writel call. These
readl/writel call are logged to the register trace buffer (RTB) by
default and generate a very large amount of output. This patch
directly calls __raw_readl_no_log and __raw_writel_no_log in
hsl_read and hsl_write to avoid logging these events to the RTB.
Change-Id: I9b3253996188f0642a4f6dedf449ec23fa1de05a
Signed-off-by: David Garibaldi <dgaribal@codeaurora.org>
Currently, HSUART uses a Kconfig option to determine the UARTDM core
version register offsets during compile time. This change adds runtime
configuration support for determining the version of the UARTDM core,
and use the same with appropriate register mappings in HSUART driver.
Also with addition of runtime support for determining the UARTDM core
version register offsets, Kconfig CONFIG_MSM_UARTDM_Core_v14 is no longer
required. This change also does clean up of defconfig files for removing
the config and uart register header files for achieving the same.
CRs-Fixed: 459281
Change-Id: Iff4ad1c37a3b04345d68cbe0a8befa284b49a539
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
smux_handle_rx_open_ack function acquires the channel state spin lock
and tries to add the channel into ready list causing spin lock lockup
between smux_rx_worker thread and smux_tx_worker thread running on
two different CPUs.
Add the channel to ready list after releasing the state spin lock.
CRs-Fixed: 514726
Change-Id: I11729290c5c28a13bed66cf7506b8aaf48a32d2a
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
When an SMUX port state is closed, the close request is sent to the
remote system. The port cannot be re-opened until the remote system
acknowledges the close request. If the client attempts to re-open the
port during this time, then the -EAGAIN error code is returned and the
client must keep retrying to open the port. An event-driven approach
would be better, but the client does not receive local state
notifications, so this is not possible.
Add local and remote closed notifications so clients can handle the
closing state transitions without using polling.
CRs-Fixed: 510114
Change-Id: I48008804d23dbfd05df0becd4bc1c695e599a835
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
While BT operation is in progress, it's possible for
client functions to explicitly turn off the
UART clocks without notifying TTY layer. Then when
TTY layer try to access UART, L2 error happened because
of un-clocked registers. Since there is no clear way
to notify clients to turn on clocks before TTY access
UART driver will implicilty turn on the clocks.
CRs-Fixed: 505225
Change-Id: Ia9958658465a6c0e5af66cd932e8e694cc12b78c
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
If a local SMUX client re-opens the channel and tries to send data before
receiving the OPEN_ACK, the transaction will get stuck because the
channel local state is not OPENED.
Add the channel to ready list if tx_queue is not empty after receiving
the OPEN_ACK.
CRs-Fixed: 507379
Change-Id: I357b6edc340c404c890da0c415ed3aeba96dcfe8
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
UART wakeup can be triggered by RX activity using a wakeup GPIO on the
UART RX pin. This change adds support for configuring the UART RX gpio
line as wakeup irq line.
CRs-Fixed: 482104
Change-Id: I775c17d4d36b08225b32063131473567c2d16f9c
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
This change adds support for ioctl implementation in HSUART
driver. UART Client application (e.g. Bluetooth) can make
request for UART Clock on/off using the ioctl mechanism.
UART Clock status also can be queried using this mechanism.
CRs-Fixed: 496245
Change-Id: I9531cf2f9eda487082b9719341c5ad84c15ad5f7
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
smux_ctl exposes only one control port to userspace. Enabling of dual
PDN support requires two SMUX ports.
Add new SMUX control port to enable dual PDN support.
CRs-Fixed: 497343
Change-Id: I2a1d48f1e5d2acd1f67d7673d325c4360b783cf4
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Wakeup irq is UART RX GPIO IRQ line to be configured as wakeup source and
is used as an optional property with UART. By default wakeup irq is set as
zero when it is not to be used with UART.
During UART clock on request msm_hs_request_clock_on(), calling
disable_irq_nosync() without validating wakeup irq is causing warning
message.
Hence fixing the issue by adding check to validate the wakeup irq during
UART clock on request.
CRs-Fixed: 490597
Change-Id: Iff014f41428d590117e469c1b470736383a78848
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Running the Subsystem Restart (SSR) unit tests without SSR enabled
causes the system to halt.
Rename SSR unit tests to allow for testing all non-SSR tests
quickly from the command line.
Change-Id: Ib80e9adef8311ebe038f878dfcf2aecd1087a471
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Reproducing and isolating wakeup issues caused by incorrect UART
configuration and hardware issues currently requires analysis of the
internal logs which is often time consuming.
Add wakeup test case to allow teams to easily reproduce wakeup issues or
verify wakeup functionality.
Change-Id: I614d6ee3eefc6563930c45564b76452e89f65dc8
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Incorrect test pattern code was skipping the test pattern validation
test and not freeing the test buffer resulting a slow memory leak in the
unit test that could lead to out-of-memory failures after several
hundred thousand iterations.
Fix pointer test to properly free memory after test case completion and
fix incorrect test pattern validation code.
Change-Id: If93c2cfd2f82295897b36ffaf98ecaa5b9128cfb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Add throughput metrics to unit tests to enable profiling the performance
of SMUX round-trip messaging.
Change-Id: I1eb552ca53358ece9f95a99a340409a4464877fb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Local test functions should be static to prevent duplicate
symbol collisions with other modules.
Change-Id: I43cf6199fa1fa5fe58e81c9b4e5b5c18f3539341
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Execution Environment(EE) enables BLSP BAM and does not allow apps
side to write to BAM CTRL registers any more.
Hence UART driver needs to register BLSP BAM in satellite mode using
SPS_BAM_MGR_DEVICE_REMOTE.
Change-Id: If628eb468893c3e488a5793f129a68bcf57bdf47
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
The UART bus interface clock requires the bus clock
to be on before it can be enabled. Ensure that there
is a vote for the bus before enabling the clock.
Change-Id: I6612d6df1b890a3de39f892439a9c406b9cbdbc7
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Currently UART device is being registered as PM runtime active
in probe() and set as suspended in shutdown(). With this UART
driver PM runtime suspend is being called when system suspend
is invoked and while resuming from the same which invokes UART
driver LPM functionality. It causes UART communication to stop
if both UART Tx and RX FIFO are empty.
This change donot register UART device as PM runtime active
device as UART driver doesn't use PM runtime APIs for its LPM
functionality.
CRs-Fixed: 479966
Change-Id: I33d0c95e4227fdb1b7d6d514498e161e6e4df465
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
If a subsystem restart occurs, the SMUX port needs to be closed when the
platform device is removed and then re-opened when the platform device
is probed again. Without this functionality, the SMUX port state is not
properly reset resulting in a data stall.
Add code to close the SMUX port when the platform device is removed.
CRs-Fixed: 474388
Change-Id: I00039fa517a5cf6b4d9230114cac7c6c9bbba9d1
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
SPS APIs sps_connect() and sps_disconnect() are used multiple time in UART
during transmit and receive path. This change adds error check conditions
in UART with usage of sps_connect() and sps_disconnect() API.
Also add fix for the error message seen during uart clock off request.
During uart clock off request, by the UART client driver, sps_disconnect
API is called two times consecutively, first in msm_hs_check_clock_off()
and then followed by msm_hs_stop_rx_locked() by queing the work
disconnect_rx_endpoint. Due to two consecutive sps_disconnect API call,
below error message is seen :
sps:BAM device of this pipe is NULL
Hence fixing the same error message by removing sps_disconnect() from the
msm_hs_check_clock_off() as calling sps_disconnect() API single time from
msm_hs_stop_rx_locked() is good enough to achieve uart clock off request
functionality.
CRs-Fixed: 474138
Change-Id: I3bcabe2cb6d6efde087a16de30e5400cda4ad74d
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
UART driver queue transfer request to BAM and expect rx callback completion
from BAM for the queued descriptor. With current UART BAM configurations
for rx path, it seen that BAM Hardware did not set EOT flag to the
descriptor processed and hence did not generate any End of Transfer
interrupt. Thus, UART driver did not receive any callback from SPS driver
for that descriptor. This results in issue of Rx stall with UART.
Hence fixing the issue by using option DESC_DONE with sps_config and INT
flag option for queued BAM descriptor. With these configurations, UART
receives rx callback completion for queued transfer request from BAM
and data transfer happens normal without any rx stall with UART.
CRs-Fixed: 473902
Change-Id: I7482d20b4bd0d7d04fe5d1400eff568bc53b1e53
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Add support to get reference of UART port using its port index.
i.e. if you want reference of UART port for enumerated device as
/dev/ttyHS10, then use the exported API with argument as 10.
Change-Id: I45fc0f2e0d44b21653fd4c875fa3b2f5735fdf84
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Linux clock driver is moving with device tree based usage. It is not
necessary that when UART driver probe is called, before that Linux clock
driver would be initialized.
Hence this change handles -EPROBE_DEFER if clk_get() API returns that and
mark UART driver Probe as deffered probe.
Change-Id: I501ec48445053d9da147f132f0631e4511ca592f
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
If UART application is running and system suspend happens, serial core
suspends the UART port by shuting down UART port. With that
msm_hsl_shutdown is calling pm_runtime_put_sync() from system suspend
context where before calling system suspend routine of UART driver,
it is already incremented UART device's PM refcount. Hence with that
pm_runtime_put_sync() from msm_hsl_shutdown() doesn't call UART driver's
PM runtime suspend routine. Hence UART device's Clock remains in ON state
which doesn't allow XO shutdown.
Serial core uses its own PM ops to enable/disable clock before invoking
any UART driver functionality. Hence remove usage of PM Runtime APIs
from startup() and shutdown() APIs of UART driver which makes sure that
suspend/resume is supported when UART application has opened the port
and not used any other way of preventing system suspend.
CRs-Fixed: 467750
Change-Id: Ie2b6e7eaeed518950674815c48a9ac3fe173d9e1
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
BLSP based UART supports maximum clock frequency of 63.16 Mhz.
With this (63.16 Mhz) clock frequency, UART can achieve baud
rate of 3.94 Mbps which is equivalent to 4 Mbps. UART hardware
is robust enough to handle this deviation to achieve baud rate
equaivalent to 4 Mbps.
CRs-Fixed: 465893
Change-Id: I507ab79601356a0692aba77e1116438f98ec4f4a
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
There are issues seen with current programming sequence implementation
for BLSP based UART with BAM, which may possibly put hardware into
different state which may effect the required UART Tx/Rx functionality.
Hence use exact programming sequence as per the hardware programming
guide for BLSP based UART with BAM for proper UART Tx/Rx functionality.
CRs-Fixed: 464370
CRs-Fixed: 460838
Change-Id: Icc69bb9a782bcd695d3eb050c9667ebdb49eb26e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
UART uses ADM or BAM hardware for data transfer. With clock off state
machine, it is required to wait for ADM flush completion to avoid
ADM stall issue. As this operation is specific with ADM usage with UART,
do not wait for flush completion when BAM is used with UART. Add check
to see BLSP UART and wait only for non BLSP based UART. Device crash is
seen with multiple clock off/on sequence for BLSP based UART without
this change.
Change-Id: Ibeb01a9d7d7d457480f2e93dbf621ed70e15fd6f
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Completion of requested flush command with ADM driver is having more
latency then previously. Hence now it is required to wait for discard
flush complete if there is more events expected with UART driver which
would go out of sync without it. Below are 2 instances where it is must
to wait for discard flush completion requested on UART Rx channel.
1. Changing Baud Rate of UART
UART application can send baud rate change request based on its requirement
of communication with connected device on remote uart. Serial core also
does set by default baud rate when application is opening the uart port. As
Rx command is queued always with ADM driver from UART driver, for above
events it is required to flush the same after setting the baud rate. Not
waiting for completion of Rx flush would allow application to send command
on Tx or any other ioctl which would reach to connected device but response
may not be received as Rx flush completion is not received to queue next Rx
command to ADM. Hence with this there are chances that received data with
UART wil be lost when Rx flush completion is not received in-time. Hence
wait for Rx flush completion from set_termios() with timeout as 300 jiffie.
Rx flush completion time is non-deterministic as it depends on number of
commands queued to ADM driver from ADM client drivers.
2. While going for UART clock off
UART clock off has multiple state machines and before going into last
state it makes sure that there are no pending data in UART Tx and Rx FIFO.
Although there would be one Rx command queued which is flushed before
moving to last state and going ahead with UART clock off. If UART clock is
turned off before Rx flush request is being executed and ADM tried to flush
Rx command, ADM encounters data bus error on UART Rx Channel. Hence with
waiting for Rx flush completion, and then doing UART clock off on receving
the same would resolve ADM data bus error issue on UART Rx channel.
CRs-Fixed: 457769
Change-Id: I7ee4f394180e982f875fe58a6e0aabe152dccfd7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Setting UART clock rate to zero is causing multiple issues
and leading to more confusion with other stability issues.
Setting UART clock rate to zero is invalid operation on
recent platforms and throws multiple error messages. Hence
add platform data set_uart_clk_zero to enable setting uart
clock rate to zero operation on required platform for
specific use case.
Also set set_uart_clk_zero for GSBI9 shared between different
processor.
CRs-Fixed: 455466
Change-Id: Iba04d4cf094885b0eae6a9c49ed06f750bcc1024
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Currently probe() doesn't deregister UART bus client if
trying to get any other resource fails. With that memory
corruption is seen as bus driver is still having reference
to pdata allocated for UART bus client and if same memory
is re-used before msm_bus_debugfs_init is called. Fix this
issue by deregistering UART bus client in error path.
Also correct error path with clock usage.
CRs-Fixed: 455957
Change-Id: Id2f5c1cd759625cf5398c400ec2c5276fe5800cb
Signed-off-by: Mayank Rana <mrana@codeaurora.org>