Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Image loader for kexec_file_load system call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright IBM Corp. 2018
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Author(s): Philipp Rudo <prudo@linux.vnet.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kexec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/ipl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static int kexec_file_add_kernel_image(struct kimage *image,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 				       struct s390_load_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	struct kexec_buf buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	buf.image = image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	buf.buffer = image->kernel_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	buf.bufsz = image->kernel_buf_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	buf.mem = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	if (image->type == KEXEC_TYPE_CRASH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		buf.mem += crashk_res.start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	buf.memsz = buf.bufsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	data->kernel_buf = image->kernel_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	data->kernel_mem = buf.mem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	data->parm = image->kernel_buf + PARMAREA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	data->memsz += buf.memsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	ipl_report_add_component(data->report, &buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 				 IPL_RB_COMPONENT_FLAG_SIGNED |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 				 IPL_RB_COMPONENT_FLAG_VERIFIED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 				 IPL_RB_CERT_UNKNOWN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	return kexec_add_buffer(&buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static void *s390_image_load(struct kimage *image,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 			     char *kernel, unsigned long kernel_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 			     char *initrd, unsigned long initrd_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 			     char *cmdline, unsigned long cmdline_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	return kexec_file_add_components(image, kexec_file_add_kernel_image);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static int s390_image_probe(const char *buf, unsigned long len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	/* Can't reliably tell if an image is valid.  Therefore give the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	 * user whatever he wants.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) const struct kexec_file_ops s390_kexec_image_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	.probe = s390_image_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	.load = s390_image_load,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #ifdef CONFIG_KEXEC_SIG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	.verify_sig = s390_verify_sig,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif /* CONFIG_KEXEC_SIG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };