chipsalliance / dromajo

RISC-V RV64GC emulator designed for RTL co-simulation
Apache License 2.0
210 stars 63 forks source link

Console input is insanely slow #36

Open et-tommythorn opened 3 years ago

et-tommythorn commented 3 years ago

I haven't yet looked into why, but keyboard input takes seconds to arrive which seems far slower than the rest of the execution speed. This looks like a bug.

et-tommythorn commented 3 years ago

Ok, the UART model is not complete and in particular the lack of interrupt support is (presumedly) the root of this. I started fixing it, but ratholed into a complete rewrite.

et-tommythorn commented 3 years ago

I enhanced the UART model (8250) to support interrupts, but it exposed what appears to be a deeper issue with interrupts. Still working on this (and might be related to why virtio isn't working)

et-tommythorn commented 2 years ago

Not technically related to serial input, but after much debugging I have found that on kernel 4.15 virtio console in tinyemu worked and doesn't in 5.12. This will affect Dromajo the same and may be a more general virtio issue. One option is to bisect linux and try to find out what changed.

et-tommythorn commented 2 years ago

Progress:

  1. By dialing down the timebase-frequency to 2000 in the device tree, the interactive session is mostly usable. It's not fully understood, but it's possible Dromajo has a bug in how it advances the clock tick.
  2. The PLIC is broken. Fix is forthcoming.
et-tommythorn commented 2 years ago

PLIC fixed and the actual issue here is that we had set the frequency way too high for simulation. Fix forthcoming.

et-tommythorn commented 1 year ago

With commit a936f7d we need just a few things to close this bug: the PLIC configuration appears to have been wrong all this time and shouldn't use intr 11 (commit pending), periodic polling of UARTs is required, and finally setting the console=ttyS0,115200 in the cmdline.