Commit Graph

1163394 Commits

Author SHA1 Message Date
Jiri Slaby (SUSE)
4dc2498506 UPSTREAM: tty: serial: simplify qcom_geni_serial_send_chunk_fifo()
* use memcpy() instead of the loop (removes c variable)
* use remaining parameter directly (removes chunk variable)

The code is simpler and easier to follow.

Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230420093514.13055-1-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I297af26a5d1eeac9d1886582a09d917efce6a7bf
(cherry picked from commit 5c7e105cd1)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:33:20 +00:00
Douglas Anderson
719b876f95 UPSTREAM: tty: serial: qcom-geni-serial: Add a poll_init() function
On sc7180 Chromebooks, I did the following:
* Didn't enable earlycon in the kernel command line.
* Didn't enable serial console in the kernel command line.
* Didn't enable an agetty or any other client of "/dev/ttyMSM0".
* Added "kgdboc=ttyMSM0" to the kernel command line.

After I did that, I tried to enter kdb with this command over an ssh
session:
  echo g > /proc/sysrq-trigger

When I did that the system just hung.

Although I thought I'd tested this scenario before, I couldn't go back
and find a time when it was working. Previous testing must have relied
on either the UART acting as the kernel console or an agetty running.

It turns out to be pretty easy to fix: we can just use
qcom_geni_serial_port_setup() as the .poll_init() function. This,
together with the patch ("serial: uart_poll_init() should power on the
UART"), allows the debugger to work even if there are no other users
of the serial port.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230316132027.RESEND.2.Ie678853bb101091afe78cc8c22344bf3ff3aed74@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I9e362aeffbb0a6a4e68f516e5325451288409172
(cherry picked from commit d8851a96ba)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:33:20 +00:00
Johan Hovold
d15f99d2b5 UPSTREAM: serial: qcom-geni: drop bogus uart_write_wakeup()
Drop the bogus uart_write_wakeup() from when setting up a new DMA
transfer, which does not free up any more space in the ring buffer.

Any pending writers will be woken up when the transfer completes.

Cc: stable <stable@kernel.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8540p-ride
Link: https://lore.kernel.org/r/20230307164405.14218-5-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Ic15a29678c6a6bc3f39af06053e1354de0ba442a
(cherry picked from commit b6a7bac184)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:33:20 +00:00
Johan Hovold
3991e7fcc9 UPSTREAM: serial: qcom-geni: fix mapping of empty DMA buffer
Make sure that there is data in the ring buffer before trying to set up
a zero-length DMA transfer.

This specifically fixes the following warning when unmapping the empty
buffer on the sc8280xp-crd:

   WARNING: CPU: 0 PID: 138 at drivers/iommu/dma-iommu.c:1046 iommu_dma_unmap_page+0xbc/0xd8
   ...
   Call trace:
    iommu_dma_unmap_page+0xbc/0xd8
    dma_unmap_page_attrs+0x30/0x1c8
    geni_se_tx_dma_unprep+0x28/0x38
    qcom_geni_serial_isr+0x358/0x75c

Fixes: 2aaa43c707 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
Cc: stable <stable@kernel.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8540p-ride
Link: https://lore.kernel.org/r/20230307164405.14218-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Idf35c80ec7975d2b5c2968948cecdd9c1e7e4cf5
(cherry picked from commit 97820780b7)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:33:20 +00:00
Johan Hovold
64bccf317e UPSTREAM: serial: qcom-geni: fix DMA mapping leak on shutdown
Fix what appears to be a copy-paste error that can lead to a leaked DMA
mapping on close() and failure to restart TX after the port is reopened.

Note that rx_dma_addr is generally NULL when
qcom_geni_serial_stop_tx_dma() is called as part of shutdown() (but
tx_dma_addr need not be).

Fixes: 2aaa43c707 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
Cc: stable <stable@kernel.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8540p-ride
Link: https://lore.kernel.org/r/20230307164405.14218-3-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I019a6af70b38cac1b0d89cd522d4e6c692e7baba
(cherry picked from commit 95fcfc0853)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Johan Hovold
4c3917c600 UPSTREAM: serial: qcom-geni: fix console shutdown hang
A recent commit added back the calls top stop tx and rx to shutdown()
which had previously been removed by commit e83766334f ("tty: serial:
qcom_geni_serial: No need to stop tx/rx on UART shutdown") in order to
be able to use kgdb after stopping the getty.

Not only did this again break kgdb, but it also broke serial consoles
more generally by hanging TX when stopping the getty during reboot.

The underlying problem has been there since the driver was first merged
and fixing it is going to be a bit involved so simply stop calling the
broken stop functions during shutdown for consoles for now.

Fixes: d8aca2f968 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown")
Cc: stable <stable@kernel.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8540p-ride
Link: https://lore.kernel.org/r/20230307164405.14218-2-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Ib532b26b318d720f74e02543e74fa26775ad4c4a
(cherry picked from commit 9aff74cc4e)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Ilpo Järvinen
8bbc5694db UPSTREAM: serial: qcom_geni: Fix variable naming
Commit 2aaa43c707 ("tty: serial: qcom-geni-serial: add support for
serial engine DMA") renamed rx_fifo member to rf_buf which caused a
build failure when b8caf69a69 ("tty: serial: qcom-geni-serial: fix
slab-out-of-bounds on RX FIFO buffer") from tty-linus was merged into
tty-next.

Fix the member variable name.

Fixes: 7a6aa989f2 ("Merge 6.2-rc5 into tty-next")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230123173857.40695-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I931e19ef4833321ba23b7c764650c1296c1615a6
(cherry picked from commit a3cf6b946e)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Bartosz Golaszewski
53be6ca12d BACKPORT: tty: serial: qcom-geni-serial: add support for serial engine DMA
The qcom-geni-serial driver currently only works in SE FIFO mode. This
limits the UART speed to around 180 kB/s. In order to achieve higher
speeds we need to use SE DMA mode.

Keep the console port working in FIFO mode but extend the code to use
DMA
for the high-speed port.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-15-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I0880354e27e04cb1a49a4759d6df7fe315311574
(cherry picked from commit 2aaa43c707)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Bartosz Golaszewski
3321cd20f3 BACKPORT: soc: qcom-geni-se: add more symbol definitions
The following symbols will be used when adding support for SE DMA in
the qcom geni serial driver.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link:https://lore.kernel.org/r/20221229155030.418800-14-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Id524d6937c9c59634195b3997c318dcac650b738
(cherry picked from commit 7de06d8455)
[ptalari: resolved conflict since file moved qcom-geni-se.h to
linux/soc/qcom/geni-se.h]
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Bartosz Golaszewski
61df751af7 BACKPORT: tty: serial: qcom-geni-serial: use of_device_id data
Instead of checking the device compatible in probe(), assign the
device-specific data to struct of_device_id. We'll use it later when
providing SE DMA support.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-13-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I3116f17cf59cefb3d065c402a1dd54fd19686dba
(cherry picked from commit 40ec6d41c8)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Bartosz Golaszewski
3ebd383e35 BACKPORT: tty: serial: qcom-geni-serial: drop the return value from handle_rx
The return value of the handle_rx() callback is never checked. Drop it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-12-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I41a50a0d933243fa03502c5fda997bd53ae14080
(cherry picked from commit 0626afe57b)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:24:04 +00:00
Bartosz Golaszewski
a88673be7e UPSTREAM: tty: serial: qcom-geni-serial: refactor qcom_geni_serial_send_chunk_fifo()
Shuffle the code a bit, drop unneeded variables, make types of others
more consistent and use uart_xmit_advance() instead of handling
tail->xmit manually.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-11-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I733a8ca4653d2e942b00f40d5106004f86af9ba1
(cherry picked from commit bd7955840c)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:22:38 +00:00
Douglas Anderson
94076b81a1 UPSTREAM: soc: qcom: geni-se: add GP_LENGTH/IRQ_EN_SET/IRQ_EN_CLEAR registers
For UART devices the M_GP_LENGTH is the TX word count. For other
devices this is the transaction word count.

For UART devices the S_GP_LENGTH is the RX word count.

The IRQ_EN set/clear registers allow you to set or clear bits in the
IRQ_EN register without needing a read-modify-write.

Acked-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20240610152420.v4.1.Ife7ced506aef1be3158712aa3ff34a006b973559@changeid
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20240906131336.23625-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I092594fffc83cdbf753c56d733da9b13ddfe0cc0
(cherry picked from commit b03ffc76b83c1a7d058454efbcf1bf0e345ef1c2)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:22:38 +00:00
Douglas Anderson
a137aa79a6 UPSTREAM: soc: qcom: geni-se: Add M_TX_FIFO_NOT_EMPTY bit definition
According to the docs I have, bit 21 of the status register is
asserted when the FIFO is _not_ empty. Add the definition.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20240112150307.1.I7dc0993c1e758a1efedd651e7e1670deb1b430fb@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I1372fe15b0d8b8ee302dccbc81f832be15a93ee5
(cherry picked from commit 486676116f4852d4198690c2c98af060cd96ab83)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-23 06:22:38 +00:00
Peter Wang
1790581f0a FROMLIST: ufs: core: requeue aborted request
After the SQ cleanup fix, the CQ will receive a response with
the corresponding tag marked as OCS: ABORTED. To align with
the behavior of Legacy SDB mode, the handling of OCS: ABORTED
has been changed to match that of OCS_INVALID_COMMAND_STATUS
(SDB), with both returning a SCSI result of DID_REQUEUE.

Furthermore, the workaround implemented before the SQ cleanup
fix can be removed.

Bug: 373785306
Fixes: ab248643d3 ("scsi: ufs: core: Add error handling for MCQ mode")
Change-Id: Id1d51f2921a519aa5d2a83b7fc70e17a45fb26b9
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/all/20241001091917.6917-3-peter.wang@mediatek.com/
2024-10-22 22:07:40 +00:00
Peter Wang
51903b71f0 FROMLIST: ufs: core: fix the issue of ICU failure
When setting the ICU bit without using read-modify-write,
SQRTCy will restart SQ again and receive an RTC return
error code 2 (Failure - SQ not stopped).

Additionally, the error log has been modified so that
this type of error can be observed.

Bug: 373785306
Fixes: ab248643d3 ("scsi: ufs: core: Add error handling for MCQ mode")
Change-Id: I46fca8eaeaa17c622349b26f97fc100aa182dea2
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/all/20241001091917.6917-2-peter.wang@mediatek.com/
2024-10-22 22:07:40 +00:00
Kever Yang
00f19bd9ed ANDROID: GKI: Add symbol for rockchip pci remove
INFO: 1 function symbol(s) added
  'void dw_pcie_host_deinit(struct dw_pcie_rp*)'

Bug: 300024866
Change-Id: I0d3d9bafcf1eb3cbbe2764c8fa030d63af5a7d3f
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2024-10-22 09:43:10 +08:00
Mrinmay Sarkar
5e1f4bb11f ANDROID: abi_gki_aarch64_qcom: Add pci_ecam_map_bus and pci_host_common_probe
Update abi_gki_aarch64_qcom with symbols needed for QCOM PCIe usecase.

2 function symbol(s) added
  'void* pci_ecam_map_bus(struct pci_bus*, unsigned int, int)'
  'int pci_host_common_probe(struct platform_device*)'

Bug: 374011847
Change-Id: I566c615134e79a67eb12158acb38ee88f3878a3b
Signed-off-by: Mrinmay Sarkar <quic_msarkar@quicinc.com>
2024-10-21 13:49:41 +00:00
yipeng xiang
72f51dd698 ANDROID: abi_gki_aarch64_honor: whitelist symbols added for skip memcg reclaim by priority
White list the __tracepoint_android_vh_should_memcg_bypass symbol.

1 function symbol(s) added
  'int __traceiter_android_vh_should_memcg_bypass(void*, struct mem_cgroup*, int, bool*)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_should_memcg_bypass'

Bug: 369921205
Change-Id: I13ae1efde783bb440fa0cbab5b436d522d58d2a2
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
2024-10-21 12:30:03 +00:00
yipeng xiang
f2b3f5888f ANDROID: mm: add vendor hook to skip memcg reclaim by priority
Add vendor hook to determine whether a memcg should be recalimed.
Avoid import memcg file pages are frequently reclaimed.

Bug: 369921205
Change-Id: Iac4abcf3a59a9c26ef9895a8f0d35aa6b6c26776
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
2024-10-21 12:30:03 +00:00
Fuad Tabba
add3d68602 ANDROID: KVM: arm64: Don't run a protected VCPU if it isn't runnable
Don't run a protected VCPU in pKVM if it isn't in a runnable PSCI
state. For protected VMs, the PSCI state is the reference state
for whether they are runnable or not.

Bug: 278749606
Bug: 373638114
Reported-by: Dmytro Maluka <dmaluka@google.com>
Change-Id: I17cc60852aa45225e65fe810f9b196e3afe88a70
Signed-off-by: Fuad Tabba <tabba@google.com>
2024-10-21 10:10:41 +00:00
Lianqin Hu
1fe91f863a ANDROID: usb: Optimization the transfer rate of accessory mode in USB3.2 mode
BmAttributes controls the maximum number of streams supported by the endpoint.
streaming is a data transmission mode that allows multiple data packets
to be sent simultaneously in one transmission cycle.

Set bmAttributes to 16, bulk endpoint with more than 65536 streams,
can effectively improve data throughput.

Modify bmAttributes to 16.
The 5Gbps peak rate increases from 350MB/s to 400MB/s.
The 10Gbps peak rate is increased from 500MB/s to 600MB/s.

Bug: 373314134

Change-Id: I4b6c9554ff39a7b2222461e1949825dd6148c006
Signed-off-by: Lianqin Hu <hulianqin@vivo.corp-partner.google.com>
Signed-off-by: Lianqin Hu <hulianqin@vivo.com>
2024-10-18 20:46:52 +00:00
Vijaya Krishna Nivarthi
299cc91948 UPSTREAM: spi: spi-geni-qcom: Select FIFO mode for chip select
Spi geni driver switches between FIFO and DMA modes based on xfer length.
FIFO mode relies on M_CMD_DONE_EN interrupt for completion while DMA mode
relies on XX_DMA_DONE.
During dynamic switching, if FIFO mode is chosen, FIFO related interrupts
are enabled and DMA related interrupts are disabled. And viceversa.
Chip select shares M_CMD_DONE_EN interrupt with FIFO to check completion.
Now, if a chip select operation is preceded by a DMA xfer, M_CMD_DONE_EN
interrupt would have been disabled and hence it will never receive one
resulting in timeout.

For chip select, in addition to setting the xfer mode to FIFO,
select_mode() to FIFO so that required interrupts are enabled.

Fixes: e5f0dfa78a ("spi: spi-geni-qcom: Add support for SE DMA mode")
Suggested-by: Praveen Talari <quic_ptalari@quicinc.com
Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com
Reviewed-by: Douglas Anderson <dianders@chromium.org
Link: https://lore.kernel.org/r/1683626496-9685-1-git-send-email-quic_vnivarth@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org

Bug: 370629635
Change-Id: Icd72416f413abc7fd67ac69c1a56251d9b2b4149
(cherry picked from commit 4c329f5da7)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-17 19:22:25 +00:00
Will Deacon
b490c66749 ANDROID: KVM: arm64: Don't skip accounting when memcache top-up fails
If topup_hyp_memcache() fails mid-way through a memcache top-up, we
should still account for the pages that were successfully added.

Don't skip accounting when topup_hyp_memcache() fails.

Bug: 373813803
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I2ffcfbe45452600994f5b69b73ea2bd00d64aeae
2024-10-17 17:02:24 +00:00
Will Deacon
1181501872 ANDROID: KVM: arm64: Fix accounting when VM creation fails
When VM creation fails part-way through __pkvm_create_hyp_vm(), we end
up destroying the partial state by calling pkvm_destroy_hyp_vm()
before the memory accounting metadata has been updated. Consequently,
we underflow the 'protected_hyp_mem' counter and run into the following
warning:

 18446744073709518848B of donations to the nVHE hyp are missing

Rework the accounting updates so that the per-VM structures are
accounted immediately after initialising the VM, with the vCPU memory
being accounted one-by-one as they are initialised.

Bug: 373813803
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: If4ae9816df009ca2a74aff5964676465c25fe6dc
2024-10-17 17:02:24 +00:00
Uwe Kleine-König
8baadbac00 UPSTREAM: spi: geni-qcom: 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.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230303172041.2103336-30-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 370629635
Change-Id: I604c1be770a2413f9370befef1acbbcb05b5191d
(cherry picked from commit d0b52f6539)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-17 13:21:07 +05:30
Vijaya Krishna Nivarthi
5ab05b86ef UPSTREAM: spi: spi-geni-qcom: Add support for SE DMA mode
SE DMA mode can be used for larger transfers and FIFO mode
for smaller transfers.

Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/1670509544-15977-1-git-send-email-quic_vnivarth@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 370629635
Change-Id: I912aa601420a92599b7aaad0f3e4ad5555bdef88
(cherry picked from commit e5f0dfa78a)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-17 11:03:41 +05:30
Praveen Talari
271bd223dd UPSTREAM: soc: qcom: geni-se: Add SPI Device mode support for GENI based QuPv3
Add device mode supported registers and masks.

Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
Reviewed-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Link: https://lore.kernel.org/r/20230714042203.14251-2-quic_ptalari@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 370629635
Change-Id: Ibfa810a93d0058912f827a76be9bd1fdacf88443
(cherry picked from commit 59bbe86bb2)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-17 10:58:26 +05:30
Bartosz Golaszewski
27021bed80 UPSTREAM: tty: serial: qcom-geni-serial: split out the FIFO tx code
qcom_geni_serial_handle_tx() is pretty big, let's move the code that
handles the actual writing of data to a separate function which makes
sense in preparation for introducing a dma variant of handle_tx().

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-10-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Id456ba7c9a15ea7e05f4dc18f50d03390dbffda1
(cherry picked from commit d420fb491c)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 22:43:45 +00:00
Bartosz Golaszewski
ad717604be UPSTREAM: tty: serial: qcom-geni-serial: remove unneeded tabs
Remove redundant indentation in struct member assignment.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-9-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I00241ff179f7e91367af3362c1324d9b55750f0a
(cherry picked from commit 3931b8fdec)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 22:43:45 +00:00
Bartosz Golaszewski
ad37632534 UPSTREAM: tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr()
Simplify the conditions in qcom_geni_serial_isr() and fix indentation.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20221229155030.418800-8-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Idd2f22b9a0ca3e9393c6c91d539127dbcad84609
(cherry picked from commit fe6a00e8fc)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 22:43:45 +00:00
Bartosz Golaszewski
1f0775355f UPSTREAM: tty: serial: qcom-geni-serial: remove stray newlines
Remove stray newlines around #ifdefs for consistency with the rest
of the driver code.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-7-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Id9bffc3e9154545ecdd92ed64d2da7589804d2b8
(cherry picked from commit 2f853f83f4)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 22:43:45 +00:00
Bartosz Golaszewski
59cbbd0b09 UPSTREAM: tty: serial: qcom-geni-serial: improve the to_dev_port() macro
The member we want to resolve in struct qcom_geni_serial_port is called
uport so we don't need an additional redundant parameter in this macro.

While at it: turn the macro into a static inline function.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-6-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: Ia1a89518e92925764573ff2f30836384bf7bfbf7
(cherry picked from commit 00ce7c6e86)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 20:56:40 +00:00
Bartosz Golaszewski
f4eec633c0 UPSTREAM: tty: serial: qcom-geni-serial: align #define values
Keep the #define symbols aligned for better readability.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-5-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I70a55f560269d0d9deec4bf499ee75d07065d030
(cherry picked from commit 6cde11dbf4)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 20:56:40 +00:00
Bartosz Golaszewski
b92a6c8545 UPSTREAM: tty: serial: qcom-geni-serial: remove unused symbols
Drop all unused symbols from the driver.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-4-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I855656c04c69602c8dfc391424ba4b395f08d91e
(cherry picked from commit 68c6bd92c8)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 20:56:40 +00:00
Bartosz Golaszewski
6e6cda8f06 UPSTREAM: tty: serial: qcom-geni-serial: drop unneeded forward definitions
If we shuffle the code a bit, we can drop all forward definitions of
various static functions.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-3-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: If741a90295960d502af58641c4db61ab14b1dabe
(cherry picked from commit d0fabb0dc1)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 20:56:40 +00:00
Bartosz Golaszewski
d75a50763e UPSTREAM: tty: serial: qcom-geni-serial: stop operations in progress at shutdown
We don't stop transmissions in progress at shutdown. This is fine with
FIFO SE mode but with DMA (support for which we'll introduce later) it
causes trouble so fix it now.

Fixes: e83766334f ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20221229155030.418800-2-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 370629635
Change-Id: I8ca4171bf25b530e7fc4bb91fad93358d753b746
(cherry picked from commit d8aca2f968)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 20:56:40 +00:00
Charan Teja Kalla
481220c5b9 ANDROID: abi_gki_aarch64_qcom: whitelist mm symbols
Whitelist the below symbols:
lru_gen_caps
unpack_shadow

Compiler o/p:
INFO: 1 function symbol(s) added
  'void unpack_shadow(void*, int*, pg_data_t**, unsigned long*, bool*)'

1 variable symbol(s) added
  'struct static_key_true lru_gen_caps[3]'

Bug: 369964379
Change-Id: I419c6273bfe2e4ce533e2c344d347683059822d5
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2024-10-16 19:52:42 +00:00
Charan Teja Kalla
e697302b05 ANDROID: mm: export lru_gen_caps
lru_gen_caps is exported to allow for lru_gen_enabled() to be used.

Bug: 369964379
Change-Id: Ic0a79eb19fd8da0232db1a63263be4184d960b4a
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2024-10-16 19:52:42 +00:00
Charan Teja Kalla
1a3bbc1910 ANDROID: mm: export unpack_shadow
The commit 56526cf94076("ANDROID: mm: swap: export and whitelist
get_shadow_from_swap_cache") exports the api to get the shadow entry
from the swap cache which is then used to check if this entry can be
further pushed down to slower devices.

At present, we are manually extracting the information from this shadow
entry using the same macros being used by unpack_shadow(). Instead
export this function.

Bug: 369964379
Change-Id: Id044add31434d234e4a6136f192c11ab20ad0985
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2024-10-16 19:52:42 +00:00
Jinjie Ruan
a6266110c1 UPSTREAM: i2c: qcom-geni: Use IRQF_NO_AUTOEN flag in request_irq()
disable_irq() after request_irq() still has a time gap in which
interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
disable IRQ auto-enable when request IRQ.

Fixes: 37692de5d5 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: <stable@vger.kernel.org> # v4.19+
Acked-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: Ifeed53c2672c0b934dfbcd19f4aba3512a20d14f
(cherry picked from commit e2c85d85a05f16af2223fcc0195ff50a7938b372)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Andi Shyti
c24feb930a UPSTREAM: i2c: qcom-geni: Use goto for clearer exit path
Refactor the code by using goto statements to reduce duplication
and make the exit path clearer.

Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: I6e7152bd47d76bc7dd0eb98ffd7906eb52b91478
(cherry picked from commit 23cc961a08591976eb17ca8552a602425b1a780d)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Andi Shyti
80c036f7f2 UPSTREAM: i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
Add the missing geni_icc_disable() call before returning in the
geni_i2c_runtime_resume() function.

Commit 9ba48db9f77c ("i2c: qcom-geni: Add missing
geni_icc_disable in geni_i2c_runtime_resume") by Gaosheng missed
disabling the interconnect in one case.

Fixes: bf225ed357 ("i2c: i2c-qcom-geni: Add interconnect support")
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: stable@vger.kernel.org # v5.9+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: I572d96cd5f29e9e1adac5c0b99c00792222fc4f0
(cherry picked from commit 4e91fa1ef3ce6290b4c598e54b5eb6cf134fbec8)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Gaosheng Cui
688cbb4cee UPSTREAM: i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
Add the missing geni_icc_disable() before return in
geni_i2c_runtime_resume().

Fixes: bf225ed357 ("i2c: i2c-qcom-geni: Add interconnect support")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: I63fc78059b3d90309131d19ecd86f8e1091c0970
(cherry picked from commit 9ba48db9f77ce0001dbb882476fa46e092feb695)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Gaosheng Cui
aff2261bb1 UPSTREAM: i2c: qcom-geni: Add missing clk_disable_unprepare in geni_i2c_runtime_resume
Add the missing clk_disable_unprepare() before return in
geni_i2c_runtime_resume().

Fixes: 14d02fbadb ("i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: I37ee2eab599292d459a78dfea8642569365c564b
(cherry picked from commit b93d16bee557302d4e588375ececd833cc048acc)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Wolfram Sang
371a327f3d UPSTREAM: i2c: qcom-geni: use 'time_left' variable with wait_for_completion_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_timeout() causing patterns like:

	timeout = wait_for_completion_timeout(...)
	if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.

Fix to the proper variable type 'unsigned long' while here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: Idfddb7efcc4fb0aeceb7972316415afab815faca
(cherry picked from commit f9288ff67a8f4bc2645d32a512d4b30f73f956d5)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
Wolfram Sang
c756c6b094 UPSTREAM: i2c: qcom-geni: remove printout on handled timeouts
I2C and SMBus timeouts are not something the user needs to be informed
about on controller level. The client driver may know if that really is
a problem and give more detailed information to the user. The controller
should just pass this information upwards. Remove the printout.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

Bug: 370629635
Change-Id: Ie1390ae6031913154eb152517f2f4e5147c5fe87
(cherry picked from commit 6d128e73c7820356a3481024166b9f3dc3aee99c)
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
2024-10-16 19:38:37 +00:00
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