mirror of
https://github.com/Qortal/Brooklyn.git
synced 2025-02-11 17:55:54 +00:00
GPU driver extensions
This commit is contained in:
parent
4fc17d7ce7
commit
83c955e101
@ -1078,8 +1078,6 @@ struct amdgpu_device {
|
|||||||
char product_name[32];
|
char product_name[32];
|
||||||
char serial[20];
|
char serial[20];
|
||||||
|
|
||||||
struct amdgpu_autodump autodump;
|
|
||||||
|
|
||||||
atomic_t throttling_logging_enabled;
|
atomic_t throttling_logging_enabled;
|
||||||
struct ratelimit_state throttling_logging_rs;
|
struct ratelimit_state throttling_logging_rs;
|
||||||
uint32_t ras_hw_enabled;
|
uint32_t ras_hw_enabled;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/poll.h>
|
|
||||||
|
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_pm.h"
|
#include "amdgpu_pm.h"
|
||||||
@ -37,85 +36,7 @@
|
|||||||
#include "amdgpu_securedisplay.h"
|
#include "amdgpu_securedisplay.h"
|
||||||
#include "amdgpu_fw_attestation.h"
|
#include "amdgpu_fw_attestation.h"
|
||||||
|
|
||||||
int amdgpu_debugfs_wait_dump(struct amdgpu_device *adev)
|
|
||||||
{
|
|
||||||
#if defined(CONFIG_DEBUG_FS)
|
#if defined(CONFIG_DEBUG_FS)
|
||||||
unsigned long timeout = 600 * HZ;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
wake_up_interruptible(&adev->autodump.gpu_hang);
|
|
||||||
|
|
||||||
ret = wait_for_completion_interruptible_timeout(&adev->autodump.dumping, timeout);
|
|
||||||
if (ret == 0) {
|
|
||||||
pr_err("autodump: timeout, move on to gpu recovery\n");
|
|
||||||
return -ETIMEDOUT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG_FS)
|
|
||||||
|
|
||||||
static int amdgpu_debugfs_autodump_open(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
struct amdgpu_device *adev = inode->i_private;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
file->private_data = adev;
|
|
||||||
|
|
||||||
ret = down_read_killable(&adev->reset_sem);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (adev->autodump.dumping.done) {
|
|
||||||
reinit_completion(&adev->autodump.dumping);
|
|
||||||
ret = 0;
|
|
||||||
} else {
|
|
||||||
ret = -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
up_read(&adev->reset_sem);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int amdgpu_debugfs_autodump_release(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
struct amdgpu_device *adev = file->private_data;
|
|
||||||
|
|
||||||
complete_all(&adev->autodump.dumping);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int amdgpu_debugfs_autodump_poll(struct file *file, struct poll_table_struct *poll_table)
|
|
||||||
{
|
|
||||||
struct amdgpu_device *adev = file->private_data;
|
|
||||||
|
|
||||||
poll_wait(file, &adev->autodump.gpu_hang, poll_table);
|
|
||||||
|
|
||||||
if (amdgpu_in_reset(adev))
|
|
||||||
return POLLIN | POLLRDNORM | POLLWRNORM;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations autodump_debug_fops = {
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = amdgpu_debugfs_autodump_open,
|
|
||||||
.poll = amdgpu_debugfs_autodump_poll,
|
|
||||||
.release = amdgpu_debugfs_autodump_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void amdgpu_debugfs_autodump_init(struct amdgpu_device *adev)
|
|
||||||
{
|
|
||||||
init_completion(&adev->autodump.dumping);
|
|
||||||
complete_all(&adev->autodump.dumping);
|
|
||||||
init_waitqueue_head(&adev->autodump.gpu_hang);
|
|
||||||
|
|
||||||
debugfs_create_file("amdgpu_autodump", 0600,
|
|
||||||
adev_to_drm(adev)->primary->debugfs_root,
|
|
||||||
adev, &autodump_debug_fops);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* amdgpu_debugfs_process_reg_op - Handle MMIO register reads/writes
|
* amdgpu_debugfs_process_reg_op - Handle MMIO register reads/writes
|
||||||
@ -1588,7 +1509,6 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
amdgpu_ras_debugfs_create_all(adev);
|
amdgpu_ras_debugfs_create_all(adev);
|
||||||
amdgpu_debugfs_autodump_init(adev);
|
|
||||||
amdgpu_rap_debugfs_init(adev);
|
amdgpu_rap_debugfs_init(adev);
|
||||||
amdgpu_securedisplay_debugfs_init(adev);
|
amdgpu_securedisplay_debugfs_init(adev);
|
||||||
amdgpu_fw_attestation_debugfs_init(adev);
|
amdgpu_fw_attestation_debugfs_init(adev);
|
||||||
|
@ -26,10 +26,6 @@
|
|||||||
/*
|
/*
|
||||||
* Debugfs
|
* Debugfs
|
||||||
*/
|
*/
|
||||||
struct amdgpu_autodump {
|
|
||||||
struct completion dumping;
|
|
||||||
struct wait_queue_head gpu_hang;
|
|
||||||
};
|
|
||||||
|
|
||||||
int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
|
int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
|
||||||
int amdgpu_debugfs_init(struct amdgpu_device *adev);
|
int amdgpu_debugfs_init(struct amdgpu_device *adev);
|
||||||
@ -37,4 +33,3 @@ void amdgpu_debugfs_fini(struct amdgpu_device *adev);
|
|||||||
void amdgpu_debugfs_fence_init(struct amdgpu_device *adev);
|
void amdgpu_debugfs_fence_init(struct amdgpu_device *adev);
|
||||||
void amdgpu_debugfs_firmware_init(struct amdgpu_device *adev);
|
void amdgpu_debugfs_firmware_init(struct amdgpu_device *adev);
|
||||||
void amdgpu_debugfs_gem_init(struct amdgpu_device *adev);
|
void amdgpu_debugfs_gem_init(struct amdgpu_device *adev);
|
||||||
int amdgpu_debugfs_wait_dump(struct amdgpu_device *adev);
|
|
||||||
|
@ -2432,10 +2432,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
|
|||||||
if (!adev->gmc.xgmi.pending_reset)
|
if (!adev->gmc.xgmi.pending_reset)
|
||||||
amdgpu_amdkfd_device_init(adev);
|
amdgpu_amdkfd_device_init(adev);
|
||||||
|
|
||||||
r = amdgpu_amdkfd_resume_iommu(adev);
|
|
||||||
if (r)
|
|
||||||
goto init_failed;
|
|
||||||
|
|
||||||
amdgpu_fru_get_product_info(adev);
|
amdgpu_fru_get_product_info(adev);
|
||||||
|
|
||||||
init_failed:
|
init_failed:
|
||||||
@ -4466,10 +4462,6 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
|
|||||||
if (reset_context->reset_req_dev == adev)
|
if (reset_context->reset_req_dev == adev)
|
||||||
job = reset_context->job;
|
job = reset_context->job;
|
||||||
|
|
||||||
/* no need to dump if device is not in good state during probe period */
|
|
||||||
if (!adev->gmc.xgmi.pending_reset)
|
|
||||||
amdgpu_debugfs_wait_dump(adev);
|
|
||||||
|
|
||||||
if (amdgpu_sriov_vf(adev)) {
|
if (amdgpu_sriov_vf(adev)) {
|
||||||
/* stop the data exchange thread */
|
/* stop the data exchange thread */
|
||||||
amdgpu_virt_fini_data_exchange(adev);
|
amdgpu_virt_fini_data_exchange(adev);
|
||||||
|
@ -924,6 +924,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
|||||||
|
|
||||||
svm_migrate_init((struct amdgpu_device *)kfd->kgd);
|
svm_migrate_init((struct amdgpu_device *)kfd->kgd);
|
||||||
|
|
||||||
|
if(kgd2kfd_resume_iommu(kfd))
|
||||||
|
goto device_iommu_error;
|
||||||
|
|
||||||
if (kfd_resume(kfd))
|
if (kfd_resume(kfd))
|
||||||
goto kfd_resume_error;
|
goto kfd_resume_error;
|
||||||
|
|
||||||
|
@ -247,6 +247,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
|
|||||||
{
|
{
|
||||||
struct amdgpu_dm_connector *connector = file_inode(f)->i_private;
|
struct amdgpu_dm_connector *connector = file_inode(f)->i_private;
|
||||||
struct dc_link *link = connector->dc_link;
|
struct dc_link *link = connector->dc_link;
|
||||||
|
struct dc *dc = (struct dc *)link->dc;
|
||||||
struct dc_link_settings prefer_link_settings;
|
struct dc_link_settings prefer_link_settings;
|
||||||
char *wr_buf = NULL;
|
char *wr_buf = NULL;
|
||||||
const uint32_t wr_buf_size = 40;
|
const uint32_t wr_buf_size = 40;
|
||||||
@ -313,7 +314,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
|
|||||||
prefer_link_settings.lane_count = param[0];
|
prefer_link_settings.lane_count = param[0];
|
||||||
prefer_link_settings.link_rate = param[1];
|
prefer_link_settings.link_rate = param[1];
|
||||||
|
|
||||||
dp_retrain_link_dp_test(link, &prefer_link_settings, false);
|
dc_link_set_preferred_training_settings(dc, &prefer_link_settings, NULL, link, true);
|
||||||
|
|
||||||
kfree(wr_buf);
|
kfree(wr_buf);
|
||||||
return size;
|
return size;
|
||||||
|
@ -2805,7 +2805,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
|
|||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
struct usb_device *rhdev;
|
struct usb_device *rhdev;
|
||||||
struct usb_hcd *shared_hcd;
|
|
||||||
|
|
||||||
if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
|
if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
|
||||||
hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
|
hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
|
||||||
@ -2966,26 +2965,13 @@ int usb_add_hcd(struct usb_hcd *hcd,
|
|||||||
goto err_hcd_driver_start;
|
goto err_hcd_driver_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* starting here, usbcore will pay attention to the shared HCD roothub */
|
|
||||||
shared_hcd = hcd->shared_hcd;
|
|
||||||
if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) {
|
|
||||||
retval = register_root_hub(shared_hcd);
|
|
||||||
if (retval != 0)
|
|
||||||
goto err_register_root_hub;
|
|
||||||
|
|
||||||
if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd))
|
|
||||||
usb_hcd_poll_rh_status(shared_hcd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* starting here, usbcore will pay attention to this root hub */
|
/* starting here, usbcore will pay attention to this root hub */
|
||||||
if (!HCD_DEFER_RH_REGISTER(hcd)) {
|
retval = register_root_hub(hcd);
|
||||||
retval = register_root_hub(hcd);
|
if (retval != 0)
|
||||||
if (retval != 0)
|
goto err_register_root_hub;
|
||||||
goto err_register_root_hub;
|
|
||||||
|
|
||||||
if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
|
if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
|
||||||
usb_hcd_poll_rh_status(hcd);
|
usb_hcd_poll_rh_status(hcd);
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
@ -3023,7 +3009,6 @@ EXPORT_SYMBOL_GPL(usb_add_hcd);
|
|||||||
void usb_remove_hcd(struct usb_hcd *hcd)
|
void usb_remove_hcd(struct usb_hcd *hcd)
|
||||||
{
|
{
|
||||||
struct usb_device *rhdev = hcd->self.root_hub;
|
struct usb_device *rhdev = hcd->self.root_hub;
|
||||||
bool rh_registered;
|
|
||||||
|
|
||||||
dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
|
dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
|
||||||
|
|
||||||
@ -3034,7 +3019,6 @@ void usb_remove_hcd(struct usb_hcd *hcd)
|
|||||||
|
|
||||||
dev_dbg(hcd->self.controller, "roothub graceful disconnect\n");
|
dev_dbg(hcd->self.controller, "roothub graceful disconnect\n");
|
||||||
spin_lock_irq (&hcd_root_hub_lock);
|
spin_lock_irq (&hcd_root_hub_lock);
|
||||||
rh_registered = hcd->rh_registered;
|
|
||||||
hcd->rh_registered = 0;
|
hcd->rh_registered = 0;
|
||||||
spin_unlock_irq (&hcd_root_hub_lock);
|
spin_unlock_irq (&hcd_root_hub_lock);
|
||||||
|
|
||||||
@ -3044,8 +3028,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
|
|||||||
cancel_work_sync(&hcd->died_work);
|
cancel_work_sync(&hcd->died_work);
|
||||||
|
|
||||||
mutex_lock(&usb_bus_idr_lock);
|
mutex_lock(&usb_bus_idr_lock);
|
||||||
if (rh_registered)
|
usb_disconnect(&rhdev); /* Sets rhdev to NULL */
|
||||||
usb_disconnect(&rhdev); /* Sets rhdev to NULL */
|
|
||||||
mutex_unlock(&usb_bus_idr_lock);
|
mutex_unlock(&usb_bus_idr_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user