From patchwork Thu Dec 17 15:25:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 58593 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp434387lbb; Thu, 17 Dec 2015 07:27:03 -0800 (PST) X-Received: by 10.98.16.206 with SMTP id 75mr14835566pfq.23.1450366022910; Thu, 17 Dec 2015 07:27:02 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id b12si6692882pfj.106.2015.12.17.07.27.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Dec 2015 07:27:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9aR6-0002Vc-UX; Thu, 17 Dec 2015 15:25:44 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9aR3-0002KT-5T for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2015 15:25:42 +0000 Received: by mail-wm0-x234.google.com with SMTP id l126so28317779wml.1 for ; Thu, 17 Dec 2015 07:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0tP04dhbhSSFXvm9yoiGVhDLBrwYJhW2NZBlOC7eQSw=; b=KWTze1DS7sFvB2RtWvSv5oT7AOYwZspBqeo+pXFZv5HCHm3R1V2epZTVs2I7+1Aadd 29Q0Wp5dIuxDB64Csz4wHlWuU4LSg4keyEXjRGBoLAWR2rmF+5eJtJ2/BD52QQ5pOykC oGd1EZB3j3BSYAhEPAxy3TQXNfEd+Y2rzN6Ko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0tP04dhbhSSFXvm9yoiGVhDLBrwYJhW2NZBlOC7eQSw=; b=Jbteg4dIGzLpf6WUJRlgEN7zDIzszaBj2tSJ4TwkUhxGZe9owjVm7WiFytNJETv5ez qGJGKOT9VjeQ4aKZYlG8XwWU+ZLHB99oRkIOD0J1EVBPA6fYKnt+rdQ7imQBL3X1VUMC Xz+kfSc1aj+wRIuWNwK2GOEOHI9wThG4V2Zy0ajsYScl1PdJgpZ2Q0Jzz0ZEJd1fabLo 8EiQ1M4HPxt/X65VUZh52bb2W+3ptI5pTMOJuyUg4+ZwjlCk3Yy/+k6RSw7fTp/X/n6y 3aNE/PN6PnxlxEU0bmejXS/MuJ4R9RKXB2QD4fgwYMf4kcJwHFq3byyki5K+fCpQAiA2 IIDQ== X-Gm-Message-State: ALoCoQkYur0uftHRgM+8dGuGg5XmL7lBj9PBk3ja+LhMVnqCacLK/Gmsjq07roV8Wn6lXb7s5yRbpPyMFGYZpmzihdQluiD8BA== X-Received: by 10.194.249.69 with SMTP id ys5mr55241792wjc.97.1450365919184; Thu, 17 Dec 2015 07:25:19 -0800 (PST) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by smtp.gmail.com with ESMTPSA id u4sm10879287wjz.4.2015.12.17.07.25.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Dec 2015 07:25:18 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, arnd@arndb.de, linux@arm.linux.org.uk Subject: [PATCH] ARM: PJ4: make coprocessor access sequences buildable in Thumb2 mode Date: Thu, 17 Dec 2015 16:25:12 +0100 Message-Id: <1450365912-3834-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151217_072541_616607_5FBD540D X-CRM114-Status: GOOD ( 12.61 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , sboyd@codeaurora.org, nico@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The PJ4 inline asm sequence to write to cp15 cannot be built in Thumb-2 mode, due to the way it performs arithmetic on the program counter, so it is built in ARM mode instead. However, building C files in ARM mode under CONFIG_THUMB2_KERNEL is problematic, since the instrumentation performed by subsystems like ftrace does not expect having to deal with interworking branches. Since the sequence in question is simply a poor man's ISB instruction, let's use a straight 'isb' instead. Unlike Xscale, where this code originated, PJ4 is strictly ARMv7 so this should always be supported. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/Makefile | 1 - arch/arm/kernel/pj4-cp0.c | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel Acked-by: Nicolas Pitre diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index af9e59bf3831..3c789496297f 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -73,7 +73,6 @@ obj-$(CONFIG_IWMMXT) += iwmmxt.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_xscale.o perf_event_v6.o \ perf_event_v7.o -CFLAGS_pj4-cp0.o := -marm AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o obj-$(CONFIG_VDSO) += vdso.o diff --git a/arch/arm/kernel/pj4-cp0.c b/arch/arm/kernel/pj4-cp0.c index 8153e36b2491..a311977d795d 100644 --- a/arch/arm/kernel/pj4-cp0.c +++ b/arch/arm/kernel/pj4-cp0.c @@ -62,14 +62,10 @@ static u32 __init pj4_cp_access_read(void) static void __init pj4_cp_access_write(u32 value) { - u32 temp; - __asm__ __volatile__ ( - "mcr p15, 0, %1, c1, c0, 2\n\t" - "mrc p15, 0, %0, c1, c0, 2\n\t" - "mov %0, %0\n\t" - "sub pc, pc, #4\n\t" - : "=r" (temp) : "r" (value)); + "mcr p15, 0, %0, c1, c0, 2\n\t" + "isb\n\t" + : : "r" (value)); } static int __init pj4_get_iwmmxt_version(void)