Commit Graph

1163347 Commits

Author SHA1 Message Date
Yang Yingliang
fa329140c1 UPSTREAM: i2c: qcom-geni: fix missing clk_disable_unprepare() and geni_se_resources_off()
Add missing clk_disable_unprepare() and geni_se_resources_off() in the error
path in geni_i2c_probe().

Fixes: 14d02fbadb ("i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: I914d5fa381478dfe0dbcf98b1245b411e5a4a84a
(cherry picked from commit 043465b66506e8c647cdd38a2db1f2ee0f369a1b)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Yangtao Li
8fd3f0784d UPSTREAM: i2c: qcom-geni: Convert to devm_platform_ioremap_resource()
Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: I7d5087c66ff6c9799cb43190156b6149c89c0bbd
(cherry picked from commit 02ebc01dde)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Uwe Kleine-König
02b20eb4bc UPSTREAM: i2c: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Alain Volmat <alain.volmat@foss.st.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Acked-by: Jochen Friedrich <jochen@scram.de>
Acked-by: Peter Rosin <peda@axentia.se>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Asmaa Mnebhi <asnaa@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Chris Pringle <chris.pringle@phabrix.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Tali Perry <tali.perry@nuvoton.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: I47c4e41ec0dc6dd719fd4416219875116bcf94e6
(cherry picked from commit e190a0c389)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Yang Yingliang
a650b9fb29 UPSTREAM: i2c: qcom-geni: change i2c_master_hub to static
i2c_master_hub is only used in i2c-qcom-geni.c now,
change it to static.

Fixes: cacd9643ec ("i2c: qcom-geni: add support for I2C Master Hub variant")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: If191b6b205f111c9b54590859438c75235e2bd0a
(cherry picked from commit 597688792c)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Neil Armstrong
aa4151b832 UPSTREAM: i2c: qcom-geni: add support for I2C Master Hub variant
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.

Add the I2C Master Hub serial engine compatible along the specific
requirements in a new desc struct passed through the device match data.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: I161a19650cd69595e0829411a2dd12a58de23615
(cherry picked from commit cacd9643ec)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Neil Armstrong
47d1f8edd6 UPSTREAM: i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.

Those I2C serial engines variants have some requirements:
- a separate "core" clock
- doesn't support DMA, thus no memory interconnect path
- fixed FIFO size not discoverable in the HW_PARAM_0 register

Add a desc struct specifying all those requirements which will be used in
a next change when adding the I2C Master Hub serial engine compatible.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: I9f007f3f4f435e59e41849d357fe0ed72b81c63d
(cherry picked from commit 14d02fbadb)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Veerendranath Jakkam
752034bc87 UPSTREAM: wifi: cfg80211: fix reporting failed MLO links status with cfg80211_connect_done
Individual MLO links connection status is not copied to
EVENT_CONNECT_RESULT data while processing the connect response
information in cfg80211_connect_done(). Due to this failed links
are wrongly indicated with success status in EVENT_CONNECT_RESULT.

To fix this, copy the individual MLO links status to the
EVENT_CONNECT_RESULT data.

Bug: 254441685
Fixes: 53ad07e982 ("wifi: cfg80211: support reporting failed links")
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Reviewed-by: Carlos Llamas <cmllamas@google.com>
Link: https://patch.msgid.link/20240724125327.3495874-1-quic_vjakkam@quicinc.com
[commit message editorial changes]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit baeaabf970b9a90999f62ae27edf63f6cb86c023)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I0a1aacb180914e8d5509eab44aa27bd82272bbf7
2024-10-15 14:12:46 +01:00
Manivannan Sadhasivam
40c204b003 UPSTREAM: scsi: ufs: core: Do not set link to OFF state while waking up from hibernation
UFS link is just put into hibern8 state during the 'freeze' process of the
hibernation. Afterwards, the system may get powered down. But that doesn't
matter during wakeup. Because during wakeup from hibernation, UFS link is
again put into hibern8 state by the restore kernel and then the control is
handed over to the to image kernel.

So in both the places, UFS link is never turned OFF. But
ufshcd_system_restore() just assumes that the link will be in OFF state and
sets the link state accordingly. And this breaks hibernation wakeup:

[ 2445.371335] phy phy-1d87000.phy.3: phy_power_on was called before phy_init
[ 2445.427883] ufshcd-qcom 1d84000.ufshc: Controller enable failed
[ 2445.427890] ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
[ 2445.427906] ufs_device_wlun 0:0:0:49488: ufshcd_wl_resume failed: -5
[ 2445.427918] ufs_device_wlun 0:0:0:49488: PM: dpm_run_callback(): scsi_bus_restore returns -5
[ 2445.427973] ufs_device_wlun 0:0:0:49488: PM: failed to restore async: error -5

So fix the issue by removing the code that sets the link to OFF state.

Bug: 254441685
Cc: Anjana Hari <quic_ahari@quicinc.com>
Cc: stable@vger.kernel.org # 6.3
Fixes: 88441a8d35 ("scsi: ufs: core: Add hibernation callbacks")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240718170659.201647-1-manivannan.sadhasivam@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ac6efb12ca64156f4a94e964acdb96ee7d59630d)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ie855c205e39a182050f2080929977e4246eb49e1
2024-10-15 14:12:46 +01:00
Yu Zhao
2589c7fa08 UPSTREAM: mm/mglru: fix overshooting shrinker memory
set_initial_priority() tries to jump-start global reclaim by estimating
the priority based on cold/hot LRU pages.  The estimation does not account
for shrinker objects, and it cannot do so because their sizes can be in
different units other than page.

If shrinker objects are the majority, e.g., on TrueNAS SCALE 24.04.0 where
ZFS ARC can use almost all system memory, set_initial_priority() can
vastly underestimate how much memory ARC shrinker can evict and assign
extreme low values to scan_control->priority, resulting in overshoots of
shrinker objects.

To reproduce the problem, using TrueNAS SCALE 24.04.0 with 32GB DRAM, a
test ZFS pool and the following commands:

  fio --name=mglru.file --numjobs=36 --ioengine=io_uring \
      --directory=/root/test-zfs-pool/ --size=1024m --buffered=1 \
      --rw=randread --random_distribution=random \
      --time_based --runtime=1h &

  for ((i = 0; i < 20; i++))
  do
    sleep 120
    fio --name=mglru.anon --numjobs=16 --ioengine=mmap \
      --filename=/dev/zero --size=1024m --fadvise_hint=0 \
      --rw=randrw --random_distribution=random \
      --time_based --runtime=1m
  done

To fix the problem:
1. Cap scan_control->priority at or above DEF_PRIORITY/2, to prevent
   the jump-start from being overly aggressive.
2. Account for the progress from mm_account_reclaimed_pages(), to
   prevent kswapd_shrink_node() from raising the priority
   unnecessarily.

Bug: 254441685
Link: https://lkml.kernel.org/r/20240711191957.939105-2-yuzhao@google.com
Fixes: e4dde56cd2 ("mm: multi-gen LRU: per-node lru_gen_folio lists")
Signed-off-by: Yu Zhao <yuzhao@google.com>
Reported-by: Alexander Motin <mav@ixsystems.com>
Cc: Wei Xu <weixugc@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 3f74e6bd3b84a8b6bb3cc51609c89e5b9d58eed7)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I4ae651a8f945c7115da48205dbfea04e66032a68
2024-10-15 14:12:46 +01:00
Willem de Bruijn
4d8187d2c8 UPSTREAM: gso: fix udp gso fraglist segmentation after pull from frag_list
Detect gso fraglist skbs with corrupted geometry (see below) and
pass these to skb_segment instead of skb_segment_list, as the first
can segment them correctly.

Valid SKB_GSO_FRAGLIST skbs
- consist of two or more segments
- the head_skb holds the protocol headers plus first gso_size
- one or more frag_list skbs hold exactly one segment
- all but the last must be gso_size

Optional datapath hooks such as NAT and BPF (bpf_skb_pull_data) can
modify these skbs, breaking these invariants.

In extreme cases they pull all data into skb linear. For UDP, this
causes a NULL ptr deref in __udpv4_gso_segment_list_csum at
udp_hdr(seg->next)->dest.

Detect invalid geometry due to pull, by checking head_skb size.
Don't just drop, as this may blackhole a destination. Convert to be
able to pass to regular skb_segment.

Link: https://lore.kernel.org/netdev/20240428142913.18666-1-shiming.cheng@mediatek.com/
Fixes: 9fd1ff5d2a ("udp: Support UDP fraglist GRO/GSO.")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20241001171752.107580-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Bug: 373245346
Bug: 333849117
Change-Id: I5a317e002f149cf9d399dce9bf87cd649a24da19
(cherry picked from commit a1e40ac5b5e9077fe1f7ae0eb88034db0f9ae1ab)
Signed-off-by: Lena Wang <lena.wang@mediatek.corp-partner.google.com>
(cherry picked from commit 42c2d1ea7c1bf984372f0ca1711d91165cbb87a6)
(cherry picked from commit 7376b8e51c4ddaa8e36b2b33d6ac3392135183b1)
2024-10-14 17:27:09 +00:00
Vijaya Krishna Nivarthi
b11f74b6c1 UPSTREAM: soc: qcom: geni-se: Do not bother about enable/disable of interrupts in secondary sequencer
The select_fifo/dma_mode() functions in geni driver enable/disable
interrupts (secondary included) conditionally for non-uart modes, while
uart is supposed to manage this internally.
However, only uart uses secondary IRQs while spi, i2c do not care about
these at all making their enablement (or disablement) totally unnecessary
for these protos.
Similarly, select_gpi_mode() also does disable s_irq and its useless again.

Drop enabling/disabling secondary IRQs.
This doesn't solve any observed problem but only gets rid of code pieces
that are not required.

Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/1686742087-30731-1-git-send-email-quic_vnivarth@quicinc.com

Bug: 370629635
Change-Id: Id35fae83b7628cf583e4cdd6307862da08d07a9c
(cherry picked from commit 5d85ea2c87)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-14 17:22:48 +00:00
Vijaya Krishna Nivarthi
f9d2a8a3bf UPSTREAM: soc: qcom: geni-se: Add interfaces geni_se_tx_init_dma() and geni_se_rx_init_dma()
The geni_se_xx_dma_prep() interfaces necessarily do DMA mapping before
initiating DMA transfers. This is not suitable for spi where framework
is expected to handle map/unmap.

Expose new interfaces geni_se_xx_init_dma() which do only DMA transfer.

Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/1684325894-30252-2-git-send-email-quic_vnivarth@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 370629635
Change-Id: I14cc6034fe404cd0777482965c98c30456547d57
(cherry picked from commit 6d6e575949)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-14 17:22:48 +00:00
Gabriel Krisman Bertazi
8097478ae8 UPSTREAM: unicode: Don't special case ignorable code points
We don't need to handle them separately. Instead, just let them
decompose/casefold to themselves.

Change-Id: I01c3f2c98ae4d84269586cec09f18239cbee0abb
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
(cherry picked from commit 5c26d2f1d3f5e4be3e196526bead29ecb139cf91)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-14 10:04:19 +00:00
Chao Yu
d41d398db6 BACKPORT: f2fs: fix to handle segment allocation failure correctly
If CONFIG_F2FS_CHECK_FS is off, and for very rare corner case that
we run out of free segment, we should not panic kernel, instead,
let's handle such error correctly in its caller.

Signed-off-by: Chao Yu <chao@kernel.org>
Tested-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Change-Id: I4e7d90895d82687ae6ec6b64b2de222f1ee2ee9e
Bug: 361829529
(cherry picked from commit 7d009e048d7cfcc21d400f2aba4c8bacbdebbd47)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-11 18:08:33 +00:00
Zhiguo Niu
751a02f798 UPSTREAM: f2fs: stop checkpoint when get a out-of-bounds segment
There is low probability that an out-of-bounds segment will be got
on a small-capacity device. In order to prevent subsequent write requests
allocating block address from this invalid segment, which may cause
unexpected issue, stop checkpoint should be performed.

Also introduce a new stop cp reason: STOP_CP_REASON_NO_SEGMENT.

Note, f2fs_stop_checkpoint(, false) is complex and it may sleep, so we should
move it outside segmap_lock spinlock coverage in get_new_segment().

Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Change-Id: Ie5a83b05851a0b5c0c75fa74dbcf9261065724fa
Bug: 361829529
(cherry picked from commit f9e28904e6442019043a8e94ec6747a064d06003)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-11 18:08:33 +00:00
Jaegeuk Kim
acc7335e1f BACKPORT: f2fs: kill heap-based allocation
No one uses this feature. Let's kill it.

Reviewed-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Change-Id: I3bd733b0535d4c18f0eb8eb1a8692fb31462e2c8
Bug: 361829529
(cherry picked from commit 4e0197f9932f70cc7be8744aa0ed4dd9b5d97d85)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-11 18:08:33 +00:00
Greg Kroah-Hartman
19e119d2d0 Reapply "io_uring: drop any code related to SCM_RIGHTS"
This reverts commit 81cc178d7c which was a
revert of commit a3812a47a3 which is
commit 6e5e6d274956305f1fc0340522b38f5f5be74bdb upstream.

It brings it back in an abi-safe way.

Bug: 338889538
Change-Id: I5e2fd45fb4d972056728fb9963a9ef9f86e9a6ca
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-09 13:05:14 +00:00
Bao D. Nguyen
80e851bf0d FROMGIT: scsi: ufs: core: Support Updating UIC Command Timeout
The default UIC command timeout still remains 500ms.
Allow platform drivers to override the UIC command
timeout if desired.

In a real product, the 500ms timeout value is probably good enough.
However, during the product development where there are a lot of
logging and debug messages being printed to the uart console,
interrupt starvations happen occasionally because the uart may
print long debug messages from different modules in the system.
While printing, the uart may have interrupts disabled for more
than 500ms, causing UIC command timeout.
The UIC command timeout would trigger more printing from
the UFS driver, and eventually a watchdog timeout may
occur unnecessarily.

Add support for overriding the UIC command timeout value
with the newly created uic_cmd_timeout kernel module parameter.
Default value is 500ms. Supported values range from 500ms
to 2 seconds.

Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Link: https://lore.kernel.org/r/e4e1c87f3f867f270a3d4b5d57a00139ff0e9741.1721792309.git.quic_nguyenb@quicinc.com
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 358022094
Bug: 361419350
Change-Id: I3778a26aa82805591454f3771f727d30f92286d9
(cherry picked from commit 88e6804fb323d1dbe477f002a89755f8b034e890
 https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 6.12/scsi-staging)
Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
(cherry picked from commit 0c95462c9112873df5ceeeaff13cbfcf05136480)
Signed-off-by: Blagovest Kolenichev <quic_c_bkolen@quicinc.com>
(cherry picked from commit 5414728d5721e0ad3921e45083ebf8cff8d757ac)
Signed-off-by: Shreyas K K <quic_shrekk@quicinc.com>
2024-10-09 00:39:29 +00:00
Seiya Wang
0d60f50b9d ANDROID: GKI: Update symbol list for mtk
ABI impact

1 function symbol(s) added
  'void dev_pm_opp_remove_table(struct device*)'

Add following symbols

arc4_crypt
arc4_setkey
dev_pm_opp_remove_table

Bug: 372142936
Change-Id: I594ae04403c547a51aba873cf3703819a27d6531
Signed-off-by: Seiya Wang <seiya.wang@mediatek.com>
2024-10-08 22:16:28 +00:00
Xu Yang
0ff444ed0b UPSTREAM: Revert "usb: typec: tcpm: clear pd_event queue in PORT_RESET"
This reverts commit bf20c69cf3cf9c6445c4925dd9a8a6ca1b78bfdf.

During tcpm_init() stage, if the VBUS is still present after
tcpm_reset_port(), then we assume that VBUS will off and goto safe0v
after a specific discharge time. Following a TCPM_VBUS_EVENT event if
VBUS reach to off state. TCPM_VBUS_EVENT event may be set during
PORT_RESET handling stage. If pd_events reset to 0 after TCPM_VBUS_EVENT
set, we will lost this VBUS event. Then the port state machine may stuck
at one state.

Before:

[    2.570172] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev1 NONE_AMS]
[    2.570179] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
[    2.570182] pending state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED @ 920 ms [rev1 NONE_AMS]
[    3.490213] state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED [delayed 920 ms]
[    3.490220] Start toggling
[    3.546050] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected]
[    3.546057] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS]

After revert this patch, we can see VBUS off event and the port will goto
expected state.

[    2.441992] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev1 NONE_AMS]
[    2.441999] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
[    2.442002] pending state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED @ 920 ms [rev1 NONE_AMS]
[    2.442122] VBUS off
[    2.442125] state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED [rev1 NONE_AMS]
[    2.442127] VBUS VSAFE0V
[    2.442351] CC1: 0 -> 0, CC2: 0 -> 0 [state SNK_UNATTACHED, polarity 0, disconnected]
[    2.442357] Start toggling
[    2.491850] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected]
[    2.491858] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS]
[    2.491863] pending state change SRC_ATTACH_WAIT -> SNK_TRY @ 200 ms [rev1 NONE_AMS]
[    2.691905] state change SRC_ATTACH_WAIT -> SNK_TRY [delayed 200 ms]

Fixes: bf20c69cf3cf ("usb: typec: tcpm: clear pd_event queue in PORT_RESET")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240809112901.535072-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 21ea1ce37fc267dc45fe27517bbde926211683df)

Test: Verify 100 reboot loop, device not stuck in SRC_ATTACH_WAIT
Bug: 320466108
Change-Id: I334497dc94d3011079d5d3208c9355dc2374c4ff
Signed-off-by: RD Babiera <rdbabiera@google.com>
2024-10-08 20:09:22 +00:00
hao lv
311457e823 ANDROID: GKI: update symbol list for transsion
INFO: 49 function symbol(s) added
  'int __percpu_counter_init(struct percpu_counter*, s64, gfp_t, struct lock_class_key*)'
  'int __traceiter_android_rvh_delayacct_init(void*, void*)'
  'int __traceiter_android_rvh_delayacct_tsk_free(void*, struct task_struct*)'
  'int __traceiter_android_rvh_delayacct_tsk_init(void*, struct task_struct*)'
  'int __traceiter_android_vh_delayacct_add_tsk(void*, struct taskstats*, struct task_struct*, int*)'
  'int __traceiter_android_vh_delayacct_blkio_end(void*, struct task_struct*)'
  'int __traceiter_android_vh_delayacct_blkio_start(void*, void*)'
  'int __traceiter_android_vh_delayacct_blkio_ticks(void*, struct task_struct*, __u64*)'
  'int __traceiter_android_vh_delayacct_compact_end(void*, void*)'
  'int __traceiter_android_vh_delayacct_compact_start(void*, void*)'
  'int __traceiter_android_vh_delayacct_freepages_end(void*, void*)'
  'int __traceiter_android_vh_delayacct_freepages_start(void*, void*)'
  'int __traceiter_android_vh_delayacct_swapin_end(void*, void*)'
  'int __traceiter_android_vh_delayacct_swapin_start(void*, void*)'
  'int __traceiter_android_vh_delayacct_thrashing_end(void*, bool*)'
  'int __traceiter_android_vh_delayacct_thrashing_start(void*, bool*)'
  'int __traceiter_android_vh_delayacct_wpcopy_end(void*, void*)'
  'int __traceiter_android_vh_delayacct_wpcopy_start(void*, void*)'
  'int __traceiter_android_vh_exit_mm(void*, struct mm_struct*)'
  'int _atomic_dec_and_lock_irqsave(atomic_t*, spinlock_t*, unsigned long*)'
  'void add_disk_randomness(struct gendisk*)'
  'void bio_uninit(struct bio*)'
  'struct gendisk* blk_mq_alloc_disk_for_queue(struct request_queue*, struct lock_class_key*)'
  'int block_read_full_folio(struct folio*, get_block_t*)'
  'struct bsg_device* bsg_register_queue(struct request_queue*, struct device*, const char*, bsg_sg_io_fn*)'
  'void bsg_unregister_queue(struct bsg_device*)'
  'void buffer_check_dirty_writeback(struct folio*, bool*, bool*)'
  'void call_rcu_hurry(struct callback_head*, rcu_callback_t)'
  'unsigned long clock_t_to_jiffies(unsigned long)'
  'int devcgroup_check_permission(short, u32, u32, short)'
  'int filemap_fdatawait_keep_errors(struct address_space*)'
  'bool folio_mark_dirty(struct folio*)'
  'void folio_unlock(struct folio*)'
  'void invalidate_bh_lrus()'
  'void mempool_exit(mempool_t*)'
  'int mempool_init(mempool_t*, int, mempool_alloc_t*, mempool_free_t*, void*)'
  'void percpu_counter_destroy(struct percpu_counter*)'
  'void percpu_ref_exit(struct percpu_ref*)'
  'int percpu_ref_init(struct percpu_ref*, percpu_ref_func_t*, unsigned int, gfp_t)'
  'bool percpu_ref_is_zero(struct percpu_ref*)'
  'void percpu_ref_kill_and_confirm(struct percpu_ref*, percpu_ref_func_t*)'
  'void percpu_ref_resurrect(struct percpu_ref*)'
  'void percpu_ref_switch_to_atomic_sync(struct percpu_ref*)'
  'void percpu_ref_switch_to_percpu(struct percpu_ref*)'
  'struct folio* read_cache_folio(struct address_space*, unsigned long, filler_t*, struct file*)'
  'int register_tracepoint_module_notifier(struct notifier_block*)'
  'int scsi_register_driver(struct device_driver*)'
  'void set_delayacct_enabled(bool)'
  'void trace_seq_puts(struct trace_seq*, const char*)'

19 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_delayacct_init'
  'struct tracepoint __tracepoint_android_rvh_delayacct_tsk_free'
  'struct tracepoint __tracepoint_android_rvh_delayacct_tsk_init'
  'struct tracepoint __tracepoint_android_vh_delayacct_add_tsk'
  'struct tracepoint __tracepoint_android_vh_delayacct_blkio_end'
  'struct tracepoint __tracepoint_android_vh_delayacct_blkio_start'
  'struct tracepoint __tracepoint_android_vh_delayacct_blkio_ticks'
  'struct tracepoint __tracepoint_android_vh_delayacct_compact_end'
  'struct tracepoint __tracepoint_android_vh_delayacct_compact_start'
  'struct tracepoint __tracepoint_android_vh_delayacct_freepages_end'
  'struct tracepoint __tracepoint_android_vh_delayacct_freepages_start'
  'struct tracepoint __tracepoint_android_vh_delayacct_swapin_end'
  'struct tracepoint __tracepoint_android_vh_delayacct_swapin_start'
  'struct tracepoint __tracepoint_android_vh_delayacct_thrashing_end'
  'struct tracepoint __tracepoint_android_vh_delayacct_thrashing_start'
  'struct tracepoint __tracepoint_android_vh_delayacct_wpcopy_end'
  'struct tracepoint __tracepoint_android_vh_delayacct_wpcopy_start'
  'struct tracepoint __tracepoint_android_vh_exit_mm'
  'struct cgroup_subsys io_cgrp_subsys'

Bug: 372173984

Change-Id: Iba231c44acd0d1e5c6c8c19259ed3a3c4f8cb190
Signed-off-by: hao lv <hao.lv5@transsion.com>
2024-10-08 19:03:31 +00:00
Mukesh Ojha
8d29837471 UPSTREAM: firmware_loader: Abort all upcoming firmware load request once reboot triggered
There could be following scenario where there is a ongoing reboot
is going from processA which tries to call all the reboot notifier
callback and one of them is firmware reboot call which tries to
abort all the ongoing firmware userspace request under fw_lock but
there could be another processB which tries to do request firmware,
which came just after abort done from ProcessA and ask for userspace
to load the firmware and this can stop the ongoing reboot ProcessA
to stall for next 60s(default timeout) which may not be expected
behaviour everyone like to see, instead we should abort any firmware
load request which came once firmware knows about the reboot through
notification.

      ProcessA                             ProcessB

kernel_restart_prepare
  blocking_notifier_call_chain
   fw_shutdown_notify
     kill_pending_fw_fallback_reqs
      __fw_load_abort
       fw_state_aborted                request_firmware
         __fw_state_set                 firmware_fallback_sysfs
...                                       fw_load_from_user_helper
..                                         ...
.                                          ..
                                            usermodehelper_read_trylock
                                             fw_load_sysfs_fallback
                                              fw_sysfs_wait_timeout
usermodehelper_disable
 __usermodehelper_disable
  down_write()

Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/1698330459-31776-2-git-send-email-quic_mojha@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 309378049
Change-Id: I61eb91f21a01460f340f890b25c60de7597a87ff
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/1698330459-31776-2-git-send-email-quic_mojha@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit effd7c70eaa0440688b60b9d419243695ede3c45)
Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
2024-10-08 14:27:15 +05:30
Mukesh Ojha
a9d791a2b2 UPSTREAM: firmware_loader: Refactor kill_pending_fw_fallback_reqs()
Rename 'only_kill_custom' and refactor logic related to it
to be more meaningful.

Bug: 309378049
Change-Id: I119d2f8c29b9b624e6c1d8546c1533d76a2cc51d
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/1698330459-31776-1-git-send-email-quic_mojha@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 87ffa98eeee8d62a56afdad80ea697e7a6e5c354)
Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
2024-10-08 14:26:59 +05:30
Rick Yiu
0e8b65e41f ANDROID: sched: Make uclamp changes depend on CAP_SYS_NICE
There is currently nothing preventing tasks from changing their per-task
clamp values in anyway that they like. The rationale is probably that
system administrators are still able to limit those clamps thanks to the
cgroup interface. However, this causes pain in a system where both
per-task and per-cgroup clamp values are expected to be under the
control of core system components (as is the case for Android).

To fix this, let's require CAP_SYS_NICE to change per-task clamp values.
There are ongoing discussions upstream about more flexible approaches
than this using the RLIMIT API -- see [1]. But the upstream discussion
has not converged yet, and this is way too late for UAPI changes in
android12-5.10 anyway, so let's apply this change which provides the
behaviour we want without actually impacting UAPIs.

[1] https://lore.kernel.org/lkml/20210623123441.592348-4-qperret@google.com/

Bug: 187186685
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I749312a77306460318ac5374cf243d00b78120dd
2024-10-07 06:38:08 +00:00
Chao Yu
d4dab27b9d UPSTREAM: f2fs: fix to update i_ctime in __f2fs_setxattr()
generic/728       - output mismatch (see /media/fstests/results//generic/728.out.bad)
    --- tests/generic/728.out	2023-07-19 07:10:48.362711407 +0000
    +++ /media/fstests/results//generic/728.out.bad	2023-07-19 08:39:57.000000000 +0000
     QA output created by 728
    +Expected ctime to change after setxattr.
    +Expected ctime to change after removexattr.
     Silence is golden
    ...
    (Run 'diff -u /media/fstests/tests/generic/728.out /media/fstests/results//generic/728.out.bad'  to see the entire diff)
generic/729        1s

It needs to update i_ctime after {set,remove}xattr, fix it.
Bug: 369150601
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Change-Id: I06ecb39a14703efe711bfceef6b52790405b9d2f
(cherry picked from commit 8874ad7dae)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-03 20:50:04 +00:00
Chao Yu
d645f73da1 UPSTREAM: f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation
We should always truncate pagecache while truncating on-disk data.

Fixes: a46bebd502 ("f2fs: synchronize atomic write aborts")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 369150601
Change-Id: Id26fbc5e80b87ca4334b9cd556885900b507ce4a
(cherry picked from commit ebd3309aec6271c4616573b0cb83ea25e623070a)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-03 20:50:04 +00:00
Yeongjin Gil
693980c220 BACKPORT: f2fs: Create COW inode from parent dentry for atomic write
The i_pino in f2fs_inode_info has the previous parent's i_ino when inode
was renamed, which may cause f2fs_ioc_start_atomic_write to fail.
If file_wrong_pino is true and i_nlink is 1, then to find a valid pino,
we should refer to the dentry from inode.

To resolve this issue, let's get parent inode using parent dentry
directly.

Fixes: 3db1de0e58 ("f2fs: change the current atomic write way")
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Sunmin Jeong <s_min.jeong@samsung.com>
Signed-off-by: Yeongjin Gil <youngjin.gil@samsung.com>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 369150601
Change-Id: I0a32c0a9f67b57ba02e6600ca22e96806ee5470d
(cherry picked from commit 8c1b787938fd86bab27a1492fa887408c75fec2b)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-03 20:50:04 +00:00
Chao Yu
e35539a5ac BACKPORT: f2fs: atomic: fix to avoid racing w/ GC
Case #1:
SQLite App		GC Thread		Kworker		Shrinker
- f2fs_ioc_start_atomic_write

- f2fs_ioc_commit_atomic_write
 - f2fs_commit_atomic_write
  - filemap_write_and_wait_range
  : write atomic_file's data to cow_inode
								echo 3 > drop_caches
								to drop atomic_file's
								cache.
			- f2fs_gc
			 - gc_data_segment
			  - move_data_page
			   - set_page_dirty

						- writepages
						 - f2fs_do_write_data_page
						 : overwrite atomic_file's data
						   to cow_inode
  - f2fs_down_write(&fi->i_gc_rwsem[WRITE])
  - __f2fs_commit_atomic_write
  - f2fs_up_write(&fi->i_gc_rwsem[WRITE])

Case #2:
SQLite App		GC Thread		Kworker
- f2fs_ioc_start_atomic_write

						- __writeback_single_inode
						 - do_writepages
						  - f2fs_write_cache_pages
						   - f2fs_write_single_data_page
						    - f2fs_do_write_data_page
						    : write atomic_file's data to cow_inode
			- f2fs_gc
			 - gc_data_segment
			  - move_data_page
			   - set_page_dirty

						- writepages
						 - f2fs_do_write_data_page
						 : overwrite atomic_file's data to cow_inode
- f2fs_ioc_commit_atomic_write

In above cases racing in between atomic_write and GC, previous
data in atomic_file may be overwrited to cow_file, result in
data corruption.

This patch introduces PAGE_PRIVATE_ATOMIC_WRITE bit flag in page.private,
and use it to indicate that there is last dirty data in atomic file,
and the data should be writebacked into cow_file, if the flag is not
tagged in page, we should never write data across files.

Fixes: 3db1de0e58 ("f2fs: change the current atomic write way")
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 369150601
Change-Id: I79e87d74a3a7eaea23490a9ee6da0f832c99abd3
(cherry picked from commit 1a0bd289a5db1df8df8fab949633a0b8d3f235ee)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-03 20:50:04 +00:00
Sunmin Jeong
9de4353ca0 UPSTREAM: f2fs: use meta inode for GC of COW file
In case of the COW file, new updates and GC writes are already
separated to page caches of the atomic file and COW file. As some cases
that use the meta inode for GC, there are some race issues between a
foreground thread and GC thread.

To handle them, we need to take care when to invalidate and wait
writeback of GC pages in COW files as the case of using the meta inode.
Also, a pointer from the COW inode to the original inode is required to
check the state of original pages.

For the former, we can solve the problem by using the meta inode for GC
of COW files. Then let's get a page from the original inode in
move_data_block when GCing the COW file to avoid race condition.

Fixes: 3db1de0e58 ("f2fs: change the current atomic write way")
Cc: stable@vger.kernel.org #v5.19+
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Yeongjin Gil <youngjin.gil@samsung.com>
Signed-off-by: Sunmin Jeong <s_min.jeong@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 369150601
Change-Id: Ibebf5ecb100b23680ef320586d83e74c41339377
(cherry picked from commit f18d0076933689775fe7faeeb10ee93ff01be6ab)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-03 20:50:04 +00:00
Sunmin Jeong
9b5ee2f2b1 BACKPORT: f2fs: use meta inode for GC of atomic file
The page cache of the atomic file keeps new data pages which will be
stored in the COW file. It can also keep old data pages when GCing the
atomic file. In this case, new data can be overwritten by old data if a
GC thread sets the old data page as dirty after new data page was
evicted.

Also, since all writes to the atomic file are redirected to COW inodes,
GC for the atomic file is not working well as below.

f2fs_gc(gc_type=FG_GC)
  - select A as a victim segment
  do_garbage_collect
    - iget atomic file's inode for block B
    move_data_page
      f2fs_do_write_data_page
        - use dn of cow inode
        - set fio->old_blkaddr from cow inode
    - seg_freed is 0 since block B is still valid
  - goto gc_more and A is selected as victim again

To solve the problem, let's separate GC writes and updates in the atomic
file by using the meta inode for GC writes.

Fixes: 3db1de0e58 ("f2fs: change the current atomic write way")
Cc: stable@vger.kernel.org #v5.19+
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Yeongjin Gil <youngjin.gil@samsung.com>
Signed-off-by: Sunmin Jeong <s_min.jeong@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 369150601
Change-Id: I0bcc1da7a59df3254d736ba3fb1d81a6d31bbbcd
(cherry picked from commit b40a2b00370931b0c50148681dd7364573e52e6b)
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-10-03 20:50:04 +00:00
Monish Chunara
30f8a76da5 ANDROID: abi_gki_aarch64_qcom: Add missing symbol to QCOM list
Add the following symbol for power_supply_core driver to be used in
bq27xxx_battery driver.

1 function symbol(s) added
  'struct power_supply *__must_check power_supply_register_no_ws(struct
          device *, const struct power_supply_desc *, const struct
          power_supply_config *)'

Bug: 370695775
Change-Id: Ie47064f9724b52ef260c33f12e7681e0eee74a1e
Signed-off-by: Monish Chunara <quic_mchunara@quicinc.com>
2024-10-03 14:43:20 +00:00
Victor Shutemov
6f2e0215d7 ANDROID: GKI: Add KMI symbols for virtio-audio
virtio-audio is used in Haleytek and Volvo Cars audio.
Symbols added:
  snd_device_new
  snd_pcm_hw_limit_rates
  _snd_pcm_stream_lock_irqsave
  snd_pcm_stream_unlock_irqrestore

Bug: 370896645
Change-Id: I741aa41e4ecb873994e567734ebe6728e1de2a69
Signed-off-by: Victor Shutemov <victor@haleytek.com>
2024-10-03 14:34:54 +00:00
Giuliano Procida
ba06e1f121 ANDROID: fix up ABI with change to private struct geni_wrapper
Commit 63fc9af83c ("soc: qcom: geni-se:
add desc struct to specify clocks from device match data") modifies a
structure in drivers/soc/qcom/qcom-geni-se.c as follows.

type 'struct geni_wrapper' changed
  byte size changed from 48 to 56
  member 'struct clk_bulk_data ahb_clks[2]' was removed
  member 'struct clk_bulk_data clks[2]' was added
  member 'unsigned int num_clks' was added

The Android 14 ABI tooling does not exclude this type definition.
This commit updates the ABI representation with the apparent break.
This is safe because the type is not visible to any other code.

Bug: 370629635
Change-Id: I9caeba4a48c4485e209352fa8fe56244e7859ea7
Signed-off-by: Giuliano Procida <gprocida@google.com>
2024-10-03 11:55:35 +00:00
Neil Armstrong
e0de5c9e33 UPSTREAM: soc: qcom: geni-se: add desc struct to specify clocks from device match data
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.

Prepare support for the I2C Master Hub variant by moving the required
clocks list to a new desc struct then passing it through the compatible
match data.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

Bug: 370629635
Change-Id: I3dacf29d5a1c630b676bf35644222fd96b399446
(cherry picked from commit 63fc9af83c)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-03 11:55:35 +00:00
Seiya Wang
1cdc168f1e ANDROID: GKI: Update symbol list for mtk
2 function symbol(s) added
  'int alloc_contig_range(unsigned long start, unsigned long end, unsigned migratetype, gfp_t gfp_mask)'
  'void free_contig_range(unsigned long pfn, unsigned long nr_pages)'

Bug: 370415608
Change-Id: I6ed58458b26364c07779d4b4f662444f14e9a146
Signed-off-by: Seiya Wang <seiya.wang@mediatek.com>
2024-10-01 22:33:24 +00:00
Mark Rutland
7c49c3acea UPSTREAM: arm64: cputype: Add Neoverse-V3 definitions
[ Upstream commit 0ce85db6c2141b7ffb95709d76fc55a27ff3cdc1 ]

Add cputype definitions for Neoverse-V3. These will be used for errata
detection in subsequent patches.

These values can be found in Table B-249 ("MIDR_EL1 bit descriptions")
in issue 0001-04 of the Neoverse-V3 TRM, which can be found at:

  https://developer.arm.com/documentation/107734/0001/?lang=en

Bug: 342491759
Change-Id: Ia2aefecb1f4e0b9c9ae613884f07dfd7d4961fa4
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20240508081400.235362-4-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
[ Mark: trivial backport ]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Chunhui Li <chunhui.li@mediatek.com>
2024-10-01 16:48:05 +00:00
Mark Rutland
53769a60e3 UPSTREAM: arm64: cputype: Add Cortex-X4 definitions
[ Upstream commit 02a0a04676fa7796d9cbc9eb5ca120aaa194d2dd ]

Add cputype definitions for Cortex-X4. These will be used for errata
detection in subsequent patches.

These values can be found in Table B-249 ("MIDR_EL1 bit descriptions")
in issue 0002-05 of the Cortex-X4 TRM, which can be found at:

  https://developer.arm.com/documentation/102484/0002/?lang=en

Bug: 342491759
Change-Id: I0c13397cb6b2220dc511a039bf18f462d70ba08d
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20240508081400.235362-3-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
[ Mark: fix conflict (dealt with upstream via a later merge) ]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Chunhui Li <chunhui.li@mediatek.com>
2024-10-01 16:48:05 +00:00
Mark Rutland
ecc82c7e71 UPSTREAM: arm64: barrier: Restore spec_bar() macro
[ Upstream commit ebfc726eae3f31bdb5fae1bbd74ef235d71046ca ]

Upcoming errata workarounds will need to use SB from C code. Restore the
spec_bar() macro so that we can use SB.

This is effectively a revert of commit:

  4f30ba1cce ("arm64: barrier: Remove spec_bar() macro")

Bug: 342491759
Change-Id: Ib62a0e6c1934c61d6cc46ea412a342dd002bcb5c
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20240508081400.235362-2-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
[ Mark: trivial backport ]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Chunhui Li <chunhui.li@mediatek.com>
2024-10-01 16:47:55 +00:00
Snehal Koukuntla
bd3cc5c733 UPSTREAM: KVM: arm64: Add memory length checks and remove inline in do_ffa_mem_xfer
When we share memory through FF-A and the description of the buffers
exceeds the size of the mapped buffer, the fragmentation API is used.
The fragmentation API allows specifying chunks of descriptors in subsequent
FF-A fragment calls and no upper limit has been established for this.
The entire memory region transferred is identified by a handle which can be
used to reclaim the transferred memory.
To be able to reclaim the memory, the description of the buffers has to fit
in the ffa_desc_buf.
Add a bounds check on the FF-A sharing path to prevent the memory reclaim
from failing.

Also do_ffa_mem_xfer() does not need __always_inline, except for the
BUILD_BUG_ON() aspect, which gets moved to a macro.

[maz: fixed the BUILD_BUG_ON() breakage with LLVM, thanks to Wei-Lin Chang
 for the timely report]

Fixes: 634d90cf0a ("KVM: arm64: Handle FFA_MEM_LEND calls from the host")
Cc: stable@vger.kernel.org
Reviewed-by: Sebastian Ene <sebastianene@google.com>
Signed-off-by: Snehal Koukuntla <snehalreddy@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240909180154.3267939-1-snehalreddy@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit f26a525b77e040d584e967369af1e018d2d59112)

Bug: 298514256
Change-Id: If515f5c03db42e7c994f9f82bef6167b104d75e2
Signed-off-by: Snehal Koukuntla <snehalreddy@google.com>
2024-10-01 08:13:54 +00:00
Pierre Couillaud
a43e7c2c12 ANDROID: GKI: Update symbol list for BCMSTB
INFO: 6 function symbol(s) added
  'void __read_overflow2_field(size_t, size_t)'
  'int iommu_fwspec_init(struct device*, struct fwnode_handle*, const struct iommu_ops*)'
  'struct pci_host_bridge* pci_find_host_bridge(struct pci_bus*)'
  'long strnlen_user(const char*, long)'
  'int tty_buffer_request_room(struct tty_port*, size_t)'
  'int tty_buffer_set_limit(struct tty_port*, int)'

Bug: 369085303
Change-Id: Ia56882467e3f523ad476db0d237f69ffc4e80084
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
2024-09-30 22:48:00 +00:00
Besar Wicaksono
5162f9a67b UPSTREAM: arm64: Add Neoverse-V2 part
[ Upstream commit f4d9d9dcc70b96b5e5d7801bd5fbf8491b07b13d ]

Add the part number and MIDR for Neoverse-V2

Bug: 342491759

Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-by: James Clark <james.clark@arm.com>
Link: https://lore.kernel.org/r/20240109192310.16234-2-bwicaksono@nvidia.com
Signed-off-by: Will Deacon <will@kernel.org>
[ Mark: trivial backport ]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Chunhui Li <chunhui.li@mediatek.com>
Change-Id: I2811f794a836d7c8f868b4f069e5d1e05ed69741
2024-09-30 18:10:28 +00:00
Faisal Hassan
1105954181 UPSTREAM: usb: dwc3: core: update LC timer as per USB Spec V3.2
This fix addresses STAR 9001285599, which only affects DWC_usb3 version
3.20a. The timer value for PM_LC_TIMER in DWC_usb3 3.20a for the Link
ECN changes is incorrect. If the PM TIMER ECN is enabled via GUCTL2[19],
the link compliance test (TD7.21) may fail. If the ECN is not enabled
(GUCTL2[19] = 0), the controller will use the old timer value (5us),
which is still acceptable for the link compliance test. Therefore, clear
GUCTL2[19] to pass the USB link compliance test: TD 7.21.

Cc: stable@vger.kernel.org
Signed-off-by: Faisal Hassan <quic_faisalh@quicinc.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20240829094502.26502-1-quic_faisalh@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 9149c9b0c7e046273141e41eebd8a517416144ac
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master)

Bug: 366400205
Change-Id: I8708984ce6c626df0c02045199301aa536520e83
Signed-off-by: Faisal Hassan <quic_faisalh@quicinc.com>
2024-09-27 18:42:18 +00:00
Kever Yang
cc274231f6 ANDROID: GKI: Add symbol for pci power limit
INFO: 1 function symbol(s) added
  'u32 of_pci_get_slot_power_limit(struct device_node*, u8*, u8*)'

Bug: 300024866
Change-Id: I558dbc6126dfd509ef200b08d5394c888aef9685
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2024-09-27 18:29:11 +08:00
Anant Goel
5a912daf87 ANDROID: OPP: fix function args mismatch for dev_pm_opp_add in pm_opp.h
The function prototype for dev_pm_opp_add differs between a
configuration when CONFIG_PM_OPP is set versus when CONFIG_PM_OPP is not
set.
Fix this mismatch by aligning the function arguments for the dummy
dev_pm_opp_add with the non-dummy version.

Bug: 369659366
Fixes: adf41f4737 ("BACKPORT: OPP: Add dev_pm_opp_add_dynamic() to allow more flexibility")
Change-Id: If23af6ba28bb493d619f96846545cb86608b285d
Signed-off-by: Anant Goel <quic_anantg@quicinc.com>
2024-09-27 00:34:46 +00:00
meitaogao
bcc435d374 ANDROID: GKI: Update KMI symbol list for ASR
INFO: 9 function symbol(s) added
  'unsigned int kmem_cache_size(struct kmem_cache*)'
  'void media_device_unregister_entity(struct media_entity*)'
  'void* memset16(uint16_t*, uint16_t, size_t)'
  'const char* const* v4l2_ctrl_get_menu(u32)'
  'bool v4l2_ctrl_type_op_equal(const struct v4l2_ctrl*, union v4l2_ctrl_ptr, union v4l2_ctrl_ptr)'
  'void v4l2_ctrl_type_op_init(const struct v4l2_ctrl*, u32, union v4l2_ctrl_ptr)'
  'void v4l2_ctrl_type_op_log(const struct v4l2_ctrl*)'
  'void v4l2_m2m_buf_done_and_job_finish(struct v4l2_m2m_dev*, struct v4l2_m2m_ctx*, enum vb2_buffer_state)'
  'struct vb2_v4l2_buffer* v4l2_m2m_last_buf(struct v4l2_m2m_queue_ctx*)'

Bug: 369670477
Change-Id: I5c3fa32e903685836b7812d33df8ddd6b2c65054
Signed-off-by: meitaogao <meitaogao@asrmicro.com>
2024-09-26 18:25:55 +08:00
yipeng xiang
9e167c1c27 ANDROID: GKI: Export a symbol “next_arg” for honor
Export a symbol “next_arg” in android/abi_gki_aarch64_honor

Bug: 368221985
Change-Id: I0bd8fc321752f0fa3d103b56510b33eadcb6e39b
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
2024-09-25 19:24:24 +00:00
Stephen Hemminger
4dcae85afd BACKPORT: netem: fix return value if duplicate enqueue fails
[ Upstream commit c07ff8592d57ed258afee5a5e04991a48dbaf382 ]

There is a bug in netem_enqueue() introduced by
commit 5845f70638 ("net: netem: fix skb length BUG_ON in __skb_to_sgvec")
that can lead to a use-after-free.

This commit made netem_enqueue() always return NET_XMIT_SUCCESS
when a packet is duplicated, which can cause the parent qdisc's q.qlen
to be mistakenly incremented. When this happens qlen_notify() may be
skipped on the parent during destruction, leaving a dangling pointer
for some classful qdiscs like DRR.

There are two ways for the bug happen:

- If the duplicated packet is dropped by rootq->enqueue() and then
  the original packet is also dropped.
- If rootq->enqueue() sends the duplicated packet to a different qdisc
  and the original packet is dropped.

In both cases NET_XMIT_SUCCESS is returned even though no packets
are enqueued at the netem qdisc.

The fix is to defer the enqueue of the duplicate packet until after
the original packet has been guaranteed to return NET_XMIT_SUCCESS.

Bug: 362391455
Fixes: 5845f70638 ("net: netem: fix skb length BUG_ON in __skb_to_sgvec")
Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240819175753.5151-1-stephen@networkplumber.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0486d31dd8)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I390f02549c726e961f57daace468d5cd48468722
2024-09-25 18:41:03 +00:00
Kalesh Singh
f4bcd4ef0f ANDROID: 16K: Fixup padding vm_flags bits on VMA splits
In some cases VMAs are split without the mmap write lock held;
later the lock is taken to fixup vm_flags of the original VMA.
Since some uppper bits of vm_flags are used to encode the ELF
padding ranges, they need to be modified on splits. This is
usually handled correctly by __split_vma(). However in the above
case, the flags get over witten later under the write lock.

Preserve vm_flag bits on reset to correctly represent padding.

Bug: 357901498
Change-Id: I1cb75419e614791a47cbdb0341373f619daf0bf2
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-09-25 17:23:10 +00:00
Kalesh Singh
9027204d5a ANDROID: 16K: Introduce pgsize_migration_inline.h
Introduce inline header to avoid circular dependency. This
will be used in a subsequent patch.

Also take opportunity to do some small noop refactor in
vma_pad_pages() and split_pad_vma() for more robust code.

Bug: 357901498
Change-Id: Ia5f447758d0d07ed3e1429ca1e35dcc0741cc22a
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-09-25 17:23:10 +00:00
Carlos Llamas
03b93dc707 FROMLIST: binder: fix BINDER_WORK_FROZEN_BINDER debug logs
The BINDER_WORK_FROZEN_BINDER type is not handled in the binder_logs
entries and it shows up as "unknown work" when logged:

  proc 649
  context binder-test
    thread 649: l 00 need_return 0 tr 0
    ref 13: desc 1 node 8 s 1 w 0 d 0000000053c4c0c3
    unknown work: type 10

This patch add the freeze work type and is now logged as such:

  proc 637
  context binder-test
    thread 637: l 00 need_return 0 tr 0
    ref 8: desc 1 node 3 s 1 w 0 d 00000000dc39e9c6
    has frozen binder

Fixes: d579b04a52a1 ("binder: frozen notification")
Cc: stable@vger.kernel.org
Signed-off-by: Carlos Llamas <cmllamas@google.com>

Bug: 366003708
Link: https://lore.kernel.org/all/20240924184401.76043-5-cmllamas@google.com/
Change-Id: I06f888aa5218db19eeda79e315385506af09d9d5
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-09-25 03:06:31 +00:00