[PATCH v3 1/2] dt-ops: Add helper API to dump fdt blob

Bhupesh Sharma bhsharma at redhat.com
Thu Jun 21 01:00:28 PDT 2018


Hi Akashi,

On 06/20/2018 03:59 PM, Bhupesh Sharma wrote:
> Hi Akashi,
> 
> Apologies for delay in replying. Somehow my email filter rules messed up 
> and the review email was sent to another folder.
> 
> Please see my comments inline:
> 
> On 05/08/2018 07:44 AM, AKASHI Takahiro wrote:
>> Bhupesh,
>>
>> On Mon, Apr 30, 2018 at 02:52:35AM +0530, Bhupesh Sharma wrote:
>>> At several occasions it would be useful to dump the fdt
>>> blob being passed to the second (kexec/kdump) kernel
>>> when '-d' flag is specified while invoking kexec/kdump.
>>>
>>> This allows one to look at the device-tree fields that
>>> is being passed to the secondary kernel and accordingly
>>> debug issues.
>>>
>>> This can be specially useful for the arm64 case, where
>>> kexec_load() or kdump passes important information like
>>> 'linux,usable-memory' ranges to the second kernel, and
>>> the correctness of the ranges can be verified by
>>> looking at the device-tree dump with '-d' flag specified.
>>>
>>> Signed-off-by: Bhupesh Sharma <bhsharma at redhat.com>
>>> ---
>>>   kexec/dt-ops.c | 143 
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>   kexec/dt-ops.h |   1 +
>>>   2 files changed, 144 insertions(+)
>>>
>>> diff --git a/kexec/dt-ops.c b/kexec/dt-ops.c
>>> index 915dbf55afd2..cb95920e5c3e 100644
>>> --- a/kexec/dt-ops.c
>>> +++ b/kexec/dt-ops.c
>>> @@ -8,6 +8,10 @@
>>>   #include "kexec.h"
>>>   #include "dt-ops.h"
>>> +#define ALIGN(x, a)    (((x) + ((a) - 1)) & ~((a) - 1))
>>> +#define PALIGN(p, a)    ((void *)(ALIGN((unsigned long)(p), (a))))
>>
>> Pointer doesn't always fit to unsigned long.
>>
>>> +#define GET_CELL(p)    (p += 4, *((const uint32_t *)(p-4)))
>>
>> Tricky :) Inline function would be better.
> 
> Ok.
> 

Well, I was working on converting this into an inline function, but the 
final implementation turned out to be more 'trickier' then the macro, so 
I would suggest that we stick to the macro for now (for the v4) and 
later when I can think of a better approach, I will submit another patch 
to fix the issue.

Please let me know in case of any concerns.
I would try to send out v4 later today.

Thanks,
Bhupesh



More information about the kexec mailing list