xen/arm: Add command line option to control SSBD mitigation
authorJulien Grall <julien.grall@arm.com>
Tue, 12 Jun 2018 11:36:35 +0000 (12:36 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 22 Jun 2018 01:59:28 +0000 (02:59 +0100)
commit07182e7d490aa6318a9d33706d8b40cbdb62e51d
tree5ce080d0a4092801d13316d42c2797d329da5ff4
parent280997891e8ca583f1b7a43297e197c0e4be8f0c
xen/arm: Add command line option to control SSBD mitigation

On a system where the firmware implements ARCH_WORKAROUND_2, it may be
useful to either permanently enable or disable the workaround for cases
where the user decides that they'd rather not get a trap overhead, and
keep the mitigation permanently on or off instead of switching it on
exception entry/exit. In any case, default to mitigation being enabled.

The new command line option is implemented as list of one option to
follow x86 option and also allow to extend it more easily in the future.

Note that for convenience, the full implemention of the workaround is
done in the .matches callback.

Lastly, a accessor is provided to know the state of the mitigation.

After this patch, there are 3 methods complementing each other to find the
state of the mitigation:
    - The capability ARM_SSBD indicates the platform is affected by the
      vulnerability. This will also return false if the user decide to force
      disabled the mitigation (spec-ctrl="ssbd=force-disable"). The
      capability is useful for putting shortcut in place using alternative.
    - ssbd_state indicates the global state of the mitigation (e.g
      unknown, force enable...). The global state is required to report
      the state to a guest.
    - The per-cpu ssbd_callback_required indicates whether a pCPU
      requires to call the SMC. This allows to shortcut SMC call
      and save an entry/exit to EL3.

This is part of XSA-263.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
docs/misc/xen-command-line.markdown
xen/arch/arm/cpuerrata.c
xen/include/asm-arm/cpuerrata.h