hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/powerpc/include/asm/lppaca.h
....@@ -1,23 +1,33 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * lppaca.h
34 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
185 */
196 #ifndef _ASM_POWERPC_LPPACA_H
207 #define _ASM_POWERPC_LPPACA_H
8
+
9
+/*
10
+ * The below VPHN macros are outside the __KERNEL__ check since these are
11
+ * used for compiling the vphn selftest in userspace
12
+ */
13
+
14
+/* The H_HOME_NODE_ASSOCIATIVITY h_call returns 6 64-bit registers. */
15
+#define VPHN_REGISTER_COUNT 6
16
+
17
+/*
18
+ * 6 64-bit registers unpacked into up to 24 be32 associativity values. To
19
+ * form the complete property we have to add the length in the first cell.
20
+ */
21
+#define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1)
22
+
23
+/*
24
+ * The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags:
25
+ * 1 for retrieving associativity information for a guest cpu
26
+ * 2 for retrieving associativity information for a host/hypervisor cpu
27
+ */
28
+#define VPHN_FLAG_VCPU 1
29
+#define VPHN_FLAG_PCPU 2
30
+
2131 #ifdef __KERNEL__
2232
2333 /*
....@@ -35,6 +45,7 @@
3545 #include <asm/types.h>
3646 #include <asm/mmu.h>
3747 #include <asm/firmware.h>
48
+#include <asm/paca.h>
3849
3950 /*
4051 * The lppaca is the "virtual processor area" registered with the hypervisor,
....@@ -113,12 +124,22 @@
113124 */
114125 #define LPPACA_OLD_SHARED_PROC 2
115126
116
-static inline bool lppaca_shared_proc(struct lppaca *l)
127
+#ifdef CONFIG_PPC_PSERIES
128
+/*
129
+ * All CPUs should have the same shared proc value, so directly access the PACA
130
+ * to avoid false positives from DEBUG_PREEMPT.
131
+ */
132
+static inline bool lppaca_shared_proc(void)
117133 {
134
+ struct lppaca *l = local_paca->lppaca_ptr;
135
+
118136 if (!firmware_has_feature(FW_FEATURE_SPLPAR))
119137 return false;
120138 return !!(l->__old_status & LPPACA_OLD_SHARED_PROC);
121139 }
140
+
141
+#define get_lppaca() (get_paca()->lppaca_ptr)
142
+#endif
122143
123144 /*
124145 * SLB shadow buffer structure as defined in the PAPR. The save_area
....@@ -135,34 +156,7 @@
135156 } save_area[SLB_NUM_BOLTED];
136157 } ____cacheline_aligned;
137158
138
-/*
139
- * Layout of entries in the hypervisor's dispatch trace log buffer.
140
- */
141
-struct dtl_entry {
142
- u8 dispatch_reason;
143
- u8 preempt_reason;
144
- __be16 processor_id;
145
- __be32 enqueue_to_dispatch_time;
146
- __be32 ready_to_enqueue_time;
147
- __be32 waiting_to_ready_time;
148
- __be64 timebase;
149
- __be64 fault_addr;
150
- __be64 srr0;
151
- __be64 srr1;
152
-};
153
-
154
-#define DISPATCH_LOG_BYTES 4096 /* bytes per cpu */
155
-#define N_DISPATCH_LOG (DISPATCH_LOG_BYTES / sizeof(struct dtl_entry))
156
-
157
-extern struct kmem_cache *dtl_cache;
158
-
159
-/*
160
- * When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE = y, the cpu accounting code controls
161
- * reading from the dispatch trace log. If other code wants to consume
162
- * DTL entries, it can set this pointer to a function that will get
163
- * called once for each DTL entry that gets processed.
164
- */
165
-extern void (*dtl_consumer)(struct dtl_entry *entry, u64 index);
159
+extern long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity);
166160
167161 #endif /* CONFIG_PPC_BOOK3S */
168162 #endif /* __KERNEL__ */