smp.c (3c19d5ada1bec8b97119215298df7669d3ffb3db) smp.c (b866cc2199d6a6cdcefe4acfe4cfca3ac3c6d38e)
1/*
2 * SMP support for ppc.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *

--- 25 unchanged lines hidden (view full) ---

34#include <linux/topology.h>
35#include <linux/profile.h>
36
37#include <asm/ptrace.h>
38#include <linux/atomic.h>
39#include <asm/irq.h>
40#include <asm/hw_irq.h>
41#include <asm/kvm_ppc.h>
1/*
2 * SMP support for ppc.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *

--- 25 unchanged lines hidden (view full) ---

34#include <linux/topology.h>
35#include <linux/profile.h>
36
37#include <asm/ptrace.h>
38#include <linux/atomic.h>
39#include <asm/irq.h>
40#include <asm/hw_irq.h>
41#include <asm/kvm_ppc.h>
42#include <asm/dbell.h>
42#include <asm/page.h>
43#include <asm/pgtable.h>
44#include <asm/prom.h>
45#include <asm/smp.h>
46#include <asm/time.h>
47#include <asm/machdep.h>
48#include <asm/cputhreads.h>
49#include <asm/cputable.h>

--- 156 unchanged lines hidden (view full) ---

206 virq, smp_ipi_name[msg], err);
207
208 return err;
209}
210
211#ifdef CONFIG_PPC_SMP_MUXED_IPI
212struct cpu_messages {
213 long messages; /* current messages */
43#include <asm/page.h>
44#include <asm/pgtable.h>
45#include <asm/prom.h>
46#include <asm/smp.h>
47#include <asm/time.h>
48#include <asm/machdep.h>
49#include <asm/cputhreads.h>
50#include <asm/cputable.h>

--- 156 unchanged lines hidden (view full) ---

207 virq, smp_ipi_name[msg], err);
208
209 return err;
210}
211
212#ifdef CONFIG_PPC_SMP_MUXED_IPI
213struct cpu_messages {
214 long messages; /* current messages */
214 unsigned long data; /* data for cause ipi */
215};
216static DEFINE_PER_CPU_SHARED_ALIGNED(struct cpu_messages, ipi_message);
217
215};
216static DEFINE_PER_CPU_SHARED_ALIGNED(struct cpu_messages, ipi_message);
217
218void smp_muxed_ipi_set_data(int cpu, unsigned long data)
219{
220 struct cpu_messages *info = &per_cpu(ipi_message, cpu);
221
222 info->data = data;
223}
224
225void smp_muxed_ipi_set_message(int cpu, int msg)
226{
227 struct cpu_messages *info = &per_cpu(ipi_message, cpu);
228 char *message = (char *)&info->messages;
229
230 /*
231 * Order previous accesses before accesses in the IPI handler.
232 */
233 smp_mb();
234 message[msg] = 1;
235}
236
237void smp_muxed_ipi_message_pass(int cpu, int msg)
238{
218void smp_muxed_ipi_set_message(int cpu, int msg)
219{
220 struct cpu_messages *info = &per_cpu(ipi_message, cpu);
221 char *message = (char *)&info->messages;
222
223 /*
224 * Order previous accesses before accesses in the IPI handler.
225 */
226 smp_mb();
227 message[msg] = 1;
228}
229
230void smp_muxed_ipi_message_pass(int cpu, int msg)
231{
239 struct cpu_messages *info = &per_cpu(ipi_message, cpu);
240
241 smp_muxed_ipi_set_message(cpu, msg);
232 smp_muxed_ipi_set_message(cpu, msg);
233
242 /*
243 * cause_ipi functions are required to include a full barrier
244 * before doing whatever causes the IPI.
245 */
234 /*
235 * cause_ipi functions are required to include a full barrier
236 * before doing whatever causes the IPI.
237 */
246 smp_ops->cause_ipi(cpu, info->data);
238 smp_ops->cause_ipi(cpu);
247}
248
249#ifdef __BIG_ENDIAN__
250#define IPI_MESSAGE(A) (1uL << ((BITS_PER_LONG - 8) - 8 * (A)))
251#else
252#define IPI_MESSAGE(A) (1uL << (8 * (A)))
253#endif
254
255irqreturn_t smp_ipi_demux(void)
256{
239}
240
241#ifdef __BIG_ENDIAN__
242#define IPI_MESSAGE(A) (1uL << ((BITS_PER_LONG - 8) - 8 * (A)))
243#else
244#define IPI_MESSAGE(A) (1uL << (8 * (A)))
245#endif
246
247irqreturn_t smp_ipi_demux(void)
248{
257 struct cpu_messages *info = this_cpu_ptr(&ipi_message);
249 struct cpu_messages *info;
258 unsigned long all;
259
260 mb(); /* order any irq clear */
261
250 unsigned long all;
251
252 mb(); /* order any irq clear */
253
254 info = this_cpu_ptr(&ipi_message);
262 do {
263 all = xchg(&info->messages, 0);
264#if defined(CONFIG_KVM_XICS) && defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE)
265 /*
266 * Must check for PPC_MSG_RM_HOST_ACTION messages
267 * before PPC_MSG_CALL_FUNCTION messages because when
268 * a VM is destroyed, we call kick_all_cpus_sync()
269 * to ensure that any pending PPC_MSG_RM_HOST_ACTION

--- 608 unchanged lines hidden ---
255 do {
256 all = xchg(&info->messages, 0);
257#if defined(CONFIG_KVM_XICS) && defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE)
258 /*
259 * Must check for PPC_MSG_RM_HOST_ACTION messages
260 * before PPC_MSG_CALL_FUNCTION messages because when
261 * a VM is destroyed, we call kick_all_cpus_sync()
262 * to ensure that any pending PPC_MSG_RM_HOST_ACTION

--- 608 unchanged lines hidden ---