On Fri, Jun 16, 2023 at 1:51 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote: > > From: "Mike Rapoport (IBM)" <rppt@xxxxxxxxxx> > > Several architectures override module_alloc() only to define address > range for code allocations different than VMALLOC address space. > > Provide a generic implementation in execmem that uses the parameters > for address space ranges, required alignment and page protections > provided by architectures. > > The architecures must fill execmem_params structure and implement > execmem_arch_params() that returns a pointer to that structure. This > way the execmem initialization won't be called from every architecure, > but rather from a central place, namely initialization of the core > memory management. > > The execmem provides execmem_text_alloc() API that wraps > __vmalloc_node_range() with the parameters defined by the architecures. > If an architeture does not implement execmem_arch_params(), > execmem_text_alloc() will fall back to module_alloc(). > > The name execmem_text_alloc() emphasizes that the allocated memory is > for executable code, the allocations of the associated data, like data > sections of a module will use execmem_data_alloc() interface that will > be added later. > > Signed-off-by: Mike Rapoport (IBM) <rppt@xxxxxxxxxx> Acked-by: Song Liu <song@xxxxxxxxxx>