[Xen-devel] [PATCH 09/11] driver/cpufreq: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
This patch enables the cpufreq driver support to Hygon Family 18h CPU: - It recognize Hygon's boost state in boost_state(), boost_set_msr(), extract_msr() functions. - It also add SMBUS support for Hygon Family 18h in amd_freq_sensitivity_init(). Signed-off-by: Pu Wen --- drivers/cpufreq

[Xen-devel] [PATCH 08/11] driver/acpi: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
This patch enables the ACPI driver support to Hygon Family 18h CPU: - Add Hygon support in power_saving_mwait_init(). - Add Hygon support in lapic_timer_state_broadcast(). Signed-off-by: Pu Wen --- drivers/acpi/acpi_pad.c | 1 + drivers/acpi/processor_idle.c | 1 + 2 files changed, 2

[Xen-devel] [PATCH 05/11] x86/mce: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
This patch enables the X86 MCE infrastructure support to Hygon Family 18h CPU: - It enable Hygon check in __mcheck_cpu_init_early(), print_mce() and mce_usable_address() etc. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mcheck/mce-severity.c | 3 ++- arch/x86/kernel/cpu/mcheck/mce.c

[Xen-devel] [PATCH 06/11] x86/kvm: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
This patch enables the x86 KVM support to Hygon Family 18h CPU: - Add Hygon CPU VENDOR ID macro for KVM. - Add SVM support in cpu_has_svm(). - Add support in em_syscall_is_enabled(). Signed-off-by: Pu Wen --- arch/x86/include/asm/kvm_emulate.h | 4 arch/x86/include/asm/virtext.h | 5

[Xen-devel] [PATCH 07/11] x86/xen: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
This patch enables the Xen Hypervisor support to Hygon Family 18h CPU: - Add Hygon support in Xen PMU arch init codes. - Add Hygon support in PMU MSR read/write codes. - Add Hygon support in read PMC codes. Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 12 1 file changed, 8

[Xen-devel] [PATCH 11/11] tools/cpupower: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
xfreq_mode(). Signed-off-by: Pu Wen --- tools/power/cpupower/utils/cpufreq-info.c | 6 -- tools/power/cpupower/utils/helpers/cpuid.c | 6 -- tools/power/cpupower/utils/helpers/helpers.h| 2 +- tools/power/cpupower/utils/idle_monitor/mperf_monitor.c | 3 ++

[Xen-devel] [PATCH 10/11] driver/edac: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
in determine_memory_type(), per_family_init() and scrub rate codes. - Add X86_VENDOR_HYGON in amd64_cpuids[]. 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

[Xen-devel] [PATCH 01/11] x86/cpu: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
_play_dead(). - MTRR for X86 - Add MTRR enablement for Hygon processor. - NMI watchdog for X86 - Add Hygon support in nmi_perfctr_msr_to_bit() and nmi_evntsel_msr_to_bit(). Signed-off-by: Pu Wen --- arch/x86/include/asm/processor.h | 3 ++- arch/x86/kernel/alternative.c | 4

[Xen-devel] [PATCH 03/11] x86/cpu/bug: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
to mitigate Spectre V2 Retpoline vulnerability. - Add Hygon's processor with no meltdown support in cpu_no_meltdown array. Signed-off-by: Pu Wen --- arch/x86/include/asm/nospec-branch.h | 4 ++-- arch/x86/kernel/cpu/bugs.c | 30 -- arch/x86/kernel/cpu/common.c

[Xen-devel] [PATCH 02/11] x86/pci: Add support for Hygon's Dhyana Family 18h processor

2018-06-09 Thread Pu Wen
in pirq_routers arrays. - Add Hygon support in amd_postcore_init(), early_root_info_init(). - APIC for X86 - Add Hygon support in modern_apic() and sync_Arb_IDs() as Hygon processors are modern processors. - Add Hygon support in detect_init_API(). Signed-off-by: Pu Wen --- arch/x86/kernel

[Xen-devel] [PATCH v3 13/17] x86/xen: enable Hygon support to Xen

2018-08-11 Thread Pu Wen
To make Xen work correctly on Hygon platforms, reuse AMD's Xen support code path and add vendor check for Hygon along with AMD. Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen

[Xen-devel] [PATCH v3 00/17] Add support for Hygon Dhyana Family 18h processor

2018-08-11 Thread Pu Wen
gon.c for Dhyana CPU initialization to reduce long-term maintenance effort. Pu Wen (17): x86/cpu: create Dhyana init file and register new cpu_dev to system x86/cache: get cache size/leaves and setup cache cpumap for Dhyana x86/mtrr: get MTRR number and support TOP_MEM2 x86/smpboot:

Re: [Xen-devel] [PATCH v3 13/17] x86/xen: enable Hygon support to Xen

2018-08-16 Thread Pu Wen
On 2018/8/12 21:26, Boris Ostrovsky wrote: On 08/12/2018 04:55 AM, Juergen Gross wrote: On 11/08/18 16:34, Boris Ostrovsky wrote: On 08/11/2018 09:29 AM, Pu Wen wrote: bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err) { - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD

Re: [Xen-devel] [PATCH v3 13/17] x86/xen: enable Hygon support to Xen

2018-08-16 Thread Pu Wen
On 2018/8/11 22:34, Boris Ostrovsky wrote: On 08/11/2018 09:29 AM, Pu Wen wrote: To make Xen work correctly on Hygon platforms, reuse AMD's Xen support code path and add vendor check for Hygon along with AMD. Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 15 --- 1 file changed

[Xen-devel] [PATCH v4 00/16] Add support for Hygon Dhyana Family 18h processor

2018-08-19 Thread Pu Wen
s. - 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 Dhyana init file and register new cpu_dev to system x86/cache: get cache size/leaves and setup cache cpum

[Xen-devel] [PATCH v4 12/16] x86/xen: enable Hygon support to Xen

2018-08-19 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. Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen

[Xen-devel] [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

[Xen-devel] [PATCH v5 00/16] Add support for Hygon Dhyana Family 18h processor

2018-08-29 Thread Pu Wen
on to reduce long-term maintenance effort. Pu Wen (16): x86/cpu: create Dhyana init file and register new cpu_dev to system x86/cache: get cache size/leaves and setup cache cpumap for Dhyana x86/mtrr: get MTRR number and support TOP_MEM2 x86/smpboot: smp init nodelay and no flush caches before s

[Xen-devel] [PATCH v2 15/17] driver/cpufreq: enable Hygon support to cpufreq driver

2018-07-23 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 | 11

[Xen-devel] [PATCH v2 03/17] x86/mtrr: get MTRR number and support TOP_MEM2

2018-07-23 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 | 3 ++- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --

[Xen-devel] [PATCH v2 12/17] x86/kvm: enable Hygon support to KVM infrastructure

2018-07-23 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

[Xen-devel] [PATCH v2 10/17] x86/events: enable Hygon support to PMU infrastructure

2018-07-23 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-

[Xen-devel] [PATCH v2 06/17] x86/nops: init ideal_nops for Hygon

2018-07-23 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

[Xen-devel] [PATCH v2 13/17] x86/xen: enable Hygon support to Xen

2018-07-23 Thread Pu Wen
To make Xen work correctly on Hygon platforms, reuse AMD's Xen support code path and add vendor check for Hygon along with AMD. Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c

[Xen-devel] [PATCH v2 11/17] x86/mce: enable Hygon support to MCE infrastructure

2018-07-23 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

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

2018-07-23 Thread Pu Wen
To make AMD64 MCE and EDAC drivers working on Hygon platforms, add Hygon vendor check for them. Also Hygon PCI Device ID DF_F0/DF_F6(0x1460/0x1466) of Host bridge is needed for these drivers. And support Dhyana processors by using AMD 0x17 codes. Signed-off-by: Pu Wen --- drivers/edac

[Xen-devel] [PATCH v2 07/17] x86/pci: add Hygon PCI vendor and northbridge support

2018-07-23 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-

[Xen-devel] [PATCH v2 08/17] x86/apic: add modern APIC support for Hygon

2018-07-23 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(). Signed-off-by: Pu Wen --- arch/x86/kernel/apic/apic.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel

[Xen-devel] [PATCH v2 04/17] x86/smpboot: smp init nodelay and no flush caches before sleep

2018-07-23 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 db9656e..26cb2c9

[Xen-devel] [PATCH v2 00/17] Add support for Hygon Dhyana Family 18h processor

2018-07-23 Thread Pu Wen
. v1->v2: - Rebased on 4.18-rc6 and tested against it. - 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 (17): x86/cpu: create Dhy

[Xen-devel] [PATCH v2 05/17] x86/perfctr: return perf counter and event selection bit offset

2018-07-23 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 | 8 1 file

[Xen-devel] [PATCH v2 14/17] driver/acpi: enable Hygon support to ACPI driver

2018-07-23 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

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

2018-07-23 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/hygon.c

[Xen-devel] [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

[Xen-devel] [PATCH v2 02/17] x86/cache: get Dhyana cache size/leaves and setup cache cpumap

2018-07-23 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

[Xen-devel] [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

[Xen-devel] [PATCH v6 12/16] x86/xen: Add Hygon Dhyana support to Xen

2018-09-10 Thread Pu Wen
). In this version 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

[Xen-devel] [PATCH v8 12/16] x86/xen: Add Hygon Dhyana support to Xen

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

[Xen-devel] [PATCH v8 00/16] Add support for Hygon Dhyana Family 18h processor

2018-09-23 Thread Pu Wen
r Dhyana CPU initialization to reduce long-term maintenance effort. Pu Wen (16): x86/cpu: Create Hygon Dhyana architecture support file x86/cpu: Get cache info and setup cache cpumap for Hygon Dhyana x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number x86/smpboot: SMP init no delay and not f

Re: [Xen-devel] [PATCH 5/6] x86/AMD: Fix handling of FPU pointer on Zen hardware

2018-12-29 Thread Pu Wen
/* clear exceptions */ > "ffree %%st(7)\n\t" /* clear stack tag */ > "fildl %0" /* load to clear state */ It seems that the functions fpu_fxrstor and fpu_fxsave have the same problem, even though they are not cal

Re: [Xen-devel] [PATCH 13/15] x86/xstate: Add Hygon Dhyana support

2018-12-29 Thread Pu Wen
On 2018/12/28 6:41, Andrew Cooper wrote: > On 20/12/2018 13:15, Pu Wen wrote: >> The Hygon Dhyana CPU don't save/restore FDP/FIP/FOP unless an exception >> is pending. So add support for it in the function xrstor. > > Really? > > Zen was the first AMD process

Re: [Xen-devel] [PATCH 07/15] x86/acpi: Add Hygon Dhyana support

2019-01-15 Thread Pu Wen
gt; At the very least here I think you want to change to switch(). I think there is no need to change if() to switch(), because if() looks concise enough here. Also the change will generate a bigger patch. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 03/15] x86/cpu/vpmu: Add Hygon Dhyana support for vPMU

2019-01-15 Thread Pu Wen
es, if Hygon directly followed AMD's cases, the insertions are placed above the respective AMD ones. If Hygon used its own cases, such as in calc_ler_msr, the new cases are placed below the AMD ones. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 04/15] x86/cpu/mce: Add Hygon Dhyana support to the MCA infrastructure

2019-01-15 Thread Pu Wen
_flags quirkflag = 0; + +if (ci->x86_vendor != X86_VENDOR_HYGON) +quirkflag = mcequirk_lookup_amd_quirkdata(ci); Is the modification OK? Also add mcequirk_lookup_hygon_quirkdata() is another solution, even though it will do nothing at the moment. -- Regards, Pu Wen

Re: [Xen-devel] [PATCH 03/15] x86/cpu/vpmu: Add Hygon Dhyana support for vPMU

2019-01-15 Thread Pu Wen
- please don't, insert the new ones after AMD's. OK. Will insert the new ones after AMD's in next version patch set. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH 10/15] x86/domain: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
Add Hygon Dhyana support to handle HyperTransport range. Also loading a nul selector does not clear bases and limits on Hygon CPUs, so add Hygon Dhyana support to the function preload_segment. Signed-off-by: Pu Wen --- xen/arch/x86/dom0_build.c | 3 ++- xen/arch/x86/domain.c | 9

[Xen-devel] [PATCH 09/15] x86/pv: Add Hygon Dhyana support to emulate MSRs access

2018-12-20 Thread Pu Wen
to write the load-store configuration(LS_CFG) MSR, so add new case in write_msr to handle this situation. Signed-off-by: Pu Wen --- xen/arch/x86/pv/emul-priv-op.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/pv/emul-priv-op.c b

[Xen-devel] [PATCH 13/15] x86/xstate: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
The Hygon Dhyana CPU don't save/restore FDP/FIP/FOP unless an exception is pending. So add support for it in the function xrstor. Signed-off-by: Pu Wen --- xen/arch/x86/xstate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86

[Xen-devel] [PATCH 14/15] x86/cpuid: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
The Hygon Dhyana family 18h processor shares the same cpuid leaves as the AMD family 17h one. So add Hygon Dhyana support to caculate the cpuid policies as the AMD CPU does. Signed-off-by: Pu Wen --- xen/arch/x86/cpuid.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff

[Xen-devel] [PATCH 15/15] tools/libxc: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
Add Hygon Dhyana support to caculate the cpuid policies for creating PV or HVM guest by using the code path of AMD. Signed-off-by: Pu Wen --- tools/libxc/xc_cpuid_x86.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc

[Xen-devel] [PATCH 12/15] x86/traps: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
The Hygon Dhyana processor has the methold to get the last exception source IP from MSR_01DD. So add support for it if the boot param ler is true. Signed-off-by: Pu Wen --- xen/arch/x86/traps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c

[Xen-devel] [PATCH 11/15] x86/domctl: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
Add Hygon Dhyana support to update cpuid info for creating PV guest. Signed-off-by: Pu Wen --- xen/arch/x86/domctl.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index aa8ad19..a64c724 100644 --- a/xen/arch/x86

[Xen-devel] [PATCH 01/15] x86/cpu: Create Hygon Dhyana architecture support file

2018-12-20 Thread Pu Wen
X86_VENDOR_HYGON for system recognition. Signed-off-by: Pu Wen --- xen/arch/x86/cpu/Makefile | 1 + xen/arch/x86/cpu/common.c | 1 + xen/arch/x86/cpu/cpu.h| 1 + xen/arch/x86/cpu/hygon.c | 296 ++ xen/include/asm-x86/x86

[Xen-devel] [PATCH 02/15] x86/cpu/mtrr: Add Hygon Dhyana support to get TOP_MEM2

2018-12-20 Thread Pu Wen
The Hygon Dhyana CPU supports the MSR way to get TOP_MEM2. So add Hygon Dhyana support to print the value of TOP_MEM2. Signed-off-by: Pu Wen --- xen/arch/x86/cpu/mtrr/generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch

[Xen-devel] [PATCH 03/15] x86/cpu/vpmu: Add Hygon Dhyana support for vPMU

2018-12-20 Thread Pu Wen
The PMU architecture for the Hygon Dhyana CPU is similar to the AMD family 17h one. To support it, add Hygon Dhyana support in the similar way as AMD does. Signed-off-by: Pu Wen --- xen/arch/x86/cpu/vpmu.c | 2 ++ xen/arch/x86/cpu/vpmu_amd.c | 2 ++ 2 files changed, 4 insertions(+) diff

[Xen-devel] [PATCH 05/15] x86/spec_ctrl: Add Hygon Dhyana to the respective mitigation machinery

2018-12-20 Thread Pu Wen
The Hygon Dhyana CPU has the same speculative execution as AMD family 17h, so share AMD Retpoline and PTI mitigation code with Hygon Dhyana. Signed-off-by: Pu Wen --- xen/arch/x86/spec_ctrl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/spec_ctrl.c b

[Xen-devel] [PATCH 08/15] x86/iommu: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
The IOMMU architecture for the Hygon Dhyana CPU is similar to the AMD family 17h one. So add Hygon Dhyana support to it by sharing the code path of AMD. Signed-off-by: Pu Wen --- xen/include/asm-x86/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include/asm-x86/iommu.h b/xen

[Xen-devel] [PATCH 00/15] Add support for Hygon Dhyana Family 18h processor

2018-12-20 Thread Pu Wen
endor type (X86_VENDOR_HYGON, with value of 5), and share most of the codes with AMD family 17h. This patch series have been applied and tested successfully on Hygon Dhyana processor. Also tested on AMD EPYC (family 17h) processor, it works fine and makes no harm to the existing codes. Pu Wen (15):

[Xen-devel] [PATCH 06/15] x86/apic: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
Add Hygon Dhyana support to use modern APIC. Signed-off-by: Pu Wen --- xen/arch/x86/apic.c | 5 + 1 file changed, 5 insertions(+) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 2a24326..004d685 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -92,6 +92,11

[Xen-devel] [PATCH 07/15] x86/acpi: Add Hygon Dhyana support

2018-12-20 Thread Pu Wen
Add Hygon Dhyana support to the acpi cpufreq subsystem by using the code path of AMD. Signed-off-by: Pu Wen --- xen/arch/x86/acpi/cpu_idle.c | 3 ++- xen/arch/x86/acpi/cpufreq/cpufreq.c | 6 -- xen/arch/x86/acpi/cpufreq/powernow.c | 3 ++- 3 files changed, 8 insertions(+), 4

[Xen-devel] [PATCH 04/15] x86/cpu/mce: Add Hygon Dhyana support to the MCA infrastructure

2018-12-20 Thread Pu Wen
The machine check architecture for Hygon Dhyana CPU is similar to the AMD family 17h one. Add vendor checking for Hygon Dhyana to share the code path of AMD family 17h. Signed-off-by: Pu Wen --- xen/arch/x86/cpu/common.c | 3 ++- xen/arch/x86/cpu/mcheck/amd_nonfatal.c | 5

Re: [Xen-devel] [PATCH 03/15] x86/cpu/vpmu: Add Hygon Dhyana support for vPMU

2018-12-21 Thread Pu Wen
s here in Dhyana cases. Since both of Zen and Dhyana support C001_020X MSRs. If use the C001_020X is preferred, we will try to modify the related codes and create a patch. Also the Linux Xen PMU driver may need to be updated to use these MSRs. -- Regards, Pu Wen ___

Re: [Xen-devel] [PATCH 01/15] x86/cpu: Create Hygon Dhyana architecture support file

2018-12-26 Thread Pu Wen
al old architectures, so I'm afraid that there are sufficient motivations to keep a clear new processor init flow. 2) Beneficial for the future maintaining. AMD and Hygon may maintain their respective architecture related codes with no interaction with each other. For these reasons, we choose to keep the architecture initialization codes in hygon.c. Thx. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 03/15] x86/cpu/vpmu: Add Hygon Dhyana support for vPMU

2018-12-21 Thread Pu Wen
On 2018/12/21 21:34, Boris Ostrovsky wrote: > On 12/21/18 5:02 AM, Pu Wen wrote: >> On 2018/12/20 22:25, Boris Ostrovsky wrote: >> ... >>>> diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c >>>> index 5efc39b..e9f0a5c 100644 >>&g

Re: [Xen-devel] [PATCH 01/15] x86/cpu: Create Hygon Dhyana architecture support file

2018-12-28 Thread Pu Wen
On 2018/12/28 5:11, Andrew Cooper wrote: > On 26/12/2018 11:42, Pu Wen wrote: >> On 2018/12/21 18:20, Andrew Cooper wrote: >>> Is there anything which is actually unique to Hygon here? I ask, >>> because this looks like a lot of duplicate code, considering that the >

[Xen-devel] [PATCH v7 00/16] Add support for Hygon Dhyana Family 18h processor

2018-09-17 Thread Pu Wen
;v2: - Rebased on 4.18-rc6 and tested against it. - Split the patch set 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 Dhya

[Xen-devel] [PATCH v7 12/16] x86/xen: Add Hygon Dhyana support to Xen

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

Re: [Xen-devel] [PATCH v4 04/15] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-04-02 Thread Pu Wen
committing, and with them in place Acked-by: Jan Beulich Thanks. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v4 02/15] x86/cpu: Fix common cpuid faulting probing for AMD and Hygon

2019-04-02 Thread Pu Wen
directly return false in the function probe_cpuid_faulting() if !cpu_has_hypervisor. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v4 04/15] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-04-02 Thread Pu Wen
of int. > > Why in front of int? The old line of code here shows the canonical > ordering we use. Sorry, after int. :) By the way, how about the patch 01/15 of this series? If it's fine, could you please offer Acked-by tag for it? -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v4 02/15] x86/cpu: Fix common cpuid faulting probing for AMD and Hygon

2019-04-02 Thread Pu Wen
opped when reading the MSR_INTEL_PLATFORM_INFO instead of producing #GP(0). -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v4 01/15] x86/cpu: Create Hygon Dhyana architecture support file

2019-04-02 Thread Pu Wen
On 2019/4/2 20:16, Andrew Cooper wrote: > On 30/03/2019 10:42, Pu Wen wrote: >> +static const struct cpu_dev hygon_cpu_dev = { >> +.c_vendor = "Hygon", >> +.c_ident= { "HygonGenuine" }, >> +.c_early_init = early

Re: [Xen-devel] [PATCH v4 04/15] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-04-02 Thread Pu Wen
01/15 should rebase over http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=e72309ffbe7c4e507649c74749f130cda691131c . So I think I'll rework the patch first. Thx. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https:

Re: [Xen-devel] [PATCH v4 00/15] Add support for Hygon Dhyana Family 18h processor

2019-04-02 Thread Pu Wen
On 2019/4/2 23:14, Andrew Cooper wrote: On 30/03/2019 10:40, Pu Wen wrote: This patch series have been applied and tested successfully on Hygon Dhyana processor, also been tested on AMD EPYC (family 17h) processor. It works fine and makes no harm to the existing code. Reference: [1] https

Re: [Xen-devel] [PATCH v4 02/15] x86/cpu: Fix common cpuid faulting probing for AMD and Hygon

2019-04-02 Thread Pu Wen
ve. Andrew - you've tried to boot Xen on a Rome already. Iirc you said it crashed, but did it perhaps get to (and past) this point? -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v4 01/15] x86/cpu: Create Hygon Dhyana architecture support file

2019-04-03 Thread Pu Wen
l hypervisor. I think this is the most important reason. Previously I only considered to run Hygon Xen on bare hardware, which is the most important usage for a server processor. To match all the using cases I'll add the checking you mentioned above. -- Regards, Pu Wen _

Re: [Xen-devel] [PATCH v3 03/14] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-03-27 Thread Pu Wen
ero. I think it's a good idea to move the default case into the shared function, which would like: static int common_init(void) { unsigned int i; if (!num_counters) { printk(XENLOG_WARNING "VPMU: Unsupported CPU family %#x\n", current_cpu_data.x86);

Re: [Xen-devel] [PATCH v3 01/14] x86/cpu: Create Hygon Dhyana architecture support file

2019-03-27 Thread Pu Wen
return false; > > Right, plus perhaps said AMD addition, unless Andrew objects to it > for some reason. Then it would be like this: if ((boot_cpu_data.x86_vendor == X86_VENDOR_HYGON || boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && !cpu_has_hypervisor) return false; Andrew, any objections? -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v3 03/14] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-03-27 Thread Pu Wen
fine to me. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v3 01/14] x86/cpu: Create Hygon Dhyana architecture support file

2019-03-27 Thread Pu Wen
unsigned long long value; ... >> +if (cpu_has(c, X86_FEATURE_EFRO)) { >> +rdmsr(MSR_K7_HWCR, l, h); >> +l |= (1 << 27); /* Enable read-only APERF/MPERF bit */ >> +wrmsr(MSR_K7_HWCR, l, h); >> +} > > ... "value" and rdmsrl() / wrmsrl() here instead. Will use rdmsrl()/wrmsrl() instead. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH v3 14/14] tools/libxc: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
Add Hygon Dhyana support to caculate the cpuid policies for creating PV or HVM guest by using the code path of AMD. Signed-off-by: Pu Wen Acked-by: Wei Liu --- tools/libxc/xc_cpuid_x86.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/libxc

[Xen-devel] [PATCH v3 00/14] Add support for Hygon Dhyana Family 18h processor

2019-03-25 Thread Pu Wen
msr_safe instead. - Remove wrmsr_hygon and use wrmsrl instead. - Remove the unnecessary change to xstate. - Refine some codes and comments. - Add Acked-by from Jan Beulich for x86/traps. - Add Acked-by from Wei Liu for tools/libxc. Pu Wen (14): x86/cpu: Create Hygon Dhyana architecture su

[Xen-devel] [PATCH v3 10/14] x86/domain: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
Add Hygon Dhyana support to handle HyperTransport range. Also loading a nul selector does not clear bases and limits on Hygon CPUs, so add Hygon Dhyana support to the function preload_segment. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/dom0_build.c | 3 ++- xen/arch/x86

[Xen-devel] [PATCH v3 06/14] x86/apic: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
Add Hygon Dhyana support to use modern APIC. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/apic.c | 5 + 1 file changed, 5 insertions(+) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 2a24326..004d685 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c

[Xen-devel] [PATCH v3 08/14] x86/iommu: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
The IOMMU architecture for the Hygon Dhyana CPU is similar to the AMD family 17h one. So add Hygon Dhyana support to it by sharing the code path of AMD. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/include/asm-x86/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include

[Xen-devel] [PATCH v3 13/14] x86/cpuid: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
The Hygon Dhyana family 18h processor shares the same cpuid leaves as the AMD family 17h one. So add Hygon Dhyana support to caculate the cpuid policies as the AMD CPU does. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/cpuid.c | 10 +++--- 1 file changed, 7 insertions(+), 3

[Xen-devel] [PATCH v3 04/14] x86/cpu/mce: Add Hygon Dhyana support to the MCA infrastructure

2019-03-25 Thread Pu Wen
The machine check architecture for Hygon Dhyana CPU is similar to the AMD family 17h one. Add vendor checking for Hygon Dhyana to share the code path of AMD family 17h. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/cpu/common.c | 3 ++- xen/arch/x86/cpu/mcheck

[Xen-devel] [PATCH v3 09/14] x86/pv: Add Hygon Dhyana support to emulate MSRs access

2019-03-25 Thread Pu Wen
-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/pv/emul-priv-op.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index 3746e2a..c92f9dc 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch

[Xen-devel] [PATCH v3 11/14] x86/domctl: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
Add Hygon Dhyana support to update cpuid info for creating PV guest. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/domctl.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 9bf2d08..19b7bdd

[Xen-devel] [PATCH v3 02/14] x86/cpu/mtrr: Add Hygon Dhyana support to get TOP_MEM2

2019-03-25 Thread Pu Wen
The Hygon Dhyana CPU supports the MSR way to get TOP_MEM2. So add Hygon Dhyana support to print the value of TOP_MEM2. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/cpu/mtrr/generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr

[Xen-devel] [PATCH v3 12/14] x86/traps: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
The Hygon Dhyana processor has the methold to get the last exception source IP from MSR_01DD. So add support for it if the boot param ler is true. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/traps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86

[Xen-devel] [PATCH v3 05/14] x86/spec_ctrl: Add Hygon Dhyana to the respective mitigation machinery

2019-03-25 Thread Pu Wen
The Hygon Dhyana CPU has the same speculative execution as AMD family 17h, so share AMD Retpoline and PTI mitigation code with Hygon Dhyana. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/spec_ctrl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen

[Xen-devel] [PATCH v3 01/14] x86/cpu: Create Hygon Dhyana architecture support file

2019-03-25 Thread Pu Wen
directly return false in the function probe_cpuid_faulting(). Add a separate hygon_get_topology(), which calculate phys_proc_id from AcpiId[6](see reference [1]). Reference: [1] https://git.kernel.org/tip/e0ceeae708cebf22c990c3d703a4ca187dc837f5 Signed-off-by: Pu Wen --- xen/arch/x86/cpu

[Xen-devel] [PATCH v3 07/14] x86/acpi: Add Hygon Dhyana support

2019-03-25 Thread Pu Wen
Add Hygon Dhyana support to the acpi cpufreq and cpuidle subsystems by using the code path of AMD. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/acpi/cpu_idle.c | 3 ++- xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +--- xen/arch/x86/acpi/cpufreq/powernow.c | 3 ++- 3

[Xen-devel] [PATCH v3 03/14] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-03-25 Thread Pu Wen
the 15h definitions for them. Signed-off-by: Pu Wen --- xen/arch/x86/cpu/vpmu.c | 5 xen/arch/x86/cpu/vpmu_amd.c | 57 - xen/include/asm-x86/vpmu.h | 1 + 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/cpu/vpmu.c b

Re: [Xen-devel] [PATCH v4 00/15] Add support for Hygon Dhyana Family 18h processor

2019-04-03 Thread Pu Wen
On 2019/4/3 0:15, Jan Beulich wrote: > On 02.04.19 at 18:00, wrote: >> On 2019/4/2 23:14, Andrew Cooper wrote: >>> On 30/03/2019 10:40, Pu Wen wrote: >>>> This patch series have been applied and tested successfully on Hygon >>>> Dhyana processor

Re: [Xen-devel] [PATCH v4 01/15] x86/cpu: Create Hygon Dhyana architecture support file

2019-04-03 Thread Pu Wen
it should be retained. Okay, will retain the conditionals. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH v5 04/15] x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

2019-04-04 Thread Pu Wen
the 15h definitions for them. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/cpu/vpmu.c | 8 ++ xen/arch/x86/cpu/vpmu_amd.c | 61 - xen/include/asm-x86/vpmu.h | 1 + 3 files changed, 52 insertions(+), 18 deletions(-) diff --git

[Xen-devel] [PATCH v5 06/15] x86/spec_ctrl: Add Hygon Dhyana to the respective mitigation machinery

2019-04-04 Thread Pu Wen
The Hygon Dhyana CPU has the same speculative execution as AMD family 17h, so share AMD Retpoline and PTI mitigation code with Hygon Dhyana. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/spec_ctrl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen

[Xen-devel] [PATCH v5 05/15] x86/cpu/mce: Add Hygon Dhyana support to the MCA infrastructure

2019-04-04 Thread Pu Wen
The machine check architecture for Hygon Dhyana CPU is similar to the AMD family 17h one. Add vendor checking for Hygon Dhyana to share the code path of AMD family 17h. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/cpu/common.c | 3 ++- xen/arch/x86/cpu/mcheck

  1   2   >