Hi Marc, Sorry, but I could not find the bottom posting mode in Gmail. Also, thanks for your reply, I continue to discover how the Stage-2 translation works in KVM. But, when I read the HCR_EL2 register in Host (it is v5.3.0) , its value is 0x4_8800_0000. So (1) I am in VHE mode. (2) The Stage-2 translation is disabled. I am sure that I have run a Non-Secure VM with QEMU, so is it correct that the S-2 translation is disabled in VHE mode? If so, how it handles the memory management for Guest? Confused, Wang Marc Zyngier <maz@xxxxxxxxxx> 于2021年10月18日周一 下午6:06写道: > > Wang, > > Please don't top-post, and stick to plain text instead of HTML. > > On Mon, 18 Oct 2021 09:36:05 +0100, > Chenxu Wang <irakatz51@xxxxxxxxx> wrote: > > > > Hi Marc, > > > > Thanks for your help. I studied the kvm_handle_guest_abort() handler, and > > basically know the reason for "return 0". > > But I still cannot solve the mapping problem. > > > > I want to find a function or APIs, whose input parameters are (1) region > > base IPA and size (2) mapped PA in Host (if IPA=PA, it could be better) (3) > > R/W/X attributes. > > Then, when I call the func(IPA start, IPA end, PA start, attr), I can get > > the map. > > There is no such function, because that's not how KVM works. > > > Where should I follow? Should I follow the "translation fault path" again? > > Or create the mapping function by myself? > > Neither. You cannot directly map random physical ranges into a VM. > Memory that gets mapped into a VM needs to be exposed by userspace in > the form of a memslot. KVM will then map that memory on demand as the > guest accesses it. > > Thanks, > > M. > > -- > Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm