1
0
Files
Greg Kroah-Hartman 69dc0743fa Merge 4.9.242 into android-4.9-q
Changes in 4.9.242
	SUNRPC: ECONNREFUSED should cause a rebind.
	scripts/setlocalversion: make git describe output more reliable
	powerpc/powernv/opal-dump : Use IRQ_HANDLED instead of numbers in interrupt handler
	efivarfs: Replace invalid slashes with exclamation marks in dentries.
	ravb: Fix bit fields checking in ravb_hwtstamp_get()
	tipc: fix memory leak caused by tipc_buf_append()
	arch/x86/amd/ibs: Fix re-arming IBS Fetch
	fuse: fix page dereference after free
	p54: avoid accessing the data mapped to streaming DMA
	mtd: lpddr: Fix bad logic in print_drs_error
	ata: sata_rcar: Fix DMA boundary mask
	fscrypt: return -EXDEV for incompatible rename or link into encrypted dir
	fscrypto: move ioctl processing more fully into common code
	fscrypt: use EEXIST when file already uses different policy
	mlxsw: core: Fix use-after-free in mlxsw_emad_trans_finish()
	powerpc/powernv/smp: Fix spurious DBG() warning
	sparc64: remove mm_cpumask clearing to fix kthread_use_mm race
	f2fs: add trace exit in exception path
	f2fs: fix to check segment boundary during SIT page readahead
	um: change sigio_spinlock to a mutex
	ARM: 8997/2: hw_breakpoint: Handle inexact watchpoint addresses
	xfs: fix realtime bitmap/summary file truncation when growing rt volume
	video: fbdev: pvr2fb: initialize variables
	ath10k: fix VHT NSS calculation when STBC is enabled
	media: tw5864: check status of tw5864_frameinterval_get
	mmc: via-sdmmc: Fix data race bug
	printk: reduce LOG_BUF_SHIFT range for H8300
	kgdb: Make "kgdbcon" work properly with "kgdb_earlycon"
	cpufreq: sti-cpufreq: add stih418 support
	USB: adutux: fix debugging
	arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
	drivers/net/wan/hdlc_fr: Correctly handle special skb->protocol values
	bus/fsl_mc: Do not rely on caller to provide non NULL mc_io
	power: supply: test_power: add missing newlines when printing parameters by sysfs
	md/bitmap: md_bitmap_get_counter returns wrong blocks
	clk: ti: clockdomain: fix static checker warning
	net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid
	drivers: watchdog: rdc321x_wdt: Fix race condition bugs
	ext4: Detect already used quota file early
	gfs2: add validation checks for size of superblock
	memory: emif: Remove bogus debugfs error handling
	ARM: dts: s5pv210: remove DMA controller bus node name to fix dtschema warnings
	ARM: dts: s5pv210: move PMU node out of clock controller
	ARM: dts: s5pv210: remove dedicated 'audio-subsystem' node
	md/raid5: fix oops during stripe resizing
	perf/x86/amd/ibs: Don't include randomized bits in get_ibs_op_count()
	perf/x86/amd/ibs: Fix raw sample data accumulation
	leds: bcm6328, bcm6358: use devres LED registering function
	fs: Don't invalidate page buffers in block_write_full_page()
	NFS: fix nfs_path in case of a rename retry
	ACPI / extlog: Check for RDMSR failure
	ACPI: video: use ACPI backlight for HP 635 Notebook
	ACPI: debug: don't allow debugging when ACPI is disabled
	acpi-cpufreq: Honor _PSD table setting on new AMD CPUs
	w1: mxc_w1: Fix timeout resolution problem leading to bus error
	scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove()
	btrfs: reschedule if necessary when logging directory items
	btrfs: cleanup cow block on error
	btrfs: fix use-after-free on readahead extent after failure to create it
	usb: dwc3: core: add phy cleanup for probe error handling
	usb: dwc3: core: don't trigger runtime pm when remove driver
	usb: host: fsl-mph-dr-of: check return of dma_set_mask()
	vt: keyboard, simplify vt_kdgkbsent
	vt: keyboard, extend func_buf_lock to readers
	dmaengine: dma-jz4780: Fix race in jz4780_dma_tx_status
	iio:light:si1145: Fix timestamp alignment and prevent data leak.
	iio:adc:ti-adc12138 Fix alignment issue with timestamp
	iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
	powerpc: Warn about use of smt_snooze_delay
	powerpc/powernv/elog: Fix race while processing OPAL error log event.
	ubifs: dent: Fix some potential memory leaks while iterating entries
	ubi: check kthread_should_stop() after the setting of task state
	ia64: fix build error with !COREDUMP
	ceph: promote to unsigned long long before shifting
	libceph: clear con->out_msg on Policy::stateful_server faults
	9P: Cast to loff_t before multiplying
	ring-buffer: Return 0 on success from ring_buffer_resize()
	vringh: fix __vringh_iov() when riov and wiov are different
	rtc: rx8010: don't modify the global rtc ops
	tty: make FONTX ioctl use the tty pointer they were actually passed
	arm64: berlin: Select DW_APB_TIMER_OF
	cachefiles: Handle readpage error correctly
	hil/parisc: Disable HIL driver when it gets stuck
	ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
	ARM: s3c24xx: fix missing system reset
	device property: Keep secondary firmware node secondary by type
	device property: Don't clear secondary pointer for shared primary firmware node
	KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
	staging: comedi: cb_pcidas: Allow 2-channel commands for AO subdevice
	staging: octeon: repair "fixed-link" support
	staging: octeon: Drop on uncorrectable alignment or FCS error
	xen/events: don't use chip_data for legacy IRQs
	tipc: fix use-after-free in tipc_bcast_get_mode
	gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP
	gianfar: Account for Tx PTP timestamp in the skb headroom
	Fonts: Replace discarded const qualifier
	ALSA: usb-audio: Add implicit feedback quirk for Qu-16
	kthread_worker: prevent queuing delayed work from timer_fn when it is being canceled
	ftrace: Fix recursion check for NMI test
	ftrace: Handle tracing when switching between context
	tracing: Fix out of bounds write in get_trace_buf
	ARM: dts: sun4i-a10: fix cpu_alert temperature
	x86/kexec: Use up-to-dated screen_info copy to fill boot params
	of: Fix reserved-memory overlap detection
	scsi: core: Don't start concurrent async scan on same host
	vsock: use ns_capable_noaudit() on socket create
	ACPI: NFIT: Fix comparison to '-ENXIO'
	vt: Disable KD_FONT_OP_COPY
	fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent
	serial: 8250_mtk: Fix uart_get_baud_rate warning
	serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init
	USB: serial: cyberjack: fix write-URB completion race
	USB: serial: option: add LE910Cx compositions 0x1203, 0x1230, 0x1231
	USB: serial: option: add Telit FN980 composition 0x1055
	USB: Add NO_LPM quirk for Kingston flash drive
	ARC: stack unwinding: avoid indefinite looping
	Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
	Linux 4.9.242

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I594296d57790eb8b7fa737119346d2b60572e5fd
2020-11-10 20:02:39 +03:00
..
2020-11-10 20:02:39 +03:00
2018-11-15 21:36:32 +03:00
2018-11-15 21:36:32 +03:00
2018-11-15 21:36:32 +03:00
2018-11-15 21:36:32 +03:00
2018-11-15 21:36:32 +03:00

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:

The diagram below shows an overview of the DPAA2 resource management
architecture:

         +--------------------------------------+
         |                  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 DPAA2 objects.
A simple scenario is described illustrating the objects involved
in creating a network interfaces.

-DPRC (Datapath Resource Container)

    A DPRC is a 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 behaves similar to a plug and
    play bus, like 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 provides specialized
    functions. Groups of these objects are used 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.  The TX/RX queues are in memory and are identified by
        queue number.
           -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.  The DPAA2
        architecture separates the mechanism to access queues (the DPIO object)
        from the queues themselves.  The DPIO provides an MMIO interface to
        enqueue/dequeue packets.  To enqueue something a descriptor is written
        to the DPIO MMIO region, which includes the target queue number.
        There will typically be one DPIO assigned to each CPU.  This allows all
        CPUs to simultaneously perform enqueue/dequeued operations.  DPIOs are
        expected to be shared by different DPAA2 drivers.
           -MMIO regions: queue operations, buffer management
           -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)   |
                 +-.----------+              +---+---+----+
                  .          .                   ^   |
                 .            .     <data avail, |   |<enqueue,
                .              .     tx confirm> |   | dequeue>
    +-------------+             .                |   |
    | DPRC driver |              .           +---+---V----+     +---------+
    |   (DPRC)    |               . . . . . .| DPIO driver|     |   MAC   |
    +----------+--+                          |  (DPIO)    |     | (DPMAC) |
               |                             +------+-----+     +-----+---+
               |<dev add/remove>                    |                 |
               |                                    |                 |
          +----+--------------+                     |              +--+---+
          |   MC-bus driver   |                     |              | PHY  |
          |                   |                     |              |driver|
          | /soc/fsl-mc       |                     |              +--+---+
          +-------------------+                     |                 |
                                                    |                 |
 ================================ 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 a
    node in the device tree (compatible "fsl,qoriq-mc") 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)
       -implementing APIs for DPAA2 driver registration and for device
        add/remove
       -creates an MSI IRQ domain
       -doing a 'device add' to expose the 'root' DPRC, in turn triggering
        a bind of the root DPRC to the DPRC driver

    DPRC driver
    -----------
    The DPRC driver is bound to 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 by
    re-scanning the DPRC.

    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 enqueue and dequeue data for
    their respective objects.
    Key services include:
        -data availability notifications
        -hardware queuing operations (enqueue and dequeue of data)
        -hardware buffer pool management

    To transmit a packet the Ethernet driver puts data on a queue and
    invokes a DPIO API.  For receive, the Ethernet driver registers
    a data availability notification callback.  To dequeue a packet
    a DPIO API is used.

    There is typically one DPIO object per physical CPU for optimum
    performance, allowing different CPUs 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.
    If the PHY driver signals a link change, the MAC driver notifies
    the MC via a DPMAC command.  If a network interface is brought
    up or down, the MC notifies the DPMAC driver via an interrupt and
    the driver can take appropriate action.