[Skiboot] [RFC PATCH v5 10/16] hdata/spira.c: Create ibm, ultravisor dt node

Ryan Grimm grimm at linux.vnet.ibm.com
Tue Mar 24 03:22:27 AEDT 2020


On Wed, 2020-03-04 at 18:44 +1100, Alexey Kardashevskiy wrote:
> 
> On 28/02/2020 07:40, Ryan Grimm wrote:
> > Create ibm,ultravisor node if secure memory exists.  See
> > doc/opal-uv-abi.rst for details.
> > 
> > Signed-off-by: Ryan Grimm <grimm at us.ibm.com>
> > ---
> >  hdata/spira.c | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/hdata/spira.c b/hdata/spira.c
> > index 7c5918d2..1435d175 100644
> > --- a/hdata/spira.c
> > +++ b/hdata/spira.c
> > @@ -1712,6 +1712,36 @@ static void update_spirah_addr(void)
> >  #endif
> >  }
> >  
> > +#define UV_LOAD_MAX_SIZE        0x200000
> 
> Oh it is another UV_LOAD_MAX_SIZE, the first one was in 02/16.
> 

k.

> 
> > +
> > +static void add_uv(void)
> > +{
> > +	struct dt_node *uv_node, *secure_mem_node, *uv_fw_node;
> > +	uint64_t uv_fw_start;
> > +	char fw_name[64];
> > +
> > +	secure_mem_node = dt_find_compatible_node_on_chip(dt_root,
> > NULL,
> > +						"ibm,secure-memory",
> > 0);
> > +	if (!secure_mem_node) {
> > +		prlog(PR_DEBUG, "HDAT: No ibm,secure-memory found\n");
> > +		return;
> > +	}
> > +
> > +	uv_node = dt_new_check(dt_root, "ibm,ultravisor");
> > +	dt_add_property_string(uv_node, "compatible",
> > "ibm,ultravisor");
> > +	dt_add_property_cells(uv_node, "#address-cells", 2);
> > +	dt_add_property_cells(uv_node, "#size-cells", 2);
> > +
> > +	uv_fw_start = dt_get_address(secure_mem_node, 0, NULL);
> > +
> > +	snprintf(fw_name, 64, "firmware@%llx", (unsigned long
> > long)uv_fw_start);
> 
> 
> (unsigned long long) seems unnecessary here.
> 

k.

> 
> > +	uv_fw_node = dt_new_check(uv_node, fw_name);
> > +	dt_add_property_string(uv_fw_node, "compatible", "ibm,uv-
> > firmware");
> > +	dt_add_property_cells(uv_fw_node, "reg", uv_fw_start >> 32,
> > +			uv_fw_start & 0xffffffff, UV_LOAD_MAX_SIZE >>
> > 23,
> 
> s/23/32/ ?
> 
> > +			UV_LOAD_MAX_SIZE & 0xffffffff);
> 
> 
> Just use dt_add_property_u64s().
> 

OK, yikes!  Thanks, I've been learning how to use dt_* functions
properly and this squeeked through. :)


-Ryan

> 
> > +}
> > +
> >  int parse_hdat(bool is_opal)
> >  {
> >  	cpu_type = PVR_TYPE(mfspr(SPR_PVR));
> > @@ -1753,6 +1783,9 @@ int parse_hdat(bool is_opal)
> >  	/* Parse MS VPD */
> >  	memory_parse();
> >  
> > +	/* Add UV node if secure memory exists */
> > +	add_uv();
> > +
> >  	/* Add any FSPs */
> >  	fsp_parse();
> >  
> > 
> 
> 



More information about the Skiboot mailing list