All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: "Orzel, Michal" <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 12:24:27 +0200	[thread overview]
Message-ID: <c595c2dbe4e6481d9bf79a8b0887200e@bugseng.com> (raw)
In-Reply-To: <d43959bd-6812-4241-b425-861d6020339b@amd.com>

On 2026-04-28 12:22, Orzel, Michal wrote:
> On 28-Apr-26 10:20, Nicola Vetrini wrote:
>> 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
> Ok. Provided I will do this on commit, may I convert this as your 
> Rb/Ab?
> 
> ~Michal

Yes, sure

Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253


      reply	other threads:[~2026-04-28 10:24 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
2026-04-28 10:22   ` Orzel, Michal
2026-04-28 10:24     ` Nicola Vetrini [this message]

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=c595c2dbe4e6481d9bf79a8b0887200e@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.