SlideShare a Scribd company logo
1 of 20
LINUX PCI EXPRESS DRIVER
Background
 PCI Express (Peripheral Component Interconnect
Express), officially abbreviated as PCIe, is a high-
speed serial computer expansion bus standard
designed to replace the older PCI, PCI-X, and
AGP bus standards.
 At the software level, PCI Express preserves
backward compatibility with PCI; legacy PCI
system software can detect and configure newer
PCI Express devices without explicit support for
the PCI Express standard, though new PCI
Express features are inaccessible.
Topology
Note: figure from https://en.wikipedia.org/wiki/PCI_Express
Terminology
 Lane
 A lane is composed of two differential signaling pairs, with one pair for receiving data and the other for
transmitting. 1, 2, …, 32 lanes will denote x1, x2, …, x32.
 Root Complex
 the device that connects the CPU and memory subsystem to the PCI Express fabric. It may support one or
more PCI Express ports.
 Endpoint
 devices other than root complex and switches that are requesters or completers of PCI Express transactions.
 Configuration Space
 PCI devices have a set of registers referred to as configuration space and PCI Express introduces extended
configuration space for devices.
 BAR
 Base Address Registers (commonly called BARs) to inform the device of its address mapping by writing
configuration commands to the PCI controller.
 INTx
 An in-band messages which emulate the four physical interrupt signals (INTA-INTD) routed between PCI
devices and the system interrupt controller
 MSI/MIS-X
 An alternative in-band method of signaling an interrupt, using special in-band messages to replace traditional
out-of-band assertion of dedicated interrupt lines.
Configuration Space Layout
Note: figure from
http://www.flashmemorysummit.com/English/Collaterals/Proceedings/2013/20130812_PreConfD_Onufryk.pdf
Configuration Space Header
Status
BIST
Header
Type
Latency
Timer
Cache
Line Size
Class Code
Rev
ID
Device ID Vendor ID
Command
Base Address 0 (BAR0)
Base Address 1 (BAR1)
Base Address 2 (BAR2)
Base Address 3 (BAR3)
Base Address 4 (BAR4)
Base Address 5 (BAR5)
CardBus CIS Pointer
Subsystem
Device ID
Subsystem
Vendor ID
Expansion ROM Base Address
Reserved
Capability
Pointer
Reserved
Max Lat Min Gnt
Interrupt
Pin
Interrupt
Line
00h
04h
08h
0Ch
10h
14h
18h
1Ch
20h
24h
28h
2Ch
30h
38h
34h
3Ch
07152331
Status
BIST
Header
Type
Latency
Timer
Cache
Line Size
Class Code
Rev
ID
Device ID Vendor ID
Command
Base Address 0 (BAR0)
Base Address 1 (BAR1)
Secondary
Lat timer
Secondary
Status
(Non-Prefetchable)
Memory Limit
Prefetchable
Memory Limit
Pretetchable Memory Base
Upper 32 Bits
Prefetchable Memory Limit
Upper 32 Bits
IO Limit
Upper 16 Bits
Reserved
Capability
Pointer
Expansion ROM Base Address
Max Lat Min Gnt
Interrupt
Pin
Interrupt
Line
00h
04h
08h
0Ch
10h
14h
18h
1Ch
20h
24h
28h
2Ch
30h
38h
34h
3Ch
07152331
Type 0 Header Type 1 Header
Subordinate
Bus #
Secondary
Bus #
Primary
Bus #
IO
Limit
IO
Base
(Non-Prefetchable)
Memory Base
Prefetchable
Memory Base
IO Base
Upper 16 Bits
Capabilities List
Example: http://www.alterawiki.com/wiki/PCI_Configuration_Space
Device Layers and their
Associated Packets
Note: figure from http://resources.infosecinstitute.com/system-address-map-initialization-x86x64-architecture-part-2-
pci-express-based-systems/
Layer Packets Relationship
Note: figure from http://www.verien.com/pcie_primer.htm
Function of Each PCIE Layer
 Transaction Layer
 Mechanisms for differentiating the ordering and processing
requirements ofTransaction Layer Packets (TLPs)
 Credit-based flow control
 TLP construction and processing
 Association of transaction-level mechanisms with device resources
including Flow Control andVirtual Channel management.
 Data Link Layer
 Data Exchange
 Error Detection and Retry
 Initialization and power management
 Physical Layer
 Logical Sub-block – symbol encoding, framing, data scrambling, Link
initialization and training, Lane to lane de-skew
 Electrical Sub-block – defines the physical layer of PCI Express that
consists of a reference clock source,Transmitter, channel, and Receiver.
Packet Routing
 Address Routing - Memory and IO requests
 Address routing is used to transfer data to or from
memory, memory mapped IO, or IO locations.
 ID Routing - Completions and Configuration
 ID routing is based on the logical position (Bus
Number, Device Number, Function Number) of a
device function within the PCI bus topology.
 Implicit Routing - Message requests
 Implicit routing is based on the intrinsic knowledge
PCI Express devices are required to have concerning
upstream and downstream traffic and the existence of
a single PCI Express Root Complex at the top of the
PCI Express topology.
pciutils – lspci command
 Command “lspci”
 is a utility for displaying information about PCI
buses in the system and devices connected to
them
 Command “lspci” popular options
 -t Show bus tree
 -v Be verbose (-vv for very verbose)
 -k Show kernel drivers handling each device
 -x Show hex-dump of the standard part of the config space
pciutils – lspci example
lspci -vkx
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit
Ethernet PCIe
Subsystem: Broadcom Corporation Device 2003
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at f0050000 (64-bit, prefetchable) [size=64K]
Memory at f0040000 (64-bit, prefetchable) [size=64K]
Memory at f0030000 (64-bit, prefetchable) [size=64K]
Expansion ROM at f7c40000 [disabled] [size=256K]
Capabilities: [48] Power Management version 3
Capabilities: [50] Vital Product Data
Capabilities: [58] MSI: Enable- Count=1/8 Maskable- 64bit+
Capabilities: [a0] MSI-X: Enable- Count=17 Masked-
Capabilities: [ac] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [13c] Device Serial Number 00-00-00-0a-f7-82-bf-82
Capabilities: [150] Power Budgeting <?>
Capabilities: [160] Virtual Channel
Kernel driver in use: tg3
00: e4 14 5f 16 06 00 10 00 00 00 00 02 10 00 80 00
10: 0c 00 05 f0 00 00 00 00 0c 00 04 f0 00 00 00 00
20: 0c 00 03 f0 00 00 00 00 00 00 00 00 e4 14 03 20
30: 00 00 c4 f7 48 00 00 00 00 00 00 00 0b 01 00 00
Controller Driver
 Find and assign resource
 Controller registers
 BARs for devices (device tree format -
http://devicetree.org/Device_Tree_Usage#PCI_Address_Translation)
 Operation implementation
 PCIe configuration access
 struct pci_ops (defined in include/linux/pci.h)
 INTx interrupts
 struct irq_domain_ops (defined in include/linux/irqdomain.h)
 struct irq_chip (defined in include/linux/irq.h)
 MSI/MSI-X interrupts
 struct irq_domain_ops
 struct irq_chip
 Example – PCIe host controller driver for Samsung EXYNOS SoCs
https://github.com/torvalds/linux/blob/master/drivers/pci/host/pc
i-exynos.c + pcie-designware.c
Enumeration Process –
Discovering the Topology
 After a system reset or power up, configuration
software has to scan the PCIe fabric to discover
the machine topology and learn how the fabric is
populated.
 Try to read device’sVendor ID register starting from
bus 0, device 0, function 0 to bus 255.
 A device is found, update device’s configuration
 Primary Bus Number Register
 Secondary Bus Number Register
 Subordinate Bus Number Register
 Enumeration software must perform a depth-first
search.
Single-Root System
Enumeration
Note: figure from https://codywu2010.wordpress.com/2015/11/29/how-modern-multi-processor-multi-root-complex-
system-assigns-pci-bus-number/
Device Driver -
Initialization Steps
Sequence Action Function
1 Enable the device pci_enable_device()
2 Enable DMA by setting the bus master bit in the
PCI_COMMAND register
pci_set_master()
3 Request MMIO/IOP resources pci_request_region()
4 Set the DMA mask size (for both coherent and streaming DMA) pci_set_dma_mask()
5 Allocate and initialize shared control data pci_ioremap_bar()
6 Access device configuration space pci_read_config_xxx()/
pci_write_config_xxx()
7 Register IRQ handler request_irq()
pci_enable_msi()
pci_enable_msix()
8 Initialize non-PCI (i.e. LAN/SCSI/etc parts of the chip)
9 Enable DMA/processing engines
 PCIe + non-PCIe
Note: How To Write Linux PCI Drivers - https://www.kernel.org/doc/Documentation/PCI/pci.txt
Device Driver – Access
Methods
 PCI/PCIe configuration access
 pci_read_config_xxx()/pci_write_config_xxx()
 Non-PCIe functionality (i.e. LAN…) registers
access
 readx()/writex()
 Example – BroadcomTigon3 ethernet driver
https://github.com/torvalds/linux/blob/maste
r/drivers/net/ethernet/broadcom/tg3.c
Common Port Service Drivers
Function Version Kconfig Port
Bus
Driver
Files
Native Hotplug (HP) 2.6.11 HOTPLUG_PCI
_PCIE
Yes drivers/pci/hotplug/pciehp*
Advanced Error
Reporting (AER)
2.6.19 PCIEAER Yes drivers/pci/pcie/aer/*
Active State Power
Management (ASPM)
/ASPM Policy
2.6.26
3.4
PCIEASPM
PCIEASPM_*
No drivers/pci/pcie/aspm.c
Power Management
Event (PME)
2.6.34 PCIE_PME Yes drivers/pci/pcie/pme/*
Note:
The PCI Express Port Bus Driver Guide HOWTO -
https://www.kernel.org/doc/Documentation/PCI/PCIEBUS-HOWTO.txt,
PCI Express Port Bus Driver Support for Linux - https://www.kernel.org/doc/ols/2005/ols2005v2-
pages-9-18.pdf
Reference Resource
• PCI Express Specifications
 https://www.pcisig.com/specifications/pciexpress/
• PCI/PCIe
 http://en.wikipedia.org/wiki/PCI_Express
 http://en.wikipedia.org/wiki/PCI_configuration_space
 http://en.wikipedia.org/wiki/Conventional_PCI
 PCIVendor(/Device) ID
 https://pcisig.com/membership/member-companies
 https://pci-ids.ucw.cz/
 http://www.pcidatabase.com/index.php
• pciutils - Linux User Space PCI configuration space access tool
 https://www.kernel.org/pub/software/utils/pciutils/
 BOOK - PCI ExpressTechnology 3.0
 https://www.mindshare.com/Books/Titles/PCI_Express_Technology_3.0

More Related Content

What's hot

PCIe Gen 3.0 Presentation @ 4th FPGA Camp
PCIe Gen 3.0 Presentation @ 4th FPGA CampPCIe Gen 3.0 Presentation @ 4th FPGA Camp
PCIe Gen 3.0 Presentation @ 4th FPGA CampFPGA Central
 
Verification Strategy for PCI-Express
Verification Strategy for PCI-ExpressVerification Strategy for PCI-Express
Verification Strategy for PCI-ExpressDVClub
 
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON
 
PCI Express Verification using Reference Modeling
PCI Express Verification using Reference ModelingPCI Express Verification using Reference Modeling
PCI Express Verification using Reference ModelingDVClub
 
Message Signaled Interrupts
Message Signaled InterruptsMessage Signaled Interrupts
Message Signaled InterruptsAnshuman Biswal
 
03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final
03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final
03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_FinalGopi Krishnamurthy
 
Difference between PCI PCI-X PCIe
Difference between PCI PCI-X PCIeDifference between PCI PCI-X PCIe
Difference between PCI PCI-X PCIeSUNODH GARLAPATI
 
Amba axi 29 3_2015
Amba axi 29 3_2015Amba axi 29 3_2015
Amba axi 29 3_2015kiemnhatminh
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0Azad Mishra
 
PCIe BUS: A State-of-the-Art-Review
PCIe BUS: A State-of-the-Art-ReviewPCIe BUS: A State-of-the-Art-Review
PCIe BUS: A State-of-the-Art-ReviewIOSRJVSP
 
AMBA 3 APB Protocol
AMBA 3 APB ProtocolAMBA 3 APB Protocol
AMBA 3 APB ProtocolSwetha GSM
 

What's hot (20)

Pcie drivers basics
Pcie drivers basicsPcie drivers basics
Pcie drivers basics
 
PCIe Gen 3.0 Presentation @ 4th FPGA Camp
PCIe Gen 3.0 Presentation @ 4th FPGA CampPCIe Gen 3.0 Presentation @ 4th FPGA Camp
PCIe Gen 3.0 Presentation @ 4th FPGA Camp
 
Pc ie tl_layer (3)
Pc ie tl_layer (3)Pc ie tl_layer (3)
Pc ie tl_layer (3)
 
PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)
 
Verification Strategy for PCI-Express
Verification Strategy for PCI-ExpressVerification Strategy for PCI-Express
Verification Strategy for PCI-Express
 
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
 
PCI Express Verification using Reference Modeling
PCI Express Verification using Reference ModelingPCI Express Verification using Reference Modeling
PCI Express Verification using Reference Modeling
 
Message Signaled Interrupts
Message Signaled InterruptsMessage Signaled Interrupts
Message Signaled Interrupts
 
AMBA AHB 5
AMBA AHB 5AMBA AHB 5
AMBA AHB 5
 
axi protocol
axi protocolaxi protocol
axi protocol
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
 
03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final
03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final
03_03_Implementing_PCIe_ATS_in_ARM-based_SoCs_Final
 
USB protocol
USB protocolUSB protocol
USB protocol
 
Ambha axi
Ambha axiAmbha axi
Ambha axi
 
Difference between PCI PCI-X PCIe
Difference between PCI PCI-X PCIeDifference between PCI PCI-X PCIe
Difference between PCI PCI-X PCIe
 
Amba axi 29 3_2015
Amba axi 29 3_2015Amba axi 29 3_2015
Amba axi 29 3_2015
 
AXI Protocol.pptx
AXI Protocol.pptxAXI Protocol.pptx
AXI Protocol.pptx
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 
PCIe BUS: A State-of-the-Art-Review
PCIe BUS: A State-of-the-Art-ReviewPCIe BUS: A State-of-the-Art-Review
PCIe BUS: A State-of-the-Art-Review
 
AMBA 3 APB Protocol
AMBA 3 APB ProtocolAMBA 3 APB Protocol
AMBA 3 APB Protocol
 

Similar to Slideshare - PCIe

P C I L O C A L B U S
P C I  L O C A L  B U S P C I  L O C A L  B U S
P C I L O C A L B U S jainfu2
 
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN
 
Intel® RDT Hands-on Lab
Intel® RDT Hands-on LabIntel® RDT Hands-on Lab
Intel® RDT Hands-on LabMichelle Holley
 
Motherboard components and their functions
Motherboard components and their functionsMotherboard components and their functions
Motherboard components and their functionsAbdullah-Al- Mahmud
 
Chapter 6: Expansion Buses
Chapter 6: Expansion BusesChapter 6: Expansion Buses
Chapter 6: Expansion Busesaskme
 
PCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdfPCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdfzahixdd
 
MPC854XE: PowerQUICC III Processors
MPC854XE: PowerQUICC III ProcessorsMPC854XE: PowerQUICC III Processors
MPC854XE: PowerQUICC III ProcessorsPremier Farnell
 
Hardware Discovery Commands
Hardware Discovery CommandsHardware Discovery Commands
Hardware Discovery CommandsKevin OBrien
 
Computer hardware and networking by Pradeep Kudale
Computer hardware and networking by Pradeep KudaleComputer hardware and networking by Pradeep Kudale
Computer hardware and networking by Pradeep Kudaleshailu26
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial艾鍗科技
 
directCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressdirectCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressHeiko Joerg Schick
 
Lesson three hardware basics
Lesson three hardware basicsLesson three hardware basics
Lesson three hardware basicsMik Endale
 
Io Architecture
Io ArchitectureIo Architecture
Io ArchitectureAero Plane
 

Similar to Slideshare - PCIe (20)

Mother board
Mother boardMother board
Mother board
 
P C I L O C A L B U S
P C I  L O C A L  B U S P C I  L O C A L  B U S
P C I L O C A L B U S
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOS
 
Intel® RDT Hands-on Lab
Intel® RDT Hands-on LabIntel® RDT Hands-on Lab
Intel® RDT Hands-on Lab
 
Motherboard components and their functions
Motherboard components and their functionsMotherboard components and their functions
Motherboard components and their functions
 
Pc interface
Pc interfacePc interface
Pc interface
 
Chapter 6: Expansion Buses
Chapter 6: Expansion BusesChapter 6: Expansion Buses
Chapter 6: Expansion Buses
 
PCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdfPCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdf
 
Bus
BusBus
Bus
 
Nsrit37
Nsrit37Nsrit37
Nsrit37
 
MPC854XE: PowerQUICC III Processors
MPC854XE: PowerQUICC III ProcessorsMPC854XE: PowerQUICC III Processors
MPC854XE: PowerQUICC III Processors
 
Hardware Discovery Commands
Hardware Discovery CommandsHardware Discovery Commands
Hardware Discovery Commands
 
Computer hardware and networking by Pradeep Kudale
Computer hardware and networking by Pradeep KudaleComputer hardware and networking by Pradeep Kudale
Computer hardware and networking by Pradeep Kudale
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial
 
directCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressdirectCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI Express
 
Lesson three hardware basics
Lesson three hardware basicsLesson three hardware basics
Lesson three hardware basics
 
Io Architecture
Io ArchitectureIo Architecture
Io Architecture
 
haifux-pcie.pdf
haifux-pcie.pdfhaifux-pcie.pdf
haifux-pcie.pdf
 
x86_1.ppt
x86_1.pptx86_1.ppt
x86_1.ppt
 

Recently uploaded

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 

Recently uploaded (20)

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 

Slideshare - PCIe

  • 2. Background  PCI Express (Peripheral Component Interconnect Express), officially abbreviated as PCIe, is a high- speed serial computer expansion bus standard designed to replace the older PCI, PCI-X, and AGP bus standards.  At the software level, PCI Express preserves backward compatibility with PCI; legacy PCI system software can detect and configure newer PCI Express devices without explicit support for the PCI Express standard, though new PCI Express features are inaccessible.
  • 3. Topology Note: figure from https://en.wikipedia.org/wiki/PCI_Express
  • 4. Terminology  Lane  A lane is composed of two differential signaling pairs, with one pair for receiving data and the other for transmitting. 1, 2, …, 32 lanes will denote x1, x2, …, x32.  Root Complex  the device that connects the CPU and memory subsystem to the PCI Express fabric. It may support one or more PCI Express ports.  Endpoint  devices other than root complex and switches that are requesters or completers of PCI Express transactions.  Configuration Space  PCI devices have a set of registers referred to as configuration space and PCI Express introduces extended configuration space for devices.  BAR  Base Address Registers (commonly called BARs) to inform the device of its address mapping by writing configuration commands to the PCI controller.  INTx  An in-band messages which emulate the four physical interrupt signals (INTA-INTD) routed between PCI devices and the system interrupt controller  MSI/MIS-X  An alternative in-band method of signaling an interrupt, using special in-band messages to replace traditional out-of-band assertion of dedicated interrupt lines.
  • 5. Configuration Space Layout Note: figure from http://www.flashmemorysummit.com/English/Collaterals/Proceedings/2013/20130812_PreConfD_Onufryk.pdf
  • 6. Configuration Space Header Status BIST Header Type Latency Timer Cache Line Size Class Code Rev ID Device ID Vendor ID Command Base Address 0 (BAR0) Base Address 1 (BAR1) Base Address 2 (BAR2) Base Address 3 (BAR3) Base Address 4 (BAR4) Base Address 5 (BAR5) CardBus CIS Pointer Subsystem Device ID Subsystem Vendor ID Expansion ROM Base Address Reserved Capability Pointer Reserved Max Lat Min Gnt Interrupt Pin Interrupt Line 00h 04h 08h 0Ch 10h 14h 18h 1Ch 20h 24h 28h 2Ch 30h 38h 34h 3Ch 07152331 Status BIST Header Type Latency Timer Cache Line Size Class Code Rev ID Device ID Vendor ID Command Base Address 0 (BAR0) Base Address 1 (BAR1) Secondary Lat timer Secondary Status (Non-Prefetchable) Memory Limit Prefetchable Memory Limit Pretetchable Memory Base Upper 32 Bits Prefetchable Memory Limit Upper 32 Bits IO Limit Upper 16 Bits Reserved Capability Pointer Expansion ROM Base Address Max Lat Min Gnt Interrupt Pin Interrupt Line 00h 04h 08h 0Ch 10h 14h 18h 1Ch 20h 24h 28h 2Ch 30h 38h 34h 3Ch 07152331 Type 0 Header Type 1 Header Subordinate Bus # Secondary Bus # Primary Bus # IO Limit IO Base (Non-Prefetchable) Memory Base Prefetchable Memory Base IO Base Upper 16 Bits
  • 8. Device Layers and their Associated Packets Note: figure from http://resources.infosecinstitute.com/system-address-map-initialization-x86x64-architecture-part-2- pci-express-based-systems/
  • 9. Layer Packets Relationship Note: figure from http://www.verien.com/pcie_primer.htm
  • 10. Function of Each PCIE Layer  Transaction Layer  Mechanisms for differentiating the ordering and processing requirements ofTransaction Layer Packets (TLPs)  Credit-based flow control  TLP construction and processing  Association of transaction-level mechanisms with device resources including Flow Control andVirtual Channel management.  Data Link Layer  Data Exchange  Error Detection and Retry  Initialization and power management  Physical Layer  Logical Sub-block – symbol encoding, framing, data scrambling, Link initialization and training, Lane to lane de-skew  Electrical Sub-block – defines the physical layer of PCI Express that consists of a reference clock source,Transmitter, channel, and Receiver.
  • 11. Packet Routing  Address Routing - Memory and IO requests  Address routing is used to transfer data to or from memory, memory mapped IO, or IO locations.  ID Routing - Completions and Configuration  ID routing is based on the logical position (Bus Number, Device Number, Function Number) of a device function within the PCI bus topology.  Implicit Routing - Message requests  Implicit routing is based on the intrinsic knowledge PCI Express devices are required to have concerning upstream and downstream traffic and the existence of a single PCI Express Root Complex at the top of the PCI Express topology.
  • 12. pciutils – lspci command  Command “lspci”  is a utility for displaying information about PCI buses in the system and devices connected to them  Command “lspci” popular options  -t Show bus tree  -v Be verbose (-vv for very verbose)  -k Show kernel drivers handling each device  -x Show hex-dump of the standard part of the config space
  • 13. pciutils – lspci example lspci -vkx 02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe Subsystem: Broadcom Corporation Device 2003 Flags: bus master, fast devsel, latency 0, IRQ 16 Memory at f0050000 (64-bit, prefetchable) [size=64K] Memory at f0040000 (64-bit, prefetchable) [size=64K] Memory at f0030000 (64-bit, prefetchable) [size=64K] Expansion ROM at f7c40000 [disabled] [size=256K] Capabilities: [48] Power Management version 3 Capabilities: [50] Vital Product Data Capabilities: [58] MSI: Enable- Count=1/8 Maskable- 64bit+ Capabilities: [a0] MSI-X: Enable- Count=17 Masked- Capabilities: [ac] Express Endpoint, MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [13c] Device Serial Number 00-00-00-0a-f7-82-bf-82 Capabilities: [150] Power Budgeting <?> Capabilities: [160] Virtual Channel Kernel driver in use: tg3 00: e4 14 5f 16 06 00 10 00 00 00 00 02 10 00 80 00 10: 0c 00 05 f0 00 00 00 00 0c 00 04 f0 00 00 00 00 20: 0c 00 03 f0 00 00 00 00 00 00 00 00 e4 14 03 20 30: 00 00 c4 f7 48 00 00 00 00 00 00 00 0b 01 00 00
  • 14. Controller Driver  Find and assign resource  Controller registers  BARs for devices (device tree format - http://devicetree.org/Device_Tree_Usage#PCI_Address_Translation)  Operation implementation  PCIe configuration access  struct pci_ops (defined in include/linux/pci.h)  INTx interrupts  struct irq_domain_ops (defined in include/linux/irqdomain.h)  struct irq_chip (defined in include/linux/irq.h)  MSI/MSI-X interrupts  struct irq_domain_ops  struct irq_chip  Example – PCIe host controller driver for Samsung EXYNOS SoCs https://github.com/torvalds/linux/blob/master/drivers/pci/host/pc i-exynos.c + pcie-designware.c
  • 15. Enumeration Process – Discovering the Topology  After a system reset or power up, configuration software has to scan the PCIe fabric to discover the machine topology and learn how the fabric is populated.  Try to read device’sVendor ID register starting from bus 0, device 0, function 0 to bus 255.  A device is found, update device’s configuration  Primary Bus Number Register  Secondary Bus Number Register  Subordinate Bus Number Register  Enumeration software must perform a depth-first search.
  • 16. Single-Root System Enumeration Note: figure from https://codywu2010.wordpress.com/2015/11/29/how-modern-multi-processor-multi-root-complex- system-assigns-pci-bus-number/
  • 17. Device Driver - Initialization Steps Sequence Action Function 1 Enable the device pci_enable_device() 2 Enable DMA by setting the bus master bit in the PCI_COMMAND register pci_set_master() 3 Request MMIO/IOP resources pci_request_region() 4 Set the DMA mask size (for both coherent and streaming DMA) pci_set_dma_mask() 5 Allocate and initialize shared control data pci_ioremap_bar() 6 Access device configuration space pci_read_config_xxx()/ pci_write_config_xxx() 7 Register IRQ handler request_irq() pci_enable_msi() pci_enable_msix() 8 Initialize non-PCI (i.e. LAN/SCSI/etc parts of the chip) 9 Enable DMA/processing engines  PCIe + non-PCIe Note: How To Write Linux PCI Drivers - https://www.kernel.org/doc/Documentation/PCI/pci.txt
  • 18. Device Driver – Access Methods  PCI/PCIe configuration access  pci_read_config_xxx()/pci_write_config_xxx()  Non-PCIe functionality (i.e. LAN…) registers access  readx()/writex()  Example – BroadcomTigon3 ethernet driver https://github.com/torvalds/linux/blob/maste r/drivers/net/ethernet/broadcom/tg3.c
  • 19. Common Port Service Drivers Function Version Kconfig Port Bus Driver Files Native Hotplug (HP) 2.6.11 HOTPLUG_PCI _PCIE Yes drivers/pci/hotplug/pciehp* Advanced Error Reporting (AER) 2.6.19 PCIEAER Yes drivers/pci/pcie/aer/* Active State Power Management (ASPM) /ASPM Policy 2.6.26 3.4 PCIEASPM PCIEASPM_* No drivers/pci/pcie/aspm.c Power Management Event (PME) 2.6.34 PCIE_PME Yes drivers/pci/pcie/pme/* Note: The PCI Express Port Bus Driver Guide HOWTO - https://www.kernel.org/doc/Documentation/PCI/PCIEBUS-HOWTO.txt, PCI Express Port Bus Driver Support for Linux - https://www.kernel.org/doc/ols/2005/ols2005v2- pages-9-18.pdf
  • 20. Reference Resource • PCI Express Specifications  https://www.pcisig.com/specifications/pciexpress/ • PCI/PCIe  http://en.wikipedia.org/wiki/PCI_Express  http://en.wikipedia.org/wiki/PCI_configuration_space  http://en.wikipedia.org/wiki/Conventional_PCI  PCIVendor(/Device) ID  https://pcisig.com/membership/member-companies  https://pci-ids.ucw.cz/  http://www.pcidatabase.com/index.php • pciutils - Linux User Space PCI configuration space access tool  https://www.kernel.org/pub/software/utils/pciutils/  BOOK - PCI ExpressTechnology 3.0  https://www.mindshare.com/Books/Titles/PCI_Express_Technology_3.0

Editor's Notes

  1. https://en.wikipedia.org/wiki/PCI_Express
  2. http://www.verien.com/pcie_primer.htm
  3. http://www.testbench.in/introduction_to_pci_express.html