Draft: RFC: Page table walker and example sanity checker
Before I move further in this direction, I wanted to get some feedback on this design. This is really part of #111 (closed) where we'd like to avoid using 64K mappings for system and use the best available mapping for the dma addresses used. Also for system. In particular we want to be able to mix the compact 64K layout for level0 pts with the mixed-4K-64K level0 layout where needed, preferring the compact layout where possible.
I ended up with a general page-table walker similar to and inspired by the cpu one in mm/pagewalk.c and an example user that sanity checks the page-table of a newly bound vma. As can be seen it's fairly straightforward and callback based and there is no need for much special-casing around partial page-tables. I think this could be easily extended to replace __xe_pt_prepare_bind and xe_pt_populate_for_vma() and possibly other functions if there is a gain.
We'd then wouldn't need special flags to choose whether to use 64K PTEs or not. They'd be automatically used if possible, even for system. We'd have to add a check that we by accident never bind 64K-requiring VRAM to 4K, though.
Feedback, and comments appreciated. Note that the sanity checker is only an example.