ARM64: fix unaligned loop in copy_from_user and copy_to_user

The unaligned loops added in commit
275a80309907a687d21a0f6fe991a0710d3a9a10 (arm64: mm: align
copy_*_user accesses) don't initialize x4, but the fault
handlers expect x4 to be the end address of the copy.
Move the initialization of x4 before the unaligned loop,
and replace the usage of x4 with x5 in the unaligned loop.

bug 1537811

Change-Id: Ic1aeaca56a9d45c4f1de9bbf9588cfc072dd5d28
Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-on: http://git-master/r/450404
Reviewed-by: Richard Wiley <rwiley@nvidia.com>
Tested-by: Richard Wiley <rwiley@nvidia.com>
Reviewed-by: Karan Jhavar <kjhavar@nvidia.com>
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
ARM64: tlbflush: fix incorrect local tlb flush check

commit 123e4f9fdd0823ce45881e5c12cf0b0c941ad823 (arm64: tlb: avoid
use of smp_processor_id()) made the incorrect assumption that
an mm with only a single cpu in the cpumask must be running on the
current cpu.  That is true for tlb flushes triggered by the process,
but is not true for tlb flushes that come from another process,
for example in direct reclaim, which may unmap clean pages from other
processes in order to free memory.

Go back to the simpler check for whether the mm has been used on
any other cpu, but disable preemption to avoid a context switch
between smp_processor_id() and the local tlb flush.

bug 1539886

Change-Id: I09a65776e102885460ade0a1fabe13afb8253214
Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-on: http://git-master/r/450405
Reviewed-by: Richard Wiley <rwiley@nvidia.com>
Tested-by: Richard Wiley <rwiley@nvidia.com>
Reviewed-by: Karan Jhavar <kjhavar@nvidia.com>
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
video: tegra: adf: replace nvmap_alloc_dmabuf with v4l2 API

Replace deprecated nvmap_alloc_dmabuf with V4L2 videobuf2 contig dma API.

Bug 1540346

Change-Id: I06dd4a64a5a548d29443a0dfb8e4ccdeee62644c
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/450681
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>
video: adf: fix incorrect dependency on DMA_SHARED_BUFFER

ADF should select DMA_SHARED_BUFFER instead of depending on it.

Bug 1540346

Change-Id: I6e9e83df1e30834d072a86b525f80461e1b13e62
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/451063
Tested-by: Michael I Gold <gold@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Michael I Gold <gold@nvidia.com>
video: tegra: nvmap: Fix sleeping while atomic warning

When reading /d/nvmap/iovmm/procrank, we first take clients_lock
spin_lock and then take ref_lock mutex inside nvmap_iovmm_get_client_mss.
This creates mutex inside spin_lock situation. To fix this,
clients_lock is converted to mutex.

bug 1540937

Change-Id: I7f3b37791c119dd94a3ce65e06a2926a7e1db25c
Signed-off-by: Gaurav Sarode <gsarode@nvidia.com>
Reviewed-on: http://git-master/r/451076
Reviewed-by: Maneet Maneet Singh <mmaneetsingh@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
ax88179_178a: Correct the RX error definition in RX header

Correct the definition of AX_RXHDR_CRC_ERR and
AX_RXHDR_DROP_ERR. They are BIT29 and BIT31 in pkt_hdr
seperately.

bug 200009821

Change-Id: Ib55e13899a68a86a847708500dccd475e2f0712a
Signed-off-by: Freddy Xin <freddy@asix.com.tw>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: wtsai <wtsai@nvidia.com>
Reviewed-on: http://git-master/r/434739
GVS: Gerrit_Virtual_Submit
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-on: http://git-master/r/450229
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>
usb: phy: initialize the notifier when add a new phy

We need to initialize the notifer before use it.

So lets initialize it when add a new phy device to
reduce the code redundancy.

Bug 1528493

Change-Id: I98aac07376f1e5a5227c78b90d2a7dd58246c025
Signed-off-by: Shu Zhong <shuz@nvidia.com>
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/433289
(cherry picked from commit d6222919c1eb922ff3fa5abc87ef5a62616c1004)
Reviewed-on: http://git-master/r/439273
Reviewed-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
arm: tegra: soctherm: revert reprogram suppression

Suppressing reprogramming HW registers saves very little but can
potentially result in suppressing all HW interrupts from soctherm.

Bug 1536511

Change-Id: I57a78f7955089c60dde89e81ed8d88d9f408f364
Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-on: http://git-master/r/453269
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
usb: gadget: mtp : Handle ioctl MTP_SEND_EVENT_32

MTP_SEND_EVENT_32 is defined for 64bit kernel.
This changes properly fixes handling of 32-64 bit
ioctl call for mtp_send_event.

Bug 200016543

Change-Id: Ife559ecb31d10fdfe17d34c8a132cbaf04b09082
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/450869
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
video: tegra: nvmap: clean cache during page allocations into page pool

Clean cache during page allocations into page pool to
avoid cache clean overhead at the time of allocation.
Increase page pool refill size to 1MB from 512KB.

Bug 1539190

Change-Id: I046289f5e4b52986f477890663bbc7b2cda76c25
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/453197
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Michael I Gold <gold@nvidia.com>
gpu: nvgpu: Add boost once GPU is initialized

Workaround for GPU hang if boost turns GPU on before it is
initialized.

Bug 1435870

Change-Id: I07d0617049612344ca7c494da8cb8d75789984e5
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/453375
(cherry picked from commit 260cf3d3fab941126eebf4bc977cb408587492eb)
Reviewed-on: http://git-master/r/454721
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
video: tegra: adf: suppress bandwidth events during probe

If tegra_dc_init() fails during probe, _tegra_dc_controller_enable()
will reset the bandwidth while cleaning up.  tegra_adf should not
attempt to report this to userspace since it is not initialized at this
point.

Bug: 17003197

Change-Id: I6ee2cb402ab109fedcb50a9405e549cc9184116a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Revert "video: tegra: nvmap: clean cache during page allocations into page pool"

This reverts commit 39b0d737566adca113baac1de61f6550634da4ea.
Merge branch 'android-tegra-nv-3.10' into android-tegra-3.10
usb: gadget: tegra_udc: disable clocks when non-standard charger detected

tegra_udc assumes that a non-standard charger is connected if an SDP
is detected but doesn't enumerate within 1 second.  Since nothing is
enumerated  otg_wakelock doesn't hold a wakelock and suspend is
allowed.  tegra_udc clocks are still on from when an SDP port was
detected, and going to suspend results in a watchdog on the second
suspend transition.

When a non-standard charger is detected, turn off the tegra_udc
clocks.  Also hold a wakeup source whenever the clocks are on
so that a suspend during the 1 second delay doesn't hit the same
issue.

Change-Id: Ia6632c9db71cd57d3e27a9ca71316243974ffb65
Signed-off-by: Colin Cross <ccross@android.com>