diff options
Diffstat (limited to 'arch/powerpc/include/asm')
37 files changed, 717 insertions, 251 deletions
diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h index 24d79e3abd8e..0835eb977ba9 100644 --- a/arch/powerpc/include/asm/cpm.h +++ b/arch/powerpc/include/asm/cpm.h | |||
@@ -3,8 +3,47 @@ | |||
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/errno.h> | ||
6 | #include <linux/of.h> | 7 | #include <linux/of.h> |
7 | 8 | ||
9 | /* | ||
10 | * USB Controller pram common to QE and CPM. | ||
11 | */ | ||
12 | struct usb_ctlr { | ||
13 | u8 usb_usmod; | ||
14 | u8 usb_usadr; | ||
15 | u8 usb_uscom; | ||
16 | u8 res1[1]; | ||
17 | __be16 usb_usep[4]; | ||
18 | u8 res2[4]; | ||
19 | __be16 usb_usber; | ||
20 | u8 res3[2]; | ||
21 | __be16 usb_usbmr; | ||
22 | u8 res4[1]; | ||
23 | u8 usb_usbs; | ||
24 | /* Fields down below are QE-only */ | ||
25 | __be16 usb_ussft; | ||
26 | u8 res5[2]; | ||
27 | __be16 usb_usfrn; | ||
28 | u8 res6[0x22]; | ||
29 | } __attribute__ ((packed)); | ||
30 | |||
31 | /* | ||
32 | * Function code bits, usually generic to devices. | ||
33 | */ | ||
34 | #ifdef CONFIG_CPM1 | ||
35 | #define CPMFCR_GBL ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
36 | #define CPMFCR_TC2 ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
37 | #define CPMFCR_DTB ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
38 | #define CPMFCR_BDB ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
39 | #else | ||
40 | #define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */ | ||
41 | #define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */ | ||
42 | #define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */ | ||
43 | #define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */ | ||
44 | #endif | ||
45 | #define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */ | ||
46 | |||
8 | /* Opcodes common to CPM1 and CPM2 | 47 | /* Opcodes common to CPM1 and CPM2 |
9 | */ | 48 | */ |
10 | #define CPM_CR_INIT_TRX ((ushort)0x0000) | 49 | #define CPM_CR_INIT_TRX ((ushort)0x0000) |
@@ -93,13 +132,56 @@ typedef struct cpm_buf_desc { | |||
93 | #define BD_I2C_START (0x0400) | 132 | #define BD_I2C_START (0x0400) |
94 | 133 | ||
95 | int cpm_muram_init(void); | 134 | int cpm_muram_init(void); |
135 | |||
136 | #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) | ||
96 | unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); | 137 | unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); |
97 | int cpm_muram_free(unsigned long offset); | 138 | int cpm_muram_free(unsigned long offset); |
98 | unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); | 139 | unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); |
99 | void __iomem *cpm_muram_addr(unsigned long offset); | 140 | void __iomem *cpm_muram_addr(unsigned long offset); |
100 | unsigned long cpm_muram_offset(void __iomem *addr); | 141 | unsigned long cpm_muram_offset(void __iomem *addr); |
101 | dma_addr_t cpm_muram_dma(void __iomem *addr); | 142 | dma_addr_t cpm_muram_dma(void __iomem *addr); |
143 | #else | ||
144 | static inline unsigned long cpm_muram_alloc(unsigned long size, | ||
145 | unsigned long align) | ||
146 | { | ||
147 | return -ENOSYS; | ||
148 | } | ||
149 | |||
150 | static inline int cpm_muram_free(unsigned long offset) | ||
151 | { | ||
152 | return -ENOSYS; | ||
153 | } | ||
154 | |||
155 | static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, | ||
156 | unsigned long size) | ||
157 | { | ||
158 | return -ENOSYS; | ||
159 | } | ||
160 | |||
161 | static inline void __iomem *cpm_muram_addr(unsigned long offset) | ||
162 | { | ||
163 | return NULL; | ||
164 | } | ||
165 | |||
166 | static inline unsigned long cpm_muram_offset(void __iomem *addr) | ||
167 | { | ||
168 | return -ENOSYS; | ||
169 | } | ||
170 | |||
171 | static inline dma_addr_t cpm_muram_dma(void __iomem *addr) | ||
172 | { | ||
173 | return 0; | ||
174 | } | ||
175 | #endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */ | ||
176 | |||
177 | #ifdef CONFIG_CPM | ||
102 | int cpm_command(u32 command, u8 opcode); | 178 | int cpm_command(u32 command, u8 opcode); |
179 | #else | ||
180 | static inline int cpm_command(u32 command, u8 opcode) | ||
181 | { | ||
182 | return -ENOSYS; | ||
183 | } | ||
184 | #endif /* CONFIG_CPM */ | ||
103 | 185 | ||
104 | int cpm2_gpiochip_add32(struct device_node *np); | 186 | int cpm2_gpiochip_add32(struct device_node *np); |
105 | 187 | ||
diff --git a/arch/powerpc/include/asm/cpm1.h b/arch/powerpc/include/asm/cpm1.h index 7685ffde8821..81b01192f440 100644 --- a/arch/powerpc/include/asm/cpm1.h +++ b/arch/powerpc/include/asm/cpm1.h | |||
@@ -478,51 +478,6 @@ typedef struct iic { | |||
478 | char res2[2]; /* Reserved */ | 478 | char res2[2]; /* Reserved */ |
479 | } iic_t; | 479 | } iic_t; |
480 | 480 | ||
481 | /* SPI parameter RAM. | ||
482 | */ | ||
483 | typedef struct spi { | ||
484 | ushort spi_rbase; /* Rx Buffer descriptor base address */ | ||
485 | ushort spi_tbase; /* Tx Buffer descriptor base address */ | ||
486 | u_char spi_rfcr; /* Rx function code */ | ||
487 | u_char spi_tfcr; /* Tx function code */ | ||
488 | ushort spi_mrblr; /* Max receive buffer length */ | ||
489 | uint spi_rstate; /* Internal */ | ||
490 | uint spi_rdp; /* Internal */ | ||
491 | ushort spi_rbptr; /* Internal */ | ||
492 | ushort spi_rbc; /* Internal */ | ||
493 | uint spi_rxtmp; /* Internal */ | ||
494 | uint spi_tstate; /* Internal */ | ||
495 | uint spi_tdp; /* Internal */ | ||
496 | ushort spi_tbptr; /* Internal */ | ||
497 | ushort spi_tbc; /* Internal */ | ||
498 | uint spi_txtmp; /* Internal */ | ||
499 | uint spi_res; | ||
500 | ushort spi_rpbase; /* Relocation pointer */ | ||
501 | ushort spi_res2; | ||
502 | } spi_t; | ||
503 | |||
504 | /* SPI Mode register. | ||
505 | */ | ||
506 | #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */ | ||
507 | #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */ | ||
508 | #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */ | ||
509 | #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */ | ||
510 | #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */ | ||
511 | #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */ | ||
512 | #define SPMODE_EN ((ushort)0x0100) /* Enable */ | ||
513 | #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */ | ||
514 | #define SPMODE_LEN4 ((ushort)0x0030) /* 4 bits per char */ | ||
515 | #define SPMODE_LEN8 ((ushort)0x0070) /* 8 bits per char */ | ||
516 | #define SPMODE_LEN16 ((ushort)0x00f0) /* 16 bits per char */ | ||
517 | #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */ | ||
518 | |||
519 | /* SPIE fields */ | ||
520 | #define SPIE_MME 0x20 | ||
521 | #define SPIE_TXE 0x10 | ||
522 | #define SPIE_BSY 0x04 | ||
523 | #define SPIE_TXB 0x02 | ||
524 | #define SPIE_RXB 0x01 | ||
525 | |||
526 | /* | 481 | /* |
527 | * RISC Controller Configuration Register definitons | 482 | * RISC Controller Configuration Register definitons |
528 | */ | 483 | */ |
diff --git a/arch/powerpc/include/asm/cpm2.h b/arch/powerpc/include/asm/cpm2.h index 990ff191da8b..f42e9baf3a4e 100644 --- a/arch/powerpc/include/asm/cpm2.h +++ b/arch/powerpc/include/asm/cpm2.h | |||
@@ -124,14 +124,6 @@ static inline void cpm2_fastbrg(uint brg, uint rate, int div16) | |||
124 | __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT); | 124 | __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT); |
125 | } | 125 | } |
126 | 126 | ||
127 | /* Function code bits, usually generic to devices. | ||
128 | */ | ||
129 | #define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */ | ||
130 | #define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */ | ||
131 | #define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */ | ||
132 | #define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */ | ||
133 | #define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */ | ||
134 | |||
135 | /* Parameter RAM offsets from the base. | 127 | /* Parameter RAM offsets from the base. |
136 | */ | 128 | */ |
137 | #define PROFF_SCC1 ((uint)0x8000) | 129 | #define PROFF_SCC1 ((uint)0x8000) |
@@ -654,45 +646,6 @@ typedef struct iic { | |||
654 | uint iic_txtmp; /* Internal */ | 646 | uint iic_txtmp; /* Internal */ |
655 | } iic_t; | 647 | } iic_t; |
656 | 648 | ||
657 | /* SPI parameter RAM. | ||
658 | */ | ||
659 | typedef struct spi { | ||
660 | ushort spi_rbase; /* Rx Buffer descriptor base address */ | ||
661 | ushort spi_tbase; /* Tx Buffer descriptor base address */ | ||
662 | u_char spi_rfcr; /* Rx function code */ | ||
663 | u_char spi_tfcr; /* Tx function code */ | ||
664 | ushort spi_mrblr; /* Max receive buffer length */ | ||
665 | uint spi_rstate; /* Internal */ | ||
666 | uint spi_rdp; /* Internal */ | ||
667 | ushort spi_rbptr; /* Internal */ | ||
668 | ushort spi_rbc; /* Internal */ | ||
669 | uint spi_rxtmp; /* Internal */ | ||
670 | uint spi_tstate; /* Internal */ | ||
671 | uint spi_tdp; /* Internal */ | ||
672 | ushort spi_tbptr; /* Internal */ | ||
673 | ushort spi_tbc; /* Internal */ | ||
674 | uint spi_txtmp; /* Internal */ | ||
675 | uint spi_res; /* Tx temp. */ | ||
676 | uint spi_res1[4]; /* SDMA temp. */ | ||
677 | } spi_t; | ||
678 | |||
679 | /* SPI Mode register. | ||
680 | */ | ||
681 | #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */ | ||
682 | #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */ | ||
683 | #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */ | ||
684 | #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */ | ||
685 | #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */ | ||
686 | #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */ | ||
687 | #define SPMODE_EN ((ushort)0x0100) /* Enable */ | ||
688 | #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */ | ||
689 | #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */ | ||
690 | |||
691 | #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4) | ||
692 | #define SPMODE_PM(x) ((x) &0xF) | ||
693 | |||
694 | #define SPI_EB ((u_char)0x10) /* big endian byte order */ | ||
695 | |||
696 | /* IDMA parameter RAM | 649 | /* IDMA parameter RAM |
697 | */ | 650 | */ |
698 | typedef struct idma { | 651 | typedef struct idma { |
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index a98653b26231..57c400071995 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h | |||
@@ -147,6 +147,7 @@ | |||
147 | .globl label##_pSeries; \ | 147 | .globl label##_pSeries; \ |
148 | label##_pSeries: \ | 148 | label##_pSeries: \ |
149 | HMT_MEDIUM; \ | 149 | HMT_MEDIUM; \ |
150 | DO_KVM n; \ | ||
150 | mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ | 151 | mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ |
151 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) | 152 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) |
152 | 153 | ||
@@ -170,6 +171,7 @@ label##_pSeries: \ | |||
170 | .globl label##_pSeries; \ | 171 | .globl label##_pSeries; \ |
171 | label##_pSeries: \ | 172 | label##_pSeries: \ |
172 | HMT_MEDIUM; \ | 173 | HMT_MEDIUM; \ |
174 | DO_KVM n; \ | ||
173 | mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ | 175 | mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ |
174 | mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ | 176 | mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ |
175 | std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ | 177 | std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ |
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index b1dafb6a9743..5856a66ab404 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
@@ -3,6 +3,10 @@ | |||
3 | 3 | ||
4 | #include <asm/page.h> | 4 | #include <asm/page.h> |
5 | 5 | ||
6 | pte_t *huge_pte_offset_and_shift(struct mm_struct *mm, | ||
7 | unsigned long addr, unsigned *shift); | ||
8 | |||
9 | void flush_dcache_icache_hugepage(struct page *page); | ||
6 | 10 | ||
7 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | 11 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, |
8 | unsigned long len); | 12 | unsigned long len); |
@@ -11,12 +15,6 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, | |||
11 | unsigned long end, unsigned long floor, | 15 | unsigned long end, unsigned long floor, |
12 | unsigned long ceiling); | 16 | unsigned long ceiling); |
13 | 17 | ||
14 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
15 | pte_t *ptep, pte_t pte); | ||
16 | |||
17 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
18 | pte_t *ptep); | ||
19 | |||
20 | /* | 18 | /* |
21 | * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs | 19 | * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs |
22 | * to override the version in mm/hugetlb.c | 20 | * to override the version in mm/hugetlb.c |
@@ -42,9 +40,26 @@ static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) | |||
42 | { | 40 | { |
43 | } | 41 | } |
44 | 42 | ||
43 | |||
44 | static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
45 | pte_t *ptep, pte_t pte) | ||
46 | { | ||
47 | set_pte_at(mm, addr, ptep, pte); | ||
48 | } | ||
49 | |||
50 | static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, | ||
51 | unsigned long addr, pte_t *ptep) | ||
52 | { | ||
53 | unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1); | ||
54 | return __pte(old); | ||
55 | } | ||
56 | |||
45 | static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, | 57 | static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, |
46 | unsigned long addr, pte_t *ptep) | 58 | unsigned long addr, pte_t *ptep) |
47 | { | 59 | { |
60 | pte_t pte; | ||
61 | pte = huge_ptep_get_and_clear(vma->vm_mm, addr, ptep); | ||
62 | flush_tlb_page(vma, addr); | ||
48 | } | 63 | } |
49 | 64 | ||
50 | static inline int huge_pte_none(pte_t pte) | 65 | static inline int huge_pte_none(pte_t pte) |
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index c27caac47ad1..f0275818b95c 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h | |||
@@ -212,6 +212,19 @@ | |||
212 | #define H_QUERY_INT_STATE 0x1E4 | 212 | #define H_QUERY_INT_STATE 0x1E4 |
213 | #define H_POLL_PENDING 0x1D8 | 213 | #define H_POLL_PENDING 0x1D8 |
214 | #define H_ILLAN_ATTRIBUTES 0x244 | 214 | #define H_ILLAN_ATTRIBUTES 0x244 |
215 | #define H_MODIFY_HEA_QP 0x250 | ||
216 | #define H_QUERY_HEA_QP 0x254 | ||
217 | #define H_QUERY_HEA 0x258 | ||
218 | #define H_QUERY_HEA_PORT 0x25C | ||
219 | #define H_MODIFY_HEA_PORT 0x260 | ||
220 | #define H_REG_BCMC 0x264 | ||
221 | #define H_DEREG_BCMC 0x268 | ||
222 | #define H_REGISTER_HEA_RPAGES 0x26C | ||
223 | #define H_DISABLE_AND_GET_HEA 0x270 | ||
224 | #define H_GET_HEA_INFO 0x274 | ||
225 | #define H_ALLOC_HEA_RESOURCE 0x278 | ||
226 | #define H_ADD_CONN 0x284 | ||
227 | #define H_DEL_CONN 0x288 | ||
215 | #define H_JOIN 0x298 | 228 | #define H_JOIN 0x298 |
216 | #define H_VASI_STATE 0x2A4 | 229 | #define H_VASI_STATE 0x2A4 |
217 | #define H_ENABLE_CRQ 0x2B0 | 230 | #define H_ENABLE_CRQ 0x2B0 |
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index abbc2aaaced5..9f4c9d4f5803 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -64,11 +64,6 @@ extern void iseries_handle_interrupts(void); | |||
64 | get_paca()->hard_enabled = 0; \ | 64 | get_paca()->hard_enabled = 0; \ |
65 | } while(0) | 65 | } while(0) |
66 | 66 | ||
67 | static inline int irqs_disabled_flags(unsigned long flags) | ||
68 | { | ||
69 | return flags == 0; | ||
70 | } | ||
71 | |||
72 | #else | 67 | #else |
73 | 68 | ||
74 | #if defined(CONFIG_BOOKE) | 69 | #if defined(CONFIG_BOOKE) |
diff --git a/arch/powerpc/include/asm/immap_cpm2.h b/arch/powerpc/include/asm/immap_cpm2.h index d4f069bf0e57..7c64fda5357b 100644 --- a/arch/powerpc/include/asm/immap_cpm2.h +++ b/arch/powerpc/include/asm/immap_cpm2.h | |||
@@ -549,7 +549,7 @@ typedef struct comm_proc { | |||
549 | 549 | ||
550 | /* USB Controller. | 550 | /* USB Controller. |
551 | */ | 551 | */ |
552 | typedef struct usb_ctlr { | 552 | typedef struct cpm_usb_ctlr { |
553 | u8 usb_usmod; | 553 | u8 usb_usmod; |
554 | u8 usb_usadr; | 554 | u8 usb_usadr; |
555 | u8 usb_uscom; | 555 | u8 usb_uscom; |
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h index c346d0bcd230..4e10f508570a 100644 --- a/arch/powerpc/include/asm/immap_qe.h +++ b/arch/powerpc/include/asm/immap_qe.h | |||
@@ -210,7 +210,7 @@ struct sir { | |||
210 | } __attribute__ ((packed)); | 210 | } __attribute__ ((packed)); |
211 | 211 | ||
212 | /* USB Controller */ | 212 | /* USB Controller */ |
213 | struct usb_ctlr { | 213 | struct qe_usb_ctlr { |
214 | u8 usb_usmod; | 214 | u8 usb_usmod; |
215 | u8 usb_usadr; | 215 | u8 usb_usadr; |
216 | u8 usb_uscom; | 216 | u8 usb_uscom; |
@@ -229,7 +229,7 @@ struct usb_ctlr { | |||
229 | } __attribute__ ((packed)); | 229 | } __attribute__ ((packed)); |
230 | 230 | ||
231 | /* MCC */ | 231 | /* MCC */ |
232 | struct mcc { | 232 | struct qe_mcc { |
233 | __be32 mcce; /* MCC event register */ | 233 | __be32 mcce; /* MCC event register */ |
234 | __be32 mccm; /* MCC mask register */ | 234 | __be32 mccm; /* MCC mask register */ |
235 | __be32 mccf; /* MCC configuration register */ | 235 | __be32 mccf; /* MCC configuration register */ |
@@ -431,9 +431,9 @@ struct qe_immap { | |||
431 | struct qe_mux qmx; /* QE Multiplexer */ | 431 | struct qe_mux qmx; /* QE Multiplexer */ |
432 | struct qe_timers qet; /* QE Timers */ | 432 | struct qe_timers qet; /* QE Timers */ |
433 | struct spi spi[0x2]; /* spi */ | 433 | struct spi spi[0x2]; /* spi */ |
434 | struct mcc mcc; /* mcc */ | 434 | struct qe_mcc mcc; /* mcc */ |
435 | struct qe_brg brg; /* brg */ | 435 | struct qe_brg brg; /* brg */ |
436 | struct usb_ctlr usb; /* USB */ | 436 | struct qe_usb_ctlr usb; /* USB */ |
437 | struct si1 si1; /* SI */ | 437 | struct si1 si1; /* SI */ |
438 | u8 res11[0x800]; | 438 | u8 res11[0x800]; |
439 | struct sir sir; /* SI Routing Tables */ | 439 | struct sir sir; /* SI Routing Tables */ |
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index bbcd1aaf3dfd..e054baef1845 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h | |||
@@ -17,8 +17,6 @@ | |||
17 | #include <asm/atomic.h> | 17 | #include <asm/atomic.h> |
18 | 18 | ||
19 | 19 | ||
20 | #define get_irq_desc(irq) (&irq_desc[(irq)]) | ||
21 | |||
22 | /* Define a way to iterate across irqs. */ | 20 | /* Define a way to iterate across irqs. */ |
23 | #define for_each_irq(i) \ | 21 | #define for_each_irq(i) \ |
24 | for ((i) = 0; (i) < NR_IRQS; ++(i)) | 22 | for ((i) = 0; (i) < NR_IRQS; ++(i)) |
@@ -34,12 +32,15 @@ extern atomic_t ppc_n_lost_interrupts; | |||
34 | */ | 32 | */ |
35 | #define NO_IRQ_IGNORE ((unsigned int)-1) | 33 | #define NO_IRQ_IGNORE ((unsigned int)-1) |
36 | 34 | ||
37 | /* Total number of virq in the platform (make it a CONFIG_* option ? */ | 35 | /* Total number of virq in the platform */ |
38 | #define NR_IRQS 512 | 36 | #define NR_IRQS CONFIG_NR_IRQS |
39 | 37 | ||
40 | /* Number of irqs reserved for the legacy controller */ | 38 | /* Number of irqs reserved for the legacy controller */ |
41 | #define NUM_ISA_INTERRUPTS 16 | 39 | #define NUM_ISA_INTERRUPTS 16 |
42 | 40 | ||
41 | /* Same thing, used by the generic IRQ code */ | ||
42 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS | ||
43 | |||
43 | /* This type is the placeholder for a hardware interrupt number. It has to | 44 | /* This type is the placeholder for a hardware interrupt number. It has to |
44 | * be big enough to enclose whatever representation is used by a given | 45 | * be big enough to enclose whatever representation is used by a given |
45 | * platform. | 46 | * platform. |
@@ -99,7 +100,7 @@ struct irq_host_ops { | |||
99 | * interrupt controller has for that line) | 100 | * interrupt controller has for that line) |
100 | */ | 101 | */ |
101 | int (*xlate)(struct irq_host *h, struct device_node *ctrler, | 102 | int (*xlate)(struct irq_host *h, struct device_node *ctrler, |
102 | u32 *intspec, unsigned int intsize, | 103 | const u32 *intspec, unsigned int intsize, |
103 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | 104 | irq_hw_number_t *out_hwirq, unsigned int *out_type); |
104 | }; | 105 | }; |
105 | 106 | ||
@@ -313,7 +314,7 @@ extern void irq_free_virt(unsigned int virq, unsigned int count); | |||
313 | * of the of_irq_map_*() functions. | 314 | * of the of_irq_map_*() functions. |
314 | */ | 315 | */ |
315 | extern unsigned int irq_create_of_mapping(struct device_node *controller, | 316 | extern unsigned int irq_create_of_mapping(struct device_node *controller, |
316 | u32 *intspec, unsigned int intsize); | 317 | const u32 *intspec, unsigned int intsize); |
317 | 318 | ||
318 | /** | 319 | /** |
319 | * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space | 320 | * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space |
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h index bb2de6aa5ce0..81f3b0b5601e 100644 --- a/arch/powerpc/include/asm/kvm.h +++ b/arch/powerpc/include/asm/kvm.h | |||
@@ -46,6 +46,24 @@ struct kvm_regs { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | struct kvm_sregs { | 48 | struct kvm_sregs { |
49 | __u32 pvr; | ||
50 | union { | ||
51 | struct { | ||
52 | __u64 sdr1; | ||
53 | struct { | ||
54 | struct { | ||
55 | __u64 slbe; | ||
56 | __u64 slbv; | ||
57 | } slb[64]; | ||
58 | } ppc64; | ||
59 | struct { | ||
60 | __u32 sr[16]; | ||
61 | __u64 ibat[8]; | ||
62 | __u64 dbat[8]; | ||
63 | } ppc32; | ||
64 | } s; | ||
65 | __u8 pad[1020]; | ||
66 | } u; | ||
49 | }; | 67 | }; |
50 | 68 | ||
51 | struct kvm_fpu { | 69 | struct kvm_fpu { |
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h index 56bfae59837f..af2abe74f544 100644 --- a/arch/powerpc/include/asm/kvm_asm.h +++ b/arch/powerpc/include/asm/kvm_asm.h | |||
@@ -49,6 +49,46 @@ | |||
49 | #define BOOKE_INTERRUPT_SPE_FP_ROUND 34 | 49 | #define BOOKE_INTERRUPT_SPE_FP_ROUND 34 |
50 | #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 | 50 | #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 |
51 | 51 | ||
52 | /* book3s */ | ||
53 | |||
54 | #define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100 | ||
55 | #define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200 | ||
56 | #define BOOK3S_INTERRUPT_DATA_STORAGE 0x300 | ||
57 | #define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380 | ||
58 | #define BOOK3S_INTERRUPT_INST_STORAGE 0x400 | ||
59 | #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480 | ||
60 | #define BOOK3S_INTERRUPT_EXTERNAL 0x500 | ||
61 | #define BOOK3S_INTERRUPT_ALIGNMENT 0x600 | ||
62 | #define BOOK3S_INTERRUPT_PROGRAM 0x700 | ||
63 | #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800 | ||
64 | #define BOOK3S_INTERRUPT_DECREMENTER 0x900 | ||
65 | #define BOOK3S_INTERRUPT_SYSCALL 0xc00 | ||
66 | #define BOOK3S_INTERRUPT_TRACE 0xd00 | ||
67 | #define BOOK3S_INTERRUPT_PERFMON 0xf00 | ||
68 | #define BOOK3S_INTERRUPT_ALTIVEC 0xf20 | ||
69 | #define BOOK3S_INTERRUPT_VSX 0xf40 | ||
70 | |||
71 | #define BOOK3S_IRQPRIO_SYSTEM_RESET 0 | ||
72 | #define BOOK3S_IRQPRIO_DATA_SEGMENT 1 | ||
73 | #define BOOK3S_IRQPRIO_INST_SEGMENT 2 | ||
74 | #define BOOK3S_IRQPRIO_DATA_STORAGE 3 | ||
75 | #define BOOK3S_IRQPRIO_INST_STORAGE 4 | ||
76 | #define BOOK3S_IRQPRIO_ALIGNMENT 5 | ||
77 | #define BOOK3S_IRQPRIO_PROGRAM 6 | ||
78 | #define BOOK3S_IRQPRIO_FP_UNAVAIL 7 | ||
79 | #define BOOK3S_IRQPRIO_ALTIVEC 8 | ||
80 | #define BOOK3S_IRQPRIO_VSX 9 | ||
81 | #define BOOK3S_IRQPRIO_SYSCALL 10 | ||
82 | #define BOOK3S_IRQPRIO_MACHINE_CHECK 11 | ||
83 | #define BOOK3S_IRQPRIO_DEBUG 12 | ||
84 | #define BOOK3S_IRQPRIO_EXTERNAL 13 | ||
85 | #define BOOK3S_IRQPRIO_DECREMENTER 14 | ||
86 | #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15 | ||
87 | #define BOOK3S_IRQPRIO_MAX 16 | ||
88 | |||
89 | #define BOOK3S_HFLAG_DCBZ32 0x1 | ||
90 | #define BOOK3S_HFLAG_SLB 0x2 | ||
91 | |||
52 | #define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ | 92 | #define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ |
53 | #define RESUME_FLAG_HOST (1<<1) /* Resume host? */ | 93 | #define RESUME_FLAG_HOST (1<<1) /* Resume host? */ |
54 | 94 | ||
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h new file mode 100644 index 000000000000..74b7369770d0 --- /dev/null +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License, version 2, as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * You should have received a copy of the GNU General Public License | ||
12 | * along with this program; if not, write to the Free Software | ||
13 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
14 | * | ||
15 | * Copyright SUSE Linux Products GmbH 2009 | ||
16 | * | ||
17 | * Authors: Alexander Graf <agraf@suse.de> | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_KVM_BOOK3S_H__ | ||
21 | #define __ASM_KVM_BOOK3S_H__ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | #include <linux/kvm_host.h> | ||
25 | #include <asm/kvm_ppc.h> | ||
26 | |||
27 | struct kvmppc_slb { | ||
28 | u64 esid; | ||
29 | u64 vsid; | ||
30 | u64 orige; | ||
31 | u64 origv; | ||
32 | bool valid; | ||
33 | bool Ks; | ||
34 | bool Kp; | ||
35 | bool nx; | ||
36 | bool large; | ||
37 | bool class; | ||
38 | }; | ||
39 | |||
40 | struct kvmppc_sr { | ||
41 | u32 raw; | ||
42 | u32 vsid; | ||
43 | bool Ks; | ||
44 | bool Kp; | ||
45 | bool nx; | ||
46 | }; | ||
47 | |||
48 | struct kvmppc_bat { | ||
49 | u64 raw; | ||
50 | u32 bepi; | ||
51 | u32 bepi_mask; | ||
52 | bool vs; | ||
53 | bool vp; | ||
54 | u32 brpn; | ||
55 | u8 wimg; | ||
56 | u8 pp; | ||
57 | }; | ||
58 | |||
59 | struct kvmppc_sid_map { | ||
60 | u64 guest_vsid; | ||
61 | u64 guest_esid; | ||
62 | u64 host_vsid; | ||
63 | bool valid; | ||
64 | }; | ||
65 | |||
66 | #define SID_MAP_BITS 9 | ||
67 | #define SID_MAP_NUM (1 << SID_MAP_BITS) | ||
68 | #define SID_MAP_MASK (SID_MAP_NUM - 1) | ||
69 | |||
70 | struct kvmppc_vcpu_book3s { | ||
71 | struct kvm_vcpu vcpu; | ||
72 | struct kvmppc_sid_map sid_map[SID_MAP_NUM]; | ||
73 | struct kvmppc_slb slb[64]; | ||
74 | struct { | ||
75 | u64 esid; | ||
76 | u64 vsid; | ||
77 | } slb_shadow[64]; | ||
78 | u8 slb_shadow_max; | ||
79 | struct kvmppc_sr sr[16]; | ||
80 | struct kvmppc_bat ibat[8]; | ||
81 | struct kvmppc_bat dbat[8]; | ||
82 | u64 hid[6]; | ||
83 | int slb_nr; | ||
84 | u64 sdr1; | ||
85 | u64 dsisr; | ||
86 | u64 hior; | ||
87 | u64 msr_mask; | ||
88 | u64 vsid_first; | ||
89 | u64 vsid_next; | ||
90 | u64 vsid_max; | ||
91 | int context_id; | ||
92 | }; | ||
93 | |||
94 | #define CONTEXT_HOST 0 | ||
95 | #define CONTEXT_GUEST 1 | ||
96 | #define CONTEXT_GUEST_END 2 | ||
97 | |||
98 | #define VSID_REAL 0xfffffffffff00000 | ||
99 | #define VSID_REAL_DR 0xffffffffffe00000 | ||
100 | #define VSID_REAL_IR 0xffffffffffd00000 | ||
101 | #define VSID_BAT 0xffffffffffc00000 | ||
102 | #define VSID_PR 0x8000000000000000 | ||
103 | |||
104 | extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 ea, u64 ea_mask); | ||
105 | extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); | ||
106 | extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end); | ||
107 | extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); | ||
108 | extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); | ||
109 | extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); | ||
110 | extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); | ||
111 | extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); | ||
112 | extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); | ||
113 | extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data); | ||
114 | extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr, bool data); | ||
115 | extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr); | ||
116 | extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); | ||
117 | extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat, | ||
118 | bool upper, u32 val); | ||
119 | |||
120 | extern u32 kvmppc_trampoline_lowmem; | ||
121 | extern u32 kvmppc_trampoline_enter; | ||
122 | |||
123 | static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu) | ||
124 | { | ||
125 | return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu); | ||
126 | } | ||
127 | |||
128 | static inline ulong dsisr(void) | ||
129 | { | ||
130 | ulong r; | ||
131 | asm ( "mfdsisr %0 " : "=r" (r) ); | ||
132 | return r; | ||
133 | } | ||
134 | |||
135 | extern void kvm_return_point(void); | ||
136 | |||
137 | #define INS_DCBZ 0x7c0007ec | ||
138 | |||
139 | #endif /* __ASM_KVM_BOOK3S_H__ */ | ||
diff --git a/arch/powerpc/include/asm/kvm_book3s_64_asm.h b/arch/powerpc/include/asm/kvm_book3s_64_asm.h new file mode 100644 index 000000000000..2e06ee8184ef --- /dev/null +++ b/arch/powerpc/include/asm/kvm_book3s_64_asm.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License, version 2, as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * You should have received a copy of the GNU General Public License | ||
12 | * along with this program; if not, write to the Free Software | ||
13 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
14 | * | ||
15 | * Copyright SUSE Linux Products GmbH 2009 | ||
16 | * | ||
17 | * Authors: Alexander Graf <agraf@suse.de> | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_KVM_BOOK3S_ASM_H__ | ||
21 | #define __ASM_KVM_BOOK3S_ASM_H__ | ||
22 | |||
23 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER | ||
24 | |||
25 | #include <asm/kvm_asm.h> | ||
26 | |||
27 | .macro DO_KVM intno | ||
28 | .if (\intno == BOOK3S_INTERRUPT_SYSTEM_RESET) || \ | ||
29 | (\intno == BOOK3S_INTERRUPT_MACHINE_CHECK) || \ | ||
30 | (\intno == BOOK3S_INTERRUPT_DATA_STORAGE) || \ | ||
31 | (\intno == BOOK3S_INTERRUPT_INST_STORAGE) || \ | ||
32 | (\intno == BOOK3S_INTERRUPT_DATA_SEGMENT) || \ | ||
33 | (\intno == BOOK3S_INTERRUPT_INST_SEGMENT) || \ | ||
34 | (\intno == BOOK3S_INTERRUPT_EXTERNAL) || \ | ||
35 | (\intno == BOOK3S_INTERRUPT_ALIGNMENT) || \ | ||
36 | (\intno == BOOK3S_INTERRUPT_PROGRAM) || \ | ||
37 | (\intno == BOOK3S_INTERRUPT_FP_UNAVAIL) || \ | ||
38 | (\intno == BOOK3S_INTERRUPT_DECREMENTER) || \ | ||
39 | (\intno == BOOK3S_INTERRUPT_SYSCALL) || \ | ||
40 | (\intno == BOOK3S_INTERRUPT_TRACE) || \ | ||
41 | (\intno == BOOK3S_INTERRUPT_PERFMON) || \ | ||
42 | (\intno == BOOK3S_INTERRUPT_ALTIVEC) || \ | ||
43 | (\intno == BOOK3S_INTERRUPT_VSX) | ||
44 | |||
45 | b kvmppc_trampoline_\intno | ||
46 | kvmppc_resume_\intno: | ||
47 | |||
48 | .endif | ||
49 | .endm | ||
50 | |||
51 | #else | ||
52 | |||
53 | .macro DO_KVM intno | ||
54 | .endm | ||
55 | |||
56 | #endif /* CONFIG_KVM_BOOK3S_64_HANDLER */ | ||
57 | |||
58 | #endif /* __ASM_KVM_BOOK3S_ASM_H__ */ | ||
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index c9c930ed11d7..1201f62d0d73 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -21,7 +21,8 @@ | |||
21 | #define __POWERPC_KVM_HOST_H__ | 21 | #define __POWERPC_KVM_HOST_H__ |
22 | 22 | ||
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/timer.h> | 24 | #include <linux/hrtimer.h> |
25 | #include <linux/interrupt.h> | ||
25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
26 | #include <linux/kvm_types.h> | 27 | #include <linux/kvm_types.h> |
27 | #include <asm/kvm_asm.h> | 28 | #include <asm/kvm_asm.h> |
@@ -37,6 +38,8 @@ | |||
37 | #define KVM_NR_PAGE_SIZES 1 | 38 | #define KVM_NR_PAGE_SIZES 1 |
38 | #define KVM_PAGES_PER_HPAGE(x) (1UL<<31) | 39 | #define KVM_PAGES_PER_HPAGE(x) (1UL<<31) |
39 | 40 | ||
41 | #define HPTEG_CACHE_NUM 1024 | ||
42 | |||
40 | struct kvm; | 43 | struct kvm; |
41 | struct kvm_run; | 44 | struct kvm_run; |
42 | struct kvm_vcpu; | 45 | struct kvm_vcpu; |
@@ -63,6 +66,17 @@ struct kvm_vcpu_stat { | |||
63 | u32 dec_exits; | 66 | u32 dec_exits; |
64 | u32 ext_intr_exits; | 67 | u32 ext_intr_exits; |
65 | u32 halt_wakeup; | 68 | u32 halt_wakeup; |
69 | #ifdef CONFIG_PPC64 | ||
70 | u32 pf_storage; | ||
71 | u32 pf_instruc; | ||
72 | u32 sp_storage; | ||
73 | u32 sp_instruc; | ||
74 | u32 queue_intr; | ||
75 | u32 ld; | ||
76 | u32 ld_slow; | ||
77 | u32 st; | ||
78 | u32 st_slow; | ||
79 | #endif | ||
66 | }; | 80 | }; |
67 | 81 | ||
68 | enum kvm_exit_types { | 82 | enum kvm_exit_types { |
@@ -109,9 +123,53 @@ struct kvmppc_exit_timing { | |||
109 | struct kvm_arch { | 123 | struct kvm_arch { |
110 | }; | 124 | }; |
111 | 125 | ||
126 | struct kvmppc_pte { | ||
127 | u64 eaddr; | ||
128 | u64 vpage; | ||
129 | u64 raddr; | ||
130 | bool may_read; | ||
131 | bool may_write; | ||
132 | bool may_execute; | ||
133 | }; | ||
134 | |||
135 | struct kvmppc_mmu { | ||
136 | /* book3s_64 only */ | ||
137 | void (*slbmte)(struct kvm_vcpu *vcpu, u64 rb, u64 rs); | ||
138 | u64 (*slbmfee)(struct kvm_vcpu *vcpu, u64 slb_nr); | ||
139 | u64 (*slbmfev)(struct kvm_vcpu *vcpu, u64 slb_nr); | ||
140 | void (*slbie)(struct kvm_vcpu *vcpu, u64 slb_nr); | ||
141 | void (*slbia)(struct kvm_vcpu *vcpu); | ||
142 | /* book3s */ | ||
143 | void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value); | ||
144 | u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum); | ||
145 | int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data); | ||
146 | void (*reset_msr)(struct kvm_vcpu *vcpu); | ||
147 | void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large); | ||
148 | int (*esid_to_vsid)(struct kvm_vcpu *vcpu, u64 esid, u64 *vsid); | ||
149 | u64 (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data); | ||
150 | bool (*is_dcbz32)(struct kvm_vcpu *vcpu); | ||
151 | }; | ||
152 | |||
153 | struct hpte_cache { | ||
154 | u64 host_va; | ||
155 | u64 pfn; | ||
156 | ulong slot; | ||
157 | struct kvmppc_pte pte; | ||
158 | }; | ||
159 | |||
112 | struct kvm_vcpu_arch { | 160 | struct kvm_vcpu_arch { |
113 | u32 host_stack; | 161 | ulong host_stack; |
114 | u32 host_pid; | 162 | u32 host_pid; |
163 | #ifdef CONFIG_PPC64 | ||
164 | ulong host_msr; | ||
165 | ulong host_r2; | ||
166 | void *host_retip; | ||
167 | ulong trampoline_lowmem; | ||
168 | ulong trampoline_enter; | ||
169 | ulong highmem_handler; | ||
170 | ulong host_paca_phys; | ||
171 | struct kvmppc_mmu mmu; | ||
172 | #endif | ||
115 | 173 | ||
116 | u64 fpr[32]; | 174 | u64 fpr[32]; |
117 | ulong gpr[32]; | 175 | ulong gpr[32]; |
@@ -123,6 +181,10 @@ struct kvm_vcpu_arch { | |||
123 | ulong xer; | 181 | ulong xer; |
124 | 182 | ||
125 | ulong msr; | 183 | ulong msr; |
184 | #ifdef CONFIG_PPC64 | ||
185 | ulong shadow_msr; | ||
186 | ulong hflags; | ||
187 | #endif | ||
126 | u32 mmucr; | 188 | u32 mmucr; |
127 | ulong sprg0; | 189 | ulong sprg0; |
128 | ulong sprg1; | 190 | ulong sprg1; |
@@ -149,6 +211,7 @@ struct kvm_vcpu_arch { | |||
149 | u32 ivor[64]; | 211 | u32 ivor[64]; |
150 | ulong ivpr; | 212 | ulong ivpr; |
151 | u32 pir; | 213 | u32 pir; |
214 | u32 pvr; | ||
152 | 215 | ||
153 | u32 shadow_pid; | 216 | u32 shadow_pid; |
154 | u32 pid; | 217 | u32 pid; |
@@ -174,6 +237,9 @@ struct kvm_vcpu_arch { | |||
174 | #endif | 237 | #endif |
175 | 238 | ||
176 | u32 last_inst; | 239 | u32 last_inst; |
240 | #ifdef CONFIG_PPC64 | ||
241 | ulong fault_dsisr; | ||
242 | #endif | ||
177 | ulong fault_dear; | 243 | ulong fault_dear; |
178 | ulong fault_esr; | 244 | ulong fault_esr; |
179 | gpa_t paddr_accessed; | 245 | gpa_t paddr_accessed; |
@@ -185,8 +251,15 @@ struct kvm_vcpu_arch { | |||
185 | 251 | ||
186 | u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ | 252 | u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ |
187 | 253 | ||
188 | struct timer_list dec_timer; | 254 | struct hrtimer dec_timer; |
255 | struct tasklet_struct tasklet; | ||
256 | u64 dec_jiffies; | ||
189 | unsigned long pending_exceptions; | 257 | unsigned long pending_exceptions; |
258 | |||
259 | #ifdef CONFIG_PPC64 | ||
260 | struct hpte_cache hpte_cache[HPTEG_CACHE_NUM]; | ||
261 | int hpte_cache_offset; | ||
262 | #endif | ||
190 | }; | 263 | }; |
191 | 264 | ||
192 | #endif /* __POWERPC_KVM_HOST_H__ */ | 265 | #endif /* __POWERPC_KVM_HOST_H__ */ |
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 2c6ee349df5e..269ee46ab028 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h | |||
@@ -39,6 +39,7 @@ enum emulation_result { | |||
39 | extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); | 39 | extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); |
40 | extern char kvmppc_handlers_start[]; | 40 | extern char kvmppc_handlers_start[]; |
41 | extern unsigned long kvmppc_handler_len; | 41 | extern unsigned long kvmppc_handler_len; |
42 | extern void kvmppc_handler_highmem(void); | ||
42 | 43 | ||
43 | extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu); | 44 | extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu); |
44 | extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, | 45 | extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, |
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h index f78f65c38f05..14b592dfb4e8 100644 --- a/arch/powerpc/include/asm/lppaca.h +++ b/arch/powerpc/include/asm/lppaca.h | |||
@@ -100,7 +100,14 @@ struct lppaca { | |||
100 | // Used to pass parms from the OS to PLIC for SetAsrAndRfid | 100 | // Used to pass parms from the OS to PLIC for SetAsrAndRfid |
101 | u64 saved_gpr3; // Saved GPR3 x20-x27 | 101 | u64 saved_gpr3; // Saved GPR3 x20-x27 |
102 | u64 saved_gpr4; // Saved GPR4 x28-x2F | 102 | u64 saved_gpr4; // Saved GPR4 x28-x2F |
103 | u64 saved_gpr5; // Saved GPR5 x30-x37 | 103 | union { |
104 | u64 saved_gpr5; /* Saved GPR5 x30-x37 */ | ||
105 | struct { | ||
106 | u8 cede_latency_hint; /* x30 */ | ||
107 | u8 reserved[7]; /* x31-x36 */ | ||
108 | } fields; | ||
109 | } gpr5_dword; | ||
110 | |||
104 | 111 | ||
105 | u8 dtl_enable_mask; // Dispatch Trace Log mask x38-x38 | 112 | u8 dtl_enable_mask; // Dispatch Trace Log mask x38-x38 |
106 | u8 donate_dedicated_cpu; // Donate dedicated CPU cycles x39-x39 | 113 | u8 donate_dedicated_cpu; // Donate dedicated CPU cycles x39-x39 |
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 9efa2be78331..9f0fc9e6ce0d 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h | |||
@@ -266,6 +266,11 @@ struct machdep_calls { | |||
266 | void (*suspend_disable_irqs)(void); | 266 | void (*suspend_disable_irqs)(void); |
267 | void (*suspend_enable_irqs)(void); | 267 | void (*suspend_enable_irqs)(void); |
268 | #endif | 268 | #endif |
269 | |||
270 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
271 | ssize_t (*cpu_probe)(const char *, size_t); | ||
272 | ssize_t (*cpu_release)(const char *, size_t); | ||
273 | #endif | ||
269 | }; | 274 | }; |
270 | 275 | ||
271 | extern void e500_idle(void); | 276 | extern void e500_idle(void); |
diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h index 079c06eae446..a062c57696d0 100644 --- a/arch/powerpc/include/asm/macio.h +++ b/arch/powerpc/include/asm/macio.h | |||
@@ -39,6 +39,7 @@ struct macio_dev | |||
39 | struct macio_bus *bus; /* macio bus this device is on */ | 39 | struct macio_bus *bus; /* macio bus this device is on */ |
40 | struct macio_dev *media_bay; /* Device is part of a media bay */ | 40 | struct macio_dev *media_bay; /* Device is part of a media bay */ |
41 | struct of_device ofdev; | 41 | struct of_device ofdev; |
42 | struct device_dma_parameters dma_parms; /* ide needs that */ | ||
42 | int n_resources; | 43 | int n_resources; |
43 | struct resource resource[MACIO_DEV_COUNT_RESOURCES]; | 44 | struct resource resource[MACIO_DEV_COUNT_RESOURCES]; |
44 | int n_interrupts; | 45 | int n_interrupts; |
@@ -78,6 +79,8 @@ static inline unsigned long macio_resource_len(struct macio_dev *dev, int resour | |||
78 | return res->end - res->start + 1; | 79 | return res->end - res->start + 1; |
79 | } | 80 | } |
80 | 81 | ||
82 | extern int macio_enable_devres(struct macio_dev *dev); | ||
83 | |||
81 | extern int macio_request_resource(struct macio_dev *dev, int resource_no, const char *name); | 84 | extern int macio_request_resource(struct macio_dev *dev, int resource_no, const char *name); |
82 | extern void macio_release_resource(struct macio_dev *dev, int resource_no); | 85 | extern void macio_release_resource(struct macio_dev *dev, int resource_no); |
83 | extern int macio_request_resources(struct macio_dev *dev, const char *name); | 86 | extern int macio_request_resources(struct macio_dev *dev, const char *name); |
@@ -131,6 +134,9 @@ struct macio_driver | |||
131 | int (*resume)(struct macio_dev* dev); | 134 | int (*resume)(struct macio_dev* dev); |
132 | int (*shutdown)(struct macio_dev* dev); | 135 | int (*shutdown)(struct macio_dev* dev); |
133 | 136 | ||
137 | #ifdef CONFIG_PMAC_MEDIABAY | ||
138 | void (*mediabay_event)(struct macio_dev* dev, int mb_state); | ||
139 | #endif | ||
134 | struct device_driver driver; | 140 | struct device_driver driver; |
135 | }; | 141 | }; |
136 | #define to_macio_driver(drv) container_of(drv,struct macio_driver, driver) | 142 | #define to_macio_driver(drv) container_of(drv,struct macio_driver, driver) |
diff --git a/arch/powerpc/include/asm/mediabay.h b/arch/powerpc/include/asm/mediabay.h index b2efb3325808..11037a4133ee 100644 --- a/arch/powerpc/include/asm/mediabay.h +++ b/arch/powerpc/include/asm/mediabay.h | |||
@@ -17,26 +17,31 @@ | |||
17 | #define MB_POWER 6 /* media bay contains a Power device (???) */ | 17 | #define MB_POWER 6 /* media bay contains a Power device (???) */ |
18 | #define MB_NO 7 /* media bay contains nothing */ | 18 | #define MB_NO 7 /* media bay contains nothing */ |
19 | 19 | ||
20 | /* Number of bays in the machine or 0 */ | 20 | struct macio_dev; |
21 | extern int media_bay_count; | ||
22 | 21 | ||
23 | #ifdef CONFIG_BLK_DEV_IDE_PMAC | 22 | #ifdef CONFIG_PMAC_MEDIABAY |
24 | #include <linux/ide.h> | ||
25 | 23 | ||
26 | int check_media_bay_by_base(unsigned long base, int what); | 24 | /* Check the content type of the bay, returns MB_NO if the bay is still |
27 | /* called by IDE PMAC host driver to register IDE controller for media bay */ | 25 | * transitionning |
28 | int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base, | 26 | */ |
29 | int irq, ide_hwif_t *hwif); | 27 | extern int check_media_bay(struct macio_dev *bay); |
30 | 28 | ||
31 | int check_media_bay(struct device_node *which_bay, int what); | 29 | /* The ATA driver uses the calls below to temporarily hold on the |
30 | * media bay callbacks while initializing the interface | ||
31 | */ | ||
32 | extern void lock_media_bay(struct macio_dev *bay); | ||
33 | extern void unlock_media_bay(struct macio_dev *bay); | ||
32 | 34 | ||
33 | #else | 35 | #else |
34 | 36 | ||
35 | static inline int check_media_bay(struct device_node *which_bay, int what) | 37 | static inline int check_media_bay(struct macio_dev *bay) |
36 | { | 38 | { |
37 | return -ENODEV; | 39 | return MB_NO; |
38 | } | 40 | } |
39 | 41 | ||
42 | static inline void lock_media_bay(struct macio_dev *bay) { } | ||
43 | static inline void unlock_media_bay(struct macio_dev *bay) { } | ||
44 | |||
40 | #endif | 45 | #endif |
41 | 46 | ||
42 | #endif /* __KERNEL__ */ | 47 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h index bebe31c2e907..2102b214a87c 100644 --- a/arch/powerpc/include/asm/mmu-hash64.h +++ b/arch/powerpc/include/asm/mmu-hash64.h | |||
@@ -173,14 +173,6 @@ extern unsigned long tce_alloc_start, tce_alloc_end; | |||
173 | */ | 173 | */ |
174 | extern int mmu_ci_restrictions; | 174 | extern int mmu_ci_restrictions; |
175 | 175 | ||
176 | #ifdef CONFIG_HUGETLB_PAGE | ||
177 | /* | ||
178 | * The page size indexes of the huge pages for use by hugetlbfs | ||
179 | */ | ||
180 | extern unsigned int mmu_huge_psizes[MMU_PAGE_COUNT]; | ||
181 | |||
182 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
183 | |||
184 | /* | 176 | /* |
185 | * This function sets the AVPN and L fields of the HPTE appropriately | 177 | * This function sets the AVPN and L fields of the HPTE appropriately |
186 | * for the page size | 178 | * for the page size |
@@ -253,10 +245,11 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access, | |||
253 | unsigned long vsid, pte_t *ptep, unsigned long trap, | 245 | unsigned long vsid, pte_t *ptep, unsigned long trap, |
254 | unsigned int local, int ssize); | 246 | unsigned int local, int ssize); |
255 | struct mm_struct; | 247 | struct mm_struct; |
248 | unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap); | ||
256 | extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); | 249 | extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); |
257 | extern int hash_huge_page(struct mm_struct *mm, unsigned long access, | 250 | int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, |
258 | unsigned long ea, unsigned long vsid, int local, | 251 | pte_t *ptep, unsigned long trap, int local, int ssize, |
259 | unsigned long trap); | 252 | unsigned int shift, unsigned int mmu_psize); |
260 | 253 | ||
261 | extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | 254 | extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, |
262 | unsigned long pstart, unsigned long prot, | 255 | unsigned long pstart, unsigned long prot, |
@@ -380,6 +373,38 @@ extern void slb_set_size(u16 size); | |||
380 | 373 | ||
381 | #ifndef __ASSEMBLY__ | 374 | #ifndef __ASSEMBLY__ |
382 | 375 | ||
376 | #ifdef CONFIG_PPC_SUBPAGE_PROT | ||
377 | /* | ||
378 | * For the sub-page protection option, we extend the PGD with one of | ||
379 | * these. Basically we have a 3-level tree, with the top level being | ||
380 | * the protptrs array. To optimize speed and memory consumption when | ||
381 | * only addresses < 4GB are being protected, pointers to the first | ||
382 | * four pages of sub-page protection words are stored in the low_prot | ||
383 | * array. | ||
384 | * Each page of sub-page protection words protects 1GB (4 bytes | ||
385 | * protects 64k). For the 3-level tree, each page of pointers then | ||
386 | * protects 8TB. | ||
387 | */ | ||
388 | struct subpage_prot_table { | ||
389 | unsigned long maxaddr; /* only addresses < this are protected */ | ||
390 | unsigned int **protptrs[2]; | ||
391 | unsigned int *low_prot[4]; | ||
392 | }; | ||
393 | |||
394 | #define SBP_L1_BITS (PAGE_SHIFT - 2) | ||
395 | #define SBP_L2_BITS (PAGE_SHIFT - 3) | ||
396 | #define SBP_L1_COUNT (1 << SBP_L1_BITS) | ||
397 | #define SBP_L2_COUNT (1 << SBP_L2_BITS) | ||
398 | #define SBP_L2_SHIFT (PAGE_SHIFT + SBP_L1_BITS) | ||
399 | #define SBP_L3_SHIFT (SBP_L2_SHIFT + SBP_L2_BITS) | ||
400 | |||
401 | extern void subpage_prot_free(struct mm_struct *mm); | ||
402 | extern void subpage_prot_init_new_context(struct mm_struct *mm); | ||
403 | #else | ||
404 | static inline void subpage_prot_free(struct mm_struct *mm) {} | ||
405 | static inline void subpage_prot_init_new_context(struct mm_struct *mm) { } | ||
406 | #endif /* CONFIG_PPC_SUBPAGE_PROT */ | ||
407 | |||
383 | typedef unsigned long mm_context_id_t; | 408 | typedef unsigned long mm_context_id_t; |
384 | 409 | ||
385 | typedef struct { | 410 | typedef struct { |
@@ -393,6 +418,9 @@ typedef struct { | |||
393 | u16 sllp; /* SLB page size encoding */ | 418 | u16 sllp; /* SLB page size encoding */ |
394 | #endif | 419 | #endif |
395 | unsigned long vdso_base; | 420 | unsigned long vdso_base; |
421 | #ifdef CONFIG_PPC_SUBPAGE_PROT | ||
422 | struct subpage_prot_table spt; | ||
423 | #endif /* CONFIG_PPC_SUBPAGE_PROT */ | ||
396 | } mm_context_t; | 424 | } mm_context_t; |
397 | 425 | ||
398 | 426 | ||
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h index b34e94d94435..26383e0778aa 100644 --- a/arch/powerpc/include/asm/mmu_context.h +++ b/arch/powerpc/include/asm/mmu_context.h | |||
@@ -23,6 +23,8 @@ extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); | |||
23 | extern void set_context(unsigned long id, pgd_t *pgd); | 23 | extern void set_context(unsigned long id, pgd_t *pgd); |
24 | 24 | ||
25 | #ifdef CONFIG_PPC_BOOK3S_64 | 25 | #ifdef CONFIG_PPC_BOOK3S_64 |
26 | extern int __init_new_context(void); | ||
27 | extern void __destroy_context(int context_id); | ||
26 | static inline void mmu_context_init(void) { } | 28 | static inline void mmu_context_init(void) { } |
27 | #else | 29 | #else |
28 | extern void mmu_context_init(void); | 30 | extern void mmu_context_init(void); |
diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h index 1b4f697abbdd..b664ce79a172 100644 --- a/arch/powerpc/include/asm/mpc52xx.h +++ b/arch/powerpc/include/asm/mpc52xx.h | |||
@@ -276,6 +276,53 @@ extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv); | |||
276 | extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node); | 276 | extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node); |
277 | extern void mpc52xx_restart(char *cmd); | 277 | extern void mpc52xx_restart(char *cmd); |
278 | 278 | ||
279 | /* mpc52xx_gpt.c */ | ||
280 | struct mpc52xx_gpt_priv; | ||
281 | extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq); | ||
282 | extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period, | ||
283 | int continuous); | ||
284 | extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt); | ||
285 | extern int mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt); | ||
286 | |||
287 | /* mpc52xx_lpbfifo.c */ | ||
288 | #define MPC52XX_LPBFIFO_FLAG_READ (0) | ||
289 | #define MPC52XX_LPBFIFO_FLAG_WRITE (1<<0) | ||
290 | #define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT (1<<1) | ||
291 | #define MPC52XX_LPBFIFO_FLAG_NO_DMA (1<<2) | ||
292 | #define MPC52XX_LPBFIFO_FLAG_POLL_DMA (1<<3) | ||
293 | |||
294 | struct mpc52xx_lpbfifo_request { | ||
295 | struct list_head list; | ||
296 | |||
297 | /* localplus bus address */ | ||
298 | unsigned int cs; | ||
299 | size_t offset; | ||
300 | |||
301 | /* Memory address */ | ||
302 | void *data; | ||
303 | phys_addr_t data_phys; | ||
304 | |||
305 | /* Details of transfer */ | ||
306 | size_t size; | ||
307 | size_t pos; /* current position of transfer */ | ||
308 | int flags; | ||
309 | |||
310 | /* What to do when finished */ | ||
311 | void (*callback)(struct mpc52xx_lpbfifo_request *); | ||
312 | |||
313 | void *priv; /* Driver private data */ | ||
314 | |||
315 | /* statistics */ | ||
316 | int irq_count; | ||
317 | int irq_ticks; | ||
318 | u8 last_byte; | ||
319 | int buffer_not_done_cnt; | ||
320 | }; | ||
321 | |||
322 | extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req); | ||
323 | extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req); | ||
324 | extern void mpc52xx_lpbfifo_poll(void); | ||
325 | |||
279 | /* mpc52xx_pic.c */ | 326 | /* mpc52xx_pic.c */ |
280 | extern void mpc52xx_init_irq(void); | 327 | extern void mpc52xx_init_irq(void); |
281 | extern unsigned int mpc52xx_get_irq(void); | 328 | extern unsigned int mpc52xx_get_irq(void); |
diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h index 6c587eddee59..850b72f27445 100644 --- a/arch/powerpc/include/asm/nvram.h +++ b/arch/powerpc/include/asm/nvram.h | |||
@@ -73,7 +73,6 @@ extern int nvram_write_error_log(char * buff, int length, | |||
73 | extern int nvram_read_error_log(char * buff, int length, | 73 | extern int nvram_read_error_log(char * buff, int length, |
74 | unsigned int * err_type, unsigned int *err_seq); | 74 | unsigned int * err_type, unsigned int *err_seq); |
75 | extern int nvram_clear_error_log(void); | 75 | extern int nvram_clear_error_log(void); |
76 | extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | ||
77 | 76 | ||
78 | extern int pSeries_nvram_init(void); | 77 | extern int pSeries_nvram_init(void); |
79 | 78 | ||
diff --git a/arch/powerpc/include/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h index e482e5352e69..d4b4bfa26fb3 100644 --- a/arch/powerpc/include/asm/pSeries_reconfig.h +++ b/arch/powerpc/include/asm/pSeries_reconfig.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #ifdef CONFIG_PPC_PSERIES | 17 | #ifdef CONFIG_PPC_PSERIES |
18 | extern int pSeries_reconfig_notifier_register(struct notifier_block *); | 18 | extern int pSeries_reconfig_notifier_register(struct notifier_block *); |
19 | extern void pSeries_reconfig_notifier_unregister(struct notifier_block *); | 19 | extern void pSeries_reconfig_notifier_unregister(struct notifier_block *); |
20 | extern struct blocking_notifier_head pSeries_reconfig_chain; | ||
20 | #else /* !CONFIG_PPC_PSERIES */ | 21 | #else /* !CONFIG_PPC_PSERIES */ |
21 | static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb) | 22 | static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb) |
22 | { | 23 | { |
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 7d8514ceceae..5e9b4ef71415 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h | |||
@@ -129,6 +129,15 @@ struct paca_struct { | |||
129 | u64 system_time; /* accumulated system TB ticks */ | 129 | u64 system_time; /* accumulated system TB ticks */ |
130 | u64 startpurr; /* PURR/TB value snapshot */ | 130 | u64 startpurr; /* PURR/TB value snapshot */ |
131 | u64 startspurr; /* SPURR value snapshot */ | 131 | u64 startspurr; /* SPURR value snapshot */ |
132 | |||
133 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER | ||
134 | struct { | ||
135 | u64 esid; | ||
136 | u64 vsid; | ||
137 | } kvm_slb[64]; /* guest SLB */ | ||
138 | u8 kvm_slb_max; /* highest used guest slb entry */ | ||
139 | u8 kvm_in_guest; /* are we inside the guest? */ | ||
140 | #endif | ||
132 | }; | 141 | }; |
133 | 142 | ||
134 | extern struct paca_struct paca[]; | 143 | extern struct paca_struct paca[]; |
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index ff24254990e1..e96d52a516ba 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
@@ -229,6 +229,20 @@ typedef unsigned long pgprot_t; | |||
229 | 229 | ||
230 | #endif | 230 | #endif |
231 | 231 | ||
232 | typedef struct { signed long pd; } hugepd_t; | ||
233 | #define HUGEPD_SHIFT_MASK 0x3f | ||
234 | |||
235 | #ifdef CONFIG_HUGETLB_PAGE | ||
236 | static inline int hugepd_ok(hugepd_t hpd) | ||
237 | { | ||
238 | return (hpd.pd > 0); | ||
239 | } | ||
240 | |||
241 | #define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep)))) | ||
242 | #else /* CONFIG_HUGETLB_PAGE */ | ||
243 | #define is_hugepd(pdep) 0 | ||
244 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
245 | |||
232 | struct page; | 246 | struct page; |
233 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | 247 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); |
234 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, | 248 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, |
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h index 3f17b83f55a1..bfc4e027e2ad 100644 --- a/arch/powerpc/include/asm/page_64.h +++ b/arch/powerpc/include/asm/page_64.h | |||
@@ -90,7 +90,7 @@ extern unsigned int HPAGE_SHIFT; | |||
90 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | 90 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) |
91 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 91 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
92 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 92 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
93 | #define HUGE_MAX_HSTATE 3 | 93 | #define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1) |
94 | 94 | ||
95 | #endif /* __ASSEMBLY__ */ | 95 | #endif /* __ASSEMBLY__ */ |
96 | 96 | ||
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h index c9500d666a1d..580cf73b96e8 100644 --- a/arch/powerpc/include/asm/pgalloc-32.h +++ b/arch/powerpc/include/asm/pgalloc-32.h | |||
@@ -3,7 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/threads.h> | 4 | #include <linux/threads.h> |
5 | 5 | ||
6 | #define PTE_NONCACHE_NUM 0 /* dummy for now to share code w/ppc64 */ | 6 | /* For 32-bit, all levels of page tables are just drawn from get_free_page() */ |
7 | #define MAX_PGTABLE_INDEX_SIZE 0 | ||
7 | 8 | ||
8 | extern void __bad_pte(pmd_t *pmd); | 9 | extern void __bad_pte(pmd_t *pmd); |
9 | 10 | ||
@@ -36,11 +37,10 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); | |||
36 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); | 37 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); |
37 | extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr); | 38 | extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr); |
38 | 39 | ||
39 | static inline void pgtable_free(pgtable_free_t pgf) | 40 | static inline void pgtable_free(void *table, unsigned index_size) |
40 | { | 41 | { |
41 | void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); | 42 | BUG_ON(index_size); /* 32-bit doesn't use this */ |
42 | 43 | free_page((unsigned long)table); | |
43 | free_page((unsigned long)p); | ||
44 | } | 44 | } |
45 | 45 | ||
46 | #define check_pgt_cache() do { } while (0) | 46 | #define check_pgt_cache() do { } while (0) |
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h index e6f069c4f713..605f5c5398d1 100644 --- a/arch/powerpc/include/asm/pgalloc-64.h +++ b/arch/powerpc/include/asm/pgalloc-64.h | |||
@@ -11,27 +11,34 @@ | |||
11 | #include <linux/cpumask.h> | 11 | #include <linux/cpumask.h> |
12 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> |
13 | 13 | ||
14 | #ifndef CONFIG_PPC_SUBPAGE_PROT | 14 | /* |
15 | static inline void subpage_prot_free(pgd_t *pgd) {} | 15 | * Functions that deal with pagetables that could be at any level of |
16 | #endif | 16 | * the table need to be passed an "index_size" so they know how to |
17 | * handle allocation. For PTE pages (which are linked to a struct | ||
18 | * page for now, and drawn from the main get_free_pages() pool), the | ||
19 | * allocation size will be (2^index_size * sizeof(pointer)) and | ||
20 | * allocations are drawn from the kmem_cache in PGT_CACHE(index_size). | ||
21 | * | ||
22 | * The maximum index size needs to be big enough to allow any | ||
23 | * pagetable sizes we need, but small enough to fit in the low bits of | ||
24 | * any page table pointer. In other words all pagetables, even tiny | ||
25 | * ones, must be aligned to allow at least enough low 0 bits to | ||
26 | * contain this value. This value is also used as a mask, so it must | ||
27 | * be one less than a power of two. | ||
28 | */ | ||
29 | #define MAX_PGTABLE_INDEX_SIZE 0xf | ||
17 | 30 | ||
18 | extern struct kmem_cache *pgtable_cache[]; | 31 | extern struct kmem_cache *pgtable_cache[]; |
19 | 32 | #define PGT_CACHE(shift) (pgtable_cache[(shift)-1]) | |
20 | #define PGD_CACHE_NUM 0 | ||
21 | #define PUD_CACHE_NUM 1 | ||
22 | #define PMD_CACHE_NUM 1 | ||
23 | #define HUGEPTE_CACHE_NUM 2 | ||
24 | #define PTE_NONCACHE_NUM 7 /* from GFP rather than kmem_cache */ | ||
25 | 33 | ||
26 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 34 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
27 | { | 35 | { |
28 | return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL); | 36 | return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), GFP_KERNEL); |
29 | } | 37 | } |
30 | 38 | ||
31 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | 39 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
32 | { | 40 | { |
33 | subpage_prot_free(pgd); | 41 | kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd); |
34 | kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); | ||
35 | } | 42 | } |
36 | 43 | ||
37 | #ifndef CONFIG_PPC_64K_PAGES | 44 | #ifndef CONFIG_PPC_64K_PAGES |
@@ -40,13 +47,13 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
40 | 47 | ||
41 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) | 48 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) |
42 | { | 49 | { |
43 | return kmem_cache_alloc(pgtable_cache[PUD_CACHE_NUM], | 50 | return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE), |
44 | GFP_KERNEL|__GFP_REPEAT); | 51 | GFP_KERNEL|__GFP_REPEAT); |
45 | } | 52 | } |
46 | 53 | ||
47 | static inline void pud_free(struct mm_struct *mm, pud_t *pud) | 54 | static inline void pud_free(struct mm_struct *mm, pud_t *pud) |
48 | { | 55 | { |
49 | kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); | 56 | kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud); |
50 | } | 57 | } |
51 | 58 | ||
52 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) | 59 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) |
@@ -78,13 +85,13 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, | |||
78 | 85 | ||
79 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) | 86 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) |
80 | { | 87 | { |
81 | return kmem_cache_alloc(pgtable_cache[PMD_CACHE_NUM], | 88 | return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE), |
82 | GFP_KERNEL|__GFP_REPEAT); | 89 | GFP_KERNEL|__GFP_REPEAT); |
83 | } | 90 | } |
84 | 91 | ||
85 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | 92 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) |
86 | { | 93 | { |
87 | kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); | 94 | kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd); |
88 | } | 95 | } |
89 | 96 | ||
90 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 97 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
@@ -107,24 +114,22 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, | |||
107 | return page; | 114 | return page; |
108 | } | 115 | } |
109 | 116 | ||
110 | static inline void pgtable_free(pgtable_free_t pgf) | 117 | static inline void pgtable_free(void *table, unsigned index_size) |
111 | { | 118 | { |
112 | void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); | 119 | if (!index_size) |
113 | int cachenum = pgf.val & PGF_CACHENUM_MASK; | 120 | free_page((unsigned long)table); |
114 | 121 | else { | |
115 | if (cachenum == PTE_NONCACHE_NUM) | 122 | BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE); |
116 | free_page((unsigned long)p); | 123 | kmem_cache_free(PGT_CACHE(index_size), table); |
117 | else | 124 | } |
118 | kmem_cache_free(pgtable_cache[cachenum], p); | ||
119 | } | 125 | } |
120 | 126 | ||
121 | #define __pmd_free_tlb(tlb, pmd,addr) \ | 127 | #define __pmd_free_tlb(tlb, pmd, addr) \ |
122 | pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ | 128 | pgtable_free_tlb(tlb, pmd, PMD_INDEX_SIZE) |
123 | PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) | ||
124 | #ifndef CONFIG_PPC_64K_PAGES | 129 | #ifndef CONFIG_PPC_64K_PAGES |
125 | #define __pud_free_tlb(tlb, pud, addr) \ | 130 | #define __pud_free_tlb(tlb, pud, addr) \ |
126 | pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ | 131 | pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) |
127 | PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) | 132 | |
128 | #endif /* CONFIG_PPC_64K_PAGES */ | 133 | #endif /* CONFIG_PPC_64K_PAGES */ |
129 | 134 | ||
130 | #define check_pgt_cache() do { } while (0) | 135 | #define check_pgt_cache() do { } while (0) |
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h index f2e812de7c3c..abe8532bd14e 100644 --- a/arch/powerpc/include/asm/pgalloc.h +++ b/arch/powerpc/include/asm/pgalloc.h | |||
@@ -24,25 +24,6 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) | |||
24 | __free_page(ptepage); | 24 | __free_page(ptepage); |
25 | } | 25 | } |
26 | 26 | ||
27 | typedef struct pgtable_free { | ||
28 | unsigned long val; | ||
29 | } pgtable_free_t; | ||
30 | |||
31 | /* This needs to be big enough to allow for MMU_PAGE_COUNT + 2 to be stored | ||
32 | * and small enough to fit in the low bits of any naturally aligned page | ||
33 | * table cache entry. Arbitrarily set to 0x1f, that should give us some | ||
34 | * room to grow | ||
35 | */ | ||
36 | #define PGF_CACHENUM_MASK 0x1f | ||
37 | |||
38 | static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum, | ||
39 | unsigned long mask) | ||
40 | { | ||
41 | BUG_ON(cachenum > PGF_CACHENUM_MASK); | ||
42 | |||
43 | return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum}; | ||
44 | } | ||
45 | |||
46 | #ifdef CONFIG_PPC64 | 27 | #ifdef CONFIG_PPC64 |
47 | #include <asm/pgalloc-64.h> | 28 | #include <asm/pgalloc-64.h> |
48 | #else | 29 | #else |
@@ -50,12 +31,12 @@ static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum, | |||
50 | #endif | 31 | #endif |
51 | 32 | ||
52 | #ifdef CONFIG_SMP | 33 | #ifdef CONFIG_SMP |
53 | extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); | 34 | extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift); |
54 | extern void pte_free_finish(void); | 35 | extern void pte_free_finish(void); |
55 | #else /* CONFIG_SMP */ | 36 | #else /* CONFIG_SMP */ |
56 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) | 37 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift) |
57 | { | 38 | { |
58 | pgtable_free(pgf); | 39 | pgtable_free(table, shift); |
59 | } | 40 | } |
60 | static inline void pte_free_finish(void) { } | 41 | static inline void pte_free_finish(void) { } |
61 | #endif /* !CONFIG_SMP */ | 42 | #endif /* !CONFIG_SMP */ |
@@ -63,12 +44,9 @@ static inline void pte_free_finish(void) { } | |||
63 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, | 44 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, |
64 | unsigned long address) | 45 | unsigned long address) |
65 | { | 46 | { |
66 | pgtable_free_t pgf = pgtable_free_cache(page_address(ptepage), | ||
67 | PTE_NONCACHE_NUM, | ||
68 | PTE_TABLE_SIZE-1); | ||
69 | tlb_flush_pgtable(tlb, address); | 47 | tlb_flush_pgtable(tlb, address); |
70 | pgtable_page_dtor(ptepage); | 48 | pgtable_page_dtor(ptepage); |
71 | pgtable_free_tlb(tlb, pgf); | 49 | pgtable_free_tlb(tlb, page_address(ptepage), 0); |
72 | } | 50 | } |
73 | 51 | ||
74 | #endif /* __KERNEL__ */ | 52 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h index 806abe7a3fa5..49865045d56f 100644 --- a/arch/powerpc/include/asm/pgtable-ppc64.h +++ b/arch/powerpc/include/asm/pgtable-ppc64.h | |||
@@ -354,6 +354,7 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry) | |||
354 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE}) | 354 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE}) |
355 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) | 355 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) |
356 | 356 | ||
357 | void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); | ||
357 | void pgtable_cache_init(void); | 358 | void pgtable_cache_init(void); |
358 | 359 | ||
359 | /* | 360 | /* |
@@ -378,7 +379,18 @@ void pgtable_cache_init(void); | |||
378 | return pt; | 379 | return pt; |
379 | } | 380 | } |
380 | 381 | ||
381 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long address); | 382 | #ifdef CONFIG_HUGETLB_PAGE |
383 | pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, | ||
384 | unsigned *shift); | ||
385 | #else | ||
386 | static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, | ||
387 | unsigned *shift) | ||
388 | { | ||
389 | if (shift) | ||
390 | *shift = 0; | ||
391 | return find_linux_pte(pgdir, ea); | ||
392 | } | ||
393 | #endif /* !CONFIG_HUGETLB_PAGE */ | ||
382 | 394 | ||
383 | #endif /* __ASSEMBLY__ */ | 395 | #endif /* __ASSEMBLY__ */ |
384 | 396 | ||
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 2a5da069714e..21207e54825b 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h | |||
@@ -211,6 +211,9 @@ extern void paging_init(void); | |||
211 | */ | 211 | */ |
212 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | 212 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); |
213 | 213 | ||
214 | extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr, | ||
215 | unsigned long end, int write, struct page **pages, int *nr); | ||
216 | |||
214 | #endif /* __ASSEMBLY__ */ | 217 | #endif /* __ASSEMBLY__ */ |
215 | 218 | ||
216 | #endif /* __KERNEL__ */ | 219 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/pte-8xx.h b/arch/powerpc/include/asm/pte-8xx.h index dd5ea95fe61e..d44826e4ff97 100644 --- a/arch/powerpc/include/asm/pte-8xx.h +++ b/arch/powerpc/include/asm/pte-8xx.h | |||
@@ -33,21 +33,21 @@ | |||
33 | #define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */ | 33 | #define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */ |
34 | #define _PAGE_SHARED 0x0004 /* No ASID (context) compare */ | 34 | #define _PAGE_SHARED 0x0004 /* No ASID (context) compare */ |
35 | #define _PAGE_SPECIAL 0x0008 /* SW entry, forced to 0 by the TLB miss */ | 35 | #define _PAGE_SPECIAL 0x0008 /* SW entry, forced to 0 by the TLB miss */ |
36 | #define _PAGE_DIRTY 0x0100 /* C: page changed */ | ||
36 | 37 | ||
37 | /* These five software bits must be masked out when the entry is loaded | 38 | /* These 4 software bits must be masked out when the entry is loaded |
38 | * into the TLB. | 39 | * into the TLB, 1 SW bit left(0x0080). |
39 | */ | 40 | */ |
40 | #define _PAGE_GUARDED 0x0010 /* software: guarded access */ | 41 | #define _PAGE_GUARDED 0x0010 /* software: guarded access */ |
41 | #define _PAGE_DIRTY 0x0020 /* software: page changed */ | 42 | #define _PAGE_ACCESSED 0x0020 /* software: page referenced */ |
42 | #define _PAGE_RW 0x0040 /* software: user write access allowed */ | 43 | #define _PAGE_WRITETHRU 0x0040 /* software: caching is write through */ |
43 | #define _PAGE_ACCESSED 0x0080 /* software: page referenced */ | ||
44 | 44 | ||
45 | /* Setting any bits in the nibble with the follow two controls will | 45 | /* Setting any bits in the nibble with the follow two controls will |
46 | * require a TLB exception handler change. It is assumed unused bits | 46 | * require a TLB exception handler change. It is assumed unused bits |
47 | * are always zero. | 47 | * are always zero. |
48 | */ | 48 | */ |
49 | #define _PAGE_HWWRITE 0x0100 /* h/w write enable: never set in Linux PTE */ | 49 | #define _PAGE_RW 0x0400 /* lsb PP bits, inverted in HW */ |
50 | #define _PAGE_USER 0x0800 /* One of the PP bits, the other is USER&~RW */ | 50 | #define _PAGE_USER 0x0800 /* msb PP bits */ |
51 | 51 | ||
52 | #define _PMD_PRESENT 0x0001 | 52 | #define _PMD_PRESENT 0x0001 |
53 | #define _PMD_BAD 0x0ff0 | 53 | #define _PMD_BAD 0x0ff0 |
diff --git a/arch/powerpc/include/asm/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h index 82b72207c51c..c4490f9c67c4 100644 --- a/arch/powerpc/include/asm/pte-hash64-64k.h +++ b/arch/powerpc/include/asm/pte-hash64-64k.h | |||
@@ -76,41 +76,4 @@ | |||
76 | remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \ | 76 | remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \ |
77 | __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN)) | 77 | __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN)) |
78 | 78 | ||
79 | |||
80 | #ifdef CONFIG_PPC_SUBPAGE_PROT | ||
81 | /* | ||
82 | * For the sub-page protection option, we extend the PGD with one of | ||
83 | * these. Basically we have a 3-level tree, with the top level being | ||
84 | * the protptrs array. To optimize speed and memory consumption when | ||
85 | * only addresses < 4GB are being protected, pointers to the first | ||
86 | * four pages of sub-page protection words are stored in the low_prot | ||
87 | * array. | ||
88 | * Each page of sub-page protection words protects 1GB (4 bytes | ||
89 | * protects 64k). For the 3-level tree, each page of pointers then | ||
90 | * protects 8TB. | ||
91 | */ | ||
92 | struct subpage_prot_table { | ||
93 | unsigned long maxaddr; /* only addresses < this are protected */ | ||
94 | unsigned int **protptrs[2]; | ||
95 | unsigned int *low_prot[4]; | ||
96 | }; | ||
97 | |||
98 | #undef PGD_TABLE_SIZE | ||
99 | #define PGD_TABLE_SIZE ((sizeof(pgd_t) << PGD_INDEX_SIZE) + \ | ||
100 | sizeof(struct subpage_prot_table)) | ||
101 | |||
102 | #define SBP_L1_BITS (PAGE_SHIFT - 2) | ||
103 | #define SBP_L2_BITS (PAGE_SHIFT - 3) | ||
104 | #define SBP_L1_COUNT (1 << SBP_L1_BITS) | ||
105 | #define SBP_L2_COUNT (1 << SBP_L2_BITS) | ||
106 | #define SBP_L2_SHIFT (PAGE_SHIFT + SBP_L1_BITS) | ||
107 | #define SBP_L3_SHIFT (SBP_L2_SHIFT + SBP_L2_BITS) | ||
108 | |||
109 | extern void subpage_prot_free(pgd_t *pgd); | ||
110 | |||
111 | static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd) | ||
112 | { | ||
113 | return (struct subpage_prot_table *)(pgd + PTRS_PER_PGD); | ||
114 | } | ||
115 | #endif /* CONFIG_PPC_SUBPAGE_PROT */ | ||
116 | #endif /* __ASSEMBLY__ */ | 79 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h index f388f0ab193f..0947b36e534c 100644 --- a/arch/powerpc/include/asm/qe.h +++ b/arch/powerpc/include/asm/qe.h | |||
@@ -87,7 +87,7 @@ extern spinlock_t cmxgcr_lock; | |||
87 | 87 | ||
88 | /* Export QE common operations */ | 88 | /* Export QE common operations */ |
89 | #ifdef CONFIG_QUICC_ENGINE | 89 | #ifdef CONFIG_QUICC_ENGINE |
90 | extern void __init qe_reset(void); | 90 | extern void qe_reset(void); |
91 | #else | 91 | #else |
92 | static inline void qe_reset(void) {} | 92 | static inline void qe_reset(void) {} |
93 | #endif | 93 | #endif |
@@ -145,8 +145,17 @@ static inline void qe_pin_set_gpio(struct qe_pin *qe_pin) {} | |||
145 | static inline void qe_pin_set_dedicated(struct qe_pin *pin) {} | 145 | static inline void qe_pin_set_dedicated(struct qe_pin *pin) {} |
146 | #endif /* CONFIG_QE_GPIO */ | 146 | #endif /* CONFIG_QE_GPIO */ |
147 | 147 | ||
148 | /* QE internal API */ | 148 | #ifdef CONFIG_QUICC_ENGINE |
149 | int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); | 149 | int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); |
150 | #else | ||
151 | static inline int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, | ||
152 | u32 cmd_input) | ||
153 | { | ||
154 | return -ENOSYS; | ||
155 | } | ||
156 | #endif /* CONFIG_QUICC_ENGINE */ | ||
157 | |||
158 | /* QE internal API */ | ||
150 | enum qe_clock qe_clock_source(const char *source); | 159 | enum qe_clock qe_clock_source(const char *source); |
151 | unsigned int qe_get_brg_clk(void); | 160 | unsigned int qe_get_brg_clk(void); |
152 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); | 161 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); |
@@ -154,7 +163,28 @@ int qe_get_snum(void); | |||
154 | void qe_put_snum(u8 snum); | 163 | void qe_put_snum(u8 snum); |
155 | unsigned int qe_get_num_of_risc(void); | 164 | unsigned int qe_get_num_of_risc(void); |
156 | unsigned int qe_get_num_of_snums(void); | 165 | unsigned int qe_get_num_of_snums(void); |
157 | int qe_alive_during_sleep(void); | 166 | |
167 | static inline int qe_alive_during_sleep(void) | ||
168 | { | ||
169 | /* | ||
170 | * MPC8568E reference manual says: | ||
171 | * | ||
172 | * "...power down sequence waits for all I/O interfaces to become idle. | ||
173 | * In some applications this may happen eventually without actively | ||
174 | * shutting down interfaces, but most likely, software will have to | ||
175 | * take steps to shut down the eTSEC, QUICC Engine Block, and PCI | ||
176 | * interfaces before issuing the command (either the write to the core | ||
177 | * MSR[WE] as described above or writing to POWMGTCSR) to put the | ||
178 | * device into sleep state." | ||
179 | * | ||
180 | * MPC8569E reference manual has a similar paragraph. | ||
181 | */ | ||
182 | #ifdef CONFIG_PPC_85xx | ||
183 | return 0; | ||
184 | #else | ||
185 | return 1; | ||
186 | #endif | ||
187 | } | ||
158 | 188 | ||
159 | /* we actually use cpm_muram implementation, define this for convenience */ | 189 | /* we actually use cpm_muram implementation, define this for convenience */ |
160 | #define qe_muram_init cpm_muram_init | 190 | #define qe_muram_init cpm_muram_init |
@@ -210,8 +240,15 @@ struct qe_firmware_info { | |||
210 | u64 extended_modes; /* Extended modes */ | 240 | u64 extended_modes; /* Extended modes */ |
211 | }; | 241 | }; |
212 | 242 | ||
243 | #ifdef CONFIG_QUICC_ENGINE | ||
213 | /* Upload a firmware to the QE */ | 244 | /* Upload a firmware to the QE */ |
214 | int qe_upload_firmware(const struct qe_firmware *firmware); | 245 | int qe_upload_firmware(const struct qe_firmware *firmware); |
246 | #else | ||
247 | static inline int qe_upload_firmware(const struct qe_firmware *firmware) | ||
248 | { | ||
249 | return -ENOSYS; | ||
250 | } | ||
251 | #endif /* CONFIG_QUICC_ENGINE */ | ||
215 | 252 | ||
216 | /* Obtain information on the uploaded firmware */ | 253 | /* Obtain information on the uploaded firmware */ |
217 | struct qe_firmware_info *qe_get_firmware_info(void); | 254 | struct qe_firmware_info *qe_get_firmware_info(void); |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index c7d671a7d9a1..07d2d19ab5e9 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -145,7 +145,7 @@ SYSCALL_SPU(setfsuid) | |||
145 | SYSCALL_SPU(setfsgid) | 145 | SYSCALL_SPU(setfsgid) |
146 | SYSCALL_SPU(llseek) | 146 | SYSCALL_SPU(llseek) |
147 | COMPAT_SYS_SPU(getdents) | 147 | COMPAT_SYS_SPU(getdents) |
148 | SYSX_SPU(sys_select,ppc32_select,ppc_select) | 148 | SYSX_SPU(sys_select,ppc32_select,sys_select) |
149 | SYSCALL_SPU(flock) | 149 | SYSCALL_SPU(flock) |
150 | SYSCALL_SPU(msync) | 150 | SYSCALL_SPU(msync) |
151 | COMPAT_SYS_SPU(readv) | 151 | COMPAT_SYS_SPU(readv) |