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