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

Merge tag 'powerpc-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc updates from Michael Ellerman:

- Extend KCSAN support to 32-bit and BookE. Add some KCSAN annotations

- Make ELFv2 ABI the default for 64-bit big-endian kernel builds, and
use the -mprofile-kernel option (kernel specific ftrace ABI) for big
endian ELFv2 kernels

- Add initial Dynamic Execution Control Register (DEXCR) support, and
allow the ROP protection instructions to be used on Power 10

- Various other small features and fixes

Thanks to Aditya Gupta, Aneesh Kumar K.V, Benjamin Gray, Brian King,
Christophe Leroy, Colin Ian King, Dmitry Torokhov, Gaurav Batra, Jean
Delvare, Joel Stanley, Marco Elver, Masahiro Yamada, Nageswara R Sastry,
Nathan Chancellor, Naveen N Rao, Nayna Jain, Nicholas Piggin, Paul
Gortmaker, Randy Dunlap, Rob Herring, Rohan McLure, Russell Currey,
Sachin Sant, Timothy Pearson, Tom Rix, and Uwe Kleine-König.

* tag 'powerpc-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (76 commits)
powerpc: remove checks for binutils older than 2.25
powerpc: Fail build if using recordmcount with binutils v2.37
powerpc/iommu: TCEs are incorrectly manipulated with DLPAR add/remove of memory
powerpc/iommu: Only build sPAPR access functions on pSeries
powerpc: powernv: Annotate data races in opal events
powerpc: Mark writes registering ipi to host cpu through kvm and polling
powerpc: Annotate accesses to ipi message flags
powerpc: powernv: Fix KCSAN datarace warnings on idle_state contention
powerpc: Mark [h]ssr_valid accesses in check_return_regs_valid
powerpc: qspinlock: Enforce qnode writes prior to publishing to queue
powerpc: qspinlock: Mark accesses to qnode lock checks
powerpc/powernv/pci: Remove last IODA1 defines
powerpc/powernv/pci: Remove MVE code
powerpc/powernv/pci: Remove ioda1 support
powerpc: 52xx: Make immr_id DT match tables static
powerpc: mpc512x: Remove open coded "ranges" parsing
powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing
powerpc: fsl: Use of_property_read_reg() to parse "reg"
powerpc: fsl_rio: Use of_range_to_resource() for "ranges" parsing
macintosh: Use of_property_read_reg() to parse "reg"
...

+1482 -4554
+58
Documentation/powerpc/dexcr.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0-or-later 2 + 3 + ========================================== 4 + DEXCR (Dynamic Execution Control Register) 5 + ========================================== 6 + 7 + Overview 8 + ======== 9 + 10 + The DEXCR is a privileged special purpose register (SPR) introduced in 11 + PowerPC ISA 3.1B (Power10) that allows per-cpu control over several dynamic 12 + execution behaviours. These behaviours include speculation (e.g., indirect 13 + branch target prediction) and enabling return-oriented programming (ROP) 14 + protection instructions. 15 + 16 + The execution control is exposed in hardware as up to 32 bits ('aspects') in 17 + the DEXCR. Each aspect controls a certain behaviour, and can be set or cleared 18 + to enable/disable the aspect. There are several variants of the DEXCR for 19 + different purposes: 20 + 21 + DEXCR 22 + A privileged SPR that can control aspects for userspace and kernel space 23 + HDEXCR 24 + A hypervisor-privileged SPR that can control aspects for the hypervisor and 25 + enforce aspects for the kernel and userspace. 26 + UDEXCR 27 + An optional ultravisor-privileged SPR that can control aspects for the ultravisor. 28 + 29 + Userspace can examine the current DEXCR state using a dedicated SPR that 30 + provides a non-privileged read-only view of the userspace DEXCR aspects. 31 + There is also an SPR that provides a read-only view of the hypervisor enforced 32 + aspects, which ORed with the userspace DEXCR view gives the effective DEXCR 33 + state for a process. 34 + 35 + 36 + Configuration 37 + ============= 38 + 39 + The DEXCR is currently unconfigurable. All threads are run with the 40 + NPHIE aspect enabled. 41 + 42 + 43 + coredump and ptrace 44 + =================== 45 + 46 + The userspace values of the DEXCR and HDEXCR (in this order) are exposed under 47 + ``NT_PPC_DEXCR``. These are each 64 bits and readonly, and are intended to 48 + assist with core dumps. The DEXCR may be made writable in future. The top 32 49 + bits of both registers (corresponding to the non-userspace bits) are masked off. 50 + 51 + If the kernel config ``CONFIG_CHECKPOINT_RESTORE`` is enabled, then 52 + ``NT_PPC_HASHKEYR`` is available and exposes the HASHKEYR value of the process 53 + for reading and writing. This is a tradeoff between increased security and 54 + checkpoint/restore support: a process should normally have no need to know its 55 + secret key, but restoring a process requires setting its original key. The key 56 + therefore appears in core dumps, and an attacker may be able to retrieve it from 57 + a coredump and effectively bypass ROP protection on any threads that share this 58 + key (potentially all threads from the same parent that have not run ``exec()``).
+1
Documentation/powerpc/index.rst
··· 15 15 cxl 16 16 cxlflash 17 17 dawr-power9 18 + dexcr 18 19 dscr 19 20 eeh-pci-error-recovery 20 21 elf_hwcaps
+9 -2
MAINTAINERS
··· 11448 11448 F: arch/mips/kvm/ 11449 11449 11450 11450 KERNEL VIRTUAL MACHINE FOR POWERPC (KVM/powerpc) 11451 + M: Michael Ellerman <mpe@ellerman.id.au> 11452 + R: Nicholas Piggin <npiggin@gmail.com> 11451 11453 L: linuxppc-dev@lists.ozlabs.org 11454 + L: kvm@vger.kernel.org 11455 + S: Maintained (Book3S 64-bit HV) 11456 + S: Odd fixes (Book3S 64-bit PR) 11457 + S: Orphan (Book3E and 32-bit) 11452 11458 T: git git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git topic/ppc-kvm 11453 11459 F: arch/powerpc/include/asm/kvm* 11454 11460 F: arch/powerpc/include/uapi/asm/kvm* ··· 11987 11981 F: lib/test_linear_ranges.c 11988 11982 11989 11983 LINUX FOR POWER MACINTOSH 11990 - M: Benjamin Herrenschmidt <benh@kernel.crashing.org> 11991 11984 L: linuxppc-dev@lists.ozlabs.org 11992 - S: Odd Fixes 11985 + S: Orphan 11993 11986 F: arch/powerpc/platforms/powermac/ 11994 11987 F: drivers/macintosh/ 11988 + X: drivers/macintosh/adb-iop.c 11989 + X: drivers/macintosh/via-macii.c 11995 11990 11996 11991 LINUX FOR POWERPC (32-BIT AND 64-BIT) 11997 11992 M: Michael Ellerman <mpe@ellerman.id.au>
+9 -8
arch/powerpc/Kconfig
··· 210 210 select HAVE_ARCH_KASAN if PPC_RADIX_MMU 211 211 select HAVE_ARCH_KASAN if PPC_BOOK3E_64 212 212 select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN 213 - select HAVE_ARCH_KCSAN if PPC_BOOK3S_64 213 + select HAVE_ARCH_KCSAN 214 214 select HAVE_ARCH_KFENCE if ARCH_SUPPORTS_DEBUG_PAGEALLOC 215 215 select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET 216 216 select HAVE_ARCH_WITHIN_STACK_FRAMES ··· 235 235 select HAVE_FUNCTION_DESCRIPTORS if PPC64_ELF_ABI_V1 236 236 select HAVE_FUNCTION_ERROR_INJECTION 237 237 select HAVE_FUNCTION_GRAPH_TRACER 238 - select HAVE_FUNCTION_TRACER 238 + select HAVE_FUNCTION_TRACER if PPC64 || (PPC32 && CC_IS_GCC) 239 239 select HAVE_GCC_PLUGINS if GCC_VERSION >= 50200 # plugin support on gcc <= 5.1 is buggy on PPC 240 240 select HAVE_GENERIC_VDSO 241 241 select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP ··· 547 547 If unsure, say "N". 548 548 549 549 config MPROFILE_KERNEL 550 - depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER 551 - def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__) 550 + depends on PPC64_ELF_ABI_V2 && FUNCTION_TRACER 551 + def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mlittle-endian) if CPU_LITTLE_ENDIAN 552 + def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mbig-endian) if CPU_BIG_ENDIAN 552 553 553 554 config HOTPLUG_CPU 554 555 bool "Support for enabling/disabling CPUs" ··· 625 624 def_bool KEXEC_FILE 626 625 627 626 config PPC64_BIG_ENDIAN_ELF_ABI_V2 628 - bool "Build big-endian kernel using ELF ABI V2 (EXPERIMENTAL)" 627 + # Option is available to BFD, but LLD does not support ELFv1 so this is 628 + # always true there. 629 + prompt "Build big-endian kernel using ELF ABI V2" if LD_IS_BFD && EXPERT 630 + def_bool y 629 631 depends on PPC64 && CPU_BIG_ENDIAN 630 632 depends on CC_HAS_ELFV2 631 - depends on LD_VERSION >= 22400 || LLD_VERSION >= 150000 632 633 help 633 634 This builds the kernel image using the "Power Architecture 64-Bit ELF 634 635 V2 ABI Specification", which has a reduced stack overhead and faster ··· 640 637 The V2 ABI is standard for 64-bit little-endian, but for big-endian 641 638 it is less well tested by kernel and toolchain. However some distros 642 639 build userspace this way, and it can produce a functioning kernel. 643 - 644 - This requires GCC and binutils 2.24 or newer. 645 640 646 641 config RELOCATABLE 647 642 bool "Build a relocatable kernel"
+8 -15
arch/powerpc/Makefile
··· 42 42 machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le 43 43 UTS_MACHINE := $(subst $(space),,$(machine-y)) 44 44 45 - # XXX This needs to be before we override LD below 46 - ifdef CONFIG_PPC32 47 - KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 48 - else 49 - ifeq ($(call ld-ifversion, -ge, 22500, y),y) 45 + ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy) 50 46 # Have the linker provide sfpr if possible. 51 47 # There is a corresponding test in arch/powerpc/lib/Makefile 52 48 KBUILD_LDFLAGS_MODULE += --save-restore-funcs 53 49 else 54 50 KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 55 - endif 56 51 endif 57 52 58 53 ifdef CONFIG_CPU_LITTLE_ENDIAN ··· 161 166 KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr) 162 167 KBUILD_AFLAGS += $(AFLAGS-y) 163 168 KBUILD_CFLAGS += $(call cc-option,-msoft-float) 164 - KBUILD_CFLAGS += -pipe $(CFLAGS-y) 169 + KBUILD_CFLAGS += $(CFLAGS-y) 165 170 CPP = $(CC) -E $(KBUILD_CFLAGS) 166 171 167 172 CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ ··· 393 398 endif 394 399 395 400 PHONY += checkbin 396 - # Check toolchain versions: 397 - # - gcc-4.6 is the minimum kernel-wide version so nothing required. 398 401 checkbin: 399 - @if test "x${CONFIG_LD_IS_LLD}" != "xy" -a \ 400 - "x$(call ld-ifversion, -le, 22400, y)" = "xy" ; then \ 401 - echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \ 402 - echo 'in some circumstances.' ; \ 403 - echo '*** binutils 2.23 do not define the TOC symbol ' ; \ 404 - echo -n '*** Please use a different binutils version.' ; \ 402 + @if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \ 403 + "x${CONFIG_LD_IS_BFD}" = "xy" -a \ 404 + "${CONFIG_LD_VERSION}" = "23700" ; then \ 405 + echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \ 406 + echo 'is unable to handle.' ; \ 407 + echo '*** Please use a different binutils version.' ; \ 405 408 false ; \ 406 409 fi
+34 -37
arch/powerpc/boot/Makefile
··· 32 32 BOOTAR := $(AR) 33 33 endif 34 34 35 - BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 36 - -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ 37 - $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ 38 - -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 39 - $(LINUXINCLUDE) 40 - 41 35 ifdef CONFIG_PPC64_BOOT_WRAPPER 42 - BOOTCFLAGS += -m64 36 + BOOTTARGETFLAGS += -m64 37 + BOOTTARGETFLAGS += -mabi=elfv2 43 38 ifdef CONFIG_PPC64_ELF_ABI_V2 44 - BOOTCFLAGS += $(call cc-option,-mabi=elfv2) 39 + BOOTTARGETFLAGS += $(call cc-option,-mabi=elfv2) 45 40 endif 46 41 else 47 - BOOTCFLAGS += -m32 42 + BOOTTARGETFLAGS := -m32 48 43 endif 49 44 50 45 ifdef CONFIG_TARGET_CPU_BOOL 51 - BOOTCFLAGS += -mcpu=$(CONFIG_TARGET_CPU) 46 + BOOTTARGETFLAGS += -mcpu=$(CONFIG_TARGET_CPU) 52 47 else ifdef CONFIG_PPC64_BOOT_WRAPPER 53 48 ifdef CONFIG_CPU_LITTLE_ENDIAN 54 - BOOTCFLAGS += -mcpu=powerpc64le 49 + BOOTTARGETFLAGS += -mcpu=powerpc64le 55 50 else 56 - BOOTCFLAGS += -mcpu=powerpc64 51 + BOOTTARGETFLAGS += -mcpu=powerpc64 57 52 endif 58 53 endif 59 54 60 - BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 55 + $(obj)/4xx.o: BOOTTARGETFLAGS += -mcpu=405 56 + $(obj)/ebony.o: BOOTTARGETFLAGS += -mcpu=440 57 + $(obj)/cuboot-hotfoot.o: BOOTTARGETFLAGS += -mcpu=405 58 + $(obj)/cuboot-taishan.o: BOOTTARGETFLAGS += -mcpu=440 59 + $(obj)/cuboot-katmai.o: BOOTTARGETFLAGS += -mcpu=440 60 + $(obj)/cuboot-acadia.o: BOOTTARGETFLAGS += -mcpu=405 61 + $(obj)/treeboot-iss4xx.o: BOOTTARGETFLAGS += -mcpu=405 62 + $(obj)/treeboot-currituck.o: BOOTTARGETFLAGS += -mcpu=405 63 + $(obj)/treeboot-akebono.o: BOOTTARGETFLAGS += -mcpu=405 61 64 62 65 ifdef CONFIG_CPU_BIG_ENDIAN 63 - BOOTCFLAGS += -mbig-endian 66 + BOOTTARGETFLAGS += -mbig-endian 64 67 else 65 - BOOTCFLAGS += -mlittle-endian 68 + BOOTTARGETFLAGS += -mlittle-endian 66 69 endif 67 70 68 - BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc 71 + BOOTCPPFLAGS := -nostdinc $(LINUXINCLUDE) 72 + BOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 73 + 74 + BOOTCFLAGS := $(BOOTTARGETFLAGS) \ 75 + -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 76 + -fno-strict-aliasing -O2 \ 77 + -msoft-float -mno-altivec -mno-vsx \ 78 + $(call cc-option,-mno-prefixed) \ 79 + $(call cc-option,-mno-pcrel) \ 80 + $(call cc-option,-mno-mma) \ 81 + $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ 82 + -fomit-frame-pointer -fno-builtin -fPIC 83 + 84 + BOOTAFLAGS := $(BOOTTARGETFLAGS) -D__ASSEMBLY__ 69 85 70 86 BOOTARFLAGS := -crD 71 - 72 - BOOTCFLAGS += $(call cc-option,-mno-prefixed) \ 73 - $(call cc-option,-mno-pcrel) \ 74 - $(call cc-option,-mno-mma) 75 87 76 88 ifdef CONFIG_CC_IS_CLANG 77 89 BOOTCFLAGS += $(CLANG_FLAGS) ··· 102 90 BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) 103 91 104 92 DTC_FLAGS ?= -p 1024 105 - 106 - $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 107 - $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 108 - $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 109 - $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 110 - $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 111 - $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 112 - $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 113 - $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 114 - $(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405 115 93 116 94 # The pre-boot decompressors pull in a lot of kernel headers and other source 117 95 # files. This creates a bit of a dependency headache since we need to copy ··· 226 224 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 227 225 228 226 quiet_cmd_bootcc = BOOTCC $@ 229 - cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 227 + cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTCFLAGS) -c -o $@ $< 230 228 231 229 quiet_cmd_bootas = BOOTAS $@ 232 - cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 230 + cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTAFLAGS) -c -o $@ $< 233 231 234 232 quiet_cmd_bootar = BOOTAR $@ 235 233 cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@ ··· 342 340 image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot 343 341 344 342 # Board ports in arch/powerpc/platform/85xx/Kconfig 345 - image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads 346 - image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads 347 - image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ 348 - cuImage.mpc8548cds_32b \ 349 - cuImage.mpc8555cds 350 343 image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 351 344 image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 352 345 cuImage.mpc8572ds
-355
arch/powerpc/boot/dts/fsl/mpc8540ads.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC8540 ADS Device Tree Source 4 - * 5 - * Copyright 2006, 2008 Freescale Semiconductor Inc. 6 - */ 7 - 8 - /dts-v1/; 9 - 10 - /include/ "e500v1_power_isa.dtsi" 11 - 12 - / { 13 - model = "MPC8540ADS"; 14 - compatible = "MPC8540ADS", "MPC85xxADS"; 15 - #address-cells = <1>; 16 - #size-cells = <1>; 17 - 18 - aliases { 19 - ethernet0 = &enet0; 20 - ethernet1 = &enet1; 21 - ethernet2 = &enet2; 22 - serial0 = &serial0; 23 - serial1 = &serial1; 24 - pci0 = &pci0; 25 - }; 26 - 27 - cpus { 28 - #address-cells = <1>; 29 - #size-cells = <0>; 30 - 31 - PowerPC,8540@0 { 32 - device_type = "cpu"; 33 - reg = <0x0>; 34 - d-cache-line-size = <32>; // 32 bytes 35 - i-cache-line-size = <32>; // 32 bytes 36 - d-cache-size = <0x8000>; // L1, 32K 37 - i-cache-size = <0x8000>; // L1, 32K 38 - timebase-frequency = <0>; // 33 MHz, from uboot 39 - bus-frequency = <0>; // 166 MHz 40 - clock-frequency = <0>; // 825 MHz, from uboot 41 - next-level-cache = <&L2>; 42 - }; 43 - }; 44 - 45 - memory { 46 - device_type = "memory"; 47 - reg = <0x0 0x8000000>; // 128M at 0x0 48 - }; 49 - 50 - soc8540@e0000000 { 51 - #address-cells = <1>; 52 - #size-cells = <1>; 53 - device_type = "soc"; 54 - compatible = "simple-bus"; 55 - ranges = <0x0 0xe0000000 0x100000>; 56 - bus-frequency = <0>; 57 - 58 - ecm-law@0 { 59 - compatible = "fsl,ecm-law"; 60 - reg = <0x0 0x1000>; 61 - fsl,num-laws = <8>; 62 - }; 63 - 64 - ecm@1000 { 65 - compatible = "fsl,mpc8540-ecm", "fsl,ecm"; 66 - reg = <0x1000 0x1000>; 67 - interrupts = <17 2>; 68 - interrupt-parent = <&mpic>; 69 - }; 70 - 71 - memory-controller@2000 { 72 - compatible = "fsl,mpc8540-memory-controller"; 73 - reg = <0x2000 0x1000>; 74 - interrupt-parent = <&mpic>; 75 - interrupts = <18 2>; 76 - }; 77 - 78 - L2: l2-cache-controller@20000 { 79 - compatible = "fsl,mpc8540-l2-cache-controller"; 80 - reg = <0x20000 0x1000>; 81 - cache-line-size = <32>; // 32 bytes 82 - cache-size = <0x40000>; // L2, 256K 83 - interrupt-parent = <&mpic>; 84 - interrupts = <16 2>; 85 - }; 86 - 87 - i2c@3000 { 88 - #address-cells = <1>; 89 - #size-cells = <0>; 90 - cell-index = <0>; 91 - compatible = "fsl-i2c"; 92 - reg = <0x3000 0x100>; 93 - interrupts = <43 2>; 94 - interrupt-parent = <&mpic>; 95 - dfsrr; 96 - }; 97 - 98 - dma@21300 { 99 - #address-cells = <1>; 100 - #size-cells = <1>; 101 - compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma"; 102 - reg = <0x21300 0x4>; 103 - ranges = <0x0 0x21100 0x200>; 104 - cell-index = <0>; 105 - dma-channel@0 { 106 - compatible = "fsl,mpc8540-dma-channel", 107 - "fsl,eloplus-dma-channel"; 108 - reg = <0x0 0x80>; 109 - cell-index = <0>; 110 - interrupt-parent = <&mpic>; 111 - interrupts = <20 2>; 112 - }; 113 - dma-channel@80 { 114 - compatible = "fsl,mpc8540-dma-channel", 115 - "fsl,eloplus-dma-channel"; 116 - reg = <0x80 0x80>; 117 - cell-index = <1>; 118 - interrupt-parent = <&mpic>; 119 - interrupts = <21 2>; 120 - }; 121 - dma-channel@100 { 122 - compatible = "fsl,mpc8540-dma-channel", 123 - "fsl,eloplus-dma-channel"; 124 - reg = <0x100 0x80>; 125 - cell-index = <2>; 126 - interrupt-parent = <&mpic>; 127 - interrupts = <22 2>; 128 - }; 129 - dma-channel@180 { 130 - compatible = "fsl,mpc8540-dma-channel", 131 - "fsl,eloplus-dma-channel"; 132 - reg = <0x180 0x80>; 133 - cell-index = <3>; 134 - interrupt-parent = <&mpic>; 135 - interrupts = <23 2>; 136 - }; 137 - }; 138 - 139 - enet0: ethernet@24000 { 140 - #address-cells = <1>; 141 - #size-cells = <1>; 142 - cell-index = <0>; 143 - device_type = "network"; 144 - model = "TSEC"; 145 - compatible = "gianfar"; 146 - reg = <0x24000 0x1000>; 147 - ranges = <0x0 0x24000 0x1000>; 148 - local-mac-address = [ 00 00 00 00 00 00 ]; 149 - interrupts = <29 2 30 2 34 2>; 150 - interrupt-parent = <&mpic>; 151 - tbi-handle = <&tbi0>; 152 - phy-handle = <&phy0>; 153 - 154 - mdio@520 { 155 - #address-cells = <1>; 156 - #size-cells = <0>; 157 - compatible = "fsl,gianfar-mdio"; 158 - reg = <0x520 0x20>; 159 - 160 - phy0: ethernet-phy@0 { 161 - interrupt-parent = <&mpic>; 162 - interrupts = <5 1>; 163 - reg = <0x0>; 164 - }; 165 - phy1: ethernet-phy@1 { 166 - interrupt-parent = <&mpic>; 167 - interrupts = <5 1>; 168 - reg = <0x1>; 169 - }; 170 - phy3: ethernet-phy@3 { 171 - interrupt-parent = <&mpic>; 172 - interrupts = <7 1>; 173 - reg = <0x3>; 174 - }; 175 - tbi0: tbi-phy@11 { 176 - reg = <0x11>; 177 - device_type = "tbi-phy"; 178 - }; 179 - }; 180 - }; 181 - 182 - enet1: ethernet@25000 { 183 - #address-cells = <1>; 184 - #size-cells = <1>; 185 - cell-index = <1>; 186 - device_type = "network"; 187 - model = "TSEC"; 188 - compatible = "gianfar"; 189 - reg = <0x25000 0x1000>; 190 - ranges = <0x0 0x25000 0x1000>; 191 - local-mac-address = [ 00 00 00 00 00 00 ]; 192 - interrupts = <35 2 36 2 40 2>; 193 - interrupt-parent = <&mpic>; 194 - tbi-handle = <&tbi1>; 195 - phy-handle = <&phy1>; 196 - 197 - mdio@520 { 198 - #address-cells = <1>; 199 - #size-cells = <0>; 200 - compatible = "fsl,gianfar-tbi"; 201 - reg = <0x520 0x20>; 202 - 203 - tbi1: tbi-phy@11 { 204 - reg = <0x11>; 205 - device_type = "tbi-phy"; 206 - }; 207 - }; 208 - }; 209 - 210 - enet2: ethernet@26000 { 211 - #address-cells = <1>; 212 - #size-cells = <1>; 213 - cell-index = <2>; 214 - device_type = "network"; 215 - model = "FEC"; 216 - compatible = "gianfar"; 217 - reg = <0x26000 0x1000>; 218 - ranges = <0x0 0x26000 0x1000>; 219 - local-mac-address = [ 00 00 00 00 00 00 ]; 220 - interrupts = <41 2>; 221 - interrupt-parent = <&mpic>; 222 - tbi-handle = <&tbi2>; 223 - phy-handle = <&phy3>; 224 - 225 - mdio@520 { 226 - #address-cells = <1>; 227 - #size-cells = <0>; 228 - compatible = "fsl,gianfar-tbi"; 229 - reg = <0x520 0x20>; 230 - 231 - tbi2: tbi-phy@11 { 232 - reg = <0x11>; 233 - device_type = "tbi-phy"; 234 - }; 235 - }; 236 - }; 237 - 238 - serial0: serial@4500 { 239 - cell-index = <0>; 240 - device_type = "serial"; 241 - compatible = "fsl,ns16550", "ns16550"; 242 - reg = <0x4500 0x100>; // reg base, size 243 - clock-frequency = <0>; // should we fill in in uboot? 244 - interrupts = <42 2>; 245 - interrupt-parent = <&mpic>; 246 - }; 247 - 248 - serial1: serial@4600 { 249 - cell-index = <1>; 250 - device_type = "serial"; 251 - compatible = "fsl,ns16550", "ns16550"; 252 - reg = <0x4600 0x100>; // reg base, size 253 - clock-frequency = <0>; // should we fill in in uboot? 254 - interrupts = <42 2>; 255 - interrupt-parent = <&mpic>; 256 - }; 257 - mpic: pic@40000 { 258 - interrupt-controller; 259 - #address-cells = <0>; 260 - #interrupt-cells = <2>; 261 - reg = <0x40000 0x40000>; 262 - compatible = "chrp,open-pic"; 263 - device_type = "open-pic"; 264 - }; 265 - }; 266 - 267 - pci0: pci@e0008000 { 268 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 269 - interrupt-map = < 270 - 271 - /* IDSEL 0x02 */ 272 - 0x1000 0x0 0x0 0x1 &mpic 0x1 0x1 273 - 0x1000 0x0 0x0 0x2 &mpic 0x2 0x1 274 - 0x1000 0x0 0x0 0x3 &mpic 0x3 0x1 275 - 0x1000 0x0 0x0 0x4 &mpic 0x4 0x1 276 - 277 - /* IDSEL 0x03 */ 278 - 0x1800 0x0 0x0 0x1 &mpic 0x4 0x1 279 - 0x1800 0x0 0x0 0x2 &mpic 0x1 0x1 280 - 0x1800 0x0 0x0 0x3 &mpic 0x2 0x1 281 - 0x1800 0x0 0x0 0x4 &mpic 0x3 0x1 282 - 283 - /* IDSEL 0x04 */ 284 - 0x2000 0x0 0x0 0x1 &mpic 0x3 0x1 285 - 0x2000 0x0 0x0 0x2 &mpic 0x4 0x1 286 - 0x2000 0x0 0x0 0x3 &mpic 0x1 0x1 287 - 0x2000 0x0 0x0 0x4 &mpic 0x2 0x1 288 - 289 - /* IDSEL 0x05 */ 290 - 0x2800 0x0 0x0 0x1 &mpic 0x2 0x1 291 - 0x2800 0x0 0x0 0x2 &mpic 0x3 0x1 292 - 0x2800 0x0 0x0 0x3 &mpic 0x4 0x1 293 - 0x2800 0x0 0x0 0x4 &mpic 0x1 0x1 294 - 295 - /* IDSEL 0x0c */ 296 - 0x6000 0x0 0x0 0x1 &mpic 0x1 0x1 297 - 0x6000 0x0 0x0 0x2 &mpic 0x2 0x1 298 - 0x6000 0x0 0x0 0x3 &mpic 0x3 0x1 299 - 0x6000 0x0 0x0 0x4 &mpic 0x4 0x1 300 - 301 - /* IDSEL 0x0d */ 302 - 0x6800 0x0 0x0 0x1 &mpic 0x4 0x1 303 - 0x6800 0x0 0x0 0x2 &mpic 0x1 0x1 304 - 0x6800 0x0 0x0 0x3 &mpic 0x2 0x1 305 - 0x6800 0x0 0x0 0x4 &mpic 0x3 0x1 306 - 307 - /* IDSEL 0x0e */ 308 - 0x7000 0x0 0x0 0x1 &mpic 0x3 0x1 309 - 0x7000 0x0 0x0 0x2 &mpic 0x4 0x1 310 - 0x7000 0x0 0x0 0x3 &mpic 0x1 0x1 311 - 0x7000 0x0 0x0 0x4 &mpic 0x2 0x1 312 - 313 - /* IDSEL 0x0f */ 314 - 0x7800 0x0 0x0 0x1 &mpic 0x2 0x1 315 - 0x7800 0x0 0x0 0x2 &mpic 0x3 0x1 316 - 0x7800 0x0 0x0 0x3 &mpic 0x4 0x1 317 - 0x7800 0x0 0x0 0x4 &mpic 0x1 0x1 318 - 319 - /* IDSEL 0x12 */ 320 - 0x9000 0x0 0x0 0x1 &mpic 0x1 0x1 321 - 0x9000 0x0 0x0 0x2 &mpic 0x2 0x1 322 - 0x9000 0x0 0x0 0x3 &mpic 0x3 0x1 323 - 0x9000 0x0 0x0 0x4 &mpic 0x4 0x1 324 - 325 - /* IDSEL 0x13 */ 326 - 0x9800 0x0 0x0 0x1 &mpic 0x4 0x1 327 - 0x9800 0x0 0x0 0x2 &mpic 0x1 0x1 328 - 0x9800 0x0 0x0 0x3 &mpic 0x2 0x1 329 - 0x9800 0x0 0x0 0x4 &mpic 0x3 0x1 330 - 331 - /* IDSEL 0x14 */ 332 - 0xa000 0x0 0x0 0x1 &mpic 0x3 0x1 333 - 0xa000 0x0 0x0 0x2 &mpic 0x4 0x1 334 - 0xa000 0x0 0x0 0x3 &mpic 0x1 0x1 335 - 0xa000 0x0 0x0 0x4 &mpic 0x2 0x1 336 - 337 - /* IDSEL 0x15 */ 338 - 0xa800 0x0 0x0 0x1 &mpic 0x2 0x1 339 - 0xa800 0x0 0x0 0x2 &mpic 0x3 0x1 340 - 0xa800 0x0 0x0 0x3 &mpic 0x4 0x1 341 - 0xa800 0x0 0x0 0x4 &mpic 0x1 0x1>; 342 - interrupt-parent = <&mpic>; 343 - interrupts = <24 2>; 344 - bus-range = <0 0>; 345 - ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 346 - 0x1000000 0x0 0x0 0xe2000000 0x0 0x100000>; 347 - clock-frequency = <66666666>; 348 - #interrupt-cells = <1>; 349 - #size-cells = <2>; 350 - #address-cells = <3>; 351 - reg = <0xe0008000 0x1000>; 352 - compatible = "fsl,mpc8540-pcix", "fsl,mpc8540-pci"; 353 - device_type = "pci"; 354 - }; 355 - };
-375
arch/powerpc/boot/dts/fsl/mpc8541cds.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC8541 CDS Device Tree Source 4 - * 5 - * Copyright 2006, 2008 Freescale Semiconductor Inc. 6 - */ 7 - 8 - /dts-v1/; 9 - 10 - /include/ "e500v1_power_isa.dtsi" 11 - 12 - / { 13 - model = "MPC8541CDS"; 14 - compatible = "MPC8541CDS", "MPC85xxCDS"; 15 - #address-cells = <1>; 16 - #size-cells = <1>; 17 - 18 - aliases { 19 - ethernet0 = &enet0; 20 - ethernet1 = &enet1; 21 - serial0 = &serial0; 22 - serial1 = &serial1; 23 - pci0 = &pci0; 24 - pci1 = &pci1; 25 - }; 26 - 27 - cpus { 28 - #address-cells = <1>; 29 - #size-cells = <0>; 30 - 31 - PowerPC,8541@0 { 32 - device_type = "cpu"; 33 - reg = <0x0>; 34 - d-cache-line-size = <32>; // 32 bytes 35 - i-cache-line-size = <32>; // 32 bytes 36 - d-cache-size = <0x8000>; // L1, 32K 37 - i-cache-size = <0x8000>; // L1, 32K 38 - timebase-frequency = <0>; // 33 MHz, from uboot 39 - bus-frequency = <0>; // 166 MHz 40 - clock-frequency = <0>; // 825 MHz, from uboot 41 - next-level-cache = <&L2>; 42 - }; 43 - }; 44 - 45 - memory { 46 - device_type = "memory"; 47 - reg = <0x0 0x8000000>; // 128M at 0x0 48 - }; 49 - 50 - soc8541@e0000000 { 51 - #address-cells = <1>; 52 - #size-cells = <1>; 53 - device_type = "soc"; 54 - compatible = "simple-bus"; 55 - ranges = <0x0 0xe0000000 0x100000>; 56 - bus-frequency = <0>; 57 - 58 - ecm-law@0 { 59 - compatible = "fsl,ecm-law"; 60 - reg = <0x0 0x1000>; 61 - fsl,num-laws = <8>; 62 - }; 63 - 64 - ecm@1000 { 65 - compatible = "fsl,mpc8541-ecm", "fsl,ecm"; 66 - reg = <0x1000 0x1000>; 67 - interrupts = <17 2>; 68 - interrupt-parent = <&mpic>; 69 - }; 70 - 71 - memory-controller@2000 { 72 - compatible = "fsl,mpc8541-memory-controller"; 73 - reg = <0x2000 0x1000>; 74 - interrupt-parent = <&mpic>; 75 - interrupts = <18 2>; 76 - }; 77 - 78 - L2: l2-cache-controller@20000 { 79 - compatible = "fsl,mpc8541-l2-cache-controller"; 80 - reg = <0x20000 0x1000>; 81 - cache-line-size = <32>; // 32 bytes 82 - cache-size = <0x40000>; // L2, 256K 83 - interrupt-parent = <&mpic>; 84 - interrupts = <16 2>; 85 - }; 86 - 87 - i2c@3000 { 88 - #address-cells = <1>; 89 - #size-cells = <0>; 90 - cell-index = <0>; 91 - compatible = "fsl-i2c"; 92 - reg = <0x3000 0x100>; 93 - interrupts = <43 2>; 94 - interrupt-parent = <&mpic>; 95 - dfsrr; 96 - }; 97 - 98 - dma@21300 { 99 - #address-cells = <1>; 100 - #size-cells = <1>; 101 - compatible = "fsl,mpc8541-dma", "fsl,eloplus-dma"; 102 - reg = <0x21300 0x4>; 103 - ranges = <0x0 0x21100 0x200>; 104 - cell-index = <0>; 105 - dma-channel@0 { 106 - compatible = "fsl,mpc8541-dma-channel", 107 - "fsl,eloplus-dma-channel"; 108 - reg = <0x0 0x80>; 109 - cell-index = <0>; 110 - interrupt-parent = <&mpic>; 111 - interrupts = <20 2>; 112 - }; 113 - dma-channel@80 { 114 - compatible = "fsl,mpc8541-dma-channel", 115 - "fsl,eloplus-dma-channel"; 116 - reg = <0x80 0x80>; 117 - cell-index = <1>; 118 - interrupt-parent = <&mpic>; 119 - interrupts = <21 2>; 120 - }; 121 - dma-channel@100 { 122 - compatible = "fsl,mpc8541-dma-channel", 123 - "fsl,eloplus-dma-channel"; 124 - reg = <0x100 0x80>; 125 - cell-index = <2>; 126 - interrupt-parent = <&mpic>; 127 - interrupts = <22 2>; 128 - }; 129 - dma-channel@180 { 130 - compatible = "fsl,mpc8541-dma-channel", 131 - "fsl,eloplus-dma-channel"; 132 - reg = <0x180 0x80>; 133 - cell-index = <3>; 134 - interrupt-parent = <&mpic>; 135 - interrupts = <23 2>; 136 - }; 137 - }; 138 - 139 - enet0: ethernet@24000 { 140 - #address-cells = <1>; 141 - #size-cells = <1>; 142 - cell-index = <0>; 143 - device_type = "network"; 144 - model = "TSEC"; 145 - compatible = "gianfar"; 146 - reg = <0x24000 0x1000>; 147 - ranges = <0x0 0x24000 0x1000>; 148 - local-mac-address = [ 00 00 00 00 00 00 ]; 149 - interrupts = <29 2 30 2 34 2>; 150 - interrupt-parent = <&mpic>; 151 - tbi-handle = <&tbi0>; 152 - phy-handle = <&phy0>; 153 - 154 - mdio@520 { 155 - #address-cells = <1>; 156 - #size-cells = <0>; 157 - compatible = "fsl,gianfar-mdio"; 158 - reg = <0x520 0x20>; 159 - 160 - phy0: ethernet-phy@0 { 161 - interrupt-parent = <&mpic>; 162 - interrupts = <5 1>; 163 - reg = <0x0>; 164 - }; 165 - phy1: ethernet-phy@1 { 166 - interrupt-parent = <&mpic>; 167 - interrupts = <5 1>; 168 - reg = <0x1>; 169 - }; 170 - tbi0: tbi-phy@11 { 171 - reg = <0x11>; 172 - device_type = "tbi-phy"; 173 - }; 174 - }; 175 - }; 176 - 177 - enet1: ethernet@25000 { 178 - #address-cells = <1>; 179 - #size-cells = <1>; 180 - cell-index = <1>; 181 - device_type = "network"; 182 - model = "TSEC"; 183 - compatible = "gianfar"; 184 - reg = <0x25000 0x1000>; 185 - ranges = <0x0 0x25000 0x1000>; 186 - local-mac-address = [ 00 00 00 00 00 00 ]; 187 - interrupts = <35 2 36 2 40 2>; 188 - interrupt-parent = <&mpic>; 189 - tbi-handle = <&tbi1>; 190 - phy-handle = <&phy1>; 191 - 192 - mdio@520 { 193 - #address-cells = <1>; 194 - #size-cells = <0>; 195 - compatible = "fsl,gianfar-tbi"; 196 - reg = <0x520 0x20>; 197 - 198 - tbi1: tbi-phy@11 { 199 - reg = <0x11>; 200 - device_type = "tbi-phy"; 201 - }; 202 - }; 203 - }; 204 - 205 - serial0: serial@4500 { 206 - cell-index = <0>; 207 - device_type = "serial"; 208 - compatible = "fsl,ns16550", "ns16550"; 209 - reg = <0x4500 0x100>; // reg base, size 210 - clock-frequency = <0>; // should we fill in in uboot? 211 - interrupts = <42 2>; 212 - interrupt-parent = <&mpic>; 213 - }; 214 - 215 - serial1: serial@4600 { 216 - cell-index = <1>; 217 - device_type = "serial"; 218 - compatible = "fsl,ns16550", "ns16550"; 219 - reg = <0x4600 0x100>; // reg base, size 220 - clock-frequency = <0>; // should we fill in in uboot? 221 - interrupts = <42 2>; 222 - interrupt-parent = <&mpic>; 223 - }; 224 - 225 - crypto@30000 { 226 - compatible = "fsl,sec2.0"; 227 - reg = <0x30000 0x10000>; 228 - interrupts = <45 2>; 229 - interrupt-parent = <&mpic>; 230 - fsl,num-channels = <4>; 231 - fsl,channel-fifo-len = <24>; 232 - fsl,exec-units-mask = <0x7e>; 233 - fsl,descriptor-types-mask = <0x01010ebf>; 234 - }; 235 - 236 - mpic: pic@40000 { 237 - interrupt-controller; 238 - #address-cells = <0>; 239 - #interrupt-cells = <2>; 240 - reg = <0x40000 0x40000>; 241 - compatible = "chrp,open-pic"; 242 - device_type = "open-pic"; 243 - }; 244 - 245 - cpm@919c0 { 246 - #address-cells = <1>; 247 - #size-cells = <1>; 248 - compatible = "fsl,mpc8541-cpm", "fsl,cpm2"; 249 - reg = <0x919c0 0x30>; 250 - ranges; 251 - 252 - muram@80000 { 253 - #address-cells = <1>; 254 - #size-cells = <1>; 255 - ranges = <0x0 0x80000 0x10000>; 256 - 257 - data@0 { 258 - compatible = "fsl,cpm-muram-data"; 259 - reg = <0x0 0x2000 0x9000 0x1000>; 260 - }; 261 - }; 262 - 263 - brg@919f0 { 264 - compatible = "fsl,mpc8541-brg", 265 - "fsl,cpm2-brg", 266 - "fsl,cpm-brg"; 267 - reg = <0x919f0 0x10 0x915f0 0x10>; 268 - }; 269 - 270 - cpmpic: pic@90c00 { 271 - interrupt-controller; 272 - #address-cells = <0>; 273 - #interrupt-cells = <2>; 274 - interrupts = <46 2>; 275 - interrupt-parent = <&mpic>; 276 - reg = <0x90c00 0x80>; 277 - compatible = "fsl,mpc8541-cpm-pic", "fsl,cpm2-pic"; 278 - }; 279 - }; 280 - }; 281 - 282 - pci0: pci@e0008000 { 283 - interrupt-map-mask = <0x1f800 0x0 0x0 0x7>; 284 - interrupt-map = < 285 - 286 - /* IDSEL 0x10 */ 287 - 0x8000 0x0 0x0 0x1 &mpic 0x0 0x1 288 - 0x8000 0x0 0x0 0x2 &mpic 0x1 0x1 289 - 0x8000 0x0 0x0 0x3 &mpic 0x2 0x1 290 - 0x8000 0x0 0x0 0x4 &mpic 0x3 0x1 291 - 292 - /* IDSEL 0x11 */ 293 - 0x8800 0x0 0x0 0x1 &mpic 0x0 0x1 294 - 0x8800 0x0 0x0 0x2 &mpic 0x1 0x1 295 - 0x8800 0x0 0x0 0x3 &mpic 0x2 0x1 296 - 0x8800 0x0 0x0 0x4 &mpic 0x3 0x1 297 - 298 - /* IDSEL 0x12 (Slot 1) */ 299 - 0x9000 0x0 0x0 0x1 &mpic 0x0 0x1 300 - 0x9000 0x0 0x0 0x2 &mpic 0x1 0x1 301 - 0x9000 0x0 0x0 0x3 &mpic 0x2 0x1 302 - 0x9000 0x0 0x0 0x4 &mpic 0x3 0x1 303 - 304 - /* IDSEL 0x13 (Slot 2) */ 305 - 0x9800 0x0 0x0 0x1 &mpic 0x1 0x1 306 - 0x9800 0x0 0x0 0x2 &mpic 0x2 0x1 307 - 0x9800 0x0 0x0 0x3 &mpic 0x3 0x1 308 - 0x9800 0x0 0x0 0x4 &mpic 0x0 0x1 309 - 310 - /* IDSEL 0x14 (Slot 3) */ 311 - 0xa000 0x0 0x0 0x1 &mpic 0x2 0x1 312 - 0xa000 0x0 0x0 0x2 &mpic 0x3 0x1 313 - 0xa000 0x0 0x0 0x3 &mpic 0x0 0x1 314 - 0xa000 0x0 0x0 0x4 &mpic 0x1 0x1 315 - 316 - /* IDSEL 0x15 (Slot 4) */ 317 - 0xa800 0x0 0x0 0x1 &mpic 0x3 0x1 318 - 0xa800 0x0 0x0 0x2 &mpic 0x0 0x1 319 - 0xa800 0x0 0x0 0x3 &mpic 0x1 0x1 320 - 0xa800 0x0 0x0 0x4 &mpic 0x2 0x1 321 - 322 - /* Bus 1 (Tundra Bridge) */ 323 - /* IDSEL 0x12 (ISA bridge) */ 324 - 0x19000 0x0 0x0 0x1 &mpic 0x0 0x1 325 - 0x19000 0x0 0x0 0x2 &mpic 0x1 0x1 326 - 0x19000 0x0 0x0 0x3 &mpic 0x2 0x1 327 - 0x19000 0x0 0x0 0x4 &mpic 0x3 0x1>; 328 - interrupt-parent = <&mpic>; 329 - interrupts = <24 2>; 330 - bus-range = <0 0>; 331 - ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 332 - 0x1000000 0x0 0x0 0xe2000000 0x0 0x100000>; 333 - clock-frequency = <66666666>; 334 - #interrupt-cells = <1>; 335 - #size-cells = <2>; 336 - #address-cells = <3>; 337 - reg = <0xe0008000 0x1000>; 338 - compatible = "fsl,mpc8540-pci"; 339 - device_type = "pci"; 340 - 341 - i8259@19000 { 342 - interrupt-controller; 343 - device_type = "interrupt-controller"; 344 - reg = <0x19000 0x0 0x0 0x0 0x1>; 345 - #address-cells = <0>; 346 - #interrupt-cells = <2>; 347 - compatible = "chrp,iic"; 348 - interrupts = <1>; 349 - interrupt-parent = <&pci0>; 350 - }; 351 - }; 352 - 353 - pci1: pci@e0009000 { 354 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 355 - interrupt-map = < 356 - 357 - /* IDSEL 0x15 */ 358 - 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 359 - 0xa800 0x0 0x0 0x2 &mpic 0xb 0x1 360 - 0xa800 0x0 0x0 0x3 &mpic 0xb 0x1 361 - 0xa800 0x0 0x0 0x4 &mpic 0xb 0x1>; 362 - interrupt-parent = <&mpic>; 363 - interrupts = <25 2>; 364 - bus-range = <0 0>; 365 - ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x20000000 366 - 0x1000000 0x0 0x0 0xe3000000 0x0 0x100000>; 367 - clock-frequency = <66666666>; 368 - #interrupt-cells = <1>; 369 - #size-cells = <2>; 370 - #address-cells = <3>; 371 - reg = <0xe0009000 0x1000>; 372 - compatible = "fsl,mpc8540-pci"; 373 - device_type = "pci"; 374 - }; 375 - };
-302
arch/powerpc/boot/dts/fsl/mpc8548cds.dtsi
··· 1 - /* 2 - * MPC8548CDS Device Tree Source stub (no addresses or top-level ranges) 3 - * 4 - * Copyright 2012 Freescale Semiconductor Inc. 5 - * 6 - * Redistribution and use in source and binary forms, with or without 7 - * modification, are permitted provided that the following conditions are met: 8 - * * Redistributions of source code must retain the above copyright 9 - * notice, this list of conditions and the following disclaimer. 10 - * * Redistributions in binary form must reproduce the above copyright 11 - * notice, this list of conditions and the following disclaimer in the 12 - * documentation and/or other materials provided with the distribution. 13 - * * Neither the name of Freescale Semiconductor nor the 14 - * names of its contributors may be used to endorse or promote products 15 - * derived from this software without specific prior written permission. 16 - * 17 - * 18 - * ALTERNATIVELY, this software may be distributed under the terms of the 19 - * GNU General Public License ("GPL") as published by the Free Software 20 - * Foundation, either version 2 of that License or (at your option) any 21 - * later version. 22 - * 23 - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 24 - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 - */ 34 - 35 - &board_lbc { 36 - nor@0,0 { 37 - #address-cells = <1>; 38 - #size-cells = <1>; 39 - compatible = "cfi-flash"; 40 - reg = <0x0 0x0 0x01000000>; 41 - bank-width = <2>; 42 - device-width = <2>; 43 - 44 - partition@0 { 45 - reg = <0x0 0x0b00000>; 46 - label = "ramdisk-nor"; 47 - }; 48 - 49 - partition@300000 { 50 - reg = <0x0b00000 0x0400000>; 51 - label = "kernel-nor"; 52 - }; 53 - 54 - partition@700000 { 55 - reg = <0x0f00000 0x060000>; 56 - label = "dtb-nor"; 57 - }; 58 - 59 - partition@760000 { 60 - reg = <0x0f60000 0x020000>; 61 - label = "env-nor"; 62 - read-only; 63 - }; 64 - 65 - partition@780000 { 66 - reg = <0x0f80000 0x080000>; 67 - label = "u-boot-nor"; 68 - read-only; 69 - }; 70 - }; 71 - 72 - board-control@1,0 { 73 - compatible = "fsl,mpc8548cds-fpga"; 74 - reg = <0x1 0x0 0x1000>; 75 - }; 76 - }; 77 - 78 - &board_soc { 79 - i2c@3000 { 80 - eeprom@50 { 81 - compatible = "atmel,24c64"; 82 - reg = <0x50>; 83 - }; 84 - 85 - eeprom@56 { 86 - compatible = "atmel,24c64"; 87 - reg = <0x56>; 88 - }; 89 - 90 - eeprom@57 { 91 - compatible = "atmel,24c64"; 92 - reg = <0x57>; 93 - }; 94 - }; 95 - 96 - i2c@3100 { 97 - eeprom@50 { 98 - compatible = "atmel,24c64"; 99 - reg = <0x50>; 100 - }; 101 - }; 102 - 103 - enet0: ethernet@24000 { 104 - tbi-handle = <&tbi0>; 105 - phy-handle = <&phy0>; 106 - }; 107 - 108 - mdio@24520 { 109 - phy0: ethernet-phy@0 { 110 - interrupts = <5 1 0 0>; 111 - reg = <0x0>; 112 - }; 113 - phy1: ethernet-phy@1 { 114 - interrupts = <5 1 0 0>; 115 - reg = <0x1>; 116 - }; 117 - phy2: ethernet-phy@2 { 118 - interrupts = <5 1 0 0>; 119 - reg = <0x2>; 120 - }; 121 - phy3: ethernet-phy@3 { 122 - interrupts = <5 1 0 0>; 123 - reg = <0x3>; 124 - }; 125 - tbi0: tbi-phy@11 { 126 - reg = <0x11>; 127 - device_type = "tbi-phy"; 128 - }; 129 - }; 130 - 131 - enet1: ethernet@25000 { 132 - tbi-handle = <&tbi1>; 133 - phy-handle = <&phy1>; 134 - }; 135 - 136 - mdio@25520 { 137 - tbi1: tbi-phy@11 { 138 - reg = <0x11>; 139 - device_type = "tbi-phy"; 140 - }; 141 - }; 142 - 143 - enet2: ethernet@26000 { 144 - tbi-handle = <&tbi2>; 145 - phy-handle = <&phy2>; 146 - }; 147 - 148 - mdio@26520 { 149 - tbi2: tbi-phy@11 { 150 - reg = <0x11>; 151 - device_type = "tbi-phy"; 152 - }; 153 - }; 154 - 155 - enet3: ethernet@27000 { 156 - tbi-handle = <&tbi3>; 157 - phy-handle = <&phy3>; 158 - }; 159 - 160 - mdio@27520 { 161 - tbi3: tbi-phy@11 { 162 - reg = <0x11>; 163 - device_type = "tbi-phy"; 164 - }; 165 - }; 166 - }; 167 - 168 - &board_pci0 { 169 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 170 - interrupt-map = < 171 - /* IDSEL 0x4 (PCIX Slot 2) */ 172 - 0x2000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 173 - 0x2000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 174 - 0x2000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 175 - 0x2000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 176 - 177 - /* IDSEL 0x5 (PCIX Slot 3) */ 178 - 0x2800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0 179 - 0x2800 0x0 0x0 0x2 &mpic 0x2 0x1 0 0 180 - 0x2800 0x0 0x0 0x3 &mpic 0x3 0x1 0 0 181 - 0x2800 0x0 0x0 0x4 &mpic 0x0 0x1 0 0 182 - 183 - /* IDSEL 0x6 (PCIX Slot 4) */ 184 - 0x3000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0 185 - 0x3000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0 186 - 0x3000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0 187 - 0x3000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0 188 - 189 - /* IDSEL 0x8 (PCIX Slot 5) */ 190 - 0x4000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 191 - 0x4000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 192 - 0x4000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 193 - 0x4000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 194 - 195 - /* IDSEL 0xC (Tsi310 bridge) */ 196 - 0x6000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 197 - 0x6000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 198 - 0x6000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 199 - 0x6000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 200 - 201 - /* IDSEL 0x14 (Slot 2) */ 202 - 0xa000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 203 - 0xa000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 204 - 0xa000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 205 - 0xa000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 206 - 207 - /* IDSEL 0x15 (Slot 3) */ 208 - 0xa800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0 209 - 0xa800 0x0 0x0 0x2 &mpic 0x2 0x1 0 0 210 - 0xa800 0x0 0x0 0x3 &mpic 0x3 0x1 0 0 211 - 0xa800 0x0 0x0 0x4 &mpic 0x0 0x1 0 0 212 - 213 - /* IDSEL 0x16 (Slot 4) */ 214 - 0xb000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0 215 - 0xb000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0 216 - 0xb000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0 217 - 0xb000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0 218 - 219 - /* IDSEL 0x18 (Slot 5) */ 220 - 0xc000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 221 - 0xc000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 222 - 0xc000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 223 - 0xc000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 224 - 225 - /* IDSEL 0x1C (Tsi310 bridge PCI primary) */ 226 - 0xe000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 227 - 0xe000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 228 - 0xe000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 229 - 0xe000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>; 230 - 231 - pci_bridge@1c { 232 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 233 - interrupt-map = < 234 - 235 - /* IDSEL 0x00 (PrPMC Site) */ 236 - 0000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 237 - 0000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 238 - 0000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 239 - 0000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 240 - 241 - /* IDSEL 0x04 (VIA chip) */ 242 - 0x2000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0 243 - 0x2000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 244 - 0x2000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 245 - 0x2000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0 246 - 247 - /* IDSEL 0x05 (8139) */ 248 - 0x2800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0 249 - 250 - /* IDSEL 0x06 (Slot 6) */ 251 - 0x3000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0 252 - 0x3000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0 253 - 0x3000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0 254 - 0x3000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0 255 - 256 - /* IDESL 0x07 (Slot 7) */ 257 - 0x3800 0x0 0x0 0x1 &mpic 0x3 0x1 0 0 258 - 0x3800 0x0 0x0 0x2 &mpic 0x0 0x1 0 0 259 - 0x3800 0x0 0x0 0x3 &mpic 0x1 0x1 0 0 260 - 0x3800 0x0 0x0 0x4 &mpic 0x2 0x1 0 0>; 261 - 262 - reg = <0xe000 0x0 0x0 0x0 0x0>; 263 - #interrupt-cells = <1>; 264 - #size-cells = <2>; 265 - #address-cells = <3>; 266 - ranges = <0x2000000 0x0 0x80000000 267 - 0x2000000 0x0 0x80000000 268 - 0x0 0x20000000 269 - 0x1000000 0x0 0x0 270 - 0x1000000 0x0 0x0 271 - 0x0 0x80000>; 272 - clock-frequency = <33333333>; 273 - 274 - isa@4 { 275 - device_type = "isa"; 276 - #interrupt-cells = <2>; 277 - #size-cells = <1>; 278 - #address-cells = <2>; 279 - reg = <0x2000 0x0 0x0 0x0 0x0>; 280 - ranges = <0x1 0x0 0x1000000 0x0 0x0 0x1000>; 281 - interrupt-parent = <&i8259>; 282 - 283 - i8259: interrupt-controller@20 { 284 - interrupt-controller; 285 - device_type = "interrupt-controller"; 286 - reg = <0x1 0x20 0x2 287 - 0x1 0xa0 0x2 288 - 0x1 0x4d0 0x2>; 289 - #address-cells = <0>; 290 - #interrupt-cells = <2>; 291 - compatible = "chrp,iic"; 292 - interrupts = <0 1 0 0>; 293 - interrupt-parent = <&mpic>; 294 - }; 295 - 296 - rtc@70 { 297 - compatible = "pnpPNP,b00"; 298 - reg = <0x1 0x70 0x2>; 299 - }; 300 - }; 301 - }; 302 - };
-82
arch/powerpc/boot/dts/fsl/mpc8548cds_32b.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC8548 CDS Device Tree Source (32-bit address map) 4 - * 5 - * Copyright 2006, 2008, 2011-2012 Freescale Semiconductor Inc. 6 - */ 7 - 8 - /include/ "mpc8548si-pre.dtsi" 9 - 10 - / { 11 - model = "MPC8548CDS"; 12 - compatible = "MPC8548CDS", "MPC85xxCDS"; 13 - 14 - memory { 15 - device_type = "memory"; 16 - reg = <0 0 0x0 0x8000000>; // 128M at 0x0 17 - }; 18 - 19 - board_lbc: lbc: localbus@e0005000 { 20 - reg = <0 0xe0005000 0 0x1000>; 21 - 22 - ranges = <0x0 0x0 0x0 0xff000000 0x01000000 23 - 0x1 0x0 0x0 0xf8004000 0x00001000>; 24 - 25 - }; 26 - 27 - board_soc: soc: soc8548@e0000000 { 28 - ranges = <0 0x0 0xe0000000 0x100000>; 29 - }; 30 - 31 - board_pci0: pci0: pci@e0008000 { 32 - reg = <0 0xe0008000 0 0x1000>; 33 - ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x10000000 34 - 0x1000000 0x0 0x00000000 0 0xe2000000 0x0 0x800000>; 35 - clock-frequency = <66666666>; 36 - }; 37 - 38 - pci1: pci@e0009000 { 39 - reg = <0 0xe0009000 0 0x1000>; 40 - ranges = <0x2000000 0x0 0x90000000 0 0x90000000 0x0 0x10000000 41 - 0x1000000 0x0 0x00000000 0 0xe2800000 0x0 0x800000>; 42 - clock-frequency = <66666666>; 43 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 44 - interrupt-map = < 45 - 46 - /* IDSEL 0x15 */ 47 - 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 0 0 48 - 0xa800 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 49 - 0xa800 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 50 - 0xa800 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>; 51 - }; 52 - 53 - pci2: pcie@e000a000 { 54 - reg = <0 0xe000a000 0 0x1000>; 55 - ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000 56 - 0x1000000 0x0 0x00000000 0 0xe3000000 0x0 0x100000>; 57 - pcie@0 { 58 - ranges = <0x2000000 0x0 0xa0000000 59 - 0x2000000 0x0 0xa0000000 60 - 0x0 0x20000000 61 - 62 - 0x1000000 0x0 0x0 63 - 0x1000000 0x0 0x0 64 - 0x0 0x100000>; 65 - }; 66 - }; 67 - 68 - rio: rapidio@e00c0000 { 69 - reg = <0x0 0xe00c0000 0x0 0x20000>; 70 - port1 { 71 - ranges = <0x0 0x0 0x0 0xc0000000 0x0 0x20000000>; 72 - }; 73 - }; 74 - }; 75 - 76 - /* 77 - * mpc8548cds.dtsi must be last to ensure board_pci0 overrides pci0 settings 78 - * for interrupt-map & interrupt-map-mask. 79 - */ 80 - 81 - /include/ "mpc8548si-post.dtsi" 82 - /include/ "mpc8548cds.dtsi"
-82
arch/powerpc/boot/dts/fsl/mpc8548cds_36b.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC8548 CDS Device Tree Source (36-bit address map) 4 - * 5 - * Copyright 2012 Freescale Semiconductor Inc. 6 - */ 7 - 8 - /include/ "mpc8548si-pre.dtsi" 9 - 10 - / { 11 - model = "MPC8548CDS"; 12 - compatible = "MPC8548CDS", "MPC85xxCDS"; 13 - 14 - memory { 15 - device_type = "memory"; 16 - reg = <0 0 0x0 0x8000000>; // 128M at 0x0 17 - }; 18 - 19 - board_lbc: lbc: localbus@fe0005000 { 20 - reg = <0xf 0xe0005000 0 0x1000>; 21 - 22 - ranges = <0x0 0x0 0xf 0xff000000 0x01000000 23 - 0x1 0x0 0xf 0xf8004000 0x00001000>; 24 - 25 - }; 26 - 27 - board_soc: soc: soc8548@fe0000000 { 28 - ranges = <0 0xf 0xe0000000 0x100000>; 29 - }; 30 - 31 - board_pci0: pci0: pci@fe0008000 { 32 - reg = <0xf 0xe0008000 0 0x1000>; 33 - ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x10000000 34 - 0x1000000 0x0 0x00000000 0xf 0xe2000000 0x0 0x800000>; 35 - clock-frequency = <66666666>; 36 - }; 37 - 38 - pci1: pci@fe0009000 { 39 - reg = <0xf 0xe0009000 0 0x1000>; 40 - ranges = <0x2000000 0x0 0xe0000000 0xc 0x10000000 0x0 0x10000000 41 - 0x1000000 0x0 0x00000000 0xf 0xe2800000 0x0 0x800000>; 42 - clock-frequency = <66666666>; 43 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 44 - interrupt-map = < 45 - 46 - /* IDSEL 0x15 */ 47 - 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 0 0 48 - 0xa800 0x0 0x0 0x2 &mpic 0x1 0x1 0 0 49 - 0xa800 0x0 0x0 0x3 &mpic 0x2 0x1 0 0 50 - 0xa800 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>; 51 - }; 52 - 53 - pci2: pcie@fe000a000 { 54 - reg = <0xf 0xe000a000 0 0x1000>; 55 - ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 56 - 0x1000000 0x0 0x00000000 0xf 0xe3000000 0x0 0x100000>; 57 - pcie@0 { 58 - ranges = <0x2000000 0x0 0xa0000000 59 - 0x2000000 0x0 0xa0000000 60 - 0x0 0x20000000 61 - 62 - 0x1000000 0x0 0x0 63 - 0x1000000 0x0 0x0 64 - 0x0 0x100000>; 65 - }; 66 - }; 67 - 68 - rio: rapidio@fe00c0000 { 69 - reg = <0xf 0xe00c0000 0x0 0x20000>; 70 - port1 { 71 - ranges = <0x0 0x0 0xc 0x40000000 0x0 0x20000000>; 72 - }; 73 - }; 74 - }; 75 - 76 - /* 77 - * mpc8548cds.dtsi must be last to ensure board_pci0 overrides pci0 settings 78 - * for interrupt-map & interrupt-map-mask. 79 - */ 80 - 81 - /include/ "mpc8548si-post.dtsi" 82 - /include/ "mpc8548cds.dtsi"
-375
arch/powerpc/boot/dts/fsl/mpc8555cds.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC8555 CDS Device Tree Source 4 - * 5 - * Copyright 2006, 2008 Freescale Semiconductor Inc. 6 - */ 7 - 8 - /dts-v1/; 9 - 10 - /include/ "e500v1_power_isa.dtsi" 11 - 12 - / { 13 - model = "MPC8555CDS"; 14 - compatible = "MPC8555CDS", "MPC85xxCDS"; 15 - #address-cells = <1>; 16 - #size-cells = <1>; 17 - 18 - aliases { 19 - ethernet0 = &enet0; 20 - ethernet1 = &enet1; 21 - serial0 = &serial0; 22 - serial1 = &serial1; 23 - pci0 = &pci0; 24 - pci1 = &pci1; 25 - }; 26 - 27 - cpus { 28 - #address-cells = <1>; 29 - #size-cells = <0>; 30 - 31 - PowerPC,8555@0 { 32 - device_type = "cpu"; 33 - reg = <0x0>; 34 - d-cache-line-size = <32>; // 32 bytes 35 - i-cache-line-size = <32>; // 32 bytes 36 - d-cache-size = <0x8000>; // L1, 32K 37 - i-cache-size = <0x8000>; // L1, 32K 38 - timebase-frequency = <0>; // 33 MHz, from uboot 39 - bus-frequency = <0>; // 166 MHz 40 - clock-frequency = <0>; // 825 MHz, from uboot 41 - next-level-cache = <&L2>; 42 - }; 43 - }; 44 - 45 - memory { 46 - device_type = "memory"; 47 - reg = <0x0 0x8000000>; // 128M at 0x0 48 - }; 49 - 50 - soc8555@e0000000 { 51 - #address-cells = <1>; 52 - #size-cells = <1>; 53 - device_type = "soc"; 54 - compatible = "simple-bus"; 55 - ranges = <0x0 0xe0000000 0x100000>; 56 - bus-frequency = <0>; 57 - 58 - ecm-law@0 { 59 - compatible = "fsl,ecm-law"; 60 - reg = <0x0 0x1000>; 61 - fsl,num-laws = <8>; 62 - }; 63 - 64 - ecm@1000 { 65 - compatible = "fsl,mpc8555-ecm", "fsl,ecm"; 66 - reg = <0x1000 0x1000>; 67 - interrupts = <17 2>; 68 - interrupt-parent = <&mpic>; 69 - }; 70 - 71 - memory-controller@2000 { 72 - compatible = "fsl,mpc8555-memory-controller"; 73 - reg = <0x2000 0x1000>; 74 - interrupt-parent = <&mpic>; 75 - interrupts = <18 2>; 76 - }; 77 - 78 - L2: l2-cache-controller@20000 { 79 - compatible = "fsl,mpc8555-l2-cache-controller"; 80 - reg = <0x20000 0x1000>; 81 - cache-line-size = <32>; // 32 bytes 82 - cache-size = <0x40000>; // L2, 256K 83 - interrupt-parent = <&mpic>; 84 - interrupts = <16 2>; 85 - }; 86 - 87 - i2c@3000 { 88 - #address-cells = <1>; 89 - #size-cells = <0>; 90 - cell-index = <0>; 91 - compatible = "fsl-i2c"; 92 - reg = <0x3000 0x100>; 93 - interrupts = <43 2>; 94 - interrupt-parent = <&mpic>; 95 - dfsrr; 96 - }; 97 - 98 - dma@21300 { 99 - #address-cells = <1>; 100 - #size-cells = <1>; 101 - compatible = "fsl,mpc8555-dma", "fsl,eloplus-dma"; 102 - reg = <0x21300 0x4>; 103 - ranges = <0x0 0x21100 0x200>; 104 - cell-index = <0>; 105 - dma-channel@0 { 106 - compatible = "fsl,mpc8555-dma-channel", 107 - "fsl,eloplus-dma-channel"; 108 - reg = <0x0 0x80>; 109 - cell-index = <0>; 110 - interrupt-parent = <&mpic>; 111 - interrupts = <20 2>; 112 - }; 113 - dma-channel@80 { 114 - compatible = "fsl,mpc8555-dma-channel", 115 - "fsl,eloplus-dma-channel"; 116 - reg = <0x80 0x80>; 117 - cell-index = <1>; 118 - interrupt-parent = <&mpic>; 119 - interrupts = <21 2>; 120 - }; 121 - dma-channel@100 { 122 - compatible = "fsl,mpc8555-dma-channel", 123 - "fsl,eloplus-dma-channel"; 124 - reg = <0x100 0x80>; 125 - cell-index = <2>; 126 - interrupt-parent = <&mpic>; 127 - interrupts = <22 2>; 128 - }; 129 - dma-channel@180 { 130 - compatible = "fsl,mpc8555-dma-channel", 131 - "fsl,eloplus-dma-channel"; 132 - reg = <0x180 0x80>; 133 - cell-index = <3>; 134 - interrupt-parent = <&mpic>; 135 - interrupts = <23 2>; 136 - }; 137 - }; 138 - 139 - enet0: ethernet@24000 { 140 - #address-cells = <1>; 141 - #size-cells = <1>; 142 - cell-index = <0>; 143 - device_type = "network"; 144 - model = "TSEC"; 145 - compatible = "gianfar"; 146 - reg = <0x24000 0x1000>; 147 - ranges = <0x0 0x24000 0x1000>; 148 - local-mac-address = [ 00 00 00 00 00 00 ]; 149 - interrupts = <29 2 30 2 34 2>; 150 - interrupt-parent = <&mpic>; 151 - tbi-handle = <&tbi0>; 152 - phy-handle = <&phy0>; 153 - 154 - mdio@520 { 155 - #address-cells = <1>; 156 - #size-cells = <0>; 157 - compatible = "fsl,gianfar-mdio"; 158 - reg = <0x520 0x20>; 159 - 160 - phy0: ethernet-phy@0 { 161 - interrupt-parent = <&mpic>; 162 - interrupts = <5 1>; 163 - reg = <0x0>; 164 - }; 165 - phy1: ethernet-phy@1 { 166 - interrupt-parent = <&mpic>; 167 - interrupts = <5 1>; 168 - reg = <0x1>; 169 - }; 170 - tbi0: tbi-phy@11 { 171 - reg = <0x11>; 172 - device_type = "tbi-phy"; 173 - }; 174 - }; 175 - }; 176 - 177 - enet1: ethernet@25000 { 178 - #address-cells = <1>; 179 - #size-cells = <1>; 180 - cell-index = <1>; 181 - device_type = "network"; 182 - model = "TSEC"; 183 - compatible = "gianfar"; 184 - reg = <0x25000 0x1000>; 185 - ranges = <0x0 0x25000 0x1000>; 186 - local-mac-address = [ 00 00 00 00 00 00 ]; 187 - interrupts = <35 2 36 2 40 2>; 188 - interrupt-parent = <&mpic>; 189 - tbi-handle = <&tbi1>; 190 - phy-handle = <&phy1>; 191 - 192 - mdio@520 { 193 - #address-cells = <1>; 194 - #size-cells = <0>; 195 - compatible = "fsl,gianfar-tbi"; 196 - reg = <0x520 0x20>; 197 - 198 - tbi1: tbi-phy@11 { 199 - reg = <0x11>; 200 - device_type = "tbi-phy"; 201 - }; 202 - }; 203 - }; 204 - 205 - serial0: serial@4500 { 206 - cell-index = <0>; 207 - device_type = "serial"; 208 - compatible = "fsl,ns16550", "ns16550"; 209 - reg = <0x4500 0x100>; // reg base, size 210 - clock-frequency = <0>; // should we fill in in uboot? 211 - interrupts = <42 2>; 212 - interrupt-parent = <&mpic>; 213 - }; 214 - 215 - serial1: serial@4600 { 216 - cell-index = <1>; 217 - device_type = "serial"; 218 - compatible = "fsl,ns16550", "ns16550"; 219 - reg = <0x4600 0x100>; // reg base, size 220 - clock-frequency = <0>; // should we fill in in uboot? 221 - interrupts = <42 2>; 222 - interrupt-parent = <&mpic>; 223 - }; 224 - 225 - crypto@30000 { 226 - compatible = "fsl,sec2.0"; 227 - reg = <0x30000 0x10000>; 228 - interrupts = <45 2>; 229 - interrupt-parent = <&mpic>; 230 - fsl,num-channels = <4>; 231 - fsl,channel-fifo-len = <24>; 232 - fsl,exec-units-mask = <0x7e>; 233 - fsl,descriptor-types-mask = <0x01010ebf>; 234 - }; 235 - 236 - mpic: pic@40000 { 237 - interrupt-controller; 238 - #address-cells = <0>; 239 - #interrupt-cells = <2>; 240 - reg = <0x40000 0x40000>; 241 - compatible = "chrp,open-pic"; 242 - device_type = "open-pic"; 243 - }; 244 - 245 - cpm@919c0 { 246 - #address-cells = <1>; 247 - #size-cells = <1>; 248 - compatible = "fsl,mpc8555-cpm", "fsl,cpm2"; 249 - reg = <0x919c0 0x30>; 250 - ranges; 251 - 252 - muram@80000 { 253 - #address-cells = <1>; 254 - #size-cells = <1>; 255 - ranges = <0x0 0x80000 0x10000>; 256 - 257 - data@0 { 258 - compatible = "fsl,cpm-muram-data"; 259 - reg = <0x0 0x2000 0x9000 0x1000>; 260 - }; 261 - }; 262 - 263 - brg@919f0 { 264 - compatible = "fsl,mpc8555-brg", 265 - "fsl,cpm2-brg", 266 - "fsl,cpm-brg"; 267 - reg = <0x919f0 0x10 0x915f0 0x10>; 268 - }; 269 - 270 - cpmpic: pic@90c00 { 271 - interrupt-controller; 272 - #address-cells = <0>; 273 - #interrupt-cells = <2>; 274 - interrupts = <46 2>; 275 - interrupt-parent = <&mpic>; 276 - reg = <0x90c00 0x80>; 277 - compatible = "fsl,mpc8555-cpm-pic", "fsl,cpm2-pic"; 278 - }; 279 - }; 280 - }; 281 - 282 - pci0: pci@e0008000 { 283 - interrupt-map-mask = <0x1f800 0x0 0x0 0x7>; 284 - interrupt-map = < 285 - 286 - /* IDSEL 0x10 */ 287 - 0x8000 0x0 0x0 0x1 &mpic 0x0 0x1 288 - 0x8000 0x0 0x0 0x2 &mpic 0x1 0x1 289 - 0x8000 0x0 0x0 0x3 &mpic 0x2 0x1 290 - 0x8000 0x0 0x0 0x4 &mpic 0x3 0x1 291 - 292 - /* IDSEL 0x11 */ 293 - 0x8800 0x0 0x0 0x1 &mpic 0x0 0x1 294 - 0x8800 0x0 0x0 0x2 &mpic 0x1 0x1 295 - 0x8800 0x0 0x0 0x3 &mpic 0x2 0x1 296 - 0x8800 0x0 0x0 0x4 &mpic 0x3 0x1 297 - 298 - /* IDSEL 0x12 (Slot 1) */ 299 - 0x9000 0x0 0x0 0x1 &mpic 0x0 0x1 300 - 0x9000 0x0 0x0 0x2 &mpic 0x1 0x1 301 - 0x9000 0x0 0x0 0x3 &mpic 0x2 0x1 302 - 0x9000 0x0 0x0 0x4 &mpic 0x3 0x1 303 - 304 - /* IDSEL 0x13 (Slot 2) */ 305 - 0x9800 0x0 0x0 0x1 &mpic 0x1 0x1 306 - 0x9800 0x0 0x0 0x2 &mpic 0x2 0x1 307 - 0x9800 0x0 0x0 0x3 &mpic 0x3 0x1 308 - 0x9800 0x0 0x0 0x4 &mpic 0x0 0x1 309 - 310 - /* IDSEL 0x14 (Slot 3) */ 311 - 0xa000 0x0 0x0 0x1 &mpic 0x2 0x1 312 - 0xa000 0x0 0x0 0x2 &mpic 0x3 0x1 313 - 0xa000 0x0 0x0 0x3 &mpic 0x0 0x1 314 - 0xa000 0x0 0x0 0x4 &mpic 0x1 0x1 315 - 316 - /* IDSEL 0x15 (Slot 4) */ 317 - 0xa800 0x0 0x0 0x1 &mpic 0x3 0x1 318 - 0xa800 0x0 0x0 0x2 &mpic 0x0 0x1 319 - 0xa800 0x0 0x0 0x3 &mpic 0x1 0x1 320 - 0xa800 0x0 0x0 0x4 &mpic 0x2 0x1 321 - 322 - /* Bus 1 (Tundra Bridge) */ 323 - /* IDSEL 0x12 (ISA bridge) */ 324 - 0x19000 0x0 0x0 0x1 &mpic 0x0 0x1 325 - 0x19000 0x0 0x0 0x2 &mpic 0x1 0x1 326 - 0x19000 0x0 0x0 0x3 &mpic 0x2 0x1 327 - 0x19000 0x0 0x0 0x4 &mpic 0x3 0x1>; 328 - interrupt-parent = <&mpic>; 329 - interrupts = <24 2>; 330 - bus-range = <0 0>; 331 - ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 332 - 0x1000000 0x0 0x0 0xe2000000 0x0 0x100000>; 333 - clock-frequency = <66666666>; 334 - #interrupt-cells = <1>; 335 - #size-cells = <2>; 336 - #address-cells = <3>; 337 - reg = <0xe0008000 0x1000>; 338 - compatible = "fsl,mpc8540-pci"; 339 - device_type = "pci"; 340 - 341 - i8259@19000 { 342 - interrupt-controller; 343 - device_type = "interrupt-controller"; 344 - reg = <0x19000 0x0 0x0 0x0 0x1>; 345 - #address-cells = <0>; 346 - #interrupt-cells = <2>; 347 - compatible = "chrp,iic"; 348 - interrupts = <1>; 349 - interrupt-parent = <&pci0>; 350 - }; 351 - }; 352 - 353 - pci1: pci@e0009000 { 354 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 355 - interrupt-map = < 356 - 357 - /* IDSEL 0x15 */ 358 - 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 359 - 0xa800 0x0 0x0 0x2 &mpic 0xb 0x1 360 - 0xa800 0x0 0x0 0x3 &mpic 0xb 0x1 361 - 0xa800 0x0 0x0 0x4 &mpic 0xb 0x1>; 362 - interrupt-parent = <&mpic>; 363 - interrupts = <25 2>; 364 - bus-range = <0 0>; 365 - ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x20000000 366 - 0x1000000 0x0 0x0 0xe3000000 0x0 0x100000>; 367 - clock-frequency = <66666666>; 368 - #interrupt-cells = <1>; 369 - #size-cells = <2>; 370 - #address-cells = <3>; 371 - reg = <0xe0009000 0x1000>; 372 - compatible = "fsl,mpc8540-pci"; 373 - device_type = "pci"; 374 - }; 375 - };
-388
arch/powerpc/boot/dts/fsl/mpc8560ads.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC8560 ADS Device Tree Source 4 - * 5 - * Copyright 2006, 2008 Freescale Semiconductor Inc. 6 - */ 7 - 8 - /dts-v1/; 9 - 10 - /include/ "e500v1_power_isa.dtsi" 11 - 12 - / { 13 - model = "MPC8560ADS"; 14 - compatible = "MPC8560ADS", "MPC85xxADS"; 15 - #address-cells = <1>; 16 - #size-cells = <1>; 17 - 18 - aliases { 19 - ethernet0 = &enet0; 20 - ethernet1 = &enet1; 21 - ethernet2 = &enet2; 22 - ethernet3 = &enet3; 23 - serial0 = &serial0; 24 - serial1 = &serial1; 25 - pci0 = &pci0; 26 - }; 27 - 28 - cpus { 29 - #address-cells = <1>; 30 - #size-cells = <0>; 31 - 32 - PowerPC,8560@0 { 33 - device_type = "cpu"; 34 - reg = <0x0>; 35 - d-cache-line-size = <32>; // 32 bytes 36 - i-cache-line-size = <32>; // 32 bytes 37 - d-cache-size = <0x8000>; // L1, 32K 38 - i-cache-size = <0x8000>; // L1, 32K 39 - timebase-frequency = <82500000>; 40 - bus-frequency = <330000000>; 41 - clock-frequency = <825000000>; 42 - }; 43 - }; 44 - 45 - memory { 46 - device_type = "memory"; 47 - reg = <0x0 0x10000000>; 48 - }; 49 - 50 - soc8560@e0000000 { 51 - #address-cells = <1>; 52 - #size-cells = <1>; 53 - device_type = "soc"; 54 - compatible = "simple-bus"; 55 - ranges = <0x0 0xe0000000 0x100000>; 56 - bus-frequency = <330000000>; 57 - 58 - ecm-law@0 { 59 - compatible = "fsl,ecm-law"; 60 - reg = <0x0 0x1000>; 61 - fsl,num-laws = <8>; 62 - }; 63 - 64 - ecm@1000 { 65 - compatible = "fsl,mpc8560-ecm", "fsl,ecm"; 66 - reg = <0x1000 0x1000>; 67 - interrupts = <17 2>; 68 - interrupt-parent = <&mpic>; 69 - }; 70 - 71 - memory-controller@2000 { 72 - compatible = "fsl,mpc8540-memory-controller"; 73 - reg = <0x2000 0x1000>; 74 - interrupt-parent = <&mpic>; 75 - interrupts = <18 2>; 76 - }; 77 - 78 - L2: l2-cache-controller@20000 { 79 - compatible = "fsl,mpc8540-l2-cache-controller"; 80 - reg = <0x20000 0x1000>; 81 - cache-line-size = <32>; // 32 bytes 82 - cache-size = <0x40000>; // L2, 256K 83 - interrupt-parent = <&mpic>; 84 - interrupts = <16 2>; 85 - }; 86 - 87 - dma@21300 { 88 - #address-cells = <1>; 89 - #size-cells = <1>; 90 - compatible = "fsl,mpc8560-dma", "fsl,eloplus-dma"; 91 - reg = <0x21300 0x4>; 92 - ranges = <0x0 0x21100 0x200>; 93 - cell-index = <0>; 94 - dma-channel@0 { 95 - compatible = "fsl,mpc8560-dma-channel", 96 - "fsl,eloplus-dma-channel"; 97 - reg = <0x0 0x80>; 98 - cell-index = <0>; 99 - interrupt-parent = <&mpic>; 100 - interrupts = <20 2>; 101 - }; 102 - dma-channel@80 { 103 - compatible = "fsl,mpc8560-dma-channel", 104 - "fsl,eloplus-dma-channel"; 105 - reg = <0x80 0x80>; 106 - cell-index = <1>; 107 - interrupt-parent = <&mpic>; 108 - interrupts = <21 2>; 109 - }; 110 - dma-channel@100 { 111 - compatible = "fsl,mpc8560-dma-channel", 112 - "fsl,eloplus-dma-channel"; 113 - reg = <0x100 0x80>; 114 - cell-index = <2>; 115 - interrupt-parent = <&mpic>; 116 - interrupts = <22 2>; 117 - }; 118 - dma-channel@180 { 119 - compatible = "fsl,mpc8560-dma-channel", 120 - "fsl,eloplus-dma-channel"; 121 - reg = <0x180 0x80>; 122 - cell-index = <3>; 123 - interrupt-parent = <&mpic>; 124 - interrupts = <23 2>; 125 - }; 126 - }; 127 - 128 - enet0: ethernet@24000 { 129 - #address-cells = <1>; 130 - #size-cells = <1>; 131 - cell-index = <0>; 132 - device_type = "network"; 133 - model = "TSEC"; 134 - compatible = "gianfar"; 135 - reg = <0x24000 0x1000>; 136 - ranges = <0x0 0x24000 0x1000>; 137 - local-mac-address = [ 00 00 00 00 00 00 ]; 138 - interrupts = <29 2 30 2 34 2>; 139 - interrupt-parent = <&mpic>; 140 - tbi-handle = <&tbi0>; 141 - phy-handle = <&phy0>; 142 - 143 - mdio@520 { 144 - #address-cells = <1>; 145 - #size-cells = <0>; 146 - compatible = "fsl,gianfar-mdio"; 147 - reg = <0x520 0x20>; 148 - 149 - phy0: ethernet-phy@0 { 150 - interrupt-parent = <&mpic>; 151 - interrupts = <5 1>; 152 - reg = <0x0>; 153 - }; 154 - phy1: ethernet-phy@1 { 155 - interrupt-parent = <&mpic>; 156 - interrupts = <5 1>; 157 - reg = <0x1>; 158 - }; 159 - phy2: ethernet-phy@2 { 160 - interrupt-parent = <&mpic>; 161 - interrupts = <7 1>; 162 - reg = <0x2>; 163 - }; 164 - phy3: ethernet-phy@3 { 165 - interrupt-parent = <&mpic>; 166 - interrupts = <7 1>; 167 - reg = <0x3>; 168 - }; 169 - tbi0: tbi-phy@11 { 170 - reg = <0x11>; 171 - device_type = "tbi-phy"; 172 - }; 173 - }; 174 - }; 175 - 176 - enet1: ethernet@25000 { 177 - #address-cells = <1>; 178 - #size-cells = <1>; 179 - cell-index = <1>; 180 - device_type = "network"; 181 - model = "TSEC"; 182 - compatible = "gianfar"; 183 - reg = <0x25000 0x1000>; 184 - ranges = <0x0 0x25000 0x1000>; 185 - local-mac-address = [ 00 00 00 00 00 00 ]; 186 - interrupts = <35 2 36 2 40 2>; 187 - interrupt-parent = <&mpic>; 188 - tbi-handle = <&tbi1>; 189 - phy-handle = <&phy1>; 190 - 191 - mdio@520 { 192 - #address-cells = <1>; 193 - #size-cells = <0>; 194 - compatible = "fsl,gianfar-tbi"; 195 - reg = <0x520 0x20>; 196 - 197 - tbi1: tbi-phy@11 { 198 - reg = <0x11>; 199 - device_type = "tbi-phy"; 200 - }; 201 - }; 202 - }; 203 - 204 - mpic: pic@40000 { 205 - interrupt-controller; 206 - #address-cells = <0>; 207 - #interrupt-cells = <2>; 208 - reg = <0x40000 0x40000>; 209 - compatible = "chrp,open-pic"; 210 - device_type = "open-pic"; 211 - }; 212 - 213 - cpm@919c0 { 214 - #address-cells = <1>; 215 - #size-cells = <1>; 216 - compatible = "fsl,mpc8560-cpm", "fsl,cpm2"; 217 - reg = <0x919c0 0x30>; 218 - ranges; 219 - 220 - muram@80000 { 221 - #address-cells = <1>; 222 - #size-cells = <1>; 223 - ranges = <0x0 0x80000 0x10000>; 224 - 225 - data@0 { 226 - compatible = "fsl,cpm-muram-data"; 227 - reg = <0x0 0x4000 0x9000 0x2000>; 228 - }; 229 - }; 230 - 231 - brg@919f0 { 232 - compatible = "fsl,mpc8560-brg", 233 - "fsl,cpm2-brg", 234 - "fsl,cpm-brg"; 235 - reg = <0x919f0 0x10 0x915f0 0x10>; 236 - clock-frequency = <165000000>; 237 - }; 238 - 239 - cpmpic: pic@90c00 { 240 - interrupt-controller; 241 - #address-cells = <0>; 242 - #interrupt-cells = <2>; 243 - interrupts = <46 2>; 244 - interrupt-parent = <&mpic>; 245 - reg = <0x90c00 0x80>; 246 - compatible = "fsl,mpc8560-cpm-pic", "fsl,cpm2-pic"; 247 - }; 248 - 249 - serial0: serial@91a00 { 250 - device_type = "serial"; 251 - compatible = "fsl,mpc8560-scc-uart", 252 - "fsl,cpm2-scc-uart"; 253 - reg = <0x91a00 0x20 0x88000 0x100>; 254 - fsl,cpm-brg = <1>; 255 - fsl,cpm-command = <0x800000>; 256 - current-speed = <115200>; 257 - interrupts = <40 8>; 258 - interrupt-parent = <&cpmpic>; 259 - }; 260 - 261 - serial1: serial@91a20 { 262 - device_type = "serial"; 263 - compatible = "fsl,mpc8560-scc-uart", 264 - "fsl,cpm2-scc-uart"; 265 - reg = <0x91a20 0x20 0x88100 0x100>; 266 - fsl,cpm-brg = <2>; 267 - fsl,cpm-command = <0x4a00000>; 268 - current-speed = <115200>; 269 - interrupts = <41 8>; 270 - interrupt-parent = <&cpmpic>; 271 - }; 272 - 273 - enet2: ethernet@91320 { 274 - device_type = "network"; 275 - compatible = "fsl,mpc8560-fcc-enet", 276 - "fsl,cpm2-fcc-enet"; 277 - reg = <0x91320 0x20 0x88500 0x100 0x913b0 0x1>; 278 - local-mac-address = [ 00 00 00 00 00 00 ]; 279 - fsl,cpm-command = <0x16200300>; 280 - interrupts = <33 8>; 281 - interrupt-parent = <&cpmpic>; 282 - phy-handle = <&phy2>; 283 - }; 284 - 285 - enet3: ethernet@91340 { 286 - device_type = "network"; 287 - compatible = "fsl,mpc8560-fcc-enet", 288 - "fsl,cpm2-fcc-enet"; 289 - reg = <0x91340 0x20 0x88600 0x100 0x913d0 0x1>; 290 - local-mac-address = [ 00 00 00 00 00 00 ]; 291 - fsl,cpm-command = <0x1a400300>; 292 - interrupts = <34 8>; 293 - interrupt-parent = <&cpmpic>; 294 - phy-handle = <&phy3>; 295 - }; 296 - }; 297 - }; 298 - 299 - pci0: pci@e0008000 { 300 - #interrupt-cells = <1>; 301 - #size-cells = <2>; 302 - #address-cells = <3>; 303 - compatible = "fsl,mpc8540-pcix", "fsl,mpc8540-pci"; 304 - device_type = "pci"; 305 - reg = <0xe0008000 0x1000>; 306 - clock-frequency = <66666666>; 307 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 308 - interrupt-map = < 309 - 310 - /* IDSEL 0x2 */ 311 - 0x1000 0x0 0x0 0x1 &mpic 0x1 0x1 312 - 0x1000 0x0 0x0 0x2 &mpic 0x2 0x1 313 - 0x1000 0x0 0x0 0x3 &mpic 0x3 0x1 314 - 0x1000 0x0 0x0 0x4 &mpic 0x4 0x1 315 - 316 - /* IDSEL 0x3 */ 317 - 0x1800 0x0 0x0 0x1 &mpic 0x4 0x1 318 - 0x1800 0x0 0x0 0x2 &mpic 0x1 0x1 319 - 0x1800 0x0 0x0 0x3 &mpic 0x2 0x1 320 - 0x1800 0x0 0x0 0x4 &mpic 0x3 0x1 321 - 322 - /* IDSEL 0x4 */ 323 - 0x2000 0x0 0x0 0x1 &mpic 0x3 0x1 324 - 0x2000 0x0 0x0 0x2 &mpic 0x4 0x1 325 - 0x2000 0x0 0x0 0x3 &mpic 0x1 0x1 326 - 0x2000 0x0 0x0 0x4 &mpic 0x2 0x1 327 - 328 - /* IDSEL 0x5 */ 329 - 0x2800 0x0 0x0 0x1 &mpic 0x2 0x1 330 - 0x2800 0x0 0x0 0x2 &mpic 0x3 0x1 331 - 0x2800 0x0 0x0 0x3 &mpic 0x4 0x1 332 - 0x2800 0x0 0x0 0x4 &mpic 0x1 0x1 333 - 334 - /* IDSEL 12 */ 335 - 0x6000 0x0 0x0 0x1 &mpic 0x1 0x1 336 - 0x6000 0x0 0x0 0x2 &mpic 0x2 0x1 337 - 0x6000 0x0 0x0 0x3 &mpic 0x3 0x1 338 - 0x6000 0x0 0x0 0x4 &mpic 0x4 0x1 339 - 340 - /* IDSEL 13 */ 341 - 0x6800 0x0 0x0 0x1 &mpic 0x4 0x1 342 - 0x6800 0x0 0x0 0x2 &mpic 0x1 0x1 343 - 0x6800 0x0 0x0 0x3 &mpic 0x2 0x1 344 - 0x6800 0x0 0x0 0x4 &mpic 0x3 0x1 345 - 346 - /* IDSEL 14*/ 347 - 0x7000 0x0 0x0 0x1 &mpic 0x3 0x1 348 - 0x7000 0x0 0x0 0x2 &mpic 0x4 0x1 349 - 0x7000 0x0 0x0 0x3 &mpic 0x1 0x1 350 - 0x7000 0x0 0x0 0x4 &mpic 0x2 0x1 351 - 352 - /* IDSEL 15 */ 353 - 0x7800 0x0 0x0 0x1 &mpic 0x2 0x1 354 - 0x7800 0x0 0x0 0x2 &mpic 0x3 0x1 355 - 0x7800 0x0 0x0 0x3 &mpic 0x4 0x1 356 - 0x7800 0x0 0x0 0x4 &mpic 0x1 0x1 357 - 358 - /* IDSEL 18 */ 359 - 0x9000 0x0 0x0 0x1 &mpic 0x1 0x1 360 - 0x9000 0x0 0x0 0x2 &mpic 0x2 0x1 361 - 0x9000 0x0 0x0 0x3 &mpic 0x3 0x1 362 - 0x9000 0x0 0x0 0x4 &mpic 0x4 0x1 363 - 364 - /* IDSEL 19 */ 365 - 0x9800 0x0 0x0 0x1 &mpic 0x4 0x1 366 - 0x9800 0x0 0x0 0x2 &mpic 0x1 0x1 367 - 0x9800 0x0 0x0 0x3 &mpic 0x2 0x1 368 - 0x9800 0x0 0x0 0x4 &mpic 0x3 0x1 369 - 370 - /* IDSEL 20 */ 371 - 0xa000 0x0 0x0 0x1 &mpic 0x3 0x1 372 - 0xa000 0x0 0x0 0x2 &mpic 0x4 0x1 373 - 0xa000 0x0 0x0 0x3 &mpic 0x1 0x1 374 - 0xa000 0x0 0x0 0x4 &mpic 0x2 0x1 375 - 376 - /* IDSEL 21 */ 377 - 0xa800 0x0 0x0 0x1 &mpic 0x2 0x1 378 - 0xa800 0x0 0x0 0x2 &mpic 0x3 0x1 379 - 0xa800 0x0 0x0 0x3 &mpic 0x4 0x1 380 - 0xa800 0x0 0x0 0x4 &mpic 0x1 0x1>; 381 - 382 - interrupt-parent = <&mpic>; 383 - interrupts = <24 2>; 384 - bus-range = <0 0>; 385 - ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 386 - 0x1000000 0x0 0x0 0xe2000000 0x0 0x1000000>; 387 - }; 388 - };
-47
arch/powerpc/configs/85xx/mpc8540_ads_defconfig
··· 1 - CONFIG_PPC_85xx=y 2 - CONFIG_SYSVIPC=y 3 - CONFIG_NO_HZ=y 4 - CONFIG_HIGH_RES_TIMERS=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_BLK_DEV_INITRD=y 7 - CONFIG_EXPERT=y 8 - # CONFIG_BLK_DEV_BSG is not set 9 - CONFIG_PARTITION_ADVANCED=y 10 - # CONFIG_MSDOS_PARTITION is not set 11 - CONFIG_MPC8540_ADS=y 12 - CONFIG_GEN_RTC=y 13 - CONFIG_BINFMT_MISC=y 14 - CONFIG_MATH_EMULATION=y 15 - # CONFIG_SECCOMP is not set 16 - CONFIG_NET=y 17 - CONFIG_PACKET=y 18 - CONFIG_UNIX=y 19 - CONFIG_XFRM_USER=y 20 - CONFIG_INET=y 21 - CONFIG_IP_MULTICAST=y 22 - CONFIG_IP_PNP=y 23 - CONFIG_IP_PNP_DHCP=y 24 - CONFIG_IP_PNP_BOOTP=y 25 - CONFIG_SYN_COOKIES=y 26 - # CONFIG_IPV6 is not set 27 - # CONFIG_FW_LOADER is not set 28 - CONFIG_BLK_DEV_LOOP=y 29 - CONFIG_BLK_DEV_RAM=y 30 - CONFIG_BLK_DEV_RAM_SIZE=32768 31 - CONFIG_NETDEVICES=y 32 - CONFIG_GIANFAR=y 33 - # CONFIG_INPUT_KEYBOARD is not set 34 - # CONFIG_INPUT_MOUSE is not set 35 - # CONFIG_SERIO is not set 36 - # CONFIG_VT is not set 37 - CONFIG_SERIAL_8250=y 38 - CONFIG_SERIAL_8250_CONSOLE=y 39 - # CONFIG_HW_RANDOM is not set 40 - CONFIG_EXT2_FS=y 41 - CONFIG_EXT4_FS=y 42 - CONFIG_PROC_KCORE=y 43 - CONFIG_TMPFS=y 44 - CONFIG_NFS_FS=y 45 - CONFIG_ROOT_NFS=y 46 - CONFIG_DETECT_HUNG_TASK=y 47 - CONFIG_DEBUG_MUTEXES=y
-50
arch/powerpc/configs/85xx/mpc8560_ads_defconfig
··· 1 - CONFIG_PPC_85xx=y 2 - CONFIG_SYSVIPC=y 3 - CONFIG_LOG_BUF_SHIFT=14 4 - CONFIG_BLK_DEV_INITRD=y 5 - CONFIG_EXPERT=y 6 - # CONFIG_BLK_DEV_BSG is not set 7 - CONFIG_PARTITION_ADVANCED=y 8 - # CONFIG_MSDOS_PARTITION is not set 9 - CONFIG_MPC8560_ADS=y 10 - CONFIG_GEN_RTC=y 11 - CONFIG_BINFMT_MISC=y 12 - CONFIG_MATH_EMULATION=y 13 - # CONFIG_SECCOMP is not set 14 - CONFIG_PCI=y 15 - CONFIG_PCI_DEBUG=y 16 - CONFIG_NET=y 17 - CONFIG_PACKET=y 18 - CONFIG_UNIX=y 19 - CONFIG_INET=y 20 - CONFIG_IP_MULTICAST=y 21 - CONFIG_IP_PNP=y 22 - CONFIG_IP_PNP_DHCP=y 23 - CONFIG_IP_PNP_BOOTP=y 24 - CONFIG_SYN_COOKIES=y 25 - # CONFIG_IPV6 is not set 26 - # CONFIG_FW_LOADER is not set 27 - CONFIG_BLK_DEV_LOOP=y 28 - CONFIG_BLK_DEV_RAM=y 29 - CONFIG_BLK_DEV_RAM_SIZE=32768 30 - CONFIG_NETDEVICES=y 31 - CONFIG_FS_ENET=y 32 - # CONFIG_FS_ENET_HAS_SCC is not set 33 - CONFIG_GIANFAR=y 34 - CONFIG_E1000=y 35 - CONFIG_DAVICOM_PHY=y 36 - CONFIG_MARVELL_PHY=y 37 - # CONFIG_INPUT_KEYBOARD is not set 38 - # CONFIG_INPUT_MOUSE is not set 39 - # CONFIG_SERIO is not set 40 - # CONFIG_VT is not set 41 - CONFIG_SERIAL_CPM=y 42 - CONFIG_SERIAL_CPM_CONSOLE=y 43 - CONFIG_EXT2_FS=y 44 - CONFIG_EXT4_FS=y 45 - CONFIG_PROC_KCORE=y 46 - CONFIG_TMPFS=y 47 - CONFIG_NFS_FS=y 48 - CONFIG_ROOT_NFS=y 49 - CONFIG_DETECT_HUNG_TASK=y 50 - CONFIG_DEBUG_MUTEXES=y
-52
arch/powerpc/configs/85xx/mpc85xx_cds_defconfig
··· 1 - CONFIG_PPC_85xx=y 2 - CONFIG_SYSVIPC=y 3 - CONFIG_NO_HZ=y 4 - CONFIG_HIGH_RES_TIMERS=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_BLK_DEV_INITRD=y 7 - CONFIG_EXPERT=y 8 - # CONFIG_BLK_DEV_BSG is not set 9 - CONFIG_PARTITION_ADVANCED=y 10 - # CONFIG_MSDOS_PARTITION is not set 11 - CONFIG_MPC85xx_CDS=y 12 - CONFIG_GEN_RTC=y 13 - CONFIG_BINFMT_MISC=y 14 - CONFIG_MATH_EMULATION=y 15 - # CONFIG_SECCOMP is not set 16 - CONFIG_PCI=y 17 - CONFIG_NET=y 18 - CONFIG_PACKET=y 19 - CONFIG_UNIX=y 20 - CONFIG_XFRM_USER=y 21 - CONFIG_INET=y 22 - CONFIG_IP_MULTICAST=y 23 - CONFIG_IP_PNP=y 24 - CONFIG_IP_PNP_DHCP=y 25 - CONFIG_IP_PNP_BOOTP=y 26 - CONFIG_SYN_COOKIES=y 27 - # CONFIG_IPV6 is not set 28 - # CONFIG_FW_LOADER is not set 29 - CONFIG_BLK_DEV_LOOP=y 30 - CONFIG_BLK_DEV_RAM=y 31 - CONFIG_BLK_DEV_RAM_SIZE=32768 32 - CONFIG_ATA=y 33 - CONFIG_ATA_GENERIC=y 34 - CONFIG_PATA_VIA=y 35 - CONFIG_NETDEVICES=y 36 - CONFIG_GIANFAR=y 37 - CONFIG_E1000=y 38 - # CONFIG_INPUT_KEYBOARD is not set 39 - # CONFIG_INPUT_MOUSE is not set 40 - # CONFIG_SERIO is not set 41 - # CONFIG_VT is not set 42 - CONFIG_SERIAL_8250=y 43 - CONFIG_SERIAL_8250_CONSOLE=y 44 - # CONFIG_HW_RANDOM is not set 45 - CONFIG_EXT2_FS=y 46 - CONFIG_EXT4_FS=y 47 - CONFIG_PROC_KCORE=y 48 - CONFIG_TMPFS=y 49 - CONFIG_NFS_FS=y 50 - CONFIG_ROOT_NFS=y 51 - CONFIG_DETECT_HUNG_TASK=y 52 - CONFIG_DEBUG_MUTEXES=y
-3
arch/powerpc/configs/mpc85xx_base.config
··· 1 1 CONFIG_MATH_EMULATION=y 2 2 CONFIG_MPC8536_DS=y 3 - CONFIG_MPC8540_ADS=y 4 - CONFIG_MPC8560_ADS=y 5 - CONFIG_MPC85xx_CDS=y 6 3 CONFIG_MPC85xx_DS=y 7 4 CONFIG_MPC85xx_MDS=y 8 5 CONFIG_MPC85xx_RDB=y
+5
arch/powerpc/include/asm/book3s/64/kexec.h
··· 21 21 plpar_set_ciabr(0); 22 22 } 23 23 24 + if (cpu_has_feature(CPU_FTR_ARCH_31)) { 25 + mtspr(SPRN_DEXCR, 0); 26 + mtspr(SPRN_HASHKEYR, 0); 27 + } 28 + 24 29 /* Do we need isync()? We are going via a kexec reset */ 25 30 isync(); 26 31 }
+1
arch/powerpc/include/asm/book3s/64/kup.h
··· 194 194 #else /* !__ASSEMBLY__ */ 195 195 196 196 #include <linux/jump_label.h> 197 + #include <linux/sched.h> 197 198 198 199 DECLARE_STATIC_KEY_FALSE(uaccess_flush_key); 199 200
+3 -1
arch/powerpc/include/asm/cputable.h
··· 192 192 #define CPU_FTR_P9_RADIX_PREFETCH_BUG LONG_ASM_CONST(0x0002000000000000) 193 193 #define CPU_FTR_ARCH_31 LONG_ASM_CONST(0x0004000000000000) 194 194 #define CPU_FTR_DAWR1 LONG_ASM_CONST(0x0008000000000000) 195 + #define CPU_FTR_DEXCR_NPHIE LONG_ASM_CONST(0x0010000000000000) 195 196 196 197 #ifndef __ASSEMBLY__ 197 198 ··· 452 451 CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ 453 452 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ 454 453 CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \ 455 - CPU_FTR_DAWR | CPU_FTR_DAWR1) 454 + CPU_FTR_DAWR | CPU_FTR_DAWR1 | \ 455 + CPU_FTR_DEXCR_NPHIE) 456 456 #define CPU_FTRS_CELL (CPU_FTR_LWSYNC | \ 457 457 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 458 458 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
+6
arch/powerpc/include/asm/elf.h
··· 12 12 13 13 /* 14 14 * This is used to ensure we don't load something for the wrong architecture. 15 + * 64le only supports ELFv2 64-bit binaries (64be supports v1 and v2). 15 16 */ 17 + #if defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN) 18 + #define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) && \ 19 + (((x)->e_flags & 0x3) == 0x2)) 20 + #else 16 21 #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) 22 + #endif 17 23 #define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC) 18 24 19 25 #define CORE_DUMP_USE_REGSET
+2 -2
arch/powerpc/include/asm/kvm_ppc.h
··· 548 548 * pairs with the barrier in kvmppc_clear_host_ipi() 549 549 */ 550 550 smp_mb(); 551 - paca_ptrs[cpu]->kvm_hstate.host_ipi = 1; 551 + WRITE_ONCE(paca_ptrs[cpu]->kvm_hstate.host_ipi, 1); 552 552 } 553 553 554 554 static inline void kvmppc_clear_host_ipi(int cpu) 555 555 { 556 - paca_ptrs[cpu]->kvm_hstate.host_ipi = 0; 556 + WRITE_ONCE(paca_ptrs[cpu]->kvm_hstate.host_ipi, 0); 557 557 /* 558 558 * order clearing of host_ipi flag vs. processing of IPI messages 559 559 *
-41
arch/powerpc/include/asm/mpc52xx.h
··· 285 285 extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt); 286 286 extern int mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt); 287 287 288 - /* mpc52xx_lpbfifo.c */ 289 - #define MPC52XX_LPBFIFO_FLAG_READ (0) 290 - #define MPC52XX_LPBFIFO_FLAG_WRITE (1<<0) 291 - #define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT (1<<1) 292 - #define MPC52XX_LPBFIFO_FLAG_NO_DMA (1<<2) 293 - #define MPC52XX_LPBFIFO_FLAG_POLL_DMA (1<<3) 294 - 295 - struct mpc52xx_lpbfifo_request { 296 - struct list_head list; 297 - 298 - /* localplus bus address */ 299 - unsigned int cs; 300 - size_t offset; 301 - 302 - /* Memory address */ 303 - void *data; 304 - phys_addr_t data_phys; 305 - 306 - /* Details of transfer */ 307 - size_t size; 308 - size_t pos; /* current position of transfer */ 309 - int flags; 310 - int defer_xfer_start; 311 - 312 - /* What to do when finished */ 313 - void (*callback)(struct mpc52xx_lpbfifo_request *); 314 - 315 - void *priv; /* Driver private data */ 316 - 317 - /* statistics */ 318 - int irq_count; 319 - int irq_ticks; 320 - u8 last_byte; 321 - int buffer_not_done_cnt; 322 - }; 323 - 324 - extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req); 325 - extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req); 326 - extern void mpc52xx_lpbfifo_poll(void); 327 - extern int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req); 328 - 329 288 /* mpc52xx_pic.c */ 330 289 extern void mpc52xx_init_irq(void); 331 290 extern unsigned int mpc52xx_get_irq(void);
-3
arch/powerpc/include/asm/opal.h
··· 112 112 uint8_t pe_action); 113 113 int64_t opal_pci_set_peltv(uint64_t phb_id, uint32_t parent_pe, uint32_t child_pe, 114 114 uint8_t state); 115 - int64_t opal_pci_set_mve(uint64_t phb_id, uint32_t mve_number, uint32_t pe_number); 116 - int64_t opal_pci_set_mve_enable(uint64_t phb_id, uint32_t mve_number, 117 - uint32_t state); 118 115 int64_t opal_pci_get_xive_reissue(uint64_t phb_id, uint32_t xive_number, 119 116 uint8_t *p_bit, uint8_t *q_bit); 120 117 int64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number,
+1
arch/powerpc/include/asm/paca.h
··· 191 191 #ifdef CONFIG_PPC_POWERNV 192 192 /* PowerNV idle fields */ 193 193 /* PNV_CORE_IDLE_* bits, all siblings work on thread 0 paca */ 194 + unsigned long idle_lock; /* A value of 1 means acquired */ 194 195 unsigned long idle_state; 195 196 union { 196 197 /* P7/P8 specific fields */
+1
arch/powerpc/include/asm/ppc-opcode.h
··· 222 222 #define OP_31_XOP_STFSX 663 223 223 #define OP_31_XOP_STFSUX 695 224 224 #define OP_31_XOP_STFDX 727 225 + #define OP_31_XOP_HASHCHK 754 225 226 #define OP_31_XOP_STFDUX 759 226 227 #define OP_31_XOP_LHBRX 790 227 228 #define OP_31_XOP_LFIWAX 855
+14
arch/powerpc/include/asm/ppc_asm.h
··· 406 406 /* offsets for stack frame layout */ 407 407 #define LRSAVE 16 408 408 409 + /* 410 + * GCC stack frames follow a different pattern on 32 vs 64. This can be used 411 + * to make asm frames be consistent with C. 412 + */ 413 + #define PPC_CREATE_STACK_FRAME(size) \ 414 + mflr r0; \ 415 + std r0,16(r1); \ 416 + stdu r1,-(size)(r1) 417 + 409 418 #else /* 32-bit */ 410 419 411 420 #define LOAD_REG_IMMEDIATE(reg, expr) __LOAD_REG_IMMEDIATE_32 reg, expr ··· 430 421 431 422 /* offsets for stack frame layout */ 432 423 #define LRSAVE 4 424 + 425 + #define PPC_CREATE_STACK_FRAME(size) \ 426 + stwu r1,-(size)(r1); \ 427 + mflr r0; \ 428 + stw r0,(size+4)(r1) 433 429 434 430 #endif 435 431
+1
arch/powerpc/include/asm/processor.h
··· 264 264 unsigned long mmcr3; 265 265 unsigned long sier2; 266 266 unsigned long sier3; 267 + unsigned long hashkeyr; 267 268 268 269 #endif 269 270 };
+2 -2
arch/powerpc/include/asm/ptrace.h
··· 180 180 static inline void set_return_regs_changed(void) 181 181 { 182 182 #ifdef CONFIG_PPC_BOOK3S_64 183 - local_paca->hsrr_valid = 0; 184 - local_paca->srr_valid = 0; 183 + WRITE_ONCE(local_paca->hsrr_valid, 0); 184 + WRITE_ONCE(local_paca->srr_valid, 0); 185 185 #endif 186 186 } 187 187
+10
arch/powerpc/include/asm/reg.h
··· 382 382 #define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ 383 383 #define SPRN_RMOR 0x138 /* Real mode offset register */ 384 384 #define SPRN_HRMOR 0x139 /* Real mode offset register */ 385 + #define SPRN_HDEXCR_RO 0x1C7 /* Hypervisor DEXCR (non-privileged, readonly) */ 386 + #define SPRN_HASHKEYR 0x1D4 /* Non-privileged hashst/hashchk key register */ 387 + #define SPRN_HDEXCR 0x1D7 /* Hypervisor dynamic execution control register */ 388 + #define SPRN_DEXCR_RO 0x32C /* DEXCR (non-privileged, readonly) */ 385 389 #define SPRN_ASDR 0x330 /* Access segment descriptor register */ 390 + #define SPRN_DEXCR 0x33C /* Dynamic execution control register */ 391 + #define DEXCR_PR_SBHE 0x80000000UL /* 0: Speculative Branch Hint Enable */ 392 + #define DEXCR_PR_IBRTPD 0x10000000UL /* 3: Indirect Branch Recurrent Target Prediction Disable */ 393 + #define DEXCR_PR_SRAPD 0x08000000UL /* 4: Subroutine Return Address Prediction Disable */ 394 + #define DEXCR_PR_NPHIE 0x04000000UL /* 5: Non-Privileged Hash Instruction Enable */ 395 + #define DEXCR_INIT DEXCR_PR_NPHIE /* Fixed DEXCR value to initialise all CPUs with */ 386 396 #define SPRN_IC 0x350 /* Virtual Instruction Count */ 387 397 #define SPRN_VTB 0x351 /* Virtual Time Base */ 388 398 #define SPRN_LDBAR 0x352 /* LD Base Address Register */
+2
arch/powerpc/include/asm/simple_spinlock.h
··· 15 15 * (the type definitions are in asm/simple_spinlock_types.h) 16 16 */ 17 17 #include <linux/irqflags.h> 18 + #include <linux/kcsan-checks.h> 18 19 #include <asm/paravirt.h> 19 20 #include <asm/paca.h> 20 21 #include <asm/synch.h> ··· 127 126 128 127 static inline void arch_spin_unlock(arch_spinlock_t *lock) 129 128 { 129 + kcsan_mb(); 130 130 __asm__ __volatile__("# arch_spin_unlock\n\t" 131 131 PPC_RELEASE_BARRIER: : :"memory"); 132 132 lock->slock = 0;
+5 -1
arch/powerpc/include/asm/thread_info.h
··· 183 183 #define clear_tsk_compat_task(tsk) do { } while (0) 184 184 #endif 185 185 186 - #if defined(CONFIG_PPC64) 186 + #ifdef CONFIG_PPC64 187 + #ifdef CONFIG_CPU_BIG_ENDIAN 187 188 #define is_elf2_task() (test_thread_flag(TIF_ELF2ABI)) 189 + #else 190 + #define is_elf2_task() (1) 191 + #endif 188 192 #else 189 193 #define is_elf2_task() (0) 190 194 #endif
+2
arch/powerpc/include/uapi/asm/elf.h
··· 98 98 #define ELF_NEBB 3 /* includes ebbrr, ebbhr, bescr */ 99 99 #define ELF_NPMU 5 /* includes siar, sdar, sier, mmcr2, mmcr0 */ 100 100 #define ELF_NPKEY 3 /* includes amr, iamr, uamor */ 101 + #define ELF_NDEXCR 2 /* includes dexcr, hdexcr */ 102 + #define ELF_NHASHKEYR 1 /* includes hashkeyr */ 101 103 102 104 typedef unsigned long elf_greg_t64; 103 105 typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG];
+7 -7
arch/powerpc/kernel/Makefile
··· 68 68 CFLAGS_syscall.o += -fno-stack-protector 69 69 #endif 70 70 71 - obj-y := cputable.o syscalls.o \ 71 + obj-y := cputable.o syscalls.o switch.o \ 72 72 irq.o align.o signal_$(BITS).o pmc.o vdso.o \ 73 73 process.o systbl.o idle.o \ 74 74 signal.o sysfs.o cacheinfo.o time.o \ ··· 165 165 166 166 obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o 167 167 168 - obj-$(CONFIG_PPC64) += $(obj64-y) 169 - obj-$(CONFIG_PPC32) += $(obj32-y) 170 - 171 168 ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC_CORE)(CONFIG_PPC_BOOK3S),) 172 169 obj-y += ppc_save_regs.o 173 170 endif ··· 206 209 207 210 obj-$(CONFIG_PPC_FPU) += fpu.o 208 211 obj-$(CONFIG_ALTIVEC) += vector.o 209 - obj-$(CONFIG_PPC64) += entry_64.o 210 - obj-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o 211 212 212 - extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check 213 + obj-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o 214 + obj64-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_entry_64.o 215 + extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check 216 + 217 + obj-$(CONFIG_PPC64) += $(obj64-y) 218 + obj-$(CONFIG_PPC32) += $(obj32-y) 213 219 214 220 quiet_cmd_prom_init_check = PROMCHK $@ 215 221 cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" $(obj)/prom_init.o; touch $@
+8
arch/powerpc/kernel/cpu_setup_power.c
··· 126 126 mtspr(SPRN_MMCR0, MMCR0_FC | MMCR0_PMCCEXT); 127 127 } 128 128 129 + static void init_DEXCR(void) 130 + { 131 + mtspr(SPRN_DEXCR, DEXCR_INIT); 132 + mtspr(SPRN_HASHKEYR, 0); 133 + } 134 + 129 135 /* 130 136 * Note that we can be called twice of pseudo-PVRs. 131 137 * The parameter offset is not used. ··· 247 241 init_FSCR_power10(); 248 242 init_PMU(); 249 243 init_PMU_ISA31(); 244 + init_DEXCR(); 250 245 251 246 if (!init_hvmode_206(t)) 252 247 return; ··· 270 263 init_FSCR_power10(); 271 264 init_PMU(); 272 265 init_PMU_ISA31(); 266 + init_DEXCR(); 273 267 274 268 msr = mfmsr(); 275 269 if (!(msr & MSR_HV))
-58
arch/powerpc/kernel/entry_32.S
··· 211 211 100: trap 212 212 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,0 213 213 214 - 215 - /* 216 - * This routine switches between two different tasks. The process 217 - * state of one is saved on its kernel stack. Then the state 218 - * of the other is restored from its kernel stack. The memory 219 - * management hardware is updated to the second process's state. 220 - * Finally, we can return to the second process. 221 - * On entry, r3 points to the THREAD for the current task, r4 222 - * points to the THREAD for the new task. 223 - * 224 - * This routine is always called with interrupts disabled. 225 - * 226 - * Note: there are two ways to get to the "going out" portion 227 - * of this code; either by coming in via the entry (_switch) 228 - * or via "fork" which must set up an environment equivalent 229 - * to the "_switch" path. If you change this , you'll have to 230 - * change the fork code also. 231 - * 232 - * The code which creates the new task context is in 'copy_thread' 233 - * in arch/ppc/kernel/process.c 234 - */ 235 - _GLOBAL(_switch) 236 - stwu r1,-SWITCH_FRAME_SIZE(r1) 237 - mflr r0 238 - stw r0,SWITCH_FRAME_SIZE+4(r1) 239 - /* r3-r12 are caller saved -- Cort */ 240 - SAVE_NVGPRS(r1) 241 - stw r0,_NIP(r1) /* Return to switch caller */ 242 - mfcr r10 243 - stw r10,_CCR(r1) 244 - stw r1,KSP(r3) /* Set old stack pointer */ 245 - 246 - #ifdef CONFIG_SMP 247 - /* We need a sync somewhere here to make sure that if the 248 - * previous task gets rescheduled on another CPU, it sees all 249 - * stores it has performed on this one. 250 - */ 251 - sync 252 - #endif /* CONFIG_SMP */ 253 - 254 - tophys(r0,r4) 255 - mtspr SPRN_SPRG_THREAD,r0 /* Update current THREAD phys addr */ 256 - lwz r1,KSP(r4) /* Load new stack pointer */ 257 - 258 - /* save the old current 'last' for return value */ 259 - mr r3,r2 260 - addi r2,r4,-THREAD /* Update current */ 261 - 262 - lwz r0,_CCR(r1) 263 - mtcrf 0xFF,r0 264 - /* r3-r12 are destroyed -- Cort */ 265 - REST_NVGPRS(r1) 266 - 267 - lwz r4,_NIP(r1) /* Return to _switch caller in new task */ 268 - mtlr r4 269 - addi r1,r1,SWITCH_FRAME_SIZE 270 - blr 271 - 272 214 .globl fast_exception_return 273 215 fast_exception_return: 274 216 #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
-331
arch/powerpc/kernel/entry_64.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * PowerPC version 4 - * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 5 - * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP 6 - * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu> 7 - * Adapted for Power Macintosh by Paul Mackerras. 8 - * Low-level exception handlers and MMU support 9 - * rewritten by Paul Mackerras. 10 - * Copyright (C) 1996 Paul Mackerras. 11 - * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net). 12 - * 13 - * This file contains the system call entry code, context switch 14 - * code, and exception/interrupt return code for PowerPC. 15 - */ 16 - 17 - #include <linux/objtool.h> 18 - #include <linux/errno.h> 19 - #include <linux/err.h> 20 - #include <asm/cache.h> 21 - #include <asm/unistd.h> 22 - #include <asm/processor.h> 23 - #include <asm/page.h> 24 - #include <asm/mmu.h> 25 - #include <asm/thread_info.h> 26 - #include <asm/code-patching-asm.h> 27 - #include <asm/ppc_asm.h> 28 - #include <asm/asm-offsets.h> 29 - #include <asm/cputable.h> 30 - #include <asm/firmware.h> 31 - #include <asm/bug.h> 32 - #include <asm/ptrace.h> 33 - #include <asm/irqflags.h> 34 - #include <asm/hw_irq.h> 35 - #include <asm/context_tracking.h> 36 - #include <asm/ppc-opcode.h> 37 - #include <asm/barrier.h> 38 - #include <asm/export.h> 39 - #include <asm/asm-compat.h> 40 - #ifdef CONFIG_PPC_BOOK3S 41 - #include <asm/exception-64s.h> 42 - #else 43 - #include <asm/exception-64e.h> 44 - #endif 45 - #include <asm/feature-fixups.h> 46 - #include <asm/kup.h> 47 - 48 - /* 49 - * System calls. 50 - */ 51 - .section ".text" 52 - 53 - #ifdef CONFIG_PPC_BOOK3S_64 54 - 55 - #define FLUSH_COUNT_CACHE \ 56 - 1: nop; \ 57 - patch_site 1b, patch__call_flush_branch_caches1; \ 58 - 1: nop; \ 59 - patch_site 1b, patch__call_flush_branch_caches2; \ 60 - 1: nop; \ 61 - patch_site 1b, patch__call_flush_branch_caches3 62 - 63 - .macro nops number 64 - .rept \number 65 - nop 66 - .endr 67 - .endm 68 - 69 - .balign 32 70 - .global flush_branch_caches 71 - flush_branch_caches: 72 - /* Save LR into r9 */ 73 - mflr r9 74 - 75 - // Flush the link stack 76 - .rept 64 77 - ANNOTATE_INTRA_FUNCTION_CALL 78 - bl .+4 79 - .endr 80 - b 1f 81 - nops 6 82 - 83 - .balign 32 84 - /* Restore LR */ 85 - 1: mtlr r9 86 - 87 - // If we're just flushing the link stack, return here 88 - 3: nop 89 - patch_site 3b patch__flush_link_stack_return 90 - 91 - li r9,0x7fff 92 - mtctr r9 93 - 94 - PPC_BCCTR_FLUSH 95 - 96 - 2: nop 97 - patch_site 2b patch__flush_count_cache_return 98 - 99 - nops 3 100 - 101 - .rept 278 102 - .balign 32 103 - PPC_BCCTR_FLUSH 104 - nops 7 105 - .endr 106 - 107 - blr 108 - #else 109 - #define FLUSH_COUNT_CACHE 110 - #endif /* CONFIG_PPC_BOOK3S_64 */ 111 - 112 - /* 113 - * This routine switches between two different tasks. The process 114 - * state of one is saved on its kernel stack. Then the state 115 - * of the other is restored from its kernel stack. The memory 116 - * management hardware is updated to the second process's state. 117 - * Finally, we can return to the second process, via interrupt_return. 118 - * On entry, r3 points to the THREAD for the current task, r4 119 - * points to the THREAD for the new task. 120 - * 121 - * Note: there are two ways to get to the "going out" portion 122 - * of this code; either by coming in via the entry (_switch) 123 - * or via "fork" which must set up an environment equivalent 124 - * to the "_switch" path. If you change this you'll have to change 125 - * the fork code also. 126 - * 127 - * The code which creates the new task context is in 'copy_thread' 128 - * in arch/powerpc/kernel/process.c 129 - */ 130 - .align 7 131 - _GLOBAL(_switch) 132 - mflr r0 133 - std r0,16(r1) 134 - stdu r1,-SWITCH_FRAME_SIZE(r1) 135 - /* r3-r13 are caller saved -- Cort */ 136 - SAVE_NVGPRS(r1) 137 - std r0,_NIP(r1) /* Return to switch caller */ 138 - mfcr r23 139 - std r23,_CCR(r1) 140 - std r1,KSP(r3) /* Set old stack pointer */ 141 - 142 - kuap_check_amr r9, r10 143 - 144 - FLUSH_COUNT_CACHE /* Clobbers r9, ctr */ 145 - 146 - /* 147 - * On SMP kernels, care must be taken because a task may be 148 - * scheduled off CPUx and on to CPUy. Memory ordering must be 149 - * considered. 150 - * 151 - * Cacheable stores on CPUx will be visible when the task is 152 - * scheduled on CPUy by virtue of the core scheduler barriers 153 - * (see "Notes on Program-Order guarantees on SMP systems." in 154 - * kernel/sched/core.c). 155 - * 156 - * Uncacheable stores in the case of involuntary preemption must 157 - * be taken care of. The smp_mb__after_spinlock() in __schedule() 158 - * is implemented as hwsync on powerpc, which orders MMIO too. So 159 - * long as there is an hwsync in the context switch path, it will 160 - * be executed on the source CPU after the task has performed 161 - * all MMIO ops on that CPU, and on the destination CPU before the 162 - * task performs any MMIO ops there. 163 - */ 164 - 165 - /* 166 - * The kernel context switch path must contain a spin_lock, 167 - * which contains larx/stcx, which will clear any reservation 168 - * of the task being switched. 169 - */ 170 - #ifdef CONFIG_PPC_BOOK3S 171 - /* Cancel all explict user streams as they will have no use after context 172 - * switch and will stop the HW from creating streams itself 173 - */ 174 - DCBT_BOOK3S_STOP_ALL_STREAM_IDS(r6) 175 - #endif 176 - 177 - addi r6,r4,-THREAD /* Convert THREAD to 'current' */ 178 - std r6,PACACURRENT(r13) /* Set new 'current' */ 179 - #if defined(CONFIG_STACKPROTECTOR) 180 - ld r6, TASK_CANARY(r6) 181 - std r6, PACA_CANARY(r13) 182 - #endif 183 - 184 - ld r8,KSP(r4) /* new stack pointer */ 185 - #ifdef CONFIG_PPC_64S_HASH_MMU 186 - BEGIN_MMU_FTR_SECTION 187 - b 2f 188 - END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) 189 - BEGIN_FTR_SECTION 190 - clrrdi r6,r8,28 /* get its ESID */ 191 - clrrdi r9,r1,28 /* get current sp ESID */ 192 - FTR_SECTION_ELSE 193 - clrrdi r6,r8,40 /* get its 1T ESID */ 194 - clrrdi r9,r1,40 /* get current sp 1T ESID */ 195 - ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_1T_SEGMENT) 196 - clrldi. r0,r6,2 /* is new ESID c00000000? */ 197 - cmpd cr1,r6,r9 /* or is new ESID the same as current ESID? */ 198 - cror eq,4*cr1+eq,eq 199 - beq 2f /* if yes, don't slbie it */ 200 - 201 - /* Bolt in the new stack SLB entry */ 202 - ld r7,KSP_VSID(r4) /* Get new stack's VSID */ 203 - oris r0,r6,(SLB_ESID_V)@h 204 - ori r0,r0,(SLB_NUM_BOLTED-1)@l 205 - BEGIN_FTR_SECTION 206 - li r9,MMU_SEGSIZE_1T /* insert B field */ 207 - oris r6,r6,(MMU_SEGSIZE_1T << SLBIE_SSIZE_SHIFT)@h 208 - rldimi r7,r9,SLB_VSID_SSIZE_SHIFT,0 209 - END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 210 - 211 - /* Update the last bolted SLB. No write barriers are needed 212 - * here, provided we only update the current CPU's SLB shadow 213 - * buffer. 214 - */ 215 - ld r9,PACA_SLBSHADOWPTR(r13) 216 - li r12,0 217 - std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */ 218 - li r12,SLBSHADOW_STACKVSID 219 - STDX_BE r7,r12,r9 /* Save VSID */ 220 - li r12,SLBSHADOW_STACKESID 221 - STDX_BE r0,r12,r9 /* Save ESID */ 222 - 223 - /* No need to check for MMU_FTR_NO_SLBIE_B here, since when 224 - * we have 1TB segments, the only CPUs known to have the errata 225 - * only support less than 1TB of system memory and we'll never 226 - * actually hit this code path. 227 - */ 228 - 229 - isync 230 - slbie r6 231 - BEGIN_FTR_SECTION 232 - slbie r6 /* Workaround POWER5 < DD2.1 issue */ 233 - END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) 234 - slbmte r7,r0 235 - isync 236 - 2: 237 - #endif /* CONFIG_PPC_64S_HASH_MMU */ 238 - 239 - clrrdi r7, r8, THREAD_SHIFT /* base of new stack */ 240 - /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE 241 - because we don't need to leave the 288-byte ABI gap at the 242 - top of the kernel stack. */ 243 - addi r7,r7,THREAD_SIZE-SWITCH_FRAME_SIZE 244 - 245 - /* 246 - * PMU interrupts in radix may come in here. They will use r1, not 247 - * PACAKSAVE, so this stack switch will not cause a problem. They 248 - * will store to the process stack, which may then be migrated to 249 - * another CPU. However the rq lock release on this CPU paired with 250 - * the rq lock acquire on the new CPU before the stack becomes 251 - * active on the new CPU, will order those stores. 252 - */ 253 - mr r1,r8 /* start using new stack pointer */ 254 - std r7,PACAKSAVE(r13) 255 - 256 - ld r6,_CCR(r1) 257 - mtcrf 0xFF,r6 258 - 259 - /* r3-r13 are destroyed -- Cort */ 260 - REST_NVGPRS(r1) 261 - 262 - /* convert old thread to its task_struct for return value */ 263 - addi r3,r3,-THREAD 264 - ld r7,_NIP(r1) /* Return to _switch caller in new task */ 265 - mtlr r7 266 - addi r1,r1,SWITCH_FRAME_SIZE 267 - blr 268 - 269 - _GLOBAL(enter_prom) 270 - mflr r0 271 - std r0,16(r1) 272 - stdu r1,-SWITCH_FRAME_SIZE(r1) /* Save SP and create stack space */ 273 - 274 - /* Because PROM is running in 32b mode, it clobbers the high order half 275 - * of all registers that it saves. We therefore save those registers 276 - * PROM might touch to the stack. (r0, r3-r13 are caller saved) 277 - */ 278 - SAVE_GPR(2, r1) 279 - SAVE_GPR(13, r1) 280 - SAVE_NVGPRS(r1) 281 - mfcr r10 282 - mfmsr r11 283 - std r10,_CCR(r1) 284 - std r11,_MSR(r1) 285 - 286 - /* Put PROM address in SRR0 */ 287 - mtsrr0 r4 288 - 289 - /* Setup our trampoline return addr in LR */ 290 - bcl 20,31,$+4 291 - 0: mflr r4 292 - addi r4,r4,(1f - 0b) 293 - mtlr r4 294 - 295 - /* Prepare a 32-bit mode big endian MSR 296 - */ 297 - #ifdef CONFIG_PPC_BOOK3E_64 298 - rlwinm r11,r11,0,1,31 299 - mtsrr1 r11 300 - rfi 301 - #else /* CONFIG_PPC_BOOK3E_64 */ 302 - LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_LE) 303 - andc r11,r11,r12 304 - mtsrr1 r11 305 - RFI_TO_KERNEL 306 - #endif /* CONFIG_PPC_BOOK3E_64 */ 307 - 308 - 1: /* Return from OF */ 309 - FIXUP_ENDIAN 310 - 311 - /* Just make sure that r1 top 32 bits didn't get 312 - * corrupt by OF 313 - */ 314 - rldicl r1,r1,0,32 315 - 316 - /* Restore the MSR (back to 64 bits) */ 317 - ld r0,_MSR(r1) 318 - MTMSRD(r0) 319 - isync 320 - 321 - /* Restore other registers */ 322 - REST_GPR(2, r1) 323 - REST_GPR(13, r1) 324 - REST_NVGPRS(r1) 325 - ld r4,_CCR(r1) 326 - mtcr r4 327 - 328 - addi r1,r1,SWITCH_FRAME_SIZE 329 - ld r0,16(r1) 330 - mtlr r0 331 - blr
+7 -10
arch/powerpc/kernel/interrupt.c
··· 125 125 case 0x1600: 126 126 case 0x1800: 127 127 validp = &local_paca->hsrr_valid; 128 - if (!*validp) 128 + if (!READ_ONCE(*validp)) 129 129 return; 130 130 131 131 srr0 = mfspr(SPRN_HSRR0); ··· 135 135 break; 136 136 default: 137 137 validp = &local_paca->srr_valid; 138 - if (!*validp) 138 + if (!READ_ONCE(*validp)) 139 139 return; 140 140 141 141 srr0 = mfspr(SPRN_SRR0); ··· 161 161 * such things will get caught most of the time, statistically 162 162 * enough to be able to get a warning out. 163 163 */ 164 - barrier(); 165 - 166 - if (!*validp) 164 + if (!READ_ONCE(*validp)) 167 165 return; 168 166 169 - if (!warned) { 170 - warned = true; 167 + if (!data_race(warned)) { 168 + data_race(warned = true); 171 169 printk("%sSRR0 was: %lx should be: %lx\n", h, srr0, regs->nip); 172 170 printk("%sSRR1 was: %lx should be: %lx\n", h, srr1, regs->msr); 173 171 show_regs(regs); 174 172 } 175 173 176 - *validp = 0; /* fixup */ 174 + WRITE_ONCE(*validp, 0); /* fixup */ 177 175 #endif 178 176 } 179 177 ··· 366 368 367 369 notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) 368 370 { 369 - unsigned long flags; 370 371 unsigned long ret = 0; 371 372 unsigned long kuap; 372 373 bool stack_store = read_thread_flags() & _TIF_EMULATE_STACK_STORE; ··· 389 392 390 393 kuap = kuap_get_and_assert_locked(); 391 394 392 - local_irq_save(flags); 395 + local_irq_disable(); 393 396 394 397 if (!arch_irq_disabled_regs(regs)) { 395 398 /* Returning to a kernel context with local irqs enabled. */
+4
arch/powerpc/kernel/iommu.c
··· 1090 1090 } 1091 1091 EXPORT_SYMBOL_GPL(iommu_tce_kill); 1092 1092 1093 + #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1093 1094 static int iommu_take_ownership(struct iommu_table *tbl) 1094 1095 { 1095 1096 unsigned long flags, i, sz = (tbl->it_size + 7) >> 3; ··· 1141 1140 spin_unlock(&tbl->pools[i].lock); 1142 1141 spin_unlock_irqrestore(&tbl->large_pool.lock, flags); 1143 1142 } 1143 + #endif 1144 1144 1145 1145 int iommu_add_device(struct iommu_table_group *table_group, struct device *dev) 1146 1146 { ··· 1173 1171 } 1174 1172 EXPORT_SYMBOL_GPL(iommu_add_device); 1175 1173 1174 + #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1176 1175 /* 1177 1176 * A simple iommu_table_group_ops which only allows reusing the existing 1178 1177 * iommu_table. This handles VFIO for POWER7 or the nested KVM. ··· 1401 1398 return 0; 1402 1399 } 1403 1400 postcore_initcall_sync(spapr_tce_setup_phb_iommus_initcall); 1401 + #endif 1404 1402 1405 1403 #endif /* CONFIG_IOMMU_API */
+3 -3
arch/powerpc/kernel/ppc_save_regs.S
··· 31 31 lbz r0,PACAIRQSOFTMASK(r13) 32 32 PPC_STL r0,SOFTE(r3) 33 33 #endif 34 - /* go up one stack frame for SP */ 35 - PPC_LL r4,0(r1) 36 - PPC_STL r4,GPR1(r3) 34 + /* store current SP */ 35 + PPC_STL r1,GPR1(r3) 37 36 /* get caller's LR */ 37 + PPC_LL r4,0(r1) 38 38 PPC_LL r0,LRSAVE(r4) 39 39 PPC_STL r0,_LINK(r3) 40 40 mflr r0
+17
arch/powerpc/kernel/process.c
··· 1182 1182 */ 1183 1183 t->tar = mfspr(SPRN_TAR); 1184 1184 } 1185 + 1186 + if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE)) 1187 + t->hashkeyr = mfspr(SPRN_HASHKEYR); 1185 1188 #endif 1186 1189 } 1187 1190 ··· 1263 1260 if (cpu_has_feature(CPU_FTR_P9_TIDR) && 1264 1261 old_thread->tidr != new_thread->tidr) 1265 1262 mtspr(SPRN_TIDR, new_thread->tidr); 1263 + 1264 + if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE) && 1265 + old_thread->hashkeyr != new_thread->hashkeyr) 1266 + mtspr(SPRN_HASHKEYR, new_thread->hashkeyr); 1266 1267 #endif 1267 1268 1268 1269 } ··· 1875 1868 1876 1869 p->thread.tidr = 0; 1877 1870 #endif 1871 + #ifdef CONFIG_PPC_BOOK3S_64 1872 + if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE)) 1873 + p->thread.hashkeyr = current->thread.hashkeyr; 1874 + #endif 1878 1875 return 0; 1879 1876 } 1880 1877 ··· 1995 1984 current->thread.tm_tfiar = 0; 1996 1985 current->thread.load_tm = 0; 1997 1986 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 1987 + #ifdef CONFIG_PPC_BOOK3S_64 1988 + if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE)) { 1989 + current->thread.hashkeyr = get_random_long(); 1990 + mtspr(SPRN_HASHKEYR, current->thread.hashkeyr); 1991 + } 1992 + #endif /* CONFIG_PPC_BOOK3S_64 */ 1998 1993 } 1999 1994 EXPORT_SYMBOL(start_thread); 2000 1995
+1
arch/powerpc/kernel/prom.c
··· 182 182 .cpu_user_ftrs2 = PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_HTM_NOSC_COMP }, 183 183 184 184 { .pabyte = 64, .pabit = 0, .cpu_features = CPU_FTR_DAWR1 }, 185 + { .pabyte = 68, .pabit = 5, .cpu_features = CPU_FTR_DEXCR_NPHIE }, 185 186 }; 186 187 187 188 /*
+87
arch/powerpc/kernel/prom_entry_64.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* 3 + * PowerPC version 4 + * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 5 + * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP 6 + * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu> 7 + * Adapted for Power Macintosh by Paul Mackerras. 8 + * Low-level exception handlers and MMU support 9 + * rewritten by Paul Mackerras. 10 + * Copyright (C) 1996 Paul Mackerras. 11 + * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net). 12 + * 13 + * This file contains the 64-bit prom entry code. 14 + */ 15 + #include <asm/asm-offsets.h> 16 + #ifdef CONFIG_PPC_BOOK3S 17 + #include <asm/exception-64s.h> 18 + #else 19 + #include <asm/exception-64e.h> 20 + #endif 21 + #include <asm/ppc_asm.h> 22 + 23 + .section ".text","ax",@progbits 24 + 25 + _GLOBAL(enter_prom) 26 + mflr r0 27 + std r0,16(r1) 28 + stdu r1,-SWITCH_FRAME_SIZE(r1) /* Save SP and create stack space */ 29 + 30 + /* Because PROM is running in 32b mode, it clobbers the high order half 31 + * of all registers that it saves. We therefore save those registers 32 + * PROM might touch to the stack. (r0, r3-r13 are caller saved) 33 + */ 34 + SAVE_GPR(2, r1) 35 + SAVE_GPR(13, r1) 36 + SAVE_NVGPRS(r1) 37 + mfcr r10 38 + mfmsr r11 39 + std r10,_CCR(r1) 40 + std r11,_MSR(r1) 41 + 42 + /* Put PROM address in SRR0 */ 43 + mtsrr0 r4 44 + 45 + /* Setup our trampoline return addr in LR */ 46 + bcl 20,31,$+4 47 + 0: mflr r4 48 + addi r4,r4,(1f - 0b) 49 + mtlr r4 50 + 51 + /* Prepare a 32-bit mode big endian MSR 52 + */ 53 + #ifdef CONFIG_PPC_BOOK3E_64 54 + rlwinm r11,r11,0,1,31 55 + mtsrr1 r11 56 + rfi 57 + #else /* CONFIG_PPC_BOOK3E_64 */ 58 + LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_LE) 59 + andc r11,r11,r12 60 + mtsrr1 r11 61 + RFI_TO_KERNEL 62 + #endif /* CONFIG_PPC_BOOK3E_64 */ 63 + 64 + 1: /* Return from OF */ 65 + FIXUP_ENDIAN 66 + 67 + /* Just make sure that r1 top 32 bits didn't get 68 + * corrupt by OF 69 + */ 70 + rldicl r1,r1,0,32 71 + 72 + /* Restore the MSR (back to 64 bits) */ 73 + ld r0,_MSR(r1) 74 + MTMSRD(r0) 75 + isync 76 + 77 + /* Restore other registers */ 78 + REST_GPR(2, r1) 79 + REST_GPR(13, r1) 80 + REST_NVGPRS(r1) 81 + ld r4,_CCR(r1) 82 + mtcr r4 83 + 84 + addi r1,r1,SWITCH_FRAME_SIZE 85 + ld r0,16(r1) 86 + mtlr r0 87 + blr
+6
arch/powerpc/kernel/ptrace/ptrace-decl.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 2 3 + #include <linux/regset.h> 4 + 3 5 /* 4 6 * Set of msr bits that gdb can change on behalf of a process. 5 7 */ ··· 57 55 REGSET_TAR, /* TAR register */ 58 56 REGSET_EBB, /* EBB registers */ 59 57 REGSET_PMR, /* Performance Monitor Registers */ 58 + REGSET_DEXCR, /* DEXCR registers */ 59 + #ifdef CONFIG_CHECKPOINT_RESTORE 60 + REGSET_HASHKEYR, /* HASHKEYR register */ 61 + #endif 60 62 #endif 61 63 #ifdef CONFIG_PPC_MEM_KEYS 62 64 REGSET_PKEY, /* AMR register */
+71 -1
arch/powerpc/kernel/ptrace/ptrace-view.c
··· 454 454 5 * sizeof(unsigned long)); 455 455 return ret; 456 456 } 457 - #endif 457 + 458 + static int dexcr_active(struct task_struct *target, const struct user_regset *regset) 459 + { 460 + if (!cpu_has_feature(CPU_FTR_ARCH_31)) 461 + return -ENODEV; 462 + 463 + return regset->n; 464 + } 465 + 466 + static int dexcr_get(struct task_struct *target, const struct user_regset *regset, 467 + struct membuf to) 468 + { 469 + if (!cpu_has_feature(CPU_FTR_ARCH_31)) 470 + return -ENODEV; 471 + 472 + /* 473 + * The DEXCR is currently static across all CPUs, so we don't 474 + * store the target's value anywhere, but the static value 475 + * will also be correct. 476 + */ 477 + membuf_store(&to, (u64)lower_32_bits(DEXCR_INIT)); 478 + 479 + /* 480 + * Technically the HDEXCR is per-cpu, but a hypervisor can't reasonably 481 + * change it between CPUs of the same guest. 482 + */ 483 + return membuf_store(&to, (u64)lower_32_bits(mfspr(SPRN_HDEXCR_RO))); 484 + } 485 + 486 + #ifdef CONFIG_CHECKPOINT_RESTORE 487 + static int hashkeyr_active(struct task_struct *target, const struct user_regset *regset) 488 + { 489 + if (!cpu_has_feature(CPU_FTR_ARCH_31)) 490 + return -ENODEV; 491 + 492 + return regset->n; 493 + } 494 + 495 + static int hashkeyr_get(struct task_struct *target, const struct user_regset *regset, 496 + struct membuf to) 497 + { 498 + if (!cpu_has_feature(CPU_FTR_ARCH_31)) 499 + return -ENODEV; 500 + 501 + return membuf_store(&to, target->thread.hashkeyr); 502 + } 503 + 504 + static int hashkeyr_set(struct task_struct *target, const struct user_regset *regset, 505 + unsigned int pos, unsigned int count, const void *kbuf, 506 + const void __user *ubuf) 507 + { 508 + if (!cpu_has_feature(CPU_FTR_ARCH_31)) 509 + return -ENODEV; 510 + 511 + return user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.hashkeyr, 512 + 0, sizeof(unsigned long)); 513 + } 514 + #endif /* CONFIG_CHECKPOINT_RESTORE */ 515 + #endif /* CONFIG_PPC_BOOK3S_64 */ 458 516 459 517 #ifdef CONFIG_PPC_MEM_KEYS 460 518 static int pkey_active(struct task_struct *target, const struct user_regset *regset) ··· 673 615 .size = sizeof(u64), .align = sizeof(u64), 674 616 .active = pmu_active, .regset_get = pmu_get, .set = pmu_set 675 617 }, 618 + [REGSET_DEXCR] = { 619 + .core_note_type = NT_PPC_DEXCR, .n = ELF_NDEXCR, 620 + .size = sizeof(u64), .align = sizeof(u64), 621 + .active = dexcr_active, .regset_get = dexcr_get 622 + }, 623 + #ifdef CONFIG_CHECKPOINT_RESTORE 624 + [REGSET_HASHKEYR] = { 625 + .core_note_type = NT_PPC_HASHKEYR, .n = ELF_NHASHKEYR, 626 + .size = sizeof(u64), .align = sizeof(u64), 627 + .active = hashkeyr_active, .regset_get = hashkeyr_get, .set = hashkeyr_set 628 + }, 629 + #endif 676 630 #endif 677 631 #ifdef CONFIG_PPC_MEM_KEYS 678 632 [REGSET_PKEY] = {
+9 -6
arch/powerpc/kernel/signal_32.c
··· 264 264 #endif 265 265 } 266 266 267 - static int __unsafe_save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, 268 - struct mcontext __user *tm_frame, int ctx_has_vsx_region) 267 + static __always_inline int 268 + __unsafe_save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, 269 + struct mcontext __user *tm_frame, int ctx_has_vsx_region) 269 270 { 270 271 unsigned long msr = regs->msr; 271 272 ··· 365 364 current->thread.ckvrsave = mfspr(SPRN_VRSAVE); 366 365 } 367 366 368 - static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame, 369 - struct mcontext __user *tm_frame, unsigned long msr) 367 + static __always_inline int 368 + save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame, 369 + struct mcontext __user *tm_frame, unsigned long msr) 370 370 { 371 371 /* Save both sets of general registers */ 372 372 unsafe_save_general_regs(&current->thread.ckpt_regs, frame, failed); ··· 446 444 #else 447 445 static void prepare_save_tm_user_regs(void) { } 448 446 449 - static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame, 450 - struct mcontext __user *tm_frame, unsigned long msr) 447 + static __always_inline int 448 + save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame, 449 + struct mcontext __user *tm_frame, unsigned long msr) 451 450 { 452 451 return 0; 453 452 }
+2 -2
arch/powerpc/kernel/smp.c
··· 291 291 * Order previous accesses before accesses in the IPI handler. 292 292 */ 293 293 smp_mb(); 294 - message[msg] = 1; 294 + WRITE_ONCE(message[msg], 1); 295 295 } 296 296 297 297 void smp_muxed_ipi_message_pass(int cpu, int msg) ··· 350 350 if (all & IPI_MESSAGE(PPC_MSG_NMI_IPI)) 351 351 nmi_ipi_action(0, NULL); 352 352 #endif 353 - } while (info->messages); 353 + } while (READ_ONCE(info->messages)); 354 354 355 355 return IRQ_HANDLED; 356 356 }
+258
arch/powerpc/kernel/switch.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + #include <linux/objtool.h> 3 + #include <asm/asm-offsets.h> 4 + #include <asm/code-patching-asm.h> 5 + #include <asm/mmu.h> 6 + #include <asm/ppc_asm.h> 7 + #include <asm/kup.h> 8 + #include <asm/thread_info.h> 9 + 10 + .section ".text","ax",@progbits 11 + 12 + #ifdef CONFIG_PPC_BOOK3S_64 13 + /* 14 + * Cancel all explict user streams as they will have no use after context 15 + * switch and will stop the HW from creating streams itself 16 + */ 17 + #define STOP_STREAMS \ 18 + DCBT_BOOK3S_STOP_ALL_STREAM_IDS(r6) 19 + 20 + #define FLUSH_COUNT_CACHE \ 21 + 1: nop; \ 22 + patch_site 1b, patch__call_flush_branch_caches1; \ 23 + 1: nop; \ 24 + patch_site 1b, patch__call_flush_branch_caches2; \ 25 + 1: nop; \ 26 + patch_site 1b, patch__call_flush_branch_caches3 27 + 28 + .macro nops number 29 + .rept \number 30 + nop 31 + .endr 32 + .endm 33 + 34 + .balign 32 35 + .global flush_branch_caches 36 + flush_branch_caches: 37 + /* Save LR into r9 */ 38 + mflr r9 39 + 40 + // Flush the link stack 41 + .rept 64 42 + ANNOTATE_INTRA_FUNCTION_CALL 43 + bl .+4 44 + .endr 45 + b 1f 46 + nops 6 47 + 48 + .balign 32 49 + /* Restore LR */ 50 + 1: mtlr r9 51 + 52 + // If we're just flushing the link stack, return here 53 + 3: nop 54 + patch_site 3b patch__flush_link_stack_return 55 + 56 + li r9,0x7fff 57 + mtctr r9 58 + 59 + PPC_BCCTR_FLUSH 60 + 61 + 2: nop 62 + patch_site 2b patch__flush_count_cache_return 63 + 64 + nops 3 65 + 66 + .rept 278 67 + .balign 32 68 + PPC_BCCTR_FLUSH 69 + nops 7 70 + .endr 71 + 72 + blr 73 + 74 + #ifdef CONFIG_PPC_64S_HASH_MMU 75 + .balign 32 76 + /* 77 + * New stack pointer in r8, old stack pointer in r1, must not clobber r3 78 + */ 79 + pin_stack_slb: 80 + BEGIN_FTR_SECTION 81 + clrrdi r6,r8,28 /* get its ESID */ 82 + clrrdi r9,r1,28 /* get current sp ESID */ 83 + FTR_SECTION_ELSE 84 + clrrdi r6,r8,40 /* get its 1T ESID */ 85 + clrrdi r9,r1,40 /* get current sp 1T ESID */ 86 + ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_1T_SEGMENT) 87 + clrldi. r0,r6,2 /* is new ESID c00000000? */ 88 + cmpd cr1,r6,r9 /* or is new ESID the same as current ESID? */ 89 + cror eq,4*cr1+eq,eq 90 + beq 2f /* if yes, don't slbie it */ 91 + 92 + /* Bolt in the new stack SLB entry */ 93 + ld r7,KSP_VSID(r4) /* Get new stack's VSID */ 94 + oris r0,r6,(SLB_ESID_V)@h 95 + ori r0,r0,(SLB_NUM_BOLTED-1)@l 96 + BEGIN_FTR_SECTION 97 + li r9,MMU_SEGSIZE_1T /* insert B field */ 98 + oris r6,r6,(MMU_SEGSIZE_1T << SLBIE_SSIZE_SHIFT)@h 99 + rldimi r7,r9,SLB_VSID_SSIZE_SHIFT,0 100 + END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 101 + 102 + /* Update the last bolted SLB. No write barriers are needed 103 + * here, provided we only update the current CPU's SLB shadow 104 + * buffer. 105 + */ 106 + ld r9,PACA_SLBSHADOWPTR(r13) 107 + li r12,0 108 + std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */ 109 + li r12,SLBSHADOW_STACKVSID 110 + STDX_BE r7,r12,r9 /* Save VSID */ 111 + li r12,SLBSHADOW_STACKESID 112 + STDX_BE r0,r12,r9 /* Save ESID */ 113 + 114 + /* No need to check for MMU_FTR_NO_SLBIE_B here, since when 115 + * we have 1TB segments, the only CPUs known to have the errata 116 + * only support less than 1TB of system memory and we'll never 117 + * actually hit this code path. 118 + */ 119 + 120 + isync 121 + slbie r6 122 + BEGIN_FTR_SECTION 123 + slbie r6 /* Workaround POWER5 < DD2.1 issue */ 124 + END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) 125 + slbmte r7,r0 126 + isync 127 + 2: blr 128 + .size pin_stack_slb,.-pin_stack_slb 129 + #endif /* CONFIG_PPC_64S_HASH_MMU */ 130 + 131 + #else 132 + #define STOP_STREAMS 133 + #define FLUSH_COUNT_CACHE 134 + #endif /* CONFIG_PPC_BOOK3S_64 */ 135 + 136 + /* 137 + * do_switch_32/64 have the same calling convention as _switch, i.e., r3,r4 138 + * are prev and next thread_struct *, and returns prev task_struct * in r3. 139 + 140 + * This switches the stack, current, and does other task switch housekeeping. 141 + */ 142 + .macro do_switch_32 143 + tophys(r0,r4) 144 + mtspr SPRN_SPRG_THREAD,r0 /* Update current THREAD phys addr */ 145 + lwz r1,KSP(r4) /* Load new stack pointer */ 146 + 147 + /* save the old current 'last' for return value */ 148 + mr r3,r2 149 + addi r2,r4,-THREAD /* Update current */ 150 + .endm 151 + 152 + .macro do_switch_64 153 + ld r8,KSP(r4) /* Load new stack pointer */ 154 + 155 + kuap_check_amr r9, r10 156 + 157 + FLUSH_COUNT_CACHE /* Clobbers r9, ctr */ 158 + 159 + STOP_STREAMS /* Clobbers r6 */ 160 + 161 + addi r3,r3,-THREAD /* old thread -> task_struct for return value */ 162 + addi r6,r4,-THREAD /* new thread -> task_struct */ 163 + std r6,PACACURRENT(r13) /* Set new task_struct to 'current' */ 164 + #if defined(CONFIG_STACKPROTECTOR) 165 + ld r6, TASK_CANARY(r6) 166 + std r6, PACA_CANARY(r13) 167 + #endif 168 + /* Set new PACAKSAVE */ 169 + clrrdi r7,r8,THREAD_SHIFT /* base of new stack */ 170 + addi r7,r7,THREAD_SIZE-SWITCH_FRAME_SIZE 171 + std r7,PACAKSAVE(r13) 172 + 173 + #ifdef CONFIG_PPC_64S_HASH_MMU 174 + BEGIN_MMU_FTR_SECTION 175 + bl pin_stack_slb 176 + END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX) 177 + #endif 178 + /* 179 + * PMU interrupts in radix may come in here. They will use r1, not 180 + * PACAKSAVE, so this stack switch will not cause a problem. They 181 + * will store to the process stack, which may then be migrated to 182 + * another CPU. However the rq lock release on this CPU paired with 183 + * the rq lock acquire on the new CPU before the stack becomes 184 + * active on the new CPU, will order those stores. 185 + */ 186 + mr r1,r8 /* start using new stack pointer */ 187 + .endm 188 + 189 + /* 190 + * This routine switches between two different tasks. The process 191 + * state of one is saved on its kernel stack. Then the state 192 + * of the other is restored from its kernel stack. The memory 193 + * management hardware is updated to the second process's state. 194 + * Finally, we can return to the second process. 195 + * On entry, r3 points to the THREAD for the current task, r4 196 + * points to the THREAD for the new task. 197 + * 198 + * This routine is always called with interrupts disabled. 199 + * 200 + * Note: there are two ways to get to the "going out" portion 201 + * of this code; either by coming in via the entry (_switch) 202 + * or via "fork" which must set up an environment equivalent 203 + * to the "_switch" path. If you change this , you'll have to 204 + * change the fork code also. 205 + * 206 + * The code which creates the new task context is in 'copy_thread' 207 + * in arch/ppc/kernel/process.c 208 + * 209 + * Note: this uses SWITCH_FRAME_SIZE rather than USER_INT_FRAME_SIZE 210 + * because we don't need to leave the redzone ABI gap at the top of 211 + * the kernel stack. 212 + */ 213 + _GLOBAL(_switch) 214 + PPC_CREATE_STACK_FRAME(SWITCH_FRAME_SIZE) 215 + PPC_STL r1,KSP(r3) /* Set old stack pointer */ 216 + SAVE_NVGPRS(r1) /* volatiles are caller-saved -- Cort */ 217 + PPC_STL r0,_NIP(r1) /* Return to switch caller */ 218 + mfcr r0 219 + stw r0,_CCR(r1) 220 + 221 + /* 222 + * On SMP kernels, care must be taken because a task may be 223 + * scheduled off CPUx and on to CPUy. Memory ordering must be 224 + * considered. 225 + * 226 + * Cacheable stores on CPUx will be visible when the task is 227 + * scheduled on CPUy by virtue of the core scheduler barriers 228 + * (see "Notes on Program-Order guarantees on SMP systems." in 229 + * kernel/sched/core.c). 230 + * 231 + * Uncacheable stores in the case of involuntary preemption must 232 + * be taken care of. The smp_mb__after_spinlock() in __schedule() 233 + * is implemented as hwsync on powerpc, which orders MMIO too. So 234 + * long as there is an hwsync in the context switch path, it will 235 + * be executed on the source CPU after the task has performed 236 + * all MMIO ops on that CPU, and on the destination CPU before the 237 + * task performs any MMIO ops there. 238 + */ 239 + 240 + /* 241 + * The kernel context switch path must contain a spin_lock, 242 + * which contains larx/stcx, which will clear any reservation 243 + * of the task being switched. 244 + */ 245 + 246 + #ifdef CONFIG_PPC32 247 + do_switch_32 248 + #else 249 + do_switch_64 250 + #endif 251 + 252 + lwz r0,_CCR(r1) 253 + mtcrf 0xFF,r0 254 + REST_NVGPRS(r1) /* volatiles are destroyed -- Cort */ 255 + PPC_LL r0,_NIP(r1) /* Return to _switch caller in new task */ 256 + mtlr r0 257 + addi r1,r1,SWITCH_FRAME_SIZE 258 + blr
+16
arch/powerpc/kernel/traps.c
··· 1516 1516 return; 1517 1517 } 1518 1518 } 1519 + 1520 + if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE) && user_mode(regs)) { 1521 + ppc_inst_t insn; 1522 + 1523 + if (get_user_instr(insn, (void __user *)regs->nip)) { 1524 + _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip); 1525 + return; 1526 + } 1527 + 1528 + if (ppc_inst_primary_opcode(insn) == 31 && 1529 + get_xop(ppc_inst_val(insn)) == OP_31_XOP_HASHCHK) { 1530 + _exception(SIGILL, regs, ILL_ILLOPN, regs->nip); 1531 + return; 1532 + } 1533 + } 1534 + 1519 1535 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); 1520 1536 return; 1521 1537 }
+2
arch/powerpc/kernel/vdso/Makefile
··· 56 56 ccflags-y := -fno-common -fno-builtin 57 57 ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack 58 58 ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld) 59 + ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) 60 + 59 61 # Filter flags that clang will warn are unused for linking 60 62 ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS)) 61 63
+3 -1
arch/powerpc/kernel/vdso/vdso32.lds.S
··· 83 83 84 84 /DISCARD/ : { 85 85 *(.note.GNU-stack) 86 + *(*.EMB.apuinfo) 87 + *(.branch_lt) 86 88 *(.data .data.* .gnu.linkonce.d.* .sdata*) 87 89 *(.bss .sbss .dynbss .dynsbss) 88 - *(.got1) 90 + *(.got1 .glink .iplt .rela*) 89 91 } 90 92 } 91 93
+3 -1
arch/powerpc/kernel/vdso/vdso64.lds.S
··· 32 32 . = ALIGN(16); 33 33 .text : { 34 34 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) 35 - *(.sfpr .glink) 35 + *(.sfpr) 36 36 } :text 37 37 PROVIDE(__etext = .); 38 38 PROVIDE(_etext = .); ··· 81 81 82 82 /DISCARD/ : { 83 83 *(.note.GNU-stack) 84 + *(*.EMB.apuinfo) 84 85 *(.branch_lt) 85 86 *(.data .data.* .gnu.linkonce.d.* .sdata*) 86 87 *(.bss .sbss .dynbss .dynsbss) 87 88 *(.opd) 89 + *(.glink .iplt .plt .rela*) 88 90 } 89 91 } 90 92
+2 -2
arch/powerpc/kvm/book3s_hv_builtin.c
··· 406 406 return 1; 407 407 408 408 /* see if a host IPI is pending */ 409 - host_ipi = local_paca->kvm_hstate.host_ipi; 409 + host_ipi = READ_ONCE(local_paca->kvm_hstate.host_ipi); 410 410 if (host_ipi) 411 411 return 1; 412 412 ··· 466 466 * meantime. If it's clear, we bounce the interrupt to the 467 467 * guest 468 468 */ 469 - host_ipi = local_paca->kvm_hstate.host_ipi; 469 + host_ipi = READ_ONCE(local_paca->kvm_hstate.host_ipi); 470 470 if (unlikely(host_ipi != 0)) { 471 471 /* We raced with the host, 472 472 * we need to resend that IPI, bummer
+1 -1
arch/powerpc/lib/Makefile
··· 44 44 # 64-bit linker creates .sfpr on demand for final link (vmlinux), 45 45 # so it is only needed for modules, and only for older linkers which 46 46 # do not support --save-restore-funcs 47 - ifeq ($(call ld-ifversion, -lt, 22500, y),y) 47 + ifndef CONFIG_LD_IS_BFD 48 48 extra-$(CONFIG_PPC64) += crtsavres.o 49 49 endif 50 50
+9 -2
arch/powerpc/lib/qspinlock.c
··· 161 161 { 162 162 u32 prev, tmp; 163 163 164 + kcsan_release(); 165 + 164 166 asm volatile( 165 167 "\t" PPC_RELEASE_BARRIER " \n" 166 168 "1: lwarx %0,0,%2 # publish_tail_cpu \n" ··· 437 435 438 436 smp_rmb(); /* See __yield_to_locked_owner comment */ 439 437 440 - if (!node->locked) { 438 + if (!READ_ONCE(node->locked)) { 441 439 yield_to_preempted(prev_cpu, yield_count); 442 440 spin_begin(); 443 441 return preempted; ··· 572 570 573 571 tail = encode_tail_cpu(node->cpu); 574 572 573 + /* 574 + * Assign all attributes of a node before it can be published. 575 + * Issues an lwsync, serving as a release barrier, as well as a 576 + * compiler barrier. 577 + */ 575 578 old = publish_tail_cpu(lock, tail); 576 579 577 580 /* ··· 591 584 592 585 /* Wait for mcs node lock to be released */ 593 586 spin_begin(); 594 - while (!node->locked) { 587 + while (!READ_ONCE(node->locked)) { 595 588 spec_barrier(); 596 589 597 590 if (yield_to_prev(lock, node, old, paravirt))
+4 -4
arch/powerpc/mm/book3s32/hash_low.S
··· 199 199 lis r6, (mmu_hash_lock - PAGE_OFFSET)@ha 200 200 addi r6, r6, (mmu_hash_lock - PAGE_OFFSET)@l 201 201 10: lwarx r0,0,r6 /* take the mmu_hash_lock */ 202 - cmpi 0,r0,0 202 + cmpwi 0,r0,0 203 203 bne- 11f 204 204 stwcx. r8,0,r6 205 205 beq+ 12f 206 206 11: lwz r0,0(r6) 207 - cmpi 0,r0,0 207 + cmpwi 0,r0,0 208 208 beq 10b 209 209 b 11b 210 210 12: isync ··· 512 512 lwz r8, TASK_CPU(r8) 513 513 oris r8,r8,9 514 514 10: lwarx r0,0,r9 515 - cmpi 0,r0,0 515 + cmpwi 0,r0,0 516 516 bne- 11f 517 517 stwcx. r8,0,r9 518 518 beq+ 12f 519 519 11: lwz r0,0(r9) 520 - cmpi 0,r0,0 520 + cmpwi 0,r0,0 521 521 beq 10b 522 522 b 11b 523 523 12: isync
+24 -15
arch/powerpc/mm/book3s64/radix_pgtable.c
··· 745 745 } 746 746 747 747 static void remove_pte_table(pte_t *pte_start, unsigned long addr, 748 - unsigned long end) 748 + unsigned long end, bool direct) 749 749 { 750 - unsigned long next; 750 + unsigned long next, pages = 0; 751 751 pte_t *pte; 752 752 753 753 pte = pte_start + pte_index(addr); ··· 769 769 } 770 770 771 771 pte_clear(&init_mm, addr, pte); 772 + pages++; 772 773 } 774 + if (direct) 775 + update_page_count(mmu_virtual_psize, -pages); 773 776 } 774 777 775 778 static void __meminit remove_pmd_table(pmd_t *pmd_start, unsigned long addr, 776 - unsigned long end) 779 + unsigned long end, bool direct) 777 780 { 778 - unsigned long next; 781 + unsigned long next, pages = 0; 779 782 pte_t *pte_base; 780 783 pmd_t *pmd; 781 784 ··· 796 793 continue; 797 794 } 798 795 pte_clear(&init_mm, addr, (pte_t *)pmd); 796 + pages++; 799 797 continue; 800 798 } 801 799 802 800 pte_base = (pte_t *)pmd_page_vaddr(*pmd); 803 - remove_pte_table(pte_base, addr, next); 801 + remove_pte_table(pte_base, addr, next, direct); 804 802 free_pte_table(pte_base, pmd); 805 803 } 804 + if (direct) 805 + update_page_count(MMU_PAGE_2M, -pages); 806 806 } 807 807 808 808 static void __meminit remove_pud_table(pud_t *pud_start, unsigned long addr, 809 - unsigned long end) 809 + unsigned long end, bool direct) 810 810 { 811 - unsigned long next; 811 + unsigned long next, pages = 0; 812 812 pmd_t *pmd_base; 813 813 pud_t *pud; 814 814 ··· 829 823 continue; 830 824 } 831 825 pte_clear(&init_mm, addr, (pte_t *)pud); 826 + pages++; 832 827 continue; 833 828 } 834 829 835 830 pmd_base = pud_pgtable(*pud); 836 - remove_pmd_table(pmd_base, addr, next); 831 + remove_pmd_table(pmd_base, addr, next, direct); 837 832 free_pmd_table(pmd_base, pud); 838 833 } 834 + if (direct) 835 + update_page_count(MMU_PAGE_1G, -pages); 839 836 } 840 837 841 - static void __meminit remove_pagetable(unsigned long start, unsigned long end) 838 + static void __meminit remove_pagetable(unsigned long start, unsigned long end, 839 + bool direct) 842 840 { 843 841 unsigned long addr, next; 844 842 pud_t *pud_base; ··· 871 861 } 872 862 873 863 pud_base = p4d_pgtable(*p4d); 874 - remove_pud_table(pud_base, addr, next); 864 + remove_pud_table(pud_base, addr, next, direct); 875 865 free_pud_table(pud_base, p4d); 876 866 } 877 867 ··· 894 884 895 885 int __meminit radix__remove_section_mapping(unsigned long start, unsigned long end) 896 886 { 897 - remove_pagetable(start, end); 887 + remove_pagetable(start, end, true); 898 888 return 0; 899 889 } 900 890 #endif /* CONFIG_MEMORY_HOTPLUG */ ··· 912 902 unsigned long phys) 913 903 { 914 904 /* Create a PTE encoding */ 915 - unsigned long flags = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_KERNEL_RW; 916 905 int nid = early_pfn_to_nid(phys >> PAGE_SHIFT); 917 906 int ret; 918 907 ··· 920 911 return -1; 921 912 } 922 913 923 - ret = __map_kernel_page_nid(start, phys, __pgprot(flags), page_size, nid); 914 + ret = __map_kernel_page_nid(start, phys, PAGE_KERNEL, page_size, nid); 924 915 BUG_ON(ret); 925 916 926 917 return 0; ··· 929 920 #ifdef CONFIG_MEMORY_HOTPLUG 930 921 void __meminit radix__vmemmap_remove_mapping(unsigned long start, unsigned long page_size) 931 922 { 932 - remove_pagetable(start, start + page_size); 923 + remove_pagetable(start, start + page_size, false); 933 924 } 934 925 #endif 935 926 #endif ··· 961 952 assert_spin_locked(pmd_lockptr(mm, pmdp)); 962 953 #endif 963 954 964 - old = radix__pte_update(mm, addr, (pte_t *)pmdp, clr, set, 1); 955 + old = radix__pte_update(mm, addr, pmdp_ptep(pmdp), clr, set, 1); 965 956 trace_hugepage_update(addr, old, clr, set); 966 957 967 958 return old;
+1 -1
arch/powerpc/mm/init_64.c
··· 189 189 unsigned long nr_pfn = page_size / sizeof(struct page); 190 190 unsigned long start_pfn = page_to_pfn((struct page *)start); 191 191 192 - if ((start_pfn + nr_pfn) > altmap->end_pfn) 192 + if ((start_pfn + nr_pfn - 1) > altmap->end_pfn) 193 193 return true; 194 194 195 195 if (start_pfn < altmap->base_pfn)
+1 -1
arch/powerpc/platforms/44x/ppc476.c
··· 103 103 .driver = { 104 104 .name = "akebono-avr", 105 105 }, 106 - .probe_new = avr_probe, 106 + .probe = avr_probe, 107 107 .id_table = avr_id, 108 108 }; 109 109
+14 -32
arch/powerpc/platforms/512x/mpc512x_lpbfifo.c
··· 373 373 { 374 374 int ret = -ENODEV; 375 375 struct device_node *lb_node; 376 - const u32 *addr_cells_p; 377 - const u32 *size_cells_p; 378 - int proplen; 379 - size_t i; 376 + size_t i = 0; 377 + struct of_range_parser parser; 378 + struct of_range range; 380 379 381 380 lb_node = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-localbus"); 382 381 if (!lb_node) 383 382 return ret; 384 383 385 - /* 386 - * The node defined as compatible with 'fsl,mpc5121-localbus' 387 - * should have two address cells and one size cell. 388 - * Every item of its ranges property should consist of: 389 - * - the first address cell which is the chipselect number; 390 - * - the second address cell which is the offset in the chipselect, 391 - * must be zero. 392 - * - CPU address of the beginning of an access window; 393 - * - the only size cell which is the size of an access window. 394 - */ 395 - addr_cells_p = of_get_property(lb_node, "#address-cells", NULL); 396 - size_cells_p = of_get_property(lb_node, "#size-cells", NULL); 397 - if (addr_cells_p == NULL || *addr_cells_p != 2 || 398 - size_cells_p == NULL || *size_cells_p != 1) { 399 - goto end; 400 - } 384 + of_range_parser_init(&parser, lb_node); 385 + lpbfifo.cs_n = of_range_count(&parser); 401 386 402 - proplen = of_property_count_u32_elems(lb_node, "ranges"); 403 - if (proplen <= 0 || proplen % 4 != 0) 404 - goto end; 405 - 406 - lpbfifo.cs_n = proplen / 4; 407 387 lpbfifo.cs_ranges = devm_kcalloc(dev, lpbfifo.cs_n, 408 388 sizeof(struct cs_range), GFP_KERNEL); 409 389 if (!lpbfifo.cs_ranges) 410 390 goto end; 411 391 412 - if (of_property_read_u32_array(lb_node, "ranges", 413 - (u32 *)lpbfifo.cs_ranges, proplen) != 0) { 414 - goto end; 415 - } 416 - 417 - for (i = 0; i < lpbfifo.cs_n; i++) { 418 - if (lpbfifo.cs_ranges[i].base != 0) 392 + for_each_of_range(&parser, &range) { 393 + u32 base = lower_32_bits(range.bus_addr); 394 + if (base) 419 395 goto end; 396 + 397 + lpbfifo.cs_ranges[i].csnum = upper_32_bits(range.bus_addr); 398 + lpbfifo.cs_ranges[i].base = base; 399 + lpbfifo.cs_ranges[i].addr = range.cpu_addr; 400 + lpbfifo.cs_ranges[i].size = range.size; 401 + i++; 420 402 } 421 403 422 404 ret = 0;
-5
arch/powerpc/platforms/52xx/Kconfig
··· 54 54 for MPC5200B based boards. 55 55 56 56 It is safe to say 'Y' here 57 - 58 - config PPC_MPC5200_LPBFIFO 59 - tristate "MPC5200 LocalPlus bus FIFO driver" 60 - depends on PPC_MPC52xx && PPC_BESTCOMM 61 - select PPC_BESTCOMM_GEN_BD
-2
arch/powerpc/platforms/52xx/Makefile
··· 14 14 ifdef CONFIG_PPC_LITE5200 15 15 obj-$(CONFIG_PM) += lite5200_sleep.o lite5200_pm.o 16 16 endif 17 - 18 - obj-$(CONFIG_PPC_MPC5200_LPBFIFO) += mpc52xx_lpbfifo.o
+1 -1
arch/powerpc/platforms/52xx/lite5200_pm.c
··· 47 47 static int lite5200_pm_prepare(void) 48 48 { 49 49 struct device_node *np; 50 - const struct of_device_id immr_ids[] = { 50 + static const struct of_device_id immr_ids[] = { 51 51 { .compatible = "fsl,mpc5200-immr", }, 52 52 { .compatible = "fsl,mpc5200b-immr", }, 53 53 { .type = "soc", .compatible = "mpc5200", }, /* lite5200 */
-594
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * LocalPlus Bus FIFO driver for the Freescale MPC52xx. 4 - * 5 - * Copyright (C) 2009 Secret Lab Technologies Ltd. 6 - * 7 - * Todo: 8 - * - Add support for multiple requests to be queued. 9 - */ 10 - 11 - #include <linux/interrupt.h> 12 - #include <linux/kernel.h> 13 - #include <linux/of.h> 14 - #include <linux/of_address.h> 15 - #include <linux/of_irq.h> 16 - #include <linux/of_platform.h> 17 - #include <linux/spinlock.h> 18 - #include <linux/module.h> 19 - #include <asm/io.h> 20 - #include <asm/mpc52xx.h> 21 - #include <asm/time.h> 22 - 23 - #include <linux/fsl/bestcomm/bestcomm.h> 24 - #include <linux/fsl/bestcomm/bestcomm_priv.h> 25 - #include <linux/fsl/bestcomm/gen_bd.h> 26 - 27 - MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); 28 - MODULE_DESCRIPTION("MPC5200 LocalPlus FIFO device driver"); 29 - MODULE_LICENSE("GPL"); 30 - 31 - #define LPBFIFO_REG_PACKET_SIZE (0x00) 32 - #define LPBFIFO_REG_START_ADDRESS (0x04) 33 - #define LPBFIFO_REG_CONTROL (0x08) 34 - #define LPBFIFO_REG_ENABLE (0x0C) 35 - #define LPBFIFO_REG_BYTES_DONE_STATUS (0x14) 36 - #define LPBFIFO_REG_FIFO_DATA (0x40) 37 - #define LPBFIFO_REG_FIFO_STATUS (0x44) 38 - #define LPBFIFO_REG_FIFO_CONTROL (0x48) 39 - #define LPBFIFO_REG_FIFO_ALARM (0x4C) 40 - 41 - struct mpc52xx_lpbfifo { 42 - struct device *dev; 43 - phys_addr_t regs_phys; 44 - void __iomem *regs; 45 - int irq; 46 - spinlock_t lock; 47 - 48 - struct bcom_task *bcom_tx_task; 49 - struct bcom_task *bcom_rx_task; 50 - struct bcom_task *bcom_cur_task; 51 - 52 - /* Current state data */ 53 - struct mpc52xx_lpbfifo_request *req; 54 - int dma_irqs_enabled; 55 - }; 56 - 57 - /* The MPC5200 has only one fifo, so only need one instance structure */ 58 - static struct mpc52xx_lpbfifo lpbfifo; 59 - 60 - /** 61 - * mpc52xx_lpbfifo_kick - Trigger the next block of data to be transferred 62 - * 63 - * @req: Pointer to request structure 64 - */ 65 - static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req) 66 - { 67 - size_t transfer_size = req->size - req->pos; 68 - struct bcom_bd *bd; 69 - void __iomem *reg; 70 - u32 *data; 71 - int i; 72 - int bit_fields; 73 - int dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA); 74 - int write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE; 75 - int poll_dma = req->flags & MPC52XX_LPBFIFO_FLAG_POLL_DMA; 76 - 77 - /* Set and clear the reset bits; is good practice in User Manual */ 78 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); 79 - 80 - /* set master enable bit */ 81 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000001); 82 - if (!dma) { 83 - /* While the FIFO can be setup for transfer sizes as large as 84 - * 16M-1, the FIFO itself is only 512 bytes deep and it does 85 - * not generate interrupts for FIFO full events (only transfer 86 - * complete will raise an IRQ). Therefore when not using 87 - * Bestcomm to drive the FIFO it needs to either be polled, or 88 - * transfers need to constrained to the size of the fifo. 89 - * 90 - * This driver restricts the size of the transfer 91 - */ 92 - if (transfer_size > 512) 93 - transfer_size = 512; 94 - 95 - /* Load the FIFO with data */ 96 - if (write) { 97 - reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA; 98 - data = req->data + req->pos; 99 - for (i = 0; i < transfer_size; i += 4) 100 - out_be32(reg, *data++); 101 - } 102 - 103 - /* Unmask both error and completion irqs */ 104 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000301); 105 - } else { 106 - /* Choose the correct direction 107 - * 108 - * Configure the watermarks so DMA will always complete correctly. 109 - * It may be worth experimenting with the ALARM value to see if 110 - * there is a performance impact. However, if it is wrong there 111 - * is a risk of DMA not transferring the last chunk of data 112 - */ 113 - if (write) { 114 - out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1e4); 115 - out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 7); 116 - lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task; 117 - } else { 118 - out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1ff); 119 - out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 0); 120 - lpbfifo.bcom_cur_task = lpbfifo.bcom_rx_task; 121 - 122 - if (poll_dma) { 123 - if (lpbfifo.dma_irqs_enabled) { 124 - disable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task)); 125 - lpbfifo.dma_irqs_enabled = 0; 126 - } 127 - } else { 128 - if (!lpbfifo.dma_irqs_enabled) { 129 - enable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task)); 130 - lpbfifo.dma_irqs_enabled = 1; 131 - } 132 - } 133 - } 134 - 135 - bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); 136 - bd->status = transfer_size; 137 - if (!write) { 138 - /* 139 - * In the DMA read case, the DMA doesn't complete, 140 - * possibly due to incorrect watermarks in the ALARM 141 - * and CONTROL regs. For now instead of trying to 142 - * determine the right watermarks that will make this 143 - * work, just increase the number of bytes the FIFO is 144 - * expecting. 145 - * 146 - * When submitting another operation, the FIFO will get 147 - * reset, so the condition of the FIFO waiting for a 148 - * non-existent 4 bytes will get cleared. 149 - */ 150 - transfer_size += 4; /* BLECH! */ 151 - } 152 - bd->data[0] = req->data_phys + req->pos; 153 - bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); 154 - 155 - /* error irq & master enabled bit */ 156 - bit_fields = 0x00000201; 157 - 158 - /* Unmask irqs */ 159 - if (write && (!poll_dma)) 160 - bit_fields |= 0x00000100; /* completion irq too */ 161 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, bit_fields); 162 - } 163 - 164 - /* Set transfer size, width, chip select and READ mode */ 165 - out_be32(lpbfifo.regs + LPBFIFO_REG_START_ADDRESS, 166 - req->offset + req->pos); 167 - out_be32(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, transfer_size); 168 - 169 - bit_fields = req->cs << 24 | 0x000008; 170 - if (!write) 171 - bit_fields |= 0x010000; /* read mode */ 172 - out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields); 173 - 174 - /* Kick it off */ 175 - if (!lpbfifo.req->defer_xfer_start) 176 - out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); 177 - if (dma) 178 - bcom_enable(lpbfifo.bcom_cur_task); 179 - } 180 - 181 - /** 182 - * mpc52xx_lpbfifo_irq - IRQ handler for LPB FIFO 183 - * @irq: IRQ number to be handled 184 - * @dev_id: device ID cookie 185 - * 186 - * On transmit, the dma completion irq triggers before the fifo completion 187 - * triggers. Handle the dma completion here instead of the LPB FIFO Bestcomm 188 - * task completion irq because everything is not really done until the LPB FIFO 189 - * completion irq triggers. 190 - * 191 - * In other words: 192 - * For DMA, on receive, the "Fat Lady" is the bestcom completion irq. on 193 - * transmit, the fifo completion irq is the "Fat Lady". The opera (or in this 194 - * case the DMA/FIFO operation) is not finished until the "Fat Lady" sings. 195 - * 196 - * Reasons for entering this routine: 197 - * 1) PIO mode rx and tx completion irq 198 - * 2) DMA interrupt mode tx completion irq 199 - * 3) DMA polled mode tx 200 - * 201 - * Exit conditions: 202 - * 1) Transfer aborted 203 - * 2) FIFO complete without DMA; more data to do 204 - * 3) FIFO complete without DMA; all data transferred 205 - * 4) FIFO complete using DMA 206 - * 207 - * Condition 1 can occur regardless of whether or not DMA is used. 208 - * It requires executing the callback to report the error and exiting 209 - * immediately. 210 - * 211 - * Condition 2 requires programming the FIFO with the next block of data 212 - * 213 - * Condition 3 requires executing the callback to report completion 214 - * 215 - * Condition 4 means the same as 3, except that we also retrieve the bcom 216 - * buffer so DMA doesn't get clogged up. 217 - * 218 - * To make things trickier, the spinlock must be dropped before 219 - * executing the callback, otherwise we could end up with a deadlock 220 - * or nested spinlock condition. The out path is non-trivial, so 221 - * extra fiddling is done to make sure all paths lead to the same 222 - * outbound code. 223 - * 224 - * Return: irqreturn code (%IRQ_HANDLED) 225 - */ 226 - static irqreturn_t mpc52xx_lpbfifo_irq(int irq, void *dev_id) 227 - { 228 - struct mpc52xx_lpbfifo_request *req; 229 - u32 status = in_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS); 230 - void __iomem *reg; 231 - u32 *data; 232 - int count, i; 233 - int do_callback = 0; 234 - u32 ts; 235 - unsigned long flags; 236 - int dma, write, poll_dma; 237 - 238 - spin_lock_irqsave(&lpbfifo.lock, flags); 239 - ts = mftb(); 240 - 241 - req = lpbfifo.req; 242 - if (!req) { 243 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 244 - pr_err("bogus LPBFIFO IRQ\n"); 245 - return IRQ_HANDLED; 246 - } 247 - 248 - dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA); 249 - write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE; 250 - poll_dma = req->flags & MPC52XX_LPBFIFO_FLAG_POLL_DMA; 251 - 252 - if (dma && !write) { 253 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 254 - pr_err("bogus LPBFIFO IRQ (dma and not writing)\n"); 255 - return IRQ_HANDLED; 256 - } 257 - 258 - if ((status & 0x01) == 0) { 259 - goto out; 260 - } 261 - 262 - /* check abort bit */ 263 - if (status & 0x10) { 264 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); 265 - do_callback = 1; 266 - goto out; 267 - } 268 - 269 - /* Read result from hardware */ 270 - count = in_be32(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS); 271 - count &= 0x00ffffff; 272 - 273 - if (!dma && !write) { 274 - /* copy the data out of the FIFO */ 275 - reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA; 276 - data = req->data + req->pos; 277 - for (i = 0; i < count; i += 4) 278 - *data++ = in_be32(reg); 279 - } 280 - 281 - /* Update transfer position and count */ 282 - req->pos += count; 283 - 284 - /* Decide what to do next */ 285 - if (req->size - req->pos) 286 - mpc52xx_lpbfifo_kick(req); /* more work to do */ 287 - else 288 - do_callback = 1; 289 - 290 - out: 291 - /* Clear the IRQ */ 292 - out_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS, 0x01); 293 - 294 - if (dma && (status & 0x11)) { 295 - /* 296 - * Count the DMA as complete only when the FIFO completion 297 - * status or abort bits are set. 298 - * 299 - * (status & 0x01) should always be the case except sometimes 300 - * when using polled DMA. 301 - * 302 - * (status & 0x10) {transfer aborted}: This case needs more 303 - * testing. 304 - */ 305 - bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL); 306 - } 307 - req->last_byte = ((u8 *)req->data)[req->size - 1]; 308 - 309 - /* When the do_callback flag is set; it means the transfer is finished 310 - * so set the FIFO as idle */ 311 - if (do_callback) 312 - lpbfifo.req = NULL; 313 - 314 - if (irq != 0) /* don't increment on polled case */ 315 - req->irq_count++; 316 - 317 - req->irq_ticks += mftb() - ts; 318 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 319 - 320 - /* Spinlock is released; it is now safe to call the callback */ 321 - if (do_callback && req->callback) 322 - req->callback(req); 323 - 324 - return IRQ_HANDLED; 325 - } 326 - 327 - /** 328 - * mpc52xx_lpbfifo_bcom_irq - IRQ handler for LPB FIFO Bestcomm task 329 - * @irq: IRQ number to be handled 330 - * @dev_id: device ID cookie 331 - * 332 - * Only used when receiving data. 333 - * 334 - * Return: irqreturn code (%IRQ_HANDLED) 335 - */ 336 - static irqreturn_t mpc52xx_lpbfifo_bcom_irq(int irq, void *dev_id) 337 - { 338 - struct mpc52xx_lpbfifo_request *req; 339 - unsigned long flags; 340 - u32 status; 341 - u32 ts; 342 - 343 - spin_lock_irqsave(&lpbfifo.lock, flags); 344 - ts = mftb(); 345 - 346 - req = lpbfifo.req; 347 - if (!req || (req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA)) { 348 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 349 - return IRQ_HANDLED; 350 - } 351 - 352 - if (irq != 0) /* don't increment on polled case */ 353 - req->irq_count++; 354 - 355 - if (!bcom_buffer_done(lpbfifo.bcom_cur_task)) { 356 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 357 - 358 - req->buffer_not_done_cnt++; 359 - if ((req->buffer_not_done_cnt % 1000) == 0) 360 - pr_err("transfer stalled\n"); 361 - 362 - return IRQ_HANDLED; 363 - } 364 - 365 - bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL); 366 - 367 - req->last_byte = ((u8 *)req->data)[req->size - 1]; 368 - 369 - req->pos = status & 0x00ffffff; 370 - 371 - /* Mark the FIFO as idle */ 372 - lpbfifo.req = NULL; 373 - 374 - /* Release the lock before calling out to the callback. */ 375 - req->irq_ticks += mftb() - ts; 376 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 377 - 378 - if (req->callback) 379 - req->callback(req); 380 - 381 - return IRQ_HANDLED; 382 - } 383 - 384 - /** 385 - * mpc52xx_lpbfifo_poll - Poll for DMA completion 386 - */ 387 - void mpc52xx_lpbfifo_poll(void) 388 - { 389 - struct mpc52xx_lpbfifo_request *req = lpbfifo.req; 390 - int dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA); 391 - int write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE; 392 - 393 - /* 394 - * For more information, see comments on the "Fat Lady" 395 - */ 396 - if (dma && write) 397 - mpc52xx_lpbfifo_irq(0, NULL); 398 - else 399 - mpc52xx_lpbfifo_bcom_irq(0, NULL); 400 - } 401 - EXPORT_SYMBOL(mpc52xx_lpbfifo_poll); 402 - 403 - /** 404 - * mpc52xx_lpbfifo_submit - Submit an LPB FIFO transfer request. 405 - * @req: Pointer to request structure 406 - * 407 - * Return: %0 on success, -errno code on error 408 - */ 409 - int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req) 410 - { 411 - unsigned long flags; 412 - 413 - if (!lpbfifo.regs) 414 - return -ENODEV; 415 - 416 - spin_lock_irqsave(&lpbfifo.lock, flags); 417 - 418 - /* If the req pointer is already set, then a transfer is in progress */ 419 - if (lpbfifo.req) { 420 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 421 - return -EBUSY; 422 - } 423 - 424 - /* Setup the transfer */ 425 - lpbfifo.req = req; 426 - req->irq_count = 0; 427 - req->irq_ticks = 0; 428 - req->buffer_not_done_cnt = 0; 429 - req->pos = 0; 430 - 431 - mpc52xx_lpbfifo_kick(req); 432 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 433 - return 0; 434 - } 435 - EXPORT_SYMBOL(mpc52xx_lpbfifo_submit); 436 - 437 - int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req) 438 - { 439 - unsigned long flags; 440 - 441 - if (!lpbfifo.regs) 442 - return -ENODEV; 443 - 444 - spin_lock_irqsave(&lpbfifo.lock, flags); 445 - 446 - /* 447 - * If the req pointer is already set and a transfer was 448 - * started on submit, then this transfer is in progress 449 - */ 450 - if (lpbfifo.req && !lpbfifo.req->defer_xfer_start) { 451 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 452 - return -EBUSY; 453 - } 454 - 455 - /* 456 - * If the req was previously submitted but not 457 - * started, start it now 458 - */ 459 - if (lpbfifo.req && lpbfifo.req == req && 460 - lpbfifo.req->defer_xfer_start) { 461 - out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); 462 - } 463 - 464 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 465 - return 0; 466 - } 467 - EXPORT_SYMBOL(mpc52xx_lpbfifo_start_xfer); 468 - 469 - void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req) 470 - { 471 - unsigned long flags; 472 - 473 - spin_lock_irqsave(&lpbfifo.lock, flags); 474 - if (lpbfifo.req == req) { 475 - /* Put it into reset and clear the state */ 476 - bcom_gen_bd_rx_reset(lpbfifo.bcom_rx_task); 477 - bcom_gen_bd_tx_reset(lpbfifo.bcom_tx_task); 478 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); 479 - lpbfifo.req = NULL; 480 - } 481 - spin_unlock_irqrestore(&lpbfifo.lock, flags); 482 - } 483 - EXPORT_SYMBOL(mpc52xx_lpbfifo_abort); 484 - 485 - static int mpc52xx_lpbfifo_probe(struct platform_device *op) 486 - { 487 - struct resource res; 488 - int rc = -ENOMEM; 489 - 490 - if (lpbfifo.dev != NULL) 491 - return -ENOSPC; 492 - 493 - lpbfifo.irq = irq_of_parse_and_map(op->dev.of_node, 0); 494 - if (!lpbfifo.irq) 495 - return -ENODEV; 496 - 497 - if (of_address_to_resource(op->dev.of_node, 0, &res)) 498 - return -ENODEV; 499 - lpbfifo.regs_phys = res.start; 500 - lpbfifo.regs = of_iomap(op->dev.of_node, 0); 501 - if (!lpbfifo.regs) 502 - return -ENOMEM; 503 - 504 - spin_lock_init(&lpbfifo.lock); 505 - 506 - /* Put FIFO into reset */ 507 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); 508 - 509 - /* Register the interrupt handler */ 510 - rc = request_irq(lpbfifo.irq, mpc52xx_lpbfifo_irq, 0, 511 - "mpc52xx-lpbfifo", &lpbfifo); 512 - if (rc) 513 - goto err_irq; 514 - 515 - /* Request the Bestcomm receive (fifo --> memory) task and IRQ */ 516 - lpbfifo.bcom_rx_task = 517 - bcom_gen_bd_rx_init(2, res.start + LPBFIFO_REG_FIFO_DATA, 518 - BCOM_INITIATOR_SCLPC, BCOM_IPR_SCLPC, 519 - 16*1024*1024); 520 - if (!lpbfifo.bcom_rx_task) 521 - goto err_bcom_rx; 522 - 523 - rc = request_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), 524 - mpc52xx_lpbfifo_bcom_irq, 0, 525 - "mpc52xx-lpbfifo-rx", &lpbfifo); 526 - if (rc) 527 - goto err_bcom_rx_irq; 528 - 529 - lpbfifo.dma_irqs_enabled = 1; 530 - 531 - /* Request the Bestcomm transmit (memory --> fifo) task and IRQ */ 532 - lpbfifo.bcom_tx_task = 533 - bcom_gen_bd_tx_init(2, res.start + LPBFIFO_REG_FIFO_DATA, 534 - BCOM_INITIATOR_SCLPC, BCOM_IPR_SCLPC); 535 - if (!lpbfifo.bcom_tx_task) 536 - goto err_bcom_tx; 537 - 538 - lpbfifo.dev = &op->dev; 539 - return 0; 540 - 541 - err_bcom_tx: 542 - free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo); 543 - err_bcom_rx_irq: 544 - bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task); 545 - err_bcom_rx: 546 - free_irq(lpbfifo.irq, &lpbfifo); 547 - err_irq: 548 - iounmap(lpbfifo.regs); 549 - lpbfifo.regs = NULL; 550 - 551 - dev_err(&op->dev, "mpc52xx_lpbfifo_probe() failed\n"); 552 - return -ENODEV; 553 - } 554 - 555 - 556 - static int mpc52xx_lpbfifo_remove(struct platform_device *op) 557 - { 558 - if (lpbfifo.dev != &op->dev) 559 - return 0; 560 - 561 - /* Put FIFO in reset */ 562 - out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); 563 - 564 - /* Release the bestcomm transmit task */ 565 - free_irq(bcom_get_task_irq(lpbfifo.bcom_tx_task), &lpbfifo); 566 - bcom_gen_bd_tx_release(lpbfifo.bcom_tx_task); 567 - 568 - /* Release the bestcomm receive task */ 569 - free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo); 570 - bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task); 571 - 572 - free_irq(lpbfifo.irq, &lpbfifo); 573 - iounmap(lpbfifo.regs); 574 - lpbfifo.regs = NULL; 575 - lpbfifo.dev = NULL; 576 - 577 - return 0; 578 - } 579 - 580 - static const struct of_device_id mpc52xx_lpbfifo_match[] = { 581 - { .compatible = "fsl,mpc5200-lpbfifo", }, 582 - {}, 583 - }; 584 - MODULE_DEVICE_TABLE(of, mpc52xx_lpbfifo_match); 585 - 586 - static struct platform_driver mpc52xx_lpbfifo_driver = { 587 - .driver = { 588 - .name = "mpc52xx-lpbfifo", 589 - .of_match_table = mpc52xx_lpbfifo_match, 590 - }, 591 - .probe = mpc52xx_lpbfifo_probe, 592 - .remove = mpc52xx_lpbfifo_remove, 593 - }; 594 - module_platform_driver(mpc52xx_lpbfifo_driver);
+1 -1
arch/powerpc/platforms/52xx/mpc52xx_pm.c
··· 60 60 int mpc52xx_pm_prepare(void) 61 61 { 62 62 struct device_node *np; 63 - const struct of_device_id immr_ids[] = { 63 + static const struct of_device_id immr_ids[] = { 64 64 { .compatible = "fsl,mpc5200-immr", }, 65 65 { .compatible = "fsl,mpc5200b-immr", }, 66 66 { .type = "soc", .compatible = "mpc5200", }, /* lite5200 */
+1 -1
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
··· 211 211 .name = "mcu-mpc8349emitx", 212 212 .of_match_table = mcu_of_match_table, 213 213 }, 214 - .probe_new = mcu_probe, 214 + .probe = mcu_probe, 215 215 .remove = mcu_remove, 216 216 .id_table = mcu_ids, 217 217 };
-3
arch/powerpc/platforms/85xx/Makefile
··· 12 12 obj-$(CONFIG_BSC9131_RDB) += bsc913x_rdb.o 13 13 obj-$(CONFIG_BSC9132_QDS) += bsc913x_qds.o 14 14 obj-$(CONFIG_C293_PCIE) += c293pcie.o 15 - obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 16 - obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o 17 - obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o 18 15 obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o 19 16 obj8259-$(CONFIG_PPC_I8259) += mpc85xx_8259.o 20 17 obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o $(obj8259-y)
-162
arch/powerpc/platforms/85xx/mpc85xx_ads.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC85xx setup and early boot code plus other random bits. 4 - * 5 - * Maintained by Kumar Gala (see MAINTAINERS for contact information) 6 - * 7 - * Copyright 2005 Freescale Semiconductor Inc. 8 - */ 9 - 10 - #include <linux/stddef.h> 11 - #include <linux/kernel.h> 12 - #include <linux/pci.h> 13 - #include <linux/kdev_t.h> 14 - #include <linux/delay.h> 15 - #include <linux/seq_file.h> 16 - #include <linux/of_platform.h> 17 - 18 - #include <asm/time.h> 19 - #include <asm/machdep.h> 20 - #include <asm/pci-bridge.h> 21 - #include <asm/mpic.h> 22 - #include <mm/mmu_decl.h> 23 - #include <asm/udbg.h> 24 - 25 - #include <sysdev/fsl_soc.h> 26 - #include <sysdev/fsl_pci.h> 27 - 28 - #ifdef CONFIG_CPM2 29 - #include <asm/cpm2.h> 30 - #include <sysdev/cpm2_pic.h> 31 - #endif 32 - 33 - #include "mpc85xx.h" 34 - 35 - static void __init mpc85xx_ads_pic_init(void) 36 - { 37 - struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN, 38 - 0, 256, " OpenPIC "); 39 - BUG_ON(mpic == NULL); 40 - mpic_init(mpic); 41 - 42 - mpc85xx_cpm2_pic_init(); 43 - } 44 - 45 - /* 46 - * Setup the architecture 47 - */ 48 - #ifdef CONFIG_CPM2 49 - struct cpm_pin { 50 - int port, pin, flags; 51 - }; 52 - 53 - static const struct cpm_pin mpc8560_ads_pins[] = { 54 - /* SCC1 */ 55 - {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 56 - {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 57 - {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 58 - 59 - /* SCC2 */ 60 - {2, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 61 - {2, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 62 - {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 63 - {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 64 - {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 65 - 66 - /* FCC2 */ 67 - {1, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 68 - {1, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 69 - {1, 20, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 70 - {1, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 71 - {1, 22, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 72 - {1, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 73 - {1, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 74 - {1, 25, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 75 - {1, 26, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 76 - {1, 27, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 77 - {1, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 78 - {1, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 79 - {1, 30, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 80 - {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 81 - {2, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK14 */ 82 - {2, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK13 */ 83 - 84 - /* FCC3 */ 85 - {1, 4, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 86 - {1, 5, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 87 - {1, 6, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 88 - {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 89 - {1, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 90 - {1, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 91 - {1, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 92 - {1, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 93 - {1, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 94 - {1, 14, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 95 - {1, 15, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 96 - {1, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 97 - {1, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 98 - {2, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK16 */ 99 - {2, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK15 */ 100 - {2, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 101 - }; 102 - 103 - static void __init init_ioports(void) 104 - { 105 - int i; 106 - 107 - for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) { 108 - const struct cpm_pin *pin = &mpc8560_ads_pins[i]; 109 - cpm2_set_pin(pin->port, pin->pin, pin->flags); 110 - } 111 - 112 - cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX); 113 - cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX); 114 - cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX); 115 - cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX); 116 - cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK13, CPM_CLK_RX); 117 - cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK14, CPM_CLK_TX); 118 - cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK15, CPM_CLK_RX); 119 - cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK16, CPM_CLK_TX); 120 - } 121 - #endif 122 - 123 - static void __init mpc85xx_ads_setup_arch(void) 124 - { 125 - if (ppc_md.progress) 126 - ppc_md.progress("mpc85xx_ads_setup_arch()", 0); 127 - 128 - #ifdef CONFIG_CPM2 129 - cpm2_reset(); 130 - init_ioports(); 131 - #endif 132 - 133 - fsl_pci_assign_primary(); 134 - } 135 - 136 - static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) 137 - { 138 - uint pvid, svid, phid1; 139 - 140 - pvid = mfspr(SPRN_PVR); 141 - svid = mfspr(SPRN_SVR); 142 - 143 - seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 144 - seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 145 - seq_printf(m, "SVR\t\t: 0x%x\n", svid); 146 - 147 - /* Display cpu Pll setting */ 148 - phid1 = mfspr(SPRN_HID1); 149 - seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 150 - } 151 - 152 - machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices); 153 - 154 - define_machine(mpc85xx_ads) { 155 - .name = "MPC85xx ADS", 156 - .compatible = "MPC85xxADS", 157 - .setup_arch = mpc85xx_ads_setup_arch, 158 - .init_IRQ = mpc85xx_ads_pic_init, 159 - .show_cpuinfo = mpc85xx_ads_show_cpuinfo, 160 - .get_irq = mpic_get_irq, 161 - .progress = udbg_progress, 162 - };
-387
arch/powerpc/platforms/85xx/mpc85xx_cds.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * MPC85xx setup and early boot code plus other random bits. 4 - * 5 - * Maintained by Kumar Gala (see MAINTAINERS for contact information) 6 - * 7 - * Copyright 2005, 2011-2012 Freescale Semiconductor Inc. 8 - */ 9 - 10 - #include <linux/stddef.h> 11 - #include <linux/kernel.h> 12 - #include <linux/init.h> 13 - #include <linux/errno.h> 14 - #include <linux/reboot.h> 15 - #include <linux/pci.h> 16 - #include <linux/kdev_t.h> 17 - #include <linux/major.h> 18 - #include <linux/console.h> 19 - #include <linux/delay.h> 20 - #include <linux/seq_file.h> 21 - #include <linux/initrd.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/fsl_devices.h> 24 - #include <linux/of_address.h> 25 - #include <linux/of_irq.h> 26 - #include <linux/of_platform.h> 27 - #include <linux/pgtable.h> 28 - 29 - #include <asm/page.h> 30 - #include <linux/atomic.h> 31 - #include <asm/time.h> 32 - #include <asm/io.h> 33 - #include <asm/machdep.h> 34 - #include <asm/ipic.h> 35 - #include <asm/pci-bridge.h> 36 - #include <asm/irq.h> 37 - #include <mm/mmu_decl.h> 38 - #include <asm/udbg.h> 39 - #include <asm/mpic.h> 40 - #include <asm/i8259.h> 41 - 42 - #include <sysdev/fsl_soc.h> 43 - #include <sysdev/fsl_pci.h> 44 - 45 - #include "mpc85xx.h" 46 - 47 - /* 48 - * The CDS board contains an FPGA/CPLD called "Cadmus", which collects 49 - * various logic and performs system control functions. 50 - * Here is the FPGA/CPLD register map. 51 - */ 52 - struct cadmus_reg { 53 - u8 cm_ver; /* Board version */ 54 - u8 cm_csr; /* General control/status */ 55 - u8 cm_rst; /* Reset control */ 56 - u8 cm_hsclk; /* High speed clock */ 57 - u8 cm_hsxclk; /* High speed clock extended */ 58 - u8 cm_led; /* LED data */ 59 - u8 cm_pci; /* PCI control/status */ 60 - u8 cm_dma; /* DMA control */ 61 - u8 res[248]; /* Total 256 bytes */ 62 - }; 63 - 64 - static struct cadmus_reg *cadmus; 65 - 66 - #ifdef CONFIG_PCI 67 - 68 - #define ARCADIA_HOST_BRIDGE_IDSEL 17 69 - #define ARCADIA_2ND_BRIDGE_IDSEL 3 70 - 71 - static int mpc85xx_exclude_device(struct pci_controller *hose, 72 - u_char bus, u_char devfn) 73 - { 74 - /* We explicitly do not go past the Tundra 320 Bridge */ 75 - if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) 76 - return PCIBIOS_DEVICE_NOT_FOUND; 77 - if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) 78 - return PCIBIOS_DEVICE_NOT_FOUND; 79 - else 80 - return PCIBIOS_SUCCESSFUL; 81 - } 82 - 83 - static int mpc85xx_cds_restart(struct notifier_block *this, 84 - unsigned long mode, void *cmd) 85 - { 86 - struct pci_dev *dev; 87 - u_char tmp; 88 - 89 - if ((dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, 90 - NULL))) { 91 - 92 - /* Use the VIA Super Southbridge to force a PCI reset */ 93 - pci_read_config_byte(dev, 0x47, &tmp); 94 - pci_write_config_byte(dev, 0x47, tmp | 1); 95 - 96 - /* Flush the outbound PCI write queues */ 97 - pci_read_config_byte(dev, 0x47, &tmp); 98 - 99 - /* 100 - * At this point, the hardware reset should have triggered. 101 - * However, if it doesn't work for some mysterious reason, 102 - * just fall through to the default reset below. 103 - */ 104 - 105 - pci_dev_put(dev); 106 - } 107 - 108 - /* 109 - * If we can't find the VIA chip (maybe the P2P bridge is 110 - * disabled) or the VIA chip reset didn't work, just return 111 - * and let default reset sequence happen. 112 - */ 113 - return NOTIFY_DONE; 114 - } 115 - 116 - static int mpc85xx_cds_restart_register(void) 117 - { 118 - static struct notifier_block restart_handler; 119 - 120 - restart_handler.notifier_call = mpc85xx_cds_restart; 121 - restart_handler.priority = 192; 122 - 123 - return register_restart_handler(&restart_handler); 124 - } 125 - machine_arch_initcall(mpc85xx_cds, mpc85xx_cds_restart_register); 126 - 127 - 128 - static void __init mpc85xx_cds_pci_irq_fixup(struct pci_dev *dev) 129 - { 130 - u_char c; 131 - if (dev->vendor == PCI_VENDOR_ID_VIA) { 132 - switch (dev->device) { 133 - case PCI_DEVICE_ID_VIA_82C586_1: 134 - /* 135 - * U-Boot does not set the enable bits 136 - * for the IDE device. Force them on here. 137 - */ 138 - pci_read_config_byte(dev, 0x40, &c); 139 - c |= 0x03; /* IDE: Chip Enable Bits */ 140 - pci_write_config_byte(dev, 0x40, c); 141 - 142 - /* 143 - * Since only primary interface works, force the 144 - * IDE function to standard primary IDE interrupt 145 - * w/ 8259 offset 146 - */ 147 - dev->irq = 14; 148 - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 149 - break; 150 - /* 151 - * Force legacy USB interrupt routing 152 - */ 153 - case PCI_DEVICE_ID_VIA_82C586_2: 154 - /* There are two USB controllers. 155 - * Identify them by function number 156 - */ 157 - if (PCI_FUNC(dev->devfn) == 3) 158 - dev->irq = 11; 159 - else 160 - dev->irq = 10; 161 - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 162 - break; 163 - default: 164 - break; 165 - } 166 - } 167 - } 168 - 169 - static void skip_fake_bridge(struct pci_dev *dev) 170 - { 171 - /* Make it an error to skip the fake bridge 172 - * in pci_setup_device() in probe.c */ 173 - dev->hdr_type = 0x7f; 174 - } 175 - DECLARE_PCI_FIXUP_EARLY(0x1957, 0x3fff, skip_fake_bridge); 176 - DECLARE_PCI_FIXUP_EARLY(0x3fff, 0x1957, skip_fake_bridge); 177 - DECLARE_PCI_FIXUP_EARLY(0xff3f, 0x5719, skip_fake_bridge); 178 - 179 - #define PCI_DEVICE_ID_IDT_TSI310 0x01a7 180 - 181 - /* 182 - * Fix Tsi310 PCI-X bridge resource. 183 - * Force the bridge to open a window from 0x0000-0x1fff in PCI I/O space. 184 - * This allows legacy I/O(i8259, etc) on the VIA southbridge to be accessed. 185 - */ 186 - void mpc85xx_cds_fixup_bus(struct pci_bus *bus) 187 - { 188 - struct pci_dev *dev = bus->self; 189 - struct resource *res = bus->resource[0]; 190 - 191 - if (dev != NULL && 192 - dev->vendor == PCI_VENDOR_ID_IBM && 193 - dev->device == PCI_DEVICE_ID_IDT_TSI310) { 194 - if (res) { 195 - res->start = 0; 196 - res->end = 0x1fff; 197 - res->flags = IORESOURCE_IO; 198 - pr_info("mpc85xx_cds: PCI bridge resource fixup applied\n"); 199 - pr_info("mpc85xx_cds: %pR\n", res); 200 - } 201 - } 202 - 203 - fsl_pcibios_fixup_bus(bus); 204 - } 205 - 206 - #ifdef CONFIG_PPC_I8259 207 - static void mpc85xx_8259_cascade_handler(struct irq_desc *desc) 208 - { 209 - unsigned int cascade_irq = i8259_irq(); 210 - 211 - if (cascade_irq) 212 - /* handle an interrupt from the 8259 */ 213 - generic_handle_irq(cascade_irq); 214 - 215 - /* check for any interrupts from the shared IRQ line */ 216 - handle_fasteoi_irq(desc); 217 - } 218 - 219 - static irqreturn_t mpc85xx_8259_cascade_action(int irq, void *dev_id) 220 - { 221 - return IRQ_HANDLED; 222 - } 223 - #endif /* PPC_I8259 */ 224 - #endif /* CONFIG_PCI */ 225 - 226 - static void __init mpc85xx_cds_pic_init(void) 227 - { 228 - struct mpic *mpic; 229 - mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN, 230 - 0, 256, " OpenPIC "); 231 - BUG_ON(mpic == NULL); 232 - mpic_init(mpic); 233 - } 234 - 235 - #if defined(CONFIG_PPC_I8259) && defined(CONFIG_PCI) 236 - static int mpc85xx_cds_8259_attach(void) 237 - { 238 - int ret; 239 - struct device_node *np = NULL; 240 - struct device_node *cascade_node = NULL; 241 - int cascade_irq; 242 - 243 - /* Initialize the i8259 controller */ 244 - for_each_node_by_type(np, "interrupt-controller") 245 - if (of_device_is_compatible(np, "chrp,iic")) { 246 - cascade_node = np; 247 - break; 248 - } 249 - 250 - if (cascade_node == NULL) { 251 - printk(KERN_DEBUG "Could not find i8259 PIC\n"); 252 - return -ENODEV; 253 - } 254 - 255 - cascade_irq = irq_of_parse_and_map(cascade_node, 0); 256 - if (!cascade_irq) { 257 - printk(KERN_ERR "Failed to map cascade interrupt\n"); 258 - return -ENXIO; 259 - } 260 - 261 - i8259_init(cascade_node, 0); 262 - of_node_put(cascade_node); 263 - 264 - /* 265 - * Hook the interrupt to make sure desc->action is never NULL. 266 - * This is required to ensure that the interrupt does not get 267 - * disabled when the last user of the shared IRQ line frees their 268 - * interrupt. 269 - */ 270 - ret = request_irq(cascade_irq, mpc85xx_8259_cascade_action, 271 - IRQF_SHARED | IRQF_NO_THREAD, "8259 cascade", 272 - cascade_node); 273 - if (ret) { 274 - printk(KERN_ERR "Failed to setup cascade interrupt\n"); 275 - return ret; 276 - } 277 - 278 - /* Success. Connect our low-level cascade handler. */ 279 - irq_set_handler(cascade_irq, mpc85xx_8259_cascade_handler); 280 - 281 - return 0; 282 - } 283 - machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach); 284 - 285 - #endif /* CONFIG_PPC_I8259 */ 286 - 287 - static void __init mpc85xx_cds_pci_assign_primary(void) 288 - { 289 - #ifdef CONFIG_PCI 290 - struct device_node *np; 291 - 292 - if (fsl_pci_primary) 293 - return; 294 - 295 - /* 296 - * MPC85xx_CDS has ISA bridge but unfortunately there is no 297 - * isa node in device tree. We now looking for i8259 node as 298 - * a workaround for such a broken device tree. This routine 299 - * is for complying to all device trees. 300 - */ 301 - np = of_find_node_by_name(NULL, "i8259"); 302 - while ((fsl_pci_primary = of_get_parent(np))) { 303 - of_node_put(np); 304 - np = fsl_pci_primary; 305 - 306 - if ((of_device_is_compatible(np, "fsl,mpc8540-pci") || 307 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) && 308 - of_device_is_available(np)) 309 - return; 310 - } 311 - #endif 312 - } 313 - 314 - /* 315 - * Setup the architecture 316 - */ 317 - static void __init mpc85xx_cds_setup_arch(void) 318 - { 319 - struct device_node *np; 320 - int cds_pci_slot; 321 - 322 - if (ppc_md.progress) 323 - ppc_md.progress("mpc85xx_cds_setup_arch()", 0); 324 - 325 - np = of_find_compatible_node(NULL, NULL, "fsl,mpc8548cds-fpga"); 326 - if (!np) { 327 - pr_err("Could not find FPGA node.\n"); 328 - return; 329 - } 330 - 331 - cadmus = of_iomap(np, 0); 332 - of_node_put(np); 333 - if (!cadmus) { 334 - pr_err("Fail to map FPGA area.\n"); 335 - return; 336 - } 337 - 338 - if (ppc_md.progress) { 339 - char buf[40]; 340 - cds_pci_slot = ((in_8(&cadmus->cm_csr) >> 6) & 0x3) + 1; 341 - snprintf(buf, 40, "CDS Version = 0x%x in slot %d\n", 342 - in_8(&cadmus->cm_ver), cds_pci_slot); 343 - ppc_md.progress(buf, 0); 344 - } 345 - 346 - #ifdef CONFIG_PCI 347 - ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; 348 - ppc_md.pci_exclude_device = mpc85xx_exclude_device; 349 - #endif 350 - 351 - mpc85xx_cds_pci_assign_primary(); 352 - fsl_pci_assign_primary(); 353 - } 354 - 355 - static void mpc85xx_cds_show_cpuinfo(struct seq_file *m) 356 - { 357 - uint pvid, svid, phid1; 358 - 359 - pvid = mfspr(SPRN_PVR); 360 - svid = mfspr(SPRN_SVR); 361 - 362 - seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 363 - seq_printf(m, "Machine\t\t: MPC85xx CDS (0x%x)\n", 364 - in_8(&cadmus->cm_ver)); 365 - seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 366 - seq_printf(m, "SVR\t\t: 0x%x\n", svid); 367 - 368 - /* Display cpu Pll setting */ 369 - phid1 = mfspr(SPRN_HID1); 370 - seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 371 - } 372 - 373 - machine_arch_initcall(mpc85xx_cds, mpc85xx_common_publish_devices); 374 - 375 - define_machine(mpc85xx_cds) { 376 - .name = "MPC85xx CDS", 377 - .compatible = "MPC85xxCDS", 378 - .setup_arch = mpc85xx_cds_setup_arch, 379 - .init_IRQ = mpc85xx_cds_pic_init, 380 - .show_cpuinfo = mpc85xx_cds_show_cpuinfo, 381 - .get_irq = mpic_get_irq, 382 - #ifdef CONFIG_PCI 383 - .pcibios_fixup_bus = mpc85xx_cds_fixup_bus, 384 - .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 385 - #endif 386 - .progress = udbg_progress, 387 - };
-1
arch/powerpc/platforms/86xx/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - config PPC_86xx 3 2 menuconfig PPC_86xx 4 3 bool "86xx-based boards" 5 4 depends on PPC_BOOK3S_32
-6
arch/powerpc/platforms/cell/spu_base.c
··· 326 326 if (stat & CLASS1_STORAGE_FAULT_INTR) 327 327 __spu_trap_data_map(spu, dar, dsisr); 328 328 329 - if (stat & CLASS1_LS_COMPARE_SUSPEND_ON_GET_INTR) 330 - ; 331 - 332 - if (stat & CLASS1_LS_COMPARE_SUSPEND_ON_PUT_INTR) 333 - ; 334 - 335 329 spu->class_1_dsisr = 0; 336 330 spu->class_1_dar = 0; 337 331
+2 -2
arch/powerpc/platforms/embedded6xx/Kconfig
··· 10 10 select FSL_SOC 11 11 select PPC_UDBG_16550 if SERIAL_8250 12 12 select DEFAULT_UIMAGE 13 - select MPC10X_BRIDGE 13 + imply MPC10X_BRIDGE if PCI 14 14 help 15 15 Select LINKSTATION if configuring for one of PPC- (MPC8241) 16 16 based NAS systems from Buffalo Technology. So far only ··· 24 24 select MPIC 25 25 select FSL_SOC 26 26 select PPC_UDBG_16550 if SERIAL_8250 27 - select MPC10X_BRIDGE 27 + imply MPC10X_BRIDGE if PCI 28 28 help 29 29 Select STORCENTER if configuring for the iomega StorCenter 30 30 with an 8241 CPU in it.
+6 -6
arch/powerpc/platforms/powermac/feature.c
··· 1053 1053 return -ENODEV; 1054 1054 1055 1055 for_each_of_cpu_node(np) { 1056 - const u32 *num = of_get_property(np, "reg", NULL); 1057 1056 const u32 *rst = of_get_property(np, "soft-reset", NULL); 1058 - if (num == NULL || rst == NULL) 1057 + if (!rst) 1059 1058 continue; 1060 - if (param == *num) { 1059 + if (param == of_get_cpu_hwid(np, 0)) { 1060 + of_node_put(np); 1061 1061 reset_io = *rst; 1062 1062 break; 1063 1063 } ··· 1499 1499 return -ENODEV; 1500 1500 1501 1501 for_each_of_cpu_node(np) { 1502 - const u32 *num = of_get_property(np, "reg", NULL); 1503 1502 const u32 *rst = of_get_property(np, "soft-reset", NULL); 1504 - if (num == NULL || rst == NULL) 1503 + if (!rst) 1505 1504 continue; 1506 - if (param == *num) { 1505 + if (param == of_get_cpu_hwid(np, 0)) { 1506 + of_node_put(np); 1507 1507 reset_io = *rst; 1508 1508 break; 1509 1509 }
+9 -7
arch/powerpc/platforms/powernv/idle.c
··· 246 246 { 247 247 int cpu = raw_smp_processor_id(); 248 248 int first = cpu_first_thread_sibling(cpu); 249 - unsigned long *state = &paca_ptrs[first]->idle_state; 249 + unsigned long *lock = &paca_ptrs[first]->idle_lock; 250 250 251 - while (unlikely(test_and_set_bit_lock(NR_PNV_CORE_IDLE_LOCK_BIT, state))) 251 + while (unlikely(test_and_set_bit_lock(NR_PNV_CORE_IDLE_LOCK_BIT, lock))) 252 252 barrier(); 253 253 } 254 254 ··· 258 258 int first = cpu_first_thread_sibling(cpu); 259 259 unsigned long thread = 1UL << cpu_thread_in_core(cpu); 260 260 unsigned long *state = &paca_ptrs[first]->idle_state; 261 + unsigned long *lock = &paca_ptrs[first]->idle_lock; 261 262 u64 s = READ_ONCE(*state); 262 263 u64 new, tmp; 263 264 264 - BUG_ON(!(s & PNV_CORE_IDLE_LOCK_BIT)); 265 + BUG_ON(!(READ_ONCE(*lock) & PNV_CORE_IDLE_LOCK_BIT)); 265 266 BUG_ON(s & thread); 266 267 267 268 again: 268 - new = (s | thread) & ~PNV_CORE_IDLE_LOCK_BIT; 269 + new = s | thread; 269 270 tmp = cmpxchg(state, s, new); 270 271 if (unlikely(tmp != s)) { 271 272 s = tmp; 272 273 goto again; 273 274 } 275 + clear_bit_unlock(NR_PNV_CORE_IDLE_LOCK_BIT, lock); 274 276 } 275 277 276 278 static inline void atomic_unlock_thread_idle(void) 277 279 { 278 280 int cpu = raw_smp_processor_id(); 279 281 int first = cpu_first_thread_sibling(cpu); 280 - unsigned long *state = &paca_ptrs[first]->idle_state; 282 + unsigned long *lock = &paca_ptrs[first]->idle_lock; 281 283 282 - BUG_ON(!test_bit(NR_PNV_CORE_IDLE_LOCK_BIT, state)); 283 - clear_bit_unlock(NR_PNV_CORE_IDLE_LOCK_BIT, state); 284 + BUG_ON(!test_bit(NR_PNV_CORE_IDLE_LOCK_BIT, lock)); 285 + clear_bit_unlock(NR_PNV_CORE_IDLE_LOCK_BIT, lock); 284 286 } 285 287 286 288 /* P7 and P8 */
-2
arch/powerpc/platforms/powernv/opal-call.c
··· 167 167 OPAL_CALL(opal_pci_set_phb_table_memory, OPAL_PCI_SET_PHB_TABLE_MEMORY); 168 168 OPAL_CALL(opal_pci_set_pe, OPAL_PCI_SET_PE); 169 169 OPAL_CALL(opal_pci_set_peltv, OPAL_PCI_SET_PELTV); 170 - OPAL_CALL(opal_pci_set_mve, OPAL_PCI_SET_MVE); 171 - OPAL_CALL(opal_pci_set_mve_enable, OPAL_PCI_SET_MVE_ENABLE); 172 170 OPAL_CALL(opal_pci_get_xive_reissue, OPAL_PCI_GET_XIVE_REISSUE); 173 171 OPAL_CALL(opal_pci_set_xive_reissue, OPAL_PCI_SET_XIVE_REISSUE); 174 172 OPAL_CALL(opal_pci_set_xive_pe, OPAL_PCI_SET_XIVE_PE);
+3 -3
arch/powerpc/platforms/powernv/opal-irqchip.c
··· 59 59 60 60 cond_resched(); 61 61 } 62 - last_outstanding_events = 0; 62 + WRITE_ONCE(last_outstanding_events, 0); 63 63 if (opal_poll_events(&events) != OPAL_SUCCESS) 64 64 return; 65 65 e = be64_to_cpu(events) & opal_event_irqchip.mask; ··· 69 69 70 70 bool opal_have_pending_events(void) 71 71 { 72 - if (last_outstanding_events & opal_event_irqchip.mask) 72 + if (READ_ONCE(last_outstanding_events) & opal_event_irqchip.mask) 73 73 return true; 74 74 return false; 75 75 } ··· 124 124 __be64 events; 125 125 126 126 opal_handle_interrupt(virq_to_hw(irq), &events); 127 - last_outstanding_events = be64_to_cpu(events); 127 + WRITE_ONCE(last_outstanding_events, be64_to_cpu(events)); 128 128 if (opal_have_pending_events()) 129 129 opal_wake_poller(); 130 130
+6 -470
arch/powerpc/platforms/powernv/pci-ioda.c
··· 45 45 #include "pci.h" 46 46 #include "../../../../drivers/pci/pci.h" 47 47 48 - #define PNV_IODA1_M64_NUM 16 /* Number of M64 BARs */ 49 - #define PNV_IODA1_M64_SEGS 8 /* Segments per M64 BAR */ 50 - #define PNV_IODA1_DMA32_SEGSIZE 0x10000000 51 - 52 - static const char * const pnv_phb_names[] = { "IODA1", "IODA2", "NPU_OCAPI" }; 48 + /* This array is indexed with enum pnv_phb_type */ 49 + static const char * const pnv_phb_names[] = { "IODA2", "NPU_OCAPI" }; 53 50 54 51 static void pnv_pci_ioda2_set_bypass(struct pnv_ioda_pe *pe, bool enable); 55 52 static void pnv_pci_configure_bus(struct pci_bus *bus); ··· 277 280 } 278 281 } 279 282 280 - static int pnv_ioda1_init_m64(struct pnv_phb *phb) 281 - { 282 - struct resource *r; 283 - int index; 284 - 285 - /* 286 - * There are 16 M64 BARs, each of which has 8 segments. So 287 - * there are as many M64 segments as the maximum number of 288 - * PEs, which is 128. 289 - */ 290 - for (index = 0; index < PNV_IODA1_M64_NUM; index++) { 291 - unsigned long base, segsz = phb->ioda.m64_segsize; 292 - int64_t rc; 293 - 294 - base = phb->ioda.m64_base + 295 - index * PNV_IODA1_M64_SEGS * segsz; 296 - rc = opal_pci_set_phb_mem_window(phb->opal_id, 297 - OPAL_M64_WINDOW_TYPE, index, base, 0, 298 - PNV_IODA1_M64_SEGS * segsz); 299 - if (rc != OPAL_SUCCESS) { 300 - pr_warn(" Error %lld setting M64 PHB#%x-BAR#%d\n", 301 - rc, phb->hose->global_number, index); 302 - goto fail; 303 - } 304 - 305 - rc = opal_pci_phb_mmio_enable(phb->opal_id, 306 - OPAL_M64_WINDOW_TYPE, index, 307 - OPAL_ENABLE_M64_SPLIT); 308 - if (rc != OPAL_SUCCESS) { 309 - pr_warn(" Error %lld enabling M64 PHB#%x-BAR#%d\n", 310 - rc, phb->hose->global_number, index); 311 - goto fail; 312 - } 313 - } 314 - 315 - for (index = 0; index < phb->ioda.total_pe_num; index++) { 316 - int64_t rc; 317 - 318 - /* 319 - * P7IOC supports M64DT, which helps mapping M64 segment 320 - * to one particular PE#. However, PHB3 has fixed mapping 321 - * between M64 segment and PE#. In order to have same logic 322 - * for P7IOC and PHB3, we enforce fixed mapping between M64 323 - * segment and PE# on P7IOC. 324 - */ 325 - rc = opal_pci_map_pe_mmio_window(phb->opal_id, 326 - index, OPAL_M64_WINDOW_TYPE, 327 - index / PNV_IODA1_M64_SEGS, 328 - index % PNV_IODA1_M64_SEGS); 329 - if (rc != OPAL_SUCCESS) { 330 - pr_warn("%s: Error %lld mapping M64 for PHB#%x-PE#%x\n", 331 - __func__, rc, phb->hose->global_number, 332 - index); 333 - goto fail; 334 - } 335 - } 336 - 337 - /* 338 - * Exclude the segments for reserved and root bus PE, which 339 - * are first or last two PEs. 340 - */ 341 - r = &phb->hose->mem_resources[1]; 342 - if (phb->ioda.reserved_pe_idx == 0) 343 - r->start += (2 * phb->ioda.m64_segsize); 344 - else if (phb->ioda.reserved_pe_idx == (phb->ioda.total_pe_num - 1)) 345 - r->end -= (2 * phb->ioda.m64_segsize); 346 - else 347 - WARN(1, "Wrong reserved PE#%x on PHB#%x\n", 348 - phb->ioda.reserved_pe_idx, phb->hose->global_number); 349 - 350 - return 0; 351 - 352 - fail: 353 - for ( ; index >= 0; index--) 354 - opal_pci_phb_mmio_enable(phb->opal_id, 355 - OPAL_M64_WINDOW_TYPE, index, OPAL_DISABLE_M64); 356 - 357 - return -EIO; 358 - } 359 - 360 283 static void pnv_ioda_reserve_m64_pe(struct pci_bus *bus, 361 284 unsigned long *pe_bitmap, 362 285 bool all) ··· 360 443 const __be32 *r; 361 444 u64 pci_addr; 362 445 363 - if (phb->type != PNV_PHB_IODA1 && phb->type != PNV_PHB_IODA2) { 446 + if (phb->type != PNV_PHB_IODA2) { 364 447 pr_info(" Not support M64 window\n"); 365 448 return; 366 449 } ··· 435 518 * Setup init functions for M64 based on IODA version, IODA3 uses 436 519 * the IODA2 code. 437 520 */ 438 - if (phb->type == PNV_PHB_IODA1) 439 - phb->init_m64 = pnv_ioda1_init_m64; 440 - else 441 - phb->init_m64 = pnv_ioda2_init_m64; 521 + phb->init_m64 = pnv_ioda2_init_m64; 442 522 } 443 523 444 524 static void pnv_ioda_freeze_pe(struct pnv_phb *phb, int pe_no) ··· 866 952 for (rid = pe->rid; rid < rid_end; rid++) 867 953 phb->ioda.pe_rmap[rid] = pe->pe_number; 868 954 869 - /* Setup one MVTs on IODA1 */ 870 - if (phb->type != PNV_PHB_IODA1) { 871 - pe->mve_number = 0; 872 - goto out; 873 - } 955 + pe->mve_number = 0; 874 956 875 - pe->mve_number = pe->pe_number; 876 - rc = opal_pci_set_mve(phb->opal_id, pe->mve_number, pe->pe_number); 877 - if (rc != OPAL_SUCCESS) { 878 - pe_err(pe, "OPAL error %ld setting up MVE %x\n", 879 - rc, pe->mve_number); 880 - pe->mve_number = -1; 881 - } else { 882 - rc = opal_pci_set_mve_enable(phb->opal_id, 883 - pe->mve_number, OPAL_ENABLE_MVE); 884 - if (rc) { 885 - pe_err(pe, "OPAL error %ld enabling MVE %x\n", 886 - rc, pe->mve_number); 887 - pe->mve_number = -1; 888 - } 889 - } 890 - 891 - out: 892 957 return 0; 893 958 } 894 959 ··· 990 1097 return pe; 991 1098 } 992 1099 993 - static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb *phb, 994 - struct pnv_ioda_pe *pe); 995 - 996 1100 static void pnv_pci_ioda_dma_dev_setup(struct pci_dev *pdev) 997 1101 { 998 1102 struct pnv_phb *phb = pci_bus_to_pnvhb(pdev->bus); ··· 1024 1134 */ 1025 1135 if (!pe->dma_setup_done && !pci_is_bridge(pdev)) { 1026 1136 switch (phb->type) { 1027 - case PNV_PHB_IODA1: 1028 - pnv_pci_ioda1_setup_dma_pe(phb, pe); 1029 - break; 1030 1137 case PNV_PHB_IODA2: 1031 1138 pnv_pci_ioda2_setup_dma_pe(phb, pe); 1032 1139 break; ··· 1160 1273 return phb->regs + 0x210; 1161 1274 } 1162 1275 1163 - static void pnv_pci_p7ioc_tce_invalidate(struct iommu_table *tbl, 1164 - unsigned long index, unsigned long npages) 1165 - { 1166 - struct iommu_table_group_link *tgl = list_first_entry_or_null( 1167 - &tbl->it_group_list, struct iommu_table_group_link, 1168 - next); 1169 - struct pnv_ioda_pe *pe = container_of(tgl->table_group, 1170 - struct pnv_ioda_pe, table_group); 1171 - __be64 __iomem *invalidate = pnv_ioda_get_inval_reg(pe->phb); 1172 - unsigned long start, end, inc; 1173 - 1174 - start = __pa(((__be64 *)tbl->it_base) + index - tbl->it_offset); 1175 - end = __pa(((__be64 *)tbl->it_base) + index - tbl->it_offset + 1176 - npages - 1); 1177 - 1178 - /* p7ioc-style invalidation, 2 TCEs per write */ 1179 - start |= (1ull << 63); 1180 - end |= (1ull << 63); 1181 - inc = 16; 1182 - end |= inc - 1; /* round up end to be different than start */ 1183 - 1184 - mb(); /* Ensure above stores are visible */ 1185 - while (start <= end) { 1186 - __raw_writeq_be(start, invalidate); 1187 - start += inc; 1188 - } 1189 - 1190 - /* 1191 - * The iommu layer will do another mb() for us on build() 1192 - * and we don't care on free() 1193 - */ 1194 - } 1195 - 1196 - static int pnv_ioda1_tce_build(struct iommu_table *tbl, long index, 1197 - long npages, unsigned long uaddr, 1198 - enum dma_data_direction direction, 1199 - unsigned long attrs) 1200 - { 1201 - int ret = pnv_tce_build(tbl, index, npages, uaddr, direction, 1202 - attrs); 1203 - 1204 - if (!ret) 1205 - pnv_pci_p7ioc_tce_invalidate(tbl, index, npages); 1206 - 1207 - return ret; 1208 - } 1209 - 1210 1276 #ifdef CONFIG_IOMMU_API 1211 1277 /* Common for IODA1 and IODA2 */ 1212 1278 static int pnv_ioda_tce_xchg_no_kill(struct iommu_table *tbl, long index, ··· 1168 1328 return pnv_tce_xchg(tbl, index, hpa, direction); 1169 1329 } 1170 1330 #endif 1171 - 1172 - static void pnv_ioda1_tce_free(struct iommu_table *tbl, long index, 1173 - long npages) 1174 - { 1175 - pnv_tce_free(tbl, index, npages); 1176 - 1177 - pnv_pci_p7ioc_tce_invalidate(tbl, index, npages); 1178 - } 1179 - 1180 - static struct iommu_table_ops pnv_ioda1_iommu_ops = { 1181 - .set = pnv_ioda1_tce_build, 1182 - #ifdef CONFIG_IOMMU_API 1183 - .xchg_no_kill = pnv_ioda_tce_xchg_no_kill, 1184 - .tce_kill = pnv_pci_p7ioc_tce_invalidate, 1185 - .useraddrptr = pnv_tce_useraddrptr, 1186 - #endif 1187 - .clear = pnv_ioda1_tce_free, 1188 - .get = pnv_tce_get, 1189 - }; 1190 1331 1191 1332 #define PHB3_TCE_KILL_INVAL_ALL PPC_BIT(0) 1192 1333 #define PHB3_TCE_KILL_INVAL_PE PPC_BIT(1) ··· 1273 1452 .get = pnv_tce_get, 1274 1453 .free = pnv_pci_ioda2_table_free_pages, 1275 1454 }; 1276 - 1277 - static int pnv_pci_ioda_dev_dma_weight(struct pci_dev *dev, void *data) 1278 - { 1279 - unsigned int *weight = (unsigned int *)data; 1280 - 1281 - /* This is quite simplistic. The "base" weight of a device 1282 - * is 10. 0 means no DMA is to be accounted for it. 1283 - */ 1284 - if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL) 1285 - return 0; 1286 - 1287 - if (dev->class == PCI_CLASS_SERIAL_USB_UHCI || 1288 - dev->class == PCI_CLASS_SERIAL_USB_OHCI || 1289 - dev->class == PCI_CLASS_SERIAL_USB_EHCI) 1290 - *weight += 3; 1291 - else if ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID) 1292 - *weight += 15; 1293 - else 1294 - *weight += 10; 1295 - 1296 - return 0; 1297 - } 1298 - 1299 - static unsigned int pnv_pci_ioda_pe_dma_weight(struct pnv_ioda_pe *pe) 1300 - { 1301 - unsigned int weight = 0; 1302 - 1303 - /* SRIOV VF has same DMA32 weight as its PF */ 1304 - #ifdef CONFIG_PCI_IOV 1305 - if ((pe->flags & PNV_IODA_PE_VF) && pe->parent_dev) { 1306 - pnv_pci_ioda_dev_dma_weight(pe->parent_dev, &weight); 1307 - return weight; 1308 - } 1309 - #endif 1310 - 1311 - if ((pe->flags & PNV_IODA_PE_DEV) && pe->pdev) { 1312 - pnv_pci_ioda_dev_dma_weight(pe->pdev, &weight); 1313 - } else if ((pe->flags & PNV_IODA_PE_BUS) && pe->pbus) { 1314 - struct pci_dev *pdev; 1315 - 1316 - list_for_each_entry(pdev, &pe->pbus->devices, bus_list) 1317 - pnv_pci_ioda_dev_dma_weight(pdev, &weight); 1318 - } else if ((pe->flags & PNV_IODA_PE_BUS_ALL) && pe->pbus) { 1319 - pci_walk_bus(pe->pbus, pnv_pci_ioda_dev_dma_weight, &weight); 1320 - } 1321 - 1322 - return weight; 1323 - } 1324 - 1325 - static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb *phb, 1326 - struct pnv_ioda_pe *pe) 1327 - { 1328 - 1329 - struct page *tce_mem = NULL; 1330 - struct iommu_table *tbl; 1331 - unsigned int weight, total_weight = 0; 1332 - unsigned int tce32_segsz, base, segs, avail, i; 1333 - int64_t rc; 1334 - void *addr; 1335 - 1336 - /* XXX FIXME: Handle 64-bit only DMA devices */ 1337 - /* XXX FIXME: Provide 64-bit DMA facilities & non-4K TCE tables etc.. */ 1338 - /* XXX FIXME: Allocate multi-level tables on PHB3 */ 1339 - weight = pnv_pci_ioda_pe_dma_weight(pe); 1340 - if (!weight) 1341 - return; 1342 - 1343 - pci_walk_bus(phb->hose->bus, pnv_pci_ioda_dev_dma_weight, 1344 - &total_weight); 1345 - segs = (weight * phb->ioda.dma32_count) / total_weight; 1346 - if (!segs) 1347 - segs = 1; 1348 - 1349 - /* 1350 - * Allocate contiguous DMA32 segments. We begin with the expected 1351 - * number of segments. With one more attempt, the number of DMA32 1352 - * segments to be allocated is decreased by one until one segment 1353 - * is allocated successfully. 1354 - */ 1355 - do { 1356 - for (base = 0; base <= phb->ioda.dma32_count - segs; base++) { 1357 - for (avail = 0, i = base; i < base + segs; i++) { 1358 - if (phb->ioda.dma32_segmap[i] == 1359 - IODA_INVALID_PE) 1360 - avail++; 1361 - } 1362 - 1363 - if (avail == segs) 1364 - goto found; 1365 - } 1366 - } while (--segs); 1367 - 1368 - if (!segs) { 1369 - pe_warn(pe, "No available DMA32 segments\n"); 1370 - return; 1371 - } 1372 - 1373 - found: 1374 - tbl = pnv_pci_table_alloc(phb->hose->node); 1375 - if (WARN_ON(!tbl)) 1376 - return; 1377 - 1378 - #ifdef CONFIG_IOMMU_API 1379 - pe->table_group.ops = &spapr_tce_table_group_ops; 1380 - pe->table_group.pgsizes = SZ_4K; 1381 - #endif 1382 - iommu_register_group(&pe->table_group, phb->hose->global_number, 1383 - pe->pe_number); 1384 - pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group); 1385 - 1386 - /* Grab a 32-bit TCE table */ 1387 - pe_info(pe, "DMA weight %d (%d), assigned (%d) %d DMA32 segments\n", 1388 - weight, total_weight, base, segs); 1389 - pe_info(pe, " Setting up 32-bit TCE table at %08x..%08x\n", 1390 - base * PNV_IODA1_DMA32_SEGSIZE, 1391 - (base + segs) * PNV_IODA1_DMA32_SEGSIZE - 1); 1392 - 1393 - /* XXX Currently, we allocate one big contiguous table for the 1394 - * TCEs. We only really need one chunk per 256M of TCE space 1395 - * (ie per segment) but that's an optimization for later, it 1396 - * requires some added smarts with our get/put_tce implementation 1397 - * 1398 - * Each TCE page is 4KB in size and each TCE entry occupies 8 1399 - * bytes 1400 - */ 1401 - tce32_segsz = PNV_IODA1_DMA32_SEGSIZE >> (IOMMU_PAGE_SHIFT_4K - 3); 1402 - tce_mem = alloc_pages_node(phb->hose->node, GFP_KERNEL, 1403 - get_order(tce32_segsz * segs)); 1404 - if (!tce_mem) { 1405 - pe_err(pe, " Failed to allocate a 32-bit TCE memory\n"); 1406 - goto fail; 1407 - } 1408 - addr = page_address(tce_mem); 1409 - memset(addr, 0, tce32_segsz * segs); 1410 - 1411 - /* Configure HW */ 1412 - for (i = 0; i < segs; i++) { 1413 - rc = opal_pci_map_pe_dma_window(phb->opal_id, 1414 - pe->pe_number, 1415 - base + i, 1, 1416 - __pa(addr) + tce32_segsz * i, 1417 - tce32_segsz, IOMMU_PAGE_SIZE_4K); 1418 - if (rc) { 1419 - pe_err(pe, " Failed to configure 32-bit TCE table, err %lld\n", 1420 - rc); 1421 - goto fail; 1422 - } 1423 - } 1424 - 1425 - /* Setup DMA32 segment mapping */ 1426 - for (i = base; i < base + segs; i++) 1427 - phb->ioda.dma32_segmap[i] = pe->pe_number; 1428 - 1429 - /* Setup linux iommu table */ 1430 - pnv_pci_setup_iommu_table(tbl, addr, tce32_segsz * segs, 1431 - base * PNV_IODA1_DMA32_SEGSIZE, 1432 - IOMMU_PAGE_SHIFT_4K); 1433 - 1434 - tbl->it_ops = &pnv_ioda1_iommu_ops; 1435 - pe->table_group.tce32_start = tbl->it_offset << tbl->it_page_shift; 1436 - pe->table_group.tce32_size = tbl->it_size << tbl->it_page_shift; 1437 - tbl->it_index = (phb->hose->global_number << 16) | pe->pe_number; 1438 - if (!iommu_init_table(tbl, phb->hose->node, 0, 0)) 1439 - panic("Failed to initialize iommu table"); 1440 - 1441 - pe->dma_setup_done = true; 1442 - return; 1443 - fail: 1444 - /* XXX Failure: Try to fallback to 64-bit only ? */ 1445 - if (tce_mem) 1446 - __free_pages(tce_mem, get_order(tce32_segsz * segs)); 1447 - if (tbl) { 1448 - pnv_pci_unlink_table_and_group(tbl, &pe->table_group); 1449 - iommu_tce_table_put(tbl); 1450 - } 1451 - } 1452 1455 1453 1456 static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group, 1454 1457 int num, struct iommu_table *tbl) ··· 2352 2707 return true; 2353 2708 } 2354 2709 2355 - static long pnv_pci_ioda1_unset_window(struct iommu_table_group *table_group, 2356 - int num) 2357 - { 2358 - struct pnv_ioda_pe *pe = container_of(table_group, 2359 - struct pnv_ioda_pe, table_group); 2360 - struct pnv_phb *phb = pe->phb; 2361 - unsigned int idx; 2362 - long rc; 2363 - 2364 - pe_info(pe, "Removing DMA window #%d\n", num); 2365 - for (idx = 0; idx < phb->ioda.dma32_count; idx++) { 2366 - if (phb->ioda.dma32_segmap[idx] != pe->pe_number) 2367 - continue; 2368 - 2369 - rc = opal_pci_map_pe_dma_window(phb->opal_id, pe->pe_number, 2370 - idx, 0, 0ul, 0ul, 0ul); 2371 - if (rc != OPAL_SUCCESS) { 2372 - pe_warn(pe, "Failure %ld unmapping DMA32 segment#%d\n", 2373 - rc, idx); 2374 - return rc; 2375 - } 2376 - 2377 - phb->ioda.dma32_segmap[idx] = IODA_INVALID_PE; 2378 - } 2379 - 2380 - pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); 2381 - return OPAL_SUCCESS; 2382 - } 2383 - 2384 - static void pnv_pci_ioda1_release_pe_dma(struct pnv_ioda_pe *pe) 2385 - { 2386 - struct iommu_table *tbl = pe->table_group.tables[0]; 2387 - int64_t rc; 2388 - 2389 - if (!pe->dma_setup_done) 2390 - return; 2391 - 2392 - rc = pnv_pci_ioda1_unset_window(&pe->table_group, 0); 2393 - if (rc != OPAL_SUCCESS) 2394 - return; 2395 - 2396 - pnv_pci_p7ioc_tce_invalidate(tbl, tbl->it_offset, tbl->it_size); 2397 - if (pe->table_group.group) { 2398 - iommu_group_put(pe->table_group.group); 2399 - WARN_ON(pe->table_group.group); 2400 - } 2401 - 2402 - free_pages(tbl->it_base, get_order(tbl->it_size << 3)); 2403 - iommu_tce_table_put(tbl); 2404 - } 2405 - 2406 2710 void pnv_pci_ioda2_release_pe_dma(struct pnv_ioda_pe *pe) 2407 2711 { 2408 2712 struct iommu_table *tbl = pe->table_group.tables[0]; ··· 2400 2806 { 2401 2807 struct pnv_phb *phb = pe->phb; 2402 2808 2403 - if (phb->type == PNV_PHB_IODA1) { 2404 - pnv_ioda_free_pe_seg(pe, OPAL_IO_WINDOW_TYPE, 2405 - phb->ioda.io_segmap); 2406 - pnv_ioda_free_pe_seg(pe, OPAL_M32_WINDOW_TYPE, 2407 - phb->ioda.m32_segmap); 2408 - /* M64 is pre-configured by pnv_ioda1_init_m64() */ 2409 - } else if (phb->type == PNV_PHB_IODA2) { 2809 + if (phb->type == PNV_PHB_IODA2) { 2410 2810 pnv_ioda_free_pe_seg(pe, OPAL_M32_WINDOW_TYPE, 2411 2811 phb->ioda.m32_segmap); 2412 2812 } ··· 2418 2830 mutex_unlock(&phb->ioda.pe_list_mutex); 2419 2831 2420 2832 switch (phb->type) { 2421 - case PNV_PHB_IODA1: 2422 - pnv_pci_ioda1_release_pe_dma(pe); 2423 - break; 2424 2833 case PNV_PHB_IODA2: 2425 2834 pnv_pci_ioda2_release_pe_dma(pe); 2426 2835 break; ··· 2566 2981 struct pci_controller *hose; 2567 2982 struct pnv_phb *phb; 2568 2983 unsigned long size, m64map_off, m32map_off, pemap_off; 2569 - unsigned long iomap_off = 0, dma32map_off = 0; 2570 2984 struct pnv_ioda_pe *root_pe; 2571 2985 struct resource r; 2572 2986 const __be64 *prop64; ··· 2676 3092 phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe_num; 2677 3093 phb->ioda.io_pci_base = 0; /* XXX calculate this ? */ 2678 3094 2679 - /* Calculate how many 32-bit TCE segments we have */ 2680 - phb->ioda.dma32_count = phb->ioda.m32_pci_base / 2681 - PNV_IODA1_DMA32_SEGSIZE; 2682 - 2683 3095 /* Allocate aux data & arrays. We don't have IO ports on PHB3 */ 2684 3096 size = ALIGN(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, 2685 3097 sizeof(unsigned long)); ··· 2683 3103 size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); 2684 3104 m32map_off = size; 2685 3105 size += phb->ioda.total_pe_num * sizeof(phb->ioda.m32_segmap[0]); 2686 - if (phb->type == PNV_PHB_IODA1) { 2687 - iomap_off = size; 2688 - size += phb->ioda.total_pe_num * sizeof(phb->ioda.io_segmap[0]); 2689 - dma32map_off = size; 2690 - size += phb->ioda.dma32_count * 2691 - sizeof(phb->ioda.dma32_segmap[0]); 2692 - } 2693 3106 pemap_off = size; 2694 3107 size += phb->ioda.total_pe_num * sizeof(struct pnv_ioda_pe); 2695 3108 aux = kzalloc(size, GFP_KERNEL); ··· 2695 3122 for (segno = 0; segno < phb->ioda.total_pe_num; segno++) { 2696 3123 phb->ioda.m64_segmap[segno] = IODA_INVALID_PE; 2697 3124 phb->ioda.m32_segmap[segno] = IODA_INVALID_PE; 2698 - } 2699 - if (phb->type == PNV_PHB_IODA1) { 2700 - phb->ioda.io_segmap = aux + iomap_off; 2701 - for (segno = 0; segno < phb->ioda.total_pe_num; segno++) 2702 - phb->ioda.io_segmap[segno] = IODA_INVALID_PE; 2703 - 2704 - phb->ioda.dma32_segmap = aux + dma32map_off; 2705 - for (segno = 0; segno < phb->ioda.dma32_count; segno++) 2706 - phb->ioda.dma32_segmap[segno] = IODA_INVALID_PE; 2707 3125 } 2708 3126 phb->ioda.pe_array = aux + pemap_off; 2709 3127 ··· 2718 3154 2719 3155 INIT_LIST_HEAD(&phb->ioda.pe_list); 2720 3156 mutex_init(&phb->ioda.pe_list_mutex); 2721 - 2722 - /* Calculate how many 32-bit TCE segments we have */ 2723 - phb->ioda.dma32_count = phb->ioda.m32_pci_base / 2724 - PNV_IODA1_DMA32_SEGSIZE; 2725 3157 2726 3158 #if 0 /* We should really do that ... */ 2727 3159 rc = opal_pci_set_phb_mem_window(opal->phb_id, ··· 2825 3265 dev->cfg_size = PCI_CFG_SPACE_EXP_SIZE; 2826 3266 } 2827 3267 DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pnv_npu2_opencapi_cfg_size_fixup); 2828 - 2829 - void __init pnv_pci_init_ioda_hub(struct device_node *np) 2830 - { 2831 - struct device_node *phbn; 2832 - const __be64 *prop64; 2833 - u64 hub_id; 2834 - 2835 - pr_info("Probing IODA IO-Hub %pOF\n", np); 2836 - 2837 - prop64 = of_get_property(np, "ibm,opal-hubid", NULL); 2838 - if (!prop64) { 2839 - pr_err(" Missing \"ibm,opal-hubid\" property !\n"); 2840 - return; 2841 - } 2842 - hub_id = be64_to_cpup(prop64); 2843 - pr_devel(" HUB-ID : 0x%016llx\n", hub_id); 2844 - 2845 - /* Count child PHBs */ 2846 - for_each_child_of_node(np, phbn) { 2847 - /* Look for IODA1 PHBs */ 2848 - if (of_device_is_compatible(phbn, "ibm,ioda-phb")) 2849 - pnv_pci_init_ioda_phb(phbn, hub_id, PNV_PHB_IODA1); 2850 - } 2851 - }
+3 -3
arch/powerpc/platforms/powernv/pci-sriov.c
··· 594 594 struct pnv_iov_data *iov; 595 595 596 596 iov = pnv_iov_get(pdev); 597 - num_vfs = iov->num_vfs; 598 - base_pe = iov->vf_pe_arr[0].pe_number; 599 - 600 597 if (WARN_ON(!iov)) 601 598 return; 599 + 600 + num_vfs = iov->num_vfs; 601 + base_pe = iov->vf_pe_arr[0].pe_number; 602 602 603 603 /* Release VF PEs */ 604 604 pnv_ioda_release_vf_PE(pdev);
-5
arch/powerpc/platforms/powernv/pci.c
··· 845 845 pcie_ports_disabled = true; 846 846 #endif 847 847 848 - /* Look for IODA IO-Hubs. */ 849 - for_each_compatible_node(np, NULL, "ibm,ioda-hub") { 850 - pnv_pci_init_ioda_hub(np); 851 - } 852 - 853 848 /* Look for ioda2 built-in PHB3's */ 854 849 for_each_compatible_node(np, NULL, "ibm,ioda2-phb") 855 850 pnv_pci_init_ioda2_phb(np);
-5
arch/powerpc/platforms/powernv/pci.h
··· 10 10 struct pci_dn; 11 11 12 12 enum pnv_phb_type { 13 - PNV_PHB_IODA1, 14 13 PNV_PHB_IODA2, 15 14 PNV_PHB_NPU_OCAPI, 16 15 }; ··· 161 162 unsigned int *m64_segmap; 162 163 unsigned int *m32_segmap; 163 164 unsigned int *io_segmap; 164 - 165 - /* DMA32 segment maps - IODA1 only */ 166 - unsigned int dma32_count; 167 - unsigned int *dma32_segmap; 168 165 169 166 /* IRQ chip */ 170 167 int irq_chip_init;
+1 -1
arch/powerpc/platforms/powernv/vas-window.c
··· 1310 1310 /* if send window, drop reference to matching receive window */ 1311 1311 if (window->tx_win) { 1312 1312 if (window->user_win) { 1313 - put_vas_user_win_ref(&vwin->task_ref); 1314 1313 mm_context_remove_vas_window(vwin->task_ref.mm); 1314 + put_vas_user_win_ref(&vwin->task_ref); 1315 1315 } 1316 1316 put_rx_win(window->rxwin); 1317 1317 }
+14 -4
arch/powerpc/platforms/pseries/iommu.c
··· 372 372 struct dma_win { 373 373 struct device_node *device; 374 374 const struct dynamic_dma_window_prop *prop; 375 + bool direct; 375 376 struct list_head list; 376 377 }; 377 378 ··· 949 948 950 949 window->device = pdn; 951 950 window->prop = dma64; 951 + window->direct = false; 952 952 953 953 return window; 954 954 } ··· 1420 1418 goto out_del_prop; 1421 1419 1422 1420 if (direct_mapping) { 1421 + window->direct = true; 1422 + 1423 1423 /* DDW maps the whole partition, so enable direct DMA mapping */ 1424 1424 ret = walk_system_ram_range(0, memblock_end_of_DRAM() >> PAGE_SHIFT, 1425 1425 win64->value, tce_setrange_multi_pSeriesLP_walk); ··· 1437 1433 struct iommu_table *newtbl; 1438 1434 int i; 1439 1435 unsigned long start = 0, end = 0; 1436 + 1437 + window->direct = false; 1440 1438 1441 1439 for (i = 0; i < ARRAY_SIZE(pci->phb->mem_resources); i++) { 1442 1440 const unsigned long mask = IORESOURCE_MEM_64 | IORESOURCE_MEM; ··· 1602 1596 case MEM_GOING_ONLINE: 1603 1597 spin_lock(&dma_win_list_lock); 1604 1598 list_for_each_entry(window, &dma_win_list, list) { 1605 - ret |= tce_setrange_multi_pSeriesLP(arg->start_pfn, 1606 - arg->nr_pages, window->prop); 1599 + if (window->direct) { 1600 + ret |= tce_setrange_multi_pSeriesLP(arg->start_pfn, 1601 + arg->nr_pages, window->prop); 1602 + } 1607 1603 /* XXX log error */ 1608 1604 } 1609 1605 spin_unlock(&dma_win_list_lock); ··· 1614 1606 case MEM_OFFLINE: 1615 1607 spin_lock(&dma_win_list_lock); 1616 1608 list_for_each_entry(window, &dma_win_list, list) { 1617 - ret |= tce_clearrange_multi_pSeriesLP(arg->start_pfn, 1618 - arg->nr_pages, window->prop); 1609 + if (window->direct) { 1610 + ret |= tce_clearrange_multi_pSeriesLP(arg->start_pfn, 1611 + arg->nr_pages, window->prop); 1612 + } 1619 1613 /* XXX log error */ 1620 1614 } 1621 1615 spin_unlock(&dma_win_list_lock);
+1 -1
arch/powerpc/platforms/pseries/vas.c
··· 507 507 vascaps[win->win_type].nr_open_windows--; 508 508 mutex_unlock(&vas_pseries_mutex); 509 509 510 - put_vas_user_win_ref(&vwin->task_ref); 511 510 mm_context_remove_vas_window(vwin->task_ref.mm); 511 + put_vas_user_win_ref(&vwin->task_ref); 512 512 513 513 kfree(win); 514 514 return 0;
+10 -36
arch/powerpc/sysdev/fsl_rio.c
··· 448 448 struct rio_mport *port; 449 449 struct rio_priv *priv; 450 450 int rc = 0; 451 - const u32 *dt_range, *cell, *port_index; 451 + const u32 *port_index; 452 452 u32 active_ports = 0; 453 453 struct device_node *np, *rmu_node; 454 - int rlen; 455 454 u32 ccsr; 456 - u64 range_start, range_size; 457 - int paw, aw, sw; 455 + u64 range_start; 458 456 u32 i; 459 457 static int tmp; 460 458 struct device_node *rmu_np[MAX_MSG_UNIT_NUM] = {NULL}; ··· 526 528 dbell->bellirq = irq_of_parse_and_map(np, 1); 527 529 dev_info(&dev->dev, "bellirq: %d\n", dbell->bellirq); 528 530 529 - aw = of_n_addr_cells(np); 530 - dt_range = of_get_property(np, "reg", &rlen); 531 - if (!dt_range) { 531 + if (of_property_read_reg(np, 0, &range_start, NULL)) { 532 532 pr_err("%pOF: unable to find 'reg' property\n", 533 533 np); 534 534 rc = -ENOMEM; 535 535 goto err_pw; 536 536 } 537 - range_start = of_read_number(dt_range, aw); 538 537 dbell->dbell_regs = (struct rio_dbell_regs *)(rmu_regs_win + 539 538 (u32)range_start); 540 539 ··· 551 556 pw->dev = &dev->dev; 552 557 pw->pwirq = irq_of_parse_and_map(np, 0); 553 558 dev_info(&dev->dev, "pwirq: %d\n", pw->pwirq); 554 - aw = of_n_addr_cells(np); 555 - dt_range = of_get_property(np, "reg", &rlen); 556 - if (!dt_range) { 559 + if (of_property_read_reg(np, 0, &range_start, NULL)) { 557 560 pr_err("%pOF: unable to find 'reg' property\n", 558 561 np); 559 562 rc = -ENOMEM; 560 563 goto err; 561 564 } 562 - range_start = of_read_number(dt_range, aw); 563 565 pw->pw_regs = (struct rio_pw_regs *)(rmu_regs_win + (u32)range_start); 564 566 565 567 /*set up ports node*/ 566 568 for_each_child_of_node(dev->dev.of_node, np) { 569 + struct resource res; 570 + 567 571 port_index = of_get_property(np, "cell-index", NULL); 568 572 if (!port_index) { 569 573 dev_err(&dev->dev, "Can't get %pOF property 'cell-index'\n", ··· 570 576 continue; 571 577 } 572 578 573 - dt_range = of_get_property(np, "ranges", &rlen); 574 - if (!dt_range) { 579 + if (of_range_to_resource(np, 0, &res)) { 575 580 dev_err(&dev->dev, "Can't get %pOF property 'ranges'\n", 576 581 np); 577 582 continue; 578 583 } 579 584 580 - /* Get node address wide */ 581 - cell = of_get_property(np, "#address-cells", NULL); 582 - if (cell) 583 - aw = *cell; 584 - else 585 - aw = of_n_addr_cells(np); 586 - /* Get node size wide */ 587 - cell = of_get_property(np, "#size-cells", NULL); 588 - if (cell) 589 - sw = *cell; 590 - else 591 - sw = of_n_size_cells(np); 592 - /* Get parent address wide wide */ 593 - paw = of_n_addr_cells(np); 594 - range_start = of_read_number(dt_range + aw, paw); 595 - range_size = of_read_number(dt_range + aw + paw, sw); 596 - 597 - dev_info(&dev->dev, "%pOF: LAW start 0x%016llx, size 0x%016llx.\n", 598 - np, range_start, range_size); 585 + dev_info(&dev->dev, "%pOF: LAW %pR\n", 586 + np, &res); 599 587 600 588 port = kzalloc(sizeof(struct rio_mport), GFP_KERNEL); 601 589 if (!port) ··· 600 624 } 601 625 602 626 INIT_LIST_HEAD(&port->dbells); 603 - port->iores.start = range_start; 604 - port->iores.end = port->iores.start + range_size - 1; 605 - port->iores.flags = IORESOURCE_MEM; 627 + port->iores = res; /* struct copy */ 606 628 port->iores.name = "rio_io_win"; 607 629 608 630 if (request_resource(&iomem_resource, &port->iores) < 0) {
+2 -8
arch/powerpc/sysdev/fsl_rmu.c
··· 23 23 #include <linux/types.h> 24 24 #include <linux/dma-mapping.h> 25 25 #include <linux/interrupt.h> 26 + #include <linux/of_address.h> 26 27 #include <linux/of_irq.h> 27 28 #include <linux/of_platform.h> 28 29 #include <linux/slab.h> ··· 1068 1067 struct rio_priv *priv; 1069 1068 struct fsl_rmu *rmu; 1070 1069 u64 msg_start; 1071 - const u32 *msg_addr; 1072 - int mlen; 1073 - int aw; 1074 1070 1075 1071 if (!mport || !mport->priv) 1076 1072 return -EINVAL; ··· 1084 1086 if (!rmu) 1085 1087 return -ENOMEM; 1086 1088 1087 - aw = of_n_addr_cells(node); 1088 - msg_addr = of_get_property(node, "reg", &mlen); 1089 - if (!msg_addr) { 1089 + if (of_property_read_reg(node, 0, &msg_start, NULL)) { 1090 1090 pr_err("%pOF: unable to find 'reg' property of message-unit\n", 1091 1091 node); 1092 1092 kfree(rmu); 1093 1093 return -ENOMEM; 1094 1094 } 1095 - msg_start = of_read_number(msg_addr, aw); 1096 - 1097 1095 rmu->msg_regs = (struct rio_msg_regs *) 1098 1096 (rmu_regs_win + (u32)msg_start); 1099 1097
+3 -11
arch/powerpc/sysdev/fsl_soc.c
··· 51 51 52 52 soc = of_find_node_by_type(NULL, "soc"); 53 53 if (soc) { 54 - int size; 55 - u32 naddr; 56 - const __be32 *prop = of_get_property(soc, "#address-cells", &size); 54 + struct resource res; 57 55 58 - if (prop && size == 4) 59 - naddr = be32_to_cpup(prop); 60 - else 61 - naddr = 2; 62 - 63 - prop = of_get_property(soc, "ranges", &size); 64 - if (prop) 65 - immrbase = of_translate_address(soc, prop + naddr); 56 + if (!of_range_to_resource(soc, 0, &res)) 57 + immrbase = res.start; 66 58 67 59 of_node_put(soc); 68 60 }
+6 -5
arch/powerpc/tools/gcc-check-mprofile-kernel.sh
··· 7 7 # To debug, uncomment the following line 8 8 # set -x 9 9 10 - # -mprofile-kernel is only supported on 64le, so this should not be invoked 11 - # for other targets. Therefore we can pass in -m64 and -mlittle-endian 12 - # explicitly, to take care of toolchains defaulting to other targets. 10 + # -mprofile-kernel is only supported on 64-bit, so this should not be invoked 11 + # for 32-bit. We pass in -m64 explicitly, and -mbig-endian and -mlittle-endian 12 + # are passed in from Kconfig, which takes care of toolchains defaulting to 13 + # other targets. 13 14 14 15 # Test whether the compile option -mprofile-kernel exists and generates 15 16 # profiling code (ie. a call to _mcount()). 16 17 echo "int func() { return 0; }" | \ 17 - $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \ 18 + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - \ 18 19 2> /dev/null | grep -q "_mcount" 19 20 20 21 # Test whether the notrace attribute correctly suppresses calls to _mcount(). 21 22 22 23 echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \ 23 - $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \ 24 + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - \ 24 25 2> /dev/null | grep -q "_mcount" && \ 25 26 exit 1 26 27
-2
arch/xtensa/lib/Makefile
··· 9 9 usercopy.o strnlen_user.o 10 10 lib-$(CONFIG_ARCH_HAS_STRNCPY_FROM_USER) += strncpy_user.o 11 11 lib-$(CONFIG_PCI) += pci-auto.o 12 - lib-$(CONFIG_KCSAN) += kcsan-stubs.o 13 - KCSAN_SANITIZE_kcsan-stubs.o := n
-54
arch/xtensa/lib/kcsan-stubs.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - #include <linux/bug.h> 4 - #include <linux/types.h> 5 - 6 - void __atomic_store_8(volatile void *p, u64 v, int i) 7 - { 8 - BUG(); 9 - } 10 - 11 - u64 __atomic_load_8(const volatile void *p, int i) 12 - { 13 - BUG(); 14 - } 15 - 16 - u64 __atomic_exchange_8(volatile void *p, u64 v, int i) 17 - { 18 - BUG(); 19 - } 20 - 21 - bool __atomic_compare_exchange_8(volatile void *p1, void *p2, u64 v, bool b, int i1, int i2) 22 - { 23 - BUG(); 24 - } 25 - 26 - u64 __atomic_fetch_add_8(volatile void *p, u64 v, int i) 27 - { 28 - BUG(); 29 - } 30 - 31 - u64 __atomic_fetch_sub_8(volatile void *p, u64 v, int i) 32 - { 33 - BUG(); 34 - } 35 - 36 - u64 __atomic_fetch_and_8(volatile void *p, u64 v, int i) 37 - { 38 - BUG(); 39 - } 40 - 41 - u64 __atomic_fetch_or_8(volatile void *p, u64 v, int i) 42 - { 43 - BUG(); 44 - } 45 - 46 - u64 __atomic_fetch_xor_8(volatile void *p, u64 v, int i) 47 - { 48 - BUG(); 49 - } 50 - 51 - u64 __atomic_fetch_nand_8(volatile void *p, u64 v, int i) 52 - { 53 - BUG(); 54 - }
+1 -1
drivers/macintosh/ams/ams-i2c.c
··· 69 69 .driver = { 70 70 .name = "ams", 71 71 }, 72 - .probe_new = ams_i2c_probe, 72 + .probe = ams_i2c_probe, 73 73 .remove = ams_i2c_remove, 74 74 .id_table = ams_id, 75 75 };
+7 -8
drivers/macintosh/smu.c
··· 33 33 #include <linux/delay.h> 34 34 #include <linux/poll.h> 35 35 #include <linux/mutex.h> 36 - #include <linux/of_device.h> 36 + #include <linux/of.h> 37 + #include <linux/of_address.h> 37 38 #include <linux/of_irq.h> 38 39 #include <linux/of_platform.h> 39 40 #include <linux/slab.h> ··· 471 470 int __init smu_init (void) 472 471 { 473 472 struct device_node *np; 474 - const u32 *data; 473 + u64 data; 475 474 int ret = 0; 476 475 477 476 np = of_find_node_by_type(NULL, "smu"); ··· 515 514 ret = -ENXIO; 516 515 goto fail_bootmem; 517 516 } 518 - data = of_get_property(smu->db_node, "reg", NULL); 519 - if (data == NULL) { 517 + if (of_property_read_reg(smu->db_node, 0, &data, NULL)) { 520 518 printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); 521 519 ret = -ENXIO; 522 520 goto fail_db_node; ··· 525 525 * and ack. GPIOs are at 0x50, best would be to find that out 526 526 * in the device-tree though. 527 527 */ 528 - smu->doorbell = *data; 528 + smu->doorbell = data; 529 529 if (smu->doorbell < 0x50) 530 530 smu->doorbell += 0x50; 531 531 ··· 534 534 smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt"); 535 535 if (smu->msg_node == NULL) 536 536 break; 537 - data = of_get_property(smu->msg_node, "reg", NULL); 538 - if (data == NULL) { 537 + if (of_property_read_reg(smu->msg_node, 0, &data, NULL)) { 539 538 of_node_put(smu->msg_node); 540 539 smu->msg_node = NULL; 541 540 break; 542 541 } 543 - smu->msg = *data; 542 + smu->msg = data; 544 543 if (smu->msg < 0x50) 545 544 smu->msg += 0x50; 546 545 } while(0);
+1 -1
drivers/macintosh/therm_adt746x.c
··· 598 598 .driver = { 599 599 .name = "therm_adt746x", 600 600 }, 601 - .probe_new = probe_thermostat, 601 + .probe = probe_thermostat, 602 602 .remove = remove_thermostat, 603 603 .id_table = therm_adt746x_id, 604 604 };
+1 -1
drivers/macintosh/therm_windtunnel.c
··· 442 442 .driver = { 443 443 .name = "therm_windtunnel", 444 444 }, 445 - .probe_new = do_probe, 445 + .probe = do_probe, 446 446 .remove = do_remove, 447 447 .id_table = therm_windtunnel_id, 448 448 };
+5 -11
drivers/macintosh/via-cuda.c
··· 235 235 int __init find_via_cuda(void) 236 236 { 237 237 struct adb_request req; 238 - phys_addr_t taddr; 239 - const u32 *reg; 238 + struct resource res; 240 239 int err; 241 240 242 241 if (vias) ··· 244 245 if (!vias) 245 246 return 0; 246 247 247 - reg = of_get_property(vias, "reg", NULL); 248 - if (reg == NULL) { 249 - printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); 248 + err = of_address_to_resource(vias, 0, &res); 249 + if (err) { 250 + printk(KERN_ERR "via-cuda: Error getting \"reg\" property !\n"); 250 251 goto fail; 251 252 } 252 - taddr = of_translate_address(vias, reg); 253 - if (taddr == 0) { 254 - printk(KERN_ERR "via-cuda: Can't translate address !\n"); 255 - goto fail; 256 - } 257 - via = ioremap(taddr, 0x2000); 253 + via = ioremap(res.start, 0x2000); 258 254 if (via == NULL) { 259 255 printk(KERN_ERR "via-cuda: Can't map address !\n"); 260 256 goto fail;
+8 -15
drivers/macintosh/via-pmu.c
··· 286 286 int __init find_via_pmu(void) 287 287 { 288 288 #ifdef CONFIG_PPC_PMAC 289 + int err; 289 290 u64 taddr; 290 - const u32 *reg; 291 + struct resource res; 291 292 292 293 if (pmu_state != uninitialized) 293 294 return 1; ··· 296 295 if (vias == NULL) 297 296 return 0; 298 297 299 - reg = of_get_property(vias, "reg", NULL); 300 - if (reg == NULL) { 301 - printk(KERN_ERR "via-pmu: No \"reg\" property !\n"); 298 + err = of_address_to_resource(vias, 0, &res); 299 + if (err) { 300 + printk(KERN_ERR "via-pmu: Error getting \"reg\" property !\n"); 302 301 goto fail; 303 302 } 304 - taddr = of_translate_address(vias, reg); 305 - if (taddr == OF_BAD_ADDR) { 306 - printk(KERN_ERR "via-pmu: Can't translate address !\n"); 307 - goto fail; 308 - } 303 + taddr = res.start; 309 304 310 305 pmu_has_adb = 1; 311 306 ··· 321 324 || of_device_is_compatible(vias->parent, "K2-Keylargo")) { 322 325 struct device_node *gpiop; 323 326 struct device_node *adbp; 324 - u64 gaddr = OF_BAD_ADDR; 325 327 326 328 pmu_kind = PMU_KEYLARGO_BASED; 327 329 adbp = of_find_node_by_type(NULL, "adb"); ··· 334 338 335 339 gpiop = of_find_node_by_name(NULL, "gpio"); 336 340 if (gpiop) { 337 - reg = of_get_property(gpiop, "reg", NULL); 338 - if (reg) 339 - gaddr = of_translate_address(gpiop, reg); 340 - if (gaddr != OF_BAD_ADDR) 341 - gpio_reg = ioremap(gaddr, 0x10); 341 + if (!of_address_to_resource(gpiop, 0, &res)) 342 + gpio_reg = ioremap(res.start, 0x10); 342 343 of_node_put(gpiop); 343 344 } 344 345 if (gpio_reg == NULL) {
+1 -1
drivers/macintosh/windfarm_ad7417_sensor.c
··· 320 320 .name = "wf_ad7417", 321 321 .of_match_table = wf_ad7417_of_id, 322 322 }, 323 - .probe_new = wf_ad7417_probe, 323 + .probe = wf_ad7417_probe, 324 324 .remove = wf_ad7417_remove, 325 325 .id_table = wf_ad7417_id, 326 326 };
+1 -1
drivers/macintosh/windfarm_fcu_controls.c
··· 589 589 .name = "wf_fcu", 590 590 .of_match_table = wf_fcu_of_id, 591 591 }, 592 - .probe_new = wf_fcu_probe, 592 + .probe = wf_fcu_probe, 593 593 .remove = wf_fcu_remove, 594 594 .id_table = wf_fcu_id, 595 595 };
+1 -1
drivers/macintosh/windfarm_lm75_sensor.c
··· 177 177 .name = "wf_lm75", 178 178 .of_match_table = wf_lm75_of_id, 179 179 }, 180 - .probe_new = wf_lm75_probe, 180 + .probe = wf_lm75_probe, 181 181 .remove = wf_lm75_remove, 182 182 .id_table = wf_lm75_id, 183 183 };
+1 -1
drivers/macintosh/windfarm_lm87_sensor.c
··· 172 172 .name = "wf_lm87", 173 173 .of_match_table = wf_lm87_of_id, 174 174 }, 175 - .probe_new = wf_lm87_probe, 175 + .probe = wf_lm87_probe, 176 176 .remove = wf_lm87_remove, 177 177 .id_table = wf_lm87_id, 178 178 };
+1 -1
drivers/macintosh/windfarm_max6690_sensor.c
··· 128 128 .name = "wf_max6690", 129 129 .of_match_table = wf_max6690_of_id, 130 130 }, 131 - .probe_new = wf_max6690_probe, 131 + .probe = wf_max6690_probe, 132 132 .remove = wf_max6690_remove, 133 133 .id_table = wf_max6690_id, 134 134 };
+1 -1
drivers/macintosh/windfarm_smu_sat.c
··· 349 349 .name = "wf_smu_sat", 350 350 .of_match_table = wf_sat_of_id, 351 351 }, 352 - .probe_new = wf_sat_probe, 352 + .probe = wf_sat_probe, 353 353 .remove = wf_sat_remove, 354 354 .id_table = wf_sat_id, 355 355 };
+2
include/uapi/linux/elf.h
··· 404 404 #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ 405 405 #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ 406 406 #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ 407 + #define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */ 408 + #define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */ 407 409 #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 408 410 #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 409 411 #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
+2
kernel/kcsan/core.c
··· 1270 1270 DEFINE_TSAN_ATOMIC_OPS(8); 1271 1271 DEFINE_TSAN_ATOMIC_OPS(16); 1272 1272 DEFINE_TSAN_ATOMIC_OPS(32); 1273 + #ifdef CONFIG_64BIT 1273 1274 DEFINE_TSAN_ATOMIC_OPS(64); 1275 + #endif 1274 1276 1275 1277 void __tsan_atomic_thread_fence(int memorder); 1276 1278 void __tsan_atomic_thread_fence(int memorder)
-4
scripts/Makefile.compiler
··· 72 72 # ld-option 73 73 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) 74 74 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3)) 75 - 76 - # ld-ifversion 77 - # Usage: $(call ld-ifversion, -ge, 22252, y) 78 - ld-ifversion = $(shell [ $(CONFIG_LD_VERSION)0 $(1) $(2)0 ] && echo $(3) || echo $(4))
+1 -1
scripts/head-object-list.txt
··· 34 34 arch/powerpc/kernel/head_8xx.o 35 35 arch/powerpc/kernel/head_85xx.o 36 36 arch/powerpc/kernel/head_book3s_32.o 37 - arch/powerpc/kernel/entry_64.o 37 + arch/powerpc/kernel/prom_entry_64.o 38 38 arch/powerpc/kernel/fpu.o 39 39 arch/powerpc/kernel/vector.o 40 40 arch/powerpc/kernel/prom_init.o
+26 -14
security/integrity/platform_certs/load_powerpc.c
··· 15 15 #include "keyring_handler.h" 16 16 #include "../integrity.h" 17 17 18 + #define extract_esl(db, data, size, offset) \ 19 + do { db = data + offset; size = size - offset; } while (0) 20 + 18 21 /* 19 22 * Get a certificate list blob from the named secure variable. 20 23 * ··· 58 55 */ 59 56 static int __init load_powerpc_certs(void) 60 57 { 61 - void *db = NULL, *dbx = NULL; 62 - u64 dbsize = 0, dbxsize = 0; 58 + void *db = NULL, *dbx = NULL, *data = NULL; 59 + u64 dsize = 0; 60 + u64 offset = 0; 63 61 int rc = 0; 64 62 ssize_t len; 65 63 char buf[32]; ··· 78 74 return -ENODEV; 79 75 } 80 76 77 + if (strcmp("ibm,plpks-sb-v1", buf) == 0) 78 + /* PLPKS authenticated variables ESL data is prefixed with 8 bytes of timestamp */ 79 + offset = 8; 80 + 81 81 /* 82 82 * Get db, and dbx. They might not exist, so it isn't an error if we 83 83 * can't get them. 84 84 */ 85 - db = get_cert_list("db", 3, &dbsize); 86 - if (!db) { 85 + data = get_cert_list("db", 3, &dsize); 86 + if (!data) { 87 87 pr_info("Couldn't get db list from firmware\n"); 88 - } else if (IS_ERR(db)) { 89 - rc = PTR_ERR(db); 88 + } else if (IS_ERR(data)) { 89 + rc = PTR_ERR(data); 90 90 pr_err("Error reading db from firmware: %d\n", rc); 91 91 return rc; 92 92 } else { 93 - rc = parse_efi_signature_list("powerpc:db", db, dbsize, 93 + extract_esl(db, data, dsize, offset); 94 + 95 + rc = parse_efi_signature_list("powerpc:db", db, dsize, 94 96 get_handler_for_db); 95 97 if (rc) 96 98 pr_err("Couldn't parse db signatures: %d\n", rc); 97 - kfree(db); 99 + kfree(data); 98 100 } 99 101 100 - dbx = get_cert_list("dbx", 4, &dbxsize); 101 - if (!dbx) { 102 + data = get_cert_list("dbx", 4, &dsize); 103 + if (!data) { 102 104 pr_info("Couldn't get dbx list from firmware\n"); 103 - } else if (IS_ERR(dbx)) { 104 - rc = PTR_ERR(dbx); 105 + } else if (IS_ERR(data)) { 106 + rc = PTR_ERR(data); 105 107 pr_err("Error reading dbx from firmware: %d\n", rc); 106 108 return rc; 107 109 } else { 108 - rc = parse_efi_signature_list("powerpc:dbx", dbx, dbxsize, 110 + extract_esl(dbx, data, dsize, offset); 111 + 112 + rc = parse_efi_signature_list("powerpc:dbx", dbx, dsize, 109 113 get_handler_for_dbx); 110 114 if (rc) 111 115 pr_err("Couldn't parse dbx signatures: %d\n", rc); 112 - kfree(dbx); 116 + kfree(data); 113 117 } 114 118 115 119 return rc;
+1
tools/testing/selftests/powerpc/Makefile
··· 17 17 benchmarks \ 18 18 cache_shape \ 19 19 copyloops \ 20 + dexcr \ 20 21 dscr \ 21 22 mm \ 22 23 nx-gzip \
+2
tools/testing/selftests/powerpc/dexcr/.gitignore
··· 1 + hashchk_test 2 + lsdexcr
+9
tools/testing/selftests/powerpc/dexcr/Makefile
··· 1 + TEST_GEN_PROGS := hashchk_test 2 + TEST_GEN_FILES := lsdexcr 3 + 4 + include ../../lib.mk 5 + 6 + $(OUTPUT)/hashchk_test: CFLAGS += -fno-pie $(call cc-option,-mno-rop-protect) 7 + 8 + $(TEST_GEN_PROGS): ../harness.c ../utils.c ./dexcr.c 9 + $(TEST_GEN_FILES): ../utils.c ./dexcr.c
+132
tools/testing/selftests/powerpc/dexcr/dexcr.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + 3 + #include <errno.h> 4 + #include <setjmp.h> 5 + #include <signal.h> 6 + #include <sys/types.h> 7 + #include <sys/wait.h> 8 + 9 + #include "dexcr.h" 10 + #include "reg.h" 11 + #include "utils.h" 12 + 13 + static jmp_buf generic_signal_jump_buf; 14 + 15 + static void generic_signal_handler(int signum, siginfo_t *info, void *context) 16 + { 17 + longjmp(generic_signal_jump_buf, 0); 18 + } 19 + 20 + bool dexcr_exists(void) 21 + { 22 + struct sigaction old; 23 + volatile bool exists; 24 + 25 + old = push_signal_handler(SIGILL, generic_signal_handler); 26 + if (setjmp(generic_signal_jump_buf)) 27 + goto out; 28 + 29 + /* 30 + * If the SPR is not recognised by the hardware it triggers 31 + * a hypervisor emulation interrupt. If the kernel does not 32 + * recognise/try to emulate it, we receive a SIGILL signal. 33 + * 34 + * If we do not receive a signal, assume we have the SPR or the 35 + * kernel is trying to emulate it correctly. 36 + */ 37 + exists = false; 38 + mfspr(SPRN_DEXCR_RO); 39 + exists = true; 40 + 41 + out: 42 + pop_signal_handler(SIGILL, old); 43 + return exists; 44 + } 45 + 46 + /* 47 + * Just test if a bad hashchk triggers a signal, without checking 48 + * for support or if the NPHIE aspect is enabled. 49 + */ 50 + bool hashchk_triggers(void) 51 + { 52 + struct sigaction old; 53 + volatile bool triggers; 54 + 55 + old = push_signal_handler(SIGILL, generic_signal_handler); 56 + if (setjmp(generic_signal_jump_buf)) 57 + goto out; 58 + 59 + triggers = true; 60 + do_bad_hashchk(); 61 + triggers = false; 62 + 63 + out: 64 + pop_signal_handler(SIGILL, old); 65 + return triggers; 66 + } 67 + 68 + unsigned int get_dexcr(enum dexcr_source source) 69 + { 70 + switch (source) { 71 + case DEXCR: 72 + return mfspr(SPRN_DEXCR_RO); 73 + case HDEXCR: 74 + return mfspr(SPRN_HDEXCR_RO); 75 + case EFFECTIVE: 76 + return mfspr(SPRN_DEXCR_RO) | mfspr(SPRN_HDEXCR_RO); 77 + default: 78 + FAIL_IF_EXIT_MSG(true, "bad enum dexcr_source"); 79 + } 80 + } 81 + 82 + void await_child_success(pid_t pid) 83 + { 84 + int wstatus; 85 + 86 + FAIL_IF_EXIT_MSG(pid == -1, "fork failed"); 87 + FAIL_IF_EXIT_MSG(waitpid(pid, &wstatus, 0) == -1, "wait failed"); 88 + FAIL_IF_EXIT_MSG(!WIFEXITED(wstatus), "child did not exit cleanly"); 89 + FAIL_IF_EXIT_MSG(WEXITSTATUS(wstatus) != 0, "child exit error"); 90 + } 91 + 92 + /* 93 + * Perform a hashst instruction. The following components determine the result 94 + * 95 + * 1. The LR value (any register technically) 96 + * 2. The SP value (also any register, but it must be a valid address) 97 + * 3. A secret key managed by the kernel 98 + * 99 + * The result is stored to the address held in SP. 100 + */ 101 + void hashst(unsigned long lr, void *sp) 102 + { 103 + asm volatile ("addi 31, %0, 0;" /* set r31 (pretend LR) to lr */ 104 + "addi 30, %1, 8;" /* set r30 (pretend SP) to sp + 8 */ 105 + PPC_RAW_HASHST(31, -8, 30) /* compute hash into stack location */ 106 + : : "r" (lr), "r" (sp) : "r31", "r30", "memory"); 107 + } 108 + 109 + /* 110 + * Perform a hashchk instruction. A hash is computed as per hashst(), 111 + * however the result is not stored to memory. Instead the existing 112 + * value is read and compared against the computed hash. 113 + * 114 + * If they match, execution continues. 115 + * If they differ, an interrupt triggers. 116 + */ 117 + void hashchk(unsigned long lr, void *sp) 118 + { 119 + asm volatile ("addi 31, %0, 0;" /* set r31 (pretend LR) to lr */ 120 + "addi 30, %1, 8;" /* set r30 (pretend SP) to sp + 8 */ 121 + PPC_RAW_HASHCHK(31, -8, 30) /* check hash at stack location */ 122 + : : "r" (lr), "r" (sp) : "r31", "r30", "memory"); 123 + } 124 + 125 + void do_bad_hashchk(void) 126 + { 127 + unsigned long hash = 0; 128 + 129 + hashst(0, &hash); 130 + hash += 1; 131 + hashchk(0, &hash); 132 + }
+49
tools/testing/selftests/powerpc/dexcr/dexcr.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* 3 + * POWER Dynamic Execution Control Facility (DEXCR) 4 + * 5 + * This header file contains helper functions and macros 6 + * required for all the DEXCR related test cases. 7 + */ 8 + #ifndef _SELFTESTS_POWERPC_DEXCR_DEXCR_H 9 + #define _SELFTESTS_POWERPC_DEXCR_DEXCR_H 10 + 11 + #include <stdbool.h> 12 + #include <sys/types.h> 13 + 14 + #include "reg.h" 15 + 16 + #define DEXCR_PR_BIT(aspect) __MASK(63 - (32 + (aspect))) 17 + #define DEXCR_PR_SBHE DEXCR_PR_BIT(0) 18 + #define DEXCR_PR_IBRTPD DEXCR_PR_BIT(3) 19 + #define DEXCR_PR_SRAPD DEXCR_PR_BIT(4) 20 + #define DEXCR_PR_NPHIE DEXCR_PR_BIT(5) 21 + 22 + #define PPC_RAW_HASH_ARGS(b, i, a) \ 23 + ((((i) >> 3) & 0x1F) << 21 | (a) << 16 | (b) << 11 | (((i) >> 8) & 0x1)) 24 + #define PPC_RAW_HASHST(b, i, a) \ 25 + str(.long (0x7C0005A4 | PPC_RAW_HASH_ARGS(b, i, a));) 26 + #define PPC_RAW_HASHCHK(b, i, a) \ 27 + str(.long (0x7C0005E4 | PPC_RAW_HASH_ARGS(b, i, a));) 28 + 29 + bool dexcr_exists(void); 30 + 31 + bool hashchk_triggers(void); 32 + 33 + enum dexcr_source { 34 + DEXCR, /* Userspace DEXCR value */ 35 + HDEXCR, /* Hypervisor enforced DEXCR value */ 36 + EFFECTIVE, /* Bitwise OR of UDEXCR and ENFORCED DEXCR bits */ 37 + }; 38 + 39 + unsigned int get_dexcr(enum dexcr_source source); 40 + 41 + void await_child_success(pid_t pid); 42 + 43 + void hashst(unsigned long lr, void *sp); 44 + 45 + void hashchk(unsigned long lr, void *sp); 46 + 47 + void do_bad_hashchk(void); 48 + 49 + #endif /* _SELFTESTS_POWERPC_DEXCR_DEXCR_H */
+227
tools/testing/selftests/powerpc/dexcr/hashchk_test.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + 3 + #define _GNU_SOURCE 4 + 5 + #include <errno.h> 6 + #include <fcntl.h> 7 + #include <limits.h> 8 + #include <sched.h> 9 + #include <setjmp.h> 10 + #include <signal.h> 11 + #include <stdio.h> 12 + #include <stdlib.h> 13 + #include <string.h> 14 + #include <sys/mman.h> 15 + #include <sys/prctl.h> 16 + #include <unistd.h> 17 + 18 + #include "dexcr.h" 19 + #include "utils.h" 20 + 21 + static int require_nphie(void) 22 + { 23 + SKIP_IF_MSG(!dexcr_exists(), "DEXCR not supported"); 24 + SKIP_IF_MSG(!(get_dexcr(EFFECTIVE) & DEXCR_PR_NPHIE), 25 + "DEXCR[NPHIE] not enabled"); 26 + 27 + return 0; 28 + } 29 + 30 + static jmp_buf hashchk_detected_buf; 31 + static const char *hashchk_failure_msg; 32 + 33 + static void hashchk_handler(int signum, siginfo_t *info, void *context) 34 + { 35 + if (signum != SIGILL) 36 + hashchk_failure_msg = "wrong signal received"; 37 + else if (info->si_code != ILL_ILLOPN) 38 + hashchk_failure_msg = "wrong signal code received"; 39 + 40 + longjmp(hashchk_detected_buf, 0); 41 + } 42 + 43 + /* 44 + * Check that hashchk triggers when DEXCR[NPHIE] is enabled 45 + * and is detected as such by the kernel exception handler 46 + */ 47 + static int hashchk_detected_test(void) 48 + { 49 + struct sigaction old; 50 + int err; 51 + 52 + err = require_nphie(); 53 + if (err) 54 + return err; 55 + 56 + old = push_signal_handler(SIGILL, hashchk_handler); 57 + if (setjmp(hashchk_detected_buf)) 58 + goto out; 59 + 60 + hashchk_failure_msg = NULL; 61 + do_bad_hashchk(); 62 + hashchk_failure_msg = "hashchk failed to trigger"; 63 + 64 + out: 65 + pop_signal_handler(SIGILL, old); 66 + FAIL_IF_MSG(hashchk_failure_msg, hashchk_failure_msg); 67 + return 0; 68 + } 69 + 70 + #define HASH_COUNT 8 71 + 72 + static unsigned long hash_values[HASH_COUNT + 1]; 73 + 74 + static void fill_hash_values(void) 75 + { 76 + for (unsigned long i = 0; i < HASH_COUNT; i++) 77 + hashst(i, &hash_values[i]); 78 + 79 + /* Used to ensure the checks uses the same addresses as the hashes */ 80 + hash_values[HASH_COUNT] = (unsigned long)&hash_values; 81 + } 82 + 83 + static unsigned int count_hash_values_matches(void) 84 + { 85 + unsigned long matches = 0; 86 + 87 + for (unsigned long i = 0; i < HASH_COUNT; i++) { 88 + unsigned long orig_hash = hash_values[i]; 89 + hash_values[i] = 0; 90 + 91 + hashst(i, &hash_values[i]); 92 + 93 + if (hash_values[i] == orig_hash) 94 + matches++; 95 + } 96 + 97 + return matches; 98 + } 99 + 100 + static int hashchk_exec_child(void) 101 + { 102 + ssize_t count; 103 + 104 + fill_hash_values(); 105 + 106 + count = write(STDOUT_FILENO, hash_values, sizeof(hash_values)); 107 + return count == sizeof(hash_values) ? 0 : EOVERFLOW; 108 + } 109 + 110 + static char *hashchk_exec_child_args[] = { "hashchk_exec_child", NULL }; 111 + 112 + /* 113 + * Check that new programs get different keys so a malicious process 114 + * can't recreate a victim's hash values. 115 + */ 116 + static int hashchk_exec_random_key_test(void) 117 + { 118 + pid_t pid; 119 + int err; 120 + int pipefd[2]; 121 + 122 + err = require_nphie(); 123 + if (err) 124 + return err; 125 + 126 + FAIL_IF_MSG(pipe(pipefd), "failed to create pipe"); 127 + 128 + pid = fork(); 129 + if (pid == 0) { 130 + if (dup2(pipefd[1], STDOUT_FILENO) == -1) 131 + _exit(errno); 132 + 133 + execve("/proc/self/exe", hashchk_exec_child_args, NULL); 134 + _exit(errno); 135 + } 136 + 137 + await_child_success(pid); 138 + FAIL_IF_MSG(read(pipefd[0], hash_values, sizeof(hash_values)) != sizeof(hash_values), 139 + "missing expected child output"); 140 + 141 + /* Verify the child used the same hash_values address */ 142 + FAIL_IF_EXIT_MSG(hash_values[HASH_COUNT] != (unsigned long)&hash_values, 143 + "bad address check"); 144 + 145 + /* If all hashes are the same it means (most likely) same key */ 146 + FAIL_IF_MSG(count_hash_values_matches() == HASH_COUNT, "shared key detected"); 147 + 148 + return 0; 149 + } 150 + 151 + /* 152 + * Check that forks share the same key so that existing hash values 153 + * remain valid. 154 + */ 155 + static int hashchk_fork_share_key_test(void) 156 + { 157 + pid_t pid; 158 + int err; 159 + 160 + err = require_nphie(); 161 + if (err) 162 + return err; 163 + 164 + fill_hash_values(); 165 + 166 + pid = fork(); 167 + if (pid == 0) { 168 + if (count_hash_values_matches() != HASH_COUNT) 169 + _exit(1); 170 + _exit(0); 171 + } 172 + 173 + await_child_success(pid); 174 + return 0; 175 + } 176 + 177 + #define STACK_SIZE (1024 * 1024) 178 + 179 + static int hashchk_clone_child_fn(void *args) 180 + { 181 + fill_hash_values(); 182 + return 0; 183 + } 184 + 185 + /* 186 + * Check that threads share the same key so that existing hash values 187 + * remain valid. 188 + */ 189 + static int hashchk_clone_share_key_test(void) 190 + { 191 + void *child_stack; 192 + pid_t pid; 193 + int err; 194 + 195 + err = require_nphie(); 196 + if (err) 197 + return err; 198 + 199 + child_stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE, 200 + MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); 201 + 202 + FAIL_IF_MSG(child_stack == MAP_FAILED, "failed to map child stack"); 203 + 204 + pid = clone(hashchk_clone_child_fn, child_stack + STACK_SIZE, 205 + CLONE_VM | SIGCHLD, NULL); 206 + 207 + await_child_success(pid); 208 + FAIL_IF_MSG(count_hash_values_matches() != HASH_COUNT, 209 + "different key detected"); 210 + 211 + return 0; 212 + } 213 + 214 + int main(int argc, char *argv[]) 215 + { 216 + int err = 0; 217 + 218 + if (argc >= 1 && !strcmp(argv[0], hashchk_exec_child_args[0])) 219 + return hashchk_exec_child(); 220 + 221 + err |= test_harness(hashchk_detected_test, "hashchk_detected"); 222 + err |= test_harness(hashchk_exec_random_key_test, "hashchk_exec_random_key"); 223 + err |= test_harness(hashchk_fork_share_key_test, "hashchk_fork_share_key"); 224 + err |= test_harness(hashchk_clone_share_key_test, "hashchk_clone_share_key"); 225 + 226 + return err; 227 + }
+141
tools/testing/selftests/powerpc/dexcr/lsdexcr.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + 3 + #include <errno.h> 4 + #include <stddef.h> 5 + #include <stdio.h> 6 + #include <string.h> 7 + 8 + #include "dexcr.h" 9 + #include "utils.h" 10 + 11 + static unsigned int dexcr; 12 + static unsigned int hdexcr; 13 + static unsigned int effective; 14 + 15 + struct dexcr_aspect { 16 + const char *name; 17 + const char *desc; 18 + unsigned int index; 19 + }; 20 + 21 + static const struct dexcr_aspect aspects[] = { 22 + { 23 + .name = "SBHE", 24 + .desc = "Speculative branch hint enable", 25 + .index = 0, 26 + }, 27 + { 28 + .name = "IBRTPD", 29 + .desc = "Indirect branch recurrent target prediction disable", 30 + .index = 3, 31 + }, 32 + { 33 + .name = "SRAPD", 34 + .desc = "Subroutine return address prediction disable", 35 + .index = 4, 36 + }, 37 + { 38 + .name = "NPHIE", 39 + .desc = "Non-privileged hash instruction enable", 40 + .index = 5, 41 + }, 42 + { 43 + .name = "PHIE", 44 + .desc = "Privileged hash instruction enable", 45 + .index = 6, 46 + }, 47 + }; 48 + 49 + static void print_list(const char *list[], size_t len) 50 + { 51 + for (size_t i = 0; i < len; i++) { 52 + printf("%s", list[i]); 53 + if (i + 1 < len) 54 + printf(", "); 55 + } 56 + } 57 + 58 + static void print_dexcr(char *name, unsigned int bits) 59 + { 60 + const char *enabled_aspects[ARRAY_SIZE(aspects) + 1] = {NULL}; 61 + size_t j = 0; 62 + 63 + printf("%s: %08x", name, bits); 64 + 65 + if (bits == 0) { 66 + printf("\n"); 67 + return; 68 + } 69 + 70 + for (size_t i = 0; i < ARRAY_SIZE(aspects); i++) { 71 + unsigned int mask = DEXCR_PR_BIT(aspects[i].index); 72 + 73 + if (bits & mask) { 74 + enabled_aspects[j++] = aspects[i].name; 75 + bits &= ~mask; 76 + } 77 + } 78 + 79 + if (bits) 80 + enabled_aspects[j++] = "unknown"; 81 + 82 + printf(" ("); 83 + print_list(enabled_aspects, j); 84 + printf(")\n"); 85 + } 86 + 87 + static void print_aspect(const struct dexcr_aspect *aspect) 88 + { 89 + const char *attributes[8] = {NULL}; 90 + size_t j = 0; 91 + unsigned long mask; 92 + 93 + mask = DEXCR_PR_BIT(aspect->index); 94 + if (dexcr & mask) 95 + attributes[j++] = "set"; 96 + if (hdexcr & mask) 97 + attributes[j++] = "set (hypervisor)"; 98 + if (!(effective & mask)) 99 + attributes[j++] = "clear"; 100 + 101 + printf("%12s %c (%d): ", aspect->name, effective & mask ? '*' : ' ', aspect->index); 102 + print_list(attributes, j); 103 + printf(" \t(%s)\n", aspect->desc); 104 + } 105 + 106 + int main(int argc, char *argv[]) 107 + { 108 + if (!dexcr_exists()) { 109 + printf("DEXCR not detected on this hardware\n"); 110 + return 1; 111 + } 112 + 113 + dexcr = get_dexcr(DEXCR); 114 + hdexcr = get_dexcr(HDEXCR); 115 + effective = dexcr | hdexcr; 116 + 117 + print_dexcr(" DEXCR", dexcr); 118 + print_dexcr(" HDEXCR", hdexcr); 119 + print_dexcr("Effective", effective); 120 + printf("\n"); 121 + 122 + for (size_t i = 0; i < ARRAY_SIZE(aspects); i++) 123 + print_aspect(&aspects[i]); 124 + printf("\n"); 125 + 126 + if (effective & DEXCR_PR_NPHIE) { 127 + printf("DEXCR[NPHIE] enabled: hashst/hashchk "); 128 + if (hashchk_triggers()) 129 + printf("working\n"); 130 + else 131 + printf("failed to trigger\n"); 132 + } else { 133 + printf("DEXCR[NPHIE] disabled: hashst/hashchk "); 134 + if (hashchk_triggers()) 135 + printf("unexpectedly triggered\n"); 136 + else 137 + printf("ignored\n"); 138 + } 139 + 140 + return 0; 141 + }
+4
tools/testing/selftests/powerpc/include/reg.h
··· 19 19 #define mb() asm volatile("sync" : : : "memory"); 20 20 #define barrier() asm volatile("" : : : "memory"); 21 21 22 + #define SPRN_HDEXCR_RO 455 /* Userspace readonly view of SPRN_HDEXCR (471) */ 23 + 22 24 #define SPRN_MMCR2 769 23 25 #define SPRN_MMCRA 770 24 26 #define SPRN_MMCR0 779 ··· 48 46 #define SPRN_SIAR 780 49 47 #define SPRN_SDAR 781 50 48 #define SPRN_SIER 768 49 + 50 + #define SPRN_DEXCR_RO 812 /* Userspace readonly view of SPRN_DEXCR (828) */ 51 51 52 52 #define SPRN_TEXASR 0x82 /* Transaction Exception and Status Register */ 53 53 #define SPRN_TFIAR 0x81 /* Transaction Failure Inst Addr */
+30 -1
tools/testing/selftests/powerpc/include/utils.h
··· 9 9 #define __cacheline_aligned __attribute__((aligned(128))) 10 10 11 11 #include <stdint.h> 12 + #include <stdio.h> 12 13 #include <stdbool.h> 14 + #include <sys/signal.h> 13 15 #include <linux/auxvec.h> 14 16 #include <linux/perf_event.h> 15 17 #include <asm/cputable.h> 16 18 #include "reg.h" 19 + #include <unistd.h> 20 + 21 + #ifndef ARRAY_SIZE 22 + # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 23 + #endif 17 24 18 25 /* Avoid headaches with PRI?64 - just use %ll? always */ 19 26 typedef unsigned long long u64; ··· 74 67 }; 75 68 76 69 #if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30) 77 - #include <unistd.h> 78 70 #include <sys/syscall.h> 79 71 80 72 static inline pid_t gettid(void) ··· 112 106 bool is_ppc64le(void); 113 107 int using_hash_mmu(bool *using_hash); 114 108 109 + struct sigaction push_signal_handler(int sig, void (*fn)(int, siginfo_t *, void *)); 110 + struct sigaction pop_signal_handler(int sig, struct sigaction old_handler); 111 + 115 112 /* Yes, this is evil */ 116 113 #define FAIL_IF(x) \ 117 114 do { \ ··· 125 116 } \ 126 117 } while (0) 127 118 119 + #define FAIL_IF_MSG(x, msg) \ 120 + do { \ 121 + if ((x)) { \ 122 + fprintf(stderr, \ 123 + "[FAIL] Test FAILED on line %d: %s\n", \ 124 + __LINE__, msg); \ 125 + return 1; \ 126 + } \ 127 + } while (0) 128 + 128 129 #define FAIL_IF_EXIT(x) \ 129 130 do { \ 130 131 if ((x)) { \ 131 132 fprintf(stderr, \ 132 133 "[FAIL] Test FAILED on line %d\n", __LINE__); \ 134 + _exit(1); \ 135 + } \ 136 + } while (0) 137 + 138 + #define FAIL_IF_EXIT_MSG(x, msg) \ 139 + do { \ 140 + if ((x)) { \ 141 + fprintf(stderr, \ 142 + "[FAIL] Test FAILED on line %d: %s\n", \ 143 + __LINE__, msg); \ 133 144 _exit(1); \ 134 145 } \ 135 146 } while (0)
-2
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
··· 18 18 #define MMCR1_RSQ 0x200000000000ULL /* radix scope qual field */ 19 19 #define BHRB_DISABLE 0x2000000000ULL /* MMCRA BHRB DISABLE bit */ 20 20 21 - #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 22 - 23 21 extern int ev_mask_pmcxsel, ev_shift_pmcxsel; 24 22 extern int ev_mask_marked, ev_shift_marked; 25 23 extern int ev_mask_comb, ev_shift_comb;
+24
tools/testing/selftests/powerpc/utils.c
··· 618 618 fclose(f); 619 619 return rc; 620 620 } 621 + 622 + struct sigaction push_signal_handler(int sig, void (*fn)(int, siginfo_t *, void *)) 623 + { 624 + struct sigaction sa; 625 + struct sigaction old_handler; 626 + 627 + sa.sa_sigaction = fn; 628 + sigemptyset(&sa.sa_mask); 629 + sa.sa_flags = SA_SIGINFO; 630 + FAIL_IF_EXIT_MSG(sigaction(sig, &sa, &old_handler), 631 + "failed to push signal handler"); 632 + 633 + return old_handler; 634 + } 635 + 636 + struct sigaction pop_signal_handler(int sig, struct sigaction old_handler) 637 + { 638 + struct sigaction popped; 639 + 640 + FAIL_IF_EXIT_MSG(sigaction(sig, &old_handler, &popped), 641 + "failed to pop signal handler"); 642 + 643 + return popped; 644 + }