Building Blocks for PRU Broad Market Success Module 4 – Linux Drivers

Slides:



Advertisements
Similar presentations
Device Virtualization Architecture
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 3 Operating System Organization.
XEN AND THE ART OF VIRTUALIZATION Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, lan Pratt, Andrew Warfield.
Chapter 6 Security Kernels.
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
Introduction to Kernel
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Memory Management 2010.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Figure 1.1 Interaction between applications and the operating system.
Cs238 Lecture 3 Operating System Structures Dr. Alan R. Davis.
Processes and Resources
Author: Texas Instruments ®, Sitara™ ARM ® Processors Building Blocks for PRU Development Module 2 PRU Firmware Development This session covers how to.
1 I/O Management in Representative Operating Systems.
Xen and the Art of Virtualization Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian Pratt, Andrew Warfield.
Xen and the Art of Virtualization. Introduction  Challenges to build virtual machines Performance isolation  Scheduling priority  Memory demand  Network.
hardware and operating systems basics.
Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
Chapter 6 Operating System Support. This chapter describes how middleware is supported by the operating system facilities at the nodes of a distributed.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Processes Introduction to Operating Systems: Module 3.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
UNIX Unit 1- Architecture of Unix - By Pratima.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Processes and Virtual Memory
Full and Para Virtualization
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Operating Systems: Summary INF1060: Introduction to Operating Systems and Data Communication.
Major OS Components CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012.
The World Leader in High Performance Signal Processing Solutions Heterogeneous Multicore for blackfin implementation Open Platform Solutions Steven Miao.
The World Leader in High Performance Signal Processing Solutions Linux Industrial I/O Subsystem Open Platform Solutions Michael Hennerich.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
System Components Operating System Services System Calls.
Tgt: Framework Target Drivers FUJITA Tomonori NTT Cyber Solutions Laboratories Mike Christie Red Hat, Inc Ottawa Linux.
Introduction to Operating Systems Concepts
Introduction to Kernel
Mechanism: Limited Direct Execution
CSCI 315 Operating Systems Design
CPSC 457 Operating Systems
I/O Systems I/O Hardware Application I/O Interface
Direct Memory Access Disk and Network transfers: awkward timing:
Chapter 2: Operating-System Structures
Introduction to Operating Systems
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Outline Operating System Organization Operating System Examples
Chapter 2: Operating-System Structures
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Building Blocks for PRU Broad Market Success Module 4 – Linux Drivers This session covers the Linux drivers to enable the PRU-ICSS sub-system. October 2014

ARM + PRU SoC Software Architecture 4/17/2017 ARM + PRU SoC Software Architecture L3 Interconnect ARM Subsystem ARM Subsystem Linux Programmable Real-Time Unit (PRU) Subsystem Programmable Real-Time Unit (PRU) Subsystem Firmware Interconnect PRU0 (200MHz) PRU1 (200MHz) PRU0 I/O Cortex-A L3 Interconnect PRU1 I/O Shared RAM Inst. RAM DataRAM Inst. RAM DataRAM L1 Instruction Cache L1 Data Cache L2 Data Cache INTC Peripherals L4 Interconnect ARM + PRU + memories + peripherals = SoC PRU works as a co-processor in system-level implementation, or - PRU works independently Shared Memory Peripherals Peripherals GP I/O

What do we need Linux to do? Load the Firmware Manage resources (memory, CPU, etc.) Control execution (start, stop, etc.) Send/receive messages to share data Synchronize through events (interrupts) These services are provided through a combination of remoteproc/rpmsg + virtio transport frameworks

Linux Drivers Remoteproc

DTB File passed from U-Boot PRU remoteproc Stack The remoteproc framework allows different platforms/architectures to control (power on, load firmware, power off) remote processors while abstracting any hardware differences Does not matter what OS (if any) the remote processor is running Kernel documentation available in /Documentation/remoteproc.txt Kernel Client drivers specifically for PRU core pruss-remoteproc remoteproc remoteproc framework DTB File passed from U-Boot PRU FW PRU Resource Table

Why Use Remoteproc? It already exists Easy to implement Easier to reuse an existing framework than to create a new one Easy to implement Requires only a few custom low-level handlers in the Linux driver for a new platform Mainline-friendly The core driver has been in mainline for a couple years Fairly simple interface for powering up and controlling a remote processor from the kernel Enables us to use rpmsg framework for message sharing

How to Use Remoteproc Load driver manually or build into kernel Use menuconfig to build into kernel or create a module Probe() function automatically looks for firmware in /lib/firmware directory in target filesystem rproc_pru0_fw or rproc_pru1_fw for core 0 and 1, respectively Interrupts passed between host application and PRU firmware Application effectively registers to an interrupt

Creating a New Node A pruss node is created in the root am33xx Device Tree file This passes information about the subsystem on AM335x into the PRU rproc driver during probe() function Primarily register offsets, clock speed, and other non-changing information Requires little-to-no interaction on a case-by-case basis All project-dependent settings are configured in Resource Table

Understanding the Resource Table What is a Resource Table? A Linux construct used to inform the remoteproc driver about the remote processor’s available resources Typically refers to memory, local peripheral registers, etc. Firmware-dependent Why do I need one? Allows the driver to remain generic while still supporting a number of different, often unique remote processors Is flexible enough to allow for the creation of a custom resource type Is not strictly required as the driver can fall back on defaults This severely limits it as the driver may not understand how the PRU firmware wishes to map/handle interrupts

Configuring the Resource Table Most projects will not need to touch anything beyond the interrupt and vring configuration Typically only need to modify up to three things Event-to-channel mapping Channel-to-host mapping Number and location of vrings

Linux Drivers Rpmsg

DTB File passed from U-Boot PRU rpmsg Stack Application Application uses /dev/rpmsg-prux interface to send messages User Space Kernel pruss-remoteproc pru-rpmsg Client drivers specifically for PRU core remoteproc rpmsg Linux frameworks DTB File passed from U-Boot virtio PRU FW PRU Data Memory vring Resource Table PRU PRU rpmsg lib

What Is Rpmsg? Rpmsg is a Linux framework designed to allow for message passing between the kernel and a remote processor Kernel documentation available in /Documentation/rpmsg.txt Virtio is a virtualized I/O framework We will use it to communicate with our virtio device (vdev) There are several ‘standard’ vdevs, but we only use virtio_ring Virtio_ring (vring) is the transport implementation for virtio The host and PRU will communicate with one another via the virtio_rings (vrings) and “kicks” for synchronization Application User Space Kernel pru-rpmsg rpmsg virtio PRU vring PRU Data Memory

Why Use Rpmsg? It already exists Mainline-friendly Easier to reuse an existing framework than to create a new one Mainline-friendly The core driver has been in mainline for at least a couple years Ties in with existing remoteproc driver framework Fairly simple interface for passing messages between User Space and the PRU firmware Allows developers to expose the virtual device (PRU) to User Space or other frameworks Provides scalability for integrating individual PRU peripherals with the respective driver sub-systems.

How to Use pru-rpmsg Generic Client Driver /dev/rpmsg-pru0 User Space applications use /dev/rpmsg-prux interface to pass messages to and from PRU An example Generic Client Driver is under development User Space Kernel pru-rpmsg rpmsg virtio PRU vring PRU Data Memory

Custom Function Drivers Linux Drivers Custom Function Drivers

Custom rpmsg Client Drivers /dev/tty06 /dev/rpmsg-pru0 User Space applications use /dev/rpmsg-pru0 interface to pass messages to and from PRU Create different rpmsg client drivers to expose the PRU as other interfaces Firmware based UART, SPI, etc. Allows true PRU firmware enhanced Linux devices User Space Kernel pru-tty pru-rpmsg rpmsg virtio PRU vring PRU Data Memory

Custom Function Drivers Some users may wish to use the PRU as another Linux Device (e.g. as another UART /dev/ttyO6) This will require a custom Linux driver to work in tandem with rproc/rpmsg Customer at this time will have to develop this custom driver themselves or work with a third party to do so TI is not initially launching any support for this mechanism We have several different targets in mind (UART, I2C, I2S, SPI, etc…), but these will not be available at release No target date available today, but we will start evaluating after broad market PRU launch

Thank you

Backup Slides

Virtio & Vring Virtio is a virtualized I/O framework We will use it to communicate with our virtio device (vdev) There are several ‘standard’ vdevs, but we only use virtio_ring The host and PRU will communicate with one another via the virtio_rings (vrings)

Virtio & Vring Virtio_ring (vring) is the transport implementation for virtio A vring consists of three primary parts: A descriptor array The available ring The used ring In our case the vring contains our list of buffers used to pass data between the host and PRU cores via rpmsg

Virtio & Vring The descriptor array This is where the guest chains together length/address pairs Address is the guest-physical address of the buffer Length is the size of the buffer There are two flags: R/W, and whether or not Next is valid Next is used for chaining This is generally used for packet processing (LANs) Address Length Flags Next

Virtio & Vring The available ring This where the guest (PRU) indicates which descriptors are ready for use Consists of a free-running index, an interrupt suppression flag, and an array of indices into the descriptor table (representing the heads of available buffers) Available buffers do not have to be contiguous in memory Available Buffers vring buffers

Virtio & Vring The used ring This is where the host indicates which descriptors chains it has used The used ring is similar to the available ring except it is written by the host as descriptor chains are consumed Consists of a free-running index, an interrupt suppression flag, and an array of indices into the descriptor table (representing the heads of used buffers) Used buffers do not need to be contiguous in memory Used Buffers vring buffers