![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-or-later */ 0002 /* 0003 * lppaca.h 0004 * Copyright (C) 2001 Mike Corrigan IBM Corporation 0005 */ 0006 #ifndef _ASM_POWERPC_LPPACA_H 0007 #define _ASM_POWERPC_LPPACA_H 0008 0009 /* 0010 * The below VPHN macros are outside the __KERNEL__ check since these are 0011 * used for compiling the vphn selftest in userspace 0012 */ 0013 0014 /* The H_HOME_NODE_ASSOCIATIVITY h_call returns 6 64-bit registers. */ 0015 #define VPHN_REGISTER_COUNT 6 0016 0017 /* 0018 * 6 64-bit registers unpacked into up to 24 be32 associativity values. To 0019 * form the complete property we have to add the length in the first cell. 0020 */ 0021 #define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1) 0022 0023 /* 0024 * The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags: 0025 * 1 for retrieving associativity information for a guest cpu 0026 * 2 for retrieving associativity information for a host/hypervisor cpu 0027 */ 0028 #define VPHN_FLAG_VCPU 1 0029 #define VPHN_FLAG_PCPU 2 0030 0031 #ifdef __KERNEL__ 0032 0033 /* 0034 * These definitions relate to hypervisors that only exist when using 0035 * a server type processor 0036 */ 0037 #ifdef CONFIG_PPC_BOOK3S 0038 0039 /* 0040 * This control block contains the data that is shared between the 0041 * hypervisor and the OS. 0042 */ 0043 #include <linux/cache.h> 0044 #include <linux/threads.h> 0045 #include <asm/types.h> 0046 #include <asm/mmu.h> 0047 #include <asm/firmware.h> 0048 0049 /* 0050 * The lppaca is the "virtual processor area" registered with the hypervisor, 0051 * H_REGISTER_VPA etc. 0052 * 0053 * According to PAPR, the structure is 640 bytes long, must be L1 cache line 0054 * aligned, and must not cross a 4kB boundary. Its size field must be at 0055 * least 640 bytes (but may be more). 0056 * 0057 * Pre-v4.14 KVM hypervisors reject the VPA if its size field is smaller than 0058 * 1kB, so we dynamically allocate 1kB and advertise size as 1kB, but keep 0059 * this structure as the canonical 640 byte size. 0060 */ 0061 struct lppaca { 0062 /* cacheline 1 contains read-only data */ 0063 0064 __be32 desc; /* Eye catcher 0xD397D781 */ 0065 __be16 size; /* Size of this struct */ 0066 u8 reserved1[3]; 0067 u8 __old_status; /* Old status, including shared proc */ 0068 u8 reserved3[14]; 0069 volatile __be32 dyn_hw_node_id; /* Dynamic hardware node id */ 0070 volatile __be32 dyn_hw_proc_id; /* Dynamic hardware proc id */ 0071 u8 reserved4[56]; 0072 volatile u8 vphn_assoc_counts[8]; /* Virtual processor home node */ 0073 /* associativity change counters */ 0074 u8 reserved5[32]; 0075 0076 /* cacheline 2 contains local read-write data */ 0077 0078 u8 reserved6[48]; 0079 u8 cede_latency_hint; 0080 u8 ebb_regs_in_use; 0081 u8 reserved7[6]; 0082 u8 dtl_enable_mask; /* Dispatch Trace Log mask */ 0083 u8 donate_dedicated_cpu; /* Donate dedicated CPU cycles */ 0084 u8 fpregs_in_use; 0085 u8 pmcregs_in_use; 0086 u8 reserved8[28]; 0087 __be64 wait_state_cycles; /* Wait cycles for this proc */ 0088 u8 reserved9[28]; 0089 __be16 slb_count; /* # of SLBs to maintain */ 0090 u8 idle; /* Indicate OS is idle */ 0091 u8 vmxregs_in_use; 0092 0093 /* cacheline 3 is shared with other processors */ 0094 0095 /* 0096 * This is the yield_count. An "odd" value (low bit on) means that 0097 * the processor is yielded (either because of an OS yield or a 0098 * hypervisor preempt). An even value implies that the processor is 0099 * currently executing. 0100 * NOTE: Even dedicated processor partitions can yield so this 0101 * field cannot be used to determine if we are shared or dedicated. 0102 */ 0103 volatile __be32 yield_count; 0104 volatile __be32 dispersion_count; /* dispatch changed physical cpu */ 0105 volatile __be64 cmo_faults; /* CMO page fault count */ 0106 volatile __be64 cmo_fault_time; /* CMO page fault time */ 0107 u8 reserved10[104]; 0108 0109 /* cacheline 4-5 */ 0110 0111 __be32 page_ins; /* CMO Hint - # page ins by OS */ 0112 u8 reserved11[148]; 0113 volatile __be64 dtl_idx; /* Dispatch Trace Log head index */ 0114 u8 reserved12[96]; 0115 } ____cacheline_aligned; 0116 0117 #define lppaca_of(cpu) (*paca_ptrs[cpu]->lppaca_ptr) 0118 0119 /* 0120 * We are using a non architected field to determine if a partition is 0121 * shared or dedicated. This currently works on both KVM and PHYP, but 0122 * we will have to transition to something better. 0123 */ 0124 #define LPPACA_OLD_SHARED_PROC 2 0125 0126 static inline bool lppaca_shared_proc(struct lppaca *l) 0127 { 0128 if (!firmware_has_feature(FW_FEATURE_SPLPAR)) 0129 return false; 0130 return !!(l->__old_status & LPPACA_OLD_SHARED_PROC); 0131 } 0132 0133 /* 0134 * SLB shadow buffer structure as defined in the PAPR. The save_area 0135 * contains adjacent ESID and VSID pairs for each shadowed SLB. The 0136 * ESID is stored in the lower 64bits, then the VSID. 0137 */ 0138 struct slb_shadow { 0139 __be32 persistent; /* Number of persistent SLBs */ 0140 __be32 buffer_length; /* Total shadow buffer length */ 0141 __be64 reserved; 0142 struct { 0143 __be64 esid; 0144 __be64 vsid; 0145 } save_area[SLB_NUM_BOLTED]; 0146 } ____cacheline_aligned; 0147 0148 extern long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity); 0149 0150 #endif /* CONFIG_PPC_BOOK3S */ 0151 #endif /* __KERNEL__ */ 0152 #endif /* _ASM_POWERPC_LPPACA_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |