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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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-only */
  2 /*
  3  * POWER Data Stream Control Register (DSCR)
  4  *
  5  * This header file contains helper functions and macros
  6  * required for all the DSCR related test cases.
  7  *
  8  * Copyright 2012, Anton Blanchard, IBM Corporation.
  9  * Copyright 2015, Anshuman Khandual, IBM Corporation.
 10  */
 11 #ifndef _SELFTESTS_POWERPC_DSCR_DSCR_H
 12 #define _SELFTESTS_POWERPC_DSCR_DSCR_H
 13 
 14 #include <unistd.h>
 15 #include <stdio.h>
 16 #include <stdlib.h>
 17 #include <string.h>
 18 #include <fcntl.h>
 19 #include <dirent.h>
 20 #include <pthread.h>
 21 #include <sched.h>
 22 #include <sys/types.h>
 23 #include <sys/stat.h>
 24 #include <sys/wait.h>
 25 
 26 #include "reg.h"
 27 #include "utils.h"
 28 
 29 #define THREADS         100     /* Max threads */
 30 #define COUNT           100     /* Max iterations */
 31 #define DSCR_MAX        16      /* Max DSCR value */
 32 #define LEN_MAX         100     /* Max name length */
 33 
 34 #define DSCR_DEFAULT    "/sys/devices/system/cpu/dscr_default"
 35 #define CPU_PATH        "/sys/devices/system/cpu/"
 36 
 37 #define rmb()  asm volatile("lwsync":::"memory")
 38 #define wmb()  asm volatile("lwsync":::"memory")
 39 
 40 #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
 41 
 42 /* Prilvilege state DSCR access */
 43 inline unsigned long get_dscr(void)
 44 {
 45         return mfspr(SPRN_DSCR_PRIV);
 46 }
 47 
 48 inline void set_dscr(unsigned long val)
 49 {
 50         mtspr(SPRN_DSCR_PRIV, val);
 51 }
 52 
 53 /* Problem state DSCR access */
 54 inline unsigned long get_dscr_usr(void)
 55 {
 56         return mfspr(SPRN_DSCR);
 57 }
 58 
 59 inline void set_dscr_usr(unsigned long val)
 60 {
 61         mtspr(SPRN_DSCR, val);
 62 }
 63 
 64 /* Default DSCR access */
 65 unsigned long get_default_dscr(void)
 66 {
 67         int err;
 68         unsigned long val;
 69 
 70         err = read_ulong(DSCR_DEFAULT, &val, 16);
 71         if (err) {
 72                 perror("read() failed");
 73                 exit(1);
 74         }
 75         return val;
 76 }
 77 
 78 void set_default_dscr(unsigned long val)
 79 {
 80         int err;
 81 
 82         err = write_ulong(DSCR_DEFAULT, val, 16);
 83         if (err) {
 84                 perror("write() failed");
 85                 exit(1);
 86         }
 87 }
 88 
 89 #endif  /* _SELFTESTS_POWERPC_DSCR_DSCR_H */
 90 

~ [ 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