Commit fbd43602 authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents e2f5cb72 9cc5ae12
Loading
Loading
Loading
Loading
+192 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/qcom,ipa.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm IP Accelerator (IPA)

maintainers:
  - Alex Elder <elder@kernel.org>

description:
  This binding describes the Qualcomm IPA.  The IPA is capable of offloading
  certain network processing tasks (e.g. filtering, routing, and NAT) from
  the main processor.

  The IPA sits between multiple independent "execution environments,"
  including the Application Processor (AP) and the modem.  The IPA presents
  a Generic Software Interface (GSI) to each execution environment.
  The GSI is an integral part of the IPA, but it is logically isolated
  and has a distinct interrupt and a separately-defined address space.

  See also soc/qcom/qcom,smp2p.txt and interconnect/interconnect.txt.

  - |
    --------             ---------
    |      |             |       |
    |  AP  +<---.   .----+ Modem |
    |      +--. |   | .->+       |
    |      |  | |   | |  |       |
    --------  | |   | |  ---------
              v |   v |
            --+-+---+-+--
            |    GSI    |
            |-----------|
            |           |
            |    IPA    |
            |           |
            -------------

properties:
  compatible:
      const: "qcom,sdm845-ipa"

  reg:
    items:
      - description: IPA registers
      - description: IPA shared memory
      - description: GSI registers

  reg-names:
    items:
      - const: ipa-reg
      - const: ipa-shared
      - const: gsi

  clocks:
    maxItems: 1

  clock-names:
      const: core

  interrupts:
    items:
      - description: IPA interrupt (hardware IRQ)
      - description: GSI interrupt (hardware IRQ)
      - description: Modem clock query interrupt (smp2p interrupt)
      - description: Modem setup ready interrupt (smp2p interrupt)

  interrupt-names:
    items:
      - const: ipa
      - const: gsi
      - const: ipa-clock-query
      - const: ipa-setup-ready

  interconnects:
    items:
      - description: Interconnect path between IPA and main memory
      - description: Interconnect path between IPA and internal memory
      - description: Interconnect path between IPA and the AP subsystem

  interconnect-names:
    items:
      - const: memory
      - const: imem
      - const: config

  qcom,smem-states:
    $ref: /schemas/types.yaml#/definitions/phandle-array
    description: State bits used in by the AP to signal the modem.
    items:
    - description: Whether the "ipa-clock-enabled" state bit is valid
    - description: Whether the IPA clock is enabled (if valid)

  qcom,smem-state-names:
    $ref: /schemas/types.yaml#/definitions/string-array
    description: The names of the state bits used for SMP2P output
    items:
      - const: ipa-clock-enabled-valid
      - const: ipa-clock-enabled

  modem-init:
    type: boolean
    description:
      If present, it indicates that the modem is responsible for
      performing early IPA initialization, including loading and
      validating firwmare used by the GSI.

  modem-remoteproc:
    $ref: /schemas/types.yaml#definitions/phandle
    description:
      This defines the phandle to the remoteproc node representing
      the modem subsystem.  This is requied so the IPA driver can
      receive and act on notifications of modem up/down events.

  memory-region:
    $ref: /schemas/types.yaml#/definitions/phandle-array
    maxItems: 1
    description:
      If present, a phandle for a reserved memory area that holds
      the firmware passed to Trust Zone for authentication.  Required
      when Trust Zone (not the modem) performs early initialization.

required:
  - compatible
  - reg
  - clocks
  - interrupts
  - interconnects
  - qcom,smem-states
  - modem-remoteproc

oneOf:
  - required:
    - modem-init
  - required:
    - memory-region

examples:
  - |
        smp2p-mpss {
                compatible = "qcom,smp2p";
                ipa_smp2p_out: ipa-ap-to-modem {
                        qcom,entry-name = "ipa";
                        #qcom,smem-state-cells = <1>;
                };

                ipa_smp2p_in: ipa-modem-to-ap {
                        qcom,entry-name = "ipa";
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };
        };
        ipa@1e40000 {
                compatible = "qcom,sdm845-ipa";

                modem-init;
                modem-remoteproc = <&mss_pil>;

                reg = <0 0x1e40000 0 0x7000>,
                        <0 0x1e47000 0 0x2000>,
                        <0 0x1e04000 0 0x2c000>;
                reg-names = "ipa-reg",
                                "ipa-shared";
                                "gsi";

                interrupts-extended = <&intc 0 311 IRQ_TYPE_EDGE_RISING>,
                                        <&intc 0 432 IRQ_TYPE_LEVEL_HIGH>,
                                        <&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
                                        <&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
                interrupt-names = "ipa",
                                        "gsi",
                                        "ipa-clock-query",
                                        "ipa-setup-ready";

                clocks = <&rpmhcc RPMH_IPA_CLK>;
                clock-names = "core";

                interconnects =
                        <&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_EBI1>,
                        <&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_IMEM>,
                        <&rsc_hlos MASTER_APPSS_PROC &rsc_hlos SLAVE_IPA_CFG>;
                interconnect-names = "memory",
                                        "imem",
                                        "config";

                qcom,smem-states = <&ipa_smp2p_out 0>,
                                        <&ipa_smp2p_out 1>;
                qcom,smem-state-names = "ipa-clock-enabled-valid",
                                        "ipa-clock-enabled";
        };
+6 −0
Original line number Diff line number Diff line
@@ -13662,6 +13662,12 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
S:	Supported
F:	sound/soc/qcom/
QCOM IPA DRIVER
M:	Alex Elder <elder@kernel.org>
L:	netdev@vger.kernel.org
S:	Supported
F:	drivers/net/ipa/
QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT
M:	Gabriel Somlo <somlo@cmu.edu>
M:	"Michael S. Tsirkin" <mst@redhat.com>
+51 −0
Original line number Diff line number Diff line
@@ -675,6 +675,17 @@
			interrupt-controller;
			#interrupt-cells = <2>;
		};

		ipa_smp2p_out: ipa-ap-to-modem {
			qcom,entry-name = "ipa";
			#qcom,smem-state-cells = <1>;
		};

		ipa_smp2p_in: ipa-modem-to-ap {
			qcom,entry-name = "ipa";
			interrupt-controller;
			#interrupt-cells = <2>;
		};
	};

	smp2p-slpi {
@@ -1435,6 +1446,46 @@
			};
		};

		ipa@1e40000 {
			compatible = "qcom,sdm845-ipa";

			modem-init;
			modem-remoteproc = <&mss_pil>;

			reg = <0 0x1e40000 0 0x7000>,
			      <0 0x1e47000 0 0x2000>,
			      <0 0x1e04000 0 0x2c000>;
			reg-names = "ipa-reg",
				    "ipa-shared",
				    "gsi";

			interrupts-extended =
					<&intc 0 311 IRQ_TYPE_EDGE_RISING>,
					<&intc 0 432 IRQ_TYPE_LEVEL_HIGH>,
					<&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
					<&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "ipa",
					  "gsi",
					  "ipa-clock-query",
					  "ipa-setup-ready";

			clocks = <&rpmhcc RPMH_IPA_CLK>;
			clock-names = "core";

			interconnects =
				<&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_EBI1>,
				<&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_IMEM>,
				<&rsc_hlos MASTER_APPSS_PROC &rsc_hlos SLAVE_IPA_CFG>;
			interconnect-names = "memory",
					     "imem",
					     "config";

			qcom,smem-states = <&ipa_smp2p_out 0>,
					   <&ipa_smp2p_out 1>;
			qcom,smem-state-names = "ipa-clock-enabled-valid",
						"ipa-clock-enabled";
		};

		tcsr_mutex_regs: syscon@1f40000 {
			compatible = "syscon";
			reg = <0 0x01f40000 0 0x40000>;
+2 −0
Original line number Diff line number Diff line
@@ -444,6 +444,8 @@ source "drivers/net/fddi/Kconfig"

source "drivers/net/hippi/Kconfig"

source "drivers/net/ipa/Kconfig"

config NET_SB1000
	tristate "General Instruments Surfboard 1000"
	depends on PNP
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ obj-$(CONFIG_ETHERNET) += ethernet/
obj-$(CONFIG_FDDI) += fddi/
obj-$(CONFIG_HIPPI) += hippi/
obj-$(CONFIG_HAMRADIO) += hamradio/
obj-$(CONFIG_QCOM_IPA) += ipa/
obj-$(CONFIG_PLIP) += plip/
obj-$(CONFIG_PPP) += ppp/
obj-$(CONFIG_PPP_ASYNC) += ppp/
Loading