[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/dt-overlay: support phandle-based targeting in overlay_get_nodes_info


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Tue, 28 Apr 2026 10:20:01 +0200
  • Arc-authentication-results: i=1; bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Arc-message-signature: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; c=relaxed/relaxed; t=1777364401; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=vZ/d8dW13BwV9iBbLeQFHYLNppK60PCdRQMXTOBjpUs=; b=dLc0Wsg7YzkorDREyDMb62JHHbhj0Y54vIXJp+mNlNJUCXX35w4WuPKNdB+jdy0c+Pdr fqLgiMga56b/1o5xCcvM7UIcH72vjXoIsgphRX09SD8egOx2mfXg80FiHO/MOdo3idT0z JLRbph22LqoGQvwfQG9h7WwEfsJKGF0If0nXyxsZwgTrM3P7m4ejGtmvFZxUDR7dB6cop 5SbxUTlsdkjHLHQQs663dUtb5LJMmGpd5k829iS/++M94EhwEjhUvJUPwWn0DvZfTgkdA gGAwtXrSi6T4yhIFieZ1X2RqZrjfKehgPOdQH5AWSrIBY0S1BTHdw1Vy73YxdW4J3frBD FoSUqV/0/uIZSpdTf64Cw8YO6kFHmF7/GpGzXf+m+O0oI356UX5kaIzfyXdXpzZ0vjQlI WAFLsfx07ug2GVNkhE2/M2ZfXk6r0V/gGo5a6p8qIqicnzRscSSKAlLPsNg7qzdxFBz0V rTeW5xG/qYpqFrmzwET8OR3F5NMocJJyEKdVNTTd93LBq0CRPaFjUjFqmh+bIfFmcJnms ziTXMEdvNQd9+jWp8rGTiSIrtyM4qmZKUizPFzF1rp7F+NsbxHYaFCUQYLYfHmXOHerKN mb4Us2uwuNL/Ee5menpb06ez4WEglQMk3Hg63P2C7SifxVDwLJo/codlr5oQNeM=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1777364401; b=HWzt/s1yxEd2Q6Re/20+f3aIl2DaWobEFjkYwCljd5Prwgeva6WijAmqoWYQJ7HuryV2 GMT1sCTk9KK+a7hsR2sVtof5qGtSrnsrAkDHItlmlrk7zF1AXzPXTtcvBWThN27vhsOfn N3UmfIT7pXnMfrlw+yIqTdbgiE5DyS1VlH1qZktD0CCBXxlys8rwEG9+/pz0XObSDb+44 eS/y6Kbwvyhvc/xWLBhXueNw1zEPRpEJbsJHfm5+AgvtsDThP13SAa/JRtZ5wWZxxkbj7 ZLI9WfWJV1pzIkcZAGBIDPFv5XfvTub9u5yJkw/AjZc35Wl4/47PIg1frBVfrqoWXRbqf YckJgS5ppIaSKFtvaPA5fn/6+CCIuPr3V7wxBaEBsVRiG6d7gptnzfVvespwO9YXb5mSf f7mo4d2ygEfpdmyNQwHCmgT+WkJOFSQoMXV5YJusqLRvaFPbUM9UmRpy9LdLNrRe/0kuc Rjr0NVhlIQCvB5TwZn5DJeRfJlx6C8q0KGQD+I20dYAWnC+wqup6ACL/sME0Qdel0mGmW 5lG0ZXDQwAERLS6la4uVix3Fr3H8YxSzPpNJ6poxqFmna0wJsaRyro0NKFftxuaMcoQSs rWsTYCRgnoU5QT2nE+l5HkY5x/GW6ecwUi5kb7O4qiHww3yknBN2chGG6Zx1+Sw=
  • Authentication-results: eu.smtp.expurgate.cloud; none
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Luca Fancellu <luca.fancellu@xxxxxxx>
  • Delivery-date: Tue, 28 Apr 2026 08:20:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxx>
Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.