Commit Graph

1127855 Commits

Author SHA1 Message Date
Chris Lew
b5758dacea net: qrtr: Add gunyah transport
Add the QRTR gunyah transport that facilitates sending and receiving
IPC Router messages between virtual machines that use the haven
hypervisor.

Change-Id: I805ee5b144c5a8fc92e4a045061770d06495f63c
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-17 13:23:48 -07:00
Chris Lew
43c9f45b6a net: qrtr: Make qrtr rx threads as RT priorities
To support high priority clients like sensor use cases in all system
conditions elevating the router reader threads to RT priorities based
on configuration.

Change-Id: I6f46097f6678f2e00c3ec8872b208d773c377224
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-13 15:05:58 -07:00
Chris Lew
188c64d260 net: qrtr: Add forwarding support based on net id
Add support for QRTR to forward messages between network clusters. The
network subnet id's are attached to the QRTR subnodes in the MHI and
RPMSG/GLINK nodes.

The current forwarding decisions are done based on the net ids and are
wrapped in a single function for easier maintenance of forwarding
decisions later on. The function will return true once it determines
a subnet has no connection to another subnet.

The NEW_SERVER, DEL_SERVER, and DEL_CLIENT control messages should be
forwarded while the DATA and RESUME_TX commands should be passed along
to their destination node.

The nameservice is expected to send NEW_SERVER commands for it's entire
database instead of just the local service database with these changes.
This is to make sure new nodes get service notifications that came
earlier and were meant to be forwarded to the new node.

This change squashes the following commits from msm-4.14:
  commit e5f6a6769ceb ("net: qrtr: Add forwarding support based on net id")
  commit 4516ab18718d ("net: qrtr: avoid deadlock in case of recursive
                        lock for node list")
  commit dc2d47cd12d3 ("net: qrtr: Only update pkts with broadcast node
                        ID")
  commit 4277aebeff91 ("net: qrtr: Free skb if qrtr_node_lookup fails
                        during qrtr_fwd_pkt")

In addition fix minor format issues and update copyright.

Change-Id: Iaf01dd212b07dfbb13ec087ea0aae980cda7c2fd
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-13 15:05:29 -07:00
Chris Lew
c742a81975 net: qrtr: Move tx_resume handling to work context
There will be non-atomic work associated with receiving the tx resume
packet from the remote. Move the handling to work function context in
preparation for the non-blocking socket blocking improvement.

In system heavy load cases the rx work queued in global worker queue is
getting delayed and causing clients request timeouts.

Create and use separate worker thread to process qrtr rx packets.

Change-Id: I2389bdcffba068258650bfbb579f8cb98a0ac928
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:41:27 -07:00
Chris Lew
ed4fba13e9 net: qrtr: Remove rcu logic for port lookup/remove
synchronize_rcu() is slow and can create delays on creating/removing
sockets.

Some clients have latency requirements for spinning off a
thread that creates a client and lookup sockets for some sessions. They
close the lookup socket during this sequence which causes delays. Each
call to synchronize_rcu takes 20-40 ms which is too long.

Remove the rcu logic and change qrtr_port_lock to a spinlock so it can
be used in qrtr_port_lookup which may be used in atomic context.

Change-Id: I3244e31d3ca0599df794d3936033735bcdd3e972
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:41:26 -07:00
Chris Lew
904b1aa353 net: qrtr: Add permission rules for QTI targets
Give control port access to processes that have root user priveleges,
AID_VENDOR_QRTR user priveleges, or NET_ADMIN capabilities.

Remove the need for SYS_ADMIN priveleges because they will not be
granted on any QTI targets.

This change squashes the following commits from msm-4.14:
  commit 17da4da93c96 ("qrtr: Allow net bind service capabilities")
  commit 56faadfd27b4 ("qrtr: Fix NET_BIND_SERVICE logic")
  commit 82ea58d60c46 ("net: qrtr: Allow control port access to
                        AID_VENDOR_QRTR")
  commit 9db4f5803ce1 ("net: qrtr: Allow Root guid process to bind")

In addition fix minor format issues.

Change-Id: I1441cbf53eb62880333a1031334a5331c1f54a77
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:41:18 -07:00
Chris Lew
bf77ef2d63 net: qrtr: Return success if control port is not bound
If a port tries to send a message before the name service binds to the
control port, then that message should succeed. This will allow clients
to operate normally until the name service comes online and causes a
net reset to restart all the ports.

Change-Id: Ica0a5e45df0e51f282e5bf426d11ff8e41b339c4
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:32:07 -07:00
Chris Lew
3f161d1572 net: qrtr: mhi: synchronize qrtr and mhi preparation
A dl callback can be received anytime after mhi_prepare_for_transfer
has been called. There is a window where the callback may happen
before the probe initializes the qrtr_mhi_dev state. Move
mhi_prepare_for_transfer after the registering the endpoint.

Once moved, the reverse can happen where qrtr will try to send a packet
before the channels are prepared. Add a wait in the sending path to
ensure the channels are prepared before trying to do a ul transfer.

Change-Id: Ib5bf34ec8c1fa56a8ce29c89449d062de7133846
Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:15:10 -07:00
Chris Lew
405ddae2c7 net: qrtr: Add support to read qrtr packet size
Some transports need to know qrtr packet to read complete packet
from underlying transport.

Add API support to get the incoming packet size form qrtr header.

Change-Id: I4e4e4ab2e4c1fe0e1e1261af85a8b8618ce65bb3
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:06:48 -07:00
Chris Lew
1dfa161834 net: qrtr: ns: Add ipc logging to ns
Log packets processed by ns using ipc logging framework.

Change-Id: I08e9b8551efb4a58cf899835cfac25c1952bd4b8
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:03:42 -07:00
Chris Lew
718816b952 net: qrtr: ns: Change to ratelimited prints
Error prints for commands that are broadcasted may spam the kernel logs
if a client is misbehaving and stops reading from it's socket.

Change these prints to ratelimited in order to prevent performance
issues when a client socket is full.

Change-Id: I5aa5fa1f693f9865a3d28f28de38f870a42fbc8d
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:03:37 -07:00
Chris Lew
f540ee360d net: qrtr: ns: Add pr_fmt to ns
Add pr_fmt to the ns file for easier error log matching.

Change-Id: I711735ee60c1fd9fde25850b8e625bb44c04f4c4
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:03:32 -07:00
Chris Lew
d94badbdaa net: qrtr: ns: Ignore ENODEV failures in ns
Ignore the ENODEV failures returned by kernel_sendmsg(). These errors
mean either the local port has closed or the remote has gone down.
Neither of these scenarios are fatal and will eventually be handled
through packets that are later queued on the control port.

Also improve the logging messages to print the error code returned by
kernel_sendmsg().

Change-Id: Ibcebd1f44a3fbc87febaa84b11e05675663da5a0
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:03:27 -07:00
Chris Lew
16c6929261 net: qrtr: ns: Increase socket recvbuf
Increase the socket recvbuf for the ns so control packets are not
dropped in heavy traffic situations. This change will not
actually set the recvbuf to INT_MAX but to the system defined rmem_max
for sockets.

Change-Id: I860cc1052080cc6e683b44bef1dd9f8fc1899f31
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:03:22 -07:00
Chris Lew
a729cfdb0b net: qrtr: ns: create kthread worker to process ns work
If worker is not processing packets on control port fast enough,
socket buffer may get full and result in drop of control packets.

Creating dedicated worker thread to process control packets.

CRs-Fixed: 2763561
Change-Id: I4585015cef2a507a9ba13014cd93f40e60f8a25a
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2022-10-11 13:02:59 -07:00
Gokul krishna Krishnakumar
8a22567035 build.config: pineapple: Add flag to enable init_boot build
By enabling this flag init_boot.img will be generated if
the header version is 4.

Change-Id: I8a01d10cee8142ef900376d7e3d29f1b49e80d00
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
2022-10-10 09:59:16 -07:00
Gokul krishna Krishnakumar
80e28b0645 build.config: pineapple: Change Boot header version to 4
Adding Bootconfig to kernel command line to support
the version change.

Change-Id: I24b667e494e5bbf14397f16d9ef7219634f3f17b
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
2022-10-10 09:58:14 -07:00
qctecmdr
3a0a1539ac Merge "net: qrtr: ns: Return 0 if server port is not present" 2022-10-07 18:54:45 -07:00
qctecmdr
b718e28e48 Merge "abi_gki_aarch64_qcom: Add symbols for UBWC-P heap" 2022-10-07 16:59:25 -07:00
qctecmdr
ec8933f385 Merge "net: qrtr: Do not take sock lock on blocking recv" 2022-10-07 16:59:23 -07:00
qctecmdr
4db6d200e2 Merge "net: qrtr: Improve qrtr_node_assign" 2022-10-06 21:44:36 -07:00
qctecmdr
b9ac1f606d Merge "ubwcp: Add buffer configuration function declarations" 2022-10-06 08:55:13 -07:00
qctecmdr
17a880d7fb Merge "sched/walt: Define sched_trace_rd_span" 2022-10-05 19:54:58 -07:00
qctecmdr
d8ed52e3d2 Merge "defconfig: Enable dcvs related configs for pineapple" 2022-10-05 19:54:57 -07:00
qctecmdr
93443fbfaa Merge "bus: mhi: ctrl: Fix number of arguments in API mhi_prepare_for_tranfer" 2022-10-05 19:54:54 -07:00
qctecmdr
4e73525132 Merge "sched/walt: Expand rq_relock()" 2022-10-05 17:39:39 -07:00
Sai Harshini Nimmala
c388a7b37f sched/walt: Define sched_trace_rd_span
sched_trace_rd_span is removed upstream. Restore the function locally.

Change-Id: I066be161e1da49b11de10f034e8f46a4c1510391
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:27 -07:00
Sai Harshini Nimmala
252aa83964 sched/walt: Update sched_switch tracehook
sched_switch tracehook has been changed upstream. Update functions
registered with tracehook accordingly.

Change-Id: Ifba53f905634b476c60a8c69cfd87c6ad0c9cff7
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:26 -07:00
Sai Harshini Nimmala
69d2ba35d6 sched/walt: Expand group_first_cpu
group_first_cpu() is removed upstream. Expand the function in all the
places that it is used.

Change-Id: I04f4f9e2b37fca897ee45165b1976e1bec83f5bd
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:26 -07:00
Sai Harshini Nimmala
845834fca9 sched/walt: Expand rq_relock()
The rq_relock() function is removed upstream. Replace all instances of it
by expanding the function.

Change-Id: I7b99d46d552695ae0afdf75f3a6033b80376fe01
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:25 -07:00
Sai Harshini Nimmala
271e7db7d1 sched/walt: Replace HK_FLAG_TIMER
Replace HK_FLAG_TIMER with HK_TYPE_TIMER because HK_FLAG_TIMER is
removed upstream.

Change-Id: I6432556b6148030c8c6621cd0790d8906e0c94ec
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:25 -07:00
Sai Harshini Nimmala
1c1b617dae sched/walt: Include header files
Due to reorganization of sched header files upstream, include missing
header files.

Change-Id: Iab3cda49a71b6a0f3f98194f975031716df47736
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:24 -07:00
Sai Harshini Nimmala
8d3a41589d sched/walt: Update enqueue,dequeue tracehooks
The Android Common Kernel has updated the enqueue,dequeue tracehooks.
Update the tracehooks accordingly.

Change-Id: Idb2efdb2f70288721c9100850e9cb344328a2c42
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:23 -07:00
Sai Harshini Nimmala
01fd5ff22e sched/walt: Update account_irq tracehook
The Android Common Kernel has replaced the irq accounting tracehook.
Update the tracehook accordingly.

Change-Id: I4d0d2e7a4d5a6d567ac2c1edaae4d050b1c82ac0
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:23 -07:00
Sai Harshini Nimmala
de003fc809 sched/walt: Remove topology.h header
Due to reorganization of tracehooks upstream, topology.h does not exist
anymore. Remove the associated header.

Change-Id: Ib4c7e630dfbefd6965524f91101784a57327af39
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:45:22 -07:00
Sai Harshini Nimmala
7c57963b7a sched/walt: Obtain task cpu from task_thread_info
struct task_struct does not contain a member to store task cpu
information anymore. Instead, use task_thread_info() to obtain that
information.

Change-Id: I8fc9ef4ebf11f6fccd6ecbe68d768ac48d2928c5
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-10-04 09:44:56 -07:00
qctecmdr
21f3a2eb36 Merge "soc: qcom: eud: Force conversion to u32" 2022-10-04 09:40:43 -07:00
qctecmdr
05f194128d Merge "generic_vm_defconfig: Remove CONFIG_ANDROID" 2022-10-04 09:40:40 -07:00
qctecmdr
35d0622658 Merge "soc: qcom: pdr: Add service path to error logs" 2022-10-03 22:16:19 -07:00
Chris Goldsworthy
0cec979ea5 abi_gki_aarch64_qcom: Add symbols for UBWC-P heap
Add a tracepoint to the whitelist to be used in the UBWC-P heap.

Change-Id: I333c00519101b45840a32f340824450ebc385d28
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-10-03 20:38:53 -07:00
Chris Goldsworthy
cfd2693211 dma-heap: qcom: Move sys heap allocation code into helper
Move sys heap allocation code into the system_qcom_sg_buffer_alloc()
function to allow core allocation code to be used from other modules.

Additionally, move the allocation of the struct qcom_sg_buffer
out of system_qcom_sg_buffer_alloc(), so that other modules can
allocate their own buffer structs with qcom_sg_buffer as an embedded
member.

Each other module will then have dmabuf->priv pointing to the
qcom_sg_buffer member of their custom buffer struct.  This is needed
to allow the qcom_sg_ops.c functions to continue working as is.

Change-Id: Id11ca188163e5c3ceba28852c2cfe8f0acde4591
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-10-03 20:38:52 -07:00
Chris Goldsworthy
92276eec13 ubwcp: Add buffer configuration function declarations
Add the declarations needed for the DMA-BUF heap driver to call into
the UBWC-P driver.

Change-Id: Id1bb19410025b858a2154eae39ac0c28e4d6235c
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-10-03 20:38:47 -07:00
Amir Vajid
8f556c93bd defconfig: Enable dcvs related configs for pineapple
Enable dcvs related configs for pineapple.

Change-Id: Ia5fb6cb7d19b3f1896a15c8d7bdb762e6f2d3992
Signed-off-by: Amir Vajid <quic_avajid@quicinc.com>
2022-10-03 11:55:22 -07:00
Gokul krishna Krishnakumar
154bbef675 soc: qcom: pdr: Add service path to error logs
When lookup fails, print the service path along with the
service name since the service name might not be unique.

Change-Id: I614d6c0a8d6cb8a83b47795315811fbf47bb6e48
Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
2022-10-03 11:29:35 -07:00
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