]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd: Update `update_pcie_parameters` functions to use uint8_t arguments
authorMario Limonciello <mario.limonciello@amd.com>
Sat, 30 Sep 2023 03:12:18 +0000 (22:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:19:40 +0000 (17:19 +0000)
[ Upstream commit 7752ccf85b929a22e658ec145283e8f31232f4bb ]

The matching values for `pcie_gen_cap` and `pcie_width_cap` when
fetched from powerplay tables are 1 byte, so narrow the arguments
to match to ensure min() and max() comparisons without casts.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index f005a90c35af43f195c66b73fccf9e3750b93e18..b47fd42414f4677c7abc79aea2e4f789255e2ead 100644 (file)
@@ -1232,7 +1232,7 @@ static int smu_smc_hw_setup(struct smu_context *smu)
 {
        struct smu_feature *feature = &smu->smu_feature;
        struct amdgpu_device *adev = smu->adev;
-       uint32_t pcie_gen = 0, pcie_width = 0;
+       uint8_t pcie_gen = 0, pcie_width = 0;
        uint64_t features_supported;
        int ret = 0;
 
index 5a52098bcf1664c52fb8f9191d18919bb26da55c..72ed836328966c09d33c87e7fd95ccd229e0d6ca 100644 (file)
@@ -844,7 +844,7 @@ struct pptable_funcs {
         * &pcie_gen_cap: Maximum allowed PCIe generation.
         * &pcie_width_cap: Maximum allowed PCIe width.
         */
-       int (*update_pcie_parameters)(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap);
+       int (*update_pcie_parameters)(struct smu_context *smu, uint8_t pcie_gen_cap, uint8_t pcie_width_cap);
 
        /**
         * @i2c_init: Initialize i2c.
index 355c156d871aff86aff1c64d8bc1278c14ea9cbb..cc02f979e9e9843e10d2fd0ca3c6764cb2cdf91f 100644 (file)
@@ -296,8 +296,8 @@ int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu,
                                        uint32_t pptable_id);
 
 int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
-                                    uint32_t pcie_gen_cap,
-                                    uint32_t pcie_width_cap);
+                                    uint8_t pcie_gen_cap,
+                                    uint8_t pcie_width_cap);
 
 #endif
 #endif
index 18487ae10bcff469f71d189f0e36e4727c81bfdb..c564f6e191f84ce072172a029d4b92256b2d8dfb 100644 (file)
@@ -2376,8 +2376,8 @@ static int navi10_get_power_limit(struct smu_context *smu,
 }
 
 static int navi10_update_pcie_parameters(struct smu_context *smu,
-                                    uint32_t pcie_gen_cap,
-                                    uint32_t pcie_width_cap)
+                                        uint8_t pcie_gen_cap,
+                                        uint8_t pcie_width_cap)
 {
        struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
        PPTable_t *pptable = smu->smu_table.driver_pptable;
index da2860da60188e084bbbfafd11403822befc20ab..0cc5d9769d3827fb63c9379b8e3cd058474050de 100644 (file)
@@ -2085,14 +2085,14 @@ static int sienna_cichlid_display_disable_memory_clock_switch(struct smu_context
 #define MAX(a, b)      ((a) > (b) ? (a) : (b))
 
 static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu,
-                                        uint32_t pcie_gen_cap,
-                                        uint32_t pcie_width_cap)
+                                                uint8_t pcie_gen_cap,
+                                                uint8_t pcie_width_cap)
 {
        struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
        struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table;
        uint8_t *table_member1, *table_member2;
-       uint32_t min_gen_speed, max_gen_speed;
-       uint32_t min_lane_width, max_lane_width;
+       uint8_t min_gen_speed, max_gen_speed;
+       uint8_t min_lane_width, max_lane_width;
        uint32_t smu_pcie_arg;
        int ret, i;
 
index 0232adb95df3a898d4a98894996690b61d703d56..a280c1ed007f692ceb160272ef18c17d5c3e07e2 100644 (file)
@@ -2420,8 +2420,8 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
 }
 
 int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
-                                    uint32_t pcie_gen_cap,
-                                    uint32_t pcie_width_cap)
+                                    uint8_t pcie_gen_cap,
+                                    uint8_t pcie_width_cap)
 {
        struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
        struct smu_13_0_pcie_table *pcie_table =