iommu evaluation in automotive use-cases...development and verification for mobile and in-vehicle...

24
IOMMU Evaluation in Automotive use-cases Khiem Nguyen / Engineer Renesas @KhiemNguyenT

Upload: others

Post on 12-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

IOMMU Evaluation in

Automotive use-casesKhiem Nguyen / Engineer

Renesas

@KhiemNguyenT

Page 2: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

WHO AM I ?

Page 2

Name:Khiem Trong. Nguyen (KHIEM Nguyen )

Company:Renesas Design Vietnam

Career:10 years experiences in embedded software development

Development and verification for Mobile and In-vehicle software platform

Development for test automation solutions of In-vehicle software platform

Email: [email protected]

Page 3: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

ABOUT RENESAS AND RENESAS DESIGN VIETNAM

Page 3

Renesas Electronics AmericaRenesas Electronics CanadaRenesas Electronics Brasil-ServicosRenesas Electronics Europe (UK) Renesas Electronics Europe (Germany) Renesas Electronics (China)Renesas Electronics (Shanghai) Renesas Electronics Hong KongRenesas Electronics TaiwanRenesas Electronics SingaporeRenesas Electronics MalaysiaRenesas Electronics India Renesas Electronics Korea

Sales Companies

Renesas Semiconductor ManufacturingRenesas Semiconductor Package & Test SolutionsRenesas Semiconductor (Beijing) Renesas Semiconductor (Suzhou) Renesas Semiconductor (Malaysia)Renesas Semiconductor (Kedah)Renesas Semiconductor Technology (Malaysia)Renesas Semiconductor KL

Manufacturing and Engineering Service Companies

Renesas System DesignRenesas EngineeringServicesRenesas Design VietnamRenesas Semiconductor Design (Beijing)Renesas Semiconductor Design(Malaysia)

Design and Application Technologies Companies

Business Corporation

Intersil Corporation

Renesas Design Vietnam Co., Ltd. (RVC) was founded in October 2004,

as one of the main design centers in Renesas group.

Business line: Design of semiconductor for both hardware and software.

Page 4: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

IOMMU EVALUATION IN AUTOMOTIVE USE-CASESOPEN SOURCE SUMMIT NORTH AMERICA 2018

08/30/2018, VANCOUVER

KHIEM NGUYEN

SENIOR STAFF ENGINEER

RENESAS DESIGN VIETNAM

RENESAS ELECTRONICS CORPORATION

Page 5: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

AGENDA

Motivation

IOMMU Overview

IOMMU support for Automotive use-cases

Buffer Sharing

Resource Isolation

Conclusion

Page 5

Page 6: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

MOTIVATION

Page 7: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

MOTIVATION (1/3)

Page 7

Nowadays, multiple applications

or services running in parallel in a

vehicle.

The services can be implemented

in multiple silicon or share the

power of a single silicon.

Page 8: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

MOTIVATION (2/3)

Page 8

Image from GENIVI Graphics Sharing and Distributed HMI Compositing presentation in Dec 2017

Hardware

Dedicated

physical areaShared physical

memory area

Dedicated

physical area

Exchange

data

Page 9: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

MOTIVATION (3/3)

Page 9

Image taken from The AGL Software Defined Connected Car Architecture white paper

Need

IOMMU

support ? Optional Required

Page 10: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

IOMMU OVERVIEW

Page 11: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved. Page 11

IOMMU OVERVIEW – IOMMU HARDWARE

Have similar capability like MMU for CPU cores.

Have been supported in recent ARM architecture, i.e.

ARMv7 and ARMv8.x

In ARMv7, it’s an optional extension called LPAE (Large

Physical Address Extension), be available in ARM

Cortex-A15 and newer ARMv7 cores.

Device

IOMMU

TLBTable Walk

Unit

Memory

Translation

tables

Device Address Space Physical Address Space

Page 12: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved. Page 12

IOMMU OVERVIEW – IOMMU HARDWARE

Support 03 translation granule type.

4KB, 16KB and 64KB

Support 1-stage address translation and 2-stage address translation.

1 stage (Physical Address <-> Virtual Address)

2 stage (Physical Address <-> Immediate Physical Address <->Virtual Address)

Device AIOMMU

MemoryDevice Address Space

Physical Address Space

IOMMU

(Stage 1)

IOMMU

(Stage 2) Physical Address Space

Device B

Page 13: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved. Page 13

IOMMU OVERVIEW – IOMMU FRAMEWORK

Be a part of Linux kernel for a long time (dated back to 2007).

Support 4KB (default configuration) page size, 16KB and 64KB.

Support managing address translation for Linux device drivers.

Initialize the translation contexts (MMU pagetables)

Initialize the memory mapping, physical to virtual, and register DMA callback handlers for

each device attached to the contexts.

Re-mapping the buffers when sharing buffers are triggered across the contexts.

Page 14: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved. Page 14

IOMMU OVERVIEW – IOMMU FRAMEWORK

Linux kernel

DMA callbackDevice Drivers

Linux kernel

DMA callbackDevice Drivers

IOMMU-DMA

callback

IOMMU-support

Device Driversiova

io-pgtable

Without IOMMU support With IOMMU support

Page 15: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

IOMMU SUPPORT FOR AUTOMOTIVE

USE-CASES

Page 16: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

IOMMU SUPPORT FOR AUTOMOTIVE USE-CASESHOW IOMMU SUPPORT AUTOMOTIVE USE-CASES ?

Page 16

Guarantee the correct and efficient dataflow among the devices.

Buffer sharing

Among devices in same contexts

Among devices in different contexts

Between non-IOMMU-supported devices and IOMMU-supported devices

Resource isolation

Create different memory mapping to grant access or block the access to specific memory

areas.

Page 17: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved. Page 17

BUFFER SHARINGVIDEO CAPTURE: PROCESSING FLOW AND ISSUES

Weston

GStreamer

Display

composition

HW

Kernel

User

DRM/KMS

waylandsink

Wayland

Image Blending Display unit

memory

vspfilter

V4L2 / vsp2driver

Image Processing

VSP Manager

Control flow

Data flow

Video

Capture

v4l2src

V4L2 /

Video

Capture

IOMMU context 1IOMMU context 0 IOMMU context 0

Map

bufferMap

buffer

1

2

User applications’ processing

Kernel drivers’ processing

Demand for BIG buffer allocation Sharing data between IOMMU contexts 21

Page 18: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

BUFFER SHARINGBIG BUFFER ALLOCATION - USE CONTIGUOUS DMA BUFFER – 1/3

Page 18

Why ?

The multimedia use-cases require a lot of CMA buffers.

With the default kernel allocation (4KB per allocation), it takes time to map/re-map big

CMA buffers (e.g 2MB, 4MB, etc).

Should use CMA contiguous allocation for big buffer allocation.

Improve the performance

Buffer sharing among two or more devices with different memory requirements.

Use DMA_ATTR_FORCE_CONTIGUOUS

The IOMMU support for ARM64 architecture has been available since Linux kernel v4.12.

* See https://www.kernel.org/doc/Documentation/DMA-attributes.txt for more detail

Page 19: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

BUFFER SHARINGBIG BUFFER ALLOCATION - USE CONTIGUOUS DMA BUFFER – 2/3

Page 19

Weston

GStreamer

Display

composition

HW

Kernel

User

DRM/KMS

waylandsink

Wayland

Image Blending Display Unit

memory

vspfilter

V4L2 / vsp2driver

Image Processing

VSP Manager

RAW

Control flow

Data flow

Video Capture

v4l2src

V4L2 /

Video Capture

IOMMU context 1IOMMU context 0 IOMMU context 0

Map

buffer

Map

buffer

3

2

User applications’ processing

2

1

1 CMA buffer allocation (in one function call)

2 Map the buffer to corresponding IOMMU pagetable (in one function call)

3 Buffer is shared via DMA Buffer sharing Framework

Page 20: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

BUFFER SHARINGBIG BUFFER ALLOCATION - PHYSICALLY CONTIGUOUS DMA BUFFER – 3/3

Page 20

Below shows the performance between non-IOMMU and IOMMU environment

No. Video capture non-IOMMU IOMMU enabled

+ use contiguous CMA Buffers

1 Video capture (1080p) 60 fps 60 fps

2 Video capture with scaling

(input/output: 1080p/720p)

60 fps 60 fps

Page 21: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

CONCLUSION

Page 22: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

CONCLUSION

Page 22

IOMMU can support buffer sharing and resource isolation, which are important criteria of

implementing complex Automotive use-cases.

To guarantee the system performance when IOMMU is enabled,

Use contiguous CMA buffer allocation for sharing big buffers.

Handle the address translation and dataflow across devices with different view of

system memory.

Future work

Check the dataflow and consider the solution to ensure the system performance in

other automotive use-cases.

Page 23: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software

© 2018 Renesas Electronics Corporation. All rights reserved.

Renesas.com

Page 24: IOMMU Evaluation in Automotive use-cases...Development and verification for Mobile and In-vehicle software platform Development for test automation solutions of In-vehicle software