![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 OR MIT */ 0002 /* 0003 * Copyright 2014-2022 Advanced Micro Devices, Inc. 0004 * 0005 * Permission is hereby granted, free of charge, to any person obtaining a 0006 * copy of this software and associated documentation files (the "Software"), 0007 * to deal in the Software without restriction, including without limitation 0008 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0009 * and/or sell copies of the Software, and to permit persons to whom the 0010 * Software is furnished to do so, subject to the following conditions: 0011 * 0012 * The above copyright notice and this permission notice shall be included in 0013 * all copies or substantial portions of the Software. 0014 * 0015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0018 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 0019 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 0020 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0021 * OTHER DEALINGS IN THE SOFTWARE. 0022 */ 0023 0024 #ifndef KFD_EVENTS_H_INCLUDED 0025 #define KFD_EVENTS_H_INCLUDED 0026 0027 #include <linux/kernel.h> 0028 #include <linux/hashtable.h> 0029 #include <linux/types.h> 0030 #include <linux/list.h> 0031 #include <linux/wait.h> 0032 #include "kfd_priv.h" 0033 #include <uapi/linux/kfd_ioctl.h> 0034 0035 /* 0036 * IDR supports non-negative integer IDs. Small IDs are used for 0037 * signal events to match their signal slot. Use the upper half of the 0038 * ID space for non-signal events. 0039 */ 0040 #define KFD_FIRST_NONSIGNAL_EVENT_ID ((INT_MAX >> 1) + 1) 0041 #define KFD_LAST_NONSIGNAL_EVENT_ID INT_MAX 0042 0043 /* 0044 * Written into kfd_signal_slot_t to indicate that the event is not signaled. 0045 * Since the event protocol may need to write the event ID into memory, this 0046 * must not be a valid event ID. 0047 * For the sake of easy memset-ing, this must be a byte pattern. 0048 */ 0049 #define UNSIGNALED_EVENT_SLOT ((uint64_t)-1) 0050 0051 struct kfd_event_waiter; 0052 struct signal_page; 0053 0054 struct kfd_event { 0055 u32 event_id; 0056 0057 bool signaled; 0058 bool auto_reset; 0059 0060 int type; 0061 0062 spinlock_t lock; 0063 wait_queue_head_t wq; /* List of event waiters. */ 0064 0065 /* Only for signal events. */ 0066 uint64_t __user *user_signal_address; 0067 0068 /* type specific data */ 0069 union { 0070 struct kfd_hsa_memory_exception_data memory_exception_data; 0071 struct kfd_hsa_hw_exception_data hw_exception_data; 0072 }; 0073 0074 struct rcu_head rcu; /* for asynchronous kfree_rcu */ 0075 }; 0076 0077 #define KFD_EVENT_TIMEOUT_IMMEDIATE 0 0078 #define KFD_EVENT_TIMEOUT_INFINITE 0xFFFFFFFFu 0079 0080 /* Matching HSA_EVENTTYPE */ 0081 #define KFD_EVENT_TYPE_SIGNAL 0 0082 #define KFD_EVENT_TYPE_HW_EXCEPTION 3 0083 #define KFD_EVENT_TYPE_DEBUG 5 0084 #define KFD_EVENT_TYPE_MEMORY 8 0085 0086 extern void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id, 0087 uint32_t valid_id_bits); 0088 0089 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |