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 2605EC433EF for ; Thu, 26 May 2022 14:23:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47E0E8D0003; Thu, 26 May 2022 10:23:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 427D88D0002; Thu, 26 May 2022 10:23:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33CA68D0003; Thu, 26 May 2022 10:23:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 229D78D0002 for ; Thu, 26 May 2022 10:23:31 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DC33360442 for ; Thu, 26 May 2022 14:23:30 +0000 (UTC) X-FDA: 79508112180.05.4E76DE3 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by imf26.hostedemail.com (Postfix) with ESMTP id 261D514003C for ; Thu, 26 May 2022 14:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653575010; x=1685111010; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=OTGMDJI8pQcKdf9OE9hgKnsMlnOsvoVlXyn5S+uD2lE=; b=mWGB2wGma2iM2OGgrYg/ceOjNkklZMjX2JILuvcdiNBMAsHjEEODQB09 5xn7Qd2KitldHBubLQuQ9oN/WZ68tt/zaMFa8AyptWjjJu2g6BCqjQvAQ +d+LVNfhODX64vepn3R+ognotBxyi61riOeuTofC+697xAA9OClAWAtPE A=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 26 May 2022 07:23:29 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2022 07:23:28 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 26 May 2022 07:23:28 -0700 Received: from [10.46.163.52] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 26 May 2022 07:23:28 -0700 Message-ID: <65f1b675-84ac-b5da-6075-2a9f0353ab37@quicinc.com> Date: Thu, 26 May 2022 07:23:27 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Queries: Using ifdef CONFIG condition in dts files Content-Language: en-US To: Pintu Agarwal , open list , , , , linux-mm References: From: T.Michael Turney In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Rspamd-Queue-Id: 261D514003C X-Stat-Signature: dpwe587utnuphnakqf3rc8j4nfzypna8 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcdkim header.b=mWGB2wGm; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf26.hostedemail.com: domain of quic_mturney@quicinc.com designates 129.46.98.28 as permitted sender) smtp.mailfrom=quic_mturney@quicinc.com X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1653575005-392114 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: 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? Cheers, T.mike 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