Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branch 'jwb/next' into next

Josh writes:
<<
A few patches from Suzie for 47x kexec/kdump support, and some MSI patches
from Mai La.
>>

+252 -24
+2 -2
arch/powerpc/Kconfig
··· 353 353 354 354 config KEXEC 355 355 bool "kexec system call (EXPERIMENTAL)" 356 - depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP && !PPC_47x)) && EXPERIMENTAL 356 + depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) && EXPERIMENTAL 357 357 help 358 358 kexec is a system call that implements the ability to shutdown your 359 359 current kernel, and to start another kernel. It is like a reboot ··· 370 370 371 371 config CRASH_DUMP 372 372 bool "Build a kdump crash kernel" 373 - depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP && !PPC_47x) 373 + depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) 374 374 select RELOCATABLE if PPC64 || 44x 375 375 select DYNAMIC_MEMSTART if FSL_BOOKE 376 376 help
+25
arch/powerpc/boot/dts/bluestone.dts
··· 373 373 0x0 0x0 0x0 0x3 &UIC3 0xe 0x4 /* swizzled int C */ 374 374 0x0 0x0 0x0 0x4 &UIC3 0xf 0x4 /* swizzled int D */>; 375 375 }; 376 + 377 + MSI: ppc4xx-msi@C10000000 { 378 + compatible = "amcc,ppc4xx-msi", "ppc4xx-msi"; 379 + reg = < 0xC 0x10000000 0x100 380 + 0xC 0x10000000 0x100>; 381 + sdr-base = <0x36C>; 382 + msi-data = <0x00004440>; 383 + msi-mask = <0x0000ffe0>; 384 + interrupts =<0 1 2 3 4 5 6 7>; 385 + interrupt-parent = <&MSI>; 386 + #interrupt-cells = <1>; 387 + #address-cells = <0>; 388 + #size-cells = <0>; 389 + msi-available-ranges = <0x0 0x100>; 390 + interrupt-map = < 391 + 0 &UIC3 0x18 1 392 + 1 &UIC3 0x19 1 393 + 2 &UIC3 0x1A 1 394 + 3 &UIC3 0x1B 1 395 + 4 &UIC3 0x1C 1 396 + 5 &UIC3 0x1D 1 397 + 6 &UIC3 0x1E 1 398 + 7 &UIC3 0x1F 1 399 + >; 400 + }; 376 401 }; 377 402 };
+195 -8
arch/powerpc/kernel/misc_32.S
··· 738 738 mr r5, r31 739 739 740 740 li r0, 0 741 - #elif defined(CONFIG_44x) && !defined(CONFIG_PPC_47x) 741 + #elif defined(CONFIG_44x) 742 742 743 + /* Save our parameters */ 744 + mr r29, r3 745 + mr r30, r4 746 + mr r31, r5 747 + 748 + #ifdef CONFIG_PPC_47x 749 + /* Check for 47x cores */ 750 + mfspr r3,SPRN_PVR 751 + srwi r3,r3,16 752 + cmplwi cr0,r3,PVR_476@h 753 + beq setup_map_47x 754 + cmplwi cr0,r3,PVR_476_ISS@h 755 + beq setup_map_47x 756 + #endif /* CONFIG_PPC_47x */ 757 + 743 758 /* 744 759 * Code for setting up 1:1 mapping for PPC440x for KEXEC 745 760 * ··· 768 753 * 5) Invalidate the tmp mapping. 769 754 * 770 755 * - Based on the kexec support code for FSL BookE 771 - * - Doesn't support 47x yet. 772 756 * 773 757 */ 774 - /* Save our parameters */ 775 - mr r29, r3 776 - mr r30, r4 777 - mr r31, r5 778 758 779 - /* Load our MSR_IS and TID to MMUCR for TLB search */ 780 - mfspr r3,SPRN_PID 759 + /* 760 + * Load the PID with kernel PID (0). 761 + * Also load our MSR_IS and TID to MMUCR for TLB search. 762 + */ 763 + li r3, 0 764 + mtspr SPRN_PID, r3 781 765 mfmsr r4 782 766 andi. r4,r4,MSR_IS@l 783 767 beq wmmucr ··· 914 900 li r3, 0 915 901 tlbwe r3, r24, PPC44x_TLB_PAGEID 916 902 sync 903 + b ppc44x_map_done 904 + 905 + #ifdef CONFIG_PPC_47x 906 + 907 + /* 1:1 mapping for 47x */ 908 + 909 + setup_map_47x: 910 + 911 + /* 912 + * Load the kernel pid (0) to PID and also to MMUCR[TID]. 913 + * Also set the MSR IS->MMUCR STS 914 + */ 915 + li r3, 0 916 + mtspr SPRN_PID, r3 /* Set PID */ 917 + mfmsr r4 /* Get MSR */ 918 + andi. r4, r4, MSR_IS@l /* TS=1? */ 919 + beq 1f /* If not, leave STS=0 */ 920 + oris r3, r3, PPC47x_MMUCR_STS@h /* Set STS=1 */ 921 + 1: mtspr SPRN_MMUCR, r3 /* Put MMUCR */ 922 + sync 923 + 924 + /* Find the entry we are running from */ 925 + bl 2f 926 + 2: mflr r23 927 + tlbsx r23, 0, r23 928 + tlbre r24, r23, 0 /* TLB Word 0 */ 929 + tlbre r25, r23, 1 /* TLB Word 1 */ 930 + tlbre r26, r23, 2 /* TLB Word 2 */ 931 + 932 + 933 + /* 934 + * Invalidates all the tlb entries by writing to 256 RPNs(r4) 935 + * of 4k page size in all 4 ways (0-3 in r3). 936 + * This would invalidate the entire UTLB including the one we are 937 + * running from. However the shadow TLB entries would help us 938 + * to continue the execution, until we flush them (rfi/isync). 939 + */ 940 + addis r3, 0, 0x8000 /* specify the way */ 941 + addi r4, 0, 0 /* TLB Word0 = (EPN=0, VALID = 0) */ 942 + addi r5, 0, 0 943 + b clear_utlb_entry 944 + 945 + /* Align the loop to speed things up. from head_44x.S */ 946 + .align 6 947 + 948 + clear_utlb_entry: 949 + 950 + tlbwe r4, r3, 0 951 + tlbwe r5, r3, 1 952 + tlbwe r5, r3, 2 953 + addis r3, r3, 0x2000 /* Increment the way */ 954 + cmpwi r3, 0 955 + bne clear_utlb_entry 956 + addis r3, 0, 0x8000 957 + addis r4, r4, 0x100 /* Increment the EPN */ 958 + cmpwi r4, 0 959 + bne clear_utlb_entry 960 + 961 + /* Create the entries in the other address space */ 962 + mfmsr r5 963 + rlwinm r7, r5, 27, 31, 31 /* Get the TS (Bit 26) from MSR */ 964 + xori r7, r7, 1 /* r7 = !TS */ 965 + 966 + insrwi r24, r7, 1, 21 /* Change the TS in the saved TLB word 0 */ 967 + 968 + /* 969 + * write out the TLB entries for the tmp mapping 970 + * Use way '0' so that we could easily invalidate it later. 971 + */ 972 + lis r3, 0x8000 /* Way '0' */ 973 + 974 + tlbwe r24, r3, 0 975 + tlbwe r25, r3, 1 976 + tlbwe r26, r3, 2 977 + 978 + /* Update the msr to the new TS */ 979 + insrwi r5, r7, 1, 26 980 + 981 + bl 1f 982 + 1: mflr r6 983 + addi r6, r6, (2f-1b) 984 + 985 + mtspr SPRN_SRR0, r6 986 + mtspr SPRN_SRR1, r5 987 + rfi 988 + 989 + /* 990 + * Now we are in the tmp address space. 991 + * Create a 1:1 mapping for 0-2GiB in the original TS. 992 + */ 993 + 2: 994 + li r3, 0 995 + li r4, 0 /* TLB Word 0 */ 996 + li r5, 0 /* TLB Word 1 */ 997 + li r6, 0 998 + ori r6, r6, PPC47x_TLB2_S_RWX /* TLB word 2 */ 999 + 1000 + li r8, 0 /* PageIndex */ 1001 + 1002 + xori r7, r7, 1 /* revert back to original TS */ 1003 + 1004 + write_utlb: 1005 + rotlwi r5, r8, 28 /* RPN = PageIndex * 256M */ 1006 + /* ERPN = 0 as we don't use memory above 2G */ 1007 + 1008 + mr r4, r5 /* EPN = RPN */ 1009 + ori r4, r4, (PPC47x_TLB0_VALID | PPC47x_TLB0_256M) 1010 + insrwi r4, r7, 1, 21 /* Insert the TS to Word 0 */ 1011 + 1012 + tlbwe r4, r3, 0 /* Write out the entries */ 1013 + tlbwe r5, r3, 1 1014 + tlbwe r6, r3, 2 1015 + addi r8, r8, 1 1016 + cmpwi r8, 8 /* Have we completed ? */ 1017 + bne write_utlb 1018 + 1019 + /* make sure we complete the TLB write up */ 1020 + isync 1021 + 1022 + /* 1023 + * Prepare to jump to the 1:1 mapping. 1024 + * 1) Extract page size of the tmp mapping 1025 + * DSIZ = TLB_Word0[22:27] 1026 + * 2) Calculate the physical address of the address 1027 + * to jump to. 1028 + */ 1029 + rlwinm r10, r24, 0, 22, 27 1030 + 1031 + cmpwi r10, PPC47x_TLB0_4K 1032 + bne 0f 1033 + li r10, 0x1000 /* r10 = 4k */ 1034 + bl 1f 1035 + 1036 + 0: 1037 + /* Defaults to 256M */ 1038 + lis r10, 0x1000 1039 + 1040 + bl 1f 1041 + 1: mflr r4 1042 + addi r4, r4, (2f-1b) /* virtual address of 2f */ 1043 + 1044 + subi r11, r10, 1 /* offsetmask = Pagesize - 1 */ 1045 + not r10, r11 /* Pagemask = ~(offsetmask) */ 1046 + 1047 + and r5, r25, r10 /* Physical page */ 1048 + and r6, r4, r11 /* offset within the current page */ 1049 + 1050 + or r5, r5, r6 /* Physical address for 2f */ 1051 + 1052 + /* Switch the TS in MSR to the original one */ 1053 + mfmsr r8 1054 + insrwi r8, r7, 1, 26 1055 + 1056 + mtspr SPRN_SRR1, r8 1057 + mtspr SPRN_SRR0, r5 1058 + rfi 1059 + 1060 + 2: 1061 + /* Invalidate the tmp mapping */ 1062 + lis r3, 0x8000 /* Way '0' */ 1063 + 1064 + clrrwi r24, r24, 12 /* Clear the valid bit */ 1065 + tlbwe r24, r3, 0 1066 + tlbwe r25, r3, 1 1067 + tlbwe r26, r3, 2 1068 + 1069 + /* Make sure we complete the TLB write and flush the shadow TLB */ 1070 + isync 1071 + 1072 + #endif 1073 + 1074 + ppc44x_map_done: 1075 + 917 1076 918 1077 /* Restore the parameters */ 919 1078 mr r3, r29
+2
arch/powerpc/platforms/44x/Kconfig
··· 23 23 default n 24 24 select PPC44x_SIMPLE 25 25 select APM821xx 26 + select PCI_MSI 27 + select PPC4xx_MSI 26 28 select PPC4xx_PCI_EXPRESS 27 29 select IBM_EMAC_RGMII 28 30 help
+28 -14
arch/powerpc/sysdev/ppc4xx_msi.c
··· 28 28 #include <linux/of_platform.h> 29 29 #include <linux/interrupt.h> 30 30 #include <linux/export.h> 31 + #include <linux/kernel.h> 31 32 #include <asm/prom.h> 32 33 #include <asm/hw_irq.h> 33 34 #include <asm/ppc-pci.h> 34 - #include <boot/dcr.h> 35 + #include <asm/dcr.h> 35 36 #include <asm/dcr-regs.h> 36 37 #include <asm/msi_bitmap.h> 37 38 ··· 44 43 #define PEIH_FLUSH0 0x30 45 44 #define PEIH_FLUSH1 0x38 46 45 #define PEIH_CNTRST 0x48 47 - #define NR_MSI_IRQS 4 46 + 47 + static int msi_irqs; 48 48 49 49 struct ppc4xx_msi { 50 50 u32 msi_addr_lo; 51 51 u32 msi_addr_hi; 52 52 void __iomem *msi_regs; 53 - int msi_virqs[NR_MSI_IRQS]; 53 + int *msi_virqs; 54 54 struct msi_bitmap bitmap; 55 55 struct device_node *msi_dev; 56 56 }; ··· 63 61 { 64 62 int err; 65 63 66 - err = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS, 64 + err = msi_bitmap_alloc(&msi_data->bitmap, msi_irqs, 67 65 dev->dev.of_node); 68 66 if (err) 69 67 return err; ··· 84 82 struct msi_msg msg; 85 83 struct msi_desc *entry; 86 84 struct ppc4xx_msi *msi_data = &ppc4xx_msi; 85 + 86 + msi_data->msi_virqs = kmalloc((msi_irqs) * sizeof(int), 87 + GFP_KERNEL); 88 + if (!msi_data->msi_virqs) 89 + return -ENOMEM; 87 90 88 91 list_for_each_entry(entry, &dev->msi_list, list) { 89 92 int_no = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1); ··· 157 150 if (!sdr_addr) 158 151 return -1; 159 152 160 - SDR0_WRITE(sdr_addr, (u64)res.start >> 32); /*HIGH addr */ 161 - SDR0_WRITE(sdr_addr + 1, res.start & 0xFFFFFFFF); /* Low addr */ 162 - 153 + mtdcri(SDR0, *sdr_addr, upper_32_bits(res.start)); /*HIGH addr */ 154 + mtdcri(SDR0, *sdr_addr + 1, lower_32_bits(res.start)); /* Low addr */ 163 155 164 156 msi->msi_dev = of_find_node_by_name(NULL, "ppc4xx-msi"); 165 - if (msi->msi_dev) 157 + if (!msi->msi_dev) 166 158 return -ENODEV; 167 159 168 160 msi->msi_regs = of_iomap(msi->msi_dev, 0); ··· 173 167 (u32) (msi->msi_regs + PEIH_TERMADH), (u32) (msi->msi_regs)); 174 168 175 169 msi_virt = dma_alloc_coherent(&dev->dev, 64, &msi_phys, GFP_KERNEL); 176 - msi->msi_addr_hi = 0x0; 177 - msi->msi_addr_lo = (u32) msi_phys; 178 - dev_dbg(&dev->dev, "PCIE-MSI: msi address 0x%x\n", msi->msi_addr_lo); 170 + if (!msi_virt) 171 + return -ENOMEM; 172 + msi->msi_addr_hi = upper_32_bits(msi_phys); 173 + msi->msi_addr_lo = lower_32_bits(msi_phys & 0xffffffff); 174 + dev_dbg(&dev->dev, "PCIE-MSI: msi address high 0x%x, low 0x%x\n", 175 + msi->msi_addr_hi, msi->msi_addr_lo); 179 176 180 177 /* Progam the Interrupt handler Termination addr registers */ 181 178 out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi); ··· 194 185 out_be32(msi->msi_regs + PEIH_MSIED, *msi_data); 195 186 out_be32(msi->msi_regs + PEIH_MSIMK, *msi_mask); 196 187 188 + dma_free_coherent(&dev->dev, 64, msi_virt, msi_phys); 189 + 197 190 return 0; 198 191 } 199 192 ··· 205 194 int i; 206 195 int virq; 207 196 208 - for (i = 0; i < NR_MSI_IRQS; i++) { 197 + for (i = 0; i < msi_irqs; i++) { 209 198 virq = msi->msi_virqs[i]; 210 199 if (virq != NO_IRQ) 211 200 irq_dispose_mapping(virq); ··· 226 215 struct resource res; 227 216 int err = 0; 228 217 229 - msi = &ppc4xx_msi;/*keep the msi data for further use*/ 230 - 231 218 dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n"); 232 219 233 220 msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL); ··· 243 234 goto error_out; 244 235 } 245 236 237 + msi_irqs = of_irq_count(dev->dev.of_node); 238 + if (!msi_irqs) 239 + return -ENODEV; 240 + 246 241 if (ppc4xx_setup_pcieh_hw(dev, res, msi)) 247 242 goto error_out; 248 243 ··· 255 242 dev_err(&dev->dev, "Error allocating MSI bitmap\n"); 256 243 goto error_out; 257 244 } 245 + ppc4xx_msi = *msi; 258 246 259 247 ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs; 260 248 ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;