Skip to content

Devfrep: phytium: update phytium devfrep controller driver support to 6.6.0.4 - #2256

Open
wangchenlu2236 wants to merge 16 commits into
deepin-community:linux-6.6.yfrom
wangchenlu2236:devfrep-6.6.y
Open

wangchenlu2236 wants to merge 16 commits into
deepin-community:linux-6.6.yfrom
wangchenlu2236:devfrep-6.6.y

Conversation

@wangchenlu2236

@wangchenlu2236 wangchenlu2236 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

This patches updates the support for phytium devfrep controller driver.
1.devfreq: Phytium: Tune scaling with ramp-up and hysteresis
2.devfreq: Phytium: Adjust data handing logic in DMU devfreq probe path
3.devfreq: Phytium:Add NOC DEVFREQ Support for PS260xxx SoCs
4.devfreq: Phytium:Add DMU DEVFREQ Support for PS260xxx SoCs
5.devfreq: Phytium: Fix memory leak in ACPI evaluate helper of NOC
6.devfreq: Phytium: Fix memory leak in ACPI evaluate helper of DMU
7.devfreq: Phytium: Modify the sampling logic of DMU driver
8.devfreq: Phytium: Add power mangement interface for noc devfreq
9.devfreq: Phytium: Delete the unnecessary release of resources
10.devfreq: Phytium: Modify some issues related to the dmu driver
11.devfreq: Phytium: Modify the default strategy for DMU freq driver
12.devfreq: Phytium: Update some new functions for DMU driver
13.devfreq: Phytium: Obtain the base address from the ACPI table
14.devfreq: Phytium: Bugfix dmu/noc driver memory leak issue
15.devfreq: Add phytium dmu devfreq driver.
16.devfreq: Add phytium noc devfreq driver.

Summary by Sourcery

Add unified Phytium DMU and NOC devfreq support for current controller hardware and improve scaling, power management, and resource handling.

New Features:

  • Add Phytium DMU and NOC devfreq drivers with support for both legacy and PS260xxx controller variants.
  • Enable ACPI-based frequency discovery and control, bandwidth monitoring, dynamic scaling, and power-management handling for Phytium memory and interconnect controllers.

Bug Fixes:

  • Fix resource and ACPI handling issues affecting Phytium devfreq operation, including cleanup and memory-leak paths.

Enhancements:

  • Tune frequency scaling with ramp-up thresholds, hysteresis, revised sampling, and controller-specific default governors.

This adds the DEVFREQ driver for Phytium Net On Chip.It adjusts
frequency for noc based on load bandwidth obtained from register.

Mainline: NA
Signed-off-by: Li Jiayi <lijiayi1493@phytium.com.cn>
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
This adds the DEVFREQ driver for Phytium DDR Memory Unit.It adjusts
frequency for dmu based on load bandwidth obtained from register.

Mainline: NA
Signed-off-by: Li Jiayi <lijiayi1493@phytium.com.cn>
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
The patch fixed dmu/noc devfreq driver some memory leak problem.

Mainline: NA
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
The patch retrieves the base address from the ACPI table instead
of being directly exposed inside the driver.

Mainline: NA
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
This patch modifies and adds the following functions:
1). On account of DMU and DDR PMU drivers operate PMU
registers at the same time, which will result in conflict.
So the register operation of se in dmufreq is transferred
to the upper driver.

2). The notification chain of dmufreq to DDR PMU is added
in order to suspend dmufreq's register action and maintain
the rate at the current frequency when the PMU driver is loaded.

3). Add suspend and resume features.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Change the default strategy for the DMU freq driver from
simple demand to the performance mode.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Firstly, replace ioremap with devm_ioremap. The advantage of this
approach is that it can be automatically managed during the unloading
stage, eliminating the need for manual resource cleanup, thus
preventing resource leakage.

Secondly, resolve the repeated printing issues.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Delete the unnecessary release of resources when using devm_kzalloc
function to allocate memory.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
This patch adds power mangement interface, Specifically adds the
phytium_nocfreq_suspend/phytium_nocfreq_resume functions so that
the frequency can be restored upon waking up.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Optimize the timer logic for sampling, with the aim of reducing
the frequent calls made by processes within the system. It is
very helpfull to reduce power consumption.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
During driver probe, functions like get_freq_count() and
phytium_noc_get_freq_info() call acpi_evaluate_object() with
ACPI_ALLOCATE_BUFFER. This interface allocates memory via kmalloc
to store the returned ACPI package, but the allocated buffer was never
released after use.

kmemleak reports unreferenced objects coming from
acpi_ut_initialize_buffer() when probing the Phytium DMU freq
drivers.

Fix this by calling kfree(buffer.pointer) after the ACPI package
has been parsed.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
During driver probe, functions like get_freq_count() and
phytium_noc_get_freq_info() call acpi_evaluate_object() with
ACPI_ALLOCATE_BUFFER. This interface allocates memory via kmalloc
to store the returned ACPI package, but the allocated buffer was never
released after use.

kmemleak reports unreferenced objects coming from
acpi_ut_initialize_buffer() when probing the Phytium NOC freq
drivers.

Fix this by calling kfree(buffer.pointer) after the ACPI package
has been parsed.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Add DMU DEVFREQ driver Support for Phytium PS260xxx SoCs,
and complatible with PD2408.

Mainline: NA
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Add NOC DEVFREQ driver Support for Phytium PS260xxx SoCs,
and complatible with PD2408.

Mainline: NA
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Move governor selection after priv allocation and adjust data
handing logic.

Mainline: Open-Source
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
Improves NoC-V2 devfreq behavior by fixing low-load oscillation,
speeding up ramp-up under rising traffic, and adding hysteresis
to reduce frequent back-and-forth transitions between adjacent levels.

Mainline: NA
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Add the DMU and NOC frequency-controller drivers, including their ACPI matching and frequency-control interfaces for v1 and v2 hardware.

  • drivers/devfreq/phytium_dmu.c L1-654
  • drivers/devfreq/phytium_noc.c L1-635

Configuration

Add Kconfig options and Makefile entries so the Phytium DMU and NOC drivers can be selected and built.

  • drivers/devfreq/Kconfig L153-170
  • drivers/devfreq/Makefile L15-16

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

Hi @wangchenlu2236. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign avenger-285714 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants