On Tue, May 01, 2018 at 11:55:00AM +0200, Mark Kettenis wrote:
> So after adding a quick hack to mitigate Spectre variant 2 to ARM
> Trusted Firmware (ATF), ARM actually designed a proper solution that
> minimizes the performance loss and makes the presence of the
> workaround detectable.  This is all documented in an update of the SMC
> Calling Convention (SMCCC) standard.
> 
> The diff below implements support for this solution while keeping
> support for the hack.  While ARM strongly suggests vendors to update
> to a version of ATF that implements SMCCC 1.1 the current ATF for the
> Marvell ARMADA 8040 hasn't been updated yet (but does include the
> initial hack).
> 
> Unfortunately the SMCCC 1.1 implementation in ATF doesn't quite
> implement the spec.  As a result we have to check whether the
> workaround is implemented by issuing the relevant calls on each of the
> CPUs that might be affected.  This is important for big.LITTLE designs
> such as the RK3399 that include both Cortex-A53 cores that aren't
> vulnerable and Cortex-A72 cores that are.
> 
> ok?
> 
> 
> Index: dev/fdt/psci.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/fdt/psci.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 psci.c
> --- dev/fdt/psci.c    23 Feb 2018 19:08:56 -0000      1.6
> +++ dev/fdt/psci.c    1 May 2018 09:35:14 -0000

> +int32_t
> +smccc_version(void)
> +{
> +     struct psci_softc *sc = psci_sc;
> +
> +     if (sc && sc->sc_callfn)
> +             return (*sc->sc_callfn)(SMCCC_VERSION, 0, 0, 0);

According to
https://developer.arm.com/-/media/developer/pdf/ARM_DEN_0070A_Firmware_interfaces_for_mitigating_CVE-2017-5715.pdf?revision=14854bab-e163-479e-b65b-05b491b31736&la=en

SMCCC_VERSION returning NOT_SUPPORTED/-1 should be treated as 1.0.
Should we return 0x10000 here or in the callers?

Though it seems all the callers just test for >= 1.1 at the moment
so I'm ok with this version going in.

Reply via email to