forked from Minki/linux
4a488a7ad7
This patch adds the amdkfd skeleton driver. The driver does nothing except define a /dev/kfd device. It returns -ENODEV on all amdkfd IOCTLs. v3: Move bool field to the end of structure, removed the pmc ioctls and added a meaningful error message for ioctl error. v5: Create a new folder drm/amd and move amdkfd from drm/radeon/ to drm/amd/ Remove scheduler_class from kfd_priv.h as it was never used Add skeleton implementation of the Get Version IOCTL v6: Update module version to the correct number and remove the "default m" from the Kconfig file Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
82 lines
2.4 KiB
C
82 lines
2.4 KiB
C
/*
|
|
* Copyright 2014 Advanced Micro Devices, Inc.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef KFD_PRIV_H_INCLUDED
|
|
#define KFD_PRIV_H_INCLUDED
|
|
|
|
#include <linux/hashtable.h>
|
|
#include <linux/mmu_notifier.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/types.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/workqueue.h>
|
|
#include <linux/spinlock.h>
|
|
#include <kgd_kfd_interface.h>
|
|
|
|
struct kfd_device_info {
|
|
unsigned int max_pasid_bits;
|
|
size_t ih_ring_entry_size;
|
|
};
|
|
|
|
struct kfd_dev {
|
|
struct kgd_dev *kgd;
|
|
|
|
const struct kfd_device_info *device_info;
|
|
struct pci_dev *pdev;
|
|
|
|
unsigned int id; /* topology stub index */
|
|
|
|
struct kgd2kfd_shared_resources shared_resources;
|
|
|
|
bool init_complete;
|
|
|
|
};
|
|
|
|
/* KGD2KFD callbacks */
|
|
void kgd2kfd_exit(void);
|
|
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev);
|
|
bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
|
const struct kgd2kfd_shared_resources *gpu_resources);
|
|
void kgd2kfd_device_exit(struct kfd_dev *kfd);
|
|
|
|
extern const struct kfd2kgd_calls *kfd2kgd;
|
|
|
|
/* Character device interface */
|
|
int kfd_chardev_init(void);
|
|
void kfd_chardev_exit(void);
|
|
struct device *kfd_chardev(void);
|
|
|
|
/* Process data */
|
|
struct kfd_process {
|
|
};
|
|
|
|
extern struct device *kfd_device;
|
|
|
|
/* Interrupts */
|
|
void kgd2kfd_interrupt(struct kfd_dev *dev, const void *ih_ring_entry);
|
|
|
|
/* Power Management */
|
|
void kgd2kfd_suspend(struct kfd_dev *dev);
|
|
int kgd2kfd_resume(struct kfd_dev *dev);
|
|
|
|
#endif
|