Rate This Document
Findability
Accuracy
Completeness
Readability

Installation Using DEB Packages

The DEB software packages include hisi_hpre, hisi_sec2, hisi_rde, hisi_zip, libkaezip, libkae, UACCE, and libwd. UACCE and libwd are mandatory. The others can be installed as required. To upgrade KAE, uninstall the old version and then install the new version.

Prerequisites

  • The dpkg tool is available.
  • The OpenSSL version is 1.1.1x (run the openssl version command to query). If not, install OpenSSL based on Installing OpenSSL/Tongsuo.
  • Set the OpenSSL environment variable OPENSSL_ENGINES to the directory where the KAE dynamic library is stored so that OpenSSL can detect KAE.
    1
    export OPENSSL_ENGINES=/usr/local/lib/engines-1.1
    

Procedure

The hisi_hpre, hisi_sec2, hisi_rde, and hisi_zip driver software packages depend on the UACCE software package, and the libkae and libkaezip engine software packages depend on the libwd software package.

  • If only the RSA and DH algorithms need to be accelerated, you are advised to install only the UACCE, hisi_hpre, libwd, and libkae software packages.
  • If only AES, MD5, SM3, and SM4 need to be accelerated, you are advised to install only the UACCE, hisi_sec2, libwd, and libkae software packages.
  • If only the zlib library compression algorithm needs to be accelerated, install only the UACCE, hisi_zip, libwd, and libkaezip packages.
  1. Use SSH to remotely log in to the Linux CLI as the root user.
  2. Download the DEB packages suitable for your OS version by referring to Obtaining Software Packages and copy the obtained KAE DEB software packages to a custom path.
  3. Install the accelerator driver software packages.
    • Method 1: Run the dpkg -i *.deb command to install all KAE DEB software packages.
      1
      dpkg -i *.deb 
      
    • Method 2: Install the software packages separately. The following example shows how to install the uacce-1.3.1 package.
      1
      2
      dpkg -i uacce-1.3.1-1.ubuntu18.04.arm64.deb 
      uacce modules installed
      

      Install the hisi_hpre, hisi_sec2, hisi_rde, and hisi_zip driver software packages and the libwd and libkae engine software packages in sequence (libwd before libkae).

  4. Check whether the DEB packages are installed in the system.
    1. Check whether UACCE is installed.
      1
      dpkg -L uacce 
      

      Command output:

      1
      2
      3
      4
      5
      6
      7
      /.
      /lib
      /lib/modules
      /lib/modules/4.15.0-70-generic
      /lib/modules/4.15.0-70-generic/extra
      /lib/modules/4.15.0-70-generic/extra/uacce.ko
      /lib/modules/4.15.0-70-generic/extra/hisi_qm.ko
      
    2. Check whether hisi_sec2, hisi_hpre, hisi_rde, and hisi-zip are installed.
      1
      dpkg -L hisi-sec2 hisi-hpre hisi-rde hisi-zip
      

      Command output:

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      /. 
      /lib 
      /lib/modules 
      /lib/modules/4.15.0-70-generic 
      /lib/modules/4.15.0-70-generic/extra 
      /lib/modules/4.15.0-70-generic/extra/hisi_sec2.ko 
      /etc 
      /etc/modprobe.d 
      /etc/modprobe.d/hisi_sec2.conf 
       
      /. 
      /lib 
      /lib/modules 
      /lib/modules/4.15.0-70-generic 
      /lib/modules/4.15.0-70-generic/extra 
      /lib/modules/4.15.0-70-generic/extra/hisi_hpre.ko 
      /etc 
      /etc/modprobe.d 
      /etc/modprobe.d/hisi_hpre.conf 
       
      /. 
      /lib 
      /lib/modules 
      /lib/modules/4.15.0-70-generic 
      /lib/modules/4.15.0-70-generic/extra 
      /lib/modules/4.15.0-70-generic/extra/hisi_rde.ko 
      /etc 
      /etc/modprobe.d 
      /etc/modprobe.d/hisi_rde.conf 
      
      /. 
      /lib 
      /lib/modules 
      /lib/modules/4.15.0-70-generic 
      /lib/modules/4.15.0-70-generic/extra 
      /lib/modules/4.15.0-70-generic/extra/hisi_zip.ko 
      /etc 
      /etc/modprobe.d 
      /etc/modprobe.d/hisi_zip.conf 
      
    3. Check whether the corresponding modules are generated in the installation directory.
      1
      ls -al /lib/modules/`uname -r`/extra
      

      Command output:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      total 348 
      drwxr-xr-x 2 root root  4096 Apr 15 17:12 . 
      drwxr-xr-x 6 root root  4096 Apr 15 17:12 .. 
      -rw-r--r-- 1 root root 49080 Apr 15 09:15 hisi_hpre.ko 
      -rw-r--r-- 1 root root 85728 Apr 15 09:15 hisi_qm.ko 
      -rw-r--r-- 1 root root 59720 Apr 15 09:15 hisi_rde.ko 
      -rw-r--r-- 1 root root 65536 Apr 15 09:15 hisi_sec2.ko 
      -rw-r--r-- 1 root root 42600 Apr 15 09:15 hisi_zip.ko
      -rw-r--r-- 1 root root 40408 Apr 15 09:15 uacce.ko 
      
    4. Check whether the corresponding configuration files are generated in /etc/modprobe.d/.
      1
      ls -al /etc/modprobe.d/
      

      Command output:

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      total 52
      drwxr-xr-x  2 root root 4096 Apr 15 17:12 .
      drwxr-xr-x 94 root root 4096 Apr 15 09:15 ..
      -rw-r--r--  1 root root  325 Jan 28  2018 blacklist-ath_pci.conf
      -rw-r--r--  1 root root 1667 Nov 13  2018 blacklist.conf
      -rw-r--r--  1 root root  210 Jan 28  2018 blacklist-firewire.conf
      -rw-r--r--  1 root root  697 Jan 28  2018 blacklist-framebuffer.conf
      -rw-r--r--  1 root root  583 Jan 28  2018 blacklist-rare-network.conf
      -rw-r--r--  1 root root   45 Apr 15 09:15 hisi_hpre.conf
      -rw-r--r--  1 root root   44 Apr 15 09:15 hisi_rde.conf
      -rw-r--r--  1 root root   61 Apr 15 09:15 hisi_sec2.conf
      -rw-r--r--  1 root root   44 Apr 15 09:15 hisi_zip.conf
      -rw-r--r--  1 root root  347 Jan 28  2018 iwlwifi.conf
      -rw-r--r--  1 root root  379 Jul  2  2018 mdadm.conf
      
  5. Load the accelerator drivers to the kernel.
    • Method 1: Restart the system.
    • Method 2: Manually load the drivers in sequence in the CLI and check whether the loading is successful.
      1. Query driver modules that have been loaded to the kernel.
        1
        lsmod | grep uacce
        

        If no command output is displayed, perform 5.b to 5.f to load the corresponding modules to the kernel.

      2. Load the UACCE driver.
        1
        modprobe uacce
        
      3. Load the hisi_sec2 driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_sec2.conf.
        1
        modprobe hisi_sec2
        
      4. Load the hisi_hpre driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_hpre.conf.
        1
        modprobe hisi_hpre
        
      5. Load the hisi_rde driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_rde.conf.
        1
        modprobe hisi_rde
        
      6. Load the hisi_zip driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_zip.conf.
        1
        modprobe hisi_zip
        
      7. Query driver modules that have been loaded to the kernel again.
        1
        2
        lsmod | grep uacce
        lsmod | grep hisi_qm
        
        If the following information is displayed, the loading is successful:
        1
        uacce                  28672  1 hisi_qm
        
        1
        2
        hisi_qm               65536  4 hisi_sec2,hisi_hpre,hisi_rde hisi_zip
        uacce                  28672  1 hisi_qm 
        

Verification

  1. Query KAE DEB software packages.
    1
    dpkg -s uacce hisi-sec2 hisi-hpre hisi-rde hisi-zip
    
    Command output:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    Package: uacce
    Status: install ok installed
    Priority: optional
    Section: utils
    Installed-Size: 512
    Maintainer: HiSilicon Tech. Co., Ltd.
    Architecture: arm64
    Version: 1.3.1
    Description: This package contains the Unified/User-space-access-intended Accelerator Framework.
    URL: https://support.huawei.com 
     
    Package: hisi-sec2
    Status: install ok installed
    Priority: optional
    Section: utils
    Installed-Size: 512
    Maintainer: HiSilicon Tech. Co., Ltd.
    Architecture: arm64
    Version: 1.3.1
    Description: This package contains the Huawei HiSilicon SEC Accelerator Driver.
    URL: https://support.huawei.com
     
    Package: hisi-hpre
    Status: install ok installed
    Priority: optional
    Section: utils
    Installed-Size: 512
    Maintainer: HiSilicon Tech. Co., Ltd.
    Architecture: arm64
    Version: 1.3.1
    Description: This package contains the Huawei Hisilicon HPRE Accelerator Driver.
    URL: https://support.huawei.com
     
    Package: hisi-rde
    Status: install ok installed
    Priority: optional
    Section: utils
    Installed-Size: 512
    Maintainer: HiSilicon Tech. Co., Ltd.
    Architecture: arm64
    Version: 1.3.1
    Description: This package contains the Huawei Hisilicon RDE Accelerator Driver.
    URL: https://support.huawei.com 
    
    Package: hisi-zip
    Status: install ok installed
    Priority: optional
    Section: utils
    Installed-Size: 512
    Maintainer: HiSilicon Tech. Co., Ltd.
    Architecture: arm64
    Version: 1.3.1
    Description: This package contains the Huawei Hisilicon ZIP Accelerator Driver.
    URL: https://support.huawei.com
    
  2. Check the accelerator devices in the virtual file system.
    1
    ls -al /sys/class/uacce/
    
    Command output:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    total 0
    lrwxrwxrwx. 1 root root 0 Nov 14 03:45 hisi_hpre-2 -> ../../devices/pci0000:78/0000:78:00.0/0000:79:00.0/uacce/hisi_hpre-2
    lrwxrwxrwx. 1 root root 0 Nov 14 03:45 hisi_hpre-3 -> ../../devices/pci0000:b8/0000:b8:00.0/0000:b9:00.0/uacce/hisi_hpre-3
    lrwxrwxrwx. 1 root root 0 Nov 17 22:09 hisi_rde-4 -> ../../devices/pci0000:78/0000:78:01.0/uacce/hisi_rde-4
    lrwxrwxrwx. 1 root root 0 Nov 17 22:09 hisi_rde-5 -> ../../devices/pci0000:b8/0000:b8:01.0/uacce/hisi_rde-5
    lrwxrwxrwx. 1 root root 0 Nov 14 08:39 hisi_sec-0 -> ../../devices/pci0000:74/0000:74:01.0/0000:76:00.0/uacce/hisi_sec-0
    lrwxrwxrwx. 1 root root 0 Nov 14 08:39 hisi_sec-1 -> ../../devices/pci0000:b4/0000:b4:01.0/0000:b6:00.0/uacce/hisi_sec-1
    lrwxrwxrwx  1 root root 0 Apr    15 17:42 hisi_zip-6 -> ../../devices/pci0000:74/0000:74:00.0/0000:75:00.0/uacce/hisi_zip-6
    lrwxrwxrwx  1 root root 0 Apr  15 17:42 hisi_zip-7 -> ../../devices/pci0000:b4/0000:b4:00.0/0000:b5:00.0/uacce/hisi_zip-7
    
  3. Check whether KAEOpensslEngine takes effect.

    The RSA performance is used as an example. For details about the verification procedure, see Testing the RSA Algorithm Performance in Synchronous Mode. The command output shows that the RSA performance is significantly improved after KAE is specified.

    In addition, during the execution of the RSA performance verification command, you can view the hardware queue resource usage of the hisi_hpre device on a new terminal. Similarly, you can view the hardware queue resource usage of the hisi_sec2 device when verifying the SM3/SM4 algorithm performance.

    1
    cat /sys/class/uacce/hisi_hpre-*/attrs/available_instances
    
    You can also run the following command to refresh the hardware queue consumption of hisi_hpre every 0.1 second:
    1
    watch -n 0.1 cat /sys/class/uacce/hisi_hpre-*/attrs/available_instances
    

    If the value changes from 256 to 255, the RSA algorithm consumes a hardware queue of the HPRE accelerator, indicating that KAEOpensslEngine has taken effect.

  4. Check whether the accelerator engines of the zlib library take effect.
    Run the ldd command to check whether the zlib library is linked to libwd and libkaezip.
    1
    ldd /usr/local/kaezip/lib/libz.so.1.2.11
    
    If the following information is displayed, the zlib library has been installed. You can also run the ldd command to check whether libwd and libkaezip are used.
    1
    2
    3
    4
    5
            linux-vdso.so.1 =>  (0x0000ffff80280000)
            libc.so.6 => /lib64/libc.so.6 (0x0000ffff80080000)
            libwd.so.1 => /lib64/libwd.so.1 (0x0000ffff80040000)
            /lib/ld-linux-aarch64.so.1 (0x0000ffff80290000)
            libkaezip.so => /usr/local/kaezip/lib/libkaezip.so (0x0000ffff80830000)