~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/platforms/ps3/smp.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  *  PS3 SMP routines.
  4  *
  5  *  Copyright (C) 2006 Sony Computer Entertainment Inc.
  6  *  Copyright 2006 Sony Corp.
  7  */
  8 
  9 #include <linux/kernel.h>
 10 #include <linux/smp.h>
 11 
 12 #include <asm/machdep.h>
 13 #include <asm/udbg.h>
 14 
 15 #include "platform.h"
 16 
 17 #if defined(DEBUG)
 18 #define DBG udbg_printf
 19 #else
 20 #define DBG pr_debug
 21 #endif
 22 
 23 /**
 24   * ps3_ipi_virqs - a per cpu array of virqs for ipi use
 25   */
 26 
 27 #define MSG_COUNT 4
 28 static DEFINE_PER_CPU(unsigned int [MSG_COUNT], ps3_ipi_virqs);
 29 
 30 static void ps3_smp_message_pass(int cpu, int msg)
 31 {
 32         int result;
 33         unsigned int virq;
 34 
 35         if (msg >= MSG_COUNT) {
 36                 DBG("%s:%d: bad msg: %d\n", __func__, __LINE__, msg);
 37                 return;
 38         }
 39 
 40         virq = per_cpu(ps3_ipi_virqs, cpu)[msg];
 41         result = ps3_send_event_locally(virq);
 42 
 43         if (result)
 44                 DBG("%s:%d: ps3_send_event_locally(%d, %d) failed"
 45                         " (%d)\n", __func__, __LINE__, cpu, msg, result);
 46 }
 47 
 48 static void __init ps3_smp_probe(void)
 49 {
 50         int cpu;
 51 
 52         for (cpu = 0; cpu < 2; cpu++) {
 53                 int result;
 54                 unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu);
 55                 int i;
 56 
 57                 DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
 58 
 59                 /*
 60                 * Check assumptions on ps3_ipi_virqs[] indexing. If this
 61                 * check fails, then a different mapping of PPC_MSG_
 62                 * to index needs to be setup.
 63                 */
 64 
 65                 BUILD_BUG_ON(PPC_MSG_CALL_FUNCTION    != 0);
 66                 BUILD_BUG_ON(PPC_MSG_RESCHEDULE       != 1);
 67                 BUILD_BUG_ON(PPC_MSG_TICK_BROADCAST   != 2);
 68                 BUILD_BUG_ON(PPC_MSG_NMI_IPI          != 3);
 69 
 70                 for (i = 0; i < MSG_COUNT; i++) {
 71                         result = ps3_event_receive_port_setup(cpu, &virqs[i]);
 72 
 73                         if (result)
 74                                 continue;
 75 
 76                         DBG("%s:%d: (%d, %d) => virq %u\n",
 77                                 __func__, __LINE__, cpu, i, virqs[i]);
 78 
 79                         result = smp_request_message_ipi(virqs[i], i);
 80 
 81                         if (result)
 82                                 virqs[i] = 0;
 83                         else
 84                                 ps3_register_ipi_irq(cpu, virqs[i]);
 85                 }
 86 
 87                 ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_NMI_IPI]);
 88 
 89                 DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu);
 90         }
 91 }
 92 
 93 void ps3_smp_cleanup_cpu(int cpu)
 94 {
 95         unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu);
 96         int i;
 97 
 98         DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
 99 
100         for (i = 0; i < MSG_COUNT; i++) {
101                 /* Can't call free_irq from interrupt context. */
102                 ps3_event_receive_port_destroy(virqs[i]);
103                 virqs[i] = 0;
104         }
105 
106         DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu);
107 }
108 
109 static struct smp_ops_t ps3_smp_ops = {
110         .probe          = ps3_smp_probe,
111         .message_pass   = ps3_smp_message_pass,
112         .kick_cpu       = smp_generic_kick_cpu,
113 };
114 
115 void __init smp_init_ps3(void)
116 {
117         DBG(" -> %s\n", __func__);
118         smp_ops = &ps3_smp_ops;
119         DBG(" <- %s\n", __func__);
120 }
121 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php