|
@@ -168,12 +168,32 @@ static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx,
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+
|
|
|
|
+static long afu_ioctl_get_features(struct ocxl_context *ctx,
|
|
|
|
+ struct ocxl_ioctl_features __user *uarg)
|
|
|
|
+{
|
|
|
|
+ struct ocxl_ioctl_features arg;
|
|
|
|
+
|
|
|
|
+ memset(&arg, 0, sizeof(arg));
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_PPC64
|
|
|
|
+ if (cpu_has_feature(CPU_FTR_P9_TIDR))
|
|
|
|
+ arg.flags[0] |= OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ if (copy_to_user(uarg, &arg, sizeof(arg)))
|
|
|
|
+ return -EFAULT;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
#define CMD_STR(x) (x == OCXL_IOCTL_ATTACH ? "ATTACH" : \
|
|
#define CMD_STR(x) (x == OCXL_IOCTL_ATTACH ? "ATTACH" : \
|
|
x == OCXL_IOCTL_IRQ_ALLOC ? "IRQ_ALLOC" : \
|
|
x == OCXL_IOCTL_IRQ_ALLOC ? "IRQ_ALLOC" : \
|
|
x == OCXL_IOCTL_IRQ_FREE ? "IRQ_FREE" : \
|
|
x == OCXL_IOCTL_IRQ_FREE ? "IRQ_FREE" : \
|
|
x == OCXL_IOCTL_IRQ_SET_FD ? "IRQ_SET_FD" : \
|
|
x == OCXL_IOCTL_IRQ_SET_FD ? "IRQ_SET_FD" : \
|
|
x == OCXL_IOCTL_GET_METADATA ? "GET_METADATA" : \
|
|
x == OCXL_IOCTL_GET_METADATA ? "GET_METADATA" : \
|
|
x == OCXL_IOCTL_ENABLE_P9_WAIT ? "ENABLE_P9_WAIT" : \
|
|
x == OCXL_IOCTL_ENABLE_P9_WAIT ? "ENABLE_P9_WAIT" : \
|
|
|
|
+ x == OCXL_IOCTL_GET_FEATURES ? "GET_FEATURES" : \
|
|
"UNKNOWN")
|
|
"UNKNOWN")
|
|
|
|
|
|
static long afu_ioctl(struct file *file, unsigned int cmd,
|
|
static long afu_ioctl(struct file *file, unsigned int cmd,
|
|
@@ -239,6 +259,11 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ case OCXL_IOCTL_GET_FEATURES:
|
|
|
|
+ rc = afu_ioctl_get_features(ctx,
|
|
|
|
+ (struct ocxl_ioctl_features __user *) args);
|
|
|
|
+ break;
|
|
|
|
+
|
|
default:
|
|
default:
|
|
rc = -EINVAL;
|
|
rc = -EINVAL;
|
|
}
|
|
}
|