x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}()
[linux-2.6-microblaze.git] / tools / testing / nvdimm / test / nfit.c
index a1a5dc6..2ac0fff 100644 (file)
@@ -23,7 +23,8 @@
 #include "nfit_test.h"
 #include "../watermark.h"
 
-#include <asm/mcsafe_test.h>
+#include <asm/copy_mc_test.h>
+#include <asm/mce.h>
 
 /*
  * Generate an NFIT table to describe the following topology:
@@ -3283,7 +3284,7 @@ static struct platform_driver nfit_test_driver = {
        .id_table = nfit_test_id,
 };
 
-static char mcsafe_buf[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
+static char copy_mc_buf[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
 
 enum INJECT {
        INJECT_NONE,
@@ -3291,7 +3292,7 @@ enum INJECT {
        INJECT_DST,
 };
 
-static void mcsafe_test_init(char *dst, char *src, size_t size)
+static void copy_mc_test_init(char *dst, char *src, size_t size)
 {
        size_t i;
 
@@ -3300,7 +3301,7 @@ static void mcsafe_test_init(char *dst, char *src, size_t size)
                src[i] = (char) i;
 }
 
-static bool mcsafe_test_validate(unsigned char *dst, unsigned char *src,
+static bool copy_mc_test_validate(unsigned char *dst, unsigned char *src,
                size_t size, unsigned long rem)
 {
        size_t i;
@@ -3321,12 +3322,12 @@ static bool mcsafe_test_validate(unsigned char *dst, unsigned char *src,
        return true;
 }
 
-void mcsafe_test(void)
+void copy_mc_test(void)
 {
        char *inject_desc[] = { "none", "source", "destination" };
        enum INJECT inj;
 
-       if (IS_ENABLED(CONFIG_MCSAFE_TEST)) {
+       if (IS_ENABLED(CONFIG_COPY_MC_TEST)) {
                pr_info("%s: run...\n", __func__);
        } else {
                pr_info("%s: disabled, skip.\n", __func__);
@@ -3344,31 +3345,31 @@ void mcsafe_test(void)
 
                        switch (inj) {
                        case INJECT_NONE:
-                               mcsafe_inject_src(NULL);
-                               mcsafe_inject_dst(NULL);
-                               dst = &mcsafe_buf[2048];
-                               src = &mcsafe_buf[1024 - i];
+                               copy_mc_inject_src(NULL);
+                               copy_mc_inject_dst(NULL);
+                               dst = &copy_mc_buf[2048];
+                               src = &copy_mc_buf[1024 - i];
                                expect = 0;
                                break;
                        case INJECT_SRC:
-                               mcsafe_inject_src(&mcsafe_buf[1024]);
-                               mcsafe_inject_dst(NULL);
-                               dst = &mcsafe_buf[2048];
-                               src = &mcsafe_buf[1024 - i];
+                               copy_mc_inject_src(&copy_mc_buf[1024]);
+                               copy_mc_inject_dst(NULL);
+                               dst = &copy_mc_buf[2048];
+                               src = &copy_mc_buf[1024 - i];
                                expect = 512 - i;
                                break;
                        case INJECT_DST:
-                               mcsafe_inject_src(NULL);
-                               mcsafe_inject_dst(&mcsafe_buf[2048]);
-                               dst = &mcsafe_buf[2048 - i];
-                               src = &mcsafe_buf[1024];
+                               copy_mc_inject_src(NULL);
+                               copy_mc_inject_dst(&copy_mc_buf[2048]);
+                               dst = &copy_mc_buf[2048 - i];
+                               src = &copy_mc_buf[1024];
                                expect = 512 - i;
                                break;
                        }
 
-                       mcsafe_test_init(dst, src, 512);
-                       rem = __memcpy_mcsafe(dst, src, 512);
-                       valid = mcsafe_test_validate(dst, src, 512, expect);
+                       copy_mc_test_init(dst, src, 512);
+                       rem = copy_mc_fragile(dst, src, 512);
+                       valid = copy_mc_test_validate(dst, src, 512, expect);
                        if (rem == expect && valid)
                                continue;
                        pr_info("%s: copy(%#lx, %#lx, %d) off: %d rem: %ld %s expect: %ld\n",
@@ -3380,8 +3381,8 @@ void mcsafe_test(void)
                }
        }
 
-       mcsafe_inject_src(NULL);
-       mcsafe_inject_dst(NULL);
+       copy_mc_inject_src(NULL);
+       copy_mc_inject_dst(NULL);
 }
 
 static __init int nfit_test_init(void)
@@ -3392,7 +3393,7 @@ static __init int nfit_test_init(void)
        libnvdimm_test();
        acpi_nfit_test();
        device_dax_test();
-       mcsafe_test();
+       copy_mc_test();
        dax_pmem_test();
        dax_pmem_core_test();
 #ifdef CONFIG_DEV_DAX_PMEM_COMPAT