SlideShare a Scribd company logo
1
Power Management Across
OSs
charles.garcia-tobin@arm.com
2
Introduction
 Firmware/ACPI is not the most popular topic in Linux:
“Modern PCs are horrible. ACPI is a complete design disaster in every
way. But we're kind of stuck with it. If any Intel people are listening to
this and you had anything to do with ACPI, shoot yourself now, before
you reproduce”
“The fact that ACPI was designed by a group of monkeys high on LSD,
and is some of the worst designs in the industry obviously makes
running it at any point pretty damn ugly. “
“EFI is this other Intel brain-damage (the first one being ACPI). “
3
Linux is not Alone on the Device
 Secure code will be present, provided by Semico or trusted
OS vendor for a variety reasons:
 Secure boot
 Crypto services
 Secure key storage
 ....
 Global platform is a leading security standards body in mobile
space
 Most companies in this room are members
 Hypervisor can also be present
 There is actually a work item in Linaro to cover Trustzone
 TrustZone kernel driver
4
ARMv7/v8 Privilege/Exception Levels
Apps
Apps
Apps
Apps
Guest OS
Apps
Apps
Apps
Apps
Guest OS
Hypervisor
Secure
AppsSecure
Apps
Secure OS
Secure Monitor
EL0
EL1
EL2
EL3
Non-Secure Secure
32-bit &
64-bit
Apps
Guest OS
64-bit
Hypervisor
Monitor
Apps
Apps
Apps
Apps
Guest OS
Apps
Apps
Apps
Apps
Guest OS
Hypervisor
Secure
AppsSecure
Apps
Secure OS
Secure Monitor
PL0
PL1
PL2
Non-Secure
ARMv7 ARMv8
5
ARMv7/v8 Privilege/Exception Levels
Apps
Apps
Apps
Apps
Guest OS
Apps
Apps
Apps
Apps
Guest OS
Hypervisor
Secure
AppsSecure
Apps
Trusted OS
Secure Monitor
PL0
PL1
PL2
Non-Secure
ARMv7
Rich OSs
Linux, Windows
...
Hyp vendors
OKLabs, VMWare
...
TrustedOS Vendors
Semicos, ...
6
So Need Collaboration
 Need OSs at different privilege
layers to collaborate on power
 OSs need to know when to
save/restore their state
 OSs need to manage peripherals
they own when entering a power
state
Linux
Hypervisor
Secure world
Hotplug
Secondary boot
Idle
Powercontroller
optional
bigLITTLE migration
7
Cold Boot vs Warm Boot
Linux Kernel
Secure ROM
Goto TrustedOS
Warm boot vector
Secure ROM
Init
check boot reason
Secure Flash
Boot firmware
Install TrustedOS
Uboot
Load linux from
media
Trusted OS
Start RichOS at
Its warm boot vector
Linux Kernel
Secure
Non-Secure
8
Cold Boot vs Warm Boot
Linux Kernel
Secure ROM
Goto TrustedOS
Warm boot vector
Secure ROM
Init
check boot reason
Secure Flash
Boot firmware
Install TrustedOS
Uboot
Load linux from
media
Trusted OS
Start RichOS at
Its warm boot vector
Linux Kernel
Secure
Non-Secure
Linux needs to define warm boot address and inform secure side
9
Context
 Idle management use of shutdown states requires context saving and restoring
 big.LITTLE migration models require saving context, and restoring on a different
CPU
 Every OS layer may need to save context, and every booting CPU needs a
context for every OS layer
10
Proposal
 System APIs are required by
 Idle states
 Hot plug
 Secondary boot
 CPU Migration (Switching)
 Can be captured in a few APIs:
 Power down CPU for Idle -> IdlePowerDown
 Power up CPU for hot plug -> CPUAdd
 Power down a CPU for hot unplug -> CPURemove
 Power up the inbound CPU for migration -> CPUSwitchIn
 Power down the outbound CPU for migration -> CPUSwitchOut
11
Conduit to next layer of privilege
 To talk across OSs you need instructions that can get you up
to next level of privilege
 SMC provides such an interface.
 SMC can also be trapped at hypervisor level
 A virtualised guest can use the same interface
12
Powering Down a CPU for Idle
 We want to capture the following semantics:
 What is being powered down:
 You can power the current CPU down
 If last man you can power the current cluster down
 How do express a return address? How do express what context to
use when you restart
13
Powering Down a CPU for Idle
 What is being powered down?
 We can use an affinity level
 Affinity level 0 -> current CPU
 Affinity Level 1 -> Current cluster
 Affinity Level 2 -> Current cluster of clusters / whole system
 CPU identification scheme in ARMv7 define three affinity levels
 OS managing power is responsible for tracking “last man” and
synchronising entry
14
Power Down – Resume Address & Context ID
 Resume address
 Address at which
calling OS expects
to be restarted
 Context ID
 Opaque value
understood by
calling OS which
must be in R0
when OS is
resumed
13
1
2
3
2
15
Power Down
 IdlePowerDown
 Parameters
 Affinity level: CPU or cluster (or indeed cluster of clusters ...)
 Resume address and context ID
 Return
 Invalid parameters
 Success
16
Power Up/Down – HotPlug
 Hot Plug - CPURemove
 Parameters
 Affinity level: CPU or cluster (or indeed cluster of clusters ...)
 OS has to track last man
 Hot Unplug or secondary cold boot - CPUAdd
 Parameters
 CPUID of core being powered up
 Resume address and context ID
 Return
 Invalid Parameters
 Success
17
Migration with Power Up/Down
18
Migration State Transfer
12
1 2
19
Power Up for CPU Switching
 SwitchIn
 Secure World knows that the intent is a switch
 Parameters
 CPUID of inbound core
 Resume vector and contextID
 Return
 Success
 TryAgain
 Invalid parameters
20
Power Down for Migration
 SwitchOut
 Parameters
 Affinity Level to power down
 Resume vector and contextID
 Must match ones used in SwitchIn
 Return
 Invalid parameters
21
Status
 Standard calling conventions
 Secure monitor SMC
 Hypervisor HVC
 ARM will be providing sample secure code for power
interface
 Questions ...

More Related Content

What's hot (20)

PDF
Q2.12: Idle Power States Nomenclature
Linaro
 
PDF
LCU14 500 ARM Trusted Firmware
Linaro
 
PDF
LCU14 302- How to port OP-TEE to another platform
Linaro
 
PDF
Linux : The Common Mailbox Framework
Mr. Vengineer
 
PDF
Lcu14 107- op-tee on ar mv8
Linaro
 
PPT
Hardware accelerated Virtualization in the ARM Cortex™ Processors
The Linux Foundation
 
PDF
Lcu14 306 - OP-TEE Future Enhancements
Linaro
 
PDF
LCA14: LCA14-502: The way to a generic TrustZone® solution
Linaro
 
PDF
HKG15-400: Next steps in KVM enablement on ARM
Linaro
 
PDF
SFO15-407: Performance Overhead of ARM Virtualization
Linaro
 
PPT
operating and configuring cisco a cisco IOS device
scooby_doo
 
PPTX
LAS16-203: Platform security architecture for embedded devices
Linaro
 
PPT
Cis81 ccna1v5-2-configuring networkoperatingsystem
Betselove
 
PPTX
Cisco ios overview
NetProtocol Xpert
 
PDF
Project ACRN USB mediator introduction
Project ACRN
 
PDF
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
FFRI, Inc.
 
PDF
HKG15-311: OP-TEE for Beginners and Porting Review
Linaro
 
PDF
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
NETWAYS
 
PPT
Slimline Open Firmware
Heiko Joerg Schick
 
PPTX
Sdk For Firmware Development
Ramesh Prasad
 
Q2.12: Idle Power States Nomenclature
Linaro
 
LCU14 500 ARM Trusted Firmware
Linaro
 
LCU14 302- How to port OP-TEE to another platform
Linaro
 
Linux : The Common Mailbox Framework
Mr. Vengineer
 
Lcu14 107- op-tee on ar mv8
Linaro
 
Hardware accelerated Virtualization in the ARM Cortex™ Processors
The Linux Foundation
 
Lcu14 306 - OP-TEE Future Enhancements
Linaro
 
LCA14: LCA14-502: The way to a generic TrustZone® solution
Linaro
 
HKG15-400: Next steps in KVM enablement on ARM
Linaro
 
SFO15-407: Performance Overhead of ARM Virtualization
Linaro
 
operating and configuring cisco a cisco IOS device
scooby_doo
 
LAS16-203: Platform security architecture for embedded devices
Linaro
 
Cis81 ccna1v5-2-configuring networkoperatingsystem
Betselove
 
Cisco ios overview
NetProtocol Xpert
 
Project ACRN USB mediator introduction
Project ACRN
 
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
FFRI, Inc.
 
HKG15-311: OP-TEE for Beginners and Porting Review
Linaro
 
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
NETWAYS
 
Slimline Open Firmware
Heiko Joerg Schick
 
Sdk For Firmware Development
Ramesh Prasad
 

Viewers also liked (19)

DOC
Chuong 2arm cortex
Tien Le
 
PDF
Sierraware ARM hypervisor
Sierraware
 
PDF
Status update-qemu-pcie
The Linux Foundation
 
PDF
LCU13: ACPI power state mapping
Linaro
 
PDF
Extracting Linux kernel feature model changes with FMDiff
NicoDintzner
 
ODP
The e820 trap of Linux kernel hibernation
joeylikernel
 
PPT
70 271 Stu Chap07
Gene Carboni
 
PPTX
Comp tia flashcards set 1 (15 cards) acpi cmos
Sue Long Smith
 
PDF
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Anne Nicolas
 
ODP
BIOS, Linux and Firmware Test Suite in-between
Alex Hung
 
PDF
Las16 200 - firmware summit - ras what is it- why do we need it
Linaro
 
PPTX
Linux Initialization Process (1)
shimosawa
 
PPTX
Hardware Probing in the Linux Kernel
Kernel TLV
 
PDF
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
Linaro
 
PDF
High Performance Storage Devices in the Linux Kernel
Kernel TLV
 
PPTX
Linux Initialization Process (2)
shimosawa
 
PDF
UEFI presentation
Bruno Cornec
 
PPTX
Power aware operating system
Rajan Kumar Yadav
 
PDF
BUD17-TR01: Philosophy of Open Source
Linaro
 
Chuong 2arm cortex
Tien Le
 
Sierraware ARM hypervisor
Sierraware
 
Status update-qemu-pcie
The Linux Foundation
 
LCU13: ACPI power state mapping
Linaro
 
Extracting Linux kernel feature model changes with FMDiff
NicoDintzner
 
The e820 trap of Linux kernel hibernation
joeylikernel
 
70 271 Stu Chap07
Gene Carboni
 
Comp tia flashcards set 1 (15 cards) acpi cmos
Sue Long Smith
 
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Anne Nicolas
 
BIOS, Linux and Firmware Test Suite in-between
Alex Hung
 
Las16 200 - firmware summit - ras what is it- why do we need it
Linaro
 
Linux Initialization Process (1)
shimosawa
 
Hardware Probing in the Linux Kernel
Kernel TLV
 
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
Linaro
 
High Performance Storage Devices in the Linux Kernel
Kernel TLV
 
Linux Initialization Process (2)
shimosawa
 
UEFI presentation
Bruno Cornec
 
Power aware operating system
Rajan Kumar Yadav
 
BUD17-TR01: Philosophy of Open Source
Linaro
 
Ad

Similar to Q2.12: Power Management Across OSs (20)

PDF
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
Linaro
 
PDF
Q2.12: Implications of Per CPU switching in a big.LITTLE system
Linaro
 
PDF
SoC Idling for unconf COSCUP 2016
Koan-Sin Tan
 
PPTX
“Linux Kernel CPU Hotplug in the Multicore System”
GlobalLogic Ukraine
 
PDF
BKK16-410 SoC Idling & CPU Cluster PM
Linaro
 
PDF
Linux_swspnd_v0.3_pub1
padmanabha srinivasaiah
 
PDF
Linux power management: are you doing it right?
Chris Simmonds
 
PDF
Hibernation in Linux 2.6.29
Varun Mahajan
 
PDF
LCA13: CPUIDLE: One driver to rule them all?
Linaro
 
PDF
BKK16-TR08 How to generate power models for EAS and IPA
Linaro
 
PDF
Power management
Scott Shu
 
PPT
OK Labs - Virtualization as the Nexus of Multicore Power Management
Open Kernel Labs
 
PDF
BKK16-317 How to generate power models for EAS and IPA
Linaro
 
PDF
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
Linaro
 
PDF
Android 电源管理 power_management_(英文版)
borderj
 
PPTX
Improving Xen idle power efficiency
The Linux Foundation
 
PPTX
Lecture02_LinuxBasedEmbeddedSystemComponentStack.pptx
ChetanNaikJECE
 
PPTX
Lecture02_LinuxBasedEmbeddedSystemComponentStack.pptx
ChetanNaikJECE
 
PPTX
Lecture02_LinuxBasedEmbeddedSystemComponentStack.pptx
ChetanNaikJECE
 
PDF
Project ACRN Device Passthrough Introduction
Project ACRN
 
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
Linaro
 
Q2.12: Implications of Per CPU switching in a big.LITTLE system
Linaro
 
SoC Idling for unconf COSCUP 2016
Koan-Sin Tan
 
“Linux Kernel CPU Hotplug in the Multicore System”
GlobalLogic Ukraine
 
BKK16-410 SoC Idling & CPU Cluster PM
Linaro
 
Linux_swspnd_v0.3_pub1
padmanabha srinivasaiah
 
Linux power management: are you doing it right?
Chris Simmonds
 
Hibernation in Linux 2.6.29
Varun Mahajan
 
LCA13: CPUIDLE: One driver to rule them all?
Linaro
 
BKK16-TR08 How to generate power models for EAS and IPA
Linaro
 
Power management
Scott Shu
 
OK Labs - Virtualization as the Nexus of Multicore Power Management
Open Kernel Labs
 
BKK16-317 How to generate power models for EAS and IPA
Linaro
 
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
Linaro
 
Android 电源管理 power_management_(英文版)
borderj
 
Improving Xen idle power efficiency
The Linux Foundation
 
Lecture02_LinuxBasedEmbeddedSystemComponentStack.pptx
ChetanNaikJECE
 
Lecture02_LinuxBasedEmbeddedSystemComponentStack.pptx
ChetanNaikJECE
 
Lecture02_LinuxBasedEmbeddedSystemComponentStack.pptx
ChetanNaikJECE
 
Project ACRN Device Passthrough Introduction
Project ACRN
 
Ad

More from Linaro (20)

PDF
Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Linaro
 
PDF
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Linaro
 
PDF
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Linaro
 
PDF
Bud17 113: distribution ci using qemu and open qa
Linaro
 
PDF
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
Linaro
 
PDF
HPC network stack on ARM - Linaro HPC Workshop 2018
Linaro
 
PDF
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...
Linaro
 
PDF
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Linaro
 
PDF
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Linaro
 
PDF
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Linaro
 
PDF
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
PDF
HKG18-100K1 - George Grey: Opening Keynote
Linaro
 
PDF
HKG18-318 - OpenAMP Workshop
Linaro
 
PDF
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
PDF
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
Linaro
 
PDF
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
Linaro
 
PDF
HKG18-TR08 - Upstreaming SVE in QEMU
Linaro
 
PDF
HKG18-113- Secure Data Path work with i.MX8M
Linaro
 
PPTX
HKG18-120 - Devicetree Schema Documentation and Validation
Linaro
 
PPTX
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro
 
Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Linaro
 
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Linaro
 
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Linaro
 
Bud17 113: distribution ci using qemu and open qa
Linaro
 
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
Linaro
 
HPC network stack on ARM - Linaro HPC Workshop 2018
Linaro
 
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...
Linaro
 
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Linaro
 
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Linaro
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
HKG18-100K1 - George Grey: Opening Keynote
Linaro
 
HKG18-318 - OpenAMP Workshop
Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
Linaro
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
Linaro
 
HKG18-TR08 - Upstreaming SVE in QEMU
Linaro
 
HKG18-113- Secure Data Path work with i.MX8M
Linaro
 
HKG18-120 - Devicetree Schema Documentation and Validation
Linaro
 
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro
 

Recently uploaded (20)

PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
Deploy Faster, Run Smarter: Learn Containers with QNAP
QNAP Marketing
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Sound the Alarm: Detection and Response
VICTOR MAESTRE RAMIREZ
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Deploy Faster, Run Smarter: Learn Containers with QNAP
QNAP Marketing
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Sound the Alarm: Detection and Response
VICTOR MAESTRE RAMIREZ
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 

Q2.12: Power Management Across OSs

  • 2. 2 Introduction  Firmware/ACPI is not the most popular topic in Linux: “Modern PCs are horrible. ACPI is a complete design disaster in every way. But we're kind of stuck with it. If any Intel people are listening to this and you had anything to do with ACPI, shoot yourself now, before you reproduce” “The fact that ACPI was designed by a group of monkeys high on LSD, and is some of the worst designs in the industry obviously makes running it at any point pretty damn ugly. “ “EFI is this other Intel brain-damage (the first one being ACPI). “
  • 3. 3 Linux is not Alone on the Device  Secure code will be present, provided by Semico or trusted OS vendor for a variety reasons:  Secure boot  Crypto services  Secure key storage  ....  Global platform is a leading security standards body in mobile space  Most companies in this room are members  Hypervisor can also be present  There is actually a work item in Linaro to cover Trustzone  TrustZone kernel driver
  • 4. 4 ARMv7/v8 Privilege/Exception Levels Apps Apps Apps Apps Guest OS Apps Apps Apps Apps Guest OS Hypervisor Secure AppsSecure Apps Secure OS Secure Monitor EL0 EL1 EL2 EL3 Non-Secure Secure 32-bit & 64-bit Apps Guest OS 64-bit Hypervisor Monitor Apps Apps Apps Apps Guest OS Apps Apps Apps Apps Guest OS Hypervisor Secure AppsSecure Apps Secure OS Secure Monitor PL0 PL1 PL2 Non-Secure ARMv7 ARMv8
  • 5. 5 ARMv7/v8 Privilege/Exception Levels Apps Apps Apps Apps Guest OS Apps Apps Apps Apps Guest OS Hypervisor Secure AppsSecure Apps Trusted OS Secure Monitor PL0 PL1 PL2 Non-Secure ARMv7 Rich OSs Linux, Windows ... Hyp vendors OKLabs, VMWare ... TrustedOS Vendors Semicos, ...
  • 6. 6 So Need Collaboration  Need OSs at different privilege layers to collaborate on power  OSs need to know when to save/restore their state  OSs need to manage peripherals they own when entering a power state Linux Hypervisor Secure world Hotplug Secondary boot Idle Powercontroller optional bigLITTLE migration
  • 7. 7 Cold Boot vs Warm Boot Linux Kernel Secure ROM Goto TrustedOS Warm boot vector Secure ROM Init check boot reason Secure Flash Boot firmware Install TrustedOS Uboot Load linux from media Trusted OS Start RichOS at Its warm boot vector Linux Kernel Secure Non-Secure
  • 8. 8 Cold Boot vs Warm Boot Linux Kernel Secure ROM Goto TrustedOS Warm boot vector Secure ROM Init check boot reason Secure Flash Boot firmware Install TrustedOS Uboot Load linux from media Trusted OS Start RichOS at Its warm boot vector Linux Kernel Secure Non-Secure Linux needs to define warm boot address and inform secure side
  • 9. 9 Context  Idle management use of shutdown states requires context saving and restoring  big.LITTLE migration models require saving context, and restoring on a different CPU  Every OS layer may need to save context, and every booting CPU needs a context for every OS layer
  • 10. 10 Proposal  System APIs are required by  Idle states  Hot plug  Secondary boot  CPU Migration (Switching)  Can be captured in a few APIs:  Power down CPU for Idle -> IdlePowerDown  Power up CPU for hot plug -> CPUAdd  Power down a CPU for hot unplug -> CPURemove  Power up the inbound CPU for migration -> CPUSwitchIn  Power down the outbound CPU for migration -> CPUSwitchOut
  • 11. 11 Conduit to next layer of privilege  To talk across OSs you need instructions that can get you up to next level of privilege  SMC provides such an interface.  SMC can also be trapped at hypervisor level  A virtualised guest can use the same interface
  • 12. 12 Powering Down a CPU for Idle  We want to capture the following semantics:  What is being powered down:  You can power the current CPU down  If last man you can power the current cluster down  How do express a return address? How do express what context to use when you restart
  • 13. 13 Powering Down a CPU for Idle  What is being powered down?  We can use an affinity level  Affinity level 0 -> current CPU  Affinity Level 1 -> Current cluster  Affinity Level 2 -> Current cluster of clusters / whole system  CPU identification scheme in ARMv7 define three affinity levels  OS managing power is responsible for tracking “last man” and synchronising entry
  • 14. 14 Power Down – Resume Address & Context ID  Resume address  Address at which calling OS expects to be restarted  Context ID  Opaque value understood by calling OS which must be in R0 when OS is resumed 13 1 2 3 2
  • 15. 15 Power Down  IdlePowerDown  Parameters  Affinity level: CPU or cluster (or indeed cluster of clusters ...)  Resume address and context ID  Return  Invalid parameters  Success
  • 16. 16 Power Up/Down – HotPlug  Hot Plug - CPURemove  Parameters  Affinity level: CPU or cluster (or indeed cluster of clusters ...)  OS has to track last man  Hot Unplug or secondary cold boot - CPUAdd  Parameters  CPUID of core being powered up  Resume address and context ID  Return  Invalid Parameters  Success
  • 19. 19 Power Up for CPU Switching  SwitchIn  Secure World knows that the intent is a switch  Parameters  CPUID of inbound core  Resume vector and contextID  Return  Success  TryAgain  Invalid parameters
  • 20. 20 Power Down for Migration  SwitchOut  Parameters  Affinity Level to power down  Resume vector and contextID  Must match ones used in SwitchIn  Return  Invalid parameters
  • 21. 21 Status  Standard calling conventions  Secure monitor SMC  Hypervisor HVC  ARM will be providing sample secure code for power interface  Questions ...