x86/vdso: Move VDSO image init to vdso2c generated code
Generate an init function for each VDSO image, replacing init_vdso() and sysenter_setup(). Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20230124184019.26850-1-brgerst@gmail.com
This commit is contained in:
@ -179,6 +179,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
|||||||
|
|
||||||
fprintf(outfile, "/* AUTOMATICALLY GENERATED -- DO NOT EDIT */\n\n");
|
fprintf(outfile, "/* AUTOMATICALLY GENERATED -- DO NOT EDIT */\n\n");
|
||||||
fprintf(outfile, "#include <linux/linkage.h>\n");
|
fprintf(outfile, "#include <linux/linkage.h>\n");
|
||||||
|
fprintf(outfile, "#include <linux/init.h>\n");
|
||||||
fprintf(outfile, "#include <asm/page_types.h>\n");
|
fprintf(outfile, "#include <asm/page_types.h>\n");
|
||||||
fprintf(outfile, "#include <asm/vdso.h>\n");
|
fprintf(outfile, "#include <asm/vdso.h>\n");
|
||||||
fprintf(outfile, "\n");
|
fprintf(outfile, "\n");
|
||||||
@ -218,5 +219,10 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
|||||||
fprintf(outfile, "\t.sym_%s = %" PRIi64 ",\n",
|
fprintf(outfile, "\t.sym_%s = %" PRIi64 ",\n",
|
||||||
required_syms[i].name, (int64_t)syms[i]);
|
required_syms[i].name, (int64_t)syms[i]);
|
||||||
}
|
}
|
||||||
|
fprintf(outfile, "};\n\n");
|
||||||
|
fprintf(outfile, "static __init int init_%s(void) {\n", image_name);
|
||||||
|
fprintf(outfile, "\treturn init_vdso_image(&%s);\n", image_name);
|
||||||
fprintf(outfile, "};\n");
|
fprintf(outfile, "};\n");
|
||||||
|
fprintf(outfile, "subsys_initcall(init_%s);\n", image_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,17 +51,8 @@ __setup("vdso32=", vdso32_setup);
|
|||||||
__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
|
__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int __init sysenter_setup(void)
|
|
||||||
{
|
|
||||||
init_vdso_image(&vdso_image_32);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
|
|
||||||
subsys_initcall(sysenter_setup);
|
|
||||||
|
|
||||||
#ifdef CONFIG_SYSCTL
|
#ifdef CONFIG_SYSCTL
|
||||||
/* Register vsyscall32 into the ABI table */
|
/* Register vsyscall32 into the ABI table */
|
||||||
#include <linux/sysctl.h>
|
#include <linux/sysctl.h>
|
||||||
|
@ -44,13 +44,16 @@ unsigned int vclocks_used __read_mostly;
|
|||||||
unsigned int __read_mostly vdso64_enabled = 1;
|
unsigned int __read_mostly vdso64_enabled = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __init init_vdso_image(const struct vdso_image *image)
|
int __init init_vdso_image(const struct vdso_image *image)
|
||||||
{
|
{
|
||||||
|
BUILD_BUG_ON(VDSO_CLOCKMODE_MAX >= 32);
|
||||||
BUG_ON(image->size % PAGE_SIZE != 0);
|
BUG_ON(image->size % PAGE_SIZE != 0);
|
||||||
|
|
||||||
apply_alternatives((struct alt_instr *)(image->data + image->alt),
|
apply_alternatives((struct alt_instr *)(image->data + image->alt),
|
||||||
(struct alt_instr *)(image->data + image->alt +
|
(struct alt_instr *)(image->data + image->alt +
|
||||||
image->alt_len));
|
image->alt_len));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct vm_special_mapping vvar_mapping;
|
static const struct vm_special_mapping vvar_mapping;
|
||||||
@ -418,18 +421,4 @@ static __init int vdso_setup(char *s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
__setup("vdso=", vdso_setup);
|
__setup("vdso=", vdso_setup);
|
||||||
|
|
||||||
static int __init init_vdso(void)
|
|
||||||
{
|
|
||||||
BUILD_BUG_ON(VDSO_CLOCKMODE_MAX >= 32);
|
|
||||||
|
|
||||||
init_vdso_image(&vdso_image_64);
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_X32_ABI
|
|
||||||
init_vdso_image(&vdso_image_x32);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
subsys_initcall(init_vdso);
|
|
||||||
#endif /* CONFIG_X86_64 */
|
#endif /* CONFIG_X86_64 */
|
||||||
|
@ -542,7 +542,6 @@ enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT,
|
|||||||
IDLE_POLL};
|
IDLE_POLL};
|
||||||
|
|
||||||
extern void enable_sep_cpu(void);
|
extern void enable_sep_cpu(void);
|
||||||
extern int sysenter_setup(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Defined in head.S */
|
/* Defined in head.S */
|
||||||
|
@ -45,7 +45,7 @@ extern const struct vdso_image vdso_image_x32;
|
|||||||
extern const struct vdso_image vdso_image_32;
|
extern const struct vdso_image vdso_image_32;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void __init init_vdso_image(const struct vdso_image *image);
|
extern int __init init_vdso_image(const struct vdso_image *image);
|
||||||
|
|
||||||
extern int map_vdso_once(const struct vdso_image *image, unsigned long addr);
|
extern int map_vdso_once(const struct vdso_image *image, unsigned long addr);
|
||||||
|
|
||||||
|
@ -1953,7 +1953,6 @@ void __init identify_boot_cpu(void)
|
|||||||
if (HAS_KERNEL_IBT && cpu_feature_enabled(X86_FEATURE_IBT))
|
if (HAS_KERNEL_IBT && cpu_feature_enabled(X86_FEATURE_IBT))
|
||||||
pr_info("CET detected: Indirect Branch Tracking enabled\n");
|
pr_info("CET detected: Indirect Branch Tracking enabled\n");
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
sysenter_setup();
|
|
||||||
enable_sep_cpu();
|
enable_sep_cpu();
|
||||||
#endif
|
#endif
|
||||||
cpu_detect_tlb(&boot_cpu_data);
|
cpu_detect_tlb(&boot_cpu_data);
|
||||||
|
Reference in New Issue
Block a user