Monday, 2021-02-15

*** tpb has joined #litex00:00
*** lf has quit IRC00:22
*** lf has joined #litex00:22
*** FFY00 has quit IRC01:16
*** FFY00 has joined #litex02:22
*** Degi_ has joined #litex03:48
*** Degi has quit IRC03:49
*** Degi_ is now known as Degi03:49
*** CarlFK has joined #litex04:14
*** key2 has quit IRC04:57
*** key2 has joined #litex04:57
*** Bertl_oO is now known as Bertl_zZ05:06
*** futarisIRCcloud has joined #litex05:18
*** cr1901_modern has quit IRC05:19
*** cr1901_modern has joined #litex05:44
*** CarlFK has quit IRC06:04
*** CarlFK has joined #litex06:23
*** CarlFK has quit IRC06:41
*** FFY00 has quit IRC06:41
*** futarisIRCcloud has quit IRC07:28
*** hansfbaier has joined #litex08:51
*** lkcl has quit IRC09:10
*** lkcl has joined #litex09:22
*** hansfbaier has quit IRC10:43
*** hansfbaier has joined #litex10:45
*** shorne has joined #litex11:51
shorneHello, I am looking at the linux kernel litex_mmc driver, https://github.com/litex-hub/linux/blob/litex-rocket-rebase/drivers/mmc/host/litex_mmc.c#L28111:54
shorneI noticed the performance on mor1kx arty is slow ~1.6mb/sec11:55
shorneI notice for the dma transfer we use: sg_copy_to_buffer(), which will slow things down, the alternative is to use dma channel's11:57
shorneI haven't implemented this before but I will look into to see how it will help, just want to mention it to get any feedback11:58
shorneI am not sure if there is a "real" dma engine with multiple programmable channels that can handle scatter gather12:11
_florent_Hi12:20
_florent_nickoe: would you mind creating an issue in litex with your notes/questions? this will be easier to answer12:21
_florent_shorne: we don't currently have scatter gather for the SDCard's DMA12:22
_florent_but if you think this is useful, I could have a look. It seems that currently the SDCard is a lot slower in Linux than with the BIOS, we should probably try to understand that first since the limitations seems to come from the software.12:25
*** Bertl_zZ is now known as Bertl12:50
*** lkcl has quit IRC12:57
*** lkcl has joined #litex13:09
*** hansfbaier has quit IRC13:39
somlo_florent_, shorne: after having stared at the Linux litesdcard driver for a loooong time, I can't find anything it's doing significantly different from what the LiteX bios does in terms of accessing the card, other than maybe the timing of the requests (although even disabling interrupts on a single-core soc around litex_request() doesn't seem to make a difference)13:40
somlolikely I'm missing something, but the litesdcard FSMs are timing out left and right when driven by the Linux driver, and seem happy and healthy when driven by the bios...13:43
*** mikeK_de1soc has joined #litex14:00
*** FFY00 has joined #litex14:03
somlo_florent_, shorne: https://github.com/enjoy-digital/litex/pull/820 should ensure that 1. we never timeout during sdcardboot (even on weird CPU configurations such as Rocket :) and 2. don't run into command timeouts with the LiteSDCard FSMs in single-block (cmd17-only) mode on the Linux driver14:36
somloThis should help stabilize the current linux driver for now at no extra penalty for any other sdcard use (larger timeout values don't actually slow down the sdcard FSMs when things work *well*, they just avoid unnecessary errors and retries in linux)14:38
somloI'm still trying to get to the bottom of why enabling cmd18 multi-block breaks horribly even with the larger timeouts14:38
somloand will open a separate issue once I have my ducks in a row (have to remember everything I tried and write down a coherent report)14:39
_florent_thanks @somlo, the PR looks fine, I'm going to merge it. For the issue with the Linux driver, I could do some capture of the SDCard signals with an external logic analyzer to try to understand the difference between the BIOS and Linux driver.14:43
somlo_florent_: thanks, that could be helpful! I've been studying the migen sources (and doing remedial learning on streams, as you are aware)14:52
somloI'm slow almost by definition -- anything I need to touch I need to learn from scratch, first :)14:52
_florent_That's a good approach that I also generally try to apply when time allows it :) (and your feedback while learning is very valuable).14:56
_florent_somlo: when  in Linux, can you tell me how you reproduce the timeouts easily? I could try on Arty with Linux-on-LiteX-VexRiscv14:57
somlo_florent_: https://github.com/litex-hub/linux/blob/litex-rebase/drivers/mmc/host/litex_mmc.c#L41514:59
somlochange max_blk_count to 214:59
somlothat will enable cmd-18 for reads15:00
somloI tried to document my understanding of how the mmc subsystem figures out everything else around that setting in the surrounding comments15:01
somloscatter/gather is off by default (as it should be, for now)15:02
*** futarisIRCcloud has joined #litex16:13
tmbinc_florent_: for programming the sds1104xe.bit, is setting the scope's jumper to "JTAG", then using openocd's "zynqpl_program"/"pld load" the right approach? (I've always used Xilinx tools before on Zynq)17:00
nickoe_florent_: Ok, I can try to do that.17:01
mithro_florent_: Do the Ibex pythondata packages look okay? https://github.com/enjoy-digital/litex/issues/695 ?17:28
*** shoragan has joined #litex17:28
*** mikeK_de1soc has quit IRC17:47
*** Bertl is now known as Bertl_oO18:36
*** mikeK_de1soc has joined #litex19:17
mikeK_de1soc_florent_: I was just wondering, Is the LiteVideo Currently working? I would like to use it for te DE1-SoC board. Thanks!19:34
shorne_florent_: I think the reason the sdcard is slower in linux is because of sg_copy_to_buffer(), I can't easily prove it now, I'llhave to think thow to profile the code in the driver.21:01
shorneIn the bios: https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/liblitesdcard/sdcard.c#L503-L510, the read/write can transfer the user buffer directly to the sdcard21:02
shorneto/from the sdcard21:02
shornein linux the driver gets a bunch of blocks in the scatter gather list, it then has to, in software, copy those into a dma buffer (with sg_copy_to_buffer) before sending to the sdcard (similar for reading).21:04
shornethat extra copy slows it down. is my assumption.  With a dma engine the hardware could handle the sg lists directly via queuing multiple small dma transactions.21:11
shorneThats what I gather from my investigatiion last mogjt reading the kernel code and some dma controller specs21:20
shorneJust found this, page 2 explains it pretty clearly https://www.intel.co.jp/content/dam/altera-www/global/ja_JP/pdfs/literature/hb/nios2/qts_qii55003.pdf21:20
_florent_tmbinc: if you generated the bistream with the target from litex-boards, you can also use --load (it uses VivadoProgrammer)21:31
_florent_tmbinc: I could provide you some test bistreams if you want to check your hardware (tomorrow)21:32
_florent_mithro: thanks for the pythondata repos, I'll have a closer look tomorrow and do the integration21:33
_florent_shorne: thanks interesting, do you know what's the general queue depth of usual scatter gather for similar cases? Implementing it should not be too complicated if you think this can be useful (just adding a FIFO for the queue)21:37
shorne_florent_: I am trying to figure that out too at the moment, I know they talk about having 32/64 channels, but I think that is for each device connected, the queue depth is separate21:38
mikeK_de1soc_florent_: Do you have an example of how to implement the liteVideo submodule?21:38
tmbinc_florent_: thanks - I've (now) noticed --load, and I'll check what Vivado does differently than my openocd setup. In neither case I could get UDP traffic working, maybe I should route the serial port to some physical pins first21:43
tmbinc(I didn't use --load but used hardware manager manually since I need a Xilinx Virtual Cable setup)21:44
shorne_florent_: it looks like some dma engines the command queue is even 1, and the queue is maintained per channel in the kernel side (readin r-car dma controller driver).21:56
shorneI can't find docs for that, I found docs for this https://www.nxp.com/docs/en/application-note/AN4522.pdf21:56
somlo_florent_, shorne: I think it's a bit worse than just lack of SG support -- the command timeout happens here in the litesdcard core: https://github.com/enjoy-digital/litesdcard/blob/master/litesdcard/core.py#L14221:57
somlowhich is before any data transfer comes into play21:57
shorneI will read more, maybe I can try programming a 1-channel dma engine for sdcard21:57
shorneI see21:57
shorneI didn't notice the timeouts21:58
shorneI will see if that is happening for me too21:58
shorneGot to go21:58
somloso while I agree SG will probably make it faster in the end, I'd like to understand why simply increasing the command, data, (and sure, DMA) timeouts in the linux driver to as huge as we can *still* won't make the errors go away :)21:58
somloI.e., I get a 2 (timeout) here: https://github.com/litex-hub/linux/blob/litex-rebase/drivers/mmc/host/litex_mmc.c#L12522:01
somlowhen I enable >1 max_blk_count in `probe`22:02
somloshorne: (for when you get back :) -- I think there's two problems: performance in linux, and an actual bona-fide *bug*22:04
somlomy first instinct to make it go faster was to allow multi-block transfers (e.g., cmd-18 for reads) by increasing max_blk_count22:04
somlowhich *should* work, but triggers the weird timeouts I've been running into (i.e., the bug) :)22:04
somloI think SG should help, but IMHO we should get the linux driver to work with multi-block transfers (18 for reads, 25 for writes)22:06
somlo* first :)22:06
somloand also IRQ support :)22:08
_florent_mikeK_de1soc: here is an example on Xilinx FPGAs: https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/soc_linux.py#L148-L18022:13
mikeK_de1soc_florent_: Many Thanks!22:13
_florent_you can find other examples in litex-buildenv, in the video targets: https://github.com/timvideos/litex-buildenv/blob/master/targets/atlys/video.py22:14
mikeK_de1socOK great!  BTW got the DE1-SoC Led chaser to work! https://youtu.be/bgpP9cWTnJQ22:16
_florent_tmbinc: were you pinging the board at 192.168.1.50? I could generate/test a bistream and then send if to you.22:16
_florent_somlo: yes sure, we first need to get rid of the timeout issue before looking for performance22:18
mikeK_de1soc_florent_: tim's buildenv, does not seem to have the Altera DE1 or DE10 boards in his repo, is it worth starting?22:22
tmbinc_florent_: Got it working - Ethernet only started working after I unplug it once, both Vivado->xvcd as well as openocd work for programming22:25
_florent_tmbinc: do you know/remember if there was something specific to be able to use the LCD of the  sds1104xe? I remember doing a very quick test last year but haven't got it working (also haven't spend too much time understanding), is is just vga? with the pins from https://github.com/360nosc0pe/siglent_hardware/blob/master/sds1104xe/fpga_pinout.txt#L13-L4822:27
tmbinc_florent_: I'll port over the stuff I had (will probably look rough :) regarding the DAC analog MUX and the other components to configure the frontend. I don't remember exactly but I remember we've been using PS SPI for PLL setup, I need to check if this can be done from PL side as well22:28
tmbinc_florent_: LCD was done by G33KatWork or q3k, I need to check22:28
tmbinc(it already worked when I started on it)22:29
_florent_tmbinc: ok good you got it working. So now basically you'll be able to control the SoC over UDP with litex_server22:29
tmbincyep - very nice! (Never worked on an ethernet-enabled litex device, so this is more friendly than I imagined :)22:30
_florent_just need to start the server with litex_server --udp and then execute your scripts to control your DAC registers22:30
_florent_A brief overview: https://github.com/enjoy-digital/litex/wiki/Use-Host-Bridge-to-control-debug-a-SoC22:30
tmbincThanks22:31
_florent_if you need to look at signals, you can also use Litescope over the bridge: https://github.com/enjoy-digital/litex/wiki/Use-LiteScope-To-Debug-A-SoC22:31
tmbincI need to adapt/rewrite  https://github.com/360nosc0pe/fpga/blob/master/py/lxwrap/offsetdac.py22:32
mikeK_de1socMAn,, that is insane!22:32
mikeK_de1socDrool..... I really want to get my DE1-SoC Video working...  still learning...22:33
_florent_tmbinc: looking at your code, I think you should be able to integrate it without modification (or maybe only minors)22:34
_florent_in your SoC:22:35
_florent_from offsetdac import OffsetDac22:35
_florent_self.submodules.offset_dac = OffsetDac()22:35
tmbincIs AutoCSR still a thing? My migen knowledge is... from 201422:35
_florent_self.add_csr("offset_dac")22:35
_florent_should do it22:35
_florent_yes22:36
_florent_I have to go, I could help more tomorrow if you have trouble integrating your old code22:37
tmbincMy duty cycle working on this will be small unfortunately but I'll see how far I get22:37
tmbincThanks for your help already!22:37
somlo_florent_, shorne: https://github.com/enjoy-digital/litesdcard/issues/2222:49

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!