Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3424825ybi; Sun, 26 May 2019 23:10:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbF+O/NQx+TKEwsZPb6fvKDpJd00X5AHvEhxLEwLHiYXE3bMHpKhrx7KylQ3EYvnCUNZ0y X-Received: by 2002:a65:614d:: with SMTP id o13mr38064997pgv.309.1558937453686; Sun, 26 May 2019 23:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558937453; cv=none; d=google.com; s=arc-20160816; b=XhjW0LAGPZQef/JKMPcWMYp544cgzAHtqYE9J2mMQmRT/WckFpGfkeQwX6iPlg74Jc +jt6UjeaZULsFiOkRjwFdc9myV8Iz722EDzIjlhyQSBAoOWrEXahfNlkfgr5FIrQv8kw QodLE7upKmqn2D6nWt+cfGz02PgeadfBnAG+M3Q7jezwTclFYDI3Y16RPjF9+ycqB0t1 qMrcRcA6Mo9AottOmcdAhQLz7HrITzl2FV2TzLz47cQ2QboA8GAIgqwnDr/i8P3+9zOw +cn13AbUi3lyQx6vZ6HFaKMeRfS2Va8EQezAp0uo8uCf/KtX99Mvcy+/LkKPN6oAYKhQ Bsug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n+c094rUq1uwfqsWu/yM89OL5HYByhHlY0R+FbyhPgs=; b=j/DHf5Sjn1jeLLY6Xb4pHLZ8eTBsyWlmCQSDVxwpyLf5WTUbFSh4taP1G/PUep4QKT +g7aREIT1JzVBrw99dySJwPIF35q7yVyeEoZbuMWpS3wyZrQKnXMgYHVdpcQdrYB/0aJ v0ZPcB45CsyXRKGL8Y+y6gY7w8FFkMUgd/XK/4bv1JfYbXRVBGI90N1MB3UXgy74cUKR u1qs15WhrTz3L2HUnIEYtuW9XVuyIGAB7qHSX8T9yIfa7hhhM0J2CV+SHFFAsoc5W/dg zft/DWfuN02BmSp60/6wnO7ywl1KyGoEbq4b85I8kzI+pcIrqHV+A7i0hohICZaqdaHM Bx3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x743Qp7s; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w22si4928455ply.127.2019.05.26.23.10.38; Sun, 26 May 2019 23:10:53 -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=@kernel.org header.s=default header.b=x743Qp7s; 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 S1726096AbfE0GId (ORCPT + 99 others); Mon, 27 May 2019 02:08:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:36628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbfE0GIc (ORCPT ); Mon, 27 May 2019 02:08:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 68B6E2075E; Mon, 27 May 2019 06:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558937311; bh=whtFdsckGzCPEkaQlXnqUsZh6c2LH490Sb3G6lofpws=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=x743Qp7sU13eieitAhmmIsWD1+3gSc4TduX14oZisxlV6Aa6RK8T/hJiS3VxrZ9QR P1PmSH9O01f82B/AttB8RnGoXzbufqHoiuc8X5S9MWfkuvrG3TZDgIvOnjF0FpJWv+ yvbZ3EfZSeVuFlpF5YhQ1j3Qju0TffhuRqMRuRtQ= Date: Mon, 27 May 2019 08:08:29 +0200 From: Greg KH To: Shaokun Zhang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Sudeep Holla , Jeremy Linton , Zhenfa Qiu Subject: Re: [PATCH v3 2/2] arm64: cacheinfo: Update cache_line_size detected from DT or PPTT Message-ID: <20190527060829.GA8106@kroah.com> References: <1558922768-29155-1-git-send-email-zhangshaokun@hisilicon.com> <1558922768-29155-2-git-send-email-zhangshaokun@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1558922768-29155-2-git-send-email-zhangshaokun@hisilicon.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 27, 2019 at 10:06:08AM +0800, Shaokun Zhang wrote: > cache_line_size is derived from CTR_EL0.CWG field and is called mostly > for I/O device drivers. For HiSilicon certain plantform, like the > Kunpeng920 server SoC, cache line sizes are different between L1/2 > cache and L3 cache while L1 cache line size is 64-byte and L3 is 128-byte, > but CTR_EL0.CWG is misreporting using L1 cache line size. > > We shall correct the right value which is important for I/O performance. > Let's update the cache line size if it is detected from DT or PPTT > information. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Sudeep Holla > Cc: Jeremy Linton > Cc: Zhenfa Qiu > Reported-by: Zhenfa Qiu > Suggested-by: Catalin Marinas > Signed-off-by: Shaokun Zhang > --- > arch/arm64/include/asm/cache.h | 6 +----- > arch/arm64/kernel/cacheinfo.c | 11 +++++++++++ > 2 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h > index 926434f413fa..758af6340314 100644 > --- a/arch/arm64/include/asm/cache.h > +++ b/arch/arm64/include/asm/cache.h > @@ -91,11 +91,7 @@ static inline u32 cache_type_cwg(void) > > #define __read_mostly __attribute__((__section__(".data..read_mostly"))) > > -static inline int cache_line_size(void) > -{ > - u32 cwg = cache_type_cwg(); > - return cwg ? 4 << cwg : ARCH_DMA_MINALIGN; > -} > +int cache_line_size(void); > > /* > * Read the effective value of CTR_EL0. > diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c > index 0bf0a835122f..3d54b0024246 100644 > --- a/arch/arm64/kernel/cacheinfo.c > +++ b/arch/arm64/kernel/cacheinfo.c > @@ -28,6 +28,17 @@ > #define CLIDR_CTYPE(clidr, level) \ > (((clidr) & CLIDR_CTYPE_MASK(level)) >> CLIDR_CTYPE_SHIFT(level)) > > +int cache_line_size(void) > +{ > + u32 cwg = cache_type_cwg(); > + > + if (coherency_max_size != 0) > + return coherency_max_size; Ah, you use it here. > + > + return cwg ? 4 << cwg : ARCH_DMA_MINALIGN; Shouldn't you set the variable if it is 0 here as well? > +} > +EXPORT_SYMBOL(cache_line_size); EXPORT_SYMBOL_GPL()? thanks, greg k-h