Skip to content

Conversation

@Ghostor8
Copy link

@Ghostor8 Ghostor8 commented Jan 9, 2026

Summary by Sourcery

Align Cix SoC multimedia drivers and timer behavior with in-tree kernel expectations to fix build and resume issues.

Bug Fixes:

  • Fix NPU driver build by converting its Makefile to standard in-tree kernel build rules and include paths.
  • Fix VPU driver build by using srctree-based include paths in its Kbuild file.
  • Avoid unnecessary reset of the SKY1 GPT timer on resume to prevent suspend-to-RAM (S3) resume issues.

Enhancements:

  • Simplify the ArmChina NPU driver build configuration by removing out-of-tree module build logic and hard-coded variant/platform flags.
  • Unify ArmChina NPU subdirectory include handling with the rest of the tree by basing paths on srctree.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the Cix NPU and VPU driver build rules to align with in-tree kernel Kbuild conventions, fixes include path resolution, simplifies the NPU driver Makefile to a standard obj-y style, and removes an unnecessary GPT timer reset on resume in the SKY1 clocksource driver.

Sequence diagram for SKY1 GPT timer resume path without reset

sequenceDiagram
    participant KernelPM as Kernel_PM
    participant ClockEvents as Clockevents_Core
    participant Sky1Drv as sky1_tick_resume
    participant GPT as SKY1_GPT_Hardware

    KernelPM ->> ClockEvents: resume_timers()
    ClockEvents ->> Sky1Drv: sky1_tick_resume(ced)
    Sky1Drv ->> Sky1Drv: to_sky1_timer(ced)
    Sky1Drv ->> GPT: sky1_gpt_setup_tctl(sky1tm)
    Sky1Drv ->> GPT: sky1_shutdown(ced)
    GPT -->> ClockEvents: timer configured and stopped
    ClockEvents -->> KernelPM: resume complete
Loading

File-Level Changes

Change Details Files
Convert the Cix NPU driver Makefile to standard in-tree Kbuild style instead of out-of-tree module build logic.
  • Remove custom module build variables, conditionals, and manual make targets oriented to external builds
  • Define obj-$(CONFIG_ARMCHINA_NPU) and the cix-aipu-y object list directly for the driver
  • Set ccflags-y include paths using $(src) for armchina-npu and related subdirectories
  • Drop version/platform selection and preprocessor defines that were previously controlled via Makefile variables
drivers/soc/cix/npu/driver/Makefile
Fix include paths for the armchina-npu sub-Makefile to work when building inside the kernel tree.
  • Change subdir-ccflags-y includes from $(src) to $(srctree)/$(src) to ensure correct absolute paths
  • Retain the same directories (root, include, zhouyi, sky1) but reference them via the source tree root
drivers/soc/cix/npu/driver/armchina-npu/Makefile
Remove a potentially problematic reset of the SKY1 GPT timer on resume.
  • Delete the reset_control_reset call in sky1_tick_resume while keeping timer reconfiguration and shutdown logic
  • Rely on sky1_gpt_setup_tctl and sky1_shutdown to correctly reprogram the timer on resume
drivers/clocksource/timer-sky1-gpt.c
Fix include paths for the Cix VPU driver Kbuild to be compatible with in-tree builds.
  • Change ccflags-y include paths to be rooted at $(srctree)/$(src) instead of relative $(src)
  • Keep existing feature flags (ftrace, print file, EXTRA_CCFLAGS) unchanged
drivers/soc/cix/vpu/driver/Kbuild

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

@deepin-ci-robot
Copy link

Hi @Ghostor8. 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.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new NPU Makefile hardcodes the Zhouyi v3 and SKY1 variants and drops the previous BUILD_* configurability (architectures, platforms, devfreq, Android flags); consider reintroducing this selection via Kconfig options or CONFIG_* flags so different variants/platforms remain buildable.
  • You now set include paths for the NPU driver in both the top-level Makefile (ccflags-y) and armchina-npu/Makefile (subdir-ccflags-y); consider consolidating these to a single mechanism to avoid redundant or conflicting include settings.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new NPU Makefile hardcodes the Zhouyi v3 and SKY1 variants and drops the previous BUILD_* configurability (architectures, platforms, devfreq, Android flags); consider reintroducing this selection via Kconfig options or CONFIG_* flags so different variants/platforms remain buildable.
- You now set include paths for the NPU driver in both the top-level Makefile (ccflags-y) and armchina-npu/Makefile (subdir-ccflags-y); consider consolidating these to a single mechanism to avoid redundant or conflicting include settings.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: opsiff

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

The pull request process is described 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

Dylan.Wu added 2 commits January 9, 2026 11:19
fix the build failure by adjusting the Makefile and Kbuild entries for
the CIX NPU and VPU drivers, ensuring that all required objects are
properly included and the build dependencies are consistent

Signed-off-by: "Dylan.Wu" <[email protected]>
remove the reset_control_reset() call from the tick resume path to
simplify the resume flow and avoid unnecessary hardware resets.

Signed-off-by: Dylan.Wu<[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses build failures and S3 suspend-to-RAM resume issues in the Cix SoC drivers by converting them to standard in-tree kernel build conventions.

  • Fixes NPU and VPU driver build failures by updating include paths to use srctree-based patterns
  • Converts NPU driver from out-of-tree module build to in-tree kernel build configuration
  • Prevents S3 resume failure by removing unnecessary timer reset on resume

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
drivers/soc/cix/vpu/driver/Kbuild Updated include paths to use srctree-based pattern for in-tree builds
drivers/soc/cix/npu/driver/armchina-npu/Makefile Updated include paths to use srctree-based pattern for consistency
drivers/soc/cix/npu/driver/Makefile Converted from out-of-tree to in-tree build, replacing complex conditional logic with simplified object file list
drivers/clocksource/timer-sky1-gpt.c Removed unnecessary timer reset on resume that was causing S3 issues
Comments suppressed due to low confidence (1)

drivers/soc/cix/npu/driver/armchina-npu/Makefile:11

  • The aipu-objs variable defined here is unused since there's no corresponding obj- line to create the module. Additionally, this hard-coded list conflicts with the Kconfig-based conditional compilation used in the included Makefiles (lines 13-16), which define armchina_npu-y based on CONFIG options. This definition should either be removed or aligned with the parent Makefile's cix-aipu-y naming.
aipu-objs := aipu.o aipu_common.o aipu_io.o aipu_irq.o  \
		aipu_job_manager.o aipu_mm.o aipu_dma_buf.o aipu_priv.o \
		aipu_tcb.o zhouyi/zhouyi.o zhouyi/v3.o zhouyi/v3_priv.o sky1/sky1.o

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12 to +16
ccflags-y += -I$(src)/armchina-npu/include \
-I$(src)/armchina-npu/zhouyi \
-I$(src)/armchina-npu/sky1 \
-I$(src) \
-I$(src)/armchina-npu
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The include paths should use the srctree-based pattern like the other driver Makefiles in this PR. Using $(src) directly can cause build issues in certain kernel build configurations. Change these to use $(srctree)/$(src) pattern for consistency with the VPU driver and the NPU subdirectory Makefile changes.

Suggested change
ccflags-y += -I$(src)/armchina-npu/include \
-I$(src)/armchina-npu/zhouyi \
-I$(src)/armchina-npu/sky1 \
-I$(src) \
-I$(src)/armchina-npu
ccflags-y += -I$(srctree)/$(src)/armchina-npu/include \
-I$(srctree)/$(src)/armchina-npu/zhouyi \
-I$(srctree)/$(src)/armchina-npu/sky1 \
-I$(srctree)/$(src) \
-I$(srctree)/$(src)/armchina-npu

Copilot uses AI. Check for mistakes.
Comment on lines +10 to 11
armchina-npu/aipu_tcb.o armchina-npu/zhouyi/zhouyi.o armchina-npu/zhouyi/v3.o armchina-npu/zhouyi/v3_priv.o armchina-npu/sky1/sky1.o

Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The object files are hard-coded to only include v3.o and v3_priv.o from the zhouyi subdirectory and sky1.o from the sky1 subdirectory. However, the Kconfig file defines multiple architecture options (V1, V2, V3, V3_1) and multiple SoC options (default, R329, SKY1). The armchina-npu subdirectory Makefiles use CONFIG_ARMCHINA_NPU_ARCH_* and CONFIG_SKY1 to conditionally include the correct object files. This hard-coded list should either use the same Kconfig-based conditional compilation pattern, or the Kconfig options should be removed if only V3 and SKY1 are supported.

Suggested change
armchina-npu/aipu_tcb.o armchina-npu/zhouyi/zhouyi.o armchina-npu/zhouyi/v3.o armchina-npu/zhouyi/v3_priv.o armchina-npu/sky1/sky1.o
armchina-npu/aipu_tcb.o armchina-npu/zhouyi/zhouyi.o
cix-aipu-$(CONFIG_ARMCHINA_NPU_ARCH_V3) += armchina-npu/zhouyi/v3.o armchina-npu/zhouyi/v3_priv.o
cix-aipu-$(CONFIG_SKY1) += armchina-npu/sky1/sky1.o

Copilot uses AI. Check for mistakes.
@opsiff opsiff merged commit de80868 into deepin-community:linux-6.6.y Jan 9, 2026
12 checks passed
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.

3 participants