From: "Edgar E. Iglesias" <edgar.igles...@amd.com> This fixes an issue with grant mappings when a read-only mapping is requested followed by a read-write mapping for the same page. Today, we don't track write-ability and read-write lookups hit on read-only entries.
This series is an attempt to fix this by splitting mapcache_grants in two, a read-only and a read-write instance. I tried a couple of other approaches, one was to speculatively map grants as read-write and if mapping fails, then fall back to read-only. This works but since Xen logs each failed grant mapping, it gets noisy. Another way is to track writeability per mapping in the cache and modify the lookup logic to only hit on compatible mappings. It works but adds more complexity to the lookup logic compared with the split cache approach. https://gitlab.com/edgar.iglesias/qemu/-/commits/edgar/grants-ro-rw-fix Cheers, Edgar Edgar E. Iglesias (1): xen: mapcache: Split mapcache_grants by ro and rw hw/xen/xen-mapcache.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) -- 2.43.0