[Skiboot] [PATCH v7 21/22] hdata: Add architected register details to device tree

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue May 14 03:26:01 AEST 2019


On 05/09/2019 10:24 AM, Michael Neuling wrote:
> On Sat, 2019-04-13 at 14:45 +0530, Vasant Hegde wrote:
>> Post MPIPL FSP/hostboot passes architected register data via HDAT. Add support
>> to get architected register data from HDAT and pass it to kernel. Kernel will
>> use this data to generate vmcore and opalcore.
>>
>> Device tree properties under /ibm,opal/dump node:
>>        cpu-data-version - Architected register data format version
>>        cpu-data-size    - Per CPU register data size
>>        result-table     - Add entry for architected register
>>                           Based on cpu-data-size and result-table, kernel will be
>>                           able to get data for indivisual CPU/register.
> 
> Individual

Fixed.

> 
>>
>> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
>> ---
>>   hdata/spira.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
>>   1 file changed, 48 insertions(+), 2 deletions(-)
>>
>> diff --git a/hdata/spira.c b/hdata/spira.c
>> index 856126844..84a0094f1 100644
>> --- a/hdata/spira.c
>> +++ b/hdata/spira.c
>> @@ -1069,6 +1069,45 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams)
>>   	dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size);
>>   }
>>   
>> +/* Map architected register data to result-table */
>> +static int opal_dump_add_arch_regs(struct dt_node *dump_node,
>> +				   struct fadump *result_table,
>> +				   int *res_table_cnt)
>> +{
>> +	const struct spira_ntuple *ntuple_proc_dump;
>> +	const struct proc_dump_area *arch_regs;
>> +	struct fadump_section *fadump_section;
>> +
>> +	ntuple_proc_dump = &spira.ntuples.proc_dump_area;
>> +	arch_regs = (void *)ntuple_proc_dump->addr;
>> +
>> +	if (arch_regs->dest_addr == 0 || arch_regs->act_size <= 0) {
>> +		prlog(PR_DEBUG,
>> +		      "DUMP: Architected register data is missing\n");
>> +		return OPAL_HARDWARE;
>> +	}
>> +
>> +	if (arch_regs->thread_size <= 0) {
>> +		prlog(PR_DEBUG,
>> +		      "DUMP: Invalid architected register thread size\n");
>> +		return OPAL_HARDWARE;
>> +	}
>> +
>> +	/* Add each thread size to device tree */
>> +	dt_add_property_cells(dump_node, "cpu-data-size",
>> +			      cpu_to_be32(arch_regs->thread_size));
>> +
>> +	fadump_section = &(result_table->section[*res_table_cnt]);
>> +	fadump_section->source_type = DUMP_REGION_CPU_DATA;
>> +	fadump_section->source_addr = arch_regs->dest_addr & ~(HRMOR_BIT);
>> +	fadump_section->dest_addr = arch_regs->dest_addr & ~(HRMOR_BIT);
>> +	fadump_section->source_size = arch_regs->act_size;
>> +	fadump_section->dest_size = arch_regs->act_size;
>> +	(*res_table_cnt)++;
> 
> Do this increment in the caller based on the errors. It seem to increment a
> counter j. I'm not sure what that's doing or why it needs to be incremented at
> all.

Yep! makes sense to increment in caller. Fixed.

> 
>> +
>> +	return OPAL_SUCCESS;
>> +}
>> +
>>   static void opal_dump_add_result_table(const struct iplparams_iplparams *p)
>>   {
>>   	int i, j = 0;
>> @@ -1109,9 +1148,9 @@ static void opal_dump_add_result_table(const struct iplparams_iplparams *p)
>>   
>>   	prlog(PR_NOTICE, "DUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt);
>>   
>> -	/* Calculcate property size */
>> +	/* Number of entries in MDRT table + 1 for arch register data */
>>   	prop_size = sizeof(struct fadump) +
>> -		(mdrt_cnt * sizeof(struct fadump_section));
>> +		((mdrt_cnt + 1) * sizeof(struct fadump_section));
>>   	result_table = zalloc(prop_size);
>>   	if (!result_table) {
>>   		prlog(PR_ERR, "DUMP: Failed to allocate memory\n");
>> @@ -1150,6 +1189,9 @@ static void opal_dump_add_result_table(const struct iplparams_iplparams *p)
>>   		return;
>>   	}
>>   
>> +	/* Add architected register data to result-table */
>> +	opal_dump_add_arch_regs(dump_node, result_table, &j);
> 
> This function returns errors you are ignoring

Fixed.

Thanks
-Vasant



More information about the Skiboot mailing list