From: Anthony Liguori <anthony@codemonkey.ws>
To: Ian Molton <ian.molton@collabora.co.uk>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Address translation - virt->phys->ram
Date: Mon, 22 Feb 2010 08:35:49 -0600 [thread overview]
Message-ID: <4B829645.5020904@codemonkey.ws> (raw)
In-Reply-To: <4B828DC2.3000609@collabora.co.uk>
On 02/22/2010 07:59 AM, Ian Molton wrote:
> Hi folks,
>
> I've been updating some old patches which make use of a function to
> translate guest virtual addresses into pointers into the guest RAM.
>
> As I understand it qemu has guest virtual and physical addresses, the
> latter of which map somehow to host ram addresses.
>
> The function which the code had been using appears not to work under
> kvm, which leads me to think that qemu doesnt emulate the MMU (or at
> least not in the same manner) when it is using kvm as opposed to pure
> emulation.
>
> If I turn off kvm, the patch works, albeit slowly. If I enable it, the
> code takes the path which looks for the magic value (below).
>
> Is there a 'proper' way to translate guest virtual addresses into host
> RAM addresses?
>
cpu_physical_memory_map().
But this function has some subtle characteristics. It may return a
bounce buffer if you attempt to map MMIO memory. There is a limited
pool of bounce buffers available so it may return NULL in the event that
it cannot allocate a bounce buffer.
It may also return a partial result if you're attempting to map a region
that straddles multiple memory slots.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2010-02-22 14:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-22 13:59 [Qemu-devel] Address translation - virt->phys->ram Ian Molton
2010-02-22 14:35 ` Anthony Liguori [this message]
2010-02-22 16:46 ` Ian Molton
2010-02-22 16:52 ` Anthony Liguori
2010-02-22 17:47 ` Ian Molton
2010-02-22 18:56 ` Alexander Graf
2010-02-23 15:46 ` Ian Molton
2010-02-23 15:54 ` Alexander Graf
2010-02-23 16:21 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B829645.5020904@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=ian.molton@collabora.co.uk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.