-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathINSTALL
179 lines (131 loc) · 5.6 KB
/
INSTALL
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Deploying UADK
UADK is a framekwork for user application to access hardware, and it depends
UACCE in kernel.
1. Kernel Requirement
User needs to make sure that UACCE is already supported in Linux kernel. The
kernel version should be at least v5.9 with SVA (Shared Virtual Addressing)
enabled.
2. Kernel Configuration
UACCE could be built as module or built-in.
Here's an example to enable UACCE with hardware accelerator in Hisilicon
platform.
CONFIG_IOMMU_SVA_LIB=y
CONFIG_ARM_SMMU=y
CONFIG_ARM_SMMU_V3=y
CONFIG_ARM_SMMU_V3_SVA=y
CONFIG_PCI_PASID=y
CONFIG_UACCE=y
CONFIG_CRYPTO_DEV_HISI_SEC2=y
CONFIG_CRYPTO_DEV_HISI_QM=y
CONFIG_CRYPTO_DEV_HISI_ZIP=y
CONFIG_CRYPTO_DEV_HISI_HPRE=y
Make sure all these above kernel configurations are selected.
Build kernel and install the kernel image on Hisilicon platform.
3. Build UADK in native environment
Configure UADK
$ ./cleanup.sh
Make sure that all generated files could be removed.
$ ./autogen.sh
$ ./conf.sh
UADK could be configured as either static or dynamic library by conf.sh.
By default, it's configured as dynamic library.
$ make
$ sudo make install
Both dynamic and static libraries would be installed in /usr/local/lib
directory. And all head files would be installed in /usr/local/include/uadk
directory.
4. Set proper permission on device nodes
Harware accelerators register in UADK. So char devices are created in dev
directory. In order to make user access resources on hardware accelerators,
write permission should be opened to user.
$ sudo chmod 777 /dev/hisi_hpre-*
$ sudo chmod 777 /dev/hisi_sec-*
$ sudo chmod 777 /dev/hisi_zip-*
5. Run test applications
Test on zip hardware accelerator
Synchronous mode
$ zip_sva_perf -b 8192000 -l 1000 -v -m 0
Asynchronous mode
$ zip_sva_perf -b 8192000 -l 1000 -v -m 1
Test on sec hardware accelerator
Synchronous mode
$ test_hisi_sec --cipher 0 --optype 0 --pktlen 16 --keylen 16 --times 1 --sync --multi 1
$ test_hisi_sec --digest 0 --optype 0 --pktlen 16 --keylen 16 --times 1 --sync --multi 1
Asynchronous mode
$ test_hisi_sec --cipher 0 --optype 0 --pktlen 16 --keylen 16 --times 1 --async --multi 1
$ test_hisi_sec --digest 0 --optype 0 --pktlen 16 --keylen 16 --times 1 --async --multi 1
Test on hpre hardware accelerator
Synchronous mode
$ test_hisi_hpre --trd_mode=sync
Asynchronous mode
$ test_hisi_hpre --trd_mode=async
6. (Optional) Build UADK by cross compiler
Since some libraries are used in UADK library and test cases, these
libraries should be built first and installed into the path of cross
compiler.
${LIBROOT} and ${CROSSTOOLCHAIN} is a directory that should be defined
by user. linaro-gcc-7.2.1 is used for reference at here.
a) Build NUMA library
$git clone https://github.com/numactl/numactl.git
$cd numactl
$./autogen.sh
$autoconf -i
$CC=aarch64-linux-gnu-gcc ./configure --host=i386-linux-gnu --target=aarch64-linux-gnu --prefix=${LIBROOT}/usr/local
$make
$make install
Install head files and libraries into the path of cross compiler by manual.
$sudo cp ${LIBROOT}/usr/local/include/numa*.h ${CROSSTOOLCHAIN}/aarch64-linux-gnu/libc/usr/include/
$sudo cp ${LIBROOT}/usr/local/lib/libnuma.a ${CROSSTOOLCHAIN}/lib/gcc/aarch64-linux-gnu/7.2.1/
$sudo cp ${LIBROOT}/usr/local/lib/libnuma.so.1.0.0 ${CROSSTOOLCHAIN}/lib/gcc/aarch64-linux-gnu/7.2.1/
$cd ${CROSSTOOLCHAIN}/lib/gcc/aarch64-linux-gnu/7.2.1
$sudo ln -sf libnuma.so.1.0.0 libnuma.so.1
$sudo ln -sf libnuma.so.1 libnuma.so
b) Build OpenSSL library
$git clone https://github.com/openssl/openssl.git
$cd openssl
$git checkout OpenSSL_1_1_1a
$./Configure linux-aarch64 --cross-compile-prefix=aarch64-linux-gnu- -D__ARCH_MAX_ARCH__=8 --prefix=${LIBROOT}/usr/local --shared
$make
$make install
$sudo cp -a ${LIBROOT}/usr/local/include/openssl ${CROSSTOOLCHAIN}/aarch64-linux-gnu/libc/usr/include/
$cd ${CROSSTOOLCHAIN}/lib/gcc/aarch64-linux-gnu/7.2.1
$sudo cp ${LIBROOT}/usr/local/lib/libcrypto.a .
$sudo cp ${LIBROOT}/usr/local/lib/libcrypto.so.3 .
$sudo cp ${LIBROOT}/usr/local/lib/libssl.a .
$sudo cp ${LIBROOT}/usr/local/lib/libssl.so.3 .
$sudo ln -sf libcrypto.so.3 libcrypto.so
$sudo ln -sf libssl.so.3 libssl.so
c) Build zlib library
$git clone https://github.com/madler/zlib
$cd zlib
$CC=aarch64-linux-gnu-gcc \
AR=aarch64-linux-gnu-ar \
RANLIB=aarch64-linux-gnu-ranlib \
./configure --prefix=${LIBROOT}/usr/local
$CC=aarch64-linux-gnu-gcc \
AR=aarch64-linux-gnu-ar \
RANLIB=aarch64-linux-gnu-ranlib \
make
$make install
$sudo cp ${LIBROOT}/usr/local/include/zconf.h ${CROSSTOOLCHAIN}/aarch64-linux-gnu/libc/usr/include/
$sudo cp ${LIBROOT}/usr/local/include/zlib.h ${CROSSTOOLCHAIN}/aarch64-linux-gnu/libc/usr/include/
$cd ${CROSSTOOLCHAIN}/lib/gcc/aarch64-linux-gnu/7.2.1
$sudo cp ${LIBROOT}/usr/local/lib/libz.a .
$sudo cp ${LIBROOT}/usr/local/lib/libz.so.1.2.11 .
$sudo ln -sf libz.so.1.2.11 libz.so.1
$sudo ln -sf libz.so.1 libz.so
d) Build UADK and install it into user specified directory
$cd ${UADK}
$./cleanup.sh
$./autogen.sh
$CC=aarch64-linux-gnu-gcc \
ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes \
./configure \
--host=i386-linux-gnu \
--target=aarch64-linux-gnu \
--prefix=${LIB_ROOT}/usr/local \
--includedir=${LIB_ROOT}/usr/local/include/uadk \
--disable-static --enable-shared
$make
$make install