]> Git Repo - J-linux.git/commitdiff
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Tue, 23 Oct 2018 15:16:40 +0000 (16:16 +0100)
committerLinus Torvalds <[email protected]>
Tue, 23 Oct 2018 15:16:40 +0000 (16:16 +0100)
Pull x86 cpu updates from Ingo Molnar:
 "The main changes in this cycle were:

   - Add support for the "Dhyana" x86 CPUs by Hygon: these are licensed
     based on the AMD Zen architecture, and are built and sold in China,
     for domestic datacenter use. The code is pretty close to AMD
     support, mostly with a few quirks and enumeration differences. (Pu
     Wen)

   - Enable CPUID support on Cyrix 6x86/6x86L processors"

* 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tools/cpupower: Add Hygon Dhyana support
  cpufreq: Add Hygon Dhyana support
  ACPI: Add Hygon Dhyana support
  x86/xen: Add Hygon Dhyana support to Xen
  x86/kvm: Add Hygon Dhyana support to KVM
  x86/mce: Add Hygon Dhyana support to the MCA infrastructure
  x86/bugs: Add Hygon Dhyana to the respective mitigation machinery
  x86/apic: Add Hygon Dhyana support
  x86/pci, x86/amd_nb: Add Hygon Dhyana support to PCI and northbridge
  x86/amd_nb: Check vendor in AMD-only functions
  x86/alternative: Init ideal_nops for Hygon Dhyana
  x86/events: Add Hygon Dhyana support to PMU infrastructure
  x86/smpboot: Do not use BSP INIT delay and MWAIT to idle on Dhyana
  x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number
  x86/cpu: Get cache info and setup cache cpumap for Hygon Dhyana
  x86/cpu: Create Hygon Dhyana architecture support file
  x86/CPU: Change query logic so CPUID is enabled before testing
  x86/CPU: Use correct macros for Cyrix calls

1  2 
MAINTAINERS
arch/x86/events/amd/uncore.c
arch/x86/events/core.c
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/xen/pmu.c
include/linux/pci_ids.h
tools/power/cpupower/utils/cpufreq-info.c
tools/power/cpupower/utils/helpers/amd.c

diff --combined MAINTAINERS
index 69dd1394718266d4052184b793205b455ca97eb7,c028e1d45c903704d407473e8d70998a26e0bf10..d47de7aa94439f04b93d8a0032a25c6a46f15d53
@@@ -324,6 -324,7 +324,6 @@@ F: Documentation/ABI/testing/sysfs-bus-
  F:    Documentation/ABI/testing/configfs-acpi
  F:    drivers/pci/*acpi*
  F:    drivers/pci/*/*acpi*
 -F:    drivers/pci/*/*/*acpi*
  F:    tools/power/acpi/
  
  ACPI APEI
@@@ -1250,7 -1251,7 +1250,7 @@@ N:      meso
  
  ARM/Annapurna Labs ALPINE ARCHITECTURE
  M:    Tsahee Zidenberg <[email protected]>
 -M:    Antoine Tenart <antoine.tenart@free-electrons.com>
 +M:    Antoine Tenart <antoine.tenart@bootlin.com>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-alpine/
@@@ -2195,7 -2196,6 +2195,7 @@@ F:      drivers/clk/uniphier
  F:    drivers/gpio/gpio-uniphier.c
  F:    drivers/i2c/busses/i2c-uniphier*
  F:    drivers/irqchip/irq-uniphier-aidet.c
 +F:    drivers/mmc/host/uniphier-sd.c
  F:    drivers/pinctrl/uniphier/
  F:    drivers/reset/reset-uniphier.c
  F:    drivers/tty/serial/8250/8250_uniphier.c
@@@ -2956,6 -2956,7 +2956,6 @@@ F:      include/linux/bcm963xx_tag.
  
  BROADCOM BNX2 GIGABIT ETHERNET DRIVER
  M:    Rasesh Mody <[email protected]>
 -M:    Harish Patil <[email protected]>
  M:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -2976,7 -2977,6 +2976,7 @@@ F:      drivers/scsi/bnx2i
  
  BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
  M:    Ariel Elior <[email protected]>
 +M:    Sudarsana Kalluru <[email protected]>
  M:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -3007,14 -3007,6 +3007,14 @@@ S:    Supporte
  F:    drivers/gpio/gpio-brcmstb.c
  F:    Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt
  
 +BROADCOM BRCMSTB I2C DRIVER
 +M:    Kamal Dasu <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/i2c/busses/i2c-brcmstb.c
 +F:    Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt
 +
  BROADCOM BRCMSTB USB2 and USB3 PHY DRIVER
  M:    Al Cooper <[email protected]>
  L:    [email protected]
@@@ -3122,15 -3114,6 +3122,15 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.txt
  F:    drivers/memory/brcmstb_dpfe.c
  
 +BROADCOM SPI DRIVER
 +M:    Kamal Dasu <[email protected]>
 +M:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.txt
 +F:    drivers/spi/spi-bcm-qspi.*
 +F:    drivers/spi/spi-brcmstb-qspi.c
 +F:    drivers/spi/spi-iproc-qspi.c
 +
  BROADCOM SYSTEMPORT ETHERNET DRIVER
  M:    Florian Fainelli <[email protected]>
  L:    [email protected]
@@@ -3691,12 -3674,6 +3691,12 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/media/coda.txt
  F:    drivers/media/platform/coda/
  
 +CODE OF CONDUCT
 +M:    Greg Kroah-Hartman <[email protected]>
 +S:    Supported
 +F:    Documentation/process/code-of-conduct.rst
 +F:    Documentation/process/code-of-conduct-interpretation.rst
 +
  COMMON CLK FRAMEWORK
  M:    Michael Turquette <[email protected]>
  M:    Stephen Boyd <[email protected]>
@@@ -5493,8 -5470,7 +5493,8 @@@ S:      Odd Fixe
  F:    drivers/net/ethernet/agere/
  
  ETHERNET BRIDGE
 -M:    Stephen Hemminger <[email protected]>
 +M:    Roopa Prabhu <[email protected]>
 +M:    Nikolay Aleksandrov <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected]
  W:    http://www.linuxfoundation.org/en/Net:Bridge
@@@ -6478,7 -6454,6 +6478,7 @@@ F:      Documentation/devicetree/bindings/hw
  F:    Documentation/hwmon/
  F:    drivers/hwmon/
  F:    include/linux/hwmon*.h
 +F:    include/trace/events/hwmon*.h
  
  HARDWARE RANDOM NUMBER GENERATOR CORE
  M:    Matt Mackall <[email protected]>
@@@ -6787,6 -6762,12 +6787,12 @@@ S:    Maintaine
  F:    mm/memory-failure.c
  F:    mm/hwpoison-inject.c
  
+ HYGON PROCESSOR SUPPORT
+ M:    Pu Wen <[email protected]>
+ L:    [email protected]
+ S:    Maintained
+ F:    arch/x86/kernel/cpu/hygon.c
  Hyper-V CORE AND DRIVERS
  M:    "K. Y. Srinivasan" <[email protected]>
  M:    Haiyang Zhang <[email protected]>
@@@ -7396,12 -7377,6 +7402,12 @@@ T:    git https://github.com/intel/gvt-lin
  S:    Supported
  F:    drivers/gpu/drm/i915/gvt/
  
 +INTEL PMIC GPIO DRIVER
 +R:    Andy Shevchenko <[email protected]>
 +S:    Maintained
 +F:    drivers/gpio/gpio-*cove.c
 +F:    drivers/gpio/gpio-msic.c
 +
  INTEL HID EVENT DRIVER
  M:    Alex Hung <[email protected]>
  L:    [email protected]
@@@ -7666,7 -7641,6 +7672,7 @@@ M:      Corey Minyard <[email protected]
  L:    [email protected] (moderated for non-subscribers)
  W:    http://openipmi.sourceforge.net/
  S:    Supported
 +F:    Documentation/devicetree/bindings/ipmi/
  F:    Documentation/IPMI.txt
  F:    drivers/char/ipmi/
  F:    include/linux/ipmi*
@@@ -8630,6 -8604,7 +8636,6 @@@ F:      include/linux/spinlock*.
  F:    arch/*/include/asm/spinlock*.h
  F:    include/linux/rwlock*.h
  F:    include/linux/mutex*.h
 -F:    arch/*/include/asm/mutex*.h
  F:    include/linux/rwsem*.h
  F:    arch/*/include/asm/rwsem.h
  F:    include/linux/seqlock.h
@@@ -8878,6 -8853,13 +8884,6 @@@ S:     Maintaine
  F:    Documentation/hwmon/max16065
  F:    drivers/hwmon/max16065.c
  
 -MAX20751 HARDWARE MONITOR DRIVER
 -M:    Guenter Roeck <[email protected]>
 -L:    [email protected]
 -S:    Maintained
 -F:    Documentation/hwmon/max20751
 -F:    drivers/hwmon/max20751.c
 -
  MAX2175 SDR TUNER DRIVER
  M:    Ramesh Shanmugasundaram <[email protected]>
  L:    [email protected]
@@@ -9682,8 -9664,7 +9688,8 @@@ MIPS/LOONGSON2 ARCHITECTUR
  M:    Jiaxun Yang <[email protected]>
  L:    [email protected]
  S:    Maintained
 -F:    arch/mips/loongson64/*{2e/2f}*
 +F:    arch/mips/loongson64/fuloong-2e/
 +F:    arch/mips/loongson64/lemote-2f/
  F:    arch/mips/include/asm/mach-loongson64/
  F:    drivers/*/*loongson2*
  F:    drivers/*/*/*loongson2*
@@@ -9723,19 -9704,6 +9729,19 @@@ S:    Maintaine
  F:    arch/arm/boot/dts/mmp*
  F:    arch/arm/mach-mmp/
  
 +MMU GATHER AND TLB INVALIDATION
 +M:    Will Deacon <[email protected]>
 +M:    "Aneesh Kumar K.V" <[email protected]>
 +M:    Andrew Morton <[email protected]>
 +M:    Nick Piggin <[email protected]>
 +M:    Peter Zijlstra <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    arch/*/include/asm/tlb.h
 +F:    include/asm-generic/tlb.h
 +F:    mm/mmu_gather.c
 +
  MN88472 MEDIA DRIVER
  M:    Antti Palosaari <[email protected]>
  L:    [email protected]
@@@ -9754,6 -9722,13 +9760,6 @@@ Q:     http://patchwork.linuxtv.org/project
  S:    Maintained
  F:    drivers/media/dvb-frontends/mn88473*
  
 -PCI DRIVER FOR MOBIVEIL PCIE IP
 -M:    Subrahmanya Lingappa <[email protected]>
 -L:    [email protected]
 -S:    Supported
 -F:    Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
 -F:    drivers/pci/controller/pcie-mobiveil.c
 -
  MODULE SUPPORT
  M:    Jessica Yu <[email protected]>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
@@@ -9903,7 -9878,7 +9909,7 @@@ M:      Peter Rosin <[email protected]
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-class-mux*
  F:    Documentation/devicetree/bindings/mux/
 -F:    include/linux/dt-bindings/mux/
 +F:    include/dt-bindings/mux/
  F:    include/linux/mux/
  F:    drivers/mux/
  
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
  S:    Maintained
 -F:    net/core/flow.c
  F:    net/xfrm/
  F:    net/key/
  F:    net/ipv4/xfrm*
@@@ -10979,7 -10955,7 +10985,7 @@@ M:   Willy Tarreau <[email protected]
  M:    Ksenija Stanojevic <[email protected]>
  S:    Odd Fixes
  F:    Documentation/auxdisplay/lcd-panel-cgram.txt
 -F:    drivers/misc/panel.c
 +F:    drivers/auxdisplay/panel.c
  
  PARALLEL PORT SUBSYSTEM
  M:    Sudip Mukherjee <[email protected]>
@@@ -11167,13 -11143,6 +11173,13 @@@ F: include/uapi/linux/switchtec_ioctl.
  F:    include/linux/switchtec.h
  F:    drivers/ntb/hw/mscc/
  
 +PCI DRIVER FOR MOBIVEIL PCIE IP
 +M:    Subrahmanya Lingappa <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
 +F:    drivers/pci/controller/pcie-mobiveil.c
 +
  PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support)
  M:    Thomas Petazzoni <[email protected]>
  M:    Jason Cooper <[email protected]>
@@@ -11240,14 -11209,8 +11246,14 @@@ F: tools/pci
  
  PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC
  M:    Russell Currey <[email protected]>
 +M:    Sam Bobroff <[email protected]>
 +M:    Oliver O'Halloran <[email protected]>
  L:    [email protected]
  S:    Supported
 +F:    Documentation/PCI/pci-error-recovery.txt
 +F:    drivers/pci/pcie/aer.c
 +F:    drivers/pci/pcie/dpc.c
 +F:    drivers/pci/pcie/err.c
  F:    Documentation/powerpc/eeh-pci-error-recovery.txt
  F:    arch/powerpc/kernel/eeh*.c
  F:    arch/powerpc/platforms/*/eeh*.c
@@@ -11526,12 -11489,15 +11532,12 @@@ S:        Maintaine
  F:    drivers/pinctrl/intel/
  
  PIN CONTROLLER - MEDIATEK
 -M:    Sean Wang <sean.wang@mediatek.com>
 +M:    Sean Wang <sean.wang@kernel.org>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
  F:    Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt
 -F:    drivers/pinctrl/mediatek/mtk-eint.*
 -F:    drivers/pinctrl/mediatek/pinctrl-mtk-common.*
 -F:    drivers/pinctrl/mediatek/pinctrl-mt2701.c
 -F:    drivers/pinctrl/mediatek/pinctrl-mt7622.c
 +F:    drivers/pinctrl/mediatek/
  
  PIN CONTROLLER - QUALCOMM
  M:    Bjorn Andersson <[email protected]>
@@@ -11609,26 -11575,7 +11615,26 @@@ W: http://hwmon.wiki.kernel.org
  W:    http://www.roeck-us.net/linux/drivers/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt
 +F:    Documentation/devicetree/bindings/hwmon/max31785.txt
 +F:    Documentation/devicetree/bindings/hwmon/ltc2978.txt
 +F:    Documentation/hwmon/adm1275
 +F:    Documentation/hwmon/ibm-cffps
 +F:    Documentation/hwmon/ir35221
 +F:    Documentation/hwmon/lm25066
 +F:    Documentation/hwmon/ltc2978
 +F:    Documentation/hwmon/ltc3815
 +F:    Documentation/hwmon/max16064
 +F:    Documentation/hwmon/max20751
 +F:    Documentation/hwmon/max31785
 +F:    Documentation/hwmon/max34440
 +F:    Documentation/hwmon/max8688
  F:    Documentation/hwmon/pmbus
 +F:    Documentation/hwmon/pmbus-core
 +F:    Documentation/hwmon/tps40422
 +F:    Documentation/hwmon/ucd9000
 +F:    Documentation/hwmon/ucd9200
 +F:    Documentation/hwmon/zl6100
  F:    drivers/hwmon/pmbus/
  F:    include/linux/pmbus.h
  
@@@ -12032,7 -11979,7 +12038,7 @@@ F:   Documentation/scsi/LICENSE.qla4xx
  F:    drivers/scsi/qla4xxx/
  
  QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER
 -M:    Harish Patil <harish.patil@cavium.com>
 +M:    Shahed Shaikh <Shahed.Shaikh@cavium.com>
  M:    Manish Chopra <[email protected]>
  M:    [email protected]
  L:    [email protected]
@@@ -12040,6 -11987,7 +12046,6 @@@ S:   Supporte
  F:    drivers/net/ethernet/qlogic/qlcnic/
  
  QLOGIC QLGE 10Gb ETHERNET DRIVER
 -M:    Harish Patil <[email protected]>
  M:    Manish Chopra <[email protected]>
  M:    [email protected]
  L:    [email protected]
@@@ -12318,7 -12266,6 +12324,7 @@@ F:   Documentation/networking/rds.tx
  
  RDT - RESOURCE ALLOCATION
  M:    Fenghua Yu <[email protected]>
 +M:    Reinette Chatre <[email protected]>
  L:    [email protected]
  S:    Supported
  F:    arch/x86/kernel/cpu/intel_rdt*
@@@ -13115,7 -13062,7 +13121,7 @@@ SELINUX SECURITY MODUL
  M:    Paul Moore <[email protected]>
  M:    Stephen Smalley <[email protected]>
  M:    Eric Paris <[email protected]>
 -L:    selinux@tycho.nsa.gov (moderated for non-subscribers)
 +L:    selinux@vger.kernel.org
  W:    https://selinuxproject.org
  W:    https://github.com/SELinuxProject
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git
@@@ -13359,7 -13306,6 +13365,7 @@@ M:   Uwe Kleine-König <u.kleine-koenig@p
  R:    Pengutronix Kernel Team <[email protected]>
  S:    Supported
  F:    drivers/siox/*
 +F:    drivers/gpio/gpio-siox.c
  F:    include/trace/events/siox.h
  
  SIS 190 ETHERNET DRIVER
@@@ -13509,8 -13455,9 +13515,8 @@@ F:   drivers/i2c/busses/i2c-synquacer.
  F:    Documentation/devicetree/bindings/i2c/i2c-synquacer.txt
  
  SOCIONEXT UNIPHIER SOUND DRIVER
 -M:    Katsuhiro Suzuki <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
 -S:    Maintained
 +S:    Orphan
  F:    sound/soc/uniphier/
  
  SOEKRIS NET48XX LED SUPPORT
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/firmware/sdei.txt
  F:    drivers/firmware/arm_sdei.c
 -F:    include/linux/sdei.h
 -F:    include/uapi/linux/sdei.h
 +F:    include/linux/arm_sdei.h
 +F:    include/uapi/linux/arm_sdei.h
  
  SOFTWARE RAID (Multiple Disks) SUPPORT
  M:    Shaohua Li <[email protected]>
@@@ -14087,12 -14034,6 +14093,12 @@@ S: Supporte
  F:    drivers/reset/reset-axs10x.c
  F:    Documentation/devicetree/bindings/reset/snps,axs10x-reset.txt
  
 +SYNOPSYS CREG GPIO DRIVER
 +M:    Eugeniy Paltsev <[email protected]>
 +S:    Maintained
 +F:    drivers/gpio/gpio-creg-snps.c
 +F:    Documentation/devicetree/bindings/gpio/snps,creg-gpio.txt
 +
  SYNOPSYS DESIGNWARE 8250 UART DRIVER
  R:    Andy Shevchenko <[email protected]>
  S:    Maintained
@@@ -15454,7 -15395,7 +15460,7 @@@ S:   Maintaine
  UVESAFB DRIVER
  M:    Michal Januszewski <[email protected]>
  L:    [email protected]
 -W:    http://dev.gentoo.org/~spock/projects/uvesafb/
 +W:    https://github.com/mjanusz/v86d
  S:    Maintained
  F:    Documentation/fb/uvesafb.txt
  F:    drivers/video/fbdev/uvesafb.*
@@@ -15978,7 -15919,6 +15984,7 @@@ F:   net/x25
  X86 ARCHITECTURE (32-BIT AND 64-BIT)
  M:    Thomas Gleixner <[email protected]>
  M:    Ingo Molnar <[email protected]>
 +M:    Borislav Petkov <[email protected]>
  R:    "H. Peter Anvin" <[email protected]>
  M:    [email protected]
  L:    [email protected]
@@@ -16007,15 -15947,6 +16013,15 @@@ M: Borislav Petkov <[email protected]
  S:    Maintained
  F:    arch/x86/kernel/cpu/microcode/*
  
 +X86 MM
 +M:    Dave Hansen <[email protected]>
 +M:    Andy Lutomirski <[email protected]>
 +M:    Peter Zijlstra <[email protected]>
 +L:    [email protected]
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
 +S:    Maintained
 +F:    arch/x86/mm/
 +
  X86 PLATFORM DRIVERS
  M:    Darren Hart <[email protected]>
  M:    Andy Shevchenko <[email protected]>
index 8671de126eac09e0a63358d72305ce0a5e9f4f31,c7d745bc41362252c654679f6fcb5a53d5bb4707..398df6eaa1094b749cb38bcdda285712d314c9ff
@@@ -36,7 -36,6 +36,7 @@@
  
  static int num_counters_llc;
  static int num_counters_nb;
 +static bool l3_mask;
  
  static HLIST_HEAD(uncore_unused_list);
  
@@@ -210,13 -209,6 +210,13 @@@ static int amd_uncore_event_init(struc
        hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
        hwc->idx = -1;
  
 +      /*
 +       * SliceMask and ThreadMask need to be set for certain L3 events in
 +       * Family 17h. For other events, the two fields do not affect the count.
 +       */
 +      if (l3_mask)
 +              hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);
 +
        if (event->cpu < 0)
                return -EINVAL;
  
@@@ -515,17 -507,19 +515,19 @@@ static int __init amd_uncore_init(void
  {
        int ret = -ENODEV;
  
-       if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
+           boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
                return -ENODEV;
  
        if (!boot_cpu_has(X86_FEATURE_TOPOEXT))
                return -ENODEV;
  
-       if (boot_cpu_data.x86 == 0x17) {
+       if (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18) {
                /*
-                * For F17h, the Northbridge counters are repurposed as Data
-                * Fabric counters. Also, L3 counters are supported too. The PMUs
-                * are exported based on  family as either L2 or L3 and NB or DF.
+                * For F17h or F18h, the Northbridge counters are
+                * repurposed as Data Fabric counters. Also, L3
+                * counters are supported too. The PMUs are exported
+                * based on family as either L2 or L3 and NB or DF.
                 */
                num_counters_nb           = NUM_COUNTERS_NB;
                num_counters_llc          = NUM_COUNTERS_L3;
                amd_llc_pmu.name          = "amd_l3";
                format_attr_event_df.show = &event_show_df;
                format_attr_event_l3.show = &event_show_l3;
 +              l3_mask                   = true;
        } else {
                num_counters_nb           = NUM_COUNTERS_NB;
                num_counters_llc          = NUM_COUNTERS_L2;
                amd_llc_pmu.name          = "amd_l2";
                format_attr_event_df      = format_attr_event;
                format_attr_event_l3      = format_attr_event;
 +              l3_mask                   = false;
        }
  
        amd_nb_pmu.attr_groups  = amd_uncore_attr_groups_df;
                if (ret)
                        goto fail_nb;
  
-               pr_info("AMD NB counters detected\n");
+               pr_info("%s NB counters detected\n",
+                       boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ?
+                               "HYGON" : "AMD");
                ret = 0;
        }
  
                if (ret)
                        goto fail_llc;
  
-               pr_info("AMD LLC counters detected\n");
+               pr_info("%s LLC counters detected\n",
+                       boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ?
+                               "HYGON" : "AMD");
                ret = 0;
        }
  
diff --combined arch/x86/events/core.c
index de32741d041a456923ea6c07b0b277f41446428a,9c562f5fbde0a7586192c46a2d6a7046b019b78c..106911b603bd95b355ddcf5d16028c4374c17035
@@@ -1033,27 -1033,6 +1033,27 @@@ static inline void x86_assign_hw_event(
        }
  }
  
 +/**
 + * x86_perf_rdpmc_index - Return PMC counter used for event
 + * @event: the perf_event to which the PMC counter was assigned
 + *
 + * The counter assigned to this performance event may change if interrupts
 + * are enabled. This counter should thus never be used while interrupts are
 + * enabled. Before this function is used to obtain the assigned counter the
 + * event should be checked for validity using, for example,
 + * perf_event_read_local(), within the same interrupt disabled section in
 + * which this counter is planned to be used.
 + *
 + * Return: The index of the performance monitoring counter assigned to
 + * @perf_event.
 + */
 +int x86_perf_rdpmc_index(struct perf_event *event)
 +{
 +      lockdep_assert_irqs_disabled();
 +
 +      return event->hw.event_base_rdpmc;
 +}
 +
  static inline int match_prev_assignment(struct hw_perf_event *hwc,
                                        struct cpu_hw_events *cpuc,
                                        int i)
@@@ -1605,7 -1584,7 +1605,7 @@@ static void __init pmu_check_apic(void
  
  }
  
 -static struct attribute_group x86_pmu_format_group = {
 +static struct attribute_group x86_pmu_format_group __ro_after_init = {
        .name = "format",
        .attrs = NULL,
  };
@@@ -1652,9 -1631,9 +1652,9 @@@ __init struct attribute **merge_attr(st
        struct attribute **new;
        int j, i;
  
 -      for (j = 0; a[j]; j++)
 +      for (j = 0; a && a[j]; j++)
                ;
 -      for (i = 0; b[i]; i++)
 +      for (i = 0; b && b[i]; i++)
                j++;
        j++;
  
                return NULL;
  
        j = 0;
 -      for (i = 0; a[i]; i++)
 +      for (i = 0; a && a[i]; i++)
                new[j++] = a[i];
 -      for (i = 0; b[i]; i++)
 +      for (i = 0; b && b[i]; i++)
                new[j++] = b[i];
        new[j] = NULL;
  
@@@ -1736,7 -1715,7 +1736,7 @@@ static struct attribute *events_attr[] 
        NULL,
  };
  
 -static struct attribute_group x86_pmu_events_group = {
 +static struct attribute_group x86_pmu_events_group __ro_after_init = {
        .name = "events",
        .attrs = events_attr,
  };
@@@ -1797,6 -1776,10 +1797,10 @@@ static int __init init_hw_perf_events(v
        case X86_VENDOR_AMD:
                err = amd_pmu_init();
                break;
+       case X86_VENDOR_HYGON:
+               err = amd_pmu_init();
+               x86_pmu.name = "HYGON";
+               break;
        default:
                err = -ENOTSUPP;
        }
@@@ -2251,7 -2234,7 +2255,7 @@@ static struct attribute *x86_pmu_attrs[
        NULL,
  };
  
 -static struct attribute_group x86_pmu_attr_group = {
 +static struct attribute_group x86_pmu_attr_group __ro_after_init = {
        .attrs = x86_pmu_attrs,
  };
  
@@@ -2269,7 -2252,7 +2273,7 @@@ static struct attribute *x86_pmu_caps_a
        NULL
  };
  
 -static struct attribute_group x86_pmu_caps_group = {
 +static struct attribute_group x86_pmu_caps_group __ro_after_init = {
        .name = "caps",
        .attrs = x86_pmu_caps_attrs,
  };
index 97d6969f9a8af5ba97fc843844ba05ac90f0b121,550f2c95dc1eefd76494408f15639c77c4c63d86..4da9b1c58d287bbdda427e31dd67a1653b519043
  
  /* MCG_CAP register defines */
  #define MCG_BANKCNT_MASK      0xff         /* Number of Banks */
 -#define MCG_CTL_P             (1ULL<<8)    /* MCG_CTL register available */
 -#define MCG_EXT_P             (1ULL<<9)    /* Extended registers available */
 -#define MCG_CMCI_P            (1ULL<<10)   /* CMCI supported */
 +#define MCG_CTL_P             BIT_ULL(8)   /* MCG_CTL register available */
 +#define MCG_EXT_P             BIT_ULL(9)   /* Extended registers available */
 +#define MCG_CMCI_P            BIT_ULL(10)  /* CMCI supported */
  #define MCG_EXT_CNT_MASK      0xff0000     /* Number of Extended registers */
  #define MCG_EXT_CNT_SHIFT     16
  #define MCG_EXT_CNT(c)                (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT)
 -#define MCG_SER_P             (1ULL<<24)   /* MCA recovery/new status bits */
 -#define MCG_ELOG_P            (1ULL<<26)   /* Extended error log supported */
 -#define MCG_LMCE_P            (1ULL<<27)   /* Local machine check supported */
 +#define MCG_SER_P             BIT_ULL(24)  /* MCA recovery/new status bits */
 +#define MCG_ELOG_P            BIT_ULL(26)  /* Extended error log supported */
 +#define MCG_LMCE_P            BIT_ULL(27)  /* Local machine check supported */
  
  /* MCG_STATUS register defines */
 -#define MCG_STATUS_RIPV  (1ULL<<0)   /* restart ip valid */
 -#define MCG_STATUS_EIPV  (1ULL<<1)   /* ip points to correct instruction */
 -#define MCG_STATUS_MCIP  (1ULL<<2)   /* machine check in progress */
 -#define MCG_STATUS_LMCES (1ULL<<3)   /* LMCE signaled */
 +#define MCG_STATUS_RIPV               BIT_ULL(0)   /* restart ip valid */
 +#define MCG_STATUS_EIPV               BIT_ULL(1)   /* ip points to correct instruction */
 +#define MCG_STATUS_MCIP               BIT_ULL(2)   /* machine check in progress */
 +#define MCG_STATUS_LMCES      BIT_ULL(3)   /* LMCE signaled */
  
  /* MCG_EXT_CTL register defines */
 -#define MCG_EXT_CTL_LMCE_EN (1ULL<<0) /* Enable LMCE */
 +#define MCG_EXT_CTL_LMCE_EN   BIT_ULL(0) /* Enable LMCE */
  
  /* MCi_STATUS register defines */
 -#define MCI_STATUS_VAL   (1ULL<<63)  /* valid error */
 -#define MCI_STATUS_OVER  (1ULL<<62)  /* previous errors lost */
 -#define MCI_STATUS_UC    (1ULL<<61)  /* uncorrected error */
 -#define MCI_STATUS_EN    (1ULL<<60)  /* error enabled */
 -#define MCI_STATUS_MISCV (1ULL<<59)  /* misc error reg. valid */
 -#define MCI_STATUS_ADDRV (1ULL<<58)  /* addr reg. valid */
 -#define MCI_STATUS_PCC   (1ULL<<57)  /* processor context corrupt */
 -#define MCI_STATUS_S   (1ULL<<56)  /* Signaled machine check */
 -#define MCI_STATUS_AR  (1ULL<<55)  /* Action required */
 +#define MCI_STATUS_VAL                BIT_ULL(63)  /* valid error */
 +#define MCI_STATUS_OVER               BIT_ULL(62)  /* previous errors lost */
 +#define MCI_STATUS_UC         BIT_ULL(61)  /* uncorrected error */
 +#define MCI_STATUS_EN         BIT_ULL(60)  /* error enabled */
 +#define MCI_STATUS_MISCV      BIT_ULL(59)  /* misc error reg. valid */
 +#define MCI_STATUS_ADDRV      BIT_ULL(58)  /* addr reg. valid */
 +#define MCI_STATUS_PCC                BIT_ULL(57)  /* processor context corrupt */
 +#define MCI_STATUS_S          BIT_ULL(56)  /* Signaled machine check */
 +#define MCI_STATUS_AR         BIT_ULL(55)  /* Action required */
 +#define MCI_STATUS_CEC_SHIFT  38           /* Corrected Error Count */
 +#define MCI_STATUS_CEC_MASK   GENMASK_ULL(52,38)
 +#define MCI_STATUS_CEC(c)     (((c) & MCI_STATUS_CEC_MASK) >> MCI_STATUS_CEC_SHIFT)
  
  /* AMD-specific bits */
 -#define MCI_STATUS_TCC                (1ULL<<55)  /* Task context corrupt */
 -#define MCI_STATUS_SYNDV      (1ULL<<53)  /* synd reg. valid */
 -#define MCI_STATUS_DEFERRED   (1ULL<<44)  /* uncorrected error, deferred exception */
 -#define MCI_STATUS_POISON     (1ULL<<43)  /* access poisonous data */
 +#define MCI_STATUS_TCC                BIT_ULL(55)  /* Task context corrupt */
 +#define MCI_STATUS_SYNDV      BIT_ULL(53)  /* synd reg. valid */
 +#define MCI_STATUS_DEFERRED   BIT_ULL(44)  /* uncorrected error, deferred exception */
 +#define MCI_STATUS_POISON     BIT_ULL(43)  /* access poisonous data */
  
  /*
   * McaX field if set indicates a given bank supports MCA extensions:
@@@ -87,7 -84,7 +87,7 @@@
  #define  MCI_MISC_ADDR_GENERIC        7       /* generic */
  
  /* CTL2 register defines */
 -#define MCI_CTL2_CMCI_EN              (1ULL << 30)
 +#define MCI_CTL2_CMCI_EN              BIT_ULL(30)
  #define MCI_CTL2_CMCI_THRESHOLD_MASK  0x7fffULL
  
  #define MCJ_CTX_MASK          3
@@@ -217,6 -214,8 +217,8 @@@ static inline void mce_amd_feature_init
  static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr) { return -EINVAL; };
  #endif
  
+ static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c) { return mce_amd_feature_init(c); }
  int mce_available(struct cpuinfo_x86 *c);
  bool mce_is_memory_error(struct mce *m);
  
index 0b99a7fae6be8a7dae6f3c045f3b8f76abaccb86,d14c879ba7ba3c4d874222eb2f279856a64e7b1f..c519a079b3d50b5ea118c183db01471bb94cf24f
@@@ -949,11 -949,11 +949,11 @@@ static void identify_cpu_without_cpuid(
  }
  
  static const __initconst struct x86_cpu_id cpu_no_speculation[] = {
 -      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_CEDARVIEW,   X86_FEATURE_ANY },
 -      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_CLOVERVIEW,  X86_FEATURE_ANY },
 -      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_LINCROFT,    X86_FEATURE_ANY },
 -      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_PENWELL,     X86_FEATURE_ANY },
 -      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_PINEVIEW,    X86_FEATURE_ANY },
 +      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_SALTWELL,    X86_FEATURE_ANY },
 +      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_SALTWELL_TABLET,     X86_FEATURE_ANY },
 +      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_BONNELL_MID, X86_FEATURE_ANY },
 +      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_SALTWELL_MID,        X86_FEATURE_ANY },
 +      { X86_VENDOR_INTEL,     6, INTEL_FAM6_ATOM_BONNELL,     X86_FEATURE_ANY },
        { X86_VENDOR_CENTAUR,   5 },
        { X86_VENDOR_INTEL,     5 },
        { X86_VENDOR_NSC,       5 },
  
  static const __initconst struct x86_cpu_id cpu_no_meltdown[] = {
        { X86_VENDOR_AMD },
+       { X86_VENDOR_HYGON },
        {}
  };
  
  /* Only list CPUs which speculate but are non susceptible to SSB */
  static const __initconst struct x86_cpu_id cpu_no_spec_store_bypass[] = {
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT1     },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT      },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_AIRMONT         },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT    },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_MERRIFIELD      },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT_X    },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT_MID  },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_CORE_YONAH           },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_XEON_PHI_KNL         },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_XEON_PHI_KNM         },
  
  static const __initconst struct x86_cpu_id cpu_no_l1tf[] = {
        /* in addition to cpu_no_speculation */
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT1     },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT    },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT      },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT_X    },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_AIRMONT         },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_MERRIFIELD      },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_MOOREFIELD      },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_SILVERMONT_MID  },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_AIRMONT_MID     },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_GOLDMONT        },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_DENVERTON       },
 -      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_GEMINI_LAKE     },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_GOLDMONT_X      },
 +      { X86_VENDOR_INTEL,     6,      INTEL_FAM6_ATOM_GOLDMONT_PLUS   },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_XEON_PHI_KNL         },
        { X86_VENDOR_INTEL,     6,      INTEL_FAM6_XEON_PHI_KNM         },
        {}
@@@ -1076,6 -1077,9 +1077,9 @@@ static void __init early_identify_cpu(s
        memset(&c->x86_capability, 0, sizeof c->x86_capability);
        c->extended_cpuid_level = 0;
  
+       if (!have_cpuid_p())
+               identify_cpu_without_cpuid(c);
        /* cyrix could have cpuid enabled via c_identify()*/
        if (have_cpuid_p()) {
                cpu_detect(c);
                if (this_cpu->c_bsp_init)
                        this_cpu->c_bsp_init(c);
        } else {
-               identify_cpu_without_cpuid(c);
                setup_clear_cpu_cap(X86_FEATURE_CPUID);
        }
  
@@@ -1669,29 -1672,6 +1672,29 @@@ static void wait_for_master_cpu(int cpu
  #endif
  }
  
 +#ifdef CONFIG_X86_64
 +static void setup_getcpu(int cpu)
 +{
 +      unsigned long cpudata = vdso_encode_cpunode(cpu, early_cpu_to_node(cpu));
 +      struct desc_struct d = { };
 +
 +      if (static_cpu_has(X86_FEATURE_RDTSCP))
 +              write_rdtscp_aux(cpudata);
 +
 +      /* Store CPU and node number in limit. */
 +      d.limit0 = cpudata;
 +      d.limit1 = cpudata >> 16;
 +
 +      d.type = 5;             /* RO data, expand down, accessed */
 +      d.dpl = 3;              /* Visible to user code */
 +      d.s = 1;                /* Not a system segment */
 +      d.p = 1;                /* Present */
 +      d.d = 1;                /* 32-bit */
 +
 +      write_gdt_entry(get_cpu_gdt_rw(cpu), GDT_ENTRY_CPUNODE, &d, DESCTYPE_S);
 +}
 +#endif
 +
  /*
   * cpu_init() initializes state that is per-CPU. Some data is already
   * initialized (naturally) in the bootstrap process, such as the GDT
@@@ -1729,7 -1709,6 +1732,7 @@@ void cpu_init(void
            early_cpu_to_node(cpu) != NUMA_NO_NODE)
                set_numa_node(early_cpu_to_node(cpu));
  #endif
 +      setup_getcpu(cpu);
  
        me = current;
  
index ef8fd1f2ede0495f63689a3889979d1f8b78dd94,909f1d75165cfae53e08f0ce801495a7d165f0c9..8cb3c02980cfa72f9d6c810f84f080565c296400
@@@ -270,7 -270,7 +270,7 @@@ static void print_mce(struct mce *m
  {
        __print_mce(m);
  
-       if (m->cpuvendor != X86_VENDOR_AMD)
+       if (m->cpuvendor != X86_VENDOR_AMD && m->cpuvendor != X86_VENDOR_HYGON)
                pr_emerg_ratelimited(HW_ERR "Run the above through 'mcelog --ascii'\n");
  }
  
@@@ -508,9 -508,9 +508,9 @@@ static int mce_usable_address(struct mc
  
  bool mce_is_memory_error(struct mce *m)
  {
-       if (m->cpuvendor == X86_VENDOR_AMD) {
+       if (m->cpuvendor == X86_VENDOR_AMD ||
+           m->cpuvendor == X86_VENDOR_HYGON) {
                return amd_mce_is_memory_error(m);
        } else if (m->cpuvendor == X86_VENDOR_INTEL) {
                /*
                 * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
@@@ -539,6 -539,9 +539,9 @@@ static bool mce_is_correctable(struct m
        if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED)
                return false;
  
+       if (m->cpuvendor == X86_VENDOR_HYGON && m->status & MCI_STATUS_DEFERRED)
+               return false;
        if (m->status & MCI_STATUS_UC)
                return false;
  
@@@ -1315,7 -1318,7 +1318,7 @@@ void do_machine_check(struct pt_regs *r
                local_irq_disable();
                ist_end_non_atomic();
        } else {
 -              if (!fixup_exception(regs, X86_TRAP_MC))
 +              if (!fixup_exception(regs, X86_TRAP_MC, error_code, 0))
                        mce_panic("Failed kernel mode recovery", &m, NULL);
        }
  
@@@ -1705,7 -1708,7 +1708,7 @@@ static int __mcheck_cpu_ancient_init(st
   */
  static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c)
  {
-       if (c->x86_vendor == X86_VENDOR_AMD) {
+       if (c->x86_vendor == X86_VENDOR_AMD || c->x86_vendor == X86_VENDOR_HYGON) {
                mce_flags.overflow_recov = !!cpu_has(c, X86_FEATURE_OVERFLOW_RECOV);
                mce_flags.succor         = !!cpu_has(c, X86_FEATURE_SUCCOR);
                mce_flags.smca           = !!cpu_has(c, X86_FEATURE_SMCA);
@@@ -1746,6 -1749,11 +1749,11 @@@ static void __mcheck_cpu_init_vendor(st
                mce_amd_feature_init(c);
                break;
                }
+       case X86_VENDOR_HYGON:
+               mce_hygon_feature_init(c);
+               break;
        case X86_VENDOR_CENTAUR:
                mce_centaur_feature_init(c);
                break;
@@@ -1971,12 -1979,14 +1979,14 @@@ static void mce_disable_error_reporting
  static void vendor_disable_error_reporting(void)
  {
        /*
-        * Don't clear on Intel or AMD CPUs. Some of these MSRs are socket-wide.
+        * Don't clear on Intel or AMD or Hygon CPUs. Some of these MSRs
+        * are socket-wide.
         * Disabling them for just a single offlined CPU is bad, since it will
         * inhibit reporting for all shared resources on the socket like the
         * last level cache (LLC), the integrated memory controller (iMC), etc.
         */
        if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ||
+           boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ||
            boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
                return;
  
diff --combined arch/x86/xen/pmu.c
index 0972184f3f199272d534c1f5d2cad46093fdce54,9403854cde317b45a890f34e5763bd86e3b832f4..e13b0b49fcdfc181c19f76de1c968b9a344e8a70
@@@ -3,7 -3,6 +3,7 @@@
  #include <linux/interrupt.h>
  
  #include <asm/xen/hypercall.h>
 +#include <xen/xen.h>
  #include <xen/page.h>
  #include <xen/interface/xen.h>
  #include <xen/interface/vcpu.h>
@@@ -91,6 -90,12 +91,12 @@@ static void xen_pmu_arch_init(void
                        k7_counters_mirrored = 0;
                        break;
                }
+       } else if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
+               amd_num_counters = F10H_NUM_COUNTERS;
+               amd_counters_base = MSR_K7_PERFCTR0;
+               amd_ctrls_base = MSR_K7_EVNTSEL0;
+               amd_msr_step = 1;
+               k7_counters_mirrored = 0;
        } else {
                uint32_t eax, ebx, ecx, edx;
  
@@@ -286,7 -291,7 +292,7 @@@ static bool xen_amd_pmu_emulate(unsigne
  
  bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err)
  {
-       if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
                if (is_amd_pmu_msr(msr)) {
                        if (!xen_amd_pmu_emulate(msr, val, 1))
                                *val = native_read_msr_safe(msr, err);
@@@ -309,7 -314,7 +315,7 @@@ bool pmu_msr_write(unsigned int msr, ui
  {
        uint64_t val = ((uint64_t)high << 32) | low;
  
-       if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
                if (is_amd_pmu_msr(msr)) {
                        if (!xen_amd_pmu_emulate(msr, &val, 0))
                                *err = native_write_msr_safe(msr, low, high);
@@@ -380,7 -385,7 +386,7 @@@ static unsigned long long xen_intel_rea
  
  unsigned long long xen_read_pmc(int counter)
  {
-       if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
                return xen_amd_read_pmc(counter);
        else
                return xen_intel_read_pmc(counter);
@@@ -479,7 -484,7 +485,7 @@@ static void xen_convert_regs(const stru
  irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id)
  {
        int err, ret = IRQ_NONE;
 -      struct pt_regs regs;
 +      struct pt_regs regs = {0};
        const struct xen_pmu_data *xenpmu_data = get_xenpmu_data();
        uint8_t xenpmu_flags = get_xenpmu_flags();
  
diff --combined include/linux/pci_ids.h
index d4afd8086ed90a09f3df691f8e083ef02d901ff0,8a0841c73f81ac5ab74ed0240e70e722e2ed111f..8ddc2ffe38951035700b42b5bdc16fd4522c5a7e
  #define PCI_CLASS_SERIAL_USB_DEVICE   0x0c03fe
  #define PCI_CLASS_SERIAL_FIBER                0x0c04
  #define PCI_CLASS_SERIAL_SMBUS                0x0c05
 +#define PCI_CLASS_SERIAL_IPMI         0x0c07
 +#define PCI_CLASS_SERIAL_IPMI_SMIC    0x0c0700
 +#define PCI_CLASS_SERIAL_IPMI_KCS     0x0c0701
 +#define PCI_CLASS_SERIAL_IPMI_BT      0x0c0702
  
  #define PCI_BASE_CLASS_WIRELESS                       0x0d
  #define PCI_CLASS_WIRELESS_RF_CONTROLLER      0x0d10
  
  #define PCI_VENDOR_ID_AMAZON          0x1d0f
  
+ #define PCI_VENDOR_ID_HYGON           0x1d94
  #define PCI_VENDOR_ID_TEKRAM          0x1de1
  #define PCI_DEVICE_ID_TEKRAM_DC290    0xdc29
  
index ccd08dd009962de64d09ce1ceacf38ca9bfed6c2,56e54eabc65cd69abe0d6258a3c36b1bbaf12b24..c3f39d5128ee4e8445cb0921f1485224fc252914
@@@ -170,6 -170,7 +170,7 @@@ static int get_boost_mode(unsigned int 
        unsigned long pstates[MAX_HW_PSTATES] = {0,};
  
        if (cpupower_cpu_info.vendor != X86_VENDOR_AMD &&
+           cpupower_cpu_info.vendor != X86_VENDOR_HYGON &&
            cpupower_cpu_info.vendor != X86_VENDOR_INTEL)
                return 0;
  
        printf(_("    Supported: %s\n"), support ? _("yes") : _("no"));
        printf(_("    Active: %s\n"), active ? _("yes") : _("no"));
  
-       if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
-           cpupower_cpu_info.family >= 0x10) {
+       if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+            cpupower_cpu_info.family >= 0x10) ||
+            cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
                ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states,
                                     pstates, &pstate_no);
                if (ret)
                printf(_("    Boost States: %d\n"), b_states);
                printf(_("    Total States: %d\n"), pstate_no);
                for (i = 0; i < pstate_no; i++) {
 +                      if (!pstates[i])
 +                              continue;
                        if (i < b_states)
                                printf(_("    Pstate-Pb%d: %luMHz (boost state)"
                                         "\n"), i, pstates[i]);
index 9607ada5b29a6a5e50825c267aadbe441c3cc426,65beaeefeef047937d6f0c11d76c6ed916d884d2..7c4f83a8c97371a5e073d969238ad491ea09fc62
@@@ -33,7 -33,7 +33,7 @@@ union msr_pstate 
                unsigned vid:8;
                unsigned iddval:8;
                unsigned idddiv:2;
 -              unsigned res1:30;
 +              unsigned res1:31;
                unsigned en:1;
        } fam17h_bits;
        unsigned long long val;
@@@ -45,7 -45,7 +45,7 @@@ static int get_did(int family, union ms
  
        if (family == 0x12)
                t = pstate.val & 0xf;
-       else if (family == 0x17)
+       else if (family == 0x17 || family == 0x18)
                t = pstate.fam17h_bits.did;
        else
                t = pstate.bits.did;
@@@ -59,7 -59,7 +59,7 @@@ static int get_cof(int family, union ms
        int fid, did, cof;
  
        did = get_did(family, pstate);
-       if (family == 0x17) {
+       if (family == 0x17 || family == 0x18) {
                fid = pstate.fam17h_bits.fid;
                cof = 200 * fid / did;
        } else {
@@@ -119,11 -119,6 +119,11 @@@ int decode_pstates(unsigned int cpu, un
                }
                if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val))
                        return -1;
 +              if ((cpu_family == 0x17) && (!pstate.fam17h_bits.en))
 +                      continue;
 +              else if (!pstate.bits.en)
 +                      continue;
 +
                pstates[i] = get_cof(cpu_family, pstate);
        }
        *no = i;
This page took 0.1789 seconds and 4 git commands to generate.