From patchwork Mon Oct 31 13:37:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 80173 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp120963qge; Mon, 31 Oct 2016 06:36:51 -0700 (PDT) X-Received: by 10.98.35.140 with SMTP id q12mr49154669pfj.180.1477921011497; Mon, 31 Oct 2016 06:36:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15si24757554pgh.231.2016.10.31.06.36.51; Mon, 31 Oct 2016 06:36:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943091AbcJaNgr (ORCPT + 27 others); Mon, 31 Oct 2016 09:36:47 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:20343 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933563AbcJaNgn (ORCPT ); Mon, 31 Oct 2016 09:36:43 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id u9VDYesh014906; Mon, 31 Oct 2016 22:34:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com u9VDYesh014906 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1477920882; bh=a0uGXRQP49A1ZDZrto2H/PXQHgNlmlcWnzHWBbtXVp4=; h=From:To:Cc:Subject:Date:From; b=EmcxS6VNmr3rm/GMn2Ojl+gNT8iO5LxFnECZSE1VqIwZGvmjM0WhPySeaCkUqbw20 awufQcj1OuUNxynQ47WuV9rsQ6Vh1eVoDu34a81hsE1CwZriieH2Em+OLDJz6TWrgu U8nWLzBEQEiV5XgugVEpQ6SC5j3Zal0eyT339uMDXCR5apQ9CvJ82r3RLwnB80UUFP bqDfXl1ammQ/jFioE7mMxGYaVJpT8Jkp1gqOYuf8ZocsEVBxOnQ3yp5z5480L9qxe2 58T7PRG1Hcpw+f/6nZH88fY+C8lCJ3PhJZk7wpDYrx63LzQkbq3FtaeTvFcMhrAffJ Rkd5R3jysH5Qw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: patches@arm.linux.org.uk Cc: Masahiro Yamada , Zhaoxiu Zeng , Arnd Bergmann , Kees Cook , Jonathan Austin , Linus Walleij , linux-kernel@vger.kernel.org, Mark Rutland , Ard Biesheuvel , Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: mm: add ARM_L1_CACHE_SHIFT_7 for UniPhier outer cache Date: Mon, 31 Oct 2016 22:37:13 +0900 Message-Id: <1477921033-13584-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The UniPhier outer cache (arch/arm/mm/cache-uniphier.c) has 128 byte line length and its tags are also managed per 128 byte line. This is very unfortunate, but the current 64 byte alignment for kmalloc() causes sharing problems on DMA if used with this outer cache. This commit adds ARM_L1_CACHE_SHIFT_7 to increase the DMA minimum alignment to 128 byte if CACHE_UNIPHIER is enabled. There are several drivers that assume aligning to L1_CACHE_BYTES will be DMA safe, so this commit also changes the L1_CACHE_BYTES for safety. Having said that, I hesitate to align all the other SoCs in Multi platform to the UniPhier's requirement. So, I am disabling the CONFIG_CACHE_UNIPHIER by default, so that multi_v7_defconfig will still stay with CONFIG_ARM_L1_CACHE_SHIFT=6. With this commit, UniPhier SoCs will become slower, but it is much better than system crash. If desired, the outer-cache can be enabled by merge_config or something. Note: The UniPhier PH1-Pro5 SoC is equipped also with L3 cache with 256 byte line size but its tags are managed per 128 byte sub-line. So, ARM_L1_CACHE_SHIFT_7 should be fine for all the UniPhier SoCs. Signed-off-by: Masahiro Yamada --- KernelVersion: 4.9-rc1 arch/arm/mm/Kconfig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index c1799dd..f68e8ec 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -991,7 +991,7 @@ config CACHE_TAUROS2 config CACHE_UNIPHIER bool "Enable the UniPhier outer cache controller" depends on ARCH_UNIPHIER - default y + select ARM_L1_CACHE_SHIFT_7 select OUTER_CACHE select OUTER_CACHE_SYNC help @@ -1012,8 +1012,14 @@ config ARM_L1_CACHE_SHIFT_6 help Setting ARM L1 cache line size to 64 Bytes. +config ARM_L1_CACHE_SHIFT_7 + bool + help + Setting ARM L1 cache line size to 128 Bytes. + config ARM_L1_CACHE_SHIFT int + default 7 if ARM_L1_CACHE_SHIFT_7 default 6 if ARM_L1_CACHE_SHIFT_6 default 5