Hi,

x86 32-bit inmates are broken with recent gcc versions: they will very
likely produce SSE instructions here and there for some optimisations.

This lets inmates crash, as SSE needs to be discovered and enabled
before it can be used.

The solution is to either use -mno-sse (for the hypervisor and inmates),
or to activate SSE for inmates. Let's go for enabling them, as almost
all CPUs that support VT-x/SVM will very likely support SSE.

Though unlikely, SSE might be unavailable. We don't stop the inmate if
SSE is unavailable, we let it continue.

The actual SSE patch is pretty simple, but I want to avoid duplicate
code for header*.S, and I found some other spots where we can
deduplicate 32/64 bit code.

  Ralf

since v3:
  - The series is getting smaller! Rebase to next, some other patches
    were already integrated
  - Adress Jan's comments

since v2:
  - Address Jan's comments
    - arch_init_features now has a valid stack when being called --
      remove the naked and noreturn attributes
  - Fix the x86 inmate stack issue
  - Fix some other bugs that I found on the way (pm_timer_read, missing
    timing.c on 32 bit x86, erroneous mmio behaviour (already merged))

since v1:
  - don't stop the inmate if SSE is unavailable, let it continue
    execution
  - Also activate AVX, and discover some other CPU features. Report
    availability of features in a x86_cpu_features struct
  - Add a common interface for simple test cases
  - Add a test that runs some SSE/AVX instruction

Ralf Ramsauer (8):
  inmates: x86: use a valid stack for secondary CPUs
  inmates: x86: rename header.S to header-64.S
  inmates: x86: introduce a common assembler entry point
  inmates: Add string.h
  inmates: x86: Add acessors for different system registers
  inmates: x86: discover and activate SSE/AVX
  inmates: introduce test.h and test.c
  inmates: x86: Add SSE/AVX test inmate

 inmates/lib/arm64/include/asm/sysregs.h   |   5 +-
 inmates/lib/include/string.h              |  40 ++++++++
 inmates/lib/include/test.h                |  18 ++++
 inmates/lib/test.c                        |  28 ++++++
 inmates/lib/x86/Makefile                  |  24 +++--
 inmates/lib/x86/cpu-features.c            |  98 +++++++++++++++++++
 inmates/lib/x86/header-32.S               |  25 ++---
 inmates/lib/x86/{header.S => header-64.S} |  25 ++---
 inmates/lib/x86/header-common.S           |  56 +++++++++++
 inmates/lib/x86/include/asm/regs.h        | 113 ++++++++++++++++++++++
 inmates/lib/x86/include/inmate.h          |   1 +
 inmates/lib/x86/inmate.lds                |   5 +-
 inmates/lib/x86/mem.c                     |   3 +-
 inmates/lib/x86/setup.c                   |   2 +
 inmates/lib/x86/smp.c                     |   3 +-
 inmates/tests/x86/Makefile                |   7 +-
 inmates/tests/x86/mmio-access-32.c        |  16 +--
 inmates/tests/x86/mmio-access.c           |  16 +--
 inmates/tests/x86/sse-demo-32.c           |   1 +
 inmates/tests/x86/sse-demo.c              |  89 +++++++++++++++++
 20 files changed, 498 insertions(+), 77 deletions(-)
 create mode 100644 inmates/lib/include/string.h
 create mode 100644 inmates/lib/include/test.h
 create mode 100644 inmates/lib/test.c
 create mode 100644 inmates/lib/x86/cpu-features.c
 rename inmates/lib/x86/{header.S => header-64.S} (94%)
 create mode 100644 inmates/lib/x86/header-common.S
 create mode 120000 inmates/tests/x86/sse-demo-32.c
 create mode 100644 inmates/tests/x86/sse-demo.c

-- 
2.22.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20190613200442.18984-1-ralf.ramsauer%40oth-regensburg.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to