From patchwork Fri Mar 9 18:44:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10271699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 47CC86016D for ; Fri, 9 Mar 2018 18:47:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3313D29A2E for ; Fri, 9 Mar 2018 18:47:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27D7C29A46; Fri, 9 Mar 2018 18:47:59 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable 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 B9FA029A2E for ; Fri, 9 Mar 2018 18:47:58 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=IgChmaHc3MGZwg49t04ll+zbrO4puqLVr2dlCA10mi4=; b=Yh5b9i/lcC1qsH5sX9zeCUEpa1 GuFp+BZCgh1f1HpX8WVZJoRpvFXaK3jouGIBAl4ogC2IXgCFhzlTaJEy4z1xV5oQMpEYT6/2JQMmW kJMagckXMeswJXNjRyc0Kow4b8QEgLdwt2KBVF9WPtU0vdo9MbwE2j6GctASwPyBNUS4RsuMAk9dH 3qrusN1/sqTmtOHttZKZh2V8gcbxWxd5WTEBZS5qL1yRzthBHEZ+sB/e8y3tO3IdwdJM4c999NW7I XgKzgZSHf/mXv0dWpR/lPn/Gn4Z5QaxhMIaVd7SCcetr/D63GPN25hynSM12/HRe0jy0GLHKaVpSB UmnMlQHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euN3Y-0004Sy-Dv; Fri, 09 Mar 2018 18:47:52 +0000 Received: from anholt.net ([50.246.234.109]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euN0K-0001VG-Ui; Fri, 09 Mar 2018 18:44:37 +0000 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 2786510A1502; Fri, 9 Mar 2018 10:44:22 -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 Zcq_yUuOx6pN; Fri, 9 Mar 2018 10:44:18 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 4FFFD10A1549; Fri, 9 Mar 2018 10:44:18 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 142F42FE2D44; Fri, 9 Mar 2018 10:44:17 -0800 (PST) From: Eric Anholt To: Florian Fainelli , Mark Rutland , Rob Herring , devicetree@vger.kernel.org, Greg Kroah-Hartman , Phil Elwell Subject: [PATCH v3 2/6] staging: vc04_services: Remove cache-line-size property (v3) Date: Fri, 9 Mar 2018 10:44:13 -0800 Message-Id: <20180309184417.23368-2-eric@anholt.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309184417.23368-1-eric@anholt.net> References: <20180309184417.23368-1-eric@anholt.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_104433_303319_870CEE8F X-CRM114-Status: GOOD ( 14.23 ) 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: Stefan Wahren , linux-kernel@vger.kernel.org, Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 It's been tempting to replace this with (L1) cache_line_size(), but that's really not what the value is about. It's about coordinating the condition for the pagelist fragment behavior between the two sides. However, the property was not accepted for the upstream DT binding, so we have to use the firmware's fallback value. Signed-off-by: Eric Anholt --- v2: Kept the property but added documentation. v3: Remove the DT property again, more documentation. .../interface/vchiq_arm/vchiq_2835_arm.c | 20 +++++++++++--------- .../interface/vchiq_arm/vchiq_pagelist.h | 1 - 2 files changed, 11 insertions(+), 10 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..afdd3e944f3f 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,17 @@ struct vchiq_pagelist_info { }; static void __iomem *g_regs; -static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); +/* This value is the size of the L2 cache lines as understood by the + * VPU firmware, which determines the required alignment of the + * offsets/sizes in pagelists. + * + * Modern VPU firmware looks for a DT "cache-line-size" property in + * the VCHIQ node and will overwrite it with the actual L2 cache size, + * which the kernel must then respect. That property was rejected + * upstream, so we have to use the VPU firmware's compatibility value + * of 32. + */ +static unsigned int g_cache_line_size = 32; static unsigned int g_fragments_size; static char *g_fragments_base; static char *g_free_fragments; @@ -117,14 +127,6 @@ 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; /* Allocate space for the channels in coherent memory */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h index a6c5f7cc78f0..bec411061554 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h @@ -34,7 +34,6 @@ #ifndef VCHIQ_PAGELIST_H #define VCHIQ_PAGELIST_H -#define CACHE_LINE_SIZE 32 #define PAGELIST_WRITE 0 #define PAGELIST_READ 1 #define PAGELIST_READ_WITH_FRAGMENTS 2