Commit Graph

973016 Commits

Author SHA1 Message Date
Will Deacon
210463b39c FROMLIST: cpuset: Don't use the cpu_possible_mask as a last resort for cgroup v1
If the scheduler cannot find an allowed CPU for a task,
cpuset_cpus_allowed_fallback() will widen the affinity to cpu_possible_mask
if cgroup v1 is in use.

In preparation for allowing architectures to provide their own fallback
mask, just return early if we're not using cgroup v2 and allow
select_fallback_rq() to figure out the mask by itself.

Cc: Li Zefan <lizefan@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Quentin Perret <qperret@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
[will: Check task_cpu_possible_mask() in v2 mode as per on-list comments]
Link: https://lore.kernel.org/r/20201217121552.ds7g2icvqp5nvtha@e107158-lin.cambridge.arm.com
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-8-will@kernel.org/
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I7a6b234c28495bae6feeecceafb841aae4de6046
2021-02-05 09:20:53 +00:00
Will Deacon
1a96879cb3 FROMLIST: sched: Introduce task_cpu_possible_mask() to limit fallback rq selection
Asymmetric systems may not offer the same level of userspace ISA support
across all CPUs, meaning that some applications cannot be executed by
some CPUs. As a concrete example, upcoming arm64 big.LITTLE designs do
not feature support for 32-bit applications on both clusters.

On such a system, we must take care not to migrate a task to an
unsupported CPU when forcefully moving tasks in select_fallback_rq()
in response to a CPU hot-unplug operation.

Introduce a task_cpu_possible_mask() hook which, given a task argument,
allows an architecture to return a cpumask of CPUs that are capable of
executing that task. The default implementation returns the
cpu_possible_mask, since sane machines do not suffer from per-cpu ISA
limitations that affect scheduling. The new mask is used when selecting
the fallback runqueue as a last resort before forcing a migration to the
first active CPU.

Reviewed-by: Quentin Perret <qperret@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-7-will@kernel.org/
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I75985976c196cee7b84043e1a03fcc62f8b6d1c4
2021-02-05 09:20:52 +00:00
Will Deacon
5ed7a93116 FROMLIST: arm64: Advertise CPUs capable of running 32-bit applications in sysfs
Since 32-bit applications will be killed if they are caught trying to
execute on a 64-bit-only CPU in a mismatched system, advertise the set
of 32-bit capable CPUs to userspace in sysfs.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Will Deacon <will@kernel.org>
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-6-will@kernel.org/
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I32991983eab382ccf727f88dc681463950f1c9d3
2021-02-05 09:20:52 +00:00
Will Deacon
c7d6ec319b BACKPORT: FROMLIST: arm64: Kill 32-bit applications scheduled on 64-bit-only CPUs
Scheduling a 32-bit application on a 64-bit-only CPU is a bad idea.

Ensure that 32-bit applications always take the slow-path when returning
to userspace on a system with mismatched support at EL0, so that we can
avoid trying to run on a 64-bit-only CPU and force a SIGKILL instead.

Signed-off-by: Will Deacon <will@kernel.org>
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-5-will@kernel.org/
[will: Fixed trivial conflict with vendor hook in __switch_to()]
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5ae90f3fb63499d7016f93d13e32693e26890f92
2021-02-05 09:20:52 +00:00
Will Deacon
a0888cb3a9 FROMLIST: KVM: arm64: Kill 32-bit vCPUs on systems with mismatched EL0 support
If a vCPU is caught running 32-bit code on a system with mismatched
support at EL0, then we should kill it.

Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-4-will@kernel.org/
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ica5929e242482be530a87d4e2de9e5554c418561
2021-02-05 09:20:52 +00:00
Will Deacon
4fb1564406 BACKPORT: FROMLIST: arm64: Allow mismatched 32-bit EL0 support
When confronted with a mixture of CPUs, some of which support 32-bit
applications and others which don't, we quite sensibly treat the system
as 64-bit only for userspace and prevent execve() of 32-bit binaries.

Unfortunately, some crazy folks have decided to build systems like this
with the intention of running 32-bit applications, so relax our
sanitisation logic to continue to advertise 32-bit support to userspace
on these systems and track the real 32-bit capable cores in a cpumask
instead. For now, the default behaviour remains but will be tied to
a command-line option in a later patch.

Signed-off-by: Will Deacon <will@kernel.org>
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-3-will@kernel.org/
[will: Fix conflict in cpucaps definition, as ARM64_HARDEN_EL2_VECTORS renamed]
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ib8d2b8df2f4ce370a518685ee81789be9b2dd6f5
2021-02-05 09:20:52 +00:00
Will Deacon
6bce5e8bf3 FROMLIST: arm64: cpuinfo: Split AArch32 registers out into a separate struct
In preparation for late initialisation of the "sanitised" AArch32 register
state, move the AArch32 registers out of 'struct cpuinfo' and into their
own struct definition.

Signed-off-by: Will Deacon <will@kernel.org>
Bug: 178507149
Link: https://lore.kernel.org/linux-arch/20201208132835.6151-2-will@kernel.org/
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I863cc7925af63d4984b3372c29d5051e51c1febf
2021-02-05 09:20:52 +00:00
Will Deacon
4622129e40 Revert "ANDROID: arm64: Add support for asymmetric AArch32 EL0 configurations"
This reverts commit 8a2a23717d.

Bug: 178507149
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I281024956da915ead240be37d66268ce862d4031
2021-02-05 09:20:51 +00:00
Will Deacon
b6a3d75cd1 Revert "ANDROID: arm64: Handle AArch32 tasks running on non AArch32 cpu"
This reverts commit cacae105ed.

Bug: 178507149
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I26369490f2f8b5c4eb47559cd1a8a197cdda1d75
2021-02-05 09:20:51 +00:00
Will Deacon
fcecc7a35e Revert "ANDROID: arm64: Disallow offlining the last aarch32 cpu"
This reverts commit d4313b326c.

Bug: 178507149
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5ea1946c496211536840de9525a71901ad60a348
2021-02-05 09:20:51 +00:00
Will Deacon
ed92ca7c78 Revert "ANDROID: arm64: kvm: Hide asym aarch32 systems from KVM"
This reverts commit b674244dc1.

Bug: 178507149
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ia0cdd883546c1ffa0f517910d09c6730ff7b2006
2021-02-05 09:20:51 +00:00
Will Deacon
ab579bdfab Revert "ANDROID: arm64: Enable KVM for Asym AArch32"
This reverts commit 7ba2f04cb6.

Bug: 178507149
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I9eaed1d2cc5004c3bfa4d2c8816a0f29fe3aff9e
2021-02-05 09:20:51 +00:00
Will Deacon
db74b01c66 ANDROID: gki_defconfig: Remove CONFIG_ASYMMETRIC_AARCH32=y
CONFIG_ASYMMETRIC_AARCH32 is about to go away, so remove its entry from
gki_defconfig.

Bug: 178507149
Signed-off-by: Will Deacon <will@kernel.org>
Change-Id: I67dbbd7c31637a4d1ec2aab8bd86d9fac515b9d3
Signed-off-by: Will Deacon <willdeacon@google.com>
2021-02-05 09:20:51 +00:00
Kyle Tso
71ede2a9b4 UPSTREAM: usb: pd: Reland VDO definitions of PD2.0
Reland VDO definitions of PD Revision 2.0 as they are still used in
PD2.0 products.

Fixes: 0e1d6f55a1 ("usb: pd: Update VDO definitions")
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210204005036.1555294-1-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2a1673f0f1
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9526d7551a58634ca67012f881eca24c630d236f
2021-02-05 07:40:24 +01:00
Shaleen Agrawal
8d420888a4 ANDROID: sched: Add PELT cmdline arg
The PELT half-life is currently hard-coded to 32ms.

Create cmdline arg to enable switching to a PELT half-life of 8mS.

Bug: 177593580
Change-Id: I9f8cfc3d9554a500eec0f6a1b161f4155c296b4d
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
2021-02-05 03:07:46 +00:00
Sami Tolvanen
8bb774b6f8 ANDROID: psci: use __pa_function for cpu_resume
With CONFIG_CFI_CLANG, the compiler replaces function pointers with
jump table addresses, which results in __pa_symbol returning the
physical address of the jump table entry. As the jump table contains
an immediate jump to an EL1 virtual address, this typically won't
work as intended. Use __pa_function instead to get the address to
cpu_resume.

Bug: 145210207
Change-Id: Iebcb0950b074c0ed0ddc6ec6cd8c4ff539f00e7c
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2021-02-05 02:29:06 +00:00
Sami Tolvanen
977c0ac09f ANDROID: arm64: kernel: use __pa_function for secondary_entry
With CONFIG_CFI_CLANG, the compiler replaces function pointers with
jump table addresses, which results in __pa_symbol returning the
physical address of the jump table entry. As the jump table contains
an immediate jump to an EL1 virtual address, this typically won't
work as intended. Use __pa_function instead to get the address of
secondary_entry.

Bug: 178005287
Change-Id: I90aea4cacd66ac224aae5c1a577decda1d922c22
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2021-02-05 02:28:53 +00:00
Sangmoon Kim
a8313dbdb3 ANDROID: arm64: add vendor hooks for kernel fault cases
Add hooks to gather data of kernel fault and summarize it with
other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I527eddf08be22fa842680bee850f1ef1f5a2c0ed
2021-02-04 23:56:39 +00:00
Sangmoon Kim
18ebdc3746 ANDROID: sched: add vendor hooks for bad scheduling
Add hooks to gather data of bad scheduling and summarize it with
other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I08a7097b60dd8eebc5c0205b31c463a36f576121
2021-02-04 23:56:20 +00:00
Sangmoon Kim
23f19a5f28 ANDROID: power: add vendor hooks for try_to_freeze fail
Add hooks to gather data of unfrozen tasks and summarize it
with other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I6f3ed7320e828a8dd1e7ae5d4449420085a75b17
2021-02-04 23:55:59 +00:00
Sangmoon Kim
b127af3af9 ANDROID: softlockup: add vendor hook for a softlockup task
Add hook to gather data of softlockup and summarize it with
other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I42b906f17ad689176f0cc5a1a46acd0b5971d6c5
2021-02-04 23:55:45 +00:00
Suren Baghdasaryan
9e4d84273c ANDROID: Fix sparse warning in __handle_speculative_fault caused by SPF
SPF patchset introduced a sparse warning caused by the mismatch in
__handle_speculative_fault function's return type. Fix the return
type.

Fixes: 1c53717440 ("FROMLIST: mm: provide speculative fault infrastructure")

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I27c75f2b3729fa5d4b610f4a1829c9beba29735c
2021-02-04 23:48:50 +00:00
Suren Baghdasaryan
aef918d19a ANDROID: mm, oom: Fix select_bad_process customization
Patch 'ANDROID: mm, oom: Avoid killing tasks with negative ADJ scores'
does not handle a special case when oom_evaluate_task is aborted and
sets oc->chosen to -1. Check for this condition to avoid invalid memory
access.

Bug: 179177151
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Id9a3f1b824c6a81d157782b8cb18115b3c577a50
2021-02-04 23:28:45 +00:00
Vinayak Menon
cf397c6c26 ANDROID: mm: sync rss in speculative page fault path
The speculative page fault path does not sync the
rss in task_struct to mm_struct leading to large
variance in the RSS values observed by userspace
tools and also in the OOM task dump.

Change-Id: Id45f1b9b0a51a9afffbaf8e65f5ef747d409d0d7
Bug: 179217427
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
2021-02-04 22:40:58 +00:00
Hridya Valsaraju
c71118016d ANDROID: GKI: Update ABI XML report
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 1 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 1 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 function with some sub-type change:

  [C] 'function dma_heap* dma_heap_add(const dma_heap_export_info*)' at dma-heap.c:283:1 has some sub-type changes:
    CRC (modversions) changed from 0xeb9fba5f to 0x7708cda

'struct dma_heap_ops at dma-heap.h:23:1' changed:
  type size changed from 64 to 128 (in bits)
  1 data member insertion:
    'long int (dma_heap*)* dma_heap_ops::get_pool_size', at offset 64 (in bits) at dma-heap.h:29:1
  5 impacted interfaces

Bug: 167709539
Change-Id: Ie1669843bdf3ae48e31bf30ef61df33ee54c19b7
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2021-02-03 21:18:40 -08:00
Hridya Valsaraju
9419dd1656 ANDROID: dma-buf: heaps: Add a sysfs file to report total pool size.
In order to help with memory accounting, expose the total pool size of
all DMA-BUF heaps at /sys/kernel/dma_heap/total_pools_kb.

This information will be exposed as part of Android Bugreport[1].

[1]: https://android-review.googlesource.com/q/topic:%22b%252F167709539%22+(status:open%20OR%20status:merged)

Bug: 167709539
Change-Id: I6a1b52517e73103122690f6567f4f295db9ca1ad
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2021-02-03 21:04:43 -08:00
Greg Kroah-Hartman
eac2a38bd6 ANDROID: GKI: enable CONFIG_USB_DUMMY_HCD
A number of systems need the dummy USB host controller driver for
testing, so enable it into the kernel to remove the need to support a
bunch of exported symbols just for that driver.

Bug: 157965270
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I74b3aa819984dd894cccd3a5239d210b9e0d43a5
2021-02-04 04:44:56 +00:00
Hridya Valsaraju
81802314e3 ANDROID: GKI: Update ABI XML report
Leaf changes summary: 76 artifacts changed
Changed leaf types summary: 2 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 74 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

74 functions with some sub-type change:

  [C] 'function int __ion_device_add_heap(ion_heap*, module*)' at ion.c:312:1 has some sub-type changes:
    CRC (modversions) changed from 0x1eddf3a5 to 0x7f958fe0

  [C] 'function dma_buf_attachment* dma_buf_attach(dma_buf*, device*)' at dma-buf.h:585:1 has some sub-type changes:
    CRC (modversions) changed from 0x1e0bba0e to 0x338ae462

  [C] 'function int dma_buf_begin_cpu_access(dma_buf*, dma_data_direction)' at dma-buf.c:1125:1 has some sub-type changes:
    CRC (modversions) changed from 0xe447ea92 to 0xca6c466d

  ... 71 omitted; 74 symbols have only CRC changes

'struct dma_buf at dma-buf.h:394:1' changed:
  type size changed from 2048 to 2112 (in bits)
  1 data member insertion:
    'dma_buf_sysfs_entry* dma_buf::sysfs_entry', at offset 2048 (in bits) at dma-buf.h:426:1
  93 impacted interfaces

'struct dma_buf_attachment at dma-buf.h:490:1' changed:
  type size changed from 640 to 704 (in bits)
  1 data member insertion:
    'dma_buf_attach_sysfs_entry* dma_buf_attachment::sysfs_entry', at offset 640 (in bits) at dma-buf.h:506:1
  93 impacted interface

Bug: 167709539
Change-Id: I3297a07ef29e63a0c2fda81b2a02cbf95fd3f372
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2021-02-03 23:04:38 +00:00
Hridya Valsaraju
e02d430a01 ANDROID: GKI: defconfig: Enable DMA-BUF sysfs stats
This patch turns on CONFIG_DMABUF_SYSFS_STATS to enable the DMA-BUF
sysfs statistics.

Bug: 167709539
Change-Id: Idc4cb231edfedcdf672474119238e5d7e545002d
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2021-02-03 23:04:29 +00:00
Vinayak Menon
4f9d16a68d ANDROID: zram: allow zram to allocate CMA pages
Though zram pages are movable, they aren't allowed to enter
MIGRATE_CMA pageblocks. zram is not seen to pin pages for
long which can cause an issue. Moreover allowing zram to
pick CMA pages can be helpful in cases seen where zram order
0 alloc fails when there are lots of free cma pages, resulting
in kswapd or direct reclaim not making enough progress.

Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>

Bug: 158645321
Link: https://lore.kernel.org/linux-mm/4c77bb100706b714213ff840d827a48e40ac9177.1604282969.git.cgoldswo@codeaurora.org/
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I406f92a4175367caec38ef8b8eaca7020ae09917
2021-02-03 22:54:39 +00:00
Alistair Delva
cf8f7947f2 ANDROID: Add filp_open_block() for zram
We currently plan to disallow use of filp_open() from drivers in GKI,
however the ZRAM driver still needs it. Add a new GKI-only variant of
filp_open() which only permits a block device to be opened, which can
be exported instead. This keeps ZRAM working but cuts down on drivers
that attempt to open and write files in kernel mode.

Bug: 179220339
Change-Id: Id696b4aaf204b0499ce0a1b6416648670236e570
Signed-off-by: Alistair Delva <adelva@google.com>
2021-02-03 18:27:38 +00:00
Kyle Tso
71037045e8 UPSTREAM: usb: pd: Update VDO definitions
"PD Spec Revision 3.0 Version 2.0 + ECNs 2020-12-10" introduces several
changes regarding the ID Header VDO and the Product Type VDOs.

Signed-off-by: Kyle Tso <kyletso@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210202161733.932215-3-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0e1d6f55a1
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0db696dde434427ed2e6d9939d97b943d792d804
2021-02-03 14:20:38 +01:00
Mathias Nyman
8d58882c6a UPSTREAM: xhci: fix bounce buffer usage for non-sg list case
xhci driver may in some special cases need to copy small amounts
of payload data to a bounce buffer in order to meet the boundary
and alignment restrictions set by the xHCI specification.

In the majority of these cases the data is in a sg list, and
driver incorrectly assumed data is always in urb->sg when using
the bounce buffer.

If data instead is contiguous, and in urb->transfer_buffer, we may still
need to bounce buffer a small part if data starts very close (less than
packet size) to a 64k boundary.

Check if sg list is used before copying data to/from it.

Fixes: f9c589e142 ("xhci: TD-fragment, align the unsplittable case with a bounce buffer")
Cc: stable@vger.kernel.org
Reported-by: Andreas Hartmann <andihartmann@01019freenet.de>
Tested-by: Andreas Hartmann <andihartmann@01019freenet.de>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210203113702.436762-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit d4a6106354
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8e58ba0a3668238f38afd048fd95a16f878ccea5
2021-02-03 13:20:24 +01:00
Pali Rohár
f4f9c0ffc8 UPSTREAM: usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720
Older ATF does not provide SMC call for USB 3.0 phy power on functionality
and therefore initialization of xhci-hcd is failing when older version of
ATF is used. In this case phy_power_on() function returns -EOPNOTSUPP.

[    3.108467] mvebu-a3700-comphy d0018300.phy: unsupported SMC call, try updating your firmware
[    3.117250] phy phy-d0018300.phy.0: phy poweron failed --> -95
[    3.123465] xhci-hcd: probe of d0058000.usb failed with error -95

This patch introduces a new plat_setup callback for xhci platform drivers
which is called prior calling usb_add_hcd() function. This function at its
beginning skips PHY init if hcd->skip_phy_initialization is set.

Current init_quirk callback for xhci platform drivers is called from
xhci_plat_setup() function which is called after chip reset completes.
It happens in the middle of the usb_add_hcd() function and therefore this
callback cannot be used for setting if PHY init should be skipped or not.

For Armada 3720 this patch introduce a new xhci_mvebu_a3700_plat_setup()
function configured as a xhci platform plat_setup callback. This new
function calls phy_power_on() and in case it returns -EOPNOTSUPP then
XHCI_SKIP_PHY_INIT quirk is set to instruct xhci-plat to skip PHY
initialization.

This patch fixes above failure by ignoring 'not supported' error in
xhci-hcd driver. In this case it is expected that phy is already power on.

It fixes initialization of xhci-hcd on Espressobin boards where is older
Marvell's Arm Trusted Firmware without SMC call for USB 3.0 phy power.

This is regression introduced in commit bd3d25b073 ("arm64: dts: marvell:
armada-37xx: link USB hosts with their PHYs") where USB 3.0 phy was defined
and therefore xhci-hcd on Espressobin with older ATF started failing.

Fixes: bd3d25b073 ("arm64: dts: marvell: armada-37xx: link USB hosts with their PHYs")
Cc: <stable@vger.kernel.org> # 5.1+: ea17a0f153: phy: marvell: comphy: Convert internal SMCC firmware return codes to errno
Cc: <stable@vger.kernel.org> # 5.1+: f768e71891: usb: host: xhci-plat: add priv quirk for skip PHY initialization
Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> # On R-Car
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> # xhci-plat
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20210201150803.7305-1-pali@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3241929b67
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib1a7567e31b368eeeb3eab5d6cde0b6354985b09
2021-02-03 11:27:37 +01:00
Chunfeng Yun
8dac114dab UPSTREAM: usb: xhci-mtk: break loop when find the endpoint to drop
No need to check the following endpoints after finding the endpoint
wanted to drop.

Fixes: 54f6a8af37 ("usb: xhci-mtk: skip dropping bandwidth of unchecked endpoints")
Cc: stable <stable@vger.kernel.org>
Reported-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1612255104-5363-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a50ea34d6d
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6c6ca12fc0d7dcd1eabe73e4b1bdecedddbc7d46
2021-02-03 08:30:48 +01:00
Kyle Tso
9c4825083b UPSTREAM: usb: typec: Return void in typec_partner_set_pd_revision
typec_partner_set_pd_revision doesn't need any return value.

Fixes: 29b01295a8 ("usb: typec: Add typec_partner_set_pd_revision")
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210202095512.761214-1-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 32e9b48d11
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I748981591b5b19d95e4e0eb05f131f5efd2c71f3
2021-02-03 08:30:48 +01:00
Yiwei Zhang
8d83de73e2 ANDROID: GKI: Update ABI with virtual_device symbols
Leaf changes summary: 450 artifacts changed
Changed leaf types summary: 4 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 438 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 6 Changed, 1 Added variable

1 Added function:

  [A] 'function int __traceiter_gpu_mem_total(void*, uint32_t, uint32_t, uint64_t)'

438 functions with some sub-type change:

  [C] 'function sk_buff* __alloc_skb(unsigned int, gfp_t, int, int)' at skbuff.c:182:1 has some sub-type changes:
    CRC (modversions) changed from 0xfd1708c0 to 0x6e6cd7df

  [C] 'function sk_buff* __cfg80211_alloc_event_skb(wiphy*, wireless_dev*, nl80211_commands, nl80211_attrs, unsigned int, int, int, gfp_t)' at nl80211.c:10265:1 has some sub-type changes:
    CRC (modversions) changed from 0x3586dfd7 to 0x15664597

  [C] 'function sk_buff* __cfg80211_alloc_reply_skb(wiphy*, nl80211_commands, nl80211_attrs, int)' at nl80211.c:13787:1 has some sub-type changes:
    CRC (modversions) changed from 0xf3ea1f25 to 0x1925a82

  ... 435 omitted; 438 symbols have only CRC changes

1 Added variable:

  [A] 'tracepoint __tracepoint_gpu_mem_total'

6 Changed variables:

  [C] 'net init_net' was changed at net_namespace.c:47:1:
    size of symbol changed from 4288 to 4224
    CRC (modversions) changed from 0xaab61b00 to 0x163d1189
    type of variable changed:
      type size changed from 34304 to 33792 (in bits)
      1 data member deletion:
        'netns_ieee802154_lowpan net::ieee802154_lowpan', at offset 18944 (in bits) at net_namespace.h:131:1
      there are data member changes:
        10 ('netns_nf net::nf' .. 'netns_bpf net::bpf') offsets changed (by -128 bits)
        4 ('netns_xfrm net::xfrm' .. 'sock* net::diag_nlsk') offsets changed (by -512 bits)
      272 impacted interfaces

  [C] 'pid_namespace init_pid_ns' was changed at pid.c:75:1:
    CRC (modversions) changed from 0x486b366 to 0x811ce7fd

  [C] 'task_struct init_task' was changed at init_task.c:64:1:
    CRC (modversions) changed from 0xb1ab451d to 0xce0185e2

  [C] 'task_group root_task_group' was changed at core.c:7251:1:
    CRC (modversions) changed from 0x47f714e8 to 0xf59cfaca

  ... 2 omitted; 5 symbols have only CRC changes

'struct ndisc_options at ndisc.h:111:1' changed:
  type size changed from 1408 to 1216 (in bits)
  1 data member deletion:
    'nd_opt_hdr* ndisc_options::nd_802154_opt_array[3]', at offset 1216 (in bits) at ndisc.h:120:1
  272 impacted interfaces

'struct net at net_namespace.h:56:1' changed:
  details were reported earlier

'struct typec_partner at class.c:32:1' changed:
  type size hasn't changed
  1 data member insertion:
    'u16 typec_partner::pd_revision', at offset 6304 (in bits) at class.c:40:1
  10 impacted interfaces

'struct typec_partner_desc at typec.h:186:1' changed:
  type size changed from 128 to 192 (in bits)
  1 data member insertion:
    'u16 typec_partner_desc::pd_revision', at offset 128 (in bits) at typec.h:200:1
  one impacted interface

Bug: 154525079
Signed-off-by: Yiwei Zhang <zzyiwei@google.com>
Change-Id: I3a66320e1178cdbc2b6bd8dfa192f75db2394136
2021-02-02 21:15:09 +00:00
Suren Baghdasaryan
bd3983c8a8 ANDROID: make per-cgroup PSI tracking configurable
With cgroup v2 hierarchy enabled PSI accounts stalls for each cgroup
separately and aggregates at each level of the hierarchy. That causes
additional overhead since psi_avgs_work would be called for each
cgroup in the hierarchy.
In Android we use PSI only at the system level, therefore this overhead
can be avoided.
Introduce CONFIG_PSI_PER_CGROUP_ACCT that controls per-cgroup PSI
tracking and is disabled by default.

Bug: 178872719
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I70a418aba76b46a27eb9e66080434aa870496384
2021-02-02 20:48:28 +00:00
Hridya Valsaraju
621f94a601 BACKPORT: FROMLIST: dmabuf: Add the capability to expose DMA-BUF stats in sysfs
This patch allows statistics to be enabled for each DMA-BUF in
sysfs by enabling the config CONFIG_DMABUF_SYSFS_STATS.

The following stats will be exposed by the interface:

/sys/kernel/dmabuf/buffers/<inode_number>/exporter_name
/sys/kernel/dmabuf/buffers/<inode_number>/size
/sys/kernel/dmabuf/buffers/<inode_number>/attachments/<attach_uid>/device
/sys/kernel/dmabuf/buffers/<inode_number>/attachments/<attach_uid>/map_counter

The inode_number is unique for each DMA-BUF and was added earlier [1]
in order to allow userspace to track DMA-BUF usage across different
processes.

Currently, this information is exposed in
/sys/kernel/debug/dma_buf/bufinfo.
However, since debugfs is considered unsafe to be mounted in production,
it is being duplicated in sysfs.

This information will be used to derive DMA-BUF
per-exporter stats and per-device usage stats for Android Bug reports.
The corresponding userspace changes can be found at [2].
Telemetry tools will also capture this information(along with other
memory metrics) periodically as well as on important events like a
foreground app kill (which might have been triggered by Low Memory
Killer). It will also contribute to provide a snapshot of the system
memory usage on other events such as OOM kills and Application Not
Responding events.

A shell script that can be run on a classic Linux environment to read
out the DMA-BUF statistics can be found at [3](suggested by John
Stultz).

The patch contains the following improvements over the previous version:
1) Each attachment is represented by its own directory to allow creating
a symlink to the importing device and to also provide room for future
expansion.
2) The number of distinct mappings of each attachment is exposed in a
separate file.
3) The per-buffer statistics are now in /sys/kernel/dmabuf/buffers
inorder to make the interface expandable in future.

All of the improvements above are based on suggestions/feedback from
Daniel Vetter and Christian König.

[1]: https://lore.kernel.org/patchwork/patch/1088791/
[2]: https://android-review.googlesource.com/q/topic:%22dmabuf-sysfs%22+(status:open%20OR%20status:merged)
[3]: https://android-review.googlesource.com/c/platform/system/memory/libmeminfo/+/1549734

Bug: 167709539
Link: https://lore.kernel.org/linux-media/20210126204240.418297-1-hridya@google.com/
[hridya: minor rebase needed in include/linux/dma-buf.h for backporting]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Reported-by: kernel test robot <lkp@intel.com>
Change-Id: I8a3342b57f2e21ff349839f5cf665980c97bf849
2021-02-02 18:47:43 +00:00
Badhri Jagan Sridharan
0589271c94 UPSTREAM: usb: typec: tcpci_maxim: Enable data path when partner is USB Comm capable
Configure USB switches when partner is USB Communication capable.
The is enabled USB data communication over D+/D- pins.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210202003101.221145-3-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2a16e18c34
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9e634089f36fa69f82d58550d18013f22c1b4c17
2021-02-02 17:43:11 +01:00
Badhri Jagan Sridharan
28ffc10398 UPSTREAM: usb: typec: tcpci: Add Callback to Usb Communication capable partner
The USB Communications Capable bit indicates if port
partner is capable of communication over the USB data lines
(e.g. D+/- or SS Tx/Rx). TCPM passes this information for chip specific
operations.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210202003101.221145-2-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 372a3d0b6b
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I79b683e60980be531add7864f73dbaab795fe9d1
2021-02-02 17:43:11 +01:00
Badhri Jagan Sridharan
c7b43222c9 UPSTREAM: usb: typec: tcpm: Add Callback to Usb Communication capable partner
The USB Communications Capable bit indicates if port
partner is capable of communication over the USB data lines
(e.g. D+/- or SS Tx/Rx). Notify the status of the bit to low
level drivers to perform chip specific operation.
For instance, low level driver enables USB switches on D+/D-
lines to set up data path when the bit is set.

Refactored from patch initially authored by
Kyle Tso <kyletso@google.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210202003101.221145-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a69bdb283f
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4478e7184c056831dd95c204759fd3170b4156e3
2021-02-02 17:43:11 +01:00
Badhri Jagan Sridharan
180030156e UPSTREAM: usb: typec: tcpm: Set in_ams flag when Source caps have been received
Receiving the first packet in an AMS sequence signals the
beginning of AMS. Set in_ams flag to true when SRC_CAPS are
received during POWER_NEGOTIATION AMS.
This fixes the failure flagged while running TD.PD.SNK.E9
compliance test.

>From Deterministic PD compliance MOI spec:
TD.PD.SNK.E9. GetSinkCap in Place of Accept
Description:
As Provider, the Tester intentionally sends a GetSinkCap message in place
of Accept message and verifies the UUT will send a SoftReset and recover
from the error.
Steps:
a) Run PROC.PD.E1 Bring-up according to the UUT role.
b) The Tester cycles VBus.
c) The Tester sends a Source Capabilities message to the UUT.
d) Upon receipt of a Request message from the UUT, the Tester replies with
   a GoodCRC message.
e) The Tester sends a GetSinkCap message to the UUT.
f) If a SoftReset is not received within 15 ms after the GetSinkCap EOP was
   sent, the test fails.
g) If a SoftReset is received timely, the Tester replies with an Accept
   message.
h) The Tester sends Source Capabilities message to the UUT repeatedly until
   nCapsCount reached or a GoodCRC is received. If nCapsCount reached, the
   test fails.
i) If a Request is not received timely within 30 ms after the GoodCRC EOP
   corresponding to Source Capabilities message was received, the test
   fails.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210202033859.258491-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2b8ff93fd7
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I85473f1c21c817a5358afaaf1b620cf29e566cf2
2021-02-02 17:43:06 +01:00
Badhri Jagan Sridharan
4240d4be96 UPSTREAM: usb: typec: tcpm: Handle vbus shutoff when in source mode
While in source mode, vbus could be shutoff by protections
circuits. TCPM does not move back to toggling state to
re-initiate connection. Fix this by moving to SRC_UNATTACHED
state when vbus shuts off while in source mode.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210201100212.49863-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7771bcc7f5
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7256c3fca5557019c1ae5295de534795b666d602
2021-02-02 17:43:01 +01:00
Yiwei Zhang
c0b981811a ANDROID: GKI: Update virtual_device symbol list
For GPU tracepoint.

Bug: 154525079
Signed-off-by: Yiwei Zhang <zzyiwei@google.com>
Change-Id: I7d66fab12441710b4a294005c359dc9634fa4ad7
2021-02-02 07:53:45 +00:00
Huang Yiwei
9789a88f42 ANDROID: timer: Add vendor hook for timer calc index
Since we're expecting timers more precisely in short period, add
a vendor hook to calc_index when adding timers. Then we can modify
the index this timer used to make it accurate.

Bug: 178758017
Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org>
Change-Id: Ie0e6493ae7ad53b0cc57eb1bbcf8a0a11f652828
2021-02-02 02:04:18 +00:00
Ram Muthiah
d4ff3d23ce ANDROID: Make vsock virtio packet buff size configurable
When the android virtual device stays up for long periods of time, the
SLAB sustains everincreasing fragmentation. Contributing to this
fragmentation are the virtio packet buffer allocations which are a
drain on 64Kb compound pages. Eventually these can't be allocated due to
fragmentation.

To enable successful allocations for this packet buffer, the packet
buffer's size needs to be reduced.

To enable a reduction without impacting other partners, this var is
being exposed as a command line param.

Bug: 149494272
Test: atest ManagedProfileLifecycleStressTest#testCreateStartDelete on
local cuttlefish device
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: Ia4f9180025b64d61d9e2b882daa84460b8f08fd2
2021-02-01 19:32:29 +00:00
Prateek Sood
aac69db49d ANDROID: ipi: Add function to return nr_ipi and ipi_desc
For implementation of IPI stats, nr_ipi and ipi_desc are useful.
This information helps in getting per cpu IPI count and total
IPI count from vendor module.

Presently, there are no helper functions to get nr_ipi and
ipi_desc on vendor side. And if we do with a new exported symbol
that does kallsyms_lookup_name on each static variable takes
more than 80ms during boot up or for the first access of each
static variable is an overhead.

So lets add helper functions to return nr_ipi and ipi_desc
value to get things done in an efficient way.

Bug: 177393446
Change-Id: I698dbbb0301d4f1529ef7484f25fe7540378008c
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
2021-02-01 16:46:43 +00:00
Benson Leung
1c2fa8ba74 UPSTREAM: usb: typec: Add typec_partner_set_pd_revision
The partner's PD revision may be resolved later than the port partner
registration since the port partner creation may take place once
Type-C detects the port has changed state, but before PD communication is
completed.

Add a setter so that the partner's PD revision can be attached to it once
it becomes available.

If the revision is set to a valid version (not 0), the setter will also
refresh the partner's usb_pd flag and notify on "supports_usb_power_delivery"
sysfs property as well.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20210129061406.2680146-4-bleung@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 29b01295a8
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If86d7729107e784fbfecd65185436b97208c97ae
2021-02-01 15:37:59 +01:00
Benson Leung
6a31be7a06 UPSTREAM: usb: typec: Provide PD Specification Revision for cable and partner
The USB Power Delivery specification Section 6.2.1.1.5 outlines
revision backward compatibility requirements starting from Revision 3.0.

The Port, the Cable Plug, and the Port Partner may support either
revision 2 or revision 3 independently, and communication between ports,
partners, and cables of different revisions are allowed under rules
that the parties agree to communicate between each other using the
lowest common operating revision.

This may mean that Port-to-Partner operating revision comms may be
different than Port-to-CablePlug operating revision comms. For example,
it is possible for a R3.0 port to communicate with a R3.0 partner
using R3.0 messages, while the R3.0 port (in the same session) must
communicate with the R2.0 cable using R2.0 messages only.

Introduce individual revision number properties for cable
and port partner so that the port can track them independently.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20210129061406.2680146-3-bleung@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f5030e2526
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iaf6481acb781fad61d86b5eab1fdebcb8ed0a779
2021-02-01 15:37:51 +01:00