Commit Graph

1116020 Commits

Author SHA1 Message Date
Chris Lew
d8e12b91fa net: qrtr: ns: Return 0 if server port is not present
When a del client message is received from remote, the corresponding
server port is deleted. And then, a del server message is announced
for this server. As part of handling this message, ns will try to
delete this server port again and returns a -ENOENT error. Return
value from server_del is returned back to qrtr_ns_worker and any
non-zero value is printed to the serial port. This is flooding the
serial port display. Returinng 0 in this case as this is not an error.

Change-Id: Icd2594875f55313baa6e3313b6aa0c62facc5b2d
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 10:00:36 -07:00
Chris Lew
82b36ba3cb net: qrtr: ns: Remove check for spoofed messages
In external soc usecases, it is possible to receive control
messages for a node that is not the src node. The APPS on the
external soc will forward control messages from the modem.

Change-Id: Ibbf8f27fa64b18e387e40e655a13b5251190a00b
Signed-off-by: Tony Truong <truong@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 10:00:20 -07:00
Chris Lew
06424dff8c net: qrtr: ns: Change servers radix tree to xarray
There is a use after free scenario while iterating through the servers
radix tree despite the ns being a single threaded process. This can
happen when the radix tree APIs are not synchronized with the
rcu_read_lock() APIs.

Convert the radix tree for servers to xarray to take advantage of the
built in rcu lock usage provided by xarray.

Change-Id: I1d9b017da4efba9d8fc72e4666253060cc7b87e3
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 10:00:13 -07:00
Chris Lew
6ec2df4fa3 net: qrtr: ns: Change nodes radix tree to xarray
There is a use after free scenario while iterating through the servers
radix tree despite the ns being a single threaded process. This can
happen when the radix tree APIs are not synchronized with the
rcu_read_lock() APIs.

Convert the radix tree for nodes to xarray to take advantage of the
built in rcu lock usage provided by xarray.

Change-Id: If2f735abf911b7b47cd7cb07224751114a2bf943
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:59:03 -07:00
Chris Lew
f9991ae46e net: qrtr: Handle IPCR control port format of older targets
The destination port value in the IPCR control buffer on older
targets is 0xFFFF. Handle the same by updating the dst_port to
QRTR_PORT_CTRL.

Change-Id: Ia70ce1c078ea84f0de47240f6fc3e764f4ae7a6f
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:58:55 -07:00
Chris Lew
a51c412524 net: qrtr: Do not take sock lock on blocking recv
Socket client's should be able to block on recv without blocking other
socket operations such as sending. The qrtr core logic should also be
able to operate on the sock while a client is blocked in recv. Remove
the sock lock from around the recv_datagram to allow execution to
continue while a client is blocked in recv.

Change-Id: I6adb09b8e44c5ff3542b88db87b376a3ae5cb5ba
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:58:46 -07:00
Chris Lew
efcd1d175b net: qrtr: Return -ENODEV error code if port not found
Post function is called from interrupt context. Returning same
error code in all cases rsults in excessive prints which can
cause irq throttling.

Return -ENODEV when port lookup fails in post function.

CRs-Fixed: 2790559
Change-Id: I75384b2116cb2fe1bbeaa2dac91157345f0bab54
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:58:31 -07:00
Chris Lew
e1a8c77a3e net: qrtr: Add missing reference cleanup
Add missing node reference put when memory allocation fails for the
tx_resume packet. Without this there could be dangling references
to a node.

Change-Id: I5a5dfa437243a39d3da660251c0357ff6eb6cbff
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:58:21 -07:00
Chris Lew
271d7f7490 net: qrtr: Rename qrtr_all_nodes to qrtr_all_epts
The node list only respresents the adjacent nodes in the system. Rename
the list to qrtr_all_epts to better describe the list contents. Rename
qrtr_nodes_lock to qrtr_epts_lock to better describe lock.

Change-Id: I168ca597d5b9b30d6c064c2a56b6e8b2dffa387b
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:58:15 -07:00
Chris Lew
e00d15abf5 net: qrtr: Improve qrtr_node_assign
First check if the node is already assigned the requested nid, this
allows an early exit for the common case.

Do not allow later nodes to overwrite a node id. The first to claim a
node id should get priority.

Change-Id: Ie3da0c3b709de8c68f9918cd485492f9eaa41247
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:58:06 -07:00
Chris Lew
8fa3203fdc net: qrtr: use alloc_skb_with_frags() in rx path
net_dev_alloc() fails for high order allocations in system where memory
is fragmented and cause communication stall due to packet drops.

Use alloc_skb_with_frags() to avoid packet drops in memory fragmented case.

Change-Id: I46b7e0da0ed04c9222c975ee930f0f8d9b41453b
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:57:58 -07:00
Chris Lew
2ec1e4ae67 net: qrtr: Prevent stale ports from sending
In order to prevent messages from stale sockets being sent, check if
ENETRESET has been set on the socket and drop the packet.

Change-Id: Ie9abc6c51139e82d3c9ebd4d546d1acd7269875e
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:57:50 -07:00
Chris Lew
9edfe6657f net: qrtr: Change port allocation to use cyclic xa
There is a race for clients that open sockets before the control port
is bound. If a client gets an idr that was allocated before the control
port is bound, there is a chance the previous address owner sent lookup
packets to the control port. The new address owner will get residual
responses to these lookup packets.

Change the xa_alloc to xa_alloc_cyclic so new ids are allocated
instead of trying to reuse the freed ids.

Change-Id: Ie1bda7a818309503f80542e739bac646327296f7
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:57:42 -07:00
Chris Lew
20cca07151 net: qrtr: Change node mutex to a rw_semaphore
There is a chance for a remote processor to become unresponsive while
QRTR is trying to broadcast a control message. This results in the node
lock being held for an extended period of time and prevents node lookup
which is needed to send messages.

Change the mutex to a rw_semaphore to allow concurrency during node
lookups and broadcasts.

Change-Id: I2e3fdde22edaac64f164cf08900e9d09b16c380d
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:57:33 -07:00
Chris Lew
cc60f7fdd8 net: qrtr: Add socket mode optimization
A remote endpoint should not need to know when a client socket is freed
if the socket never established commnication with the endpoint. Add a
mode to keep track of which endpoints a socket communicates with.

There are three modes a socket can be in:
	INIT   - Socket has not sent anything or only local messages,
		 only send client close to local services.

	SINGLE - Socket has sent messages to a single ept, send event
		 to this single ept.

	MULTI  - Socket has sent messages to multiple epts, broadcast
		 release of this socket.

Server state changes should be broadcast throughout the system. Change
the ipc state of a port when it sends a NEW SERVER control packet. This
ensures the DEL CLIENT control packet is propagated correctly for
servers.

Change-Id: I416742cff598bf7aa9da2baa2e86a53b18367870
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:57:24 -07:00
Chris Lew
a0f46809c5 net: qrtr: Do not send packets before hello negotiation
There is a race where broadcast packets can be sent to a node that has
not sent the hello message to the remote processor. This breaks the
protocol expectation. Add a status variable to track when the hello
packet has been sent.

An alternative solution attempted was to remove the nodes from the
broadcast list until the hello packet is sent. This is not a valid
solution because hello messages are broadcasted if the ns is restarted
or started late. There needs to be a status variable separate from the
broadcast list.

Change-Id: I2a55e587f324e64e2bde4ea634de66008f190de1
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-03 09:57:02 -07:00
qctecmdr
16b799c886 Merge "dwc3-msm-core: Add NULL check with dwc3_msm_override_pm_ops() API" 2022-10-02 09:14:21 -07:00
qctecmdr
1befe958e4 Merge "dwc3-msm-core: Add NULL check against USB GSI event buffer" 2022-10-02 09:14:20 -07:00
qctecmdr
8678efeb9b Merge "dwc3-msm-core: Add NULL check with return value from memremap() API" 2022-10-02 07:05:29 -07:00
qctecmdr
d036b442ae Merge "dwc3-msm-core: Use refcount to handle USB DP concurrency case" 2022-10-01 06:50:29 -07:00
Mayank Rana
727bbb3139 dwc3-msm-core: Add NULL check with dwc3_msm_override_pm_ops() API
dwc3 msm core driver shall start USB host or device mode with dwc3
controller driver. This shall fail specifically USB host mode due
to any error with xhci controller initialization. In this case HCD
would be unbinded causing NULL pointer deference when trying to
override its PM ops with dwc3_msm_override_pm_ops() API. To avoid
NULL pointer dereference add NULL check with dwc3_msm_override_pm_ops()
API.

Change-Id: Ia96e945d58b1bf1d5434b004ac3d3090b24c6208
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
2022-09-30 18:12:45 -07:00
Mayank Rana
63c0cd6d2d dwc3-msm-core: Add NULL check against USB GSI event buffer
mdwc->gsi_ev_buff is seen NULL when dwc3_msm_notify_event() is getting
called from dwc3 driver's probe context as mdwc->gsi_ev_buff is being
allocated at end of dwc3_msm_core_init(). dwc3_otg_start_peripheral()
setups GSI event buffers with USB controller. Fix NULL pointer issue
by adding explicit check against NULL with mdwc->gsi_ev_buff.

Change-Id: Ia15b677b5fa55e4281a78fb877283fe37c9ad95f
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
2022-09-30 18:12:19 -07:00
Mayank Rana
4d28227211 dwc3-msm-core: Add NULL check with return value from memremap() API
memremap() API shall return valid address or NULL. If return value
is NULL then it would result into NULL pointer dereference while
accessing ebc_trb_pool. Fix this unlikely issue by adding check
against NULL with return value from memremap() API.

Change-Id: I42ad1a735c0d4958a7251f27223af6cc0aa670dc
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
2022-09-30 18:11:18 -07:00
qctecmdr
8ea5a380bf Merge "net: qrtr: smd: Add error message for registration failure" 2022-09-30 16:56:08 -07:00
qctecmdr
3912c8275c Merge "sched/walt: Create attribute groups" 2022-09-29 21:32:41 -07:00
qctecmdr
a9ebb3ce41 Merge "cpufreq: qcom-hw: Add sysfs file for hw clock domain index" 2022-09-29 21:32:41 -07:00
Mayank Rana
97bd9f3aab dwc3-msm-core: Use refcount to handle USB DP concurrency case
DP driver uses altmode glink interface whereas USB driver uses
UCSI interface for getting PPM based DP and USB related notification.
PPM based notification can come in different order specifically when
PPM is being restarted with SSR. With PPM SSR (here ADSP SSR) DP driver
is getting disconnect notification but USB driver won't be getting
disconnect notification. Once ADSP SSR is being completed, DP does go
through re-initialization and it does need USB DP combo PHY as
concurrent mode (2 lane USB and 2 lane DP usage). Current code goes
ahead disabling USB host mode with DP not connected notification.

In some case DP notification is coming after ADSP SSR is being completed
but before USB notification has gone through. This results into DP
initiailzation failure (aux timeout) due to USB host mode not started
configuring USB DP combo PHY into concurrent mode.

Consider case: USB DP concurrent mode usage with connecting MPA and
performing ADSP SSR

a. USB and DP are initialized (concurrent mode)
b. ADSP SSR is being performed
c. USB gets usb role as UFP/host mode
d. DP notifies as DP not connected
e. DP notified as 2 lane usage

Current code tears down USB host mode functionality with DP not connected
notification. If above step c notification comes after step d, then step e
based functionality goes through as USB host mode is active. Due to
asynchronous nature of notification, usage of multiple interfaces (altmode
link and UCSI) and ADSP doesn't notify USB disconnect with SSR (due to USB
audio use case requirement) whereas notify disconnect with DP. It is needed
to use refcounting mechnism to decide when to tear down USB host session to
allow sharing of USB DP combo PHY. This change adds ref count usage to
address above issue.

Change-Id: I0ea80611e52c1e45fed50cde61741f7a9aedd87d
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
2022-09-29 14:10:53 -07:00
qctecmdr
e36999b737 Merge "build.config.msm.gki: Disable GKI_SKIP_IF_VERSION_MATCHES" 2022-09-29 10:40:35 -07:00
qctecmdr
034caeb492 Merge "msm: bus: mhi: Add device info structure for sdx75" 2022-09-29 10:40:35 -07:00
qctecmdr
0607a4e6cc Merge "mem-buf: Add accessor for mem_buf_desc sgl list" 2022-09-29 10:40:34 -07:00
Chris Lew
750c23e102 net: qrtr: smd: Add error message for registration failure
Add error prints around qrtr endpoint registration fails. Adjust the
prints so more information error information is available during early
bootup.

Change-Id: I0cf41144c6b4e8d8de0c91914e46155bbe54c6c5
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-09-28 21:59:42 -07:00
qctecmdr
98ba4717dc Merge "soc: qcom: Limit name length to 9 in SVM" 2022-09-28 20:13:23 -07:00
qctecmdr
42fbe3bc58 Merge "pwm: pwm-qti-lpg: Add Support for high resolution PWM" 2022-09-28 18:44:46 -07:00
qctecmdr
126f94625b Merge "soc: qcom: pmic-pon-log: update USB pon log reason for PM7250B" 2022-09-28 18:44:46 -07:00
qctecmdr
0b71641cf5 Merge "usb: dwc3: Enable u1u2 functionality with USB Gen1 speed" 2022-09-28 17:04:06 -07:00
qctecmdr
6306289371 Merge "clk: qcom: debugcc-pineapple: Add a clk_measure node for CPU Gold2" 2022-09-28 17:04:05 -07:00
qctecmdr
007a38d10e Merge "drivers: soc: qcom: Add snapshot of cpucp communication drivers" 2022-09-28 17:04:05 -07:00
Xubin Bai
272c2c21cd cpufreq: qcom-hw: Add sysfs file for hw clock domain index
Default linear mapping no longer works due to non-linear
policy-to-clk_domain index mapping in new chipsets, add
a new sysfs file hw_clk_domain in sysfs directory policy*
so that test script can capture the correct HW clock
domain index.

Change-Id: Id78df0074e9cb13dd1f748dbab2381a48440e8e9
Signed-off-by: Xubin Bai <quic_xubibai@quicinc.com>
2022-09-27 18:17:11 -07:00
qctecmdr
4166c80b23 Merge "android: abi_gki_aarch64_qcom: Add flush_delayed_fput" 2022-09-27 17:52:11 -07:00
Sai Harshini Nimmala
558622e9b9 sched/walt: Create attribute groups
struct kobj_type does not contain the default_attrs member anymore.
Instead create attribute group using the ATTRIBUTE_GROUPS macro and
assign to kobj_type object.

Change-Id: I5d21c816edb13b5020e064f55c3e495002897d4a
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-09-27 16:32:36 -07:00
Stephen Dickey
b0a014fc64 kernel/sched/walt: remove unused walt error type
Remove WALT_NONCRITICAL as it hasn't been useful.

Change-Id: Ia28005c5f980fcb598226b3aae4b21efeac1b526
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-09-27 16:27:20 -07:00
Stephen Dickey
902848221f kernel/sched/walt: test is walt is enabled
Pause will not be invoked through core control until after
walt has been initialized. However, the walt_pause apis are
made available to other vendor modules, and if those modules
attempt to invoke pause prior to walt being initialized, an
invalid reference to walt_drain_thread will be made.

Prevent the walt_pause and walt_resume apis from being used
until after walt has been properly initialized, walt_halt_init
has been called, and walt_drain_thread properly created.

Change-Id: Iadd764ebfb7402529b49de6ef121d23dfcdc5649
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-09-27 16:27:20 -07:00
Sai Harshini Nimmala
1a0cf49aa3 sched/walt: Change update_cpu_capacity tracepoint
Capture the fmax_capacity of the CPU reduced under cpufreq constraints
in the related tracepoint.

Change-Id: I3dc5c54a7a5850b9c5f4df8a40daea593fff023b
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-09-27 16:27:19 -07:00
qctecmdr
7622335450 Merge "usb: dwc3-msm: Don't allow dynamic speed change for host mode" 2022-09-27 16:06:07 -07:00
qctecmdr
f6a0cc734a Merge "usb: dwc3: dwc3-msm-core: Re-use usb_role callbacks for mode changes" 2022-09-27 16:06:07 -07:00
qctecmdr
4d36671e16 Merge "kernel/sched/walt: check migration disabled in allowed_ptr_locked" 2022-09-27 16:06:05 -07:00
Elliot Berman
a52db04bfb build.config.msm.gki: Disable GKI_SKIP_IF_VERSION_MATCHES
We're currently using the ABI symbol list from within msm-kernel and is
not version-tracked by ACK. Thus, GKI_SKIP_IF_VERSION_MATCHES may
spuriously pass even if there is a symbol list change. Disable
GKI_SKIP_IF_VERSION_MATCHES for now until we start using symbol list
from ACK.

Change-Id: Ifea662029a193e36c4c6d28bedc167399f4f85ba
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2022-09-27 15:13:23 -07:00
Prudhvi Yarlagadda
bc261dbf64 msm: bus: mhi: Add device info structure for sdx75
Add the device information structure for sdx75 along with
its device id, firmware and edl image paths.
Remove the kconfig dependency on the esoc driver.

Change-Id: Iea7b3e82f274804d781bdbc333b36c64784eef33
Signed-off-by: Prudhvi Yarlagadda <quic_pyarlaga@quicinc.com>
2022-09-27 14:27:05 -07:00
Xubin Bai
f3ba3025c9 clk: qcom: debugcc-pineapple: Add a clk_measure node for CPU Gold2
Add one clk_measure node to support CPU Gold2 cluster for
Pineapple.

Change-Id: I2b7d3f4fa249b1496fe6104edcd54b030e2a7e8e
Signed-off-by: Xubin Bai <quic_xubibai@quicinc.com>
2022-09-26 19:40:54 -07:00
Mayank Rana
4977a05f93 usb: dwc3: Enable u1u2 functionality with USB Gen1 speed
Enable u1u2 functionality in USB device mode when USB is operating
in super speed (gen1 speed).

Change-Id: I14056274b68c3ed395ee3673312606ded68afcd6
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
2022-09-26 16:21:27 -07:00