aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/xpram.c
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2009-09-11 04:28:50 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-09-11 04:29:50 -0400
commit99b5e2d3d7ae8f5a2dba7a41a02ba7eb25523b3f (patch)
tree80177d3f079116272be2b9b25fcf3d1d54c7a5e5 /drivers/s390/block/xpram.c
parent3f7cb51fac60618aa543058a90e668956d5fb518 (diff)
[S390] xpram: Remove checksum validation for suspend/resume
Currently in the suspend process checksums for the XPRAM partitions are created and stored. During the resume process it is checked, if the checksums are still the same. If this is not the case, a kernel panic is triggered. Unfortunately this prevents XPRAM from beeing used as suspend device, because in this case after the checksum has been created, the memory image is written to XPRAM and therefore the contents of the suspend partition is changed. In order to allow XPRAM to be used as suspend device, this patch removes the checksum validation. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/xpram.c')
-rw-r--r--drivers/s390/block/xpram.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index db442cd6621e..ee604e92a5fa 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -42,7 +42,6 @@
42#include <linux/suspend.h> 42#include <linux/suspend.h>
43#include <linux/platform_device.h> 43#include <linux/platform_device.h>
44#include <asm/uaccess.h> 44#include <asm/uaccess.h>
45#include <asm/checksum.h>
46 45
47#define XPRAM_NAME "xpram" 46#define XPRAM_NAME "xpram"
48#define XPRAM_DEVS 1 /* one partition */ 47#define XPRAM_DEVS 1 /* one partition */
@@ -51,7 +50,6 @@
51typedef struct { 50typedef struct {
52 unsigned int size; /* size of xpram segment in pages */ 51 unsigned int size; /* size of xpram segment in pages */
53 unsigned int offset; /* start page of xpram segment */ 52 unsigned int offset; /* start page of xpram segment */
54 unsigned int csum; /* partition checksum for suspend */
55} xpram_device_t; 53} xpram_device_t;
56 54
57static xpram_device_t xpram_devices[XPRAM_MAX_DEVS]; 55static xpram_device_t xpram_devices[XPRAM_MAX_DEVS];
@@ -387,58 +385,6 @@ out:
387} 385}
388 386
389/* 387/*
390 * Save checksums for all partitions.
391 */
392static int xpram_save_checksums(void)
393{
394 unsigned long mem_page;
395 int rc, i;
396
397 rc = 0;
398 mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
399 if (!mem_page)
400 return -ENOMEM;
401 for (i = 0; i < xpram_devs; i++) {
402 rc = xpram_page_in(mem_page, xpram_devices[i].offset);
403 if (rc)
404 goto fail;
405 xpram_devices[i].csum = csum_partial((const void *) mem_page,
406 PAGE_SIZE, 0);
407 }
408fail:
409 free_page(mem_page);
410 return rc ? -ENXIO : 0;
411}
412
413/*
414 * Verify checksums for all partitions.
415 */
416static int xpram_validate_checksums(void)
417{
418 unsigned long mem_page;
419 unsigned int csum;
420 int rc, i;
421
422 rc = 0;
423 mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
424 if (!mem_page)
425 return -ENOMEM;
426 for (i = 0; i < xpram_devs; i++) {
427 rc = xpram_page_in(mem_page, xpram_devices[i].offset);
428 if (rc)
429 goto fail;
430 csum = csum_partial((const void *) mem_page, PAGE_SIZE, 0);
431 if (xpram_devices[i].csum != csum) {
432 rc = -EINVAL;
433 goto fail;
434 }
435 }
436fail:
437 free_page(mem_page);
438 return rc ? -ENXIO : 0;
439}
440
441/*
442 * Resume failed: Print error message and call panic. 388 * Resume failed: Print error message and call panic.
443 */ 389 */
444static void xpram_resume_error(const char *message) 390static void xpram_resume_error(const char *message)
@@ -458,21 +404,10 @@ static int xpram_restore(struct device *dev)
458 xpram_resume_error("xpram disappeared"); 404 xpram_resume_error("xpram disappeared");
459 if (xpram_pages != xpram_highest_page_index() + 1) 405 if (xpram_pages != xpram_highest_page_index() + 1)
460 xpram_resume_error("Size of xpram changed"); 406 xpram_resume_error("Size of xpram changed");
461 if (xpram_validate_checksums())
462 xpram_resume_error("Data of xpram changed");
463 return 0; 407 return 0;
464} 408}
465 409
466/*
467 * Save necessary state in suspend.
468 */
469static int xpram_freeze(struct device *dev)
470{
471 return xpram_save_checksums();
472}
473
474static struct dev_pm_ops xpram_pm_ops = { 410static struct dev_pm_ops xpram_pm_ops = {
475 .freeze = xpram_freeze,
476 .restore = xpram_restore, 411 .restore = xpram_restore,
477}; 412};
478 413