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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06A49C43462 for ; Fri, 9 Apr 2021 13:35:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB88B61108 for ; Fri, 9 Apr 2021 13:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233607AbhDINfg (ORCPT ); Fri, 9 Apr 2021 09:35:36 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:60757 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbhDINff (ORCPT ); Fri, 9 Apr 2021 09:35:35 -0400 Received: from mail-ot1-f46.google.com ([209.85.210.46]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MKKd7-1lHJaB3nAt-00Lmj3; Fri, 09 Apr 2021 15:35:21 +0200 Received: by mail-ot1-f46.google.com with SMTP id k14-20020a9d7dce0000b02901b866632f29so5711168otn.1; Fri, 09 Apr 2021 06:35:20 -0700 (PDT) X-Gm-Message-State: AOAM532xvLKvGNL2LF61vwvwtwLHReYP9333LL2z5p1rlYjdMf69CKzw fSpUfUYdMVyq9818UN5Y7dhxe7yzwRDpnGLAGHc= X-Google-Smtp-Source: ABdhPJynlbx4kLNikSNjAjnCb5vtFq6G/850R+R5+xWMARHqWLy+tfY7F0Z+Hrp7Hz4KWDmPvvGBCrUcX4hM8LkZWnk= X-Received: by 2002:a9d:758b:: with SMTP id s11mr12240759otk.305.1617975319390; Fri, 09 Apr 2021 06:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20210409112035.27221-1-david@redhat.com> In-Reply-To: <20210409112035.27221-1-david@redhat.com> From: Arnd Bergmann Date: Fri, 9 Apr 2021 15:35:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: David Hildenbrand Cc: Linux Kernel Mailing List , Linux-MM , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Joel Stanley , Andrew Jeffery , Lucas Stach , Russell King , Christian Gmeiner , Paul Cercueil , Linus Walleij , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Andrew Morton , Mike Rapoport , Bartlomiej Zolnierkiewicz , Eric Anholt , Michal Simek , Masahiro Yamada , "Alexander A. Klimov" , Peter Collingbourne , Suman Anna , Jason Gunthorpe , dri-devel , linux-aspeed , Linux ARM , The etnaviv authors , "open list:BROADCOM NVRAM DRIVER" , Linux Fbdev development list , "open list:IOMMU DRIVERS" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:/7zXw/c1UfESlEruqAGXS8UzIHuJI2NxiDK7tVwMgfdq4wYKuFS 6pXkdJchhga4+TmhN9Ms++pwBTz9yL9aKgjVvkvHHvhiWjciAWR+WA3f421jDGE5exNDCzr Zk5rhoQb9IDWjo/pGPYYeB2HOtt/KqEOaWYPozig6+QzGPuhVphXpUk/7G2o29IHNdPUcek fajs/Hllr8UunECmkMm7A== X-UI-Out-Filterresults: notjunk:1;V03:K0:Ug59u7F3OJQ=:3IXoa0MamCC3tSceenqEE6 Q79+SXOGJ/h7Ykjqa6HuOBjWxBa8k1io25xcFGxpQDn5WLf5vIQ04Q7VygmOtvaDZU34kLSWx 3WtRiTo6IJMGXSre12X0/Tp6Yzk7E81VxdfylZacU9F8rwfU8fpA5K5e8gx8N/QAE4FZLg6AW 5wU9f6mF6tQuLiyMAonPYwaVG0slmNcPh447tFDuIc9sQPklyKSNEBzRsSoFxmvPmWWASKKEW BblFUNyAg6zFxLiQZeahg/nmKUn//83+AutMsoa5nDPJmO8xSe6MIyetduAmheLONxu5JJYfG p/TpJ6nkCuxUfDqGueDOCICsT7xcRKuQNdCODZhVZCmHt5oVXblvQQTU8RpfzPbN19SXMoLRb EbiTZbIFeHKKv5M++TMmBAT4T2WFokbdEyo5UT1cFpUmNgeCCizy7OXCSouDqXcv6yGaHGiuo g9Ph9lviL6CiZVSiRw51AcD+QMmrz2o= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 9, 2021 at 1:21 PM David Hildenbrand wrote: > > Random drivers should not override a user configuration of core knobs > (e.g., CONFIG_DMA_CMA=n). Applicable drivers would like to use DMA_CMA, > which depends on CMA, if possible; however, these drivers also have to > tolerate if DMA_CMA is not available/functioning, for example, if no CMA > area for DMA_CMA use has been setup via "cma=X". In the worst case, the > driver cannot do it's job properly in some configurations. > > For example, commit 63f5677544b3 ("drm/etnaviv: select CMA and DMA_CMA if > available") documents > While this is no build dependency, etnaviv will only work correctly > on most systems if CMA and DMA_CMA are enabled. Select both options > if available to avoid users ending up with a non-working GPU due to > a lacking kernel config. > So etnaviv really wants to have DMA_CMA, however, can deal with some cases > where it is not available. > > Let's introduce WANT_DMA_CMA and use it in most cases where drivers > select CMA/DMA_CMA, or depend on DMA_CMA (in a wrong way via CMA because > of recursive dependency issues). > > We'll assume that any driver that selects DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER would like to use DMA_CMA if possible. > > With this change, distributions can disable CONFIG_CMA or > CONFIG_DMA_CMA, without it silently getting enabled again by random > drivers. Also, we'll now automatically try to enabled both, CONFIG_CMA > and CONFIG_DMA_CMA if they are unspecified and any driver is around that > selects WANT_DMA_CMA -- also implicitly via DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER. > > For example, if any driver selects WANT_DMA_CMA and we do a > "make olddefconfig": > > 1. With "# CONFIG_CMA is not set" and no specification of > "CONFIG_DMA_CMA" > > -> CONFIG_DMA_CMA won't be part of .config > > 2. With no specification of CONFIG_CMA or CONFIG_DMA_CMA > > Contiguous Memory Allocator (CMA) [Y/n/?] (NEW) > DMA Contiguous Memory Allocator (DMA_CMA) [Y/n/?] (NEW) > > 3. With "# CONFIG_CMA is not set" and "# CONFIG_DMA_CMA is not set" > > -> CONFIG_DMA_CMA will be removed from .config > > Note: drivers/remoteproc seems to be special; commit c51e882cd711 > ("remoteproc/davinci: Update Kconfig to depend on DMA_CMA") explains that > there is a real dependency to DMA_CMA for it to work; leave that dependency > in place and don't convert it to a soft dependency. I don't think this dependency is fundamentally different from the others, though davinci machines tend to have less memory than a lot of the other machines, so it's more likely to fail without CMA. Regardless of this, Reviewed-by: Arnd Bergmann 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63AD8C43470 for ; Fri, 9 Apr 2021 13:35:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E080261178 for ; Fri, 9 Apr 2021 13:35:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E080261178 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 665E66B006E; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63BC66B0070; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B8266B0071; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 2AAB66B006E for ; Fri, 9 Apr 2021 09:35:24 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D52993624 for ; Fri, 9 Apr 2021 13:35:23 +0000 (UTC) X-FDA: 78012925326.31.A3DCAC0 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by imf24.hostedemail.com (Postfix) with ESMTP id A1BDEA000143 for ; Fri, 9 Apr 2021 13:35:18 +0000 (UTC) Received: from mail-ot1-f47.google.com ([209.85.210.47]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MiIhU-1m1Qx50gC6-00fUWR for ; Fri, 09 Apr 2021 15:35:21 +0200 Received: by mail-ot1-f47.google.com with SMTP id t23-20020a0568301e37b02901b65ab30024so5697345otr.4 for ; Fri, 09 Apr 2021 06:35:20 -0700 (PDT) X-Gm-Message-State: AOAM530Av2utdRVV73uVBJanBaBNN+/Oe+hKqv60m17/1oW21Kmxa5E6 eDf5415qSybhqN/VwHl4l9SKcafrH05gqV9alXo= X-Google-Smtp-Source: ABdhPJynlbx4kLNikSNjAjnCb5vtFq6G/850R+R5+xWMARHqWLy+tfY7F0Z+Hrp7Hz4KWDmPvvGBCrUcX4hM8LkZWnk= X-Received: by 2002:a9d:758b:: with SMTP id s11mr12240759otk.305.1617975319390; Fri, 09 Apr 2021 06:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20210409112035.27221-1-david@redhat.com> In-Reply-To: <20210409112035.27221-1-david@redhat.com> From: Arnd Bergmann Date: Fri, 9 Apr 2021 15:35:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: David Hildenbrand Cc: Linux Kernel Mailing List , Linux-MM , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Joel Stanley , Andrew Jeffery , Lucas Stach , Russell King , Christian Gmeiner , Paul Cercueil , Linus Walleij , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Andrew Morton , Mike Rapoport , Bartlomiej Zolnierkiewicz , Eric Anholt , Michal Simek , Masahiro Yamada , "Alexander A. Klimov" , Peter Collingbourne , Suman Anna , Jason Gunthorpe , dri-devel , linux-aspeed , Linux ARM , The etnaviv authors , "open list:BROADCOM NVRAM DRIVER" , Linux Fbdev development list , "open list:IOMMU DRIVERS" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:zujcCUeU99yOgref8KSZibKzyqmwS4vOm3sFA3lyFKPx+qLuQpq RvkN5wXWMh+NGdg0XNcVZO1chJZ/FX1UuN0MdjDuSBiL+QoNtPez1kL7VfiIcnuJNhZNjgq IOeB27VJaxESYa/WURKi61D+NbWq0Zisd3V25gsaI3aJQENAgu1NHNt4vBGFpXoxIE4yyqt lT+ymra6c/Hh+CrKNs6IA== X-UI-Out-Filterresults: notjunk:1;V03:K0:UXvXZCDfB50=:gisZ5GoVEMqzulKEQvarVN A2pR803JBwVs6W+mRtzKW09xj0u71D7prlmiuTzm/OQPX/khp6YJvpcJlEgDaYIllkxiX+Cd1 XRJLfODM56czgHwlX+hlU9w+YidCUAf1MIaID4cfiktiksp0/3/O9XEoaZjY52Z2xdj8Lcn8r kN8n+qPoryiiUJwDuhYV9yFzbzb9HCUwGrtDPLVRQLH7PWgVnf3jog1yPFLd8J0X73k8ktEP/ XH27Nrn2qDRX6pWtaM/yp2tHmXV0zXDcof7Z2+T2yWF/SGRfQTokM9jLmzNr/dSOXZ9rj42vs WRgQdPkZsPgPF4Ohx2AmpSShCRbvBL+LzOCFH6vsMz4057EYIUj5AOUYAMG9cWnSboNYl6661 nKqn4SABR9+tHyXgVmH4bqpGEiNDYrD7iFOxy7FH7nc3vA6Gk2vD7z8/aJs7if6SwLnMgrDrN iwn2kSHn3O5AcBnLXnKI0ZeBBjGZeko= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A1BDEA000143 X-Stat-Signature: shpx6j43g6bo86b7t75kdtxeyce9rh5s Received-SPF: none (arndb.de>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mout.kundenserver.de; client-ip=212.227.17.24 X-HE-DKIM-Result: none/none X-HE-Tag: 1617975318-551671 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Apr 9, 2021 at 1:21 PM David Hildenbrand wrote: > > Random drivers should not override a user configuration of core knobs > (e.g., CONFIG_DMA_CMA=n). Applicable drivers would like to use DMA_CMA, > which depends on CMA, if possible; however, these drivers also have to > tolerate if DMA_CMA is not available/functioning, for example, if no CMA > area for DMA_CMA use has been setup via "cma=X". In the worst case, the > driver cannot do it's job properly in some configurations. > > For example, commit 63f5677544b3 ("drm/etnaviv: select CMA and DMA_CMA if > available") documents > While this is no build dependency, etnaviv will only work correctly > on most systems if CMA and DMA_CMA are enabled. Select both options > if available to avoid users ending up with a non-working GPU due to > a lacking kernel config. > So etnaviv really wants to have DMA_CMA, however, can deal with some cases > where it is not available. > > Let's introduce WANT_DMA_CMA and use it in most cases where drivers > select CMA/DMA_CMA, or depend on DMA_CMA (in a wrong way via CMA because > of recursive dependency issues). > > We'll assume that any driver that selects DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER would like to use DMA_CMA if possible. > > With this change, distributions can disable CONFIG_CMA or > CONFIG_DMA_CMA, without it silently getting enabled again by random > drivers. Also, we'll now automatically try to enabled both, CONFIG_CMA > and CONFIG_DMA_CMA if they are unspecified and any driver is around that > selects WANT_DMA_CMA -- also implicitly via DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER. > > For example, if any driver selects WANT_DMA_CMA and we do a > "make olddefconfig": > > 1. With "# CONFIG_CMA is not set" and no specification of > "CONFIG_DMA_CMA" > > -> CONFIG_DMA_CMA won't be part of .config > > 2. With no specification of CONFIG_CMA or CONFIG_DMA_CMA > > Contiguous Memory Allocator (CMA) [Y/n/?] (NEW) > DMA Contiguous Memory Allocator (DMA_CMA) [Y/n/?] (NEW) > > 3. With "# CONFIG_CMA is not set" and "# CONFIG_DMA_CMA is not set" > > -> CONFIG_DMA_CMA will be removed from .config > > Note: drivers/remoteproc seems to be special; commit c51e882cd711 > ("remoteproc/davinci: Update Kconfig to depend on DMA_CMA") explains that > there is a real dependency to DMA_CMA for it to work; leave that dependency > in place and don't convert it to a soft dependency. I don't think this dependency is fundamentally different from the others, though davinci machines tend to have less memory than a lot of the other machines, so it's more likely to fail without CMA. Regardless of this, Reviewed-by: Arnd Bergmann 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65D4EC433B4 for ; Fri, 9 Apr 2021 13:36:01 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 0CFF2610E5 for ; Fri, 9 Apr 2021 13:36:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CFF2610E5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D0BA684ACB; Fri, 9 Apr 2021 13:36:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8wXLd4oFGGhd; Fri, 9 Apr 2021 13:36:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTP id 995FF84867; Fri, 9 Apr 2021 13:35:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6CE44C000C; Fri, 9 Apr 2021 13:35:59 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 25FC5C000A for ; Fri, 9 Apr 2021 13:35:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A33BA401C0 for ; Fri, 9 Apr 2021 13:35:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YKhsRJRDL-Vj for ; Fri, 9 Apr 2021 13:35:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) by smtp2.osuosl.org (Postfix) with ESMTPS id E4C4B40E96 for ; Fri, 9 Apr 2021 13:35:33 +0000 (UTC) Received: from mail-ot1-f47.google.com ([209.85.210.47]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MFKX3-1lK8z545U1-00FjUR for ; Fri, 09 Apr 2021 15:35:31 +0200 Received: by mail-ot1-f47.google.com with SMTP id y19-20020a0568301d93b02901b9f88a238eso5663208oti.11 for ; Fri, 09 Apr 2021 06:35:30 -0700 (PDT) X-Gm-Message-State: AOAM530JOvmbKl2enp58AWomExNKQOlUq0RbYyE8cvCdZ48PsLoSNIz+ 3aYSRzZ+eeH97UkIXeq6qsE2cu8ydMLUKNP66gw= X-Google-Smtp-Source: ABdhPJynlbx4kLNikSNjAjnCb5vtFq6G/850R+R5+xWMARHqWLy+tfY7F0Z+Hrp7Hz4KWDmPvvGBCrUcX4hM8LkZWnk= X-Received: by 2002:a9d:758b:: with SMTP id s11mr12240759otk.305.1617975319390; Fri, 09 Apr 2021 06:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20210409112035.27221-1-david@redhat.com> In-Reply-To: <20210409112035.27221-1-david@redhat.com> From: Arnd Bergmann Date: Fri, 9 Apr 2021 15:35:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: David Hildenbrand X-Provags-ID: V03:K1:OMAF1FO98rpK/VrW1T2O2Tq8Wv51pZhAa8YqWUZyqINkuHbsS0X 9LyFZ0+VuvDHNICSW5CyPf0lboMrJyQzbGqEl9r1mvuebjNM85cDvGejCsfsFbl0wlWKjiW 53rRNzQw3ZOiTWfAusitxIKi/6k6igdRuIf0n1Pq7n72dmqVM4k+KU7Xd2xz/6LGoh04JJm EpVesAa7gaMXP0s5IiCww== X-UI-Out-Filterresults: notjunk:1;V03:K0:VcyZhBwg+9o=:bBsdt/ixMtx5NmZOYpGOuo 9GWPLNgyG3qa6dtU07rJpF6Q/HyAvzR/MO6V3v0j13QgUmzetrZkMqAqPWbH9gDeVO5BwcVuJ QBP8uXo0ulAnYCzsKB5mLebxkbHCDjitrHG9us3i9E0MgBNX/aHE7zdlCNWKS17R4O4ICmXXc SkaOJY80T/tLPJDfXiPYFRrWCYzK8XeqR7nE3jLBJaULltBmOtxkTCsKkyBa13EdWqujpkfLJ TcsnTz+GsG72h9X4dL5TVW/eF3zj+iTEGcwYYj69qG/1Vvq4jQ9nTYxBww2E5T4TyRgFmaCLo JSmXeYhCE7tJrMRk6qCkk2CP+hofCdrogHzFaKlmI7wI3DxcAZgXZzJGpRvv5as+GST3CGvjU IRWwoaP2NGav/wMZKMoDbqVYg7VI8z0OAECfKIKcvBwKG5ACBg7mJ6iT90qiwJzJJAgVeIO0H 3UjJXjhQ0OY1hNULjxHVj0A6hs7Hmra3XK4U02j/6mH4dxMl8QgktvpTwxQLMNCrjcpW5ISsY qjWogXFu7PIDRPvYXLXxkxmo4EFC3WTY4HESwAYKNXGbkAwZ2GUKobAq2MxLLzPhby7Jtw219 6uFLnsimRb5lLAnmo7+D5PxKRosV1W51YV Cc: Linux Fbdev development list , linux-aspeed , David Airlie , Linus Walleij , dri-devel , "open list:BROADCOM NVRAM DRIVER" , Paul Cercueil , Eric Anholt , Christoph Hellwig , Masahiro Yamada , Michal Simek , Jason Gunthorpe , Joel Stanley , Russell King , Thomas Zimmermann , Bartlomiej Zolnierkiewicz , Maarten Lankhorst , The etnaviv authors , Maxime Ripard , Christian Gmeiner , Peter Collingbourne , Linux ARM , "Alexander A. Klimov" , Linux-MM , Andrew Jeffery , Linux Kernel Mailing List , "open list:IOMMU DRIVERS" , Daniel Vetter , Andrew Morton , Robin Murphy , Mike Rapoport , Lucas Stach X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, Apr 9, 2021 at 1:21 PM David Hildenbrand wrote: > > Random drivers should not override a user configuration of core knobs > (e.g., CONFIG_DMA_CMA=n). Applicable drivers would like to use DMA_CMA, > which depends on CMA, if possible; however, these drivers also have to > tolerate if DMA_CMA is not available/functioning, for example, if no CMA > area for DMA_CMA use has been setup via "cma=X". In the worst case, the > driver cannot do it's job properly in some configurations. > > For example, commit 63f5677544b3 ("drm/etnaviv: select CMA and DMA_CMA if > available") documents > While this is no build dependency, etnaviv will only work correctly > on most systems if CMA and DMA_CMA are enabled. Select both options > if available to avoid users ending up with a non-working GPU due to > a lacking kernel config. > So etnaviv really wants to have DMA_CMA, however, can deal with some cases > where it is not available. > > Let's introduce WANT_DMA_CMA and use it in most cases where drivers > select CMA/DMA_CMA, or depend on DMA_CMA (in a wrong way via CMA because > of recursive dependency issues). > > We'll assume that any driver that selects DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER would like to use DMA_CMA if possible. > > With this change, distributions can disable CONFIG_CMA or > CONFIG_DMA_CMA, without it silently getting enabled again by random > drivers. Also, we'll now automatically try to enabled both, CONFIG_CMA > and CONFIG_DMA_CMA if they are unspecified and any driver is around that > selects WANT_DMA_CMA -- also implicitly via DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER. > > For example, if any driver selects WANT_DMA_CMA and we do a > "make olddefconfig": > > 1. With "# CONFIG_CMA is not set" and no specification of > "CONFIG_DMA_CMA" > > -> CONFIG_DMA_CMA won't be part of .config > > 2. With no specification of CONFIG_CMA or CONFIG_DMA_CMA > > Contiguous Memory Allocator (CMA) [Y/n/?] (NEW) > DMA Contiguous Memory Allocator (DMA_CMA) [Y/n/?] (NEW) > > 3. With "# CONFIG_CMA is not set" and "# CONFIG_DMA_CMA is not set" > > -> CONFIG_DMA_CMA will be removed from .config > > Note: drivers/remoteproc seems to be special; commit c51e882cd711 > ("remoteproc/davinci: Update Kconfig to depend on DMA_CMA") explains that > there is a real dependency to DMA_CMA for it to work; leave that dependency > in place and don't convert it to a soft dependency. I don't think this dependency is fundamentally different from the others, though davinci machines tend to have less memory than a lot of the other machines, so it's more likely to fail without CMA. Regardless of this, Reviewed-by: Arnd Bergmann _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1DD9C43460 for ; Fri, 9 Apr 2021 13:37:49 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 4A13561108 for ; Fri, 9 Apr 2021 13:37:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A13561108 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=zsyWEOZY+tiC9FINQ/qY3RuIa8JvLkJCgVfpX/JHpDQ=; b=VIcG94NwF/5HBrNCNFzbIqqdU aMChv2XpZkpoWKznwEY1NCs6anhIh7/kfejdpelRd0Mzsbi0yBMkepr4xO7E6lh2yRULH/YJIlUbz xyQEY16TjpYYPfKSzCX5E1o4w8v6aQU08L6SPGoyHtnFhoXSUi5+ZisvGyX/om2VNyyz7fM5ZbXbf UomkfSrNXJkZ+DaU66FOrOTIphLkusRyDrlGHoy2eBJPYYeHugGeDq38r5/NosHfseIUMMWfaIH1C i4lfBgooQIUA6VPEYnjZyrRpYN+yYy7cLEcstyBSsVYaEAgaXI3lNsqQXn3JNh31KuhOdK1gK9cl5 +ZOTv8YYg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUrIW-000pyL-4U; Fri, 09 Apr 2021 13:35:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUrIR-000py9-Sc for linux-arm-kernel@desiato.infradead.org; Fri, 09 Apr 2021 13:35:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yId9o196h6K7DXFDKAFmn+u8X22BPRejHTFYE2oXPjI=; b=cNDetRWWN7z4/KBUWUwzhPE3NM tRYs6lZpX3Az3E06jWMIi6ArwSfNKYRpZel6TtWwJHF2PQmevMhcFwTAPiVM9bV+5qNGDiYDxqyqg GU0tzzjtqo6uw7C8DLRiDaPjQSz4SbjFJrK0h+vEyaoMVIX6n9csnxw20BjPHokGRZbwrzU0jqfNA oouqgeQ3h1rPKOG+mnS4mhoQKlFYS9W9VMfruqQDw3dBa7DxI8WfND0tyJcS/MdrlHr4xgkabUeFQ Q05kVAeRwIsr78HXqVzsodNj3wxVsnJSkxWXxsIn6zrFUsQ6TYpwSP1G5bllxHf40+veAfXIlreNF TQAKt0Qw==; Received: from mout.kundenserver.de ([217.72.192.73]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUrIO-004YDQ-TQ for linux-arm-kernel@lists.infradead.org; Fri, 09 Apr 2021 13:35:38 +0000 Received: from mail-ua1-f44.google.com ([209.85.222.44]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MQMqN-1l93Br32UT-00MNKF for ; Fri, 09 Apr 2021 15:35:30 +0200 Received: by mail-ua1-f44.google.com with SMTP id u11so1828049uaw.2 for ; Fri, 09 Apr 2021 06:35:30 -0700 (PDT) X-Gm-Message-State: AOAM531E9nQz056Stsja1wfrC1lqnbJt9ElIlUjmxtSDRcTHhy9YIrjD rnuETMFkfEkMJsv5VXZMcxtNcKnUt+UfnGwqXbM= X-Google-Smtp-Source: ABdhPJynlbx4kLNikSNjAjnCb5vtFq6G/850R+R5+xWMARHqWLy+tfY7F0Z+Hrp7Hz4KWDmPvvGBCrUcX4hM8LkZWnk= X-Received: by 2002:a9d:758b:: with SMTP id s11mr12240759otk.305.1617975319390; Fri, 09 Apr 2021 06:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20210409112035.27221-1-david@redhat.com> In-Reply-To: <20210409112035.27221-1-david@redhat.com> From: Arnd Bergmann Date: Fri, 9 Apr 2021 15:35:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: David Hildenbrand X-Provags-ID: V03:K1:fnKTB+5Bn/GyGgUzb0x/oGvTf3SCDawi575CaUbyWLLyFHvVE55 XR2kLkPTZ7gxtMeNUxGhJTsMnC0DJOvXDKa3N98/myPBS117B/JkvXPgU5stEaX0wbweRzh J9ktJ+1Aaz05n7+3b/m4vgmnhTvtUOZJC7sHeudGxefMXZP1klMCdu47d608W2GiHKOyZqk E0eHEQhw59EjrWPvep3Iw== X-UI-Out-Filterresults: notjunk:1;V03:K0:V3GIOZtjsQY=:GRcMQMKFF1JEJuTpuSa1Vo PQIRMQRblywSPf2nXTwBlGV+WPjZlWCejJ8AQqWU94mrYtG7X77OKUZkO0cT0RRg6jnajovwS nK85XG9kOHbShtNKIpSpKuF3qjc4N2TUBSSD/r24SWcjk6Z5ky3dPWjmATZ73Ut8mTq7QIoOJ 11y3tQpVhVZLCUoyITQomJH8ivz+TmR4aTGbmNO3pZfqX/cvxYT7XZckqV8GR0FZmSuGm1oYw 77L/F+wzCf9fwhJCEc7CTeNVHGTjcdGnLoBuoTi7TtfAa6ufv9SrO1x/w1H8qL16xzEovayfu ViFjS0kK4pWvmbDrvaswqHGcUeWb79h8SIln/fLvbS3ppb8qpaR8SlGoqRIz0WcohJQeoXpsf CezmsheCVizXnE8cNWoa2pnSbgXk9QmQLkZ5Fjv2YC0r9p6XPgQHAMppl9FnNhEfu7ckMEuuS 24U6hgtVH6jz2ej/eMwMnsY/NilbdfvCsYhTXnKll6E6VUXtngZbGA/7m7PC0XiQFIXQfbk+q tmL13faEBpkVR96TalMXgWLLO35B+PucRVKCYx6QuwJ0D1PUNJSS1I8ciFS2oFFFlLHQUoZEN mAPYK4K7nAMkvGx9csNvgGxnyulID1ancm X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_063537_266029_CFBFB776 X-CRM114-Status: GOOD ( 30.69 ) 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: , Cc: Linux Fbdev development list , linux-aspeed , David Airlie , Linus Walleij , dri-devel , "open list:BROADCOM NVRAM DRIVER" , Paul Cercueil , Eric Anholt , Christoph Hellwig , Marek Szyprowski , Masahiro Yamada , Michal Simek , Jason Gunthorpe , Joel Stanley , Russell King , Thomas Zimmermann , Bartlomiej Zolnierkiewicz , Maarten Lankhorst , The etnaviv authors , Maxime Ripard , Christian Gmeiner , Peter Collingbourne , Linux ARM , "Alexander A. Klimov" , Linux-MM , Andrew Jeffery , Linux Kernel Mailing List , "open list:IOMMU DRIVERS" , Daniel Vetter , Andrew Morton , Robin Murphy , Mike Rapoport , Lucas Stach 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 Fri, Apr 9, 2021 at 1:21 PM David Hildenbrand wrote: > > Random drivers should not override a user configuration of core knobs > (e.g., CONFIG_DMA_CMA=n). Applicable drivers would like to use DMA_CMA, > which depends on CMA, if possible; however, these drivers also have to > tolerate if DMA_CMA is not available/functioning, for example, if no CMA > area for DMA_CMA use has been setup via "cma=X". In the worst case, the > driver cannot do it's job properly in some configurations. > > For example, commit 63f5677544b3 ("drm/etnaviv: select CMA and DMA_CMA if > available") documents > While this is no build dependency, etnaviv will only work correctly > on most systems if CMA and DMA_CMA are enabled. Select both options > if available to avoid users ending up with a non-working GPU due to > a lacking kernel config. > So etnaviv really wants to have DMA_CMA, however, can deal with some cases > where it is not available. > > Let's introduce WANT_DMA_CMA and use it in most cases where drivers > select CMA/DMA_CMA, or depend on DMA_CMA (in a wrong way via CMA because > of recursive dependency issues). > > We'll assume that any driver that selects DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER would like to use DMA_CMA if possible. > > With this change, distributions can disable CONFIG_CMA or > CONFIG_DMA_CMA, without it silently getting enabled again by random > drivers. Also, we'll now automatically try to enabled both, CONFIG_CMA > and CONFIG_DMA_CMA if they are unspecified and any driver is around that > selects WANT_DMA_CMA -- also implicitly via DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER. > > For example, if any driver selects WANT_DMA_CMA and we do a > "make olddefconfig": > > 1. With "# CONFIG_CMA is not set" and no specification of > "CONFIG_DMA_CMA" > > -> CONFIG_DMA_CMA won't be part of .config > > 2. With no specification of CONFIG_CMA or CONFIG_DMA_CMA > > Contiguous Memory Allocator (CMA) [Y/n/?] (NEW) > DMA Contiguous Memory Allocator (DMA_CMA) [Y/n/?] (NEW) > > 3. With "# CONFIG_CMA is not set" and "# CONFIG_DMA_CMA is not set" > > -> CONFIG_DMA_CMA will be removed from .config > > Note: drivers/remoteproc seems to be special; commit c51e882cd711 > ("remoteproc/davinci: Update Kconfig to depend on DMA_CMA") explains that > there is a real dependency to DMA_CMA for it to work; leave that dependency > in place and don't convert it to a soft dependency. I don't think this dependency is fundamentally different from the others, though davinci machines tend to have less memory than a lot of the other machines, so it's more likely to fail without CMA. Regardless of this, Reviewed-by: Arnd Bergmann _______________________________________________ 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 664EFC433B4 for ; Fri, 9 Apr 2021 13:35:39 +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 2FE2760241 for ; Fri, 9 Apr 2021 13:35:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FE2760241 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A22B6EC26; Fri, 9 Apr 2021 13:35:38 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7A936EC25; Fri, 9 Apr 2021 13:35:36 +0000 (UTC) Received: from mail-ua1-f51.google.com ([209.85.222.51]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1N49Yn-1le2PX1WYj-0105KN; Fri, 09 Apr 2021 15:35:34 +0200 Received: by mail-ua1-f51.google.com with SMTP id v23so1810969uaq.13; Fri, 09 Apr 2021 06:35:32 -0700 (PDT) X-Gm-Message-State: AOAM530Fg9Jd9LhR6MBsZaI1guQG77Y05M5JZ873/tJtLD++mvpBP6/i EX9l7TzGeiNH55Ex644bVmDMwNW7ONuE2/GoqDg= X-Google-Smtp-Source: ABdhPJynlbx4kLNikSNjAjnCb5vtFq6G/850R+R5+xWMARHqWLy+tfY7F0Z+Hrp7Hz4KWDmPvvGBCrUcX4hM8LkZWnk= X-Received: by 2002:a9d:758b:: with SMTP id s11mr12240759otk.305.1617975319390; Fri, 09 Apr 2021 06:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20210409112035.27221-1-david@redhat.com> In-Reply-To: <20210409112035.27221-1-david@redhat.com> From: Arnd Bergmann Date: Fri, 9 Apr 2021 15:35:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: David Hildenbrand X-Provags-ID: V03:K1:hkRGLNMHG/1wUU9HP7zMV+mBjZYTv1bWf8ZFfNaCY2KeW/S73kg Mk0Supar4jDVwNCx+TXqYEud+rzrXC+JLK73WmKWaVTf9buitG5fqH0kjjaEU9AeNdE9aBB J2osJKGR/eCjCth4YY1yCx24hBzjw1GmWNBBHx3fCrohWu0e2x3aLCdplHMZ5123GLhet2N JYfe3G58TWxHpjW6TqvnQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:VTBDSgC5udI=:yE2zKyAQbTy1zm5ntyYXkx NCFaxglwKLaG/AVYsmyTJMVxvqOvpjRQY9AYwzOE+bjUYpQ6wPHyNCg9omMqMpWHsXfSZ28FB BHKO2M/0XiDs72ku+pGa05VoJECsp1JANprNZp6rTtPkr9L4rtFeWBzvCUi8QKZKVgGWbuvaV lnnVJ1a9dbyy89ulQgPLqNdAmTzKTKFhD275xSbDTswk21rc3Y8GAGhoDwQBE6IoSp+j7cZKB cYhncrFhPWauCNU39qSQt8gHCoOQ/kh2tloJyIOsdhvLCaR2/IaD7pVHOVqILOX8FqJU4s5CB 2ebRtFfH4E/Yw329ie4ZSOV5jGaoXhnc9oZ+JAhWxdArk60CzVHU1s1w0Q44nCJsFqZqJqPKT RKIGmjnmsdBcwABV5aVYcdhCyPOELK1Bhd3KjLBsXi1WJAf+o4FhiaRi6ATC4nArbBRXpKv0G 6vmPhhG8BmOm478lnd134uYvDx1B7g6i1y3vEVqHW+UNWNRd7SDLb2NInubgZI+qhQBPrSFLd CTJd5i74YlDNt2lcT40Oxn175vU/GmqBGTzZSYsPL11LPmT1Ri506Xw9CtEW48tzznaJ1/gWR zgh6iPUAikk7S2J+5pYgc/g9cov2phjdGu 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: Linux Fbdev development list , linux-aspeed , David Airlie , dri-devel , "open list:BROADCOM NVRAM DRIVER" , Paul Cercueil , Suman Anna , Christoph Hellwig , Marek Szyprowski , Masahiro Yamada , Michal Simek , Jason Gunthorpe , Joel Stanley , Russell King , Thomas Zimmermann , Bartlomiej Zolnierkiewicz , The etnaviv authors , Peter Collingbourne , Linux ARM , "Alexander A. Klimov" , Linux-MM , Andrew Jeffery , Linux Kernel Mailing List , "open list:IOMMU DRIVERS" , Andrew Morton , Robin Murphy , Mike Rapoport Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Apr 9, 2021 at 1:21 PM David Hildenbrand wrote: > > Random drivers should not override a user configuration of core knobs > (e.g., CONFIG_DMA_CMA=n). Applicable drivers would like to use DMA_CMA, > which depends on CMA, if possible; however, these drivers also have to > tolerate if DMA_CMA is not available/functioning, for example, if no CMA > area for DMA_CMA use has been setup via "cma=X". In the worst case, the > driver cannot do it's job properly in some configurations. > > For example, commit 63f5677544b3 ("drm/etnaviv: select CMA and DMA_CMA if > available") documents > While this is no build dependency, etnaviv will only work correctly > on most systems if CMA and DMA_CMA are enabled. Select both options > if available to avoid users ending up with a non-working GPU due to > a lacking kernel config. > So etnaviv really wants to have DMA_CMA, however, can deal with some cases > where it is not available. > > Let's introduce WANT_DMA_CMA and use it in most cases where drivers > select CMA/DMA_CMA, or depend on DMA_CMA (in a wrong way via CMA because > of recursive dependency issues). > > We'll assume that any driver that selects DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER would like to use DMA_CMA if possible. > > With this change, distributions can disable CONFIG_CMA or > CONFIG_DMA_CMA, without it silently getting enabled again by random > drivers. Also, we'll now automatically try to enabled both, CONFIG_CMA > and CONFIG_DMA_CMA if they are unspecified and any driver is around that > selects WANT_DMA_CMA -- also implicitly via DRM_GEM_CMA_HELPER or > DRM_KMS_CMA_HELPER. > > For example, if any driver selects WANT_DMA_CMA and we do a > "make olddefconfig": > > 1. With "# CONFIG_CMA is not set" and no specification of > "CONFIG_DMA_CMA" > > -> CONFIG_DMA_CMA won't be part of .config > > 2. With no specification of CONFIG_CMA or CONFIG_DMA_CMA > > Contiguous Memory Allocator (CMA) [Y/n/?] (NEW) > DMA Contiguous Memory Allocator (DMA_CMA) [Y/n/?] (NEW) > > 3. With "# CONFIG_CMA is not set" and "# CONFIG_DMA_CMA is not set" > > -> CONFIG_DMA_CMA will be removed from .config > > Note: drivers/remoteproc seems to be special; commit c51e882cd711 > ("remoteproc/davinci: Update Kconfig to depend on DMA_CMA") explains that > there is a real dependency to DMA_CMA for it to work; leave that dependency > in place and don't convert it to a soft dependency. I don't think this dependency is fundamentally different from the others, though davinci machines tend to have less memory than a lot of the other machines, so it's more likely to fail without CMA. Regardless of this, Reviewed-by: Arnd Bergmann _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel