Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25349998rwd; Sun, 2 Jul 2023 15:52:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEoyunlJJ4gqoj+Gm8bwAXMHo1EaUeasyR8gSJz4j8ymydg0K+0SLs28yrRGNMUiCqWqOlz X-Received: by 2002:a17:903:22ce:b0:1b8:4ec2:5200 with SMTP id y14-20020a17090322ce00b001b84ec25200mr9124160plg.2.1688338327996; Sun, 02 Jul 2023 15:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688338327; cv=none; d=google.com; s=arc-20160816; b=sqkHLGXMN+yaB2xx2Z5hek+/HVuXi7171p/9f/831lcEcWPdqEpk1tHsHe5ahNfOvE t08PUt9zq6cwTz+6vvM6VVAMqY0gstc7UdfIfnIyqhTuz2P9Zupeg0mPRSrz7veGvs6r u3Ns4eOs01A924Zx6+kqZclZuX88zsgL9Ln9urDu4XCU2/96/I2SQQY3C7dbBrfu4aTn fcCoDxd6jfdXywhDwhAIAkkTWt0ebR3yGZSi7MjOv49qJmKIdVQ1Qy5fIODlFm759ujM 5bYBLwrs4BZH8fb7H6NClluK1rN5sbLfOHvsJjIK4UEQh1b1IsaQl4kC7AXuknMFHUzg kUrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EccncNEIPvTq5ZLKRiBzsj327H73VoG71hEIf4reNtI=; fh=+n5AWP6HiCRPxVY6KWNt4bDuxdsuI0DB7R1AeJ+ngLQ=; b=IVGBjFrWmDfOsaR1avQKrKLxvS+cSDD/aRiGAprMyQLIsyBhW00rgEdOQTfBCYIlvr 23uhx+f0A/ozJlESMz/SN8BbHK0pckxQYuW8ueRaiKGt3dFHltm6ey3UtNWTAhQVUF7P C+nGr91uLyaD9iyAj0g3VAws7HSyMQgGhWGt4hsa0WvInd/P0dbjZiHFrehifH5YDj0T tx9RAReY1YemCMZNj/gO++LV2UoPX4RSVpofSMdVUbk2lFxkuxsd8hsom4HxJpwS4F1q WCnwoPXBbpMJNV84JdxcPYsU5DcbD6wzfDVLwlle86Vl+gXyMx6ge6LraeN8DKRHRLft QPfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PiOCpW9o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a1709029b9600b001aae1eefc9bsi15973187plp.238.2023.07.02.15.51.55; Sun, 02 Jul 2023 15:52:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PiOCpW9o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjGBWdB (ORCPT + 99 others); Sun, 2 Jul 2023 18:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjGBWdA (ORCPT ); Sun, 2 Jul 2023 18:33:00 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E08E49; Sun, 2 Jul 2023 15:32:59 -0700 (PDT) Received: from ideasonboard.com (85-160-45-219.reb.o2.cz [85.160.45.219]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5B7A36DE; Mon, 3 Jul 2023 00:32:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688337135; bh=5sny6CY4ssurgOhg9dEm+wJ9LPpiuE4sHpxZ2EjTn8Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PiOCpW9o3ljZWU3eadw0kKEZ6zf5KRhnMDZdLpUJLvRJQ8XdPp68XDDeQSd1hY9tW SGwEx/alQa7/E1TVw5ylOb9UA6/dtIgf+gq6WWh3OCUqOlijbRXXfIDcVTbIXXbsEW E1NfxjNE7dTA2gH5aildxC8tiPQZbXuPHF22LSIQ= Date: Mon, 3 Jul 2023 00:32:54 +0200 From: Jacopo Mondi To: Petr =?utf-8?B?VGVzYcWZw61r?= Cc: Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "open list:SUPERH" , open list Subject: Re: arch/superh: Suspicious coherent DMA allocations for CEU video buffers Message-ID: <6hbvbciyyx7wcuwzhgaczqearmu2mu3h2u447mljbp24emtjaz@ciel5ezmehfq> References: <20230629151124.34e72817@meshulam.tesarici.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230629151124.34e72817@meshulam.tesarici.cz> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Petr, On Thu, Jun 29, 2023 at 03:11:24PM +0200, Petr Tesařík wrote: > Hi Jacopo, > > I've just noticed a few calls to dma_declare_coherent_memory() which > look suspicious to me, all authored by you: > > - arch/sh/boards/mach-ap325rxa/setup.c > - arch/sh/boards/mach-ecovec24/setup.c > - arch/sh/boards/mach-kfr2r09/setup.c > - arch/sh/boards/mach-migor/setup.c > - arch/sh/boards/mach-se/7724/setup.c > > In these files, the last argument to dma_declare_coherent_memory() > looks like the last address to be used, but the expected value should > be the size of the reserved region, e.g.: > > dma_declare_coherent_memory(&ap325rxa_ceu_device.dev, > ceu_dma_membase, ceu_dma_membase, > ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1); > > Do you (or anyone else on Cc) agree that this is a braino, and all these > boards should actually use CEU_BUFFER_MEMORY_SIZE as the size of their > DMA pools rather than membase + CEU_BUFFER_MEMORY_SIZE - 1? > Thanks for spotting this.. I tried to track down where this comes from digging out the CEU and the platform file from 4.16, but it seems this simply is a brain fart from my side. I presume this is very much dead code, as the commit message of 39fb993038e1 ("media: arch: sh: ap325rxa: Use new renesas-ceu camera driver") says: "Compile tested only." and nobody has ever reported bugs. Feel free to send patches and cc me, as long as this code is around it's nice to have it correct at least. Thank you! j PS: if you ask me, as nobody clearly run this code in the last 5 years, I would simply drop all these platform files. But that's maintainers' call. > Petr T