On Mon, Feb 01, 2021 at 06:32:52PM +0000, Quentin Perret wrote: > On Monday 01 Feb 2021 at 18:16:08 (+0000), Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:04PM +0000, Quentin Perret wrote: > > > +static struct kvm_pgtable_mm_ops kvm_s2_mm_ops = { > > > + .zalloc_page = stage2_memcache_alloc_page, > > > + .zalloc_pages_exact = kvm_host_zalloc_pages_exact, > > > + .free_pages_exact = free_pages_exact, > > > + .get_page = kvm_host_get_page, > > > + .put_page = kvm_host_put_page, > > > + .page_count = kvm_host_page_count, > > > + .phys_to_virt = kvm_host_va, > > > + .virt_to_phys = kvm_host_pa, > > > +}; > > > > Idle thought, but I wonder whether it would be better to have these > > implementations as the default and make the mm_ops structure parameter > > to kvm_pgtable_stage2_init() optional? I guess you don't gain an awful > > lot though, so feel free to ignore me. > > No strong opinion really, but I suppose I could do something as simple > as having static inline wrappers which provide kvm_s2_mm_ops to the > pgtable API for me. I'll probably want to make sure these are not > defined when compiling EL2 code, though, to avoid confusion. > > Or maybe you had something else in mind? No, just food for thought. If we can reduce the changes for normal KVM then it's probably worth considering if it doesn't add divergent code paths. But I'm also fine with the proposal you have here, so if it doesn't work then don't get hung up on it. Will