fpga manager & device tree overlays moritz fischer - - PowerPoint PPT Presentation

fpga manager device tree overlays moritz fischer
SMART_READER_LITE
LIVE PREVIEW

fpga manager & device tree overlays moritz fischer - - PowerPoint PPT Presentation

fpga manager & device tree overlays moritz fischer moritz.fischer@ettus.com mfischer embedded sdr wtf?! what does that even mean embedded sdr? come see other talks tomorrow @ sdr track so why care about fpgas? performance


slide-1
SLIDE 1

fpga manager & device tree

  • verlays
slide-2
SLIDE 2

moritz fischer

moritz.fischer@ettus.com mfischer

slide-3
SLIDE 3

embedded sdr

slide-4
SLIDE 4

wtf?! what does that even mean embedded sdr?

slide-5
SLIDE 5

come see other talks tomorrow @ sdr track

slide-6
SLIDE 6

so why care about fpgas?

performance

slide-7
SLIDE 7

so why care about fpgas?

reconfigurability

slide-8
SLIDE 8

so why care about fpgas?

also, they’re awesome

slide-9
SLIDE 9

i won’t go into details of fpga design

slide-10
SLIDE 10

bitstream (firmware) contains hardware behavior

slide-11
SLIDE 11

so how to configure an fpga in a sane way?

slide-12
SLIDE 12

let’s start off with a bit

  • f history
slide-13
SLIDE 13

vendor solutions

slide-14
SLIDE 14

altera $ cat design.rbf > /dev/fpga0 xilinx $ cat design.bin > /dev/xdevcfg

slide-15
SLIDE 15

what could possibly go wrong?

slide-16
SLIDE 16

well … if you have more than one device implemented in the fpga

slide-17
SLIDE 17

userland just goes ahead and reloads the fpga

slide-18
SLIDE 18

you maybe have a kernel driver using fpga resources as well ...

slide-19
SLIDE 19

ehrm … whoopsie

slide-20
SLIDE 20

should the user really care what fpga is in the system?

slide-21
SLIDE 21

what if you had more than one fpga?

slide-22
SLIDE 22

even worse, hierarchy?

(i’m not making these up...)

slide-23
SLIDE 23

partial reconfiguration anyone?

slide-24
SLIDE 24

fpga manager is vendor neutral as part of linux 4.4 basic support for socfpga and zynq

slide-25
SLIDE 25

api - driver ops

write_init() /* prepare fpga for reload */ write() /* reconfigure fpga */ write_complete() /* callback when done */ state() /* returns framework internal state */ fpga_remove() /* called when removed */

slide-26
SLIDE 26

api usage (kernel)

/* get reference from device node */ struct fpga_manager *mgr = of_fpga_mgr_get(dn); /* load bitstream via fw layer*/ fpga_mgr_firmware_load(mgr, flags, “fw.bin”); /* drop reference */ fpga_mgr_put(mgr);

slide-27
SLIDE 27

this covers the simple usecase: driver needs fpga bitstream loaded

slide-28
SLIDE 28

but we can do better than that ...

slide-29
SLIDE 29

let’s talk about device tree overlays

slide-30
SLIDE 30

device tree describes hardware, but what if hardware changes?

slide-31
SLIDE 31

device tree overlays allow us to add, remove, and modify nodes of the live tree

slide-32
SLIDE 32
  • - foo.dts (abbrev.)--

foo0: foo@0 { compatible = “linux,foo”; status = “disabled”; };

  • - overlay.dts (abbrev.) --

fragment@0 { target = <&foo0>; __overlay__ { status = “okay”; }; };

example to modify status property

slide-33
SLIDE 33

example to add bar child

  • - foo.dts (abbrev.) --

foo0: foo@0 { compatible = “linux,foo”; [...] };

  • - overlay.dts (abbrev.) --

fragment@0 { target = <&foo0>; __overlay__ { bar0: bar@42 { compatible = “linux,bar”; }; }; };

slide-34
SLIDE 34
slide-35
SLIDE 35

seriously now, that’s pretty close to what we want, right?

slide-36
SLIDE 36

fpga area (still in dev) so DO NOT TRUST THE SLIDES

slide-37
SLIDE 37
  • - overlay.dts (abbrev.) --

fragment@0 { target = <&fpga_mgr0>; __overlay__ { area0: area@40000000 { compatible = “fpga-area”; firmware-name = “foo.bin”; c0: child@0 { compatible = “linux,foo” }; c1: child@4 { compatible = “linux,bar” }; }; }; };

will look somewhat like this

slide-38
SLIDE 38

discussion still ongoing, if you care about fpga join the discussion on lkml

slide-39
SLIDE 39

some open issues, but seem mostly solvable

slide-40
SLIDE 40

what if fpga is pass- through, i.e. soc spi routed through fabric out to a pin?

slide-41
SLIDE 41

notifiers? trying to let driver know device is gonna be gone for a bit

slide-42
SLIDE 42

fw subsystem doesn’t support (yet) streaming fw for wimpy systems

slide-43
SLIDE 43

buckle up … demo time

slide-44
SLIDE 44

if we got here, we’re probably out of time… questions?

slide-45
SLIDE 45

thanks to these guys

alan tull - fpga mgr core, socfpga driver, reviews gregkh - taking my patches pantelis antoniou - dt overlays michal simek - reviews, initial fpga mgr josh cartwright - reviews

slide-46
SLIDE 46
  • - foo.dts --

btn0: button@0 { compatible = “ettus, e3x0-button”; status = “disabled”; };

  • - overlay.dts (abbrev.) --

fragment@0 { target = <&btn0>; __overlay__ { status = “okay”; }; };

example to modify status property