[PATCH 0/3] Fixes for tval/tinst when using sbi_trap_redirect()
Anup Patel
apatel at ventanamicro.com
Thu Jun 9 01:51:59 PDT 2022
On Thu, Jun 9, 2022 at 12:37 PM dramforever <dramforever at live.com> wrote:
>
> I went through usages of sbi_trap_redirect() and saw some cases where
> after redirecting, stval/htinst could be set to incorrect values. I
> tried fixing what I noticed.
Overall, most fixes are in the right direction. I will review it soon.
>
> Note that these patches are *UNTESTED*.
>
> - For the htinst fixes, no current implementation (QEMU or Spike) of the
> hypervisor extension writes mtinst/htinst to non-zero values, so the
> code paths are unused.
Can you test this series with QEMU nested virtualization fixes which
include mtinst/htinst emulation ?
https://lore.kernel.org/all/20220609033011.752714-1-apatel@ventanamicro.com/
> - The sbi_get_insn() fix requires a rare occasion where the instruction
> is fetched normally then unmapped from memory before OpenSBI can load
> it again, and I have not been reproduce.
Yes, this case can happen but it is very rare and difficult to reproduce.
Regards,
Anup
>
> Please bear in mind when reviewing.
>
> dramforever (3):
> include: sbi: Add mtinst/htinst psuedoinstructions
> lib: sbi: Fixup tinst for exceptions in sbi_misaligned_*()
> lib: sbi: Fix tval and tinst for sbi_get_insn()
>
> include/sbi/riscv_encoding.h | 20 ++++++++++++++++++++
> lib/sbi/sbi_misaligned_ldst.c | 16 ++++++++++++++++
> lib/sbi/sbi_unpriv.c | 8 +++++---
> 3 files changed, 41 insertions(+), 3 deletions(-)
>
> --
> 2.36.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list