Skip to contentSkip to conversation

target/riscv: Fix page_check_range use in fault-only-first

PATCH Applied LIU Zhiwei 3 participants 4 messages Jul 29, 2023 – Aug 2, 2023 RISC-V

lore
Share & tools
lore

LIU Zhiwei

author
#0 lore raw

PATCH 1/1 target/riscv: Fix page_check_range use in fault-only-first

Commit bef6f008b98(accel/tcg: Return bool from page_check_range) converts integer return value to bool type. However, it wrongly converted the use of the API in riscv fault-only-first, where page_check_range < = 0, should be converted to !page_check_range.

---
 target/riscv/vector_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/vector_helper.c +1 -1
index 4d06754826..a059ef3900 100644
@@ -583,7 +583,7 @@ vext_ldff(void *vd, void *v0, target_ulong base,
                                          cpu_mmu_index(env, false));
                 if (host) {
 #ifdef CONFIG_USER_ONLY
-                    if (page_check_range(addr, offset, PAGE_READ)) {
+                    if (!page_check_range(addr, offset, PAGE_READ)) {
                         vl = i;
                         goto ProbeSuccess;
                     }
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · LIU Zhiwei

Commit bef6f008b98(accel/tcg: Return bool from page_check_range) converts integer return value to bool type. However, it wrongly converted the use of the API in riscv fault-only-first, where page_check_range < = 0, should be converted to !page_check_range.

---
  target/riscv/vector_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

As far as it goes,

though the test will never fail, because tlb_vaddr_to_host just succeeded.

r~

author
#2 lore raw
Quoted 11 lines · Richard Henderson
Quoted 9 lines · LIU Zhiwei

Commit bef6f008b98(accel/tcg: Return bool from page_check_range) converts integer return value to bool type. However, it wrongly converted the use of the API in riscv fault-only-first, where page_check_range < = 0, should be converted to !page_check_range.

---
  target/riscv/vector_helper.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines

As far as it goes,

though the test will never fail, because tlb_vaddr_to_host just succeeded.

It fails one test case in linux-user mode, where tlb_vaddr_to_host always succeeded.

Zhiwei

Quoted 3 lines

r~

#3 lore raw
In reply to LIU Zhiwei
Quoted 7 lines · LIU Zhiwei

Commit bef6f008b98(accel/tcg: Return bool from page_check_range) converts integer return value to bool type. However, it wrongly converted the use of the API in riscv fault-only-first, where page_check_range < = 0, should be converted to !page_check_range.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 21 lines
---
 target/riscv/vector_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/vector_helper.c +1 -2
index 4d06754826..a059ef3900 100644
@@ -583,7 +583,7 @@ vext_ldff(void *vd, void *v0, target_ulong base,
                                          cpu_mmu_index(env, false));
                 if (host) {
 #ifdef CONFIG_USER_ONLY
-                    if (page_check_range(addr, offset, PAGE_READ)) {
+                    if (!page_check_range(addr, offset, PAGE_READ)) {
                         vl = i;
                         goto ProbeSuccess;
                     }
--

2.17.1