Commit e180af19 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'amd-drm-fixes-5.6-2020-02-26' of...

Merge tag 'amd-drm-fixes-5.6-2020-02-26' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

amd-drm-fixes-5.6-2020-02-26:

amdgpu:
- Drop DRIVER_USE_AGP
- Fix memory leak in GPU reset
- Resume fix for raven

radeon:
- Drop DRIVER_USE_AGP
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200227034106.3912-1-alexander.deucher@amd.com
parents f8788d86 eb12c957
...@@ -1389,7 +1389,7 @@ amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe, ...@@ -1389,7 +1389,7 @@ amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
static struct drm_driver kms_driver = { static struct drm_driver kms_driver = {
.driver_features = .driver_features =
DRIVER_USE_AGP | DRIVER_ATOMIC | DRIVER_ATOMIC |
DRIVER_GEM | DRIVER_GEM |
DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ | DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ |
DRIVER_SYNCOBJ_TIMELINE, DRIVER_SYNCOBJ_TIMELINE,
......
...@@ -195,6 +195,7 @@ struct amdgpu_gmc { ...@@ -195,6 +195,7 @@ struct amdgpu_gmc {
uint32_t srbm_soft_reset; uint32_t srbm_soft_reset;
bool prt_warning; bool prt_warning;
uint64_t stolen_size; uint64_t stolen_size;
uint32_t sdpif_register;
/* apertures */ /* apertures */
u64 shared_aperture_start; u64 shared_aperture_start;
u64 shared_aperture_end; u64 shared_aperture_end;
......
...@@ -1271,6 +1271,19 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev) ...@@ -1271,6 +1271,19 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
} }
} }
/**
* gmc_v9_0_restore_registers - restores regs
*
* @adev: amdgpu_device pointer
*
* This restores register values, saved at suspend.
*/
static void gmc_v9_0_restore_registers(struct amdgpu_device *adev)
{
if (adev->asic_type == CHIP_RAVEN)
WREG32(mmDCHUBBUB_SDPIF_MMIO_CNTRL_0, adev->gmc.sdpif_register);
}
/** /**
* gmc_v9_0_gart_enable - gart enable * gmc_v9_0_gart_enable - gart enable
* *
...@@ -1376,6 +1389,20 @@ static int gmc_v9_0_hw_init(void *handle) ...@@ -1376,6 +1389,20 @@ static int gmc_v9_0_hw_init(void *handle)
return r; return r;
} }
/**
* gmc_v9_0_save_registers - saves regs
*
* @adev: amdgpu_device pointer
*
* This saves potential register values that should be
* restored upon resume
*/
static void gmc_v9_0_save_registers(struct amdgpu_device *adev)
{
if (adev->asic_type == CHIP_RAVEN)
adev->gmc.sdpif_register = RREG32(mmDCHUBBUB_SDPIF_MMIO_CNTRL_0);
}
/** /**
* gmc_v9_0_gart_disable - gart disable * gmc_v9_0_gart_disable - gart disable
* *
...@@ -1412,9 +1439,16 @@ static int gmc_v9_0_hw_fini(void *handle) ...@@ -1412,9 +1439,16 @@ static int gmc_v9_0_hw_fini(void *handle)
static int gmc_v9_0_suspend(void *handle) static int gmc_v9_0_suspend(void *handle)
{ {
int r;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
return gmc_v9_0_hw_fini(adev); r = gmc_v9_0_hw_fini(adev);
if (r)
return r;
gmc_v9_0_save_registers(adev);
return 0;
} }
static int gmc_v9_0_resume(void *handle) static int gmc_v9_0_resume(void *handle)
...@@ -1422,6 +1456,7 @@ static int gmc_v9_0_resume(void *handle) ...@@ -1422,6 +1456,7 @@ static int gmc_v9_0_resume(void *handle)
int r; int r;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
gmc_v9_0_restore_registers(adev);
r = gmc_v9_0_hw_init(adev); r = gmc_v9_0_hw_init(adev);
if (r) if (r)
return r; return r;
......
...@@ -7376,6 +7376,8 @@ ...@@ -7376,6 +7376,8 @@
#define mmCRTC4_CRTC_DRR_CONTROL 0x0f3e #define mmCRTC4_CRTC_DRR_CONTROL 0x0f3e
#define mmCRTC4_CRTC_DRR_CONTROL_BASE_IDX 2 #define mmCRTC4_CRTC_DRR_CONTROL_BASE_IDX 2
#define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0 0x395d
#define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX 2
// addressBlock: dce_dc_fmt4_dispdec // addressBlock: dce_dc_fmt4_dispdec
// base address: 0x2000 // base address: 0x2000
...@@ -978,8 +978,12 @@ int smu_v11_0_init_max_sustainable_clocks(struct smu_context *smu) ...@@ -978,8 +978,12 @@ int smu_v11_0_init_max_sustainable_clocks(struct smu_context *smu)
struct smu_11_0_max_sustainable_clocks *max_sustainable_clocks; struct smu_11_0_max_sustainable_clocks *max_sustainable_clocks;
int ret = 0; int ret = 0;
max_sustainable_clocks = kzalloc(sizeof(struct smu_11_0_max_sustainable_clocks), if (!smu->smu_table.max_sustainable_clocks)
max_sustainable_clocks = kzalloc(sizeof(struct smu_11_0_max_sustainable_clocks),
GFP_KERNEL); GFP_KERNEL);
else
max_sustainable_clocks = smu->smu_table.max_sustainable_clocks;
smu->smu_table.max_sustainable_clocks = (void *)max_sustainable_clocks; smu->smu_table.max_sustainable_clocks = (void *)max_sustainable_clocks;
max_sustainable_clocks->uclock = smu->smu_table.boot_values.uclk / 100; max_sustainable_clocks->uclock = smu->smu_table.boot_values.uclk / 100;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/vga_switcheroo.h> #include <linux/vga_switcheroo.h>
#include <linux/mmu_notifier.h> #include <linux/mmu_notifier.h>
#include <drm/drm_agpsupport.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_drv.h> #include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
...@@ -325,6 +326,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, ...@@ -325,6 +326,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
unsigned long flags = 0; unsigned long flags = 0;
struct drm_device *dev;
int ret; int ret;
if (!ent) if (!ent)
...@@ -365,7 +367,44 @@ static int radeon_pci_probe(struct pci_dev *pdev, ...@@ -365,7 +367,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,
if (ret) if (ret)
return ret; return ret;
return drm_get_pci_dev(pdev, ent, &kms_driver); dev = drm_dev_alloc(&kms_driver, &pdev->dev);
if (IS_ERR(dev))
return PTR_ERR(dev);
ret = pci_enable_device(pdev);
if (ret)
goto err_free;
dev->pdev = pdev;
#ifdef __alpha__
dev->hose = pdev->sysdata;
#endif
pci_set_drvdata(pdev, dev);
if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
dev->agp = drm_agp_init(dev);
if (dev->agp) {
dev->agp->agp_mtrr = arch_phys_wc_add(
dev->agp->agp_info.aper_base,
dev->agp->agp_info.aper_size *
1024 * 1024);
}
ret = drm_dev_register(dev, ent->driver_data);
if (ret)
goto err_agp;
return 0;
err_agp:
if (dev->agp)
arch_phys_wc_del(dev->agp->agp_mtrr);
kfree(dev->agp);
pci_disable_device(pdev);
err_free:
drm_dev_put(dev);
return ret;
} }
static void static void
...@@ -575,7 +614,7 @@ radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe, ...@@ -575,7 +614,7 @@ radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
static struct drm_driver kms_driver = { static struct drm_driver kms_driver = {
.driver_features = .driver_features =
DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER, DRIVER_GEM | DRIVER_RENDER,
.load = radeon_driver_load_kms, .load = radeon_driver_load_kms,
.open = radeon_driver_open_kms, .open = radeon_driver_open_kms,
.postclose = radeon_driver_postclose_kms, .postclose = radeon_driver_postclose_kms,
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/vga_switcheroo.h> #include <linux/vga_switcheroo.h>
#include <drm/drm_agpsupport.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_ioctl.h> #include <drm/drm_ioctl.h>
...@@ -77,6 +78,11 @@ void radeon_driver_unload_kms(struct drm_device *dev) ...@@ -77,6 +78,11 @@ void radeon_driver_unload_kms(struct drm_device *dev)
radeon_modeset_fini(rdev); radeon_modeset_fini(rdev);
radeon_device_fini(rdev); radeon_device_fini(rdev);
if (dev->agp)
arch_phys_wc_del(dev->agp->agp_mtrr);
kfree(dev->agp);
dev->agp = NULL;
done_free: done_free:
kfree(rdev); kfree(rdev);
dev->dev_private = NULL; dev->dev_private = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment