Linux already has some xor code that was optimized for RAID. Include
it and use it for bitfix. This appears to save 200-300 ms.
BUG=chrome-os-partner:15655
TEST=Timed before and after:
Before:
[ 28.344096] s3c_pm_check: Suspend memory scan took
4341511 usecs
[ 28.344096] s3c_pm_check: Resume memory scan took
1204971 usecs
[ 40.794096] s3c_pm_check: Suspend memory scan took
4372845 usecs
[ 40.794096] s3c_pm_check: Resume memory scan took
1205185 usecs
[ 53.689130] s3c_pm_check: Suspend memory scan took
4348640 usecs
[ 53.689130] s3c_pm_check: Resume memory scan took
1205305 usecs
After:
[ 34.604046] s3c_pm_check: Suspend memory scan took
4000453 usecs
[ 34.604046] s3c_pm_check: Resume memory scan took
1202673 usecs
[ 48.804021] s3c_pm_check: Suspend memory scan took
3991251 usecs
[ 48.804021] s3c_pm_check: Resume memory scan took
1202789 usecs
[ 62.234132] s3c_pm_check: Suspend memory scan took
4161455 usecs
[ 62.234132] s3c_pm_check: Resume memory scan took
1203661 usecs
[ 83.439127] s3c_pm_check: Suspend memory scan took
4002259 usecs
[ 83.439127] s3c_pm_check: Resume memory scan took
1205180 usecs
Change-Id: I17a6d6b8c072ac0fe04ae2fa8762374aafcae7ff
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37691
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
config SNOW_BITFIX
bool "Enable fixing of bit errors across suspend-to-RAM cycle"
depends on SOC_EXYNOS5250 && SAMSUNG_PM_CHECK
+ select XOR_BLOCKS
help
Some Snow boards have an issue in read-only firmware that can cause
bit errors across a suspend/resume cycle. Enabling this option will
#include <linux/moduleparam.h>
#include <linux/of_fdt.h>
#include <linux/pm.h>
+#include <linux/raid/xor.h>
#include <linux/slab.h>
#include <plat/pm.h>
*
* @dest: Place to xor into.
* @src: Place to xor from.
- * @count: Number of _bytes_ to process. Must be an even number of 32-bit
- * elements.
+ * @count: Number of _bytes_ to process.
*/
-static void bitfix_xor32(u32 *dest, const u32 *src, size_t count)
+static void bitfix_xor32(void *dest, const void *src, size_t count)
{
- size_t i;
-
- BUG_ON(count & 0x03);
-
- for (i = 0; i < count / sizeof(u32); i++)
- dest[i] ^= src[i];
+ xor_blocks(1, PAGE_SIZE, dest, (void **)&src);
}
/**