Loading arch/arm64/Kconfig +33 −0 Original line number Diff line number Diff line Loading @@ -905,6 +905,39 @@ config KEXEC but it is independent of the system firmware. And like a reboot you can start any kernel with it, not just Linux. config KEXEC_FILE bool "kexec file based system call" select KEXEC_CORE help This is new version of kexec system call. This system call is file based and takes file descriptors as system call argument for kernel and initramfs as opposed to list of segments as accepted by previous system call. config KEXEC_VERIFY_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE help Select this option to verify a signature with loaded kernel image. If configured, any attempt of loading a image without valid signature will fail. In addition to that option, you need to enable signature verification for the corresponding kernel image type being loaded in order for this to work. config KEXEC_IMAGE_VERIFY_SIG bool "Enable Image signature verification support" default y depends on KEXEC_VERIFY_SIG depends on EFI && SIGNED_PE_FILE_VERIFICATION help Enable Image signature verification support. comment "Support for PE file signature verification disabled" depends on KEXEC_VERIFY_SIG depends on !EFI || !SIGNED_PE_FILE_VERIFICATION config CRASH_DUMP bool "Build kdump crash kernel" help Loading arch/arm64/include/asm/cpufeature.h +48 −0 Original line number Diff line number Diff line Loading @@ -489,11 +489,59 @@ static inline bool system_supports_32bit_el0(void) return cpus_have_const_cap(ARM64_HAS_32BIT_EL0); } static inline bool system_supports_4kb_granule(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_TGRAN4_SHIFT); return val == ID_AA64MMFR0_TGRAN4_SUPPORTED; } static inline bool system_supports_64kb_granule(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_TGRAN64_SHIFT); return val == ID_AA64MMFR0_TGRAN64_SUPPORTED; } static inline bool system_supports_16kb_granule(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_TGRAN16_SHIFT); return val == ID_AA64MMFR0_TGRAN16_SUPPORTED; } static inline bool system_supports_mixed_endian_el0(void) { return id_aa64mmfr0_mixed_endian_el0(read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1)); } static inline bool system_supports_mixed_endian(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_BIGENDEL_SHIFT); return val == 0x1; } static inline bool system_supports_fpsimd(void) { return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD); Loading arch/arm64/include/asm/image.h 0 → 100644 +59 −0 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_IMAGE_H #define __ASM_IMAGE_H #define ARM64_IMAGE_MAGIC "ARM\x64" #define ARM64_IMAGE_FLAG_BE_SHIFT 0 #define ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT (ARM64_IMAGE_FLAG_BE_SHIFT + 1) #define ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT \ (ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT + 2) #define ARM64_IMAGE_FLAG_BE_MASK 0x1 #define ARM64_IMAGE_FLAG_PAGE_SIZE_MASK 0x3 #define ARM64_IMAGE_FLAG_PHYS_BASE_MASK 0x1 #define ARM64_IMAGE_FLAG_LE 0 #define ARM64_IMAGE_FLAG_BE 1 #define ARM64_IMAGE_FLAG_PAGE_SIZE_4K 1 #define ARM64_IMAGE_FLAG_PAGE_SIZE_16K 2 #define ARM64_IMAGE_FLAG_PAGE_SIZE_64K 3 #define ARM64_IMAGE_FLAG_PHYS_BASE 1 #ifndef __ASSEMBLY__ #define arm64_image_flag_field(flags, field) \ (((flags) >> field##_SHIFT) & field##_MASK) /* * struct arm64_image_header - arm64 kernel image header * See Documentation/arm64/booting.txt for details * * @code0: Executable code, or * @mz_header alternatively used for part of MZ header * @code1: Executable code * @text_offset: Image load offset * @image_size: Effective Image size * @flags: kernel flags * @reserved: reserved * @magic: Magic number * @reserved5: reserved, or * @pe_header: alternatively used for PE COFF offset */ struct arm64_image_header { __le32 code0; __le32 code1; __le64 text_offset; __le64 image_size; __le64 flags; __le64 res2; __le64 res3; __le64 res4; __le32 magic; __le32 res5; }; #endif /* __ASSEMBLY__ */ #endif /* __ASM_IMAGE_H */ arch/arm64/include/asm/kexec.h +19 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,25 @@ static inline void crash_prepare_suspend(void) {} static inline void crash_post_resume(void) {} #endif #ifdef CONFIG_KEXEC_FILE #define ARCH_HAS_KIMAGE_ARCH struct kimage_arch { void *dtb; unsigned long dtb_mem; }; extern const struct kexec_file_ops kexec_image_ops; struct kimage; extern int arch_kimage_file_post_load_cleanup(struct kimage *image); extern int load_other_segments(struct kimage *image, unsigned long kernel_load_addr, unsigned long kernel_size, char *initrd, unsigned long initrd_len, char *cmdline); #endif #endif /* __ASSEMBLY__ */ #endif arch/arm64/kernel/Makefile +2 −1 Original line number Diff line number Diff line Loading @@ -49,8 +49,9 @@ arm64-obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL) += acpi_parking_protocol.o arm64-obj-$(CONFIG_PARAVIRT) += paravirt.o arm64-obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o arm64-obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ arm64-obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o \ cpu-reset.o arm64-obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o arm64-obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o Loading Loading
arch/arm64/Kconfig +33 −0 Original line number Diff line number Diff line Loading @@ -905,6 +905,39 @@ config KEXEC but it is independent of the system firmware. And like a reboot you can start any kernel with it, not just Linux. config KEXEC_FILE bool "kexec file based system call" select KEXEC_CORE help This is new version of kexec system call. This system call is file based and takes file descriptors as system call argument for kernel and initramfs as opposed to list of segments as accepted by previous system call. config KEXEC_VERIFY_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE help Select this option to verify a signature with loaded kernel image. If configured, any attempt of loading a image without valid signature will fail. In addition to that option, you need to enable signature verification for the corresponding kernel image type being loaded in order for this to work. config KEXEC_IMAGE_VERIFY_SIG bool "Enable Image signature verification support" default y depends on KEXEC_VERIFY_SIG depends on EFI && SIGNED_PE_FILE_VERIFICATION help Enable Image signature verification support. comment "Support for PE file signature verification disabled" depends on KEXEC_VERIFY_SIG depends on !EFI || !SIGNED_PE_FILE_VERIFICATION config CRASH_DUMP bool "Build kdump crash kernel" help Loading
arch/arm64/include/asm/cpufeature.h +48 −0 Original line number Diff line number Diff line Loading @@ -489,11 +489,59 @@ static inline bool system_supports_32bit_el0(void) return cpus_have_const_cap(ARM64_HAS_32BIT_EL0); } static inline bool system_supports_4kb_granule(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_TGRAN4_SHIFT); return val == ID_AA64MMFR0_TGRAN4_SUPPORTED; } static inline bool system_supports_64kb_granule(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_TGRAN64_SHIFT); return val == ID_AA64MMFR0_TGRAN64_SUPPORTED; } static inline bool system_supports_16kb_granule(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_TGRAN16_SHIFT); return val == ID_AA64MMFR0_TGRAN16_SUPPORTED; } static inline bool system_supports_mixed_endian_el0(void) { return id_aa64mmfr0_mixed_endian_el0(read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1)); } static inline bool system_supports_mixed_endian(void) { u64 mmfr0; u32 val; mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); val = cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_BIGENDEL_SHIFT); return val == 0x1; } static inline bool system_supports_fpsimd(void) { return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD); Loading
arch/arm64/include/asm/image.h 0 → 100644 +59 −0 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_IMAGE_H #define __ASM_IMAGE_H #define ARM64_IMAGE_MAGIC "ARM\x64" #define ARM64_IMAGE_FLAG_BE_SHIFT 0 #define ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT (ARM64_IMAGE_FLAG_BE_SHIFT + 1) #define ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT \ (ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT + 2) #define ARM64_IMAGE_FLAG_BE_MASK 0x1 #define ARM64_IMAGE_FLAG_PAGE_SIZE_MASK 0x3 #define ARM64_IMAGE_FLAG_PHYS_BASE_MASK 0x1 #define ARM64_IMAGE_FLAG_LE 0 #define ARM64_IMAGE_FLAG_BE 1 #define ARM64_IMAGE_FLAG_PAGE_SIZE_4K 1 #define ARM64_IMAGE_FLAG_PAGE_SIZE_16K 2 #define ARM64_IMAGE_FLAG_PAGE_SIZE_64K 3 #define ARM64_IMAGE_FLAG_PHYS_BASE 1 #ifndef __ASSEMBLY__ #define arm64_image_flag_field(flags, field) \ (((flags) >> field##_SHIFT) & field##_MASK) /* * struct arm64_image_header - arm64 kernel image header * See Documentation/arm64/booting.txt for details * * @code0: Executable code, or * @mz_header alternatively used for part of MZ header * @code1: Executable code * @text_offset: Image load offset * @image_size: Effective Image size * @flags: kernel flags * @reserved: reserved * @magic: Magic number * @reserved5: reserved, or * @pe_header: alternatively used for PE COFF offset */ struct arm64_image_header { __le32 code0; __le32 code1; __le64 text_offset; __le64 image_size; __le64 flags; __le64 res2; __le64 res3; __le64 res4; __le32 magic; __le32 res5; }; #endif /* __ASSEMBLY__ */ #endif /* __ASM_IMAGE_H */
arch/arm64/include/asm/kexec.h +19 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,25 @@ static inline void crash_prepare_suspend(void) {} static inline void crash_post_resume(void) {} #endif #ifdef CONFIG_KEXEC_FILE #define ARCH_HAS_KIMAGE_ARCH struct kimage_arch { void *dtb; unsigned long dtb_mem; }; extern const struct kexec_file_ops kexec_image_ops; struct kimage; extern int arch_kimage_file_post_load_cleanup(struct kimage *image); extern int load_other_segments(struct kimage *image, unsigned long kernel_load_addr, unsigned long kernel_size, char *initrd, unsigned long initrd_len, char *cmdline); #endif #endif /* __ASSEMBLY__ */ #endif
arch/arm64/kernel/Makefile +2 −1 Original line number Diff line number Diff line Loading @@ -49,8 +49,9 @@ arm64-obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL) += acpi_parking_protocol.o arm64-obj-$(CONFIG_PARAVIRT) += paravirt.o arm64-obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o arm64-obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ arm64-obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o \ cpu-reset.o arm64-obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o arm64-obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o Loading