@@ -80,3 +80,24 @@ Description:
# echo "subsystem" > /sys/firmware/zynqmp/shutdown_scope
Users: Xilinx
+
+What: /sys/firmware/zynqmp/health_status
+Date: April 2018
+KernelVersion: 5.5
+Contact: "Rajan Vaja" <rajanv@xilinx.com>
+Description:
+ This sysfs interface allows to set the health status. If PMUFW
+ is compiled with CHECK_HEALTHY_BOOT, it will check the healthy
+ bit on FPD WDT expiration. If healthy bit is set by a user
+ application running in Linux, PMUFW will do APU only restart. If
+ healthy bit is not set during FPD WDT expiration, PMUFW will do
+ system restart.
+
+ Usage:
+ Set healthy bit
+ # echo 1 > /sys/firmware/zynqmp/health_status
+
+ Unset healthy bit
+ # echo 0 > /sys/firmware/zynqmp/health_status
+
+Users: Xilinx
@@ -477,6 +477,7 @@ static inline int zynqmp_is_valid_ioctl(u32 ioctl_id)
case IOCTL_READ_GGS:
case IOCTL_WRITE_PGGS:
case IOCTL_READ_PGGS:
+ case IOCTL_SET_BOOT_HEALTH_STATUS:
return 1;
default:
return 0;
@@ -861,8 +862,48 @@ static ssize_t shutdown_scope_store(struct device *device,
static DEVICE_ATTR_RW(shutdown_scope);
+/**
+ * health_status_store - Store health_status sysfs attribute
+ * @device: Device structure
+ * @attr: Device attribute structure
+ * @buf: User entered health_status attribute string
+ * @count: Buffer size
+ *
+ * User-space interface for setting the boot health status.
+ * Usage: echo <value> > /sys/firmware/zynqmp/health_status
+ *
+ * Value:
+ * 1 - Set healthy bit to 1
+ * 0 - Unset healthy bit
+ *
+ * Return: count argument if request succeeds, the corresponding error
+ * code otherwise
+ */
+static ssize_t health_status_store(struct device *device,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int ret;
+ unsigned int value;
+
+ ret = kstrtouint(buf, 10, &value);
+ if (ret)
+ return ret;
+
+ ret = zynqmp_pm_ioctl(0, IOCTL_SET_BOOT_HEALTH_STATUS, value, 0, NULL);
+ if (ret) {
+ pr_err("unable to set healthy bit value to %u\n", value);
+ return ret;
+ }
+
+ return count;
+}
+
+static DEVICE_ATTR_WO(health_status);
+
static struct attribute *zynqmp_attrs[] = {
&dev_attr_shutdown_scope.attr,
+ &dev_attr_health_status.attr,
NULL,
};
@@ -106,6 +106,8 @@ enum pm_ioctl_id {
IOCTL_READ_GGS,
IOCTL_WRITE_PGGS,
IOCTL_READ_PGGS,
+ /* Set healthy bit value */
+ IOCTL_SET_BOOT_HEALTH_STATUS = 17,
};
enum pm_query_id {