From patchwork Thu Oct 11 12:43:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 1581931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2FE27DFABE for ; Thu, 11 Oct 2012 12:45:27 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMI70-0000lm-Hx; Thu, 11 Oct 2012 12:43:39 +0000 Received: from mail-oa0-f49.google.com ([209.85.219.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TMI6w-0000kP-IC for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 12:43:35 +0000 Received: by mail-oa0-f49.google.com with SMTP id l10so1712157oag.36 for ; Thu, 11 Oct 2012 05:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=j50M2okSw4VHoESJk8nSpIi5dM23tDdXfAZKBXuje1Q=; b=S7XvgMk5y3UBbHcDT/VN0GeBkkkmgpaEwjgts9uXlil1DKORdTRVj1dDfU0ntW/t7F P8R104uVIG4HpevPU6h9qmgW8lqLucQXf7gugxc96pqF0a5kSWQbKCvwtRbD5Bz+/OD/ xGT2ofEPjHC7qoyPjpp7od5obhgbWQ8jP2QVfNxw1udeETnoHEUEETxr1dB++E7oaWFC UY2LNcyxXZpL1muUkt61Q3Q86NiNJ6+wnSu6pd9hBkixC/MpjMdGm53w2rlMwfITHs+Q o7bIAw/7KQmjHCokpWze2oJ5LWD15Z0gqnxQfwsImIa8Umi8TRKULRq+YeVtuw3xXc+2 U0iA== Received: by 10.182.10.71 with SMTP id g7mr534732obb.84.1349959413280; Thu, 11 Oct 2012 05:43:33 -0700 (PDT) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPS id xj9sm3916037obb.17.2012.10.11.05.43.30 (version=SSLv3 cipher=OTHER); Thu, 11 Oct 2012 05:43:31 -0700 (PDT) From: Rob Herring To: linux-arm-kernel@lists.infradead.org, Russell King Subject: [PATCH] ARM: decompressor: clear SCTLR.A bit for v7 cores Date: Thu, 11 Oct 2012 07:43:22 -0500 Message-Id: <1349959402-24164-1-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.219.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (robherring2[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -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 Cc: Olof Johansson , Shawn Guo , Arnd Bergmann , Rob Herring , Nicolas Pitre X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Rob Herring With recent compilers and move to generic unaligned.h in commit d25c881 (ARM: 7493/1: use generic unaligned.h), unaligned accesses will be used by the LZO decompressor on v7 cores. So we need to make sure unaligned accesses are allowed by clearing the SCTLR A bit. While v6 can support unaligned accesses, it is optional and current compilers won't emit unaligned accesses. So we don't clear the A bit for v6. Signed-off-by: Rob Herring Acked-by: Nicolas Pitre Tested-by: Shawn Guo --- The contents of this were already reviewed on this thread, so I sent this to the patch system and this was Russell's reply: > NAK for two reasons. > > 1. It hasn't been on the list (I can't find a match for "clear SCTLR.A" > in my mailbox) > > 2. The behaviour of unaligned accesses vary depending on CPU. Some > fix-up the access, others load the word and then rotate it. If we have > decompressors which perform unaligned accesses, we need to fix this > properly to avoid the CPU specific behaviour, rather than tweaking > control bits to hide the problem. I'm simply matching the behavior of the kernel itself. The A bit is cleared for v7 kernels and compilers only generate unaligned accesses for v7. Without this the initial state of the A bit is undefined as a bootloader could have cleared it already. We should document the required state or set it to what we want. Rob arch/arm/boot/compressed/head.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index bc67cbf..b2e30b8 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -654,6 +654,7 @@ __armv7_mmu_cache_on: #endif mrc p15, 0, r0, c1, c0, 0 @ read control reg bic r0, r0, #1 << 28 @ clear SCTLR.TRE + bic r0, r0, #1 << 1 @ clear SCTLR.A orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement orr r0, r0, #0x003c @ write buffer #ifdef CONFIG_MMU