Hi Himanshu, On 11/6/2026 9:45 PM, Himanshu Chauhan wrote: > Per the Sdtrig specification, on a breakpoint exception with icount, the > xepc must contain the virtual address of the next instruction that must > be executed to preserve the program flow. > > Since SBI DBTR exposes these trigger encodings to supervisor software, an > icount trigger used as a one-instruction step must fire only after the > counted instruction retires and the architectural successor PC is known, > which for a taken branch is the branch target, not the trigger install > address or fallthrough. > > QEMU previously disabled the translated-block trigger flag when icount was > enabled and relied on timer and privilege-change callbacks to update the > count, so the trigger could fire outside instruction retirement before the > guest PC advanced, causing Linux to observe the old PC and re-enter the same > breakpoint while single-stepping with icount. > > Fix this by > - publishing the icount trigger flag in translated blocks even with > icount enabled > - making the helper decrement the trigger count after the > instruction has committed its successor PC and raise the trigger > action only then > - privilege-change callbacks refresh cached enabled state because itriggers > tied to privilege mode. > > Also make trigger data CSR availability depend on an implemented trigger slot > rather than the currently selected trigger type, so software can disable a > trigger with type zero and still write the rest of the slot state before > selecting another supported type. > > itrigger timers are completely removed as they are not required now. > > Signed-off-by: Himanshu Chauhan <[email protected]> > --- > target/riscv/cpu.h | 5 +- > target/riscv/tcg/cpu_helper.c | 10 +- > target/riscv/tcg/debug.c | 169 ++++++++++------------------------ > target/riscv/tcg/tcg-cpu.c | 7 +- > 4 files changed, 59 insertions(+), 132 deletions(-) >
it could be a good idea to repost including concerned maintainers/devs. At least, you want Alistair, the riscv maintainer, and Daniel Barboza, which works on riscv support at Qualcomm too. A simple way is to use git-publish (https://github.com/stefanha/git-publish), which will automate all the steps, and build the recipients list for you. Regards, Pierrick
