aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/powerpc/kernel/ptrace/ptrace-spe.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2020-04-17 08:12:22 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2020-04-17 08:12:22 +0200
commit08d99b2c23dfa84ca5b5e5c194062a0550888b71 (patch)
treef4cf81ba52b375bbafd3b7ee2603b3a4cae7fe30 /arch/powerpc/kernel/ptrace/ptrace-spe.c
parentdrm: Don't free a struct never allocated by drm_gem_fb_init() (diff)
parentLinux 5.7-rc1 (diff)
downloadwireguard-linux-08d99b2c23dfa84ca5b5e5c194062a0550888b71.tar.xz
wireguard-linux-08d99b2c23dfa84ca5b5e5c194062a0550888b71.zip
Merge drm/drm-next into drm-misc-next
Backmerging required to pull topic/phy-compliance. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'arch/powerpc/kernel/ptrace/ptrace-spe.c')
-rw-r--r--arch/powerpc/kernel/ptrace/ptrace-spe.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/ptrace/ptrace-spe.c b/arch/powerpc/kernel/ptrace/ptrace-spe.c
new file mode 100644
index 000000000000..68b86b4a4be4
--- /dev/null
+++ b/arch/powerpc/kernel/ptrace/ptrace-spe.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <linux/regset.h>
+
+#include <asm/switch_to.h>
+
+#include "ptrace-decl.h"
+
+/*
+ * For get_evrregs/set_evrregs functions 'data' has the following layout:
+ *
+ * struct {
+ * u32 evr[32];
+ * u64 acc;
+ * u32 spefscr;
+ * }
+ */
+
+int evr_active(struct task_struct *target, const struct user_regset *regset)
+{
+ flush_spe_to_thread(target);
+ return target->thread.used_spe ? regset->n : 0;
+}
+
+int evr_get(struct task_struct *target, const struct user_regset *regset,
+ unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
+{
+ int ret;
+
+ flush_spe_to_thread(target);
+
+ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+ &target->thread.evr,
+ 0, sizeof(target->thread.evr));
+
+ BUILD_BUG_ON(offsetof(struct thread_struct, acc) + sizeof(u64) !=
+ offsetof(struct thread_struct, spefscr));
+
+ if (!ret)
+ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+ &target->thread.acc,
+ sizeof(target->thread.evr), -1);
+
+ return ret;
+}
+
+int evr_set(struct task_struct *target, const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+ int ret;
+
+ flush_spe_to_thread(target);
+
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
+ &target->thread.evr,
+ 0, sizeof(target->thread.evr));
+
+ BUILD_BUG_ON(offsetof(struct thread_struct, acc) + sizeof(u64) !=
+ offsetof(struct thread_struct, spefscr));
+
+ if (!ret)
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
+ &target->thread.acc,
+ sizeof(target->thread.evr), -1);
+
+ return ret;
+}