/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2024 Arm Ltd4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627#ifndef _ARM64_ARM_SPE_H_28#define _ARM64_ARM_SPE_H_2930/* kqueue events */31#define ARM_SPE_KQ_BUF 13832#define ARM_SPE_KQ_SHUTDOWN 13933#define ARM_SPE_KQ_SIGNAL 1403435/* spe_backend_read() u64 data encoding */36#define KQ_BUF_POS_SHIFT 037#define KQ_BUF_POS (1 << KQ_BUF_POS_SHIFT)38#define KQ_PARTREC_SHIFT 139#define KQ_PARTREC (1 << KQ_PARTREC_SHIFT)40#define KQ_FINAL_BUF_SHIFT 241#define KQ_FINAL_BUF (1 << KQ_FINAL_BUF_SHIFT)4243enum arm_spe_ctx_field {44ARM_SPE_CTX_NONE,45ARM_SPE_CTX_PID,46ARM_SPE_CTX_CPU_ID47};4849enum arm_spe_profiling_level {50ARM_SPE_KERNEL_AND_USER,51ARM_SPE_KERNEL_ONLY,52ARM_SPE_USER_ONLY53};54struct arm_spe_config {55/* Minimum interval is IMP DEF up to maximum 24 bit value */56uint32_t interval;5758/* Profile kernel (EL1), userspace (EL0) or both */59enum arm_spe_profiling_level level;6061/*62* Configure context field in SPE records to store either the63* current PID, the CPU ID or neither64*65* In PID mode, kernel threads without a process context are66* logged as PID 067*/68enum arm_spe_ctx_field ctx_field;69};7071struct arm_spe_svc_buf {72uint32_t ident;73uint8_t buf_idx : 1;74};7576#endif /* _ARM64_ARM_SPE_H_ */777879