[PATCH] xen/arm: Use FDT_MAGIC from libfdt instead of local macro

Dmytro Prokopchuk1 posted 1 patch 6 days, 17 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/464fb509cc7f66934689d9e2d3a77bf5fcd45c24.1762931200.git.dmytro._5Fprokopchuk1@epam.com
There is a newer version of this series
xen/arch/arm/kernel.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] xen/arm: Use FDT_MAGIC from libfdt instead of local macro
Posted by Dmytro Prokopchuk1 6 days, 17 hours ago
Remove the redundant local 'DTB_MAGIC' definition and replace its usage
with the canonical 'FDT_MAGIC' from 'libfdt'.

Fixes: 66edeb2e3972 (arm: copy DTB appended to zImage)
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
 xen/arch/arm/kernel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 48f4b56d0c..7544fd50a2 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -40,8 +40,6 @@ struct minimal_dtb_header {
     /* There are other fields but we don't use them yet. */
 };
 
-#define DTB_MAGIC 0xd00dfeedU
-
 static void __init place_modules(struct kernel_info *info,
                                  paddr_t kernbase, paddr_t kernend)
 {
@@ -383,7 +381,7 @@ static int __init kernel_zimage32_probe(struct kernel_info *info,
     if ( addr + end - start + sizeof(dtb_hdr) <= size )
     {
         copy_from_paddr(&dtb_hdr, addr + end - start, sizeof(dtb_hdr));
-        if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
+        if (be32_to_cpu(dtb_hdr.magic) == FDT_MAGIC) {
             end += be32_to_cpu(dtb_hdr.total_size);
 
             if ( end > addr + size )
-- 
2.43.0
Re: [PATCH] xen/arm: Use FDT_MAGIC from libfdt instead of local macro
Posted by Luca Fancellu 6 days, 16 hours ago
Hi Dmytro,

> On 12 Nov 2025, at 07:08, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
> 
> Remove the redundant local 'DTB_MAGIC' definition and replace its usage
> with the canonical 'FDT_MAGIC' from 'libfdt'.
> 
> Fixes: 66edeb2e3972 (arm: copy DTB appended to zImage)
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
> ---

Looks good to me!

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

while there I noticed we have DTB_MAGIC that seems to be not used in the toolstack
xen/tools/libs/guest/xg_dom_armzimageloader.c.

I don’t think that should be addressed in this patch, I just wanted to raise awareness.

Cheers,
Luca


Re: [PATCH] xen/arm: Use FDT_MAGIC from libfdt instead of local macro
Posted by Orzel, Michal 6 days, 16 hours ago

On 12/11/2025 08:47, Luca Fancellu wrote:
> Hi Dmytro,
> 
>> On 12 Nov 2025, at 07:08, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
>>
>> Remove the redundant local 'DTB_MAGIC' definition and replace its usage
>> with the canonical 'FDT_MAGIC' from 'libfdt'.
>>
>> Fixes: 66edeb2e3972 (arm: copy DTB appended to zImage)
NIT: Fixes is for bugs. Redundant macro is not a bug I believe.

~Michal

>> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
>> ---
> 
> Looks good to me!
> 
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
> 
> while there I noticed we have DTB_MAGIC that seems to be not used in the toolstack
> xen/tools/libs/guest/xg_dom_armzimageloader.c.
> 
> I don’t think that should be addressed in this patch, I just wanted to raise awareness.
> 
> Cheers,
> Luca
> 
> 


Re: [PATCH] xen/arm: Use FDT_MAGIC from libfdt instead of local macro
Posted by Jan Beulich 6 days, 16 hours ago
On 12.11.2025 09:15, Orzel, Michal wrote:
> On 12/11/2025 08:47, Luca Fancellu wrote:
>>> On 12 Nov 2025, at 07:08, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
>>>
>>> Remove the redundant local 'DTB_MAGIC' definition and replace its usage
>>> with the canonical 'FDT_MAGIC' from 'libfdt'.
>>>
>>> Fixes: 66edeb2e3972 (arm: copy DTB appended to zImage)
> NIT: Fixes is for bugs. Redundant macro is not a bug I believe.

Maybe use the relatively new Amends: here instead?

Jan
Re: [PATCH] xen/arm: Use FDT_MAGIC from libfdt instead of local macro
Posted by Dmytro Prokopchuk1 6 days, 14 hours ago

On 11/12/25 10:27, Jan Beulich wrote:
> On 12.11.2025 09:15, Orzel, Michal wrote:
>> On 12/11/2025 08:47, Luca Fancellu wrote:
>>>> On 12 Nov 2025, at 07:08, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
>>>>
>>>> Remove the redundant local 'DTB_MAGIC' definition and replace its usage
>>>> with the canonical 'FDT_MAGIC' from 'libfdt'.
>>>>
>>>> Fixes: 66edeb2e3972 (arm: copy DTB appended to zImage)
>> NIT: Fixes is for bugs. Redundant macro is not a bug I believe.
> 
> Maybe use the relatively new Amends: here instead?
> 
> Jan

Yes, sure. "Amends:" tag should be used here.
Thanks.
Dmytro.