From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 07/62] ST SPEAr13XX: Adding machine specific src files
Date: Tue, 18 Jan 2011 16:06:55 +0000 [thread overview]
Message-ID: <20110118160655.GD16980@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <86b571fe06bdc264254a4125ec32195fdff46457.1295333958.git.viresh.kumar@st.com>
On Tue, Jan 18, 2011 at 12:41:35PM +0530, Viresh Kumar wrote:
> diff --git a/arch/arm/mach-spear13xx/headsmp.S b/arch/arm/mach-spear13xx/headsmp.S
> new file mode 100644
> index 0000000..30761d3
> --- /dev/null
> +++ b/arch/arm/mach-spear13xx/headsmp.S
> @@ -0,0 +1,96 @@
> +/*
> + * arch/arm/mach-spear13XX/headsmp.S
> + *
> + * Picked from realview
> + * Copyright (c) 2010 ST Microelectronics Limited
> + * Shiraz Hashim <shiraz.hashim@st.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/linkage.h>
> +#include <linux/init.h>
> +
> + __INIT
Is this ever called after the kernel text is thrown away? What if we
add support in the generic code to start with secondary CPUs offline
as a power saving or boot time feature?
> +
> +/*
> + * This one is picked from Tegra :-
> + *
> + * The secondary kernel init calls v7_flush_dcache_all before it enables
> + * the L1; however, the L1 comes out of reset in an undefined state, so
> + * the clean + invalidate performed by v7_flush_dcache_all causes a bunch
> + * of cache lines with uninitialized data and uninitialized tags to get
> + * written out to memory, which does really unpleasant things to the ain
> + * processor. We fix this by performing an invalidate, rather than a
> + * clean + invalidate, before jumping into the kernel.
> + */
> +ENTRY(v7_invalidate_l1)
> + mov r0, #0
> + mcr p15, 2, r0, c0, c0, 0
> + mrc p15, 1, r0, c0, c0, 0
> +
> + ldr r1, =0x7fff
> + and r2, r1, r0, lsr #13
> +
> + ldr r1, =0x3ff
> +
> + and r3, r1, r0, lsr #3 @ NumWays - 1
> + add r2, r2, #1 @ NumSets
> +
> + and r0, r0, #0x7
> + add r0, r0, #4 @ SetShift
> +
> + clz r1, r3 @ WayShift
> + add r4, r3, #1 @ NumWays
> +1: sub r2, r2, #1 @ NumSets--
> + mov r3, r4 @ Temp = NumWays
> +2: subs r3, r3, #1 @ Temp--
> + mov r5, r3, lsl r1
> + mov r6, r2, lsl r0
> + orr r5, r5, r6 @ Reg = Temp<<WayShift)|(NumSets<<SetShift)
> + mcr p15, 0, r5, c7, c6, 2
> + bgt 2b
> + cmp r2, #0
> + bgt 1b
> + dsb
> + isb
> + mov pc, lr
> +ENDPROC(v7_invalidate_l1)
This code appears to have its only caller commented out. Should it be
removed?
> +
> +/*
> + * spear13xx specific entry point for secondary CPUs. This provides
> + * a "holding pen" into which all secondary cores are held until we're
> + * ready for them to initialise.
> + */
> +ENTRY(spear13xx_secondary_startup)
> + /* If we don't do this then we have a crash */
> +
> + /*
> + * Since now this is being called from xloader so removing it
> + * here
> + */
> +#if 0
> + bl v7_invalidate_l1
> +#endif
> +
> + mrc p15, 0, r0, c0, c0, 5
> + and r0, r0, #15
> + adr r4, 1f
> + ldmia r4, {r5, r6}
> + sub r4, r4, r5
> + add r6, r6, r4
> +pen: ldr r7, [r6]
> + cmp r7, r0
> + bne pen
> +
> + /*
> + * we've been released from the holding pen: secondary_stack
> + * should now contain the SVC stack for this core
> + */
> + b secondary_startup
> +
> + .align
> +1: .long .
> + .long pen_release
...
> +volatile int __cpuinitdata pen_release = -1;
> +static DEFINE_SPINLOCK(boot_lock);
> +
> +/*
> + * Write pen_release in a way that is guaranteed to be visible to all
> + * observers, irrespective of whether they're taking part in coherency
> + * or not. This is necessary for the hotplug code to work reliably.
> + */
> +static void write_pen_release(int val)
> +{
> + pen_release = val;
> + smp_wmb();
> + __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
> + outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
> +}
> +
> +static void __iomem *scu_base_addr(void)
> +{
> + return __io_address(SPEAR13XX_SCU_BASE);
> +}
> +
> +void __cpuinit platform_secondary_init(unsigned int cpu)
> +{
> + /*
> + * if any interrupts are already enabled for the primary
> + * core (e.g. timer irq), then they will not have been enabled
> + * for us: do so
> + */
> + gic_secondary_init(0);
> +
> + /*
> + * let the primary processor know we're out of the
> + * pen, then head off into the C entry point
> + */
> + write_pen_release(-1);
> +
> + /*
> + * Synchronise with the boot thread.
> + */
> + spin_lock(&boot_lock);
> + spin_unlock(&boot_lock);
> +}
> +
> +int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
> +{
> + unsigned long timeout;
> +
> + /*
> + * set synchronisation state between this boot processor
> + * and the secondary one
> + */
> + spin_lock(&boot_lock);
> +
> + /*
> + * The secondary processor is waiting to be released from
> + * the holding pen - release it, then wait for it to flag
> + * that it has been released by resetting pen_release.
> + *
> + * Note that "pen_release" is the hardware CPU ID, whereas
> + * "cpu" is Linux's internal ID.
> + */
> + write_pen_release(cpu);
> +
> + timeout = jiffies + (1 * HZ);
> + while (time_before(jiffies, timeout)) {
> + smp_rmb();
> + if (pen_release == -1)
> + break;
> +
> + udelay(10);
> + }
> +
> + /*
> + * now the secondary core is starting up let it run its
> + * calibrations, then wait for it to finish
> + */
> + spin_unlock(&boot_lock);
> +
> + return pen_release != -1 ? -ENOSYS : 0;
> +}
> +
> +/*
> + * Initialise the CPU possible map early - this describes the CPUs
> + * which may be present or become present in the system.
> + */
> +void __init smp_init_cpus(void)
> +{
> + void __iomem *scu_base = scu_base_addr();
> + unsigned int i, ncores;
> +
> + ncores = scu_base ? scu_get_core_count(scu_base) : 1;
> +
> + for (i = 0; i < ncores; i++)
> + set_cpu_possible(i, true);
> +}
> +
> +static void __init wakeup_secondary(void)
> +{
> + /* nobody is to be released from the pen yet */
> + pen_release = -1;
But pen_release starts off as -1, so is this really needed?
> +
> + /*
> + * Write the address of secondary startup into the system-wide
> + * location (presently it is in SRAM). The BootMonitor waits
> + * for this register to become non-zero.
> + * We must also send an sev to wake it up
> + */
> + __raw_writel(BSYM(virt_to_phys(spear13xx_secondary_startup)),
> + __io_address(SPEAR13XX_SYS_LOCATION));
> +
> + mb();
Do you really need to sync back to L2, or will a dsb() do here - and
as the spinlock code uses dsb() + sev() together, would it make sense
to combine the two? (dsb() is required to ensure all previous writes
are visible prior to the sev() executing.)
next prev parent reply other threads:[~2011-01-18 16:06 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-18 7:11 [PATCH V4 00/62] Updating SPEAr Support Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 01/62] spear/vmalloc.h: Appending UL to VMALLOC_END Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 02/62] sp810 Fix: Switch to slow mode before sysctl_soft_reset Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 03/62] ST SPEAr: Padmux code Updated Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 04/62] ST SPEAr: Making clock functions more generic Viresh Kumar
2011-01-18 15:56 ` Russell King - ARM Linux
2011-01-19 4:03 ` viresh kumar
2011-01-18 7:11 ` [PATCH V4 05/62] ST SPEAr: Formalized timer support Viresh Kumar
2011-01-18 23:50 ` Jamie Iles
2011-01-19 3:53 ` viresh kumar
2011-01-18 7:11 ` [PATCH V4 06/62] ST SPEAr13XX: Adding machine specific header files Viresh Kumar
2011-01-18 16:00 ` Russell King - ARM Linux
2011-01-19 4:38 ` viresh kumar
2011-01-19 9:02 ` viresh kumar
2011-01-18 7:11 ` [PATCH V4 07/62] ST SPEAr13XX: Adding machine specific src files Viresh Kumar
2011-01-18 16:06 ` Russell King - ARM Linux [this message]
2011-01-19 6:03 ` Shiraz Hashim
2011-01-19 8:52 ` Russell King - ARM Linux
2011-01-19 9:20 ` Shiraz Hashim
2011-01-18 7:11 ` [PATCH V4 08/62] ST SPEAr: Adding support for SPEAr13xx SoC in spear generic plat/ Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 09/62] ST SPEAr13XX: Added compilation support in arch/arm/ Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 10/62] ST SPEAr13xx: Adding default config file Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 11/62] ST SPEAr: Adding support for CLCD on SPEAr3xx/6xx Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 12/62] ST SPEAr: Updating Clock Support Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 13/62] ST SPEAr: Adding Debugfs support on clock framework Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 14/62] ST SPEAr: Correcting SOC Config base address for spear320 Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 15/62] ST SPEAr: Adding PLGPIO driver for spear platform Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 17/62] ST SPEAr: Adding machine support for rtc-spear Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 18/62] ST SPEAr: adding support for synopsis i2c designware Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 19/62] ST SPEAr: Adding machine support for USB host Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 20/62] ST SPEAr: Adding machine support for keyboard Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 21/62] ST SPEAr: Added ARM PL061 GPIO Support on SPEAr13xx and modified resource size Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 22/62] ST SPEAr: Adding support for ST's PWM IP Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 23/62] ST SPEAr: Adding Watchdog support Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 24/62] ST SPEAr: Adding machine support for nand Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 25/62] ST SPEAr: Added PCIE host controller base driver support Viresh Kumar
2011-01-19 0:05 ` Russell King - ARM Linux
2011-01-19 4:17 ` viresh kumar
2011-01-18 7:11 ` [PATCH V4 26/62] ST SPEAr: Adding support for SSP PL022 Viresh Kumar
2011-01-18 16:18 ` Russell King - ARM Linux
2011-01-19 4:16 ` viresh kumar
2011-01-18 7:11 ` [PATCH V4 27/62] ST SPEAr: Adding support for SDHCI (SDIO) Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 28/62] ST SPEAr: Changing resource size of amba devices to SZ_4K Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 29/62] ST SPEAr: Replacing SIZE macro's with actual required size Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 30/62] SPEAr: defines base addresses as ulong Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 31/62] ST SPEAr: Adding miscellaneous devices Viresh Kumar
2011-01-18 7:11 ` [PATCH V4 32/62] ST SPEAr 13xx : Adding support for SPEAr1310 Viresh Kumar
2011-01-19 0:09 ` Jamie Iles
2011-01-19 4:39 ` viresh kumar
2011-01-19 6:40 ` viresh kumar
2011-01-19 8:29 ` Jamie Iles
2011-01-18 7:12 ` [PATCH V4 33/62] SPEAr320: Adding support for CAN Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 34/62] ST SPEAr: Adding support for DDR in clock framework Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 35/62] ST SPEAr : EMI (Extrenal Memory Interface) controller driver Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 36/62] SPEAr Clock Framework: Adding support for PLL frequency change Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 37/62] SPEAr Power Management: Added the support for Standby mode Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 38/62] SPEAr CPU freq: Adding support for CPU Freq framework Viresh Kumar
2011-01-19 0:20 ` Jamie Iles
2011-01-19 2:13 ` deepaksi
2011-01-19 8:35 ` Jamie Iles
2011-01-19 9:00 ` Shiraz Hashim
2011-01-19 9:39 ` Shiraz Hashim
2011-01-19 9:53 ` Russell King - ARM Linux
2011-01-19 11:14 ` viresh kumar
2011-01-18 7:12 ` [PATCH V4 39/62] ST SPEAr13xx: Adding CPU hotplug support added for SMP platforms Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 40/62] ST SPEAr: replace readl, writel with readl_relaxed, writel_relaxed in uncompress.h Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 41/62] ST SPEAr13xx: add L2 cache support Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 42/62] ST SPEAr13xx: Modified static mappings Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 43/62] SPEAr1310: Adding Static Mapping for RAS Area Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 44/62] SPEAr: Adding and Updating Clock definitions Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 45/62] SPEAr : Pad multiplexing handling modified Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 46/62] SPEAr13xx : Fixed part devices in SPEAr13xx addded to the generic implementation Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 47/62] SPEAr : Updating pad multiplexing support Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 48/62] ST SPEAr3xx: Passing pmx devices address from machine *.c files Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 49/62] ST SPEAr Clock Framework: Updating for single image solution Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 50/62] SPEAr3xx: Make local structures static Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 51/62] SPEAR3xx: Rename register/irq defines to remove naming conflicts Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 52/62] SPEAr3xx: Rework pmx_dev code to remove conflicts Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 53/62] SPEAr3xx: Rework KConfig to allow all boards to be compiled in Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 54/62] SPEAr3xx: Replace defconfigs with single unified defconfig Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 55/62] ST SPEAr: Appending spear3** with global structures Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 56/62] ST SPEAr3xx: Updating plgpio and emi source to make it compliant with single image strategy Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 57/62] SPEAr6xx: Rework Kconfig for single image solution Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 58/62] ST SPEAR6xx: renaming spear600_defconfig as spear6xx_defconfig Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 59/62] ST SPEAr13xx: Pass default padmux settings as parameter to spear13**_init routine Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 60/62] ST SPEAr: Adding devices & clocks Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 61/62] ST SPEAr: Adding information in Documentation/ and MAINTAINERS Viresh Kumar
2011-01-18 7:12 ` [PATCH V4 62/62] ST SPEAr: Updating defconfigs Viresh Kumar
2011-01-18 15:53 ` [PATCH V4 00/62] Updating SPEAr Support Russell King - ARM Linux
2011-01-19 3:49 ` viresh kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110118160655.GD16980@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).