Skip to content

Commit 88205d1

Browse files
SDA USRsdausr
authored and
GitHub Enterprise
committed
Squashed 'security' changes from 9ba8ba0..2079b9b (#576)
2079b9b Ethash SC prototype (#150) c08ada1 merge tutorial (#157) 04302db Merge pull request #155 from changg/fix_issues f792a67 revert the change 98ccdea test 8fa693a fix security issues f60f3c8 Update Makefile (#152) 9612886 Fix cr 1114888 1114873 (#151) e622384 update rc4 benchmark case, reduce to 1 kernel (#149) 8b43251 remove email from Jenkinsfile:https://jira.xilinx.com/browse/CR-1124831 (#145) 3d86755 Fix cr 1114880 1114888 (#146) 49d5003 Merge pull request #144 from liyuanz/replace_cflags 43651c8 replace cflags with clflags ee65b70 Add open file failure guard and mode for read-only (#143) a05e213 Merge pull request #141 from liyuanz/replace_blacklist 9095130 replace whiltelist/blacklist to allowlist/blocklist fb7dfd6 Merge pull request #137 from leol/fix-CR 4454482 Merge pull request #138 from liyuanz/next ded8552 add mem for mem limit case 80dddf9 Fix for L1 CBC SC benchmarks host build issue dd68b83 Clang format crc32c_sc.cpp with 3.9.0 version 443fa59 Merge pull request #132 from liyuanz/next 34bc727 Merge pull request #134 from liyuanz/replace_targets be250a9 update targes 3e28567 update e0cbc3d Refine crc32c to improve the performance of the resdu line (#133) 884b4f9 update c790abe update 0256aac update 61cb658 update Makefile and utils.mk 359c5b6 Clang format crc32c_sc.cpp for both 3.9.0 and 8.0.0 (#131) 92cf068 SC L3 design of CRC32C (#123) c00352b update Makefile for Vitis Flow testcase (#128) 33c3c23 remove ssl linkage from library,json (#127) c67da48 Merge pull request #126 from changg/metadata 080686b draft metadata files e3efd4d add aws support (#124) 87f65b0 change 2021.2_stable_latest to 2022.1_stable_latest Co-authored-by: sdausr <[email protected]>
1 parent 665afd5 commit 88205d1

File tree

231 files changed

+14073
-6181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+14073
-6181
lines changed

security/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@Library('pipeline-library')_
2-
VitisLibPipeline (branch: 'next', libname: 'xf_security', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
2+
VitisLibPipeline (branch: 'next', libname: 'xf_security', TARGETS: 'hls_csim:hls_cosim:vivado_syn:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
33
upstream_dependencies: 'xf_utils_hw,next,../utils',
4-
email: '[email protected]', devtest: 'RunDeploy.sh', TOOLVERSION: '2021.2_stable_latest')
4+
devtest: 'RunDeploy.sh', TOOLVERSION: '2022.1_stable_latest')

security/L1/benchmarks/adler32/Makefile

+236-127
Large diffs are not rendered by default.

security/L1/benchmarks/adler32/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ The steps for library download and environment setup can be found in :ref:`l1_vi
1919
* **Build kernel(Step 2)**
2020

2121

22-
Please check you've installed openSSL and make sure that its version is 1.0.2 or higher. Command to check openSSL version:
23-
24-
```
25-
openssl version
26-
```
27-
2822
Run the following make command to build your XCLBIN and host binary targeting a specific device. Please be noticed that this process will take a long time, maybe couple of hours.
2923

3024
```

security/L1/benchmarks/adler32/description.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
"name": "Xilinx Adler32 Benchmark",
44
"description": "Adler32 checksum algorithm benchmark",
55
"flow": "vitis",
6-
"platform_whitelist": [
6+
"platform_allowlist": [
77
"u50",
88
"aws-vu9p-f1"
99
],
10-
"platform_blacklist": [
10+
"platform_blocklist": [
1111
"zc"
1212
],
1313
"platform_properties": {
1414
"u50": {
1515
"v++": {
1616
"compiler": {
17-
"cflags": [
17+
"clflags": [
1818
"--config PROJECT/conn_u50.cfg"
1919
]
2020
}

security/L1/benchmarks/adler32/utils.mk

+96-57
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2019-2021 Xilinx, Inc.
2+
# Copyright 2019-2022 Xilinx, Inc.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
# vitis makefile-generator v2.0.6
1516
#
1617
#+-------------------------------------------------------------------------------
1718
# The following parameters are assigned with default values. These parameters can
@@ -39,17 +40,59 @@ ifeq ($(DEBUG), yes)
3940
VPP_LDFLAGS += --dk protocol:all:all:all
4041
endif
4142

42-
#Checks for XILINX_XRT
43-
ifeq ($(HOST_ARCH), x86)
43+
#Check environment setup
44+
ifndef XILINX_VITIS
45+
XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION)
46+
export XILINX_VITIS
47+
endif
4448
ifndef XILINX_XRT
4549
XILINX_XRT = /opt/xilinx/xrt
4650
export XILINX_XRT
4751
endif
52+
53+
check_device:
54+
@set -eu; \
55+
inallowlist=False; \
56+
inblocklist=False; \
57+
for dev in $(PLATFORM_ALLOWLIST); \
58+
do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \
59+
then inallowlist=True; fi; \
60+
done ;\
61+
for dev in $(PLATFORM_BLOCKLIST); \
62+
do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \
63+
then inblocklist=True; fi; \
64+
done ;\
65+
if [[ $$inallowlist == False ]]; \
66+
then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \
67+
fi; \
68+
if [[ $$inblocklist == True ]]; \
69+
then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\
70+
fi;
71+
72+
#get HOST_ARCH by PLATFORM
73+
ifneq (,$(PLATFORM))
74+
HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
75+
ifeq ($(HOST_ARCH_temp), x86)
76+
HOST_ARCH := x86
77+
else ifeq ($(HOST_ARCH_temp), cortex-a9)
78+
HOST_ARCH := aarch32
79+
else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp)))
80+
HOST_ARCH := aarch64
81+
endif
82+
endif
83+
84+
85+
#get suffix of kernel by PLATFORM
86+
VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
87+
DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
88+
ifeq ($(DEVICE_TYPE), versal)
89+
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
90+
LINK_TARGET_FMT := xsa
4891
else
49-
ifndef XILINX_VITIS
50-
XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION)
51-
export XILINX_VITIS
92+
LINK_TARGET_FMT := xclbin
5293
endif
94+
else
95+
LINK_TARGET_FMT := xclbin
5396
endif
5497

5598
#Checks for Device Family
@@ -59,13 +102,18 @@ else ifeq ($(HOST_ARCH), aarch64)
59102
DEV_FAM = Ultrascale
60103
endif
61104

62-
B_NAME = $(shell dirname $(XPLATFORM))
63-
64105
#Checks for Correct architecture
65106
ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86))
66107
$(error HOST_ARCH variable not set, please set correctly and rerun)
67108
endif
68109

110+
check_version:
111+
ifneq (, $(shell which git))
112+
ifneq (,$(wildcard $(XFLIB_DIR)/.git))
113+
@cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd -
114+
endif
115+
endif
116+
69117
#Checks for SYSROOT
70118
check_sysroot:
71119
ifneq ($(HOST_ARCH), x86)
@@ -74,25 +122,24 @@ ifndef SYSROOT
74122
endif
75123
endif
76124

77-
check_version:
78-
ifneq (, $(shell which git))
79-
ifneq (,$(wildcard $(XFLIB_DIR)/.git))
80-
@cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd -
81-
endif
82-
endif
83-
84125
#Checks for g++
85126
CXX := g++
86127
ifeq ($(HOST_ARCH), x86)
87-
ifneq ($(shell expr $(shell g++ -dumpversion) \>= 5), 1)
128+
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
129+
CXX_VER := 8.3.0
130+
else
131+
CXX_VER := 6.2.0
132+
endif
133+
CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}')
134+
ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1)
88135
ifndef XILINX_VIVADO
89-
$(error [ERROR]: g++ version too old. Please use 5.0 or above)
136+
$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above)
90137
else
91-
CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/bin/g++
138+
CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++
92139
ifeq ($(LD_LIBRARY_PATH),)
93-
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/lib64
140+
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64
94141
else
95-
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/lib64:$(LD_LIBRARY_PATH)
142+
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH)
96143
endif
97144
$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX))
98145
endif
@@ -103,20 +150,32 @@ else ifeq ($(HOST_ARCH), aarch32)
103150
CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++
104151
endif
105152

106-
#Check OS and setting env
153+
#Check OS and setting env for xrt c++ api
107154
OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' )
108155
OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t')
109156

110-
ifeq ($(OSDIST), centos)
157+
# for centos and redhat
158+
ifneq ($(findstring centos,$(OSDIST)),)
159+
ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' ))
160+
ifeq ($(HOST_ARCH), x86)
161+
XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
162+
endif
163+
endif
164+
else ifneq ($(findstring redhat,$(OSDIST)),)
111165
ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' ))
112-
CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
166+
ifeq ($(HOST_ARCH), x86)
167+
XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
168+
endif
113169
endif
114170
endif
115171

116172
#Setting VPP
117173
VPP := v++
118174

119175
#Cheks for aiecompiler
176+
AIECXX := aiecompiler
177+
AIESIMULATOR := aiesimulator
178+
X86SIMULATOR := x86simulator
120179

121180
.PHONY: check_vivado
122181
check_vivado:
@@ -132,11 +191,9 @@ endif
132191

133192
.PHONY: check_xrt
134193
check_xrt:
135-
ifeq ($(HOST_ARCH), x86)
136194
ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so))
137195
@echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false
138196
endif
139-
endif
140197

141198
export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH)
142199
ifeq ($(HOST_ARCH), x86)
@@ -145,82 +202,64 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib
145202
else
146203
LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH)
147204
endif
148-
else # aarch64
149-
ifeq (,$(LD_LIBRARY_PATH))
150-
LD_LIBRARY_PATH := $(SYSROOT)/usr/lib
151-
else
152-
LD_LIBRARY_PATH := $(SYSROOT)/usr/lib:$(LD_LIBRARY_PATH)
153-
endif
154-
endif
155-
156-
# check target
157-
ifeq ($(filter $(TARGET),sw_emu hw_emu hw),)
158-
$(error TARGET is not sw_emu, hw_emu or hw)
159205
endif
160206

161-
ifneq (,$(wildcard $(DEVICE)))
162-
# Use DEVICE as a file path
163-
XPLATFORM := $(DEVICE)
207+
ifneq (,$(wildcard $(PLATFORM)))
208+
# Use PLATFORM as a file path
209+
XPLATFORM := $(PLATFORM)
164210
else
165-
# Use DEVICE as a file name pattern
211+
# Use PLATFORM as a file name pattern
166212
# 1. search paths specified by variable
167213
ifneq (,$(PLATFORM_REPO_PATHS))
168214
# 1.1 as exact name
169-
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(DEVICE)/$(DEVICE).xpfm)))
215+
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm)))
170216
# 1.2 as a pattern
171217
ifeq (,$(XPLATFORM))
172218
XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm))
173-
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
219+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
174220
endif # 1.2
175221
endif # 1
176222
# 2. search Vitis installation
177223
ifeq (,$(XPLATFORM))
178224
# 2.1 as exact name
179-
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE)/$(DEVICE).xpfm))
225+
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
180226
# 2.2 as a pattern
181227
ifeq (,$(XPLATFORM))
182228
XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm)
183-
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
229+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
184230
endif # 2.2
185231
endif # 2
186232
# 3. search default locations
187233
ifeq (,$(XPLATFORM))
188234
# 3.1 as exact name
189-
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(DEVICE)/$(DEVICE).xpfm))
235+
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
190236
# 3.2 as a pattern
191237
ifeq (,$(XPLATFORM))
192238
XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm)
193-
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
239+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
194240
endif # 3.2
195241
endif # 3
196242
endif
197243

198244
define MSG_PLATFORM
199-
No platform matched pattern '$(DEVICE)'.
245+
No platform matched pattern '$(PLATFORM)'.
200246
Available platforms are: $(XPLATFORMS)
201-
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point DEVICE variable to the full path of platform .xpfm file.
247+
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file.
202248
endef
203249
export MSG_PLATFORM
204250

205-
define MSG_DEVICE
206-
More than one platform matched: $(XPLATFORM)
207-
Please set DEVICE variable more accurately to select only one platform file, or set DEVICE variable to the full path of the platform .xpfm file.
208-
endef
209-
export MSG_DEVICE
210251

211252
.PHONY: check_platform
212253
check_platform:
213254
ifeq (,$(XPLATFORM))
214255
@echo "$${MSG_PLATFORM}" && false
215256
endif
216-
ifneq (,$(word 2,$(XPLATFORM)))
217-
@echo "$${MSG_DEVICE}" && false
218-
endif
219257
#Check ends
220258

221259
# device2xsa - create a filesystem friendly name from device name
222260
# $(1) - full name of device
223-
device2xsa = $(strip $(patsubst %.xpfm, % , $(shell basename $(DEVICE))))
261+
PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM))))
262+
224263

225264
# Cleaning stuff
226265
RM = rm -f

0 commit comments

Comments
 (0)