#include <linux/of.h>
 
 #include <asm/cputhreads.h>
+#include <asm/firmware.h>
 #include <asm/reg.h>
 #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */
 
                return -ENODEV;
        }
 
-       WARN_ON(len_ids != len_freqs);
+       if (len_ids != len_freqs) {
+               pr_warn("Entries in ibm,pstate-ids and "
+                       "ibm,pstate-frequencies-mhz does not match\n");
+       }
+
        nr_pstates = min(len_ids, len_freqs) / sizeof(u32);
        if (!nr_pstates) {
                pr_warn("No PStates found\n");
        int i;
 
        i = powernv_pstate_info.max - pstate_id;
-       BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0);
+       if (i >= powernv_pstate_info.nr_pstates || i < 0) {
+               pr_warn("PState id %d outside of PState table, "
+                       "reporting nominal id %d instead\n",
+                       pstate_id, powernv_pstate_info.nominal);
+               i = powernv_pstate_info.max - powernv_pstate_info.nominal;
+       }
 
        return powernv_freqs[i].frequency;
 }
 {
        int rc = 0;
 
+       /* Don't probe on pseries (guest) platforms */
+       if (!firmware_has_feature(FW_FEATURE_OPALv3))
+               return -ENODEV;
+
        /* Discover pstates from device tree and init */
        rc = init_powernv_pstates();
        if (rc) {