[PATCH v4 0/7] xen/arm: Sanitize cpuinfo

Bertrand Marquis posted 7 patches 2 years, 6 months ago
Failed in applying to current master (apply log)
xen/arch/arm/arm64/Makefile            |   1 +
xen/arch/arm/arm64/cpufeature.c        | 637 +++++++++++++++++++++++++
xen/arch/arm/cpufeature.c              |  12 +-
xen/arch/arm/p2m.c                     |  30 +-
xen/arch/arm/setup.c                   |  36 +-
xen/arch/arm/smpboot.c                 |  36 +-
xen/common/kernel.c                    |   6 +-
xen/include/asm-arm/arm64/cpufeature.h | 104 ++++
xen/include/asm-arm/arm64/sysregs.h    | 312 ++++++++++++
xen/include/asm-arm/cpufeature.h       |  32 +-
xen/include/asm-arm/processor.h        |  18 +-
xen/include/xen/lib.h                  |   1 +
12 files changed, 1166 insertions(+), 59 deletions(-)
create mode 100644 xen/arch/arm/arm64/cpufeature.c
create mode 100644 xen/include/asm-arm/arm64/cpufeature.h
[PATCH v4 0/7] xen/arm: Sanitize cpuinfo
Posted by Bertrand Marquis 2 years, 6 months ago
On arm architecture we might have heterogeneous platforms with different
types of cores. As a guest can potentialy run on any of those cores we
have to present them cpu features which are compatible with all cores
and discard the features which are only available on some cores.

As the features can be fairly complex, the way to deduce from 2
different features what should be the acceptable minimal feature can be
complex (and sometime impossible).

To reduce the implementation effort in Xen, this serie is importing the
structures and filtering system used by Linux in order to build a
cpuinfo containing the best values compatible with all cores on the
platform.

The serie start by importing the necessary code and structure from Linux
and then use it to sanitize the boot cpuinfo.
It is simplifying p2m code which was searching for the best support
value for PAR and VMID size.

On big.LITTLE platforms the current behaviour is kept and if hmp-unsafe
is provided in Xen command line then  Xen is using all cores. This serie
is tainting Xen with CPU_OUT_OF_SPEC when different MIDR are found.

It is also adding DCZID and CTR registers in cpuinfo in order to check
for incoherent values between cores for those 2 registers. Xen is
tainted if different DCZID registers are found and CTR register is
sanitized when possible. As CTR is not emulated, the sanitized value is
only available inside Xen.

Changes in v4:
- add and use arm64_ftr_set_value
- remove TID2 bit setting and CTR_EL0 emulation in case of different
  i-cache types. We now just sanitize ctr_el0 internally and taint Xen.
Changes in v3:
- restore hmp-unsafe need to use all core when different midr are found
- taint Xen if different MIDR are found
- sanitize system_cpuinfo only if core is not stopped by Xen on boot
Changes in v2:
- Sanitize DCZID register
- Sanitize CTR_EL0 and add emulation of registers catched by TID2
- rename cpu_boot_data to system_cpuinfo


Bertrand Marquis (7):
  xen/arm: Import ID registers definitions from Linux
  xen/arm: Import ID features sanitize from linux
  xen/arm: Rename cpu_boot_data to system_cpuinfo
  xen/arm: Sanitize cpuinfo ID registers fields
  xen/arm: Use sanitize values for p2m
  xen/arm: Taint Xen on incompatible DCZID values
  xen/arm: Sanitize CTR_EL0

 xen/arch/arm/arm64/Makefile            |   1 +
 xen/arch/arm/arm64/cpufeature.c        | 637 +++++++++++++++++++++++++
 xen/arch/arm/cpufeature.c              |  12 +-
 xen/arch/arm/p2m.c                     |  30 +-
 xen/arch/arm/setup.c                   |  36 +-
 xen/arch/arm/smpboot.c                 |  36 +-
 xen/common/kernel.c                    |   6 +-
 xen/include/asm-arm/arm64/cpufeature.h | 104 ++++
 xen/include/asm-arm/arm64/sysregs.h    | 312 ++++++++++++
 xen/include/asm-arm/cpufeature.h       |  32 +-
 xen/include/asm-arm/processor.h        |  18 +-
 xen/include/xen/lib.h                  |   1 +
 12 files changed, 1166 insertions(+), 59 deletions(-)
 create mode 100644 xen/arch/arm/arm64/cpufeature.c
 create mode 100644 xen/include/asm-arm/arm64/cpufeature.h

-- 
2.17.1