Received: by 10.223.185.116 with SMTP id b49csp4963598wrg; Wed, 7 Mar 2018 04:12:58 -0800 (PST) X-Google-Smtp-Source: AG47ELtvKS+dFT61ScTcqT8+D71LLVhiFUW3kmFKainwQ2YrthbqNYziYZpGP/Qy5IR9MSk3bfaP X-Received: by 2002:a17:902:b43:: with SMTP id 61-v6mr20825353plq.270.1520424778634; Wed, 07 Mar 2018 04:12:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520424778; cv=none; d=google.com; s=arc-20160816; b=qNi9TOqrcsOjCoMdj+t4/ro9WUF5j8Vp1+iEA3pIQPuUq16WhWPoVt6knoW1+pWaoL va3cK63W4PCRbXaNATgpw0LbHawdRoW68mQA/jo0vNb9nonI/8n7x8N0qwvBIZW/afAu Yd26ogCZZHSXoJgd0u8ZXwxZ7SP/A0jD7CFXHzg7At5ArMXmuatcyb+O0dl/Fh9tKVIP O+WYh1Dz4IoLUddtcdJUqaceZ8dMQWQ+ZVKFxYYCQ1JnHAYZhUrpRd8/D8YSTWQnCddZ A8TWo1dBeRrxamY8lVZD/wz3284WJNFNB6836pTtAMse5WU5BD0IiDTZwnUOkILGrwCK ws+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:arc-authentication-results; bh=ZR+DI0pCy7s4vm5XOCV/StP93ko8ysy04BD17wVvS1g=; b=QucJCUNmcmVz4jrMAh0gGn04AeGT/d2Xn8+fa8zHKSuWjOZkcMz2h7j7B4kpB4Rjcp c8qcX3mbMkGf9cqAEmovTRgpDmc/qgrH8MANUhSMy8uXQ+pU+1WE+/lu1IhvDO5OrqYk bNmBbEeNFfWBp/njvxm+VeatP07yEUIBEmiGFci/M77K5Q5EceyDvJgnT+zVe0qlGRKZ PiT2WWT/kxtHGh87amCQrOFgO+a2OEJYDkKlmiryQxfB5gfkEblZcqXJTWZkjWQQhrYe 8vBQT+qFx/808SlU3MBamJhNfbI9oPJl7F/5XYhHRKb4Qgz7WO36dhKv/DW5cLxq2WFm JKfg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si12842711plb.601.2018.03.07.04.12.44; Wed, 07 Mar 2018 04:12:58 -0800 (PST) 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; 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 S1754395AbeCGMLn convert rfc822-to-8bit (ORCPT + 99 others); Wed, 7 Mar 2018 07:11:43 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:54563 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754333AbeCGMLg (ORCPT ); Wed, 7 Mar 2018 07:11:36 -0500 Received: from null ([172.19.246.44]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MIlvk-1erM2a1wfw-002FA1; Wed, 07 Mar 2018 13:10:32 +0100 Date: Wed, 7 Mar 2018 13:10:30 +0100 (CET) From: Stefan Wahren To: Rob Herring , Florian Fainelli , Eric Anholt , Mark Rutland , Greg Kroah-Hartman , Phil Elwell , devicetree@vger.kernel.org Cc: linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-ID: <1332781939.275857.1520424630939@email.1und1.de> In-Reply-To: <638bd870-bb17-a0e1-d2aa-30a364b53279@raspberrypi.org> References: <20180305202806.21219-1-eric@anholt.net> <20180305202806.21219-3-eric@anholt.net> <87muzl9ger.fsf@anholt.net> <638bd870-bb17-a0e1-d2aa-30a364b53279@raspberrypi.org> Subject: Re: [PATCH 2/5] staging: vc04_services: Remove cache-line-size property. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev22 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K0:vusHja4DW60gCRotraaJUea26LNvfq/yxPduER/yzyzQFbzLXVw hAda2+Vcsfc+xCT7dyw7w/a5/Or5v8fPQcUOK+BFNgSKZkJ+sCldOkuxVCJwF+hFzwwZrsc DcKrDNyqQ4U3XanRwokRwuLz9ckpAfGtre+B7B4WZ3m3X3BePdS1c18bL+UH+V8s5bps3TS b1tdSilNK7vNn15MqSOYA== X-UI-Out-Filterresults: notjunk:1;V01:K0:zJUSCRdsQjk=:5Q+EIuOlblC18h13wPlHNU 8mA8AOTg5aeg118fqAJWXtWXLx+7ulSA9J7Ca8360zCiuaLFAj7id3QILF0UDDkjELTiutge2 gud4AM5jJEvmy5cvYuY/VdOigKQyYSqhQIlHpQkB/zinVi7q7PE1+FQvPeG6TwTyIyFi8WBV3 J3FI+3vrhiwq0gb5XzGKbbrmHoOXW2uNNHmydDpkFV00P6Xq+fZUWGjfyhk0xRF0jT5keeFJk blvjhWfphgbmPcYZqm9o2wIHI9SE0DhxlWipteh/dFOLQ4AdjINwFCKPg0GH4nbiGEUQAcVrl ON4DNiLZ4GFkwdCFbOOHCGwjJ/rg0LrUcx5nf4/F2YJs5J58srexWUpBCviSdBroj67Sj65Wp ScOTQVkDHhzfU7n2C2uKfnNonDet23LsO58AUA7bTZ+kWkKBhRtU0gaASrY7zqPtqlfAq7MVZ qtmCpiTCM0obU1iXi8M1pP/iq6FFUVwD9mq7/WUIAEEtHozpvogaGGfqWbXeHFSYR0LWCVdPA haDSyeM37os0r2BNgjDwQyt15PfqYw3eGrLG7tphzyibhi3mLnDiOkLwSkPAWdV+9866S8yjO PE8Div8n1U7KWoG6jonuKEfHhAnby7KxyU84zJdmSoCskdjTtX0nLKDIjtujFUiaGx2VNANhA RzGBjuyPR2x0YAQEY6gc2fzFDMVhezdpcMwFdYX6n05or4RWgXJKd4R/USgwym22s56Eg0een M97OpxpInyENTZiRIqHLSwhh3xkgiTqEivFzIidz7XT823A/iawE/dG875M= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Phil, > Phil Elwell hat am 7. März 2018 um 09:02 geschrieben: > > > Hi Eric, > > On 06/03/2018 19:02, Eric Anholt wrote: > > Stefan Wahren writes: > > > >> Hi Eric, > >> > >> > >> Am 05.03.2018 um 21:28 schrieb Eric Anholt: > >>> This was just a way for the DT-passed value to get out of sync with > >>> what Linux has configured the ARM for. > >>> > >>> Signed-off-by: Eric Anholt > >>> --- > >>> .../interface/vchiq_arm/vchiq_2835_arm.c | 25 +++++++--------------- > >>> .../interface/vchiq_arm/vchiq_pagelist.h | 1 - > >>> 2 files changed, 8 insertions(+), 18 deletions(-) > >>> > >>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c > >>> index b59ef14890aa..e0e01c812036 100644 > >>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c > >>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c > >>> @@ -77,7 +77,6 @@ struct vchiq_pagelist_info { > >>> }; > >>> > >>> static void __iomem *g_regs; > >>> -static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); > >>> static unsigned int g_fragments_size; > >>> static char *g_fragments_base; > >>> static char *g_free_fragments; > >>> @@ -117,15 +116,7 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) > >>> if (err < 0) > >>> return err; > >>> > >>> - err = of_property_read_u32(dev->of_node, "cache-line-size", > >>> - &g_cache_line_size); > >>> - > >>> - if (err) { > >>> - dev_err(dev, "Missing cache-line-size property\n"); > >>> - return -ENODEV; > >>> - } > >>> - > >>> - g_fragments_size = 2 * g_cache_line_size; > >>> + g_fragments_size = 2 * cache_line_size(); > >>> > >>> /* Allocate space for the channels in coherent memory */ > >>> slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); > >>> @@ -548,9 +539,9 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) > >>> > >>> /* Partial cache lines (fragments) require special measures */ > >>> if ((type == PAGELIST_READ) && > >>> - ((pagelist->offset & (g_cache_line_size - 1)) || > >>> + ((pagelist->offset & (cache_line_size() - 1)) || > >>> ((pagelist->offset + pagelist->length) & > >>> - (g_cache_line_size - 1)))) { > >>> + (cache_line_size() - 1)))) { > >>> char *fragments; > >>> > >>> if (down_interruptible(&g_free_fragments_sema) != 0) { > >>> @@ -598,10 +589,10 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, > >>> g_fragments_size; > >>> int head_bytes, tail_bytes; > >>> > >>> - head_bytes = (g_cache_line_size - pagelist->offset) & > >>> - (g_cache_line_size - 1); > >>> + head_bytes = (cache_line_size() - pagelist->offset) & > >>> + (cache_line_size() - 1); > >>> tail_bytes = (pagelist->offset + actual) & > >>> - (g_cache_line_size - 1); > >>> + (cache_line_size() - 1); > >> > >> should it be so easy? Back in 2016 we said that cache_line_size() won't > >> work. I always thought that we need the cache line size of L2 not of the > >> L1 one. > >> > >> Did you already test the behavior for these combinations? > >> BCM2835 ARM32, expected cache line size = 32 > >> BCM2836 ARM32, expected cache line size = 64 > >> BCM2837 ARM32, expected cache line size = 64 > >> BCM2837 ARM64, expected cache line size = 64 > > > > I didn't explicitly test, but was going by: > > > > config ARM_L1_CACHE_SHIFT_6 > > bool > > default y if CPU_V7 > > 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 > > > > and only L1_CACHE_SHIFT_7 gets selected by UNIPHIER and neither one is > > accessible by menus. > > > > I think you're technically correct that it's the size of L2 that matters > > (or, specifically, the hardcoded value that the firmware is using on its > > side for the fragments list handling. It overrides a cache-line-size DT > > property with that number if present). However, I think L1==L2 cache > > line size this should be a safe assumption for us. > > > > Phil, any opinion? > > It is the L2 cache line size that matters, but as long as you end up with > the numbers Stefan mentioned - 32 on BCM2835, 64 on BCM2836 and BCM2837 - > I'm not too bothered how you get there. i think a kernel with bcm2835_defconfig on RPi 2 could be such a corncase. Am i right that the firmware doesn't rely on the existence of "cache-line-size"? Btw it would be nice to get fixed the corruption on ARM64 [1]. Stefan [1] - https://github.com/lategoodbye/rpi-zero/issues/23 > > Phil > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel