SlideShare a Scribd company logo
1 of 41
Download to read offline
Embedded Linux Conference Europe 2014 
Two years of ARM 
SoC support 
mainlining: lessons 
learned 
Thomas Petazzoni 
Free Electrons 
thomas.petazzoni@free-electrons.com 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 1/41
Thomas Petazzoni 
I CTO and Embedded Linux engineer at Free Electrons 
I Embedded Linux development: kernel and driver 
development, system integration, boot time and power 
consumption optimization, consulting, etc. 
I Embedded Linux training, Linux driver development, 
Yocto/OpenEmbedded and Android system development 
training, with materials freely available under a Creative 
Commons license. 
I http://free-electrons.com 
I Contributions 
I Kernel support for the Marvell Armada ARM SoCs from 
Marvell 
I Major contributor to Buildroot, an open-source, simple and 
fast embedded Linux build system 
I Living in Toulouse, south west of France 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 2/41
Context 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 3/41
Process 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 4/41
Timeline (1) 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 5/41
Timeline (2) 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 6/41
Lesson #0 
Submit early 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 7/41
Submit early 
I Release early, release often 
I Translated into the kernel contributor position: submit early 
I You will make incorrect choices in your patches 
I The only solution to know it is to post them and get reviews 
and comments 
I On several occasions, we had too many internal discussions 
and reviews before posting, and we wasted too much time. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 8/41
Lesson #1 
Engage with the community 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 9/41
Community 
I Really embrace the power of the community 
I Test linux-next and -rc 
I Allows to
nd regressions early, and make sure your platform 
support is in a minimally working state at all times. 
I Much better than big jumps every 2/3 years! 
I Provide boards for the ARM board farm 
I Talk with Kevin Hilman and Olof Johansson 
I Gets the latest mainline and linux-next built and booted on 
your platform every day! 
I Create a good relationship with your sub-architecture 
maintainer, and possibly other maintainers. 
I They are the key to getting your patches merged. 
I Attend conferences, and plan a beer/drink budget. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 10/41
Lesson #2 
Encourage community 
contributions 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 11/41
Community contributions 
I While the community may not necessarily work on big" 
features, people can help dramatically in areas like: 
debugging, bug
xing, performance optimizations, etc. 
I Provide boards and datasheets to a selection of good 
people, and they will solve problems 
I Marvell now provides public datasheets for Armada 370/XP 
(great!) 
I Not yet for Armada 375/38x, though. 
I Provide these contributors support/assistance. 
I Examples: 
I Willy Tarreau debugged and
xed a major performance issue in 
the Armada 370/XP network driver. 
I Neil Greatorex, Jason Gunthorpe and Willy Tarreau 
investigated and
xed a number of PCIe related issues. 
I Help solving communication issues: special PCI terminology 
I Quick build
xes 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 12/41
Lesson #3 
Review patches from others 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 13/41
Review patches from others 
I Review patches from other developers. Not the ones in your 
company, people from other companies. 
I Doing this helps the maintainers 
I Shows that you care about the community and understand 
how it works 
I Of course, do it wisely, and don't do stupid reviews! 
I Ezequiel's evil plan 
I Statistically speaking, you can speed-up your own reviewing 
process by reviewing other patches on the same queue 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 14/41
Lesson #4 
Assign dedicated engineering 
resources 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 15/41
Engineering resources 
I Mainlining is a time consuming process 
I Have a small team of engineers fully dedicated to mainlining. 
I Keep the team small and ecient, throwing more people will 
not necessarily make things go faster. 
I Half of the work is technical, half of the work is social. 
I Make sure this small team has easy access to other engineers 
with deep knowledge of the hardware. 
I The datasheet often isn't enough. 
I Give them the right technical tools 
I Not a crappy company mail client, unusable to handle patches 
and mailing list discussions. 
I IRC access 
I The engineers need to be able to reply quickly to 
community comments and requests. 
I Otherwise the community won't trust that you will
x issues 
and maintain the code moving forward. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 16/41
Engineering resources 
550 days of work, spread over three engineers. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 17/41
Lesson #5 
Take into account older SoCs 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 18/41
Take into account existing code 
I Yes, you want to push support for your new SoC / hardware 
right now 
I But nothing upsets more the community than neglecting 
existing hardware support in the kernel. 
I In our case: 
I We wanted to push support for Armada 370/XP, sharing a lot 
of HW blocks with previous SoCs 
I We had to take into account Kirkwood, Discovery, Orion5x 
and Dove when doing changes to core drivers (pinctrl, clock, 
mbus, PCIe, etc.) 
I Help of the community is key here! 
I If you care today for older code, you will care tomorrow for 
code you're submitting today. 
I Also avoids carrying legacy code in your platform. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 19/41
Lesson #6 
Code re-use actually works 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 20/41
Code re-use actually works 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 21/41
Code re-use actually works 
I Two successive groups of SoCs: 
1. Armada 370/XP 
2. Armada 375/38x 
I Many drivers pre-existed from the Kirkwood/Orion era, and 
we could re-use them with just a DT binding addition. 
I Lot of work done Armada 370/XP: writing (hopefully) good 
Device Tree bindings, proper pinctrl, clock, irqchip drivers, etc. 
I Paid o when Armada 375/38x were introduced: all the 
identical HW blocks were enabled really quickly. 
I Mainlining is a long term investment, but it pays o, 
especially if you have related SoCs. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 22/41
Lesson #7 
Adopt the new code 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 23/41
Adopt the new code 
I The SoC vendor should really adopt the code that has been 
mainlined. 
I There is a big risk of a split between: 
I the SoC vendor custom BSP: ugly code, but lots of QA 
I mainline: beautiful code, but poor QA 
I In our case, mainlining eort from 3.6 to 3.12, Marvell 
adopted 3.10 + several backports early January 2014 
I It was already too late: when they started testing, we 
discovered several issues thanks to their stronger QA eort. 
I Also, a split means that there is a duplicated debugging eort. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 24/41
Lesson #8 
Realize there is a culture 
dierence 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 25/41
Culture dierence 
I Initially, surprised by the need of a third-party to mainline 
Marvell SoCs: Marvell has highly skilled engineers 
I However, the mainlining process is not (only?) about 
making code work 
I It's about 
I Making code pretty: use the appropriate subsystems, don't 
hack core code in a non-generic way 
I Caring about other platforms 
I Understanding how the social interactions with maintainers 
and the community work 
I As said earlier: half technical, half social 
I Need people having both an understanding of the community, 
and technical expertise. They may not be the deepest 
technical experts, but they know how to create the interface 
with the community. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 26/41
Lesson #9 
Know how to schedule patch 
submission 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 27/41
Patch submission timeline 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 28/41
Patch submission scheduling 
I The maintainers/community has a bounded absorption rate 
I Don't send too many patches/features during the same 
cycle 
I Complex things posted way before the cycle starts, and 
be almost in the
nal stages when the -rc1 of the previous 
cycle is released. 
I You're always two releases ahead: version X has just been 
released, your stu for release X+1 should be ready since some 
time, and your active development is for X+2 
I During a cycle, you typically 
I Post the
nal versions of your patches for X+1, do the 
remaining polishing and quick iterations to review/comments. 
I Develop the features for X+2, post RFC-level patch series. 
I Accelerate patch submission as you approach merging. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 29/41
Lesson #10 
Merging special DT bindings is 
hard 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 30/41
Special DT bindings 
I Bindings for simple, normal devices, are usually relatively easy 
to get merged. 
I Binding for more complex devices, or buses, require much 
more discussion 
I Armada 370/XP was the
rst ARM platform to merge a PCI 
host controller driver with a DT binding. 
I Initial patch proposed on December 7th, 2012. 
I 10 iterations until May 16th, 2013. 
I Finally released as part of 3.11, September 2013. 
I Similar story for mvebu-mbus, the driver for the 
exible MBus 
Marvell bus. 
I Be patient, take comments into consideration, explain how 
your hardware works. 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 31/41
Special DT bindings 
pcie-controller { 
compatible = marvell,armada-xp-pcie; 
#address-cells = 3; 
#size-cells = 2; 
msi-parent = mpic; 
bus-range = 0x00 0xff; 
ranges = 
0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ 
0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */ 
0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ 
0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ 
0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ 
0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ 
0x82000000 0 0x82000 MBUS_ID(0xf0, 0x01) 0x82000 0 0x00002000 /* Port 3.0 registers */ 
[...] 
0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ 
0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ 
0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ 
0x81000000 0x2 0 MBUS_ID(0x04, 0xd0) 0 1 0 /* Port 0.1 IO */ 
0x82000000 0x3 0 MBUS_ID(0x04, 0xb8) 0 1 0 /* Port 0.2 MEM */ 
0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ 
0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ 
0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ 
[...] 
pcie@1,0 { 
device_type = pci; 
assigned-addresses = 0x82000800 0 0x40000 0 0x2000; 
reg = 0x0800 0 0 0 0; 
#address-cells = 3; 
#size-cells = 2; 
#interrupt-cells = 1; 
ranges = 0x82000000 0 0 0x82000000 0x1 0 1 0 
0x81000000 0 0 0x81000000 0x1 0 1 0; 
interrupt-map-mask = 0 0 0 0; 
interrupt-map = 0 0 0 0 mpic 58; 
marvell,pcie-port = 0; 
marvell,pcie-lane = 0; 
clocks = gateclk 5; 
status = disabled; 
}; 
Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 32/41

More Related Content

Viewers also liked

How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...
How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...
How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...Polaris Associates
 
At8000 s arquitetura de empilhamento
At8000 s arquitetura de empilhamentoAt8000 s arquitetura de empilhamento
At8000 s arquitetura de empilhamentoNetPlus
 
Maxim zap cv_asic_backend_04_13
Maxim zap cv_asic_backend_04_13Maxim zap cv_asic_backend_04_13
Maxim zap cv_asic_backend_04_13Maxim Zap
 
ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...
ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...
ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...OptimalPlus
 
Summit 16: ARM Mini-Summit - NFV for the Masses - Marvell
Summit 16: ARM Mini-Summit - NFV for the Masses - MarvellSummit 16: ARM Mini-Summit - NFV for the Masses - Marvell
Summit 16: ARM Mini-Summit - NFV for the Masses - MarvellOPNFV
 
WiFi (IEEE 802.11 WLAN) Patents for Standard Ranking
WiFi (IEEE 802.11 WLAN) Patents for Standard RankingWiFi (IEEE 802.11 WLAN) Patents for Standard Ranking
WiFi (IEEE 802.11 WLAN) Patents for Standard RankingAlex G. Lee, Ph.D. Esq. CLP
 

Viewers also liked (6)

How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...
How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...
How Marvell Semiconductor Implemented Executive Dashboards in 17 Countries in...
 
At8000 s arquitetura de empilhamento
At8000 s arquitetura de empilhamentoAt8000 s arquitetura de empilhamento
At8000 s arquitetura de empilhamento
 
Maxim zap cv_asic_backend_04_13
Maxim zap cv_asic_backend_04_13Maxim zap cv_asic_backend_04_13
Maxim zap cv_asic_backend_04_13
 
ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...
ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...
ITC 2015 - Marvell Present : "Improving Quality and Yield Through Optimal+ Bi...
 
Summit 16: ARM Mini-Summit - NFV for the Masses - Marvell
Summit 16: ARM Mini-Summit - NFV for the Masses - MarvellSummit 16: ARM Mini-Summit - NFV for the Masses - Marvell
Summit 16: ARM Mini-Summit - NFV for the Masses - Marvell
 
WiFi (IEEE 802.11 WLAN) Patents for Standard Ranking
WiFi (IEEE 802.11 WLAN) Patents for Standard RankingWiFi (IEEE 802.11 WLAN) Patents for Standard Ranking
WiFi (IEEE 802.11 WLAN) Patents for Standard Ranking
 

Recently uploaded

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
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
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%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
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%+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
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
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
 
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
 

Recently uploaded (20)

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
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?
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%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
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%+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...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
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-...
 
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
 

Two years of ARM SoC support mainlining: lessons learned (ELCE 2014)

  • 1. Embedded Linux Conference Europe 2014 Two years of ARM SoC support mainlining: lessons learned Thomas Petazzoni Free Electrons thomas.petazzoni@free-electrons.com Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 1/41
  • 2. Thomas Petazzoni I CTO and Embedded Linux engineer at Free Electrons I Embedded Linux development: kernel and driver development, system integration, boot time and power consumption optimization, consulting, etc. I Embedded Linux training, Linux driver development, Yocto/OpenEmbedded and Android system development training, with materials freely available under a Creative Commons license. I http://free-electrons.com I Contributions I Kernel support for the Marvell Armada ARM SoCs from Marvell I Major contributor to Buildroot, an open-source, simple and fast embedded Linux build system I Living in Toulouse, south west of France Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 2/41
  • 3. Context Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 3/41
  • 4. Process Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 4/41
  • 5. Timeline (1) Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 5/41
  • 6. Timeline (2) Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 6/41
  • 7. Lesson #0 Submit early Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 7/41
  • 8. Submit early I Release early, release often I Translated into the kernel contributor position: submit early I You will make incorrect choices in your patches I The only solution to know it is to post them and get reviews and comments I On several occasions, we had too many internal discussions and reviews before posting, and we wasted too much time. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 8/41
  • 9. Lesson #1 Engage with the community Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 9/41
  • 10. Community I Really embrace the power of the community I Test linux-next and -rc I Allows to
  • 11. nd regressions early, and make sure your platform support is in a minimally working state at all times. I Much better than big jumps every 2/3 years! I Provide boards for the ARM board farm I Talk with Kevin Hilman and Olof Johansson I Gets the latest mainline and linux-next built and booted on your platform every day! I Create a good relationship with your sub-architecture maintainer, and possibly other maintainers. I They are the key to getting your patches merged. I Attend conferences, and plan a beer/drink budget. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 10/41
  • 12. Lesson #2 Encourage community contributions Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 11/41
  • 13. Community contributions I While the community may not necessarily work on big" features, people can help dramatically in areas like: debugging, bug
  • 14. xing, performance optimizations, etc. I Provide boards and datasheets to a selection of good people, and they will solve problems I Marvell now provides public datasheets for Armada 370/XP (great!) I Not yet for Armada 375/38x, though. I Provide these contributors support/assistance. I Examples: I Willy Tarreau debugged and
  • 15. xed a major performance issue in the Armada 370/XP network driver. I Neil Greatorex, Jason Gunthorpe and Willy Tarreau investigated and
  • 16. xed a number of PCIe related issues. I Help solving communication issues: special PCI terminology I Quick build
  • 17. xes Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 12/41
  • 18. Lesson #3 Review patches from others Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 13/41
  • 19. Review patches from others I Review patches from other developers. Not the ones in your company, people from other companies. I Doing this helps the maintainers I Shows that you care about the community and understand how it works I Of course, do it wisely, and don't do stupid reviews! I Ezequiel's evil plan I Statistically speaking, you can speed-up your own reviewing process by reviewing other patches on the same queue Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 14/41
  • 20. Lesson #4 Assign dedicated engineering resources Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 15/41
  • 21. Engineering resources I Mainlining is a time consuming process I Have a small team of engineers fully dedicated to mainlining. I Keep the team small and ecient, throwing more people will not necessarily make things go faster. I Half of the work is technical, half of the work is social. I Make sure this small team has easy access to other engineers with deep knowledge of the hardware. I The datasheet often isn't enough. I Give them the right technical tools I Not a crappy company mail client, unusable to handle patches and mailing list discussions. I IRC access I The engineers need to be able to reply quickly to community comments and requests. I Otherwise the community won't trust that you will
  • 22. x issues and maintain the code moving forward. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 16/41
  • 23. Engineering resources 550 days of work, spread over three engineers. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 17/41
  • 24. Lesson #5 Take into account older SoCs Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 18/41
  • 25. Take into account existing code I Yes, you want to push support for your new SoC / hardware right now I But nothing upsets more the community than neglecting existing hardware support in the kernel. I In our case: I We wanted to push support for Armada 370/XP, sharing a lot of HW blocks with previous SoCs I We had to take into account Kirkwood, Discovery, Orion5x and Dove when doing changes to core drivers (pinctrl, clock, mbus, PCIe, etc.) I Help of the community is key here! I If you care today for older code, you will care tomorrow for code you're submitting today. I Also avoids carrying legacy code in your platform. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 19/41
  • 26. Lesson #6 Code re-use actually works Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 20/41
  • 27. Code re-use actually works Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 21/41
  • 28. Code re-use actually works I Two successive groups of SoCs: 1. Armada 370/XP 2. Armada 375/38x I Many drivers pre-existed from the Kirkwood/Orion era, and we could re-use them with just a DT binding addition. I Lot of work done Armada 370/XP: writing (hopefully) good Device Tree bindings, proper pinctrl, clock, irqchip drivers, etc. I Paid o when Armada 375/38x were introduced: all the identical HW blocks were enabled really quickly. I Mainlining is a long term investment, but it pays o, especially if you have related SoCs. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 22/41
  • 29. Lesson #7 Adopt the new code Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 23/41
  • 30. Adopt the new code I The SoC vendor should really adopt the code that has been mainlined. I There is a big risk of a split between: I the SoC vendor custom BSP: ugly code, but lots of QA I mainline: beautiful code, but poor QA I In our case, mainlining eort from 3.6 to 3.12, Marvell adopted 3.10 + several backports early January 2014 I It was already too late: when they started testing, we discovered several issues thanks to their stronger QA eort. I Also, a split means that there is a duplicated debugging eort. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 24/41
  • 31. Lesson #8 Realize there is a culture dierence Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 25/41
  • 32. Culture dierence I Initially, surprised by the need of a third-party to mainline Marvell SoCs: Marvell has highly skilled engineers I However, the mainlining process is not (only?) about making code work I It's about I Making code pretty: use the appropriate subsystems, don't hack core code in a non-generic way I Caring about other platforms I Understanding how the social interactions with maintainers and the community work I As said earlier: half technical, half social I Need people having both an understanding of the community, and technical expertise. They may not be the deepest technical experts, but they know how to create the interface with the community. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 26/41
  • 33. Lesson #9 Know how to schedule patch submission Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 27/41
  • 34. Patch submission timeline Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 28/41
  • 35. Patch submission scheduling I The maintainers/community has a bounded absorption rate I Don't send too many patches/features during the same cycle I Complex things posted way before the cycle starts, and be almost in the
  • 36. nal stages when the -rc1 of the previous cycle is released. I You're always two releases ahead: version X has just been released, your stu for release X+1 should be ready since some time, and your active development is for X+2 I During a cycle, you typically I Post the
  • 37. nal versions of your patches for X+1, do the remaining polishing and quick iterations to review/comments. I Develop the features for X+2, post RFC-level patch series. I Accelerate patch submission as you approach merging. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 29/41
  • 38. Lesson #10 Merging special DT bindings is hard Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 30/41
  • 39. Special DT bindings I Bindings for simple, normal devices, are usually relatively easy to get merged. I Binding for more complex devices, or buses, require much more discussion I Armada 370/XP was the
  • 40. rst ARM platform to merge a PCI host controller driver with a DT binding. I Initial patch proposed on December 7th, 2012. I 10 iterations until May 16th, 2013. I Finally released as part of 3.11, September 2013. I Similar story for mvebu-mbus, the driver for the exible MBus Marvell bus. I Be patient, take comments into consideration, explain how your hardware works. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 31/41
  • 41. Special DT bindings pcie-controller { compatible = marvell,armada-xp-pcie; #address-cells = 3; #size-cells = 2; msi-parent = mpic; bus-range = 0x00 0xff; ranges = 0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ 0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */ 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ 0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ 0x82000000 0 0x82000 MBUS_ID(0xf0, 0x01) 0x82000 0 0x00002000 /* Port 3.0 registers */ [...] 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ 0x81000000 0x2 0 MBUS_ID(0x04, 0xd0) 0 1 0 /* Port 0.1 IO */ 0x82000000 0x3 0 MBUS_ID(0x04, 0xb8) 0 1 0 /* Port 0.2 MEM */ 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ [...] pcie@1,0 { device_type = pci; assigned-addresses = 0x82000800 0 0x40000 0 0x2000; reg = 0x0800 0 0 0 0; #address-cells = 3; #size-cells = 2; #interrupt-cells = 1; ranges = 0x82000000 0 0 0x82000000 0x1 0 1 0 0x81000000 0 0 0x81000000 0x1 0 1 0; interrupt-map-mask = 0 0 0 0; interrupt-map = 0 0 0 0 mpic 58; marvell,pcie-port = 0; marvell,pcie-lane = 0; clocks = gateclk 5; status = disabled; }; Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 32/41
  • 42. Lesson #11 Keeping DT stability is hard Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 33/41
  • 43. Keeping DT stability is hard I Some hardware blocks have well-de
  • 44. ned functions and boundaries, generally for devices I But some hardware blocks have less well-de
  • 45. ned boundaries, generally core components (clocks, power management, etc.) I The need for stable DT bindings pretty much requires a complete understanding of how all the hardware works... I ... which goes a bit against the principle of iterative development. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 34/41
  • 46. Keeping DT stability is hard: example (1) I For SMP enabling on Armada XP, we needed to
  • 47. ddle with a unit called the PMSU (Power Management Service Unit) and some CPU reset registers. I So, we did a DT binding like this: armada-370-xp-pmsu@22000 { compatible = marvell,armada-370-xp-pmsu; reg = 0x22100 0x400, 0x20800 0x20; }; I First register region: PMSU I Second register region: CPU reset registers Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 35/41
  • 48. Keeping DT stability is hard: example (1) A year later, we realized that: I To implement cpuidle on Armada XP, we need to access PMSU registers between 0x22000 to 0x22100: need to change the base address of the
  • 49. rst register region. I Armada 375 has CPU reset registers for SMP, but no PMSU: need to split in two DT nodes. I And continue support the old DT binding. I Not able to use the new reset framework I Our experience: be very careful about all these system registers, and think twice. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 36/41
  • 50. Lesson #12 Technical vs. marketing Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 37/41
  • 51. Technical vs. marketing I A new SoC is going to be released and announced. I Technical people: we want the SoC to be supported in mainline as soon as it starts shipping. I Would require to start and post patches early I Marketing people: you're not allowed to disclose any details about the SoC before its ocial release. I Prevents from posting patches early, and goes against the limited absorption rate problem Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 38/41
  • 52. Lesson #13 Making estimates is impossible Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 39/41
  • 53. Making estimates is impossible I Manager: please tell me how much time you need to get this merged, and when it will be merged? I Making precise estimates for kernel mainlining work is very dicult, close to impossible. I You can estimate how much work is needed to get to the point where you send the
  • 54. rst version. I But then, the review may point out issues, or require refactoring of some subsystem: will require time! I For MSI support on Armada 370/XP, had to touch PowerPC, x86, SPARC, Tile, S390! I With the experience, you will progressively get a better feeling of how dicult it will be for a given change to be merged. Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 40/41
  • 56. k Bayouk, Lior Amsalem, Ezequiel Garcia, Gregory Clement and Marvell. Slides under CC-BY-SA 3.0 http://free-electrons.com/pub/conferences/2014/elce/petazzoni-soc- mainlining-lessons-learned/ Free Electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 41/41