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: 9405473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7FCA960234 for ; Mon, 31 Oct 2016 13:38:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A90629269 for ; Mon, 31 Oct 2016 13:38:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E014292B8; Mon, 31 Oct 2016 13:38:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09EB229269 for ; Mon, 31 Oct 2016 13:38:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1Ckq-0007JK-8A; Mon, 31 Oct 2016 13:36:00 +0000 Received: from conuserg-11.nifty.com ([210.131.2.78]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1Ckk-0006jc-Kj for linux-arm-kernel@lists.infradead.org; Mon, 31 Oct 2016 13:35:55 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161031_063554_975246_D73858D7 X-CRM114-Status: GOOD ( 11.20 ) 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: Mark Rutland , Jonathan Austin , Arnd Bergmann , Ard Biesheuvel , Linus Walleij , linux-kernel@vger.kernel.org, Russell King , Masahiro Yamada , Zhaoxiu Zeng , linux-arm-kernel@lists.infradead.org, Kees Cook MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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