Hi Alex, On Fri, Aug 28, 2020 at 04:35:24PM +0100, Alexandru Elisei wrote: > On 8/25/20 10:39 AM, Will Deacon wrote: > > The generic page-table walker is pretty useless as it stands, because it > > doesn't understand enough to allocate anything. Teach it about stage-1 > > page-tables, and hook up an API for allocating these for the hypervisor > > at EL2. > > > > Cc: Marc Zyngier <maz@xxxxxxxxxx> > > Cc: Quentin Perret <qperret@xxxxxxxxxx> > > Signed-off-by: Will Deacon <will@xxxxxxxxxx> > > --- > > arch/arm64/include/asm/kvm_pgtable.h | 34 +++++++ > > arch/arm64/kvm/hyp/pgtable.c | 131 +++++++++++++++++++++++++++ > > 2 files changed, 165 insertions(+) [...] > > +/** > > + * kvm_pgtable_hyp_map() - Install a mapping in a hypervisor stage-1 page-table. > > + * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init(). > > + * @addr: Virtual address at which to place the mapping. > > + * @size: Size of the mapping. > > + * @phys: Physical address of the memory to map. > > + * @prot: Permissions and attributes for the mapping. > > + * > > + * If device attributes are not explicitly requested in @prot, then the > > + * mapping will be normal, cacheable. > > + * > > + * Return: 0 on success, negative error code on failure. > > From my understanding of the code, when the caller replaces an existing leaf entry > or a table with a different one, KVM will print a warning instead of using > break-before-make (if necessary). It might be worth pointing out that it is > expected from the callers not to do that, because it's not immediately obvious. For hypervisor stage-1 mappings, we WARN() and ignore the mapping request if we run into an existing valid leaf entry for a different mapping. That shouldn't happen, as hyp mappings are typically static and performed only for the .hyp.* sections and the GICv2 memory-mapped bits. We don't even provide an unmap interface. But yes, I can mention this in the comment: | Attempts to install a mapping for a virtual address that is already | mapped will be rejected with an error and a WARN(). Will _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm