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