Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2405350ybl; Mon, 20 Jan 2020 02:17:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzHgRJvgcNKT1ON6gGQl75roW3NQfzTcs5EBBbMv7Tah3FsOLGzYhIEFtog9x8Sm/boBIrB X-Received: by 2002:a05:6830:1bd5:: with SMTP id v21mr16249267ota.154.1579515431922; Mon, 20 Jan 2020 02:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579515431; cv=none; d=google.com; s=arc-20160816; b=LKNzdSYx5caJ+hZEkZshmdS9o+t+lDMp+I6Cl7FdHZbKg1l/Yt9BDP+eZCtqIiekyD jobfrUF2Lon1a+YrLJ/9Kk13BR7yEw48u0rZht6TH/NYSfbBTbmcLx9iLnHTTbR9VLCB VdTtX2EgIrVYmfiihD6leBpdgi0QdRZIs0TEsHpo7YXiCXlx7DIC/mwuJ1u6UdfUEwc5 QwVRP/M+3QiZcCnZRvOS2WeSQYsFGfM5gZr3Xc5Q9xscyhLGVXMMvG1yrPSv6SaZFxNk rVi3X0Q6yI24khzbV2ep7STfkK7xKeigasePwJY8FODs0VQvc0VPY40xvd0kFrBOIavu vJGw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=KyVH3zWSUl96d+3Kz0z4lRV0WTTLoc+PmB9suhnpFow=; b=fS9w0lG2NfGTvHgsQc0nH47o1K8ZBBa74sdOE1xIVm0DH0c3SWAHVonVUqtqyuA6Ae eVExDcDpoFW69EFVGmaL9VIdzFkrSMG1Bmh48EYzohyVQ0F4Kj9sOHyhzdS5QrlK/E0K CaZ8js8jaQy5bNVhk7PC97oB+hJDkbNrXuFbqp42VSUyZlNbRjccFQ3DiT9rrXsIYNGw 0Yl2WALeXPtjp7r2hMha4I8DZDQ9cT8N+oDlUBnHmStHrLhcAllNxx8Xn81qiCuUaE1m kdlFqixIuIAMZcMUyamhx6yKMQKvftNJMFmB5mrDo1UGHSRYNfWGkaPRN5i5+Wge71ZH TRZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qKnpHeZg; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si16135970otf.198.2020.01.20.02.16.59; Mon, 20 Jan 2020 02:17:11 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qKnpHeZg; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726728AbgATKQJ (ORCPT + 99 others); Mon, 20 Jan 2020 05:16:09 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:38530 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgATKQJ (ORCPT ); Mon, 20 Jan 2020 05:16:09 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 00KAFuIr042476; Mon, 20 Jan 2020 04:15:56 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1579515356; bh=KyVH3zWSUl96d+3Kz0z4lRV0WTTLoc+PmB9suhnpFow=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=qKnpHeZgN9POcSaW/sgFbaPIeo4qWTas1IGF1xF7QzpagKVbebC/8GWA+maeCHoP6 hPqbriPqABeoroU/c2NUHgPoaSiaw/ONgCZC4PHVZu1C/p8LiRexu971bWe4o0aDAZ yx1SRhf2+tTseU1AKMRV3TP9UuuD41xrpHV9rfT4= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 00KAFumX047513 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 20 Jan 2020 04:15:56 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 20 Jan 2020 04:15:55 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 20 Jan 2020 04:15:55 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 00KAFrRn010845; Mon, 20 Jan 2020 04:15:53 -0600 Subject: Re: [PATCH v2] dmaengine: Create symlinks between DMA channels and slaves To: Geert Uytterhoeven CC: Geert Uytterhoeven , Vinod Koul , Dan Williams , , Linux-Renesas , Linux Kernel Mailing List References: <20200117153056.31363-1-geert+renesas@glider.be> From: Peter Ujfalusi Message-ID: <1cdc4f71-f365-8c9e-4634-408c59e6a3f9@ti.com> Date: Mon, 20 Jan 2020 12:16:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/01/2020 11.01, Geert Uytterhoeven wrote: > Hi Peter, > > On Fri, Jan 17, 2020 at 9:08 PM Peter Ujfalusi wrote: >> On 1/17/20 5:30 PM, Geert Uytterhoeven wrote: >>> Currently it is not easy to find out which DMA channels are in use, and >>> which slave devices are using which channels. >>> >>> Fix this by creating two symlinks between the DMA channel and the actual >>> slave device when a channel is requested: >>> 1. A "slave" symlink from DMA channel to slave device, >> >> Have you considered similar link name as on the slave device: >> slave: >> >> That way it would be easier to grasp which channel is used for what >> purpose by only looking under /sys/class/dma/ and no need to check the >> slave device. > > Would this really provide more information? > The device name is already provided in the target of the symlink: > > root@koelsch:~# readlink > /sys/devices/platform/soc/e6720000.dma-controller/dma/dma1chan2/slave > ../../../ee140000.sd e6720000.dma-controller/dma/dma1chan2/slave -> ../../../ee140000.sd e6720000.dma-controller/dma/dma1chan3/slave -> ../../../ee140000.sd It is hard to tell which one is the tx and RX channel without looking under the ee140000.sd: ee140000.sd/dma:rx -> ../e6720000.dma-controller/dma/dma1chan3 ee140000.sd/dma:tx -> ../e6720000.dma-controller/dma/dma1chan2 Another option would be to not have symlinks, but a debugfs file where this information can be extracted and would only compiled if debugfs is enabled. >>> 2. A "dma:" symlink slave device to DMA channel. >>> When the channel is released, the symlinks are removed again. >>> The latter requires keeping track of the slave device and the channel >>> name in the dma_chan structure. >>> >>> Note that this is limited to channel request functions for requesting an >>> exclusive slave channel that take a device pointer (dma_request_chan() >>> and dma_request_slave_channel*()). >>> >>> Signed-off-by: Geert Uytterhoeven >>> --- >>> v2: >>> - Add DMA_SLAVE_NAME macro, >>> - Also handle channels from FIXME, >>> - Add backlinks from slave device to DMA channel, >>> >>> On r8a7791/koelsch, the following new symlinks are created: >>> >>> /sys/devices/platform/soc/ >>> ├── e6700000.dma-controller/dma/dma0chan0/slave -> ../../../e6e20000.spi >>> ├── e6700000.dma-controller/dma/dma0chan1/slave -> ../../../e6e20000.spi >>> ├── e6700000.dma-controller/dma/dma0chan2/slave -> ../../../ee100000.sd >>> ├── e6700000.dma-controller/dma/dma0chan3/slave -> ../../../ee100000.sd >>> ├── e6700000.dma-controller/dma/dma0chan4/slave -> ../../../ee160000.sd >>> ├── e6700000.dma-controller/dma/dma0chan5/slave -> ../../../ee160000.sd >>> ├── e6700000.dma-controller/dma/dma0chan6/slave -> ../../../e6e68000.serial >>> ├── e6700000.dma-controller/dma/dma0chan7/slave -> ../../../e6e68000.serial >>> ├── e6720000.dma-controller/dma/dma1chan0/slave -> ../../../e6b10000.spi >>> ├── e6720000.dma-controller/dma/dma1chan1/slave -> ../../../e6b10000.spi >>> ├── e6720000.dma-controller/dma/dma1chan2/slave -> ../../../ee140000.sd >>> ├── e6720000.dma-controller/dma/dma1chan3/slave -> ../../../ee140000.sd >>> ├── e6b10000.spi/dma:rx -> ../e6720000.dma-controller/dma/dma1chan1 >>> ├── e6b10000.spi/dma:tx -> ../e6720000.dma-controller/dma/dma1chan0 >>> ├── e6e20000.spi/dma:rx -> ../e6700000.dma-controller/dma/dma0chan1 >>> ├── e6e20000.spi/dma:tx -> ../e6700000.dma-controller/dma/dma0chan0 >>> ├── e6e68000.serial/dma:rx -> ../e6700000.dma-controller/dma/dma0chan7 >>> ├── e6e68000.serial/dma:tx -> ../e6700000.dma-controller/dma/dma0chan6 >>> ├── ee100000.sd/dma:rx -> ../e6700000.dma-controller/dma/dma0chan3 >>> ├── ee100000.sd/dma:tx -> ../e6700000.dma-controller/dma/dma0chan2 >>> ├── ee140000.sd/dma:rx -> ../e6720000.dma-controller/dma/dma1chan3 >>> ├── ee140000.sd/dma:tx -> ../e6720000.dma-controller/dma/dma1chan2 >>> ├── ee160000.sd/dma:rx -> ../e6700000.dma-controller/dma/dma0chan5 >>> └── ee160000.sd/dma:tx -> ../e6700000.dma-controller/dma/dma0chan4 > > > Gr{oetje,eeting}s, > > Geert > - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki