~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/powerpc/dexcr/dexcr.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * POWER Dynamic Execution Control Facility (DEXCR)
  4  *
  5  * This header file contains helper functions and macros
  6  * required for all the DEXCR related test cases.
  7  */
  8 #ifndef _SELFTESTS_POWERPC_DEXCR_DEXCR_H
  9 #define _SELFTESTS_POWERPC_DEXCR_DEXCR_H
 10 
 11 #include <stdbool.h>
 12 #include <sys/prctl.h>
 13 #include <sys/types.h>
 14 
 15 #include "reg.h"
 16 
 17 #define DEXCR_PR_BIT(aspect)    __MASK(63 - (32 + (aspect)))
 18 #define DEXCR_PR_SBHE           DEXCR_PR_BIT(0)
 19 #define DEXCR_PR_IBRTPD         DEXCR_PR_BIT(3)
 20 #define DEXCR_PR_SRAPD          DEXCR_PR_BIT(4)
 21 #define DEXCR_PR_NPHIE          DEXCR_PR_BIT(5)
 22 
 23 #define PPC_RAW_HASH_ARGS(b, i, a) \
 24         ((((i) >> 3) & 0x1F) << 21 | (a) << 16 | (b) << 11 | (((i) >> 8) & 0x1))
 25 #define PPC_RAW_HASHST(b, i, a) \
 26         str(.long (0x7C0005A4 | PPC_RAW_HASH_ARGS(b, i, a));)
 27 #define PPC_RAW_HASHCHK(b, i, a) \
 28         str(.long (0x7C0005E4 | PPC_RAW_HASH_ARGS(b, i, a));)
 29 
 30 struct dexcr_aspect {
 31         const char *name;       /* Short display name */
 32         const char *opt;        /* Option name for chdexcr */
 33         const char *desc;       /* Expanded aspect meaning */
 34         unsigned int index;     /* Aspect bit index in DEXCR */
 35         unsigned long prctl;    /* 'which' value for get/set prctl */
 36 };
 37 
 38 static const struct dexcr_aspect aspects[] = {
 39         {
 40                 .name = "SBHE",
 41                 .opt = "sbhe",
 42                 .desc = "Speculative branch hint enable",
 43                 .index = 0,
 44                 .prctl = PR_PPC_DEXCR_SBHE,
 45         },
 46         {
 47                 .name = "IBRTPD",
 48                 .opt = "ibrtpd",
 49                 .desc = "Indirect branch recurrent target prediction disable",
 50                 .index = 3,
 51                 .prctl = PR_PPC_DEXCR_IBRTPD,
 52         },
 53         {
 54                 .name = "SRAPD",
 55                 .opt = "srapd",
 56                 .desc = "Subroutine return address prediction disable",
 57                 .index = 4,
 58                 .prctl = PR_PPC_DEXCR_SRAPD,
 59         },
 60         {
 61                 .name = "NPHIE",
 62                 .opt = "nphie",
 63                 .desc = "Non-privileged hash instruction enable",
 64                 .index = 5,
 65                 .prctl = PR_PPC_DEXCR_NPHIE,
 66         },
 67         {
 68                 .name = "PHIE",
 69                 .opt = "phie",
 70                 .desc = "Privileged hash instruction enable",
 71                 .index = 6,
 72                 .prctl = -1,
 73         },
 74 };
 75 
 76 bool dexcr_exists(void);
 77 
 78 bool pr_dexcr_aspect_supported(unsigned long which);
 79 
 80 bool pr_dexcr_aspect_editable(unsigned long which);
 81 
 82 int pr_get_dexcr(unsigned long pr_aspect);
 83 
 84 int pr_set_dexcr(unsigned long pr_aspect, unsigned long ctrl);
 85 
 86 unsigned int pr_which_to_aspect(unsigned long which);
 87 
 88 bool hashchk_triggers(void);
 89 
 90 enum dexcr_source {
 91         DEXCR,          /* Userspace DEXCR value */
 92         HDEXCR,         /* Hypervisor enforced DEXCR value */
 93         EFFECTIVE,      /* Bitwise OR of UDEXCR and ENFORCED DEXCR bits */
 94 };
 95 
 96 unsigned int get_dexcr(enum dexcr_source source);
 97 
 98 void await_child_success(pid_t pid);
 99 
100 void hashst(unsigned long lr, void *sp);
101 
102 void hashchk(unsigned long lr, void *sp);
103 
104 void do_bad_hashchk(void);
105 
106 #endif  /* _SELFTESTS_POWERPC_DEXCR_DEXCR_H */
107 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php