diff options
| -rw-r--r-- | arch/powerpc/include/asm/exception-64s.h | 2 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/unaligned.h | 7 | ||||
| -rw-r--r-- | arch/powerpc/kernel/head_64.S | 2 | ||||
| -rw-r--r-- | arch/powerpc/lib/copyuser_64.S | 53 | ||||
| -rw-r--r-- | arch/powerpc/platforms/powernv/eeh-ioda.c | 20 | ||||
| -rw-r--r-- | arch/powerpc/platforms/powernv/pci.h | 4 |
6 files changed, 55 insertions, 33 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 894662a5d4d5..243ce69ad685 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h | |||
| @@ -284,7 +284,7 @@ do_kvm_##n: \ | |||
| 284 | subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \ | 284 | subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \ |
| 285 | beq- 1f; \ | 285 | beq- 1f; \ |
| 286 | ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ | 286 | ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ |
| 287 | 1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ | 287 | 1: cmpdi cr1,r1,-INT_FRAME_SIZE; /* check if r1 is in userspace */ \ |
| 288 | blt+ cr1,3f; /* abort if it is */ \ | 288 | blt+ cr1,3f; /* abort if it is */ \ |
| 289 | li r1,(n); /* will be reloaded later */ \ | 289 | li r1,(n); /* will be reloaded later */ \ |
| 290 | sth r1,PACA_TRAP_SAVE(r13); \ | 290 | sth r1,PACA_TRAP_SAVE(r13); \ |
diff --git a/arch/powerpc/include/asm/unaligned.h b/arch/powerpc/include/asm/unaligned.h index 5f1b1e3c2137..8296381ae432 100644 --- a/arch/powerpc/include/asm/unaligned.h +++ b/arch/powerpc/include/asm/unaligned.h | |||
| @@ -4,13 +4,18 @@ | |||
| 4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
| 5 | 5 | ||
| 6 | /* | 6 | /* |
| 7 | * The PowerPC can do unaligned accesses itself in big endian mode. | 7 | * The PowerPC can do unaligned accesses itself based on its endian mode. |
| 8 | */ | 8 | */ |
| 9 | #include <linux/unaligned/access_ok.h> | 9 | #include <linux/unaligned/access_ok.h> |
| 10 | #include <linux/unaligned/generic.h> | 10 | #include <linux/unaligned/generic.h> |
| 11 | 11 | ||
| 12 | #ifdef __LITTLE_ENDIAN__ | ||
| 13 | #define get_unaligned __get_unaligned_le | ||
| 14 | #define put_unaligned __put_unaligned_le | ||
| 15 | #else | ||
| 12 | #define get_unaligned __get_unaligned_be | 16 | #define get_unaligned __get_unaligned_be |
| 13 | #define put_unaligned __put_unaligned_be | 17 | #define put_unaligned __put_unaligned_be |
| 18 | #endif | ||
| 14 | 19 | ||
| 15 | #endif /* __KERNEL__ */ | 20 | #endif /* __KERNEL__ */ |
| 16 | #endif /* _ASM_POWERPC_UNALIGNED_H */ | 21 | #endif /* _ASM_POWERPC_UNALIGNED_H */ |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 2ae41aba4053..4f0946de2d5c 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
| @@ -80,6 +80,7 @@ END_FTR_SECTION(0, 1) | |||
| 80 | * of the function that the cpu should jump to to continue | 80 | * of the function that the cpu should jump to to continue |
| 81 | * initialization. | 81 | * initialization. |
| 82 | */ | 82 | */ |
| 83 | .balign 8 | ||
| 83 | .globl __secondary_hold_spinloop | 84 | .globl __secondary_hold_spinloop |
| 84 | __secondary_hold_spinloop: | 85 | __secondary_hold_spinloop: |
| 85 | .llong 0x0 | 86 | .llong 0x0 |
| @@ -470,6 +471,7 @@ _STATIC(__after_prom_start) | |||
| 470 | mtctr r8 | 471 | mtctr r8 |
| 471 | bctr | 472 | bctr |
| 472 | 473 | ||
| 474 | .balign 8 | ||
| 473 | p_end: .llong _end - _stext | 475 | p_end: .llong _end - _stext |
| 474 | 476 | ||
| 475 | 4: /* Now copy the rest of the kernel up to _end */ | 477 | 4: /* Now copy the rest of the kernel up to _end */ |
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S index d73a59014900..596a285c0755 100644 --- a/arch/powerpc/lib/copyuser_64.S +++ b/arch/powerpc/lib/copyuser_64.S | |||
| @@ -9,6 +9,14 @@ | |||
| 9 | #include <asm/processor.h> | 9 | #include <asm/processor.h> |
| 10 | #include <asm/ppc_asm.h> | 10 | #include <asm/ppc_asm.h> |
| 11 | 11 | ||
| 12 | #ifdef __BIG_ENDIAN__ | ||
| 13 | #define sLd sld /* Shift towards low-numbered address. */ | ||
| 14 | #define sHd srd /* Shift towards high-numbered address. */ | ||
| 15 | #else | ||
| 16 | #define sLd srd /* Shift towards low-numbered address. */ | ||
| 17 | #define sHd sld /* Shift towards high-numbered address. */ | ||
| 18 | #endif | ||
| 19 | |||
| 12 | .align 7 | 20 | .align 7 |
| 13 | _GLOBAL(__copy_tofrom_user) | 21 | _GLOBAL(__copy_tofrom_user) |
| 14 | BEGIN_FTR_SECTION | 22 | BEGIN_FTR_SECTION |
| @@ -118,10 +126,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
| 118 | 126 | ||
| 119 | 24: ld r9,0(r4) /* 3+2n loads, 2+2n stores */ | 127 | 24: ld r9,0(r4) /* 3+2n loads, 2+2n stores */ |
| 120 | 25: ld r0,8(r4) | 128 | 25: ld r0,8(r4) |
| 121 | sld r6,r9,r10 | 129 | sLd r6,r9,r10 |
| 122 | 26: ldu r9,16(r4) | 130 | 26: ldu r9,16(r4) |
| 123 | srd r7,r0,r11 | 131 | sHd r7,r0,r11 |
| 124 | sld r8,r0,r10 | 132 | sLd r8,r0,r10 |
| 125 | or r7,r7,r6 | 133 | or r7,r7,r6 |
| 126 | blt cr6,79f | 134 | blt cr6,79f |
| 127 | 27: ld r0,8(r4) | 135 | 27: ld r0,8(r4) |
| @@ -129,35 +137,35 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
| 129 | 137 | ||
| 130 | 28: ld r0,0(r4) /* 4+2n loads, 3+2n stores */ | 138 | 28: ld r0,0(r4) /* 4+2n loads, 3+2n stores */ |
| 131 | 29: ldu r9,8(r4) | 139 | 29: ldu r9,8(r4) |
| 132 | sld r8,r0,r10 | 140 | sLd r8,r0,r10 |
| 133 | addi r3,r3,-8 | 141 | addi r3,r3,-8 |
| 134 | blt cr6,5f | 142 | blt cr6,5f |
| 135 | 30: ld r0,8(r4) | 143 | 30: ld r0,8(r4) |
| 136 | srd r12,r9,r11 | 144 | sHd r12,r9,r11 |
| 137 | sld r6,r9,r10 | 145 | sLd r6,r9,r10 |
| 138 | 31: ldu r9,16(r4) | 146 | 31: ldu r9,16(r4) |
| 139 | or r12,r8,r12 | 147 | or r12,r8,r12 |
| 140 | srd r7,r0,r11 | 148 | sHd r7,r0,r11 |
| 141 | sld r8,r0,r10 | 149 | sLd r8,r0,r10 |
| 142 | addi r3,r3,16 | 150 | addi r3,r3,16 |
| 143 | beq cr6,78f | 151 | beq cr6,78f |
| 144 | 152 | ||
| 145 | 1: or r7,r7,r6 | 153 | 1: or r7,r7,r6 |
| 146 | 32: ld r0,8(r4) | 154 | 32: ld r0,8(r4) |
| 147 | 76: std r12,8(r3) | 155 | 76: std r12,8(r3) |
| 148 | 2: srd r12,r9,r11 | 156 | 2: sHd r12,r9,r11 |
| 149 | sld r6,r9,r10 | 157 | sLd r6,r9,r10 |
| 150 | 33: ldu r9,16(r4) | 158 | 33: ldu r9,16(r4) |
| 151 | or r12,r8,r12 | 159 | or r12,r8,r12 |
| 152 | 77: stdu r7,16(r3) | 160 | 77: stdu r7,16(r3) |
| 153 | srd r7,r0,r11 | 161 | sHd r7,r0,r11 |
| 154 | sld r8,r0,r10 | 162 | sLd r8,r0,r10 |
| 155 | bdnz 1b | 163 | bdnz 1b |
| 156 | 164 | ||
| 157 | 78: std r12,8(r3) | 165 | 78: std r12,8(r3) |
| 158 | or r7,r7,r6 | 166 | or r7,r7,r6 |
| 159 | 79: std r7,16(r3) | 167 | 79: std r7,16(r3) |
| 160 | 5: srd r12,r9,r11 | 168 | 5: sHd r12,r9,r11 |
| 161 | or r12,r8,r12 | 169 | or r12,r8,r12 |
| 162 | 80: std r12,24(r3) | 170 | 80: std r12,24(r3) |
| 163 | bne 6f | 171 | bne 6f |
| @@ -165,23 +173,38 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
| 165 | blr | 173 | blr |
| 166 | 6: cmpwi cr1,r5,8 | 174 | 6: cmpwi cr1,r5,8 |
| 167 | addi r3,r3,32 | 175 | addi r3,r3,32 |
| 168 | sld r9,r9,r10 | 176 | sLd r9,r9,r10 |
| 169 | ble cr1,7f | 177 | ble cr1,7f |
| 170 | 34: ld r0,8(r4) | 178 | 34: ld r0,8(r4) |
| 171 | srd r7,r0,r11 | 179 | sHd r7,r0,r11 |
| 172 | or r9,r7,r9 | 180 | or r9,r7,r9 |
| 173 | 7: | 181 | 7: |
| 174 | bf cr7*4+1,1f | 182 | bf cr7*4+1,1f |
| 183 | #ifdef __BIG_ENDIAN__ | ||
| 175 | rotldi r9,r9,32 | 184 | rotldi r9,r9,32 |
| 185 | #endif | ||
| 176 | 94: stw r9,0(r3) | 186 | 94: stw r9,0(r3) |
| 187 | #ifdef __LITTLE_ENDIAN__ | ||
| 188 | rotrdi r9,r9,32 | ||
| 189 | #endif | ||
| 177 | addi r3,r3,4 | 190 | addi r3,r3,4 |
| 178 | 1: bf cr7*4+2,2f | 191 | 1: bf cr7*4+2,2f |
| 192 | #ifdef __BIG_ENDIAN__ | ||
| 179 | rotldi r9,r9,16 | 193 | rotldi r9,r9,16 |
| 194 | #endif | ||
| 180 | 95: sth r9,0(r3) | 195 | 95: sth r9,0(r3) |
| 196 | #ifdef __LITTLE_ENDIAN__ | ||
| 197 | rotrdi r9,r9,16 | ||
| 198 | #endif | ||
| 181 | addi r3,r3,2 | 199 | addi r3,r3,2 |
| 182 | 2: bf cr7*4+3,3f | 200 | 2: bf cr7*4+3,3f |
| 201 | #ifdef __BIG_ENDIAN__ | ||
| 183 | rotldi r9,r9,8 | 202 | rotldi r9,r9,8 |
| 203 | #endif | ||
| 184 | 96: stb r9,0(r3) | 204 | 96: stb r9,0(r3) |
| 205 | #ifdef __LITTLE_ENDIAN__ | ||
| 206 | rotrdi r9,r9,8 | ||
| 207 | #endif | ||
| 185 | 3: li r3,0 | 208 | 3: li r3,0 |
| 186 | blr | 209 | blr |
| 187 | 210 | ||
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c index 02245cee7818..d7ddcee7feb8 100644 --- a/arch/powerpc/platforms/powernv/eeh-ioda.c +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | #include "powernv.h" | 36 | #include "powernv.h" |
| 37 | #include "pci.h" | 37 | #include "pci.h" |
| 38 | 38 | ||
| 39 | static char *hub_diag = NULL; | ||
| 40 | static int ioda_eeh_nb_init = 0; | 39 | static int ioda_eeh_nb_init = 0; |
| 41 | 40 | ||
| 42 | static int ioda_eeh_event(struct notifier_block *nb, | 41 | static int ioda_eeh_event(struct notifier_block *nb, |
| @@ -140,15 +139,6 @@ static int ioda_eeh_post_init(struct pci_controller *hose) | |||
| 140 | ioda_eeh_nb_init = 1; | 139 | ioda_eeh_nb_init = 1; |
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | /* We needn't HUB diag-data on PHB3 */ | ||
| 144 | if (phb->type == PNV_PHB_IODA1 && !hub_diag) { | ||
| 145 | hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO); | ||
| 146 | if (!hub_diag) { | ||
| 147 | pr_err("%s: Out of memory !\n", __func__); | ||
| 148 | return -ENOMEM; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | #ifdef CONFIG_DEBUG_FS | 142 | #ifdef CONFIG_DEBUG_FS |
| 153 | if (phb->dbgfs) { | 143 | if (phb->dbgfs) { |
| 154 | debugfs_create_file("err_injct_outbound", 0600, | 144 | debugfs_create_file("err_injct_outbound", 0600, |
| @@ -633,11 +623,10 @@ static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data) | |||
| 633 | static void ioda_eeh_hub_diag(struct pci_controller *hose) | 623 | static void ioda_eeh_hub_diag(struct pci_controller *hose) |
| 634 | { | 624 | { |
| 635 | struct pnv_phb *phb = hose->private_data; | 625 | struct pnv_phb *phb = hose->private_data; |
| 636 | struct OpalIoP7IOCErrorData *data; | 626 | struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag; |
| 637 | long rc; | 627 | long rc; |
| 638 | 628 | ||
| 639 | data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag; | 629 | rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data)); |
| 640 | rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE); | ||
| 641 | if (rc != OPAL_SUCCESS) { | 630 | if (rc != OPAL_SUCCESS) { |
| 642 | pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n", | 631 | pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n", |
| 643 | __func__, phb->hub_id, rc); | 632 | __func__, phb->hub_id, rc); |
| @@ -820,14 +809,15 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose) | |||
| 820 | struct OpalIoPhbErrorCommon *common; | 809 | struct OpalIoPhbErrorCommon *common; |
| 821 | long rc; | 810 | long rc; |
| 822 | 811 | ||
| 823 | common = (struct OpalIoPhbErrorCommon *)phb->diag.blob; | 812 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, |
| 824 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE); | 813 | PNV_PCI_DIAG_BUF_SIZE); |
| 825 | if (rc != OPAL_SUCCESS) { | 814 | if (rc != OPAL_SUCCESS) { |
| 826 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", | 815 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", |
| 827 | __func__, hose->global_number, rc); | 816 | __func__, hose->global_number, rc); |
| 828 | return; | 817 | return; |
| 829 | } | 818 | } |
| 830 | 819 | ||
| 820 | common = (struct OpalIoPhbErrorCommon *)phb->diag.blob; | ||
| 831 | switch (common->ioType) { | 821 | switch (common->ioType) { |
| 832 | case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: | 822 | case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: |
| 833 | ioda_eeh_p7ioc_phb_diag(hose, common); | 823 | ioda_eeh_p7ioc_phb_diag(hose, common); |
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h index 911c24ef033e..1ed8d5f40f5a 100644 --- a/arch/powerpc/platforms/powernv/pci.h +++ b/arch/powerpc/platforms/powernv/pci.h | |||
| @@ -172,11 +172,13 @@ struct pnv_phb { | |||
| 172 | } ioda; | 172 | } ioda; |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | /* PHB status structure */ | 175 | /* PHB and hub status structure */ |
| 176 | union { | 176 | union { |
| 177 | unsigned char blob[PNV_PCI_DIAG_BUF_SIZE]; | 177 | unsigned char blob[PNV_PCI_DIAG_BUF_SIZE]; |
| 178 | struct OpalIoP7IOCPhbErrorData p7ioc; | 178 | struct OpalIoP7IOCPhbErrorData p7ioc; |
| 179 | struct OpalIoP7IOCErrorData hub_diag; | ||
| 179 | } diag; | 180 | } diag; |
| 181 | |||
| 180 | }; | 182 | }; |
| 181 | 183 | ||
| 182 | extern struct pci_ops pnv_pci_ops; | 184 | extern struct pci_ops pnv_pci_ops; |
