]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/amd/pmc: Update IP information structure for newer SoCs
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Fri, 8 Nov 2024 07:08:19 +0000 (12:38 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 2 Dec 2024 17:46:07 +0000 (19:46 +0200)
The latest AMD processors include additional IP blocks that must be turned
off before transitioning to low power. PMFW provides an interface to
retrieve debug information from each IP block, which is useful for
diagnosing issues if the system fails to enter or exit low power states,
or for profiling which IP block takes more time. Add support for using
this information within the driver.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-8-Shyam-sundar.S-k@amd.com
[ij: grouped active_ips, ips_ptr, and num_ips next to each other.]
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmc/pmc.c
drivers/platform/x86/amd/pmc/pmc.h

index 147644e5026b97fc39b15a0d323e57cf688b2c96..bfdf63ecfc80796a055f385d8fcd035b872ed2f5 100644 (file)
@@ -95,6 +95,34 @@ struct amd_pmc_bit_map {
        u32 bit_mask;
 };
 
+static const struct amd_pmc_bit_map soc15_ip_blk_v2[] = {
+       {"DISPLAY",     BIT(0)},
+       {"CPU",         BIT(1)},
+       {"GFX",         BIT(2)},
+       {"VDD",         BIT(3)},
+       {"VDD_CCX",     BIT(4)},
+       {"ACP",         BIT(5)},
+       {"VCN_0",       BIT(6)},
+       {"VCN_1",       BIT(7)},
+       {"ISP",         BIT(8)},
+       {"NBIO",        BIT(9)},
+       {"DF",          BIT(10)},
+       {"USB3_0",      BIT(11)},
+       {"USB3_1",      BIT(12)},
+       {"LAPIC",       BIT(13)},
+       {"USB3_2",      BIT(14)},
+       {"USB4_RT0",    BIT(15)},
+       {"USB4_RT1",    BIT(16)},
+       {"USB4_0",      BIT(17)},
+       {"USB4_1",      BIT(18)},
+       {"MPM",         BIT(19)},
+       {"JPEG_0",      BIT(20)},
+       {"JPEG_1",      BIT(21)},
+       {"IPU",         BIT(22)},
+       {"UMSCH",       BIT(23)},
+       {"VPE",         BIT(24)},
+};
+
 static const struct amd_pmc_bit_map soc15_ip_blk[] = {
        {"DISPLAY",     BIT(0)},
        {"CPU",         BIT(1)},
@@ -161,15 +189,23 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev)
        case AMD_CPU_ID_YC:
        case AMD_CPU_ID_CB:
                dev->num_ips = 12;
+               dev->ips_ptr = soc15_ip_blk;
                dev->smu_msg = 0x538;
                break;
        case AMD_CPU_ID_PS:
                dev->num_ips = 21;
+               dev->ips_ptr = soc15_ip_blk;
                dev->smu_msg = 0x538;
                break;
        case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT:
        case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT:
-               dev->num_ips = ARRAY_SIZE(soc15_ip_blk);
+               if (boot_cpu_data.x86_model == 0x70) {
+                       dev->num_ips = ARRAY_SIZE(soc15_ip_blk_v2);
+                       dev->ips_ptr = soc15_ip_blk_v2;
+               } else {
+                       dev->num_ips = ARRAY_SIZE(soc15_ip_blk);
+                       dev->ips_ptr = soc15_ip_blk;
+               }
                dev->smu_msg = 0x938;
                break;
        }
@@ -337,8 +373,8 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)
 
        seq_puts(s, "\n=== Active time (in us) ===\n");
        for (idx = 0 ; idx < dev->num_ips ; idx++) {
-               if (soc15_ip_blk[idx].bit_mask & dev->active_ips)
-                       seq_printf(s, "%-8s : %lld\n", soc15_ip_blk[idx].name,
+               if (dev->ips_ptr[idx].bit_mask & dev->active_ips)
+                       seq_printf(s, "%-8s : %lld\n", dev->ips_ptr[idx].name,
                                   table.timecondition_notmet_lastcapture[idx]);
        }
 
index 2c640bd8de82f2fb9aaf7fd1afdb5842d5b67135..f43f0253b0f53e40303995d01baa37919de371f9 100644 (file)
@@ -44,8 +44,9 @@ struct amd_pmc_dev {
        void __iomem *fch_virt_addr;
        u32 base_addr;
        u32 cpu_id;
-       u32 active_ips;
        u32 dram_size;
+       u32 active_ips;
+       const struct amd_pmc_bit_map *ips_ptr;
        u32 num_ips;
        u32 smu_msg;
 /* SMU version information */