Received: by 10.223.185.116 with SMTP id b49csp4176134wrg; Tue, 6 Mar 2018 11:03:25 -0800 (PST) X-Google-Smtp-Source: AG47ELvN2A42v5B//bHKoi+Uxq+NGEolpJExvw+FN5lAgV4xzGq+wfznLuHSItnjGnI0ld3kOaSc X-Received: by 10.99.167.66 with SMTP id w2mr15840107pgo.357.1520363004951; Tue, 06 Mar 2018 11:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520363004; cv=none; d=google.com; s=arc-20160816; b=B6oq7GlSUE2L5EhxIMk+xqMugVVwnd23ogrhkgh1DNKdwskA675F3bwo8rRdhHe03k mEh/oZUedfb2SDi3SF1xJHXWxMtTrCydC0nt6y/cNTlL2HmJY2zjP+kcpi2/qZ8S3zF0 nTsS/ROE8XrFL/9Bd7IMjDAsXAgjiHV2tPNke0fazLCvmMfqDz6Qp1JSFfHzQJedUcwM VEAhu/JkmSuS0Hg7koH8HjqXH6K3lpMjO9u2eEb1uAEeDjVP4tmtMcAAxqCsxtsWuigl tWPmNtNyQCUxMjIXbGj0SBPj/faNcf3fH7OuhE06W9WVSnU5vtzdhtjwth2elUkWOvpC s7WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=K0iCJ+RShBShTfnjrFkl34eGYURbSSwStF+PpoSIb4U=; b=wojsy/SqLluuUnWxD51N7kT7pGTNkwNaWr1uik7aLh3OfHYL0jziNfLOqI3nwv7JFI 36cGMXrb5+7n3k9UJaqvU8nVw6zJw2DP21mXpzo39NdWwf0NTzeiXcIYVeogeqHfgxUB kqO8NQGxwHrRwl1sFHC2+znfub2AXln2iyjX7IC6m9OKoga/dlSzKAjDbjQOUSo3ji2W Nb3PF0ZqwuKjpzDs5pVu3SABp8dZoGSc978IGnZj4X0AbsK3y50UGEO6tdWZvmSefFpZ OmkMH3XNbsnmvOJLMU5ZG92/OIUBMtRlXRrXeOThuJiaKFJbnFkG1rYt/fwkJB20ODLN 8WYg== 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 o61-v6si11448186pld.692.2018.03.06.11.03.10; Tue, 06 Mar 2018 11:03:24 -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 S1753926AbeCFTCJ (ORCPT + 99 others); Tue, 6 Mar 2018 14:02:09 -0500 Received: from anholt.net ([50.246.234.109]:58660 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932078AbeCFTCH (ORCPT ); Tue, 6 Mar 2018 14:02:07 -0500 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id DEBA010A13BE; Tue, 6 Mar 2018 11:02:06 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1cvHtx9STcIl; Tue, 6 Mar 2018 11:02:05 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 4AA9510A060E; Tue, 6 Mar 2018 11:02:05 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 8C5472FE2D33; Tue, 6 Mar 2018 11:02:04 -0800 (PST) From: Eric Anholt To: Stefan Wahren , Florian Fainelli , Mark Rutland , Rob Herring , devicetree@vger.kernel.org, Greg Kroah-Hartman , Phil Elwell Cc: linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/5] staging: vc04_services: Remove cache-line-size property. In-Reply-To: References: <20180305202806.21219-1-eric@anholt.net> <20180305202806.21219-3-eric@anholt.net> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Tue, 06 Mar 2018 11:02:04 -0800 Message-ID: <87muzl9ger.fsf@anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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_283= 5_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 { >> }; >>=20=20=20 >> static void __iomem *g_regs; >> -static unsigned int g_cache_line_size =3D 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 *pde= v, VCHIQ_STATE_T *state) >> if (err < 0) >> return err; >>=20=20=20 >> - err =3D 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 =3D 2 * g_cache_line_size; >> + g_fragments_size =3D 2 * cache_line_size(); >>=20=20=20 >> /* Allocate space for the channels in coherent memory */ >> slot_mem_size =3D PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); >> @@ -548,9 +539,9 @@ create_pagelist(char __user *buf, size_t count, unsi= gned short type) >>=20=20=20 >> /* Partial cache lines (fragments) require special measures */ >> if ((type =3D=3D 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; >>=20=20=20 >> if (down_interruptible(&g_free_fragments_sema) !=3D 0) { >> @@ -598,10 +589,10 @@ free_pagelist(struct vchiq_pagelist_info *pagelist= info, >> g_fragments_size; >> int head_bytes, tail_bytes; >>=20=20=20 >> - head_bytes =3D (g_cache_line_size - pagelist->offset) & >> - (g_cache_line_size - 1); >> + head_bytes =3D (cache_line_size() - pagelist->offset) & >> + (cache_line_size() - 1); >> tail_bytes =3D (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=20 > work. I always thought that we need the cache line size of L2 not of the= =20 > L1 one. > > Did you already test the behavior for these combinations? > BCM2835 ARM32, expected cache line size =3D 32 > BCM2836 ARM32, expected cache line size =3D 64 > BCM2837 ARM32, expected cache line size =3D 64 > BCM2837 ARM64, expected cache line size =3D 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=3D=3DL2 cache line size this should be a safe assumption for us. Phil, any opinion? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlqe5awACgkQtdYpNtH8 nuiVIg/7BCR/T2KYUbPO4Og6lrzuDe3pu4wWtwKytbBiYK5CtBAawnguegrB5Waa IK3dS/w5c0kLgAZf3kezgW2DvrsYiqyXSR9X00icc/c4parhNq6bntr0i3MsUnHA 13EGee0xI5GXkZXvH6ZNuSY7QtuEuexdaQkBDPQj8WkJeZ9uSzBSwaReyhsZqRWl RKhxmiBBsx5aaUmRHMlPyvYiMDItVwVSLEkUiKIY1Gw3+OtUUXii/xMPlkx2Py7b bcX5q+CeB2f7xa6nv0Dvpn+47Q+a6K8nCumShEHUK+zywh9tlMeRqYWaJ18YxxkJ kci1c+VuHFHMt05dkuiklxf3+7PLQr92IlKFW02svAFz5C/q6ufwPtm7QxRKe8G1 VTVBnmpp0Hoc06Pci1xcKf5VXIoZb024FH6evWqlvXWeXp9KQAKKFRvlP/VTZNo9 x2BajQ+9yJrjSViIZmTPqQB3kz5LYt2URIhRcQ7XR1jECqTfnuFLBlHblLqRHUCG UjhCfmdwpC+s1gPcsGbWHdQ8Pw9GvMUTi4/AS5RHQoTj8GizXzBDazL58XnJQC4K vSr0DkVyDAgpGfiUbch4LV15TLsKMecO3MT9eKDYBxybYD/36Me447ssBLVBYKdi RwfAOMfM9KW2V+1Y7qq0FbatMJ3AYa4E7qX1tydMi7iyTbLFsLk= =5IJ2 -----END PGP SIGNATURE----- --=-=-=--