From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Michal Orzel <michal.orzel@amd.com>
Cc: xen-devel@lists.xenproject.org,
Doug Goldstein <cardoe@cardoe.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Luca Fancellu <luca.fancellu@arm.com>
Subject: Re: [PATCH v2] xen/dt-overlay: support phandle-based targeting in overlay_get_nodes_info
Date: Tue, 28 Apr 2026 10:20:01 +0200 [thread overview]
Message-ID: <2f9875a8a1f4d85ddceccb2d093a4951@bugseng.com> (raw)
In-Reply-To: <20260428080218.19371-1-michal.orzel@amd.com>
On 2026-04-28 10:02, Michal Orzel wrote:
> overlay_get_nodes_info() is called before fdt_overlay_apply() to
> extract
> target paths from the overlay. This fails for overlays using
> phandle-based
> targeting (target = <&label>) because DTC compiles these as unresolved
> fixups (target = <0xffffffff>), causing fdt_overlay_target_offset() to
> return -FDT_ERR_BADPHANDLE. Prior to this change users were forced to
> manually modify the dtbo (even for hwdom) to switch from target to
> target-phandle by manually inspecting also the host DTB.
>
> Introduce overlay_get_target_path() which directly handles the two
> targeting cases that occur before fixup resolution:
> - target-path: the string property is returned directly.
> - target = <&label>: the label is found in the overlay's __fixups__
> node, then resolved to a path via the base DTB's __symbols__ node.
>
> Libfdt fdt_for_each_property_offset() violates MISRA R20.7. Despite
> libfdt being excluded from the analysis, this causes ECLAIR scan to
> report a regression because the violation introduced by a macro is
> reported at the call site. Deviate R20.7 for libfdt.h.
>
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> ---
> In my pre-push testing I realized ECLAIR allcode reported a violation
> related to
> the use of fdt_for_each_property_offset. Libfdt is excluded from
> analysis but
> this does not apply to e.g. macros used in other places.
>
> Changes in v2:
> - strip out from series that is ready to be committed
> - deviate 20.7 for libfdt.h. Discussed with Nicole.
>
> https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2484326830
> ---
> .../eclair_analysis/ECLAIR/deviations.ecl | 1 +
> xen/common/device-tree/dt-overlay.c | 65 +++++++++++++++++--
> 2 files changed, 60 insertions(+), 6 deletions(-)
>
> diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl
> b/automation/eclair_analysis/ECLAIR/deviations.ecl
> index 30c323906924..5f0b73062474 100644
> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> @@ -631,6 +631,7 @@ not in scope for compliance are allowed, as that is
> imported code."
> -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
> -config=MC3A2.R20.7,reports+={safe,
> "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
> -config=MC3A2.R20.7,reports+={safe,
> "any_area(any_loc(file(acpi_cpu_idle)))"}
> +-config=MC3A2.R20.7,reports+={safe,
> "any_area(any_loc(any_exp(file(^xen/include/xen/libfdt/libfdt.h$))))"}
> -doc_end
>
Nit: I think using a file_tag as above is better, but in any case use
libfdt\\.h in the regex
> -doc_begin="To avoid compromising readability, the macros
> alternative_(v)?call[0-9] are allowed
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
next prev parent reply other threads:[~2026-04-28 8:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 8:02 [PATCH v2] xen/dt-overlay: support phandle-based targeting in overlay_get_nodes_info Michal Orzel
2026-04-28 8:05 ` Luca Fancellu
2026-04-28 8:10 ` Orzel, Michal
2026-04-28 8:20 ` Nicola Vetrini [this message]
2026-04-28 10:22 ` Orzel, Michal
2026-04-28 10:24 ` Nicola Vetrini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f9875a8a1f4d85ddceccb2d093a4951@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=bertrand.marquis@arm.com \
--cc=cardoe@cardoe.com \
--cc=julien@xen.org \
--cc=luca.fancellu@arm.com \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.