Lines Matching +full:reserved +full:- +full:cpu +full:- +full:vectors

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (C) 1996-2005 Paul Mackerras.
31 #include <linux/cpu.h>
49 #include <asm/pci-bridge.h>
94 * overlaps_initrd - check for overlap with page aligned extension of
111 * move_device_tree - move tree to an unused area, if needed.
122 DBG("-> move_device_tree\n"); in move_device_tree()
128 !memblock_is_memory(start + size - 1) || in move_device_tree()
139 DBG("<- move_device_tree\n"); in move_device_tree()
143 * ibm,pa/pi-features is a per-cpu property that contains a string of
147 * Second header byte is an "attribute-specifier" type, of which
148 * zero is the only currently-defined value.
150 * that we are interested in. The function will return -1 if the
151 * pa-features property is missing, or a 1/0 to indicate if the feature
153 * big-endian to match the definition in PAPR.
155 * ibm,pa/pi-features property, it does not set the feature if the
163 unsigned char pabyte; /* byte number in ibm,pa/pi-features */
164 unsigned char pabit; /* bit number (big-endian) */
192 * ibm,pi-features property provides the support of processor specific
193 * options not described in ibm,pa-features. Right now use byte 0, bit 3
218 tablelen -= len; in scan_features()
224 if (fp->pabyte >= ftrs[0]) in scan_features()
226 bit = (ftrs[2 + fp->pabyte] >> (7 - fp->pabit)) & 1; in scan_features()
227 if (bit && !fp->clear) { in scan_features()
228 cur_cpu_spec->cpu_features |= fp->cpu_features; in scan_features()
229 cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs; in scan_features()
230 cur_cpu_spec->cpu_user_features2 |= fp->cpu_user_ftrs2; in scan_features()
231 cur_cpu_spec->mmu_features |= fp->mmu_features; in scan_features()
232 } else if (bit == fp->clear) { in scan_features()
233 cur_cpu_spec->cpu_features &= ~fp->cpu_features; in scan_features()
234 cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs; in scan_features()
235 cur_cpu_spec->cpu_user_features2 &= ~fp->cpu_user_ftrs2; in scan_features()
236 cur_cpu_spec->mmu_features &= ~fp->mmu_features; in scan_features()
260 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL) ? : in init_mmu_slb_size()
261 of_get_flat_dt_prop(node, "ibm,slb-size", NULL); in init_mmu_slb_size()
305 pvr = cur_cpu_spec->pvr_value | 0x8; in identical_pvr_fixup()
321 prop = of_get_flat_dt_prop(node, fp->name, NULL); in check_cpu_feature_properties()
322 if (prop && be32_to_cpup(prop) >= fp->min_value) { in check_cpu_feature_properties()
323 cur_cpu_spec->cpu_features |= fp->cpu_feature; in check_cpu_feature_properties()
324 cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftr; in check_cpu_feature_properties()
339 int found = -1; in early_init_dt_scan_cpus()
342 /* We are scanning "cpu" nodes only */ in early_init_dt_scan_cpus()
343 if (type == NULL || strcmp(type, "cpu") != 0) in early_init_dt_scan_cpus()
350 intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len); in early_init_dt_scan_cpus()
357 * Now see if any of these threads match our boot cpu. in early_init_dt_scan_cpus()
367 /* logical cpu id is always 0 on UP kernels */ in early_init_dt_scan_cpus()
372 /* Not the boot CPU */ in early_init_dt_scan_cpus()
391 pr_warn("Boot CPU %d (core hwid %d) >= nr_cpu_ids, adjusted boot CPU to %d\n", in early_init_dt_scan_cpus()
394 // Adjust boot CPU to appear on logical core 0 in early_init_dt_scan_cpus()
398 DBG("boot cpu: logical %d physical %d\n", boot_cpuid, in early_init_dt_scan_cpus()
406 * If the cpu-version property in the cpu node contains in early_init_dt_scan_cpus()
408 * logical PVR value in order to use the cpu feature in early_init_dt_scan_cpus()
415 * If we're using device tree CPU feature discovery then we don't in early_init_dt_scan_cpus()
416 * support the cpu-version property, and it's the responsibility of the in early_init_dt_scan_cpus()
418 * architecture level via the ibm,powerpc-cpu-features binding. in early_init_dt_scan_cpus()
421 prop = of_get_flat_dt_prop(node, "cpu-version", NULL); in early_init_dt_scan_cpus()
428 check_cpu_features(node, "ibm,pa-features", ibm_pa_features, in early_init_dt_scan_cpus()
430 check_cpu_features(node, "ibm,pi-features", ibm_pi_features, in early_init_dt_scan_cpus()
436 // We can now add the CPU name & PVR to the hardware description in early_init_dt_scan_cpus()
437 seq_buf_printf(&ppc_hw_desc, "%s 0x%04lx ", cur_cpu_spec->cpu_name, mfspr(SPRN_PVR)); in early_init_dt_scan_cpus()
445 cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT; in early_init_dt_scan_cpus()
447 cur_cpu_spec->cpu_features |= CPU_FTR_SMT; in early_init_dt_scan_cpus()
465 if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) in early_init_dt_scan_chosen_ppc()
467 if (of_get_flat_dt_prop(node, "linux,iommu-force-on", NULL) != NULL) in early_init_dt_scan_chosen_ppc()
472 lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL); in early_init_dt_scan_chosen_ppc()
477 lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL); in early_init_dt_scan_chosen_ppc()
480 lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL); in early_init_dt_scan_chosen_ppc()
486 lprop = of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL); in early_init_dt_scan_chosen_ppc()
490 lprop = of_get_flat_dt_prop(node, "linux,crashkernel-size", NULL); in early_init_dt_scan_chosen_ppc()
492 crashk_res.end = crashk_res.start + *lprop - 1; in early_init_dt_scan_chosen_ppc()
512 *size = max_mem - base; in validate_mem_limit()
535 base = lmb->base_addr; in early_init_drmem_lmb()
540 * Skip this block if the reserved bit is set in flags in early_init_drmem_lmb()
543 if ((lmb->flags & DRCONF_MEM_RESERVED) || in early_init_drmem_lmb()
544 !(lmb->flags & DRCONF_MEM_ASSIGNED)) in early_init_drmem_lmb()
552 * For each memblock in ibm,dynamic-memory, a in early_init_drmem_lmb()
553 * corresponding entry in linux,drconf-usable-memory in early_init_drmem_lmb()
556 * linux,drconf-usable-memory property in early_init_drmem_lmb()
573 size = 0x80000000ul - base; in early_init_drmem_lmb()
579 DBG("Adding: %llx -> %llx\n", base, size); in early_init_drmem_lmb()
582 if (lmb->flags & DRCONF_MEM_HOTREMOVABLE) in early_init_drmem_lmb()
584 } while (--rngs); in early_init_drmem_lmb()
594 int node = fdt_path_offset(fdt, "/ibm,dynamic-reconfiguration-memory"); in early_init_dt_scan_memory_ppc()
625 size = 0x80000000ul - base; in early_init_dt_add_memory_arch()
628 /* Keep track of the beginning of memory -and- the size of in early_init_dt_add_memory_arch()
629 * the very first block in the device-tree as it represents in early_init_dt_add_memory_arch()
655 prop = of_get_flat_dt_prop(dt_root, "reserved-ranges", &len); in early_reserve_mem_dt()
660 DBG("Found new-style reserved-ranges\n"); in early_reserve_mem_dt()
662 /* Each reserved range is an (address,size) pair, 2 cells each, in early_reserve_mem_dt()
671 DBG("reserving: %llx -> %llx\n", base, size); in early_reserve_mem_dt()
684 /* Look for the new "reserved-regions" property in the DT */ in early_reserve_mem()
691 ALIGN(initrd_end, PAGE_SIZE) - in early_reserve_mem()
701 * image that setup the mem_rsvmap as pairs of 32-bit values in early_reserve_mem()
707 DBG("Found old 32-bit reserve map\n"); in early_reserve_mem()
714 DBG("reserving: %x -> %x\n", base_32, size_32); in early_reserve_mem()
729 return -EINVAL; in parse_ppc_tm()
741 cur_cpu_spec->cpu_user_features2 &= in tm_init()
743 cur_cpu_spec->cpu_features &= ~CPU_FTR_TM; in tm_init()
791 DBG(" -> early_init_devtree(%px)\n", params); in early_init_devtree()
818 * device-tree, including the platform type, initrd location and in early_init_devtree()
844 memblock_reserve(PHYSICAL_START, __pa(_end) - PHYSICAL_START); in early_init_devtree()
846 /* If relocatable, reserve at least 32k for interrupt vectors etc. */ in early_init_devtree()
847 int_vector_size = __end_interrupts - _stext; in early_init_devtree()
850 /* If relocatable, reserve first 32k for interrupt vectors etc. */ in early_init_devtree()
858 * If we fail to reserve memory for firmware-assisted dump then in early_init_devtree()
891 /* Retrieve CPU related informations from the flat tree in early_init_devtree()
892 * (altivec support, boot CPU ID, ...) in early_init_devtree()
896 printk("Failed to identify boot CPU !\n"); in early_init_devtree()
904 * NCPUS-1 non-boot CPUs :-) in early_init_devtree()
906 spinning_secondaries = boot_cpu_count - 1; in early_init_devtree()
936 DBG(" <- early_init_devtree()\n"); in early_init_devtree()
946 /* Setup flat device-tree pointer */ in early_get_first_memblock_info()
975 * of_get_ibm_chip_id - Returns the IBM "chip-id" of a device
978 * This looks for a property "ibm,chip-id" in the node or any
979 * of its parents and returns its content, or -1 if it cannot
990 * cell in chip-id, we only read the first one here. in of_get_ibm_chip_id()
992 if (!of_property_read_u32(np, "ibm,chip-id", &chip_id)) { in of_get_ibm_chip_id()
999 return -1; in of_get_ibm_chip_id()
1004 * cpu_to_chip_id - Return the cpus chip-id
1005 * @cpu: The logical cpu number.
1007 * Return the value of the ibm,chip-id property corresponding to the given
1008 * logical cpu number. If the chip-id can not be found, returns -1.
1010 int cpu_to_chip_id(int cpu) in cpu_to_chip_id() argument
1013 int ret = -1, idx; in cpu_to_chip_id()
1015 idx = cpu / threads_per_core; in cpu_to_chip_id()
1016 if (chip_id_lookup_table && chip_id_lookup_table[idx] != -1) in cpu_to_chip_id()
1019 np = of_get_cpu_node(cpu, NULL); in cpu_to_chip_id()
1032 bool arch_match_cpu_phys_id(int cpu, u64 phys_id) in arch_match_cpu_phys_id() argument
1041 return (int)phys_id == cpu_to_phys_id[cpu]; in arch_match_cpu_phys_id()
1044 return (int)phys_id == get_hard_smp_processor_id(cpu); in arch_match_cpu_phys_id()