static int __init disabled_on_cmdline(void) { unsigned long root, chosen; const char *p; root = of_get_flat_dt_root(); chosen = of_get_flat_dt_subnode_by_name(root, "chosen"); if (chosen == -FDT_ERR_NOTFOUND) return false; p = of_get_flat_dt_prop(chosen, "bootargs", NULL); if (!p) return false; if (strstr(p, "dt_cpu_ftrs=off")) return true; return false; }
/* * If we're running under a hypervisor, we need to check the contents of * /chosen/ibm,architecture-vec-5 to see if the hypervisor is willing to do * radix. If not, we clear the radix feature bit so we fall back to hash. */ static void __init early_check_vec5(void) { unsigned long root, chosen; int size; const u8 *vec5; u8 mmu_supported; root = of_get_flat_dt_root(); chosen = of_get_flat_dt_subnode_by_name(root, "chosen"); if (chosen == -FDT_ERR_NOTFOUND) { cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; return; } vec5 = of_get_flat_dt_prop(chosen, "ibm,architecture-vec-5", &size); if (!vec5) { cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; return; } if (size <= OV5_INDX(OV5_MMU_SUPPORT)) { cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; return; } /* Check for supported configuration */ mmu_supported = vec5[OV5_INDX(OV5_MMU_SUPPORT)] & OV5_FEAT(OV5_MMU_SUPPORT); if (mmu_supported == OV5_FEAT(OV5_MMU_RADIX)) { /* Hypervisor only supports radix - check enabled && GTSE */ if (!early_radix_enabled()) { pr_warn("WARNING: Ignoring cmdline option disable_radix\n"); } if (!(vec5[OV5_INDX(OV5_RADIX_GTSE)] & OV5_FEAT(OV5_RADIX_GTSE))) { pr_warn("WARNING: Hypervisor doesn't support RADIX with GTSE\n"); } /* Do radix anyway - the hypervisor said we had to */ cur_cpu_spec->mmu_features |= MMU_FTR_TYPE_RADIX; } else if (mmu_supported == OV5_FEAT(OV5_MMU_HASH)) { /* Hypervisor only supports hash - disable radix */ cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; } }