All of lore.kernel.org
 help / color / mirror / Atom feed
* VM Memory Map
@ 2023-08-11 17:04 Yahya Sohail
  2023-08-11 18:07 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Yahya Sohail @ 2023-08-11 17:04 UTC (permalink / raw)
  To: kvm

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.

Thanks,
Yahya Sohail

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: VM Memory Map
  2023-08-11 17:04 VM Memory Map Yahya Sohail
@ 2023-08-11 18:07 ` Sean Christopherson
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2023-08-11 18:07 UTC (permalink / raw)
  To: Yahya Sohail; +Cc: kvm

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).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-11 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 17:04 VM Memory Map Yahya Sohail
2023-08-11 18:07 ` Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.