blob: ac163bd46cfdaf99d7a5da904d9f455cf6a220dc [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * c 2001 PPC 64 Team, IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/types.h>
11#include <linux/threads.h>
12#include <linux/module.h>
13
14#include <asm/processor.h>
15#include <asm/ptrace.h>
16#include <asm/page.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm/lppaca.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/paca.h>
Michael Neuling2f6093c2006-08-07 16:19:19 +100019#include <asm/mmu.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22/* This symbol is provided by the linker - let it fill in the paca
23 * field correctly */
24extern unsigned long __toc_start;
25
David Gibson3356bb92006-01-13 10:26:42 +110026/*
Stephen Rothwell30ff2e82008-04-10 16:43:47 +100027 * The structure which the hypervisor knows about - this structure
David Gibson3356bb92006-01-13 10:26:42 +110028 * should not cross a page boundary. The vpa_init/register_vpa call
29 * is now known to fail if the lppaca structure crosses a page
Stephen Rothwell30ff2e82008-04-10 16:43:47 +100030 * boundary. The lppaca is also used on legacy iSeries and POWER5
31 * pSeries boxes. The lppaca is 640 bytes long, and cannot readily
32 * change since the hypervisor knows its layout, so a 1kB alignment
33 * will suffice to ensure that it doesn't cross a page boundary.
David Gibson3356bb92006-01-13 10:26:42 +110034 */
35struct lppaca lppaca[] = {
36 [0 ... (NR_CPUS-1)] = {
37 .desc = 0xd397d781, /* "LpPa" */
38 .size = sizeof(struct lppaca),
39 .dyn_proc_status = 2,
40 .decr_val = 0x00ff0000,
41 .fpregs_in_use = 1,
42 .end_of_quantum = 0xfffffffffffffffful,
43 .slb_count = 64,
44 .vmxregs_in_use = 0,
45 },
46};
47
Michael Neuling2f6093c2006-08-07 16:19:19 +100048/*
49 * 3 persistent SLBs are registered here. The buffer will be zero
50 * initially, hence will all be invaild until we actually write them.
51 */
52struct slb_shadow slb_shadow[] __cacheline_aligned = {
53 [0 ... (NR_CPUS-1)] = {
54 .persistent = SLB_NUM_BOLTED,
55 .buffer_length = sizeof(struct slb_shadow),
56 },
57};
58
David Gibson8882a4d2005-11-09 13:38:01 +110059/* The Paca is an array with one entry per processor. Each contains an
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 * lppaca, which contains the information shared between the
David Gibson1888e7b2005-11-24 16:34:45 +110061 * hypervisor and Linux.
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 * On systems with hardware multi-threading, there are two threads
63 * per processor. The Paca array must contain an entry for each thread.
64 * The VPD Areas will give a max logical processors = 2 * max physical
65 * processors. The processor VPD array needs one entry per physical
66 * processor (not thread).
67 */
Stephen Rothwell30ff2e82008-04-10 16:43:47 +100068#define PACA_INIT(number) \
69{ \
David Gibson3356bb92006-01-13 10:26:42 +110070 .lppaca_ptr = &lppaca[number], \
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 .lock_token = 0x8000, \
72 .paca_index = (number), /* Paca Index */ \
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
Michael Neuling2f6093c2006-08-07 16:19:19 +100074 .hw_cpu_id = 0xffff, \
Stephen Rothwell30ff2e82008-04-10 16:43:47 +100075 .slb_shadow_ptr = &slb_shadow[number], \
Benjamin Herrenschmidt7c6352a2008-04-09 17:21:26 +100076 .__current = &init_task, \
Michael Ellermanee484442005-06-30 15:07:48 +100077}
78
Michael Ellermanee484442005-06-30 15:07:48 +100079struct paca_struct paca[] = {
Anton Blanchard4df20462006-03-25 17:25:17 +110080 PACA_INIT(0),
Linus Torvalds1da177e2005-04-16 15:20:36 -070081#if NR_CPUS > 1
Michael Ellermanee484442005-06-30 15:07:48 +100082 PACA_INIT( 1), PACA_INIT( 2), PACA_INIT( 3),
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#if NR_CPUS > 4
Michael Ellermanee484442005-06-30 15:07:48 +100084 PACA_INIT( 4), PACA_INIT( 5), PACA_INIT( 6), PACA_INIT( 7),
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#if NR_CPUS > 8
Michael Ellermanee484442005-06-30 15:07:48 +100086 PACA_INIT( 8), PACA_INIT( 9), PACA_INIT( 10), PACA_INIT( 11),
87 PACA_INIT( 12), PACA_INIT( 13), PACA_INIT( 14), PACA_INIT( 15),
88 PACA_INIT( 16), PACA_INIT( 17), PACA_INIT( 18), PACA_INIT( 19),
89 PACA_INIT( 20), PACA_INIT( 21), PACA_INIT( 22), PACA_INIT( 23),
90 PACA_INIT( 24), PACA_INIT( 25), PACA_INIT( 26), PACA_INIT( 27),
91 PACA_INIT( 28), PACA_INIT( 29), PACA_INIT( 30), PACA_INIT( 31),
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#if NR_CPUS > 32
Michael Ellermanee484442005-06-30 15:07:48 +100093 PACA_INIT( 32), PACA_INIT( 33), PACA_INIT( 34), PACA_INIT( 35),
94 PACA_INIT( 36), PACA_INIT( 37), PACA_INIT( 38), PACA_INIT( 39),
95 PACA_INIT( 40), PACA_INIT( 41), PACA_INIT( 42), PACA_INIT( 43),
96 PACA_INIT( 44), PACA_INIT( 45), PACA_INIT( 46), PACA_INIT( 47),
97 PACA_INIT( 48), PACA_INIT( 49), PACA_INIT( 50), PACA_INIT( 51),
98 PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55),
99 PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59),
100 PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101#if NR_CPUS > 64
Michael Ellermanee484442005-06-30 15:07:48 +1000102 PACA_INIT( 64), PACA_INIT( 65), PACA_INIT( 66), PACA_INIT( 67),
103 PACA_INIT( 68), PACA_INIT( 69), PACA_INIT( 70), PACA_INIT( 71),
104 PACA_INIT( 72), PACA_INIT( 73), PACA_INIT( 74), PACA_INIT( 75),
105 PACA_INIT( 76), PACA_INIT( 77), PACA_INIT( 78), PACA_INIT( 79),
106 PACA_INIT( 80), PACA_INIT( 81), PACA_INIT( 82), PACA_INIT( 83),
107 PACA_INIT( 84), PACA_INIT( 85), PACA_INIT( 86), PACA_INIT( 87),
108 PACA_INIT( 88), PACA_INIT( 89), PACA_INIT( 90), PACA_INIT( 91),
109 PACA_INIT( 92), PACA_INIT( 93), PACA_INIT( 94), PACA_INIT( 95),
110 PACA_INIT( 96), PACA_INIT( 97), PACA_INIT( 98), PACA_INIT( 99),
111 PACA_INIT(100), PACA_INIT(101), PACA_INIT(102), PACA_INIT(103),
112 PACA_INIT(104), PACA_INIT(105), PACA_INIT(106), PACA_INIT(107),
113 PACA_INIT(108), PACA_INIT(109), PACA_INIT(110), PACA_INIT(111),
114 PACA_INIT(112), PACA_INIT(113), PACA_INIT(114), PACA_INIT(115),
115 PACA_INIT(116), PACA_INIT(117), PACA_INIT(118), PACA_INIT(119),
116 PACA_INIT(120), PACA_INIT(121), PACA_INIT(122), PACA_INIT(123),
117 PACA_INIT(124), PACA_INIT(125), PACA_INIT(126), PACA_INIT(127),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118#endif
119#endif
120#endif
121#endif
122#endif
123};
124EXPORT_SYMBOL(paca);