Skip to content

Commit

Permalink
2018.3 rc3 updates (Xilinx#2605)
Browse files Browse the repository at this point in the history
* fix 'download xilinx xclbin file on aws crash' issue (Xilinx#1749)

(cherry picked from commit 8654da1)

* 2018.3 (Xilinx#2449)

* fix 'download xilinx xclbin file on aws crash' issue

* add aws reclock support

(cherry picked from commit e154bac)
  • Loading branch information
rradjabi authored and maxzhen committed Dec 19, 2019
1 parent 014f560 commit f723d1d
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/runtime_src/driver/xclng/xrt/user_aws/shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ namespace awsbwhal {
axlf *axlfbuffer = reinterpret_cast<axlf*>(const_cast<xclBin*> (buffer));
fpga_mgmt_image_info orig_info;
char* afi_id = get_afi_from_axlf(axlfbuffer);

if (!afi_id)
return -EINVAL;

std::memset(&orig_info, 0, sizeof(struct fpga_mgmt_image_info));
fpga_mgmt_describe_local_image(mBoardNumber, &orig_info, 0);

Expand Down Expand Up @@ -927,9 +931,27 @@ namespace awsbwhal {
xclmgmt_ioc_freqscaling obj = {0, targetFreqMHz[0], targetFreqMHz[1], targetFreqMHz[2], 0};
return ioctl(mMgtHandle, XCLMGMT_IOCFREQSCALE, &obj);
#else
// # error "INTERNAL_TESTING macro disabled. AMZN code goes here. "
// # This API is not supported in AWS, the frequencies are set per AFI
return 0;
int retVal = 0;
fpga_mgmt_image_info orig_info;
std::memset(&orig_info, 0, sizeof(struct fpga_mgmt_image_info));
fpga_mgmt_describe_local_image(mBoardNumber, &orig_info, 0);
if(orig_info.status == FPGA_STATUS_LOADED) {
std::cout << "Reclock AFI(" << orig_info.ids.afi_id << ")" << std::endl;
union fpga_mgmt_load_local_image_options opt;
fpga_mgmt_init_load_local_image_options(&opt);
opt.afi_id = orig_info.ids.afi_id;
opt.slot_id = mBoardNumber;
opt.clock_mains[0] = targetFreqMHz[0];
opt.clock_mains[1] = targetFreqMHz[1];
opt.clock_mains[2] = targetFreqMHz[2];
retVal = fpga_mgmt_load_local_image_with_options(&opt);
if (retVal) {
std::cout << "Failed to load AFI with freq , error: " << retVal << std::endl;
return -retVal;
}
return retVal;
}
return 1;
#endif
}

Expand Down

0 comments on commit f723d1d

Please sign in to comment.