diff options
author | LIU Zhiwei <zhiwei_liu@linux.alibaba.com> | 2022-10-12 14:00:16 +0800 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2023-01-06 10:42:55 +1000 |
commit | 824cac681c3e2a6ac2d661c86befd7c36359c924 (patch) | |
tree | 1a0cc7fc02b7fc7b0ebcf40f9c29c1a81fb39eb4 /tcg/riscv/tcg-target.c.inc | |
parent | d1852caab131ea898134fdcea8c14bc2ee75fbe9 (diff) | |
download | qemu-824cac681c3e2a6ac2d661c86befd7c36359c924.zip qemu-824cac681c3e2a6ac2d661c86befd7c36359c924.tar.gz qemu-824cac681c3e2a6ac2d661c86befd7c36359c924.tar.bz2 |
target/riscv: Fix PMP propagation for tlb
Only the pmp index that be checked by pmp_hart_has_privs can be used
by pmp_get_tlb_size to avoid an error pmp index.
Before modification, we may use an error pmp index. For example,
we check address 0x4fc, and the size 0x4 in pmp_hart_has_privs. If there
is an pmp rule, valid range is [0x4fc, 0x500), then pmp_hart_has_privs
will return true;
However, this checked pmp index is discarded as pmp_hart_has_privs
return bool value. In pmp_is_range_in_tlb, it will traverse all pmp
rules. The tlb_sa will be 0x0, and tlb_ea will be 0xfff. If there is
a pmp rule [0x10, 0x14), it will be misused as it is legal in
pmp_get_tlb_size.
As we have already known the correct pmp index, just remove the
remove the pmp_is_range_in_tlb and get tlb size directly from
pmp_get_tlb_size.
Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20221012060016.30856-1-zhiwei_liu@linux.alibaba.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'tcg/riscv/tcg-target.c.inc')
0 files changed, 0 insertions, 0 deletions