Skip to content

Commit fbd4360

Browse files
committed
Merge branch 'net-introduce-Qualcomm-IPA-driver'
Alex Elder says: ==================== net: introduce Qualcomm IPA driver (UPDATED) This series presents the driver for the Qualcomm IP Accelerator (IPA). This is version 2 of this updated series. It includes the following small changes since the previous version: - Now based on net-next instead of v5.6-rc - Config option now named CONFIG_QCOM_IPA - Some minor cleanup in the GSI code - Small change to replenish logic - No longer depends on remoteproc bug fixes What follows is the basically same explanation as was posted previously. -Alex I have posted earlier versions of this code previously, but it has undergone quite a bit of development since the last time, so rather than calling it "version 3" I'm just treating it as a new series (indicating it's been updated in this message). The fast/data path is the same as before. But the driver now (nearly) supports a second platform, its transaction handling has been generalized and improved, and modem activities are now handled in a more unified way. This series is available (based on net-next in branch "ipa_updated-v2" in this git repository: https://git.linaro.org/people/alex.elder/linux.git The branch depends on other one other small patch that I sent out for review earlier. https://lore.kernel.org/lkml/20200306042302.17602-1-elder@linaro.org/ I want to address some of the discussion that arose last time. First, there was the WWAN discussion. Here's the history: - This was last posted nine months ago. - Reviewers at that time favored developing a new WWAN subsystem that would be used for managing devices like this. And the suggestion was to not accept this driver until that could be developed. - Along the way, Apple acquired much of Intel's modem business. And as a result, the generic framework became less pressing. - I did participate in the WWAN subsystem design however, and although it went dormant for a while it's been resurrected: https://lore.kernel.org/netdev/20200225100053.16385-1-johannes@sipsolutions.net/ - Unfortunately the proposed WWAN design was not an easy fit with Qualcomm's integrated modem interfaces. Given that rmnet is a supported link type for in the upstream "iproute2" package (more on this below), I have opted not to integrate with any WWAN subsystem. So in summary, this driver does not integrate with a generic WWAN framework. And I'd like it to be accepted upstream despite that. Next, Arnd Bergmann had some concerns about flow control. (Note: some of my discussions with Arnd about this were offline.) The overall architecture here also involves the "rmnet" driver: drivers/net/ethernet/qualcomm/rmnet The rmnet driver presents a network device for use. It connects with another network device presented, by the IPA driver. The rmnet driver wraps (and unwraps) packets transferred to (and from) the IPA driver with QMAP headers. --------------- | rmnet_data0 | <-- "real" netdev --------------- || }- QMAP spoken here -------------- | rmnet_ipa0 | <-- also netdev, transporting QMAP packets -------------- || -------------- ( IPA hardware ) -------------- Arnd's concern was that the rmnet_data0 network device does not have the benefit of information about the state of the underlying IPA hardware in order to be effective in controlling TX flow. The feared result is over-buffering of TX packets (bufferbloat). I began working on some simple experiments to see whether (or how much) his concern was warranted. But it turned out that completing these experiments was much more work than had been hoped. The rmnet driver is present in the upstream kernel. There is also support for the rmnet link type in the upstream "ip" user space command in the "iproute2" package. Changing the layering of rmnet over IPA likely involves deprecating the rmnet driver and its support in "iproute2". I would really rather not go down that path. There is precedent for this sort of layering of network devices (L2TP, VLAN). And any architecture like this would suffer the issues Arnd mentioned; the problem is not limited to rmnet and IPA. I do think this is a problem worth solving, but the prudent thing to do might be to try to solve it more generally. So to summarize on this issue, this driver does not attempt to change the way the rmnet and IPA drivers work together. And even though I think Arnd's concerns warrant more investigation, I'd like this driver to to be accepted upstream without any change to this architecture. Finally, a more technical description for the series, and some acknowledgements to some people who contributed to it. The IPA is a component present in some Qualcomm SoCs that allows network functions such as aggregation, filtering, routing, and NAT to be performed without active involvement of the main application processor (AP). In this initial patch series these advanced features are not implemented. The IPA driver simply provides a network interface that makes the modem's LTE network available in Linux. This initial series supports only the Qualcomm SDM845 SoC. The Qualcomm SC7180 SoC is partially supported, and support for other platforms will follow. This code is derived from a driver developed by Qualcomm. A version of the original source can be seen here: https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree in the "drivers/platform/msm/ipa" directory. Many were involved in developing this, but the following individuals deserve explicit acknowledgement for their substantial contributions: Abhishek Choubey Ady Abraham Chaitanya Pratapa David Arinzon Ghanim Fodi Gidon Studinski Ravi Gummadidala Shihuan Liu Skylar Chang ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents e2f5cb7 + 9cc5ae1 commit fbd4360

50 files changed

Lines changed: 14192 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/qcom,ipa.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Qualcomm IP Accelerator (IPA)
8+
9+
maintainers:
10+
- Alex Elder <elder@kernel.org>
11+
12+
description:
13+
This binding describes the Qualcomm IPA. The IPA is capable of offloading
14+
certain network processing tasks (e.g. filtering, routing, and NAT) from
15+
the main processor.
16+
17+
The IPA sits between multiple independent "execution environments,"
18+
including the Application Processor (AP) and the modem. The IPA presents
19+
a Generic Software Interface (GSI) to each execution environment.
20+
The GSI is an integral part of the IPA, but it is logically isolated
21+
and has a distinct interrupt and a separately-defined address space.
22+
23+
See also soc/qcom/qcom,smp2p.txt and interconnect/interconnect.txt.
24+
25+
- |
26+
-------- ---------
27+
| | | |
28+
| AP +<---. .----+ Modem |
29+
| +--. | | .->+ |
30+
| | | | | | | |
31+
-------- | | | | ---------
32+
v | v |
33+
--+-+---+-+--
34+
| GSI |
35+
|-----------|
36+
| |
37+
| IPA |
38+
| |
39+
-------------
40+
41+
properties:
42+
compatible:
43+
const: "qcom,sdm845-ipa"
44+
45+
reg:
46+
items:
47+
- description: IPA registers
48+
- description: IPA shared memory
49+
- description: GSI registers
50+
51+
reg-names:
52+
items:
53+
- const: ipa-reg
54+
- const: ipa-shared
55+
- const: gsi
56+
57+
clocks:
58+
maxItems: 1
59+
60+
clock-names:
61+
const: core
62+
63+
interrupts:
64+
items:
65+
- description: IPA interrupt (hardware IRQ)
66+
- description: GSI interrupt (hardware IRQ)
67+
- description: Modem clock query interrupt (smp2p interrupt)
68+
- description: Modem setup ready interrupt (smp2p interrupt)
69+
70+
interrupt-names:
71+
items:
72+
- const: ipa
73+
- const: gsi
74+
- const: ipa-clock-query
75+
- const: ipa-setup-ready
76+
77+
interconnects:
78+
items:
79+
- description: Interconnect path between IPA and main memory
80+
- description: Interconnect path between IPA and internal memory
81+
- description: Interconnect path between IPA and the AP subsystem
82+
83+
interconnect-names:
84+
items:
85+
- const: memory
86+
- const: imem
87+
- const: config
88+
89+
qcom,smem-states:
90+
$ref: /schemas/types.yaml#/definitions/phandle-array
91+
description: State bits used in by the AP to signal the modem.
92+
items:
93+
- description: Whether the "ipa-clock-enabled" state bit is valid
94+
- description: Whether the IPA clock is enabled (if valid)
95+
96+
qcom,smem-state-names:
97+
$ref: /schemas/types.yaml#/definitions/string-array
98+
description: The names of the state bits used for SMP2P output
99+
items:
100+
- const: ipa-clock-enabled-valid
101+
- const: ipa-clock-enabled
102+
103+
modem-init:
104+
type: boolean
105+
description:
106+
If present, it indicates that the modem is responsible for
107+
performing early IPA initialization, including loading and
108+
validating firwmare used by the GSI.
109+
110+
modem-remoteproc:
111+
$ref: /schemas/types.yaml#definitions/phandle
112+
description:
113+
This defines the phandle to the remoteproc node representing
114+
the modem subsystem. This is requied so the IPA driver can
115+
receive and act on notifications of modem up/down events.
116+
117+
memory-region:
118+
$ref: /schemas/types.yaml#/definitions/phandle-array
119+
maxItems: 1
120+
description:
121+
If present, a phandle for a reserved memory area that holds
122+
the firmware passed to Trust Zone for authentication. Required
123+
when Trust Zone (not the modem) performs early initialization.
124+
125+
required:
126+
- compatible
127+
- reg
128+
- clocks
129+
- interrupts
130+
- interconnects
131+
- qcom,smem-states
132+
- modem-remoteproc
133+
134+
oneOf:
135+
- required:
136+
- modem-init
137+
- required:
138+
- memory-region
139+
140+
examples:
141+
- |
142+
smp2p-mpss {
143+
compatible = "qcom,smp2p";
144+
ipa_smp2p_out: ipa-ap-to-modem {
145+
qcom,entry-name = "ipa";
146+
#qcom,smem-state-cells = <1>;
147+
};
148+
149+
ipa_smp2p_in: ipa-modem-to-ap {
150+
qcom,entry-name = "ipa";
151+
interrupt-controller;
152+
#interrupt-cells = <2>;
153+
};
154+
};
155+
ipa@1e40000 {
156+
compatible = "qcom,sdm845-ipa";
157+
158+
modem-init;
159+
modem-remoteproc = <&mss_pil>;
160+
161+
reg = <0 0x1e40000 0 0x7000>,
162+
<0 0x1e47000 0 0x2000>,
163+
<0 0x1e04000 0 0x2c000>;
164+
reg-names = "ipa-reg",
165+
"ipa-shared";
166+
"gsi";
167+
168+
interrupts-extended = <&intc 0 311 IRQ_TYPE_EDGE_RISING>,
169+
<&intc 0 432 IRQ_TYPE_LEVEL_HIGH>,
170+
<&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
171+
<&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
172+
interrupt-names = "ipa",
173+
"gsi",
174+
"ipa-clock-query",
175+
"ipa-setup-ready";
176+
177+
clocks = <&rpmhcc RPMH_IPA_CLK>;
178+
clock-names = "core";
179+
180+
interconnects =
181+
<&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_EBI1>,
182+
<&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_IMEM>,
183+
<&rsc_hlos MASTER_APPSS_PROC &rsc_hlos SLAVE_IPA_CFG>;
184+
interconnect-names = "memory",
185+
"imem",
186+
"config";
187+
188+
qcom,smem-states = <&ipa_smp2p_out 0>,
189+
<&ipa_smp2p_out 1>;
190+
qcom,smem-state-names = "ipa-clock-enabled-valid",
191+
"ipa-clock-enabled";
192+
};

‎MAINTAINERS‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13662,6 +13662,12 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
1366213662
S: Supported
1366313663
F: sound/soc/qcom/
1366413664

13665+
QCOM IPA DRIVER
13666+
M: Alex Elder <elder@kernel.org>
13667+
L: netdev@vger.kernel.org
13668+
S: Supported
13669+
F: drivers/net/ipa/
13670+
1366513671
QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT
1366613672
M: Gabriel Somlo <somlo@cmu.edu>
1366713673
M: "Michael S. Tsirkin" <mst@redhat.com>

‎arch/arm64/boot/dts/qcom/sdm845.dtsi‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,17 @@
675675
interrupt-controller;
676676
#interrupt-cells = <2>;
677677
};
678+
679+
ipa_smp2p_out: ipa-ap-to-modem {
680+
qcom,entry-name = "ipa";
681+
#qcom,smem-state-cells = <1>;
682+
};
683+
684+
ipa_smp2p_in: ipa-modem-to-ap {
685+
qcom,entry-name = "ipa";
686+
interrupt-controller;
687+
#interrupt-cells = <2>;
688+
};
678689
};
679690

680691
smp2p-slpi {
@@ -1435,6 +1446,46 @@
14351446
};
14361447
};
14371448

1449+
ipa@1e40000 {
1450+
compatible = "qcom,sdm845-ipa";
1451+
1452+
modem-init;
1453+
modem-remoteproc = <&mss_pil>;
1454+
1455+
reg = <0 0x1e40000 0 0x7000>,
1456+
<0 0x1e47000 0 0x2000>,
1457+
<0 0x1e04000 0 0x2c000>;
1458+
reg-names = "ipa-reg",
1459+
"ipa-shared",
1460+
"gsi";
1461+
1462+
interrupts-extended =
1463+
<&intc 0 311 IRQ_TYPE_EDGE_RISING>,
1464+
<&intc 0 432 IRQ_TYPE_LEVEL_HIGH>,
1465+
<&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
1466+
<&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
1467+
interrupt-names = "ipa",
1468+
"gsi",
1469+
"ipa-clock-query",
1470+
"ipa-setup-ready";
1471+
1472+
clocks = <&rpmhcc RPMH_IPA_CLK>;
1473+
clock-names = "core";
1474+
1475+
interconnects =
1476+
<&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_EBI1>,
1477+
<&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_IMEM>,
1478+
<&rsc_hlos MASTER_APPSS_PROC &rsc_hlos SLAVE_IPA_CFG>;
1479+
interconnect-names = "memory",
1480+
"imem",
1481+
"config";
1482+
1483+
qcom,smem-states = <&ipa_smp2p_out 0>,
1484+
<&ipa_smp2p_out 1>;
1485+
qcom,smem-state-names = "ipa-clock-enabled-valid",
1486+
"ipa-clock-enabled";
1487+
};
1488+
14381489
tcsr_mutex_regs: syscon@1f40000 {
14391490
compatible = "syscon";
14401491
reg = <0 0x01f40000 0 0x40000>;

‎drivers/net/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ source "drivers/net/fddi/Kconfig"
444444

445445
source "drivers/net/hippi/Kconfig"
446446

447+
source "drivers/net/ipa/Kconfig"
448+
447449
config NET_SB1000
448450
tristate "General Instruments Surfboard 1000"
449451
depends on PNP

‎drivers/net/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ obj-$(CONFIG_ETHERNET) += ethernet/
4747
obj-$(CONFIG_FDDI) += fddi/
4848
obj-$(CONFIG_HIPPI) += hippi/
4949
obj-$(CONFIG_HAMRADIO) += hamradio/
50+
obj-$(CONFIG_QCOM_IPA) += ipa/
5051
obj-$(CONFIG_PLIP) += plip/
5152
obj-$(CONFIG_PPP) += ppp/
5253
obj-$(CONFIG_PPP_ASYNC) += ppp/

‎drivers/net/ipa/Kconfig‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
config QCOM_IPA
2+
tristate "Qualcomm IPA support"
3+
depends on ARCH_QCOM && 64BIT && NET
4+
select QCOM_QMI_HELPERS
5+
select QCOM_MDT_LOADER
6+
default QCOM_Q6V5_COMMON
7+
help
8+
Choose Y or M here to include support for the Qualcomm
9+
IP Accelerator (IPA), a hardware block present in some
10+
Qualcomm SoCs. The IPA is a programmable protocol processor
11+
that is capable of generic hardware handling of IP packets,
12+
including routing, filtering, and NAT. Currently the IPA
13+
driver supports only basic transport of network traffic
14+
between the AP and modem, on the Qualcomm SDM845 SoC.
15+
16+
Note that if selected, the selection type must match that
17+
of QCOM_Q6V5_COMMON (Y or M).
18+
19+
If unsure, say N.

‎drivers/net/ipa/Makefile‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Un-comment the next line if you want to validate configuration data
2+
#ccflags-y += -DIPA_VALIDATE
3+
4+
obj-$(CONFIG_QCOM_IPA) += ipa.o
5+
6+
ipa-y := ipa_main.o ipa_clock.o ipa_reg.o ipa_mem.o \
7+
ipa_table.o ipa_interrupt.o gsi.o gsi_trans.o \
8+
ipa_gsi.o ipa_smp2p.o ipa_uc.o \
9+
ipa_endpoint.o ipa_cmd.o ipa_modem.o \
10+
ipa_qmi.o ipa_qmi_msg.o
11+
12+
ipa-y += ipa_data-sdm845.o ipa_data-sc7180.o

0 commit comments

Comments
 (0)