SlideShare a Scribd company logo
1 of 25
Linux kernel TLV meetup, 21.09.2015
Kfir Gollan
 What is hardware probing?
 Different approaches for detecting hardware
 Probing in the linux kernel
 Have you ever wondered how does the OS know what
hardware components are available on a given
machine?
 Basically, someone needs to tell the OS what is
available.
 The process of detecting all the hardware components
and pairing them up with the matching drivers in the
OS is called hardware probing, or just probing for
short.
 Hardcode the details of the hardware into the kernel
 Static configuration
 Device trees
 Dynamic configuration
 ACPI
 Bus based detection
 PCI
Formal definition:
“The Device Tree is a data structure for describing
hardware.
Rather than hard coding every detail of a device into an
operating system, many aspect of the hardware can be
described in a data structure that is passed to the
operating system at boot time.”
devicetree.org
 Device tree source (DTS)
 Device tree bindings
 Device tree blob (DTB)
 Flattened Device Tree (FDT)
 Device tree compiler (DTC)
{
compatible = "nvidia,harmony", "nvidia,tegra20";
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&intc>;
memory {
device_type = "memory";
reg = <0x00000000 0x40000000>;
};
...
};
{
….
sound {
compatible = "nvidia,harmony-sound";
i2s-controller = <&i2s1>;
i2s-codec = <&wm8903>;
};
};
chosen {
bootargs = "console=ttyS0,115200 loglevel=8";
initrd-start = <0xc8000000>;
initrd-end = <0xc8200000>;
};
 Xillybus Device tree tutorial
 Device trees for Dummies!
 Documentation/devicetree/
 usage-model.txt
 booting-without-of.txt
 Advanced configuration and power interface
 Originally created by Intel, Toshiba & Microsoft
 Currently maintained by the UEFI forum
 Current last revision of the spec was released at May 2015
(Revision 6.0)
 Replaces APM (Advanced Power Management)
 Allows the kernel/user to control power features without
going into BIOS configuration
 It’s complex! (Revision 6.0 is 1056 pages long)
The fact that it takes more code to parse and interpret
ACPI than it does to route traffic on the internet
backbones should be a hint something is badly wrong
either in ACPI the spec, ACPI the implementation or
both.
Alan Cox
ACPI is a complete design disaster in every way
Linus Torvalds
Basically, it is just complex.
 Divided to three major components
 ACPI registers
 ACPI BIOS
 ACPI tables
 AML – ACPI Machine Language
 Requires a full-fledged interpreter to be implemented in
the kernel.
 Motherboard devices are described in an hierarchical
format called the ACPI namespace.
 ACPI definition blocks
 Differentiated System Description Table (DSDT)
 Secondary System Description Table (SSDT)
 The operating system is simply required to iterate over
the ACPI namespace and load the proper drivers for
each device that is listed there.
Device (BT)
{
Name (_HID, "TOS6205")
Method (_STA, 0, NotSerialized)
{
If (BTEN)
{
Return (0x00)
}
Else
{
Return (0x0F)
}
}
...
}
Device (BT)
{
…
Method (DUSB, 0, NotSerialized)
{
Store (0x00, _SB.PCI0.LPC0.EC0.BTDT)
}
…
}
 ACPI Component Architecture
 (OS)-independent reference implementation of the
Advanced Configuration and Power Interface
Specification (ACPI).
 www.acpica.org
 Divided into a few major components
 OS services layer
 ACPI core subsystem
 device drivers
 A collection of modules that implement the core logic
of ACPI.
 AML interpreter
 Execution of the AML bytecode
 ACPI table management
 Validation, parsing, installation and removal
 Resource management
 Dependencies between resources
 IRQ routing tables
 Namespace management
 Providing simple access to the full ACPI device hierarchy
 Many others
 Intermediate layer between the ACPI core and the rest
of the system
 Translate syscall to a matching ACPI method
 Standard set of interfaces that perform OS dependenet
functions
 Memory allocation
 Hardware access
 Threading and synchronization
 Needs to be implemented by each operating system
that wishes to use ACPICA.
 Platform devices
 Platform devices are devices that typically appear as
autonomous entities in the system.
 No bus initialization and management required
 Directly probe the hardware – implementing .probe
function
struct platform_driver {
int (*probe)(struct platform_device *);
int (*remove)(struct platform_device *);
...
};
 PCI devices
 Drivers are registered to the PCI subsystem of the
kernel.
 When a device is detected the matching drivers probe
function is invoked.
struct pci_driver {
...
int (*probe) (struct pci_dev *dev, ..);
void (*remove) (struct pci_dev *dev);
...
};
Hardware Probing in the Linux Kernel

More Related Content

What's hot

Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionGene Chang
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013Wave Digitech
 
Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device DriversNEEVEE Technologies
 
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)William Liang
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom BoardPatrick Bellasi
 
Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux KernelAdrian Huang
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image艾鍗科技
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Adrian Huang
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
Kernel module programming
Kernel module programmingKernel module programming
Kernel module programmingVandana Salve
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/CoreShay Cohen
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Toursamrat das
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot) Omkar Rane
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMSherif Mousa
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Tushar B Kute
 

What's hot (20)

Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
 
Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device Drivers
 
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom Board
 
Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux Kernel
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Kernel module programming
Kernel module programmingKernel module programming
Kernel module programming
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Tour
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
 

Similar to Hardware Probing in the Linux Kernel

SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)Linaro
 
Developing a Windows CE OAL.ppt
Developing a Windows CE OAL.pptDeveloping a Windows CE OAL.ppt
Developing a Windows CE OAL.pptKundanSingh887495
 
ACPI In Windows Vista
ACPI In Windows VistaACPI In Windows Vista
ACPI In Windows Vistaspot2
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelSUSE Labs Taipei
 
Introduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmwareIntroduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmwaredefinecareer
 
Profiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event HandingProfiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event HandingSUSE Labs Taipei
 
Achieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-KernelsAchieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-KernelsJiannan Ouyang, PhD
 
Real Machine Cloud Computing Che Rung Lee.pptx
Real Machine Cloud Computing Che Rung Lee.pptxReal Machine Cloud Computing Che Rung Lee.pptx
Real Machine Cloud Computing Che Rung Lee.pptxDanyMoko
 
OS - System Structure
OS - System StructureOS - System Structure
OS - System Structurevinay arora
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIeJin Wu
 
COS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC SystemsCOS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC SystemsPrateek Anand
 
Oleksyk applied-anti-forensics
Oleksyk   applied-anti-forensicsOleksyk   applied-anti-forensics
Oleksyk applied-anti-forensicsDefconRussia
 
intel_x86_pm.pptx
intel_x86_pm.pptxintel_x86_pm.pptx
intel_x86_pm.pptxAtul Vaish
 
Computer architecture
Computer architectureComputer architecture
Computer architectureRozase Patel
 

Similar to Hardware Probing in the Linux Kernel (20)

SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
 
Developing a Windows CE OAL.ppt
Developing a Windows CE OAL.pptDeveloping a Windows CE OAL.ppt
Developing a Windows CE OAL.ppt
 
ACPI In Windows Vista
ACPI In Windows VistaACPI In Windows Vista
ACPI In Windows Vista
 
Slimline Open Firmware
Slimline Open FirmwareSlimline Open Firmware
Slimline Open Firmware
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux Kernel
 
Introduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmwareIntroduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmware
 
Agnostic Device Drivers
Agnostic Device DriversAgnostic Device Drivers
Agnostic Device Drivers
 
Profiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event HandingProfiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event Handing
 
Achieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-KernelsAchieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-Kernels
 
Basics to Configure NW Device
Basics to Configure NW DeviceBasics to Configure NW Device
Basics to Configure NW Device
 
Real Machine Cloud Computing Che Rung Lee.pptx
Real Machine Cloud Computing Che Rung Lee.pptxReal Machine Cloud Computing Che Rung Lee.pptx
Real Machine Cloud Computing Che Rung Lee.pptx
 
OS - System Structure
OS - System StructureOS - System Structure
OS - System Structure
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIe
 
Evatronix track h
Evatronix   track hEvatronix   track h
Evatronix track h
 
haifux-pcie.pdf
haifux-pcie.pdfhaifux-pcie.pdf
haifux-pcie.pdf
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
COS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC SystemsCOS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC Systems
 
Oleksyk applied-anti-forensics
Oleksyk   applied-anti-forensicsOleksyk   applied-anti-forensics
Oleksyk applied-anti-forensics
 
intel_x86_pm.pptx
intel_x86_pm.pptxintel_x86_pm.pptx
intel_x86_pm.pptx
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 

More from Kernel TLV

Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCBuilding Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCKernel TLV
 
SGX Trusted Execution Environment
SGX Trusted Execution EnvironmentSGX Trusted Execution Environment
SGX Trusted Execution EnvironmentKernel TLV
 
Kernel Proc Connector and Containers
Kernel Proc Connector and ContainersKernel Proc Connector and Containers
Kernel Proc Connector and ContainersKernel TLV
 
Bypassing ASLR Exploiting CVE 2015-7545
Bypassing ASLR Exploiting CVE 2015-7545Bypassing ASLR Exploiting CVE 2015-7545
Bypassing ASLR Exploiting CVE 2015-7545Kernel TLV
 
Present Absence of Linux Filesystem Security
Present Absence of Linux Filesystem SecurityPresent Absence of Linux Filesystem Security
Present Absence of Linux Filesystem SecurityKernel TLV
 
OpenWrt From Top to Bottom
OpenWrt From Top to BottomOpenWrt From Top to Bottom
OpenWrt From Top to BottomKernel TLV
 
Make Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance ToolsMake Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance ToolsKernel TLV
 
Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...
Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...
Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...Kernel TLV
 
File Systems: Why, How and Where
File Systems: Why, How and WhereFile Systems: Why, How and Where
File Systems: Why, How and WhereKernel TLV
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptablesKernel TLV
 
KernelTLV Speaker Guidelines
KernelTLV Speaker GuidelinesKernelTLV Speaker Guidelines
KernelTLV Speaker GuidelinesKernel TLV
 
Userfaultfd: Current Features, Limitations and Future Development
Userfaultfd: Current Features, Limitations and Future DevelopmentUserfaultfd: Current Features, Limitations and Future Development
Userfaultfd: Current Features, Limitations and Future DevelopmentKernel TLV
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageKernel TLV
 
Linux Kernel Cryptographic API and Use Cases
Linux Kernel Cryptographic API and Use CasesLinux Kernel Cryptographic API and Use Cases
Linux Kernel Cryptographic API and Use CasesKernel TLV
 
DMA Survival Guide
DMA Survival GuideDMA Survival Guide
DMA Survival GuideKernel TLV
 
FD.IO Vector Packet Processing
FD.IO Vector Packet ProcessingFD.IO Vector Packet Processing
FD.IO Vector Packet ProcessingKernel TLV
 
WiFi and the Beast
WiFi and the BeastWiFi and the Beast
WiFi and the BeastKernel TLV
 
Introduction to DPDK
Introduction to DPDKIntroduction to DPDK
Introduction to DPDKKernel TLV
 

More from Kernel TLV (20)

DPDK In Depth
DPDK In DepthDPDK In Depth
DPDK In Depth
 
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCBuilding Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
 
SGX Trusted Execution Environment
SGX Trusted Execution EnvironmentSGX Trusted Execution Environment
SGX Trusted Execution Environment
 
Fun with FUSE
Fun with FUSEFun with FUSE
Fun with FUSE
 
Kernel Proc Connector and Containers
Kernel Proc Connector and ContainersKernel Proc Connector and Containers
Kernel Proc Connector and Containers
 
Bypassing ASLR Exploiting CVE 2015-7545
Bypassing ASLR Exploiting CVE 2015-7545Bypassing ASLR Exploiting CVE 2015-7545
Bypassing ASLR Exploiting CVE 2015-7545
 
Present Absence of Linux Filesystem Security
Present Absence of Linux Filesystem SecurityPresent Absence of Linux Filesystem Security
Present Absence of Linux Filesystem Security
 
OpenWrt From Top to Bottom
OpenWrt From Top to BottomOpenWrt From Top to Bottom
OpenWrt From Top to Bottom
 
Make Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance ToolsMake Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance Tools
 
Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...
Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...
Emerging Persistent Memory Hardware and ZUFS - PM-based File Systems in User ...
 
File Systems: Why, How and Where
File Systems: Why, How and WhereFile Systems: Why, How and Where
File Systems: Why, How and Where
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
 
KernelTLV Speaker Guidelines
KernelTLV Speaker GuidelinesKernelTLV Speaker Guidelines
KernelTLV Speaker Guidelines
 
Userfaultfd: Current Features, Limitations and Future Development
Userfaultfd: Current Features, Limitations and Future DevelopmentUserfaultfd: Current Features, Limitations and Future Development
Userfaultfd: Current Features, Limitations and Future Development
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
 
Linux Kernel Cryptographic API and Use Cases
Linux Kernel Cryptographic API and Use CasesLinux Kernel Cryptographic API and Use Cases
Linux Kernel Cryptographic API and Use Cases
 
DMA Survival Guide
DMA Survival GuideDMA Survival Guide
DMA Survival Guide
 
FD.IO Vector Packet Processing
FD.IO Vector Packet ProcessingFD.IO Vector Packet Processing
FD.IO Vector Packet Processing
 
WiFi and the Beast
WiFi and the BeastWiFi and the Beast
WiFi and the Beast
 
Introduction to DPDK
Introduction to DPDKIntroduction to DPDK
Introduction to DPDK
 

Recently uploaded

What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Hardware Probing in the Linux Kernel

  • 1. Linux kernel TLV meetup, 21.09.2015 Kfir Gollan
  • 2.  What is hardware probing?  Different approaches for detecting hardware  Probing in the linux kernel
  • 3.  Have you ever wondered how does the OS know what hardware components are available on a given machine?  Basically, someone needs to tell the OS what is available.  The process of detecting all the hardware components and pairing them up with the matching drivers in the OS is called hardware probing, or just probing for short.
  • 4.  Hardcode the details of the hardware into the kernel  Static configuration  Device trees  Dynamic configuration  ACPI  Bus based detection  PCI
  • 5.
  • 6. Formal definition: “The Device Tree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspect of the hardware can be described in a data structure that is passed to the operating system at boot time.” devicetree.org
  • 7.  Device tree source (DTS)  Device tree bindings  Device tree blob (DTB)  Flattened Device Tree (FDT)  Device tree compiler (DTC)
  • 8. { compatible = "nvidia,harmony", "nvidia,tegra20"; #address-cells = <1>; #size-cells = <1>; interrupt-parent = <&intc>; memory { device_type = "memory"; reg = <0x00000000 0x40000000>; }; ... };
  • 9. { …. sound { compatible = "nvidia,harmony-sound"; i2s-controller = <&i2s1>; i2s-codec = <&wm8903>; }; };
  • 10. chosen { bootargs = "console=ttyS0,115200 loglevel=8"; initrd-start = <0xc8000000>; initrd-end = <0xc8200000>; };
  • 11.  Xillybus Device tree tutorial  Device trees for Dummies!  Documentation/devicetree/  usage-model.txt  booting-without-of.txt
  • 12.
  • 13.  Advanced configuration and power interface  Originally created by Intel, Toshiba & Microsoft  Currently maintained by the UEFI forum  Current last revision of the spec was released at May 2015 (Revision 6.0)  Replaces APM (Advanced Power Management)  Allows the kernel/user to control power features without going into BIOS configuration  It’s complex! (Revision 6.0 is 1056 pages long)
  • 14. The fact that it takes more code to parse and interpret ACPI than it does to route traffic on the internet backbones should be a hint something is badly wrong either in ACPI the spec, ACPI the implementation or both. Alan Cox ACPI is a complete design disaster in every way Linus Torvalds Basically, it is just complex.
  • 15.  Divided to three major components  ACPI registers  ACPI BIOS  ACPI tables  AML – ACPI Machine Language  Requires a full-fledged interpreter to be implemented in the kernel.
  • 16.  Motherboard devices are described in an hierarchical format called the ACPI namespace.  ACPI definition blocks  Differentiated System Description Table (DSDT)  Secondary System Description Table (SSDT)  The operating system is simply required to iterate over the ACPI namespace and load the proper drivers for each device that is listed there.
  • 17. Device (BT) { Name (_HID, "TOS6205") Method (_STA, 0, NotSerialized) { If (BTEN) { Return (0x00) } Else { Return (0x0F) } } ... }
  • 18. Device (BT) { … Method (DUSB, 0, NotSerialized) { Store (0x00, _SB.PCI0.LPC0.EC0.BTDT) } … }
  • 19.  ACPI Component Architecture  (OS)-independent reference implementation of the Advanced Configuration and Power Interface Specification (ACPI).  www.acpica.org  Divided into a few major components  OS services layer  ACPI core subsystem  device drivers
  • 20.  A collection of modules that implement the core logic of ACPI.  AML interpreter  Execution of the AML bytecode  ACPI table management  Validation, parsing, installation and removal  Resource management  Dependencies between resources  IRQ routing tables  Namespace management  Providing simple access to the full ACPI device hierarchy  Many others
  • 21.  Intermediate layer between the ACPI core and the rest of the system  Translate syscall to a matching ACPI method  Standard set of interfaces that perform OS dependenet functions  Memory allocation  Hardware access  Threading and synchronization  Needs to be implemented by each operating system that wishes to use ACPICA.
  • 22.
  • 23.  Platform devices  Platform devices are devices that typically appear as autonomous entities in the system.  No bus initialization and management required  Directly probe the hardware – implementing .probe function struct platform_driver { int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); ... };
  • 24.  PCI devices  Drivers are registered to the PCI subsystem of the kernel.  When a device is detected the matching drivers probe function is invoked. struct pci_driver { ... int (*probe) (struct pci_dev *dev, ..); void (*remove) (struct pci_dev *dev); ... };

Editor's Notes

  1. Main topics of the presentation. What is hardware probing? Talking about the entire process from high-level, not too technical. Various approaches for detecting hardware. Mainly talking about concepts. We will use ACPI as an example for x86 and device tree for arm. Dynamic detection will be discussed briefly.
  2. Possible example to use – When you install a linux distribution on your machine, say ubuntu, do you specify anything about your hardware? how many USB ports you have? how much RAM?
  3. When presenting this slide make sure to talk about pros and cons of each approach. Hardcoding pros Simple to implement, hardcoding addresses in the required drivers and subsystems. No restrictions on the bootloader Minimal overhead which results in faster boot-time. cons The generated kernel matches a single architecture. If we want to add/remove a component we will need to re-compile the kernel. Non standard for recent kernels. This approach will work for custom embedded devices. Device trees pros Relatively simple to use (requires parsing of a static binary structure in the kernel). Provides a simple channel to pass parameters from the bootloader to the kernel (chosen entity in the DT) Small memory footprint cons Modifications to the hardware requires recompiling the dtb Non compliant to the x86 standard set by intel (Some userspace applications such as lshw will not work properly with device trees) ACPI pros Widely supported on various machines Doesn’t require to recompile anything when hardware is added to the system Provides extra features such as power management cons Rather complex to integrate into a system (AML interpreter for example) Considered to be not secure. Dynamic detection on static buses pros The detection can be performed at run-time (hot-plugging) The detection can be deferred on many cases, this allows the logic to be implemented in userspace cons Most complex approach (Take a look at the USB/PCI subsystem in the linux kernel…)
  4. Device tree source “Code” written in dts syntax. Used as input for the DTC in most cases. Device tree blob The binary output of the dtc. This output is used by the kernel Flattened Device Tree (FDT) – structure for the DTB. the FDT is the format used in linux. Device tree compiler A tool that can convert from/to dts to/from dtb. The linux kernel maintains its own compiler, located in scripts/dtc Links: - http://elinux.org/Device_Tree
  5. The chosen entry in the device tree is for general information that can be passed from the bootloader to the kernel. This was added to be used as a general way to configure the kernel from the bootloader.
  6. Links: https://www.kernel.org/doc/ols/2005/ols2005v1-pages-59-76.pdf https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface https://lwn.net/Articles/367630/ http://www.uefi.org/sites/default/files/resources/ACPI_6.0.pdf http://lwn.net/2001/0704/kernel.php3
  7. ACPI bios – Loads the ACPI tables into known memory locations to be used by the kernel. Does other stuff as well but this is its major role. ACPI registers – information used for loading the tables. ACPI tables – Static description of hardware and functionalities as well as byte code to be executed - AML
  8. Full source file can be found in http://www.codon.org.uk/~mjg59/lwn/toshiba_x300.dsl
  9. The probe function allows a driver to interact with the compatible hardware. Request required resources (memory, irq etc) The remove function allows a driver to clean up if the device was disconnected. This allows for hot-plugging of platform devices.