Skip to content

Commit 09bc24e

Browse files
porting AWS F2 work around changes to 2024.1 (#8607)
* 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>
1 parent 212dcae commit 09bc24e

File tree

1 file changed

+35
-1
lines changed
  • src/runtime_src/core/pcie/driver/linux/xocl/userpf

1 file changed

+35
-1
lines changed

src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_ioctl.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/version.h>
2020
#include <linux/eventfd.h>
2121
#include <linux/uuid.h>
22+
#include <linux/delay.h>
2223
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
2324
#include <linux/hashtable.h>
2425
#endif
@@ -538,6 +539,32 @@ xocl_resolver(struct xocl_dev *xdev, struct axlf *axlf, xuid_t *xclbin_id,
538539
return ret;
539540
}
540541

542+
/* This is a Workaround function for AWS F2 to reset the clock registers.
543+
* This function also incurs a delay of 10seconds to work around AWS ocl timeout issue.
544+
* These changes will be removed once the issue is addressed in AWS F2 instance.
545+
*/
546+
void aws_reset_clock_registers(xdev_handle_t xdev)
547+
{
548+
struct xocl_dev_core *core = XDEV(xdev);
549+
resource_size_t bar0_clk1, bar0_clk2;
550+
void __iomem *vbar0_clk1, *vbar0_clk2;
551+
552+
userpf_info(xdev, "AWS F2 WA, waiting to reset clock registers after Load ");
553+
msleep(10000);
554+
555+
bar0_clk1 = pci_resource_start(core->pdev, 0) + 0x4058014;
556+
bar0_clk2 = pci_resource_start(core->pdev, 0) + 0x4058010;
557+
vbar0_clk1 = ioremap_nocache(bar0_clk1, 32);
558+
vbar0_clk2 = ioremap_nocache(bar0_clk2, 32);
559+
560+
iowrite32(0, vbar0_clk1);
561+
iowrite32(0, vbar0_clk2);
562+
563+
iounmap(vbar0_clk1);
564+
iounmap(vbar0_clk2);
565+
return;
566+
}
567+
541568
int
542569
xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,
543570
uint32_t qos, uint32_t *slot)
@@ -555,6 +582,7 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,
555582
void *ulp_blob;
556583
void *kernels;
557584
int rc = 0;
585+
struct xocl_dev_core *core = XDEV(drm_p->xdev);
558586

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

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

772806
out_done:
773807
/* Update the slot */

0 commit comments

Comments
 (0)