From patchwork Tue Dec 22 07:21:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 58823 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3066869lbb; Mon, 21 Dec 2015 23:23:13 -0800 (PST) X-Received: by 10.98.32.74 with SMTP id g71mr3290155pfg.46.1450768993433; Mon, 21 Dec 2015 23:23:13 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a1si625349pas.56.2015.12.21.23.23.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2015 23:23:13 -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 1aBHGf-0004EB-8W; Tue, 22 Dec 2015 07:21:57 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aBHGX-00045A-Se for linux-arm-kernel@lists.infradead.org; Tue, 22 Dec 2015 07:21:50 +0000 Received: by mail-wm0-x229.google.com with SMTP id p187so98305710wmp.0 for ; Mon, 21 Dec 2015 23:21:29 -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=RCYHcrcC/vmtvrC2TR7T7WWDWAj9v8/8CluuN2Tmy8I=; b=cKgd66Z/6GloQ5lmN2FBRRecPc4UhwewhMz32ra8YXfZFpkKyf8sD75E9gdLGB88T1 xUAdQTQwcLC1SxZ7sTDXtvFzil1FjdGQP4tsNi/n+I3xkGLD+rdEMS9qRxSq+wiHK01h ZODNgwPBa4L6wLFOvSwOarwdpccBthQgM+qus= 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=RCYHcrcC/vmtvrC2TR7T7WWDWAj9v8/8CluuN2Tmy8I=; b=hXSvA6Xh5FEq5HFESN2KStPj6Oa0/SAlV0dy5ArGRcMB72cMmMmi4JobweeT136ORh aE/g6Zs+hwj1K21mZZ0o4MzIoAed2V8BB/sjKUtvm6+AKtKP8JiZfY8pnWlF+9TiPHn1 zQbX23LK4fttT8zbvJDENWlsqjoj88glePTz58hGW42n1t30ZGqYQy0RKeqddhAgb9b8 B+nJ2mtaKAVbqI5cgoOx0uGYCWZJ5hnpGj50O/yg/pkjX7UEvP32TwGqRqbv35NkO45b Jqp0EBw5lhxJgO8zdmqkt7eJM6XlWFTGEYkyv38WD8ZHu6uHCdneTLNBMsE5B9xCcKcH Gvvg== X-Gm-Message-State: ALoCoQnnuj4pXWveP2I/YTeqzbPyEfGzYUc5N1tbTaL9aa8+gZpgxhEjgZkFvZcwvgnNqiT/oXmEYAq+jkJPjI+xWV2SCxu4NA== X-Received: by 10.28.23.136 with SMTP id 130mr27340549wmx.94.1450768888245; Mon, 21 Dec 2015 23:21:28 -0800 (PST) Received: from jessie.localdomain (52D95939.cm-11-1b.dynamic.ziggo.nl. [82.217.89.57]) by smtp.gmail.com with ESMTPSA id g187sm632148wmf.8.2015.12.21.23.21.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Dec 2015 23:21:27 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, nico@linaro.org, arnd@arndb.de, linux@arm.linux.org.uk Subject: [PATCH v2] ARM: PJ4: make coprocessor access sequences buildable in Thumb2 mode Date: Tue, 22 Dec 2015 08:21:09 +0100 Message-Id: <1450768869-13450-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151221_232150_134227_CBA2807B X-CRM114-Status: GOOD ( 13.55 ) 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:229 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_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 when building in Thumb2 mode. Thumb2 implies V7, so 'isb' should always be supported in that case. Acked-by: Arnd Bergmann Acked-by: Nicolas Pitre Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/Makefile | 1 - arch/arm/kernel/pj4-cp0.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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..7c9248b74d3f 100644 --- a/arch/arm/kernel/pj4-cp0.c +++ b/arch/arm/kernel/pj4-cp0.c @@ -66,9 +66,13 @@ static void __init pj4_cp_access_write(u32 value) __asm__ __volatile__ ( "mcr p15, 0, %1, c1, c0, 2\n\t" +#ifdef CONFIG_THUMB2_KERNEL + "isb\n\t" +#else "mrc p15, 0, %0, c1, c0, 2\n\t" "mov %0, %0\n\t" "sub pc, pc, #4\n\t" +#endif : "=r" (temp) : "r" (value)); }