03 Nov, 2020

1 commit


16 Oct, 2020

2 commits

  • On multi-package systems, the Psys MSR is only valid for CPUs on
    specific package (master package). The current code makes the
    assumption that package 0 is the master package, but this is not
    true on new platforms like SPR.

    Fix the problem by emuerating the Psys RAPL domain for every
    package, so CPUs in slave packages will read 0 for the Psys energy
    counter and only CPUs in master packages can get a valid reading
    and register the Psys RAPL domain.

    The sysfs I/F for the Psys RAPL domain is not changed.

    Signed-off-by: Zhang Rui
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • As only the low 32 bits of the RAPL_DOMAIN_REG_STATUS register
    represents the energy counter, and the high 32 bits are reserved,
    detect the existence of a RAPL domain by checking the low 32 bits only.

    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     

16 Sep, 2020

1 commit


11 Sep, 2020

3 commits


27 Jul, 2020

1 commit

  • Modern Intel Mobile platforms support power limit4 (PL4), which is
    the SoC package level maximum power limit (in Watts). It can be used
    to preemptively limits potential SoC power to prevent power spikes
    from tripping the power adapter and battery over-current protection.
    This patch enables this feature by exposing package level peak power
    capping control to userspace via RAPL sysfs interface. With this,
    application like DTPF can modify PL4 power limit, the similar way
    of other package power limit (PL1).
    As this feature is not tested on previous generations, here it is
    enabled only for the platform that has been verified to work,
    for safety concerns.

    Signed-off-by: Sumeet Pawnikar
    Co-developed-by: Zhang Rui
    Signed-off-by: Zhang Rui
    Reviewed-by: Srinivas Pandruvada
    Tested-by: Srinivas Pandruvada
    Signed-off-by: Rafael J. Wysocki

    Sumeet Pawnikar
     

01 Jul, 2020

1 commit


25 May, 2020

1 commit

  • Remove unused PLATFORM_POWER_LIMIT MSR local definition from file
    intel_rapl_common.c. This was missed while splitting old RAPL code
    intel_rapl.c file into two new files intel_rapl_msr.c and
    intel_rapl_common.c as per the commit 3382388d7148
    ("intel_rapl: abstract RAPL common code"). Currently, this #define
    entry is being used only in intel_rapl_msr.c file and local definition
    present in this file.

    Signed-off-by: Sumeet Pawnikar
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki

    Sumeet Pawnikar
     

16 May, 2020

1 commit


25 Mar, 2020

1 commit

  • The new macro set has a consistent namespace and uses C99 initializers
    instead of the grufty C89 ones.

    Get rid the of the local macro wrappers for consistency.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Borislav Petkov
    Reviewed-by: Greg Kroah-Hartman
    Link: https://lkml.kernel.org/r/20200320131510.501728797@linutronix.de

    Thomas Gleixner
     

13 Jan, 2020

1 commit


07 Jan, 2020

1 commit

  • RAPL MMIO support depends on the RAPL common driver. During CPU
    initialization rapl_mmio_cpu_online() is called via CPU hotplug
    to initialize the MMIO RAPL for the new CPU, but if that CPU is
    not present in the common RAPL driver's support list, rapl_defaults
    is NULL and the kernel crashes on an attempt to dereference it:

    [ 4.188566] BUG: kernel NULL pointer dereference, address: 0000000000000020
    ...snip...
    [ 4.189555] RIP: 0010:rapl_add_package+0x223/0x574
    [ 4.189555] Code: b5 a0 31 c0 49 8b 4d 78 48 01 d9 48 8b 0c c1 49 89 4c c6 10 48 ff c0 48 83 f8 05 75 e7 49 83 ff 03 75 15 48 8b 05 09 bc 18 01 70 20 41 89 b6 0c 05 00 00 85 f6 75 1a 49 81 c6 18 9
    [ 4.189555] RSP: 0000:ffffb3adc00b3d90 EFLAGS: 00010246
    [ 4.189555] RAX: 0000000000000000 RBX: 0000000000000098 RCX: 0000000000000000
    [ 4.267161] usb 1-1: New USB device found, idVendor=2109, idProduct=2812, bcdDevice= b.e0
    [ 4.189555] RDX: 0000000000001000 RSI: 0000000000000000 RDI: ffff9340caafd000
    [ 4.189555] RBP: ffffb3adc00b3df8 R08: ffffffffa0246e28 R09: ffff9340caafc000
    [ 4.189555] R10: 000000000000024a R11: ffffffff9ff1f6f2 R12: 00000000ffffffed
    [ 4.189555] R13: ffff9340caa94800 R14: ffff9340caafc518 R15: 0000000000000003
    [ 4.189555] FS: 0000000000000000(0000) GS:ffff9340ce200000(0000) knlGS:0000000000000000
    [ 4.189555] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 4.189555] CR2: 0000000000000020 CR3: 0000000302c14001 CR4: 00000000003606f0
    [ 4.189555] Call Trace:
    [ 4.189555] ? __switch_to_asm+0x40/0x70
    [ 4.189555] rapl_mmio_cpu_online+0x47/0x64
    [ 4.189555] ? rapl_mmio_write_raw+0x33/0x33
    [ 4.281059] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [ 4.189555] cpuhp_invoke_callback+0x29f/0x66f
    [ 4.189555] ? __schedule+0x46d/0x6a0
    [ 4.189555] cpuhp_thread_fun+0xb9/0x11c
    [ 4.189555] smpboot_thread_fn+0x17d/0x22f
    [ 4.297006] usb 1-1: Product: USB2.0 Hub
    [ 4.189555] ? cpu_report_death+0x43/0x43
    [ 4.189555] kthread+0x137/0x13f
    [ 4.189555] ? cpu_report_death+0x43/0x43
    [ 4.189555] ? kthread_blkcg+0x2e/0x2e
    [ 4.312951] usb 1-1: Manufacturer: VIA Labs, Inc.
    [ 4.189555] ret_from_fork+0x1f/0x40
    [ 4.189555] Modules linked in:
    [ 4.189555] CR2: 0000000000000020
    [ 4.189555] ---[ end trace 01bb812aabc791f4 ]---

    To avoid that problem, check rapl_defaults NULL upfront and return an
    error code if it is NULL. [Note that it does not make sense to even
    try to allocate memory in that case, because it is not going to be
    used anyway.]

    Fixes: 555c45fe0d04 ("int340X/processor_thermal_device: add support for MMIO RAPL")
    Cc: 5.3+ # 5.3+
    Signed-off-by: Harry Pan
    [ rjw: Subject & changelog ]
    Signed-off-by: Rafael J. Wysocki

    Harry Pan
     

20 Dec, 2019

1 commit


17 Dec, 2019

1 commit


04 Nov, 2019

2 commits


28 Aug, 2019

4 commits

  • Currently big microservers have _XEON_D while small microservers have
    _X, Make it uniformly: _D.

    for i in `git grep -l "\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*_\(X\|XEON_D\)"`
    do
    sed -i -e 's/\(\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*ATOM.*\)_X/\1_D/g' \
    -e 's/\(\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*\)_XEON_D/\1_D/g' ${i}
    done

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Tony Luck
    Cc: x86@kernel.org
    Cc: Dave Hansen
    Cc: Thomas Gleixner
    Cc: Borislav Petkov
    Link: https://lkml.kernel.org/r/20190827195122.677152989@infradead.org

    Peter Zijlstra
     
  • Currently big core clients with extra graphics on have:

    - _G
    - _GT3E

    Make it uniformly: _G

    for i in `git grep -l "\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*_GT3E"`
    do
    sed -i -e 's/\(\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*\)_GT3E/\1_G/g' ${i}
    done

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Tony Luck
    Cc: x86@kernel.org
    Cc: Dave Hansen
    Cc: Thomas Gleixner
    Cc: Borislav Petkov
    Link: https://lkml.kernel.org/r/20190827195122.622802314@infradead.org

    Peter Zijlstra
     
  • Currently big core mobile chips have either:

    - _L
    - _ULT
    - _MOBILE

    Make it uniformly: _L.

    for i in `git grep -l "\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*_\(MOBILE\|ULT\)"`
    do
    sed -i -e 's/\(\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*\)_\(MOBILE\|ULT\)/\1_L/g' ${i}
    done

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Tony Luck
    Cc: x86@kernel.org
    Cc: Dave Hansen
    Cc: Borislav Petkov
    Cc: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190827195122.568978530@infradead.org

    Peter Zijlstra
     
  • Currently the big core client models either have:

    - no OPTDIFF
    - _CORE
    - _DESKTOP

    Make it uniformly: 'no OPTDIFF'.

    for i in `git grep -l "\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*_\(CORE\|DESKTOP\)"`
    do
    sed -i -e 's/\(\(INTEL_FAM6_\|VULNWL_INTEL\|INTEL_CPU_FAM6\).*\)_\(CORE\|DESKTOP\)/\1/g' ${i}
    done

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Tony Luck
    Cc: x86@kernel.org
    Cc: Dave Hansen
    Cc: Borislav Petkov
    Cc: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190827195122.513945586@infradead.org

    Peter Zijlstra
     

22 Jul, 2019

1 commit

  • The MMIO RAPL interface driver depends on both powercap subsystem and
    the intel_rapl_common code.

    But when all of them are built-in, the MMIO RAPL interface driver can
    be loaded before the other two and this breaks the system during boot.

    Fix this by adjusting the init order of the powercap subsystem and the
    intel_rapl_common code, so that it can be initialized first.

    Fixes: 555c45fe0d04 ("int340X/processor_thermal_device: add support for MMIO RAPL")
    Reported-by: Kenneth R. Crudup
    Tested-by: Kenneth R. Crudup
    Signed-off-by: Zhang Rui
    [ rjw: Subject & changelog ]
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     

11 Jul, 2019

8 commits

  • Enables support for ICL-NNPI, which is a neural network processor for deep
    learning inference. From RAPL point of view it is same as Ice Lake Mobile
    processor.

    Link: https://lkml.org/lkml/2019/6/5/1034
    Signed-off-by: Rajneesh Bhardwaj
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Rajneesh Bhardwaj
     
  • Add ICX-D support in intel_rapl driver

    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • Add ICX support in intel_rapl driver

    Signed-off-by: Jacob Pan
    Signed-off-by: Rajneesh Bhardwaj
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • Add IceLake desktop support in intel_rapl driver

    Signed-off-by: Gayatri Kammela
    Signed-off-by: Joe Konno
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • intel_rapl driver used to have a list of cpuids, which is used to
    1. check if the processor support RAPL MSRs
    2. do some cpu model specific setting
    3. module autoloading

    Now, the cpu model specific setting are moved to intel_rapl_common.c as
    part of the common code, because the setup is also needed by RAPL MMIO
    interface on those platforms.
    But removing the cpuid list from intel_rapl MSR interface driver results
    in that the driver can not be loaded automatically.

    Maintaining another copy of the cpuid list in intel_rapl_msr.c does not make
    sense because it increases the complexity when enabling RAPL support on a
    new cpu model.

    Fix the problem by creating an "intel_rapl_msr" platform device in the
    common code, and make RAPL MSR interface driver (intel_rapl_msr.c) probe the
    platform device directly.

    Reviewed-by: Pandruvada, Srinivas
    Tested-by: Pandruvada, Srinivas
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • RAPL MSR interface supports 2 power limits for package domain, and 1 power
    limit for other domains, while RAPL MMIO interface supports 2 power limits
    for both package and dram domains.
    And when 2 power limits are supported, the FW_LOCK bit is in bit 63 of the
    register, instead of bit 31.

    Remove the assumption that only pakcage domain supports 2 power limits.
    And allow the RAPL interface driver to specify the number of power limits
    supported, for every single RAPL domain it owns..

    Reviewed-by: Pandruvada, Srinivas
    Tested-by: Pandruvada, Srinivas
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • RAPL MMIO interface uses 64 bit registers, thus force use 64 bit register
    for all the RAPL code.

    Reviewed-by: Pandruvada, Srinivas
    Tested-by: Pandruvada, Srinivas
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • Split intel_rapl.c to intel_rapl_common.c and intel_rapl_msr.c, where
    intel_rapl_common.c contains the common code that can be used by both MSR
    and MMIO interface.
    intel_rapl_msr.c contains the implementation of RAPL MSR interface.

    Reviewed-by: Pandruvada, Srinivas
    Tested-by: Pandruvada, Srinivas
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui