On 25/10/23 02:35PM, Sourabh Jain wrote:
>
>
> > <...snip...>
> > + curr_reg_entry->reg_id =
> > + cpu_to_be64(fadump_str_to_u64("CPUSTRT"));
> > + curr_reg_entry->reg_value = cpu_to_be64(
> > + ppc_cpu->vcpu_id & FADUMP_CPU_ID_MASK);
>
> Seems like converting full 64 bit CPU ID to 64 bit BE value will not bring
> reg
> entry in below format. Isn't it?
>
> 8 Bytes Identifier (BE) | 4 Bytes Reserved (0x0) | 4 Bytes Logical CPU ID
> (BE)
>
>
>
> > <...snip...>
> > + /* End the registers for this CPU with "CPUEND" reg entry */
> > + curr_reg_entry->reg_id =
> > + cpu_to_be64(fadump_str_to_u64("CPUEND"));
> > + curr_reg_entry->reg_value = cpu_to_be64(
> > + ppc_cpu->vcpu_id & FADUMP_CPU_ID_MASK);
>
> Same here.
Yes, it follows the format since even though we use 8 bytes, but
swapping the 8 bytes at a time, brings the lower 4 bytes of 'vcpu_id'
to the higher 4 bytes after a 8 byte swap, which is where the CPU ID
should be according to the format.
It is also consistent with how the Linux kernel reads this field:
cpu = (be64_to_cpu(reg_entry->reg_value) &
RTAS_FADUMP_CPU_ID_MASK);
Thanks,
- Aditya G