Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1362665pxf; Fri, 9 Apr 2021 06:41:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKxkCOlBSwCwrggvAeKyUTgkP82+tgFKt+kwC5VnripwJ73kvpWCNmTfyOaygFHlqg5Fli X-Received: by 2002:aa7:de8b:: with SMTP id j11mr17773364edv.363.1617975710593; Fri, 09 Apr 2021 06:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617975710; cv=none; d=google.com; s=arc-20160816; b=rfWFsjTnJVevQOgJEVznHBsGMJZr5nfTN+bTJLK18ifZsBvCM6FOFpEULS7RoahQsG 6COcGx68LYY+0RtmPTUC3Gj5TUn1YDerXdEqDQnF8D73k6GIB9DunsIfdUKRDslwJ/Xx GetcfCgWKM/XE/V4qu4RsRMQS9jTYlXMIHJHbXhz0sK5d+dx/rgu9Ltkf6fMCfZbabbo 4VK/plAjDYIxNxTRm8TmgGa7cCLFkTpRYgHCP41j0EuDGr5iYWMNETwseMapFcWhwqE2 oaeA2o7hK2PrZmRPMBQGwtyX0M9onY16+A++GYVkSzO3D3FsvO9xD3YzMgEEW2SP77zv cBpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=lsrzJwlfstULCCREnSPVP3WRVuSyvEw5HXvTFd2r4do=; b=ZyKDAUA8TQ2sUVbTieETiRf3aM1XD5INKqoces9ZII08gUu5f1UYhHjKf0Rw71OjG8 pRy3ikUYcWgUnN4zpcaS56S5TVAZFmYmoo9/hAIaZRUM+dML6FLyvDDu3oq2Apa+XTb3 iUq53KtZkve/f4M194NxWxq3xGCKg7v9/Mhhh0xQGVDDh/n578ziKD5dg/Jr8qrkr08F NL1reBkfqNHw3hRMiCLUHFxA48+HNp/HRC02nFgX6ozgJQfwvCf7OykzBp/Bqrf4U534 DvhY9W1YTn33KeekKLHvccu4+BiaT8FsylY9mERoCsxaly1zp1BC0Ynjay+V4velm3Cf Vesw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OMtcyd0E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si2384008edl.294.2021.04.09.06.41.27; Fri, 09 Apr 2021 06:41:50 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OMtcyd0E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231946AbhDINkV (ORCPT + 99 others); Fri, 9 Apr 2021 09:40:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44929 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232615AbhDINkU (ORCPT ); Fri, 9 Apr 2021 09:40:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617975606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lsrzJwlfstULCCREnSPVP3WRVuSyvEw5HXvTFd2r4do=; b=OMtcyd0Ey8henN7DdHOa64TG6+RcQ3yQtd9qJqu4fIbwhvuSElxbzysNjju/dUo5Tg7ydo MlYxJSNpyADshpWO3/0QogVaZ3JdMf3ol84JxmiAetnJVVMvG4GV3wa3TtZ+fewuLtpPJ5 jJArafTsuWFRRzZd2bJyiA+Iiq6zuQ4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-143-3MzYaf2pNUSmKJKsGUehFg-1; Fri, 09 Apr 2021 09:40:02 -0400 X-MC-Unique: 3MzYaf2pNUSmKJKsGUehFg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB324C73AD; Fri, 9 Apr 2021 13:39:57 +0000 (UTC) Received: from [10.36.115.11] (ovpn-115-11.ams2.redhat.com [10.36.115.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id E60C619801; Fri, 9 Apr 2021 13:39:48 +0000 (UTC) Subject: Re: [PATCH v3] drivers: introduce and use WANT_DMA_CMA for soft dependencies on DMA_CMA To: Arnd Bergmann 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" References: <20210409112035.27221-1-david@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <53ec94ac-ffe3-d0bc-d081-3489fa03daa1@redhat.com> Date: Fri, 9 Apr 2021 15:39:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09.04.21 15:35, Arnd Bergmann wrote: > 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. > I was also unsure - and Lucas had similar thoughts. If you want, I can send a v4 also taking care of this. Thanks! > Regardless of this, > > Reviewed-by: Arnd Bergmann > -- Thanks, David / dhildenb