tpb has joined #litex
CarlFK has quit [Quit: Leaving.]
CarlFK has joined #litex
<xobs> florent (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...
<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.
<xobs> I'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.
<xobs> Okay, 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.
<xobs> I wonder if there's a caching issue here...
<xobs> Looks 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.
<xobs> Yeah, 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.
<sorear> why is the I/O space being cached in the first place?
<sorear> `fence.i` only affects instruction fetches and wouldn't be expected to help here
<xobs> I'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.
<sorear> risc-v is designed around the idea that your memory attributes are set correctly and cache flushing is not a thing
<sorear> only caches that are entirely transparent to software are supportable
<xobs> Interesting. So how do I indicate a region shouldn't be cached?
<_florent_> xobs: is there something else specific with your SoC/use-case? is it only when having debug enabled?
<xobs> florent: ill have to check about the debug mode.
<xobs> But how does litex indicate to vex that a particular region shouldn't be cached?
<_florent_> In the SoC, we have the shadow_base, but i how to check how this information is passed to vexriscv
<xobs> Just to check: have others gotten "linux+debug" and/or "linux" to work with the uart?
<_florent_> xobs: for linux yes, not sure we tested linux+debug
<xobs> _florent_: alright, thanks. I'm not using an socsdram, so there's no L2 cache. Would that affect anything?
<_florent_> xobs: if i do: lxsim --cpu-type=vexriscv --cpu-variant=std
<_florent_> it's working correctly
<_florent_> but lxsim --cpu-type=vexriscv --cpu-variant=linux
<tpb> Title: Snippet | IRCCloud (at www.irccloud.com)
<_florent_> is not and is stuck just after ^
<_florent_> do you have a similar behaviour?
<_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 works
<tpb> Title: linux-on-litex-vexriscv/soc_linux.py at master · litex-hub/linux-on-litex-vexriscv · GitHub (at github.com)
<xobs> florent: no, the behavior I see is it just prints a few underscores and then gets stuck in the isr.
<xobs> So 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.
<_florent_> ah ok, i already saw that then
<xobs> Already saw that?
<_florent_> yes with a wrong mem_map/shadow_base
<_florent_> are you able to share your SoC/CPU, i could do a test in simulation
<xobs> Oh. So you've seen the issue, and fixing the mem_map works around it?
<xobs> The design is at https://github.com/xobs/haddecks/blob/master/haddecks.py but that's three days old. Not much has changed.
<tpb> Title: haddecks/haddecks.py at master · xobs/haddecks · GitHub (at github.com)
<xobs> Alright, it kind of makes sense that assigning the csr to a high address fixes it. Thanks for the feedback!
<xobs> I'm still curious how to indicate to vex that a region is uncached.
<xobs> Also, is it possible to use the L2 cache in front of the spi ram module I have? Or does it basically assume sdram?
<_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)
<xobs> So maybe it's the mmu and not the dcache.
<tpb> Title: VexRiscv-verilog/GenCoreDefault.scala at master · m-labs/VexRiscv-verilog · GitHub (at github.com)
<_florent_> xobs: it seems cached/uncached regions are just defined in VexRiscv with ioRange (uncached = io)
<xobs> Oh! That's what that does. Then that totally explains it. The regions are hardcoded and the defaults put them in the wrong spot.
<xobs> Thanks! I'm confident that remapping ram will fix things.
<xobs> I should remap them in Fomu, too.
<xobs> I wonder. Does that mean they're not subject to mmu access controls?
<_florent_> xobs: when looking at VexRiscv source code, it seems to be subject to mmu access controls:
<tpb> Title: VexRiscv/MmuPlugin.scala at master · SpinalHDL/VexRiscv · GitHub (at github.com)
<tpb> Title: VexRiscv/MmuPlugin.scala at master · SpinalHDL/VexRiscv · GitHub (at github.com)
<_florent_> so you first translate
<tpb> Title: VexRiscv/MmuPlugin.scala at master · SpinalHDL/VexRiscv · GitHub (at github.com)
<xobs> That'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.
<xobs> Thanks for tracking that down, _florent_! I've learned something today about vex and riscv.
<_florent_> That was also instructive for me, i should really spend more time studying VexRiscv code
<xobs> Ah, I see why I don't have the issue with foboot - I already hardcoded the memory addresses to the ones you provided.
<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.
_whitelogger has joined #litex
freemint has quit [Ping timeout: 245 seconds]
freemint has joined #litex
freemint has quit [Remote host closed the connection]
freeemint has joined #litex
xobs has quit [Read error: Connection reset by peer]
synaption[m] has quit [Read error: Connection reset by peer]
john_k[m] has quit [Remote host closed the connection]
nrossi has quit [Read error: Connection reset by peer]
CarlFK has quit [Quit: Leaving.]
xobs has joined #litex
<xobs> florent: that did solve the problem, thanks!
synaption[m] has joined #litex
nrossi has joined #litex
john_k[m] has joined #litex
CarlFK has joined #litex
<_florent_> xobs: ok great, thanks for the feedback
freeemint has quit [Remote host closed the connection]
freeemint has joined #litex
freeemint has quit [Ping timeout: 246 seconds]
freeemint has joined #litex
freeemint has quit [Ping timeout: 245 seconds]
freeemint has joined #litex
freeemint has quit [Remote host closed the connection]
freeemint has joined #litex
freeemint has quit [Ping timeout: 245 seconds]
freeemint has joined #litex
freeemint has quit [Ping timeout: 250 seconds]
CarlFK has quit [Quit: Leaving.]
freeemint has joined #litex
tpb has quit [Remote host closed the connection]