qshinoの日記

Powershell関係と徒然なこと

Xavierはじめ

背景

何故かXavier があったので、使ってみようかと。

用途

pcie epになるらしく情報収集。

xavier上のgpuはデバイスとして見えず、メモリデバイスとして見える。このメモリデバイスで何をする?

単純なGPUプールとならず、専用構成。

host - driver - pcirp - pciep - mem - driver

用途としては、

  1. mpi で計算
  2. gst plugin でパイプ処理

ぐらいかな。

gst shmsrc/sink

https://stackoverflow.com/questions/40260580/gstreamer-shmsrc-and-shmsink-with-h264-data

shmドライバを作れば使える?

メモリデバイスドライバrp/ep

メモリデバイス機能があるらしく、まずはrp/ep用ドライバ

  • ch dev?
  • blk dev?
  • eth nvdia pio mode version

通信機能

  • tx/rx buf
  • buf management
  • device management
  • msi / intr : dev to host
  • signal to dev
  • ordering

とりあえず、基本機能は、

  • queue
  • lock, semaphore
  • shared mem
  • process management

嫌らしいのは、両側で作る必要がある所。host 制御ベースで手を抜きたい。

ホストは、queueにデータを積んで、結果を待つ。

バイスは、queueからデータを取りだし、結果をホストに送る。

バイスへの実行コードを送る為には、ファイルシステムを使いたいので、LAN経由で送る?

LANとpcieの機能分割を上手く設計する。

  • LAN: 制御系
  • pcie: データ系

機能ドライバ

pcie直結メリットはレイテンシと帯域。

  • send/receive?
  • ring buffer for video stream gst - mem - gst

インストール

やりたくたくないが、これが無いと始まらない。

画面はdp to dvi、kbdはusbaコネクタ、添付のusbc to a変換ケーブルで母艦とフロントusbc、lanを繋いで最後にac cable。マイクロsdカードを早目に確保しないとemmc 32gbでは直ぐに容量不足になりそう。

インストールはざっくり4ステップ

  1. 母艦にjetpack4.2をdl
  2. 母艦にインストール
  3. リカバリモードで、フロントusbc経由のxavier flash/emmc書き込み
  4. xavier へlan経由のsshで追加インストール

細かい手順

1.ホストPCとJetson AGX Xavierの電源の反対側にあるUSB-Cと接続されていることを確認。
2.電源アダプタがコンセントとJetson AGX Xavierと接続できていることを確認。
3.電源ボタン(3つ並んでいるボタンの一番左)を押して電源をONにする。
4.以下でJetson AGX Xavierをforce recovery mode(強制回復モード)にする。
•Force recovery ボタン(3つ並んでいるボタンの真ん中)を押下し続ける。
•リセットボタン(3つ並んでいるボタンの右側)を単押し(押して離す)をする。
•2秒後にForce recoveryボタンを離す。
5.最後にエンターキーを押すと書き込みが開始する。

次はpcieのep化

できると言うコメント。

https://devtalk.nvidia.com/default/topic/1043719/jetson-agx-xavier/is-jetson-xavier-inter-board-pcie-connection-possible/

下記のデータシートはログインが必要。

http://developer.nvidia.com/embedded/dlc/jetson-xavier-data-sheet

ep configuration

vidyas

Which controller would you like to use in endpoint mode?
FWIW, there are three controllers C0, C4 and C5 which can operate in end point mode (one at a time) and corresponding device-tree nodes are already available. Please enable
pcie_ep@14180000 for C0
pcie_ep@14160000 for C4
pcie_ep@141a0000 for C5
and disable their corresponding root port nodes
There is a platform driver (pcie-tegra-dw-ep.c) available to configure controller for endpoint mode of operation and also a client driver (tegra-pcie-ep-mem.c) to exercise the DMA functionality of end point controller. You can write your own client driver to satisfy your requirements and modify platform driver also accordingly.
Does it work like this:
1. I take tegra-pcie-ep-mem.c, compile it in X86 host.
2. get pcie-tegra-dw-ep.c to work on Xavier
3. hook it up via some kinds of pcie cable.
4. then I will be able to read/write xavier from X86 side?

Yes. It would work. Please make sure that the cable you are using would route Tx from one end to Rx of another end. Also, since Xavier is self powered, there is no need to supply power from x86 to Xavier(EP)

If Xavier can work in endpoint mode, does that mean I can wire PC PCIE directly to Xavier PCIE ? Maybe through own carrier board design or through Molex cable/PCIE card?
Yes

BTW, which controller of three is used as RC to link to GPU? If I configure this controller to EP mode, what will happen? GPU can't work properly?
As far as I know, GPU is not supplied by default. So, whichever controller you have planning to connect GPU to cannot be operated in endpoint mode. Dual mode controller can work either in root port mode or endpoint mode but only one at a time (mutually exclusive)
Once a controller is configured to operate in endpoint mode, you can reserve memory to be exposed through EP's BAR to host and thereby letting host (in this case x86) be able to directly write to Xavier's system memory. (OR) Xavier-EP's internal DMA engine can be used to push/pull data to/from x86's system memory (this is like how a typical PCIe endpoint works). You can go through Xavier TRM to learn more about it and also device tree documentation on how EP can be configured through device-tree entries.

https://devtalk.nvidia.com/default/topic/1039469/jetson-agx-xavier/how-another-cpu-communicate-with-xavier-through-pcie-solved-/

next page

kernel/nvidia$ find -iname "pcie-tegra-dw-ep.c" 
./drivers/pci/ep/pcie-tegra-dw-ep.c

#27

Posted 05/15/2019 04:36 AM   

WayneWWW

No idea what is your problem now.

Please refer to 


https://devtalk.nvidia.com/default/topic/1050616/jetson-agx-xavier/the-bandwidth-of-of-virtual-ethernet-over-pcie-between-two-xaviers-is-low/1

#28

Posted 05/17/2019 02:45 AM   

https://devtalk.nvidia.com/default/topic/1039469/jetson-agx-xavier/how-another-cpu-communicate-with-xavier-through-pcie-solved-/2

virtual ethernet on pcie

現状のvnetはpio modeで実装されており、100mbps程度の性能。

https://devtalk.nvidia.com/default/topic/1050616/jetson-agx-xavier/the-bandwidth-of-of-virtual-ethernet-over-pcie-between-two-xaviers-is-low/1

pcie dma test

パッチを当てて試験する手順書。

素晴らしい!

https://devtalk.nvidia.com/default/topic/1050616/jetson-agx-xavier/the-bandwidth-of-of-virtual-ethernet-over-pcie-between-two-xaviers-is-low/2

ep 側lspci

0005:01:00.0 RAM memory: NVIDIA Corporation Device 1ad5
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- Dis+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- I-
Latency: 0
Interrupt: pin A routed to IRQ 595
Region 2: Memory at 1c00000000 (64-bit, prefetchable) [size=128K]
Region 4: Memory at <unassigned> (64-bit, non-prefetchable)
Capabilities: <access denied>
Kernel driver in use: tegra_ep_mem

pcie connection

https://www.google.com/url?sa=t&source=web&rct=j&url=http://karekinada.na.coocan.jp/Jetson/Xavier.doc/EndPoint/index_jp.html&ved=2ahUKEwjYqu2G-aTiAhXKG6YKHQ2YBRwQFjAHegQIARAB&usg=AOvVaw339j6UptIY-LChQtnyxlU4

https://devtalk.nvidia.com/default/topic/1042223/jetson-agx-xavier/xavier-pcie-endpoint-mode/

概要

https://elinux.org/Jetson_AGX_Xavier