-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
M Chetan Kumar says: ==================== net: iosm: PCIe Driver for Intel M.2 Modem The IOSM (IPC over Shared Memory) driver is a PCIe host driver implemented for linux or chrome platform for data exchange over PCIe interface between Host platform & Intel M.2 Modem. The driver exposes interface conforming to the MBIM protocol. Any front end application ( eg: Modem Manager) could easily manage the MBIM interface to enable data communication towards WWAN. Intel M.2 modem uses 2 BAR regions. The first region is dedicated to Doorbell register for IRQs and the second region is used as scratchpad area for book keeping modem execution stage details along with host system shared memory region context details. The upper edge of the driver exposes the control and data channels for user space application interaction. At lower edge these data and control channels are associated to pipes. The pipes are lowest level interfaces used over PCIe as a logical channel for message exchange. A single channel maps to UL and DL pipe and are initialized on device open. On UL path, driver copies application sent data to SKBs associate it with transfer descriptor and puts it on to ring buffer for DMA transfer. Once information has been updated in shared memory region, host gives a Doorbell to modem to perform DMA and modem uses MSI to communicate back to host. For receiving data in DL path, SKBs are pre-allocated during pipe open and transfer descriptors are given to modem for DMA transfer. The driver exposes two types of ports, namely "wwan0mbim0", a char device node which is used for MBIM control operation and "wwan0-x",(x = 0,1,2..7) network interfaces for IP data communication. 1) MBIM Control Interface: This node exposes an interface between modem and application using char device exposed by "IOSM" driver to establish and manage the MBIM data communication with PCIe based Intel M.2 Modems. 2) MBIM Data Interface: The IOSM driver exposes IP link interface "wwan0-x" of type "wwan" for IP traffic. Iproute network utility is used for creating "wwan0-x" network interface and for associating it with MBIM IP session. The Driver supports upto 8 IP sessions for simultaneous IP communication. This applies on top of WWAN core rtnetlink series posted here: https://lore.kernel.org/netdev/1623486057-13075-1-git-send-email-loic.poulain@linaro.org/ Also driver has been compiled and tested on top of netdev net-next tree. https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
37 changed files
with
8,903 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ Contents: | |
qlogic/index | ||
wan/index | ||
wifi/index | ||
wwan/index | ||
|
||
.. only:: subproject and html | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.. SPDX-License-Identifier: GPL-2.0-only | ||
WWAN Device Drivers | ||
=================== | ||
|
||
Contents: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
iosm | ||
|
||
.. only:: subproject and html | ||
|
||
Indices | ||
======= | ||
|
||
* :ref:`genindex` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
.. SPDX-License-Identifier: GPL-2.0-only | ||
.. Copyright (C) 2020-21 Intel Corporation | ||
.. _iosm_driver_doc: | ||
|
||
=========================================== | ||
IOSM Driver for Intel M.2 PCIe based Modems | ||
=========================================== | ||
The IOSM (IPC over Shared Memory) driver is a WWAN PCIe host driver developed | ||
for linux or chrome platform for data exchange over PCIe interface between | ||
Host platform & Intel M.2 Modem. The driver exposes interface conforming to the | ||
MBIM protocol [1]. Any front end application ( eg: Modem Manager) could easily | ||
manage the MBIM interface to enable data communication towards WWAN. | ||
|
||
Basic usage | ||
=========== | ||
MBIM functions are inactive when unmanaged. The IOSM driver only provides a | ||
userspace interface MBIM "WWAN PORT" representing MBIM control channel and does | ||
not play any role in managing the functionality. It is the job of a userspace | ||
application to detect port enumeration and enable MBIM functionality. | ||
|
||
Examples of few such userspace application are: | ||
- mbimcli (included with the libmbim [2] library), and | ||
- Modem Manager [3] | ||
|
||
Management Applications to carry out below required actions for establishing | ||
MBIM IP session: | ||
- open the MBIM control channel | ||
- configure network connection settings | ||
- connect to network | ||
- configure IP network interface | ||
|
||
Management application development | ||
================================== | ||
The driver and userspace interfaces are described below. The MBIM protocol is | ||
described in [1] Mobile Broadband Interface Model v1.0 Errata-1. | ||
|
||
MBIM control channel userspace ABI | ||
---------------------------------- | ||
|
||
/dev/wwan0mbim0 character device | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
The driver exposes an MBIM interface to the MBIM function by implementing | ||
MBIM WWAN Port. The userspace end of the control channel pipe is a | ||
/dev/wwan0mbim0 character device. Application shall use this interface for | ||
MBIM protocol communication. | ||
|
||
Fragmentation | ||
~~~~~~~~~~~~~ | ||
The userspace application is responsible for all control message fragmentation | ||
and defragmentation as per MBIM specification. | ||
|
||
/dev/wwan0mbim0 write() | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
The MBIM control messages from the management application must not exceed the | ||
negotiated control message size. | ||
|
||
/dev/wwan0mbim0 read() | ||
~~~~~~~~~~~~~~~~~~~~ | ||
The management application must accept control messages of up the negotiated | ||
control message size. | ||
|
||
MBIM data channel userspace ABI | ||
------------------------------- | ||
|
||
wwan0-X network device | ||
~~~~~~~~~~~~~~~~~~~~ | ||
The IOSM driver exposes IP link interface "wwan0-X" of type "wwan" for IP | ||
traffic. Iproute network utility is used for creating "wwan0-X" network | ||
interface and for associating it with MBIM IP session. The Driver supports | ||
upto 8 IP sessions for simultaneous IP communication. | ||
|
||
The userspace management application is responsible for creating new IP link | ||
prior to establishing MBIM IP session where the SessionId is greater than 0. | ||
|
||
For example, creating new IP link for a MBIM IP session with SessionId 1: | ||
|
||
ip link add dev wwan0-1 parentdev-name wwan0 type wwan linkid 1 | ||
|
||
The driver will automatically map the "wwan0-1" network device to MBIM IP | ||
session 1. | ||
|
||
References | ||
========== | ||
[1] "MBIM (Mobile Broadband Interface Model) Errata-1" | ||
- https://www.usb.org/document-library/ | ||
|
||
[2] libmbim - "a glib-based library for talking to WWAN modems and | ||
devices which speak the Mobile Interface Broadband Model (MBIM) | ||
protocol" | ||
- http://www.freedesktop.org/wiki/Software/libmbim/ | ||
|
||
[3] Modem Manager - "a DBus-activated daemon which controls mobile | ||
broadband (2G/3G/4G) devices and connections" | ||
- http://www.freedesktop.org/wiki/Software/ModemManager/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-License-Identifier: (GPL-2.0-only) | ||
# | ||
# Copyright (C) 2020-21 Intel Corporation. | ||
# | ||
|
||
iosm-y = \ | ||
iosm_ipc_task_queue.o \ | ||
iosm_ipc_imem.o \ | ||
iosm_ipc_imem_ops.o \ | ||
iosm_ipc_mmio.o \ | ||
iosm_ipc_port.o \ | ||
iosm_ipc_wwan.o \ | ||
iosm_ipc_uevent.o \ | ||
iosm_ipc_pm.o \ | ||
iosm_ipc_pcie.o \ | ||
iosm_ipc_irq.o \ | ||
iosm_ipc_chnl_cfg.o \ | ||
iosm_ipc_protocol.o \ | ||
iosm_ipc_protocol_ops.o \ | ||
iosm_ipc_mux.o \ | ||
iosm_ipc_mux_codec.o | ||
|
||
obj-$(CONFIG_IOSM) := iosm.o | ||
|
||
# compilation flags | ||
ccflags-y += -DDEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Copyright (C) 2020-21 Intel Corporation. | ||
*/ | ||
|
||
#include <linux/wwan.h> | ||
|
||
#include "iosm_ipc_chnl_cfg.h" | ||
|
||
/* Max. sizes of a downlink buffers */ | ||
#define IPC_MEM_MAX_DL_FLASH_BUF_SIZE (16 * 1024) | ||
#define IPC_MEM_MAX_DL_LOOPBACK_SIZE (1 * 1024 * 1024) | ||
#define IPC_MEM_MAX_DL_AT_BUF_SIZE 2048 | ||
#define IPC_MEM_MAX_DL_RPC_BUF_SIZE (32 * 1024) | ||
#define IPC_MEM_MAX_DL_MBIM_BUF_SIZE IPC_MEM_MAX_DL_RPC_BUF_SIZE | ||
|
||
/* Max. transfer descriptors for a pipe. */ | ||
#define IPC_MEM_MAX_TDS_FLASH_DL 3 | ||
#define IPC_MEM_MAX_TDS_FLASH_UL 6 | ||
#define IPC_MEM_MAX_TDS_AT 4 | ||
#define IPC_MEM_MAX_TDS_RPC 4 | ||
#define IPC_MEM_MAX_TDS_MBIM IPC_MEM_MAX_TDS_RPC | ||
#define IPC_MEM_MAX_TDS_LOOPBACK 11 | ||
|
||
/* Accumulation backoff usec */ | ||
#define IRQ_ACC_BACKOFF_OFF 0 | ||
|
||
/* MUX acc backoff 1ms */ | ||
#define IRQ_ACC_BACKOFF_MUX 1000 | ||
|
||
/* Modem channel configuration table | ||
* Always reserve element zero for flash channel. | ||
*/ | ||
static struct ipc_chnl_cfg modem_cfg[] = { | ||
/* IP Mux */ | ||
{ IPC_MEM_IP_CHL_ID_0, IPC_MEM_PIPE_0, IPC_MEM_PIPE_1, | ||
IPC_MEM_MAX_TDS_MUX_LITE_UL, IPC_MEM_MAX_TDS_MUX_LITE_DL, | ||
IPC_MEM_MAX_DL_MUX_LITE_BUF_SIZE, WWAN_PORT_UNKNOWN }, | ||
/* RPC - 0 */ | ||
{ IPC_MEM_CTRL_CHL_ID_1, IPC_MEM_PIPE_2, IPC_MEM_PIPE_3, | ||
IPC_MEM_MAX_TDS_RPC, IPC_MEM_MAX_TDS_RPC, | ||
IPC_MEM_MAX_DL_RPC_BUF_SIZE, WWAN_PORT_UNKNOWN }, | ||
/* IAT0 */ | ||
{ IPC_MEM_CTRL_CHL_ID_2, IPC_MEM_PIPE_4, IPC_MEM_PIPE_5, | ||
IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_DL_AT_BUF_SIZE, | ||
WWAN_PORT_AT }, | ||
/* Trace */ | ||
{ IPC_MEM_CTRL_CHL_ID_3, IPC_MEM_PIPE_6, IPC_MEM_PIPE_7, | ||
IPC_MEM_TDS_TRC, IPC_MEM_TDS_TRC, IPC_MEM_MAX_DL_TRC_BUF_SIZE, | ||
WWAN_PORT_UNKNOWN }, | ||
/* IAT1 */ | ||
{ IPC_MEM_CTRL_CHL_ID_4, IPC_MEM_PIPE_8, IPC_MEM_PIPE_9, | ||
IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_DL_AT_BUF_SIZE, | ||
WWAN_PORT_AT }, | ||
/* Loopback */ | ||
{ IPC_MEM_CTRL_CHL_ID_5, IPC_MEM_PIPE_10, IPC_MEM_PIPE_11, | ||
IPC_MEM_MAX_TDS_LOOPBACK, IPC_MEM_MAX_TDS_LOOPBACK, | ||
IPC_MEM_MAX_DL_LOOPBACK_SIZE, WWAN_PORT_UNKNOWN }, | ||
/* MBIM Channel */ | ||
{ IPC_MEM_CTRL_CHL_ID_6, IPC_MEM_PIPE_12, IPC_MEM_PIPE_13, | ||
IPC_MEM_MAX_TDS_MBIM, IPC_MEM_MAX_TDS_MBIM, | ||
IPC_MEM_MAX_DL_MBIM_BUF_SIZE, WWAN_PORT_MBIM }, | ||
}; | ||
|
||
int ipc_chnl_cfg_get(struct ipc_chnl_cfg *chnl_cfg, int index) | ||
{ | ||
int array_size = ARRAY_SIZE(modem_cfg); | ||
|
||
if (index >= array_size) { | ||
pr_err("index: %d and array_size %d", index, array_size); | ||
return -ECHRNG; | ||
} | ||
|
||
if (index == IPC_MEM_MUX_IP_CH_IF_ID) | ||
chnl_cfg->accumulation_backoff = IRQ_ACC_BACKOFF_MUX; | ||
else | ||
chnl_cfg->accumulation_backoff = IRQ_ACC_BACKOFF_OFF; | ||
|
||
chnl_cfg->ul_nr_of_entries = modem_cfg[index].ul_nr_of_entries; | ||
chnl_cfg->dl_nr_of_entries = modem_cfg[index].dl_nr_of_entries; | ||
chnl_cfg->dl_buf_size = modem_cfg[index].dl_buf_size; | ||
chnl_cfg->id = modem_cfg[index].id; | ||
chnl_cfg->ul_pipe = modem_cfg[index].ul_pipe; | ||
chnl_cfg->dl_pipe = modem_cfg[index].dl_pipe; | ||
chnl_cfg->wwan_port_type = modem_cfg[index].wwan_port_type; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only | ||
* | ||
* Copyright (C) 2020-21 Intel Corporation | ||
*/ | ||
|
||
#ifndef IOSM_IPC_CHNL_CFG_H | ||
#define IOSM_IPC_CHNL_CFG_H | ||
|
||
#include "iosm_ipc_mux.h" | ||
|
||
/* Number of TDs on the trace channel */ | ||
#define IPC_MEM_TDS_TRC 32 | ||
|
||
/* Trace channel TD buffer size. */ | ||
#define IPC_MEM_MAX_DL_TRC_BUF_SIZE 8192 | ||
|
||
/* Channel ID */ | ||
enum ipc_channel_id { | ||
IPC_MEM_IP_CHL_ID_0 = 0, | ||
IPC_MEM_CTRL_CHL_ID_1, | ||
IPC_MEM_CTRL_CHL_ID_2, | ||
IPC_MEM_CTRL_CHL_ID_3, | ||
IPC_MEM_CTRL_CHL_ID_4, | ||
IPC_MEM_CTRL_CHL_ID_5, | ||
IPC_MEM_CTRL_CHL_ID_6, | ||
}; | ||
|
||
/** | ||
* struct ipc_chnl_cfg - IPC channel configuration structure | ||
* @id: Interface ID | ||
* @ul_pipe: Uplink datastream | ||
* @dl_pipe: Downlink datastream | ||
* @ul_nr_of_entries: Number of Transfer descriptor uplink pipe | ||
* @dl_nr_of_entries: Number of Transfer descriptor downlink pipe | ||
* @dl_buf_size: Downlink buffer size | ||
* @wwan_port_type: Wwan subsystem port type | ||
* @accumulation_backoff: Time in usec for data accumalation | ||
*/ | ||
struct ipc_chnl_cfg { | ||
u32 id; | ||
u32 ul_pipe; | ||
u32 dl_pipe; | ||
u32 ul_nr_of_entries; | ||
u32 dl_nr_of_entries; | ||
u32 dl_buf_size; | ||
u32 wwan_port_type; | ||
u32 accumulation_backoff; | ||
}; | ||
|
||
/** | ||
* ipc_chnl_cfg_get - Get pipe configuration. | ||
* @chnl_cfg: Array of ipc_chnl_cfg struct | ||
* @index: Channel index (upto MAX_CHANNELS) | ||
* | ||
* Return: 0 on success and failure value on error | ||
*/ | ||
int ipc_chnl_cfg_get(struct ipc_chnl_cfg *chnl_cfg, int index); | ||
|
||
#endif |
Oops, something went wrong.