From patchwork Tue Mar 26 06:28:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaokun Zhang X-Patchwork-Id: 10870441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15A1D139A for ; Tue, 26 Mar 2019 06:29:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F01252905F for ; Tue, 26 Mar 2019 06:29:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0AB52908E; Tue, 26 Mar 2019 06:29:51 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 550692905F for ; Tue, 26 Mar 2019 06:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=r6HYWdiQcERRLe2sD2tTPDcEW8RIyNOzd54nbkI6r38=; b=MPyy2nOBqXeKMm +ztnArWEl7MG7OxOkPswHKgpW8H8aFfdKFqsPcgSzNBi5yZYJ3IJtVSJFZWMDYJpLppMRVft/qtB2 leTdGZIyZZ8FQtJ6Iwi+C6X2j0gAM49NdHgNZb8ySoqlsSklHkagJuvlxDUaeyiOyhZgbhvlZqLOl haNmv78pXmG6OGIbbIXelNP8Yh0vHC52I1KMwr4W0SPZSjyAxKRrXv5qisIebhuj3+sddfQzigOb6 zDC39B1rfR0kN1alXamuEEEva8MvZkiNQV7VgTaIJPrejvYt1LBrqDSZsrI+sfBhxVf8kN6fi3aLE my0ys6WS9XxqT7dMpZag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8faf-0001yR-Er; Tue, 26 Mar 2019 06:29:41 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8faZ-0001xm-PS for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 06:29:38 +0000 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7E038176353626305ADE; Tue, 26 Mar 2019 14:29:19 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Tue, 26 Mar 2019 14:29:12 +0800 From: Shaokun Zhang To: Subject: [PATCH] arm64: cache: Update cache_line_size for HiSilicon certain platform Date: Tue, 26 Mar 2019 14:28:10 +0800 Message-ID: <1553581690-24753-1-git-send-email-zhangshaokun@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190325_232935_997992_1EE18EAE X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , John Garry , Will Deacon , Shaokun Zhang , Zhenfa Qiu , Hanjun Guo 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 For HiSilicon's certain platform, like Kunpeng920 server SoC, it uses the tsv110 CPUs whose L1 cache line size is 64-Byte, while the cache line size of L3C is 128-Byte. cache_line_size is used mostly for IO device drivers, so we shall correct the right value and the device drivers can match it accurately to get good performance. When test mlx5 with Kunpeng920 SoC, ib_send_bw is run under the condition that the length of the packet is 4-Byte and only one queue and cpu core: Without this patch: 1.67 Mpps with this patch : 2.40 Mpps Cc: Hanjun Guo Cc: John Garry Cc: Zhenfa Qiu Cc: Catalin Marinas Cc: Will Deacon Reported-by: Zhenfa Qiu Signed-off-by: Shaokun Zhang --- arch/arm64/include/asm/cache.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index 926434f413fa..0f7d9581e0b9 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -93,7 +93,12 @@ static inline u32 cache_type_cwg(void) static inline int cache_line_size(void) { - u32 cwg = cache_type_cwg(); + u32 cwg; + + if (read_cpuid_part_number() == HISI_CPU_PART_TSV110) + return ARCH_DMA_MINALIGN; + + cwg = cache_type_cwg(); return cwg ? 4 << cwg : ARCH_DMA_MINALIGN; }