#define SF_CURR                1000            /* milliamperes */
 #define SF_VOLTAGE     1000            /* millivolts */
 #define SF_ENERGY      1000000         /* microjoules */
+#define SF_TIME                1000            /* milliseconds */
 
 /**
  * struct xe_hwmon_energy_info - to accumulate energy
        int scl_shift_power;
        /** @scl_shift_energy: pkg energy unit */
        int scl_shift_energy;
+       /** @scl_shift_time: pkg time unit */
+       int scl_shift_time;
        /** @ei: Energy info for energy1_input */
        struct xe_hwmon_energy_info ei;
 };
                                  hwmon->scl_shift_energy);
 }
 
+static ssize_t
+xe_hwmon_power1_max_interval_show(struct device *dev, struct device_attribute *attr,
+                                 char *buf)
+{
+       struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+       u32 x, y, x_w = 2; /* 2 bits */
+       u64 r, tau4, out;
+
+       xe_device_mem_access_get(gt_to_xe(hwmon->gt));
+
+       mutex_lock(&hwmon->hwmon_lock);
+
+       xe_hwmon_process_reg(hwmon, REG_PKG_RAPL_LIMIT,
+                            REG_READ32, &r, 0, 0);
+
+       mutex_unlock(&hwmon->hwmon_lock);
+
+       xe_device_mem_access_put(gt_to_xe(hwmon->gt));
+
+       x = REG_FIELD_GET(PKG_PWR_LIM_1_TIME_X, r);
+       y = REG_FIELD_GET(PKG_PWR_LIM_1_TIME_Y, r);
+
+       /*
+        * tau = 1.x * power(2,y), x = bits(23:22), y = bits(21:17)
+        *     = (4 | x) << (y - 2)
+        *
+        * Here (y - 2) ensures a 1.x fixed point representation of 1.x
+        * As x is 2 bits so 1.x can be 1.0, 1.25, 1.50, 1.75
+        *
+        * As y can be < 2, we compute tau4 = (4 | x) << y
+        * and then add 2 when doing the final right shift to account for units
+        */
+       tau4 = ((1 << x_w) | x) << y;
+
+       /* val in hwmon interface units (millisec) */
+       out = mul_u64_u32_shr(tau4, SF_TIME, hwmon->scl_shift_time + x_w);
+
+       return sysfs_emit(buf, "%llu\n", out);
+}
+
+static ssize_t
+xe_hwmon_power1_max_interval_store(struct device *dev, struct device_attribute *attr,
+                                  const char *buf, size_t count)
+{
+       struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+       u32 x, y, rxy, x_w = 2; /* 2 bits */
+       u64 tau4, r, max_win;
+       unsigned long val;
+       int ret;
+
+       ret = kstrtoul(buf, 0, &val);
+       if (ret)
+               return ret;
+
+       /*
+        * Max HW supported tau in '1.x * power(2,y)' format, x = 0, y = 0x12.
+        * The hwmon->scl_shift_time default of 0xa results in a max tau of 256 seconds.
+        *
+        * The ideal scenario is for PKG_MAX_WIN to be read from the PKG_PWR_SKU register.
+        * However, it is observed that existing discrete GPUs does not provide correct
+        * PKG_MAX_WIN value, therefore a using default constant value. For future discrete GPUs
+        * this may get resolved, in which case PKG_MAX_WIN should be obtained from PKG_PWR_SKU.
+        */
+#define PKG_MAX_WIN_DEFAULT 0x12ull
+
+       /*
+        * val must be < max in hwmon interface units. The steps below are
+        * explained in xe_hwmon_power1_max_interval_show()
+        */
+       r = FIELD_PREP(PKG_MAX_WIN, PKG_MAX_WIN_DEFAULT);
+       x = REG_FIELD_GET(PKG_MAX_WIN_X, r);
+       y = REG_FIELD_GET(PKG_MAX_WIN_Y, r);
+       tau4 = ((1 << x_w) | x) << y;
+       max_win = mul_u64_u32_shr(tau4, SF_TIME, hwmon->scl_shift_time + x_w);
+
+       if (val > max_win)
+               return -EINVAL;
+
+       /* val in hw units */
+       val = DIV_ROUND_CLOSEST_ULL((u64)val << hwmon->scl_shift_time, SF_TIME);
+
+       /*
+        * Convert val to 1.x * power(2,y)
+        * y = ilog2(val)
+        * x = (val - (1 << y)) >> (y - 2)
+        */
+       if (!val) {
+               y = 0;
+               x = 0;
+       } else {
+               y = ilog2(val);
+               x = (val - (1ul << y)) << x_w >> y;
+       }
+
+       rxy = REG_FIELD_PREP(PKG_PWR_LIM_1_TIME_X, x) | REG_FIELD_PREP(PKG_PWR_LIM_1_TIME_Y, y);
+
+       xe_device_mem_access_get(gt_to_xe(hwmon->gt));
+
+       mutex_lock(&hwmon->hwmon_lock);
+
+       xe_hwmon_process_reg(hwmon, REG_PKG_RAPL_LIMIT, REG_RMW32, (u64 *)&r,
+                            PKG_PWR_LIM_1_TIME, rxy);
+
+       mutex_unlock(&hwmon->hwmon_lock);
+
+       xe_device_mem_access_put(gt_to_xe(hwmon->gt));
+
+       return count;
+}
+
+static SENSOR_DEVICE_ATTR(power1_max_interval, 0664,
+                         xe_hwmon_power1_max_interval_show,
+                         xe_hwmon_power1_max_interval_store, 0);
+
+static struct attribute *hwmon_attributes[] = {
+       &sensor_dev_attr_power1_max_interval.dev_attr.attr,
+       NULL
+};
+
+static umode_t xe_hwmon_attributes_visible(struct kobject *kobj,
+                                          struct attribute *attr, int index)
+{
+       struct device *dev = kobj_to_dev(kobj);
+       struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+       int ret = 0;
+
+       xe_device_mem_access_get(gt_to_xe(hwmon->gt));
+
+       if (attr == &sensor_dev_attr_power1_max_interval.dev_attr.attr)
+               ret = xe_hwmon_get_reg(hwmon, REG_PKG_RAPL_LIMIT) ? attr->mode : 0;
+
+       xe_device_mem_access_put(gt_to_xe(hwmon->gt));
+
+       return ret;
+}
+
+static const struct attribute_group hwmon_attrgroup = {
+       .attrs = hwmon_attributes,
+       .is_visible = xe_hwmon_attributes_visible,
+};
+
+static const struct attribute_group *hwmon_groups[] = {
+       &hwmon_attrgroup,
+       NULL
+};
+
 static const struct hwmon_channel_info *hwmon_info[] = {
        HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_CRIT),
        HWMON_CHANNEL_INFO(curr, HWMON_C_CRIT),
                                     REG_READ32, &val_sku_unit, 0, 0);
                hwmon->scl_shift_power = REG_FIELD_GET(PKG_PWR_UNIT, val_sku_unit);
                hwmon->scl_shift_energy = REG_FIELD_GET(PKG_ENERGY_UNIT, val_sku_unit);
+               hwmon->scl_shift_time = REG_FIELD_GET(PKG_TIME_UNIT, val_sku_unit);
        }
 
        /*
        /*  hwmon_dev points to device hwmon<i> */
        hwmon->hwmon_dev = devm_hwmon_device_register_with_info(dev, "xe", hwmon,
                                                                &hwmon_chip_info,
-                                                               NULL);
+                                                               hwmon_groups);
+
        if (IS_ERR(hwmon->hwmon_dev)) {
                drm_warn(&xe->drm, "Failed to register xe hwmon (%pe)\n", hwmon->hwmon_dev);
                xe->hwmon = NULL;