diff options
42 files changed, 635 insertions, 50 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 69dd13947182..d47de7aa9443 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -6787,6 +6787,12 @@ S: Maintained | |||
| 6787 | F: mm/memory-failure.c | 6787 | F: mm/memory-failure.c |
| 6788 | F: mm/hwpoison-inject.c | 6788 | F: mm/hwpoison-inject.c |
| 6789 | 6789 | ||
| 6790 | HYGON PROCESSOR SUPPORT | ||
| 6791 | M: Pu Wen <puwen@hygon.cn> | ||
| 6792 | L: linux-kernel@vger.kernel.org | ||
| 6793 | S: Maintained | ||
| 6794 | F: arch/x86/kernel/cpu/hygon.c | ||
| 6795 | |||
| 6790 | Hyper-V CORE AND DRIVERS | 6796 | Hyper-V CORE AND DRIVERS |
| 6791 | M: "K. Y. Srinivasan" <kys@microsoft.com> | 6797 | M: "K. Y. Srinivasan" <kys@microsoft.com> |
| 6792 | M: Haiyang Zhang <haiyangz@microsoft.com> | 6798 | M: Haiyang Zhang <haiyangz@microsoft.com> |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 638411f22267..6adce15268bd 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
| @@ -426,6 +426,20 @@ config CPU_SUP_AMD | |||
| 426 | 426 | ||
| 427 | If unsure, say N. | 427 | If unsure, say N. |
| 428 | 428 | ||
| 429 | config CPU_SUP_HYGON | ||
| 430 | default y | ||
| 431 | bool "Support Hygon processors" if PROCESSOR_SELECT | ||
| 432 | select CPU_SUP_AMD | ||
| 433 | help | ||
| 434 | This enables detection, tunings and quirks for Hygon processors | ||
| 435 | |||
| 436 | You need this enabled if you want your kernel to run on an | ||
| 437 | Hygon CPU. Disabling this option on other types of CPUs | ||
| 438 | makes the kernel a tiny bit smaller. Disabling it on an Hygon | ||
| 439 | CPU might render the kernel unbootable. | ||
| 440 | |||
| 441 | If unsure, say N. | ||
| 442 | |||
| 429 | config CPU_SUP_CENTAUR | 443 | config CPU_SUP_CENTAUR |
| 430 | default y | 444 | default y |
| 431 | bool "Support Centaur processors" if PROCESSOR_SELECT | 445 | bool "Support Centaur processors" if PROCESSOR_SELECT |
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index c84584bb9402..7d2d7c801dba 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c | |||
| @@ -669,6 +669,10 @@ static int __init amd_core_pmu_init(void) | |||
| 669 | * We fallback to using default amd_get_event_constraints. | 669 | * We fallback to using default amd_get_event_constraints. |
| 670 | */ | 670 | */ |
| 671 | break; | 671 | break; |
| 672 | case 0x18: | ||
| 673 | pr_cont("Fam18h "); | ||
| 674 | /* Using default amd_get_event_constraints. */ | ||
| 675 | break; | ||
| 672 | default: | 676 | default: |
| 673 | pr_err("core perfctr but no constraints; unknown hardware!\n"); | 677 | pr_err("core perfctr but no constraints; unknown hardware!\n"); |
| 674 | return -ENODEV; | 678 | return -ENODEV; |
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 8671de126eac..398df6eaa109 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c | |||
| @@ -515,17 +515,19 @@ static int __init amd_uncore_init(void) | |||
| 515 | { | 515 | { |
| 516 | int ret = -ENODEV; | 516 | int ret = -ENODEV; |
| 517 | 517 | ||
| 518 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | 518 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && |
| 519 | boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) | ||
| 519 | return -ENODEV; | 520 | return -ENODEV; |
| 520 | 521 | ||
| 521 | if (!boot_cpu_has(X86_FEATURE_TOPOEXT)) | 522 | if (!boot_cpu_has(X86_FEATURE_TOPOEXT)) |
| 522 | return -ENODEV; | 523 | return -ENODEV; |
| 523 | 524 | ||
| 524 | if (boot_cpu_data.x86 == 0x17) { | 525 | if (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18) { |
| 525 | /* | 526 | /* |
| 526 | * For F17h, the Northbridge counters are repurposed as Data | 527 | * For F17h or F18h, the Northbridge counters are |
| 527 | * Fabric counters. Also, L3 counters are supported too. The PMUs | 528 | * repurposed as Data Fabric counters. Also, L3 |
| 528 | * are exported based on family as either L2 or L3 and NB or DF. | 529 | * counters are supported too. The PMUs are exported |
| 530 | * based on family as either L2 or L3 and NB or DF. | ||
| 529 | */ | 531 | */ |
| 530 | num_counters_nb = NUM_COUNTERS_NB; | 532 | num_counters_nb = NUM_COUNTERS_NB; |
| 531 | num_counters_llc = NUM_COUNTERS_L3; | 533 | num_counters_llc = NUM_COUNTERS_L3; |
| @@ -557,7 +559,9 @@ static int __init amd_uncore_init(void) | |||
| 557 | if (ret) | 559 | if (ret) |
| 558 | goto fail_nb; | 560 | goto fail_nb; |
| 559 | 561 | ||
| 560 | pr_info("AMD NB counters detected\n"); | 562 | pr_info("%s NB counters detected\n", |
| 563 | boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ? | ||
| 564 | "HYGON" : "AMD"); | ||
| 561 | ret = 0; | 565 | ret = 0; |
| 562 | } | 566 | } |
| 563 | 567 | ||
| @@ -571,7 +575,9 @@ static int __init amd_uncore_init(void) | |||
| 571 | if (ret) | 575 | if (ret) |
| 572 | goto fail_llc; | 576 | goto fail_llc; |
| 573 | 577 | ||
| 574 | pr_info("AMD LLC counters detected\n"); | 578 | pr_info("%s LLC counters detected\n", |
| 579 | boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ? | ||
| 580 | "HYGON" : "AMD"); | ||
| 575 | ret = 0; | 581 | ret = 0; |
| 576 | } | 582 | } |
| 577 | 583 | ||
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index de32741d041a..106911b603bd 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c | |||
| @@ -1797,6 +1797,10 @@ static int __init init_hw_perf_events(void) | |||
| 1797 | case X86_VENDOR_AMD: | 1797 | case X86_VENDOR_AMD: |
| 1798 | err = amd_pmu_init(); | 1798 | err = amd_pmu_init(); |
| 1799 | break; | 1799 | break; |
| 1800 | case X86_VENDOR_HYGON: | ||
| 1801 | err = amd_pmu_init(); | ||
| 1802 | x86_pmu.name = "HYGON"; | ||
| 1803 | break; | ||
| 1800 | default: | 1804 | default: |
| 1801 | err = -ENOTSUPP; | 1805 | err = -ENOTSUPP; |
| 1802 | } | 1806 | } |
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index fddb6d26239f..1ae4e5791afa 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
| @@ -103,6 +103,9 @@ static inline u16 amd_pci_dev_to_node_id(struct pci_dev *pdev) | |||
| 103 | 103 | ||
| 104 | static inline bool amd_gart_present(void) | 104 | static inline bool amd_gart_present(void) |
| 105 | { | 105 | { |
| 106 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | ||
| 107 | return false; | ||
| 108 | |||
| 106 | /* GART present only on Fam15h, upto model 0fh */ | 109 | /* GART present only on Fam15h, upto model 0fh */ |
| 107 | if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 || | 110 | if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 || |
| 108 | (boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model < 0x10)) | 111 | (boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model < 0x10)) |
diff --git a/arch/x86/include/asm/cacheinfo.h b/arch/x86/include/asm/cacheinfo.h index e958e28f7ab5..86b63c7feab7 100644 --- a/arch/x86/include/asm/cacheinfo.h +++ b/arch/x86/include/asm/cacheinfo.h | |||
| @@ -3,5 +3,6 @@ | |||
| 3 | #define _ASM_X86_CACHEINFO_H | ||
