Skip to content

Commit dded93f

Browse files
committed
Merge tag 'amd-drm-fixes-5.9-2020-10-08' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
amd-drm-fixes-5.9-2020-10-08: amdgpu: - Fix a crash on renoir if you override the IP discovery parameter - Fix the build on ARC platforms - Display fix for Sienna Cichlid Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents d10285a + 33c8256 commit dded93f

File tree

6 files changed

+48
-15
lines changed

6 files changed

+48
-15
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,12 +694,12 @@ static void soc15_reg_base_init(struct amdgpu_device *adev)
694694
* it doesn't support SRIOV. */
695695
if (amdgpu_discovery) {
696696
r = amdgpu_discovery_reg_base_init(adev);
697-
if (r) {
698-
DRM_WARN("failed to init reg base from ip discovery table, "
699-
"fallback to legacy init method\n");
700-
vega10_reg_base_init(adev);
701-
}
697+
if (r == 0)
698+
break;
699+
DRM_WARN("failed to init reg base from ip discovery table, "
700+
"fallback to legacy init method\n");
702701
}
702+
vega10_reg_base_init(adev);
703703
break;
704704
case CHIP_VEGA20:
705705
vega20_reg_base_init(adev);

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ static int dm_late_init(void *handle)
14091409
if (dmcu)
14101410
ret = dmcu_load_iram(dmcu, params);
14111411
else if (adev->dm.dc->ctx->dmub_srv)
1412-
ret = dmub_init_abm_config(adev->dm.dc->res_pool->abm, params);
1412+
ret = dmub_init_abm_config(adev->dm.dc->res_pool, params);
14131413

14141414
if (!ret)
14151415
return -EINVAL;

drivers/gpu/drm/amd/display/modules/power/power_helpers.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,16 +657,21 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame
657657
params, ram_table, big_endian);
658658
}
659659

660-
bool dmub_init_abm_config(struct abm *abm,
660+
bool dmub_init_abm_config(struct resource_pool *res_pool,
661661
struct dmcu_iram_parameters params)
662662
{
663663
struct iram_table_v_2_2 ram_table;
664664
struct abm_config_table config;
665665
bool result = false;
666666
uint32_t i, j = 0;
667667

668-
if (abm == NULL)
668+
#if defined(CONFIG_DRM_AMD_DC_DCN3_0)
669+
if (res_pool->abm == NULL && res_pool->multiple_abms[0] == NULL)
669670
return false;
671+
#else
672+
if (res_pool->abm == NULL)
673+
return false;
674+
#endif
670675

671676
memset(&ram_table, 0, sizeof(ram_table));
672677
memset(&config, 0, sizeof(config));
@@ -707,8 +712,14 @@ bool dmub_init_abm_config(struct abm *abm,
707712

708713
config.min_abm_backlight = ram_table.min_abm_backlight;
709714

710-
result = abm->funcs->init_abm_config(
711-
abm, (char *)(&config), sizeof(struct abm_config_table));
715+
#if defined(CONFIG_DRM_AMD_DC_DCN3_0)
716+
if (res_pool->multiple_abms[0]) {
717+
result = res_pool->multiple_abms[0]->funcs->init_abm_config(
718+
res_pool->multiple_abms[0], (char *)(&config), sizeof(struct abm_config_table));
719+
} else
720+
#endif
721+
result = res_pool->abm->funcs->init_abm_config(
722+
res_pool->abm, (char *)(&config), sizeof(struct abm_config_table));
712723

713724
return result;
714725
}

drivers/gpu/drm/amd/display/modules/power/power_helpers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "dc/inc/hw/dmcu.h"
2929
#include "dc/inc/hw/abm.h"
3030

31+
struct resource_pool;
32+
3133

3234
enum abm_defines {
3335
abm_defines_max_level = 4,
@@ -45,7 +47,7 @@ struct dmcu_iram_parameters {
4547

4648
bool dmcu_load_iram(struct dmcu *dmcu,
4749
struct dmcu_iram_parameters params);
48-
bool dmub_init_abm_config(struct abm *abm,
50+
bool dmub_init_abm_config(struct resource_pool *res_pool,
4951
struct dmcu_iram_parameters params);
5052

5153
#endif /* MODULES_POWER_POWER_HELPERS_H_ */

drivers/gpu/drm/amd/powerplay/navi10_ppt.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,8 +2265,6 @@ static void navi10_fill_i2c_req(SwI2cRequest_t *req, bool write,
22652265
{
22662266
int i;
22672267

2268-
BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);
2269-
22702268
req->I2CcontrollerPort = 0;
22712269
req->I2CSpeed = 2;
22722270
req->SlaveAddress = address;
@@ -2304,6 +2302,12 @@ static int navi10_i2c_read_data(struct i2c_adapter *control,
23042302
struct smu_table_context *smu_table = &adev->smu.smu_table;
23052303
struct smu_table *table = &smu_table->driver_table;
23062304

2305+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2306+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2307+
numbytes, MAX_SW_I2C_COMMANDS);
2308+
return -EINVAL;
2309+
}
2310+
23072311
memset(&req, 0, sizeof(req));
23082312
navi10_fill_i2c_req(&req, false, address, numbytes, data);
23092313

@@ -2340,6 +2344,12 @@ static int navi10_i2c_write_data(struct i2c_adapter *control,
23402344
SwI2cRequest_t req;
23412345
struct amdgpu_device *adev = to_amdgpu_device(control);
23422346

2347+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2348+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2349+
numbytes, MAX_SW_I2C_COMMANDS);
2350+
return -EINVAL;
2351+
}
2352+
23432353
memset(&req, 0, sizeof(req));
23442354
navi10_fill_i2c_req(&req, true, address, numbytes, data);
23452355

drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,8 +2445,6 @@ static void sienna_cichlid_fill_i2c_req(SwI2cRequest_t *req, bool write,
24452445
{
24462446
int i;
24472447

2448-
BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);
2449-
24502448
req->I2CcontrollerPort = 0;
24512449
req->I2CSpeed = 2;
24522450
req->SlaveAddress = address;
@@ -2484,6 +2482,12 @@ static int sienna_cichlid_i2c_read_data(struct i2c_adapter *control,
24842482
struct smu_table_context *smu_table = &adev->smu.smu_table;
24852483
struct smu_table *table = &smu_table->driver_table;
24862484

2485+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2486+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2487+
numbytes, MAX_SW_I2C_COMMANDS);
2488+
return -EINVAL;
2489+
}
2490+
24872491
memset(&req, 0, sizeof(req));
24882492
sienna_cichlid_fill_i2c_req(&req, false, address, numbytes, data);
24892493

@@ -2520,6 +2524,12 @@ static int sienna_cichlid_i2c_write_data(struct i2c_adapter *control,
25202524
SwI2cRequest_t req;
25212525
struct amdgpu_device *adev = to_amdgpu_device(control);
25222526

2527+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2528+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2529+
numbytes, MAX_SW_I2C_COMMANDS);
2530+
return -EINVAL;
2531+
}
2532+
25232533
memset(&req, 0, sizeof(req));
25242534
sienna_cichlid_fill_i2c_req(&req, true, address, numbytes, data);
25252535

0 commit comments

Comments
 (0)