Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 1 | #ifndef _ASM_POWERPC_DTL_H |
| 2 | #define _ASM_POWERPC_DTL_H |
| 3 | |
| 4 | #include <asm/lppaca.h> |
| 5 | #include <linux/spinlock_types.h> |
| 6 | |
| 7 | /* |
| 8 | * Layout of entries in the hypervisor's dispatch trace log buffer. |
| 9 | */ |
| 10 | struct dtl_entry { |
| 11 | u8 dispatch_reason; |
| 12 | u8 preempt_reason; |
| 13 | __be16 processor_id; |
| 14 | __be32 enqueue_to_dispatch_time; |
| 15 | __be32 ready_to_enqueue_time; |
| 16 | __be32 waiting_to_ready_time; |
| 17 | __be64 timebase; |
| 18 | __be64 fault_addr; |
| 19 | __be64 srr0; |
| 20 | __be64 srr1; |
| 21 | }; |
| 22 | |
| 23 | #define DISPATCH_LOG_BYTES 4096 /* bytes per cpu */ |
| 24 | #define N_DISPATCH_LOG (DISPATCH_LOG_BYTES / sizeof(struct dtl_entry)) |
| 25 | |
| 26 | /* |
| 27 | * Dispatch trace log event enable mask: |
| 28 | * 0x1: voluntary virtual processor waits |
| 29 | * 0x2: time-slice preempts |
| 30 | * 0x4: virtual partition memory page faults |
| 31 | */ |
| 32 | #define DTL_LOG_CEDE 0x1 |
| 33 | #define DTL_LOG_PREEMPT 0x2 |
| 34 | #define DTL_LOG_FAULT 0x4 |
| 35 | #define DTL_LOG_ALL (DTL_LOG_CEDE | DTL_LOG_PREEMPT | DTL_LOG_FAULT) |
| 36 | |
| 37 | extern struct kmem_cache *dtl_cache; |
| 38 | extern rwlock_t dtl_access_lock; |
| 39 | |
| 40 | /* |
| 41 | * When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE = y, the cpu accounting code controls |
| 42 | * reading from the dispatch trace log. If other code wants to consume |
| 43 | * DTL entries, it can set this pointer to a function that will get |
| 44 | * called once for each DTL entry that gets processed. |
| 45 | */ |
| 46 | extern void (*dtl_consumer)(struct dtl_entry *entry, u64 index); |
| 47 | |
| 48 | extern void register_dtl_buffer(int cpu); |
| 49 | extern void alloc_dtl_buffers(unsigned long *time_limit); |
| 50 | extern long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity); |
| 51 | |
| 52 | #endif /* _ASM_POWERPC_DTL_H */ |