Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linux-6.6.y] Add support for Zhaoxin HW Random Number Generator #257

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

leoliu-oc
Copy link
Contributor

zhaoxin inclusion
category: feature


This driver provides kernel-side support for the Random Number Generator hardware found on Zhaoxin based motherboards.

zhaoxin inclusion
category: feature

-------------------

This driver provides kernel-side support for the Random Number Generator
hardware found on Zhaoxin based motherboards.

Signed-off-by: leoliu-oc <[email protected]>
@deepin-ci-robot
Copy link

[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 yukarichiba for approval. For more information see the Code Review Process.

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

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

@deepin-ci-robot
Copy link

Hi @leoliu-oc. 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.

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.

@leoliu-oc leoliu-oc changed the title Add support for Zhaoxin HW Random Number Generator [linux-6.6.y] Add support for Zhaoxin HW Random Number Generator Jun 12, 2024

pr_info("VIA RNG detected\n");
err = hwrng_register(&via_rng);
if (err) {
pr_err(PFX "RNG registering failed (%d)\n",
err);
pr_err(PFX "RNG registering failed (%d)\n", err);
Copy link
Member

Choose a reason for hiding this comment

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

这里为什么要修改

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里修改的原因是,checkpatch.pl会提示格式warning。不过,这边会恢复保留原先格式。

int err;

if (!x86_match_cpu(zhaoxin_rng_cpu_ids)) {
pr_err(PFX "The CPU isn't support XSTORE.\n");
Copy link
Member

Choose a reason for hiding this comment

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

这个pr_err要修改成pr_info吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里是参考同内核类似情况采用pr_err的。这边的理解是,要么使用pr_err,要么直接不打印任何信息。而改为pr_info的话,会导致在其他非zhaoxin_rng_cpu_ids列表中的处理器平台上会多出冗余打印信息。

@opsiff
Copy link
Member

opsiff commented Jul 3, 2024

/lgtm

@opsiff
Copy link
Member

opsiff commented Jul 3, 2024

/ok-to-test

@opsiff opsiff merged commit 7de9402 into deepin-community:linux-6.6.y Jul 3, 2024
2 of 3 checks passed
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • zhaoxin_rng_read函数中,rep_xstore函数的调用可能不正确,因为它没有处理可能的错误返回值。
  • zhaoxin_rng_cpu_ids数组中的X86_MATCH_VENDOR_FAM_FEATURE宏可能不适用于所有Zhaoxin CPUs,需要确认是否适用于所有目标平台。
  • zhaoxin_rng_mod_init函数中的x86_match_cpu调用可能不会正确处理所有Zhaoxin CPUs,需要确保所有Zhaoxin CPUs都支持XSTORE。
  • 缺少对zhaoxin_rng_initzhaoxin_rng_read函数中错误返回值的处理,应该添加相应的错误处理逻辑。
  • 代码中使用了硬编码的值,如ZHAOXIN_RNG_CHUNK_1ZHAOXIN_RNG_MAX_SIZE,应该将这些值定义为常量,以提高代码的可维护性。

是否建议立即修改:

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