[PATCH v2 00/15] x86: Merge cpuid and msr policy objects

Andrew Cooper posted 15 patches 1 year ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230404095222.1373721-1-andrew.cooper3@citrix.com
tools/fuzz/cpu-policy/afl-policy-fuzzer.c     |  64 +-
.../fuzz/x86_instruction_emulator/fuzz-emul.c |   2 +-
tools/libs/guest/xg_cpuid_x86.c               |  50 +-
tools/libs/guest/xg_private.h                 |   5 +-
tools/tests/cpu-policy/test-cpu-policy.c      |  54 +-
tools/tests/tsx/test-tsx.c                    |  71 +-
tools/tests/x86_emulator/Makefile             |   2 +-
tools/tests/x86_emulator/test_x86_emulator.c  |   2 +-
tools/tests/x86_emulator/x86-emulate.c        |   4 +-
tools/tests/x86_emulator/x86-emulate.h        |   2 +-
xen/arch/x86/Makefile                         |   1 +
xen/arch/x86/{cpuid.c => cpu-policy.c}        | 692 ++++----------
xen/arch/x86/cpu/common.c                     |   4 +-
xen/arch/x86/cpu/mcheck/mce_intel.c           |   2 +-
xen/arch/x86/cpuid.c                          | 856 +-----------------
xen/arch/x86/domain.c                         |  17 +-
xen/arch/x86/domctl.c                         |  51 +-
xen/arch/x86/hvm/emulate.c                    |   4 +-
xen/arch/x86/hvm/hvm.c                        |   5 +-
xen/arch/x86/hvm/svm/svm.c                    |   2 +-
xen/arch/x86/hvm/vlapic.c                     |   2 +-
xen/arch/x86/hvm/vmx/vmx.c                    |   8 +-
xen/arch/x86/include/asm/cpu-policy.h         |  27 +
xen/arch/x86/include/asm/cpuid.h              |  21 +-
xen/arch/x86/include/asm/domain.h             |  13 +-
xen/arch/x86/include/asm/msr.h                |  14 +-
xen/arch/x86/mm/mem_sharing.c                 |   3 +-
xen/arch/x86/mm/shadow/hvm.c                  |   2 +-
xen/arch/x86/msr.c                            | 160 +---
xen/arch/x86/pv/domain.c                      |   3 +-
xen/arch/x86/pv/emul-priv-op.c                |   6 +-
xen/arch/x86/pv/ro-page-fault.c               |   2 +-
xen/arch/x86/setup.c                          |   5 +-
xen/arch/x86/sysctl.c                         |  79 +-
xen/arch/x86/traps.c                          |   2 +-
xen/arch/x86/x86_emulate/private.h            |   4 +-
xen/arch/x86/x86_emulate/x86_emulate.c        |   2 +-
xen/arch/x86/x86_emulate/x86_emulate.h        |   9 +-
xen/arch/x86/xstate.c                         |   4 +-
xen/include/public/domctl.h                   |   4 +-
xen/include/public/sysctl.h                   |   4 +-
xen/include/xen/lib/x86/cpu-policy.h          | 510 ++++++++++-
xen/include/xen/lib/x86/cpuid.h               | 475 ----------
xen/include/xen/lib/x86/msr.h                 | 104 ---
xen/lib/x86/cpuid.c                           |  68 +-
xen/lib/x86/msr.c                             |   6 +-
xen/lib/x86/policy.c                          |   8 +-
47 files changed, 1005 insertions(+), 2430 deletions(-)
copy xen/arch/x86/{cpuid.c => cpu-policy.c} (52%)
create mode 100644 xen/arch/x86/include/asm/cpu-policy.h
delete mode 100644 xen/include/xen/lib/x86/cpuid.h
delete mode 100644 xen/include/xen/lib/x86/msr.h
[PATCH v2 00/15] x86: Merge cpuid and msr policy objects
Posted by Andrew Cooper 1 year ago
This is in order to be able to put MSR_ARCH_CAPS in a featureset.  In
hindsight it was a mistake separating CPUID and read-only MSR data into
separate structs.

Patches 1-8 were posted previously and have had the feedback addressed.
Patches 9-15 are the result of splitting the older RFC patch 9 apart, with the
discussed adjustment to aliases accounted for.

Gitlab run showing the series to be buildable at each changeset:

  https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/4053607867

P.S. I'm not sure I believe the net diffstat below.  I think the cpuid.c =>
cpu-policy.c rename is confusing it.

Andrew Cooper (15):
  x86: Rename struct cpu_policy to struct old_cpuid_policy
  x86: Rename {domctl,sysctl}.cpu_policy.{cpuid,msr}_policy fields
  x86: Rename struct cpuid_policy to struct cpu_policy
  x86: Merge struct msr_policy into struct cpu_policy
  x86: Merge the system {cpuid,msr} policy objects
  x86: Merge a domain's {cpuid,msr} policy objects
  x86: Merge xc_cpu_policy's cpuid and msr objects
  x86: Drop struct old_cpu_policy
  x86: Out-of-inline the policy<->featureset convertors
  x86/boot: Move MSR policy initialisation logic into cpu-policy.c
  x86/boot: Merge CPUID policy initialisation logic into cpu-policy.c
  x86/emul: Switch x86_emulate_ctxt to cpu_policy
  tools/fuzz: Rework afl-policy-fuzzer
  libx86: Update library API for cpu_policy
  x86: Remove temporary {cpuid,msr}_policy defines

 tools/fuzz/cpu-policy/afl-policy-fuzzer.c     |  64 +-
 .../fuzz/x86_instruction_emulator/fuzz-emul.c |   2 +-
 tools/libs/guest/xg_cpuid_x86.c               |  50 +-
 tools/libs/guest/xg_private.h                 |   5 +-
 tools/tests/cpu-policy/test-cpu-policy.c      |  54 +-
 tools/tests/tsx/test-tsx.c                    |  71 +-
 tools/tests/x86_emulator/Makefile             |   2 +-
 tools/tests/x86_emulator/test_x86_emulator.c  |   2 +-
 tools/tests/x86_emulator/x86-emulate.c        |   4 +-
 tools/tests/x86_emulator/x86-emulate.h        |   2 +-
 xen/arch/x86/Makefile                         |   1 +
 xen/arch/x86/{cpuid.c => cpu-policy.c}        | 692 ++++----------
 xen/arch/x86/cpu/common.c                     |   4 +-
 xen/arch/x86/cpu/mcheck/mce_intel.c           |   2 +-
 xen/arch/x86/cpuid.c                          | 856 +-----------------
 xen/arch/x86/domain.c                         |  17 +-
 xen/arch/x86/domctl.c                         |  51 +-
 xen/arch/x86/hvm/emulate.c                    |   4 +-
 xen/arch/x86/hvm/hvm.c                        |   5 +-
 xen/arch/x86/hvm/svm/svm.c                    |   2 +-
 xen/arch/x86/hvm/vlapic.c                     |   2 +-
 xen/arch/x86/hvm/vmx/vmx.c                    |   8 +-
 xen/arch/x86/include/asm/cpu-policy.h         |  27 +
 xen/arch/x86/include/asm/cpuid.h              |  21 +-
 xen/arch/x86/include/asm/domain.h             |  13 +-
 xen/arch/x86/include/asm/msr.h                |  14 +-
 xen/arch/x86/mm/mem_sharing.c                 |   3 +-
 xen/arch/x86/mm/shadow/hvm.c                  |   2 +-
 xen/arch/x86/msr.c                            | 160 +---
 xen/arch/x86/pv/domain.c                      |   3 +-
 xen/arch/x86/pv/emul-priv-op.c                |   6 +-
 xen/arch/x86/pv/ro-page-fault.c               |   2 +-
 xen/arch/x86/setup.c                          |   5 +-
 xen/arch/x86/sysctl.c                         |  79 +-
 xen/arch/x86/traps.c                          |   2 +-
 xen/arch/x86/x86_emulate/private.h            |   4 +-
 xen/arch/x86/x86_emulate/x86_emulate.c        |   2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h        |   9 +-
 xen/arch/x86/xstate.c                         |   4 +-
 xen/include/public/domctl.h                   |   4 +-
 xen/include/public/sysctl.h                   |   4 +-
 xen/include/xen/lib/x86/cpu-policy.h          | 510 ++++++++++-
 xen/include/xen/lib/x86/cpuid.h               | 475 ----------
 xen/include/xen/lib/x86/msr.h                 | 104 ---
 xen/lib/x86/cpuid.c                           |  68 +-
 xen/lib/x86/msr.c                             |   6 +-
 xen/lib/x86/policy.c                          |   8 +-
 47 files changed, 1005 insertions(+), 2430 deletions(-)
 copy xen/arch/x86/{cpuid.c => cpu-policy.c} (52%)
 create mode 100644 xen/arch/x86/include/asm/cpu-policy.h
 delete mode 100644 xen/include/xen/lib/x86/cpuid.h
 delete mode 100644 xen/include/xen/lib/x86/msr.h

-- 
2.30.2