#include <linux/mm_types.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/sched/signal.h>
#include <linux/sched/mm.h>
#include <linux/uaccess.h>
#include <linux/mman.h>
#include <linux/memory.h>
#include "kfd_priv.h"
#include "kfd_events.h"
#include <linux/device.h>
struct kfd_event_waiter { … };
struct kfd_signal_page { … };
static uint64_t *page_slots(struct kfd_signal_page *page)
{ … }
static struct kfd_signal_page *allocate_signal_page(struct kfd_process *p)
{ … }
static int allocate_event_notification_slot(struct kfd_process *p,
struct kfd_event *ev,
const int *restore_id)
{ … }
static struct kfd_event *lookup_event_by_id(struct kfd_process *p, uint32_t id)
{ … }
static struct kfd_event *lookup_signaled_event_by_partial_id(
struct kfd_process *p, uint32_t id, uint32_t bits)
{ … }
static int create_signal_event(struct file *devkfd, struct kfd_process *p,
struct kfd_event *ev, const int *restore_id)
{ … }
static int create_other_event(struct kfd_process *p, struct kfd_event *ev, const int *restore_id)
{ … }
int kfd_event_init_process(struct kfd_process *p)
{ … }
static void destroy_event(struct kfd_process *p, struct kfd_event *ev)
{ … }
static void destroy_events(struct kfd_process *p)
{ … }
static void shutdown_signal_page(struct kfd_process *p)
{ … }
void kfd_event_free_process(struct kfd_process *p)
{ … }
static bool event_can_be_gpu_signaled(const struct kfd_event *ev)
{ … }
static bool event_can_be_cpu_signaled(const struct kfd_event *ev)
{ … }
static int kfd_event_page_set(struct kfd_process *p, void *kernel_address,
uint64_t size, uint64_t user_handle)
{ … }
int kfd_kmap_event_page(struct kfd_process *p, uint64_t event_page_offset)
{ … }
int kfd_event_create(struct file *devkfd, struct kfd_process *p,
uint32_t event_type, bool auto_reset, uint32_t node_id,
uint32_t *event_id, uint32_t *event_trigger_data,
uint64_t *event_page_offset, uint32_t *event_slot_index)
{ … }
int kfd_criu_restore_event(struct file *devkfd,
struct kfd_process *p,
uint8_t __user *user_priv_ptr,
uint64_t *priv_data_offset,
uint64_t max_priv_data_size)
{ … }
int kfd_criu_checkpoint_events(struct kfd_process *p,
uint8_t __user *user_priv_data,
uint64_t *priv_data_offset)
{ … }
int kfd_get_num_events(struct kfd_process *p)
{ … }
int kfd_event_destroy(struct kfd_process *p, uint32_t event_id)
{ … }
static void set_event(struct kfd_event *ev)
{ … }
int kfd_set_event(struct kfd_process *p, uint32_t event_id)
{ … }
static void reset_event(struct kfd_event *ev)
{ … }
int kfd_reset_event(struct kfd_process *p, uint32_t event_id)
{ … }
static void acknowledge_signal(struct kfd_process *p, struct kfd_event *ev)
{ … }
static void set_event_from_interrupt(struct kfd_process *p,
struct kfd_event *ev)
{ … }
void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
uint32_t valid_id_bits)
{ … }
static struct kfd_event_waiter *alloc_event_waiters(uint32_t num_events)
{ … }
static int init_event_waiter(struct kfd_process *p,
struct kfd_event_waiter *waiter,
struct kfd_event_data *event_data)
{ … }
static uint32_t test_event_condition(bool all, uint32_t num_events,
struct kfd_event_waiter *event_waiters)
{ … }
static int copy_signaled_event_data(uint32_t num_events,
struct kfd_event_waiter *event_waiters,
struct kfd_event_data __user *data)
{ … }
static long user_timeout_to_jiffies(uint32_t user_timeout_ms)
{ … }
static void free_waiters(uint32_t num_events, struct kfd_event_waiter *waiters,
bool undo_auto_reset)
{ … }
int kfd_wait_on_events(struct kfd_process *p,
uint32_t num_events, void __user *data,
bool all, uint32_t *user_timeout_ms,
uint32_t *wait_result)
{ … }
int kfd_event_mmap(struct kfd_process *p, struct vm_area_struct *vma)
{ … }
static void lookup_events_by_type_and_signal(struct kfd_process *p,
int type, void *event_data)
{ … }
void kfd_signal_hw_exception_event(u32 pasid)
{ … }
void kfd_signal_vm_fault_event(struct kfd_node *dev, u32 pasid,
struct kfd_vm_fault_info *info,
struct kfd_hsa_memory_exception_data *data)
{ … }
void kfd_signal_reset_event(struct kfd_node *dev)
{ … }
void kfd_signal_poison_consumed_event(struct kfd_node *dev, u32 pasid)
{ … }