18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* Copyright 2017 IBM Corp. */ 38c2ecf20Sopenharmony_ci#ifndef _UAPI_MISC_OCXL_H 48c2ecf20Sopenharmony_ci#define _UAPI_MISC_OCXL_H 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/types.h> 78c2ecf20Sopenharmony_ci#include <linux/ioctl.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cienum ocxl_event_type { 108c2ecf20Sopenharmony_ci OCXL_AFU_EVENT_XSL_FAULT_ERROR = 0, 118c2ecf20Sopenharmony_ci}; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define OCXL_KERNEL_EVENT_FLAG_LAST 0x0001 /* This is the last event pending */ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct ocxl_kernel_event_header { 168c2ecf20Sopenharmony_ci __u16 type; 178c2ecf20Sopenharmony_ci __u16 flags; 188c2ecf20Sopenharmony_ci __u32 reserved; 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistruct ocxl_kernel_event_xsl_fault_error { 228c2ecf20Sopenharmony_ci __u64 addr; 238c2ecf20Sopenharmony_ci __u64 dsisr; 248c2ecf20Sopenharmony_ci __u64 count; 258c2ecf20Sopenharmony_ci __u64 reserved; 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistruct ocxl_ioctl_attach { 298c2ecf20Sopenharmony_ci __u64 amr; 308c2ecf20Sopenharmony_ci __u64 reserved1; 318c2ecf20Sopenharmony_ci __u64 reserved2; 328c2ecf20Sopenharmony_ci __u64 reserved3; 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct ocxl_ioctl_metadata { 368c2ecf20Sopenharmony_ci __u16 version; /* struct version, always backwards compatible */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci /* Version 0 fields */ 398c2ecf20Sopenharmony_ci __u8 afu_version_major; 408c2ecf20Sopenharmony_ci __u8 afu_version_minor; 418c2ecf20Sopenharmony_ci __u32 pasid; /* PASID assigned to the current context */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci __u64 pp_mmio_size; /* Per PASID MMIO size */ 448c2ecf20Sopenharmony_ci __u64 global_mmio_size; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci /* End version 0 fields */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci __u64 reserved[13]; /* Total of 16*u64 */ 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistruct ocxl_ioctl_p9_wait { 528c2ecf20Sopenharmony_ci __u16 thread_id; /* The thread ID required to wake this thread */ 538c2ecf20Sopenharmony_ci __u16 reserved1; 548c2ecf20Sopenharmony_ci __u32 reserved2; 558c2ecf20Sopenharmony_ci __u64 reserved3[3]; 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT 0x01 598c2ecf20Sopenharmony_cistruct ocxl_ioctl_features { 608c2ecf20Sopenharmony_ci __u64 flags[4]; 618c2ecf20Sopenharmony_ci}; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_cistruct ocxl_ioctl_irq_fd { 648c2ecf20Sopenharmony_ci __u64 irq_offset; 658c2ecf20Sopenharmony_ci __s32 eventfd; 668c2ecf20Sopenharmony_ci __u32 reserved; 678c2ecf20Sopenharmony_ci}; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* ioctl numbers */ 708c2ecf20Sopenharmony_ci#define OCXL_MAGIC 0xCA 718c2ecf20Sopenharmony_ci/* AFU devices */ 728c2ecf20Sopenharmony_ci#define OCXL_IOCTL_ATTACH _IOW(OCXL_MAGIC, 0x10, struct ocxl_ioctl_attach) 738c2ecf20Sopenharmony_ci#define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64) 748c2ecf20Sopenharmony_ci#define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64) 758c2ecf20Sopenharmony_ci#define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd) 768c2ecf20Sopenharmony_ci#define OCXL_IOCTL_GET_METADATA _IOR(OCXL_MAGIC, 0x14, struct ocxl_ioctl_metadata) 778c2ecf20Sopenharmony_ci#define OCXL_IOCTL_ENABLE_P9_WAIT _IOR(OCXL_MAGIC, 0x15, struct ocxl_ioctl_p9_wait) 788c2ecf20Sopenharmony_ci#define OCXL_IOCTL_GET_FEATURES _IOR(OCXL_MAGIC, 0x16, struct ocxl_ioctl_features) 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#endif /* _UAPI_MISC_OCXL_H */ 81