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 BF16EC433EF for ; Thu, 26 May 2022 07:23:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E5D78D0003; Thu, 26 May 2022 03:23:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 595048D0001; Thu, 26 May 2022 03:23:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A6978D0003; Thu, 26 May 2022 03:23:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 37C658D0001 for ; Thu, 26 May 2022 03:23:33 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 040A220445 for ; Thu, 26 May 2022 07:23:32 +0000 (UTC) X-FDA: 79507053906.08.54D1D99 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf07.hostedemail.com (Postfix) with ESMTP id B5B254000E for ; Thu, 26 May 2022 07:23:19 +0000 (UTC) Received: by mail-yb1-f170.google.com with SMTP id p190so1543137ybg.4 for ; Thu, 26 May 2022 00:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=2KhjXwBVwTk7PW/5GLlqKmbbxTLB+d9tnTP/pX0MQvU=; b=JbSwHk3mHWF1E5L/LlPc3k5Stk4E5CwE+E7oUjaSgVTXdMVCYw6QlBAZxsCRjq9g6s rFo7VkIbQdW6rBojOdXWhZqV80Y3/0ykIq/E5rwA1MoH8M8Ulw812KcuVip8eyRy/l4k iXNb6IwlCj0I1Uxjr7FHkAm5DtzDQPQBa6yuzPlOdynVyFTUM/aLQbgJkdgP/kiwh5KP KoB7RGa0OpXgIoH/82N4MD9lgLVqTOdmJsVFsm66FasRWEe1rYWVzjFkueUE//jLMAUS QI1F6fsLfrY1yHlNfk4bcUsPU99mz+PDF8ILiUabqaFvkoLiedDPii0pqsme8FW1ZZiI F1ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2KhjXwBVwTk7PW/5GLlqKmbbxTLB+d9tnTP/pX0MQvU=; b=syrl1LQG4+YKfKlXdwDhPbiiLKsSo1bgOC48x/AlTC4lUXYCWxTUGlQ0vGOnY7AlOW VM2WRbBcBSnPGN2UvDuyDp3a9Upip3D+LOKpWhyThKteJ6Ve3WK5sLX8oXoJlcsWJxA5 LFEnOledV8f4pVixvqwlXBiSObD0umszS+Nql7EQ4STcY3iOWmQQHAXMk3e6Lbu8Sw/N msY92ybarK3XWq6nmzvL9chovy+jZvpzi7E02ZSk7DOZAPAtX4kuZR7JZCJSUlQZPIEW 6Z+zjizigSUvb5mWwaiDsEGymC0tkbqUcHva6JCP1xOnnvoTEH4I3H5b/Hgh4zPdejFl eUEQ== X-Gm-Message-State: AOAM533Sk58WlgefybwfWK9PCa23K6U6ZqAWWqnbryIWxab0cI+FbWZk BLelQpCl9QTzPDANN2lA690E+eEUyLC1nW9hDIE= X-Google-Smtp-Source: ABdhPJz9RaHH5bGePPcsu7usQ2T2BnkAH5e47hY/5Z6HPNwOMVNTYVe0axBvWZdyV3cw3CoByJAf9grIvhHU12LRqpI= X-Received: by 2002:a25:7485:0:b0:64f:5cfb:4372 with SMTP id p127-20020a257485000000b0064f5cfb4372mr27425825ybc.403.1653549809611; Thu, 26 May 2022 00:23:29 -0700 (PDT) MIME-Version: 1.0 From: Pintu Agarwal Date: Thu, 26 May 2022 12:53:18 +0530 Message-ID: Subject: Queries: Using ifdef CONFIG condition in dts files To: open list , robh+dt@kernel.org, devicetree@vger.kernel.org, frowand.list@gmail.com, linux-mm Content-Type: multipart/alternative; boundary="00000000000005369005dfe511f3" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B5B254000E X-Rspam-User: Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JbSwHk3m; spf=pass (imf07.hostedemail.com: domain of pintu.ping@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=pintu.ping@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: swje9z61onn1xh3gbctmw946ko7bxm4g X-HE-Tag: 1653549799-226295 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: --00000000000005369005dfe511f3 Content-Type: text/plain; charset="UTF-8" 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 --00000000000005369005dfe511f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I have a generic question regarding conditional compil= ation 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(CON= FIG_XYZ)
&reserved_mem {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 xyz_region: xyz= _region {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 compat= ible =3D "shared-dma-pool";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 reusable;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 size =3D <0x600000>;
=C2=A0 =C2=A0 =C2=A0 =C2=A0= };
};
#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 e= nable 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 ena= bled (node is not getting created).
e) This mysoc.dtsi file is getting incl= uded in many other dts files, so we cannot add a compilation check in Makef= ile. 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:
<= div class=3D"gmail_default" style=3D"font-family:verdana,sans-serif">#ifdef SOC_HAS_US= B2_CH2

But the same is not recognized by the device tr= ee compiler when using kernel CONFIG_ check.

Is it the device-tree com= piler issue which got fixed in the latest version ?
Or, is it because Kerne= l config cannot be shared with device-tree ?

Please let us know if the= re is any other opinion.


Thank you.

Regards,
Pintu

--00000000000005369005dfe511f3--