| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Author: Andy Fleming <afleming@freescale.com> |
|---|
| 3 | 4 | * Kumar Gala <galak@kernel.crashing.org> |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright 2006-2008, 2011-2012, 2015 Freescale Semiconductor Inc. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 8 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 9 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 10 | | - * option) any later version. |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #include <linux/stddef.h> |
|---|
| .. | .. |
|---|
| 20 | 16 | #include <linux/highmem.h> |
|---|
| 21 | 17 | #include <linux/cpu.h> |
|---|
| 22 | 18 | #include <linux/fsl/guts.h> |
|---|
| 19 | +#include <linux/pgtable.h> |
|---|
| 23 | 20 | |
|---|
| 24 | 21 | #include <asm/machdep.h> |
|---|
| 25 | | -#include <asm/pgtable.h> |
|---|
| 26 | 22 | #include <asm/page.h> |
|---|
| 27 | 23 | #include <asm/mpic.h> |
|---|
| 28 | 24 | #include <asm/cacheflush.h> |
|---|
| .. | .. |
|---|
| 44 | 40 | u32 pir; |
|---|
| 45 | 41 | }; |
|---|
| 46 | 42 | |
|---|
| 47 | | -#ifdef CONFIG_HOTPLUG_CPU |
|---|
| 48 | 43 | static u64 timebase; |
|---|
| 49 | 44 | static int tb_req; |
|---|
| 50 | 45 | static int tb_valid; |
|---|
| .. | .. |
|---|
| 116 | 111 | local_irq_restore(flags); |
|---|
| 117 | 112 | } |
|---|
| 118 | 113 | |
|---|
| 119 | | -static void smp_85xx_mach_cpu_die(void) |
|---|
| 114 | +#ifdef CONFIG_HOTPLUG_CPU |
|---|
| 115 | +static void smp_85xx_cpu_offline_self(void) |
|---|
| 120 | 116 | { |
|---|
| 121 | 117 | unsigned int cpu = smp_processor_id(); |
|---|
| 122 | 118 | |
|---|
| .. | .. |
|---|
| 216 | 212 | |
|---|
| 217 | 213 | /* Map the spin table */ |
|---|
| 218 | 214 | if (ioremappable) |
|---|
| 219 | | - spin_table = ioremap_prot(*cpu_rel_addr, |
|---|
| 220 | | - sizeof(struct epapr_spin_table), _PAGE_COHERENT); |
|---|
| 215 | + spin_table = ioremap_coherent(*cpu_rel_addr, |
|---|
| 216 | + sizeof(struct epapr_spin_table)); |
|---|
| 221 | 217 | else |
|---|
| 222 | 218 | spin_table = phys_to_virt(*cpu_rel_addr); |
|---|
| 223 | 219 | |
|---|
| 224 | 220 | local_irq_save(flags); |
|---|
| 225 | 221 | hard_irq_disable(); |
|---|
| 226 | 222 | |
|---|
| 227 | | - if (qoriq_pm_ops) |
|---|
| 223 | + if (qoriq_pm_ops && qoriq_pm_ops->cpu_up_prepare) |
|---|
| 228 | 224 | qoriq_pm_ops->cpu_up_prepare(cpu); |
|---|
| 229 | 225 | |
|---|
| 230 | 226 | /* if cpu is not spinning, reset it */ |
|---|
| .. | .. |
|---|
| 256 | 252 | out_be64((u64 *)(&spin_table->addr_h), |
|---|
| 257 | 253 | __pa(ppc_function_entry(generic_secondary_smp_init))); |
|---|
| 258 | 254 | #else |
|---|
| 255 | +#ifdef CONFIG_PHYS_ADDR_T_64BIT |
|---|
| 256 | + /* |
|---|
| 257 | + * We need also to write addr_h to spin table for systems |
|---|
| 258 | + * in which their physical memory start address was configured |
|---|
| 259 | + * to above 4G, otherwise the secondary core can not get |
|---|
| 260 | + * correct entry to start from. |
|---|
| 261 | + */ |
|---|
| 262 | + out_be32(&spin_table->addr_h, __pa(__early_start) >> 32); |
|---|
| 263 | +#endif |
|---|
| 259 | 264 | out_be32(&spin_table->addr_l, __pa(__early_start)); |
|---|
| 260 | 265 | #endif |
|---|
| 261 | 266 | flush_spin_table(spin_table); |
|---|
| .. | .. |
|---|
| 287 | 292 | booting_thread_hwid = cpu_thread_in_core(nr); |
|---|
| 288 | 293 | primary = cpu_first_thread_sibling(nr); |
|---|
| 289 | 294 | |
|---|
| 290 | | - if (qoriq_pm_ops) |
|---|
| 295 | + if (qoriq_pm_ops && qoriq_pm_ops->cpu_up_prepare) |
|---|
| 291 | 296 | qoriq_pm_ops->cpu_up_prepare(nr); |
|---|
| 292 | 297 | |
|---|
| 293 | 298 | /* |
|---|
| .. | .. |
|---|
| 490 | 495 | smp_85xx_ops.probe = NULL; |
|---|
| 491 | 496 | } |
|---|
| 492 | 497 | |
|---|
| 493 | | -#ifdef CONFIG_HOTPLUG_CPU |
|---|
| 494 | 498 | #ifdef CONFIG_FSL_CORENET_RCPM |
|---|
| 499 | + /* Assign a value to qoriq_pm_ops on PPC_E500MC */ |
|---|
| 495 | 500 | fsl_rcpm_init(); |
|---|
| 496 | | -#endif |
|---|
| 497 | | - |
|---|
| 498 | | -#ifdef CONFIG_FSL_PMC |
|---|
| 501 | +#else |
|---|
| 502 | + /* Assign a value to qoriq_pm_ops on !PPC_E500MC */ |
|---|
| 499 | 503 | mpc85xx_setup_pmc(); |
|---|
| 500 | 504 | #endif |
|---|
| 501 | 505 | if (qoriq_pm_ops) { |
|---|
| 502 | 506 | smp_85xx_ops.give_timebase = mpc85xx_give_timebase; |
|---|
| 503 | 507 | smp_85xx_ops.take_timebase = mpc85xx_take_timebase; |
|---|
| 504 | | - ppc_md.cpu_die = smp_85xx_mach_cpu_die; |
|---|
| 508 | +#ifdef CONFIG_HOTPLUG_CPU |
|---|
| 509 | + smp_85xx_ops.cpu_offline_self = smp_85xx_cpu_offline_self; |
|---|
| 505 | 510 | smp_85xx_ops.cpu_die = qoriq_cpu_kill; |
|---|
| 506 | | - } |
|---|
| 507 | 511 | #endif |
|---|
| 512 | + } |
|---|
| 508 | 513 | smp_ops = &smp_85xx_ops; |
|---|
| 509 | 514 | |
|---|
| 510 | 515 | #ifdef CONFIG_KEXEC_CORE |
|---|