[Skiboot] [PATCH v7 20/22] fadump: Hardcode architected register destination memory

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue May 14 18:09:58 AEST 2019


On 05/09/2019 09:45 AM, Michael Neuling wrote:
> On Sat, 2019-04-13 at 14:45 +0530, Vasant Hegde wrote:
>> Hardcode architected register destination memory address. So that we can
>> capture early OPAL crashes.
>>
>> Note that this patch splits SPIRAH memory into two parts to accommodate
>> architected register ntuple. Today we have 1K memory for SPIRAH and it uses
>> 288 bytes. After this split we have 244 bytes left for SPIRAH expansion. I
>> think this is good enough (at least for P9 generation).
>>
>> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
>> ---
>>   core/opal-dump.c  |  4 ++++
>>   hdata/spira.c     | 12 ++++++++++++
>>   include/mem-map.h | 26 +++++++++++++++++++++++---
>>   skiboot.lds.S     |  5 +++++
>>   4 files changed, 44 insertions(+), 3 deletions(-)
>>
>> diff --git a/core/opal-dump.c b/core/opal-dump.c
>> index 8e042083c..f06739937 100644
>> --- a/core/opal-dump.c
>> +++ b/core/opal-dump.c
>> @@ -261,6 +261,10 @@ static void add_dump_reserve_node(struct dt_node
>> *dump_node)
>>   
>>   	mem_reserve_fw("ibm,firmware-dump", (u64)OPAL_DUMP_DEST_BASE,
>>   		       new_size > cur_size ? new_size : cur_size);
>> +
>> +	/* Reserved memory used to capture architected register state */
>> +	mem_reserve_fw("ibm,firmware-arch-registers",
>> +		       (u64)ARCH_REGS_STATE_BASE, ARCH_REGS_STATE_SIZE);
>>   }
>>   
>>   /* Pass OPAL dump reservation details to payload via device tree. */
>> diff --git a/hdata/spira.c b/hdata/spira.c
>> index fa6149322..856126844 100644
>> --- a/hdata/spira.c
>> +++ b/hdata/spira.c
>> @@ -131,6 +131,11 @@ __section(".mddt.data") struct mddt_table
>> init_mddt_table[3] = {
>>   	},
>>   };
>>   
>> +__section(".procdump.data") struct proc_dump_area proc_dump_area = {
>> +	.alloc_addr = CPU_TO_BE64(ARCH_REGS_STATE_BASE | HRMOR_BIT),
>> +	.alloc_size = CPU_TO_BE32(ARCH_REGS_STATE_SIZE),
>> +};
>> +
>>   /* SP Interface Root Array, aka SPIRA */
>>   __section(".spira.data") struct spira spira = {
>>   	.hdr = HDIF_SIMPLE_HDR("SPIRA ", SPIRA_VERSION, struct spira),
>> @@ -242,6 +247,13 @@ __section(".spirah.data") struct spirah spirah = {
>>   			.alloc_len	= CPU_TO_BE32(sizeof(struct
>> mdrt_table)),
>>   			.act_len	= CPU_TO_BE32(sizeof(struct mdrt_table)),
>>   		},
>> +		.proc_dump_area = {
>> +			.addr		= CPU_TO_BE64(PROC_DUMP_AREA_OFF),
>> +			.alloc_cnt	= CPU_TO_BE16(1),
>> +			.act_cnt	= CPU_TO_BE16(1),
>> +			.alloc_len	= CPU_TO_BE32(sizeof(struct
>> proc_dump_area)),
>> +			.act_len	= CPU_TO_BE32(sizeof(struct proc_dump_area)),
>> +		},
>>   	},
>>   };
>>   
>> diff --git a/include/mem-map.h b/include/mem-map.h
>> index 01b8945b6..0cb4d5da4 100644
>> --- a/include/mem-map.h
>> +++ b/include/mem-map.h
>> @@ -38,10 +38,22 @@
>>    * give it 64k before placing the SPIRA and related data.
>>    */
>>   #define SPIRA_OFF		0x00010000
>> +#define SPIRA_SIZE		0x400
>>   #define SPIRAH_OFF		0x00010400
>> +#define SPIRAH_SIZE		0x200
>> +
>> +#define PROC_DUMP_AREA_OFF	(SPIRAH_OFF + SPIRAH_SIZE)
>> +#define PROC_DUMP_AREA_SIZE	0x200
>>   
>>   /* Actual SPIRA size is lesser than 1K (presently 0x340 bytes).
>> - * Use 1K for legacy SPIRA and 1K for SPIRA-H.
>> + * Use 1K for legacy SPIRA.
>> + *
>> + * SPIRA-H is lesser than 512 bytes (presently we use 288 bytes)
>> + * Use 512 bytes for SPIRAH.
>> + *
>> + * Use 512 bytes for processor dump area. (presently we use
>> + * sizeof(proc_dump_area) = 0x30 bytes).
>> + *
>>    * Then follow with for proc_init_data (aka PROCIN).
>>    * These need to be at fixed addresses in case we're ever little
>>    * endian: linker can't endian reverse a pointer for us.  Text, data
>> @@ -133,9 +145,17 @@
>>    * XXX: Use continuguous memory for OPAL destination memory so that we can
>>    *      create single reserve node entry in device tree for OPAL destination
>>    *      memory.
>> + *
>> + *      Note that we allocate maximum memory required to capture architected
>> + *      registers on P9 two socket system. If we ever support bigger system
>> + *      then we have to adjust this size.
> 
> Please put an assert in the code for this. This comment is likely to be long
> forgotten when we get our first > 2 socket machine.

Sure. I will add assert.

> 
>>    */
>> -#define OPAL_DUMP_DEST_BASE	(CPU_STACKS_BASE + \
>> +#define ARCH_REGS_STATE_BASE	(CPU_STACKS_BASE + \
>>   				 ((SPR_PIR_P9_MASK + 1) * STACK_SIZE))
>> +#define ARCH_REGS_STATE_SIZE	0x200000
> 
> How is this number calculated?

Based on number of registers data we are going to capture and its size.
I should have changed this to 1MB....which is sufficient for 2socket system.
Will fix it.

For now its hardcoded. I have asked HDAT to provide the count ... so
that we will calculate exact size during init.


-Vasant



More information about the Skiboot mailing list