Re: [PATCH v2 01/17] x86/cpu: create Dhyana init file and register new cpu_dev to system

2018-07-30 Thread Pu Wen
ge this by directly reusing condition check if reused codes are direct: + case X86_VENDOR_HYGON: case X86_VENDOR_AMD: if (msr >= MSR_F15H_PERF_CTR) return (msr - MSR_F15H_PERF_CTR) >> 1; return msr - MSR_K7_PERFCTR0; Also will branch codes for Hygon in case of complicated checking condition such as in xen_pmu_arch_init(). Thanks, Pu Wen

Re: [PATCH v2 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-07-30 Thread Pu Wen
On 2018-07-29 07:42, Paolo Bonzini wrote: On 23/07/2018 15:20, Pu Wen wrote: scrubval = scrubrates[i].scrubval; - if (pvt->fam == 0x17) { + if (pvt->fam == 0x17 || pvt->fam == 0x18) { __f17h_set_scrubval(pvt, scrubval); } else if (pvt->fam == 0x15 &&

Re: [PATCH v2 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-07-31 Thread Pu Wen
. For code consistency, will check explicitly for Hygon before testing family 18h in next patch set. Thanks, Pu Wen

[PATCH v3 11/17] x86/mce: enable Hygon support to MCE infrastructure

2018-08-11 Thread Pu Wen
Hygon machine check arch is similar to AMD family 17h. To enable the MCE infrastructure support, add CPU vendor check for Hygon to share the code path of AMD. Add hygon mce init function mce_hygon_feature_init() to minimize further maintenance effort. Signed-off-by: Pu Wen --- arch/x86/include

[PATCH v3 12/17] x86/kvm: enable Hygon support to KVM infrastructure

2018-08-11 Thread Pu Wen
Hygon Dhyana CPU has the SVM feature as AMD family 17h does. Add Hygon support in the KVM infrastructure. Signed-off-by: Pu Wen --- arch/x86/include/asm/kvm_emulate.h | 4 arch/x86/include/asm/virtext.h | 5 +++-- arch/x86/kvm/emulate.c | 11 ++- 3 files changed

[PATCH v3 10/17] x86/events: enable Hygon support to PMU infrastructure

2018-08-11 Thread Pu Wen
Hygon PMU arch is similar to AMD Family 17h. To support Hygon PMU, the initialization flow for it just call amd_pmu_init() and change PMU name to "HYGON". To share AMD's flow, add code check for Hygon family ID 18h to run the code path of AMD family 17h in core/uncore functions. Signed-

[PATCH v3 08/17] x86/apic: add modern APIC support for Hygon

2018-08-11 Thread Pu Wen
Hygon processors use modern APIC, so just return in modern_apic() and sync_Arb_IDs(). And should break in switch case in detect_init_API(). When running on 32 bit mode, should set bigsmp if there are more than 8 cores. Signed-off-by: Pu Wen --- arch/x86/kernel/apic/apic.c | 19

[PATCH v3 07/17] x86/pci: add Hygon PCI vendor and northbridge support

2018-08-11 Thread Pu Wen
b_misc_ids[], hygon_nb_link_ids[]. To enable Hygon north bridge support, add new variable root_ids, and assign its value based on whether CPU vendor is AMD or Hygon. Modify the CONFIG_AMD_NB to depends on either AMD or Hygon. Add Hygon support in amd_postcore_init(), early_root_info_init(). Signed-

[PATCH v3 09/17] x86/bugs: add lfence mitigation to spectre v2 and no meltdown for Hygon

2018-08-11 Thread Pu Wen
vulnerability as AMD's, so add exception in array cpu_no_meltdown[] for Hygon. Signed-off-by: Pu Wen --- arch/x86/include/asm/nospec-branch.h | 4 ++-- arch/x86/kernel/cpu/bugs.c | 28 +++- arch/x86/kernel/cpu/common.c | 1 + 3 files changed, 18 insertions

[PATCH v3 05/17] x86/perfctr: return perf counter and event selection bit offset

2018-08-11 Thread Pu Wen
Hygon Dhyana shares similar perfctr arch with AMD family 17h. It returns the bit offset of the performance counter register and the event selection register for Hygon CPU in the similar way as AMD does. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/perfctr-watchdog.c | 2 ++ 1 file changed, 2

[PATCH v3 06/17] x86/nops: init ideal_nops for Hygon

2018-08-11 Thread Pu Wen
The ideal_nops for Dhyana processors should be p6_nops. Signed-off-by: Pu Wen --- arch/x86/kernel/alternative.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index a481763..8f4925b 100644 --- a/arch/x86/kernel/alternative.c

[PATCH v3 17/17] tools/cpupower: enable Hygon support to cpupower tool

2018-08-11 Thread Pu Wen
Tool cpupower is useful to get CPU frequency information and monitor power stats on Hygon platforms. So enable platform support to cpupower for Hygon Dhyana Family 18h processors by checking vendor ID and vendor string. Signed-off-by: Pu Wen --- tools/power/cpupower/utils/cpufreq-info.c

[PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-11 Thread Pu Wen
is needed for edac driver. Signed-off-by: Pu Wen --- drivers/edac/amd64_edac.c | 45 - drivers/edac/amd64_edac.h | 5 + drivers/edac/mce_amd.c| 12 +++- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/drivers/edac

[PATCH v3 15/17] driver/cpufreq: enable Hygon support to cpufreq driver

2018-08-11 Thread Pu Wen
Enable ACPI cpufreq driver support for Hygon by adding family ID check along with AMD. As Hygon platforms have SMBus device(PCI device ID 0x790b), enable Hygon support to function amd_freq_sensitivity_init(). Signed-off-by: Pu Wen --- drivers/cpufreq/acpi-cpufreq.c | 5 + drivers

[PATCH v3 14/17] driver/acpi: enable Hygon support to ACPI driver

2018-08-11 Thread Pu Wen
For Dhyana processors have NONSTOP TSC feature, so enable the support to ACPI driver. Signed-off-by: Pu Wen --- drivers/acpi/acpi_pad.c | 1 + drivers/acpi/processor_idle.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index

[PATCH v3 01/17] x86/cpu: create Dhyana init file and register new cpu_dev to system

2018-08-11 Thread Pu Wen
a separated Kconfig entry (CPU_SUP_HYGON) for Dhyana CPU in kernel config setup. Signed-off-by: Pu Wen --- MAINTAINERS | 6 + arch/x86/Kconfig.cpu | 13 ++ arch/x86/include/asm/processor.h | 3 +- arch/x86/kernel/cpu/Makefile | 1 + arch/x86/kernel/cpu

[PATCH v3 02/17] x86/cache: get cache size/leaves and setup cache cpumap for Dhyana

2018-08-11 Thread Pu Wen
(). Also add cacheinfo_hygon_init_llc_id() and init_hygon_cacheinfo() functions to initialize Dhyana cache info. Setup cache cpumap in the same way as AMD does. Signed-off-by: Pu Wen --- arch/x86/include/asm/cacheinfo.h | 1 + arch/x86/kernel/cpu/cacheinfo.c | 31

[PATCH v3 04/17] x86/smpboot: smp init nodelay and no flush caches before sleep

2018-08-11 Thread Pu Wen
Dhyana use no delay in smp_quirk_init_udelay(), and return in mwait_play_dead() as AMD does. Signed-off-by: Pu Wen --- arch/x86/kernel/smpboot.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index db9656e..32eec7f

[PATCH v3 03/17] x86/mtrr: get MTRR number and support TOP_MEM2

2018-08-11 Thread Pu Wen
RRs, then cleared to 0 for operation. The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) d

Re: [PATCH v3 07/17] x86/pci: add Hygon PCI vendor and northbridge support

2018-08-13 Thread Pu Wen
On 2018/8/14 6:14, Bjorn Helgaas wrote: On Sat, Aug 11, 2018 at 09:27:42PM +0800, Pu Wen wrote: diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 2950223..d0e98a9 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -511,6 +511,8 @@ #define

Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-13 Thread Pu Wen
On 2018/8/12 3:56, Michael Jin wrote: On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen wrote: diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 18aeabb..fb81354 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -211,7 +211,7 @@ static int __set_scrub_rate

Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-13 Thread Pu Wen
On 2018/8/12 3:56, Michael Jin wrote: On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen wrote: diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 18aeabb..fb81354 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -211,7 +211,7 @@ static int __set_scrub_rate

Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-13 Thread Pu Wen
On 2018/8/12 4:10, Michael Jin wrote: On Sat, Aug 11, 2018 at 3:56 PM, Michael Jin wrote: On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen wrote: @@ -1051,6 +1065,16 @@ static void determine_memory_type(struct amd64_pvt *pvt) else pvt->dram_type = MEM_D

Re: [PATCH v3 15/17] driver/cpufreq: enable Hygon support to cpufreq driver

2018-08-13 Thread Pu Wen
On 2018/8/12 17:55, Rafael J. Wysocki wrote: On Sat, Aug 11, 2018 at 3:36 PM Pu Wen wrote: Enable ACPI cpufreq driver support for Hygon by adding family ID check along with AMD. As Hygon platforms have SMBus device(PCI device ID 0x790b), enable Hygon support to function

Re: [PATCH v4 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-21 Thread Pu Wen
On 2018-08-21 16:13, Borislav Petkov wrote: On Mon, Aug 20, 2018 at 12:14:58AM +0800, Pu Wen wrote: ... diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 18aeabb..3cefb25 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -211,7 +211,8 @@ static

[PATCH v4 01/16] x86/cpu: create Dhyana init file and register new cpu_dev to system

2018-08-19 Thread Pu Wen
a separated Kconfig entry (CPU_SUP_HYGON) for Dhyana CPU in kernel config setup. Signed-off-by: Pu Wen --- MAINTAINERS | 6 + arch/x86/Kconfig.cpu | 13 ++ arch/x86/include/asm/processor.h | 3 +- arch/x86/kernel/cpu/Makefile | 1 + arch/x86/kernel/cpu

[PATCH v4 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-08-19 Thread Pu Wen
RRs, then cleared to 0 for operation. The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) d

[PATCH v4 02/16] x86/cache: get cache size/leaves and setup cache cpumap for Dhyana

2018-08-19 Thread Pu Wen
(). Also add cacheinfo_hygon_init_llc_id() and init_hygon_cacheinfo() functions to initialize Dhyana cache info. Setup cache cpumap in the same way as AMD does. Signed-off-by: Pu Wen --- arch/x86/include/asm/cacheinfo.h | 1 + arch/x86/kernel/cpu/cacheinfo.c | 31

[PATCH v4 05/16] x86/pmu: enable Hygon support to PMU infrastructure

2018-08-19 Thread Pu Wen
it returns the bit offset of the performance counter register and event selection register for Hygon CPU in the similar way as AMD does. Signed-off-by: Pu Wen --- arch/x86/events/amd/core.c | 6 ++ arch/x86/events/amd/uncore.c | 15 ++- arch/x86/eve

[PATCH v4 04/16] x86/smpboot: smp init nodelay and no flush caches before sleep

2018-08-19 Thread Pu Wen
Dhyana use no delay in smp_quirk_init_udelay(), and return in mwait_play_dead() as AMD does. Signed-off-by: Pu Wen --- arch/x86/kernel/smpboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f02ecaf..5369d7f

[PATCH v4 06/16] x86/nops: init ideal_nops for Hygon

2018-08-19 Thread Pu Wen
The ideal_nops for Dhyana processors should be p6_nops. Signed-off-by: Pu Wen --- arch/x86/kernel/alternative.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index a481763..8f4925b 100644 --- a/arch/x86/kernel/alternative.c

[PATCH v4 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-19 Thread Pu Wen
is needed for edac driver. Signed-off-by: Pu Wen --- drivers/edac/amd64_edac.c | 52 ++- drivers/edac/amd64_edac.h | 5 + drivers/edac/mce_amd.c| 15 +- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/drivers/edac

[PATCH v4 11/16] x86/kvm: enable Hygon support to KVM infrastructure

2018-08-19 Thread Pu Wen
Hygon Dhyana CPU has the SVM feature as AMD family 17h does. Add Hygon support in the KVM infrastructure. Signed-off-by: Pu Wen --- arch/x86/include/asm/kvm_emulate.h | 4 arch/x86/include/asm/virtext.h | 5 +++-- arch/x86/kvm/emulate.c | 11 ++- 3 files changed

[PATCH v4 16/16] tools/cpupower: enable Hygon support to cpupower tool

2018-08-19 Thread Pu Wen
Tool cpupower is useful to get CPU frequency information and monitor power stats on Hygon platforms. So enable platform support to cpupower for Hygon Dhyana Family 18h processors by checking vendor ID & family and vendor string along with AMD. Signed-off-by: Pu Wen --- tools/power/cpup

[PATCH v4 14/16] driver/cpufreq: enable Hygon support to cpufreq driver

2018-08-19 Thread Pu Wen
Enable ACPI cpufreq driver support for Hygon by adding family ID check along with AMD. As Hygon platforms have SMBus device(PCI device ID 0x790b), enable Hygon support to function amd_freq_sensitivity_init(). Acked-by: Rafael J. Wysocki Signed-off-by: Pu Wen --- drivers/cpufreq/acpi-cpufreq.c

[PATCH v4 13/16] driver/acpi: enable Hygon support to ACPI driver

2018-08-19 Thread Pu Wen
For Dhyana processors have NONSTOP TSC feature, so enable the support to ACPI driver. Acked-by: Rafael J. Wysocki Signed-off-by: Pu Wen --- drivers/acpi/acpi_pad.c | 1 + drivers/acpi/processor_idle.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/acpi/acpi_pad.c b/drivers

[PATCH v4 09/16] x86/bugs: add lfence mitigation to spectre v2 and no meltdown for Hygon

2018-08-19 Thread Pu Wen
vulnerability as AMD's, so add exception in array cpu_no_meltdown[] for Hygon. Signed-off-by: Pu Wen --- arch/x86/include/asm/nospec-branch.h | 4 ++-- arch/x86/kernel/cpu/bugs.c | 28 +++- arch/x86/kernel/cpu/common.c | 1 + 3 files changed, 18 insertions

[PATCH v4 07/16] x86/pci: add Hygon PCI vendor and northbridge support

2018-08-19 Thread Pu Wen
-by: Bjorn Helgaas# pci_ids.h Signed-off-by: Pu Wen --- arch/x86/Kconfig | 2 +- arch/x86/kernel/amd_nb.c | 51 ++-- arch/x86/pci/amd_bus.c | 6 -- include/linux/pci_ids.h | 2 ++ 4 files changed, 52 insertions(+), 9 deletions(-)

[PATCH v4 08/16] x86/apic: add modern APIC support for Hygon

2018-08-19 Thread Pu Wen
Hygon processors use modern APIC, so just return in modern_apic() and sync_Arb_IDs(). And should break in switch case in detect_init_API(). When running on 32 bit mode, should set bigsmp if there are more than 8 cores. Signed-off-by: Pu Wen --- arch/x86/kernel/apic/apic.c | 19

[PATCH v4 10/16] x86/mce: enable Hygon support to MCE infrastructure

2018-08-19 Thread Pu Wen
Hygon machine check arch is similar to AMD family 17h. To enable the MCE infrastructure support, add CPU vendor check for Hygon to share the code path of AMD. Add hygon mce init function mce_hygon_feature_init() to minimize further maintenance effort. Signed-off-by: Pu Wen --- arch/x86/include

Re: [PATCH v4 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-22 Thread Pu Wen
more clear. Regards Pu Wen

Re: [PATCH v4 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-22 Thread Pu Wen
, make the assumption clear and try to keep it small. If that's ok, we will rework this patch. Thanks for all the suggestions. Regards, Pu Wen

[PATCH v5 07/16] x86/pci: add Hygon PCI vendor and northbridge support

2018-08-29 Thread Pu Wen
-by: Bjorn Helgaas# pci_ids.h Signed-off-by: Pu Wen --- arch/x86/Kconfig | 2 +- arch/x86/kernel/amd_nb.c | 51 ++-- arch/x86/pci/amd_bus.c | 6 -- include/linux/pci_ids.h | 2 ++ 4 files changed, 52 insertions(+), 9 deletions(-)

[PATCH v5 10/16] x86/mce: enable Hygon support to MCE infrastructure

2018-08-29 Thread Pu Wen
Hygon machine check arch is similar to AMD family 17h. To enable the MCE infrastructure support, add CPU vendor check for Hygon to share the code path of AMD. Add hygon mce init function mce_hygon_feature_init() to minimize further maintenance effort. Signed-off-by: Pu Wen --- arch/x86/include

[PATCH v5 06/16] x86/nops: init ideal_nops for Hygon

2018-08-29 Thread Pu Wen
The ideal_nops for Dhyana processors should be p6_nops. Signed-off-by: Pu Wen --- arch/x86/kernel/alternative.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 014f214..3f51d1c 100644 --- a/arch/x86/kernel/alternative.c

[PATCH v5 04/16] x86/smpboot: smp init nodelay and no flush caches before sleep

2018-08-29 Thread Pu Wen
Dhyana use no delay in smp_quirk_init_udelay(), and return in mwait_play_dead() as AMD does. Signed-off-by: Pu Wen --- arch/x86/kernel/smpboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f02ecaf..5369d7f

[PATCH v5 14/16] driver/cpufreq: enable Hygon support to cpufreq driver

2018-08-29 Thread Pu Wen
Enable ACPI cpufreq driver support for Hygon by adding family ID check along with AMD. As Hygon platforms have SMBus device(PCI device ID 0x790b), enable Hygon support to function amd_freq_sensitivity_init(). Acked-by: Rafael J. Wysocki Signed-off-by: Pu Wen --- drivers/cpufreq/acpi-cpufreq.c

[PATCH v5 09/16] x86/bugs: add lfence mitigation to spectre v2 and no meltdown for Hygon

2018-08-29 Thread Pu Wen
vulnerability as AMD's, so add exception in array cpu_no_meltdown[] for Hygon. Signed-off-by: Pu Wen --- arch/x86/include/asm/nospec-branch.h | 4 ++-- arch/x86/kernel/cpu/bugs.c | 28 +++- arch/x86/kernel/cpu/common.c | 1 + 3 files changed, 18 insertions

[PATCH v5 02/16] x86/cache: get cache size/leaves and setup cache cpumap for Dhyana

2018-08-29 Thread Pu Wen
(). Also add cacheinfo_hygon_init_llc_id() and init_hygon_cacheinfo() functions to initialize Dhyana cache info. Setup cache cpumap in the same way as AMD does. Signed-off-by: Pu Wen --- arch/x86/include/asm/cacheinfo.h | 1 + arch/x86/kernel/cpu/cacheinfo.c | 31

[PATCH v5 12/16] x86/xen: enable Hygon support to Xen

2018-08-29 Thread Pu Wen
of kernel Hygon use the lagacy and safe versions of MSR access. It works fine when VPMU enabled in Xen on Hygon platforms by testing with perf. Reviewed-by: Boris Ostrovsky Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git

[PATCH v5 05/16] x86/pmu: enable Hygon support to PMU infrastructure

2018-08-29 Thread Pu Wen
it returns the bit offset of the performance counter register and event selection register for Hygon CPU in the similar way as AMD does. Signed-off-by: Pu Wen --- arch/x86/events/amd/core.c | 6 ++ arch/x86/events/amd/uncore.c | 15 ++- arch/x86/eve

[PATCH v5 13/16] driver/acpi: enable Hygon support to ACPI driver

2018-08-29 Thread Pu Wen
For Dhyana processors have NONSTOP TSC feature, so enable the support to ACPI driver. Acked-by: Rafael J. Wysocki Signed-off-by: Pu Wen --- drivers/acpi/acpi_pad.c | 1 + drivers/acpi/processor_idle.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/acpi/acpi_pad.c b/drivers

[PATCH v5 11/16] x86/kvm: enable Hygon support to KVM infrastructure

2018-08-29 Thread Pu Wen
Hygon Dhyana CPU has the SVM feature as AMD family 17h does. Add Hygon support in the KVM infrastructure. Signed-off-by: Pu Wen --- arch/x86/include/asm/kvm_emulate.h | 4 arch/x86/include/asm/virtext.h | 5 +++-- arch/x86/kvm/emulate.c | 11 ++- 3 files changed

[PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-08-29 Thread Pu Wen
RRs, then cleared to 0 for operation. The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) d

[PATCH v5 01/16] x86/cpu: create Dhyana init file and register new cpu_dev to system

2018-08-29 Thread Pu Wen
a separated Kconfig entry (CPU_SUP_HYGON) for Dhyana CPU in kernel config setup. Signed-off-by: Pu Wen --- MAINTAINERS | 6 + arch/x86/Kconfig.cpu | 13 ++ arch/x86/include/asm/processor.h | 3 +- arch/x86/kernel/cpu/Makefile | 1 + arch/x86/kernel/cpu

[PATCH v5 16/16] tools/cpupower: enable Hygon support to cpupower tool

2018-08-29 Thread Pu Wen
Tool cpupower is useful to get CPU frequency information and monitor power stats on Hygon platforms. So enable platform support to cpupower for Hygon Dhyana Family 0x18 processors by checking vendor ID & family and vendor string by using the code path of AMD family 0x17. Signed-off-by: Pu

[PATCH v5 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-29 Thread Pu Wen
with AMD. Also Hygon PCI Device ID DF_F0/DF_F6(0x1460/0x1466) of Host bridges is needed for edac driver. Signed-off-by: Pu Wen --- drivers/edac/amd64_edac.c | 20 +++- drivers/edac/amd64_edac.h | 4 drivers/edac/mce_amd.c| 4 +++- 3 files changed, 26 insertions(+), 2

[PATCH v5 08/16] x86/apic: add modern APIC support for Hygon

2018-08-29 Thread Pu Wen
Hygon processors use modern APIC, so just return in modern_apic() and sync_Arb_IDs(). And should break in switch case in detect_init_API(). When running on 32 bit mode, should set bigsmp if there are more than 8 cores. Signed-off-by: Pu Wen --- arch/x86/kernel/apic/apic.c | 19

[PATCH v2 09/17] x86/bugs: add lfence mitigation to spectre v2 and no meltdown for Hygon

2018-07-23 Thread Pu Wen
vulnerability as AMD's, so add exception in array cpu_no_meltdown[] for it. Signed-off-by: Pu Wen --- arch/x86/include/asm/nospec-branch.h | 4 ++-- arch/x86/kernel/cpu/bugs.c | 28 +++- arch/x86/kernel/cpu/common.c | 1 + 3 files changed, 18 insertions(+), 15

Re: [PATCH v5 01/16] x86/cpu: create Dhyana init file and register new cpu_dev to system

2018-08-30 Thread Pu Wen
On 2018-08-30 03:35, Andi Kleen wrote: Pu Wen writes: Add x86 architecture support for new processor Hygon Dhyana Family 18h. Rework to create a separated file(arch/x86/kernel/cpu/hygon.c) from the AMD init one(arch/x86/kernel/cpu/amd.c) to initialize Dhyana CPU. Standard approach would

Re: [PATCH v5 01/16] x86/cpu: create Dhyana init file and register new cpu_dev to system

2018-08-30 Thread Pu Wen
On 2018-08-30 20:35, Borislav Petkov wrote: +HYGON PROCESSOR SUPPORT +M: Pu Wen +L: linux-a...@vger.kernel.org This is probably the wrong ML. You either have your own or use lkml, I'd say. That's all right, I'll use linux-kernel@vger.kernel.org instead. +++ b/arch/x86/kernel/cpu

Re: [PATCH v5 08/16] x86/apic: add modern APIC support for Hygon

2018-09-05 Thread Pu Wen
On 2018/9/5 2:33, Borislav Petkov wrote: On Wed, Aug 29, 2018 at 08:44:30PM +0800, Pu Wen wrote: ... + if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD && +boot_cpu_data.x86 >= 0xf) || +boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) return

Re: [PATCH v5 10/16] x86/mce: enable Hygon support to MCE infrastructure

2018-09-05 Thread Pu Wen
On 2018/9/5 21:15, Borislav Petkov wrote: On Wed, Sep 05, 2018 at 08:59:24PM +0800, Pu Wen wrote: If CONFIG_X86_MCE_AMD=n, mce_hygon_feature_init will call the other one mce_amd_feature_init which is a null function and located in the else branch of "#ifdef CONFIG_X86_MCE_AMD". The c

Re: [PATCH v5 05/16] x86/pmu: enable Hygon support to PMU infrastructure

2018-09-04 Thread Pu Wen
On 2018/9/4 18:48, Borislav Petkov wrote: On Wed, Aug 29, 2018 at 08:43:54PM +0800, Pu Wen wrote: Hygon PMU arch is similar to AMD Family 17h. To support Hygon PMU, the initialization flow for it just call amd_pmu_init() and change PMU name That sentence reads funny. Will rewrite

Re: [PATCH v5 07/16] x86/pci: add Hygon PCI vendor and northbridge support

2018-09-04 Thread Pu Wen
PCI_DEVICE_ID_HYGON_18H_DF_F30x1463 +#define PCI_DEVICE_ID_HYGON_18H_DF_F40x1464 Why are you adding those if you can use the AMD f17h ones? They're the same. I add these definitions to indicate that there are Hygon PCI device IDs. You are right, I can just use the AMD f17h ones here. -- Regards, Pu Wen

Re: [PATCH v5 10/16] x86/mce: enable Hygon support to MCE infrastructure

2018-09-06 Thread Pu Wen
On 2018/9/6 16:39, Borislav Petkov wrote: > On Thu, Sep 06, 2018 at 11:52:42AM +0800, Pu Wen wrote: >> In most of the normal use cases MCE is necessary. Rarely in some cases >> such as for test purpose MCE may be unselected. > > Test with MCE disabled? Please

Re: [PATCH v5 10/16] x86/mce: enable Hygon support to MCE infrastructure

2018-09-06 Thread Pu Wen
for CPU_SUP_HYGON to solve the dependency issues in kernel. -- Regards, Pu Wen

[PATCH v6 02/16] x86/cpu: Get cache info and setup cache cpumap for Hygon Dhyana

2018-09-10 Thread Pu Wen
to it in find_num_cache_leaves(). Also add cacheinfo_hygon_init_llc_id() and init_hygon_cacheinfo() functions to initialize Dhyana cache info. Setup cache cpumap in the same way as AMD does. Reviewed-by: Borislav Petkov Signed-off-by: Pu Wen --- arch/x86/include/asm/cacheinfo.h | 1 + arch/x86/kernel

[PATCH v6 01/16] x86/cpu: Create Hygon Dhyana architecture support file

2018-09-10 Thread Pu Wen
(CPU_SUP_HYGON) in kernel config setup. And select CPU_SUP_AMD to solve the dependency issues in kernel. Signed-off-by: Pu Wen --- MAINTAINERS | 6 + arch/x86/Kconfig.cpu | 14 ++ arch/x86/include/asm/processor.h | 3 +- arch/x86/kernel/cpu/Makefile | 1

[PATCH v6 00/16] Add support for Hygon Dhyana Family 18h processor

2018-09-10 Thread Pu Wen
t. - Split the patchset to small series of patches. - Rework patch descriptions. - Create a separated arch/x86/kernel/cpu/hygon.c for Dhyana CPU initialization to reduce long-term maintenance effort. Pu Wen (16): x86/cpu: Create Hygon Dhyana architecture support file x86/cpu: Get cache in

[PATCH v6 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-10 Thread Pu Wen
The Hygon Dhyana CPU have a special magic MSR way to force WB for memory >4GB, and support TOP_MEM2. Therefore, it is necessary to add Hygon Dhyana support in amd_special_default_mtrr(). The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/m

[PATCH v6 06/16] x86/alternative: Init ideal_nops for Hygon Dhyana

2018-09-10 Thread Pu Wen
The ideal_nops for Hygon Dhyana CPU should be p6_nops. Reviewed-by: Borislav Petkov Signed-off-by: Pu Wen --- arch/x86/kernel/alternative.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index b9d5e7c..184e9a0 100644

[PATCH v6 07/16] x86/pci: Add Hygon Dhyana support to PCI and north bridge

2018-09-10 Thread Pu Wen
Signed-off-by: Pu Wen --- arch/x86/kernel/amd_nb.c | 47 +-- arch/x86/pci/amd_bus.c | 6 -- include/linux/pci_ids.h | 2 ++ 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index

[PATCH v6 08/16] x86/apic: Add Hygon Dhyana support to APIC

2018-09-10 Thread Pu Wen
Add Hygon Dhyana support to the APIC subsystem as it use modern APIC. When running on 32 bit mode, bigsmp should be enabled if there are more than 8 cores online. Signed-off-by: Pu Wen --- arch/x86/kernel/apic/apic.c | 13 +++-- arch/x86/kernel/apic/probe_32.c | 1 + 2 files

[PATCH v6 04/16] x86/smpboot: SMP init nodelay and not flush caches before sleep

2018-09-10 Thread Pu Wen
The Hygon Dhyana CPU use no delay in smp_quirk_init_udelay(), and return in mwait_play_dead() as AMD does. Reviewed-by: Borislav Petkov Signed-off-by: Pu Wen --- arch/x86/kernel/smpboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch

[PATCH v6 05/16] perf/x86: Add Hygon Dhyana support to PMU infrastructure

2018-09-10 Thread Pu Wen
registers and event selection registers), so add Hygon Dhyana support to get bit offset in the similar way as AMD does. Signed-off-by: Pu Wen --- arch/x86/events/amd/core.c | 4 arch/x86/events/amd/uncore.c | 20 +--- arch/x86/events/core.c

[PATCH v6 10/16] x86/mce: Add Hygon Dhyana support to MCE infrastructure

2018-09-10 Thread Pu Wen
The machine check architecture for Hygon Dhyana CPU is similar to the AMD family 17h one. To make MCE working on Hygon platforms, add vendor checking for Hygon Dhyana to share the code path of AMD family 17h. Signed-off-by: Pu Wen --- arch/x86/include/asm/mce.h| 2 ++ arch/x86

[PATCH v6 09/16] x86/bugs: Add mitigation to spectre and no meltdown for Hygon Dhyana

2018-09-10 Thread Pu Wen
The Hygon Dhyana CPU has the same speculative execution as AMD family 17h, so share AMD spectre mitigation code for Hygon Dhyana. Also Hygon Dhyana is not affected by meltdown vulnerability as AMD, so add the exception for Hygon Dhyana. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/bugs.c

[PATCH v6 11/16] x86/kvm: Add Hygon Dhyana support to KVM infrastructure

2018-09-10 Thread Pu Wen
The Hygon Dhyana CPU has the SVM feature as AMD family 17h does. So enable the KVM infrastructure support to it. Reviewed-by: Borislav Petkov Signed-off-by: Pu Wen --- arch/x86/include/asm/kvm_emulate.h | 4 arch/x86/include/asm/virtext.h | 5 +++-- arch/x86/kvm/emulate.c

[PATCH v6 13/16] ACPI, x86: Add Hygon Dhyana support

2018-09-10 Thread Pu Wen
The Hygon Dhyana CPU has NONSTOP TSC feature, so enable the ACPI driver support to it. Acked-by: Rafael J. Wysocki Signed-off-by: Pu Wen --- drivers/acpi/acpi_pad.c | 1 + drivers/acpi/processor_idle.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/acpi/acpi_pad.c b

[PATCH v6 16/16] cpupower, x86: Add Hygon Dhyana support

2018-09-10 Thread Pu Wen
Tool cpupower is useful to get CPU frequency information and monitor power stats on Hygon Dhyana platforms. So add Hygon Dhyana support to it by checking vendor and family to share the code path of AMD family 17h. Signed-off-by: Pu Wen --- tools/power/cpupower/utils/cpufreq-info.c

[PATCH v6 15/16] EDAC, amd64: Add Hygon Dhyana support

2018-09-10 Thread Pu Wen
To make AMD64 EDAC and MCE drivers working on Hygon platforms, add support for Hygon Dhyana CPU by using the code path of AMD family 17h. Signed-off-by: Pu Wen --- drivers/edac/amd64_edac.c | 8 +++- drivers/edac/mce_amd.c| 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff

[PATCH v6 14/16] cpufreq, x86: Add Hygon Dhyana support

2018-09-10 Thread Pu Wen
As the Hygon Dhyana CPU support ACPI P-States feature, and there is SMBus device(PCI device ID 0x790b) on Hygon platform, so add Hygon Dhyana support to the cpufreq driver by using the code path of AMD family 17h. Acked-by: Rafael J. Wysocki Signed-off-by: Pu Wen --- drivers/cpufreq/acpi

Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-09-04 Thread Pu Wen
fixed. So the workaround is not needed for Hygon Dhyana platforms any more, and the vendor checking for Hygon will be removed in next version of patch. Thanks, Pu Wen

Re: [PATCH v5 09/16] x86/bugs: add lfence mitigation to spectre v2 and no meltdown for Hygon

2018-09-05 Thread Pu Wen
on of the vendor tests. The other stuff you can drop. That's reasonable. To avoid the confusion, will only leave the vendor testing for Hygon and drop the other changes, which also minimize the code modification. -- Regards, Pu Wen

Re: [PATCH v5 10/16] x86/mce: enable Hygon support to MCE infrastructure

2018-09-05 Thread Pu Wen
-- Regards, Pu Wen

Re: [PATCH v5 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-09-05 Thread Pu Wen
efine PCI_DEVICE_ID_HYGON_18H_DF_F0 0x1460 >> +#define PCI_DEVICE_ID_HYGON_18H_DF_F6 0x1466 > > As in the previous patch - use the AMD defines. Will remove them in next version of patches. -- Regards, Pu Wen

Re: [PATCH v6 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-11 Thread Pu Wen
On 2018/9/11 2:06, Borislav Petkov wrote: On Mon, Sep 10, 2018 at 09:16:03PM +0800, Pu Wen wrote: The Hygon Dhyana CPU have a special magic MSR way to force WB for From the last review round: Also, it is "The ... CPU has a special..." Please take your time and incorporate *a

Re: [PATCH v6 05/16] perf/x86: Add Hygon Dhyana support to PMU infrastructure

2018-09-11 Thread Pu Wen
rds are used with the tendency to explain what the patch do, actually they are not needed and will be removed. -- Regards, Pu Wen

Re: [PATCH v6 01/16] x86/cpu: Create Hygon Dhyana architecture support file

2018-09-11 Thread Pu Wen
vides that functionality." Thanks for the detailed correction. Will improve the description and remove unneeded sentences in next version of patch. -- Regards, Pu Wen

Re: [PATCH v6 09/16] x86/bugs: Add mitigation to spectre and no meltdown for Hygon Dhyana

2018-09-11 Thread Pu Wen
MD. Switching to AUTO select\n"); + pr_err("retpoline,amd selected but CPU is not AMD or Hygon. Switching to AUTO select\n"); Didn't we say, no user-visible changes pls? Sorry for the incomplete modification. Will revert the pr_err string. -- Regards, Pu Wen

Re: [PATCH v6 08/16] x86/apic: Add Hygon Dhyana support to APIC

2018-09-11 Thread Pu Wen
Dhyana CPU always uses modern APIC, so the function modern_apic will always return true for Hygon Dhyana. I will remove this change in next version of patch. With it removed: Reviewed-by: Borislav Petkov -- Regards, Pu Wen

[PATCH] x86/cpu: Avoid endless loop to get the number of cache leaves

2018-11-05 Thread Pu Wen
into an endless loop. To fix this problem, add a new enum type CTYPE_MAX to limit the maximum cpuid accessing. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/cacheinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu

[PATCH] tools/perf: Add Hygon Dhyana support

2018-11-05 Thread Pu Wen
The tool perf is useful for the performance analysis on the Hygon Dhyana platform. But right now there is no Hygon support for it to analyze the KVM guest os data. So add Hygon Dhyana support to it by checking vendor string to share the code path of AMD. Signed-off-by: Pu Wen --- tools/perf

[RFC PATCH RESEND] tools/perf: Add Hygon Dhyana support

2018-11-11 Thread Pu Wen
The tool perf is useful for the performance analysis on the Hygon Dhyana platform. But right now there is no Hygon support for it to analyze the KVM guest os data. So add Hygon Dhyana support to it by checking vendor string to share the code path of AMD. Signed-off-by: Pu Wen --- tools/perf

[RESEND PATCH v8 16/16] cpupower: Add Hygon Dhyana support

2018-10-03 Thread Pu Wen
Tool cpupower is useful to get CPU frequency information and monitor power stats on Hygon Dhyana platform. So add Hygon Dhyana support to it by checking vendor and family to share the code path of AMD family 17h. Signed-off-by: Pu Wen Acked-by: Shuah Khan (Samsung OSG) --- tools/power/cpupower

Re: [PATCH v5 02/16] x86/cache: get cache size/leaves and setup cache cpumap for Dhyana

2018-09-03 Thread Pu Wen
support "With this bit, the kernel..." Dhyana also find num_cache_leaves via CPUID leaf 0x801d, so "... also discovers num_cache_leaves ..." Thanks for the correction. Regards, Pu Wen With that: Reviewed-by: Borislav Petkov

Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-09-03 Thread Pu Wen
p; + !(boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) or: + if ((boot_cpu_data.x86_vendor != X86_VENDOR_AMD || +boot_cpu_data.x86 < 0x0f) && + (boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)) Which statement is better? Thanks, Pu Wen

Re: [LKP] [x86/pci] 7ffb31888c: PANIC:early_exception

2018-09-19 Thread Pu Wen
gt; this email I cannot reproduce this panic on Hygon Dhyana platform. I tired lkp-tests both in Ubuntu 16.04 (with gcc-5) and Ubuntu 18.04 (with gcc-7). What kind of host do you use to run the qemu? A Intel one or AMD one? Thanks, Pu Wen

Re: [PATCH v6 07/16] x86/pci: Add Hygon Dhyana support to PCI and north bridge

2018-09-20 Thread Pu Wen
ds; The PANIC will be eliminated. The PANIC will also be eliminated by adding AMD vendor checking in amd_gart_present: + if(boot_cpu_data.x86_vendor != X86_VENDOR_AMD) + return false; To prevent the function return true on non AMD platform. Thanks, Pu Wen

  1   2   3   4   >