ARM: brcmstb: Add Broadcom STB SoC support
Subsystems (7)
v8 cover ARM: brcmstb: Add Broadcom STB SoC support
Hi all,
I'm taking over the latest resubmission of this patch series. There are a few moderate changes for v8 (noted below), but we are waiting mostly for an Ack for the reboot driver.
This patchset contains the board support package for the Broadcom BCM7445 ARM-based SoC [1]. These changes contain a minimal set of code needed for a BCM7445-based board to boot the Linux kernel.
These changes heavily leverage the OF/devicetree framework. The machine is also built into the multi-platform ARMv7 image.
Changes are also available here:
https://github.com/brcm/linux/tree/brcmstb-v8
git://github.com/brcm/linux.git +brcmstb-v8
v8:
- rebase to v3.16-rc6
- convert SMP bringup to use CPU_METHOD_OF_DECLARE
- add MAINTAINERS entries
- select a few new drivers for the ARCH_BRCMSTB platform
v7 (https://lkml.org/lkml/2014/2/26/133):
- rebase to v3.14-rc4
- detect and apply ARM erratum 798181 to Brahma15 CPUs
- split-up bcm7445.dts into a common dtsi and board-specific dts
v6 (https://lkml.org/lkml/2014/2/3/493):
- rebased to v3.14-rc1
- utilize common APIs for handling CPU power-down
- drop deprecated __cpuinit attributes
v5 (https://lkml.org/lkml/2014/1/21/640):
- rebased to v3.13 tag
- make UART DT node a child of 'rdb' node
- fix ordering of debug UART entries
v4 (https://lkml.org/lkml/2014/1/17/455):
- make a reboot driver and put it in the drivers folder
- rework DT bindings to leverage 'syscon'
- rework BSP code to use 'syscon' for all register mappings
- misc. tweaks per suggestions from v3
v3 (https://lkml.org/lkml/2014/1/14/696):
- rebased to v3.13-rc8
- switched to using 'multi_v7_defconfig'
- eliminated dependence on compile-time peripheral register access
- moved DT node iomap out from 'init_early'
- misc. minor cleanups from mailing-list discussion for v2
v2 (https://lkml.org/lkml/2013/11/26/570):
- rebased to v3.13-rc1
- moved implementation to 'mach-bcm' folder
- added CPU init for B16RM
v1:
- initial submission
[1] http://www.broadcom.com/products/Cable/Cable-Set-Top-Box-Solutions/BCM7445
Brian Norris (2):
ARM: brcmstb: select GISB arbiter and interrupt drivers
MAINTAINERS: add entry for Broadcom ARM STB architecture
Gregory Fong (1):
ARM: Enable erratum 798181 for Broadcom Brahma-B15
Marc Carino (8):
ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
power: reset: Add reboot driver for brcmstb
ARM: brcmstb: add debug UART for earlyprintk support
ARM: do CPU-specific init for Broadcom Brahma15 cores
ARM: brcmstb: add CPU binding for Broadcom Brahma15
ARM: brcmstb: add misc. DT bindings for brcmstb
ARM: brcmstb: gic: add compatible string for Broadcom Brahma15
ARM: brcmstb: dts: add a reference DTS for Broadcom 7445
.../devicetree/bindings/arm/brcm-brcmstb.txt | 95 ++++++ Documentation/devicetree/bindings/arm/cpus.txt | 2 + Documentation/devicetree/bindings/arm/gic.txt | 1 + MAINTAINERS | 9 + arch/arm/Kconfig.debug | 16 +- arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/bcm7445-bcm97445svmb.dts | 14 + arch/arm/boot/dts/bcm7445.dtsi | 111 +++++++ arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/kernel/smp_tlb.c | 20 +- arch/arm/mach-bcm/Kconfig | 17 + arch/arm/mach-bcm/Makefile | 5 + arch/arm/mach-bcm/brcmstb.c | 28 ++ arch/arm/mach-bcm/brcmstb.h | 19 ++ arch/arm/mach-bcm/headsmp-brcmstb.S | 33 ++ arch/arm/mach-bcm/platsmp-brcmstb.c | 363 +++++++++++++++++++++ arch/arm/mm/proc-v7.S | 11 + drivers/power/reset/Kconfig | 10 + drivers/power/reset/Makefile | 1 + drivers/power/reset/brcmstb-reboot.c | 120 +++++++ 20 files changed, 869 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/brcm-brcmstb.txt create mode 100644 arch/arm/boot/dts/bcm7445-bcm97445svmb.dts create mode 100644 arch/arm/boot/dts/bcm7445.dtsi create mode 100644 arch/arm/mach-bcm/brcmstb.c create mode 100644 arch/arm/mach-bcm/brcmstb.h create mode 100644 arch/arm/mach-bcm/headsmp-brcmstb.S create mode 100644 arch/arm/mach-bcm/platsmp-brcmstb.c create mode 100644 drivers/power/reset/brcmstb-reboot.c
Signature · 1 line
1.9.1
PATCH v8 1/11 ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
From: Marc Carino <[email protected]>
The BCM7xxx series of Broadcom SoCs are used primarily in set-top boxes.
This patch adds machine support for the ARM-based Broadcom SoCs.
--- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/mach-bcm/Kconfig | 14 ++ arch/arm/mach-bcm/Makefile | 5 + arch/arm/mach-bcm/brcmstb.c | 28 +++ arch/arm/mach-bcm/brcmstb.h | 19 ++ arch/arm/mach-bcm/headsmp-brcmstb.S | 33 ++++ arch/arm/mach-bcm/platsmp-brcmstb.c | 363 ++++++++++++++++++++++++++++++++++++ 7 files changed, 463 insertions(+) create mode 100644 arch/arm/mach-bcm/brcmstb.c create mode 100644 arch/arm/mach-bcm/brcmstb.h create mode 100644 arch/arm/mach-bcm/headsmp-brcmstb.S create mode 100644 arch/arm/mach-bcm/platsmp-brcmstb.c
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_MACH_DOVE=y CONFIG_ARCH_BCM=y CONFIG_ARCH_BCM_MOBILE=y CONFIG_ARCH_BCM_5301X=y +CONFIG_ARCH_BRCMSTB=y CONFIG_ARCH_BERLIN=y CONFIG_MACH_BERLIN_BG2=y CONFIG_MACH_BERLIN_BG2CD=y
arch/arm/mach-bcm/Kconfig +14 -0
@@ -87,4 +87,18 @@ config ARCH_BCM_5301X different SoC or with the older BCM47XX and BCM53XX based network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx +config ARCH_BRCMSTB + bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7 + depends on MMU + select ARM_GIC + select MIGHT_HAVE_PCI + select HAVE_SMP + select HAVE_ARM_ARCH_TIMER + help + Say Y if you intend to run the kernel on a Broadcom ARM-based STB + chipset. + + This enables support for Broadcom ARM-based set-top box chipsets, + including the 7445 family of chips. + endif
arch/arm/mach-bcm/Makefile +5 -0
@@ -30,3 +30,8 @@ obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o # BCM5301X obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o + +ifeq ($(CONFIG_ARCH_BRCMSTB),y) +obj-y += brcmstb.o +obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o +endif
arch/arm/mach-bcm/brcmstb.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/init.h> +#include <linux/of_platform.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +static const char *brcmstb_match[]__initconst = { +"brcm,bcm7445" , +"brcm,brcmstb" , +NULL +}; + +DT_MACHINE_START (BRCMSTB ,"Broadcom STB (Flattened Device Tree)" ) + .dt_compat = brcmstb_match, +MACHINE_END
arch/arm/mach-bcm/brcmstb.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __BRCMSTB_H__ +#define __BRCMSTB_H__ + +void brcmstb_secondary_startup (void ); + +#endif /* __BRCMSTB_H__ */
arch/arm/mach-bcm/headsmp-brcmstb.S new file +33 -0
@@ -0,0 +1,33 @@ +/* + * SMP boot code for secondary CPUs + * Based on arch/arm/mach-tegra/headsmp.S + * + * Copyright (C) 2010 NVIDIA, Inc. + * Copyright (C) 2013-2014 Broadcom Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <asm/assembler.h> +#include <linux/linkage.h> +#include <linux/init.h> + + .section ".text.head", "ax" + +ENTRY(brcmstb_secondary_startup) + /* + * Ensure CPU is in a sane state by disabling all IRQs and switching + * into SVC mode. + */ + setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 + + bl v7_invalidate_l1 + b secondary_startup +ENDPROC(brcmstb_secondary_startup)
arch/arm/mach-bcm/platsmp-brcmstb.c new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 2/11 power: reset: Add reboot driver for brcmstb
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Add support for reboot functionality on boards with ARM-based Broadcom STB chipsets.
--- arch/arm/mach-bcm/Kconfig | 1 + drivers/power/reset/Kconfig | 10 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/brcmstb-reboot.c | 120 +++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 drivers/power/reset/brcmstb-reboot.c
arch/arm/mach-bcm/Kconfig +1 -0
@@ -94,6 +94,7 @@ config ARCH_BRCMSTB select MIGHT_HAVE_PCI select HAVE_SMP select HAVE_ARM_ARCH_TIMER + select POWER_RESET_BRCMSTB help Say Y if you intend to run the kernel on a Broadcom ARM-based STB chipset.
drivers/power/reset/Kconfig +10 -0
@@ -20,6 +20,16 @@ config POWER_RESET_AXXIA Say Y if you have an Axxia family SoC. +config POWER_RESET_BRCMSTB + bool "Broadcom STB reset driver" + depends on POWER_RESET && ARCH_BRCMSTB + help + This driver provides restart support for ARM-based Broadcom STB + boards. + + Say Y here if you have an ARM-based Broadcom STB board and you wish + to have restart support. + config POWER_RESET_GPIO bool "GPIO power-off driver" depends on OF_GPIO && POWER_RESET
drivers/power/reset/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o +obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
drivers/power/reset/brcmstb-reboot.c new file +120 -0
120 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 3/11 ARM: brcmstb: add debug UART for earlyprintk support
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Add the UART definitions needed to support earlyprintk on brcmstb machines.
--- arch/arm/Kconfig.debug | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/Kconfig.debug +15 -1
@@ -130,6 +130,17 @@ choice Say Y here if you want kernel low-level debugging support on Marvell Berlin SoC based platforms. + config DEBUG_BRCMSTB_UART + bool "Use BRCMSTB UART for low-level debug" + depends on ARCH_BRCMSTB + select DEBUG_UART_8250 + help + Say Y here if you want the debug print routines to direct + their output to the first serial port on these devices. + + If you have a Broadcom STB chip and would like early print + messages to appear over the UART, select this option. + config DEBUG_CLPS711X_UART1 bool "Kernel low-level debugging messages via UART1" depends on ARCH_CLPS711X
@@ -1088,6 +1099,7 @@ config DEBUG_UART_PHYS default 0xd4018000 if DEBUG_MMP_UART3 default 0xe0000000 if ARCH_SPEAR13XX default 0xf0000be0 if ARCH_EBSA110 + default 0xf040ab00 if DEBUG_BRCMSTB_UART default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \ ARCH_ORION5X
@@ -1133,6 +1145,7 @@ config DEBUG_UART_VIRT default 0xfa71e000 if DEBUG_QCOM_UARTDM default 0xfb009000 if DEBUG_REALVIEW_STD_PORT default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT + default 0xfc40ab00 if DEBUG_BRCMSTB_UART default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX default 0xfd000000 if ARCH_SPEAR13XX default 0xfd012000 if ARCH_MV78XX0
@@ -1186,7 +1199,8 @@ config DEBUG_UART_8250_WORD ARCH_KEYSTONE || \ DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ DEBUG_DAVINCI_DA8XX_UART2 || \ - DEBUG_BCM_KONA_UART + DEBUG_BCM_KONA_UART || \ + DEBUG_BRCMSTB_UART config DEBUG_UART_8250_FLOW_CONTROL bool "Enable flow control for 8250 UART"
Signature · 1 line
1.9.1
PATCH v8 4/11 ARM: do CPU-specific init for Broadcom Brahma15 cores
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Perform any CPU-specific initialization required on the Broadcom Brahma-15 core.
--- arch/arm/mm/proc-v7.S | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/mm/proc-v7.S +11 -0
@@ -216,6 +216,7 @@ __v7_cr7mp_setup: __v7_ca7mp_setup: __v7_ca12mp_setup: __v7_ca15mp_setup: +__v7_b15mp_setup: __v7_ca17mp_setup: mov r10, #0 1:
@@ -528,6 +529,16 @@ __v7_ca15mp_proc_info: .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info /* + * Broadcom Corporation Brahma-B15 processor. + */ + .type __v7_b15mp_proc_info, #object +__v7_b15mp_proc_info: + .long 0x420f00f0 + .long 0xff0ffff0 + __v7_proc __v7_b15mp_setup, hwcaps = HWCAP_IDIV + .size __v7_b15mp_proc_info, . - __v7_b15mp_proc_info + + /* * ARM Ltd. Cortex A17 processor. */ .type __v7_ca17mp_proc_info, #object
Signature · 1 line
1.9.1
PATCH v8 5/11 ARM: Enable erratum 798181 for Broadcom Brahma-B15
In reply to Brian NorrisFrom: Gregory Fong <[email protected]>
Broadcom Brahma-B15 (r0p0..r0p2) is also affected by Cortex-A15 erratum 798181, so enable the workaround for Brahma-B15.
--- arch/arm/kernel/smp_tlb.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
arch/arm/kernel/smp_tlb.c +12 -8
@@ -92,15 +92,19 @@ void erratum_a15_798181_init(void)unsigned int midr =read_cpuid_id ();unsigned int revidr =read_cpuid (CPUID_REVIDR ); -/* Cortex-A15 r0p0..r3p2 w/o ECO fix affected */ -if ((midr &0xff0ffff0 ) !=0x410fc0f0 || midr >0x413fc0f2 || - (revidr &0x210 ) ==0x210 ) { -return ; - } -if (revidr &0x10 ) - erratum_a15_798181_handler = erratum_a15_798181_partial; -else +/* Brahma-B15 r0p0..r0p2 affected +* Cortex-A15 r0p0..r3p2 w/o ECO fix affected */ +if ((midr &0xff0ffff0 ) ==0x420f00f0 && midr <=0x420f00f2 ) erratum_a15_798181_handler = erratum_a15_798181_broadcast; +else if ((midr &0xff0ffff0 ) ==0x410fc0f0 && midr <=0x413fc0f2 && + (revidr &0x210 ) !=0x210 ) { +if (revidr &0x10 ) + erratum_a15_798181_handler = + erratum_a15_798181_partial; +else + erratum_a15_798181_handler = + erratum_a15_798181_broadcast; + } }#endif
Signature · 1 line
1.9.1
PATCH v8 6/11 ARM: brcmstb: add CPU binding for Broadcom Brahma15
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Add the Broadcom Brahma B15 CPU to the DT CPU binding list.
--- Documentation/devicetree/bindings/arm/cpus.txt | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +2 -0
@@ -163,6 +163,7 @@ nodes to be present and contain the properties described below. "arm,cortex-r4" "arm,cortex-r5" "arm,cortex-r7" + "brcm,brahma-b15" "faraday,fa526" "intel,sa110" "intel,sa1100"
@@ -184,6 +185,7 @@ nodes to be present and contain the properties described below. can be one of: "allwinner,sun6i-a31" "arm,psci" + "brcm,brahma-b15" "marvell,armada-375-smp" "marvell,armada-380-smp" "marvell,armada-xp-smp"
Signature · 1 line
1.9.1
PATCH v8 7/11 ARM: brcmstb: add misc. DT bindings for brcmstb
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Document the bindings that the Broadcom STB platform needs for proper bootup.
--- .../devicetree/bindings/arm/brcm-brcmstb.txt | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/brcm-brcmstb.txt
Documentation/devicetree/bindings/arm/brcm-brcmstb.txt new file +95 -0
@@ -0,0 +1,95 @@ +ARM Broadcom STB platforms Device Tree Bindings +----------------------------------------------- +Boards with Broadcom Brahma15 ARM-based BCMxxxx (generally BCM7xxx variants) +SoC shall have the following DT organization: + +Required root node properties: + - compatible: "brcm,bcm<chip_id>", "brcm,brcmstb" + +example: +/ { + #address-cells = <2>; + #size-cells = <2>; + model = "Broadcom STB (bcm7445)"; + compatible = "brcm,bcm7445", "brcm,brcmstb"; + +Further, syscon nodes that map platform-specific registers used for general +system control is required: + + - compatible: "brcm,bcm<chip_id>-sun-top-ctrl", "syscon" + - compatible: "brcm,bcm<chip_id>-hif-cpubiuctrl", "syscon" + - compatible: "brcm,bcm<chip_id>-hif-continuation", "syscon" + +example: + rdb { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges = <0 0x00 0xf0000000 0x1000000>; + + sun_top_ctrl: syscon at 404000 { + compatible = "brcm,bcm7445-sun-top-ctrl", "syscon"; + reg = <0x404000 0x51c>; + }; + + hif_cpubiuctrl: syscon at 3e2400 { + compatible = "brcm,bcm7445-hif-cpubiuctrl", "syscon"; + reg = <0x3e2400 0x5b4>; + }; + + hif_continuation: syscon at 452000 { + compatible = "brcm,bcm7445-hif-continuation", "syscon"; + reg = <0x452000 0x100>; + }; + }; + +Lastly, nodes that allow for support of SMP initialization and reboot are +required: + +smpboot +------- +Required properties: + + - compatible + The string "brcm,brcmstb-smpboot". + + - syscon-cpu + A phandle / integer array property which lets the BSP know the location + of certain CPU power-on registers. + + The layout of the property is as follows: + o a phandle to the "hif_cpubiuctrl" syscon node + o offset to the base CPU power zone register + o offset to the base CPU reset register + + - syscon-cont + A phandle pointing to the syscon node which describes the CPU boot + continuation registers. + o a phandle to the "hif_continuation" syscon node + +example: + smpboot { + compatible = "brcm,brcmstb-smpboot"; + syscon-cpu = <&hif_cpubiuctrl 0x88 0x178>; + syscon-cont = <&hif_continuation>; + }; + +reboot +------- +Required properties + + - compatible + The string property "brcm,brcmstb-reboot". + + - syscon + A phandle / integer array that points to the syscon node which describes + the general system reset registers. + o a phandle to "sun_top_ctrl" + o offset to the "reset source enable" register + o offset to the "software master reset" register + +example: + reboot { + compatible = "brcm,brcmstb-reboot"; + syscon = <&sun_top_ctrl 0x304 0x308>; + };
Signature · 1 line
1.9.1
PATCH v8 8/11 ARM: brcmstb: gic: add compatible string for Broadcom Brahma15
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Document the Broadcom Brahma B15 GIC implementation as compatible with the ARM GIC standard.
--- Documentation/devicetree/bindings/arm/gic.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/gic.txt +1 -0
@@ -16,6 +16,7 @@ Main node required properties: "arm,cortex-a9-gic" "arm,cortex-a7-gic" "arm,arm11mp-gic" + "brcm,brahma-b15-gic" - interrupt-controller : Identifies the node as an interrupt controller - #interrupt-cells : Specifies the number of cells needed to encode an interrupt source. The type shall be a <u32> and the value shall be 3.
Signature · 1 line
1.9.1
PATCH v8 9/11 ARM: brcmstb: dts: add a reference DTS for Broadcom 7445
In reply to Brian NorrisFrom: Marc Carino <[email protected]>
Add a sample DTS which will allow bootup of a board populated with the BCM7445 chip.
--- arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/bcm7445-bcm97445svmb.dts | 14 ++++ arch/arm/boot/dts/bcm7445.dtsi | 111 +++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 arch/arm/boot/dts/bcm7445-bcm97445svmb.dts create mode 100644 arch/arm/boot/dts/bcm7445.dtsi
arch/arm/boot/dts/Makefile +2 -0
@@ -59,6 +59,8 @@ dtb-$(CONFIG_ARCH_BERLIN) += \ berlin2-sony-nsz-gs7.dtb \ berlin2cd-google-chromecast.dtb \ berlin2q-marvell-dmp.dtb +dtb-$(CONFIG_ARCH_BRCMSTB) += \ + bcm7445-bcm97445svmb.dtb dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ da850-evm.dtb dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb
arch/arm/boot/dts/bcm7445-bcm97445svmb.dts new file +14 -0
@@ -0,0 +1,14 @@ +/dts-v1/; +#include "bcm7445.dtsi" + +/ { + model = "Broadcom STB (bcm7445), SVMB reference board"; + compatible = "brcm,bcm7445", "brcm,brcmstb"; + + memory { + device_type = "memory"; + reg = <0x00 0x00000000 0x00 0x40000000>, + <0x00 0x40000000 0x00 0x40000000>, + <0x00 0x80000000 0x00 0x40000000>; + }; +};
arch/arm/boot/dts/bcm7445.dtsi new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 10/11 ARM: brcmstb: select GISB arbiter and interrupt drivers
In reply to Brian Norris--- arch/arm/mach-bcm/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-bcm/Kconfig +2 -0
@@ -95,6 +95,8 @@ config ARCH_BRCMSTB select HAVE_SMP select HAVE_ARM_ARCH_TIMER select POWER_RESET_BRCMSTB + select BRCMSTB_GISB_ARB + select BRCMSTB_L2_IRQ help Say Y if you intend to run the kernel on a Broadcom ARM-based STB chipset.
Signature · 1 line
1.9.1
PATCH v8 11/11 MAINTAINERS: add entry for Broadcom ARM STB architecture
In reply to Brian Norris--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -1969,6 +1969,15 @@ F: arch/arm/mach-bcm/bcm_5301x.c F: arch/arm/boot/dts/bcm5301x.dtsi F: arch/arm/boot/dts/bcm470* +BROADCOM BCM7XXX ARM ARCHITECTURE +M: Marc Carino <[email protected]> +M: Brian Norris <[email protected]> +L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) +T: git git://github.com/brcm/linux.git +S: Maintained +F: arch/arm/mach-bcm/*brcmstb* +F: arch/arm/boot/dts/bcm7*.dts* + BROADCOM TG3 GIGABIT ETHERNET DRIVER M: Nithin Nayak Sujir <[email protected]> M: Michael Chan <[email protected]>
Signature · 1 line
1.9.1
Arnd Bergmann
maintainerRe: [PATCH v8 02/11] power: reset: Add reboot driver for brcmstb
In reply to Brian NorrisQuoted 24 lines · On Monday 21 July 2014 14:07:57 Brian Norris wrote:
arch/arm/mach-bcm/Kconfig +1
-0@@ -94,6 +94,7 @@ config ARCH_BRCMSTB select MIGHT_HAVE_PCI select HAVE_SMP select HAVE_ARM_ARCH_TIMER + select POWER_RESET_BRCMSTB help Say Y if you intend to run the kernel on a Broadcom ARM-based STB chipset.drivers/power/reset/Kconfig +3
-0@@ -20,6 +20,16 @@ config POWER_RESET_AXXIA Say Y if you have an Axxia family SoC. +config POWER_RESET_BRCMSTB + bool "Broadcom STB reset driver" + depends on POWER_RESET && ARCH_BRCMSTB
drivers/power/reset/Kconfig config POWER_RESET_AXXIA · line 35
Quoted 10 lines
drivers/power/reset/Kconfig +7
-0+ help + This driver provides restart support for ARM-based Broadcom STB + boards. + + Say Y here if you have an ARM-based Broadcom STB board and you wish + to have restart support. + config POWER_RESET_GPIO bool "GPIO power-off driver" depends on OF_GPIO && POWER_RESET
(nitpicking)
You shouldn't have both a user-selectable option and 'select' it from the platform, because it makes it inherently not selectable, in particular in the combination with 'depends on ARCH_BRCMSTB'.
One way to solve this would be to change the dependency to
config POWER_RESET_BRCMSTB
bool "Broadcom STB reset driver" depends on POWER_RESET && ARM depends on ARCH_BRCMSTB || COMPILE_TEST
which in effect would allow building it on any ARM machine as long as COMPILE_TEST is set (which normally is not).
The same could be expressed using
config POWER_RESET_BRCMSTB
bool "Broadcom STB reset driver" if COMPILE_TEST depends on POWER_RESET && ARM
My preference in this case however would be to just drop the 'select' statement and add the driver to the defconfig file.
Arnd
Quoted 9 lines · On Monday 21 July 2014 14:07:55 Brian Norris wrote:
I'm taking over the latest resubmission of this patch series. There are a few moderate changes for v8 (noted below), but we are waiting mostly for an Ack for the reboot driver.
This patchset contains the board support package for the Broadcom BCM7445 ARM-based SoC [1]. These changes contain a minimal set of code needed for a BCM7445-based board to boot the Linux kernel.
Quoted 7 lines
These changes heavily leverage the OF/devicetree framework. The machine is also built into the multi-platform ARMv7 image.
Changes are also available here:
https://github.com/brcm/linux/tree/brcmstb-v8
git://github.com/brcm/linux.git+brcmstb-v8
Whole series
I think we should try to get this merged into 3.17, it's already taken too long and the patches look good.
Please add the core architecture patches for arch/arm into Russell's patch tracker http://www.arm.linux.org.uk/developer/patches/.
For the platform changes in the first patch, I would prefer to have Matt pick up the first patch, but we can also apply it directly into arm-soc if he prefers that.
The reset driver can ideally go through the drivers/power/ maintainers, but if they are not interested in merging it, we can also take that through arm-soc. See also my one comment on that driver.
Arnd
Re: [PATCH v8 02/11] power: reset: Add reboot driver for brcmstb
In reply to Arnd BergmannQuoted 38 lines · Arnd Bergmann
Quoted 24 lines · On Monday 21 July 2014 14:07:57 Brian Norris wrote:
arch/arm/mach-bcm/Kconfig +1
-0@@ -94,6 +94,7 @@ config ARCH_BRCMSTB select MIGHT_HAVE_PCI select HAVE_SMP select HAVE_ARM_ARCH_TIMER + select POWER_RESET_BRCMSTB help Say Y if you intend to run the kernel on a Broadcom ARM-based STB chipset.drivers/power/reset/Kconfig +3
-0@@ -20,6 +20,16 @@ config POWER_RESET_AXXIA Say Y if you have an Axxia family SoC. +config POWER_RESET_BRCMSTB + bool "Broadcom STB reset driver" + depends on POWER_RESET && ARCH_BRCMSTBdrivers/power/reset/Kconfig config POWER_RESET_AXXIA · line 35
Quoted 10 lines
drivers/power/reset/Kconfig +7
-0+ help + This driver provides restart support for ARM-based Broadcom STB + boards. + + Say Y here if you have an ARM-based Broadcom STB board and you wish + to have restart support. + config POWER_RESET_GPIO bool "GPIO power-off driver" depends on OF_GPIO && POWER_RESET(nitpicking)
Quoted 3 lines
You shouldn't have both a user-selectable option and 'select' it from the platform, because it makes it inherently not selectable, in particular in the combination with 'depends on
ARCH_BRCMSTB'.
OK, thanks for the comment. Note that there is some precedent for this bad Kconfig behavior in the same subsystem (POWER_RESET_GPIO and POWER_RESET_VEXPRESS are both 'select'ed in arch/arm/mach-*/Kconfig).
[...]
Quoted 2 lines
My preference in this case however would be to just drop the 'select' statement and add the driver to the defconfig file.
How about a third option, where we drop the 'select' statement and set POWER_RESET_BRCMSTB to be 'default y'? Then we don't have to modify the defconfig, and it gives the added bonus of choosing a sane default even if you're not based on the multi_v7_defconfig. i.e.:
arch/arm/mach-bcm/Kconfig +0 -1
@@ -94,7 +94,6 @@ config ARCH_BRCMSTB select MIGHT_HAVE_PCI select HAVE_SMP select HAVE_ARM_ARCH_TIMER - select POWER_RESET_BRCMSTB select BRCMSTB_GISB_ARB select BRCMSTB_L2_IRQ help
drivers/power/reset/Kconfig +1 -0
@@ -23,6 +23,7 @@ config POWER_RESET_AXXIA config POWER_RESET_BRCMSTB bool "Broadcom STB reset driver" depends on POWER_RESET && ARCH_BRCMSTB + default y help This driver provides restart support for ARM-based Broadcom STB boards.
Brian
+ Sebastian
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Monday 21 July 2014 14:07:55 Brian Norris wrote:
I'm taking over the latest resubmission of this patch series. There are a few moderate changes for v8 (noted below), but we are waiting mostly for an Ack for the reboot driver.
This patchset contains the board support package for the Broadcom BCM7445 ARM-based SoC [1]. These changes contain a minimal set of code needed for a BCM7445-based board to boot the Linux kernel.
These changes heavily leverage the OF/devicetree framework. The machine is also built into the multi-platform ARMv7 image.
Quoted 8 lines
Quoted 4 lines
Changes are also available here:
https://github.com/brcm/linux/tree/brcmstb-v8
git://github.com/brcm/linux.git+brcmstb-v8Whole series
Acked-by Arnd Bergmann <[email protected]>
Thanks!
Quoted 2 lines
I think we should try to get this merged into 3.17, it's already taken too long and the patches look good.
Yes, it's about time.
Quoted 2 lines
Please add the core architecture patches for
arch/arminto Russell's patch tracker http://www.arm.linux.org.uk/developer/patches/.
OK, that's unfamiliar to me, but I'll try that out.
Quoted 3 lines
For the platform changes in the first patch, I would prefer to have Matt pick up the first patch, but we can also apply it directly into arm-soc if he prefers that.
That brings up a question related to PATCH 11 in the series (MAINTAINERS update); who will be maintaining arch/arm/mach-bcm/*brcmstb*, and how will code go upstream? It seems like Matt and Christian are officially mach-bcm maintainers, although I don't know if Christian is still involved.
Also, BCM7xxx shares little in common with the rest of mach-bcm, except a company name, so we'd really like at least the 'Maintainer' entries for the CC. I was planning on a separate git tree too, although it could have conflicts if we touch arch/arm/mach-bcm/{Makefile,Kconfig}.
So would we send a separate arm-soc pull request for the arm-soc targeted changes (and all future development)?
Quoted 3 lines
The reset driver can ideally go through the
drivers/power/maintainers, but if they are not interested in merging it, we can also take that through arm-soc.
I don't see much activity from the drivers/power/ maintainers on the mailing lists, and I know David Woodhouse at least has been severely distracted (I took over for him on driver/mtd/ recently), so I don't expect much. (EDIT: I see [1]. Nice!)
Quoted 1 line
See also my one comment on that driver.
I proposed an additional diff on that patch in response.
I can strip the drivers/power/reboot/ driver out and send it separately to our new drivers/power/ maintainer (thanks Sebastian!), and hope that it gets through for 3.17.
For the reset of mach-bcm stuff, I'll just send an arm-soc pull request soon enough, unless Matt/Arnd/Olof object.
Thanks,
Brian
Arnd Bergmann
maintainerQuoted 9 lines · On Tuesday 22 July 2014 13:44:31 Brian Norris wrote:
Quoted 3 lines
For the platform changes in the first patch, I would prefer to have Matt pick up the first patch, but we can also apply it directly into arm-soc if he prefers that.
That brings up a question related to PATCH 11 in the series (
MAINTAINERSupdate); who will be maintainingarch/arm/mach-bcm/*brcmstb*, and how will code go upstream? It seems like Matt and Christian are officially mach-bcm maintainers, although I don't know if Christian is still involved.
You have to solve that question together with Matt. From my perspective it would be easier if I only have to deal with one person for mach-bcm, but it's really up to you.
Quoted 7 lines
Also, BCM7xxx shares little in common with the rest of mach-bcm, except a company name, so we'd really like at least the 'Maintainer' entries for the CC. I was planning on a separate git tree too, although it could have conflicts if we touch
arch/arm/mach-bcm/{Makefile,Kconfig}.So would we send a separate arm-soc pull request for the arm-soc targeted changes (and all future development)?
You can definitely have the separate MAINTAINERS entry without necessarily becoming a maintainer at the same level. I know Matt is very responsive and can forward your patches to arm-soc if that works for you.
Quoted 2 lines
For the reset of mach-bcm stuff, I'll just send an arm-soc pull request soon enough, unless Matt/Arnd/Olof object.
I'll wait for Matt to comment before pulling it, otherwise that sounds fine.
Arnd
Arnd Bergmann
maintainerRe: [PATCH v8 02/11] power: reset: Add reboot driver for brcmstb
In reply to Brian NorrisQuoted 22 lines · On Tuesday 22 July 2014 13:02:13 Brian Norris wrote:
How about a third option, where we drop the 'select' statement and set
POWER_RESET_BRCMSTBto be 'default y'? Then we don't have to modify the defconfig, and it gives the added bonus of choosing a sane default even if you're not based on themulti_v7_defconfig. i.e.:arch/arm/mach-bcm/Kconfig +0
-1@@ -94,7 +94,6 @@ config ARCH_BRCMSTB select MIGHT_HAVE_PCI select HAVE_SMP select HAVE_ARM_ARCH_TIMER - select POWER_RESET_BRCMSTB select BRCMSTB_GISB_ARB select BRCMSTB_L2_IRQ helpdrivers/power/reset/Kconfig +0
-0
drivers/power/reset/Kconfig config POWER_RESET_AXXIA · line 29
Quoted 7 lines
drivers/power/reset/Kconfig +1
-0@@ -23,6 +23,7 @@ config POWER_RESET_AXXIA config POWER_RESET_BRCMSTB bool "Broadcom STB reset driver" depends on POWER_RESET && ARCH_BRCMSTB + default y help This driver provides restart support for ARM-based Broadcom STB boards.
I don't like this too much. Why do you want to allow disabling the driver if you make it 'default y' in the first place?
We try to avoid 'default y' for user-selectable drivers in general. I noticed that in my example, I was missing the default. It should have been
config POWER_RESET_BRCMSTB
bool "Broadcom STB reset driver" if COMPILE_TEST depends on POWER_RESET && ARM
default ARCH_BRCMSTB
This way, it always gets selected when ARCH_BRCMSTB is on and COMPILE_TEST is off. With COMPILE_TEST enabled, it defaults to ARCH_BRCMSTB but can be enabled or disabled for the purpose of compile testing.
Arnd
Quoted 21 lines · Arnd Bergmann
Quoted 9 lines · On Tuesday 22 July 2014 13:44:31 Brian Norris wrote:
Quoted 3 lines
For the platform changes in the first patch, I would prefer to have Matt pick up the first patch, but we can also apply it directly into arm-soc if he prefers that.
That brings up a question related to PATCH 11 in the series (
MAINTAINERSupdate); who will be maintainingarch/arm/mach-bcm/*brcmstb*, and how will code go upstream? It seems like Matt and Christian are officially mach-bcm maintainers, although I don't know if Christian is still involved.You have to solve that question together with Matt. From my perspective it would be easier if I only have to deal with one person for mach-bcm, but it's really up to you.
Quoted 5 lines
Also, BCM7xxx shares little in common with the rest of mach-bcm, except a company name, so we'd really like at least the 'Maintainer' entries for the CC. I was planning on a separate git tree too, although it could have conflicts if we touch
arch/arm/mach-bcm/{Makefile,Kconfig}.
Quoted 6 lines
Quoted 2 lines
So would we send a separate arm-soc pull request for the arm-soc targeted changes (and all future development)?
You can definitely have the separate
MAINTAINERSentry without necessarily becoming a maintainer at the same level. I know Matt is very responsive and can forward your patches to arm-soc if that works for you.
We had this discussion wrt Hauke's BCM5301x support. The situation is basically the same. To date, every instance of a BCM ARM SoC shares nothing more than the company name and in some rare cases a piece of licensed IP like the Arasan sdhci or dwc2. I can't recall who asked for it, but I think Olof asked to have one pull request for all of mach-bcm to keep things simple. So we ended up with:
BROADCOM BCM5301X ARM ARCHICTURE
M: Hauke Mehrtens <[email protected]> L: linux-arm-kernel at lists.infradead.org S: Maintained F: arch/arm/mach-bcm/bcm_5301x.c F: arch/arm/boot/dts/bcm5301x.dtsi F: arch/arm/boot/dts/bcm470*
which could be a model for BCM7xxx maintainership and Christian and I can aggregate this stuff in the mach-bcm tree for pull requests to the arm-soc team as we are doing now. bcm2835 is an exception case since that was living elsewhere before the new platforms colocated in mach-bcm.
Quoted 5 lines
Quoted 2 lines
For the reset of mach-bcm stuff, I'll just send an arm-soc pull request soon enough, unless Matt/Arnd/Olof object.
I'll wait for Matt to comment before pulling it, otherwise that sounds fine.
I'm fine with it, but we were asked to have one request for bcm5301x to make life easy for the arm-soc team. If we want each platform to do pull requests directly with arm-soc we should advise Hauke to do the same as well with bcm5301x. I think the chances of Kconfig/Makefile conflicts are relatively low as there's a dwindling amount of code of interest in new platform mach directories like ours.
I would like to see a consistent path for all BCM platform maintainers.
-Matt
Arnd Bergmann
maintainerQuoted 7 lines · On Tuesday 22 July 2014 17:33:50 Matt Porter wrote:
Quoted 6 lines
Quoted 3 lines
For the reset of mach-bcm stuff, I'll just send an arm-soc pull request soon enough, unless Matt/Arnd/Olof object.
I'll wait for Matt to comment before pulling it, otherwise that sounds fine.
Quoted 9 lines
I'm fine with it, but we were asked to have one request for bcm5301x to make life easy for the arm-soc team. If we want each platform to do pull requests directly with arm-soc we should advise Hauke to do the same as well with bcm5301x. I think the chances of Kconfig/Makefile conflicts are relatively low as there's a dwindling amount of code of interest in new platform mach directories like ours.
I would like to see a consistent path for all BCM platform maintainers.
Ok. Brian, please send the pull request or patches to Matt then.
Arnd
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · On Tuesday 22 July 2014 17:33:50 Matt Porter wrote:
Quoted 5 lines
Quoted 2 lines
For the reset of mach-bcm stuff, I'll just send an arm-soc pull request soon enough, unless Matt/Arnd/Olof object.
I'll wait for Matt to comment before pulling it, otherwise that sounds fine.
I'm fine with it, but we were asked to have one request for bcm5301x to make life easy for the arm-soc team.
That's all news to me; thanks for the explanation.
Quoted 9 lines
Quoted 7 lines
If we want each platform to do pull
requests directly with arm-soc we should advise Hauke to do the same as well with bcm5301x. I think the chances of Kconfig/Makefile conflicts are relatively low as there's a dwindling amount of code of interest in new platform mach directories like ours.I would like to see a consistent path for all BCM platform maintainers.
Ok. Brian, please send the pull request or patches to Matt then.
Sure thing. I'll drop the 'select POWER_RESET_BRCMSTB' and also drop our git tree from MAINTAINERS. I'll send v9 of the reboot driver separately, targeted at Sebastian (or else to also defer to Matt's tree).
Thanks,
Brian
Re: [PATCH v8 02/11] power: reset: Add reboot driver for brcmstb
In reply to Arnd Bergmann+ Sebastian
Quoted 25 lines · Arnd Bergmann
Quoted 24 lines · On Tuesday 22 July 2014 13:02:13 Brian Norris wrote:
How about a third option, where we drop the 'select' statement and set
POWER_RESET_BRCMSTBto be 'default y'? Then we don't have to modify the defconfig, and it gives the added bonus of choosing a sane default even if you're not based on themulti_v7_defconfig. i.e.:arch/arm/mach-bcm/Kconfig +0
-1@@ -94,7 +94,6 @@ config ARCH_BRCMSTB select MIGHT_HAVE_PCI select HAVE_SMP select HAVE_ARM_ARCH_TIMER - select POWER_RESET_BRCMSTB select BRCMSTB_GISB_ARB select BRCMSTB_L2_IRQ helpdrivers/power/reset/Kconfig +0
-0@@ -23,6 +23,7 @@ config POWER_RESET_AXXIA config POWER_RESET_BRCMSTB bool "Broadcom STB reset driver"
Quoted 8 lines
drivers/power/reset/Kconfig config POWER_RESET_AXXIA · line 29
Quoted 5 lines
drivers/power/reset/Kconfig +1
-0depends on POWER_RESET && ARCH_BRCMSTB + default y help This driver provides restart support for ARM-based Broadcom STB boards.I don't like this too much. Why do you want to allow disabling the driver if you make it 'default y' in the first place?
Not much of a reason, but I thought configurability is a positive. There's really not a good reason to not have this driver though; I can't imagine someone wanting to build our platform but not be able to reboot it.
Quoted 1 line
We try to avoid 'default y' for user-selectable drivers in general.
I didn't know that. A default is technically different than "should a user be able to disable this," but I suppose the policy makes sense.
Quoted 1 line
I noticed that in my example, I was missing the default.
I see. That's why I immediately ruled it out.
Quoted 6 lines
It should have been
config
POWER_RESET_BRCMSTB
bool "Broadcom STB reset driver" ifCOMPILE_TESTdepends onPOWER_RESET&& ARM
defaultARCH_BRCMSTB
OK, that's OK with me if it's OK with Sebastian, et al. Respin coming soon, separate from the mach-bcm and ARM stuff...
(BTW, we might consider rewriting the other config entries to be similar, if we really want to make this things consistently nitpick-proof.)
Quoted 4 lines
This way, it always gets selected when
ARCH_BRCMSTBis on andCOMPILE_TESTis off. WithCOMPILE_TESTenabled, it defaults toARCH_BRCMSTBbut can be enabled or disabled for the purpose of compile testing.
Thanks,
Brian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Brian NorrisQuoted 20 lines · Brian Norris
arch/arm/mach-bcm/platsmp-brcmstb.c new file +20
-0+static DEFINE_SPINLOCK (boot_lock); + +static void brcmstb_secondary_init (unsigned int cpu) +{ +/* +* Synchronise with the boot thread. +*/ +spin_lock (&boot_lock); +spin_unlock (&boot_lock); +} + +static int brcmstb_boot_secondary (unsigned int cpu,struct task_struct *idle) +{ +/* +* set synchronisation state between this boot processor +* and the secondary one +*/ +spin_lock (&boot_lock); + +/* Bring up power to the core if necessary */
arch/arm/mach-bcm/platsmp-brcmstb.c line 348
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+if (brcmstb_cpu_get_power_state (cpu) ==0 ) +brcmstb_cpu_power_on (cpu); + +brcmstb_cpu_boot (cpu); + +/* +* now the secondary core is starting up let it run its +* calibrations, then wait for it to finish +*/ +spin_unlock (&boot_lock);
I've just read through this code (because it caused my allmodconfig to break) and spotted this.
What function does boot_lock perform here? Please, don't quote the comments (I know where the comments came from) but what I want to hear is your comments about why you decided to retain this.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Brian NorrisQuoted 39 lines · Brian Norris
From: Marc Carino <[email protected]>
The BCM7xxx series of Broadcom SoCs are used primarily in set-top boxes.
This patch adds machine support for the ARM-based Broadcom SoCs.
Signed-off-by Marc Carino <[email protected]>Signed-off-by Brian Norris <[email protected]>--- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/mach-bcm/Kconfig | 14 ++ arch/arm/mach-bcm/Makefile | 5 + arch/arm/mach-bcm/brcmstb.c | 28 +++ arch/arm/mach-bcm/brcmstb.h | 19 ++ arch/arm/mach-bcm/headsmp-brcmstb.S | 33 ++++ arch/arm/mach-bcm/platsmp-brcmstb.c | 363 ++++++++++++++++++++++++++++++++++++ 7 files changed, 463 insertions(+) create mode 100644 arch/arm/mach-bcm/brcmstb.c create mode 100644 arch/arm/mach-bcm/brcmstb.h create mode 100644 arch/arm/mach-bcm/headsmp-brcmstb.S create mode 100644 arch/arm/mach-bcm/platsmp-brcmstb.carch/arm/configs/multi_v7_defconfig +1
-0@@ -19,6 +19,7 @@ CONFIG_MACH_DOVE=y CONFIG_ARCH_BCM=y CONFIG_ARCH_BCM_MOBILE=y CONFIG_ARCH_BCM_5301X=y +CONFIG_ARCH_BRCMSTB=y CONFIG_ARCH_BERLIN=y CONFIG_MACH_BERLIN_BG2=y CONFIG_MACH_BERLIN_BG2CD=yarch/arm/mach-bcm/Kconfig +0
-0
arch/arm/mach-bcm/Kconfig config ARCH_BCM_5301X · line 92
Quoted 6 lines
arch/arm/mach-bcm/Kconfig +3
-0@@ -87,4 +87,18 @@ config ARCH_BCM_5301X different SoC or with the older BCM47XX and BCM53XX based network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx +config ARCH_BRCMSTB + bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7 + depends on MMU
This was implied, but there are some patches from Arnd in this area. Does it really not build with !MMU?
arch/arm/mach-bcm/Kconfig config ARCH_BCM_5301X · line 95
Quoted 4 lines
arch/arm/mach-bcm/Kconfig +3
-0+ select ARM_GIC + select MIGHT_HAVE_PCI + select HAVE_SMP
At least HAVE_SMP is for sure, but I think both of these are selected already .
Quoted 46 lines
arch/arm/mach-bcm/Kconfig +8
-0+ select HAVE_ARM_ARCH_TIMER + help + Say Y if you intend to run the kernel on a Broadcom ARM-based STB + chipset. + + This enables support for Broadcom ARM-based set-top box chipsets, + including the 7445 family of chips. +endif
arch/arm/mach-bcm/Makefile +5
-0@@ -30,3 +30,8 @@ obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o # BCM5301X obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o + +ifeq ($(CONFIG_ARCH_BRCMSTB),y) +obj-y += brcmstb.o +obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o +endifarch/arm/mach-bcm/brcmstb.c new file +18
-0@@ -0,0 +1,28 @@ +/* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/init.h> +#include <linux/of_platform.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h>
arch/arm/mach-bcm/brcmstb.c line 28
Quoted 10 lines
arch/arm/mach-bcm/brcmstb.c new file +10
-0+ +static const char *brcmstb_match[]__initconst = { +"brcm,bcm7445" , +"brcm,brcmstb" , +NULL +}; + +DT_MACHINE_START (BRCMSTB ,"Broadcom STB (Flattened Device Tree)" ) + .dt_compat = brcmstb_match, +MACHINE_END
Do you plan to add more here? Otherwise you don't need this file.
Quoted 52 lines
arch/arm/mach-bcm/brcmstb.h new file +19
-0@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __BRCMSTB_H__ +#define __BRCMSTB_H__ + +void brcmstb_secondary_startup (void ); + +#endif /* __BRCMSTB_H__ */ arch/arm/mach-bcm/headsmp-brcmstb.S new file +21
-0@@ -0,0 +1,33 @@ +/* + * SMP boot code for secondary CPUs + * Based on arch/arm/mach-tegra/headsmp.S + * + * Copyright (C) 2010 NVIDIA, Inc. + * Copyright (C) 2013-2014 Broadcom Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <asm/assembler.h> +#include <linux/linkage.h> +#include <linux/init.h> +
arch/arm/mach-bcm/headsmp-brcmstb.S line 31
Quoted 10 lines
arch/arm/mach-bcm/headsmp-brcmstb.S new file +10
-0+ .section ".text.head", "ax" + +ENTRY(brcmstb_secondary_startup) + /* + * Ensure CPU is in a sane state by disabling all IRQs and switching + * into SVC mode. + */ + setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 + + bl v7_invalidate_l1
This should be in your boot code. That is part of the documented entry requirements. Also, if you are coming straight from reset, there is other setup probably missing.
Yes, there are others with this, but that doesn't make it right.
Quoted 72 lines
arch/arm/mach-bcm/headsmp-brcmstb.S new file +2
-0+ b secondary_startup +ENDPROC(brcmstb_secondary_startup)arch/arm/mach-bcm/platsmp-brcmstb.c new file +64
-0@@ -0,0 +1,363 @@ +/* +* Broadcom STB CPU SMP and hotplug support for ARM +* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/printk.h> +#include <linux/regmap.h> +#include <linux/smp.h> +#include <linux/mfd/syscon.h> +#include <linux/spinlock.h> + +#include <asm/cacheflush.h> +#include <asm/cp15.h> +#include <asm/mach-types.h> +#include <asm/smp_plat.h> + +#include "brcmstb.h" + +enum { +ZONE_MAN_CLKEN_MASK =BIT (0 ), +ZONE_MAN_RESET_CNTL_MASK =BIT (1 ), +ZONE_MAN_MEM_PWR_MASK =BIT (4 ), +ZONE_RESERVED_1_MASK =BIT (5 ), +ZONE_MAN_ISO_CNTL_MASK =BIT (6 ), +ZONE_MANUAL_CONTROL_MASK =BIT (7 ), +ZONE_PWR_DN_REQ_MASK =BIT (9 ), +ZONE_PWR_UP_REQ_MASK =BIT (10 ), +ZONE_BLK_RST_ASSERT_MASK =BIT (12 ), +ZONE_PWR_OFF_STATE_MASK =BIT (25 ), +ZONE_PWR_ON_STATE_MASK =BIT (26 ), +ZONE_DPG_PWR_STATE_MASK =BIT (28 ), +ZONE_MEM_PWR_STATE_MASK =BIT (29 ), +ZONE_RESET_STATE_MASK =BIT (31 ), +CPU0_PWR_ZONE_CTRL_REG =1 , +CPU_RESET_CONFIG_REG =2 , +}; + +static void __iomem *cpubiuctrl_block; +static void __iomem *hif_cont_block; +static u32 cpu0_pwr_zone_ctrl_reg; +static u32 cpu_rst_cfg_reg; +static u32 hif_cont_reg; + +#ifdef CONFIG_HOTPLUG_CPU +static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state); + +static int per_cpu_sw_state_rd (u32 cpu) +{
arch/arm/mach-bcm/platsmp-brcmstb.c line 74
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+sync_cache_r (SHIFT_PERCPU_PTR (&per_cpu_sw_state,per_cpu_offset (cpu))); +return per_cpu (per_cpu_sw_state, cpu); +} + +static void per_cpu_sw_state_wr (u32 cpu,int val) +{ +per_cpu (per_cpu_sw_state, cpu) = val; +dmb (); +sync_cache_w (SHIFT_PERCPU_PTR (&per_cpu_sw_state,per_cpu_offset (cpu))); +dsb_sev ();
Barriers need to be documented why they are needed.
Quoted 35 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +35
-0+} +#else +static inline void per_cpu_sw_state_wr (u32 cpu,int val) { } +#endif + +static void __iomem *pwr_ctrl_get_base (u32 cpu) +{ +void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg; + base += (cpu_logical_map (cpu) *4 ); +return base; +} + +static u32 pwr_ctrl_rd (u32 cpu) +{ +void __iomem *base =pwr_ctrl_get_base (cpu); +return readl_relaxed (base); +} + +static void pwr_ctrl_wr (u32 cpu,u32 val) +{ +void __iomem *base =pwr_ctrl_get_base (cpu); +writel (val, base); +} + +static void cpu_rst_cfg_set (u32 cpu,int set) +{ +u32 val; + val =readl_relaxed (cpubiuctrl_block + cpu_rst_cfg_reg); +if (set) + val |=BIT (cpu_logical_map (cpu)); +else + val &= ~BIT (cpu_logical_map (cpu)); +writel_relaxed (val, cpubiuctrl_block + cpu_rst_cfg_reg); +} +
arch/arm/mach-bcm/platsmp-brcmstb.c line 119
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+static void cpu_set_boot_addr (u32 cpu,unsigned long boot_addr) +{ +const int reg_ofs =cpu_logical_map (cpu) *8 ; +writel_relaxed (0 , hif_cont_block + hif_cont_reg + reg_ofs); +writel_relaxed (boot_addr, hif_cont_block + hif_cont_reg +4 + reg_ofs); +} + +static void brcmstb_cpu_boot (u32 cpu) +{ +pr_info ("SMP: Booting CPU%d...\n" , cpu);
The core already prints messages.
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+ +/* +* set the reset vector to point to the secondary_startup +* routine +*/ +cpu_set_boot_addr (cpu,virt_to_phys (brcmstb_secondary_startup)); + +/* unhalt the cpu */ +cpu_rst_cfg_set (cpu,0 ); +}
arch/arm/mach-bcm/platsmp-brcmstb.c line 139
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+ +static void brcmstb_cpu_power_on (u32 cpu) +{ +/* +* The secondary cores power was cut, so we must go through +* power-on initialization. +*/ +u32 tmp; + +pr_info ("SMP: Powering up CPU%d...\n" , cpu);
ditto.
arch/arm/mach-bcm/platsmp-brcmstb.c line 147
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +8
-0+ +/* Request zone power up */ +pwr_ctrl_wr (cpu,ZONE_PWR_UP_REQ_MASK ); + +/* Wait for the power up FSM to complete */ +do { + tmp =pwr_ctrl_rd (cpu); + }while (!(tmp &ZONE_PWR_ON_STATE_MASK ));
Perhaps a timeout? Or perhaps you don't need to wait here. The core code will wait for the core to come online.
arch/arm/mach-bcm/platsmp-brcmstb.c line 149
Quoted 2 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +2
-0+ +per_cpu_sw_state_wr (cpu,1 );
The kernel already tracks the state.
Quoted 6 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +6
-0+} + +static int brcmstb_cpu_get_power_state (u32 cpu) +{ +int tmp =pwr_ctrl_rd (cpu); +return (tmp &ZONE_RESET_STATE_MASK ) ?0 :1 ;
arch/arm/mach-bcm/platsmp-brcmstb.c line 165
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+} + +#ifdef CONFIG_HOTPLUG_CPU + +static void brcmstb_cpu_die (u32 cpu) +{ +v7_exit_coherency_flush (all); + +/* Prevent all interrupts from reaching this CPU. */ +arch_local_irq_disable ();
Surely that is already done? And disabling IRQ has no effect on wake-up from WFI.
Quoted 15 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +15
-0+ +/* +* Final full barrier to ensure everything before this instruction has +* quiesced. +*/ +isb (); +dsb (); + +per_cpu_sw_state_wr (cpu,0 ); + +/* Sit and wait to die */ +wfi (); + +/* We should never get here... */ +panic ("Spurious interrupt on CPU %d received!\n" , cpu);
arch/arm/mach-bcm/platsmp-brcmstb.c line 190
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+} + +static int brcmstb_cpu_kill (u32 cpu) +{ +u32 tmp; + +pr_info ("SMP: Powering down CPU%d...\n" , cpu); + +while (per_cpu_sw_state_rd (cpu)) + ;
I don't think this is necessary. You don't need to synchronize die and kill. Look at other implementations that actually power down the core (vs. just wfi).
Quoted 127 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +127
-0+ +/* Program zone reset */ +pwr_ctrl_wr (cpu,ZONE_RESET_STATE_MASK |ZONE_BLK_RST_ASSERT_MASK | +ZONE_PWR_DN_REQ_MASK ); + +/* Verify zone reset */ + tmp =pwr_ctrl_rd (cpu); +if (!(tmp &ZONE_RESET_STATE_MASK )) +pr_err ("%s: Zone reset bit for CPU %d not asserted!\n" , + __func__, cpu); + +/* Wait for power down */ +do { + tmp =pwr_ctrl_rd (cpu); + }while (!(tmp &ZONE_PWR_OFF_STATE_MASK )); + +/* Settle-time from Broadcom-internal DVT reference code */ +udelay (7 ); + +/* Assert reset on the CPU */ +cpu_rst_cfg_set (cpu,1 ); + +return 1 ; +} + +#endif /* CONFIG_HOTPLUG_CPU */ + +static int __init setup_hifcpubiuctrl_regs (struct device_node *np) +{ +int rc =0 ; +char *name; +struct device_node *syscon_np =NULL ; + + name ="syscon-cpu" ; + + syscon_np =of_parse_phandle (np, name,0 ); +if (!syscon_np) { +pr_err ("can't find phandle %s\n" , name); + rc = -EINVAL ; + goto cleanup; + } + + cpubiuctrl_block =of_iomap (syscon_np,0 ); +if (!cpubiuctrl_block) { +pr_err ("iomap failed for cpubiuctrl_block\n" ); + rc = -EINVAL ; + goto cleanup; + } + + rc =of_property_read_u32_index (np, name,CPU0_PWR_ZONE_CTRL_REG , + &cpu0_pwr_zone_ctrl_reg); +if (rc) { +pr_err ("failed to read 1st entry from %s property (%d)\n" , name, + rc); + rc = -EINVAL ; + goto cleanup; + } + + rc =of_property_read_u32_index (np, name,CPU_RESET_CONFIG_REG , + &cpu_rst_cfg_reg); +if (rc) { +pr_err ("failed to read 2nd entry from %s property (%d)\n" , name, + rc); + rc = -EINVAL ; + goto cleanup; + } + +cleanup: +if (syscon_np) +of_node_put (syscon_np); + +return rc; +} + +static int __init setup_hifcont_regs (struct device_node *np) +{ +int rc =0 ; +char *name; +struct device_node *syscon_np =NULL ; + + name ="syscon-cont" ; + + syscon_np =of_parse_phandle (np, name,0 ); +if (!syscon_np) { +pr_err ("can't find phandle %s\n" , name); + rc = -EINVAL ; + goto cleanup; + } + + hif_cont_block =of_iomap (syscon_np,0 ); +if (!hif_cont_block) { +pr_err ("iomap failed for hif_cont_block\n" ); + rc = -EINVAL ; + goto cleanup; + } + +/* offset is at top of hif_cont_block */ + hif_cont_reg =0 ; + +cleanup: +if (syscon_np) +of_node_put (syscon_np); + +return rc; +} + +static void __init brcmstb_cpu_ctrl_setup (unsigned int max_cpus) +{ +int rc; +struct device_node *np; +char *name; + + name ="brcm,brcmstb-smpboot" ; + np =of_find_compatible_node (NULL ,NULL , name); +if (!np) { +pr_err ("can't find compatible node %s\n" , name); +return ; + } + + rc =setup_hifcpubiuctrl_regs (np); +if (rc) +return ; + + rc =setup_hifcont_regs (np); +if (rc) +return ; +}
arch/arm/mach-bcm/platsmp-brcmstb.c line 327
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+ +static DEFINE_SPINLOCK (boot_lock); + +static void brcmstb_secondary_init (unsigned int cpu) +{ +/* +* Synchronise with the boot thread. +*/ +spin_lock (&boot_lock); +spin_unlock (&boot_lock);
I suggest you read previous discussions on attempts to make this common before replying to Russell.
Quoted 44 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +36
-1+} + +static int brcmstb_boot_secondary (unsigned int cpu,struct task_struct *idle) +{ +/* +* set synchronisation state between this boot processor +* and the secondary one +*/ +spin_lock (&boot_lock); + +/* Bring up power to the core if necessary */ +if (brcmstb_cpu_get_power_state (cpu) ==0 ) +brcmstb_cpu_power_on (cpu); + +brcmstb_cpu_boot (cpu); + +/* +* now the secondary core is starting up let it run its +* calibrations, then wait for it to finish +*/ +spin_unlock (&boot_lock); + +return 0 ; +} + +static struct smp_operations brcmstb_smp_ops__initdata = { + .smp_prepare_cpus = brcmstb_cpu_ctrl_setup, + .smp_secondary_init = brcmstb_secondary_init, + .smp_boot_secondary = brcmstb_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_kill = brcmstb_cpu_kill, + .cpu_die = brcmstb_cpu_die, +#endif +}; + +CPU_METHOD_OF_DECLARE (brcmstb_smp,"brcm,brahma-b15" , &brcmstb_smp_ops); --1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
Hi Rob,
I appreciate your comments, but where were many of these 5 months ago on the first 7 revisions? :)
On a practical note: v9 is already queued for 3.17. Should I send patches for the 3.17 cycle (or later) to fixup some of these issues? Or would you recommend pulling the patches out of Matt Porter's tree now, and reintroducing for 3.18? (I would be much happier with the first.)
I do note that we at least need to fix allmodconfig ASAP; I'll reply to Russell on that one.
Quoted 43 lines · Rob Herring
Quoted 42 lines · Brian Norris
From: Marc Carino <[email protected]>
The BCM7xxx series of Broadcom SoCs are used primarily in set-top boxes.
This patch adds machine support for the ARM-based Broadcom SoCs.
Signed-off-by Marc Carino <[email protected]>Signed-off-by Brian Norris <[email protected]>--- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/mach-bcm/Kconfig | 14 ++ arch/arm/mach-bcm/Makefile | 5 + arch/arm/mach-bcm/brcmstb.c | 28 +++ arch/arm/mach-bcm/brcmstb.h | 19 ++ arch/arm/mach-bcm/headsmp-brcmstb.S | 33 ++++ arch/arm/mach-bcm/platsmp-brcmstb.c | 363 ++++++++++++++++++++++++++++++++++++ 7 files changed, 463 insertions(+) create mode 100644 arch/arm/mach-bcm/brcmstb.c create mode 100644 arch/arm/mach-bcm/brcmstb.h create mode 100644 arch/arm/mach-bcm/headsmp-brcmstb.S create mode 100644 arch/arm/mach-bcm/platsmp-brcmstb.carch/arm/configs/multi_v7_defconfig +1
-0@@ -19,6 +19,7 @@ CONFIG_MACH_DOVE=y CONFIG_ARCH_BCM=y CONFIG_ARCH_BCM_MOBILE=y CONFIG_ARCH_BCM_5301X=y +CONFIG_ARCH_BRCMSTB=y CONFIG_ARCH_BERLIN=y CONFIG_MACH_BERLIN_BG2=y CONFIG_MACH_BERLIN_BG2CD=yarch/arm/mach-bcm/Kconfig +0
-0@@ -87,4 +87,18 @@ config ARCH_BCM_5301X different SoC or with the older BCM47XX and BCM53XX based network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
Quoted 6 lines
arch/arm/mach-bcm/Kconfig config ARCH_BCM_5301X · line 92
Quoted 3 lines
arch/arm/mach-bcm/Kconfig +3
-0+config ARCH_BRCMSTB + bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7 + depends on MMUThis was implied, but there are some patches from Arnd in this area. Does it really not build with !MMU?
I suppose it probably builds, it likely won't run. I can drop this line and then reassess if ARCH_MULTIPLATFORM becomes buildable with !MMU.
Quoted 6 lines
arch/arm/mach-bcm/Kconfig config ARCH_BCM_5301X · line 95
Quoted 4 lines
arch/arm/mach-bcm/Kconfig +3
-0+ select ARM_GIC + select MIGHT_HAVE_PCI + select HAVE_SMPAt least
HAVE_SMPis for sure, but I think both of these are selected already .
You're correct. ARCH_MULTIPLATFORM selects MIGHT_HAVE_PCI and ARCH_MULTI_V7 selects HAVE_SMP. I can look at dropping these.
Quoted 50 lines
Quoted 50 lines
arch/arm/mach-bcm/Kconfig +8
-0+ select HAVE_ARM_ARCH_TIMER + help + Say Y if you intend to run the kernel on a Broadcom ARM-based STB + chipset. + + This enables support for Broadcom ARM-based set-top box chipsets, + including the 7445 family of chips. +endif
arch/arm/mach-bcm/Makefile +5
-0@@ -30,3 +30,8 @@ obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o # BCM5301X obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o + +ifeq ($(CONFIG_ARCH_BRCMSTB),y) +obj-y += brcmstb.o +obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o +endifarch/arm/mach-bcm/brcmstb.c new file +22
-0@@ -0,0 +1,28 @@ +/* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/init.h> +#include <linux/of_platform.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +static const char *brcmstb_match[]__initconst = { +"brcm,bcm7445" , +"brcm,brcmstb" ,
Quoted 8 lines
arch/arm/mach-bcm/brcmstb.c line 28
Quoted 6 lines
arch/arm/mach-bcm/brcmstb.c new file +6
-0+ NULL +}; + +DT_MACHINE_START (BRCMSTB ,"Broadcom STB (Flattened Device Tree)" ) + .dt_compat = brcmstb_match, +MACHINE_END Do you plan to add more here? Otherwise you don't need this file.
Probably eventually, but not yet (there's out-of-tree stuff that hasn't been integrated); should we drop the file until it's needed?
(Over 9 revisions, this file has evolved. And the CPU_METHOD_OF_DECLARE stuff appearing in the meantime, which cut this file down to a no-op.)
Quoted 57 lines
Quoted 57 lines
arch/arm/mach-bcm/brcmstb.h new file +19
-0@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __BRCMSTB_H__ +#define __BRCMSTB_H__ + +void brcmstb_secondary_startup (void ); + +#endif /* __BRCMSTB_H__ */ arch/arm/mach-bcm/headsmp-brcmstb.S new file +26
-0@@ -0,0 +1,33 @@ +/* + * SMP boot code for secondary CPUs + * Based on arch/arm/mach-tegra/headsmp.S + * + * Copyright (C) 2010 NVIDIA, Inc. + * Copyright (C) 2013-2014 Broadcom Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <asm/assembler.h> +#include <linux/linkage.h> +#include <linux/init.h> + + .section ".text.head", "ax" + +ENTRY(brcmstb_secondary_startup) + /* + * Ensure CPU is in a sane state by disabling all IRQs and switching
Quoted 8 lines
arch/arm/mach-bcm/headsmp-brcmstb.S line 31
Quoted 5 lines
arch/arm/mach-bcm/headsmp-brcmstb.S new file +5
-0+ * into SVC mode. + */ + setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 + + bl v7_invalidate_l1This should be in your boot code. That is part of the documented entry requirements.
By "documented" are you referring to the ARM TRM? Wouldn't any "boot code" requirements only apply to CPU0? Linux prepares the non-boot CPUs for SMP, as you see here.
Quoted 2 lines
Also, if you are coming straight from reset, there is other setup probably missing.
Like what?
Quoted 78 lines
Yes, there are others with this, but that doesn't make it right.
Quoted 76 lines
arch/arm/mach-bcm/headsmp-brcmstb.S new file +2
-0+ b secondary_startup +ENDPROC(brcmstb_secondary_startup)arch/arm/mach-bcm/platsmp-brcmstb.c new file +68
-0@@ -0,0 +1,363 @@ +/* +* Broadcom STB CPU SMP and hotplug support for ARM +* +* Copyright (C) 2013-2014 Broadcom Corporation +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/printk.h> +#include <linux/regmap.h> +#include <linux/smp.h> +#include <linux/mfd/syscon.h> +#include <linux/spinlock.h> + +#include <asm/cacheflush.h> +#include <asm/cp15.h> +#include <asm/mach-types.h> +#include <asm/smp_plat.h> + +#include "brcmstb.h" + +enum { +ZONE_MAN_CLKEN_MASK =BIT (0 ), +ZONE_MAN_RESET_CNTL_MASK =BIT (1 ), +ZONE_MAN_MEM_PWR_MASK =BIT (4 ), +ZONE_RESERVED_1_MASK =BIT (5 ), +ZONE_MAN_ISO_CNTL_MASK =BIT (6 ), +ZONE_MANUAL_CONTROL_MASK =BIT (7 ), +ZONE_PWR_DN_REQ_MASK =BIT (9 ), +ZONE_PWR_UP_REQ_MASK =BIT (10 ), +ZONE_BLK_RST_ASSERT_MASK =BIT (12 ), +ZONE_PWR_OFF_STATE_MASK =BIT (25 ), +ZONE_PWR_ON_STATE_MASK =BIT (26 ), +ZONE_DPG_PWR_STATE_MASK =BIT (28 ), +ZONE_MEM_PWR_STATE_MASK =BIT (29 ), +ZONE_RESET_STATE_MASK =BIT (31 ), +CPU0_PWR_ZONE_CTRL_REG =1 , +CPU_RESET_CONFIG_REG =2 , +}; + +static void __iomem *cpubiuctrl_block; +static void __iomem *hif_cont_block; +static u32 cpu0_pwr_zone_ctrl_reg; +static u32 cpu_rst_cfg_reg; +static u32 hif_cont_reg; + +#ifdef CONFIG_HOTPLUG_CPU +static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state); + +static int per_cpu_sw_state_rd (u32 cpu) +{ +sync_cache_r (SHIFT_PERCPU_PTR (&per_cpu_sw_state,per_cpu_offset (cpu))); +return per_cpu (per_cpu_sw_state, cpu); +} +
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 74
Quoted 6 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +6
-0+static void per_cpu_sw_state_wr (u32 cpu,int val) +{ +per_cpu (per_cpu_sw_state, cpu) = val; +dmb (); +sync_cache_w (SHIFT_PERCPU_PTR (&per_cpu_sw_state,per_cpu_offset (cpu))); +dsb_sev ();Barriers need to be documented why they are needed.
(NB: I see approximately 3 total existing cases where there is a comment near a dsb()/dsb_sev().)
This was actually adapted from the mcpm code, and
(1) I think the dmb() is in the wrong place (it should be the first
thing in this function);
(2) the SEV is unnecessary (we don't use WFE; just a cache-invalidated polling loop); and
(3) the DSB is also unnecessary, since sync_cache_w() handles its own barriers.
Plus, we should probably add some comments to describe what's going on here. (Follow-up patch?)
Quoted 39 lines
Quoted 39 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +39
-0+} +#else +static inline void per_cpu_sw_state_wr (u32 cpu,int val) { } +#endif + +static void __iomem *pwr_ctrl_get_base (u32 cpu) +{ +void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg; + base += (cpu_logical_map (cpu) *4 ); +return base; +} + +static u32 pwr_ctrl_rd (u32 cpu) +{ +void __iomem *base =pwr_ctrl_get_base (cpu); +return readl_relaxed (base); +} + +static void pwr_ctrl_wr (u32 cpu,u32 val) +{ +void __iomem *base =pwr_ctrl_get_base (cpu); +writel (val, base); +} + +static void cpu_rst_cfg_set (u32 cpu,int set) +{ +u32 val; + val =readl_relaxed (cpubiuctrl_block + cpu_rst_cfg_reg); +if (set) + val |=BIT (cpu_logical_map (cpu)); +else + val &= ~BIT (cpu_logical_map (cpu)); +writel_relaxed (val, cpubiuctrl_block + cpu_rst_cfg_reg); +} + +static void cpu_set_boot_addr (u32 cpu,unsigned long boot_addr) +{ +const int reg_ofs =cpu_logical_map (cpu) *8 ; +writel_relaxed (0 , hif_cont_block + hif_cont_reg + reg_ofs);
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 119
Quoted 6 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +6
-0+writel_relaxed (boot_addr, hif_cont_block + hif_cont_reg +4 + reg_ofs); +} + +static void brcmstb_cpu_boot (u32 cpu) +{ +pr_info ("SMP: Booting CPU%d...\n" , cpu);The core already prints messages.
Ok, we can drop.
Quoted 23 lines
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+ +/* +* set the reset vector to point to the secondary_startup +* routine +*/ +cpu_set_boot_addr (cpu,virt_to_phys (brcmstb_secondary_startup)); + +/* unhalt the cpu */ +cpu_rst_cfg_set (cpu,0 ); +}arch/arm/mach-bcm/platsmp-brcmstb.c line 139
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+ +static void brcmstb_cpu_power_on (u32 cpu) +{ +/* +* The secondary cores power was cut, so we must go through +* power-on initialization. +*/ +u32 tmp; + +pr_info ("SMP: Powering up CPU%d...\n" , cpu);ditto.
Quoted 11 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 147
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +8
-0+ +/* Request zone power up */ +pwr_ctrl_wr (cpu,ZONE_PWR_UP_REQ_MASK ); + +/* Wait for the power up FSM to complete */ +do { + tmp =pwr_ctrl_rd (cpu); + }while (!(tmp &ZONE_PWR_ON_STATE_MASK ));Perhaps a timeout? Or perhaps you don't need to wait here. The core code will wait for the core to come online.
I believe we do have to wait for power before we can proceed to poke the core. This is a quirk of our chip, explained below. But sure, I could try to add a timeout.
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 149
Quoted 2 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +2
-0+ +per_cpu_sw_state_wr (cpu,1 );The kernel already tracks the state.
Yes, but it doesn't synchronize cpu_die() and cpu_kill(). But I see you objected below.
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +10
-0+} + +static int brcmstb_cpu_get_power_state (u32 cpu) +{ +int tmp =pwr_ctrl_rd (cpu); +return (tmp &ZONE_RESET_STATE_MASK ) ?0 :1 ; +} + +#ifdef CONFIG_HOTPLUG_CPU +
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 165
Quoted 6 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +6
-0+static void brcmstb_cpu_die (u32 cpu) +{ +v7_exit_coherency_flush (all); + +/* Prevent all interrupts from reaching this CPU. */ +arch_local_irq_disable ();Surely that is already done?
True. Third line in arch/arm/kernel/smp.c cpu_die(). I believe we can drop this.
Quoted 24 lines
And disabling IRQ has no effect on
wake-up from WFI.Quoted 21 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +21
-0+ +/* +* Final full barrier to ensure everything before this instruction has +* quiesced. +*/ +isb (); +dsb (); + +per_cpu_sw_state_wr (cpu,0 ); + +/* Sit and wait to die */ +wfi (); + +/* We should never get here... */ +panic ("Spurious interrupt on CPU %d received!\n" , cpu); +} + +static int brcmstb_cpu_kill (u32 cpu) +{ +u32 tmp; +
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 190
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+pr_info ("SMP: Powering down CPU%d...\n" , cpu); + +while (per_cpu_sw_state_rd (cpu)) + ;I don't think this is necessary. You don't need to synchronize die and kill. Look at other implementations that actually power down the core (vs. just wfi).
Hmm, I'm pretty sure the synchronization is required for our B15 core. If we yank the power before the core has properly quiesced, the whole CPU complex will lock up. (Similar story for the power-up while loop you complained about above.)
Quoted 132 lines
Quoted 132 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +132
-0+ +/* Program zone reset */ +pwr_ctrl_wr (cpu,ZONE_RESET_STATE_MASK |ZONE_BLK_RST_ASSERT_MASK | +ZONE_PWR_DN_REQ_MASK ); + +/* Verify zone reset */ + tmp =pwr_ctrl_rd (cpu); +if (!(tmp &ZONE_RESET_STATE_MASK )) +pr_err ("%s: Zone reset bit for CPU %d not asserted!\n" , + __func__, cpu); + +/* Wait for power down */ +do { + tmp =pwr_ctrl_rd (cpu); + }while (!(tmp &ZONE_PWR_OFF_STATE_MASK )); + +/* Settle-time from Broadcom-internal DVT reference code */ +udelay (7 ); + +/* Assert reset on the CPU */ +cpu_rst_cfg_set (cpu,1 ); + +return 1 ; +} + +#endif /* CONFIG_HOTPLUG_CPU */ + +static int __init setup_hifcpubiuctrl_regs (struct device_node *np) +{ +int rc =0 ; +char *name; +struct device_node *syscon_np =NULL ; + + name ="syscon-cpu" ; + + syscon_np =of_parse_phandle (np, name,0 ); +if (!syscon_np) { +pr_err ("can't find phandle %s\n" , name); + rc = -EINVAL ; + goto cleanup; + } + + cpubiuctrl_block =of_iomap (syscon_np,0 ); +if (!cpubiuctrl_block) { +pr_err ("iomap failed for cpubiuctrl_block\n" ); + rc = -EINVAL ; + goto cleanup; + } + + rc =of_property_read_u32_index (np, name,CPU0_PWR_ZONE_CTRL_REG , + &cpu0_pwr_zone_ctrl_reg); +if (rc) { +pr_err ("failed to read 1st entry from %s property (%d)\n" , name, + rc); + rc = -EINVAL ; + goto cleanup; + } + + rc =of_property_read_u32_index (np, name,CPU_RESET_CONFIG_REG , + &cpu_rst_cfg_reg); +if (rc) { +pr_err ("failed to read 2nd entry from %s property (%d)\n" , name, + rc); + rc = -EINVAL ; + goto cleanup; + } + +cleanup: +if (syscon_np) +of_node_put (syscon_np); + +return rc; +} + +static int __init setup_hifcont_regs (struct device_node *np) +{ +int rc =0 ; +char *name; +struct device_node *syscon_np =NULL ; + + name ="syscon-cont" ; + + syscon_np =of_parse_phandle (np, name,0 ); +if (!syscon_np) { +pr_err ("can't find phandle %s\n" , name); + rc = -EINVAL ; + goto cleanup; + } + + hif_cont_block =of_iomap (syscon_np,0 ); +if (!hif_cont_block) { +pr_err ("iomap failed for hif_cont_block\n" ); + rc = -EINVAL ; + goto cleanup; + } + +/* offset is at top of hif_cont_block */ + hif_cont_reg =0 ; + +cleanup: +if (syscon_np) +of_node_put (syscon_np); + +return rc; +} + +static void __init brcmstb_cpu_ctrl_setup (unsigned int max_cpus) +{ +int rc; +struct device_node *np; +char *name; + + name ="brcm,brcmstb-smpboot" ; + np =of_find_compatible_node (NULL ,NULL , name); +if (!np) { +pr_err ("can't find compatible node %s\n" , name); +return ; + } + + rc =setup_hifcpubiuctrl_regs (np); +if (rc) +return ; + + rc =setup_hifcont_regs (np); +if (rc) +return ; +} + +static DEFINE_SPINLOCK (boot_lock); + +static void brcmstb_secondary_init (unsigned int cpu) +{
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 327
Quoted 5 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +5
-0+/* +* Synchronise with the boot thread. +*/ +spin_lock (&boot_lock); +spin_unlock (&boot_lock);I suggest you read previous discussions on attempts to make this common before replying to Russell.
Can you point me to this discussion? linux-arm-kernel is a big and noisy world...
BTW, I'm not sure the boot_lock is actually necessary at all for us; it was just borrowed from one of the other mach-*'s. The synchronization we need is done in the while loops above.
Quoted 28 lines
Quoted 28 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +28
-0+} + +static int brcmstb_boot_secondary (unsigned int cpu,struct task_struct *idle) +{ +/* +* set synchronisation state between this boot processor +* and the secondary one +*/ +spin_lock (&boot_lock); + +/* Bring up power to the core if necessary */ +if (brcmstb_cpu_get_power_state (cpu) ==0 ) +brcmstb_cpu_power_on (cpu); + +brcmstb_cpu_boot (cpu); + +/* +* now the secondary core is starting up let it run its +* calibrations, then wait for it to finish +*/ +spin_unlock (&boot_lock); + +return 0 ; +} + +static struct smp_operations brcmstb_smp_ops__initdata = { + .smp_prepare_cpus = brcmstb_cpu_ctrl_setup, + .smp_secondary_init = brcmstb_secondary_init,
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 363
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +8
-0+ .smp_boot_secondary = brcmstb_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_kill = brcmstb_cpu_kill, + .cpu_die = brcmstb_cpu_die, +#endif +}; + +CPU_METHOD_OF_DECLARE (brcmstb_smp,"brcm,brahma-b15" , &brcmstb_smp_ops);
Brian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Russell King - ARM LinuxHi Russell,
Quoted 26 lines · Russell King
Quoted 25 lines · Brian Norris
(quoted diff) +25
-0+static DEFINE_SPINLOCK(boot_lock); + +static void brcmstb_secondary_init(unsigned int cpu) +{ + /* + * Synchronise with the boot thread. + */ + spin_lock(&boot_lock); + spin_unlock(&boot_lock); +} + +static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + /* + * set synchronisation state between this boot processor + * and the secondary one + */ + spin_lock(&boot_lock); + + /* Bring up power to the core if necessary */ + if (brcmstb_cpu_get_power_state(cpu) == 0) + brcmstb_cpu_power_on(cpu); + + brcmstb_cpu_boot(cpu); +
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ /* + * now the secondary core is starting up let it run its + * calibrations, then wait for it to finish + */ + spin_unlock(&boot_lock);I've just read through this code (because it caused my allmodconfig to break) and spotted this.
Sorry about the allmodconfig problems. I never compile-tested with ARMv6 enabled. This look OK?
arch/arm/mach-bcm/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o ifeq ($(CONFIG_ARCH_BRCMSTB),y) +CFLAGS_platsmp-brcmstb.o += -march=armv7-a obj-y += brcmstb.o obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o endif
Quoted 3 lines
What function does
boot_lockperform here? Please, don't quote the comments (I know where the comments came from) but what I want to hear is your comments about why you decided to retain this.
You might glean a little more from my response to Rob, but I'm not sure there was a good reason for retaining this. We do need to be sure the CPU is fully powered online before bringing it out of reset, but the spinlock seems overkill AFAICT.
Brian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Brian NorrisQuoted 14 lines · Brian Norris
Hi Rob,
I appreciate your comments, but where were many of these 5 months ago on the first 7 revisions? :)
On a practical note: v9 is already queued for 3.17. Should I send patches for the 3.17 cycle (or later) to fixup some of these issues? Or would you recommend pulling the patches out of Matt Porter's tree now, and reintroducing for 3.18? (I would be much happier with the first.)
I do note that we at least need to fix allmodconfig ASAP; I'll reply to Russell on that one.
On Wed, Jul 30, 2014 at 12:09:48PM -0500, Rob Herring wrote:
Quoted 8 lines
Quoted 5 lines · Brian Norris
Review
Quoted 2 lines
(quoted diff) +2
-0+ + per_cpu_sw_state_wr(cpu, 1);The kernel already tracks the state.
Yes, but it doesn't synchronize
cpu_die()andcpu_kill(). But I see you objected below.
Err.
static DECLARE_COMPLETION(cpu_died);
/*
* called on the thread which is asking for a CPU to be shutdown -
* waits until shutdown has completed, or it is timed out. */
void __cpu_die(unsigned int cpu)
{
if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
pr_err("CPU%u: cpu didn't die\n", cpu);
return;
}
printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
...
if (!platform_cpu_kill(cpu))
printk("CPU%u: unable to kill\n", cpu);
}void __ref cpu_die(void)
{
...
/*
* Tell __cpu_die() that this CPU is now safe to dispose of. Once
* this returns, power and/or clocks can be removed at any point
* from this CPU and its cache by platform_cpu_kill(). */
complete(&cpu_died);
There _is_ synchronisation between these two. Your cpu_kill() function will not be called until we have flushed all data from the dying CPU's cache. That's the best we can do, because if we cause the dying CPU to exit the coherency domain, any kind of locking or completion will no longer work (neither will your state tracking solution because the L1 caches will no longer snoop.)
Quoted 4 lines
Hmm, I'm pretty sure the synchronization is required for our B15 core. If we yank the power before the core has properly quiesced, the whole CPU complex will lock up. (Similar story for the power-up while loop you complained about above.)
If you need to ensure that the power isn't turned off too soon, how about using a delayed work queue to do the power-off of the CPU (remembering to cancel the delayed work queue when powering the CPU back up.)
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
Hi Russell,
Quoted 17 lines · Russell King
Quoted 16 lines · Brian Norris
I appreciate your comments, but where were many of these 5 months ago on the first 7 revisions? :)
On a practical note: v9 is already queued for 3.17. Should I send patches for the 3.17 cycle (or later) to fixup some of these issues? Or would you recommend pulling the patches out of Matt Porter's tree now, and reintroducing for 3.18? (I would be much happier with the first.)
I do note that we at least need to fix allmodconfig ASAP; I'll reply to Russell on that one.
Quoted 4 lines · Rob Herring
Quoted 2 lines · Brian Norris
(quoted diff) +2
-0+ + per_cpu_sw_state_wr(cpu, 1);
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
The kernel already tracks the state.
Yes, but it doesn't synchronize
cpu_die()andcpu_kill(). But I see you objected below.Err.
static
DECLARE_COMPLETION(cpu_died);
Yes, I noticed this. What I meant is that smp_ops.cpu_die() and smp_ops.cpu_kill() are not synchronized.
Quoted 26 lines
/*
* called on the thread which is asking for a CPU to be shutdown -
* waits until shutdown has completed, or it is timed out. */
void__cpu_die(unsigned int cpu){ if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) { pr_err("CPU%u: cpu didn't die\n", cpu); return; } printk(KERN_NOTICE "CPU%u: shutdown\n", cpu); ... if (!platform_cpu_kill(cpu)) printk("CPU%u: unable to kill\n", cpu); }void
__refcpu_die(void)
{
...
/*
* Tell__cpu_die()that this CPU is now safe to dispose of. Once
* this returns, power and/or clocks can be removed at any point
* from this CPU and its cache byplatform_cpu_kill(). */
complete(&cpu_died);
Quoted 6 lines
There _is_ synchronisation between these two. Your
cpu_kill()function will not be called until we have flushed all data from the dying CPU's cache. That's the best we can do, because if we cause the dying CPU to exit the coherency domain, any kind of locking or completion will no longer work (neither will your state tracking solution because the L1 caches will no longer snoop.)
We're not relying on the L1 cache, though. Don't sync_cache_{r,w}() ensure all reads/writes reach at least the L2?
Besides, we modeled this after the MCPM code (e.g., __mcpm_cpu_down()). Are both implementations incorrect?
Quoted 8 lines
Quoted 4 lines
Hmm, I'm pretty sure the synchronization is required for our B15 core. If we yank the power before the core has properly quiesced, the whole CPU complex will lock up. (Similar story for the power-up while loop you complained about above.)
If you need to ensure that the power isn't turned off too soon, how about using a delayed work queue to do the power-off of the CPU (remembering to cancel the delayed work queue when powering the CPU back up.)
How does that ensure that the CPU is down by the time the work is scheduled? It seems like this would just defer the work long enough that it *most likely* has quiesced, but I don't see how this gives us a better guarantee. Or maybe I'm missing something. (If so, please do enlighten!)
Brian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Brian NorrisQuoted 4 lines · Brian Norris
Hi Rob,
I appreciate your comments, but where were many of these 5 months ago on the first 7 revisions? :)
Sorry, but that is the nature of upstreaming. But given some of the issues, it is obvious the reviews were not sufficient.
Quoted 4 lines
On a practical note: v9 is already queued for 3.17. Should I send patches for the 3.17 cycle (or later) to fixup some of these issues? Or would you recommend pulling the patches out of Matt Porter's tree now, and reintroducing for 3.18? (I would be much happier with the first.)
Things can always be un-queued. I guess that's Matt's and arm-soc's decision.
Quoted 12 lines
Quoted 11 lines
arch/arm/mach-bcm/brcmstb.c line 28
Quoted 9 lines
arch/arm/mach-bcm/brcmstb.c new file +9
-0+static const char *brcmstb_match[]__initconst = { +"brcm,bcm7445" , +"brcm,brcmstb" , +NULL +}; + +DT_MACHINE_START (BRCMSTB ,"Broadcom STB (Flattened Device Tree)" ) + .dt_compat = brcmstb_match, +MACHINE_END Do you plan to add more here? Otherwise you don't need this file.
Quoted 2 lines
Probably eventually, but not yet (there's out-of-tree stuff that hasn't been integrated); should we drop the file until it's needed?
I would say yes if you re-spin the patches.
Quoted 12 lines
Quoted 11 lines
arch/arm/mach-bcm/headsmp-brcmstb.S line 31
Quoted 8 lines
arch/arm/mach-bcm/headsmp-brcmstb.S new file +8
-0+ENTRY(brcmstb_secondary_startup) + /* + * Ensure CPU is in a sane state by disabling all IRQs and switching + * into SVC mode. + */ + setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 + + bl v7_invalidate_l1This should be in your boot code. That is part of the documented entry requirements.
Quoted 8 lines
By "documented" are you referring to the ARM TRM? Wouldn't any "boot code" requirements only apply to CPU0? Linux prepares the non-boot CPUs for SMP, as you see here.
Quoted 2 lines
Also, if you are coming straight from reset, there is other setup probably missing.
Like what?
Errata work-arounds, performance bits, etc. I don't recall exactly which ones are per core vs. global. I assume this is an A9, but cores with virt extensions would also need to drop to non-secure mode.
Also, your entry (and many of the custom entry points) would not work for big endian kernels. You may not care, but there's really no reason why it should not work.
Quoted 11 lines
Quoted 6 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 74
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+per_cpu (per_cpu_sw_state, cpu) = val; +dmb (); +sync_cache_w (SHIFT_PERCPU_PTR (&per_cpu_sw_state,per_cpu_offset (cpu))); +dsb_sev ();Barriers need to be documented why they are needed.
(NB: I see approximately 3 total existing cases where there is a comment near a dsb()/dsb_sev().)
This was actually adapted from the mcpm code, and
Why? Blindly copying other implementations seems to be a common issue here...
Quoted 9 lines
(1) I think the
dmb()is in the wrong place (it should be the firstthing in this function);(2) the SEV is unnecessary (we don't use WFE; just a cache-invalidated polling loop); and
(3) the DSB is also unnecessary, sincesync_cache_w()handles its own barriers.Plus, we should probably add some comments to describe what's going on here. (Follow-up patch?)
I'm not sure you need the state variable at all. You appear to be able to fully control power on and off of the cores, so you should not need any spin loops or synchronization.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+static int brcmstb_cpu_kill (u32 cpu) +{ +u32 tmp; +Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 190
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+pr_info ("SMP: Powering down CPU%d...\n" , cpu); + +while (per_cpu_sw_state_rd (cpu)) + ;I don't think this is necessary. You don't need to synchronize die and kill. Look at other implementations that actually power down the core (vs. just wfi).
Quoted 4 lines
Hmm, I'm pretty sure the synchronization is required for our B15 core. If we yank the power before the core has properly quiesced, the whole CPU complex will lock up. (Similar story for the power-up while loop you complained about above.)
That is true for every SMP system which is why it is done in the core code as Russell pointed out.
Quoted 11 lines
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 327
Quoted 7 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +7
-0+static void brcmstb_secondary_init (unsigned int cpu) +{ +/* +* Synchronise with the boot thread. +*/ +spin_lock (&boot_lock); +spin_unlock (&boot_lock);I suggest you read previous discussions on attempts to make this common before replying to Russell.
Quoted 2 lines
Can you point me to this discussion? linux-arm-kernel is a big and noisy world...
Here's a recent example:
http://www.spinics.net/lists/arm-kernel/msg318585.html
Quoted 3 lines
BTW, I'm not sure the
boot_lockis actually necessary at all for us; it was just borrowed from one of the other mach-*'s. The synchronization we need is done in the while loops above.
The blindly copying code without knowing what it does problem...
Rob
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
Hello,
2014-08-01 7:33 GMT-07:00 Rob Herring <[email protected]>:
Quoted 10 lines
Quoted 4 lines · Brian Norris
Hi Rob,
I appreciate your comments, but where were many of these 5 months ago on the first 7 revisions? :)
Sorry, but that is the nature of upstreaming. But given some of the issues, it is obvious the reviews were not sufficient.
Quoted 6 lines
Quoted 4 lines
On a practical note: v9 is already queued for 3.17. Should I send patches for the 3.17 cycle (or later) to fixup some of these issues? Or would you recommend pulling the patches out of Matt Porter's tree now, and reintroducing for 3.18? (I would be much happier with the first.)
Things can always be un-queued. I guess that's Matt's and arm-soc's decision.
Does that mean we should get all those patches un-queued, because that specific patch adding SMP support that needs to be reworked, or does that mean that if we drop this specific patch we are good with the remainder of the patch series?
Quoted 34 lines
Quoted 13 lines
Quoted 12 lines
arch/arm/mach-bcm/brcmstb.c line 28
Quoted 10 lines
arch/arm/mach-bcm/brcmstb.c new file +9
-0+static const char *brcmstb_match[]__initconst = { +"brcm,bcm7445" , +"brcm,brcmstb" , +NULL +}; + +DT_MACHINE_START (BRCMSTB ,"Broadcom STB (Flattened Device Tree)" ) + .dt_compat = brcmstb_match, +MACHINE_END Do you plan to add more here? Otherwise you don't need this file.
Quoted 2 lines
Probably eventually, but not yet (there's out-of-tree stuff that hasn't been integrated); should we drop the file until it's needed?
I would say yes if you re-spin the patches.
Quoted 16 lines
Quoted 11 lines
arch/arm/mach-bcm/headsmp-brcmstb.S line 31
Quoted 8 lines
arch/arm/mach-bcm/headsmp-brcmstb.S new file +8
-0+ENTRY(brcmstb_secondary_startup) + /* + * Ensure CPU is in a sane state by disabling all IRQs and switching + * into SVC mode. + */ + setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 + + bl v7_invalidate_l1This should be in your boot code. That is part of the documented entry requirements.
By "documented" are you referring to the ARM TRM? Wouldn't any "boot code" requirements only apply to CPU0? Linux prepares the non-boot CPUs for SMP, as you see here.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Also, if you are coming straight from reset, there is other setup probably missing.
Like what?
Errata work-arounds, performance bits, etc. I don't recall exactly which ones are per core vs. global. I assume this is an A9, but cores with virt extensions would also need to drop to non-secure mode.
This is a Brahma B15 CPU, maybe we should have mentioned that again in this specific patch. The only ARM erratum we are affected (as of today) is 798181, and it requires a one-time initialization.
Quoted 4 lines
Also, your entry (and many of the custom entry points) would not work for big endian kernels. You may not care, but there's really no reason why it should not work.
I don't think we want to support big-endian kernels at all, although I can't see a good way to enforce that restriction.
Quoted 73 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+per_cpu (per_cpu_sw_state, cpu) = val; +dmb (); +sync_cache_w (SHIFT_PERCPU_PTR (&per_cpu_sw_state,per_cpu_offset (cpu))); +dsb_sev ();Quoted 6 lines
Quoted 1 line
Barriers need to be documented why they are needed.
(NB: I see approximately 3 total existing cases where there is a comment near a dsb()/dsb_sev().)
This was actually adapted from the mcpm code, and
Why? Blindly copying other implementations seems to be a common issue here...
Quoted 9 lines
(1) I think the
dmb()is in the wrong place (it should be the firstthing in this function);(2) the SEV is unnecessary (we don't use WFE; just a cache-invalidated polling loop); and
(3) the DSB is also unnecessary, sincesync_cache_w()handles its own barriers.Plus, we should probably add some comments to describe what's going on here. (Follow-up patch?)
I'm not sure you need the state variable at all. You appear to be able to fully control power on and off of the cores, so you should not need any spin loops or synchronization.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+static int brcmstb_cpu_kill (u32 cpu) +{ +u32 tmp; +Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 190
Quoted 4 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +4
-0+pr_info ("SMP: Powering down CPU%d...\n" , cpu); + +while (per_cpu_sw_state_rd (cpu)) + ;I don't think this is necessary. You don't need to synchronize die and kill. Look at other implementations that actually power down the core (vs. just wfi).
Quoted 4 lines
Hmm, I'm pretty sure the synchronization is required for our B15 core. If we yank the power before the core has properly quiesced, the whole CPU complex will lock up. (Similar story for the power-up while loop you complained about above.)
That is true for every SMP system which is why it is done in the core code as Russell pointed out.
Quoted 11 lines
Quoted 10 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 327
Quoted 7 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +7
-0+static void brcmstb_secondary_init (unsigned int cpu) +{ +/* +* Synchronise with the boot thread. +*/ +spin_lock (&boot_lock); +spin_unlock (&boot_lock);I suggest you read previous discussions on attempts to make this common before replying to Russell.
Quoted 2 lines
Can you point me to this discussion? linux-arm-kernel is a big and noisy world...
Here's a recent example:
http://www.spinics.net/lists/arm-kernel/msg318585.html
Quoted 3 lines
BTW, I'm not sure the
boot_lockis actually necessary at all for us; it was just borrowed from one of the other mach-*'s. The synchronization we need is done in the while loops above.The blindly copying code without knowing what it does problem...
Signature · 1 line
Florian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
Quoted 18 lines · Florian Fainelli
Hello,
2014-08-01 7:33 GMT-07:00 Rob Herring <[email protected]>:
Quoted 15 lines
Quoted 4 lines · Brian Norris
Hi Rob,
I appreciate your comments, but where were many of these 5 months ago on the first 7 revisions? :)
Sorry, but that is the nature of upstreaming. But given some of the issues, it is obvious the reviews were not sufficient.
Quoted 4 lines
On a practical note: v9 is already queued for 3.17. Should I send patches for the 3.17 cycle (or later) to fixup some of these issues? Or would you recommend pulling the patches out of Matt Porter's tree now, and reintroducing for 3.18? (I would be much happier with the first.)
Quoted 6 lines
Quoted 1 line
Things can always be un-queued. I guess that's Matt's and arm-soc's decision.
Does that mean we should get all those patches un-queued, because that specific patch adding SMP support that needs to be reworked, or does that mean that if we drop this specific patch we are good with the remainder of the patch series?
Well, keep in mind that there's no specific patch adding SMP support. The patch here contains *all* of the actual code that goes through mach-bcm. The rest will go through Russell.
Given what was missed, if we drop just this patch, we're left with just the DT, Kconfig, and MAINTAINERS changes. It doesn't seem like there's time to fix the problems now. It might be better to drop the whole series from arm-soc since it won't be functional in 3.17 if we drop just this patch. I'd like to see what Arnd and Olof think. I think there's value in leaving all the DT bits for 3.17.
-Matt
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Brian NorrisHere's some more comments on this.
arch/arm/mach-bcm/platsmp-brcmstb.c line 162
Quoted 3 lines · Brian Norris
arch/arm/mach-bcm/platsmp-brcmstb.c new file +3
-0+static void brcmstb_cpu_die (u32 cpu) +{ +v7_exit_coherency_flush (all);
This is ultimately what causes my builds to break:
/tmp/ccSPowmq.s:171: Error: selected processor does not support ARM mode isb ' /tmp/ccSPowmq.s:177: Error: selected processor does not support ARM mode isb ' /tmp/ccSPowmq.s:178: Error: selected processor does not support ARM mode `dsb ' make[2]: *** [arch/arm/mach-bcm/platsmp-brcmstb.o] Error 1
It seems that v7_exit_coherency_flush() can only be used with code which is ARMv7 only.
arch/arm/mach-bcm/platsmp-brcmstb.c line 165
Quoted 2 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +2
-0+/* Prevent all interrupts from reaching this CPU. */ +arch_local_irq_disable ();
Why do you think it is necessary to disable interrupts here? Where have they been re-enabled since this bit of generic code:
void __ref cpu_die(void)
{
unsigned int cpu = smp_processor_id();
idle_task_exit();
local_irq_disable();and why arch_local_irq_disable() at that? Even if interrupts were enabled prior to your call to arch_local_irq_disable(), what do you think would be the effect of receiving an interrupt after you've exited coherency?
arch/arm/mach-bcm/platsmp-brcmstb.c line 172
Quoted 7 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +7
-0+ +/* +* Final full barrier to ensure everything before this instruction has +* quiesced. +*/ +isb (); +dsb ();
If the call to arch_local_irq_disable() is removed, and v7_exit_coherency_flush() is fixed, then this is not required, because v7_exit_coherency_flush() already does this at the very end.
arch/arm/mach-bcm/platsmp-brcmstb.c line 180
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +8
-0+ +per_cpu_sw_state_wr (cpu,0 ); + +/* Sit and wait to die */ +wfi (); + +/* We should never get here... */ +panic ("Spurious interrupt on CPU %d received!\n" , cpu);
You really should /not/ be calling panic here, because that uses data shared with the CPUs which are still coherent. This is akin to doing DMA into bits of the kernel space without dealing with the cache coherency issues. Moreover, if you read the comments on v7_exit_coherency_flush() about ldrex/strex, which are two instructions spinlocks use, you'll see that ldrex/strex must not be executed, which means you can't call any function which uses spinlocks. That rules out printk() et.al. printascii is fine, but that's only available when the low level debug stuff is enabled.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Rob HerringQuoted 7 lines · Rob Herring
Quoted 1 line · Brian Norris
Like what?
Errata work-arounds, performance bits, etc. I don't recall exactly which ones are per core vs. global. I assume this is an A9, but cores with virt extensions would also need to drop to non-secure mode.
The kernel's bringup just before enabling the CPU deals with that stuff provided your CPU is running in secure mode, but you are right - we /do/ want to encourage platforms to do the errata fixups before they call the kernel via any entry point.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH v8 03/11] ARM: brcmstb: add debug UART for earlyprintk support
In reply to Brian NorrisQuoted 7 lines · Brian Norris
From: Marc Carino <[email protected]>
Add the UART definitions needed to support earlyprintk on brcmstb machines.
Signed-off-by Marc Carino <[email protected]>Acked-by Florian Fainelli <[email protected]>Signed-off-by Brian Norris <[email protected]>
I noticed that you sent this to the patch system. I asked Olof last night whether he had anything in arm-soc touching Kconfig.debug, and he does (a number of other platforms have updated it.) This means that if I apply it to my tree, it may conflict, so I'm reluctant to take it.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Brian NorrisQuoted 4 lines · Brian Norris
Hi Russell,
Yes, I noticed this. What I meant is that
smp_ops.cpu_die()andsmp_ops.cpu_kill()are not synchronized.
...
Quoted 2 lines
We're not relying on the L1 cache, though. Don't sync_cache_{r,w}() ensure all reads/writes reach at least the L2?
What exactly are you trying to achieve here?
Quoted 5 lines
How does that ensure that the CPU is down by the time the work is scheduled? It seems like this would just defer the work long enough that it *most likely* has quiesced, but I don't see how this gives us a better guarantee. Or maybe I'm missing something. (If so, please do enlighten!)
Note that I said a delayed work queue. The dying CPU runs a predictable sequence once cpu_die() has been entered - interrupts at the GIC have been programmed to be routed to other CPUs, interrupts at the CPU are masked, so the CPU isn't going to be doing anything else except executing that code path. So, it's going to be a predictable number of CPU cycles.
That allows you to arrange a delayed workqueue (or a timer) to fire after a period of time that you can guarantee that the dying CPU has reached that wfi().
Another point which raises itself in your patch is this:
+ /* Settle-time from Broadcom-internal DVT reference code */
+ udelay(7);
7us looks very precise, but udelay() may not be that precise. What is the actual specification? Does it say "you must wait at least 7us"?
udelay() _may_ return early, especially if it is using the CPU delay loop to perform the delay - I've explained why this happens previously, and why it isn't a bug.
If you're using a timer-based delay for udelay() (which you should be using if you support cpufreq) then the delay should be more accurate, but it's still good practise to give a little leeway on the figure.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH v8 03/11] ARM: brcmstb: add debug UART for earlyprintk support
In reply to Russell King - ARM LinuxQuoted 9 lines · Russell King
Quoted 7 lines · Brian Norris
From: Marc Carino <[email protected]>
Add the UART definitions needed to support earlyprintk on brcmstb machines.
Signed-off-by Marc Carino <[email protected]>Acked-by Florian Fainelli <[email protected]>Signed-off-by Brian Norris <[email protected]>
Quoted 5 lines
I noticed that you sent this to the patch system. I asked Olof last night whether he had anything in arm-soc touching
Kconfig.debug, and he does (a number of other platforms have updated it.) This means that if I apply it to my tree, it may conflict, so I'm reluctant to take it.
OK... Matt told me that such patches go through you. So which is it? Should all Kconfig.debug patches go through the arm-soc route?
Brian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Russell King - ARM LinuxQuoted 9 lines · Russell King
Here's some more comments on this.
arch/arm/mach-bcm/platsmp-brcmstb.c line 162
Quoted 3 lines · Brian Norris
arch/arm/mach-bcm/platsmp-brcmstb.c new file +3
-0+static void brcmstb_cpu_die (u32 cpu) +{ +v7_exit_coherency_flush (all);This is ultimately what causes my builds to break:
Quoted 7 lines
/tmp/ccSPowmq.s:171: Error: selected processor does not support ARM modeisb ' /tmp/ccSPowmq.s:177: Error: selected processor does not support ARM modeisb '/tmp/ccSPowmq.s:178: Error: selected processor does not support ARM mode `dsb ' make[2]: *** [arch/arm/mach-bcm/platsmp-brcmstb.o] Error 1It seems that
v7_exit_coherency_flush()can only be used with code which is ARMv7 only.
Yes, I noticed this already, and I proposed a solution:
http://article.gmane.org/gmane.linux.drivers.devicetree/84517
Quoted 14 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 165
Quoted 2 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +2
-0+/* Prevent all interrupts from reaching this CPU. */ +arch_local_irq_disable ();Why do you think it is necessary to disable interrupts here? Where have they been re-enabled since this bit of generic code:
void
__refcpu_die(void){ unsigned int cpu = smp_processor_id(); idle_task_exit(); local_irq_disable();
Quoted 4 lines
and why
arch_local_irq_disable()at that? Even if interrupts were enabled prior to your call toarch_local_irq_disable(), what do you think would be the effect of receiving an interrupt after you've exited coherency?
This mistake was already noted. No need for the extra IRQ disable.
(http://article.gmane.org/gmane.linux.drivers.devicetree/84516)
Quoted 11 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 172
Quoted 7 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +7
-0+ +/* +* Final full barrier to ensure everything before this instruction has +* quiesced. +*/ +isb (); +dsb ();If the call to
arch_local_irq_disable()is removed, andv7_exit_coherency_flush()is fixed, then this is not required, becausev7_exit_coherency_flush()already does this at the very end.
Right. Will drop.
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +5
-0+ +per_cpu_sw_state_wr (cpu,0 ); + +/* Sit and wait to die */ +wfi ();
Quoted 8 lines
arch/arm/mach-bcm/platsmp-brcmstb.c line 180
Quoted 3 lines
arch/arm/mach-bcm/platsmp-brcmstb.c new file +3
-0+ +/* We should never get here... */ +panic ("Spurious interrupt on CPU %d received!\n" , cpu);You really should /not/ be calling panic here, because that uses data shared with the CPUs which are still coherent. This is akin to doing DMA into bits of the kernel space without dealing with the cache coherency issues.
OK.
Quoted 6 lines
Moreover, if you read the comments on
v7_exit_coherency_flush()about ldrex/strex, which are two instructions spinlocks use, you'll see that ldrex/strex must not be executed, which means you can't call any function which uses spinlocks. That rules outprintk()et.al. printascii is fine, but that's only available when the low level debug stuff is enabled.
OK, so I'll drop the panic(). printascii doesn't look extremely useful, but I suppose we could use it for debugging. Seems like a while (1) loop might be a suitable replacement. If we get this far, we'll likely get locked up trying to power this CPU off anyway, so it'll be apparent that there was power-down failure.
Thanks,
Brian
Re: [PATCH v8 03/11] ARM: brcmstb: add debug UART for earlyprintk support
In reply to Brian NorrisPing (Olof or Matt?)
Quoted 10 lines · Brian Norris
Quoted 9 lines · Russell King
Quoted 7 lines · Brian Norris
From: Marc Carino <[email protected]>
Add the UART definitions needed to support earlyprintk on brcmstb machines.
Signed-off-by Marc Carino <[email protected]>Acked-by Florian Fainelli <[email protected]>Signed-off-by Brian Norris <[email protected]>
Quoted 8 lines
Quoted 5 lines
I noticed that you sent this to the patch system. I asked Olof last night whether he had anything in arm-soc touching
Kconfig.debug, and he does (a number of other platforms have updated it.) This means that if I apply it to my tree, it may conflict, so I'm reluctant to take it.OK... Matt told me that such patches go through you. So which is it? Should all
Kconfig.debugpatches go through the arm-soc route?
How should this get in? Should I rebase/resend through Matt and arm-soc? Or can you pick this up as-is?
Brian
Re: [PATCH v8 03/11] ARM: brcmstb: add debug UART for earlyprintk support
Quoted 20 lines · Brian Norris
Ping (Olof or Matt?)
Quoted 16 lines · Brian Norris
Quoted 14 lines · Russell King
Quoted 7 lines · Brian Norris
From: Marc Carino <[email protected]>
Add the UART definitions needed to support earlyprintk on brcmstb machines.
Signed-off-by Marc Carino <[email protected]>Acked-by Florian Fainelli <[email protected]>Signed-off-by Brian Norris <[email protected]>I noticed that you sent this to the patch system. I asked Olof last night whether he had anything in arm-soc touching
Kconfig.debug, and he does (a number of other platforms have updated it.) This means that if I apply it to my tree, it may conflict, so I'm reluctant to take it.
Quoted 5 lines
Quoted 2 lines
OK... Matt told me that such patches go through you. So which is it? Should all
Kconfig.debugpatches go through the arm-soc route?How should this get in? Should I rebase/resend through Matt and arm-soc? Or can you pick this up as-is?
Kconfig.debug is something that we usually merge new platforms for through arm-soc. The main exception has been release cycles when Russell has been doing major surgery on the file (one of those was a few releases ago), where we've backed off to avoid conflicts.
That's been the assumed arrangement from our side at least, we haven't had anything more formal than that.
So, go ahead and send it through us -- if we end up having a cycle where we can't apply it we can send it over to Russell for you.
-Olof
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
In reply to Russell King - ARM LinuxHi Russell,
Picking up this thread again, as things are now set for dropping this patch and resubmitting SMP support for 3.18.
Quoted 8 lines · Russell King
Quoted 2 lines · Brian Norris
Yes, I noticed this. What I meant is that
smp_ops.cpu_die()andsmp_ops.cpu_kill()are not synchronized....
Quoted 2 lines
We're not relying on the L1 cache, though. Don't sync_cache_{r,w}() ensure all reads/writes reach at least the L2?
What exactly are you trying to achieve here?
Synchronization between v7_exit_coherency_flush() (on the dying CPU) and yanking the power (brcmstb_cpu_kill(), on the murderous CPU). The core completion-based synchronization is not sufficient, since it allows brcmstb_smp_ops.smp_kill and brcmstb_smp_ops.smp_die to race.
Am I somehow not achieving what I intend here?
Quoted 12 lines
Quoted 5 lines
How does that ensure that the CPU is down by the time the work is scheduled? It seems like this would just defer the work long enough that it *most likely* has quiesced, but I don't see how this gives us a better guarantee. Or maybe I'm missing something. (If so, please do enlighten!)
Note that I said a delayed work queue. The dying CPU runs a predictable sequence once
cpu_die()has been entered - interrupts at the GIC have been programmed to be routed to other CPUs, interrupts at the CPU are masked, so the CPU isn't going to be doing anything else except executing that code path. So, it's going to be a predictable number of CPU cycles.
Quoted 3 lines
That allows you to arrange a delayed workqueue (or a timer) to fire after a period of time that you can guarantee that the dying CPU has reached that
wfi().
OK, that sounds workable for the active hotplug case.
But what about for the suspend case? CPUs are hot-unplugged during disable_nonboot_cpus(), and I don't see that this would guarantee the workqueue will complete before we enter suspend.
Quoted 8 lines
Another point which raises itself in your patch is this:
arch/arm/mach-bcm/platsmp-brcmstb.c new file +2
-0+/* Settle-time from Broadcom-internal DVT reference code */ +udelay (7 );7us looks very precise, but
udelay()may not be that precise. What is the actual specification? Does it say "you must wait at least 7us"?
Quoted 7 lines
udelay()_may_ return early, especially if it is using the CPU delay loop to perform the delay - I've explained why this happens previously, and why it isn't a bug.If you're using a timer-based delay for
udelay()(which you should be using if you support cpufreq) then the delay should be more accurate, but it's still good practise to give a little leeway on the figure.
I'm looking into this specific delay. I'd bet it's just "wait at least 7us." I could probably factor in some leeway to be safe.
Thanks,
Brian
Re: [PATCH v8 01/11] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
Hi Russell,
Quoted 2 lines · Brian Norris
Picking up this thread again, as things are now set for dropping this patch and resubmitting SMP support for 3.18.
Any further comment on this? I'd like to submit v10 of this patch soon. As of now, my patch will still look essentially the same (with only minor changes for some of the review comments), since I'm convinced neither that my current per-cpu flag-based solution is unsound nor that a delayed work queue can solve all of the same problems.
Quoted 44 lines · Russell King
Quoted 8 lines · Brian Norris
Quoted 2 lines
Yes, I noticed this. What I meant is that
smp_ops.cpu_die()andsmp_ops.cpu_kill()are not synchronized....
Quoted 2 lines
We're not relying on the L1 cache, though. Don't sync_cache_{r,w}() ensure all reads/writes reach at least the L2?
What exactly are you trying to achieve here?
Synchronization between
v7_exit_coherency_flush()(on the dying CPU) and yanking the power (brcmstb_cpu_kill(), on the murderous CPU). The core completion-based synchronization is not sufficient, since it allows brcmstb_smp_ops.smp_kill and brcmstb_smp_ops.smp_die to race.Am I somehow not achieving what I intend here?
Quoted 12 lines
Quoted 5 lines
How does that ensure that the CPU is down by the time the work is scheduled? It seems like this would just defer the work long enough that it *most likely* has quiesced, but I don't see how this gives us a better guarantee. Or maybe I'm missing something. (If so, please do enlighten!)
Note that I said a delayed work queue. The dying CPU runs a predictable sequence once
cpu_die()has been entered - interrupts at the GIC have been programmed to be routed to other CPUs, interrupts at the CPU are masked, so the CPU isn't going to be doing anything else except executing that code path. So, it's going to be a predictable number of CPU cycles.Quoted 3 lines
That allows you to arrange a delayed workqueue (or a timer) to fire after a period of time that you can guarantee that the dying CPU has reached that
wfi().OK, that sounds workable for the active hotplug case.
But what about for the suspend case? CPUs are hot-unplugged during
disable_nonboot_cpus(), and I don't see that this would guarantee the workqueue will complete before we enter suspend.Quoted 5 lines
Another point which raises itself in your patch is this:
(quoted diff) +2
-0+ /* Settle-time from Broadcom-internal DVT reference code */ + udelay(7);
[...]
Quoted 1 line
I'm looking into this specific delay. [...]
BTW, I think this delay can be dropped. It was retained from an early non-production release of this CPU.
Brian
Re: [PATCH v8 03/11] ARM: brcmstb: add debug UART for earlyprintk support
In reply to Olof JohanssonOn 08/13/2014 03:16 PM, Olof Johansson wrote:
[snip]
Quoted 17 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
I noticed that you sent this to the patch system. I asked Olof last night whether he had anything in arm-soc touching
Kconfig.debug, and he does (a number of other platforms have updated it.) This means that if I apply it to my tree, it may conflict, so I'm reluctant to take it.OK... Matt told me that such patches go through you. So which is it? Should all
Kconfig.debugpatches go through the arm-soc route?How should this get in? Should I rebase/resend through Matt and arm-soc? Or can you pick this up as-is?
Kconfig.debugis something that we usually merge new platforms for through arm-soc. The main exception has been release cycles when Russell has been doing major surgery on the file (one of those was a few releases ago), where we've backed off to avoid conflicts.
Quoted 5 lines
That's been the assumed arrangement from our side at least, we haven't had anything more formal than that.
So, go ahead and send it through us -- if we end up having a cycle where we can't apply it we can send it over to Russell for you.
It looks like somehow, this patch got lost somewhere in the submission process. Is it too late to accept it for 3.17 if we were to re-submit it?
Thanks
--
Florian
Re: [PATCH v8 03/11] ARM: brcmstb: add debug UART for earlyprintk support
Quoted 21 lines · Florian Fainelli
On 08/13/2014 03:16 PM, Olof Johansson wrote:
[snip]
Quoted 17 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
I noticed that you sent this to the patch system. I asked Olof last night whether he had anything in arm-soc touching
Kconfig.debug, and he does (a number of other platforms have updated it.) This means that if I apply it to my tree, it may conflict, so I'm reluctant to take it.OK... Matt told me that such patches go through you. So which is it? Should all
Kconfig.debugpatches go through the arm-soc route?How should this get in? Should I rebase/resend through Matt and arm-soc? Or can you pick this up as-is?
Kconfig.debugis something that we usually merge new platforms for through arm-soc. The main exception has been release cycles when Russell has been doing major surgery on the file (one of those was a few releases ago), where we've backed off to avoid conflicts.
Quoted 8 lines
Quoted 5 lines
That's been the assumed arrangement from our side at least, we haven't had anything more formal than that.
So, go ahead and send it through us -- if we end up having a cycle where we can't apply it we can send it over to Russell for you.
It looks like somehow, this patch got lost somewhere in the submission process. Is it too late to accept it for 3.17 if we were to re-submit it?
I already resubmitted this weeks ago:
http://article.gmane.org/gmane.linux.ports.arm.kernel/348468
No comment / action so far.
Brian