From patchwork Wed Mar 7 18:57:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10264697 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 E0912602BD for ; Wed, 7 Mar 2018 18:59:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D195528995 for ; Wed, 7 Mar 2018 18:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5CC02966D; Wed, 7 Mar 2018 18:59:08 +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 3729228995 for ; Wed, 7 Mar 2018 18:59:07 +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=XroXzY311kcSRAqMBSXxQ2JeSI5bxLoO/B6T8J1gcWs=; b=MlnYd94Or84MDhVdqP/PGKLsX+ hquDUV8MFQOWa0GFo6/590ZGwQy6m+4s6/7WAb2h5rOZgf3HBLnBUc7nxsxSxR0SVwSTlWiHqeuyJ jdd6m2ezguoJ/s4+FplbAcnahoBSUzD78DU+zNFFFMTI/AL5jzSgmPTWUYc6xDIugGw3B7vnhRYwW Ufaztj58Ey0PMHLaVl+6KxS2Lcv+xyyLU9Atlo/v1dYZBMb5fzAnoTOMLW0CppFUjpkOIhfPljJdx wG8LlAKOdw3n91FeO2YXnhAVr2eJm/DIfo2dh59rYGJJv7uDA91RJChZKl41S7MEiyLMk7d3NJVie mcm28c1A==; 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 1eteH9-00077i-F6; Wed, 07 Mar 2018 18:58:55 +0000 Received: from anholt.net ([50.246.234.109]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eteFo-0006Op-Ue; Wed, 07 Mar 2018 18:57:37 +0000 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id CFDBD10A14DA; Wed, 7 Mar 2018 10:57: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 KCWr_2zVlkRb; Wed, 7 Mar 2018 10:57:21 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id F2E5D10A14F4; Wed, 7 Mar 2018 10:57:17 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 4BD8F2FE2D44; Wed, 7 Mar 2018 10:57:16 -0800 (PST) From: Eric Anholt To: Florian Fainelli , Mark Rutland , Rob Herring , devicetree@vger.kernel.org, Greg Kroah-Hartman , Phil Elwell Subject: [PATCH v2 2/6] staging: vc04_services: Add comments describing g_cache_line_size. Date: Wed, 7 Mar 2018 10:57:12 -0800 Message-Id: <20180307185716.17449-2-eric@anholt.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307185716.17449-1-eric@anholt.net> References: <20180307185716.17449-1-eric@anholt.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180307_105733_150653_4B35FFD5 X-CRM114-Status: GOOD ( 12.89 ) 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. Signed-off-by: Eric Anholt --- v2: new patch to replace the cache_line_size() patch. .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++++++- .../staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h | 1 - 2 files changed, 9 insertions(+), 2 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..3aeffa189f64 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,11 @@ 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. + */ +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,6 +121,10 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) if (err < 0) return err; + /* Get the L2 cache-line-size as set by the VPU. If the + * property is missing, then the firmware assumes an older + * kernel using a 32-byte cache line size for compatibility. + */ err = of_property_read_u32(dev->of_node, "cache-line-size", &g_cache_line_size); 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