All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] How QEMU maintains the translation from guest virtual address to guest physical address?
@ 2015-05-06 14:22 浩倫 魏
  2015-05-06 17:26 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: 浩倫 魏 @ 2015-05-06 14:22 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

Hi, all:
I've been trying to understand the process of address translation inside QEMU, but I got stuck in GVA->GPA.I've known that QEMU uses a two level description table 'PhysPageDesc' to maintain the translation between GPA & HVA(host virtual address), but I couldn't find out where QEMU translates GVA to GPA to go to that table to find HVA when a TLB missed occured. I've traced the internal codes and there are something may be able to solve my problems but I can't figure it out, could anyone help me?There is a function get_level1_table_address() called by get_phys_addr() in target-arm/helper.c, and it seems like start translating the GVA to GPA. But I don't understand the env->cp15.c2_base_mask variable which claimed to be the MMU translation table base selection mask means. Where is the description of MMU translation table?
Any suggestions would be helpful to me.Thanks in advance. 

[-- Attachment #2: Type: text/html, Size: 2023 bytes --]

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

* Re: [Qemu-devel] How QEMU maintains the translation from guest virtual address to guest physical address?
  2015-05-06 14:22 [Qemu-devel] How QEMU maintains the translation from guest virtual address to guest physical address? 浩倫 魏
@ 2015-05-06 17:26 ` Peter Maydell
  2015-05-06 18:41   ` 浩倫 魏
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2015-05-06 17:26 UTC (permalink / raw)
  To: 浩倫 魏; +Cc: qemu-devel

On 6 May 2015 at 15:22, 浩倫 魏 <goberwei@yahoo.com.tw> wrote:
> I've been trying to understand the process of address translation inside
> QEMU, but I got stuck in GVA->GPA.
> I've known that QEMU uses a two level description table 'PhysPageDesc' to
> maintain the translation between GPA & HVA(host virtual address), but I
> couldn't find out where QEMU translates GVA to GPA to go to that table to
> find HVA when a TLB missed occured.
> I've traced the internal codes and there are something may be able to solve
> my problems but I can't figure it out, could anyone help me?
> There is a function get_level1_table_address() called by get_phys_addr() in
> target-arm/helper.c, and it seems like start translating the GVA to GPA. But
> I don't understand the env->cp15.c2_base_mask variable which claimed to be
> the MMU translation table base selection mask means. Where is the
> description of MMU translation table?

To repeat the answer I just posted on stackoverflow:

The code you are looking at (get_phys_addr() and the functions it
calls) is implementing the page table walk algorithm for ARM. This
(and the data structures in guest memory which it reads) is defined
in the architecture reference manual (the "ARM ARM"). To understand
the code you need to read the relevant sections of the architecture
specification so you know what we're trying to emulate.

(For instance, the c2_base_mask is precalculated based on the value
in the 'N' field of the translation table base control register (TTBCR)
and is part of the calculation of the translation table base address.)

-- PMM

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

* Re: [Qemu-devel] How QEMU maintains the translation from guest virtual address to guest physical address?
  2015-05-06 17:26 ` Peter Maydell
@ 2015-05-06 18:41   ` 浩倫 魏
  2015-05-06 18:54     ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: 浩倫 魏 @ 2015-05-06 18:41 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]

Thanks for the response.
So am I in the right path if I want to know how QEMU translates GVA to GPA?I have question about that if guest OS would take part in the translation between GCA to GPA? Or qemu-softmmu would take control everything?
Respectfully,Gober Wei


     Peter Maydell <peter.maydell@linaro.org> 於 2015/5/7 (週四) 1:26 AM 寫道﹕
   

 On 6 May 2015 at 15:22, 浩倫 魏 <goberwei@yahoo.com.tw> wrote:
> I've been trying to understand the process of address translation inside
> QEMU, but I got stuck in GVA->GPA.
> I've known that QEMU uses a two level description table 'PhysPageDesc' to
> maintain the translation between GPA & HVA(host virtual address), but I
> couldn't find out where QEMU translates GVA to GPA to go to that table to
> find HVA when a TLB missed occured.
> I've traced the internal codes and there are something may be able to solve
> my problems but I can't figure it out, could anyone help me?
> There is a function get_level1_table_address() called by get_phys_addr() in
> target-arm/helper.c, and it seems like start translating the GVA to GPA. But
> I don't understand the env->cp15.c2_base_mask variable which claimed to be
> the MMU translation table base selection mask means. Where is the
> description of MMU translation table?

To repeat the answer I just posted on stackoverflow:

The code you are looking at (get_phys_addr() and the functions it
calls) is implementing the page table walk algorithm for ARM. This
(and the data structures in guest memory which it reads) is defined
in the architecture reference manual (the "ARM ARM"). To understand
the code you need to read the relevant sections of the architecture
specification so you know what we're trying to emulate.

(For instance, the c2_base_mask is precalculated based on the value
in the 'N' field of the translation table base control register (TTBCR)
and is part of the calculation of the translation table base address.)

-- PMM


  

[-- Attachment #2: Type: text/html, Size: 3613 bytes --]

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

* Re: [Qemu-devel] How QEMU maintains the translation from guest virtual address to guest physical address?
  2015-05-06 18:41   ` 浩倫 魏
@ 2015-05-06 18:54     ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-05-06 18:54 UTC (permalink / raw)
  To: 浩倫 魏; +Cc: qemu-devel

On 6 May 2015 at 19:41, 浩倫 魏 <goberwei@yahoo.com.tw> wrote:
> So am I in the right path if I want to know how QEMU translates GVA to GPA?
> I have question about that if guest OS would take part in the translation
> between GCA to GPA? Or qemu-softmmu would take control everything?

Well, the guest OS is what sets up the page tables in memory
which QEMU (or the real CPU, in hardware) is reading. So it's
the guest OS that controls what the mapping is, in the end.

-- PMM

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

end of thread, other threads:[~2015-05-06 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 14:22 [Qemu-devel] How QEMU maintains the translation from guest virtual address to guest physical address? 浩倫 魏
2015-05-06 17:26 ` Peter Maydell
2015-05-06 18:41   ` 浩倫 魏
2015-05-06 18:54     ` Peter Maydell

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.