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

Merge tag 'mips_4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS updates from Paul Burton:

- kexec support for the generic MIPS platform when running on a CPU
including the MIPS Coherence Manager & related hardware.

- Improvements to the definition of memory barriers used around MMIO
accesses, and fixes in their use.

- Switch to CONFIG_NO_BOOTMEM from Mike Rapoport, finally dropping
reliance on the old bootmem code.

- A number of fixes & improvements for Loongson 3 systems.

- DT & config updates for the Microsemi Ocelot platform.

- Workaround to enable USB power on the Netgear WNDR3400v3.

- Various cleanups & fixes.

* tag 'mips_4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (51 commits)
MIPS: Cleanup DSP ASE detection
MIPS: dts: Change upper case to lower case
MIPS: generic: Add Network, SPI and I2C to ocelot_defconfig
MIPS: Loongson-3: Fix BRIDGE irq delivery problem
MIPS: Loongson-3: Fix CPU UART irq delivery problem
MIPS: Remove unused PREF, PREFE & PREFX macros
MIPS: lib: Use kernel_pref & user_pref in memcpy()
MIPS: Remove unused CAT macro
MIPS: Add kernel_pref & user_pref helpers
MIPS: Remove unused TTABLE macro
MIPS: Remove unused PIC macros
MIPS: Remove unused MOVN & MOVZ macros
MIPS: Provide actually relaxed MMIO accessors
MIPS: Enforce strong ordering for MMIO accessors
MIPS: Correct `mmiowb' barrier for `wbflush' platforms
MIPS: Define MMIO ordering barriers
MIPS: mscc: add PCB120 to the ocelot fitImage
MIPS: mscc: add DT for Ocelot PCB120
MIPS: memset: Limit excessive `noreorder' assembly mode use
MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
...

+918 -1017
+39 -3
arch/mips/Kconfig
··· 21 21 select GENERIC_CLOCKEVENTS 22 22 select GENERIC_CMOS_UPDATE 23 23 select GENERIC_CPU_AUTOPROBE 24 + select GENERIC_IOMAP 24 25 select GENERIC_IRQ_PROBE 25 26 select GENERIC_IRQ_SHOW 26 27 select GENERIC_LIB_ASHLDI3 ··· 29 28 select GENERIC_LIB_CMPDI2 30 29 select GENERIC_LIB_LSHRDI3 31 30 select GENERIC_LIB_UCMPDI2 32 - select GENERIC_PCI_IOMAP 33 31 select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC 34 32 select GENERIC_SMP_IDLE_THREAD 35 33 select GENERIC_TIME_VSYSCALL ··· 78 78 select RTC_LIB if !MACH_LOONGSON64 79 79 select SYSCTL_EXCEPTION_TRACE 80 80 select VIRT_TO_BUS 81 + select NO_BOOTMEM 81 82 82 83 menu "Machine selection" 83 84 ··· 133 132 select USB_UHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN 134 133 select USB_UHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN 135 134 select USE_OF 135 + select UHI_BOOT 136 136 help 137 137 Select this to build a kernel which aims to support multiple boards, 138 138 generally using a flattened device tree passed from the bootloader ··· 1151 1149 1152 1150 config GENERIC_CSUM 1153 1151 bool 1152 + default y if !CPU_HAS_LOAD_STORE_LR 1154 1153 1155 1154 config GENERIC_ISA_DMA 1156 1155 bool ··· 1370 1367 select CPU_SUPPORTS_64BIT_KERNEL 1371 1368 select CPU_SUPPORTS_HIGHMEM 1372 1369 select CPU_SUPPORTS_HUGEPAGES 1370 + select CPU_HAS_LOAD_STORE_LR 1373 1371 select WEAK_ORDERING 1374 1372 select WEAK_REORDERING_BEYOND_LLSC 1375 1373 select MIPS_PGD_C0_CONTEXT ··· 1447 1443 bool "MIPS32 Release 1" 1448 1444 depends on SYS_HAS_CPU_MIPS32_R1 1449 1445 select CPU_HAS_PREFETCH 1446 + select CPU_HAS_LOAD_STORE_LR 1450 1447 select CPU_SUPPORTS_32BIT_KERNEL 1451 1448 select CPU_SUPPORTS_HIGHMEM 1452 1449 help ··· 1465 1460 bool "MIPS32 Release 2" 1466 1461 depends on SYS_HAS_CPU_MIPS32_R2 1467 1462 select CPU_HAS_PREFETCH 1463 + select CPU_HAS_LOAD_STORE_LR 1468 1464 select CPU_SUPPORTS_32BIT_KERNEL 1469 1465 select CPU_SUPPORTS_HIGHMEM 1470 1466 select CPU_SUPPORTS_MSA ··· 1484 1478 select CPU_SUPPORTS_32BIT_KERNEL 1485 1479 select CPU_SUPPORTS_HIGHMEM 1486 1480 select CPU_SUPPORTS_MSA 1487 - select GENERIC_CSUM 1488 1481 select HAVE_KVM 1489 1482 select MIPS_O32_FP64_SUPPORT 1490 1483 help ··· 1496 1491 bool "MIPS64 Release 1" 1497 1492 depends on SYS_HAS_CPU_MIPS64_R1 1498 1493 select CPU_HAS_PREFETCH 1494 + select CPU_HAS_LOAD_STORE_LR 1499 1495 select CPU_SUPPORTS_32BIT_KERNEL 1500 1496 select CPU_SUPPORTS_64BIT_KERNEL 1501 1497 select CPU_SUPPORTS_HIGHMEM ··· 1516 1510 bool "MIPS64 Release 2" 1517 1511 depends on SYS_HAS_CPU_MIPS64_R2 1518 1512 select CPU_HAS_PREFETCH 1513 + select CPU_HAS_LOAD_STORE_LR 1519 1514 select CPU_SUPPORTS_32BIT_KERNEL 1520 1515 select CPU_SUPPORTS_64BIT_KERNEL 1521 1516 select CPU_SUPPORTS_HIGHMEM ··· 1538 1531 select CPU_SUPPORTS_64BIT_KERNEL 1539 1532 select CPU_SUPPORTS_HIGHMEM 1540 1533 select CPU_SUPPORTS_MSA 1541 - select GENERIC_CSUM 1542 1534 select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32 1543 1535 select HAVE_KVM 1544 1536 help ··· 1550 1544 bool "R3000" 1551 1545 depends on SYS_HAS_CPU_R3000 1552 1546 select CPU_HAS_WB 1547 + select CPU_HAS_LOAD_STORE_LR 1553 1548 select CPU_SUPPORTS_32BIT_KERNEL 1554 1549 select CPU_SUPPORTS_HIGHMEM 1555 1550 help ··· 1565 1558 bool "R39XX" 1566 1559 depends on SYS_HAS_CPU_TX39XX 1567 1560 select CPU_SUPPORTS_32BIT_KERNEL 1561 + select CPU_HAS_LOAD_STORE_LR 1568 1562 1569 1563 config CPU_VR41XX 1570 1564 bool "R41xx" 1571 1565 depends on SYS_HAS_CPU_VR41XX 1572 1566 select CPU_SUPPORTS_32BIT_KERNEL 1573 1567 select CPU_SUPPORTS_64BIT_KERNEL 1568 + select CPU_HAS_LOAD_STORE_LR 1574 1569 help 1575 1570 The options selects support for the NEC VR4100 series of processors. 1576 1571 Only choose this option if you have one of these processors as a ··· 1584 1575 depends on SYS_HAS_CPU_R4300 1585 1576 select CPU_SUPPORTS_32BIT_KERNEL 1586 1577 select CPU_SUPPORTS_64BIT_KERNEL 1578 + select CPU_HAS_LOAD_STORE_LR 1587 1579 help 1588 1580 MIPS Technologies R4300-series processors. 1589 1581 ··· 1594 1584 select CPU_SUPPORTS_32BIT_KERNEL 1595 1585 select CPU_SUPPORTS_64BIT_KERNEL 1596 1586 select CPU_SUPPORTS_HUGEPAGES 1587 + select CPU_HAS_LOAD_STORE_LR 1597 1588 help 1598 1589 MIPS Technologies R4000-series processors other than 4300, including 1599 1590 the R4000, R4400, R4600, and 4700. ··· 1603 1592 bool "R49XX" 1604 1593 depends on SYS_HAS_CPU_TX49XX 1605 1594 select CPU_HAS_PREFETCH 1595 + select CPU_HAS_LOAD_STORE_LR 1606 1596 select CPU_SUPPORTS_32BIT_KERNEL 1607 1597 select CPU_SUPPORTS_64BIT_KERNEL 1608 1598 select CPU_SUPPORTS_HUGEPAGES ··· 1614 1602 select CPU_SUPPORTS_32BIT_KERNEL 1615 1603 select CPU_SUPPORTS_64BIT_KERNEL 1616 1604 select CPU_SUPPORTS_HUGEPAGES 1605 + select CPU_HAS_LOAD_STORE_LR 1617 1606 help 1618 1607 MIPS Technologies R5000-series processors other than the Nevada. 1619 1608 ··· 1624 1611 select CPU_SUPPORTS_32BIT_KERNEL 1625 1612 select CPU_SUPPORTS_64BIT_KERNEL 1626 1613 select CPU_SUPPORTS_HUGEPAGES 1614 + select CPU_HAS_LOAD_STORE_LR 1627 1615 1628 1616 config CPU_R5500 1629 1617 bool "R5500" ··· 1632 1618 select CPU_SUPPORTS_32BIT_KERNEL 1633 1619 select CPU_SUPPORTS_64BIT_KERNEL 1634 1620 select CPU_SUPPORTS_HUGEPAGES 1621 + select CPU_HAS_LOAD_STORE_LR 1635 1622 help 1636 1623 NEC VR5500 and VR5500A series processors implement 64-bit MIPS IV 1637 1624 instruction set. ··· 1643 1628 select CPU_SUPPORTS_32BIT_KERNEL 1644 1629 select CPU_SUPPORTS_64BIT_KERNEL 1645 1630 select CPU_SUPPORTS_HUGEPAGES 1631 + select CPU_HAS_LOAD_STORE_LR 1646 1632 help 1647 1633 QED / PMC-Sierra RM52xx-series ("Nevada") processors. 1648 1634 ··· 1651 1635 bool "R8000" 1652 1636 depends on SYS_HAS_CPU_R8000 1653 1637 select CPU_HAS_PREFETCH 1638 + select CPU_HAS_LOAD_STORE_LR 1654 1639 select CPU_SUPPORTS_64BIT_KERNEL 1655 1640 help 1656 1641 MIPS Technologies R8000 processors. Note these processors are ··· 1661 1644 bool "R10000" 1662 1645 depends on SYS_HAS_CPU_R10000 1663 1646 select CPU_HAS_PREFETCH 1647 + select CPU_HAS_LOAD_STORE_LR 1664 1648 select CPU_SUPPORTS_32BIT_KERNEL 1665 1649 select CPU_SUPPORTS_64BIT_KERNEL 1666 1650 select CPU_SUPPORTS_HIGHMEM ··· 1673 1655 bool "RM7000" 1674 1656 depends on SYS_HAS_CPU_RM7000 1675 1657 select CPU_HAS_PREFETCH 1658 + select CPU_HAS_LOAD_STORE_LR 1676 1659 select CPU_SUPPORTS_32BIT_KERNEL 1677 1660 select CPU_SUPPORTS_64BIT_KERNEL 1678 1661 select CPU_SUPPORTS_HIGHMEM ··· 1682 1663 config CPU_SB1 1683 1664 bool "SB1" 1684 1665 depends on SYS_HAS_CPU_SB1 1666 + select CPU_HAS_LOAD_STORE_LR 1685 1667 select CPU_SUPPORTS_32BIT_KERNEL 1686 1668 select CPU_SUPPORTS_64BIT_KERNEL 1687 1669 select CPU_SUPPORTS_HIGHMEM ··· 1693 1673 bool "Cavium Octeon processor" 1694 1674 depends on SYS_HAS_CPU_CAVIUM_OCTEON 1695 1675 select CPU_HAS_PREFETCH 1676 + select CPU_HAS_LOAD_STORE_LR 1696 1677 select CPU_SUPPORTS_64BIT_KERNEL 1697 1678 select WEAK_ORDERING 1698 1679 select CPU_SUPPORTS_HIGHMEM ··· 1723 1702 select WEAK_ORDERING 1724 1703 select CPU_SUPPORTS_HIGHMEM 1725 1704 select CPU_HAS_PREFETCH 1705 + select CPU_HAS_LOAD_STORE_LR 1726 1706 select CPU_SUPPORTS_CPUFREQ 1727 1707 select MIPS_EXTERNAL_TIMER 1728 1708 help ··· 1732 1710 config CPU_XLR 1733 1711 bool "Netlogic XLR SoC" 1734 1712 depends on SYS_HAS_CPU_XLR 1713 + select CPU_HAS_LOAD_STORE_LR 1735 1714 select CPU_SUPPORTS_32BIT_KERNEL 1736 1715 select CPU_SUPPORTS_64BIT_KERNEL 1737 1716 select CPU_SUPPORTS_HIGHMEM ··· 1751 1728 select WEAK_ORDERING 1752 1729 select WEAK_REORDERING_BEYOND_LLSC 1753 1730 select CPU_HAS_PREFETCH 1731 + select CPU_HAS_LOAD_STORE_LR 1754 1732 select CPU_MIPSR2 1755 1733 select CPU_SUPPORTS_HUGEPAGES 1756 1734 select MIPS_ASID_BITS_VARIABLE ··· 1857 1833 select CPU_SUPPORTS_HIGHMEM 1858 1834 select CPU_SUPPORTS_HUGEPAGES 1859 1835 select ARCH_HAS_PHYS_TO_DMA 1836 + select CPU_HAS_LOAD_STORE_LR 1860 1837 1861 1838 config CPU_LOONGSON1 1862 1839 bool 1863 1840 select CPU_MIPS32 1864 1841 select CPU_MIPSR1 1865 1842 select CPU_HAS_PREFETCH 1843 + select CPU_HAS_LOAD_STORE_LR 1866 1844 select CPU_SUPPORTS_32BIT_KERNEL 1867 1845 select CPU_SUPPORTS_HIGHMEM 1868 1846 select CPU_SUPPORTS_CPUFREQ ··· 2478 2452 config CPU_HAS_RIXI 2479 2453 bool 2480 2454 2455 + config CPU_HAS_LOAD_STORE_LR 2456 + bool 2457 + help 2458 + CPU has support for unaligned load and store instructions: 2459 + LWL, LWR, SWL, SWR (Load/store word left/right). 2460 + LDL, LDR, SDL, SDR (Load/store doubleword left/right, for 64bit systems). 2461 + 2481 2462 # 2482 2463 # Vectored interrupt mode is an R2 feature 2483 2464 # ··· 2931 2898 select OF 2932 2899 select OF_EARLY_FLATTREE 2933 2900 select IRQ_DOMAIN 2901 + 2902 + config UHI_BOOT 2903 + bool 2934 2904 2935 2905 config BUILTIN_DTB 2936 2906 bool
+4 -7
arch/mips/Makefile
··· 13 13 # 14 14 15 15 archscripts: scripts_basic 16 + $(Q)$(MAKE) $(build)=arch/mips/tools elf-entry 16 17 $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs 17 18 18 19 KBUILD_DEFCONFIG := 32r2el_defconfig ··· 231 230 cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA 232 231 toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc) 233 232 cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC 233 + toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp) 234 + cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP 234 235 235 236 # 236 237 # Firmware support ··· 260 257 load-y = $(CONFIG_PHYSICAL_START) 261 258 endif 262 259 263 - # Sign-extend the entry point to 64 bits if retrieved as a 32-bit number. 264 - entry-y = $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \ 265 - | sed -n '/^start address / { \ 266 - s/^.* //; \ 267 - s/0x\([0-7].......\)$$/0x00000000\1/; \ 268 - s/0x\(........\)$$/0xffffffff\1/; p }') 269 - 260 + entry-y = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux) 270 261 cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic 271 262 drivers-$(CONFIG_PCI) += arch/mips/pci/ 272 263
+5 -3
arch/mips/bcm47xx/workarounds.c
··· 5 5 #include <bcm47xx_board.h> 6 6 #include <bcm47xx.h> 7 7 8 - static void __init bcm47xx_workarounds_netgear_wnr3500l(void) 8 + static void __init bcm47xx_workarounds_enable_usb_power(int usb_power) 9 9 { 10 - const int usb_power = 12; 11 10 int err; 12 11 13 12 err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power"); ··· 22 23 23 24 switch (board) { 24 25 case BCM47XX_BOARD_NETGEAR_WNR3500L: 25 - bcm47xx_workarounds_netgear_wnr3500l(); 26 + bcm47xx_workarounds_enable_usb_power(12); 27 + break; 28 + case BCM47XX_BOARD_NETGEAR_WNDR3400_V3: 29 + bcm47xx_workarounds_enable_usb_power(21); 26 30 break; 27 31 default: 28 32 /* No workaround(s) needed */
+1 -8
arch/mips/bmips/setup.c
··· 153 153 mips_hpt_frequency = freq; 154 154 } 155 155 156 - extern const char __appended_dtb; 157 - 158 156 void __init plat_mem_setup(void) 159 157 { 160 158 void *dtb; ··· 162 164 ioport_resource.start = 0; 163 165 ioport_resource.end = ~0; 164 166 165 - #ifdef CONFIG_MIPS_ELF_APPENDED_DTB 166 - if (!fdt_check_header(&__appended_dtb)) 167 - dtb = (void *)&__appended_dtb; 168 - else 169 - #endif 170 167 /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ 171 168 if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) 172 169 dtb = phys_to_virt(fw_arg2); 173 - else if (fw_passed_dtb) /* UHI interface */ 170 + else if (fw_passed_dtb) /* UHI interface or appended dtb */ 174 171 dtb = (void *)fw_passed_dtb; 175 172 else if (__dtb_start != __dtb_end) 176 173 dtb = (void *)__dtb_start;
+21 -21
arch/mips/boot/dts/lantiq/danube.dtsi
··· 10 10 }; 11 11 }; 12 12 13 - biu@1F800000 { 13 + biu@1f800000 { 14 14 #address-cells = <1>; 15 15 #size-cells = <1>; 16 16 compatible = "lantiq,biu", "simple-bus"; 17 - reg = <0x1F800000 0x800000>; 18 - ranges = <0x0 0x1F800000 0x7FFFFF>; 17 + reg = <0x1f800000 0x800000>; 18 + ranges = <0x0 0x1f800000 0x7fffff>; 19 19 20 20 icu0: icu@80200 { 21 21 #interrupt-cells = <1>; ··· 24 24 reg = <0x80200 0x120>; 25 25 }; 26 26 27 - watchdog@803F0 { 27 + watchdog@803f0 { 28 28 compatible = "lantiq,wdt"; 29 - reg = <0x803F0 0x10>; 29 + reg = <0x803f0 0x10>; 30 30 }; 31 31 }; 32 32 33 - sram@1F000000 { 33 + sram@1f000000 { 34 34 #address-cells = <1>; 35 35 #size-cells = <1>; 36 36 compatible = "lantiq,sram"; 37 - reg = <0x1F000000 0x800000>; 38 - ranges = <0x0 0x1F000000 0x7FFFFF>; 37 + reg = <0x1f000000 0x800000>; 38 + ranges = <0x0 0x1f000000 0x7fffff>; 39 39 40 40 eiu0: eiu@101000 { 41 41 #interrupt-cells = <1>; ··· 66 66 #address-cells = <1>; 67 67 #size-cells = <1>; 68 68 compatible = "lantiq,fpi", "simple-bus"; 69 - ranges = <0x0 0x10000000 0xEEFFFFF>; 70 - reg = <0x10000000 0xEF00000>; 69 + ranges = <0x0 0x10000000 0xeefffff>; 70 + reg = <0x10000000 0xef00000>; 71 71 72 - gptu@E100A00 { 72 + gptu@e100a00 { 73 73 compatible = "lantiq,gptu-xway"; 74 - reg = <0xE100A00 0x100>; 74 + reg = <0xe100a00 0x100>; 75 75 }; 76 76 77 - serial@E100C00 { 77 + serial@e100c00 { 78 78 compatible = "lantiq,asc"; 79 - reg = <0xE100C00 0x400>; 79 + reg = <0xe100c00 0x400>; 80 80 interrupt-parent = <&icu0>; 81 81 interrupts = <112 113 114>; 82 82 }; 83 83 84 - dma0: dma@E104100 { 84 + dma0: dma@e104100 { 85 85 compatible = "lantiq,dma-xway"; 86 - reg = <0xE104100 0x800>; 86 + reg = <0xe104100 0x800>; 87 87 }; 88 88 89 - ebu0: ebu@E105300 { 89 + ebu0: ebu@e105300 { 90 90 compatible = "lantiq,ebu-xway"; 91 - reg = <0xE105300 0x100>; 91 + reg = <0xe105300 0x100>; 92 92 }; 93 93 94 - pci0: pci@E105400 { 94 + pci0: pci@e105400 { 95 95 #address-cells = <3>; 96 96 #size-cells = <2>; 97 97 #interrupt-cells = <1>; 98 98 compatible = "lantiq,pci-xway"; 99 99 bus-range = <0x0 0x0>; 100 100 ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ 101 - 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ 101 + 0x1000000 0 0x00000000 0xae00000 0 0x200000>; /* io space */ 102 102 reg = <0x7000000 0x8000 /* config space */ 103 - 0xE105400 0x400>; /* pci bridge */ 103 + 0xe105400 0x400>; /* pci bridge */ 104 104 }; 105 105 }; 106 106 };
+7 -7
arch/mips/boot/dts/lantiq/easy50712.dts
··· 52 52 }; 53 53 }; 54 54 55 - gpio: pinmux@E100B10 { 55 + gpio: pinmux@e100b10 { 56 56 compatible = "lantiq,danube-pinctrl"; 57 57 pinctrl-names = "default"; 58 58 pinctrl-0 = <&state_default>; 59 59 60 60 #gpio-cells = <2>; 61 61 gpio-controller; 62 - reg = <0xE100B10 0xA0>; 62 + reg = <0xe100b10 0xa0>; 63 63 64 64 state_default: pinmux { 65 65 stp { ··· 82 82 }; 83 83 }; 84 84 85 - etop@E180000 { 85 + etop@e180000 { 86 86 compatible = "lantiq,etop-xway"; 87 - reg = <0xE180000 0x40000>; 87 + reg = <0xe180000 0x40000>; 88 88 interrupt-parent = <&icu0>; 89 89 interrupts = <73 78>; 90 90 phy-mode = "rmii"; 91 91 mac-address = [ 00 11 22 33 44 55 ]; 92 92 }; 93 93 94 - stp0: stp@E100BB0 { 94 + stp0: stp@e100bb0 { 95 95 #gpio-cells = <2>; 96 96 compatible = "lantiq,gpio-stp-xway"; 97 97 gpio-controller; 98 - reg = <0xE100BB0 0x40>; 98 + reg = <0xe100bb0 0x40>; 99 99 100 100 lantiq,shadow = <0xfff>; 101 101 lantiq,groups = <0x3>; 102 102 }; 103 103 104 - pci@E105400 { 104 + pci@e105400 { 105 105 lantiq,bus-clock = <33333333>; 106 106 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 107 107 interrupt-map = <
+1 -1
arch/mips/boot/dts/mscc/Makefile
··· 1 - dtb-$(CONFIG_MSCC_OCELOT) += ocelot_pcb123.dtb 1 + dtb-$(CONFIG_MSCC_OCELOT) += ocelot_pcb123.dtb ocelot_pcb120.dtb 2 2 3 3 obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
+19
arch/mips/boot/dts/mscc/ocelot.dtsi
··· 78 78 status = "disabled"; 79 79 }; 80 80 81 + i2c: i2c@100400 { 82 + compatible = "mscc,ocelot-i2c", "snps,designware-i2c"; 83 + pinctrl-0 = <&i2c_pins>; 84 + pinctrl-names = "default"; 85 + reg = <0x100400 0x100>, <0x198 0x8>; 86 + #address-cells = <1>; 87 + #size-cells = <0>; 88 + interrupts = <8>; 89 + clocks = <&ahb_clk>; 90 + 91 + status = "disabled"; 92 + }; 93 + 81 94 uart2: serial@100800 { 82 95 pinctrl-0 = <&uart2_pins>; 83 96 pinctrl-names = "default"; ··· 195 182 interrupts = <13>; 196 183 #interrupt-cells = <2>; 197 184 185 + i2c_pins: i2c-pins { 186 + pins = "GPIO_16", "GPIO_17"; 187 + function = "twi"; 188 + }; 189 + 198 190 uart_pins: uart-pins { 199 191 pins = "GPIO_6", "GPIO_7"; 200 192 function = "uart"; ··· 214 196 pins = "GPIO_14", "GPIO_15"; 215 197 function = "miim1"; 216 198 }; 199 + 217 200 }; 218 201 219 202 mdio0: mdio@107009c {
+107
arch/mips/boot/dts/mscc/ocelot_pcb120.dts
··· 1 + // SPDX-License-Identifier: (GPL-2.0 OR MIT) 2 + /* Copyright (c) 2017 Microsemi Corporation */ 3 + 4 + /dts-v1/; 5 + 6 + #include <dt-bindings/interrupt-controller/irq.h> 7 + #include <dt-bindings/phy/phy-ocelot-serdes.h> 8 + #include "ocelot.dtsi" 9 + 10 + / { 11 + compatible = "mscc,ocelot-pcb120", "mscc,ocelot"; 12 + 13 + chosen { 14 + stdout-path = "serial0:115200n8"; 15 + }; 16 + 17 + memory@0 { 18 + device_type = "memory"; 19 + reg = <0x0 0x0e000000>; 20 + }; 21 + }; 22 + 23 + &gpio { 24 + phy_int_pins: phy_int_pins { 25 + pins = "GPIO_4"; 26 + function = "gpio"; 27 + }; 28 + }; 29 + 30 + &mdio0 { 31 + status = "okay"; 32 + }; 33 + 34 + &mdio1 { 35 + status = "okay"; 36 + pinctrl-names = "default"; 37 + pinctrl-0 = <&miim1>, <&phy_int_pins>; 38 + 39 + phy7: ethernet-phy@0 { 40 + reg = <0>; 41 + interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; 42 + interrupt-parent = <&gpio>; 43 + }; 44 + phy6: ethernet-phy@1 { 45 + reg = <1>; 46 + interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; 47 + interrupt-parent = <&gpio>; 48 + }; 49 + phy5: ethernet-phy@2 { 50 + reg = <2>; 51 + interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; 52 + interrupt-parent = <&gpio>; 53 + }; 54 + phy4: ethernet-phy@3 { 55 + reg = <3>; 56 + interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; 57 + interrupt-parent = <&gpio>; 58 + }; 59 + }; 60 + 61 + &port0 { 62 + phy-handle = <&phy0>; 63 + }; 64 + 65 + &port1 { 66 + phy-handle = <&phy1>; 67 + }; 68 + 69 + &port2 { 70 + phy-handle = <&phy2>; 71 + }; 72 + 73 + &port3 { 74 + phy-handle = <&phy3>; 75 + }; 76 + 77 + &port4 { 78 + phy-handle = <&phy7>; 79 + phy-mode = "sgmii"; 80 + phys = <&serdes 4 SERDES1G(2)>; 81 + }; 82 + 83 + &port5 { 84 + phy-handle = <&phy4>; 85 + phy-mode = "sgmii"; 86 + phys = <&serdes 5 SERDES1G(5)>; 87 + }; 88 + 89 + &port6 { 90 + phy-handle = <&phy6>; 91 + phy-mode = "sgmii"; 92 + phys = <&serdes 6 SERDES1G(3)>; 93 + }; 94 + 95 + &port9 { 96 + phy-handle = <&phy5>; 97 + phy-mode = "sgmii"; 98 + phys = <&serdes 9 SERDES1G(4)>; 99 + }; 100 + 101 + &uart0 { 102 + status = "okay"; 103 + }; 104 + 105 + &uart2 { 106 + status = "okay"; 107 + };
+6
arch/mips/boot/dts/mscc/ocelot_pcb123.dts
··· 36 36 }; 37 37 }; 38 38 39 + &i2c { 40 + clock-frequency = <100000>; 41 + i2c-sda-hold-time-ns = <300>; 42 + status = "okay"; 43 + }; 44 + 39 45 &mdio0 { 40 46 status = "okay"; 41 47 };
+8 -8
arch/mips/cavium-octeon/octeon-irq.c
··· 1180 1180 type = IRQ_TYPE_LEVEL_LOW; 1181 1181 break; 1182 1182 default: 1183 - pr_err("Error: (%s) Invalid irq trigger specification: %x\n", 1184 - node->name, 1183 + pr_err("Error: (%pOFn) Invalid irq trigger specification: %x\n", 1184 + node, 1185 1185 trigger); 1186 1186 type = IRQ_TYPE_LEVEL_LOW; 1187 1187 break; ··· 2271 2271 2272 2272 parent_irq = irq_of_parse_and_map(ciu_node, 0); 2273 2273 if (!parent_irq) { 2274 - pr_err("ERROR: Couldn't acquire parent_irq for %s\n", 2275 - ciu_node->name); 2274 + pr_err("ERROR: Couldn't acquire parent_irq for %pOFn\n", 2275 + ciu_node); 2276 2276 return -EINVAL; 2277 2277 } 2278 2278 ··· 2283 2283 2284 2284 addr = of_get_address(ciu_node, 0, NULL, NULL); 2285 2285 if (!addr) { 2286 - pr_err("ERROR: Couldn't acquire reg(0) %s\n", ciu_node->name); 2286 + pr_err("ERROR: Couldn't acquire reg(0) %pOFn\n", ciu_node); 2287 2287 return -EINVAL; 2288 2288 } 2289 2289 host_data->raw_reg = (u64)phys_to_virt( ··· 2291 2291 2292 2292 addr = of_get_address(ciu_node, 1, NULL, NULL); 2293 2293 if (!addr) { 2294 - pr_err("ERROR: Couldn't acquire reg(1) %s\n", ciu_node->name); 2294 + pr_err("ERROR: Couldn't acquire reg(1) %pOFn\n", ciu_node); 2295 2295 return -EINVAL; 2296 2296 } 2297 2297 host_data->en_reg = (u64)phys_to_virt( ··· 2299 2299 2300 2300 r = of_property_read_u32(ciu_node, "cavium,max-bits", &val); 2301 2301 if (r) { 2302 - pr_err("ERROR: Couldn't read cavium,max-bits from %s\n", 2303 - ciu_node->name); 2302 + pr_err("ERROR: Couldn't read cavium,max-bits from %pOFn\n", 2303 + ciu_node); 2304 2304 return r; 2305 2305 } 2306 2306 host_data->max_bits = val;
+3 -6
arch/mips/cavium-octeon/setup.c
··· 1161 1161 bool do_prune; 1162 1162 bool fill_mac; 1163 1163 1164 - #ifdef CONFIG_MIPS_ELF_APPENDED_DTB 1165 - if (!fdt_check_header(&__appended_dtb)) { 1166 - fdt = &__appended_dtb; 1164 + if (fw_passed_dtb) { 1165 + fdt = (void *)fw_passed_dtb; 1167 1166 do_prune = false; 1168 1167 fill_mac = true; 1169 1168 pr_info("Using appended Device Tree.\n"); 1170 - } else 1171 - #endif 1172 - if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { 1169 + } else if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { 1173 1170 fdt = phys_to_virt(octeon_bootinfo->fdt_addr); 1174 1171 if (fdt_check_header(fdt)) 1175 1172 panic("Corrupt Device Tree passed to kernel.");
+7
arch/mips/cavium-octeon/smp.c
··· 15 15 #include <linux/sched/task_stack.h> 16 16 #include <linux/init.h> 17 17 #include <linux/export.h> 18 + #include <linux/kexec.h> 18 19 19 20 #include <asm/mmu_context.h> 20 21 #include <asm/time.h> ··· 425 424 .cpu_disable = octeon_cpu_disable, 426 425 .cpu_die = octeon_cpu_die, 427 426 #endif 427 + #ifdef CONFIG_KEXEC 428 + .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 429 + #endif 428 430 }; 429 431 430 432 static irqreturn_t octeon_78xx_reched_interrupt(int irq, void *dev_id) ··· 504 500 #ifdef CONFIG_HOTPLUG_CPU 505 501 .cpu_disable = octeon_cpu_disable, 506 502 .cpu_die = octeon_cpu_die, 503 + #endif 504 + #ifdef CONFIG_KEXEC 505 + .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 507 506 #endif 508 507 }; 509 508
+9 -1
arch/mips/configs/generic/board-ocelot.config
··· 18 18 CONFIG_SERIAL_8250_CONSOLE=y 19 19 CONFIG_SERIAL_OF_PLATFORM=y 20 20 21 - CONFIG_GPIO_SYSFS=y 21 + CONFIG_NETDEVICES=y 22 + CONFIG_MSCC_OCELOT_SWITCH=y 23 + CONFIG_MSCC_OCELOT_SWITCH_OCELOT=y 24 + CONFIG_MDIO_MSCC_MIIM=y 25 + CONFIG_MICROSEMI_PHY=y 22 26 23 27 CONFIG_I2C=y 24 28 CONFIG_I2C_CHARDEV=y 25 29 CONFIG_I2C_MUX=y 30 + CONFIG_I2C_DESIGNWARE_PLATFORM=y 26 31 27 32 CONFIG_SPI=y 28 33 CONFIG_SPI_BITBANG=y 29 34 CONFIG_SPI_DESIGNWARE=y 35 + CONFIG_SPI_DW_MMIO=y 30 36 CONFIG_SPI_SPIDEV=y 37 + 38 + CONFIG_GPIO_SYSFS=y 31 39 32 40 CONFIG_POWER_RESET=y 33 41 CONFIG_POWER_RESET_OCELOT_RESET=y
+3 -3
arch/mips/generic/Kconfig
··· 65 65 Enable this to include the FDT for the MIPSfpga platform 66 66 from Imagination Technologies in the FIT kernel image. 67 67 68 - config FIT_IMAGE_FDT_OCELOT_PCB123 69 - bool "Include FDT for Microsemi Ocelot PCB123" 68 + config FIT_IMAGE_FDT_OCELOT 69 + bool "Include FDT for Microsemi Ocelot development platforms" 70 70 select MSCC_OCELOT 71 71 help 72 - Enable this to include the FDT for the Ocelot PCB123 platform 72 + Enable this to include the FDT for the Ocelot development platforms 73 73 from Microsemi in the FIT kernel image. 74 74 This requires u-boot on the platform. 75 75
-1
arch/mips/generic/Makefile
··· 15 15 obj-$(CONFIG_YAMON_DT_SHIM) += yamon-dt.o 16 16 obj-$(CONFIG_LEGACY_BOARD_SEAD3) += board-sead3.o 17 17 obj-$(CONFIG_LEGACY_BOARD_OCELOT) += board-ocelot.o 18 - obj-$(CONFIG_KEXEC) += kexec.o 19 18 obj-$(CONFIG_VIRT_BOARD_RANCHU) += board-ranchu.o
+1 -1
arch/mips/generic/Platform
··· 16 16 its-y := vmlinux.its.S 17 17 its-$(CONFIG_FIT_IMAGE_FDT_BOSTON) += board-boston.its.S 18 18 its-$(CONFIG_FIT_IMAGE_FDT_NI169445) += board-ni169445.its.S 19 - its-$(CONFIG_FIT_IMAGE_FDT_OCELOT_PCB123) += board-ocelot_pcb123.its.S 19 + its-$(CONFIG_FIT_IMAGE_FDT_OCELOT) += board-ocelot.its.S 20 20 its-$(CONFIG_FIT_IMAGE_FDT_XILFPGA) += board-xilfpga.its.S
+17
arch/mips/generic/board-ocelot_pcb123.its.S arch/mips/generic/board-ocelot.its.S
··· 11 11 algo = "sha1"; 12 12 }; 13 13 }; 14 + 15 + fdt@ocelot_pcb120 { 16 + description = "MSCC Ocelot PCB120 Device Tree"; 17 + data = /incbin/("boot/dts/mscc/ocelot_pcb120.dtb"); 18 + type = "flat_dt"; 19 + arch = "mips"; 20 + compression = "none"; 21 + hash@0 { 22 + algo = "sha1"; 23 + }; 24 + }; 14 25 }; 15 26 16 27 configurations { ··· 29 18 description = "Ocelot Linux kernel"; 30 19 kernel = "kernel@0"; 31 20 fdt = "fdt@ocelot_pcb123"; 21 + }; 22 + 23 + conf@ocelot_pcb120 { 24 + description = "Ocelot Linux kernel"; 25 + kernel = "kernel@0"; 26 + fdt = "fdt@ocelot_pcb120"; 32 27 }; 33 28 }; 34 29 };
-44
arch/mips/generic/kexec.c
··· 1 - /* 2 - * Copyright (C) 2016 Imagination Technologies 3 - * Author: Marcin Nowakowski <marcin.nowakowski@mips.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify it 6 - * under the terms of the GNU General Public License as published by the 7 - * Free Software Foundation; either version 2 of the License, or (at your 8 - * option) any later version. 9 - */ 10 - 11 - #include <linux/kexec.h> 12 - #include <linux/libfdt.h> 13 - #include <linux/uaccess.h> 14 - 15 - static int generic_kexec_prepare(struct kimage *image) 16 - { 17 - int i; 18 - 19 - for (i = 0; i < image->nr_segments; i++) { 20 - struct fdt_header fdt; 21 - 22 - if (image->segment[i].memsz <= sizeof(fdt)) 23 - continue; 24 - 25 - if (copy_from_user(&fdt, image->segment[i].buf, sizeof(fdt))) 26 - continue; 27 - 28 - if (fdt_check_header(&fdt)) 29 - continue; 30 - 31 - kexec_args[0] = -2; 32 - kexec_args[1] = (unsigned long) 33 - phys_to_virt((unsigned long)image->segment[i].mem); 34 - break; 35 - } 36 - return 0; 37 - } 38 - 39 - static int __init register_generic_kexec(void) 40 - { 41 - _machine_kexec_prepare = generic_kexec_prepare; 42 - return 0; 43 - } 44 - arch_initcall(register_generic_kexec);
+6
arch/mips/include/asm/asm-eva.h
··· 15 15 /* Kernel variants */ 16 16 17 17 #define kernel_cache(op, base) "cache " op ", " base "\n" 18 + #define kernel_pref(hint, base) "pref " hint ", " base "\n" 18 19 #define kernel_ll(reg, addr) "ll " reg ", " addr "\n" 19 20 #define kernel_sc(reg, addr) "sc " reg ", " addr "\n" 20 21 #define kernel_lw(reg, addr) "lw " reg ", " addr "\n" ··· 52 51 " .set pop\n" 53 52 54 53 #define user_cache(op, base) __BUILD_EVA_INSN("cachee", op, base) 54 + #define user_pref(hint, base) __BUILD_EVA_INSN("prefe", hint, base) 55 55 #define user_ll(reg, addr) __BUILD_EVA_INSN("lle", reg, addr) 56 56 #define user_sc(reg, addr) __BUILD_EVA_INSN("sce", reg, addr) 57 57 #define user_lw(reg, addr) __BUILD_EVA_INSN("lwe", reg, addr) ··· 74 72 #else 75 73 76 74 #define user_cache(op, base) kernel_cache(op, base) 75 + #define user_pref(hint, base) kernel_pref(hint, base) 77 76 #define user_ll(reg, addr) kernel_ll(reg, addr) 78 77 #define user_sc(reg, addr) kernel_sc(reg, addr) 79 78 #define user_lw(reg, addr) kernel_lw(reg, addr) ··· 102 99 #else /* __ASSEMBLY__ */ 103 100 104 101 #define kernel_cache(op, base) cache op, base 102 + #define kernel_pref(hint, base) pref hint, base 105 103 #define kernel_ll(reg, addr) ll reg, addr 106 104 #define kernel_sc(reg, addr) sc reg, addr 107 105 #define kernel_lw(reg, addr) lw reg, addr ··· 139 135 .set pop; 140 136 141 137 #define user_cache(op, base) __BUILD_EVA_INSN(cachee, op, base) 138 + #define user_pref(hint, base) __BUILD_EVA_INSN(prefe, hint, base) 142 139 #define user_ll(reg, addr) __BUILD_EVA_INSN(lle, reg, addr) 143 140 #define user_sc(reg, addr) __BUILD_EVA_INSN(sce, reg, addr) 144 141 #define user_lw(reg, addr) __BUILD_EVA_INSN(lwe, reg, addr) ··· 160 155 #else 161 156 162 157 #define user_cache(op, base) kernel_cache(op, base) 158 + #define user_pref(hint, base) kernel_pref(hint, base) 163 159 #define user_ll(reg, addr) kernel_ll(reg, addr) 164 160 #define user_sc(reg, addr) kernel_sc(reg, addr) 165 161 #define user_lw(reg, addr) kernel_lw(reg, addr)
-116
arch/mips/include/asm/asm.h
··· 20 20 #include <asm/sgidefs.h> 21 21 #include <asm/asm-eva.h> 22 22 23 - #ifndef CAT 24 - #ifdef __STDC__ 25 - #define __CAT(str1, str2) str1##str2 26 - #else 27 - #define __CAT(str1, str2) str1/**/str2 28 - #endif 29 - #define CAT(str1, str2) __CAT(str1, str2) 30 - #endif 31 - 32 - /* 33 - * PIC specific declarations 34 - * Not used for the kernel but here seems to be the right place. 35 - */ 36 - #ifdef __PIC__ 37 - #define CPRESTORE(register) \ 38 - .cprestore register 39 - #define CPADD(register) \ 40 - .cpadd register 41 - #define CPLOAD(register) \ 42 - .cpload register 43 - #else 44 - #define CPRESTORE(register) 45 - #define CPADD(register) 46 - #define CPLOAD(register) 47 - #endif 48 - 49 23 /* 50 24 * LEAF - declare leaf routine 51 25 */ ··· 102 128 .pushsection .data; \ 103 129 8: .asciiz msg; \ 104 130 .popsection; 105 - 106 - /* 107 - * Build text tables 108 - */ 109 - #define TTABLE(string) \ 110 - .pushsection .text; \ 111 - .word 1f; \ 112 - .popsection \ 113 - .pushsection .data; \ 114 - 1: .asciiz string; \ 115 - .popsection 116 - 117 - /* 118 - * MIPS IV pref instruction. 119 - * Use with .set noreorder only! 120 - * 121 - * MIPS IV implementations are free to treat this as a nop. The R5000 122 - * is one of them. So we should have an option not to use this instruction. 123 - */ 124 - #ifdef CONFIG_CPU_HAS_PREFETCH 125 - 126 - #define PREF(hint,addr) \ 127 - .set push; \ 128 - .set arch=r5000; \ 129 - pref hint, addr; \ 130 - .set pop 131 - 132 - #define PREFE(hint, addr) \ 133 - .set push; \ 134 - .set mips0; \ 135 - .set eva; \ 136 - prefe hint, addr; \ 137 - .set pop 138 - 139 - #define PREFX(hint,addr) \ 140 - .set push; \ 141 - .set arch=r5000; \ 142 - prefx hint, addr; \ 143 - .set pop 144 - 145 - #else /* !CONFIG_CPU_HAS_PREFETCH */ 146 - 147 - #define PREF(hint, addr) 148 - #define PREFE(hint, addr) 149 - #define PREFX(hint, addr) 150 - 151 - #endif /* !CONFIG_CPU_HAS_PREFETCH */ 152 - 153 - /* 154 - * MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs. 155 - */ 156 - #if (_MIPS_ISA == _MIPS_ISA_MIPS1) 157 - #define MOVN(rd, rs, rt) \ 158 - .set push; \ 159 - .set reorder; \ 160 - beqz rt, 9f; \ 161 - move rd, rs; \ 162 - .set pop; \ 163 - 9: 164 - #define MOVZ(rd, rs, rt) \ 165 - .set push; \ 166 - .set reorder; \ 167 - bnez rt, 9f; \ 168 - move rd, rs; \ 169 - .set pop; \ 170 - 9: 171 - #endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */ 172 - #if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) 173 - #define MOVN(rd, rs, rt) \ 174 - .set push; \ 175 - .set noreorder; \ 176 - bnezl rt, 9f; \ 177 - move rd, rs; \ 178 - .set pop; \ 179 - 9: 180 - #define MOVZ(rd, rs, rt) \ 181 - .set push; \ 182 - .set noreorder; \ 183 - beqzl rt, 9f; \ 184 - move rd, rs; \ 185 - .set pop; \ 186 - 9: 187 - #endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */ 188 - #if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \ 189 - (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64) 190 - #define MOVN(rd, rs, rt) \ 191 - movn rd, rs, rt 192 - #define MOVZ(rd, rs, rt) \ 193 - movz rd, rs, rt 194 - #endif /* MIPS IV, MIPS V, MIPS32 or MIPS64 */ 195 131 196 132 /* 197 133 * Stack alignment
+64 -65
arch/mips/include/asm/io.h
··· 20 20 #include <linux/irqflags.h> 21 21 22 22 #include <asm/addrspace.h> 23 + #include <asm/barrier.h> 23 24 #include <asm/bug.h> 24 25 #include <asm/byteorder.h> 25 26 #include <asm/cpu.h> ··· 35 34 #include <mangle-port.h> 36 35 37 36 /* 38 - * Slowdown I/O port space accesses for antique hardware. 39 - */ 40 - #undef CONF_SLOWDOWN_IO 41 - 42 - /* 43 37 * Raw operations are never swapped in software. OTOH values that raw 44 38 * operations are working on may or may not have been swapped by the bus 45 39 * hardware. An example use would be for flash memory that's used for ··· 45 49 # define __raw_ioswabl(a, x) (x) 46 50 # define __raw_ioswabq(a, x) (x) 47 51 # define ____raw_ioswabq(a, x) (x) 52 + 53 + # define __relaxed_ioswabb ioswabb 54 + # define __relaxed_ioswabw ioswabw 55 + # define __relaxed_ioswabl ioswabl 56 + # define __relaxed_ioswabq ioswabq 48 57 49 58 /* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ 50 59 ··· 81 80 } 82 81 83 82 /* 84 - * Thanks to James van Artsdalen for a better timing-fix than 85 - * the two short jumps: using outb's to a nonexistent port seems 86 - * to guarantee better timings even on fast machines. 87 - * 88 - * On the other hand, I'd like to be sure of a non-existent port: 89 - * I feel a bit unsafe about using 0x80 (should be safe, though) 90 - * 91 - * Linus 92 - * 83 + * Provide the necessary definitions for generic iomap. We make use of 84 + * mips_io_port_base for iomap(), but we don't reserve any low addresses for 85 + * use with I/O ports. 93 86 */ 94 87 95 - #define __SLOW_DOWN_IO \ 96 - __asm__ __volatile__( \ 97 - "sb\t$0,0x80(%0)" \ 98 - : : "r" (mips_io_port_base)); 88 + #define HAVE_ARCH_PIO_SIZE 89 + #define PIO_OFFSET mips_io_port_base 90 + #define PIO_MASK IO_SPACE_LIMIT 91 + #define PIO_RESERVED 0x0UL 99 92 100 - #ifdef CONF_SLOWDOWN_IO 101 - #ifdef REALLY_SLOW_IO 102 - #define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } 103 - #else 104 - #define SLOW_DOWN_IO __SLOW_DOWN_IO 105 - #endif 106 - #else 107 - #define SLOW_DOWN_IO 108 - #endif 93 + /* 94 + * Enforce in-order execution of data I/O. In the MIPS architecture 95 + * these are equivalent to corresponding platform-specific memory 96 + * barriers defined in <asm/barrier.h>. API pinched from PowerPC, 97 + * with sync additionally defined. 98 + */ 99 + #define iobarrier_rw() mb() 100 + #define iobarrier_r() rmb() 101 + #define iobarrier_w() wmb() 102 + #define iobarrier_sync() iob() 103 + 104 + /* Some callers use this older API instead. */ 105 + #define mmiowb() iobarrier_w() 109 106 110 107 /* 111 108 * virt_to_phys - map virtual addresses to physical ··· 170 171 171 172 extern void __iomem * __ioremap(phys_addr_t offset, phys_addr_t size, unsigned long flags); 172 173 extern void __iounmap(const volatile void __iomem *addr); 173 - 174 - #ifndef CONFIG_PCI 175 - struct pci_dev; 176 - static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} 177 - #endif 178 174 179 175 static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long size, 180 176 unsigned long flags) ··· 310 316 #undef __IS_KSEG1 311 317 } 312 318 313 - #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_LOONGSON3_ENHANCEMENT) 319 + #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON3) 314 320 #define war_io_reorder_wmb() wmb() 315 321 #else 316 322 #define war_io_reorder_wmb() barrier() 317 323 #endif 318 324 319 - #define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \ 325 + #define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, barrier, relax, irq) \ 320 326 \ 321 327 static inline void pfx##write##bwlq(type val, \ 322 328 volatile void __iomem *mem) \ ··· 324 330 volatile type *__mem; \ 325 331 type __val; \ 326 332 \ 327 - war_io_reorder_wmb(); \ 333 + if (barrier) \ 334 + iobarrier_rw(); \ 335 + else \ 336 + war_io_reorder_wmb(); \ 328 337 \ 329 338 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ 330 339 \ ··· 364 367 \ 365 368 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ 366 369 \ 370 + if (barrier) \ 371 + iobarrier_rw(); \ 372 + \ 367 373 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \ 368 374 __val = *__mem; \ 369 375 else if (cpu_has_64bits) { \ ··· 390 390 } \ 391 391 \ 392 392 /* prevent prefetching of coherent DMA data prematurely */ \ 393 - rmb(); \ 393 + if (!relax) \ 394 + rmb(); \ 394 395 return pfx##ioswab##bwlq(__mem, __val); \ 395 396 } 396 397 397 - #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \ 398 + #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \ 398 399 \ 399 400 static inline void pfx##out##bwlq##p(type val, unsigned long port) \ 400 401 { \ 401 402 volatile type *__addr; \ 402 403 type __val; \ 403 404 \ 404 - war_io_reorder_wmb(); \ 405 + if (barrier) \ 406 + iobarrier_rw(); \ 407 + else \ 408 + war_io_reorder_wmb(); \ 405 409 \ 406 410 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \ 407 411 \ ··· 415 411 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ 416 412 \ 417 413 *__addr = __val; \ 418 - slow; \ 419 414 } \ 420 415 \ 421 416 static inline type pfx##in##bwlq##p(unsigned long port) \ ··· 426 423 \ 427 424 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ 428 425 \ 426 + if (barrier) \ 427 + iobarrier_rw(); \ 428 + \ 429 429 __val = *__addr; \ 430 - slow; \ 431 430 \ 432 431 /* prevent prefetching of coherent DMA data prematurely */ \ 433 - rmb(); \ 432 + if (!relax) \ 433 + rmb(); \ 434 434 return pfx##ioswab##bwlq(__addr, __val); \ 435 435 } 436 436 437 - #define __BUILD_MEMORY_PFX(bus, bwlq, type) \ 437 + #define __BUILD_MEMORY_PFX(bus, bwlq, type, relax) \ 438 438 \ 439 - __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1) 439 + __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1, relax, 1) 440 440 441 441 #define BUILDIO_MEM(bwlq, type) \ 442 442 \ 443 - __BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 444 - __BUILD_MEMORY_PFX(, bwlq, type) \ 445 - __BUILD_MEMORY_PFX(__mem_, bwlq, type) \ 443 + __BUILD_MEMORY_PFX(__raw_, bwlq, type, 0) \ 444 + __BUILD_MEMORY_PFX(__relaxed_, bwlq, type, 1) \ 445 + __BUILD_MEMORY_PFX(__mem_, bwlq, type, 0) \ 446 + __BUILD_MEMORY_PFX(, bwlq, type, 0) 446 447 447 448 BUILDIO_MEM(b, u8) 448 449 BUILDIO_MEM(w, u16) ··· 454 447 BUILDIO_MEM(q, u64) 455 448 456 449 #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ 457 - __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \ 458 - __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) 450 + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \ 451 + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p) 459 452 460 453 #define BUILDIO_IOPORT(bwlq, type) \ 461 454 __BUILD_IOPORT_PFX(, bwlq, type) \ ··· 470 463 471 464 #define __BUILDIO(bwlq, type) \ 472 465 \ 473 - __BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0) 466 + __BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 1, 0, 0) 474 467 475 468 __BUILDIO(q, u64) 476 469 477 - #define readb_relaxed readb 478 - #define readw_relaxed readw 479 - #define readl_relaxed readl 480 - #define readq_relaxed readq 470 + #define readb_relaxed __relaxed_readb 471 + #define readw_relaxed __relaxed_readw 472 + #define readl_relaxed __relaxed_readl 473 + #define readq_relaxed __relaxed_readq 481 474 482 - #define writeb_relaxed writeb 483 - #define writew_relaxed writew 484 - #define writel_relaxed writel 485 - #define writeq_relaxed writeq 475 + #define writeb_relaxed __relaxed_writeb 476 + #define writew_relaxed __relaxed_writew 477 + #define writel_relaxed __relaxed_writel 478 + #define writeq_relaxed __relaxed_writeq 486 479 487 480 #define readb_be(addr) \ 488 481 __raw_readb((__force unsigned *)(addr)) ··· 566 559 BUILDSTRING(l, u32) 567 560 #ifdef CONFIG_64BIT 568 561 BUILDSTRING(q, u64) 569 - #endif 570 - 571 - 572 - #ifdef CONFIG_CPU_CAVIUM_OCTEON 573 - #define mmiowb() wmb() 574 - #else 575 - /* Depends on MIPS II instruction set */ 576 - #define mmiowb() asm volatile ("sync" ::: "memory") 577 562 #endif 578 563 579 564 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
+6 -5
arch/mips/include/asm/kexec.h
··· 12 12 #include <asm/stacktrace.h> 13 13 14 14 /* Maximum physical address we can use pages from */ 15 - #define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000) 15 + #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) 16 16 /* Maximum address we can reach in physical address mode */ 17 - #define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000) 17 + #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) 18 18 /* Maximum address we can use for the control code buffer */ 19 - #define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000) 19 + #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) 20 20 /* Reserve 3*4096 bytes for board-specific info */ 21 21 #define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096) 22 22 ··· 39 39 extern int (*_machine_kexec_prepare)(struct kimage *); 40 40 extern void (*_machine_kexec_shutdown)(void); 41 41 extern void (*_machine_crash_shutdown)(struct pt_regs *regs); 42 - extern void default_machine_crash_shutdown(struct pt_regs *regs); 42 + void default_machine_crash_shutdown(struct pt_regs *regs); 43 + void kexec_nonboot_cpu_jump(void); 44 + void kexec_reboot(void); 43 45 #ifdef CONFIG_SMP 44 46 extern const unsigned char kexec_smp_wait[]; 45 47 extern unsigned long secondary_kexec_args[4]; 46 - extern void (*relocated_kexec_smp_wait) (void *); 47 48 extern atomic_t kexec_ready_to_reboot; 48 49 extern void (*_crash_smp_send_stop)(void); 49 50 #endif
+1 -1
arch/mips/include/asm/mach-loongson64/irq.h
··· 10 10 #define MIPS_CPU_IRQ_BASE 56 11 11 12 12 #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ 13 - #define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ 13 + #define LOONGSON_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 3) /* CASCADE */ 14 14 #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ 15 15 16 16 #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base
+12 -4
arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
··· 11 11 #ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H 12 12 #define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H 13 13 14 + #include <asm/cpu.h> 15 + 14 16 /* 15 17 * Override macros used in arch/mips/kernel/head.S. 16 18 */ ··· 28 26 mfc0 t0, CP0_PAGEGRAIN 29 27 or t0, (0x1 << 29) 30 28 mtc0 t0, CP0_PAGEGRAIN 31 - #ifdef CONFIG_LOONGSON3_ENHANCEMENT 32 29 /* Enable STFill Buffer */ 30 + mfc0 t0, CP0_PRID 31 + andi t0, (PRID_IMP_MASK | PRID_REV_MASK) 32 + slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2) 33 + bnez t0, 1f 33 34 mfc0 t0, CP0_CONFIG6 34 35 or t0, 0x100 35 36 mtc0 t0, CP0_CONFIG6 36 - #endif 37 + 1: 37 38 _ehb 38 39 .set pop 39 40 #endif ··· 57 52 mfc0 t0, CP0_PAGEGRAIN 58 53 or t0, (0x1 << 29) 59 54 mtc0 t0, CP0_PAGEGRAIN 60 - #ifdef CONFIG_LOONGSON3_ENHANCEMENT 61 55 /* Enable STFill Buffer */ 56 + mfc0 t0, CP0_PRID 57 + andi t0, (PRID_IMP_MASK | PRID_REV_MASK) 58 + slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2) 59 + bnez t0, 1f 62 60 mfc0 t0, CP0_CONFIG6 63 61 or t0, 0x100 64 62 mtc0 t0, CP0_CONFIG6 65 - #endif 63 + 1: 66 64 _ehb 67 65 .set pop 68 66 #endif
+19 -1
arch/mips/include/asm/mipsregs.h
··· 2287 2287 _write_32bit_cp1_register(dest, val, ) 2288 2288 #endif 2289 2289 2290 - #ifdef HAVE_AS_DSP 2290 + #ifdef TOOLCHAIN_SUPPORTS_DSP 2291 2291 #define rddsp(mask) \ 2292 2292 ({ \ 2293 2293 unsigned int __dspctl; \ 2294 2294 \ 2295 2295 __asm__ __volatile__( \ 2296 2296 " .set push \n" \ 2297 + " .set " MIPS_ISA_LEVEL " \n" \ 2297 2298 " .set dsp \n" \ 2298 2299 " rddsp %0, %x1 \n" \ 2299 2300 " .set pop \n" \ ··· 2307 2306 do { \ 2308 2307 __asm__ __volatile__( \ 2309 2308 " .set push \n" \ 2309 + " .set " MIPS_ISA_LEVEL " \n" \ 2310 2310 " .set dsp \n" \ 2311 2311 " wrdsp %0, %x1 \n" \ 2312 2312 " .set pop \n" \ ··· 2320 2318 long mflo0; \ 2321 2319 __asm__( \ 2322 2320 " .set push \n" \ 2321 + " .set " MIPS_ISA_LEVEL " \n" \ 2323 2322 " .set dsp \n" \ 2324 2323 " mflo %0, $ac0 \n" \ 2325 2324 " .set pop \n" \ ··· 2333 2330 long mflo1; \ 2334 2331 __asm__( \ 2335 2332 " .set push \n" \ 2333 + " .set " MIPS_ISA_LEVEL " \n" \ 2336 2334 " .set dsp \n" \ 2337 2335 " mflo %0, $ac1 \n" \ 2338 2336 " .set pop \n" \ ··· 2346 2342 long mflo2; \ 2347 2343 __asm__( \ 2348 2344 " .set push \n" \ 2345 + " .set " MIPS_ISA_LEVEL " \n" \ 2349 2346 " .set dsp \n" \ 2350 2347 " mflo %0, $ac2 \n" \ 2351 2348 " .set pop \n" \ ··· 2359 2354 long mflo3; \ 2360 2355 __asm__( \ 2361 2356 " .set push \n" \ 2357 + " .set " MIPS_ISA_LEVEL " \n" \ 2362 2358 " .set dsp \n" \ 2363 2359 " mflo %0, $ac3 \n" \ 2364 2360 " .set pop \n" \ ··· 2372 2366 long mfhi0; \ 2373 2367 __asm__( \ 2374 2368 " .set push \n" \ 2369 + " .set " MIPS_ISA_LEVEL " \n" \ 2375 2370 " .set dsp \n" \ 2376 2371 " mfhi %0, $ac0 \n" \ 2377 2372 " .set pop \n" \ ··· 2385 2378 long mfhi1; \ 2386 2379 __asm__( \ 2387 2380 " .set push \n" \ 2381 + " .set " MIPS_ISA_LEVEL " \n" \ 2388 2382 " .set dsp \n" \ 2389 2383 " mfhi %0, $ac1 \n" \ 2390 2384 " .set pop \n" \ ··· 2398 2390 long mfhi2; \ 2399 2391 __asm__( \ 2400 2392 " .set push \n" \ 2393 + " .set " MIPS_ISA_LEVEL " \n" \ 2401 2394 " .set dsp \n" \ 2402 2395 " mfhi %0, $ac2 \n" \ 2403 2396 " .set pop \n" \ ··· 2411 2402 long mfhi3; \ 2412 2403 __asm__( \ 2413 2404 " .set push \n" \ 2405 + " .set " MIPS_ISA_LEVEL " \n" \ 2414 2406 " .set dsp \n" \ 2415 2407 " mfhi %0, $ac3 \n" \ 2416 2408 " .set pop \n" \ ··· 2424 2414 ({ \ 2425 2415 __asm__( \ 2426 2416 " .set push \n" \ 2417 + " .set " MIPS_ISA_LEVEL " \n" \ 2427 2418 " .set dsp \n" \ 2428 2419 " mtlo %0, $ac0 \n" \ 2429 2420 " .set pop \n" \ ··· 2436 2425 ({ \ 2437 2426 __asm__( \ 2438 2427 " .set push \n" \ 2428 + " .set " MIPS_ISA_LEVEL " \n" \ 2439 2429 " .set dsp \n" \ 2440 2430 " mtlo %0, $ac1 \n" \ 2441 2431 " .set pop \n" \ ··· 2448 2436 ({ \ 2449 2437 __asm__( \ 2450 2438 " .set push \n" \ 2439 + " .set " MIPS_ISA_LEVEL " \n" \ 2451 2440 " .set dsp \n" \ 2452 2441 " mtlo %0, $ac2 \n" \ 2453 2442 " .set pop \n" \ ··· 2460 2447 ({ \ 2461 2448 __asm__( \ 2462 2449 " .set push \n" \ 2450 + " .set " MIPS_ISA_LEVEL " \n" \ 2463 2451 " .set dsp \n" \ 2464 2452 " mtlo %0, $ac3 \n" \ 2465 2453 " .set pop \n" \ ··· 2472 2458 ({ \ 2473 2459 __asm__( \ 2474 2460 " .set push \n" \ 2461 + " .set " MIPS_ISA_LEVEL " \n" \ 2475 2462 " .set dsp \n" \ 2476 2463 " mthi %0, $ac0 \n" \ 2477 2464 " .set pop \n" \ ··· 2484 2469 ({ \ 2485 2470 __asm__( \ 2486 2471 " .set push \n" \ 2472 + " .set " MIPS_ISA_LEVEL " \n" \ 2487 2473 " .set dsp \n" \ 2488 2474 " mthi %0, $ac1 \n" \ 2489 2475 " .set pop \n" \ ··· 2496 2480 ({ \ 2497 2481 __asm__( \ 2498 2482 " .set push \n" \ 2483 + " .set " MIPS_ISA_LEVEL " \n" \ 2499 2484 " .set dsp \n" \ 2500 2485 " mthi %0, $ac2 \n" \ 2501 2486 " .set pop \n" \ ··· 2508 2491 ({ \ 2509 2492 __asm__( \ 2510 2493 " .set push \n" \ 2494 + " .set " MIPS_ISA_LEVEL " \n" \ 2511 2495 " .set dsp \n" \ 2512 2496 " mthi %0, $ac3 \n" \ 2513 2497 " .set pop \n" \
-73
arch/mips/include/asm/r4kcache.h
··· 48 48 : \ 49 49 : "i" (op), "R" (*(unsigned char *)(addr))) 50 50 51 - #ifdef CONFIG_MIPS_MT 52 - 53 - #define __iflush_prologue \ 54 - unsigned long redundance; \ 55 - extern int mt_n_iflushes; \ 56 - for (redundance = 0; redundance < mt_n_iflushes; redundance++) { 57 - 58 - #define __iflush_epilogue \ 59 - } 60 - 61 - #define __dflush_prologue \ 62 - unsigned long redundance; \ 63 - extern int mt_n_dflushes; \ 64 - for (redundance = 0; redundance < mt_n_dflushes; redundance++) { 65 - 66 - #define __dflush_epilogue \ 67 - } 68 - 69 - #define __inv_dflush_prologue __dflush_prologue 70 - #define __inv_dflush_epilogue __dflush_epilogue 71 - #define __sflush_prologue { 72 - #define __sflush_epilogue } 73 - #define __inv_sflush_prologue __sflush_prologue 74 - #define __inv_sflush_epilogue __sflush_epilogue 75 - 76 - #else /* CONFIG_MIPS_MT */ 77 - 78 - #define __iflush_prologue { 79 - #define __iflush_epilogue } 80 - #define __dflush_prologue { 81 - #define __dflush_epilogue } 82 - #define __inv_dflush_prologue { 83 - #define __inv_dflush_epilogue } 84 - #define __sflush_prologue { 85 - #define __sflush_epilogue } 86 - #define __inv_sflush_prologue { 87 - #define __inv_sflush_epilogue } 88 - 89 - #endif /* CONFIG_MIPS_MT */ 90 - 91 51 static inline void flush_icache_line_indexed(unsigned long addr) 92 52 { 93 - __iflush_prologue 94 53 cache_op(Index_Invalidate_I, addr); 95 - __iflush_epilogue 96 54 } 97 55 98 56 static inline void flush_dcache_line_indexed(unsigned long addr) 99 57 { 100 - __dflush_prologue 101 58 cache_op(Index_Writeback_Inv_D, addr); 102 - __dflush_epilogue 103 59 } 104 60 105 61 static inline void flush_scache_line_indexed(unsigned long addr) ··· 65 109 66 110 static inline void flush_icache_line(unsigned long addr) 67 111 { 68 - __iflush_prologue 69 112 switch (boot_cpu_type()) { 70 113 case CPU_LOONGSON2: 71 114 cache_op(Hit_Invalidate_I_Loongson2, addr); ··· 74 119 cache_op(Hit_Invalidate_I, addr); 75 120 break; 76 121 } 77 - __iflush_epilogue 78 122 } 79 123 80 124 static inline void flush_dcache_line(unsigned long addr) 81 125 { 82 - __dflush_prologue 83 126 cache_op(Hit_Writeback_Inv_D, addr); 84 - __dflush_epilogue 85 127 } 86 128 87 129 static inline void invalidate_dcache_line(unsigned long addr) 88 130 { 89 - __dflush_prologue 90 131 cache_op(Hit_Invalidate_D, addr); 91 - __dflush_epilogue 92 132 } 93 133 94 134 static inline void invalidate_scache_line(unsigned long addr) ··· 536 586 current_cpu_data.desc.waybit; \ 537 587 unsigned long ws, addr; \ 538 588 \ 539 - __##pfx##flush_prologue \ 540 - \ 541 589 for (ws = 0; ws < ws_end; ws += ws_inc) \ 542 590 for (addr = start; addr < end; addr += lsize * 32) \ 543 591 cache##lsize##_unroll32(addr|ws, indexop); \ 544 - \ 545 - __##pfx##flush_epilogue \ 546 592 } \ 547 593 \ 548 594 static inline void extra##blast_##pfx##cache##lsize##_page(unsigned long page) \ ··· 546 600 unsigned long start = page; \ 547 601 unsigned long end = page + PAGE_SIZE; \ 548 602 \ 549 - __##pfx##flush_prologue \ 550 - \ 551 603 do { \ 552 604 cache##lsize##_unroll32(start, hitop); \ 553 605 start += lsize * 32; \ 554 606 } while (start < end); \ 555 - \ 556 - __##pfx##flush_epilogue \ 557 607 } \ 558 608 \ 559 609 static inline void extra##blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \ ··· 562 620 current_cpu_data.desc.waybit; \ 563 621 unsigned long ws, addr; \ 564 622 \ 565 - __##pfx##flush_prologue \ 566 - \ 567 623 for (ws = 0; ws < ws_end; ws += ws_inc) \ 568 624 for (addr = start; addr < end; addr += lsize * 32) \ 569 625 cache##lsize##_unroll32(addr|ws, indexop); \ 570 - \ 571 - __##pfx##flush_epilogue \ 572 626 } 573 627 574 628 __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16, ) ··· 594 656 unsigned long start = page; \ 595 657 unsigned long end = page + PAGE_SIZE; \ 596 658 \ 597 - __##pfx##flush_prologue \ 598 - \ 599 659 do { \ 600 660 cache##lsize##_unroll32_user(start, hitop); \ 601 661 start += lsize * 32; \ 602 662 } while (start < end); \ 603 - \ 604 - __##pfx##flush_epilogue \ 605 663 } 606 664 607 665 __BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, ··· 619 685 unsigned long addr = start & ~(lsize - 1); \ 620 686 unsigned long aend = (end - 1) & ~(lsize - 1); \ 621 687 \ 622 - __##pfx##flush_prologue \ 623 - \ 624 688 while (1) { \ 625 689 prot##cache_op(hitop, addr); \ 626 690 if (addr == aend) \ 627 691 break; \ 628 692 addr += lsize; \ 629 693 } \ 630 - \ 631 - __##pfx##flush_epilogue \ 632 694 } 633 695 634 696 #ifndef CONFIG_EVA ··· 642 712 unsigned long addr = start & ~(lsize - 1); \ 643 713 unsigned long aend = (end - 1) & ~(lsize - 1); \ 644 714 \ 645 - __##pfx##flush_prologue \ 646 - \ 647 715 if (!uaccess_kernel()) { \ 648 716 while (1) { \ 649 717 protected_cachee_op(hitop, addr); \ ··· 658 730 } \ 659 731 \ 660 732 } \ 661 - __##pfx##flush_epilogue \ 662 733 } 663 734 664 735 __BUILD_PROT_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D)
+3
arch/mips/include/asm/smp-ops.h
··· 33 33 int (*cpu_disable)(void); 34 34 void (*cpu_die)(unsigned int cpu); 35 35 #endif 36 + #ifdef CONFIG_KEXEC 37 + void (*kexec_nonboot_cpu)(void); 38 + #endif 36 39 }; 37 40 38 41 extern void register_smp_ops(const struct plat_smp_ops *ops);
+16
arch/mips/include/asm/smp.h
··· 91 91 extern void play_dead(void); 92 92 #endif 93 93 94 + #ifdef CONFIG_KEXEC 95 + static inline void kexec_nonboot_cpu(void) 96 + { 97 + extern const struct plat_smp_ops *mp_ops; /* private */ 98 + 99 + return mp_ops->kexec_nonboot_cpu(); 100 + } 101 + 102 + static inline void *kexec_nonboot_cpu_func(void) 103 + { 104 + extern const struct plat_smp_ops *mp_ops; /* private */ 105 + 106 + return mp_ops->kexec_nonboot_cpu; 107 + } 108 + #endif 109 + 94 110 /* 95 111 * This function will set up the necessary IPIs for Linux to communicate 96 112 * with the CPUs in mask.
-18
arch/mips/kernel/Makefile
··· 113 113 obj-$(CONFIG_CPU_PM) += pm.o 114 114 obj-$(CONFIG_MIPS_CPS_PM) += pm-cps.o 115 115 116 - # 117 - # DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is not 118 - # safe to unconditionnaly use the assembler -mdsp / -mdspr2 switches 119 - # here because the compiler may use DSP ASE instructions (such as lwx) in 120 - # code paths where we cannot check that the CPU we are running on supports it. 121 - # Proper abstraction using HAVE_AS_DSP and macros is done in 122 - # arch/mips/include/asm/mipsregs.h. 123 - # 124 - ifeq ($(CONFIG_CPU_MIPSR2), y) 125 - CFLAGS_DSP = -DHAVE_AS_DSP 126 - 127 - CFLAGS_signal.o = $(CFLAGS_DSP) 128 - CFLAGS_signal32.o = $(CFLAGS_DSP) 129 - CFLAGS_process.o = $(CFLAGS_DSP) 130 - CFLAGS_branch.o = $(CFLAGS_DSP) 131 - CFLAGS_ptrace.o = $(CFLAGS_DSP) 132 - endif 133 - 134 116 CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
+6 -1
arch/mips/kernel/crash.c
··· 36 36 if (!cpu_online(cpu)) 37 37 return; 38 38 39 + /* We won't be sent IPIs any more. */ 40 + set_cpu_online(cpu, false); 41 + 39 42 local_irq_disable(); 40 43 if (!cpumask_test_cpu(cpu, &cpus_in_crash)) 41 44 crash_save_cpu(regs, cpu); ··· 46 43 47 44 while (!atomic_read(&kexec_ready_to_reboot)) 48 45 cpu_relax(); 49 - relocated_kexec_smp_wait(NULL); 46 + 47 + kexec_reboot(); 48 + 50 49 /* NOTREACHED */ 51 50 } 52 51
+10 -8
arch/mips/kernel/head.S
··· 77 77 */ 78 78 FEXPORT(__kernel_entry) 79 79 j kernel_entry 80 - #endif 80 + #endif /* CONFIG_BOOT_RAW */ 81 81 82 82 __REF 83 83 ··· 94 94 0: 95 95 96 96 #ifdef CONFIG_USE_OF 97 - #ifdef CONFIG_MIPS_RAW_APPENDED_DTB 97 + #if defined(CONFIG_MIPS_RAW_APPENDED_DTB) || \ 98 + defined(CONFIG_MIPS_ELF_APPENDED_DTB) 99 + 98 100 PTR_LA t2, __appended_dtb 99 101 100 102 #ifdef CONFIG_CPU_BIG_ENDIAN 101 103 li t1, 0xd00dfeed 102 - #else 104 + #else /* !CONFIG_CPU_BIG_ENDIAN */ 103 105 li t1, 0xedfe0dd0 104 - #endif 106 + #endif /* !CONFIG_CPU_BIG_ENDIAN */ 105 107 lw t0, (t2) 106 108 beq t0, t1, dtb_found 107 - #endif 109 + #endif /* CONFIG_MIPS_RAW_APPENDED_DTB || CONFIG_MIPS_ELF_APPENDED_DTB */ 108 110 li t1, -2 109 111 move t2, a1 110 112 beq a0, t1, dtb_found 111 113 112 114 li t2, 0 113 115 dtb_found: 114 - #endif 116 + #endif /* CONFIG_USE_OF */ 115 117 PTR_LA t0, __bss_start # clear .bss 116 118 LONG_S zero, (t0) 117 119 PTR_LA t1, __bss_stop - LONGSIZE ··· 158 156 * newly sync'd icache. 159 157 */ 160 158 jr.hb v0 161 - #else 159 + #else /* !CONFIG_RELOCATABLE */ 162 160 j start_kernel 163 - #endif 161 + #endif /* !CONFIG_RELOCATABLE */ 164 162 END(kernel_entry) 165 163 166 164 #ifdef CONFIG_SMP
+136 -7
arch/mips/kernel/machine_kexec.c
··· 9 9 #include <linux/kexec.h> 10 10 #include <linux/mm.h> 11 11 #include <linux/delay.h> 12 + #include <linux/libfdt.h> 12 13 13 14 #include <asm/cacheflush.h> 14 15 #include <asm/page.h> ··· 20 19 extern unsigned long kexec_start_address; 21 20 extern unsigned long kexec_indirection_page; 22 21 23 - int (*_machine_kexec_prepare)(struct kimage *) = NULL; 24 - void (*_machine_kexec_shutdown)(void) = NULL; 25 - void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL; 22 + static unsigned long reboot_code_buffer; 23 + 26 24 #ifdef CONFIG_SMP 27 - void (*relocated_kexec_smp_wait) (void *); 25 + static void (*relocated_kexec_smp_wait)(void *); 26 + 28 27 atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0); 29 28 void (*_crash_smp_send_stop)(void) = NULL; 30 29 #endif 30 + 31 + void (*_machine_kexec_shutdown)(void) = NULL; 32 + void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL; 31 33 32 34 static void kexec_image_info(const struct kimage *kimage) 33 35 { ··· 52 48 } 53 49 } 54 50 51 + #ifdef CONFIG_UHI_BOOT 52 + 53 + static int uhi_machine_kexec_prepare(struct kimage *kimage) 54 + { 55 + int i; 56 + 57 + /* 58 + * In case DTB file is not passed to the new kernel, a flat device 59 + * tree will be created by kexec tool. It holds modified command 60 + * line for the new kernel. 61 + */ 62 + for (i = 0; i < kimage->nr_segments; i++) { 63 + struct fdt_header fdt; 64 + 65 + if (kimage->segment[i].memsz <= sizeof(fdt)) 66 + continue; 67 + 68 + if (copy_from_user(&fdt, kimage->segment[i].buf, sizeof(fdt))) 69 + continue; 70 + 71 + if (fdt_check_header(&fdt)) 72 + continue; 73 + 74 + kexec_args[0] = -2; 75 + kexec_args[1] = (unsigned long) 76 + phys_to_virt((unsigned long)kimage->segment[i].mem); 77 + break; 78 + } 79 + 80 + return 0; 81 + } 82 + 83 + int (*_machine_kexec_prepare)(struct kimage *) = uhi_machine_kexec_prepare; 84 + 85 + #else 86 + 87 + int (*_machine_kexec_prepare)(struct kimage *) = NULL; 88 + 89 + #endif /* CONFIG_UHI_BOOT */ 90 + 55 91 int 56 92 machine_kexec_prepare(struct kimage *kimage) 57 93 { 94 + #ifdef CONFIG_SMP 95 + if (!kexec_nonboot_cpu_func()) 96 + return -EINVAL; 97 + #endif 98 + 58 99 kexec_image_info(kimage); 59 100 60 101 if (_machine_kexec_prepare) 61 102 return _machine_kexec_prepare(kimage); 103 + 62 104 return 0; 63 105 } 64 106 ··· 113 63 { 114 64 } 115 65 66 + #ifdef CONFIG_SMP 67 + static void kexec_shutdown_secondary(void *param) 68 + { 69 + int cpu = smp_processor_id(); 70 + 71 + if (!cpu_online(cpu)) 72 + return; 73 + 74 + /* We won't be sent IPIs any more. */ 75 + set_cpu_online(cpu, false); 76 + 77 + local_irq_disable(); 78 + while (!atomic_read(&kexec_ready_to_reboot)) 79 + cpu_relax(); 80 + 81 + kexec_reboot(); 82 + 83 + /* NOTREACHED */ 84 + } 85 + #endif 86 + 116 87 void 117 88 machine_shutdown(void) 118 89 { 119 90 if (_machine_kexec_shutdown) 120 91 _machine_kexec_shutdown(); 92 + 93 + #ifdef CONFIG_SMP 94 + smp_call_function(kexec_shutdown_secondary, NULL, 0); 95 + 96 + while (num_online_cpus() > 1) { 97 + cpu_relax(); 98 + mdelay(1); 99 + } 100 + #endif 121 101 } 122 102 123 103 void ··· 159 79 default_machine_crash_shutdown(regs); 160 80 } 161 81 162 - typedef void (*noretfun_t)(void) __noreturn; 82 + #ifdef CONFIG_SMP 83 + void kexec_nonboot_cpu_jump(void) 84 + { 85 + local_flush_icache_range((unsigned long)relocated_kexec_smp_wait, 86 + reboot_code_buffer + relocate_new_kernel_size); 87 + 88 + relocated_kexec_smp_wait(NULL); 89 + } 90 + #endif 91 + 92 + void kexec_reboot(void) 93 + { 94 + void (*do_kexec)(void) __noreturn; 95 + 96 + /* 97 + * We know we were online, and there will be no incoming IPIs at 98 + * this point. Mark online again before rebooting so that the crash 99 + * analysis tool will see us correctly. 100 + */ 101 + set_cpu_online(smp_processor_id(), true); 102 + 103 + /* Ensure remote CPUs observe that we're online before rebooting. */ 104 + smp_mb__after_atomic(); 105 + 106 + #ifdef CONFIG_SMP 107 + if (smp_processor_id() > 0) { 108 + /* 109 + * Instead of cpu_relax() or wait, this is needed for kexec 110 + * smp reboot. Kdump usually doesn't require an smp new 111 + * kernel, but kexec may do. 112 + */ 113 + kexec_nonboot_cpu(); 114 + 115 + /* NOTREACHED */ 116 + } 117 + #endif 118 + 119 + /* 120 + * Make sure we get correct instructions written by the 121 + * machine_kexec() CPU. 122 + */ 123 + local_flush_icache_range(reboot_code_buffer, 124 + reboot_code_buffer + relocate_new_kernel_size); 125 + 126 + do_kexec = (void *)reboot_code_buffer; 127 + do_kexec(); 128 + } 163 129 164 130 void 165 131 machine_kexec(struct kimage *image) 166 132 { 167 - unsigned long reboot_code_buffer; 168 133 unsigned long entry; 169 134 unsigned long *ptr; 170 135 ··· 243 118 *ptr = (unsigned long) phys_to_virt(*ptr); 244 119 } 245 120 121 + /* Mark offline BEFORE disabling local irq. */ 122 + set_cpu_online(smp_processor_id(), false); 123 + 246 124 /* 247 125 * we do not want to be bothered. 248 126 */ ··· 253 125 254 126 printk("Will call new kernel at %08lx\n", image->start); 255 127 printk("Bye ...\n"); 128 + /* Make reboot code buffer available to the boot CPU. */ 256 129 __flush_cache_all(); 257 130 #ifdef CONFIG_SMP 258 131 /* All secondary cpus now may jump to kexec_wait cycle */ ··· 262 133 smp_wmb(); 263 134 atomic_set(&kexec_ready_to_reboot, 1); 264 135 #endif 265 - ((noretfun_t) reboot_code_buffer)(); 136 + kexec_reboot(); 266 137 }
-59
arch/mips/kernel/mips-mt.c
··· 154 154 } 155 155 __setup("config7=", config7_set); 156 156 157 - /* Experimental cache flush control parameters that should go away some day */ 158 - int mt_protiflush; 159 - int mt_protdflush; 160 - int mt_n_iflushes = 1; 161 - int mt_n_dflushes = 1; 162 - 163 - static int __init set_protiflush(char *s) 164 - { 165 - mt_protiflush = 1; 166 - return 1; 167 - } 168 - __setup("protiflush", set_protiflush); 169 - 170 - static int __init set_protdflush(char *s) 171 - { 172 - mt_protdflush = 1; 173 - return 1; 174 - } 175 - __setup("protdflush", set_protdflush); 176 - 177 - static int __init niflush(char *s) 178 - { 179 - get_option(&s, &mt_n_iflushes); 180 - return 1; 181 - } 182 - __setup("niflush=", niflush); 183 - 184 - static int __init ndflush(char *s) 185 - { 186 - get_option(&s, &mt_n_dflushes); 187 - return 1; 188 - } 189 - __setup("ndflush=", ndflush); 190 - 191 157 static unsigned int itc_base; 192 158 193 159 static int __init set_itc_base(char *str) ··· 198 232 printk("Config7: 0x%08x\n", read_c0_config7()); 199 233 } 200 234 201 - /* Report Cache management debug options */ 202 - if (mt_protiflush) 203 - printk("I-cache flushes single-threaded\n"); 204 - if (mt_protdflush) 205 - printk("D-cache flushes single-threaded\n"); 206 - if (mt_n_iflushes != 1) 207 - printk("I-Cache Flushes Repeated %d times\n", mt_n_iflushes); 208 - if (mt_n_dflushes != 1) 209 - printk("D-Cache Flushes Repeated %d times\n", mt_n_dflushes); 210 - 211 235 if (itc_base != 0) { 212 236 /* 213 237 * Configure ITC mapping. This code is very ··· 237 281 printk("Mapped %ld ITC cells starting at 0x%08x\n", 238 282 ((itcblkgrn & 0x7fe00000) >> 20), itc_base); 239 283 } 240 - } 241 - 242 - /* 243 - * Function to protect cache flushes from concurrent execution 244 - * depends on MP software model chosen. 245 - */ 246 - 247 - void mt_cflush_lockdown(void) 248 - { 249 - /* FILL IN VSMP and AP/SP VERSIONS HERE */ 250 - } 251 - 252 - void mt_cflush_release(void) 253 - { 254 - /* FILL IN VSMP and AP/SP VERSIONS HERE */ 255 284 } 256 285 257 286 struct class *mt_class;
+1 -1
arch/mips/kernel/relocate.c
··· 146 146 break; 147 147 148 148 type = (*r >> 24) & 0xff; 149 - loc_orig = (void *)(kbase_old + ((*r & 0x00ffffff) << 2)); 149 + loc_orig = kbase_old + ((*r & 0x00ffffff) << 2); 150 150 loc_new = RELOCATED(loc_orig); 151 151 152 152 if (reloc_handlers_rel[type] == NULL) {
+45 -99
arch/mips/kernel/setup.c
··· 333 333 334 334 maybe_bswap_initrd(); 335 335 336 - reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT); 336 + memblock_reserve(__pa(initrd_start), size); 337 337 initrd_below_start_ok = 1; 338 338 339 339 pr_info("Initial ramdisk at: 0x%lx (%lu bytes)\n", ··· 370 370 371 371 #else /* !CONFIG_SGI_IP27 */ 372 372 373 - static unsigned long __init bootmap_bytes(unsigned long pages) 374 - { 375 - unsigned long bytes = DIV_ROUND_UP(pages, 8); 376 - 377 - return ALIGN(bytes, sizeof(long)); 378 - } 379 - 380 373 static void __init bootmem_init(void) 381 374 { 382 375 unsigned long reserved_end; 383 - unsigned long mapstart = ~0UL; 384 - unsigned long bootmap_size; 385 376 phys_addr_t ramstart = PHYS_ADDR_MAX; 386 - bool bootmap_valid = false; 387 377 int i; 388 378 389 379 /* ··· 384 394 */ 385 395 init_initrd(); 386 396 reserved_end = (unsigned long) PFN_UP(__pa_symbol(&_end)); 397 + 398 + memblock_reserve(PHYS_OFFSET, reserved_end << PAGE_SHIFT); 387 399 388 400 /* 389 401 * max_low_pfn is not a number of pages. The number of pages ··· 434 442 if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end))) 435 443 continue; 436 444 #endif 437 - if (start >= mapstart) 438 - continue; 439 - mapstart = max(reserved_end, start); 440 445 } 441 446 442 447 if (min_low_pfn >= max_low_pfn) ··· 445 456 /* 446 457 * Reserve any memory between the start of RAM and PHYS_OFFSET 447 458 */ 448 - if (ramstart > PHYS_OFFSET) 459 + if (ramstart > PHYS_OFFSET) { 449 460 add_memory_region(PHYS_OFFSET, ramstart - PHYS_OFFSET, 450 461 BOOT_MEM_RESERVED); 462 + memblock_reserve(PHYS_OFFSET, ramstart - PHYS_OFFSET); 463 + } 451 464 452 465 if (min_low_pfn > ARCH_PFN_OFFSET) { 453 466 pr_info("Wasting %lu bytes for tracking %lu unused pages\n", ··· 473 482 #endif 474 483 max_low_pfn = PFN_DOWN(HIGHMEM_START); 475 484 } 476 - 477 - #ifdef CONFIG_BLK_DEV_INITRD 478 - /* 479 - * mapstart should be after initrd_end 480 - */ 481 - if (initrd_end) 482 - mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end))); 483 - #endif 484 - 485 - /* 486 - * check that mapstart doesn't overlap with any of 487 - * memory regions that have been reserved through eg. DTB 488 - */ 489 - bootmap_size = bootmap_bytes(max_low_pfn - min_low_pfn); 490 - 491 - bootmap_valid = memory_region_available(PFN_PHYS(mapstart), 492 - bootmap_size); 493 - for (i = 0; i < boot_mem_map.nr_map && !bootmap_valid; i++) { 494 - unsigned long mapstart_addr; 495 - 496 - switch (boot_mem_map.map[i].type) { 497 - case BOOT_MEM_RESERVED: 498 - mapstart_addr = PFN_ALIGN(boot_mem_map.map[i].addr + 499 - boot_mem_map.map[i].size); 500 - if (PHYS_PFN(mapstart_addr) < mapstart) 501 - break; 502 - 503 - bootmap_valid = memory_region_available(mapstart_addr, 504 - bootmap_size); 505 - if (bootmap_valid) 506 - mapstart = PHYS_PFN(mapstart_addr); 507 - break; 508 - default: 509 - break; 510 - } 511 - } 512 - 513 - if (!bootmap_valid) 514 - panic("No memory area to place a bootmap bitmap"); 515 - 516 - /* 517 - * Initialize the boot-time allocator with low memory only. 518 - */ 519 - if (bootmap_size != init_bootmem_node(NODE_DATA(0), mapstart, 520 - min_low_pfn, max_low_pfn)) 521 - panic("Unexpected memory size required for bootmap"); 522 485 523 486 for (i = 0; i < boot_mem_map.nr_map; i++) { 524 487 unsigned long start, end; ··· 522 577 default: 523 578 /* Not usable memory */ 524 579 if (start > min_low_pfn && end < max_low_pfn) 525 - reserve_bootmem(boot_mem_map.map[i].addr, 526 - boot_mem_map.map[i].size, 527 - BOOTMEM_DEFAULT); 580 + memblock_reserve(boot_mem_map.map[i].addr, 581 + boot_mem_map.map[i].size); 582 + 528 583 continue; 529 584 } 530 585 ··· 547 602 size = end - start; 548 603 549 604 /* Register lowmem ranges */ 550 - free_bootmem(PFN_PHYS(start), size << PAGE_SHIFT); 551 605 memory_present(0, start, end); 552 606 } 553 - 554 - /* 555 - * Reserve the bootmap memory. 556 - */ 557 - reserve_bootmem(PFN_PHYS(mapstart), bootmap_size, BOOTMEM_DEFAULT); 558 607 559 608 #ifdef CONFIG_RELOCATABLE 560 609 /* ··· 580 641 } 581 642 582 643 #endif /* CONFIG_SGI_IP27 */ 583 - 584 - /* 585 - * arch_mem_init - initialize memory management subsystem 586 - * 587 - * o plat_mem_setup() detects the memory configuration and will record detected 588 - * memory areas using add_memory_region. 589 - * 590 - * At this stage the memory configuration of the system is known to the 591 - * kernel but generic memory management system is still entirely uninitialized. 592 - * 593 - * o bootmem_init() 594 - * o sparse_init() 595 - * o paging_init() 596 - * o dma_contiguous_reserve() 597 - * 598 - * At this stage the bootmem allocator is ready to use. 599 - * 600 - * NOTE: historically plat_mem_setup did the entire platform initialization. 601 - * This was rather impractical because it meant plat_mem_setup had to 602 - * get away without any kind of memory allocator. To keep old code from 603 - * breaking plat_setup was just renamed to plat_mem_setup and a second platform 604 - * initialization hook for anything else was introduced. 605 - */ 606 644 607 645 static int usermem __initdata; 608 646 ··· 757 841 #define BUILTIN_EXTEND_WITH_PROM \ 758 842 IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND) 759 843 844 + /* 845 + * arch_mem_init - initialize memory management subsystem 846 + * 847 + * o plat_mem_setup() detects the memory configuration and will record detected 848 + * memory areas using add_memory_region. 849 + * 850 + * At this stage the memory configuration of the system is known to the 851 + * kernel but generic memory management system is still entirely uninitialized. 852 + * 853 + * o bootmem_init() 854 + * o sparse_init() 855 + * o paging_init() 856 + * o dma_contiguous_reserve() 857 + * 858 + * At this stage the bootmem allocator is ready to use. 859 + * 860 + * NOTE: historically plat_mem_setup did the entire platform initialization. 861 + * This was rather impractical because it meant plat_mem_setup had to 862 + * get away without any kind of memory allocator. To keep old code from 863 + * breaking plat_setup was just renamed to plat_mem_setup and a second platform 864 + * initialization hook for anything else was introduced. 865 + */ 760 866 static void __init arch_mem_init(char **cmdline_p) 761 867 { 762 868 struct memblock_region *reg; ··· 854 916 early_init_fdt_scan_reserved_mem(); 855 917 856 918 bootmem_init(); 919 + 920 + /* 921 + * Prevent memblock from allocating high memory. 922 + * This cannot be done before max_low_pfn is detected, so up 923 + * to this point is possible to only reserve physical memory 924 + * with memblock_reserve; memblock_virt_alloc* can be used 925 + * only after this point 926 + */ 927 + memblock_set_current_limit(PFN_PHYS(max_low_pfn)); 928 + 857 929 #ifdef CONFIG_PROC_VMCORE 858 930 if (setup_elfcorehdr && setup_elfcorehdr_size) { 859 931 printk(KERN_INFO "kdump reserved memory at %lx-%lx\n", 860 932 setup_elfcorehdr, setup_elfcorehdr_size); 861 - reserve_bootmem(setup_elfcorehdr, setup_elfcorehdr_size, 862 - BOOTMEM_DEFAULT); 933 + memblock_reserve(setup_elfcorehdr, setup_elfcorehdr_size); 863 934 } 864 935 #endif 865 936 866 937 mips_parse_crashkernel(); 867 938 #ifdef CONFIG_KEXEC 868 939 if (crashk_res.start != crashk_res.end) 869 - reserve_bootmem(crashk_res.start, 870 - crashk_res.end - crashk_res.start + 1, 871 - BOOTMEM_DEFAULT); 940 + memblock_reserve(crashk_res.start, 941 + crashk_res.end - crashk_res.start + 1); 872 942 #endif 873 943 device_tree_init(); 874 944 sparse_init(); ··· 886 940 /* Tell bootmem about cma reserved memblock section */ 887 941 for_each_memblock(reserved, reg) 888 942 if (reg->size != 0) 889 - reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); 943 + memblock_reserve(reg->base, reg->size); 890 944 891 945 reserve_bootmem_region(__pa_symbol(&__nosave_begin), 892 946 __pa_symbol(&__nosave_end)); /* Reserve for hibernation */
+7
arch/mips/kernel/smp-bmips.c
··· 25 25 #include <linux/linkage.h> 26 26 #include <linux/bug.h> 27 27 #include <linux/kernel.h> 28 + #include <linux/kexec.h> 28 29 29 30 #include <asm/time.h> 30 31 #include <asm/pgtable.h> ··· 424 423 .cpu_disable = bmips_cpu_disable, 425 424 .cpu_die = bmips_cpu_die, 426 425 #endif 426 + #ifdef CONFIG_KEXEC 427 + .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 428 + #endif 427 429 }; 428 430 429 431 const struct plat_smp_ops bmips5000_smp_ops = { ··· 440 436 #ifdef CONFIG_HOTPLUG_CPU 441 437 .cpu_disable = bmips_cpu_disable, 442 438 .cpu_die = bmips_cpu_die, 439 + #endif 440 + #ifdef CONFIG_KEXEC 441 + .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 443 442 #endif 444 443 }; 445 444
+55 -25
arch/mips/kernel/smp-cps.c
··· 398 398 local_irq_enable(); 399 399 } 400 400 401 + #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC) 402 + 403 + enum cpu_death { 404 + CPU_DEATH_HALT, 405 + CPU_DEATH_POWER, 406 + }; 407 + 408 + static void cps_shutdown_this_cpu(enum cpu_death death) 409 + { 410 + unsigned int cpu, core, vpe_id; 411 + 412 + cpu = smp_processor_id(); 413 + core = cpu_core(&cpu_data[cpu]); 414 + 415 + if (death == CPU_DEATH_HALT) { 416 + vpe_id = cpu_vpe_id(&cpu_data[cpu]); 417 + 418 + pr_debug("Halting core %d VP%d\n", core, vpe_id); 419 + if (cpu_has_mipsmt) { 420 + /* Halt this TC */ 421 + write_c0_tchalt(TCHALT_H); 422 + instruction_hazard(); 423 + } else if (cpu_has_vp) { 424 + write_cpc_cl_vp_stop(1 << vpe_id); 425 + 426 + /* Ensure that the VP_STOP register is written */ 427 + wmb(); 428 + } 429 + } else { 430 + pr_debug("Gating power to core %d\n", core); 431 + /* Power down the core */ 432 + cps_pm_enter_state(CPS_PM_POWER_GATED); 433 + } 434 + } 435 + 436 + #ifdef CONFIG_KEXEC 437 + 438 + static void cps_kexec_nonboot_cpu(void) 439 + { 440 + if (cpu_has_mipsmt || cpu_has_vp) 441 + cps_shutdown_this_cpu(CPU_DEATH_HALT); 442 + else 443 + cps_shutdown_this_cpu(CPU_DEATH_POWER); 444 + } 445 + 446 + #endif /* CONFIG_KEXEC */ 447 + 448 + #endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC */ 449 + 401 450 #ifdef CONFIG_HOTPLUG_CPU 402 451 403 452 static int cps_cpu_disable(void) ··· 470 421 } 471 422 472 423 static unsigned cpu_death_sibling; 473 - static enum { 474 - CPU_DEATH_HALT, 475 - CPU_DEATH_POWER, 476 - } cpu_death; 424 + static enum cpu_death cpu_death; 477 425 478 426 void play_dead(void) 479 427 { 480 - unsigned int cpu, core, vpe_id; 428 + unsigned int cpu; 481 429 482 430 local_irq_disable(); 483 431 idle_task_exit(); 484 432 cpu = smp_processor_id(); 485 - core = cpu_core(&cpu_data[cpu]); 486 433 cpu_death = CPU_DEATH_POWER; 487 434 488 435 pr_debug("CPU%d going offline\n", cpu); ··· 501 456 /* This CPU has chosen its way out */ 502 457 (void)cpu_report_death(); 503 458 504 - if (cpu_death == CPU_DEATH_HALT) { 505 - vpe_id = cpu_vpe_id(&cpu_data[cpu]); 506 - 507 - pr_debug("Halting core %d VP%d\n", core, vpe_id); 508 - if (cpu_has_mipsmt) { 509 - /* Halt this TC */ 510 - write_c0_tchalt(TCHALT_H); 511 - instruction_hazard(); 512 - } else if (cpu_has_vp) { 513 - write_cpc_cl_vp_stop(1 << vpe_id); 514 - 515 - /* Ensure that the VP_STOP register is written */ 516 - wmb(); 517 - } 518 - } else { 519 - pr_debug("Gating power to core %d\n", core); 520 - /* Power down the core */ 521 - cps_pm_enter_state(CPS_PM_POWER_GATED); 522 - } 459 + cps_shutdown_this_cpu(cpu_death); 523 460 524 461 /* This should never be reached */ 525 462 panic("Failed to offline CPU %u", cpu); ··· 619 592 #ifdef CONFIG_HOTPLUG_CPU 620 593 .cpu_disable = cps_cpu_disable, 621 594 .cpu_die = cps_cpu_die, 595 + #endif 596 + #ifdef CONFIG_KEXEC 597 + .kexec_nonboot_cpu = cps_kexec_nonboot_cpu, 622 598 #endif 623 599 }; 624 600
+4 -1
arch/mips/kernel/traps.c
··· 29 29 #include <linux/spinlock.h> 30 30 #include <linux/kallsyms.h> 31 31 #include <linux/bootmem.h> 32 + #include <linux/memblock.h> 32 33 #include <linux/interrupt.h> 33 34 #include <linux/ptrace.h> 34 35 #include <linux/kgdb.h> ··· 349 348 */ 350 349 void show_regs(struct pt_regs *regs) 351 350 { 352 - __show_regs((struct pt_regs *)regs); 351 + __show_regs(regs); 353 352 dump_stack(); 354 353 } 355 354 ··· 2261 2260 unsigned long size = 0x200 + VECTORSPACING*64; 2262 2261 phys_addr_t ebase_pa; 2263 2262 2263 + memblock_set_bottom_up(true); 2264 2264 ebase = (unsigned long) 2265 2265 __alloc_bootmem(size, 1 << fls(size), 0); 2266 + memblock_set_bottom_up(false); 2266 2267 2267 2268 /* 2268 2269 * Try to ensure ebase resides in KSeg0 if possible.
+23 -24
arch/mips/kernel/unaligned.c
··· 130 130 : "r" (addr), "i" (-EFAULT)); \ 131 131 } while(0) 132 132 133 - #ifndef CONFIG_CPU_MIPSR6 133 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 134 134 #define _LoadW(addr, value, res, type) \ 135 135 do { \ 136 136 __asm__ __volatile__ ( \ ··· 151 151 : "r" (addr), "i" (-EFAULT)); \ 152 152 } while(0) 153 153 154 - #else 155 - /* MIPSR6 has no lwl instruction */ 154 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 155 + /* For CPUs without lwl instruction */ 156 156 #define _LoadW(addr, value, res, type) \ 157 157 do { \ 158 158 __asm__ __volatile__ ( \ ··· 186 186 : "r" (addr), "i" (-EFAULT)); \ 187 187 } while(0) 188 188 189 - #endif /* CONFIG_CPU_MIPSR6 */ 189 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 190 190 191 191 #define _LoadHWU(addr, value, res, type) \ 192 192 do { \ ··· 212 212 : "r" (addr), "i" (-EFAULT)); \ 213 213 } while(0) 214 214 215 - #ifndef CONFIG_CPU_MIPSR6 215 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 216 216 #define _LoadWU(addr, value, res, type) \ 217 217 do { \ 218 218 __asm__ __volatile__ ( \ ··· 255 255 : "r" (addr), "i" (-EFAULT)); \ 256 256 } while(0) 257 257 258 - #else 259 - /* MIPSR6 has not lwl and ldl instructions */ 258 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 259 + /* For CPUs without lwl and ldl instructions */ 260 260 #define _LoadWU(addr, value, res, type) \ 261 261 do { \ 262 262 __asm__ __volatile__ ( \ ··· 339 339 : "r" (addr), "i" (-EFAULT)); \ 340 340 } while(0) 341 341 342 - #endif /* CONFIG_CPU_MIPSR6 */ 342 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 343 343 344 344 345 345 #define _StoreHW(addr, value, res, type) \ ··· 365 365 : "r" (value), "r" (addr), "i" (-EFAULT));\ 366 366 } while(0) 367 367 368 - #ifndef CONFIG_CPU_MIPSR6 368 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 369 369 #define _StoreW(addr, value, res, type) \ 370 370 do { \ 371 371 __asm__ __volatile__ ( \ ··· 406 406 : "r" (value), "r" (addr), "i" (-EFAULT)); \ 407 407 } while(0) 408 408 409 - #else 410 - /* MIPSR6 has no swl and sdl instructions */ 409 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 411 410 #define _StoreW(addr, value, res, type) \ 412 411 do { \ 413 412 __asm__ __volatile__ ( \ ··· 482 483 : "memory"); \ 483 484 } while(0) 484 485 485 - #endif /* CONFIG_CPU_MIPSR6 */ 486 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 486 487 487 488 #else /* __BIG_ENDIAN */ 488 489 ··· 508 509 : "r" (addr), "i" (-EFAULT)); \ 509 510 } while(0) 510 511 511 - #ifndef CONFIG_CPU_MIPSR6 512 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 512 513 #define _LoadW(addr, value, res, type) \ 513 514 do { \ 514 515 __asm__ __volatile__ ( \ ··· 529 530 : "r" (addr), "i" (-EFAULT)); \ 530 531 } while(0) 531 532 532 - #else 533 - /* MIPSR6 has no lwl instruction */ 533 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 534 + /* For CPUs without lwl instruction */ 534 535 #define _LoadW(addr, value, res, type) \ 535 536 do { \ 536 537 __asm__ __volatile__ ( \ ··· 564 565 : "r" (addr), "i" (-EFAULT)); \ 565 566 } while(0) 566 567 567 - #endif /* CONFIG_CPU_MIPSR6 */ 568 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 568 569 569 570 570 571 #define _LoadHWU(addr, value, res, type) \ ··· 591 592 : "r" (addr), "i" (-EFAULT)); \ 592 593 } while(0) 593 594 594 - #ifndef CONFIG_CPU_MIPSR6 595 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 595 596 #define _LoadWU(addr, value, res, type) \ 596 597 do { \ 597 598 __asm__ __volatile__ ( \ ··· 634 635 : "r" (addr), "i" (-EFAULT)); \ 635 636 } while(0) 636 637 637 - #else 638 - /* MIPSR6 has not lwl and ldl instructions */ 638 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 639 + /* For CPUs without lwl and ldl instructions */ 639 640 #define _LoadWU(addr, value, res, type) \ 640 641 do { \ 641 642 __asm__ __volatile__ ( \ ··· 717 718 : "=&r" (value), "=r" (res) \ 718 719 : "r" (addr), "i" (-EFAULT)); \ 719 720 } while(0) 720 - #endif /* CONFIG_CPU_MIPSR6 */ 721 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 721 722 722 723 #define _StoreHW(addr, value, res, type) \ 723 724 do { \ ··· 742 743 : "r" (value), "r" (addr), "i" (-EFAULT));\ 743 744 } while(0) 744 745 745 - #ifndef CONFIG_CPU_MIPSR6 746 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 746 747 #define _StoreW(addr, value, res, type) \ 747 748 do { \ 748 749 __asm__ __volatile__ ( \ ··· 783 784 : "r" (value), "r" (addr), "i" (-EFAULT)); \ 784 785 } while(0) 785 786 786 - #else 787 - /* MIPSR6 has no swl and sdl instructions */ 787 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 788 + /* For CPUs without swl and sdl instructions */ 788 789 #define _StoreW(addr, value, res, type) \ 789 790 do { \ 790 791 __asm__ __volatile__ ( \ ··· 860 861 : "memory"); \ 861 862 } while(0) 862 863 863 - #endif /* CONFIG_CPU_MIPSR6 */ 864 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 864 865 #endif 865 866 866 867 #define LoadHWU(addr, value, res) _LoadHWU(addr, value, res, kernel)
+1 -1
arch/mips/lib/Makefile
··· 7 7 mips-atomic.o strncpy_user.o \ 8 8 strnlen_user.o uncached.o 9 9 10 - obj-y += iomap.o iomap_copy.o 10 + obj-y += iomap_copy.o 11 11 obj-$(CONFIG_PCI) += iomap-pci.o 12 12 lib-$(CONFIG_GENERIC_CSUM) := $(filter-out csum_partial.o, $(lib-y)) 13 13
-7
arch/mips/lib/iomap-pci.c
··· 44 44 } 45 45 46 46 #endif /* CONFIG_PCI_DRIVERS_LEGACY */ 47 - 48 - void pci_iounmap(struct pci_dev *dev, void __iomem * addr) 49 - { 50 - iounmap(addr); 51 - } 52 - 53 - EXPORT_SYMBOL(pci_iounmap);
-227
arch/mips/lib/iomap.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Implement the default iomap interfaces 4 - * 5 - * (C) Copyright 2004 Linus Torvalds 6 - * (C) Copyright 2006 Ralf Baechle <ralf@linux-mips.org> 7 - * (C) Copyright 2007 MIPS Technologies, Inc. 8 - * written by Ralf Baechle <ralf@linux-mips.org> 9 - */ 10 - #include <linux/export.h> 11 - #include <asm/io.h> 12 - 13 - /* 14 - * Read/write from/to an (offsettable) iomem cookie. It might be a PIO 15 - * access or a MMIO access, these functions don't care. The info is 16 - * encoded in the hardware mapping set up by the mapping functions 17 - * (or the cookie itself, depending on implementation and hw). 18 - * 19 - * The generic routines don't assume any hardware mappings, and just 20 - * encode the PIO/MMIO as part of the cookie. They coldly assume that 21 - * the MMIO IO mappings are not in the low address range. 22 - * 23 - * Architectures for which this is not true can't use this generic 24 - * implementation and should do their own copy. 25 - */ 26 - 27 - #define PIO_MASK 0x0ffffUL 28 - 29 - unsigned int ioread8(void __iomem *addr) 30 - { 31 - return readb(addr); 32 - } 33 - 34 - EXPORT_SYMBOL(ioread8); 35 - 36 - unsigned int ioread16(void __iomem *addr) 37 - { 38 - return readw(addr); 39 - } 40 - 41 - EXPORT_SYMBOL(ioread16); 42 - 43 - unsigned int ioread16be(void __iomem *addr) 44 - { 45 - return be16_to_cpu(__raw_readw(addr)); 46 - } 47 - 48 - EXPORT_SYMBOL(ioread16be); 49 - 50 - unsigned int ioread32(void __iomem *addr) 51 - { 52 - return readl(addr); 53 - } 54 - 55 - EXPORT_SYMBOL(ioread32); 56 - 57 - unsigned int ioread32be(void __iomem *addr) 58 - { 59 - return be32_to_cpu(__raw_readl(addr)); 60 - } 61 - 62 - EXPORT_SYMBOL(ioread32be); 63 - 64 - void iowrite8(u8 val, void __iomem *addr) 65 - { 66 - writeb(val, addr); 67 - } 68 - 69 - EXPORT_SYMBOL(iowrite8); 70 - 71 - void iowrite16(u16 val, void __iomem *addr) 72 - { 73 - writew(val, addr); 74 - } 75 - 76 - EXPORT_SYMBOL(iowrite16); 77 - 78 - void iowrite16be(u16 val, void __iomem *addr) 79 - { 80 - __raw_writew(cpu_to_be16(val), addr); 81 - } 82 - 83 - EXPORT_SYMBOL(iowrite16be); 84 - 85 - void iowrite32(u32 val, void __iomem *addr) 86 - { 87 - writel(val, addr); 88 - } 89 - 90 - EXPORT_SYMBOL(iowrite32); 91 - 92 - void iowrite32be(u32 val, void __iomem *addr) 93 - { 94 - __raw_writel(cpu_to_be32(val), addr); 95 - } 96 - 97 - EXPORT_SYMBOL(iowrite32be); 98 - 99 - /* 100 - * These are the "repeat MMIO read/write" functions. 101 - * Note the "__mem" accesses, since we want to convert 102 - * to CPU byte order if the host bus happens to not match the 103 - * endianness of PCI/ISA (see mach-generic/mangle-port.h). 104 - */ 105 - static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) 106 - { 107 - while (--count >= 0) { 108 - u8 data = __mem_readb(addr); 109 - *dst = data; 110 - dst++; 111 - } 112 - } 113 - 114 - static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) 115 - { 116 - while (--count >= 0) { 117 - u16 data = __mem_readw(addr); 118 - *dst = data; 119 - dst++; 120 - } 121 - } 122 - 123 - static inline void mmio_insl(void __iomem *addr, u32 *dst, int count) 124 - { 125 - while (--count >= 0) { 126 - u32 data = __mem_readl(addr); 127 - *dst = data; 128 - dst++; 129 - } 130 - } 131 - 132 - static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count) 133 - { 134 - while (--count >= 0) { 135 - __mem_writeb(*src, addr); 136 - src++; 137 - } 138 - } 139 - 140 - static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count) 141 - { 142 - while (--count >= 0) { 143 - __mem_writew(*src, addr); 144 - src++; 145 - } 146 - } 147 - 148 - static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) 149 - { 150 - while (--count >= 0) { 151 - __mem_writel(*src, addr); 152 - src++; 153 - } 154 - } 155 - 156 - void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 157 - { 158 - mmio_insb(addr, dst, count); 159 - } 160 - 161 - EXPORT_SYMBOL(ioread8_rep); 162 - 163 - void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 164 - { 165 - mmio_insw(addr, dst, count); 166 - } 167 - 168 - EXPORT_SYMBOL(ioread16_rep); 169 - 170 - void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 171 - { 172 - mmio_insl(addr, dst, count); 173 - } 174 - 175 - EXPORT_SYMBOL(ioread32_rep); 176 - 177 - void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) 178 - { 179 - mmio_outsb(addr, src, count); 180 - } 181 - 182 - EXPORT_SYMBOL(iowrite8_rep); 183 - 184 - void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) 185 - { 186 - mmio_outsw(addr, src, count); 187 - } 188 - 189 - EXPORT_SYMBOL(iowrite16_rep); 190 - 191 - void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) 192 - { 193 - mmio_outsl(addr, src, count); 194 - } 195 - 196 - EXPORT_SYMBOL(iowrite32_rep); 197 - 198 - /* 199 - * Create a virtual mapping cookie for an IO port range 200 - * 201 - * This uses the same mapping are as the in/out family which has to be setup 202 - * by the platform initialization code. 203 - * 204 - * Just to make matters somewhat more interesting on MIPS systems with 205 - * multiple host bridge each will have it's own ioport address space. 206 - */ 207 - static void __iomem *ioport_map_legacy(unsigned long port, unsigned int nr) 208 - { 209 - return (void __iomem *) (mips_io_port_base + port); 210 - } 211 - 212 - void __iomem *ioport_map(unsigned long port, unsigned int nr) 213 - { 214 - if (port > PIO_MASK) 215 - return NULL; 216 - 217 - return ioport_map_legacy(port, nr); 218 - } 219 - 220 - EXPORT_SYMBOL(ioport_map); 221 - 222 - void ioport_unmap(void __iomem *addr) 223 - { 224 - /* Nothing to do */ 225 - } 226 - 227 - EXPORT_SYMBOL(ioport_unmap);
+13 -9
arch/mips/lib/memcpy.S
··· 204 204 #define LOADB(reg, addr, handler) EXC(lb, LD_INSN, reg, addr, handler) 205 205 #define STOREB(reg, addr, handler) EXC(sb, ST_INSN, reg, addr, handler) 206 206 207 - #define _PREF(hint, addr, type) \ 207 + #ifdef CONFIG_CPU_HAS_PREFETCH 208 + # define _PREF(hint, addr, type) \ 208 209 .if \mode == LEGACY_MODE; \ 209 - PREF(hint, addr); \ 210 + kernel_pref(hint, addr); \ 210 211 .else; \ 211 212 .if ((\from == USEROP) && (type == SRC_PREFETCH)) || \ 212 213 ((\to == USEROP) && (type == DST_PREFETCH)); \ ··· 219 218 * used later on. Therefore use $v1. \ 220 219 */ \ 221 220 .set at=v1; \ 222 - PREFE(hint, addr); \ 221 + user_pref(hint, addr); \ 223 222 .set noat; \ 224 223 .else; \ 225 - PREF(hint, addr); \ 224 + kernel_pref(hint, addr); \ 226 225 .endif; \ 227 226 .endif 227 + #else 228 + # define _PREF(hint, addr, type) 229 + #endif 228 230 229 231 #define PREFS(hint, addr) _PREF(hint, addr, SRC_PREFETCH) 230 232 #define PREFD(hint, addr) _PREF(hint, addr, DST_PREFETCH) ··· 301 297 and t0, src, ADDRMASK 302 298 PREFS( 0, 2*32(src) ) 303 299 PREFD( 1, 2*32(dst) ) 304 - #ifndef CONFIG_CPU_MIPSR6 300 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 305 301 bnez t1, .Ldst_unaligned\@ 306 302 nop 307 303 bnez t0, .Lsrc_unaligned_dst_aligned\@ ··· 389 385 bne rem, len, 1b 390 386 .set noreorder 391 387 392 - #ifndef CONFIG_CPU_MIPSR6 388 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 393 389 /* 394 390 * src and dst are aligned, need to copy rem bytes (rem < NBYTES) 395 391 * A loop would do only a byte at a time with possible branch ··· 491 487 bne len, rem, 1b 492 488 .set noreorder 493 489 494 - #endif /* !CONFIG_CPU_MIPSR6 */ 490 + #endif /* CONFIG_CPU_HAS_LOAD_STORE_LR */ 495 491 .Lcopy_bytes_checklen\@: 496 492 beqz len, .Ldone\@ 497 493 nop ··· 520 516 jr ra 521 517 nop 522 518 523 - #ifdef CONFIG_CPU_MIPSR6 519 + #ifndef CONFIG_CPU_HAS_LOAD_STORE_LR 524 520 .Lcopy_unaligned_bytes\@: 525 521 1: 526 522 COPY_BYTE(0) ··· 534 530 ADD src, src, 8 535 531 b 1b 536 532 ADD dst, dst, 8 537 - #endif /* CONFIG_CPU_MIPSR6 */ 533 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 538 534 .if __memcpy == 1 539 535 END(memcpy) 540 536 .set __memcpy, 0
+30 -30
arch/mips/lib/memset.S
··· 78 78 #endif 79 79 .endm 80 80 81 - .set noreorder 82 81 .align 5 83 82 84 83 /* ··· 93 94 .endif 94 95 95 96 sltiu t0, a2, STORSIZE /* very small region? */ 97 + .set noreorder 96 98 bnez t0, .Lsmall_memset\@ 97 99 andi t0, a0, STORMASK /* aligned? */ 100 + .set reorder 98 101 99 102 #ifdef CONFIG_CPU_MICROMIPS 100 103 move t8, a1 /* used by 'swp' instruction */ 101 104 move t9, a1 102 105 #endif 106 + .set noreorder 103 107 #ifndef CONFIG_CPU_DADDI_WORKAROUNDS 104 108 beqz t0, 1f 105 109 PTR_SUBU t0, STORSIZE /* alignment in bytes */ ··· 113 111 PTR_SUBU t0, AT /* alignment in bytes */ 114 112 .set at 115 113 #endif 114 + .set reorder 116 115 117 - #ifndef CONFIG_CPU_MIPSR6 116 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 118 117 R10KCBARRIER(0(ra)) 119 118 #ifdef __MIPSEB__ 120 119 EX(LONG_S_L, a1, (a0), .Lfirst_fixup\@) /* make word/dword aligned */ ··· 125 122 PTR_SUBU a0, t0 /* long align ptr */ 126 123 PTR_ADDU a2, t0 /* correct size */ 127 124 128 - #else /* CONFIG_CPU_MIPSR6 */ 125 + #else /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 129 126 #define STORE_BYTE(N) \ 130 127 EX(sb, a1, N(a0), .Lbyte_fixup\@); \ 128 + .set noreorder; \ 131 129 beqz t0, 0f; \ 132 - PTR_ADDU t0, 1; 130 + PTR_ADDU t0, 1; \ 131 + .set reorder; 133 132 134 133 PTR_ADDU a2, t0 /* correct size */ 135 134 PTR_ADDU t0, 1 ··· 150 145 ori a0, STORMASK 151 146 xori a0, STORMASK 152 147 PTR_ADDIU a0, STORSIZE 153 - #endif /* CONFIG_CPU_MIPSR6 */ 148 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 154 149 1: ori t1, a2, 0x3f /* # of full blocks */ 155 150 xori t1, 0x3f 151 + andi t0, a2, 0x40-STORSIZE 156 152 beqz t1, .Lmemset_partial\@ /* no block to fill */ 157 - andi t0, a2, 0x40-STORSIZE 158 153 159 154 PTR_ADDU t1, a0 /* end address */ 160 - .set reorder 161 155 1: PTR_ADDIU a0, 64 162 156 R10KCBARRIER(0(ra)) 163 157 f_fill64 a0, -64, FILL64RG, .Lfwd_fixup\@, \mode 164 158 bne t1, a0, 1b 165 - .set noreorder 166 159 167 160 .Lmemset_partial\@: 168 161 R10KCBARRIER(0(ra)) ··· 176 173 PTR_SUBU t1, AT 177 174 .set at 178 175 #endif 176 + PTR_ADDU a0, t0 /* dest ptr */ 179 177 jr t1 180 - PTR_ADDU a0, t0 /* dest ptr */ 181 178 182 - .set push 183 - .set noreorder 184 - .set nomacro 185 179 /* ... but first do longs ... */ 186 180 f_fill64 a0, -64, FILL64RG, .Lpartial_fixup\@, \mode 187 - 2: .set pop 188 - andi a2, STORMASK /* At most one long to go */ 181 + 2: andi a2, STORMASK /* At most one long to go */ 189 182 183 + .set noreorder 190 184 beqz a2, 1f 191 - #ifndef CONFIG_CPU_MIPSR6 185 + #ifdef CONFIG_CPU_HAS_LOAD_STORE_LR 192 186 PTR_ADDU a0, a2 /* What's left */ 187 + .set reorder 193 188 R10KCBARRIER(0(ra)) 194 189 #ifdef __MIPSEB__ 195 190 EX(LONG_S_R, a1, -1(a0), .Llast_fixup\@) ··· 196 195 #endif 197 196 #else 198 197 PTR_SUBU t0, $0, a2 198 + .set reorder 199 199 move a2, zero /* No remaining longs */ 200 200 PTR_ADDIU t0, 1 201 201 STORE_BYTE(0) ··· 212 210 #endif 213 211 0: 214 212 #endif 215 - 1: jr ra 216 - move a2, zero 213 + 1: move a2, zero 214 + jr ra 217 215 218 216 .Lsmall_memset\@: 217 + PTR_ADDU t1, a0, a2 219 218 beqz a2, 2f 220 - PTR_ADDU t1, a0, a2 221 219 222 220 1: PTR_ADDIU a0, 1 /* fill bytewise */ 223 221 R10KCBARRIER(0(ra)) 222 + .set noreorder 224 223 bne t1, a0, 1b 225 224 EX(sb, a1, -1(a0), .Lsmall_fixup\@) 225 + .set reorder 226 226 227 - 2: jr ra /* done */ 228 - move a2, zero 227 + 2: move a2, zero 228 + jr ra /* done */ 229 229 .if __memset == 1 230 230 END(memset) 231 231 .set __memset, 0 232 232 .hidden __memset 233 233 .endif 234 234 235 - #ifdef CONFIG_CPU_MIPSR6 235 + #ifndef CONFIG_CPU_HAS_LOAD_STORE_LR 236 236 .Lbyte_fixup\@: 237 237 /* 238 238 * unset_bytes = (#bytes - (#unaligned bytes)) - (-#unaligned bytes remaining + 1) + 1 239 239 * a2 = a2 - t0 + 1 240 240 */ 241 241 PTR_SUBU a2, t0 242 + PTR_ADDIU a2, 1 242 243 jr ra 243 - PTR_ADDIU a2, 1 244 - #endif /* CONFIG_CPU_MIPSR6 */ 244 + #endif /* !CONFIG_CPU_HAS_LOAD_STORE_LR */ 245 245 246 246 .Lfirst_fixup\@: 247 247 /* unset_bytes already in a2 */ 248 248 jr ra 249 - nop 250 249 251 250 .Lfwd_fixup\@: 252 251 /* ··· 258 255 andi a2, 0x3f 259 256 LONG_L t0, THREAD_BUADDR(t0) 260 257 LONG_ADDU a2, t1 258 + LONG_SUBU a2, t0 261 259 jr ra 262 - LONG_SUBU a2, t0 263 260 264 261 .Lpartial_fixup\@: 265 262 /* ··· 270 267 andi a2, STORMASK 271 268 LONG_L t0, THREAD_BUADDR(t0) 272 269 LONG_ADDU a2, a0 270 + LONG_SUBU a2, t0 273 271 jr ra 274 - LONG_SUBU a2, t0 275 272 276 273 .Llast_fixup\@: 277 274 /* unset_bytes already in a2 */ 278 275 jr ra 279 - nop 280 276 281 277 .Lsmall_fixup\@: 282 278 /* 283 279 * unset_bytes = end_addr - current_addr + 1 284 280 * a2 = t1 - a0 + 1 285 281 */ 286 - .set reorder 287 282 PTR_SUBU a2, t1, a0 288 283 PTR_ADDIU a2, 1 289 284 jr ra 290 - .set noreorder 291 285 292 286 .endm 293 287 ··· 298 298 299 299 LEAF(memset) 300 300 EXPORT_SYMBOL(memset) 301 + move v0, a0 /* result */ 301 302 beqz a1, 1f 302 - move v0, a0 /* result */ 303 303 304 304 andi a1, 0xff /* spread fillword */ 305 305 LONG_SLL t1, a1, 8
-1
arch/mips/loongson64/common/Makefile
··· 6 6 obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ 7 7 bonito-irq.o mem.o machtype.o platform.o serial.o 8 8 obj-$(CONFIG_PCI) += pci.o 9 - obj-$(CONFIG_CPU_LOONGSON2) += dma.o 10 9 11 10 # 12 11 # Serial port support
-4
arch/mips/loongson64/common/dma.c arch/mips/loongson64/lemote-2f/dma.c
··· 8 8 9 9 phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) 10 10 { 11 - #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) 12 11 if (dma_addr > 0x8fffffff) 13 12 return dma_addr; 14 13 return dma_addr & 0x0fffffff; 15 - #else 16 - return dma_addr & 0x7fffffff; 17 - #endif 18 14 }
+1 -1
arch/mips/loongson64/fuloong-2e/Makefile
··· 2 2 # Makefile for Lemote Fuloong2e mini-PC board. 3 3 # 4 4 5 - obj-y += irq.o reset.o 5 + obj-y += irq.o reset.o dma.o
+12
arch/mips/loongson64/fuloong-2e/dma.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <linux/dma-direct.h> 3 + 4 + dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) 5 + { 6 + return paddr | 0x80000000; 7 + } 8 + 9 + phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) 10 + { 11 + return dma_addr & 0x7fffffff; 12 + }
+1 -1
arch/mips/loongson64/lemote-2f/Makefile
··· 2 2 # Makefile for lemote loongson2f family machines 3 3 # 4 4 5 - obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o 5 + obj-y += clock.o machtype.o irq.o reset.o dma.o ec_kb3310b.o 6 6 7 7 # 8 8 # Suspend Support
+6 -50
arch/mips/loongson64/loongson-3/irq.c
··· 96 96 } 97 97 } 98 98 99 - static struct irqaction cascade_irqaction = { 100 - .handler = no_action, 101 - .flags = IRQF_NO_SUSPEND, 102 - .name = "cascade", 103 - }; 104 - 105 - static inline void mask_loongson_irq(struct irq_data *d) 106 - { 107 - clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 108 - irq_disable_hazard(); 109 - 110 - /* Workaround: UART IRQ may deliver to any core */ 111 - if (d->irq == LOONGSON_UART_IRQ) { 112 - int cpu = smp_processor_id(); 113 - int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; 114 - int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; 115 - u64 intenclr_addr = smp_group[node_id] | 116 - (u64)(&LOONGSON_INT_ROUTER_INTENCLR); 117 - u64 introuter_lpc_addr = smp_group[node_id] | 118 - (u64)(&LOONGSON_INT_ROUTER_LPC); 119 - 120 - *(volatile u32 *)intenclr_addr = 1 << 10; 121 - *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id); 122 - } 123 - } 124 - 125 - static inline void unmask_loongson_irq(struct irq_data *d) 126 - { 127 - /* Workaround: UART IRQ may deliver to any core */ 128 - if (d->irq == LOONGSON_UART_IRQ) { 129 - int cpu = smp_processor_id(); 130 - int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; 131 - int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; 132 - u64 intenset_addr = smp_group[node_id] | 133 - (u64)(&LOONGSON_INT_ROUTER_INTENSET); 134 - u64 introuter_lpc_addr = smp_group[node_id] | 135 - (u64)(&LOONGSON_INT_ROUTER_LPC); 136 - 137 - *(volatile u32 *)intenset_addr = 1 << 10; 138 - *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id); 139 - } 140 - 141 - set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 142 - irq_enable_hazard(); 143 - } 99 + static inline void mask_loongson_irq(struct irq_data *d) { } 100 + static inline void unmask_loongson_irq(struct irq_data *d) { } 144 101 145 102 /* For MIPS IRQs which shared by all cores */ 146 103 static struct irq_chip loongson_irq_chip = { ··· 140 183 chip->irq_set_affinity = plat_set_irq_affinity; 141 184 142 185 irq_set_chip_and_handler(LOONGSON_UART_IRQ, 143 - &loongson_irq_chip, handle_level_irq); 186 + &loongson_irq_chip, handle_percpu_irq); 187 + irq_set_chip_and_handler(LOONGSON_BRIDGE_IRQ, 188 + &loongson_irq_chip, handle_percpu_irq); 144 189 145 - /* setup HT1 irq */ 146 - setup_irq(LOONGSON_HT1_IRQ, &cascade_irqaction); 147 - 148 - set_c0_status(STATUSF_IP2 | STATUSF_IP6); 190 + set_c0_status(STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP6); 149 191 } 150 192 151 193 #ifdef CONFIG_HOTPLUG_CPU
+15 -19
arch/mips/loongson64/loongson-3/numa.c
··· 180 180 181 181 static void __init node_mem_init(unsigned int node) 182 182 { 183 - unsigned long bootmap_size; 184 183 unsigned long node_addrspace_offset; 185 - unsigned long start_pfn, end_pfn, freepfn; 184 + unsigned long start_pfn, end_pfn; 186 185 187 186 node_addrspace_offset = nid_to_addroffset(node); 188 187 pr_info("Node%d's addrspace_offset is 0x%lx\n", 189 188 node, node_addrspace_offset); 190 189 191 190 get_pfn_range_for_nid(node, &start_pfn, &end_pfn); 192 - freepfn = start_pfn; 193 - if (node == 0) 194 - freepfn = PFN_UP(__pa_symbol(&_end)); /* kernel end address */ 195 - pr_info("Node%d: start_pfn=0x%lx, end_pfn=0x%lx, freepfn=0x%lx\n", 196 - node, start_pfn, end_pfn, freepfn); 191 + pr_info("Node%d: start_pfn=0x%lx, end_pfn=0x%lx\n", 192 + node, start_pfn, end_pfn); 197 193 198 194 __node_data[node] = prealloc__node_data + node; 199 195 200 - NODE_DATA(node)->bdata = &bootmem_node_data[node]; 201 196 NODE_DATA(node)->node_start_pfn = start_pfn; 202 197 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; 203 198 204 - bootmap_size = init_bootmem_node(NODE_DATA(node), freepfn, 205 - start_pfn, end_pfn); 206 199 free_bootmem_with_active_regions(node, end_pfn); 207 - if (node == 0) /* used by finalize_initrd() */ 200 + 201 + if (node == 0) { 202 + /* kernel end address */ 203 + unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end)); 204 + 205 + /* used by finalize_initrd() */ 208 206 max_low_pfn = end_pfn; 209 207 210 - /* This is reserved for the kernel and bdata->node_bootmem_map */ 211 - reserve_bootmem_node(NODE_DATA(node), start_pfn << PAGE_SHIFT, 212 - ((freepfn - start_pfn) << PAGE_SHIFT) + bootmap_size, 213 - BOOTMEM_DEFAULT); 208 + /* Reserve the kernel text/data/bss */ 209 + memblock_reserve(start_pfn << PAGE_SHIFT, 210 + ((kernel_end_pfn - start_pfn) << PAGE_SHIFT)); 214 211 215 - if (node == 0 && node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT)) { 216 212 /* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */ 217 - reserve_bootmem_node(NODE_DATA(node), 218 - (node_addrspace_offset | 0xfe000000), 219 - 32 << 20, BOOTMEM_DEFAULT); 213 + if (node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT)) 214 + memblock_reserve((node_addrspace_offset | 0xfe000000), 215 + 32 << 20); 220 216 } 221 217 222 218 sparse_memory_present_with_active_regions(node);
+9 -5
arch/mips/loongson64/loongson-3/smp.c
··· 21 21 #include <linux/sched/task_stack.h> 22 22 #include <linux/smp.h> 23 23 #include <linux/cpufreq.h> 24 + #include <linux/kexec.h> 24 25 #include <asm/processor.h> 25 26 #include <asm/time.h> 26 27 #include <asm/clock.h> ··· 350 349 write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ); 351 350 local_irq_enable(); 352 351 loongson3_ipi_write64(0, 353 - (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x0)); 352 + ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0); 354 353 pr_info("CPU#%d finished, CP0_ST=%x\n", 355 354 smp_processor_id(), read_c0_status()); 356 355 } ··· 417 416 cpu, startargs[0], startargs[1], startargs[2]); 418 417 419 418 loongson3_ipi_write64(startargs[3], 420 - (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x18)); 419 + ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x18); 421 420 loongson3_ipi_write64(startargs[2], 422 - (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x10)); 421 + ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x10); 423 422 loongson3_ipi_write64(startargs[1], 424 - (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x8)); 423 + ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x8); 425 424 loongson3_ipi_write64(startargs[0], 426 - (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x0)); 425 + ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0); 427 426 return 0; 428 427 } 429 428 ··· 749 748 #ifdef CONFIG_HOTPLUG_CPU 750 749 .cpu_disable = loongson3_cpu_disable, 751 750 .cpu_die = loongson3_cpu_die, 751 + #endif 752 + #ifdef CONFIG_KEXEC 753 + .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 752 754 #endif 753 755 };
+1 -6
arch/mips/mm/init.c
··· 32 32 #include <linux/kcore.h> 33 33 #include <linux/initrd.h> 34 34 35 - #include <asm/asm-offsets.h> 36 35 #include <asm/bootinfo.h> 37 36 #include <asm/cachectl.h> 38 37 #include <asm/cpu.h> ··· 520 521 #endif 521 522 522 523 /* 523 - * gcc 3.3 and older have trouble determining that PTRS_PER_PGD and PGD_ORDER 524 - * are constants. So we use the variants from asm-offset.h until that gcc 525 - * will officially be retired. 526 - * 527 524 * Align swapper_pg_dir in to 64K, allows its address to be loaded 528 525 * with a single LUI instruction in the TLB handlers. If we used 529 526 * __aligned(64K), its size would get rounded up to the alignment 530 527 * size, and waste space. So we place it in its own section and align 531 528 * it in the linker script. 532 529 */ 533 - pgd_t swapper_pg_dir[_PTRS_PER_PGD] __section(.bss..swapper_pg_dir); 530 + pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir); 534 531 #ifndef __PAGETABLE_PUD_FOLDED 535 532 pud_t invalid_pud_table[PTRS_PER_PUD] __page_aligned_bss; 536 533 #endif
+7 -7
arch/mips/netlogic/common/irq.c
··· 291 291 /* we need a hack to get the PIC's SoC chip id */ 292 292 ret = of_address_to_resource(node, 0, &res); 293 293 if (ret < 0) { 294 - pr_err("PIC %s: reg property not found!\n", node->name); 294 + pr_err("PIC %pOFn: reg property not found!\n", node); 295 295 return -EINVAL; 296 296 } 297 297 ··· 304 304 break; 305 305 } 306 306 if (socid == NLM_NR_NODES) { 307 - pr_err("PIC %s: Node mapping for bus %d not found!\n", 308 - node->name, bus); 307 + pr_err("PIC %pOFn: Node mapping for bus %d not found!\n", 308 + node, bus); 309 309 return -EINVAL; 310 310 } 311 311 } else { 312 312 socid = (res.start >> 18) & 0x3; 313 313 if (!nlm_node_present(socid)) { 314 - pr_err("PIC %s: node %d does not exist!\n", 315 - node->name, socid); 314 + pr_err("PIC %pOFn: node %d does not exist!\n", 315 + node, socid); 316 316 return -EINVAL; 317 317 } 318 318 } 319 319 320 320 if (!nlm_node_present(socid)) { 321 - pr_err("PIC %s: node %d does not exist!\n", node->name, socid); 321 + pr_err("PIC %pOFn: node %d does not exist!\n", node, socid); 322 322 return -EINVAL; 323 323 } 324 324 ··· 326 326 nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE, 327 327 &xlp_pic_irq_domain_ops, NULL); 328 328 if (xlp_pic_domain == NULL) { 329 - pr_err("PIC %s: Creating legacy domain failed!\n", node->name); 329 + pr_err("PIC %pOFn: Creating legacy domain failed!\n", node); 330 330 return -EINVAL; 331 331 } 332 332 pr_info("Node %d: IRQ domain created for PIC@%pR\n", socid, &res);
+24 -10
arch/mips/pci/ops-loongson3.c
··· 18 18 int where, u32 *data) 19 19 { 20 20 unsigned char busnum = bus->number; 21 - u_int64_t addr, type; 22 - void *addrp; 23 - int device = PCI_SLOT(devfn); 24 21 int function = PCI_FUNC(devfn); 22 + int device = PCI_SLOT(devfn); 25 23 int reg = where & ~3; 24 + void *addrp; 25 + u64 addr; 26 26 27 - addr = (busnum << 16) | (device << 11) | (function << 8) | reg; 28 - if (busnum == 0) { 29 - if (device > 31) 27 + if (where < PCI_CFG_SPACE_SIZE) { /* standard config */ 28 + addr = (busnum << 16) | (device << 11) | (function << 8) | reg; 29 + if (busnum == 0) { 30 + if (device > 31) 31 + return PCIBIOS_DEVICE_NOT_FOUND; 32 + addrp = (void *)TO_UNCAC(HT1LO_PCICFG_BASE | addr); 33 + } else { 34 + addrp = (void *)TO_UNCAC(HT1LO_PCICFG_BASE_TP1 | addr); 35 + } 36 + } else if (where < PCI_CFG_SPACE_EXP_SIZE) { /* extended config */ 37 + struct pci_dev *rootdev; 38 + 39 + rootdev = pci_get_domain_bus_and_slot(0, 0, 0); 40 + if (!rootdev) 30 41 return PCIBIOS_DEVICE_NOT_FOUND; 31 - addrp = (void *)(TO_UNCAC(HT1LO_PCICFG_BASE) | (addr & 0xffff)); 32 - type = 0; 33 42 43 + addr = pci_resource_start(rootdev, 3); 44 + if (!addr) 45 + return PCIBIOS_DEVICE_NOT_FOUND; 46 + 47 + addr |= busnum << 20 | device << 15 | function << 12 | reg; 48 + addrp = (void *)TO_UNCAC(addr); 34 49 } else { 35 - addrp = (void *)(TO_UNCAC(HT1LO_PCICFG_BASE_TP1) | (addr)); 36 - type = 0x10000; 50 + return PCIBIOS_DEVICE_NOT_FOUND; 37 51 } 38 52 39 53 if (access_type == PCI_ACCESS_WRITE)
+4
arch/mips/pci/pci-legacy.c
··· 127 127 if (pci_has_flag(PCI_PROBE_ONLY)) { 128 128 pci_bus_claim_resources(bus); 129 129 } else { 130 + struct pci_bus *child; 131 + 130 132 pci_bus_size_bridges(bus); 131 133 pci_bus_assign_resources(bus); 134 + list_for_each_entry(child, &bus->children, node) 135 + pcie_bus_configure_settings(child); 132 136 } 133 137 pci_bus_add_devices(bus); 134 138 }
+2
arch/mips/pci/pci-rt2880.c
··· 246 246 rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000); 247 247 (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0); 248 248 249 + rt2880_pci_controller.of_node = pdev->dev.of_node; 250 + 249 251 register_pci_controller(&rt2880_pci_controller); 250 252 return 0; 251 253 }
+2 -2
arch/mips/pmcs-msp71xx/msp_usb.c
··· 133 133 * "D" for device-mode. If it works for Ethernet, why not USB... 134 134 * -- hammtrev, 2007/03/22 135 135 */ 136 - snprintf((char *)&envstr[0], sizeof(envstr), "usbmode"); 136 + snprintf(&envstr[0], sizeof(envstr), "usbmode"); 137 137 138 138 /* set default host mode */ 139 139 val = 1; 140 140 141 141 /* get environment string */ 142 - strp = prom_getenv((char *)&envstr[0]); 142 + strp = prom_getenv(&envstr[0]); 143 143 if (strp) { 144 144 /* compare string */ 145 145 if (!strcmp(strp, "device"))
+3 -3
arch/mips/ralink/cevt-rt3352.c
··· 134 134 systick.dev.min_delta_ticks = 0x3; 135 135 systick.dev.irq = irq_of_parse_and_map(np, 0); 136 136 if (!systick.dev.irq) { 137 - pr_err("%s: request_irq failed", np->name); 137 + pr_err("%pOFn: request_irq failed", np); 138 138 return -EINVAL; 139 139 } 140 140 ··· 146 146 147 147 clockevents_register_device(&systick.dev); 148 148 149 - pr_info("%s: running - mult: %d, shift: %d\n", 150 - np->name, systick.dev.mult, systick.dev.shift); 149 + pr_info("%pOFn: running - mult: %d, shift: %d\n", 150 + np, systick.dev.mult, systick.dev.shift); 151 151 152 152 return 0; 153 153 }
+1 -1
arch/mips/ralink/ill_acc.c
··· 62 62 63 63 pdev = of_find_device_by_node(np); 64 64 if (!pdev) { 65 - pr_err("%s: failed to lookup pdev\n", np->name); 65 + pr_err("%pOFn: failed to lookup pdev\n", np); 66 66 return -EINVAL; 67 67 } 68 68
+5
arch/mips/ralink/rt305x.c
··· 49 49 static struct rt2880_pmx_func rt3352_lna_func[] = { FUNC("lna", 0, 36, 2) }; 50 50 static struct rt2880_pmx_func rt3352_pa_func[] = { FUNC("pa", 0, 38, 2) }; 51 51 static struct rt2880_pmx_func rt3352_led_func[] = { FUNC("led", 0, 40, 5) }; 52 + static struct rt2880_pmx_func rt3352_cs1_func[] = { 53 + FUNC("spi_cs1", 0, 45, 1), 54 + FUNC("wdg_cs1", 1, 45, 1), 55 + }; 52 56 53 57 static struct rt2880_pmx_group rt3050_pinmux_data[] = { 54 58 GRP("i2c", i2c_func, 1, RT305X_GPIO_MODE_I2C), ··· 79 75 GRP("lna", rt3352_lna_func, 1, RT3352_GPIO_MODE_LNA), 80 76 GRP("pa", rt3352_pa_func, 1, RT3352_GPIO_MODE_PA), 81 77 GRP("led", rt3352_led_func, 1, RT5350_GPIO_MODE_PHY_LED), 78 + GRP("spi_cs1", rt3352_cs1_func, 2, RT5350_GPIO_MODE_SPI_CS1), 82 79 { 0 } 83 80 }; 84 81
+1 -1
arch/mips/sgi-ip22/ip28-berr.c
··· 464 464 die_if_kernel("Oops", regs); 465 465 force_sig(SIGBUS, current); 466 466 } else if (debug_be_interrupt) 467 - show_regs((struct pt_regs *)regs); 467 + show_regs(regs); 468 468 } 469 469 470 470 static int ip28_be_handler(struct pt_regs *regs, int is_fixup)
+4 -7
arch/mips/sgi-ip27/ip27-memory.c
··· 389 389 { 390 390 unsigned long slot_firstpfn = slot_getbasepfn(node, 0); 391 391 unsigned long slot_freepfn = node_getfirstfree(node); 392 - unsigned long bootmap_size; 393 392 unsigned long start_pfn, end_pfn; 394 393 395 394 get_pfn_range_for_nid(node, &start_pfn, &end_pfn); ··· 399 400 __node_data[node] = __va(slot_freepfn << PAGE_SHIFT); 400 401 memset(__node_data[node], 0, PAGE_SIZE); 401 402 402 - NODE_DATA(node)->bdata = &bootmem_node_data[node]; 403 403 NODE_DATA(node)->node_start_pfn = start_pfn; 404 404 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; 405 405 ··· 407 409 slot_freepfn += PFN_UP(sizeof(struct pglist_data) + 408 410 sizeof(struct hub_data)); 409 411 410 - bootmap_size = init_bootmem_node(NODE_DATA(node), slot_freepfn, 411 - start_pfn, end_pfn); 412 412 free_bootmem_with_active_regions(node, end_pfn); 413 - reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 414 - ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size, 415 - BOOTMEM_DEFAULT); 413 + 414 + memblock_reserve(slot_firstpfn << PAGE_SHIFT, 415 + ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT)); 416 + 416 417 sparse_memory_present_with_active_regions(node); 417 418 } 418 419
+1
arch/mips/tools/.gitignore
··· 1 + elf-entry
+5
arch/mips/tools/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + hostprogs-y := elf-entry 3 + PHONY += elf-entry 4 + elf-entry: $(obj)/elf-entry 5 + @:
+96
arch/mips/tools/elf-entry.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <byteswap.h> 3 + #include <elf.h> 4 + #include <endian.h> 5 + #include <inttypes.h> 6 + #include <stdint.h> 7 + #include <stdio.h> 8 + #include <stdlib.h> 9 + #include <string.h> 10 + 11 + #ifdef be32toh 12 + /* If libc provides [bl]e{32,64}toh() then we'll use them */ 13 + #elif BYTE_ORDER == LITTLE_ENDIAN 14 + # define be32toh(x) bswap_32(x) 15 + # define le32toh(x) (x) 16 + # define be64toh(x) bswap_64(x) 17 + # define le64toh(x) (x) 18 + #elif BYTE_ORDER == BIG_ENDIAN 19 + # define be32toh(x) (x) 20 + # define le32toh(x) bswap_32(x) 21 + # define be64toh(x) (x) 22 + # define le64toh(x) bswap_64(x) 23 + #endif 24 + 25 + __attribute__((noreturn)) 26 + static void die(const char *msg) 27 + { 28 + fputs(msg, stderr); 29 + exit(EXIT_FAILURE); 30 + } 31 + 32 + int main(int argc, const char *argv[]) 33 + { 34 + uint64_t entry; 35 + size_t nread; 36 + FILE *file; 37 + union { 38 + Elf32_Ehdr ehdr32; 39 + Elf64_Ehdr ehdr64; 40 + } hdr; 41 + 42 + if (argc != 2) 43 + die("Usage: elf-entry <elf-file>\n"); 44 + 45 + file = fopen(argv[1], "r"); 46 + if (!file) { 47 + perror("Unable to open input file"); 48 + return EXIT_FAILURE; 49 + } 50 + 51 + nread = fread(&hdr, 1, sizeof(hdr), file); 52 + if (nread != sizeof(hdr)) { 53 + perror("Unable to read input file"); 54 + return EXIT_FAILURE; 55 + } 56 + 57 + if (memcmp(hdr.ehdr32.e_ident, ELFMAG, SELFMAG)) 58 + die("Input is not an ELF\n"); 59 + 60 + switch (hdr.ehdr32.e_ident[EI_CLASS]) { 61 + case ELFCLASS32: 62 + switch (hdr.ehdr32.e_ident[EI_DATA]) { 63 + case ELFDATA2LSB: 64 + entry = le32toh(hdr.ehdr32.e_entry); 65 + break; 66 + case ELFDATA2MSB: 67 + entry = be32toh(hdr.ehdr32.e_entry); 68 + break; 69 + default: 70 + die("Invalid ELF encoding\n"); 71 + } 72 + 73 + /* Sign extend to form a canonical address */ 74 + entry = (int64_t)(int32_t)entry; 75 + break; 76 + 77 + case ELFCLASS64: 78 + switch (hdr.ehdr32.e_ident[EI_DATA]) { 79 + case ELFDATA2LSB: 80 + entry = le64toh(hdr.ehdr64.e_entry); 81 + break; 82 + case ELFDATA2MSB: 83 + entry = be64toh(hdr.ehdr64.e_entry); 84 + break; 85 + default: 86 + die("Invalid ELF encoding\n"); 87 + } 88 + break; 89 + 90 + default: 91 + die("Invalid ELF class\n"); 92 + } 93 + 94 + printf("0x%016" PRIx64 "\n", entry); 95 + return EXIT_SUCCESS; 96 + }
+2 -3
arch/mips/txx9/generic/setup.c
··· 960 960 goto exit_put; 961 961 err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); 962 962 if (err) { 963 - device_unregister(&dev->dev); 964 963 iounmap(dev->base); 965 - kfree(dev); 964 + device_unregister(&dev->dev); 966 965 } 967 966 return; 968 967 exit_put: 968 + iounmap(dev->base); 969 969 put_device(&dev->dev); 970 - return; 971 970 }