SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
ACRN GPIO Mediator Introduction
LIU Long
Liu, Long <Long.Liu@intel.com>
05/27/2020
Table of Contents
PART 1: GPIO Overview
PART 2: GPIO Virtualization
PART 3: GPIO IRQ Virtualization
PART 4: Q & A
PIN & GPIO
➢ PINs are equal to pads, fingers, balls or whatever packaging input or output line you want to
control. PINs can sometimes be software-configured in various ways, mostly related to their
electronic properties, such as biasing and drive strength, when used as inputs or outputs. PINs
also support multiplexing, it means device can set PINs to one specific function, such as GPIO,
SPI or I2C.
➢ GPIO stands for “General Purpose Input/Output”, is a flexible software-controlled digital signal.
Each GPIO represents a bit connected to a particular pin, or "ball" on Ball Grid Array(BGA)
packages and it supports some capabilities including GPIO enabled/disabled, input values are
readable(typically high or low), output values are writable/readable and input values can often be
used as IRQs (typically for wakeup events).
https://en.wikipedia.org/wiki/General-purpose_input/output
GPIO hardware logic block
SOC
Pin
Configuration
Logic Block
SPI Logic
Block
I2C Logic
Block
Multiplexer
Physical
Pin
GPIO Logic
Block
➢ Type1 - GPIO, Multiplexer and Pin
Configuration are isolated, and each
model has its own MMIO.
➢ Type 2 - GPIO, Multiplexer and Pin
Configuration are merged into single
controller, all of them has same MMIO
range. GPIO Logic
Block
Type 2
Type 1
GPIO subsystem architecture
static struct pinmux_ops foo_pmxops = {
.get_functions_count = foo_get_functions_count,
.get_function_name = foo_get_fname,
.get_function_groups = foo_get_groups,
.set_mux = foo_set_mux,
.strict = true,
};
static struct pinconf_ops foo_pconf_ops = {
.pin_config_get = foo_pin_config_get,
.pin_config_set = foo_pin_config_set,
.pin_config_group_get = foo_pin_config_group_get,
.pin_config_group_set = foo_pin_config_group_set,
};
static struct gpio_chip foo_gpio_chip = {
.get_direction= foo_get_direction,
.direction_input = foo_direction_input,
.direction_output = foo_direction_output,
.get = foo_get,
.set = foo_set,
.base = 0,
.ngpio = 64,
…
};
GPIO virtualization
➢ Full virtualization solution needs to provide full functionality registers to UOS, but lots of
them have no real functionality due to only assigned virtual GPIO links to physical GPIO,
and another risk is that there is no common physical GPIO controller as reference for all
UOS platforms.
➢ Para virtualization solution can be as one common solution for all future platforms.
• GPIO virtualization follows the Virtual I/O Device (virtio) specification.
• The virtual pins information and the number of pins can be configured through acrn-dm command line.
• No kernel space mediator support due to high risk for SOS kernel stability.
virtio-gpio architecture
https://projectacrn.github.io/latest/developer-guides/hld/hld-virtio-devices.html?highlight=virtio
Native GPIO
Virtualization GPIO
virtio-gpio virtual gpio chip
➢ Each UOS has only one
GPIO chip instance, its
number of GPIOs is based
on acrn-dm command line
and GPIO base always
start from 0.
➢ Each acrn-dm may be able
to access one or more
native GPIO chips and all
GPIOs are exclusive.
virtio-gpio how to access GPIO in UOS
int xx_pci_probe(struct pci_dev *dev, const struct
pci_device_id *id) {
struct gpio_desc *desc;
int ret, val;
…
desc = gpiod_get_index(dev->dev, "reset-gpios",
0,GPIOD_IN);
or
desc = gpiod_get_index(dev->dev, NULL, 0, GPIOD_IN);
if (!desc || gpiod_direction_input(desc))
goto err;
val = gpiod_get_value(desc);
...
}
virtio-gpio gpio mapping
GPIO Description table
Native
GPIO
name
Native
GPIO
chip
Native
GPIO
offset
Virtual
GPIO
offset
reset 0 10 2
shutdown 0 100 0
virtio-gpio how to access
GPIO from userspace
sysfs:
For example :
cd /sys/class/gpio
echo 9 > export
echo 0 > gpio9/value
cat gpio9/value
echo 9 > unexport
char device
For example :
void write_value(unsigned offset, int value) {
struct gpiohandle_request req;
int ret, fd;
…
fd = open(“/dev/gpiochip0”, O_RDWR);
memset(&req, 0, sizeof(req));
req.lineoffsets[0] = offset;
req.default_values[0] = value;
req.flags = GPIOHANDLE_REQUEST_OUTPUT;
req.lines = 1;
ret = ioctl(line->chip->fd, GPIO_GET_LINEHANDLE_IOCTL, &req);
…
}
GPIO IRQ Virtualization
/dev/gpiochipN
Virtio-GPIO
DM
Virtio-GPIO
FE driver
UOS
IRQ consumer
Request IRQ
Request IRQ
Apply the IRQ
IRQ event notification
Send IRQ information
Invoke consumer’s IRQ handler
Free IRQ
Release IRQ
Free the IRQ line event
Send IRQ information
Return fd
Start to poll IRQ event
IRQ event notification
IRQ event notification
Invoke consumer’s IRQ handler
… Allocate buff
Allocate buff
…
…
Usage
⚫ <gpio resources>
<@controller_name{offset|name[=mapping_name]:offset|name[=mapping_name]:…}@controller_name{…}…]>
E.g.
1. Map native gpio numbers are 1 and 6, plus one gpio its name is “reset” to frontend, all of them are defined in
GPIO controller 0
<@gpiochip0{1:6:reset}>
2. Map native gpio numbers are 1 and 6, which are in gpio controller 0, and native gpio numbers are 2 and 7, which
are in gpio controller 1.
<@gpiochip0{1:6}@gpiochip1{2:7}>
⚫ [ | acpi resources]
[|@device_name{gpio_identifier[=apci name]:gpio_identifier[=apci name]…@device_name{…}…}]
E.g.
1. Usb FE driver wants to access “reset” gpio, and it is GPIO controller 0’s “reset” GPIO in native.
<@gpiochip0{reset}|@usb{gpiochip0_reset}
2. Usb FE driver wants to access “reset” gpio, and its offset is 2 in the native GPIO controller 0.
<@gpiochip0{2}|@usb{gpiochip0_2=reset}
•
Q & A

Weitere ähnliche Inhalte

Was ist angesagt?

LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
Linaro
 
Introduction to Vortex86DX2 Motion-Control Evaluation Board
Introduction to Vortex86DX2 Motion-Control Evaluation BoardIntroduction to Vortex86DX2 Motion-Control Evaluation Board
Introduction to Vortex86DX2 Motion-Control Evaluation Board
roboard
 
Note - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and InstallNote - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and Install
boyw165
 

Was ist angesagt? (20)

Kernel Recipes 2013 - Overview display in the Linux kernel
Kernel Recipes 2013 - Overview display in the Linux kernelKernel Recipes 2013 - Overview display in the Linux kernel
Kernel Recipes 2013 - Overview display in the Linux kernel
 
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN CPU sharing BVT scheduler in ACRN hypervisorProject ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
 
I2c drivers
I2c driversI2c drivers
I2c drivers
 
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
 
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Server Hardware Monitoring done right | Werner FischerOSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
Introduction to Vortex86DX2 Motion-Control Evaluation Board
Introduction to Vortex86DX2 Motion-Control Evaluation BoardIntroduction to Vortex86DX2 Motion-Control Evaluation Board
Introduction to Vortex86DX2 Motion-Control Evaluation Board
 
Note - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and InstallNote - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and Install
 
ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
ACRN vMeet-Up EU 2021 - Real Time Management and Performance OptimizationACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
Introduction to Android G Sensor I²C Driver on Android
Introduction to Android G Sensor I²C Driver on AndroidIntroduction to Android G Sensor I²C Driver on Android
Introduction to Android G Sensor I²C Driver on Android
 
Let's Play STM32
Let's Play STM32Let's Play STM32
Let's Play STM32
 
Linux Conference Australia 2018 : Device Tree, past, present, future
Linux Conference Australia 2018 : Device Tree, past, present, futureLinux Conference Australia 2018 : Device Tree, past, present, future
Linux Conference Australia 2018 : Device Tree, past, present, future
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
 
VHDL Practical Exam Guide
VHDL Practical Exam GuideVHDL Practical Exam Guide
VHDL Practical Exam Guide
 
Andes RISC-V processor solutions
Andes RISC-V processor solutionsAndes RISC-V processor solutions
Andes RISC-V processor solutions
 
Interrupts
InterruptsInterrupts
Interrupts
 
ELC-E 2016 Neil Armstrong - No, it's never too late to upstream your legacy l...
ELC-E 2016 Neil Armstrong - No, it's never too late to upstream your legacy l...ELC-E 2016 Neil Armstrong - No, it's never too late to upstream your legacy l...
ELC-E 2016 Neil Armstrong - No, it's never too late to upstream your legacy l...
 
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
 
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
 

Ähnlich wie Project ACRN GPIO mediator introduction

Openwrt, linux e GPIO al LinuxDay 2010 Roma
Openwrt, linux e GPIO al LinuxDay 2010 RomaOpenwrt, linux e GPIO al LinuxDay 2010 Roma
Openwrt, linux e GPIO al LinuxDay 2010 Roma
Claudio Mignanti
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
Tom Paulus
 
Raspberry pi lcd-shield20x4
Raspberry pi lcd-shield20x4Raspberry pi lcd-shield20x4
Raspberry pi lcd-shield20x4
Iulius Bors
 
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
mayank272369
 

Ähnlich wie Project ACRN GPIO mediator introduction (20)

Atomic pi Mini PC
Atomic pi Mini PCAtomic pi Mini PC
Atomic pi Mini PC
 
Atomic PI apug
Atomic PI apugAtomic PI apug
Atomic PI apug
 
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
 
PPT+.pdf
PPT+.pdfPPT+.pdf
PPT+.pdf
 
Ins and Outs of GPIO Programming
Ins and Outs of GPIO ProgrammingIns and Outs of GPIO Programming
Ins and Outs of GPIO Programming
 
Part-1 : Mastering microcontroller with embedded driver development
Part-1 : Mastering microcontroller with embedded driver development Part-1 : Mastering microcontroller with embedded driver development
Part-1 : Mastering microcontroller with embedded driver development
 
F9 microkernel app development part 2 gpio meets led
F9 microkernel app development part 2 gpio meets ledF9 microkernel app development part 2 gpio meets led
F9 microkernel app development part 2 gpio meets led
 
Openwrt, linux e GPIO al LinuxDay 2010 Roma
Openwrt, linux e GPIO al LinuxDay 2010 RomaOpenwrt, linux e GPIO al LinuxDay 2010 Roma
Openwrt, linux e GPIO al LinuxDay 2010 Roma
 
Interfacing two wire adc0831 to raspberry pi2 / Pi3
Interfacing two wire adc0831 to raspberry pi2 / Pi3Interfacing two wire adc0831 to raspberry pi2 / Pi3
Interfacing two wire adc0831 to raspberry pi2 / Pi3
 
Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo
 
Raspberry Pi dan Alat Parkir UI
Raspberry Pi dan Alat Parkir UIRaspberry Pi dan Alat Parkir UI
Raspberry Pi dan Alat Parkir UI
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !
 
Raspberry pi lcd-shield20x4
Raspberry pi lcd-shield20x4Raspberry pi lcd-shield20x4
Raspberry pi lcd-shield20x4
 
Raspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentRaspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application Development
 
Roll your own toy unix clone os
Roll your own toy unix clone osRoll your own toy unix clone os
Roll your own toy unix clone os
 
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
 
Led blinking using TMS320C6745
Led blinking using TMS320C6745Led blinking using TMS320C6745
Led blinking using TMS320C6745
 
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi GPIO Tutorial - Make Your Own Game ConsoleRaspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
 
Raspberry pi led blink
Raspberry pi led blinkRaspberry pi led blink
Raspberry pi led blink
 

Mehr von Project ACRN

Mehr von Project ACRN (20)

ACRN vMeet-Up EU 2021 - installation and configuration introduction
ACRN vMeet-Up EU 2021 - installation and configuration introductionACRN vMeet-Up EU 2021 - installation and configuration introduction
ACRN vMeet-Up EU 2021 - installation and configuration introduction
 
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
 
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - Boot Process and Secure BootACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
 
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
ACRN vMeet-Up EU 2021 -  functional safety design and certification planACRN vMeet-Up EU 2021 -  functional safety design and certification plan
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
 
ACRN vMeet-Up EU 2021 - community and development model
ACRN vMeet-Up EU 2021 - community and development modelACRN vMeet-Up EU 2021 - community and development model
ACRN vMeet-Up EU 2021 - community and development model
 
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
 
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
 
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look ForwardACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
 
ACRN Kata Container on ACRN
ACRN Kata Container on ACRNACRN Kata Container on ACRN
ACRN Kata Container on ACRN
 
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introduction
 
Project ACRN system debug
Project ACRN system debugProject ACRN system debug
Project ACRN system debug
 
Project ACRN SR-IOV on ACRN
Project ACRN SR-IOV on ACRNProject ACRN SR-IOV on ACRN
Project ACRN SR-IOV on ACRN
 
Project ACRN Device Model architecture introduction
Project ACRN Device Model architecture introductionProject ACRN Device Model architecture introduction
Project ACRN Device Model architecture introduction
 
Project ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config tool
 
Project ACRN hypervisor introduction
Project ACRN hypervisor introduction Project ACRN hypervisor introduction
Project ACRN hypervisor introduction
 
Project ACRN how to build a Yocto Project-based SOS
Project ACRN how to build a Yocto Project-based SOSProject ACRN how to build a Yocto Project-based SOS
Project ACRN how to build a Yocto Project-based SOS
 
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOS
 
Project ACRN GVT-d introduction and tutorial
Project ACRN GVT-d introduction and tutorialProject ACRN GVT-d introduction and tutorial
Project ACRN GVT-d introduction and tutorial
 
Project ACRN schedule framework introduction
Project ACRN schedule framework introductionProject ACRN schedule framework introduction
Project ACRN schedule framework introduction
 
Project ACRN Device Passthrough Introduction
Project ACRN Device Passthrough IntroductionProject ACRN Device Passthrough Introduction
Project ACRN Device Passthrough Introduction
 

Kürzlich hochgeladen

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Kürzlich hochgeladen (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
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
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
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
 
%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
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%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
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Project ACRN GPIO mediator introduction

  • 1. ACRN GPIO Mediator Introduction LIU Long Liu, Long <Long.Liu@intel.com> 05/27/2020
  • 2. Table of Contents PART 1: GPIO Overview PART 2: GPIO Virtualization PART 3: GPIO IRQ Virtualization PART 4: Q & A
  • 3. PIN & GPIO ➢ PINs are equal to pads, fingers, balls or whatever packaging input or output line you want to control. PINs can sometimes be software-configured in various ways, mostly related to their electronic properties, such as biasing and drive strength, when used as inputs or outputs. PINs also support multiplexing, it means device can set PINs to one specific function, such as GPIO, SPI or I2C. ➢ GPIO stands for “General Purpose Input/Output”, is a flexible software-controlled digital signal. Each GPIO represents a bit connected to a particular pin, or "ball" on Ball Grid Array(BGA) packages and it supports some capabilities including GPIO enabled/disabled, input values are readable(typically high or low), output values are writable/readable and input values can often be used as IRQs (typically for wakeup events). https://en.wikipedia.org/wiki/General-purpose_input/output
  • 4. GPIO hardware logic block SOC Pin Configuration Logic Block SPI Logic Block I2C Logic Block Multiplexer Physical Pin GPIO Logic Block ➢ Type1 - GPIO, Multiplexer and Pin Configuration are isolated, and each model has its own MMIO. ➢ Type 2 - GPIO, Multiplexer and Pin Configuration are merged into single controller, all of them has same MMIO range. GPIO Logic Block Type 2 Type 1
  • 5. GPIO subsystem architecture static struct pinmux_ops foo_pmxops = { .get_functions_count = foo_get_functions_count, .get_function_name = foo_get_fname, .get_function_groups = foo_get_groups, .set_mux = foo_set_mux, .strict = true, }; static struct pinconf_ops foo_pconf_ops = { .pin_config_get = foo_pin_config_get, .pin_config_set = foo_pin_config_set, .pin_config_group_get = foo_pin_config_group_get, .pin_config_group_set = foo_pin_config_group_set, }; static struct gpio_chip foo_gpio_chip = { .get_direction= foo_get_direction, .direction_input = foo_direction_input, .direction_output = foo_direction_output, .get = foo_get, .set = foo_set, .base = 0, .ngpio = 64, … };
  • 6. GPIO virtualization ➢ Full virtualization solution needs to provide full functionality registers to UOS, but lots of them have no real functionality due to only assigned virtual GPIO links to physical GPIO, and another risk is that there is no common physical GPIO controller as reference for all UOS platforms. ➢ Para virtualization solution can be as one common solution for all future platforms. • GPIO virtualization follows the Virtual I/O Device (virtio) specification. • The virtual pins information and the number of pins can be configured through acrn-dm command line. • No kernel space mediator support due to high risk for SOS kernel stability.
  • 10. virtio-gpio virtual gpio chip ➢ Each UOS has only one GPIO chip instance, its number of GPIOs is based on acrn-dm command line and GPIO base always start from 0. ➢ Each acrn-dm may be able to access one or more native GPIO chips and all GPIOs are exclusive.
  • 11. virtio-gpio how to access GPIO in UOS int xx_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct gpio_desc *desc; int ret, val; … desc = gpiod_get_index(dev->dev, "reset-gpios", 0,GPIOD_IN); or desc = gpiod_get_index(dev->dev, NULL, 0, GPIOD_IN); if (!desc || gpiod_direction_input(desc)) goto err; val = gpiod_get_value(desc); ... }
  • 12. virtio-gpio gpio mapping GPIO Description table Native GPIO name Native GPIO chip Native GPIO offset Virtual GPIO offset reset 0 10 2 shutdown 0 100 0
  • 13. virtio-gpio how to access GPIO from userspace sysfs: For example : cd /sys/class/gpio echo 9 > export echo 0 > gpio9/value cat gpio9/value echo 9 > unexport char device For example : void write_value(unsigned offset, int value) { struct gpiohandle_request req; int ret, fd; … fd = open(“/dev/gpiochip0”, O_RDWR); memset(&req, 0, sizeof(req)); req.lineoffsets[0] = offset; req.default_values[0] = value; req.flags = GPIOHANDLE_REQUEST_OUTPUT; req.lines = 1; ret = ioctl(line->chip->fd, GPIO_GET_LINEHANDLE_IOCTL, &req); … }
  • 14. GPIO IRQ Virtualization /dev/gpiochipN Virtio-GPIO DM Virtio-GPIO FE driver UOS IRQ consumer Request IRQ Request IRQ Apply the IRQ IRQ event notification Send IRQ information Invoke consumer’s IRQ handler Free IRQ Release IRQ Free the IRQ line event Send IRQ information Return fd Start to poll IRQ event IRQ event notification IRQ event notification Invoke consumer’s IRQ handler … Allocate buff Allocate buff … …
  • 15. Usage ⚫ <gpio resources> <@controller_name{offset|name[=mapping_name]:offset|name[=mapping_name]:…}@controller_name{…}…]> E.g. 1. Map native gpio numbers are 1 and 6, plus one gpio its name is “reset” to frontend, all of them are defined in GPIO controller 0 <@gpiochip0{1:6:reset}> 2. Map native gpio numbers are 1 and 6, which are in gpio controller 0, and native gpio numbers are 2 and 7, which are in gpio controller 1. <@gpiochip0{1:6}@gpiochip1{2:7}> ⚫ [ | acpi resources] [|@device_name{gpio_identifier[=apci name]:gpio_identifier[=apci name]…@device_name{…}…}] E.g. 1. Usb FE driver wants to access “reset” gpio, and it is GPIO controller 0’s “reset” GPIO in native. <@gpiochip0{reset}|@usb{gpiochip0_reset} 2. Usb FE driver wants to access “reset” gpio, and its offset is 2 in the native GPIO controller 0. <@gpiochip0{2}|@usb{gpiochip0_2=reset} •
  • 16. Q & A