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

TOMOYO Linux Cross Reference
Linux/arch/loongarch/kernel/proc.c

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
  2 /*
  3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  4  */
  5 #include <linux/delay.h>
  6 #include <linux/kernel.h>
  7 #include <linux/sched.h>
  8 #include <linux/seq_file.h>
  9 #include <asm/bootinfo.h>
 10 #include <asm/cpu.h>
 11 #include <asm/cpu-features.h>
 12 #include <asm/idle.h>
 13 #include <asm/processor.h>
 14 #include <asm/time.h>
 15 
 16 /*
 17  * No lock; only written during early bootup by CPU 0.
 18  */
 19 static RAW_NOTIFIER_HEAD(proc_cpuinfo_chain);
 20 
 21 int __ref register_proc_cpuinfo_notifier(struct notifier_block *nb)
 22 {
 23         return raw_notifier_chain_register(&proc_cpuinfo_chain, nb);
 24 }
 25 
 26 int proc_cpuinfo_notifier_call_chain(unsigned long val, void *v)
 27 {
 28         return raw_notifier_call_chain(&proc_cpuinfo_chain, val, v);
 29 }
 30 
 31 static int show_cpuinfo(struct seq_file *m, void *v)
 32 {
 33         unsigned long n = (unsigned long) v - 1;
 34         unsigned int version = cpu_data[n].processor_id & 0xff;
 35         unsigned int fp_version = cpu_data[n].fpu_vers;
 36         struct proc_cpuinfo_notifier_args proc_cpuinfo_notifier_args;
 37 
 38 #ifdef CONFIG_SMP
 39         if (!cpu_online(n))
 40                 return 0;
 41 #endif
 42 
 43         /*
 44          * For the first processor also print the system type
 45          */
 46         if (n == 0)
 47                 seq_printf(m, "system type\t\t: %s\n\n", get_system_type());
 48 
 49         seq_printf(m, "processor\t\t: %ld\n", n);
 50         seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
 51         seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
 52         seq_printf(m, "global_id\t\t: %d\n", cpu_data[n].global_id);
 53         seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
 54         seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
 55         seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
 56         seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);
 57         seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",
 58                       cpu_clock_freq / 1000000, (cpu_clock_freq / 10000) % 100);
 59         seq_printf(m, "BogoMIPS\t\t: %llu.%02llu\n",
 60                       (lpj_fine * cpu_clock_freq / const_clock_freq) / (500000/HZ),
 61                       ((lpj_fine * cpu_clock_freq / const_clock_freq) / (5000/HZ)) % 100);
 62         seq_printf(m, "TLB Entries\t\t: %d\n", cpu_data[n].tlbsize);
 63         seq_printf(m, "Address Sizes\t\t: %d bits physical, %d bits virtual\n",
 64                       cpu_pabits + 1, cpu_vabits + 1);
 65 
 66         seq_printf(m, "ISA\t\t\t:");
 67         if (cpu_has_loongarch32)
 68                 seq_printf(m, " loongarch32");
 69         if (cpu_has_loongarch64)
 70                 seq_printf(m, " loongarch64");
 71         seq_printf(m, "\n");
 72 
 73         seq_printf(m, "Features\t\t:");
 74         if (cpu_has_cpucfg)     seq_printf(m, " cpucfg");
 75         if (cpu_has_lam)        seq_printf(m, " lam");
 76         if (cpu_has_ual)        seq_printf(m, " ual");
 77         if (cpu_has_fpu)        seq_printf(m, " fpu");
 78         if (cpu_has_lsx)        seq_printf(m, " lsx");
 79         if (cpu_has_lasx)       seq_printf(m, " lasx");
 80         if (cpu_has_crc32)      seq_printf(m, " crc32");
 81         if (cpu_has_complex)    seq_printf(m, " complex");
 82         if (cpu_has_crypto)     seq_printf(m, " crypto");
 83         if (cpu_has_ptw)        seq_printf(m, " ptw");
 84         if (cpu_has_lvz)        seq_printf(m, " lvz");
 85         if (cpu_has_lbt_x86)    seq_printf(m, " lbt_x86");
 86         if (cpu_has_lbt_arm)    seq_printf(m, " lbt_arm");
 87         if (cpu_has_lbt_mips)   seq_printf(m, " lbt_mips");
 88         seq_printf(m, "\n");
 89 
 90         seq_printf(m, "Hardware Watchpoint\t: %s",
 91                       cpu_has_watch ? "yes, " : "no\n");
 92         if (cpu_has_watch) {
 93                 seq_printf(m, "iwatch count: %d, dwatch count: %d\n",
 94                       cpu_data[n].watch_ireg_count, cpu_data[n].watch_dreg_count);
 95         }
 96 
 97         proc_cpuinfo_notifier_args.m = m;
 98         proc_cpuinfo_notifier_args.n = n;
 99 
100         raw_notifier_call_chain(&proc_cpuinfo_chain, 0,
101                                 &proc_cpuinfo_notifier_args);
102 
103         seq_printf(m, "\n");
104 
105         return 0;
106 }
107 
108 static void *c_start(struct seq_file *m, loff_t *pos)
109 {
110         unsigned long i = *pos;
111 
112         return i < nr_cpu_ids ? (void *)(i + 1) : NULL;
113 }
114 
115 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
116 {
117         ++*pos;
118         return c_start(m, pos);
119 }
120 
121 static void c_stop(struct seq_file *m, void *v)
122 {
123 }
124 
125 const struct seq_operations cpuinfo_op = {
126         .start  = c_start,
127         .next   = c_next,
128         .stop   = c_stop,
129         .show   = show_cpuinfo,
130 };
131 

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