[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: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 28 Apr 2026 12:22:08 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=bugseng.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EyR7PutCQL5LGH1gsjDsAyMJf9cdoMsIdLhIXecj38Y=; b=OysW7VcVUniKM06XG5r/85l+hEhf1p00VWFtCLYg4JmMe2U2i9NpQsqn/ZWhTJvCIJTGRKiYL/kYZneY+ep0FcV/12iZBu/yNHSflUvzGiBfdXEbVH/xEtLP8fyH3xYzot20tKU6n9/UxkIaOIw5dYqamiM1LjMCohn2zEFGhCqfqpxci1udICBgqvMrI/9Jmbm8lx8GvRCkEuWsdFu6eWr82DOylIaAsO4jZ39KwCTfmnGkpt5ZBsCnbtCT9lIJCCjPGhXW3ObMExpnf2PBgBtBGU4/fLiyErOAOyjqLbakWInwfejjOtJIIm/LfoVAoL1PfXFUUabLEc7cLauWLw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BAWoDlqXGQXKRHwlK4JMZn29cFi5cwRt+yh8joO2Rzs9Pm2ER7kkuYaHGAeWdD6UbpO5JUjWjAnLtCW4GK//GrHURKQqoNislXR0xTJT/AuslUGpZmawmxBshUcmE1Xqjjzkr2L+Iko6K7nt4wjXuHPxS4t7gfarThIcUXnyTwnfW0WblFXxa+R1Bbo5mRu4ZhZ6m4GRmQPiFiY0HdtIU+BBnGE3E3LJgLpQFM2hm3as3F/xSfc1tj01BTfhPAVvxwSdLysztD5gzh8G5Yg4Bou5jKlXebTDQa0F6kCigw2bMCISB9TKKM/hm+7HAXDgidskpEpbLjcZrt2GqDpFgQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • 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 10:22:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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@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
Ok. Provided I will do this on commit, may I convert this as your Rb/Ab?

~Michal




 


Rackspace

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