drm/amdgpu: Fix memcpy() in sienna_cichlid_append_powerplay_table function.
authorjsg <jsg@openbsd.org>
Thu, 20 Jul 2023 08:47:27 +0000 (08:47 +0000)
committerjsg <jsg@openbsd.org>
Thu, 20 Jul 2023 08:47:27 +0000 (08:47 +0000)
From Srinivasan Shanmugam
8d68ba92554b79a93f52bea0cf778eb7821c9901 in linux-6.1.y/6.1.39
d50dc746ff72b9c48812dac3344fa87fbde940a3 in mainline linux

sys/dev/pci/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

index f106763..e381c28 100644 (file)
@@ -431,7 +431,13 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu)
 {
        struct atom_smc_dpm_info_v4_9 *smc_dpm_table;
        int index, ret;
-       I2cControllerConfig_t *table_member;
+       PPTable_beige_goby_t *ppt_beige_goby;
+       PPTable_t *ppt;
+
+       if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))
+               ppt_beige_goby = smu->smu_table.driver_pptable;
+       else
+               ppt = smu->smu_table.driver_pptable;
 
        index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
                                            smc_dpm_info);
@@ -440,9 +446,13 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu)
                                      (uint8_t **)&smc_dpm_table);
        if (ret)
                return ret;
-       GET_PPTABLE_MEMBER(I2cControllers, &table_member);
-       memcpy(table_member, smc_dpm_table->I2cControllers,
-                       sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header));
+
+       if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))
+               smu_memcpy_trailing(ppt_beige_goby, I2cControllers, BoardReserved,
+                                   smc_dpm_table, I2cControllers);
+       else
+               smu_memcpy_trailing(ppt, I2cControllers, BoardReserved,
+                                   smc_dpm_table, I2cControllers);
 
        return 0;
 }