]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/misc/cxl/sysfs.c
Merge tag 'powerpc-4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
[linux.git] / drivers / misc / cxl / sysfs.c
index a8b6d6a635e962b057325d9d5d6af96382474eba..95285b7f636ff3f854876e5743658f91d88c3e3d 100644 (file)
@@ -62,7 +62,19 @@ static ssize_t psl_timebase_synced_show(struct device *device,
                                        char *buf)
 {
        struct cxl *adapter = to_cxl_adapter(device);
+       u64 psl_tb, delta;
 
+       /* Recompute the status only in native mode */
+       if (cpu_has_feature(CPU_FTR_HVMODE)) {
+               psl_tb = adapter->native->sl_ops->timebase_read(adapter);
+               delta = abs(mftb() - psl_tb);
+
+               /* CORE TB and PSL TB difference <= 16usecs ? */
+               adapter->psl_timebase_synced = (tb_to_ns(delta) < 16000) ? true : false;
+               pr_devel("PSL timebase %s - delta: 0x%016llx\n",
+                        (tb_to_ns(delta) < 16000) ? "synchronized" :
+                        "not synchronized", tb_to_ns(delta));
+       }
        return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced);
 }