[Skiboot] [PATCH v7 16/22] fadump: Send OPAL relocated base address to SBE

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


On 05/09/2019 09:21 AM, Michael Neuling wrote:
> On Sat, 2019-04-13 at 14:45 +0530, Vasant Hegde wrote:
>> OPAL relocates itself during boot. During memory preserving IPL hostboot needs
>> to access relocated OPAL base address to get MDST, MDDT tables. Hence send
>> relocated base address to SBE via 'stash MPIPL config' chip-op. During next
>> IPL SBE will send stashed data to hostboot... so that hostboot can access
>> these data.
>>
>> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
>> ---
>>   core/opal-dump.c |  4 ++++
>>   hw/sbe-p9.c      | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>>   include/sbe-p9.h |  8 +++++++-
>>   3 files changed, 59 insertions(+), 1 deletion(-)
>>
>> diff --git a/core/opal-dump.c b/core/opal-dump.c
>> index 6400cbdb1..8e042083c 100644
>> --- a/core/opal-dump.c
>> +++ b/core/opal-dump.c
>> @@ -23,6 +23,7 @@
>>   #include <opal.h>
>>   #include <opal-dump.h>
>>   #include <opal-internal.h>
>> +#include <sbe-p9.h>
>>   #include <skiboot.h>
>>   
>>   #include <ccan/endian/endian.h>
>> @@ -363,6 +364,9 @@ void opal_dump_init(void)
>>   
>>   	adjust_opal_dump_size(dump_node);
>>   
>> +	/* Send OPAL relocated base address to SBE */
>> +	p9_sbe_send_relocated_base(SKIBOOT_BASE);
>> +
>>   	/* OPAL interface */
>>   	opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3);
>>   }
>> diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
>> index c28dbb9d6..ba7691f50 100644
>> --- a/hw/sbe-p9.c
>> +++ b/hw/sbe-p9.c
>> @@ -861,6 +861,54 @@ bool p9_sbe_timer_ok(void)
>>   	return sbe_has_timer;
>>   }
>>   
>> +static void p9_sbe_stash_chipop_resp(struct p9_sbe_msg *msg)
>> +{
>> +	int rc = p9_sbe_get_primary_rc(msg->resp);
>> +	struct p9_sbe *sbe = (void *)msg->user_data;
>> +
>> +	if (rc == SBE_STATUS_PRI_SUCCESS) {
>> +		prlog(PR_DEBUG, "Sent stash MPIPL config [chip id =0x%x]\n",
>> +		      sbe->chip_id);
>> +	} else {
>> +		prlog(PR_ERR, "Failed to send stash MPIPL config "
>> +		      "[chip id = 0x%x, rc = %d]\n", sbe->chip_id, rc);
>> +	}
>> +
>> +	p9_sbe_freemsg(msg);
>> +}
>> +
>> +static void __p9_sbe_send_relocated_base(struct p9_sbe *sbe, u64 reloc_base)
>> +{
>> +	u8 key = SBE_STASH_KEY_SKIBOOT_BASE;
>> +	u16 cmd = SBE_CMD_STASH_MPIPL_CONFIG;
>> +	u16 flag = SBE_CMD_CTRL_RESP_REQ;
>> +	struct p9_sbe_msg *msg;
>> +
>> +	msg = p9_sbe_mkmsg(cmd, flag, key, reloc_base, 0);
>> +	if (!msg) {
>> +		prlog(PR_DEBUG, "Message allocation failed\n");
> 
> PR_ERR

Fixed.

> 
> 
> 
>> +		return;
>> +	}
>> +
>> +	msg->user_data = (void *)sbe;
>> +	if (p9_sbe_queue_msg(sbe->chip_id, msg, p9_sbe_stash_chipop_resp)) {
>> +		prlog(PR_ERR, "Failed to queue stash MPIPL config message\n");
>> +	}
>> +}
>> +
>> +/* Send relocated skiboot base address to all SBE */
>> +void p9_sbe_send_relocated_base(uint64_t reloc_base)
> 
> Just call this "all" and the __ version "one" like we do with smp_call_function
> in the kernel.

I made it as p9_sbe_send_relocated_base and p9_sbe_send_relocated_base_single.

Thanks!
-Vasant



More information about the Skiboot mailing list