Received: by 10.223.185.116 with SMTP id b49csp4768617wrg; Wed, 7 Mar 2018 00:11:27 -0800 (PST) X-Google-Smtp-Source: AG47ELviSwxsCrBGigzqalcu1y20pj6ajzP61E2ci4KCpuLfvr4Ce8T3m4r0o8IDWcPOz9HwNzZa X-Received: by 10.101.85.71 with SMTP id t7mr17394669pgr.386.1520410287711; Wed, 07 Mar 2018 00:11:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520410287; cv=none; d=google.com; s=arc-20160816; b=vKdRCxKG2coqA6NUvxkmb/+0LE0qGOd2lXZL6bSn6aWv7zp/IKAF0u2T2S4JfUGP4O NCANXyjDz25BtBI8pfvOId1BhXlyvnJJakxnYaniElpbCSYf3owtsOqChlMzKJpdjE9g /RciEgfqknc4V2UAwLUpkX03Q++oLQ3CpREioIV7oqfcXxfso8o4LopJo0e8NvnypLsA pB24hKneboGWYf+FmrRFXWXaS55NY4xrs7O2f1NOLJBMfRfGWJx3qlNtpeM1TDUkGDj2 0oLzeB/v9+4lwPWdsbJkba9fTTT2kc2DBaSLjQdAtxz2Mt17U4VG9RuzMZZuwcoIyfKe CT2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:dkim-signature:arc-authentication-results; bh=luSs04f2W7nQXtHlT82IJAf9w3Y4WchwfSLY+lizG4w=; b=UJ2M17yaXDPEY83G388qODF7PZFICNYAjIrZaZBh+F29h91aAZmqErkOS1qjPAdbo9 6hFEq5npnkXixo/KlXvwTkfnxS+XdWWV2UIAYywYSwL3nmXjpAM+veDYiA/9bIMlYWI8 shTS3FYnETkOvQqfbqf6BLyU98LkCmdta37LKb3VVmAW4r4spXL31QCKpYPMiOjLj1S/ p3iom8AppIVE77Q48qyPPs/B8v+EptN5RFtzlCppMNUU9LsAjYcIGW0a36Mot9ZQK58m EkTdzVxa6ZusyfBb0X1z5nxwVL/qlITfJiARP233iJ9uJnZ1IOly+jZRLfHV7fZk+C0Y h4NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@raspberrypi.org header.s=pp header.b=rwY59/QL; dkim=pass header.i=@raspberrypi-org.20150623.gappssmtp.com header.s=20150623 header.b=OYMh41kO; 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 x12si11063038pge.263.2018.03.07.00.11.12; Wed, 07 Mar 2018 00:11:27 -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; dkim=fail header.i=@raspberrypi.org header.s=pp header.b=rwY59/QL; dkim=pass header.i=@raspberrypi-org.20150623.gappssmtp.com header.s=20150623 header.b=OYMh41kO; 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 S1751176AbeCGIKJ (ORCPT + 99 others); Wed, 7 Mar 2018 03:10:09 -0500 Received: from mx08-00252a01.pphosted.com ([91.207.212.211]:41850 "EHLO mx08-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbeCGIKH (ORCPT ); Wed, 7 Mar 2018 03:10:07 -0500 X-Greylist: delayed 442 seconds by postgrey-1.27 at vger.kernel.org; Wed, 07 Mar 2018 03:10:06 EST Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) by mx08-00252a01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2782hAA006954 for ; Wed, 7 Mar 2018 08:02:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp; bh=luSs04f2W7nQXtHlT82IJAf9w3Y4WchwfSLY+lizG4w=; b=rwY59/QL9ykVTRY6t/vOkqnhXvYjPlvZaDhbbiZoNG7EugSiAGExN58kigpPJ6Jf0M+r Vf6Le6Z4Z5ogimLkCBFSoJj028O6EidsyWlNo49C+uFg81llpCFokG18ruDNAU/3NXod gd2/8Whx2tR2WWGlNsZc6wvqtkUrl35/zIinXREBBKCswMu8KFqS+1iHeRKKgPPUps80 zuoD5W/zA8EhbYtVfHTf01lJipI/9yAWGBb/Z/cCbNG5PdMLPAqlvCX3m7GdnGiCpz68 u9drkQpnrddqNyOqJu/UgSboZas5IL76B0ub82VnvtUrFJTBi23Acrq8gfXB9/cb2IPF TQ== Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by mx08-00252a01.pphosted.com with ESMTP id 2gfh2k9y2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Wed, 07 Mar 2018 08:02:43 +0000 Received: by mail-wr0-f199.google.com with SMTP id q15so776796wra.22 for ; Wed, 07 Mar 2018 00:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=luSs04f2W7nQXtHlT82IJAf9w3Y4WchwfSLY+lizG4w=; b=OYMh41kO+y3heWdErTVl9arbS4EUtnAWmuf2nSnA1Hol+0SCSIbL8CAYsYThWDOQYQ DydX8hl98UFKfBNrZpAORrYTYCqYqGzujy5nj3LN92HdFyCXJia1oOZFlAo4zRDIVAwK +IwXEtje9/k4KiKwM56Bc44lP8CBnX+CmPASyQ4VRA3XimbDNBbDCSfR8N4PAZMf+6UW xAscjOoAITcx3SDQeIbw5NMIAhpErCxx3ku/3AuH6GuUBfNZtBIBhkH8GH6PO2TU/zgt mbCkmJ8O7Q7w5F7AyMvK+tESHrRfvJfvp7CLvaAEJ1Phnv6UEoG3sYvBBFz+OFIl5zl6 6ONw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=luSs04f2W7nQXtHlT82IJAf9w3Y4WchwfSLY+lizG4w=; b=PQPnPSlo0hK3QcCywaA6T/o7lDdoVqpCM4GBLMzOWUmgWCB0MS44+HphjU3yfDoJlM 33K//cHavOfEutDgfcqeuUZFsPqJavjp4wDpdbLrL20c1FAxynCkEYPzuFPqCWk6S6PP XNiVlw83K1k6O9izkgfbrrGWDI/eHCPAOpsNx8XHEqgPBWJtmDFfK++5mbzjTR0uoa1v 3QJiy02D5k4zhA8wA6scZj7uwOiZtj9jG1z33sWDb3L20Ekalne2/6wP7Vjwy9M6wxV+ Zv7E+YglnsnVQjKlUQUoru2bOgYkTASf5G1djLXvJh+HKDmRcfb3USXbBW7LipGyTmO3 jQmA== X-Gm-Message-State: APf1xPC+MVlsUHZpwDQU/y2VnINTAlBfELY+1ejfmp5xzw2QmUWDu2OM qYRU7eIYJ58Cm+qGEd33F2G61G3Z56Qt3taJ+95pIfO196jpe2xNK0BLjHyTGYWJOSZylF1WQt9 /cNILnIxvEcbqpD12GzqFcvJO X-Received: by 10.223.189.136 with SMTP id l8mr19768159wrh.69.1520409762843; Wed, 07 Mar 2018 00:02:42 -0800 (PST) X-Received: by 10.223.189.136 with SMTP id l8mr19768141wrh.69.1520409762567; Wed, 07 Mar 2018 00:02:42 -0800 (PST) Received: from PhilsPB.local (cpc128070-papw8-2-0-cust244.know.cable.virginm.net. [86.12.27.245]) by smtp.gmail.com with ESMTPSA id z3sm14109401wme.3.2018.03.07.00.02.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 00:02:42 -0800 (PST) Subject: Re: [PATCH 2/5] staging: vc04_services: Remove cache-line-size property. To: Eric Anholt , Stefan Wahren , Florian Fainelli , Mark Rutland , Rob Herring , devicetree@vger.kernel.org, Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20180305202806.21219-1-eric@anholt.net> <20180305202806.21219-3-eric@anholt.net> <87muzl9ger.fsf@anholt.net> From: Phil Elwell Message-ID: <638bd870-bb17-a0e1-d2aa-30a364b53279@raspberrypi.org> Date: Wed, 7 Mar 2018 08:02:49 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <87muzl9ger.fsf@anholt.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-07_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Phil