Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755161AbbHGBVb (ORCPT ); Thu, 6 Aug 2015 21:21:31 -0400 Received: from mail-bn1on0136.outbound.protection.outlook.com ([157.56.110.136]:6784 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750968AbbHGBV3 (ORCPT ); Thu, 6 Aug 2015 21:21:29 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Stuart Yoder To: , , CC: , , , , Stuart Yoder Subject: [PATCH v2] staging: fsl-mc: add DPAA2 overview readme Date: Thu, 6 Aug 2015 20:09:24 -0500 Message-ID: <1438909764-16338-1-git-send-email-stuart.yoder@freescale.com> X-Mailer: git-send-email 2.3.3 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD018;1:BnBx1nzCCIPEzN4rBEJNboslI1W4nRqN+q9fjZfhEct04AwKO6JKbFj9RGw9xeTojfsY2Wr7KeDKlEALxJ3OBwPa85JbBsugIo5ddd71qUUha4sUDmrwvW2YQ2y0Et+e5LwNEKA7IZdIXQEBEy7EgWR6KlVxWisq4n4gFlYr4W6sJti1YWJbZceiC6uD5v2ZuOjioOOqwXEXtDw1QSAcfoiURp4U8bmMtKpUDbhIO61HNcvchNUfTdj5U2Lyv6gYruMUd+avNXIgfCCq4k9yYrRLILNLEmGyF7DqZp9PqMzWY4chEr3RpYOGgl37xF3IKW9ape6mIGpp0SFHOx0a9w== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(54534003)(4001450100002)(5001960100002)(189998001)(68736005)(46102003)(105606002)(19580405001)(107886002)(6806004)(19580395003)(92566002)(77096005)(48376002)(36756003)(50226001)(4001540100001)(106466001)(33646002)(87936001)(5003940100001)(5001770100001)(97736004)(85426001)(50466002)(81156007)(104016003)(77156002)(5001830100001)(229853001)(47776003)(2201001)(64706001)(50986999)(86362001)(5001860100001)(62966003)(2101003)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0301MB0744;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB0744;2:pkaQ8OuKD28jgq5br7GezLMUDTvixouUFVx67gQZPLkQWFYMs01CZQ+51H431YJs;3:GauGJP6Tbtokbdo/fb1fKZjGBYK2+2u3qcOw+gi3FgKUqSepS+ROB1nao3Ku67kapq3gIDHJFJ52kKiUhyID54R96qkOP/A70T0XcDpRsUxL5q1gTO6WQ0c4q2aU1EycAbOtv52BWnjnggVCfHdpevQuc47W+JXiytuBLfphEUwZArtmJ2M7yKOeHBiyU2FPp+e97b89954PJ00ANbYJB2QgUZ9NDT5ACFpH4M6+LNo=;25:JOEFK7YoTQywye7Xr4s4ktQzSjMLSKlBuLen1P8IKFaqIvCYLilt8OhksMMB/KIC5kkGbZqHpH3+MS4qTTyrb5so8KFMZe2VT+W3V3QE1Q70y6cUPnyTikzQETNcAg0MDlqHr7MKbg8T841Enib9LdmVJLaBTt4yH9ulIJRAm96NBjEoxVooTEBLfaUol5ULXHmLpj7t++nqKEZleW7JBWdjnKe4bLy4mouda/S7dxLPZjkMIucslW4dL/Fp0G+hDQA1WcjeJTGBLFQDMM9nkA==;20:5FOFs28PXIeY/g55atRFcIcHfgl9i5ijUPsebTZ+bWSO0Jhh9P1ue+gnJyuTPnRwITHDD15r3u3/IuASZlLA5URn+XHSA20K4b8M11ZoK3lkaFkv0G+mJWZThFCXoPyxYdnaN03O85yejmVK4QtHUwe/RFFs5kl5WgLxFXsGF8A0lTFllB0i6jyPdcs+CvsUJRktuaJArG9deuCL4Um6dGqRkGO8R+4fwjLJZXpiG2s0lNNP2iTlxYIkQMncoBIWsVu9H2Z3RT/YS66U4MOu3O6Nsl5GaIanUB41F7Ixr3XP6l8ItrRzT/VzymCeQHl/vJEPcMfu2Prk+JEvbuWQiQ37Ald9X/KKrSgoW+bqrl4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0744; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY2PR0301MB0744;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0744; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB0744;4:u1AvdXzNgwgjzjoI888+wAR66kDjH2FXgxTm/FwW3d4dR6HTtr9LCp7jrsLDSVxP1J413EP527eAG8VqgS7P3v9m/PE1PmX/pVK3UZNlegR9u4vkssRgdKsnUGHTBj8FK/ziioOAap3jrss5179qOl25WjvDOnqeaVvLX3njA7M4zRn7wotInzENSD4OByLDwx7jMm9pXrMZ3gPTDglGbMR3rHYKFG6PwWnhApbngjvsoyWQJJTlbrkfJFQhrCv0uDgFZzlbn6Sq+osqWbgJtElNN+A4T5AnCQRpp0SzjGo= X-Forefront-PRVS: 066153096A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0301MB0744;23:brRbHuQEJ/dcL9N9tyUzULETo2k22soN4cw204D?= =?us-ascii?Q?mdxQaCsLlFiXsDdXMFLdvxfAojxvf4otvTXV6R0ZEvxZ6TR0mkVfX5be8tCb?= =?us-ascii?Q?9HroWzRqBhUvA4c5oCuWwmASMHTXLLWcr+gontSQDNEPVerG0okIPy3oXF/Z?= =?us-ascii?Q?yBjCgGtBWWYgZOybxihYn1fy3ox5QkQJcVsRPMQtG046yE1oKr0k8v9M+F7M?= =?us-ascii?Q?na+a+dzl7DxlgSN0+iCAcwFa9k5fzjlleTy3N6hfSvbJx4PsbTW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3hocicZqR3M8OuQJFtEg4cLwQd4NHdkDFx6/r?= =?us-ascii?Q?YgpwQ/OLkBRfqc+E=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB0744;5:Oj+60iQ2YRcz2vl7kUUH7oy/B4NYOL2X/GK/JxlhJFJbGLZOrdfFkNObhPwAq3IxrXVM+ouSQs3us+Uj40GrFx6uO6nV5EELJsvFvk5omyXoVD2WDvUmgOE2aKt21s0itjRykQSbkYAQlUoRaP3hBw==;24:2Sq4Kz9abzJTn+WCs25UlcjVPptR2Vw4cYjwixlZUKEb09zDeujnohcnpM61oXfmf0cMhAiLlS0P/tHxRB0E+BCJCZTu/TkBTrH4fwQNqk4=;20:R3LLjQGDLQaWicIo7OWfRg9g7X8iPJbrtjGpPAHIsMYCY/7GYQBHc+fxZdsabV85rC3x8cVLW4/m6612Pp0+JA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2015 01:21:25.1971 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0744 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 17365 Lines: 402 add README file providing an overview of the DPAA2 architecture and how it is integrated in Linux Signed-off-by: Stuart Yoder --- -v2: added changelog text drivers/staging/fsl-mc/README.txt | 364 ++++++++++++++++++++++++++++++++++++++ drivers/staging/fsl-mc/TODO | 4 - 2 files changed, 364 insertions(+), 4 deletions(-) create mode 100644 drivers/staging/fsl-mc/README.txt diff --git a/drivers/staging/fsl-mc/README.txt b/drivers/staging/fsl-mc/README.txt new file mode 100644 index 0000000..8214102 --- /dev/null +++ b/drivers/staging/fsl-mc/README.txt @@ -0,0 +1,364 @@ +Copyright (C) 2015 Freescale Semiconductor Inc. + +DPAA2 (Data Path Acceleration Architecture Gen2) +------------------------------------------------ + +This document provides an overview of the Freescale DPAA2 architecture +and how it is integrated into the Linux kernel. + +Contents summary + -DPAA2 overview + -Overview of DPAA2 objects + -DPAA2 Linux driver architecture overview + -bus driver + -dprc driver + -allocator + -dpio driver + -Ethernet + -mac + +DPAA2 Overview +-------------- + +DPAA2 is a hardware architecture designed for high-speeed network +packet processing. DPAA2 consists of sophisticated mechanisms for +processing Ethernet packets, queue management, buffer management, +autonomous L2 switching, virtual Ethernet bridging, and accelerator +(e.g. crypto) sharing. + +A DPAA2 hardware component called the Management Complex (or MC) manages the +DPAA2 hardware resources. The MC provides an object-based abstraction for +software drivers to use the DPAA2 hardware. + +The MC uses DPAA2 hardware resources such as queues, buffer pools, and +network ports to create functional objects/devices such as network +interfaces, an L2 switch, or accelerator instances. + +The MC provides memory-mapped I/O command interfaces (MC portals) +which DPAA2 software drivers use to operate on DPAA2 objects: + + +--------------------------------------+ + | OS | + | DPAA2 drivers | + | | | + +-----------------------------|--------+ + | + | (create,discover,connect + | config,use,destroy) + | + DPAA2 | + +------------------------| mc portal |-+ + | | | + | +- - - - - - - - - - - - -V- - -+ | + | | | | + | | Management Complex (MC) | | + | | | | + | +- - - - - - - - - - - - - - - -+ | + | | + | Hardware Hardware | + | Resources Objects | + | --------- ------- | + | -queues -DPRC | + | -buffer pools -DPMCP | + | -Eth MACs/ports -DPIO | + | -network interface -DPNI | + | profiles -DPMAC | + | -queue portals -DPBP | + | -MC portals ... | + | ... | + | | + +--------------------------------------+ + +The MC mediates operations such as create, discover, +connect, configuration, and destroy. Fast-path operations +on data, such as packet transmit/receive, are not mediated by +the MC and are done directly using memory mapped regions in +DPIO objects. + +Overview of DPAA2 Objects +------------------------- +The section provides a brief overview of some key objects +in the DPAA2 hardware. A simple scenario is described illustrating +the objects involved in creating a network interfaces. + +-DPRC (Datapath Resource Container) + + A DPRC is an container object that holds all the other + types of DPAA2 objects. In the example diagram below there + are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC) + in the container. + + +---------------------------------------------------------+ + | DPRC | + | | + | +-------+ +-------+ +-------+ +-------+ +-------+ | + | | DPMCP | | DPIO | | DPBP | | DPNI | | DPMAC | | + | +-------+ +-------+ +-------+ +---+---+ +---+---+ | + | | DPMCP | | DPIO | | + | +-------+ +-------+ | + | | DPMCP | | + | +-------+ | + | | + +---------------------------------------------------------+ + + From the point of view of an OS, a DPRC is bus-like. Like + a plug-and-play bus, such as PCI, DPRC commands can be used to + enumerate the contents of the DPRC, discover the hardware + objects present (including mappable regions and interrupts). + + dprc.1 (bus) + | + +--+--------+-------+-------+-------+ + | | | | | + dpmcp.1 dpio.1 dpbp.1 dpni.1 dpmac.1 + dpmcp.2 dpio.2 + dpmcp.3 + + Hardware objects can be created and destroyed dynamically, providing + the ability to hot plug/unplug objects in and out of the DPRC. + + A DPRC has a mappable mmio region (an MC portal) that can be used + to send MC commands. It has an interrupt for status events (like + hotplug). + + All objects in a container share the same hardware "isolation context". + This means that with respect to an IOMMU the isolation granularity + is at the DPRC (container) level, not at the individual object + level. + + DPRCs can be defined statically and populated with objects + via a config file passed to the MC when firmware starts + it. There is also a Linux user space tool called "restool" + that can be used to create/destroy containers and objects + dynamically. + +-DPAA2 Objects for an Ethernet Network Interface + + A typical Ethernet NIC is monolithic-- the NIC device contains TX/RX + queuing mechanisms, configuration mechanisms, buffer management, + physical ports, and interrupts. DPAA2 uses a more granular approach + utilizing multiple hardware objects. Each object has specialized + functions, and are used together by software to provide Ethernet network + interface functionality. This approach provides efficient use of finite + hardware resources, flexibility, and performance advantages. + + The diagram below shows the objects needed for a simple + network interface configuration on a system with 2 CPUs. + + +---+---+ +---+---+ + CPU0 CPU1 + +---+---+ +---+---+ + | | + +---+---+ +---+---+ + DPIO DPIO + +---+---+ +---+---+ + \ / + \ / + \ / + +---+---+ + DPNI --- DPBP,DPMCP + +---+---+ + | + | + +---+---+ + DPMAC + +---+---+ + | + port/PHY + + Below the objects are described. For each object a brief description + is provided along with a summary of the kinds of operations the object + supports and a summary of key resources of the object (mmio regions + and irqs). + + -DPMAC (Datapath Ethernet MAC): represents an Ethernet MAC, a + hardware device that connects to an Ethernet PHY and allows + physical transmission and reception of Ethernet frames. + -mmio regions: none + -irqs: dpni link change + -commands: set link up/down, link config, get stats, + irq config, enable, reset + + -DPNI (Datapath Network Interface): contains TX/RX queues, + network interface configuration, and rx buffer pool configuration + mechanisms. + -mmio regions: none + -irqs: link state + -commands: port config, offload config, queue config, + parse/classify config, irq config, enable, reset + + -DPIO (Datapath I/O): provides interfaces to enqueue and dequeue + packets and do hardware buffer pool management operations. For + optimum performance there is typically DPIO per CPU. This allows + each CPU to perform simultaneous enqueue/dequeue operations. + -mmio regions: queue operations, buffer mgmt + -irqs: data availability, congestion notification, buffer + pool depletion + -commands: irq config, enable, reset + + -DPBP (Datapath Buffer Pool): represents a hardware buffer + pool. + -mmio regions: none + -irqs: none + -commands: enable, reset + + -DPMCP (Datapath MC Portal): provides an MC command portal. + Used by drivers to send commands to the MC to manage + objects. + -mmio regions: MC command portal + -irqs: command completion + -commands: irq config, enable, reset + + Object Connections + ------------------ + Some objects have explicit relationships that must + be configured: + + -DPNI <--> DPMAC + -DPNI <--> DPNI + -DPNI <--> L2-switch-port + A DPNI must be connected to something such as a DPMAC, + another DPNI, or L2 switch port. The DPNI connection + is made via a DPRC command. + + +-------+ +-------+ + | DPNI | | DPMAC | + +---+---+ +---+---+ + | | + +==========+ + + -DPNI <--> DPBP + A network interface requires a 'buffer pool' (DPBP + object) which provides a list of pointers to memory + where received Ethernet data is to be copied. The + Ethernet driver configures the DPBPs associated with + the network interface. + + Interrupts + ---------- + All interrupts generated by DPAA2 objects are message + interrupts. At the hardware level message interrupts + generated by devices will normally have 3 components-- + 1) a non-spoofable 'device-id' expressed on the hardware + bus, 2) an address, 3) a data value. + + In the case of DPAA2 devices/objects, all objects in the + same container/DPRC share the same 'device-id'. + For ARM-based SoC this is the same as the stream ID. + + +DPAA2 Linux Driver Overview +--------------------------- + +This section provides an overview of the Linux kernel drivers for +DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure" +drivers and 2) functional object drivers (such as Ethernet). + +As described previously, a DPRC is a container that holds the other +types of DPAA2 objects. It is functionally similar to a plug-and-play +bus controller. + +Each object in the DPRC is a Linux "device" and is bound to a driver. +The diagram below shows the Linux drivers involved in a networking +scenario and the objects bound to each driver. A brief description +of each driver follows. + + +------------+ + | OS Network | + | Stack | + +------------+ +------------+ + | Allocator |. . . . . . . | Ethernet | + |(dpmcp,dpbp)| | (dpni) | + +-.----------+ +---+---+----+ + . . ^ | + . . | | dequeue> + +-------------+ . | | + | DPRC driver | . +---+---V----+ +---------+ + | (dprc) | . . . . . .| DPIO driver| | MAC | + +----------+--+ | (dpio) | | (dpmac) | + | +------+-----+ +-----+---+ + | | | + | | | + +----+--------------+ | +--+---+ + | mc-bus driver | | | PHY | + | | | |driver| + | /fsl-mc@80c000000 | | +--+---+ + +-------------------+ | | + | | + ================================ HARDWARE =========|=================|====== + DPIO | + | | + DPNI---DPBP | + | | + DPMAC | + | | + PHY ---------------+ + ===================================================|======================== + +A brief description of each driver is provided below. + + mc-bus driver + ------------- + The mc-bus driver is a platform driver and is probed from an + "/fsl-mc@xxxx" node in the device tree passed in by boot firmware. + It is responsible for bootstrapping the DPAA2 kernel infrastructure. + Key functions include: + -registering a new bus type named "fsl-mc" with the kernel, + and implementing bus call-backs (e.g. match/uevent/dev_groups) + -implemeting APIs for DPAA2 driver registration and for device + add/remove + -creates an MSI irq domain + -do a device add of the 'root' DPRC device, which is needed + to bootstrap things + + DPRC driver + ----------- + The dprc-driver is bound DPRC objects and does runtime management + of a bus instance. It performs the initial bus scan of the DPRC + and handles interrupts for container events such as hot plug. + + Allocator + ---------- + Certain objects such as DPMCP and DPBP are generic and fungible, + and are intended to be used by other drivers. For example, + the DPAA2 Ethernet driver needs: + -DPMCPs to send MC commands, to configure network interfaces + -DPBPs for network buffer pools + + The allocator driver registers for these allocatable object types + and those objects are bound to the allocator when the bus is probed. + The allocator maintains a pool of objects that are available for + allocation by other DPAA2 drivers. + + DPIO driver + ----------- + The DPIO driver is bound to DPIO objects and provides services that allow + other drivers such as the Ethernet driver to receive and transmit data. + Key services include: + -data availability notifications + -hardware queuing operations (enqueue and dequeue of data) + -hardware buffer pool management + + There is typically one DPIO object per physical CPU for optimum + performance, allowing each CPU to simultaneously enqueue + and dequeue data. + + The DPIO driver operates on behalf of all DPAA2 drivers + active in the kernel-- Ethernet, crypto, compression, + etc. + + Ethernet + -------- + The Ethernet driver is bound to a DPNI and implements the kernel + interfaces needed to connect the DPAA2 network interface to + the network stack. + + Each DPNI corresponds to a Linux network interface. + + MAC driver + ---------- + An Ethernet PHY is an off-chip, board specific component and is managed + by the appropriate PHY driver via an mdio bus. The MAC driver + plays a role of being a proxy between the PHY driver and the + MC. It does this proxy via the MC commands to a DPMAC object. diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO index c29516b..3894368 100644 --- a/drivers/staging/fsl-mc/TODO +++ b/drivers/staging/fsl-mc/TODO @@ -1,7 +1,3 @@ -* Add README file (with ASCII art) describing relationships between - DPAA2 objects and how combine them to make a NIC, an LS2 switch, etc. - Also, define all acronyms used. - * Decide if multiple root fsl-mc buses will be supported per Linux instance, and if so add support for this. -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/