summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/dscr
diff options
context:
space:
mode:
authorBenjamin Gray <bgray@linux.ibm.com>2022-11-28 07:19:42 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2022-12-02 10:04:27 +0300
commitaecfd680099ba518c34dff2941017c5aa97def52 (patch)
treebcf31ab0f1e97370e3d91ae078452865f8f34c7e /tools/testing/selftests/powerpc/dscr
parent5921eb36d2a1b276b16a24e529788550e6a65449 (diff)
downloadlinux-aecfd680099ba518c34dff2941017c5aa97def52.tar.xz
selftests/powerpc: Use mfspr/mtspr macros
No need to write inline asm for mtspr/mfspr, we have macros for this in reg.h Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20221128041948.58339-2-bgray@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/dscr')
-rw-r--r--tools/testing/selftests/powerpc/dscr/dscr.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/tools/testing/selftests/powerpc/dscr/dscr.h b/tools/testing/selftests/powerpc/dscr/dscr.h
index 13e9b9e28e2c..b703714e7d98 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr.h
+++ b/tools/testing/selftests/powerpc/dscr/dscr.h
@@ -23,6 +23,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
+#include "reg.h"
#include "utils.h"
#define THREADS 100 /* Max threads */
@@ -41,31 +42,23 @@
/* Prilvilege state DSCR access */
inline unsigned long get_dscr(void)
{
- unsigned long ret;
-
- asm volatile("mfspr %0,%1" : "=r" (ret) : "i" (SPRN_DSCR_PRIV));
-
- return ret;
+ return mfspr(SPRN_DSCR_PRIV);
}
inline void set_dscr(unsigned long val)
{
- asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR_PRIV));
+ mtspr(SPRN_DSCR_PRIV, val);
}
/* Problem state DSCR access */
inline unsigned long get_dscr_usr(void)
{
- unsigned long ret;
-
- asm volatile("mfspr %0,%1" : "=r" (ret) : "i" (SPRN_DSCR));
-
- return ret;
+ return mfspr(SPRN_DSCR);
}
inline void set_dscr_usr(unsigned long val)
{
- asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR));
+ mtspr(SPRN_DSCR, val);
}
/* Default DSCR access */