All of lore.kernel.org
 help / color / mirror / Atom feed
* Fill tlb for data and io address
@ 2021-02-16 11:25 沈梦姣
  2021-02-16 11:48 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: 沈梦姣 @ 2021-02-16 11:25 UTC (permalink / raw)
  To: QEMU Developers, qemu-discuss

Look at the store/load helper, it will use the tlb entry to do the address translation(from guest virtual address to host virtual address) but where the tlb is filled for the data ram and io address, I know where the code ram is filled(tb_find->tb_lookup__cpu_state...) 

Thanks a lot 

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

* Re: Fill tlb for data and io address
  2021-02-16 11:25 Fill tlb for data and io address 沈梦姣
@ 2021-02-16 11:48 ` Peter Maydell
  2021-02-16 14:39   ` 沈梦姣
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2021-02-16 11:48 UTC (permalink / raw)
  To: 沈梦姣; +Cc: QEMU Developers, qemu-discuss

On Tue, 16 Feb 2021 at 11:28, 沈梦姣 <shen.mengjiao3@icloud.com> wrote:
> Look at the store/load helper, it will use the tlb entry to do the address translation(from guest virtual address to host virtual address) but where the tlb is filled for the data ram and io address, I know where the code ram is filled(tb_find->tb_lookup__cpu_state...)

The common QEMU code calls the target CPU tlb_fill function, which tries
to translate the guest virtual address to a physical address (usually by
walking the guest page tables). If it succeeds then will update the QEMU
TLB by calling either tlb_set_page() or tlb_set_page_with_attrs(). If it
fails then it arranges to deliver a suitable exception to the guest.

thanks
-- PMM


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

* Re: Fill tlb for data and io address
  2021-02-16 11:48 ` Peter Maydell
@ 2021-02-16 14:39   ` 沈梦姣
  2021-02-16 14:41     ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: 沈梦姣 @ 2021-02-16 14:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, qemu-discuss



> 在 2021年2月16日,下午7:48,Peter Maydell <peter.maydell@linaro.org> 写道:
> 
> On Tue, 16 Feb 2021 at 11:28, 沈梦姣 <shen.mengjiao3@icloud.com> wrote:
>> Look at the store/load helper, it will use the tlb entry to do the address translation(from guest virtual address to host virtual address) but where the tlb is filled for the data ram and io address, I know where the code ram is filled(tb_find->tb_lookup__cpu_state...)
> 
> The common QEMU code calls the target
Thanks Peter. But what’s the common code? I mean in which case the tlb_fill will be triggered, the generated code will trigger or something else? Thanks in advance.
> CPU tlb_fill function, which tries
> to translate the guest virtual address to a physical address (usually by
> walking the guest page tables). If it succeeds then will update the QEMU
> TLB by calling either tlb_set_page() or tlb_set_page_with_attrs().

> If it
> fails then it arranges to deliver a suitable exception to the guest.
This should be page fault, guest code will update page table, am I right? Thanks 
> 
> thanks
> -- PMM


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

* Re: Fill tlb for data and io address
  2021-02-16 14:39   ` 沈梦姣
@ 2021-02-16 14:41     ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-02-16 14:41 UTC (permalink / raw)
  To: 沈梦姣; +Cc: QEMU Developers, qemu-discuss

On Tue, 16 Feb 2021 at 14:39, 沈梦姣 <shen.mengjiao3@icloud.com> wrote:
> > 在 2021年2月16日,下午7:48,Peter Maydell <peter.maydell@linaro.org> 写道:
> >
> > On Tue, 16 Feb 2021 at 11:28, 沈梦姣 <shen.mengjiao3@icloud.com> wrote:
> >> Look at the store/load helper, it will use the tlb entry to do the address translation(from guest virtual address to host virtual address) but where the tlb is filled for the data ram and io address, I know where the code ram is filled(tb_find->tb_lookup__cpu_state...)
> >
> > The common QEMU code calls the target
> Thanks Peter. But what’s the common code? I mean in which case the tlb_fill will be triggered, the generated code will trigger or something else? Thanks in advance.

"git grep tlb_fill accel/tcg" will tell you the call sites.
Basically if the guest code tries to access an address and
we don't already have that in the QEMU TLB, then we call
tlb_fill.

> > CPU tlb_fill function, which tries
> > to translate the guest virtual address to a physical address (usually by
> > walking the guest page tables). If it succeeds then will update the QEMU
> > TLB by calling either tlb_set_page() or tlb_set_page_with_attrs().
>
> > If it
> > fails then it arranges to deliver a suitable exception to the guest.
> This should be page fault, guest code will update page table, am I right? Thanks

It depends on the guest architecture, but yes, that's the usual thing.

-- PMM


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

end of thread, other threads:[~2021-02-16 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 11:25 Fill tlb for data and io address 沈梦姣
2021-02-16 11:48 ` Peter Maydell
2021-02-16 14:39   ` 沈梦姣
2021-02-16 14:41     ` 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.