From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE8DF2C80 for ; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 43C2661B43 for ; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636979905; bh=0vPaiFLUq2SXWicOiHJ0dTL68j+HqvYqhdUUZpm4Lbg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I+1x2XZxjf0LcgW3lMmbiJPZ71Bi+3kqOGuAZRKXN1JfNBFrZaiB21OzI8/74f0h0 Qq9j3mNJNww5Ebh37UUU7T73Uy/xgxrT9Cch7mYImOv2H/bbOmofM9xkajEGTkGGUU hGAI73KgAeiXM888w+zysyYQTZ4yYyjDXcXqXXwQJ8IyYB0pf/b0pqA/XCjqw9IpRl yCWpvb6UA7WovNrxde2iEzHRITt42AWtZE7nvXGbJMW3vN4eAR3DyqEs1DZrNZzLk2 tuMyHLag1K86+X0psZqBhLcvq1czh8i8zV/S46+iyDlDN0sbFnwCD3e9XH7d1GqYQT IxYpNW3g9oKFg== Received: by mail-wm1-f48.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso12767278wms.3 for ; Mon, 15 Nov 2021 04:38:25 -0800 (PST) X-Gm-Message-State: AOAM533merf4WpNmmTlbamxmuPIzRZQrDepyeDaGuaSJu/n8GxDtd6cQ 6RSEqVze1ez8zAic2nGkuhhzoDx8ye/HxsDAjj0= X-Google-Smtp-Source: ABdhPJwFTprJJd11s9duELVend6oLQx+lemeU4w9vOaJiXxZUrLq0sghW72KOFAqYJMNV8KCFht4GWVIPZFIhNgyYas= X-Received: by 2002:a1c:770e:: with SMTP id t14mr58047076wmi.173.1636979903584; Mon, 15 Nov 2021 04:38:23 -0800 (PST) Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20211115085403.360194-1-arnd@kernel.org> <20211115085403.360194-9-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 15 Nov 2021 13:38:07 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field To: Laurent Pinchart Cc: Vinod Koul , Arnd Bergmann , Andy Gross , Andy Shevchenko , Baolin Wang , Bjorn Andersson , Chunyan Zhang , Greg Kroah-Hartman , Hyun Kwon , Jaroslav Kysela , Jon Hunter , Lars-Peter Clausen , Laxman Dewangan , Manivannan Sadhasivam , Mark Brown , Michal Simek , Nicolas Saenz Julienne , Orson Zhai , Robert Jarzmik , Scott Branden , Takashi Iwai , Thierry Reding , ALSA Development Mailing List , bcm-kernel-feedback-list , dmaengine@vger.kernel.org, dri-devel , Linux ARM , linux-arm-msm , Linux Kernel Mailing List , linux-mmc , linux-mtd , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" , "open list:SERIAL DRIVERS" , linux-spi , linux-staging@lists.linux.dev, "open list:TEGRA ARCHITECTURE SUPPORT" Content-Type: text/plain; charset="UTF-8" On Mon, Nov 15, 2021 at 12:49 PM Laurent Pinchart wrote: > On Mon, Nov 15, 2021 at 11:21:30AM +0100, Arnd Bergmann wrote: > > On Mon, Nov 15, 2021 at 10:14 AM Laurent Pinchart wrote: > > > On Mon, Nov 15, 2021 at 09:54:00AM +0100, Arnd Bergmann wrote: > > > > @@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, > > > > spin_lock_irqsave(&chan->lock, flags); > > > > > > > > /* > > > > - * Abuse the slave_id to indicate that the channel is part of a video > > > > - * group. > > > > + * Abuse the peripheral_config to indicate that the channel is part > > > > > > Is it still an abuse, or is this now the right way to pass custom data > > > to the DMA engine driver ? > > > > It doesn't make the driver any more portable, but it's now being > > more explicit about it. As far as I can tell, this is the best way > > to pass data that cannot be expressed through the regular interfaces > > in DT and the dmaengine API. > > > > Ideally there would be a generic way to pass this flag, but I couldn't > > figure out what this is actually doing, or whether there is a better > > way. Maybe Vinod has an idea. > > I don't think we need a generic API in this case. The DMA engine is > specific to the display device, I don't foresee a need to mix-n-match. Right. I wonder if there is even a point in using the dmaengine API in that case, I think for other single-purpose drivers we tend to just integrate the functionality in the client driver. No point changing this now of course, but it does feel odd. >From my earlier reading of the driver, my impression was that this is just a memory-to-memory device, so it could be used that way as well, but does need a flag when working on the video memory. I couldn't quite make sense of that though. > > /* > > * Use the peripheral_config to indicate that the channel is part > > * of a video group. This requires matching use of the custom > > * structure in each driver. > > */ > > pconfig = config->peripheral_config; > > if (WARN_ON(config->peripheral_size != 0 && > > config->peripheral_size != sizeof(*pconfig))) > > return -EINVAL; > > How about > > if (WARN_ON(config->peripheral_config && > config->peripheral_size != sizeof(*pconfig))) > > > > > spin_lock_irqsave(&chan->lock, flags); > > if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && > > config->peripheral_size == sizeof(*pconfig)) > > And here you can test pconfig != NULL. Good idea. Changed now, using 'if (pconfig)' without the '!= NULL' in both expressions. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49623C433F5 for ; Mon, 15 Nov 2021 12:38:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15A0560FC2 for ; Mon, 15 Nov 2021 12:38:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 15A0560FC2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 655426E0D6; Mon, 15 Nov 2021 12:38:26 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BAB66E0D6 for ; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D0E76137B for ; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636979905; bh=0vPaiFLUq2SXWicOiHJ0dTL68j+HqvYqhdUUZpm4Lbg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I+1x2XZxjf0LcgW3lMmbiJPZ71Bi+3kqOGuAZRKXN1JfNBFrZaiB21OzI8/74f0h0 Qq9j3mNJNww5Ebh37UUU7T73Uy/xgxrT9Cch7mYImOv2H/bbOmofM9xkajEGTkGGUU hGAI73KgAeiXM888w+zysyYQTZ4yYyjDXcXqXXwQJ8IyYB0pf/b0pqA/XCjqw9IpRl yCWpvb6UA7WovNrxde2iEzHRITt42AWtZE7nvXGbJMW3vN4eAR3DyqEs1DZrNZzLk2 tuMyHLag1K86+X0psZqBhLcvq1czh8i8zV/S46+iyDlDN0sbFnwCD3e9XH7d1GqYQT IxYpNW3g9oKFg== Received: by mail-wm1-f47.google.com with SMTP id az33-20020a05600c602100b00333472fef04so14934100wmb.5 for ; Mon, 15 Nov 2021 04:38:25 -0800 (PST) X-Gm-Message-State: AOAM532qIsd0BbGFA9WrkBrMLhcrkhPJ751Jh78JB8VBjJyy8zuICLJI 3gYFtaFYapL2s5hrEg4KrmPjFP87QSp0XkycEMc= X-Google-Smtp-Source: ABdhPJwFTprJJd11s9duELVend6oLQx+lemeU4w9vOaJiXxZUrLq0sghW72KOFAqYJMNV8KCFht4GWVIPZFIhNgyYas= X-Received: by 2002:a1c:770e:: with SMTP id t14mr58047076wmi.173.1636979903584; Mon, 15 Nov 2021 04:38:23 -0800 (PST) MIME-Version: 1.0 References: <20211115085403.360194-1-arnd@kernel.org> <20211115085403.360194-9-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 15 Nov 2021 13:38:07 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field To: Laurent Pinchart Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ALSA Development Mailing List , dri-devel , Bjorn Andersson , "open list:TEGRA ARCHITECTURE SUPPORT" , Thierry Reding , linux-mtd , linux-spi , Robert Jarzmik , Chunyan Zhang , linux-staging@lists.linux.dev, Michal Simek , Jon Hunter , Andy Gross , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Orson Zhai , Nicolas Saenz Julienne , Arnd Bergmann , Manivannan Sadhasivam , linux-arm-msm , dmaengine@vger.kernel.org, Mark Brown , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" , Jaroslav Kysela , Andy Shevchenko , Linux ARM , Scott Branden , Hyun Kwon , Greg Kroah-Hartman , linux-mmc , Takashi Iwai , Linux Kernel Mailing List , Vinod Koul , Laxman Dewangan , Baolin Wang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Nov 15, 2021 at 12:49 PM Laurent Pinchart wrote: > On Mon, Nov 15, 2021 at 11:21:30AM +0100, Arnd Bergmann wrote: > > On Mon, Nov 15, 2021 at 10:14 AM Laurent Pinchart wrote: > > > On Mon, Nov 15, 2021 at 09:54:00AM +0100, Arnd Bergmann wrote: > > > > @@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, > > > > spin_lock_irqsave(&chan->lock, flags); > > > > > > > > /* > > > > - * Abuse the slave_id to indicate that the channel is part of a video > > > > - * group. > > > > + * Abuse the peripheral_config to indicate that the channel is part > > > > > > Is it still an abuse, or is this now the right way to pass custom data > > > to the DMA engine driver ? > > > > It doesn't make the driver any more portable, but it's now being > > more explicit about it. As far as I can tell, this is the best way > > to pass data that cannot be expressed through the regular interfaces > > in DT and the dmaengine API. > > > > Ideally there would be a generic way to pass this flag, but I couldn't > > figure out what this is actually doing, or whether there is a better > > way. Maybe Vinod has an idea. > > I don't think we need a generic API in this case. The DMA engine is > specific to the display device, I don't foresee a need to mix-n-match. Right. I wonder if there is even a point in using the dmaengine API in that case, I think for other single-purpose drivers we tend to just integrate the functionality in the client driver. No point changing this now of course, but it does feel odd. >From my earlier reading of the driver, my impression was that this is just a memory-to-memory device, so it could be used that way as well, but does need a flag when working on the video memory. I couldn't quite make sense of that though. > > /* > > * Use the peripheral_config to indicate that the channel is part > > * of a video group. This requires matching use of the custom > > * structure in each driver. > > */ > > pconfig = config->peripheral_config; > > if (WARN_ON(config->peripheral_size != 0 && > > config->peripheral_size != sizeof(*pconfig))) > > return -EINVAL; > > How about > > if (WARN_ON(config->peripheral_config && > config->peripheral_size != sizeof(*pconfig))) > > > > > spin_lock_irqsave(&chan->lock, flags); > > if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && > > config->peripheral_size == sizeof(*pconfig)) > > And here you can test pconfig != NULL. Good idea. Changed now, using 'if (pconfig)' without the '!= NULL' in both expressions. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC076C433EF for ; Mon, 15 Nov 2021 12:39:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C067A60EFD for ; Mon, 15 Nov 2021 12:39:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C067A60EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MkQBtXtfLXAPWSeKl+fOA5wQ8HsEUlP/ffKdR9x36PQ=; b=Ik5/Pvgd+CWv/X Dp73jDGUYijxMIZUwnOf9HgfFGx1yJ8+494v4cB8uFroHLdHMHroodcITdlsNRrX/V4s+Uu6gSQKL Tpvf//xNwt8wrNXS4saU0nkzZdTgqT5XWQ4em5zs1HI6Dt7k1fPo6V8MtGt/ZyHJhKCNVrEvbXjbw onbG++VmpJzh3cFm+IRbUdPL3ZwZDh4ASUyoKnZZGgQ3bAI3hIb9dT9c6V2aLBaRBn1HzRCmP2NSN RUDFMUWi1Ykjwg8Jw0cfX3vUIoxqA4mU3SnJZJA1a9m5Jk1S5ttW8voD3/ztTsUzz3zVVbOwJ4bRa YPxaK+YiZzh26emiq4SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmbFu-00FWxF-VX; Mon, 15 Nov 2021 12:38:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmbFh-00FWuE-LY; Mon, 15 Nov 2021 12:38:27 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5027561B5E; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636979905; bh=0vPaiFLUq2SXWicOiHJ0dTL68j+HqvYqhdUUZpm4Lbg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I+1x2XZxjf0LcgW3lMmbiJPZ71Bi+3kqOGuAZRKXN1JfNBFrZaiB21OzI8/74f0h0 Qq9j3mNJNww5Ebh37UUU7T73Uy/xgxrT9Cch7mYImOv2H/bbOmofM9xkajEGTkGGUU hGAI73KgAeiXM888w+zysyYQTZ4yYyjDXcXqXXwQJ8IyYB0pf/b0pqA/XCjqw9IpRl yCWpvb6UA7WovNrxde2iEzHRITt42AWtZE7nvXGbJMW3vN4eAR3DyqEs1DZrNZzLk2 tuMyHLag1K86+X0psZqBhLcvq1czh8i8zV/S46+iyDlDN0sbFnwCD3e9XH7d1GqYQT IxYpNW3g9oKFg== Received: by mail-wm1-f48.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so15717843wme.0; Mon, 15 Nov 2021 04:38:25 -0800 (PST) X-Gm-Message-State: AOAM531FDLFGxOZ6l3NEJDDcaZSgAe0lRi05xICIe0pzXhMa+8bh3IjP lujIvjMMaZLHSg25LKK1Q6HsVulB7GmlFwFVQkY= X-Google-Smtp-Source: ABdhPJwFTprJJd11s9duELVend6oLQx+lemeU4w9vOaJiXxZUrLq0sghW72KOFAqYJMNV8KCFht4GWVIPZFIhNgyYas= X-Received: by 2002:a1c:770e:: with SMTP id t14mr58047076wmi.173.1636979903584; Mon, 15 Nov 2021 04:38:23 -0800 (PST) MIME-Version: 1.0 References: <20211115085403.360194-1-arnd@kernel.org> <20211115085403.360194-9-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 15 Nov 2021 13:38:07 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field To: Laurent Pinchart Cc: Vinod Koul , Arnd Bergmann , Andy Gross , Andy Shevchenko , Baolin Wang , Bjorn Andersson , Chunyan Zhang , Greg Kroah-Hartman , Hyun Kwon , Jaroslav Kysela , Jon Hunter , Lars-Peter Clausen , Laxman Dewangan , Manivannan Sadhasivam , Mark Brown , Michal Simek , Nicolas Saenz Julienne , Orson Zhai , Robert Jarzmik , Scott Branden , Takashi Iwai , Thierry Reding , ALSA Development Mailing List , bcm-kernel-feedback-list , dmaengine@vger.kernel.org, dri-devel , Linux ARM , linux-arm-msm , Linux Kernel Mailing List , linux-mmc , linux-mtd , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" , "open list:SERIAL DRIVERS" , linux-spi , linux-staging@lists.linux.dev, "open list:TEGRA ARCHITECTURE SUPPORT" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_043825_773919_D1B111A7 X-CRM114-Status: GOOD ( 31.65 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, Nov 15, 2021 at 12:49 PM Laurent Pinchart wrote: > On Mon, Nov 15, 2021 at 11:21:30AM +0100, Arnd Bergmann wrote: > > On Mon, Nov 15, 2021 at 10:14 AM Laurent Pinchart wrote: > > > On Mon, Nov 15, 2021 at 09:54:00AM +0100, Arnd Bergmann wrote: > > > > @@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, > > > > spin_lock_irqsave(&chan->lock, flags); > > > > > > > > /* > > > > - * Abuse the slave_id to indicate that the channel is part of a video > > > > - * group. > > > > + * Abuse the peripheral_config to indicate that the channel is part > > > > > > Is it still an abuse, or is this now the right way to pass custom data > > > to the DMA engine driver ? > > > > It doesn't make the driver any more portable, but it's now being > > more explicit about it. As far as I can tell, this is the best way > > to pass data that cannot be expressed through the regular interfaces > > in DT and the dmaengine API. > > > > Ideally there would be a generic way to pass this flag, but I couldn't > > figure out what this is actually doing, or whether there is a better > > way. Maybe Vinod has an idea. > > I don't think we need a generic API in this case. The DMA engine is > specific to the display device, I don't foresee a need to mix-n-match. Right. I wonder if there is even a point in using the dmaengine API in that case, I think for other single-purpose drivers we tend to just integrate the functionality in the client driver. No point changing this now of course, but it does feel odd. >From my earlier reading of the driver, my impression was that this is just a memory-to-memory device, so it could be used that way as well, but does need a flag when working on the video memory. I couldn't quite make sense of that though. > > /* > > * Use the peripheral_config to indicate that the channel is part > > * of a video group. This requires matching use of the custom > > * structure in each driver. > > */ > > pconfig = config->peripheral_config; > > if (WARN_ON(config->peripheral_size != 0 && > > config->peripheral_size != sizeof(*pconfig))) > > return -EINVAL; > > How about > > if (WARN_ON(config->peripheral_config && > config->peripheral_size != sizeof(*pconfig))) > > > > > spin_lock_irqsave(&chan->lock, flags); > > if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && > > config->peripheral_size == sizeof(*pconfig)) > > And here you can test pconfig != NULL. Good idea. Changed now, using 'if (pconfig)' without the '!= NULL' in both expressions. Arnd ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64572C433F5 for ; Mon, 15 Nov 2021 12:39:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F03D60EFD for ; Mon, 15 Nov 2021 12:39:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F03D60EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QaxZaCJ3ll83Lr+WEtka1VCZvZfWvrtMsMq0i4hpc5Q=; b=IJurXNJeWH3BRa gHz1tNVq4WthivoA97CeP3B+jTSz+xTWEeI/1OS8rFvKEO5rWCZdQZZNpUoQwEm+I+sfOW6lp2lBb CQPMr4Qz4qC+E5FH30RlpF4iy2ZeMheq6LffdtIc4Vp+3Zq1qu49ueJ/SKYCLTqno58bHDr99LDh7 9R9HyLk97MSjMNyoL94DjrFbR5IZAspZjqEkJgI/VxA88vfG7zEcEOwFAVaBP6GTMzU7MTRR9BYsb 3lexRTlot4pPW4dgf8XQ4T8+re60onkTkFjeGqy3wPZ4x7nUkHZ/G3NEpocr8jahl503RvWd0tTrk MxNda2OOtu/r7yWyIqiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmbFl-00FWvI-HE; Mon, 15 Nov 2021 12:38:29 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmbFh-00FWuE-LY; Mon, 15 Nov 2021 12:38:27 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5027561B5E; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636979905; bh=0vPaiFLUq2SXWicOiHJ0dTL68j+HqvYqhdUUZpm4Lbg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I+1x2XZxjf0LcgW3lMmbiJPZ71Bi+3kqOGuAZRKXN1JfNBFrZaiB21OzI8/74f0h0 Qq9j3mNJNww5Ebh37UUU7T73Uy/xgxrT9Cch7mYImOv2H/bbOmofM9xkajEGTkGGUU hGAI73KgAeiXM888w+zysyYQTZ4yYyjDXcXqXXwQJ8IyYB0pf/b0pqA/XCjqw9IpRl yCWpvb6UA7WovNrxde2iEzHRITt42AWtZE7nvXGbJMW3vN4eAR3DyqEs1DZrNZzLk2 tuMyHLag1K86+X0psZqBhLcvq1czh8i8zV/S46+iyDlDN0sbFnwCD3e9XH7d1GqYQT IxYpNW3g9oKFg== Received: by mail-wm1-f48.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so15717843wme.0; Mon, 15 Nov 2021 04:38:25 -0800 (PST) X-Gm-Message-State: AOAM531FDLFGxOZ6l3NEJDDcaZSgAe0lRi05xICIe0pzXhMa+8bh3IjP lujIvjMMaZLHSg25LKK1Q6HsVulB7GmlFwFVQkY= X-Google-Smtp-Source: ABdhPJwFTprJJd11s9duELVend6oLQx+lemeU4w9vOaJiXxZUrLq0sghW72KOFAqYJMNV8KCFht4GWVIPZFIhNgyYas= X-Received: by 2002:a1c:770e:: with SMTP id t14mr58047076wmi.173.1636979903584; Mon, 15 Nov 2021 04:38:23 -0800 (PST) MIME-Version: 1.0 References: <20211115085403.360194-1-arnd@kernel.org> <20211115085403.360194-9-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 15 Nov 2021 13:38:07 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field To: Laurent Pinchart Cc: Vinod Koul , Arnd Bergmann , Andy Gross , Andy Shevchenko , Baolin Wang , Bjorn Andersson , Chunyan Zhang , Greg Kroah-Hartman , Hyun Kwon , Jaroslav Kysela , Jon Hunter , Lars-Peter Clausen , Laxman Dewangan , Manivannan Sadhasivam , Mark Brown , Michal Simek , Nicolas Saenz Julienne , Orson Zhai , Robert Jarzmik , Scott Branden , Takashi Iwai , Thierry Reding , ALSA Development Mailing List , bcm-kernel-feedback-list , dmaengine@vger.kernel.org, dri-devel , Linux ARM , linux-arm-msm , Linux Kernel Mailing List , linux-mmc , linux-mtd , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" , "open list:SERIAL DRIVERS" , linux-spi , linux-staging@lists.linux.dev, "open list:TEGRA ARCHITECTURE SUPPORT" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_043825_773919_D1B111A7 X-CRM114-Status: GOOD ( 31.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 15, 2021 at 12:49 PM Laurent Pinchart wrote: > On Mon, Nov 15, 2021 at 11:21:30AM +0100, Arnd Bergmann wrote: > > On Mon, Nov 15, 2021 at 10:14 AM Laurent Pinchart wrote: > > > On Mon, Nov 15, 2021 at 09:54:00AM +0100, Arnd Bergmann wrote: > > > > @@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, > > > > spin_lock_irqsave(&chan->lock, flags); > > > > > > > > /* > > > > - * Abuse the slave_id to indicate that the channel is part of a video > > > > - * group. > > > > + * Abuse the peripheral_config to indicate that the channel is part > > > > > > Is it still an abuse, or is this now the right way to pass custom data > > > to the DMA engine driver ? > > > > It doesn't make the driver any more portable, but it's now being > > more explicit about it. As far as I can tell, this is the best way > > to pass data that cannot be expressed through the regular interfaces > > in DT and the dmaengine API. > > > > Ideally there would be a generic way to pass this flag, but I couldn't > > figure out what this is actually doing, or whether there is a better > > way. Maybe Vinod has an idea. > > I don't think we need a generic API in this case. The DMA engine is > specific to the display device, I don't foresee a need to mix-n-match. Right. I wonder if there is even a point in using the dmaengine API in that case, I think for other single-purpose drivers we tend to just integrate the functionality in the client driver. No point changing this now of course, but it does feel odd. >From my earlier reading of the driver, my impression was that this is just a memory-to-memory device, so it could be used that way as well, but does need a flag when working on the video memory. I couldn't quite make sense of that though. > > /* > > * Use the peripheral_config to indicate that the channel is part > > * of a video group. This requires matching use of the custom > > * structure in each driver. > > */ > > pconfig = config->peripheral_config; > > if (WARN_ON(config->peripheral_size != 0 && > > config->peripheral_size != sizeof(*pconfig))) > > return -EINVAL; > > How about > > if (WARN_ON(config->peripheral_config && > config->peripheral_size != sizeof(*pconfig))) > > > > > spin_lock_irqsave(&chan->lock, flags); > > if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && > > config->peripheral_size == sizeof(*pconfig)) > > And here you can test pconfig != NULL. Good idea. Changed now, using 'if (pconfig)' without the '!= NULL' in both expressions. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DCADC433EF for ; Thu, 18 Nov 2021 16:37:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C376861175 for ; Thu, 18 Nov 2021 16:37:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C376861175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 38F0F1832; Thu, 18 Nov 2021 17:37:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 38F0F1832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637253471; bh=0vPaiFLUq2SXWicOiHJ0dTL68j+HqvYqhdUUZpm4Lbg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vBwSoaPkDT9YPwu/xw9eSPRGMdbsklTdxpgq5DszgT73krxZm1e6fQHmIf8KxrFCk k3sr8FGfaIIAukL2yaD5uNKcmXvDN/V2ZJiOIgPxVLuq64qGIvqmT/iasnb1e9q3cR bm+chQnyFZovHnGkjzd05y2PxXitMUEYFH3k1f54= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C563AF80528; Thu, 18 Nov 2021 17:33:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8EC9AF801D5; Mon, 15 Nov 2021 13:38:34 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7D68EF800FA for ; Mon, 15 Nov 2021 13:38:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7D68EF800FA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I+1x2XZx" Received: by mail.kernel.org (Postfix) with ESMTPSA id 446E661B72 for ; Mon, 15 Nov 2021 12:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636979905; bh=0vPaiFLUq2SXWicOiHJ0dTL68j+HqvYqhdUUZpm4Lbg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I+1x2XZxjf0LcgW3lMmbiJPZ71Bi+3kqOGuAZRKXN1JfNBFrZaiB21OzI8/74f0h0 Qq9j3mNJNww5Ebh37UUU7T73Uy/xgxrT9Cch7mYImOv2H/bbOmofM9xkajEGTkGGUU hGAI73KgAeiXM888w+zysyYQTZ4yYyjDXcXqXXwQJ8IyYB0pf/b0pqA/XCjqw9IpRl yCWpvb6UA7WovNrxde2iEzHRITt42AWtZE7nvXGbJMW3vN4eAR3DyqEs1DZrNZzLk2 tuMyHLag1K86+X0psZqBhLcvq1czh8i8zV/S46+iyDlDN0sbFnwCD3e9XH7d1GqYQT IxYpNW3g9oKFg== Received: by mail-wm1-f53.google.com with SMTP id n33-20020a05600c502100b0032fb900951eso10403744wmr.4 for ; Mon, 15 Nov 2021 04:38:25 -0800 (PST) X-Gm-Message-State: AOAM53333EkO60bu5/X68zhAAovMmcOoPqYtmL0UBQ6loSiwVMosCS6l er4Hnb3yepJhY11pgM6J1l/L51e3G3gFwIRn8pA= X-Google-Smtp-Source: ABdhPJwFTprJJd11s9duELVend6oLQx+lemeU4w9vOaJiXxZUrLq0sghW72KOFAqYJMNV8KCFht4GWVIPZFIhNgyYas= X-Received: by 2002:a1c:770e:: with SMTP id t14mr58047076wmi.173.1636979903584; Mon, 15 Nov 2021 04:38:23 -0800 (PST) MIME-Version: 1.0 References: <20211115085403.360194-1-arnd@kernel.org> <20211115085403.360194-9-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 15 Nov 2021 13:38:07 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field To: Laurent Pinchart Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Thu, 18 Nov 2021 17:33:02 +0100 Cc: ALSA Development Mailing List , dri-devel , Bjorn Andersson , "open list:TEGRA ARCHITECTURE SUPPORT" , Thierry Reding , linux-mtd , linux-spi , Robert Jarzmik , Lars-Peter Clausen , Chunyan Zhang , linux-staging@lists.linux.dev, Michal Simek , Jon Hunter , Andy Gross , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Orson Zhai , Nicolas Saenz Julienne , Arnd Bergmann , Manivannan Sadhasivam , linux-arm-msm , dmaengine@vger.kernel.org, Mark Brown , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" , Andy Shevchenko , Linux ARM , Scott Branden , Hyun Kwon , Greg Kroah-Hartman , linux-mmc , Takashi Iwai , Linux Kernel Mailing List , Vinod Koul , Laxman Dewangan , Baolin Wang X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, Nov 15, 2021 at 12:49 PM Laurent Pinchart wrote: > On Mon, Nov 15, 2021 at 11:21:30AM +0100, Arnd Bergmann wrote: > > On Mon, Nov 15, 2021 at 10:14 AM Laurent Pinchart wrote: > > > On Mon, Nov 15, 2021 at 09:54:00AM +0100, Arnd Bergmann wrote: > > > > @@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, > > > > spin_lock_irqsave(&chan->lock, flags); > > > > > > > > /* > > > > - * Abuse the slave_id to indicate that the channel is part of a video > > > > - * group. > > > > + * Abuse the peripheral_config to indicate that the channel is part > > > > > > Is it still an abuse, or is this now the right way to pass custom data > > > to the DMA engine driver ? > > > > It doesn't make the driver any more portable, but it's now being > > more explicit about it. As far as I can tell, this is the best way > > to pass data that cannot be expressed through the regular interfaces > > in DT and the dmaengine API. > > > > Ideally there would be a generic way to pass this flag, but I couldn't > > figure out what this is actually doing, or whether there is a better > > way. Maybe Vinod has an idea. > > I don't think we need a generic API in this case. The DMA engine is > specific to the display device, I don't foresee a need to mix-n-match. Right. I wonder if there is even a point in using the dmaengine API in that case, I think for other single-purpose drivers we tend to just integrate the functionality in the client driver. No point changing this now of course, but it does feel odd. >From my earlier reading of the driver, my impression was that this is just a memory-to-memory device, so it could be used that way as well, but does need a flag when working on the video memory. I couldn't quite make sense of that though. > > /* > > * Use the peripheral_config to indicate that the channel is part > > * of a video group. This requires matching use of the custom > > * structure in each driver. > > */ > > pconfig = config->peripheral_config; > > if (WARN_ON(config->peripheral_size != 0 && > > config->peripheral_size != sizeof(*pconfig))) > > return -EINVAL; > > How about > > if (WARN_ON(config->peripheral_config && > config->peripheral_size != sizeof(*pconfig))) > > > > > spin_lock_irqsave(&chan->lock, flags); > > if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && > > config->peripheral_size == sizeof(*pconfig)) > > And here you can test pconfig != NULL. Good idea. Changed now, using 'if (pconfig)' without the '!= NULL' in both expressions. Arnd