Skip to content

Commit

Permalink
Squashed 'security' changes from 3d03602..a4cab30 (#840)
Browse files Browse the repository at this point in the history
a4cab30 update release note to record sc cases failure on centos 7.9 (Xilinx#221)
9bc3d4e Merge pull request Xilinx#220 from liyuanz/update_makefile
7beee74 update
0477f1c update
4e69ff5 update
7bbf7c9 Merge pull request Xilinx#219 from liyuanz/next
e9bf63d update
839a75d Revise aes.hpp of decryption (Xilinx#210)
d1f6764 Add a low resource ecdsa design implementation. (Xilinx#215)

Co-authored-by: sdausr <[email protected]>
  • Loading branch information
2 people authored and GitHub Enterprise committed Apr 26, 2023
1 parent 87e7cbe commit 8e34925
Show file tree
Hide file tree
Showing 324 changed files with 5,450 additions and 2,355 deletions.
62 changes: 40 additions & 22 deletions security/L1/benchmarks/adler32/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2019-2022 Xilinx, Inc.
# Copyright (C) 2019-2022, Xilinx, Inc.
# Copyright (C) 2022-2023, Advanced Micro Devices, 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 @@ -11,7 +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.8
# vitis makefile-generator v2.0.9

############################## Help Section ##############################
.PHONY: help
Expand All @@ -35,15 +36,15 @@ help::
$(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p "
$(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz"
$(ECHO) " export SYSROOT=< path-to-platform-sysroot >"
$(ECHO) " b. User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: "
$(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: "
$(ECHO) " export SYSROOT=< path-to-platform-sysroot >"
$(ECHO) " export K_IMAGE=< path-to-Image-files >"
$(ECHO) " export ROOTFS=< path-to-rootfs >"
$(ECHO) ""
$(ECHO) " make clean "
$(ECHO) " Command to remove the generated non-hardware files."
$(ECHO) ""
$(ECHO) " make cleanall"
$(ECHO) " make cleanall TARGET=<hw/hw_emu/sw_emu/>"
$(ECHO) " Command to remove all the generated files."
$(ECHO) ""

Expand Down Expand Up @@ -102,12 +103,6 @@ CXXFLAGS += $(EXTRA_CXXFLAGS)
VPP_FLAGS += $(EXTRA_VPP_FLAGS)

########################## Setting up Host Variables ##########################
ifeq ($(TARGET),sw_emu)
CXXFLAGS += -D SW_EMU_TEST
endif
ifeq ($(TARGET),hw_emu)
CXXFLAGS += -D HW_EMU_TEST
endif

#Inclue Required Host Source Files
ifeq ($(ps_on_x86), on)
Expand All @@ -127,7 +122,7 @@ endif

EXE_NAME := host.exe
EXE_FILE := $(BUILD_DIR)/$(EXE_NAME)
EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS)
EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS)

HOST_ARGS := -xclbin $(BUILD_DIR)/Adler32Kernel.xclbin -data $(CUR_DIR)/data/test.dat -num 16
ifneq ($(HOST_ARCH), x86)
Expand Down Expand Up @@ -201,8 +196,8 @@ endif
@echo 'fi' >> $(RUN_SCRIPT)
@echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT)
@echo 'exit $$return_code' >> $(RUN_SCRIPT)
DATA_FILE :=
DATA_DIR :=
DATA_FILE := $(custom_data_file)
DATA_DIR := $(custom_data_dir)
SD_FILES += $(RUN_SCRIPT)
SD_FILES += $(EXE_FILE)
SD_FILES += $(EMCONFIG)
Expand All @@ -228,13 +223,21 @@ ifeq ($(ps_on_x86), on)
@echo "### ***** running PS X86 SE_EMU ***** ###"
$(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86
endif
#3. General Embeded flow
# 3. AIE_ON_X86 Flow
ifeq ($(pcie_aie), on)
@echo "### ***** running AIE ON_X86 ***** ###"
${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi
@echo "### ***** sd_card generation done! ***** ###"
endif
# 4. General Embeded flow
ifeq ($(dfx_hw), off)
ifeq ($(ps_on_x86), off)
ifeq ($(pcie_aie), off)
$(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX)
@echo "### ***** sd_card generation done! ***** ###"
endif
endif
endif

.PHONY: sd_card
sd_card: $(SD_CARD)
Expand All @@ -248,17 +251,26 @@ mkflag:
mkdir -p $(BUILD_DIR)
rm -rf $(BUILD_DIR)/makefile_args.txt
@for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done

all: check_device check_vpp check_platform mkflag $(RUN_DEPS)

run: all
#hw_emu
ifneq (,$(filter hw_emu, $(TARGET)))
ifeq ($(HOST_ARCH), x86)
ifeq ($(pcie_aie), on)
cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./
cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./
LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \
XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG)

endif
LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \
XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS)

else
@echo $(RUN_DEPS)
$(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT))
$(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT))
grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1

endif
Expand All @@ -271,7 +283,7 @@ ifeq ($(HOST_ARCH), x86)

else
@echo $(RUN_DEPS)
$(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT))
$(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT))
grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1

endif
Expand All @@ -298,7 +310,7 @@ endif

############################## Setting Targets ##############################

.PHONY: clean cleanall emconfig
.PHONY: clean cleanall emconfig gen_instances valid_params
emconfig: $(EMCONFIG)

.PHONY: host
Expand All @@ -315,18 +327,24 @@ else
xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS)
endif

gen_instances: $(INSTANCE_FILES)
@echo "Nothing to generate."

valid_params:
@echo "Nothing to validate."

############################## Cleaning Rules ##############################
cleanh:
-$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/
-$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png
-$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES)
-$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db

cleank:
-$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin
-$(RMDIR) _x_temp.*
-$(RMDIR) _x_temp.* _x* $(INST_FILES)

cleanall: cleanh cleank
-$(RMDIR) $(BUILD_DIR) emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str
-$(RMDIR) $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut
-$(RMDIR)
-$(RMDIR) $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut
-$(RMDIR) *.html $(INSTANCE_FILES)

clean: cleanh
153 changes: 85 additions & 68 deletions security/L1/benchmarks/adler32/utils.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019-2022 Xilinx, Inc.
# Copyright (C) 2019-2022, Xilinx, Inc.
# Copyright (C) 2022-2023, Advanced Micro Devices, 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,7 +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.7
# vitis makefile-generator v2.0.9
#
#+-------------------------------------------------------------------------------
# The following parameters are assigned with default values. These parameters can
Expand All @@ -23,6 +23,9 @@ REPORT := no
PROFILE := no
DEBUG := no

#Get PLATFORM_NAME by PLATFORM
PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM))))

#'estimate' for estimate report generation
#'system' for system report generation
ifneq ($(REPORT), no)
Expand Down Expand Up @@ -66,25 +69,86 @@ check_device:
then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\
fi;

ifneq (,$(wildcard $(PLATFORM)))
# Use PLATFORM as a file path
XPLATFORM := $(PLATFORM)
else
# 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)/$(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 ~ /$(PLATFORM)/')))
endif # 1.2
endif # 1
# 2. search Vitis installation
ifeq (,$(XPLATFORM))
# 2.1 as exact name vitis < 2022.2
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
ifeq (,$(XPLATFORM))
# 2.2 as exact name vitis >= 2022.2
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(PLATFORM)/$(PLATFORM).xpfm))
# 2.3 as a pattern vitis < 2022.2
ifeq (,$(XPLATFORM))
XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm)
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
# 2.4 as a pattern vitis >= 2022.2
ifeq (,$(XPLATFORM))
XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm)
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
endif # 2.4
endif # 2.3
endif # 2.2
endif # 2
# 3. search default locations
ifeq (,$(XPLATFORM))
# 3.1 as exact name
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 ~ /$(PLATFORM)/')))
endif # 3.2
endif # 3
endif

define MSG_PLATFORM
No platform matched pattern '$(PLATFORM)'.
Available platforms are: $(XPLATFORMS)
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

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

#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:]]*//')
HOST_ARCH_temp = $(shell platforminfo -p $(XPLATFORM) | 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



# Special processing for tool version/platform type
VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
# 1) for versal flow from 2022.1
DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
ifeq ($(DEVICE_TYPE), versal)
AIE_TYPE := $(shell platforminfo $(XPLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g')
ifeq (AIE ,$(findstring AIE, $(AIE_TYPE)))
HAS_AIE := on
else
HAS_AIE := off
endif
# 1) for aie flow from 2022.1
ifeq (on, $(HAS_AIE))
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
LINK_TARGET_FMT := xsa
else
Expand All @@ -110,6 +174,13 @@ HOST_ARCH := x86
endif
endif
endif
# 4) for aie on x86 flow
pcie_aie := off
ifeq ($(HOST_ARCH), x86)
ifeq ($(HAS_AIE), on)
pcie_aie := on
endif
endif

#when x86 arch, check XRT setup
ifeq ($(HOST_ARCH), x86)
Expand All @@ -129,6 +200,9 @@ endif
ifeq ($(ps_on_x86), on)
SD_CARD_NEEDED := on
endif
ifeq ($(pcie_aie), on)
SD_CARD_NEEDED := on
endif

#Checks for Device Family
ifeq ($(HOST_ARCH), aarch32)
Expand Down Expand Up @@ -262,63 +336,6 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH)
endif
endif

ifneq (,$(wildcard $(PLATFORM)))
# Use PLATFORM as a file path
XPLATFORM := $(PLATFORM)
else
# 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)/$(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 ~ /$(PLATFORM)/')))
endif # 1.2
endif # 1
# 2. search Vitis installation
ifeq (,$(XPLATFORM))
# 2.1 as exact name
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 ~ /$(PLATFORM)/')))
endif # 2.2
endif # 2
# 3. search default locations
ifeq (,$(XPLATFORM))
# 3.1 as exact name
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 ~ /$(PLATFORM)/')))
endif # 3.2
endif # 3
endif

define MSG_PLATFORM
No platform matched pattern '$(PLATFORM)'.
Available platforms are: $(XPLATFORMS)
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


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

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


# Cleaning stuff
RM = rm -f
RMDIR = rm -rf
Expand Down
Loading

0 comments on commit 8e34925

Please sign in to comment.