aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-17mhi: pci_generic: Fix shared MSI vector supportsdx55-v104Loic Poulain
When a shared MSI vector must be used (e.g. when VTd is disabled on x86_64), each event MSI vector must be set to the shared vector idx. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-17mhi: unconstify mhi_event_configLoic Poulain
Some parameters may have to be determined at runtime. It is the case for the event ring MSI vector. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-17net: mhi-net: Add de-aggeration supportLoic Poulain
When device side MTU is larger than host side MTU, the packets (typically rmnet packets) are split over multiple MHI transfers. In that case, fragments must be re-aggregated to recover the packet before forwarding to upper layer. A fragmented packet result in -EOVERFLOW MHI transaction status for each of its fragments, except the final one. Such transfer was previoulsy considered as error and fragments were simply dropped. This patch implements the aggregation mechanism allowing to recover the initial packet. It also print a warning (once) since this behavior usually comes from a misconfiguration of the device (modem). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-17net: mhi: Add raw IP mode supportLoic Poulain
MHI net is protocol agnostic, the payload protocol depends on the modem configuration, which can be either RMNET (IP muxing and aggregation) or raw IP. This patch adds support for incomming IPv4/IPv6 packets, that was previously unconditionnaly reported as RMNET packets. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-15net: mhi: Set wwan device typeLoic Poulain
The device_type is useful for userspace to determine The 'wwan' devtype is meant for devices that require additional configuration to be used, like WWAN specific APN setup over AT/QMI commands, rmnet link creation, etc. For now, all MHI (Modem Host Interface) net devices target modem/ WWAN endpoints (modem IPA accelerator), this changes unconditionnaly setup netdev type to 'wwan'. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-15net: mhi: Get rid of local rx queue countLoic Poulain
Use the new mhi_get_free_desc_count helper to track queue usage instead of relying on the locally maintained rx_queued count. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-15net: mhi: Get RX queue size from MHI coreLoic Poulain
The RX queue size can be determined at runtime by retrieving the number of available transfer descriptors. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-15bus: mhi: core: Add helper API to return number of free TREsHemant Kumar
Introduce mhi_get_free_desc_count() API to return number of TREs available to queue buffer. MHI clients can use this API to know before hand if ring is full without calling queue API. Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2020-12-15net: mhi: Fix unexpected queue wakeLoic Poulain
This patch checks that MHI queue is not full before waking up the net queue. This fix sporadic MHI queueing issues in xmit. Indeed xmit and its symmetric complete callback (ul_callback) can run concurently, it is then not safe to unconditionnaly waking the queue in the callback without checking queue fullness. Fixes: 3ffec6a14f24 ("net: Add mhi-net driver") Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-15[DONOTUPSTREAM]mhi_uci: fix DIAG supportLoic Poulain
The current firmware is buggy an does not allow to close the DIAG without causing error on subsequent DIAG session (open). This patch simply prevents to close channel in case of DIAG chardev release. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-15net: qualcomm: rmnet: Update rmnet device MTU based on real deviceSubash Abhinov Kasiviswanathan
Packets sent by rmnet to the real device have variable MAP header lengths based on the data format configured. This patch adds checks to ensure that the real device MTU is sufficient to transmit the MAP packet comprising of the MAP header and the IP packet. This check is enforced when rmnet devices are created and updated and during MTU updates of both the rmnet and real device. Additionally, rmnet devices now have a default MTU configured which accounts for the real device MTU and the headroom based on the data format. Signed-off-by: Sean Tranchetti <stranche@codeaurora.org> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2020-12-15Revert "net: rmnet: Adjust virtual device MTU on real device capability"Loic Poulain
This reverts commit be683bbe247bab9b503662a7f12961a68f3e4809.
2020-12-15[REWORKME] [WORKAROUND] Fix sporadic modem crashLoic Poulain
This change fix sporadic modem crashes when performing transfer. On modem side we get: [ 207.104356] gsi soc:qcom,msm_gsi: gsi_handle_glob_err:304 log err_type=2 ee=0 idx=1 [ 207.104393] gsi soc:qcom,msm_gsi: gsi_handle_glob_err:306 code=1 arg1=0 arg2=0 arg3=0 [ 207.105219] gsi soc:qcom,msm_gsi: gsi_handle_glob_err:347 Unexpected channel state 15 [ 207.106212] BUG: failure at drivers/platform/msm/gsi/gsi.c:348/gsi_handle_glob_err()! [ 207.107231] [telit_sys_reset_reason_set] current_reset_reason : 0xDA000031 [ 207.109635] [telit_sys_reset_reason_set] changed_reset_reason :0xDA000011 [ 207.110496] line = 0 [ 207.111327] Filename = [ 207.111616] Msg = Kernel: Kernel panic or HW Wdog suspected. [ 207.111948] telit_sys_fatal_set_panic: start store panic. [ 207.112655] Kernel panic - not syncing: BUG! This change needs to be revisited in a proper way. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: core: Factorize mhi queuingLoic Poulain
Instead of duplicating queuing procedure in mhi_queue_dma(), mhi_queue_buf() and mhi_queue_skb(), add a new generic mhi_queue() as common helper. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14[DONOTUPSTREAM] kernel/configs: Add FN980 configLoic Poulain
Add requested config symboles. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14pci: aer: Disable corrected error reporting by defaultLoic Poulain
It appears to be very common that people complain about kernel log (and irq) flooding because of reported corrected errors by AER. An usual reply/solution is to completely disable aer with 'noaer' pci parameter. This is a big hammer tip since it also prevents reporting of 'real' non corrected PCI errors, that need to be handled by the kernel. A PCI correctable error is an error corrected at hardware level by the PCI protocol (e.g. with retry mechanism), the OS can then totally live without being notified about that hardware event. A simple change would then consist in not enabling correctable error reporting at all, but it can remain useful in some cases, such as for determining health of the PCI link. This patch changes the default AER mask to not enable correctable error reporting by default, and introduce a new pci parameter, 'aerfull' that can be used to re-enable all error reports, including correctable ones. Note: Alternatively, if changing the legacy behavior is not desirable, that can be done the other way, with a 'noaer_correctable' parameter to only disable correctable error reporting. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: pci-generic: Increase number of elements for QMI/IPCRLoic Poulain
Both QMI and IPCR are protocols that can be used by multiple clients at the same time. It is then important to have enough elements in the transfer ring to allow parallel transactions. This change increases the value to 16 in order to prevent buffer starvation. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14net: rmnet: Adjust virtual device MTU on real device capabilityLoic Poulain
A submitted qmap/rmnet packet size can not be larger than the linked interface (real_dev) MTU. This patch ensures that the rmnet virtual iface MTU is configured according real device capability. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: core: Add MHI register dump helperLoic Poulain
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: core: Print message in case of DMA mapping errorLoic Poulain
Print a realelimited error in case of buffer mapping error. That can be useful to determine root cause of buffer queuing issues. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: pci_generic: Fix implicit conversion warningLoic Poulain
Fix the following warning with explicit cast: warning: implicit conversion from 'unsigned long long' to 'dma_addr_t' (aka 'unsigned int') mhi_cntrl->iova_stop = DMA_BIT_MASK(info->dma_data_width); Fixes: 855a70c12021 ("bus: mhi: Add MHI PCI support for WWAN modems") Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
2020-12-14mhi_uci: Add diag supportLoic Poulain
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi_uci: fixup for prepare_flagLoic Poulain
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14bus: mhi: Add userspace client interface driverHemant Kumar
This MHI client driver allows userspace clients to transfer raw data between MHI device and host using standard file operations. Driver instantiates UCI device object which is associated to device file node. UCI device object instantiates UCI channel object when device file node is opened. UCI channel object is used to manage MHI channels by calling MHI core APIs for read and write operations. MHI channels are started as part of device open(). MHI channels remain in start state until last release() is called on UCI device file node. Device file node is created with format /dev/mhi_<mhi_device_name> Currently it supports QMI channel. Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2020-12-14docs: Add documentation for userspace client interfaceHemant Kumar
MHI userspace client driver is creating device file node for user application to perform file operations. File operations are handled by MHI core driver. Currently QMI MHI channel is supported by this driver. Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2020-12-14bus: mhi: core: Move MHI_MAX_MTU to external header fileHemant Kumar
Currently this macro is defined in internal MHI header as a TRE length mask. Moving it to external header allows MHI client drivers to set this upper bound for the transmit buffer size. Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2020-12-14mhi: pci_generic: Set irq moderation value to 1ms for hw channelsLoic Poulain
MHI hardware channels are usually the hardware accelerated data path e.g. IP packets path for modems. This path needs to be optimized for low latency and high throughput. After several tests on FN980m SDX55 based modem, it seems 1ms is a good default irq_moderation value: - It allows to reach the maximum download throughput - It introduces limited latency (5ms is too high) - It prevents interrupt flooding Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: pci_generic: Add diag channelsLoic Poulain
Add support for Diag over MHI. Qualcomm Diag is the qualcomm diagnostics interface that can be used to collect modem logs, events, traces, etc. It can be used by tools such QPST or QXDM. This patch adds the DIAG channels and a dedicated event ring. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by Hemant Kumar <hemantk@codeaurora.org>
2020-12-14mhi: pci_generic: Increase controller timeout valueLoic Poulain
On cold boot, device can take slightly more than 5 seconds to start. Increase the timeout to prevent MHI power-up issues. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
2020-12-14mhi: pci_generic: Add health-checkLoic Poulain
If the modem crashes for any reason, we may not be able to detect it at MHI level (MHI registers not reachable anymore). This patch implements a health-check mechanism to check regularly that device is alive (MHI layer can communicate with). If device is not alive (because a crash or unexpected reset), the recovery procedure is triggered. Tested successfully with Telit FN980m module. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
2020-12-14mhi: pci_generic: Add PCI error handlersLoic Poulain
In AER capable root complex, errors are reported to the host which can then act accordingly and perform PCI recovering procedure. This patch enables error reporting and implements error_detected, slot_reset and resume callbacks. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by Hemant Kumar <hemantk@codeaurora.org>
2020-12-14mhi: pci_generic: Add suspend/resume/recovery procedureLoic Poulain
Add support for system wide suspend/resume. During suspend, MHI device controller must be put in M3 state and PCI bus in D3 state. Add a recovery procedure allowing to reinitialize the device in case of error during resume steps, which can happen if device loses power (and so its context) while system suspend. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by Hemant Kumar <hemantk@codeaurora.org>
2020-12-14mhi: pci_generic: Add support for resetLoic Poulain
Add support for resetting the device, reset can be triggered in case of error or manually via sysfs (/sys/bus/pci/devices/*/reset). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: pci_generic: Enable burst mode for hardware channelsLoic Poulain
Hardware channels have a feature called burst mode that allows to queue transfer ring element(s) (TRE) to a channel without ringing the device doorbell. In that mode, the device is polling the channel context for new elements. This reduces the frequency of host initiated doorbells and increase throughput. Create a new dedicated macro for hardware channels with burst enabled. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2020-12-14mhi: pci-generic: Increase number of hardware eventsLoic Poulain
If the IPA (IP hardware accelerator) is starved of event ring elements, the modem is crashing (SDX55). That can be prevented by setting a larger number of events (i.e 2 x number of channel ring elements). Tested with FN980m module. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2020-12-14bus: mhi: core: Add device hardware reset supportLoic Poulain
The MHI specification allows to perform a hard reset of the device when writing to the SOC_RESET register. It can be used to completely restart the device (e.g. in case of unrecoverable MHI error). This is up to the MHI controller driver to determine when this hard reset should be used, and in case of MHI errors, should be used as a reset of last resort (after standard MHI stack reset). This function is prefixed with 'mhi_reg' to highlight that this is a stateless function, the MHI layer do nothing except triggering the reset by writing into the right register, this is up to the caller to ensure right mhi_controller state (e.g. unregister the controller if necessary). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-14mhi: Add mhi_controller_initialize helperLoic Poulain
This function allows to initialize a mhi_controller structure. Today, it only zeroing the structure. Use this function from mhi_alloc_controller so that any further initialization can be factorized in initalize function. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-09bus: mhi: core: Indexed MHI controller nameLoic Poulain
Today the MHI controller name is simply cloned from the underlying bus device (its parent), that gives the following device structure for e.g. a MHI/PCI controller: devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0 devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0/0000:02:00.0_IPCR ... That's quite misleading/confusing and can cause device registering issues because of duplicate dev name (e.g. if a PCI device register two different MHI instances). This patch changes MHI core to create indexed mhi controller names (mhi0, mhi1...) in the same way as other busses (i2c0, usb0...). The previous example becomes: devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0 devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0/mhi0_IPCR ... Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-09bus: mhi: Ensure correct ring update ordering with memory barrierLoic Poulain
The ring element data, though being part of coherent memory, still need to be performed before updating the ring context to point to this new element. That can be guaranteed with a memory barrier (dma_wmb). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-09bus: mhi: core: Fix device hierarchyLoic Poulain
This patch fixes the hierarchical structure of MHI devices. Indeed, MHI client devices are directly 'enumerated' from the mhi controller and therefore must be direct descendants/children of their mhi controller device, in accordance with the Linux Device Model. Today both MHI clients and controller devices are at the same level, this patch ensures that MHI controller is parent of its client devices. The hierarchy is especially important for power management (safe suspend/resume order). It is also useful for userspace to determine relationship between MHI client devices and controllers. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-12-01Revert "bus: mhi: Fix channel close issue on driver remove"Loic Poulain
This reverts commit f988f5c354a3947866343e5bcf662d62cd30b3ec. This cause double page free on mhi_pci_generic remove. In unprepare (called by the driver) and in unit channel loop. Fix that in a proper way.
2020-12-01Revert "bus: mhi: Add memory barrier before ringing doorbell"Loic Poulain
This reverts commit 516a1bd9a2a458685296558e030966678acdfab4.
2020-12-01USB: serial: option: add Telit FN980 composition 0x1055Daniele Palmas
Add the following Telit FN980 composition: 0x1055: tty, adb, tty, tty, tty, tty Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2020-12-01[FIXUP} net: qrtr: add mhi_prepare allocation flagLoic Poulain
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-01net: qrtr: Release distant nodes along the bridge nodeLoic Poulain
Distant QRTR nodes can be accessed via an other node that acts as a bridge. When the a QRTR endpoint associated to a bridge node is released, all the linked distant nodes should also be released. This patch fixes endpoint release by: - Submitting QRTR BYE message locally on behalf of all the nodes accessible through the endpoint. - Removing all the routable node IDs from radix tree pointing to the released node endpoint. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-01net: qrtr: Add GFP flags parameter to qrtr_alloc_ctrl_packetLoic Poulain
This will be requested for allocating control packet in atomic context. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-01net: qrtr: Allow non-immediate node routingLoic Poulain
In order to reach non-immediate remote node services that are accessed through an intermediate node, the route to the remote node needs to be saved. E.g for a [node1 <=> node2 <=> node3] network - node2 forwards node3 service to node1 - node1 must save node2 as route for reaching node3 Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-12-01net: qrtr: Allow forwarded servicesLoic Poulain
A remote endpoint (immediate neighbors node) can forward services from other nodes (non-immadiate), in that case ctrl packet node ID (offering distant service) can differ from the qrtr source node (forwarding the packet). Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2020-12-01net: qrtr: Fix port ID for control messagesLoic Poulain
The port ID for control messages was uncorrectly set with broadcast node ID value, causing message to be dropped on remote side since not passing packet filtering (cb->dst_port != QRTR_PORT_CTRL). Fixes: d27e77a3de28 ("net: qrtr: Reset the node and port ID of broadcast messages") Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-12-01fixup 429934f40ce375c7Loic Poulain
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>