[PATCH v2 2/2] habv4: use hab rom implementation of report_event

Sascha Hauer s.hauer at pengutronix.de
Tue Jan 16 23:20:25 PST 2024


On Tue, Jan 16, 2024 at 09:13:48AM +0100, Ahmad Fatoum wrote:
> Hello Stefan,
> 
> On 12.01.24 16:21, Stefan Kerkmann wrote:
> > +static enum hab_status hab_sip_report_event(enum hab_status status,
> > +					    uint32_t index, uint8_t *event,
> > +					    size_t *bytes)
> > +{
> > +	struct arm_smccc_res res;
> > +
> > +	v8_flush_dcache_range((unsigned long)bytes,
> > +			      (unsigned long)bytes + sizeof(*bytes));
> > +
> > +	if (event)
> > +		v8_flush_dcache_range((unsigned long)event,
> > +				      (unsigned long)event + *bytes);
> 
> I am not too happy about the cache maintenance here. *event and *bytes
> are both stack memory, which share a cache line with other stack variables.
> 
> This issue exists in hab_sip_report_status too, so this need not delay
> application of the series, but it would nice to get this cleaned up,
> eventually.
> 
> A first attempt was here:
> https://lore.barebox.org/barebox/20230921095649.310666-1-a.fatoum@pengutronix.de/
> 
> I am also unsure if cache maintenance is correct, see:
> https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.org/message/D3PIAW7G2B3JQIH5BGMUZZKHPGNMXUUT/
> 
> > +static enum hab_status imx8m_report_event(enum hab_status status,
> > +					  uint32_t index, uint8_t *event,
> > +					  size_t *bytes)
> > +{
> > +	if (cpu_is_mx8mm() || cpu_is_mx8mn() || cpu_is_imx8mp())
> 
> I suggest we swap the if else clauses and use cpu_is_mx8mq(). imx8m_read_sram_events
> only supports that one SoC now and it's likely that new SoCs (e.g. i.MX9) will
> also reuse hab_sip_report_event. Could you send a fixup?

I fixed this part up here.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list