From 827f4b7241ba7c8219a703b0a114088f875dc9cf Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 14:27:06 +0800 Subject: [PATCH 1/8] x86/amd_nb: Add support for Hygon family 18h model 7h Add Hygon family 18h model 7h processor support for amd_nb. Signed-off-by: fuhao --- arch/x86/kernel/amd_nb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 4e7a5ffcab45..c8291fc94bb7 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c @@ -277,6 +277,7 @@ static int get_df_register(struct pci_dev *misc, u8 func, int offset, u32 *value device = PCI_DEVICE_ID_HYGON_18H_M04H_DF_F1; break; case 0x6: + case 0x7: device = PCI_DEVICE_ID_HYGON_18H_M05H_DF_F1; break; default: @@ -285,6 +286,7 @@ static int get_df_register(struct pci_dev *misc, u8 func, int offset, u32 *value } else if (func == 5) { switch (boot_cpu_data.x86_model) { case 0x6: + case 0x7: device = PCI_DEVICE_ID_HYGON_18H_M06H_DF_F5; break; default: @@ -317,7 +319,8 @@ int get_df_id(struct pci_dev *misc, u8 *id) u32 value; int ret; - if (boot_cpu_data.x86_model == 0x6) { + if (boot_cpu_data.x86_model >= 0x6 && + boot_cpu_data.x86_model <= 0x7) { /* F5x180[19:16]: DF ID */ ret = get_df_register(misc, 5, 0x180, &value); *id = (value >> 16) & 0xf; -- Gitee From f72fcef48a4c1d1585e31829f379ddc602eba097 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 14:37:19 +0800 Subject: [PATCH 2/8] EDAC/amd64: Add support for Hygon family 18h model 7h Add Hygon family 18h model 7h processor support for amd64_edac. Signed-off-by: fuhao --- drivers/edac/amd64_edac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index b8d98cd081b5..433112c6aef2 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4173,6 +4173,9 @@ static int per_family_init(struct amd64_pvt *pvt) } else if (pvt->model == 0x6) { pvt->ctl_name = "F18h_M06h"; break; + } else if (pvt->model == 0x7) { + pvt->ctl_name = "F18h_M07h"; + break; } pvt->ctl_name = "F18h"; break; -- Gitee From 5af4f9846eec6c6ecd922b0aeb514d5011537cb8 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 14:43:46 +0800 Subject: [PATCH 3/8] perf/x86/uncore: Add L3 PMU support for Hygon family 18h model 7h From model 6h, Hygon processors can use the same L3 PMU slicemask and threadmask. Signed-off-by: fuhao --- arch/x86/events/amd/uncore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 5100469fef32..a4c164e7f9c0 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -203,7 +203,7 @@ static u64 l3_thread_slice_mask(u64 config) if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON && boot_cpu_data.x86 == 0x18) { - if (boot_cpu_data.x86_model == 0x6) + if (boot_cpu_data.x86_model >= 0x6 && boot_cpu_data.x86_model <= 0xf) return ((config & HYGON_L3_SLICE_MASK) ? : HYGON_L3_SLICE_MASK) | ((config & HYGON_L3_THREAD_MASK) ? : HYGON_L3_THREAD_MASK); else @@ -282,7 +282,8 @@ amd_f17h_uncore_is_visible(struct kobject *kobj, struct attribute *attr, int i) static umode_t hygon_f18h_m6h_uncore_is_visible(struct kobject *kobj, struct attribute *attr, int i) { - return boot_cpu_data.x86 == 0x18 && boot_cpu_data.x86_model == 0x6 ? + return boot_cpu_data.x86 == 0x18 && + boot_cpu_data.x86_model >= 0x6 && boot_cpu_data.x86_model <= 0xf ? attr->mode : 0; } @@ -755,7 +756,7 @@ static int __init amd_uncore_init(void) boot_cpu_data.x86 == 0x18) { *l3_attr++ = &format_attr_event8.attr; *l3_attr++ = &format_attr_umask8.attr; - if (boot_cpu_data.x86_model == 0x6) { + if (boot_cpu_data.x86_model >= 0x6 && boot_cpu_data.x86_model <= 0xf) { *l3_attr++ = &format_attr_threadmask32.attr; amd_llc_pmu.attr_update = hygon_uncore_l3_attr_update; } else { -- Gitee From 14c7fd394771a47c46702883f749cfecb0d20d69 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 14:46:52 +0800 Subject: [PATCH 4/8] x86/cpu: Get LLC ID for Hygon family 18h model 10h Get LLC ID from ApicId[3]. Signed-off-by: fuhao --- arch/x86/kernel/cpu/cacheinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c index 7c4ce361c728..66c3ba277507 100644 --- a/arch/x86/kernel/cpu/cacheinfo.c +++ b/arch/x86/kernel/cpu/cacheinfo.c @@ -708,7 +708,8 @@ void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu) if (!cpuid_edx(0x80000006)) return; - if (c->x86_model < 0x5) { + if (c->x86_model < 0x5 || + (c->x86_model >= 0x10 && c->x86_model <= 0x1f)) { /* * LLC is at the core complex level. * Core complex ID is ApicId[3] for these processors. -- Gitee From 6e6d1fd9afeb05bff095f08ab746a4465eb6ecc3 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 14:56:26 +0800 Subject: [PATCH 5/8] x86/amd_nb: Add support for Hygon family 18h model 10h Add root and DF F1/F3/F4 device IDs for Hygon family 18h model 10h processors. Signed-off-by: fuhao --- arch/x86/kernel/amd_nb.c | 5 +++++ include/linux/pci_ids.h | 1 + 2 files changed, 6 insertions(+) diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index c8291fc94bb7..90ad306d8e8e 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c @@ -45,9 +45,11 @@ #define PCI_DEVICE_ID_AMD_MI200_DF_F4 0x14d4 #define PCI_DEVICE_ID_HYGON_18H_M05H_ROOT 0x14a0 +#define PCI_DEVICE_ID_HYGON_18H_M10H_ROOT 0x14c0 #define PCI_DEVICE_ID_HYGON_18H_M04H_DF_F1 0x1491 #define PCI_DEVICE_ID_HYGON_18H_M05H_DF_F1 0x14b1 #define PCI_DEVICE_ID_HYGON_18H_M05H_DF_F4 0x14b4 +#define PCI_DEVICE_ID_HYGON_18H_M10H_DF_F4 0x14d4 #define PCI_DEVICE_ID_HYGON_18H_M06H_DF_F5 0x14b5 /* Protect the PCI config register pairs used for SMN. */ @@ -132,6 +134,7 @@ static const struct pci_device_id hygon_root_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_17H_ROOT) }, { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_17H_M30H_ROOT) }, { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_HYGON_18H_M05H_ROOT) }, + { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_HYGON_18H_M10H_ROOT) }, {} }; @@ -139,6 +142,7 @@ static const struct pci_device_id hygon_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_HYGON_18H_M05H_DF_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_HYGON_18H_M10H_DF_F3) }, {} }; @@ -146,6 +150,7 @@ static const struct pci_device_id hygon_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_17H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_HYGON_18H_M05H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_HYGON_18H_M10H_DF_F4) }, {} }; diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 80ab3c226f7a..664961a30ae9 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2600,6 +2600,7 @@ #define PCI_VENDOR_ID_HYGON 0x1d94 #define PCI_DEVICE_ID_HYGON_18H_M05H_HDA 0x14a9 #define PCI_DEVICE_ID_HYGON_18H_M05H_DF_F3 0x14b3 +#define PCI_DEVICE_ID_HYGON_18H_M10H_DF_F3 0x14d3 #define PCI_VENDOR_ID_FUNGIBLE 0x1dad -- Gitee From 7c004add8041dee4cb5aaa72ec3e8ddbd00705d2 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 15:01:25 +0800 Subject: [PATCH 6/8] EDAC/amd64: Add support for Hygon family 18h model 10h Add Hygon family 18h model 10h processor support for amd64_edac. Signed-off-by: fuhao --- drivers/edac/amd64_edac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 433112c6aef2..3053f3383021 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4176,6 +4176,9 @@ static int per_family_init(struct amd64_pvt *pvt) } else if (pvt->model == 0x7) { pvt->ctl_name = "F18h_M07h"; break; + } else if (pvt->model == 0x10) { + pvt->ctl_name = "F18h_M10h"; + break; } pvt->ctl_name = "F18h"; break; -- Gitee From f18dcd9fb18c5442e9274fbcefe11d46196fa926 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 15:03:21 +0800 Subject: [PATCH 7/8] hwmon/k10temp: Add support for Hygon family 18h model 10h Add 18H_M10H DF F3 device ID to get the temperature for Hygon family 18h model 10h processor. Signed-off-by: fuhao --- drivers/hwmon/k10temp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index faf3955a311f..ec771408dece 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c @@ -609,6 +609,7 @@ static const struct pci_device_id k10temp_id_table[] = { { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) }, { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_HYGON_18H_M05H_DF_F3) }, + { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_HYGON_18H_M10H_DF_F3) }, {} }; MODULE_DEVICE_TABLE(pci, k10temp_id_table); -- Gitee From b6f2a5b5a61c95a3944d9f0591ffb3396b5e69d6 Mon Sep 17 00:00:00 2001 From: fuhao Date: Mon, 23 Sep 2024 15:07:23 +0800 Subject: [PATCH 8/8] ALSA: hda: Add support for Hygon family 18h model 10h HD-Audio Add the new PCI ID 0x1d94 0x14c9 for Hygon family 18h model 10h HDA controller. Signed-off-by: fuhao --- include/linux/pci_ids.h | 1 + sound/pci/hda/hda_intel.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 664961a30ae9..06d362397812 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2599,6 +2599,7 @@ #define PCI_VENDOR_ID_HYGON 0x1d94 #define PCI_DEVICE_ID_HYGON_18H_M05H_HDA 0x14a9 +#define PCI_DEVICE_ID_HYGON_18H_M10H_HDA 0x14c9 #define PCI_DEVICE_ID_HYGON_18H_M05H_DF_F3 0x14b3 #define PCI_DEVICE_ID_HYGON_18H_M10H_DF_F3 0x14d3 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index acf139136513..eba8255d8ec0 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2827,6 +2827,8 @@ static const struct pci_device_id azx_ids[] = { /* Hygon HDAudio */ { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_HYGON_18H_M05H_HDA), .driver_data = AZX_DRIVER_HYGON | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_NO_MSI }, + { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_HYGON_18H_M10H_HDA), + .driver_data = AZX_DRIVER_HYGON }, { 0, } }; MODULE_DEVICE_TABLE(pci, azx_ids); -- Gitee