Monday, 2019-10-07

*** tpb has joined #litex00:00
*** CarlFK has quit IRC02:17
*** CarlFK has joined #litex03:13
xobsflorent (or anyone else): have you ever encountered an issue where the UART rx IRQ gets stuck?  I'm trying to get litescope working so I can get a better idea of why...04:26
xobs...but the symptoms are that the ISR is constantly running, and the UART_EV_STATUS bit is permanently stuck on 2.  Disabling that IRQ fixes it, though.04:27
xobsI'm sorry, it's the "tx" bit. Hmm... maybe this is a software problem in the bios.  If I manually clear that register, then it prints out more data, but it looks like the actual buffer contents are dropped.04:36
xobsOkay, that's just bizarre.  It's doing `lw a5,0(a5)` with `a5=0x82001810`.  In the debugger, this returns `1` (i.e. "tx bit set"), but the CPU is actually seeing this as `0`.  If I change the return value to `1` then it works better.05:17
xobsI wonder if there's a caching issue here...05:17
xobsLooks like it.  If I use my own CPU (which has a cache) or linux+debug, then I get the failure.  If I use "min+debug" it works.05:25
xobsYeah, my theory is that the dcache isn't getting flushed.  It's either that or the mmu (which isn't used) is causing issues.  But I definitely can tell that the CPU is not seeing what's actually going on, even if I stick a `fence.i` in there.05:55
sorearwhy is the I/O space being cached in the first place?06:00
sorear`fence.i` only affects instruction fetches and wouldn't be expected to help here06:00
xobsI'm not sure the vexriscv knows which space is which.  I thought the high bit prevented it from being cached, but AIUI that's only if you're using the L2 cache.06:01
sorearrisc-v is designed around the idea that your memory attributes are set correctly and cache flushing is not a thing06:20
sorearonly caches that are entirely transparent to software are supportable06:20
xobsInteresting. So how do I indicate a region shouldn't be cached?06:22
_florent_xobs: is there something else specific with your SoC/use-case? is it only when having debug enabled?06:23
xobsflorent: ill have to check about the debug mode.06:24
xobsBut how does litex indicate to vex that a particular region shouldn't be cached?06:25
_florent_In the SoC, we have the shadow_base, but i how to check how this information is passed to vexriscv06:26
xobsJust to check: have others gotten "linux+debug" and/or "linux" to work with the uart?06:28
_florent_xobs: for linux yes, not sure we tested linux+debug06:29
xobs_florent_: alright, thanks. I'm not using an socsdram, so there's no L2 cache. Would that affect anything?06:30
_florent_xobs: if i do: lxsim --cpu-type=vexriscv --cpu-variant=std06:33
_florent_it's working correctly06:33
_florent_but lxsim --cpu-type=vexriscv --cpu-variant=linux06:33
_florent_https://www.irccloud.com/pastebin/0nNjaGYS/06:34
tpbTitle: Snippet | IRCCloud (at www.irccloud.com)06:34
_florent_is not and is stuck just after ^06:34
_florent_do you have a similar behaviour?06:34
_florent_but we have using a specific mem-map in linux-on-litex-vexriscv: https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/soc_linux.py#L45-L52 which makes it works06:35
tpbTitle: linux-on-litex-vexriscv/soc_linux.py at master · litex-hub/linux-on-litex-vexriscv · GitHub (at github.com)06:35
xobsflorent: no, the behavior I see is it just prints a few underscores and then gets stuck in the isr.06:36
xobsSo when I get the device back, I'll check to see if it works with debug disabled, then I'll check to see if the "std" cpu works. Then I'll see if reassigning the memory map helps.06:38
_florent_ah ok, i already saw that then06:38
xobsAlready saw that?06:40
_florent_yes with a wrong mem_map/shadow_base06:41
_florent_are you able to share your SoC/CPU, i could do a test in simulation06:41
xobsOh. So you've seen the issue, and fixing the mem_map works around it?06:42
xobsThe design is at https://github.com/xobs/haddecks/blob/master/haddecks.py but that's three days old. Not much has changed.06:45
tpbTitle: haddecks/haddecks.py at master · xobs/haddecks · GitHub (at github.com)06:45
xobsAlright, it kind of makes sense that assigning the csr to a high address fixes it. Thanks for the feedback!06:46
xobsI'm still curious how to indicate to vex that a region is uncached.06:47
xobsAlso, is it possible to use the L2 cache in front of the spi ram module I have? Or does it basically assume sdram?06:48
_florent_i think your issue is the same i see with the simulation, just that the behaviour is a bit different on real hardware vs simulation (the simulation is able to output more characters)06:49
xobsSo maybe it's the mmu and not the dcache.07:04
_florent_xobs: then maybe have a look at this: https://github.com/m-labs/VexRiscv-verilog/blob/master/src/main/scala/vexriscv/GenCoreDefault.scala#L139-L14307:08
tpbTitle: VexRiscv-verilog/GenCoreDefault.scala at master · m-labs/VexRiscv-verilog · GitHub (at github.com)07:08
_florent_xobs: it seems cached/uncached regions are just defined in VexRiscv with ioRange (uncached = io)07:08
xobsOh! That's what that does. Then that totally explains it. The regions are hardcoded and the defaults put them in the wrong spot.07:11
xobsThanks! I'm confident that remapping ram will fix things.07:12
xobsI should remap them in Fomu, too.07:14
xobsI wonder. Does that mean they're not subject to mmu access controls?07:16
_florent_xobs: when looking at VexRiscv source code, it seems to be subject to mmu access controls:07:30
_florent_https://github.com/SpinalHDL/VexRiscv/blob/master/src/main/scala/vexriscv/plugin/MmuPlugin.scala#L12407:30
tpbTitle: VexRiscv/MmuPlugin.scala at master · SpinalHDL/VexRiscv · GitHub (at github.com)07:30
_florent_https://github.com/SpinalHDL/VexRiscv/blob/master/src/main/scala/vexriscv/plugin/MmuPlugin.scala#L13107:30
tpbTitle: VexRiscv/MmuPlugin.scala at master · SpinalHDL/VexRiscv · GitHub (at github.com)07:30
_florent_so you first translate07:31
_florent_and the check is done here: https://github.com/SpinalHDL/VexRiscv/blob/master/src/main/scala/vexriscv/plugin/MmuPlugin.scala#L13807:31
tpbTitle: VexRiscv/MmuPlugin.scala at master · SpinalHDL/VexRiscv · GitHub (at github.com)07:31
xobsThat's really well designed. I guess riscv must have a concept of an io region that is defacto uncached. That's different coming from arm.07:44
xobsThanks for tracking that down, _florent_! I've learned something today about vex and riscv.07:49
_florent_That was also instructive for me, i should really spend more time studying VexRiscv code07:51
xobsAh, I see why I don't have the issue with foboot - I already hardcoded the memory addresses to the ones you provided.09:00
xobs_florent_: I was getting ready to use litescope, and I found an issue in wishbone-tool where it doesn't support transfers with more than one word. So that's another yak to shave! But that's really a thing I should have already fixed.09:03
*** _whitelogger has quit IRC10:57
*** _whitelogger has joined #litex11:00
*** freemint has quit IRC12:12
*** freemint has joined #litex13:12
*** freemint has quit IRC14:13
*** freeemint has joined #litex14:13
*** xobs has quit IRC14:19
*** synaption[m] has quit IRC14:19
*** john_k[m] has quit IRC14:19
*** nrossi has quit IRC14:19
*** CarlFK has quit IRC15:18
*** xobs has joined #litex16:31
xobsflorent: that did solve the problem, thanks!16:37
*** synaption[m] has joined #litex16:52
*** nrossi has joined #litex16:52
*** john_k[m] has joined #litex16:53
*** CarlFK has joined #litex16:55
_florent_xobs: ok great, thanks for the feedback17:33
*** freeemint has quit IRC17:35
*** freeemint has joined #litex17:35
*** freeemint has quit IRC18:34
*** freeemint has joined #litex19:19
*** freeemint has quit IRC19:44
*** freeemint has joined #litex19:44
*** freeemint has quit IRC19:55
*** freeemint has joined #litex19:56
*** freeemint has quit IRC21:36
*** freeemint has joined #litex22:17
*** freeemint has quit IRC22:22
*** CarlFK has quit IRC22:28
*** freeemint has joined #litex23:33

Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!