Commit Graph

1067110 Commits

Author SHA1 Message Date
Peter Yoon
d4eb48ce24 kernel/configs : update from aosp/kernel/configs
- from kernel/configs/android-5.15:4ca2ff98
2023-02-28 17:56:49 +09:00
Peter Yoon
9655518f3b arch/arm64 : add androidboot params to cmdline 2023-02-28 17:56:44 +09:00
Peter Yoon
5dc2740b34 drivers/gpu/drm : changes for android-rpi
- reduce access limitation
  - support DRM_FORMAT_RGBA8888
  - avoid dma_fence_set_error() overrun
2023-02-28 17:56:40 +09:00
Peter Yoon
af2ebb08ea Revert "staging: ion: remove from the tree"
This reverts commit e722a295cf.
2023-02-28 17:56:37 +09:00
Peter Yoon
670c6da635 Merge branch 'android14-5.15' into arpi-5.15.92 2023-02-28 17:56:07 +09:00
Vincent Donnefort
8705a3d943 ANDROID: KVM: arm64: Add header_page userspace descriptor for nVHE tracing
Added userspace file that describes the content of each hyp tracing
ring-buffer page. This follows the same format as the descriptor found
in the tracefs root to ensure compatibility with userspace trace tools.

Bug: 229972309
Change-Id: Ideebf37cb285b581c4cbe2a991a0df8c7ed61c0f
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-02-14 15:27:08 +00:00
Ulises Mendez Martinez
27e5fbdd85 ANDROID: Remove non-actionable & outdated comments
* These values are now specified in kernel_build rule.

Bug: 261722616
Change-Id: I0c7681408770b2136f9a13d01c20f01bf78d1ac2
Signed-off-by: Ulises Mendez Martinez <umendez@google.com>
2023-02-14 10:44:42 +00:00
Rick Yiu
8e245b4c3a ANDROID: topology: Add vendor hook for use_amu_fie
Vendors could decide to use amu fie feature or not, such as if they
have some feature that needs amu fie to be disabled.

Bug: 261753861
Change-Id: I6b44ee899c58e7d5a8b2db03a30e3ab14b08f101
Signed-off-by: Rick Yiu <rickyiu@google.com>
2023-02-14 01:36:30 +00:00
Minchan Kim
32dfefb4c8 ANDROID: f2fs: enable cleancache
cleancache is enabled for only ext4 and btrfs. Since f2fs is one
of the main fs in Android, this patch enables cleancache for f2fs.

Bug: 236887352
Change-Id: Ib6e6e832234f72681058da848e9cff36c5a496f2
Signed-off-by: Minchan Kim <minchan@google.com>
2023-02-13 10:40:20 -08:00
Christophe JAILLET
30fd2f4242 FROMGIT: scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param()
If an error occurs, some memory may need to be freed, as in the other error
handling paths.

Before the commit in the Fixes tag, this test was done before the memory
allocation, so there was no issue.

Fixes: 16ed9d312b42 ("scsi: ufs: core: Remove ufshcd_map_desc_id_to_length()")
Link: https://lore.kernel.org/r/2c6e42205e5ec22e5e8c7c85c6deb8fde31c74da.1673781835.git.christophe.jaillet@wanadoo.fr
Change-Id: Ia09dd2a289deccf75f77f68378be9b53675cf160
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 833f7d4819a88f027033e0033ea44f7ae3e45a9b git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:39 -08:00
Mason Zhang
531b704375 FROMGIT: scsi: ufs: core: Fix device management cmd timeout flow
In the UFS error handling flow, the host will send a device management cmd
(NOP OUT) to the device for link recovery. If this cmd times out and
clearing the doorbell fails, ufshcd_wait_for_dev_cmd() will do nothing and
return. hba->dev_cmd.complete struct is not set to NULL.

When this happens, if cmd has been completed by device, then we will call
complete() in __ufshcd_transfer_req_compl(). Because the complete struct is
allocated on the stack, the following crash will occur:

  ipanic_die+0x24/0x38 [mrdump]
  die+0x344/0x748
  arm64_notify_die+0x44/0x104
  do_debug_exception+0x104/0x1e0
  el1_dbg+0x38/0x54
  el1_sync_handler+0x40/0x88
  el1_sync+0x8c/0x140
  queued_spin_lock_slowpath+0x2e4/0x3c0
  __ufshcd_transfer_req_compl+0x3b0/0x1164
  ufshcd_trc_handler+0x15c/0x308
  ufshcd_host_reset_and_restore+0x54/0x260
  ufshcd_reset_and_restore+0x28c/0x57c
  ufshcd_err_handler+0xeb8/0x1b6c
  process_one_work+0x288/0x964
  worker_thread+0x4bc/0xc7c
  kthread+0x15c/0x264
  ret_from_fork+0x10/0x30

Link: https://lore.kernel.org/r/20221216032532.1280-1-mason.zhang@mediatek.com
Change-Id: I5e829ec4c6e025954d521b17d48a8874b0694250
Signed-off-by: Mason Zhang <Mason.Zhang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 36822124f9de200cedc2f42516301b50d386a6cd git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:35 -08:00
Bart Van Assche
908d42ee93 FROMGIT: scsi: ufs: core: Fix kernel-doc syntax
Fix the following kernel-doc warnings:

drivers/ufs/core/ufs-mcq.c:87: warning: Function parameter or member 'hba' not described in 'ufshcd_mcq_config_mac'
drivers/ufs/core/ufs-mcq.c:87: warning: Function parameter or member 'max_active_cmds' not described in 'ufshcd_mcq_config_mac'
drivers/ufs/core/ufs-mcq.c:107: warning: Function parameter or member 'hba' not described in 'ufshcd_mcq_req_to_hwq'
drivers/ufs/core/ufs-mcq.c:107: warning: Function parameter or member 'req' not described in 'ufshcd_mcq_req_to_hwq'
drivers/ufs/core/ufs-mcq.c:128: warning: Function parameter or member 'hba' not described in 'ufshcd_mcq_decide_queue_depth'

Link: https://lore.kernel.org/r/20230202220155.561115-1-bvanassche@acm.org
Fixes: 854f84e7feeb ("scsi: ufs: core: mcq: Find hardware queue to queue request")
Fixes: 2468da61ea09 ("scsi: ufs: core: mcq: Configure operation and runtime interface")
Fixes: 7224c806876e ("scsi: ufs: core: mcq: Calculate queue depth")
Cc: Asutosh Das <quic_asutoshd@quicinc.com>
Change-Id: Ieee720d2b8f3bc26618f00f146ba32dd3f48aa67
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Asutosh Das <quic_asutoshd@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit b62c8292d223c8e7eafb3cfd2e997cbb63d15e23 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:31 -08:00
Anjana Hari
b7a0649832 FROMGIT: scsi: ufs: core: Add hibernation callbacks
Add freeze, thaw, and restore callbacks for hibernate and restore
functionality.

Link: https://lore.kernel.org/r/20230202161045.3956-2-quic_ahari@quicinc.com
Change-Id: Id5d636c7004df9516eeb65ede66989c315cca729
Signed-off-by: Anjana Hari <quic_ahari@quicinc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 88441a8d355dcbb86aa69f82934ae1ff0fccfa83 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:28 -08:00
Bjorn Andersson
c386657d2e FROMGIT: scsi: ufs: core: Limit DMA alignment check
The three DMA memory regions allocated for the host memory space are
documented to require alignment of 128, 1024, and 1024 respectively, but
the returned address is checked for PAGE_SIZE alignment.

In the case where these allocations are serviced by e.g. the Arm SMMU, the
size and alignment will be determined by its supported page sizes. In most
cases SZ_4K and a few larger sizes are available.

In the typical configuration this does not cause problems, but in the event
that the system PAGE_SIZE is increased beyond 4k, it's no longer reasonable
to expect that the allocation will be PAGE_SIZE aligned.

Limit the DMA alignment check to the actual alignment requirements written
in the comments in the code, to avoid the UFS core refusing to initialize
with such configuration.

Link: https://lore.kernel.org/r/20230201034917.1902330-1-quic_bjorande@quicinc.com
Change-Id: Iddb462133be5473b012ef58997d6e05867c7f2cc
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Asutosh Das <quic_asutoshd@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 339aa12218728cad1caf6de3ff7a83771aeed164 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:25 -08:00
Abel Vesa
7c11d103b0 FROMGIT: scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW version major 5
On SM8550, depending on the Qunipro, we can run with G5 or G4.  For now,
when the major version is 5 or above, we go with G5.  Therefore, we need to
specifically tell UFS HC that.

Change-Id: Ia1fc8ac41940599dd616f1777165fd3e2cf0ef29
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 9c02aa24bf404a39ec509d9f50539056b9b128f7 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:21 -08:00
Bart Van Assche
c4e9d151d5 FROMGIT: scsi: ufs: core: Enable DMA clustering
All UFS host controllers support DMA clustering. Hence enable DMA
clustering.

Notes:

 - The max_segment_size parameter implements the 256 KiB limit for the
   PRDT. The dma_boundary parameter represents a boundary that must not be
   crossed by DMA scatter/gather lists. I'm not aware of any restrictions
   on DMA scatter/gather lists in the UFSHCI specification other than the
   256 KiB limit for the PRDT and the 32-bit address restriction for
   controllers that only support 32-bits DMA. The latter restriction is
   already handled by ufshcd_set_dma_mask().

 - Without patch "scsi: ufs: exynos: Fix the maximum segment size", this
   patch breaks support for the Exynos controller.

The history of the dma_boundary parameter in the UFS driver is as
follows:

 * The initial UFS driver did not set the dma_boundary parameter.

 * Commit 4dd4130a72 ("scsi: make sure all drivers set the use_clustering
   flag") set the .use_clustering flag.

 * Commit 4af14d113b ("scsi: remove the use_clustering flag") removed the
   use_clustering flag and set the dma_boundary parameter instead.

Cc: Avri Altman <avri.altman@wdc.com>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Change-Id: I7a14065dee3278b93f51e66b132dd2ffbc3020c4
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 13f87983fb91454e4a534bb41b5b2b43afe97798 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:18 -08:00
Bart Van Assche
1810e7b451 FROMGIT: scsi: ufs: exynos: Fix the maximum segment size
Prepare for enabling DMA clustering and also for supporting PAGE_SIZE !=
4096 by declaring explicitly that the maximum segment size is 4096 bytes
for Exynos UFS host controllers. Add this code in
exynos_ufs_hce_enable_notify() such that it happens after scsi_host_alloc()
and before __scsi_init_queue() is called by the LUN scanning code.

Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Change-Id: Idce6f25fbe5fccb964d590bbafdcf3d793c0a443
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 9a80bc5debf74b09f3a8bbc02cfba8d04e2048d0 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:14 -08:00
Bart Van Assche
eaebb00d00 FROMGIT: scsi: ufs: exynos: Fix DMA alignment for PAGE_SIZE != 4096
The Exynos UFS controller only supports scatter/gather list elements that
are aligned on a 4 KiB boundary. Fix DMA alignment in case PAGE_SIZE !=
4096. Rename UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE into
UFSHCD_QUIRK_4KB_DMA_ALIGNMENT.

Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Fixes: 2b2bfc8aa5 ("scsi: ufs: Introduce a quirk to allow only page-aligned sg entries")
Change-Id: Ice7b3d32192e0c7f6f607ad4ca64071062fa8b17
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 86bd0c4a2a5dc4265884648cb92c681646509692 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:10 -08:00
Alim Akhtar
21a48c99fd FROMGIT: scsi: ufs: ufs: Remove duplicate entry
PA_GRANULARITY is duplicated, delete one of the entries.

Change-Id: I2b7e65364000d07216717bb8974593bc9ae19fd3
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230114022010.27088-1-alim.akhtar@samsung.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 3730bea883cd8f74fd9b2b31d51665c74cf73362 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:39:06 -08:00
Maulik Shah
8e623dc18e ANDROID: cpuidle-psci: Fix suspicious RCU usage
This change fixes suspicious RCU usage warnings from vendor hook.

    =============================
    WARNING: suspicious RCU usage
    5.15.41-debug-gc1163f69ba3b-dirty #1 Not tainted
    -----------------------------
    include/trace/events/lock.h:37 suspicious rcu_dereference_check() usage!

    other info that might help us debug this:

    rcu_scheduler_active = 2, debug_locks = 1
    RCU used illegally from extended quiescent state!
    no locks held by swapper/0/0.

    stack backtrace:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.41-debug-gc1163f69ba3b-dirty #1

    Call trace:
     dump_backtrace+0x0/0x1d8
     dump_stack+0x1c/0x4c
    ..
    ..
     _printk+0x58/0x84
     lockdep_rcu_suspicious+0x44/0x15c
     trace_android_vh_printk_caller_id+0xc4/0x13c
     vprintk_store+0x54/0x59c
     vprintk_emit+0x8c/0x130
     vprintk_default+0x48/0x74
     vprintk+0xf8/0x13c
     _printk+0x58/0x84
     lockdep_rcu_suspicious+0x44/0x15c
     trace_android_vh_cpuidle_psci_enter+0xc4/0x144
     __psci_enter_domain_idle_state+0x64/0x118
     psci_enter_domain_idle_state+0x1c/0x2c
     cpuidle_enter_state+0x14c/0x2fc
     cpuidle_enter+0x3c/0x58

Bug: 267847290
Fixes: 3567f51602 ("ANDROID: cpuidle-psci: Add vendor hook for cpuidle psci enter and exit")
Change-Id: I910a6a0595c3a79b75e581297eb56d512ce5885c
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
2023-02-10 17:54:27 +00:00
Yifan Hong
52b9f943fb ANDROID: Update symbol list for virtual device.
This is updated by
  tools/bazel run //common-modules/virtual-device:virtual_device_aarch64_abi_update_symbol_list

Test: TH
Bug: 267694690
Change-Id: I876704cc5d0aa84647f3dbf1e30c08dd5136286a
Signed-off-by: Yifan Hong <elsk@google.com>
2023-02-10 17:25:07 +00:00
Sebastian Ene
6b38102053 ANDROID: KVM: arm64: Coalesce host stage2 entries on ownership reclaim
This optimization allows us to re-create higher order block mappings in
the host stage2 pagetables after we teardown a guest VM. The coalescing
code is triggered on host_stage2_set_owner_locked path when we annotate
the entries in the host stage2 page-tables with an invalid entry that has
the owner set to PKVM_ID_HOST. This can also be triggered from
page_relinquish when we do page insertion in the ballooning code.

When the host reclaims ownership during guest teardown, the page table
walker drops the refcount of the counted entries and clears out
unreferenced entries (refcount == 1). Clearing out the entry installs a
zero PTE. When the host stage2 receives a data abort because there is no
mapping associated, it will try to create the largest possible block
mapping from the founded leaf entry.
With the current patch, we increase the chances of finding a leaf entry
that has level < 3 if the requested region comes from a reclaimed torned
down VM memory. This has the advantage of reducing the TLB pressure at
host stage2.

To be able to do coalescing, we modify the way we do refcounting by not
counting the following descriptor types at host stage 2:
- non-zero invalid PTEs
- any descriptor that has at least one of the reserved-high bits(58-55)
toogled
- non-default attribute mappings
- page table descriptors

The algorithm works as presented below:

  Is refcount(child(pte_table)) == 1 ?

  Yes -> (because we left only default mappings)
	Zap the table by setting 0 in the pte_table
	and put the page that holds the level 3 entries
	back into the memcache

  level 2
+---------+
|         |
|  ...    |
| pte_table---+      level 3      -> we can now re-create a 2Mb mapping
|  ...    |   +---> +---------+
|         |         |         |
|         |         |         |
|         |         |def entry|
+---------+         |         |
                    |def entry|
                    |         |
                    |  ...    |
                    +---------+

This (v3) is a re-work of the previous version which fixes some issues on
the stage2_unmap path:

When we register a pKVM IOMMU we unmap the MMIO region from the host
stage2. While we treat most of the MMIO regions as default mappings in
the coalescing change, we end up decrementing the page table page
refcount for a default mapping which breaks the refcounting. Fix this by
adding a check which verifies if we have a default mapping before
decrementing the reference.

Bug: 222044487
Test: dump the host stage2 pagetables and view the mapping
Change-Id: I518fcbd7f022e77965eef54dd59dac07425db3a5
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Signed-off-by: Will Deacon <willdeacon@google.com>
2023-02-10 13:37:29 +00:00
Bart Van Assche
e1aee10e87 ANDROID: scsi: ufs: Backport the remainder of "Fix devfreq deadlocks"
Stable kernel v5.15.91 includes commit b03f7ed9af ("scsi: ufs: core:
Fix devfreq deadlocks"). That commit is a backport of upstream commit
ba81043753ff ("scsi: ufs: core: Fix devfreq deadlocks"). Merge commit
c45adc3d89 ("Merge 5.15.92 into android14-5.15") removed the 'err'
argument from ufshcd_clock_scaling_unprepare(). Restore the 'err'
argument.

Fixes: c45adc3d89 ("Merge 5.15.92 into android14-5.15")
Change-Id: Icce2a7cb69ba7ccf9a6d548406d786e15d279acc
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 07:42:44 +00:00
Andrey Konovalov
f34aed1750 ANDROID: kasan: fix slab page check in complete_report_info
The backport commit 77a0deb5d5 ("BACKPORT: kasan: fill in cache and
object in complete_report_info") did not resolve the conflict due to the
folio patchset missing in 5.15 correctly: complete_report_info needs to
check PageSlab to make sure that the page is a slab page.

Add a PageSlab check to complete_report_info.

Bug: 254721825
Reported-by: Peter Collingbourne <pcc@google.com>
Fixes: 77a0deb5d5 ("BACKPORT: kasan: fill in cache and object in complete_report_info")
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I307ddbd9315134f825b37a0c7254a033453a46ef
2023-02-10 00:01:43 +01:00
Bart Van Assche
93f59126f9 ANDROID: Enable SCSI logging
There is more information available in the SCSI logging mechanism than
in the SCSI ftrace event output, e.g. ASC and ASCQ sense codes. Hence
enable the SCSI logging mechanism. For more information about this
mechanism, see also the documentation of the scsi_logging_level
parameter on https://www.kernel.org/doc/html/v6.1/scsi/scsi-parameters.html
and also
https://github.com/torvalds/linux/blob/master/drivers/scsi/scsi_logging.h.

Bug: 268210743
Test: adb shell 'echo -1 > /sys/module/scsi_mod/parameters/scsi_logging_level && dmesg -w'
Change-Id: Ia0f048c3646714c62461d54271de1822377e61d8
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-09 16:41:53 +00:00
Amit Pundir
a5edfb5af6 ANDROID: ufs: core: Fix v5.15.91 merge conflicts in android14-5.15
LTS v5.15.91 commit b03f7ed9af ("scsi: ufs: core: Fix
devfreq deadlocks") didn't apply cleanly and it led to a
probable merge conflict which broke DB845c (sdm845).

Bug: 146449535
Fixes: e3d8fe0993 (Merge 5.15.91 into android14-5.15)
Change-Id: I308d6425f49e924dad412d5b5a93dc71c1881cbf
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2023-02-09 13:49:12 +00:00
Amit Pundir
a4b821db5c Revert "FROMGIT: scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device"
This reverts commit 3ce7942d7b.

UFS G4 patchseries broke RB5 (sm8250). Reverting a minimal
set of patches to get the device booting again.

Bug: 146449535
Change-Id: I26a755402561c6ec445a514f5b59f40d7e207cef
Suggested-by: Bart Van Assche <bvanassche@google.com>
Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2023-02-08 18:23:24 +00:00
Amit Pundir
5a84915a10 Revert "FROMGIT: scsi: ufs: ufs-qcom: Add support for finding max gear on new platforms"
This reverts commit ac7823b077.

UFS G4 patchseries broke RB5 (sm8250). Reverting a minimal
set of patches to get the device booting again.

Bug: 146449535
Change-Id: I33155982effdcedcbf836e5355fbed646236ea48
Suggested-by: Bart Van Assche <bvanassche@google.com>
Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2023-02-08 18:23:18 +00:00
Matthias Reichl
14b35093ca drm/vc4: Calculate bpc based on max_requested_bpc
This aligns vc4 with Intel, AMD and Synopsis drivers and fixes max bpc
connector property not working as expected on monitors with YCbCr 4:2:2
support but not deep color support.

max_bpc in connector state is clamped at max_bpc from display info and
the latter only takes deep color modes into account so it will always
be 8, even if the display can do 4:2:2 12-bit output.

Signed-off-by: Matthias Reichl <hias@horus.com>
2023-02-08 16:47:50 +00:00
Quentin Perret
a1cdb3fe0e ANDROID: KVM: arm64: Remove 'pending reclaim' page flags
The HOST_PAGE_PENDING_RECLAIM and HOST_PAGE_NEED_POISONING flags are now
no longer used, remove them.

Bug: 229972313
Bug: 238945523
Change-Id: Ib88a22c486f9c5eab95f0763ff949426f883be83
Signed-off-by: Quentin Perret <qperret@google.com>
2023-02-08 13:45:37 +00:00
Quentin Perret
a6c0641d2d ANDROID: KVM: arm64: Refactor the guest teardown path
The __pkvm_teardown_vm hypercall can take a long time. According to my
measurement on Pixel 6, up to 150+ms. The vast majority of that time is
spent walking the guest stage-2 page-table to put its pages in the
'pending reclaim' state, which was introduced to allow poisoning the
pages asynchronously. Given that pKVM is fundamentally non-preemptible,
those 150+ms are not acceptable.

In order to spread the work in multiple smaller sections, let's split the
teardown procedure in two. A first hypercall will be used to place a VM
in a 'dying' state after all the required sanity checks have been done
(e.g. checking that no vCPUs are currently loaded). Once in a dying
state, the hypervisor will deny any attempt to load vCPUs and run the
VM, but accept requests to reclaim guest pages. Once all guest pages have
been reclaimed, the host can issue a second hypercall to finalize the
teardown, which will free the handle and return all pages used to store
guest metadata at EL2 back to EL1.

This was tested on Pixel 6 with android14-6.1, and concurrently running
a memory intensive benchmark on the host and a large protected guest.
The length of EL2 periods have been measured by parsing pKVM traces and
the results showed that all outliers of 200+us have been entirely
eliminated.

Bug: 229972313
Bug: 238945523
Change-Id: Iaa426a964e1f7a5e48e9365aaec4700a62b3b776
Signed-off-by: Quentin Perret <qperret@google.com>
2023-02-08 13:45:37 +00:00
Quentin Perret
f13ce4744f ANDROID: KVM: arm64: Poison pages on the relinquish path
When a guest relinquishes a page to the host (because of e.g.
balooning), it issues a hypercall where the hypervisor puts the page in
the 'pending reclaim' state. It is then the host's responsibility to
call the reclaim hypercall to trigger the page poisoning before dropping
the GUP pin.

In order to reduce dependencies on the 'pending reclaim' state which
will be reworked very soon, rework the relinquish path to poison the
pages synchronously, hence removing the need for the host to issue a
reclaim call. The page ownership is now synchronously returned to the
host on the back of the relinquish hcall.

Bug: 229972313
Bug: 238945523
Change-Id: I85fd3485308209357bcdeb855de07da227fac0fe
Signed-off-by: Quentin Perret <qperret@google.com>
2023-02-08 13:45:37 +00:00
Will Deacon
3d06919cab Revert "ANDROID: KVM: arm64: Coalesce host stage2 entries on ownership reclaim"
This reverts commit fe0be0c1c4.

Reason for revert: Appears to be the root-cause behind b/267581040

Change-Id: I51ac488de4326d39c7e33f37764cba0b65b84caf
Signed-off-by: Will Deacon <willdeacon@google.com>
2023-02-07 18:19:58 +00:00
Dom Cobley
c113cf1287 Merge remote-tracking branch 'stable/linux-5.15.y' into rpi-5.15.y 2023-02-06 12:25:10 +00:00
Greg Kroah-Hartman
c45adc3d89 Merge 5.15.92 into android14-5.15
Changes in 5.15.92
	ARM: dts: imx: Fix pca9547 i2c-mux node name
	ARM: dts: vf610: Fix pca9548 i2c-mux node names
	arm64: dts: freescale: Fix pca954x i2c-mux node names
	arm64: dts: imx8mq-thor96: fix no-mmc property for SDHCI
	firmware: arm_scmi: Clear stale xfer->hdr.status
	bpf: Skip task with pid=1 in send_signal_common()
	erofs/zmap.c: Fix incorrect offset calculation
	blk-cgroup: fix missing pd_online_fn() while activating policy
	HID: playstation: sanity check DualSense calibration data.
	dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init
	cifs: fix return of uninitialized rc in dfs_cache_update_tgthint()
	ext4: fix bad checksum after online resize
	extcon: usbc-tusb320: fix kernel-doc warning
	ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems
	Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
	tools: fix ARRAY_SIZE defines in tools and selftests hdrs
	selftests/vm: remove ARRAY_SIZE define from individual tests
	selftests: Provide local define of __cpuid_count()
	net: fix NULL pointer in skb_segment_list
	net: mctp: purge receive queues on sk destruction
	Linux 5.15.92

Change-Id: Ia09e2a458fdd8f6f527e5d2ecff18cbb40c6ef10
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-02-06 10:45:01 +00:00
Greg Kroah-Hartman
e515b9902f Linux 5.15.92
Link: https://lore.kernel.org/r/20230203101007.985835823@linuxfoundation.org
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Ron Economos <re@w6rz.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:02 +01:00
Jeremy Kerr
c7caf669b8 net: mctp: purge receive queues on sk destruction
commit 60bd1d9008a50cc78c4033a16a6f5d78210d481c upstream.

We may have pending skbs in the receive queue when the sk is being
destroyed; add a destructor to purge the queue.

MCTP doesn't use the error queue, so only the receive_queue is purged.

Fixes: 833ef3b91d ("mctp: Populate socket implementation")
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://lore.kernel.org/r/20230126064551.464468-1-jk@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:02 +01:00
Yan Zhai
046de74f9a net: fix NULL pointer in skb_segment_list
commit 876e8ca8366735a604bac86ff7e2732fc9d85d2d upstream.

Commit 3a1296a38d ("net: Support GRO/GSO fraglist chaining.")
introduced UDP listifyed GRO. The segmentation relies on frag_list being
untouched when passing through the network stack. This assumption can be
broken sometimes, where frag_list itself gets pulled into linear area,
leaving frag_list being NULL. When this happens it can trigger
following NULL pointer dereference, and panic the kernel. Reverse the
test condition should fix it.

[19185.577801][    C1] BUG: kernel NULL pointer dereference, address:
...
[19185.663775][    C1] RIP: 0010:skb_segment_list+0x1cc/0x390
...
[19185.834644][    C1] Call Trace:
[19185.841730][    C1]  <TASK>
[19185.848563][    C1]  __udp_gso_segment+0x33e/0x510
[19185.857370][    C1]  inet_gso_segment+0x15b/0x3e0
[19185.866059][    C1]  skb_mac_gso_segment+0x97/0x110
[19185.874939][    C1]  __skb_gso_segment+0xb2/0x160
[19185.883646][    C1]  udp_queue_rcv_skb+0xc3/0x1d0
[19185.892319][    C1]  udp_unicast_rcv_skb+0x75/0x90
[19185.900979][    C1]  ip_protocol_deliver_rcu+0xd2/0x200
[19185.910003][    C1]  ip_local_deliver_finish+0x44/0x60
[19185.918757][    C1]  __netif_receive_skb_one_core+0x8b/0xa0
[19185.927834][    C1]  process_backlog+0x88/0x130
[19185.935840][    C1]  __napi_poll+0x27/0x150
[19185.943447][    C1]  net_rx_action+0x27e/0x5f0
[19185.951331][    C1]  ? mlx5_cq_tasklet_cb+0x70/0x160 [mlx5_core]
[19185.960848][    C1]  __do_softirq+0xbc/0x25d
[19185.968607][    C1]  irq_exit_rcu+0x83/0xb0
[19185.976247][    C1]  common_interrupt+0x43/0xa0
[19185.984235][    C1]  asm_common_interrupt+0x22/0x40
...
[19186.094106][    C1]  </TASK>

Fixes: 3a1296a38d ("net: Support GRO/GSO fraglist chaining.")
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Yan Zhai <yan@cloudflare.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/Y9gt5EUizK1UImEP@debian
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Reinette Chatre
7ab3376703 selftests: Provide local define of __cpuid_count()
commit a23039c7306f53416ba35d230201398ea34f4640 upstream.

Some selftests depend on information provided by the CPUID instruction.
To support this dependency the selftests implement private wrappers for
CPUID.

Duplication of the CPUID wrappers should be avoided.

Both gcc and clang/LLVM provide __cpuid_count() macros but neither
the macro nor its header file are available in all the compiler
versions that need to be supported by the selftests. __cpuid_count()
as provided by gcc is available starting with gcc v4.4, so it is
not available if the latest tests need to be run in all the
environments required to support kernels v4.9 and v4.14 that
have the minimal required gcc v3.2.

Duplicate gcc's __cpuid_count() macro to provide a centrally defined
macro for __cpuid_count() to help eliminate the duplicate CPUID wrappers
while continuing to compile in older environments.

Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Cc: Kyle Huey <me@kylehuey.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Shuah Khan
e92e311ced selftests/vm: remove ARRAY_SIZE define from individual tests
commit e89908201e2509354c40158b517945bf3d645812 upstream.

ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.

Remove ARRAY_SIZE from vm tests and pickup the one defined in
kselftest.h.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Cc: Kyle Huey <me@kylehuey.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Shuah Khan
c9e52db900 tools: fix ARRAY_SIZE defines in tools and selftests hdrs
commit 066b34aa5461f6072dbbecb690f4fe446b736ebf upstream.

tools/include/linux/kernel.h and kselftest_harness.h are missing
ifndef guard around ARRAY_SIZE define. Fix them to avoid duplicate
define errors during compile when another file defines it. This
problem was found when compiling selftests that include a header
with ARRAY_SIZE define.

ARRAY_SIZE is defined in several selftests. There are about 25+
duplicate defines in various selftests source and header files.
Add ARRAY_SIZE to kselftest.h in preparation for removing duplicate
ARRAY_SIZE defines from individual test files.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Cc: Kyle Huey <me@kylehuey.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Soenke Huster
c1aa0dd52d Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
commit 3afee2118132e93e5f6fa636dfde86201a860ab3 upstream.

This event is just specified for SCO and eSCO link types.
On the reception of a HCI_Synchronous_Connection_Complete for a BDADDR
of an existing LE connection, LE link type and a status that triggers the
second case of the packet processing a NULL pointer dereference happens,
as conn->link is NULL.

Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Dave Hansen
02e61196c5 ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems
commit e400ad8b7e6a1b9102123c6240289a811501f7d9 upstream.

Old, circa 2002 chipsets have a bug: they don't go idle when they are
supposed to.  So, a workaround was added to slow the CPU down and
ensure that the CPU waits a bit for the chipset to actually go idle.
This workaround is ancient and has been in place in some form since
the original kernel ACPI implementation.

But, this workaround is very painful on modern systems.  The "inl()"
can take thousands of cycles (see Link: for some more detailed
numbers and some fun kernel archaeology).

First and foremost, modern systems should not be using this code.
Typical Intel systems have not used it in over a decade because it is
horribly inferior to MWAIT-based idle.

Despite this, people do seem to be tripping over this workaround on
AMD system today.

Limit the "dummy wait" workaround to Intel systems.  Keep Modern AMD
systems from tripping over the workaround.  Remotely modern Intel
systems use intel_idle instead of this code and will, in practice,
remain unaffected by the dummy wait.

Reported-by: K Prateek Nayak <kprateek.nayak@amd.com>
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/all/20220921063638.2489-1-kprateek.nayak@amd.com/
Link: https://lkml.kernel.org/r/20220922184745.3252932-1-dave.hansen@intel.com
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Rong Chen
79dd676b44 extcon: usbc-tusb320: fix kernel-doc warning
commit 08099ecd9216219f51cc82637f06797cf81890b6 upstream.

Fix the warning:
drivers/extcon/extcon-usbc-tusb320.c:19: warning: expecting prototype
for drivers/extcon/extcon-tusb320.c(). Prototype was for TUSB320_REG8()
instead

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Rong Chen <rong.a.chen@intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 07:59:01 +01:00
Baokun Li
c2bd60ef20 ext4: fix bad checksum after online resize
commit a408f33e895e455f16cf964cb5cd4979b658db7b upstream.

When online resizing is performed twice consecutively, the error message
"Superblock checksum does not match superblock" is displayed for the
second time. Here's the reproducer:

	mkfs.ext4 -F /dev/sdb 100M
	mount /dev/sdb /tmp/test
	resize2fs /dev/sdb 5G
	resize2fs /dev/sdb 6G

To solve this issue, we moved the update of the checksum after the
es->s_overhead_clusters is updated.

Fixes: 026d0d27c488 ("ext4: reduce computation of overhead during resize")
Fixes: de394a86658f ("ext4: update s_overhead_clusters in the superblock during an on-line resize")
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20221117040341.1380702-2-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-06 07:59:01 +01:00
Paulo Alcantara
4cd1e18bc0 cifs: fix return of uninitialized rc in dfs_cache_update_tgthint()
[ Upstream commit d6a49e8c4ca4d399ed65ac219585187fc8c2e2b1 ]

Fix this by initializing rc to 0 as cache_refresh_path() would not set
it in case of success.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/all/202301190004.bEHvbKG6-lkp@intel.com/
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-06 07:59:00 +01:00
Hui Wang
43acd767bd dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init
[ Upstream commit 1417f59ac0b02130ee56c0c50794b9b257be3d17 ]

If the function sdma_load_context() fails, the sdma_desc will be
freed, but the allocated desc->bd is forgot to be freed.

We already met the sdma_load_context() failure case and the log as
below:
[ 450.699064] imx-sdma 30bd0000.dma-controller: Timeout waiting for CH0 ready
...

In this case, the desc->bd will not be freed without this change.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20221130090800.102035-1-hui.wang@canonical.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-06 07:59:00 +01:00
Roderick Colenbrander
a54c5ad007 HID: playstation: sanity check DualSense calibration data.
[ Upstream commit ccf1e1626d37745d0a697db67407beec9ae9d4b8 ]

Make sure calibration values are defined to prevent potential kernel
crashes. This fixes a hypothetical issue for virtual or clone devices
inspired by a similar fix for DS4.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-06 07:59:00 +01:00
Yu Kuai
6d7686cc11 blk-cgroup: fix missing pd_online_fn() while activating policy
[ Upstream commit e3ff8887e7db757360f97634e0d6f4b8e27a8c46 ]

If the policy defines pd_online_fn(), it should be called after
pd_init_fn(), like blkg_create().

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230103112833.2013432-1-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-06 07:59:00 +01:00
Siddh Raman Pant
2144859229 erofs/zmap.c: Fix incorrect offset calculation
[ Upstream commit 6acd87d50998ef0afafc441613aeaf5a8f5c9eff ]

Effective offset to add to length was being incorrectly calculated,
which resulted in iomap->length being set to 0, triggering a WARN_ON
in iomap_iter_done().

Fix that, and describe it in comments.

This was reported as a crash by syzbot under an issue about a warning
encountered in iomap_iter_done(), but unrelated to erofs.

C reproducer: https://syzkaller.appspot.com/text?tag=ReproC&x=1037a6b2880000
Kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=e2021a61197ebe02
Dashboard link: https://syzkaller.appspot.com/bug?extid=a8e049cd3abd342936b6

Reported-by: syzbot+a8e049cd3abd342936b6@syzkaller.appspotmail.com
Suggested-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Siddh Raman Pant <code@siddh.me>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20221209102151.311049-1-code@siddh.me
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-06 07:59:00 +01:00