Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1359095pxf; Fri, 9 Apr 2021 06:36:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa9XQjPmEDwRBIOZ2Q3XL3eLMH7q2o6on6Khc4n7xA2W3WZDhXb5E6U1KzhNEtNvK0k7pb X-Received: by 2002:a17:902:9f94:b029:e9:68a3:8551 with SMTP id g20-20020a1709029f94b02900e968a38551mr11698104plq.35.1617975373667; Fri, 09 Apr 2021 06:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617975373; cv=none; d=google.com; s=arc-20160816; b=XOtiqmgY40ufo3jdGlU7YAUgVb+kakXtXkPJ6Ug03Q+f51TYn+MBVJak5jyyHTI8N2 OLbfpk0dQuMvGfgaJxGeUP8z6KiEre+I6LZMOkVwW5i6f2KW3VgSC/bTyHC3+RBdx7yB TAslxI0gpj++l28nWPAr1WcAwoJA5h4RixNI8jHigpHM/HJPyjw45wnsGqeqBEQvoAYB qaWxlB9cihqV9uALrKKsMFRjOuXRcvkYHIAAHRR3aHvBbCYn32ZmD9K9fdgqNM1tKbO7 viE2mOEFhm2nMGCQTiDZM5C0P21lCjL/Zp/6J/yaNOTV8Q9M5f5OjjS0fEhnafclweS5 s3Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=yId9o196h6K7DXFDKAFmn+u8X22BPRejHTFYE2oXPjI=; b=XKNNdwXV3MuUqCO28qBOQ+arHcI/0zWAHul+2GN7dkc3m6pEs5tAyMIdkjNZQXhUVm rMuf6dKICgeqCT0QBbJl4BwC+TA3l8nJ54XFINfteA3LRQb6JPxmAs7peFXKlUoGda5i lK5HZHnKHEe7zAUo/hJVo8fLq3igSB//F2pRCJP9JnxHbxFSD3zSrF6HtnKFLcJtz5uK Nhmldwr1H/BEovu2XR62w5fkaNeIa2z9Y4D6VHi7qItGUSYxiEILZa9lEr6+93qP+Xut ZYfppSEecQRCSkuAt6TU/xOSpQHvrXQDemzQMfp7+spJktg8uHKM9bCYMAQu+EA3gIZw sOyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si3034403plz.16.2021.04.09.06.36.00; Fri, 09 Apr 2021 06:36:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233552AbhDINfg (ORCPT + 99 others); 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-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-Spam-Flag: NO 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