Skip to content

Conversation

@Suneeth-D
Copy link

@Suneeth-D Suneeth-D commented Nov 5, 2025

Add the cpu_model numbers range (0x60, 0x6F) for detecting Zen5 CPUs in the get_x86_amd_zen().

Add function description for the function get_x86_amd_zen().

Signed-off-by: Suneeth D [email protected]

Summary by CodeRabbit

  • Documentation

    • Clarified docstring for AMD Zen CPU detection to describe returned revision.
  • Bug Fixes

    • Expanded AMD Zen detection to cover additional model ranges for family 0x1A, improving recognition of more processor variants.

@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Walkthrough

A docstring line was added to get_x86_amd_zen describing that it returns the AMD Zen architecture's x86_AMD CPU version. The AMD Zen model mapping for family 0x1A was extended: the existing 5th entry now includes the model range (0x60, 0x6F), and a new 6th entry for family 0x1A was added with ranges (0x50, 0x5F), (0x80, 0xAF), and (0xC0, 0xCF).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single-file change: avocado/utils/cpu.py
  • Changes limited to a docstring addition and extension of a static mapping
  • No control-flow or algorithmic changes; review focus: verify mapping ranges and docstring wording

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title accurately describes the main change: adding/extending CPU model numbers for the Zen architecture, which aligns with the PR's objective of adding model numbers to enable Zen 5 CPU detection.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mr-avocado mr-avocado bot moved this to Review Requested in Default project Nov 5, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
avocado/utils/cpu.py (1)

321-321: Consider sorting model ranges for consistency.

The new Zen 5 model range (0x60, 0x6F) is functionally correct but appears out of order relative to (0x70, 0x7F). Other families in the mapping (0x17 and 0x19) use ascending ranges. Reordering improves maintainability:

- 0x1A: {5: [(0x00, 0x0F), (0x20, 0x2F), (0x40, 0x4F), (0x70, 0x7F), (0x60, 0x6F)]},
+ 0x1A: {5: [(0x00, 0x0F), (0x20, 0x2F), (0x40, 0x4F), (0x60, 0x6F), (0x70, 0x7F)]},
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50bcca0 and c99a01e.

📒 Files selected for processing (1)
  • avocado/utils/cpu.py (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (27)
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
🔇 Additional comments (2)
avocado/utils/cpu.py (2)

305-312: Docstring improves clarity.

The docstring addition properly documents the function's return value and follows the project's conventions with :param, :type, :return, and :rtype tags. Good.


303-333: Verify purpose and integration: get_x86_amd_zen() function appears unused and lacks tests.

The get_x86_amd_zen() function at lines 303-333 has no test coverage and is not called anywhere in the codebase. Before extending CPU model detection, clarify if this function is:

  • Dead code that should be removed
  • An incomplete feature requiring integration with existing code and corresponding test coverage for the new Zen 5 model range (0x60, 0x6F)

@clebergnu clebergnu self-assigned this Nov 13, 2025
@clebergnu
Copy link
Contributor

Hi @Suneeth-D, could you please add a reference to an official documentation source where these model numbers are defined? It'd be helpful for the review process. Thanks!

The patch has the following changes incorporated:-

  *Add the cpu_model numbers range (0x60, 0x6F) for detecting Zen5
  CPUs in the get_x86_amd_zen().

  *Extend the cpu_model dictionary to have Zen6 numbers in the
  get_x86_amd_zen().

  *Add function description for the function get_x86_amd_zen().

Referred the cpu_model numbers from [1].

[1] https://github.com/torvalds/linux/blob/master/arch/x86/kernel/cpu/amd.c

Signed-off-by: Suneeth D <[email protected]>
@Suneeth-D Suneeth-D changed the title Add missing cpu_model numbers for the Zen 5 Add/extend cpu_model numbers for the Zen arch Nov 18, 2025
@Suneeth-D
Copy link
Author

Hi @clebergnu , Thanks for reviewing my patch. I have added the link to where I referred those cpu_model numbers from in the commit message now. Also extended the patch to have numbers for detecting Zen6 CPUs too.

Thanks!

Copy link
Contributor

@bssrikanth bssrikanth left a comment

Choose a reason for hiding this comment

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

},
0x19: {3: [(0x00, 0x0F), (0x20, 0x5F)], 4: [(0x10, 0x1F), (0x60, 0xAF)]},
0x1A: {5: [(0x00, 0x0F), (0x20, 0x2F), (0x40, 0x4F), (0x70, 0x7F)]},
0x1A: {5: [(0x00, 0x0F), (0x20, 0x2F), (0x40, 0x4F), (0x60, 0x6F), (0x70, 0x7F)], 6: [(0x50, 0x5f), (0x80, 0xAF), (0xc0, 0xcf)]},
Copy link
Contributor

Choose a reason for hiding this comment

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

@Suneeth-D according to https://github.com/torvalds/linux/blob/master/arch/x86/kernel/cpu/amd.c#L515 should the range added for zen 5 be (0x60, 0x7F) instead of (0x60, 0x6F) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Suneeth-D any updates here?

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

Labels

None yet

Projects

Status: Review Requested

Development

Successfully merging this pull request may close these issues.

3 participants