Skip to content

Commit 04d505d

Browse files
committed
Merge tag 'amd-drm-next-5.15-2021-07-29' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-5.15-2021-07-29: amdgpu: - VCN/JPEG power down sequencing fixes - Various navi pcie link handling fixes - Clockgating fixes - Yellow Carp fixes - Beige Goby fixes - Misc code cleanups - S0ix fixes - SMU i2c bus rework - EEPROM handling rework - PSP ucode handling cleanup - SMU error handling rework - AMD HDMI freesync fixes - USB PD firmware update rework - MMIO based vram access rework - Misc display fixes - Backlight fixes - Add initial Cyan Skillfish support - Overclocking fixes suspend/resume amdkfd: - Sysfs leak fix - Add counters for vm faults and migration - GPUVM TLB optimizations radeon: - Misc fixes Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents f1b7996 + 544dcd7 commit 04d505d

File tree

164 files changed

+6856
-2662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+6856
-2662
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15481,6 +15481,8 @@ M: Pan, Xinhui <[email protected]>
1548115481
1548215482
S: Supported
1548315483
T: git https://gitlab.freedesktop.org/agd5f/linux.git
15484+
B: https://gitlab.freedesktop.org/drm/amd/-/issues
15485+
C: irc://irc.oftc.net/radeon
1548415486
F: drivers/gpu/drm/amd/
1548515487
F: drivers/gpu/drm/radeon/
1548615488
F: include/uapi/drm/amdgpu_drm.h

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
5757
amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \
5858
amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \
5959
amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \
60-
amdgpu_fw_attestation.o amdgpu_securedisplay.o amdgpu_hdp.o
60+
amdgpu_fw_attestation.o amdgpu_securedisplay.o amdgpu_hdp.o \
61+
amdgpu_eeprom.o
6162

6263
amdgpu-$(CONFIG_PROC_FS) += amdgpu_fdinfo.o
6364

@@ -75,7 +76,7 @@ amdgpu-y += \
7576
vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \
7677
arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \
7778
nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o \
78-
beige_goby_reg_init.o yellow_carp_reg_init.o
79+
beige_goby_reg_init.o yellow_carp_reg_init.o cyan_skillfish_reg_init.o
7980

8081
# add DF block
8182
amdgpu-y += \
@@ -111,6 +112,7 @@ amdgpu-y += \
111112
psp_v3_1.o \
112113
psp_v10_0.o \
113114
psp_v11_0.o \
115+
psp_v11_0_8.o \
114116
psp_v12_0.o \
115117
psp_v13_0.o
116118

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,13 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev);
11081108

11091109
int amdgpu_gpu_wait_for_idle(struct amdgpu_device *adev);
11101110

1111+
void amdgpu_device_mm_access(struct amdgpu_device *adev, loff_t pos,
1112+
void *buf, size_t size, bool write);
1113+
size_t amdgpu_device_aper_access(struct amdgpu_device *adev, loff_t pos,
1114+
void *buf, size_t size, bool write);
1115+
11111116
void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos,
1112-
uint32_t *buf, size_t size, bool write);
1117+
void *buf, size_t size, bool write);
11131118
uint32_t amdgpu_device_rreg(struct amdgpu_device *adev,
11141119
uint32_t reg, uint32_t acc_flags);
11151120
void amdgpu_device_wreg(struct amdgpu_device *adev,
@@ -1385,12 +1390,12 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta
13851390
int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
13861391

13871392
void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1388-
bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev);
1393+
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
13891394
void amdgpu_acpi_detect(void);
13901395
#else
13911396
static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
13921397
static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1393-
static inline bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev) { return false; }
1398+
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
13941399
static inline void amdgpu_acpi_detect(void) { }
13951400
static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
13961401
static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,28 @@ static int acp_poweron(struct generic_pm_domain *genpd)
160160
return 0;
161161
}
162162

163-
static struct device *get_mfd_cell_dev(const char *device_name, int r)
163+
static int acp_genpd_add_device(struct device *dev, void *data)
164164
{
165-
char auto_dev_name[25];
166-
struct device *dev;
165+
struct generic_pm_domain *gpd = data;
166+
int ret;
167167

168-
snprintf(auto_dev_name, sizeof(auto_dev_name),
169-
"%s.%d.auto", device_name, r);
170-
dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name);
171-
dev_info(dev, "device %s added to pm domain\n", auto_dev_name);
168+
ret = pm_genpd_add_device(gpd, dev);
169+
if (ret)
170+
dev_err(dev, "Failed to add dev to genpd %d\n", ret);
172171

173-
return dev;
172+
return ret;
173+
}
174+
175+
static int acp_genpd_remove_device(struct device *dev, void *data)
176+
{
177+
int ret;
178+
179+
ret = pm_genpd_remove_device(dev);
180+
if (ret)
181+
dev_err(dev, "Failed to remove dev from genpd %d\n", ret);
182+
183+
/* Continue to remove */
184+
return 0;
174185
}
175186

176187
/**
@@ -181,11 +192,10 @@ static struct device *get_mfd_cell_dev(const char *device_name, int r)
181192
*/
182193
static int acp_hw_init(void *handle)
183194
{
184-
int r, i;
195+
int r;
185196
uint64_t acp_base;
186197
u32 val = 0;
187198
u32 count = 0;
188-
struct device *dev;
189199
struct i2s_platform_data *i2s_pdata = NULL;
190200

191201
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -341,15 +351,10 @@ static int acp_hw_init(void *handle)
341351
if (r)
342352
goto failure;
343353

344-
for (i = 0; i < ACP_DEVS ; i++) {
345-
dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
346-
r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev);
347-
if (r) {
348-
dev_err(dev, "Failed to add dev to genpd\n");
349-
goto failure;
350-
}
351-
}
352-
354+
r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd,
355+
acp_genpd_add_device);
356+
if (r)
357+
goto failure;
353358

354359
/* Assert Soft reset of ACP */
355360
val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
@@ -410,10 +415,8 @@ static int acp_hw_init(void *handle)
410415
*/
411416
static int acp_hw_fini(void *handle)
412417
{
413-
int i, ret;
414418
u32 val = 0;
415419
u32 count = 0;
416-
struct device *dev;
417420
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
418421

419422
/* return early if no ACP */
@@ -458,13 +461,8 @@ static int acp_hw_fini(void *handle)
458461
udelay(100);
459462
}
460463

461-
for (i = 0; i < ACP_DEVS ; i++) {
462-
dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
463-
ret = pm_genpd_remove_device(dev);
464-
/* If removal fails, dont giveup and try rest */
465-
if (ret)
466-
dev_err(dev, "remove dev from genpd failed\n");
467-
}
464+
device_for_each_child(adev->acp.parent, NULL,
465+
acp_genpd_remove_device);
468466

469467
mfd_remove_devices(adev->acp.parent);
470468
kfree(adev->acp.acp_res);

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/slab.h>
2727
#include <linux/power_supply.h>
2828
#include <linux/pm_runtime.h>
29+
#include <linux/suspend.h>
2930
#include <acpi/video.h>
3031
#include <acpi/actbl.h>
3132

@@ -853,8 +854,8 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
853854
if (amdgpu_device_has_dc_support(adev)) {
854855
#if defined(CONFIG_DRM_AMD_DC)
855856
struct amdgpu_display_manager *dm = &adev->dm;
856-
if (dm->backlight_dev)
857-
atif->bd = dm->backlight_dev;
857+
if (dm->backlight_dev[0])
858+
atif->bd = dm->backlight_dev[0];
858859
#endif
859860
} else {
860861
struct drm_encoder *tmp;
@@ -1031,18 +1032,18 @@ void amdgpu_acpi_detect(void)
10311032
}
10321033

10331034
/**
1034-
* amdgpu_acpi_is_s0ix_supported
1035+
* amdgpu_acpi_is_s0ix_active
10351036
*
10361037
* @adev: amdgpu_device_pointer
10371038
*
10381039
* returns true if supported, false if not.
10391040
*/
1040-
bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
1041+
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10411042
{
10421043
#if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE)
10431044
if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
10441045
if (adev->flags & AMD_IS_APU)
1045-
return true;
1046+
return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
10461047
}
10471048
#endif
10481049
return false;

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#include "amdgpu_amdkfd.h"
24+
#include "amd_pcie.h"
2425
#include "amd_shared.h"
2526

2627
#include "amdgpu.h"
@@ -553,6 +554,88 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s
553554
return (uint8_t)ret;
554555
}
555556

557+
int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct kgd_dev *dst, struct kgd_dev *src, bool is_min)
558+
{
559+
struct amdgpu_device *adev = (struct amdgpu_device *)dst, *peer_adev;
560+
int num_links;
561+
562+
if (adev->asic_type != CHIP_ALDEBARAN)
563+
return 0;
564+
565+
if (src)
566+
peer_adev = (struct amdgpu_device *)src;
567+
568+
/* num links returns 0 for indirect peers since indirect route is unknown. */
569+
num_links = is_min ? 1 : amdgpu_xgmi_get_num_links(adev, peer_adev);
570+
if (num_links < 0) {
571+
DRM_ERROR("amdgpu: failed to get xgmi num links between node %d and %d. ret = %d\n",
572+
adev->gmc.xgmi.physical_node_id,
573+
peer_adev->gmc.xgmi.physical_node_id, num_links);
574+
num_links = 0;
575+
}
576+
577+
/* Aldebaran xGMI DPM is defeatured so assume x16 x 25Gbps for bandwidth. */
578+
return (num_links * 16 * 25000)/BITS_PER_BYTE;
579+
}
580+
581+
int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct kgd_dev *dev, bool is_min)
582+
{
583+
struct amdgpu_device *adev = (struct amdgpu_device *)dev;
584+
int num_lanes_shift = (is_min ? ffs(adev->pm.pcie_mlw_mask) :
585+
fls(adev->pm.pcie_mlw_mask)) - 1;
586+
int gen_speed_shift = (is_min ? ffs(adev->pm.pcie_gen_mask &
587+
CAIL_PCIE_LINK_SPEED_SUPPORT_MASK) :
588+
fls(adev->pm.pcie_gen_mask &
589+
CAIL_PCIE_LINK_SPEED_SUPPORT_MASK)) - 1;
590+
uint32_t num_lanes_mask = 1 << num_lanes_shift;
591+
uint32_t gen_speed_mask = 1 << gen_speed_shift;
592+
int num_lanes_factor = 0, gen_speed_mbits_factor = 0;
593+
594+
switch (num_lanes_mask) {
595+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X1:
596+
num_lanes_factor = 1;
597+
break;
598+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X2:
599+
num_lanes_factor = 2;
600+
break;
601+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X4:
602+
num_lanes_factor = 4;
603+
break;
604+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X8:
605+
num_lanes_factor = 8;
606+
break;
607+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X12:
608+
num_lanes_factor = 12;
609+
break;
610+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X16:
611+
num_lanes_factor = 16;
612+
break;
613+
case CAIL_PCIE_LINK_WIDTH_SUPPORT_X32:
614+
num_lanes_factor = 32;
615+
break;
616+
}
617+
618+
switch (gen_speed_mask) {
619+
case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1:
620+
gen_speed_mbits_factor = 2500;
621+
break;
622+
case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2:
623+
gen_speed_mbits_factor = 5000;
624+
break;
625+
case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3:
626+
gen_speed_mbits_factor = 8000;
627+
break;
628+
case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4:
629+
gen_speed_mbits_factor = 16000;
630+
break;
631+
case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN5:
632+
gen_speed_mbits_factor = 32000;
633+
break;
634+
}
635+
636+
return (num_lanes_factor * gen_speed_mbits_factor)/BITS_PER_BYTE;
637+
}
638+
556639
uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct kgd_dev *kgd)
557640
{
558641
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ uint32_t amdgpu_amdkfd_get_num_gws(struct kgd_dev *kgd);
226226
uint32_t amdgpu_amdkfd_get_asic_rev_id(struct kgd_dev *kgd);
227227
int amdgpu_amdkfd_get_noretry(struct kgd_dev *kgd);
228228
uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *src);
229+
int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct kgd_dev *dst, struct kgd_dev *src, bool is_min);
230+
int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct kgd_dev *dev, bool is_min);
229231

230232
/* Read user wptr from a specified user address space with page fault
231233
* disabled. The memory must be pinned and mapped to the hardware when
@@ -330,7 +332,7 @@ int kgd2kfd_pre_reset(struct kfd_dev *kfd);
330332
int kgd2kfd_post_reset(struct kfd_dev *kfd);
331333
void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry);
332334
void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd);
333-
void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask);
335+
void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask);
334336
#else
335337
static inline int kgd2kfd_init(void)
336338
{
@@ -389,7 +391,7 @@ void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd)
389391
}
390392

391393
static inline
392-
void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask)
394+
void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask)
393395
{
394396
}
395397
#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,11 +1285,22 @@ int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
12851285
if (avm->process_info)
12861286
return -EINVAL;
12871287

1288+
/* Free the original amdgpu allocated pasid,
1289+
* will be replaced with kfd allocated pasid.
1290+
*/
1291+
if (avm->pasid) {
1292+
amdgpu_pasid_free(avm->pasid);
1293+
amdgpu_vm_set_pasid(adev, avm, 0);
1294+
}
1295+
12881296
/* Convert VM into a compute VM */
1289-
ret = amdgpu_vm_make_compute(adev, avm, pasid);
1297+
ret = amdgpu_vm_make_compute(adev, avm);
12901298
if (ret)
12911299
return ret;
12921300

1301+
ret = amdgpu_vm_set_pasid(adev, avm, pasid);
1302+
if (ret)
1303+
return ret;
12931304
/* Initialize KFD part of the VM and process info */
12941305
ret = init_kfd_vm(avm, process_info, ef);
12951306
if (ret)

0 commit comments

Comments
 (0)