forked from mirrors/linux
		
	RISC-V: Move struct riscv_cpuinfo to new header
In preparation for tracking and exposing microarchitectural details to userspace (like whether or not unaligned accesses are fast), move the riscv_cpuinfo struct out to its own new cpufeatures.h header. It will need to be used by more than just cpu.c. Signed-off-by: Evan Green <evan@rivosinc.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Heiko Stuebner <heiko.stuebner@vrull.eu> Tested-by: Heiko Stuebner <heiko.stuebner@vrull.eu> Reviewed-by: Paul Walmsley <paul.walmsley@sifive.com> Link: https://lore.kernel.org/r/20230407231103.2622178-2-evan@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
		
							parent
							
								
									fe15c26ee2
								
							
						
					
					
						commit
						ff77cf5b2e
					
				
					 2 changed files with 23 additions and 6 deletions
				
			
		
							
								
								
									
										21
									
								
								arch/riscv/include/asm/cpufeature.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								arch/riscv/include/asm/cpufeature.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  | /*
 | ||||||
|  |  * Copyright 2022-2023 Rivos, Inc | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _ASM_CPUFEATURE_H | ||||||
|  | #define _ASM_CPUFEATURE_H | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * These are probed via a device_initcall(), via either the SBI or directly | ||||||
|  |  * from the corresponding CSRs. | ||||||
|  |  */ | ||||||
|  | struct riscv_cpuinfo { | ||||||
|  | 	unsigned long mvendorid; | ||||||
|  | 	unsigned long marchid; | ||||||
|  | 	unsigned long mimpid; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | DECLARE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo); | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -7,6 +7,7 @@ | ||||||
| #include <linux/init.h> | #include <linux/init.h> | ||||||
| #include <linux/seq_file.h> | #include <linux/seq_file.h> | ||||||
| #include <linux/of.h> | #include <linux/of.h> | ||||||
|  | #include <asm/cpufeature.h> | ||||||
| #include <asm/csr.h> | #include <asm/csr.h> | ||||||
| #include <asm/hwcap.h> | #include <asm/hwcap.h> | ||||||
| #include <asm/sbi.h> | #include <asm/sbi.h> | ||||||
|  | @ -70,12 +71,7 @@ int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid) | ||||||
| 	return -1; | 	return -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| struct riscv_cpuinfo { | DEFINE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo); | ||||||
| 	unsigned long mvendorid; |  | ||||||
| 	unsigned long marchid; |  | ||||||
| 	unsigned long mimpid; |  | ||||||
| }; |  | ||||||
| static DEFINE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo); |  | ||||||
| 
 | 
 | ||||||
| unsigned long riscv_cached_mvendorid(unsigned int cpu_id) | unsigned long riscv_cached_mvendorid(unsigned int cpu_id) | ||||||
| { | { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Evan Green
						Evan Green