Go to the documentation of this file.
37 #include "debug/GPUDriver.hh"
42 #include "params/GPUComputeDriver.hh"
49 DPRINTF(GPUDriver,
"Constructing KFD: device\n");
60 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_GET_VERSION\n");
71 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_CREATE_QUEUE\n");
82 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_DESTROY_QUEUE;" \
83 "queue offset %d\n", args->
queue_id);
89 warn(
"unimplemented ioctl: AMDKFD_IOC_SET_MEMORY_POLICY\n");
94 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_GET_CLOCK_COUNTERS\n");
116 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_GET_PROCESS_APERTURES\n");
150 DPRINTF(GPUDriver,
"GPUVM base for node[%i] = %#x\n",
i,
152 DPRINTF(GPUDriver,
"GPUVM limit for node[%i] = %#x\n",
i,
155 DPRINTF(GPUDriver,
"LDS base for node[%i] = %#x\n",
i,
157 DPRINTF(GPUDriver,
"LDS limit for node[%i] = %#x\n",
i,
160 DPRINTF(GPUDriver,
"Scratch base for node[%i] = %#x\n",
i,
162 DPRINTF(GPUDriver,
"Scratch limit for node[%i] = %#x\n",
i,
202 warn(
"unimplemented ioctl: AMDKFD_IOC_UPDATE_QUEUE\n");
207 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_CREATE_EVENT\n");
212 fatal(
"Signal events are only supported currently\n");
214 fatal(
"Signal event wasn't created; signal limit reached\n");
218 uint64_t page_index = 0;
226 DPRINTF(GPUDriver,
"amdkfd create events"
227 "(event_id: 0x%x, offset: 0x%x)\n",
241 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_DESTROY_EVENT\n");
246 "Event ID invalid, cannot destroy this event\n");
252 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_SET_EVENTS\n");
257 "Event ID invlaid, cannot set this event\n");
264 warn(
"unimplemented ioctl: AMDKFD_IOC_RESET_EVENT\n");
269 DPRINTF(GPUDriver,
"ioctl: AMDKFD_IOC_WAIT_EVENTS\n");
274 DPRINTF(GPUDriver,
"amdkfd wait for events"
275 "(wait on all: %d, timeout : %d, num_events: %s)\n",
278 "Wait for all events not supported\n");
279 bool should_sleep =
true;
283 TCEvents.emplace(std::piecewise_construct, std::make_tuple(tc),
284 std::make_tuple(
this, tc));
285 DPRINTF(GPUDriver,
"\tamdkfd creating event list"
286 " for thread %d\n", tc->
cpuId());
289 "There are %d events that put this thread to sleep,"
290 " this thread should not be running\n",
294 "Event pointer invalid\n");
298 EventData.
copyIn(virt_proxy);
300 "\tamdkfd wait for event %d\n", EventData->
event_id);
302 "Event ID invalid, cannot set this event\n");
304 "Multiple threads waiting on the same event\n");
309 should_sleep =
false;
336 warn(
"unimplemented ioctl: AMDKFD_IOC_DBG_REGISTER\n");
341 warn(
"unimplemented ioctl: AMDKFD_IOC_DBG_UNREGISTER\n");
346 warn(
"unimplemented ioctl: AMDKFD_IOC_DBG_ADDRESS_WATCH\n");
351 warn(
"unimplemented ioctl: AMDKFD_IOC_DBG_WAVE_CONTROL\n");
356 warn(
"unimplemented ioctl: AMDKFD_IOC_ALLOC_MEMORY_OF_GPU\n");
361 warn(
"unimplemented ioctl: AMDKFD_IOC_FREE_MEMORY_OF_GPU\n");
366 warn(
"unimplemented ioctl: AMDKFD_IOC_MAP_MEMORY_TO_GPU\n");
371 warn(
"unimplemented ioctl: AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU\n");
376 warn(
"unimplemented ioctl: AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH\n");
381 warn(
"unimplemented ioctl: AMDKFD_IOC_SET_CU_MASK\n");
386 warn(
"unimplemented ioctl: AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE"
392 warn(
"unimplemented ioctl: AMDKFD_IOC_SET_TRAP_HANDLER\n");
398 "ioctl: AMDKFD_IOC_GET_PROCESS_APERTURES_NEW\n");
403 ioc_args.
copyIn(virt_proxy);
420 assert(bits<Addr>(ape_args->
scratch_base, 63, 47) != 0x1ffff);
421 assert(bits<Addr>(ape_args->
scratch_base, 63, 47) != 0);
422 assert(bits<Addr>(ape_args->
scratch_limit, 63, 47) != 0x1ffff);
424 assert(bits<Addr>(ape_args->
lds_base, 63, 47) != 0x1ffff);
425 assert(bits<Addr>(ape_args->
lds_base, 63, 47) != 0);
426 assert(bits<Addr>(ape_args->
lds_limit, 63, 47) != 0x1ffff);
427 assert(bits<Addr>(ape_args->
lds_limit, 63, 47) != 0);
428 assert(bits<Addr>(ape_args->
gpuvm_base, 63, 47) != 0x1ffff);
429 assert(bits<Addr>(ape_args->
gpuvm_base, 63, 47) != 0);
430 assert(bits<Addr>(ape_args->
gpuvm_limit, 63, 47) != 0x1ffff);
431 assert(bits<Addr>(ape_args->
gpuvm_limit, 63, 47) != 0);
441 warn(
"unimplemented ioctl: AMDKFD_IOC_GET_DMABUF_INFO\n");
446 warn(
"unimplemented ioctl: AMDKFD_IOC_IMPORT_DMABUF\n");
451 warn(
"unimplemented ioctl: AMDKFD_IOC_GET_TILE_CONFIG\n");
456 warn(
"unimplemented ioctl: AMDKFD_IOC_IPC_IMPORT_HANDLE\n");
461 warn(
"unimplemented ioctl: AMDKFD_IOC_IPC_EXPORT_HANDLE\n");
466 warn(
"unimplemented ioctl: AMDKFD_IOC_CROSS_MEMORY_COPY\n");
471 warn(
"unimplemented ioctl: AMDKFD_IOC_OPEN_GRAPHIC_HANDLE\n");
475 fatal(
"%s: bad ioctl %d\n", req);
485 Tick wakeup_delay((uint64_t)milliSecTimeout * 1000000000);
487 TCEvents[tc].timerEvent.scheduleWakeup(wakeup_delay);
490 "CPU %d is put to sleep\n", tc->
cpuId());
496 return ((
Addr)gpuNum << 61) + 0x1000000000000
L;
502 return (apeBase & 0xFFFFFF0000000000UL) | 0xFFFFFFFFFF
L;
508 return ((
Addr)gpuNum << 61) + 0x100000000
L;
514 return (apeBase & 0xFFFFFFFF00000000UL) | 0xFFFFFFFF;
520 return ((
Addr)gpuNum << 61) + 0x0;
526 return (apeBase & 0xFFFFFFFF00000000UL) | 0xFFFFFFFF;
Addr scratchApeLimit(Addr apeBase) const
#define fatal(...)
This implements a cprintf based fatal() function.
#define AMDKFD_IOC_MAP_MEMORY_TO_GPU
uint64_t kfd_process_device_apertures_ptr
Addr ldsApeBase(int gpuNum) const
#define AMDKFD_IOC_GET_TILE_CONFIG
#define AMDKFD_IOC_DBG_WAVE_CONTROL
#define AMDKFD_IOC_FREE_MEMORY_OF_GPU
uint64_t event_page_offset
#define AMDKFD_IOC_DESTROY_EVENT
#define AMDKFD_IOC_IPC_EXPORT_HANDLE
uint64_t system_clock_counter
virtual void suspend()=0
Set the status to Suspended.
uint64_t Tick
Tick count type.
struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS]
#define KFD_IOCTL_MINOR_VERSION
#define AMDKFD_IOC_GET_VERSION
#define AMDKFD_IOC_CROSS_MEMORY_COPY
uint64_t system_clock_freq
std::unordered_map< ThreadContext *, EventList > TCEvents
uint64_t gpu_clock_counter
#define AMDKFD_IOC_SET_EVENT
uint64_t cpu_clock_counter
uint32_t event_trigger_data
#define AMDKFD_IOC_GET_PROCESS_APERTURES
#define AMDKFD_IOC_SET_TRAP_HANDLER
GPUComputeDriverParams Params
#define AMDKFD_IOC_DBG_REGISTER
void sleepCPU(ThreadContext *tc, uint32_t milliSecTimeout)
Addr ldsApeLimit(Addr apeBase) const
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Addr gpuVmApeLimit(Addr apeBase) const
Addr scratchApeBase(int gpuNum) const
#define AMDKFD_IOC_SET_CU_MASK
#define AMDKFD_IOC_IPC_IMPORT_HANDLE
void unsetDeviceQueueDesc(uint64_t queue_id)
#define KFD_IOCTL_MAJOR_VERSION
#define AMDKFD_IOC_RESET_EVENT
virtual int cpuId() const =0
#define KFD_IOC_EVENT_SIGNAL
#define AMDKFD_IOC_DBG_ADDRESS_WATCH
int ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf) override
Abstract method, invoked when the user program calls ioctl() on the file descriptor returned by a pre...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr gpuVmApeBase(int gpuNum) const
The aperture (APE) base/limit pairs are set statically at startup by the real KFD.
bool copyIn(PortProxy &memproxy)
copy data into simulator space (read from target memory)
#define AMDKFD_IOC_IMPORT_DMABUF
#define KFD_MMAP_TYPE_EVENTS
virtual PortProxy & getVirtProxy()=0
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
HSAPacketProcessor & hsaPacketProc()
#define AMDKFD_IOC_CREATE_EVENT
#define AMDKFD_IOC_DESTROY_QUEUE
#define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU
#define AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH
#define AMDKFD_IOC_SET_MEMORY_POLICY
#define AMDKFD_IOC_WAIT_EVENTS
uint32_t event_slot_index
#define AMDKFD_IOC_OPEN_GRAPHIC_HANDLE
virtual void signalWakeupEvent(uint32_t event_id)
GPUComputeDriver(const Params &p)
#define AMDKFD_IOC_DBG_UNREGISTER
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
Tick curTick()
The universal simulation clock.
#define AMDKFD_IOC_UPDATE_QUEUE
std::unordered_map< uint32_t, ETEntry > ETable
HSADevice * device
HSA agent (device) that is controled by this driver.
virtual void attachDriver(HSADriver *driver)
#define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
void allocateQueue(ThreadContext *tc, Addr ioc_buf)
Forward relevant parameters to packet processor; queueID is used to link doorbell.
#define AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE
#define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU
#define AMDKFD_IOC_CREATE_QUEUE
bool copyOut(PortProxy &memproxy)
copy data out of simulator space (write to target memory)
#define AMDKFD_IOC_GET_CLOCK_COUNTERS
#define AMDKFD_IOC_GET_DMABUF_INFO
Generated on Tue Mar 23 2021 19:41:27 for gem5 by doxygen 1.8.17