On Fri, Aug 11, 2023, Yahya Sohail wrote: > Hi, > > Accesses to certain memory addresses by the guest trigger a KVM_EXIT_MMIO. I > can't seem to find a memory map in the documentation or source that > describes exactly which addresses are real memory and which addresses are > MMIO addresses (on x86, if that matters). Is there any such documentation or > a listing in the source? > > Is there any way to configure which addresses are MMIO? I hoped that mapping > memory to MMIO address regions with the KVM_SET_USER_MEMORY_REGION ioctl > would allow me to use them as memory, but that didn't work. The only ioctls > that seem relevant to MMIO are KVM_(UN)REGISTER_COALESCED_MMIO, but those > only allow coalescing MMIO exits, not changing which addresses cause them. KVM_EXIT_MMIO is for *emulated* MMIO, and is triggered by a guest access to non-existent memory from the guest's (and KVM's) perspective. Specifically, if the guest accesses a GPA that is not covered by a memslot. Mapping a "real" host MMIO address into a guest via KVM_SET_USER_MEMORY_REGION will not generate KVM_EXIT_MMIO, as KVM will simply map the "real" MMIO directly into the guest. There is no KVM documentation of a memory map or real vs. emulated addresses because what is real and what is emulated is completely userspace defined (except for the local APIC and/or I/O APIC if userspace enables KVM's "in-kernel" APIC emulation).