Message ID | 20230113211151.2314874-1-andreas@kemnade.info |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp484068wrt; Fri, 13 Jan 2023 13:13:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXteI+THg5hT7TUj1s/vVTMlnpp1oITFq4N1cNpkaa6luA8wevlV1rBQzBwBzsBNeTr2yokC X-Received: by 2002:a17:90a:7383:b0:229:14eb:b296 with SMTP id j3-20020a17090a738300b0022914ebb296mr6137498pjg.38.1673644385642; Fri, 13 Jan 2023 13:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673644385; cv=none; d=google.com; s=arc-20160816; b=y5kTO7MEjNXDptrNvITPa3VHhDgWwj9p8X9twtbGcQry8sSkTsoM84W7D4+TodElQk 61jRmwYgu6TkXKeY8AFsAr6WSLJWkF4Uu7oshgrpLvkVBZkF+k75rLt/sho4p5ep09Wg LferG7bUSgjuzu+NxIs/LW0si7uG836FZrSb8gmuBVNmpOlUfNjS6SgMgmjV4l6mSD+U KayzNyTEAQfLgBL6sTRwhITVnUVEy07HLs8iE/Pzn7CwgfjDa22lSYoNn9iJb4L9KYTG Xml4Z87L9wmUt2VK/k3XO/lKxhNvBzLgCHIkm1uW6JPFCVvxD5Tp4fb5edXKGa4ZXE1c mkJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6wh/LvHiAV+cBnCS2OWc1a/uyl4L/FHgVxOEFcPbsNs=; b=W+Kb63LvlReU+VBXyjMLk0ndB9p7SGAygu2ci/YVqHVMkH5QXAMsEIuC5vhy4/Fqq5 yyE/nqQFvSYICKba1pucaOIHGlprz4ZAY63j7l7cx/v1AY0NxfybwMQCr8SZATBgANWe z7BpIZEbGHkSb5Ti3+GBDBv5/6JA1Gacig6/0sE02iYQ69vH54yh9ai6SoTgXgeY+H0M CaVEngZpi3iJKvWYHz4ykfZjQFT9VP6PwkcAQdwHWg21HhGr/uzhnlW8TGXy0oQCNH7C XhtzF26Ya41AV6k0BpmtnQ9TfcMvOfkDewW2CKwmpxKjGfIoF+IQCyYFNbqpB+cHwaau W4/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=+QCUBDwN; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a17090ac40200b00219f65e19fcsi24024218pjt.170.2023.01.13.13.12.41; Fri, 13 Jan 2023 13:13:05 -0800 (PST) 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=fail header.i=@kemnade.info header.s=20220719 header.b=+QCUBDwN; 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 S229870AbjAMVMM (ORCPT <rfc822;andrewvogler123@gmail.com> + 99 others); Fri, 13 Jan 2023 16:12:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229673AbjAMVMK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Jan 2023 16:12:10 -0500 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884244D4B3; Fri, 13 Jan 2023 13:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6wh/LvHiAV+cBnCS2OWc1a/uyl4L/FHgVxOEFcPbsNs=; b=+QCUBDwNzM+PirmCEw8yQTQJhi IEe2NVdTM+cA4w+1TeqBoy9kD7/3p7bi7e+11uMHQu/m7ns0cqUmz5VosWZ1f+T0EMoog0sh+/0KJ CFCD/QchLgm+UTUi7KbYFAVvXb6a2IY6/60/KByuXYz/qjJKj2cWq0wYCYsqUGAK2JuT7KfmYTht1 GfD1TOPpusSlgBSnlN2kw+qEzRivkyfVtBIO7MHRyyiJSVTdyvYBc4APt/iYrOZ3hMyHxL7ILB1v4 cwSXgPkkkhNEqc+LsYiiCS8OcE0viplmn7GTEeVCxKiFGxSTIWSr+YnPvu63A3DPWhJlATjwU+9cJ EZ9qAiiw==; Received: from p200300ccff089e001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff08:9e00:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <andreas@kemnade.info>) id 1pGRLD-0005C3-4A; Fri, 13 Jan 2023 22:11:59 +0100 Received: from andi by aktux with local (Exim 4.94.2) (envelope-from <andreas@kemnade.info>) id 1pGRLC-009iDU-JV; Fri, 13 Jan 2023 22:11:58 +0100 From: Andreas Kemnade <andreas@kemnade.info> To: bcousson@baylibre.com, tony@atomide.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, aford173@gmail.com, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "H. Nikolaus Schaller" <hns@goldelico.com>, Andreas Kemnade <andreas@kemnade.info> Subject: [PATCH] ARM: dts: gta04: fix excess dma channel usage Date: Fri, 13 Jan 2023 22:11:51 +0100 Message-Id: <20230113211151.2314874-1-andreas@kemnade.info> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.0 (-) 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_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754943335111790883?= X-GMAIL-MSGID: =?utf-8?q?1754943335111790883?= |
Series |
ARM: dts: gta04: fix excess dma channel usage
|
|
Commit Message
Andreas Kemnade
Jan. 13, 2023, 9:11 p.m. UTC
From: "H. Nikolaus Schaller" <hns@goldelico.com> OMAP processors support 32 channels but there is no check or inspect this except booting a device and looking at dmesg reports of not available channels. Recently some more subsystems with DMA (aes1+2) were added filling the list of dma channels beyond the limit of 32 (even if other parameters indicate 96 or 128 channels). This leads to random subsystem failures i(e.g. mcbsp for audio) after boot or boot messages that DMA can not be initialized. Another symptom is that /sys/kernel/debug/dmaengine/summary has 32 entries and does not show all required channels. Fix by disabling unused (on the GTA04 hardware) mcspi1...4. Each SPI channel allocates 4 DMA channels rapidly filling the available ones. Disabling unused SPI modules on the OMAP3 SoC may also save some energy (has not been checked). Fixes: c312f066314e ("ARM: dts: omap3: Migrate AES from hwmods to sysc-omap2") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> [re-enabled aes2, improved commit subject line] Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- arch/arm/boot/dts/omap3-gta04.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Comments
On Fri, Jan 13, 2023 at 3:12 PM Andreas Kemnade <andreas@kemnade.info> wrote: > > From: "H. Nikolaus Schaller" <hns@goldelico.com> > > OMAP processors support 32 channels but there is no check or > inspect this except booting a device and looking at dmesg reports > of not available channels. > > Recently some more subsystems with DMA (aes1+2) were added filling > the list of dma channels beyond the limit of 32 (even if other > parameters indicate 96 or 128 channels). This leads to random > subsystem failures i(e.g. mcbsp for audio) after boot or boot > messages that DMA can not be initialized. > > Another symptom is that > > /sys/kernel/debug/dmaengine/summary > > has 32 entries and does not show all required channels. > > Fix by disabling unused (on the GTA04 hardware) mcspi1...4. > Each SPI channel allocates 4 DMA channels rapidly filling > the available ones. > > Disabling unused SPI modules on the OMAP3 SoC may also save > some energy (has not been checked). Tony, Would it make sense to make this default in the omap3.dtsi file and enable them in the individual boards that need it? From what I can tell the following use mcspi1: logicpd-som-lv.dtsi logicpd-torpedo-som.dtsi omap3-evm-common.dtsi omap3-ldp.dts omap3-n900.dts omap3-pandora-common.dtsi omap3-tao3530.dtsi The following use mcspi2: omap3-lilly-a83x.dtsi mscpi3 is used on: omap3-tao3530.dtsi and mcspi4: omap3-n900.dts In theory that would save a bunch of boards duplicating the disabled status if they were to all follow suit. I was looking into doing something like that for the mmc drivers on various OMAP3 boards while disabling it on the omap3.dtsi. It seems like some drivers are disabled by default (dss, ssi, mcbsp) while others are enabled by default (i2c, spi, mmc, usb_otg_hs, gpmc, usbhshost, and a bunch of timers). Disabling some of these also might help speed up boot times if less devices need to enumerate. I am willing to do some of that work if the idea makes sense. adam > > Fixes: c312f066314e ("ARM: dts: omap3: Migrate AES from hwmods to sysc-omap2") > Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> > [re-enabled aes2, improved commit subject line] > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > --- > arch/arm/boot/dts/omap3-gta04.dtsi | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi > index 87e0ab1bbe95..e0be0fb23f80 100644 > --- a/arch/arm/boot/dts/omap3-gta04.dtsi > +++ b/arch/arm/boot/dts/omap3-gta04.dtsi > @@ -612,6 +612,22 @@ &i2c3 { > clock-frequency = <100000>; > }; > > +&mcspi1 { > + status = "disabled"; > +}; > + > +&mcspi2 { > + status = "disabled"; > +}; > + > +&mcspi3 { > + status = "disabled"; > +}; > + > +&mcspi4 { > + status = "disabled"; > +}; > + > &usb_otg_hs { > interface-type = <0>; > usb-phy = <&usb2_phy>; > -- > 2.30.2 >
Hi, * Adam Ford <aford173@gmail.com> [230116 14:16]: > Would it make sense to make this default in the omap3.dtsi file and > enable them in the individual boards that need it? In general disabling the unused devices by default for omaps will break the power management. The disabled devices are completely ignored by the kernel, and the devices are left to whatever the bootloader state might be. For SoCs using firmware to manage devices it's a bit different story however. The firmware can still idle disabled devices based on a late_initcall for example, even if the kernel knows nothing about the disabled devices. Regards, Tony
Hi, > Am 16.01.2023 um 15:51 schrieb Tony Lindgren <tony@atomide.com>: > > Hi, > > * Adam Ford <aford173@gmail.com> [230116 14:16]: >> Would it make sense to make this default in the omap3.dtsi file and >> enable them in the individual boards that need it? > > In general disabling the unused devices by default for omaps will break > the power management. The disabled devices are completely ignored by the > kernel, and the devices are left to whatever the bootloader state might > be. Yes, indeed. > For SoCs using firmware to manage devices it's a bit different story > however. The firmware can still idle disabled devices based on a > late_initcall for example, even if the kernel knows nothing about the > disabled devices. But how can we then handle all devices being "okay" by default and eating up more dma channels than are available? We can't put all under power management AND dma by default. Or can dma channel usage be postponed until the device is really used? BR, Nikolaus
On Mon, 16 Jan 2023 16:51:57 +0200 Tony Lindgren <tony@atomide.com> wrote: > Hi, > > * Adam Ford <aford173@gmail.com> [230116 14:16]: > > Would it make sense to make this default in the omap3.dtsi file and > > enable them in the individual boards that need it? > > In general disabling the unused devices by default for omaps will break > the power management. The disabled devices are completely ignored by the > kernel, and the devices are left to whatever the bootloader state might > be. > hmm, shouldn't ti-sysc keep things disabled in most cases? It is still a bit known because there is no status = "disabled" in the target-module@xxx node. Regards, Andreas
* Andreas Kemnade <andreas@kemnade.info> [230116 16:39]: > On Mon, 16 Jan 2023 16:51:57 +0200 > Tony Lindgren <tony@atomide.com> wrote: > > > Hi, > > > > * Adam Ford <aford173@gmail.com> [230116 14:16]: > > > Would it make sense to make this default in the omap3.dtsi file and > > > enable them in the individual boards that need it? > > > > In general disabling the unused devices by default for omaps will break > > the power management. The disabled devices are completely ignored by the > > kernel, and the devices are left to whatever the bootloader state might > > be. > > > hmm, shouldn't ti-sysc keep things disabled in most cases? It is still a bit > known because there is no status = "disabled" in the target-module@xxx node. Oh right, if the child device is tagged disabled (instead of the the parent ti-sysc tagged disabled) the module should get idled just fine as long as the module related quirks are implemented for ti-sysc.c. But still, I'd rather not start tagging devices disabled by default and then re-enabling everywhere since we never needed it before. It just adds a lot of pointless status tinkering, see commit 12afc0cf8121 ("ARM: dts: Drop pointless status changing for am3 musb"). So considering things, IMO it's best to set only the child device with status disabled, and set it at the board specific dts file in this case. Also note that the dma channels could be freed with /delete-property/ at the board specific dts file even for devices that are usable if not really needed. Regards, Tony
* H. Nikolaus Schaller <hns@goldelico.com> [230116 15:29]: > Hi, > > > Am 16.01.2023 um 15:51 schrieb Tony Lindgren <tony@atomide.com>: > > > > Hi, > > > > * Adam Ford <aford173@gmail.com> [230116 14:16]: > >> Would it make sense to make this default in the omap3.dtsi file and > >> enable them in the individual boards that need it? > > > > In general disabling the unused devices by default for omaps will break > > the power management. The disabled devices are completely ignored by the > > kernel, and the devices are left to whatever the bootloader state might > > be. > > Yes, indeed. See my further clarification based on what Adam commented too, I was thinking status = "disabled" at the ti-sysc parent level. > > For SoCs using firmware to manage devices it's a bit different story > > however. The firmware can still idle disabled devices based on a > > late_initcall for example, even if the kernel knows nothing about the > > disabled devices. > > But how can we then handle all devices being "okay" by default and > eating up more dma channels than are available? 1. Set the child device (not the ti-sysc node) with status = "disabled" in the board specific file as needed 2. Use /delete-property/ for dma channels in the board specific file if the device is in use but does not need dma 3. Or if this is a generic problem, we could disable dma by default for some devices > We can't put all under power management AND dma by default. > > Or can dma channel usage be postponed until the device is really used? Sure. Regards, Tony
On Mon, Jan 16, 2023 at 10:56 AM Tony Lindgren <tony@atomide.com> wrote: > > * Andreas Kemnade <andreas@kemnade.info> [230116 16:39]: > > On Mon, 16 Jan 2023 16:51:57 +0200 > > Tony Lindgren <tony@atomide.com> wrote: > > > > > Hi, > > > > > > * Adam Ford <aford173@gmail.com> [230116 14:16]: > > > > Would it make sense to make this default in the omap3.dtsi file and > > > > enable them in the individual boards that need it? > > > > > > In general disabling the unused devices by default for omaps will break > > > the power management. The disabled devices are completely ignored by the > > > kernel, and the devices are left to whatever the bootloader state might > > > be. > > > > > hmm, shouldn't ti-sysc keep things disabled in most cases? It is still a bit > > known because there is no status = "disabled" in the target-module@xxx node. > > Oh right, if the child device is tagged disabled (instead of the the parent > ti-sysc tagged disabled) the module should get idled just fine as long as the > module related quirks are implemented for ti-sysc.c. > > But still, I'd rather not start tagging devices disabled by default and then > re-enabling everywhere since we never needed it before. It just adds a lot > of pointless status tinkering, see commit 12afc0cf8121 ("ARM: dts: Drop > pointless status changing for am3 musb"). > > So considering things, IMO it's best to set only the child device with > status disabled, and set it at the board specific dts file in this case. Doesn't this imply the target-module stuff needs to be implemented for the drivers? It looks like a lot of the omap3 drivers are still using hwmods although some have target-modules. In this case, the mcspi drivers that Andreas is disabling don't appear to have target-module stuff configured. adam > > Also note that the dma channels could be freed with /delete-property/ at the > board specific dts file even for devices that are usable if not really > needed. > > Regards, > > Tony >
* Adam Ford <aford173@gmail.com> [230116 17:00]: > Doesn't this imply the target-module stuff needs to be implemented for > the drivers? It looks like a lot of the omap3 drivers are still using > hwmods although some have target-modules. In this case, the mcspi > drivers that Andreas is disabling don't appear to have target-module > stuff configured. Sorry I don't remember if omap_device.c ignores status disabled or not. But in any case, it should be trivial to update omap3.dtsi to configure some of the devices like mcspi to probe with device tree data and ti-sysc as needed. Regards, Tony
* Tony Lindgren <tony@atomide.com> [230116 17:33]: > * Adam Ford <aford173@gmail.com> [230116 17:00]: > > Doesn't this imply the target-module stuff needs to be implemented for > > the drivers? It looks like a lot of the omap3 drivers are still using > > hwmods although some have target-modules. In this case, the mcspi > > drivers that Andreas is disabling don't appear to have target-module > > stuff configured. > > Sorry I don't remember if omap_device.c ignores status disabled or not. > But in any case, it should be trivial to update omap3.dtsi to configure > some of the devices like mcspi to probe with device tree data and ti-sysc > as needed. So as long as gta04 power management still behaves with this patch it should good to go. Just to note, if mcspi is at some point is updated to probe with ti-sysc, the disabled flag needs to be kept at the mcspi child node, not at the sysc target module level to idle the unused devices. Regards, Tony
On Thu, 19 Jan 2023 09:30:20 +0200 Tony Lindgren <tony@atomide.com> wrote: > * Tony Lindgren <tony@atomide.com> [230116 17:33]: > > * Adam Ford <aford173@gmail.com> [230116 17:00]: > > > Doesn't this imply the target-module stuff needs to be implemented for > > > the drivers? It looks like a lot of the omap3 drivers are still using > > > hwmods although some have target-modules. In this case, the mcspi > > > drivers that Andreas is disabling don't appear to have target-module > > > stuff configured. > > > > Sorry I don't remember if omap_device.c ignores status disabled or not. > > But in any case, it should be trivial to update omap3.dtsi to configure > > some of the devices like mcspi to probe with device tree data and ti-sysc > > as needed. > > So as long as gta04 power management still behaves with this patch it > should good to go. > # sleep 10 ; /usr/local/bin/idledump CM_IDLEST1_CORE 00000042 CM_IDLEST3_CORE 00000000 CM_FCLKEN1_CORE 00000000 CM_FCLKEN3_CORE 00000002 CM_CLKSTST_CORE 00000003 CM_IDLEST_CKGEN 00000209 CM_IDLEST2_CKGEN 00000000 CM_FCLKEN_DSS 00000000 CM_IDLEST_DSS 00000000 CM_FCLKEN_CAM 00000000 CM_IDLEST_CAM 00000000 CM_FCLKEN_PER 00000000 CM_IDLEST_PER 00000000 FCLKEN3_CORE becomes 0 after unbinding the bandgap sensor. but... # cat /sys/kernel/debug/pm_debug/time usbhost_pwrdm (ON),OFF:830267486567,RET:0,INA:0,ON:12202880865 sgx_pwrdm (INA),OFF:0,RET:0,INA:841224365234,ON:1245971680 core_pwrdm (ON),OFF:0,RET:0,INA:0,ON:842470336914 per_pwrdm (ON),OFF:520406799328,RET:30043365464,INA:0,ON:292020111087 hmmm.... but does not look like anything related to mcspi*. Regards, Andreas
* Andreas Kemnade <andreas@kemnade.info> [230113 23:12]: > From: "H. Nikolaus Schaller" <hns@goldelico.com> > > OMAP processors support 32 channels but there is no check or > inspect this except booting a device and looking at dmesg reports > of not available channels. > > Recently some more subsystems with DMA (aes1+2) were added filling > the list of dma channels beyond the limit of 32 (even if other > parameters indicate 96 or 128 channels). This leads to random > subsystem failures i(e.g. mcbsp for audio) after boot or boot > messages that DMA can not be initialized. > > Another symptom is that > > /sys/kernel/debug/dmaengine/summary > > has 32 entries and does not show all required channels. > > Fix by disabling unused (on the GTA04 hardware) mcspi1...4. > Each SPI channel allocates 4 DMA channels rapidly filling > the available ones. > > Disabling unused SPI modules on the OMAP3 SoC may also save > some energy (has not been checked). Applying this into omap-for-v6.4/dt based on what we discussed in this thread earlier. Thanks, Tony
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi index 87e0ab1bbe95..e0be0fb23f80 100644 --- a/arch/arm/boot/dts/omap3-gta04.dtsi +++ b/arch/arm/boot/dts/omap3-gta04.dtsi @@ -612,6 +612,22 @@ &i2c3 { clock-frequency = <100000>; }; +&mcspi1 { + status = "disabled"; +}; + +&mcspi2 { + status = "disabled"; +}; + +&mcspi3 { + status = "disabled"; +}; + +&mcspi4 { + status = "disabled"; +}; + &usb_otg_hs { interface-type = <0>; usb-phy = <&usb2_phy>;