Skip to content

Commit

Permalink
accel/tcg: Fix start page passed to tb_invalidate_phys_page_range__lo…
Browse files Browse the repository at this point in the history
…cked

Due to a copy-paste error in tb_invalidate_phys_range, the wrong
start address was passed to tb_invalidate_phys_page_range__locked.
Correct is to use the start of each page in turn.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: e506ad6 ("accel/tcg: Pass last not end to tb_invalidate_phys_range")
Message-Id: <20230629082522.606219-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 3307e08)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
mcayland authored and Michael Tokarev committed Jul 2, 2023
1 parent 477ab90 commit 78e8c9c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions accel/tcg/tb-maint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,15 +1183,17 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t last)
index_last = last >> TARGET_PAGE_BITS;
for (index = start >> TARGET_PAGE_BITS; index <= index_last; index++) {
PageDesc *pd = page_find(index);
tb_page_addr_t bound;
tb_page_addr_t page_start, page_last;

if (pd == NULL) {
continue;
}
assert_page_locked(pd);
bound = (index << TARGET_PAGE_BITS) | ~TARGET_PAGE_MASK;
bound = MIN(bound, last);
tb_invalidate_phys_page_range__locked(pages, pd, start, bound, 0);
page_start = index << TARGET_PAGE_BITS;
page_last = page_start | ~TARGET_PAGE_MASK;
page_last = MIN(page_last, last);
tb_invalidate_phys_page_range__locked(pages, pd,
page_start, page_last, 0);
}
page_collection_unlock(pages);
}
Expand Down

0 comments on commit 78e8c9c

Please sign in to comment.