提交 f4b7e18d 编写于 作者: W Wang ShaoBo 提交者: Zheng Zengkai

kabi: reserve space for arm64 SME in thread_struct

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4QPLR
CVE: NA

Reference: https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211210184133.320748-1-broonie@kernel.org/

-------------------------------

Reserve space for arm64 SME in thread_struct.

According to the implementation of SME, we need to reserve space for the
following fields like this:

        +enum vec_type {
        +       ARM64_VEC_SVE = 0,
        +       ARM64_VEC_SME,
        +       ARM64_VEC_MAX,
        +};
        +
         struct thread_struct {
                struct cpu_context      cpu_context;    /* cpu context */

        @@ -149,8 +155,6 @@ struct thread_struct {

                unsigned int            fpsimd_cpu;
                void                    *sve_state;     /* SVE registers, if any */
        -       unsigned int            sve_vl;         /* SVE vector length */
        -       unsigned int            sve_vl_onexec;  /* SVE vl after next exec */
                unsigned long           fault_address;  /* fault info */
                unsigned long           fault_code;     /* ESR_EL1 value */
                struct debug_info       debug;          /* debugging */
        @@ -162,6 +166,11 @@ struct thread_struct {
                u64                     sctlr_tcf0;
                u64                     gcr_user_incl;
         #endif
        +       void *za_state; /* ZA register, if any */
        +       unsigned int vl[ARM64_VEC_MAX]; /* vector length */
        +       unsigned int vl_onexec[ARM64_VEC_MAX]; /* vl after next exec */
        +       u64 svcr;
        +       u64 tpidr2_el0;
         };

This requires at least five 64bit spaces, other three for expansion.
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ea10c1ed
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/thread_info.h> #include <linux/thread_info.h>
#include <linux/kabi.h>
#include <vdso/processor.h> #include <vdso/processor.h>
...@@ -162,6 +163,14 @@ struct thread_struct { ...@@ -162,6 +163,14 @@ struct thread_struct {
u64 sctlr_tcf0; u64 sctlr_tcf0;
u64 gcr_user_incl; u64 gcr_user_incl;
#endif #endif
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
}; };
static inline void arch_thread_struct_whitelist(unsigned long *offset, static inline void arch_thread_struct_whitelist(unsigned long *offset,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册