• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/amd-catalyst/0005-Use-a-local-copy-of-copy_xregs_to_kernel.patch
Romain PerierRomain Perier committed 689ae6e404c23 Aug 2016
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
From eb703737be5c91c1a0817351db8ec152c523c85d Mon Sep 17 00:00:00 2001
2
From: Alberto Milone <alberto.milone@canonical.com>
3
Date: Thu, 17 Sep 2015 15:49:46 +0200
4
Subject: [PATCH] Use a local copy of copy_xregs_to_kernel
5
​
6
This is needed for Linux 4.2.
7
​
8
Thanks to Tim Gardner for the patch.
9
​
10
Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
11
---
12
 common/lib/modules/fglrx/build_mod/firegl_public.c | 44 +++++++++++++++++++++-
13
 1 file changed, 43 insertions(+), 1 deletion(-)
14
​
15
diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
16
index 4c1f9a5..bb67bba 100755
17
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
18
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
19
@@ -6443,6 +6443,48 @@ int ATI_API_CALL kcl_sscanf(const char * buf, const char * fmt, ...)
20
     return i;
21
 }
22
 
23
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
24
+/*
25
+ * Save processor xstate to xsave area.
26
+ */
27
+static void _copy_xregs_to_kernel(struct xregs_state *xstate)
28
+{
29
+        u64 mask = -1;
30
+        u32 lmask = mask;
31
+        u32 hmask = mask >> 32;
32
+        int err = 0;
33
+
34
+        /*WARN_ON(!alternatives_patched);*/
35
+
36
+        /*
37
+         * If xsaves is enabled, xsaves replaces xsaveopt because
38
+         * it supports compact format and supervisor states in addition to
39
+         * modified optimization in xsaveopt.
40
+         *
41
+         * Otherwise, if xsaveopt is enabled, xsaveopt replaces xsave
42
+         * because xsaveopt supports modified optimization which is not
43
+         * supported by xsave.
44
+         *
45
+         * If none of xsaves and xsaveopt is enabled, use xsave.
46
+         */
47
+        alternative_input_2(
48
+                "1:"XSAVE,
49
+                XSAVEOPT,
50
+                X86_FEATURE_XSAVEOPT,
51
+                XSAVES,
52
+                X86_FEATURE_XSAVES,
53
+                [xstate] "D" (xstate), "a" (lmask), "d" (hmask) :
54
+                "memory");
55
+        asm volatile("2:\n\t"
56
+                     xstate_fault(err)
57
+                     : "0" (err)
58
+                     : "memory");
59
+
60
+        /* We should never fault when copying to a kernel buffer: */
61
+        WARN_ON_FPU(err);
62
+}
63
+#endif
64
+
65
 /** \brief Generate UUID
66
  *  \param buf pointer to the generated UUID
67
  *  \return None
68
@@ -6462,7 +6504,7 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
69
       fpu_xsave(fpu);
70
       if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
71
 #else
72
-      copy_xregs_to_kernel(&fpu->state.xsave);
73
+      _copy_xregs_to_kernel(&fpu->state.xsave);
74
       if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
75
 #endif
76
     return 1;
77
-- 
78
2.8.1
79
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.