Skip to content

Commit

Permalink
porting AWS F2 work around changes to 2024.1 (#8607)
Browse files Browse the repository at this point in the history
* Fix errors in PR 8361

* porting AWS F2 work around changes to 2024.1

Signed-off-by: karthik dmg <[email protected]>

---------

Signed-off-by: karthik dmg <[email protected]>
Co-authored-by: rave <karthik>
  • Loading branch information
karthdmg-xilinx authored Nov 20, 2024
1 parent 212dcae commit 09bc24e
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/version.h>
#include <linux/eventfd.h>
#include <linux/uuid.h>
#include <linux/delay.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
#include <linux/hashtable.h>
#endif
Expand Down Expand Up @@ -538,6 +539,32 @@ xocl_resolver(struct xocl_dev *xdev, struct axlf *axlf, xuid_t *xclbin_id,
return ret;
}

/* This is a Workaround function for AWS F2 to reset the clock registers.
* This function also incurs a delay of 10seconds to work around AWS ocl timeout issue.
* These changes will be removed once the issue is addressed in AWS F2 instance.
*/
void aws_reset_clock_registers(xdev_handle_t xdev)
{
struct xocl_dev_core *core = XDEV(xdev);
resource_size_t bar0_clk1, bar0_clk2;
void __iomem *vbar0_clk1, *vbar0_clk2;

userpf_info(xdev, "AWS F2 WA, waiting to reset clock registers after Load ");
msleep(10000);

bar0_clk1 = pci_resource_start(core->pdev, 0) + 0x4058014;
bar0_clk2 = pci_resource_start(core->pdev, 0) + 0x4058010;
vbar0_clk1 = ioremap_nocache(bar0_clk1, 32);
vbar0_clk2 = ioremap_nocache(bar0_clk2, 32);

iowrite32(0, vbar0_clk1);
iowrite32(0, vbar0_clk2);

iounmap(vbar0_clk1);
iounmap(vbar0_clk2);
return;
}

int
xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,
uint32_t qos, uint32_t *slot)
Expand All @@ -555,6 +582,7 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,
void *ulp_blob;
void *kernels;
int rc = 0;
struct xocl_dev_core *core = XDEV(drm_p->xdev);

if (!xocl_is_unified(xdev)) {
userpf_err(xdev, "XOCL: not unified Shell\n");
Expand Down Expand Up @@ -766,8 +794,14 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,

userpf_err(xdev, "Failed to download xclbin, err: %ld\n", err);
}
else
else {
userpf_info(xdev, "Loaded xclbin %pUb", &bin_obj.m_header.uuid);
/* Work around added for AWS F2 Instance to perform delay and reset clock registers */
if(core->pdev->device == 0xf010)
{
aws_reset_clock_registers(xdev);
}
}

out_done:
/* Update the slot */
Expand Down

0 comments on commit 09bc24e

Please sign in to comment.