19
19
#include <linux/version.h>
20
20
#include <linux/eventfd.h>
21
21
#include <linux/uuid.h>
22
+ #include <linux/delay.h>
22
23
#if LINUX_VERSION_CODE >= KERNEL_VERSION (3 , 7 , 0 )
23
24
#include <linux/hashtable.h>
24
25
#endif
@@ -538,6 +539,32 @@ xocl_resolver(struct xocl_dev *xdev, struct axlf *axlf, xuid_t *xclbin_id,
538
539
return ret ;
539
540
}
540
541
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
+
541
568
int
542
569
xocl_read_axlf_helper (struct xocl_drm * drm_p , struct drm_xocl_axlf * axlf_ptr ,
543
570
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,
555
582
void * ulp_blob ;
556
583
void * kernels ;
557
584
int rc = 0 ;
585
+ struct xocl_dev_core * core = XDEV (drm_p -> xdev );
558
586
559
587
if (!xocl_is_unified (xdev )) {
560
588
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,
766
794
767
795
userpf_err (xdev , "Failed to download xclbin, err: %ld\n" , err );
768
796
}
769
- else
797
+ else {
770
798
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
+ }
771
805
772
806
out_done :
773
807
/* Update the slot */
0 commit comments