From patchwork Tue Aug 16 09:35:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1070862 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7G9ZXE1028221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 16 Aug 2011 09:35:54 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QtG3K-0006zy-3l; Tue, 16 Aug 2011 09:35:18 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QtG3J-0001TX-KB; Tue, 16 Aug 2011 09:35:17 +0000 Received: from mail-qw0-f49.google.com ([209.85.216.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QtG3F-0001TF-5k for linux-arm-kernel@lists.infradead.org; Tue, 16 Aug 2011 09:35:14 +0000 Received: by qwi2 with SMTP id 2so3430755qwi.36 for ; Tue, 16 Aug 2011 02:35:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.218.74 with SMTP id hp10mr3227524qab.147.1313487309031; Tue, 16 Aug 2011 02:35:09 -0700 (PDT) Received: by 10.224.37.136 with HTTP; Tue, 16 Aug 2011 02:35:08 -0700 (PDT) In-Reply-To: <20110816092615.GC28656@e102144-lin.cambridge.arm.com> References: <20110810152400.GO10121@e102144-lin.cambridge.arm.com> <20110816092615.GC28656@e102144-lin.cambridge.arm.com> Date: Tue, 16 Aug 2011 11:35:08 +0200 Message-ID: Subject: Re: PB1176 broken in -rc1 From: Linus Walleij To: Will Deacon X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110816_053513_477200_6E76D21B X-CRM114-Status: GOOD ( 30.21 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.49 listed in list.dnswl.org] Cc: Jamie Iles , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 16 Aug 2011 09:35:54 +0000 (UTC) On Tue, Aug 16, 2011 at 11:26 AM, Will Deacon wrote: >> Will, Jamie, any hints? > > Can you make your .config available somewhere please? http://www.df.lth.se/~triad/realview_config Basically that's the realview_defconfig with these changes done on top: scripts/config --file $(realview_dir)/.config \ --enable BLK_DEV_INITRD \ --set-str INITRAMFS_SOURCE rootfs-u338.cpio \ --enable INITRAMFS_COMPRESSION_NONE \ --enable MISC_DEVICES \ --enable ARM_CHARLCD \ --enable DEBUG_LL \ --enable EARLY_PRINTK \ --enable ARM_TEST \ --enable ARM_TCM_TEST \ --set-str CMDLINE "root=/dev/ram0 console=ttyAMA0 earlyprintk mem=128M" yes "" | make $(make_options) oldconfig > It sounds like an unrelated issue, so let's try to track it down. Thanx! > How do you use the interface > with the TCMs once they've been mapped at the high address? Here is my test code patch I'm cooking RFC: ------------8<-----------------------------8<----------------------------- From ece57aeca9a03107432c6090733f89f483872163 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 30 Jun 2011 14:33:48 +0200 Subject: [PATCH] ARM TCM sample code This is a simple sample snippet of ARM TCM code use, we create arm/test to host the code. Signed-off-by: Linus Walleij --- Documentation/arm/tcm.txt | 60 +-------------------------- arch/arm/Kconfig.debug | 2 + arch/arm/Makefile | 2 + arch/arm/test/Kconfig | 20 +++++++++ arch/arm/test/Makefile | 2 + arch/arm/test/tcm-example.c | 94 +++++++++++++++++++++++++++++++++++++++++++ samples/Kconfig | 9 ++++ samples/Makefile | 2 +- 8 files changed, 132 insertions(+), 59 deletions(-) create mode 100644 arch/arm/test/Kconfig create mode 100644 arch/arm/test/Makefile create mode 100644 arch/arm/test/tcm-example.c diff --git a/Documentation/arm/tcm.txt b/Documentation/arm/tcm.txt index 7c15871..f6ead49 100644 --- a/Documentation/arm/tcm.txt +++ b/Documentation/arm/tcm.txt @@ -95,61 +95,5 @@ To put assembler into TCM just use .section ".tcm.text" or .section ".tcm.data" respectively. -Example code: - -#include - -/* Uninitialized data */ -static u32 __tcmdata tcmvar; -/* Initialized data */ -static u32 __tcmdata tcmassigned = 0x2BADBABEU; -/* Constant */ -static const u32 __tcmconst tcmconst = 0xCAFEBABEU; - -static void __tcmlocalfunc tcm_to_tcm(void) -{ - int i; - for (i = 0; i < 100; i++) - tcmvar ++; -} - -static void __tcmfunc hello_tcm(void) -{ - /* Some abstract code that runs in ITCM */ - int i; - for (i = 0; i < 100; i++) { - tcmvar ++; - } - tcm_to_tcm(); -} - -static void __init test_tcm(void) -{ - u32 *tcmem; - int i; - - hello_tcm(); - printk("Hello TCM executed from ITCM RAM\n"); - - printk("TCM variable from testrun: %u @ %p\n", tcmvar, &tcmvar); - tcmvar = 0xDEADBEEFU; - printk("TCM variable: 0x%x @ %p\n", tcmvar, &tcmvar); - - printk("TCM assigned variable: 0x%x @ %p\n", tcmassigned, &tcmassigned); - - printk("TCM constant: 0x%x @ %p\n", tcmconst, &tcmconst); - - /* Allocate some TCM memory from the pool */ - tcmem = tcm_alloc(20); - if (tcmem) { - printk("TCM Allocated 20 bytes of TCM @ %p\n", tcmem); - tcmem[0] = 0xDEADBEEFU; - tcmem[1] = 0x2BADBABEU; - tcmem[2] = 0xCAFEBABEU; - tcmem[3] = 0xDEADBEEFU; - tcmem[4] = 0x2BADBABEU; - for (i = 0; i < 5; i++) - printk("TCM tcmem[%d] = %08x\n", i, tcmem[i]); - tcm_free(tcmem, 20); - } -} +Example code can be found in the samples/arm_tcm directory of the kernel +tree, and can be compiled in using menuconfig. diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 81cbe40..82bf536 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -129,4 +129,6 @@ config DEBUG_S3C_UART The uncompressor code port configuration is now handled by CONFIG_S3C_LOWLEVEL_UART_PORT. +source "arch/arm/test/Kconfig" + endmenu diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 70c424e..f2f370b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -255,6 +255,8 @@ core-$(CONFIG_VFP) += arch/arm/vfp/ core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ core-y += $(machdirs) $(platdirs) +core-$(CONFIG_ARM_TEST) += arch/arm/test/ + drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ libs-y := arch/arm/lib/ $(libs-y) diff --git a/arch/arm/test/Kconfig b/arch/arm/test/Kconfig new file mode 100644 index 0000000..13c38e1 --- /dev/null +++ b/arch/arm/test/Kconfig @@ -0,0 +1,20 @@ +config ARM_TEST + bool "Enable ARM kernel tests" + +if ARM_TEST + +menu "ARM Kernel tests" + +comment "test code to exercise the ARM kernel" + +config ARM_TCM_TEST + bool "ARM TCM test" + depends on HAVE_TCM + help + Enables some test code snippets to exercise the TCM memory + on platforms that have it. The code will not be executed + if no TCM memory is found. + +endmenu + +endif diff --git a/arch/arm/test/Makefile b/arch/arm/test/Makefile new file mode 100644 index 0000000..9161440 --- /dev/null +++ b/arch/arm/test/Makefile @@ -0,0 +1,2 @@ +obj-y := +obj-$(CONFIG_ARM_TCM_TEST) += tcm-example.o diff --git a/arch/arm/test/tcm-example.c b/arch/arm/test/tcm-example.c new file mode 100644 index 0000000..156d97e --- /dev/null +++ b/arch/arm/test/tcm-example.c @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 ST-Ericsson AB + * License terms: GNU General Public License (GPL) version 2 + * TCM memory test + * + * Author: Linus Walleij + */ + +#include +#include +#include + +#define CANARY1 0xDEADBEEFU +#define CANARY2 0x2BADBABEU +#define CANARY3 0xCAFEBABEU + +/* Uninitialized data */ +static u32 __tcmdata tcmvar; +/* Initialized data */ +static u32 __tcmdata tcmassigned = CANARY2; +/* Constant */ +static const u32 __tcmconst tcmconst = CANARY3; + +static void __tcmlocalfunc tcm_to_tcm(void) +{ + int i; + for (i = 0; i < 100; i++) + tcmvar ++; +} + +static void __tcmfunc hello_tcm(void) +{ + /* Some abstract code that runs in ITCM */ + int i; + for (i = 0; i < 100; i++) { + tcmvar ++; + } + tcm_to_tcm(); +} + +static int __init test_tcm(void) +{ + u32 *tcmem; + int i; + + if (!tcm_dtcm_present() && !tcm_itcm_present()) { + pr_info("CPU: no TCMs present, skipping tests\n"); + return 0; + } + + if (!tcm_itcm_present()) + goto skip_itcm_tests; + + hello_tcm(); + pr_info("CPU: hello TCM executed from ITCM RAM\n"); + + pr_info("CPU: TCM variable from testrun: %u @ %p\n", + tcmvar, &tcmvar); + BUG_ON(tcmvar != 200); + +skip_itcm_tests: + tcmvar = CANARY1; + pr_info("CPU: TCM variable: 0x%x @ %p\n", tcmvar, &tcmvar); + BUG_ON(tcmvar != CANARY1); + + pr_info("CPU: TCM assigned variable: 0x%x @ %p\n", + tcmassigned, &tcmassigned); + BUG_ON(tcmassigned != CANARY2); + + pr_info("CPU: TCM constant: 0x%x @ %p\n", tcmconst, &tcmconst); + BUG_ON(tcmconst != CANARY3); + + /* Allocate some TCM memory from the pool */ + tcmem = tcm_alloc(20); + if (tcmem) { + pr_info("CPU: TCM Allocated 20 bytes of TCM @ %p\n", tcmem); + tcmem[0] = CANARY1; + tcmem[1] = CANARY2; + tcmem[2] = CANARY3; + tcmem[3] = CANARY1; + tcmem[4] = CANARY2; + for (i = 0; i < 5; i++) + pr_info("CPU: TCM tcmem[%d] = %08x\n", i, tcmem[i]); + BUG_ON(tcmem[0] != CANARY1); + BUG_ON(tcmem[1] != CANARY2); + BUG_ON(tcmem[2] != CANARY3); + BUG_ON(tcmem[3] != CANARY1); + BUG_ON(tcmem[4] != CANARY2); + tcm_free(tcmem, 20); + } + return 0; +} + +late_initcall(test_tcm); diff --git a/samples/Kconfig b/samples/Kconfig index 96a7572..91260c6 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -67,4 +67,13 @@ config SAMPLE_HIDRAW help Build an example of how to use hidraw from userspace. +config SAMPLE_ARM_TCM + bool "TCM sample testing module" + depends on HAVE_TCM + help + This enables a small testing module that execise the ARM TCM + memory on the platform at startup to make sure it's working. + If you're really using the TCM it is a scarce resource so + this should only be selected for testing and education. + endif # SAMPLES diff --git a/samples/Makefile b/samples/Makefile index 6280817..11a1d27 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -1,4 +1,4 @@ # Makefile for Linux samples code obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ tracepoints/ trace_events/ \ - hw_breakpoint/ kfifo/ kdb/ hidraw/ + hw_breakpoint/ kfifo/ kdb/ hidraw/ arm_tcm/