Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2436258ioo; Sat, 28 May 2022 13:37:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4NxdSDsxfpuWTiLmOHci/Tf/CTuQKaQNhL9/QtGue2nNXwUhvBsipuz7rlSGVKqA6yRXi X-Received: by 2002:a63:6685:0:b0:3fb:fe7d:b5f4 with SMTP id a127-20020a636685000000b003fbfe7db5f4mr181627pgc.275.1653770265093; Sat, 28 May 2022 13:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770265; cv=none; d=google.com; s=arc-20160816; b=ZesBvNyvTDAun+lD5ql8PwWDfnMK7zWcMaMNIf3ukmsAg81b8FBBbkYzN+7Nfqnx4L KyVMe96yF/rfiSAEQRvgW1v9A/oLwau2D/OKR6eNc5knL8bFmlbglWKB7G2u0ZXbnd+a cetRsuqwza4arFa3r/XNtTorSRcuogI4iV/5zZuP1ks41KgWVh1O3D37TgPL93mHiwta 7vmW/HTkcR5JcT8ra7S8xgQuEEhTbiBOgJT7tlcaiD2mgsXU6Wr6ZKbmGcMHi3IcJNm8 DGwl6L/TRF6QBDUob5KbOv1YJWM1/ZPT9iZb6TB45bj7pCBie5Vnmtm+me8dPOROlN73 zbng== 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:dkim-signature; bh=5JIYIoPQbAr8+N/6Btv1Jhwnhm7d6XglBceN1Qe6Sgg=; b=fyqIN+esHwxMEqZVQmC06O5/oVFqdw3UIYdU7SKRuv5fTLtkCHkADUffEZGrsBXwAI ZMUJuJ/yEflPv+Si7EYMZynTn6anR63y/Qtcl7s5IsuUqLBExpZtsOXsfU6HYcIoh/sn kpp4RbbfWauSSgAigHQlZ84B1MqpL3QxxRFpIhbVX5v/TOuOdsdELbsplbFwr/DYSOxB VcFywdhWgX/GunFZDUtdz+I/o+WEYTDlNN7Opl8hzNp4RNETKCOhZXOBJpUcj4+wWtPu x7p/gF52AU5o+B4qRFKwaU5aG0y2O0qDoHKj99nGeyvI/DucEC7y60EaE22Vu5I0p1Kv gB2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RyObOFEt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x63-20020a638642000000b003dae95430c8si2103924pgd.866.2022.05.28.13.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RyObOFEt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6843312C94D; Sat, 28 May 2022 12:40:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350777AbiE0KEn (ORCPT + 99 others); Fri, 27 May 2022 06:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350762AbiE0KEi (ORCPT ); Fri, 27 May 2022 06:04:38 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C265106A69; Fri, 27 May 2022 03:04:37 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id x137so7097402ybg.5; 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=VI85LRBcUnR/4nd4Y8lArP16KybcdAmfaxFY3nZS3calFbHwmCl+GEXS0k+ga1cjAk hnVrosaRNI7QByPtLjkoHybxfSUgXUOOS4cHW7Eih4b1PuqnDQcs/R3YmIlw4vmqjONR 6dykMJrQNWrtMkBntu/I1PLWMia7U9yiVAjHK2p/P0bSu4/RB/Zc2Jhrjwxgs5eB5K0D fHmYGTr/pW8O9l4RNwl23xy+x34aNk+IwWjR/7LAyl7hYOk801gfRyTY1il9S/57fUFl tMqTHZ3RWP5q5Cw0zj1fNWRHcGuq3jY/w5P3FWL5Sr+aQPy3ku3iIpaG1uqqQjuZn8tI fsrA== X-Gm-Message-State: AOAM530mwyRK56vpfV/U4TCMFptx2wS/HvyKDF96x/g5Q0vuVxpgmKoN VZxarzh8VzkzLUVuUFqHKEK8V9ahn5sSX2eyhPeVrmlEP1A= 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-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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