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

Add GM Driver Support for Hygon platform Cryptographic Coprocessor #384

Merged
merged 20 commits into from
Aug 23, 2024

Conversation

Dpy0407
Copy link

@Dpy0407 Dpy0407 commented Aug 20, 2024

Description:

  1. Support GM kernel driver for hygon C86-2G C86-3G C86-4G CPU.
    the Cryptographic Co-Processor in hygon CPU has implement SM2,SM3,SM4 algo,to use these feature,The corresponding driver needs to be implemented in the kernel.

  2. Support Hygon CCP used via mdev module and support CCP virtualization
    we have also implement a user mode crypto sdk named HCT,which support to use on host and virtual env. the hct driver provide in kernel is important for HCT sdk.

liyabin27 and others added 20 commits August 20, 2024 10:26
hygon inclusion
category: feature

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

In order to add SM2 driver for hygon ccp, relating to
SM2_sign, SM2_verify, SM2_encrypt and SM2_decrypt.

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

In order to add SM3 driver for hygon ccp, include sm3-hmac.

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

In order to add SM4 driver for hygon ccp, relating to sm4 mode of
ecb/ecb_hs, cbc/cbc_hs, cfb, ofb and ctr

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: bugfix

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

the complete callback 'crypto_req_done' has changed its input parameter,
we need update input in ccp-crypto implement.
Fixes: acafe30ff58a ("crypto: ccp: Support SM2 algorithm for hygon ccp.")

Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: bugfix

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

ccp_find_lsb_regions check from vq_1 but status value start from vq_0.
Fixes: 4b394a2 ("crypto: ccp - Let a v5 CCP provide the same function as v3")

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: bugfix

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

fix the repetitive interrupt (INT_COMPLETION & INT_EMPTY_QUEUE)
in one cmd process.
Fixes: 6263b51 ("crypto: ccp - Change ISR handler method for a v5 CCP")

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
…cess test.

hygon inclusion
category: bugfix

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

we shuld clear interrupt status before set int_revd flag, otherwise, it
will cause vq thread stuck when process multi command.
Fixes: 4b394a2 ("crypto: ccp - Let a v5 CCP provide the same function as v3")

Signed-off-by: Xiangyu Xu <[email protected]>
Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
…ding

hygon inclusion
category: bugfix

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

Add DER coding support for ccp sm2 sign interface.
Fixes: acafe30ff58a ("crypto: ccp: Support SM2 algorithm for hygon ccp.")

Signed-off-by: liulanyi <[email protected]>
Signed-off-by: yangdepei <[email protected]>
…rash

hygon inclusion
category: bugfix

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

long data sm2 encryption may cause out of bounds memory access
Fixes: acafe30ff58a ("crypto: ccp: Support SM2 algorithm for hygon ccp.")

Signed-off-by: liulanyi <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

change command queue size to 8192 to support multipule cmd in hygon ccp

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

optimize sm3 processing performance, the physical page of each sg list
corresponds to a CCP cmd, all cmd prepared, then start ccp.

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

optimize sm4 processing performance by starting ccp only after
all cmd has been prepared

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: bugfix

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

remove the repeated sm4-hs mode definition, otherwise, it
will caused ccp-crypto module load err in the following
version of kernel-6.6, eg. 6.6.20
Fixes: 474d2ff69261 ("crypto: ccp: Support SM4 algorithm for hygon ccp.")

Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

1. support sm2 on 4th cpu
2. create new ccp-dev-v5.c file for hygon ccp only
3. restore original ccp-dev-v5.c file

Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

Add the hct.ko driver module to support the HYGON Cryptography Technology
(HCT) Engine, which also supports CCP virtualization.

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

1. hct support run vfio-noiommu mode on memmory-encrypt host
2. change wb attribute for the bar memory of hct virtual machine.

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: bugfix

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

support build hct.ko with only part of features in the virtual env
Fixes: ab5c224be459 ("hct: add mediated ccp driver support for hygon crypto technology.")

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

There are more than 16 ccps from Hygon-Gen4 CPU, so the driver need
update to support more ccps

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: feature

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

hct support more process.

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[email protected]>
hygon inclusion
category: bugfix

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

fix fork process in virtual env will cause stuck due to inherrit parent
wb info
Fixes: bd4bd8459fe2 ("hct: supporting memory encryption in host and wb set in vm")

Signed-off-by: Yabin Li <[email protected]>
Signed-off-by: yangdepei <[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 matrix-wsk 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 @Dpy0407. Thanks for your PR. 😃

@deepin-ci-robot
Copy link

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

@Avenger-285714 Avenger-285714 merged commit 8fb48ea into deepin-community:linux-6.6.y Aug 23, 2024
3 of 5 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.

4 participants