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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A932FC433F5 for ; Fri, 27 May 2022 10:04:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 137C28D0003; Fri, 27 May 2022 06:04:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E7468D0002; Fri, 27 May 2022 06:04:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F19A08D0003; Fri, 27 May 2022 06:04:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E36808D0002 for ; Fri, 27 May 2022 06:04:38 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id A1CF71210A4 for ; Fri, 27 May 2022 10:04:38 +0000 (UTC) X-FDA: 79511088636.24.1B42A81 Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf25.hostedemail.com (Postfix) with ESMTP id 869A7A0047 for ; Fri, 27 May 2022 10:04:07 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id i187so7088030ybg.6 for ; Fri, 27 May 2022 03:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5JIYIoPQbAr8+N/6Btv1Jhwnhm7d6XglBceN1Qe6Sgg=; b=RyObOFEt9mrpw1GFgsf97COA3nU0+H88/3PXIdOj5Fnkf4HBbF7C68+ZciXfCILMYf b6hexwK6RaYMbIHqqjO0c2FbFFbMOB1/PhMDDu3kNUkWxnu/lFbJ+6VjEvCmENqwmwQP /9KEPyvyrWQW86Uto87PtYyVxtKsXIdSufp/YJMGGS0FihaaBkb1VSqLi3/K7INqaE61 jPr4SprPehyy7tyc3El0xf+3pKgv9S1ZKQrs90IpPDE3QGq5finBWG0Z3uW3ds++wrSM ZaTO2rb2+Cftee2Z9rgG9aGsMThyRMADCLbHlgdD9VAiyboBOyaMdFNVvwM6flGW5H2s 6Fag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5JIYIoPQbAr8+N/6Btv1Jhwnhm7d6XglBceN1Qe6Sgg=; b=RsSDxHI3BMG1Xd7oTd3crz0cKVNfBfKFT7mGbnKKnPh7kW6xWuL4b1zy+kA+m/miiM EBYRAfV4l7IGxMei2CwcflbtoqYYYUjHRee7uEbuW5ZeVa9ZzQnmkHbVlnuubSl+UDIi FtNhRg/0myRhE9KUN0Llrli3kY3XA8Dbi1J5wn+IebhrKxzTPc57Y+xUnsrR5+H3SW6x FQi0fmry/tnQvg3bIcS+uqhklLLCA2MRHk8ElIhhjJrNfPRPteyIbAbH8N2RXYKSofS/ TlMibcFqUBL3JCCv9Uodhz3mgwc5u7oBd6Wui0pvk5/eA4robAABZW9ECoXfE6bKC1Qj g1+Q== X-Gm-Message-State: AOAM532LIjuhko0NfpgtQja/b1raCa1IlnaBFFYB3IrEhHJgXJ08WqHn TqDVPM+rWwf/18rylA2DONZZV4Ku2Gs8i123vdc= X-Google-Smtp-Source: ABdhPJxFjKSnq7Y/HKDtruNHyzaSMSuJHcQI86uptqpuKtH7XmDC5NFFJhzVoMiNXmnwoNMYzowzX9ss0zn0OqY420M= X-Received: by 2002:a25:40b:0:b0:65b:5f11:2b5b with SMTP id 11-20020a25040b000000b0065b5f112b5bmr1049941ybe.520.1653645876784; Fri, 27 May 2022 03:04:36 -0700 (PDT) MIME-Version: 1.0 References: <65f1b675-84ac-b5da-6075-2a9f0353ab37@quicinc.com> In-Reply-To: <65f1b675-84ac-b5da-6075-2a9f0353ab37@quicinc.com> From: Pintu Agarwal Date: Fri, 27 May 2022 15:34:25 +0530 Message-ID: Subject: Re: Queries: Using ifdef CONFIG condition in dts files To: "T.Michael Turney" Cc: open list , robh+dt@kernel.org, devicetree@vger.kernel.org, frowand.list@gmail.com, linux-mm Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 869A7A0047 X-Stat-Signature: a46nacjeqxxbe1cqs5im4aeqdmxx4xky Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RyObOFEt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of pintu.ping@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=pintu.ping@gmail.com X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1653645847-266835 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: Hi, On Thu, 26 May 2022 at 19:53, T.Michael Turney wrote: > > Kernel developers correct me where I go astray, but this seems like the > CONFIG_XYZ value is not available in this file. This would explain why > the disable case works. > > At top of dtsi file are you #include or whatever the correct > syntax is to see the CONFIG values? Thanks for your comments. No, I could not find any specific config,h to be included to make the CONFIG values visible to dts. Thanks, Pintu > > On 5/26/2022 1:46 AM, Pintu Agarwal wrote: > > Hi, > > > > I have a generic question regarding conditional compilation options in > > dts/dtsi files. > > Our Kernel version is: 4.14 > > Let's say I have a Kernel config such as CONFIG_XYZ. > > This driver uses a CMA reserved memory and its node is defined in a > > mysoc.dtsi file. > > Like: > > #if defined(CONFIG_XYZ) > > &reserved_mem { > > xyz_region: xyz_region { > > compatible = "shared-dma-pool"; > > reusable; > > size = <0x600000>; > > }; > > }; > > #endif > > > > The problem is as follows: > > a) The same kernel/dts source is shared across 2 product versions. > > b) In one product we need to enable this CONFIG_XYZ but in another > > product we need to disable it. > > c) When we disable the CONFIG we wanted this dts node also to be > > disabled together. > > d) When we add "#if defined(CONFIG_XYZ)" check in the dtsi file, it > > works if the CONFIG is disabled, but it does not work if CONFIG is > > enabled (node is not getting created). > > e) This mysoc.dtsi file is getting included in many other dts files, > > so we cannot add a compilation check in Makefile. We will end up > > renaming many files just to protect this one change. > > > > Is there any other better way to handle this situation ? > > > > I see that in latest kernel we have a conditional compilation added like this: > > #ifdef SOC_HAS_USB2_CH2 > > https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/salvator-common.dtsi#L1028 > > > > But the same is not recognized by the device tree compiler when using > > kernel CONFIG_ check. > > > > Is it the device-tree compiler issue which got fixed in the latest version ? > > Or, is it because Kernel config cannot be shared with device-tree ? > > > > Please let us know if there is any other opinion. > > > > > > Thank you. > > > > Regards, > > Pintu