1. 03 2月, 2023 1 次提交
    • S
      powercap: idle_inject: Add update callback · acbc6610
      Srinivas Pandruvada 提交于
      The powercap/idle_inject core uses play_idle_precise() to inject idle
      time. But play_idle_precise() can't ensure that the CPU is fully idle
      for the specified duration because of wakeups due to interrupts. To
      compensate for the reduced idle time due to these wakes, the caller
      can adjust requested idle time for the next cycle.
      
      The goal of idle injection is to keep system at some idle percent on
      average, so this is fine to overshoot or undershoot instantaneous idle
      times.
      
      The idle inject core provides an interface idle_inject_set_duration()
      to set idle and runtime duration.
      
      Some architectures provide interface to get actual idle time observed
      by the hardware. So, the effective idle percent can be adjusted using
      the hardware feedback. For example, Intel CPUs provides package idle
      counters, which is currently used by Intel powerclamp driver to
      readjust runtime duration.
      
      When the caller's desired idle time over a period is less or greater
      than the actual CPU idle time observed by the hardware, caller can
      readjust idle and runtime duration for the next cycle.
      
      The only way this can be done currently is by monitoring hardware idle
      time from a different software thread and readjust idle and runtime
      duration using idle_inject_set_duration().
      
      This can be avoided by adding a callback which callers can register and
      readjust from this callback function.
      
      Add a capability to register an optional update() callback, which can be
      called from the idle inject core before waking up CPUs for idle injection.
      This callback can be registered via a new interface:
      idle_inject_register_full().
      
      During this process of constantly adjusting idle and runtime duration
      there can be some cases where actual idle time is more than the desired.
      In this case idle inject can be skipped for a cycle. If update() callback
      returns false, then the idle inject core skips waking up CPUs for the
      idle injection.
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      acbc6610
  2. 02 2月, 2023 1 次提交
  3. 25 1月, 2023 1 次提交
  4. 20 1月, 2023 1 次提交
    • A
      firmware: zynqmp: fix declarations for gcc-13 · d2c86555
      Arnd Bergmann 提交于
      gcc-13.0.1 reports a type mismatch for two functions:
      
      drivers/firmware/xilinx/zynqmp.c:1228:5: error: conflicting types for 'zynqmp_pm_set_rpu_mode' due to enum/integer mismatch; have 'int(u32,  enum rpu_oper_mode)' {aka 'int(unsigned int,  enum rpu_oper_mode)'} [-Werror=enum-int-mismatch]
       1228 | int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
            |     ^~~~~~~~~~~~~~~~~~~~~~
      In file included from drivers/firmware/xilinx/zynqmp.c:25:
      include/linux/firmware/xlnx-zynqmp.h:552:5: note: previous declaration of 'zynqmp_pm_set_rpu_mode' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
        552 | int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
            |     ^~~~~~~~~~~~~~~~~~~~~~
      drivers/firmware/xilinx/zynqmp.c:1246:5: error: conflicting types for 'zynqmp_pm_set_tcm_config' due to enum/integer mismatch; have 'int(u32,  enum rpu_tcm_comb)' {aka 'int(unsigned int,  enum rpu_tcm_comb)'} [-Werror=enum-int-mismatch]
       1246 | int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~
      include/linux/firmware/xlnx-zynqmp.h:553:5: note: previous declaration of 'zynqmp_pm_set_tcm_config' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
        553 | int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
            |     ^~~~~~~~~~~~~~~~~~~~~~~~
      
      Change the declaration in the header to match the function definition.
      Acked-by: NMichal Simek <michal.simek@amd.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      d2c86555
  5. 18 1月, 2023 1 次提交
    • J
      USB: fix misleading usb_set_intfdata() kernel doc · 11cefeb2
      Johan Hovold 提交于
      The struct device driver-data pointer is used for any data that a driver
      may need in various callbacks while bound to the device. For
      convenience, subsystems typically provide wrappers such as
      usb_set_intfdata() of the generic accessor functions for use in bus
      callbacks.
      
      There is generally no longer any need for a driver to clear the pointer,
      but since commit 0998d063 ("device-core: Ensure drvdata = NULL when
      no driver is bound") the driver-data pointer is set to NULL by driver
      core post unbind anyway.
      
      For historical reasons, USB core also clears this pointer when an
      explicitly claimed interface is released.
      
      Due to a misunderstanding, a misleading kernel doc comment for
      usb_set_intfdata() was recently added which claimed that the driver data
      pointer must not be cleared during disconnect before "all actions [are]
      completed", which is both imprecise and incorrect.
      
      Specifically, drivers like cdc-acm which claim additional interfaces use
      the driver-data pointer as a flag which is cleared when the first
      interface is unbound. As long as a driver does not do something odd like
      dereference the pointer in, for example, completion callbacks, this can
      be done at any time during disconnect. And in any case this is no
      different than for any other resource, like the driver data itself,
      which may be freed by the disconnect callback.
      
      Note that the comment actually also claimed that the interface itself
      was somehow being set to NULL by driver core.
      
      Fix the kernel doc by removing incorrect, overly specific and misleading
      details and adding a comment about why some drivers do clear the
      driver-data pointer.
      
      Fixes: 27ef1784 ("usb: add usb_set_intfdata() documentation")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Link: https://lore.kernel.org/r/20221212152035.31806-1-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11cefeb2
  6. 17 1月, 2023 1 次提交
  7. 14 1月, 2023 1 次提交
    • A
      efi: tpm: Avoid READ_ONCE() for accessing the event log · d3f45053
      Ard Biesheuvel 提交于
      Nathan reports that recent kernels built with LTO will crash when doing
      EFI boot using Fedora's GRUB and SHIM. The culprit turns out to be a
      misaligned load from the TPM event log, which is annotated with
      READ_ONCE(), and under LTO, this gets translated into a LDAR instruction
      which does not tolerate misaligned accesses.
      
      Interestingly, this does not happen when booting the same kernel
      straight from the UEFI shell, and so the fact that the event log may
      appear misaligned in memory may be caused by a bug in GRUB or SHIM.
      
      However, using READ_ONCE() to access firmware tables is slightly unusual
      in any case, and here, we only need to ensure that 'event' is not
      dereferenced again after it gets unmapped, but this is already taken
      care of by the implicit barrier() semantics of the early_memunmap()
      call.
      
      Cc: <stable@vger.kernel.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Jarkko Sakkinen <jarkko@kernel.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Reported-by: NNathan Chancellor <nathan@kernel.org>
      Tested-by: NNathan Chancellor <nathan@kernel.org>
      Link: https://github.com/ClangBuiltLinux/linux/issues/1782Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      d3f45053
  8. 13 1月, 2023 2 次提交
  9. 12 1月, 2023 3 次提交
  10. 11 1月, 2023 1 次提交
    • A
      ARM: omap1: fix !ARCH_OMAP1_ANY link failures · 980a637d
      Arnd Bergmann 提交于
      While compile-testing randconfig builds for the upcoming boardfile
      removal, I noticed that an earlier patch of mine was completely
      broken, and the introduction of CONFIG_ARCH_OMAP1_ANY only replaced
      one set of build failures with another one, now resulting in
      link failures like
      
      ld: drivers/video/fbdev/omap/omapfb_main.o: in function `omapfb_do_probe':
      drivers/video/fbdev/omap/omapfb_main.c:1703: undefined reference to `omap_set_dma_priority'
      ld: drivers/dma/ti/omap-dma.o: in function `omap_dma_free_chan_resources':
      drivers/dma/ti/omap-dma.c:777: undefined reference to `omap_free_dma'
      drivers/dma/ti/omap-dma.c:1685: undefined reference to `omap_get_plat_info'
      ld: drivers/usb/gadget/udc/omap_udc.o: in function `next_in_dma':
      drivers/usb/gadget/udc/omap_udc.c:820: undefined reference to `omap_get_dma_active_status'
      
      I tried reworking it, but the resulting patch ended up much bigger than
      simply avoiding the original problem of unused-function warnings like
      
      arch/arm/mach-omap1/mcbsp.c:76:30: error: unused variable 'omap1_mcbsp_ops' [-Werror,-Wunused-variable]
      
      As a result, revert the previous fix, and rearrange the code that
      produces warnings to hide them. For mcbsp, the #ifdef check can
      simply be removed as the cpu_is_omapxxx() checks already achieve
      the same result, while in the io.c the easiest solution appears to
      be to merge the common map bits into each soc specific portion.
      This gets cleaned in a nicer way after omap7xx support gets dropped,
      as the remaining SoCs all have the exact same I/O map.
      
      Fixes: 615dce5b ("ARM: omap1: fix build with no SoC selected")
      Cc: stable@vger.kernel.org
      Acked-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      980a637d
  11. 10 1月, 2023 2 次提交
    • M
      net/mlx5: Fix command stats access after free · da2e552b
      Moshe Shemesh 提交于
      Command may fail while driver is reloading and can't accept FW commands
      till command interface is reinitialized. Such command failure is being
      logged to command stats. This results in NULL pointer access as command
      stats structure is being freed and reallocated during mlx5 devlink
      reload (see kernel log below).
      
      Fix it by making command stats statically allocated on driver probe.
      
      Kernel log:
      [ 2394.808802] BUG: unable to handle kernel paging request at 000000000002a9c0
      [ 2394.810610] PGD 0 P4D 0
      [ 2394.811811] Oops: 0002 [#1] SMP NOPTI
      ...
      [ 2394.815482] RIP: 0010:native_queued_spin_lock_slowpath+0x183/0x1d0
      ...
      [ 2394.829505] Call Trace:
      [ 2394.830667]  _raw_spin_lock_irq+0x23/0x26
      [ 2394.831858]  cmd_status_err+0x55/0x110 [mlx5_core]
      [ 2394.833020]  mlx5_access_reg+0xe7/0x150 [mlx5_core]
      [ 2394.834175]  mlx5_query_port_ptys+0x78/0xa0 [mlx5_core]
      [ 2394.835337]  mlx5e_ethtool_get_link_ksettings+0x74/0x590 [mlx5_core]
      [ 2394.836454]  ? kmem_cache_alloc_trace+0x140/0x1c0
      [ 2394.837562]  __rh_call_get_link_ksettings+0x33/0x100
      [ 2394.838663]  ? __rtnl_unlock+0x25/0x50
      [ 2394.839755]  __ethtool_get_link_ksettings+0x72/0x150
      [ 2394.840862]  duplex_show+0x6e/0xc0
      [ 2394.841963]  dev_attr_show+0x1c/0x40
      [ 2394.843048]  sysfs_kf_seq_show+0x9b/0x100
      [ 2394.844123]  seq_read+0x153/0x410
      [ 2394.845187]  vfs_read+0x91/0x140
      [ 2394.846226]  ksys_read+0x4f/0xb0
      [ 2394.847234]  do_syscall_64+0x5b/0x1a0
      [ 2394.848228]  entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Fixes: 34f46ae0 ("net/mlx5: Add command failures data to debugfs")
      Signed-off-by: NMoshe Shemesh <moshe@nvidia.com>
      Reviewed-by: NShay Drory <shayd@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      da2e552b
    • P
      bpf: remove the do_idr_lock parameter from bpf_prog_free_id() · e7895f01
      Paul Moore 提交于
      It was determined that the do_idr_lock parameter to
      bpf_prog_free_id() was not necessary as it should always be true.
      Suggested-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      Acked-by: NStanislav Fomichev <sdf@google.com>
      Link: https://lore.kernel.org/r/20230106154400.74211-2-paul@paul-moore.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
      e7895f01
  12. 06 1月, 2023 3 次提交
    • J
      thermal/drivers/qcom: Fix set_trip_temp() deadlock · e6ec64f8
      Johan Hovold 提交于
      The set_trip_temp() callback is used when changing the trip temperature
      through sysfs. As it is called with the thermal-zone-device lock held
      it must not use thermal_zone_get_trip() directly or it will deadlock.
      
      Fixes: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function")
      Signed-off-by: NJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20221214131617.2447-2-johan+linaro@kernel.orgSigned-off-by: NDaniel Lezcano <daniel.lezcano@kernel.org>
      e6ec64f8
    • D
      thermal/core: Add a generic thermal_zone_set_trip() function · 2e38a2a9
      Daniel Lezcano 提交于
      The thermal zone ops defines a set_trip callback where we can invoke
      the backend driver to set an interrupt for the next trip point
      temperature being crossed the way up or down, or setting the low level
      with the hysteresis.
      
      The ops is only called from the thermal sysfs code where the userspace
      has the ability to modify a trip point characteristic.
      
      With the effort of encapsulating the thermal framework core code,
      let's create a thermal_zone_set_trip() which is the writable side of
      the thermal_zone_get_trip() and put there all the ops encapsulation.
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Link: https://lore.kernel.org/r/20221003092602.1323944-4-daniel.lezcano@linaro.org
      2e38a2a9
    • D
      thermal/core: Add a generic thermal_zone_get_trip() function · 7c3d5c20
      Daniel Lezcano 提交于
      The thermal_zone_device_ops structure defines a set of ops family,
      get_trip_temp(), get_trip_hyst(), get_trip_type(). Each of them is
      returning a property of a trip point.
      
      The result is the code is calling the ops everywhere to get a trip
      point which is supposed to be defined in the backend driver. It is a
      non-sense as a thermal trip can be generic and used by the backend
      driver to declare its trip points.
      
      Part of the thermal framework has been changed and all the OF thermal
      drivers are using the same definition for the trip point and use a
      thermal zone registration variant to pass those trip points which are
      part of the thermal zone device structure.
      
      Consequently, we can use a generic function to get the trip points
      when they are stored in the thermal zone device structure.
      
      This approach can be generalized to all the drivers and we can get rid
      of the ops->get_trip_*. That will result to a much more simpler code
      and make possible to rework how the thermal trip are handled in the
      thermal core framework as discussed previously.
      
      This change adds a function thermal_zone_get_trip() where we get the
      thermal trip point structure which contains all the properties (type,
      temp, hyst) instead of doing multiple calls to ops->get_trip_*.
      
      That opens the door for trip point extension with more attributes. For
      instance, replacing the trip points disabled bitmask with a 'disabled'
      field in the structure.
      
      Here we replace all the calls to ops->get_trip_* in the thermal core
      code with a call to the thermal_zone_get_trip() function.
      
      The thermal zone ops defines a callback to retrieve the critical
      temperature. As the trip handling is being reworked, all the trip
      points will be the same whatever the driver and consequently finding
      the critical trip temperature will be just a loop to search for a
      critical trip point type.
      
      Provide such a generic function, so we encapsulate the ops
      get_crit_temp() which can be removed when all the backend drivers are
      using the generic trip points handling.
      
      While at it, add the thermal_zone_get_num_trips() to encapsulate the
      code more and reduce the grip with the thermal framework internals.
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NZhang Rui <rui.zhang@intel.com>
      Link: https://lore.kernel.org/r/20221003092602.1323944-2-daniel.lezcano@linaro.org
      7c3d5c20
  13. 05 1月, 2023 5 次提交
  14. 02 1月, 2023 3 次提交
  15. 01 1月, 2023 2 次提交
  16. 31 12月, 2022 1 次提交
    • Z
      thermal/intel: Introduce Intel TCC library · a3c1f066
      Zhang Rui 提交于
      There are several different drivers that accesses the Intel TCC
      (thermal control circuitry) MSRs, and each of them has its own
      implementation for the same functionalities, e.g. getting the current
      temperature, getting the tj_max, and getting/setting the tj_max offset.
      
      Introduce a library to unify the code for Intel CPU TCC MSR access.
      
      At the same time, ensure the temperature is got based on the updated
      tjmax value because tjmax can be changed at runtime for cases like
      the Intel SST-PP (Intel Speed Select Technology - Performance Profile)
      level change.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a3c1f066
  17. 29 12月, 2022 3 次提交
  18. 20 12月, 2022 2 次提交
  19. 17 12月, 2022 1 次提交
  20. 16 12月, 2022 5 次提交