Skip to content

Commit

Permalink
Squashed 'security' changes from 9ba8ba0..2079b9b (#576)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
2 people authored and GitHub Enterprise committed Apr 18, 2022
1 parent 665afd5 commit 88205d1
Show file tree
Hide file tree
Showing 231 changed files with 14,073 additions and 6,181 deletions.
4 changes: 2 additions & 2 deletions security/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('pipeline-library')_
VitisLibPipeline (branch: 'next', libname: 'xf_security', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
VitisLibPipeline (branch: 'next', libname: 'xf_security', TARGETS: 'hls_csim:hls_cosim:vivado_syn:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
upstream_dependencies: 'xf_utils_hw,next,../utils',
email: '[email protected]', devtest: 'RunDeploy.sh', TOOLVERSION: '2021.2_stable_latest')
devtest: 'RunDeploy.sh', TOOLVERSION: '2022.1_stable_latest')
363 changes: 236 additions & 127 deletions security/L1/benchmarks/adler32/Makefile

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions security/L1/benchmarks/adler32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ The steps for library download and environment setup can be found in :ref:`l1_vi
* **Build kernel(Step 2)**


Please check you've installed openSSL and make sure that its version is 1.0.2 or higher. Command to check openSSL version:

```
openssl version
```

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.

```
Expand Down
6 changes: 3 additions & 3 deletions security/L1/benchmarks/adler32/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"name": "Xilinx Adler32 Benchmark",
"description": "Adler32 checksum algorithm benchmark",
"flow": "vitis",
"platform_whitelist": [
"platform_allowlist": [
"u50",
"aws-vu9p-f1"
],
"platform_blacklist": [
"platform_blocklist": [
"zc"
],
"platform_properties": {
"u50": {
"v++": {
"compiler": {
"cflags": [
"clflags": [
"--config PROJECT/conn_u50.cfg"
]
}
Expand Down
153 changes: 96 additions & 57 deletions security/L1/benchmarks/adler32/utils.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019-2021 Xilinx, Inc.
# Copyright 2019-2022 Xilinx, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,6 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# vitis makefile-generator v2.0.6
#
#+-------------------------------------------------------------------------------
# The following parameters are assigned with default values. These parameters can
Expand Down Expand Up @@ -39,17 +40,59 @@ ifeq ($(DEBUG), yes)
VPP_LDFLAGS += --dk protocol:all:all:all
endif

#Checks for XILINX_XRT
ifeq ($(HOST_ARCH), x86)
#Check environment setup
ifndef XILINX_VITIS
XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION)
export XILINX_VITIS
endif
ifndef XILINX_XRT
XILINX_XRT = /opt/xilinx/xrt
export XILINX_XRT
endif

check_device:
@set -eu; \
inallowlist=False; \
inblocklist=False; \
for dev in $(PLATFORM_ALLOWLIST); \
do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \
then inallowlist=True; fi; \
done ;\
for dev in $(PLATFORM_BLOCKLIST); \
do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \
then inblocklist=True; fi; \
done ;\
if [[ $$inallowlist == False ]]; \
then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \
fi; \
if [[ $$inblocklist == True ]]; \
then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\
fi;

#get HOST_ARCH by PLATFORM
ifneq (,$(PLATFORM))
HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
ifeq ($(HOST_ARCH_temp), x86)
HOST_ARCH := x86
else ifeq ($(HOST_ARCH_temp), cortex-a9)
HOST_ARCH := aarch32
else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp)))
HOST_ARCH := aarch64
endif
endif


#get suffix of kernel by PLATFORM
VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
ifeq ($(DEVICE_TYPE), versal)
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
LINK_TARGET_FMT := xsa
else
ifndef XILINX_VITIS
XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION)
export XILINX_VITIS
LINK_TARGET_FMT := xclbin
endif
else
LINK_TARGET_FMT := xclbin
endif

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

B_NAME = $(shell dirname $(XPLATFORM))

#Checks for Correct architecture
ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86))
$(error HOST_ARCH variable not set, please set correctly and rerun)
endif

check_version:
ifneq (, $(shell which git))
ifneq (,$(wildcard $(XFLIB_DIR)/.git))
@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 -
endif
endif

#Checks for SYSROOT
check_sysroot:
ifneq ($(HOST_ARCH), x86)
Expand All @@ -74,25 +122,24 @@ ifndef SYSROOT
endif
endif

check_version:
ifneq (, $(shell which git))
ifneq (,$(wildcard $(XFLIB_DIR)/.git))
@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 -
endif
endif

#Checks for g++
CXX := g++
ifeq ($(HOST_ARCH), x86)
ifneq ($(shell expr $(shell g++ -dumpversion) \>= 5), 1)
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
CXX_VER := 8.3.0
else
CXX_VER := 6.2.0
endif
CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}')
ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1)
ifndef XILINX_VIVADO
$(error [ERROR]: g++ version too old. Please use 5.0 or above)
$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above)
else
CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/bin/g++
CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++
ifeq ($(LD_LIBRARY_PATH),)
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/lib64
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64
else
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/lib64:$(LD_LIBRARY_PATH)
export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH)
endif
$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX))
endif
Expand All @@ -103,20 +150,32 @@ else ifeq ($(HOST_ARCH), aarch32)
CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++
endif

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

ifeq ($(OSDIST), centos)
# for centos and redhat
ifneq ($(findstring centos,$(OSDIST)),)
ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' ))
ifeq ($(HOST_ARCH), x86)
XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
endif
endif
else ifneq ($(findstring redhat,$(OSDIST)),)
ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' ))
CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
ifeq ($(HOST_ARCH), x86)
XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
endif
endif
endif

#Setting VPP
VPP := v++

#Cheks for aiecompiler
AIECXX := aiecompiler
AIESIMULATOR := aiesimulator
X86SIMULATOR := x86simulator

.PHONY: check_vivado
check_vivado:
Expand All @@ -132,11 +191,9 @@ endif

.PHONY: check_xrt
check_xrt:
ifeq ($(HOST_ARCH), x86)
ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so))
@echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false
endif
endif

export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH)
ifeq ($(HOST_ARCH), x86)
Expand All @@ -145,82 +202,64 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib
else
LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH)
endif
else # aarch64
ifeq (,$(LD_LIBRARY_PATH))
LD_LIBRARY_PATH := $(SYSROOT)/usr/lib
else
LD_LIBRARY_PATH := $(SYSROOT)/usr/lib:$(LD_LIBRARY_PATH)
endif
endif

# check target
ifeq ($(filter $(TARGET),sw_emu hw_emu hw),)
$(error TARGET is not sw_emu, hw_emu or hw)
endif

ifneq (,$(wildcard $(DEVICE)))
# Use DEVICE as a file path
XPLATFORM := $(DEVICE)
ifneq (,$(wildcard $(PLATFORM)))
# Use PLATFORM as a file path
XPLATFORM := $(PLATFORM)
else
# Use DEVICE as a file name pattern
# Use PLATFORM as a file name pattern
# 1. search paths specified by variable
ifneq (,$(PLATFORM_REPO_PATHS))
# 1.1 as exact name
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(DEVICE)/$(DEVICE).xpfm)))
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm)))
# 1.2 as a pattern
ifeq (,$(XPLATFORM))
XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm))
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
endif # 1.2
endif # 1
# 2. search Vitis installation
ifeq (,$(XPLATFORM))
# 2.1 as exact name
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE)/$(DEVICE).xpfm))
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
# 2.2 as a pattern
ifeq (,$(XPLATFORM))
XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm)
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
endif # 2.2
endif # 2
# 3. search default locations
ifeq (,$(XPLATFORM))
# 3.1 as exact name
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(DEVICE)/$(DEVICE).xpfm))
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
# 3.2 as a pattern
ifeq (,$(XPLATFORM))
XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm)
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
endif # 3.2
endif # 3
endif

define MSG_PLATFORM
No platform matched pattern '$(DEVICE)'.
No platform matched pattern '$(PLATFORM)'.
Available platforms are: $(XPLATFORMS)
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point DEVICE variable to the full path of platform .xpfm file.
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file.
endef
export MSG_PLATFORM

define MSG_DEVICE
More than one platform matched: $(XPLATFORM)
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.
endef
export MSG_DEVICE

.PHONY: check_platform
check_platform:
ifeq (,$(XPLATFORM))
@echo "$${MSG_PLATFORM}" && false
endif
ifneq (,$(word 2,$(XPLATFORM)))
@echo "$${MSG_DEVICE}" && false
endif
#Check ends

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


# Cleaning stuff
RM = rm -f
Expand Down
Loading

0 comments on commit 88205d1

Please sign in to comment.