Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2395025pxp; Mon, 7 Mar 2022 14:37:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJBz9bqjVrkTi+Ly1giJhtxGEwDbVN6XDW+6+OWbcf2puX7rp2CkjNUQFd2QoeMp1zC3gf X-Received: by 2002:a17:90a:9106:b0:1b9:115a:a2c1 with SMTP id k6-20020a17090a910600b001b9115aa2c1mr1329213pjo.80.1646692658256; Mon, 07 Mar 2022 14:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646692658; cv=none; d=google.com; s=arc-20160816; b=J+2WuMRexP4X+TDs7rCs/Rc1u2Khik76VAYmyiGovKZzlEFMUI95AbMSGVMutS93jE 1U6uESodcUF435EfcaNvlBEVcPgU/BU1rkPjYOGdyqwso4NX4GDXSMjmm8LINXPC63Ha o2wIfwJUtFSN2ICVfH9eVqYON4yVQZGWc074vygQvpO7jh/LbiGaeapeRv9WsKyEKOz+ WpOLN65xuqI3EJz6g0EwYtBrVuOZtWzq52WAPrB43o6pZptK5zwMN6QtVJ4tj8Kun1Lm A04gb6S3Vd089z5fbdTC5qqT+E1exCwJ4MXngiwGL/LewxU1mResZ/haz+OjPTuu/cHc CTDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4gIqvsVuKj0bmzWmxEJWkf2QmkNfqBuOw31l6fZNNHA=; b=EJIIgR6fEYqw4LOJsoKmXaOTe4Ogsazwpw57evXUKfXwlU+n/pgh+CibcIuaL6UeOU 7v8dn6lKxRapFG5JSnOIHkzE4RYHqGK4zqWA1aGxy4+O9bX3KfYUtmw2mjylzD0/X3MU zQO3vFSIAyrdaabq1eC6kG7mmRzUdK+fG4QO3SRWKeVbZhEPVXpfnthk+Rm+4kBM4Tn9 N3cT46Y90lIOKSYKlm2Iw6D06bwgtz6fd6zoFc1gszo2GUr1+46LbMZTK7Bj3lY3J20k BueHxl2gRyvLfu6p7rSz+BW6cFGebfuzuSFU/elezRgsjOm5WtUQD6BjUvK2tJIlx9e6 JMkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a635152000000b003736efce260si13667672pgl.805.2022.03.07.14.37.22; Mon, 07 Mar 2022 14:37:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237306AbiCGRB1 (ORCPT + 99 others); Mon, 7 Mar 2022 12:01:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232458AbiCGRBZ (ORCPT ); Mon, 7 Mar 2022 12:01:25 -0500 Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A74376C1C3; Mon, 7 Mar 2022 09:00:30 -0800 (PST) Received: by mail-oo1-f45.google.com with SMTP id l24-20020a4a8558000000b00320d5a1f938so5847354ooh.8; Mon, 07 Mar 2022 09:00:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4gIqvsVuKj0bmzWmxEJWkf2QmkNfqBuOw31l6fZNNHA=; b=2UC68IK2XXEkinqs4BQn1bpHN+SbFNqXn3p1mU7Ya2LSCARXF7hePUBEU+8ChxsRZV u8zSDgogHBtdJR8RixWfiB0+N/O0cOL4pLNOqrFTia7fjlU+09xxAC7L3lIJa8BLwhX9 il/8fuwEYZY9PbLdsPeBChZq2mb2P15nNDHB2xyYhsk5SQaHvE8wNCwjGT3mIEnEpde1 jY76RJQDqQqqiVp8dIMyMp1Xr4z9LPZytOAkfob2D3pN/86WVpKQSjnpDAcHdnXAGdMK n3jj7QJFC7g8fT7o9YIdseUxnqKwkYoR5MbUo52Oam91C4xp+6riqxCqp2mZqZSvkbDT YQTg== X-Gm-Message-State: AOAM532sw6WLfRDcxksHIhFPQwkGo3bIsYYKs3LkmaXb+49u3kzXU2Qc poxxlWy+VCfe/vRYDKBe1w== X-Received: by 2002:a05:6870:e352:b0:d6:e15f:2d40 with SMTP id a18-20020a056870e35200b000d6e15f2d40mr15181748oae.137.1646672429885; Mon, 07 Mar 2022 09:00:29 -0800 (PST) Received: from robh.at.kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id 60-20020a9d0f42000000b005ad59a0fe01sm6531777ott.35.2022.03.07.09.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 09:00:29 -0800 (PST) Received: (nullmailer pid 2757845 invoked by uid 1000); Mon, 07 Mar 2022 17:00:28 -0000 Date: Mon, 7 Mar 2022 11:00:28 -0600 From: Rob Herring To: Geert Uytterhoeven Cc: Masahiro Yamada , Krzysztof Kozlowski , Michal Marek , Nick Desaulniers , Frank Rowand , Laurent Pinchart , Maxime Ripard , Linux Kernel Mailing List , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-kbuild Subject: Re: [PATCH 2/2] dt-bindings: kbuild: Use DTB files for validation Message-ID: References: <20220303224237.2497570-1-robh@kernel.org> <20220303224237.2497570-3-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,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 On Mon, Mar 07, 2022 at 01:20:29PM +0100, Geert Uytterhoeven wrote: > Hi Rob, > > On Thu, Mar 3, 2022 at 11:43 PM Rob Herring wrote: > > Switch the DT validation to use DTB files directly instead of a DTS to > > YAML conversion. > > > > The original motivation for supporting validation on DTB files was to > > enable running validation on a running system (e.g. 'dt-validate > > /sys/firmware/fdt') or other cases where the original source DTS is not > > available. > > > > The YAML format was not without issues. Using DTBs with the schema type > > information solves some of those problems. The YAML format relies on the > > DTS source level information including bracketing of properties, size > > directives, and phandle tags all of which are lost in a DTB file. While > > standardizing the bracketing is a good thing, it does cause a lot of > > extra warnings and churn to fix them. > > > > Another issue has been signed types are not validated correctly as sign > > information is not propagated to YAML. Using the schema type information > > allows for proper handling of signed types. YAML also can't represent > > the full range of 64-bit integers as numbers are stored as floats by > > most/all parsers. > > > > The DTB validation works by decoding property values using the type > > information in the schemas themselves. The main corner case this does > > not work for is matrix types where neither dimension is fixed. For > > now, checking the dimensions in these cases are skipped. > > > > Signed-off-by: Rob Herring > > Thanks for your patch! > > While investigating why a newly added device node to DTS was not > instantiated as a platform device, I discovered an issue with this > patch: "make dtbs" no longer rebuilds DTB files that need a rebuild. > > How to reproduce: > > $ git checkout next-20220307 > # apply this series and its dependency: > # dt-bindings: kbuild: Support partial matches with DT_SCHEMA_FILES > # dt-bindings: kbuild: Pass DT_SCHEMA_FILES to dt-validate > # dt-bindings: kbuild: Use DTB files for validation > $ make ARCH=arm shmobile_defconfig > $ make ARCH=arm dtbs > $ touch arch/arm/boot/dts/r8a7791.dtsi > $ make ARCH=arm dtbs > # The above command does NOT cause: > # DTC arch/arm/boot/dts/r8a7791-koelsch.dtb > # DTC arch/arm/boot/dts/r8a7791-porter.dtb > > I don't see anything wrong with this patch at first sight, though. Was this a clean tree? I think I reproduced it, but then couldn't... But then after a 'make clean', 'make dtbs' would error out. I think the issue in both cases was processed-schema.json always a dependency when it should be conditional on 'dtbs_check'. The patch below fixes that. Can you give it a try too. diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4629af60160b..9d5320a47ef8 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -349,12 +349,12 @@ $(multi-dtb-y): FORCE $(call if_changed,fdtoverlay) $(call multi_depend, $(multi-dtb-y), .dtb, -dtbs) +ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),) DT_CHECKER ?= dt-validate DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m) DT_BINDING_DIR := Documentation/devicetree/bindings -DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.json +DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json -ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),) quiet_cmd_dtb_check = CHECK $@ cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true endif