On Sat, 16 Oct 2021 13:21:01 +0100, Chenxu Wang <irakatz51@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm