riscvarchive / riscv-qemu

QEMU with RISC-V (RV64G, RV32G) Emulation Support
384 stars 154 forks source link

riscv-qemu PMP function revise #172

Closed wxjstz closed 5 years ago

wxjstz commented 5 years ago

I tried to test the PMP function of qemu and passed my test case. But I found that the mainline code has been updated and I tried to merge failed.

My code is located at: https://github.com/wxjstz/riscv-qemu/tree/qemu-for-testing.pmp

michaeljclark commented 5 years ago

I've merged your changes and my changes here:

I've rolled back some of my changes and included several of yours. I don't think we need to scan twice for the TLB fix, instead we can pass both the request size and the TLB size (inout), and adjust the TLB size down if the matches rule is smaller than the initial TLB size (PAGE_SIZE), given the priority and rule matching logic dictates the first matching rule must be selected, we know that if the rule is within the the boundaries of a page, then we must return a smaller TLB size. Also we can short-circuit given we correctly handle discontiguous rules.

These branches are stable, and only move forward, so if you base patches on these branches, then you won't get merge failures, however they are behind:

These branches are future, due to the nature or upstream, such as the need to add Reviewed-by and Signed-off-by, these branches will be rebased to incorporate patch review feedback and rebase against upstream changes:

We need more open source test cases. If you can share some that would be great!