mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Stefan Kerkmann <s.kerkmann@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] habv4: use hab rom implementation of report_event
Date: Tue, 16 Jan 2024 09:13:48 +0100	[thread overview]
Message-ID: <15aa742d-9670-4da5-a65b-263d44e260cb@pengutronix.de> (raw)
In-Reply-To: <20240112-fix-habv4-event-report-v2-2-1c91bc857935@pengutronix.de>

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?

Thanks,
Ahmad

> +		return hab_sip_report_event(status, index, event, bytes);
> +	else
> +		return imx8m_read_sram_events(status, index, event, bytes);
> +}
> +
>  struct habv4_rvt hab_smc_ops = {
>  	.header = { .tag = 0xdd },
> -	.report_event = imx8m_read_sram_events,
> +	.report_event = imx8m_report_event,
>  	.report_status = hab_sip_report_status,
>  };
>  
> 

-- 
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 |




  parent reply	other threads:[~2024-01-16  8:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 15:21 [PATCH v2 0/2] Use HABv4 report_event implementation for imx8mm and imx8mn Stefan Kerkmann
2024-01-12 15:21 ` [PATCH v2 1/2] habv4: correct habv4 rom vector table Stefan Kerkmann
2024-01-12 15:21 ` [PATCH v2 2/2] habv4: use hab rom implementation of report_event Stefan Kerkmann
2024-01-12 16:29   ` Stefan Kerkmann
2024-01-16  6:53     ` Sascha Hauer
2024-01-16  8:13   ` Ahmad Fatoum [this message]
2024-01-17  7:20     ` Sascha Hauer
2024-01-17  7:45       ` Stefan Kerkmann
2024-01-16  6:50 ` [PATCH v2 0/2] Use HABv4 report_event implementation for imx8mm and imx8mn Sascha Hauer
2024-01-16  7:09 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15aa742d-9670-4da5-a65b-263d44e260cb@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.kerkmann@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox