void __init allocate_pacas(void) { int cpu, limit; /* * We can't take SLB misses on the paca, and we want to access them * in real mode, so allocate them within the RMA and also within * the first segment. */ limit = min(0x10000000ULL, ppc64_rma_size); paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids); paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit)); memset(paca, 0, paca_size); printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n", paca_size, nr_cpu_ids, paca); allocate_lppacas(nr_cpu_ids, limit); /* Can't use for_each_*_cpu, as they aren't functional yet */ for (cpu = 0; cpu < nr_cpu_ids; cpu++) initialise_paca(&paca[cpu], cpu); }
void __init allocate_pacas(void) { int nr_cpus, cpu, limit; /* * We can't take SLB misses on the paca, and we want to access them * in real mode, so allocate them within the RMA and also within * the first segment. On iSeries they must be within the area mapped * by the HV, which is HvPagesToMap * HVPAGESIZE bytes. */ limit = min(0x10000000ULL, ppc64_rma_size); if (firmware_has_feature(FW_FEATURE_ISERIES)) limit = min(limit, HvPagesToMap * HVPAGESIZE); nr_cpus = NR_CPUS; /* On iSeries we know we can never have more than 64 cpus */ if (firmware_has_feature(FW_FEATURE_ISERIES)) nr_cpus = min(64, nr_cpus); paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus); paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit)); memset(paca, 0, paca_size); printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n", paca_size, nr_cpus, paca); allocate_lppacas(nr_cpus, limit); /* Can't use for_each_*_cpu, as they aren't functional yet */ for (cpu = 0; cpu < nr_cpus; cpu++) initialise_paca(&paca[cpu], cpu); }
void __init allocate_pacas(void) { int cpu, limit; /* */ limit = min(0x10000000ULL, ppc64_rma_size); paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids); paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit)); memset(paca, 0, paca_size); printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n", paca_size, nr_cpu_ids, paca); allocate_lppacas(nr_cpu_ids, limit); /* */ for (cpu = 0; cpu < nr_cpu_ids; cpu++) initialise_paca(&paca[cpu], cpu); }
void __init allocate_pacas(void) { u64 limit; int cpu; #ifdef CONFIG_PPC_BOOK3S_64 /* * We access pacas in real mode, and cannot take SLB faults * on them when in virtual mode, so allocate them accordingly. */ limit = min(ppc64_bolted_size(), ppc64_rma_size); #else limit = ppc64_rma_size; #endif paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids); paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit)); memset(paca, 0, paca_size); printk(KERN_DEBUG "Allocated %u bytes for %u pacas at %p\n", paca_size, nr_cpu_ids, paca); allocate_lppacas(nr_cpu_ids, limit); allocate_slb_shadows(nr_cpu_ids, limit); /* Can't use for_each_*_cpu, as they aren't functional yet */ for (cpu = 0; cpu < nr_cpu_ids; cpu++) initialise_paca(&paca[cpu], cpu); }
void __init allocate_pacas(void) { u64 limit; int cpu; int nr_cpus; limit = ppc64_rma_size; #ifdef CONFIG_PPC_BOOK3S_64 /* * We can't take SLB misses on the paca, and we want to access them * in real mode, so allocate them within the RMA and also within * the first segment. */ limit = min(0x10000000ULL, limit); #endif /* * Always align up the nr_cpu_ids to SMT threads and allocate * the paca. This will help us to prepare for a situation where * boot cpu id > nr_cpus_id. We will use the last nthreads * slots (nthreads == threads per core) to accommodate a core * that contains boot cpu thread. * * Do not change nr_cpu_ids value here. Let us do that in * early_init_dt_scan_cpus() where we know exact value * of threads per core. */ nr_cpus = _ALIGN_UP(nr_cpu_ids, MAX_SMT); paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus); paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit)); memset(paca, 0, paca_size); printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n", paca_size, nr_cpus, paca); allocate_lppacas(nr_cpus, limit); allocate_slb_shadows(nr_cpus, limit); /* Can't use for_each_*_cpu, as they aren't functional yet */ for (cpu = 0; cpu < nr_cpus; cpu++) initialise_paca(&paca[cpu], cpu); }