Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC207C433F5 for ; Sat, 4 Sep 2021 14:03:31 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 96DF360F9C for ; Sat, 4 Sep 2021 14:03:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 96DF360F9C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 22A8E82F4C; Sat, 4 Sep 2021 16:03:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1630764208; bh=gN+UWhTmkEOdhvjcfqXrCNPs+DP4zbaLmss3J9NEz78=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=v2zmoIqwvX+O5JXBDSbeQXRbEl5V9q8Y5QeXhNECO+8NYxoj9/DabS0sC8kg6LrJ3 k0aJdWEtV77hu0Rh0XsjoeQAZAdnH5aXgjtKFgzzbazrNcbPGeecU2vNeApUIHUKR1 RJjbJpbljZahdoUYeQDSfEH6ZOI5UJwH0c+JqQbJdSvOsch1sfdgLWnY8wo81TkcCe OMAbGmKmYcjbLiRVhFTJ1hn3cbFO0QKFyaKjZjT7hUYEWtidl6ABFq6Ldj7llb8Uq7 qpnZz4KVW8mZ1nc3cishS/ElYz4U6G//HBYS9Re0Eh9V6UpxBi0Qg1q+tY2rC55B9M SdbYu6NNik0aQ== Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id E59E182F10; Sat, 4 Sep 2021 16:03:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1630764206; bh=gN+UWhTmkEOdhvjcfqXrCNPs+DP4zbaLmss3J9NEz78=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=siCWEEVX17oZo1j13pvBuBVVJfOGeICxttg10xc0p0/LMfjvs0qlUKyTFAHHbP/jA H0Aknad1FjIP0kEkCsm5ZLohFZVDTYgxaVoIIQYqi87alxtWQpjIEhwkND3nhMKCsv gVm2YNvA4CSLgjK5MtNzOVsXMuFO3BNia3XN3a7jotuUYr00K0UhTJ5lfSEQqqd9aY /FC2cKRjtM21LXiCHxCcWUzsEFig+/+n6l31iTaoe3fBbgLiVBsMZdF22wf/2RcUiu 1d7kJ38WRBovgD0cESk/xBPASfT+SffJLXxiNwqAFRoAH6VIeDFDijY537aF8F59I3 f2r3kke9wlNTQ== Subject: Re: [PATCH 02/14] lmb: Use CONFIG_LMB_*_REGIONS only if they are defined To: Tom Rini Cc: u-boot@lists.denx.de, Simon Glass , Simon Goldschmidt References: <20210829193239.GH858@bill-the-cat> <20210829221008.GK858@bill-the-cat> <0f735fc1-c331-ee13-4bbf-5be71d45fecd@denx.de> <20210829222356.GL858@bill-the-cat> <2cffb09e-23aa-afce-962e-1eb9727457db@denx.de> <20210829225126.GM858@bill-the-cat> <20210829231145.GN858@bill-the-cat> <95c965a3-2da8-1212-fb54-0d5628d7743b@denx.de> <20210830120102.GO858@bill-the-cat> From: Marek Vasut Message-ID: <678a77d9-356a-e924-da8e-102fba938ee3@denx.de> Date: Sat, 4 Sep 2021 16:03:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210830120102.GO858@bill-the-cat> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 8/30/21 2:01 PM, Tom Rini wrote: [...] >>>>>>>>>>>>>>> We shouldn't need this at all. LMB and LMB_USE_MAX_REGIONS are both in >>>>>>>>>>>>>>> Kconfig and have the dependencies expressed that way. >>>>>>>>>>>>>> >>>>>>>>>>>>>> However, CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS may be >>>>>>>>>>>>>> undefined if CONFIG_LMB and !CONFIG_LMB_USE_MAX_REGIONS . They are four >>>>>>>>>>>>>> different symbols. >>>>>>>>>>>>> >>>>>>>>>>>>> I'm still not seeing it, sorry. Is there some case where we're trying >>>>>>>>>>>>> to access a struct lmb without CONFIG_LMB enabled? >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> See build failure >>>>>>>>>>>> https://source.denx.de/u-boot/custodians/u-boot-sh/-/jobs/315331 >>>>>>>>>>> >>>>>>>>>>> Ah, progress. Drop from since we already have a >>>>>>>>>>> forward declaration of struct lmb? But it's not failing without this >>>>>>>>>>> series too, so what's changing? >>>>>>>>>> >>>>>>>>>> See 01/14 in this series. >>>>>>>>> >>>>>>>>> Ah, so drop 1/14 then. >>>>>>>> >>>>>>>> Why ? That patch is correct. >>>>>>> >>>>>>> It's not quite right, 1/14 and then 2/14 are papering over the fact that >>>>>>> lmb.h, and it's including headers / files, need to be cleaned up so that >>>>>>> we don't need to have redundant tests in the header. >>>>>> >>>>>> 1/14 disables LMB and CMD_BDI for tools build, we do not need those, so 1/14 >>>>>> is correct. >>>>> >>>>> We don't need to build u-boot at all for tools-only, only the tools-only >>>>> build target. It's just annoying to exclude the tools-only_defconfig from >>>>> "sandbox" in CI. >>>> >>>> So, what exactly is the problem with that 01/14 ? Please elaborate, I >>>> believe the patch is correct. >>> >>> You disable LMB in a target that's only building "all" in CI because >>> wasn't ever worth adding ",sandbox" to the all other arches job until >>> perhaps now. >>> >>> Disabling LMB in tools-only_defconfig then exposes that can only >>> be included safely when CONFIG_LMB is set. >>> >>> Adding / extending an #if test in code for something that's already >>> checked for in Kconfig is bad. We spent so much time already removing >>> and shrinking #if tests in the code. >> >> So, the patch is correct, the headers need further clean up. > > No, it's not. The first patch is wrong because disabling CONFIG_LMB is > invalid. Please explain why the patch disabling LMB support for tools-only build is invalid. I disagree with this statement, LMB support in tools-only build is useless, because LMB protects parts of running U-Boot from being overwritten. > The second patch is conceptually wrong because if we're > enforcing a check in C for a dependency that's enforced in Kconfig, we > have another problem to investigate. Which I did, LMB is non-optional. Please explain why is LMB non-optional ? I disagree. LMB for tools-only build is useless, hence it should not be enabled. >>>>>> What kind of cleanup of lmb.h do you have in mind ? >>>>> >>>>> Remove it from include/image.h and fix any fall-out from that of files >>>>> that got indirectly when they needed it directly instead. >>>> >>>> Uh ... that is likely for a separate series, and a big one. >>> >>> Honestly, checking again, I'm not sure LMB=n is valid, ever. >> >> Why wouldn't it be ? For tools, LMB=n is perfectly valid. > > Because it's never valid to disable LMB, LMB is what protects the > running U-Boot. We are talking about tools-only build here, not running U-Boot. > It's nonsense to build u-boot on tools-only_defconfig but we don't have > a way currently to remove "u-boot" from the all target. Maybe once a > few more of the hard/tricky CONFIG symbols get migrated to Kconfig we > can then set tools-only_defconfig to NOT build u-boot at all. > >>> That's how >>> we keep our running U-Boot from being trivially overwritten and a huge >>> number of security issues from being re-opened. >> >> Tools are not running U-Boot. >> >>> At this point, I think you should rework things to stop making >>> CONFIG_LMB be optional, it should be a def_bool y. >> >> I disagree, see above. > > The only reason "tools-only_defconfig" builds a useless u-boot binary > today is in CI where it would be more work than it's worth to make CI > exclude that from the build list. But if you want to just do that > instead, I'll also accept adding -x tools-only to the azure/gitlab jobs > that build all other architectures, as tools-only is tested in its own > build job, for it's only valid build target. The tools-only build is also used elsewhere, to build just that, tools. [...]