Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 745b2e3b authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "PM/Hibernate: Add Config option to skip crc check"

parents cb075a78 edcfa65a
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -77,6 +77,33 @@ config HIBERNATION

	  For more information take a look at <file:Documentation/power/swsusp.txt>.

config HIBERNATION_IMAGE_REUSE
	bool "Reuse hibernation image"
	depends on HIBERNATION
	---help---
	  By default this hibernation image is erased after either a
	  successful or unsuccessful hibernation restore sequeunce. Since
	  filesystem contents on disk are not part of the hibernation
	  image, failure to create a new hibernation image every boot can
	  lead to filesystem corruption.

	  Conversely, if the usecase can guarantee that the filesystem is
	  not ever modified, the same hibernation image can be reused. This
	  prevents creating additional hibernation images unncesarily.

	  For more details, refer to the description of CONFIG_HIBERNATION
	  for booting without resuming.

config HIBERNATION_SKIP_CRC
	bool "Skip LZO image CRC check"
	default n
	depends on HIBERNATION
	---help---
	  Some filesystem devices may have hw based integrity checks. In this
	  scenario, repeating the integrity check in software is unnecessary
	  and wasteful. This config option has no effect if uncompressed
	  hibernation images are used.

config ARCH_SAVE_PAGE_KEYS
	bool

+8 −4
Original line number Diff line number Diff line
@@ -605,6 +605,7 @@ static int crc32_threadfn(void *data)
		}
		atomic_set(&d->ready, 0);

		if (!IS_ENABLED(CONFIG_HIBERNATION_SKIP_CRC))
			for (i = 0; i < d->run_threads; i++)
				*d->crc32 = crc32_le(*d->crc32,
						d->unc[i], *d->unc_len[i]);
@@ -1453,7 +1454,8 @@ static int load_image_lzo(struct swap_map_handle *handle,
		if (!snapshot_image_loaded(snapshot))
			ret = -ENODATA;
		if (!ret) {
			if (swsusp_header->flags & SF_CRC32_MODE) {
			if ((swsusp_header->flags & SF_CRC32_MODE) &&
			    (!IS_ENABLED(CONFIG_HIBERNATION_SKIP_CRC))) {
				if(handle->crc32 != swsusp_header->crc32) {
					printk(KERN_ERR
					       "PM: Invalid image CRC32!\n");
@@ -1540,10 +1542,12 @@ int swsusp_check(void)

		if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
			memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
#ifndef CONFIG_HIBERNATION_IMAGE_REUSE
			/* Reset swap signature now */
			error = hib_submit_io(REQ_OP_WRITE, REQ_SYNC,
						swsusp_resume_block,
						swsusp_header, NULL);
#endif
		} else {
			error = -EINVAL;
		}