From: Marc Zyngier <maz@kernel.org>
To: Chenxu Wang <irakatz51@gmail.com>
Cc: kvmarm@lists.cs.columbia.edu
Subject: Re: Problems about Stage-2 translation
Date: Sat, 16 Oct 2021 22:19:38 +0100 [thread overview]
Message-ID: <877decvf9x.wl-maz@kernel.org> (raw)
In-Reply-To: <CAFLP=uDhb8Zq5pAnTbvXi_OU047Uw3WRkw2YJsYNEsCkdHzkJQ@mail.gmail.com>
On Sat, 16 Oct 2021 13:21:01 +0100,
Chenxu Wang <irakatz51@gmail.com> wrote:
>
> Hi all,
>
> I am facing two problems with the Stage-2 translation in KVM.
>
> (1)
> I reserve a memory region (e.g., 0xa000_0000 ~ 0xa020_0000) from DRAM space
> of HostOS, and fill it with some values. Then ask a GuestVM to access this
> region.
>
> void __iomem *region=ioremap(0xa0000000, 0x1000);
> uint32_t val=ioread32(region);
>
> But I get value 0, which is not the expected value.
It is the expected behaviour.
> I guess the reason is that the Stage-2 translation of the GuestVM does not
> map the reserved region, but it should return a translation fault, rather
> than 0. So I feel confused, could you provide some helpful explanation?
Why should the guest see a translation fault? After all, the whole
point of KVM is to transparently handle the translation fault and map
a page on demand.
> (2)
> I consider mapping a region with the Stage-2 translation. I find that KVM
> create the stage-2 table with kvm_alloc_stage2_pgd(). But I could not find
> a function that can "arbitrarily add a stage-2 mapping to the physical
> address in HostOS" when the VM is activated.
>
> Could you provide such functions?
Follow the translation fault path in KVM, and you will find what you
are asking for.
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2021-10-16 21:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 12:21 Problems about Stage-2 translation Chenxu Wang
2021-10-16 21:19 ` Marc Zyngier [this message]
2021-10-18 8:36 ` Chenxu Wang
2021-10-18 10:06 ` Marc Zyngier
2021-10-18 19:01 ` Chenxu Wang
2021-10-18 19:31 ` Marc Zyngier
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=877decvf9x.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=irakatz51@gmail.com \
--cc=kvmarm@lists.cs.columbia.edu \
/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.