[PATCH v5 00/24] Disable domctl-op via CONFIG_MGMT_HYPERCALLS

Penny Zheng posted 24 patches 1 day, 21 hours ago
tools/fuzz/cpu-policy/Makefile               |   4 +-
tools/fuzz/x86_instruction_emulator/Makefile |  11 +-
tools/libs/guest/Makefile.common             |   4 +-
tools/tests/cpu-policy/Makefile              |   3 +-
tools/tests/x86_emulator/Makefile            |   3 +-
xen/Kconfig.debug                            |   3 +-
xen/arch/arm/Kconfig                         |   2 +-
xen/arch/arm/Makefile                        |   4 +-
xen/arch/arm/arm32/Makefile                  |   2 +-
xen/arch/arm/arm64/Makefile                  |   2 +-
xen/arch/arm/domain.c                        |   3 +
xen/arch/arm/include/asm/tee/tee.h           |   2 +
xen/arch/arm/mmu/p2m.c                       |   8 +
xen/arch/arm/mpu/p2m.c                       |   2 +
xen/arch/arm/tee/ffa.c                       |   4 +
xen/arch/arm/tee/optee.c                     |   4 +
xen/arch/arm/tee/tee.c                       |   2 +
xen/arch/arm/time.c                          |   2 +
xen/arch/ppc/stubs.c                         |   2 +
xen/arch/riscv/stubs.c                       |   8 +-
xen/arch/x86/Kconfig                         |   1 +
xen/arch/x86/Makefile                        |   4 +-
xen/arch/x86/configs/pvshim_defconfig        |   2 +-
xen/arch/x86/domain.c                        |   2 +
xen/arch/x86/domctl.c                        |   2 +-
xen/arch/x86/emul-i8254.c                    |   2 +
xen/arch/x86/hvm/Kconfig                     |   2 +
xen/arch/x86/hvm/hvm.c                       |   7 +-
xen/arch/x86/hvm/pmtimer.c                   |   2 +
xen/arch/x86/include/asm/p2m.h               |   2 +-
xen/arch/x86/include/asm/paging.h            |   3 +-
xen/arch/x86/mm/p2m-pod.c                    |   2 +
xen/arch/x86/mm/p2m.c                        |   2 +
xen/arch/x86/mm/paging.c                     |   4 +
xen/arch/x86/psr.c                           |  18 --
xen/arch/x86/time.c                          |   2 +
xen/common/Kconfig                           |  28 +-
xen/common/Makefile                          |   6 +-
xen/common/device-tree/device-tree.c         |  16 --
xen/common/domain.c                          | 116 ++++----
xen/common/page_alloc.c                      |   8 +-
xen/common/perfc.c                           |   4 +-
xen/common/sched/arinc653.c                  |  11 +-
xen/common/sched/core.c                      |   8 +-
xen/common/sched/cpupool.c                   |  16 +-
xen/common/sched/credit.c                    |  10 +-
xen/common/sched/credit2.c                   |  10 +-
xen/common/sched/private.h                   |  10 +-
xen/common/sched/rt.c                        |   4 +
xen/common/spinlock.c                        |   4 +-
xen/drivers/char/console.c                   |   4 +-
xen/drivers/passthrough/amd/pci_amd_iommu.c  |  20 +-
xen/drivers/passthrough/arm/ipmmu-vmsa.c     |  26 +-
xen/drivers/passthrough/arm/smmu-v3.c        |   6 +
xen/drivers/passthrough/arm/smmu.c           |  55 ++--
xen/drivers/passthrough/device_tree.c        | 136 +++++----
xen/drivers/passthrough/iommu.c              |   2 +
xen/drivers/passthrough/pci.c                |  52 ++--
xen/drivers/passthrough/vtd/iommu.c          |   6 +-
xen/include/hypercall-defs.c                 |  14 +-
xen/include/xen/device_tree.h                |  13 -
xen/include/xen/domain.h                     |   4 -
xen/include/xen/iommu.h                      |   2 +
xen/include/xsm/dummy.h                      |  22 +-
xen/include/xsm/xsm.h                        |  52 ++--
xen/lib/Makefile                             |   5 +
xen/lib/x86/Makefile                         |   4 +-
xen/lib/x86/cpuid-cp2buf.c                   | 123 ++++++++
xen/lib/x86/cpuid-cpfrbuf.c                  | 129 +++++++++
xen/lib/x86/cpuid.c                          | 286 -------------------
xen/lib/x86/cpupolicy-clr.c                  |  73 +++++
xen/xsm/dummy.c                              |  20 +-
xen/xsm/flask/hooks.c                        |  55 ++--
73 files changed, 827 insertions(+), 665 deletions(-)
create mode 100644 xen/lib/x86/cpuid-cp2buf.c
create mode 100644 xen/lib/x86/cpuid-cpfrbuf.c
create mode 100644 xen/lib/x86/cpupolicy-clr.c
[PATCH v5 00/24] Disable domctl-op via CONFIG_MGMT_HYPERCALLS
Posted by Penny Zheng 1 day, 21 hours ago
It can be beneficial for some dom0less systems to further reduce Xen footprint
via disabling some hypercalls handling code, which may not to be used &
required in such systems.
We are introducing a new single Kconfig CONFIG_MGMT_HYPERCALLS to manage
such hypercalls.

We are trying to disable hypercalls in the following aspects:
- sysctl
- domctl
- hvm
- physdev
- platform
This patch serie is only focusing on domctl-op. Different aspects will be
covered in different patch serie.

Features, like VM event, or paging log-dirty support, which fully rely on
domctl-op, will be wrapped with CONFIG_MGMT_HYPERCALLS, to reduce Xen
footprint as much as possible.

It is derived from Stefano Stabellini's commit "xen: introduce kconfig options
to disable hypercalls"(
https://lore.kernel.org/xen-devel/20241219092917.3006174-1-Sergiy_Kibrik@epam.com)
---
This patch serie is based on "[PATCH v3 0/7] consolidate vm event subsystem"
---
The following commits are prerequisite, and could be committed independently:
- xen/xsm: remove redundant flask_iomem_mapping()
- xen/x86: library-fy cpuid-releated functions
- xen/arm: move dt_find_node_by_gpath() to passthrough/device_tree.c
- xen/sysctl: replace CONFIG_SYSCTL with CONFIG_MGMT_HYPERCALLS
---
Penny Zheng (24):
  xen/xsm: remove redundant flask_iomem_mapping()
  xen/x86: library-fy cpuid-releated functions
  xen/arm: move dt_find_node_by_gpath() to passthrough/device_tree.c
  xen/sysctl: replace CONFIG_SYSCTL with CONFIG_MGMT_HYPERCALLS
  xen/domctl: make MGMT_HYPERCALLS transiently def_bool
  xen/vm_event: make VM_EVENT depend on CONFIG_MGMT_HYPERCALLS
  xen/domctl: consolidate domain.c towards MGMT_HYPERCALLS
  xen/mem_sharing: make memory sharing depend on MGMT_HYPERCALLS
  xen/domctl: wrap domain_kill() with CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap vcpu_affinity_domctl() with CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap sched_adjust() with CONFIG_MGMT_HYPERCALLS
  xen/xsm: wrap xsm_irq{,iomem}_permission with CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap arch-specific domain_set_time_offset() with
    CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap xsm_set_target() with CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap pci-subset iommu-related domctl op with
    CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap device-tree-subset iommu-related domctl op with
    CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap iommu-related domctl op with CONFIG_MGMT_HYPERCALLS
  xen/domctl: wrap arch_{get,set}_paging_mempool_size() with
    CONFIG_MGMT_HYPERCALLS
  xen/domctl: make CONFIG_X86_PSR depend on CONFIG_MGMT_HYPERCALLS
  xen/x86: wrap x86-specific domctl-op with CONFIG_MGMT_HYPERCALLS
  xen/arm: wrap arm-specific domctl-op with CONFIG_MGMT_HYPERCALLS
  x86/hvm: domctl_lock synchronization only when MGMT_HYPERCALLS=y
  xen/domctl: wrap common/domctl.c with CONFIG_MGMT_HYPERCALLS
  xen: decouple PV_SHIM_EXCLUSIVE and MGMT_HYPERCALLS

 tools/fuzz/cpu-policy/Makefile               |   4 +-
 tools/fuzz/x86_instruction_emulator/Makefile |  11 +-
 tools/libs/guest/Makefile.common             |   4 +-
 tools/tests/cpu-policy/Makefile              |   3 +-
 tools/tests/x86_emulator/Makefile            |   3 +-
 xen/Kconfig.debug                            |   3 +-
 xen/arch/arm/Kconfig                         |   2 +-
 xen/arch/arm/Makefile                        |   4 +-
 xen/arch/arm/arm32/Makefile                  |   2 +-
 xen/arch/arm/arm64/Makefile                  |   2 +-
 xen/arch/arm/domain.c                        |   3 +
 xen/arch/arm/include/asm/tee/tee.h           |   2 +
 xen/arch/arm/mmu/p2m.c                       |   8 +
 xen/arch/arm/mpu/p2m.c                       |   2 +
 xen/arch/arm/tee/ffa.c                       |   4 +
 xen/arch/arm/tee/optee.c                     |   4 +
 xen/arch/arm/tee/tee.c                       |   2 +
 xen/arch/arm/time.c                          |   2 +
 xen/arch/ppc/stubs.c                         |   2 +
 xen/arch/riscv/stubs.c                       |   8 +-
 xen/arch/x86/Kconfig                         |   1 +
 xen/arch/x86/Makefile                        |   4 +-
 xen/arch/x86/configs/pvshim_defconfig        |   2 +-
 xen/arch/x86/domain.c                        |   2 +
 xen/arch/x86/domctl.c                        |   2 +-
 xen/arch/x86/emul-i8254.c                    |   2 +
 xen/arch/x86/hvm/Kconfig                     |   2 +
 xen/arch/x86/hvm/hvm.c                       |   7 +-
 xen/arch/x86/hvm/pmtimer.c                   |   2 +
 xen/arch/x86/include/asm/p2m.h               |   2 +-
 xen/arch/x86/include/asm/paging.h            |   3 +-
 xen/arch/x86/mm/p2m-pod.c                    |   2 +
 xen/arch/x86/mm/p2m.c                        |   2 +
 xen/arch/x86/mm/paging.c                     |   4 +
 xen/arch/x86/psr.c                           |  18 --
 xen/arch/x86/time.c                          |   2 +
 xen/common/Kconfig                           |  28 +-
 xen/common/Makefile                          |   6 +-
 xen/common/device-tree/device-tree.c         |  16 --
 xen/common/domain.c                          | 116 ++++----
 xen/common/page_alloc.c                      |   8 +-
 xen/common/perfc.c                           |   4 +-
 xen/common/sched/arinc653.c                  |  11 +-
 xen/common/sched/core.c                      |   8 +-
 xen/common/sched/cpupool.c                   |  16 +-
 xen/common/sched/credit.c                    |  10 +-
 xen/common/sched/credit2.c                   |  10 +-
 xen/common/sched/private.h                   |  10 +-
 xen/common/sched/rt.c                        |   4 +
 xen/common/spinlock.c                        |   4 +-
 xen/drivers/char/console.c                   |   4 +-
 xen/drivers/passthrough/amd/pci_amd_iommu.c  |  20 +-
 xen/drivers/passthrough/arm/ipmmu-vmsa.c     |  26 +-
 xen/drivers/passthrough/arm/smmu-v3.c        |   6 +
 xen/drivers/passthrough/arm/smmu.c           |  55 ++--
 xen/drivers/passthrough/device_tree.c        | 136 +++++----
 xen/drivers/passthrough/iommu.c              |   2 +
 xen/drivers/passthrough/pci.c                |  52 ++--
 xen/drivers/passthrough/vtd/iommu.c          |   6 +-
 xen/include/hypercall-defs.c                 |  14 +-
 xen/include/xen/device_tree.h                |  13 -
 xen/include/xen/domain.h                     |   4 -
 xen/include/xen/iommu.h                      |   2 +
 xen/include/xsm/dummy.h                      |  22 +-
 xen/include/xsm/xsm.h                        |  52 ++--
 xen/lib/Makefile                             |   5 +
 xen/lib/x86/Makefile                         |   4 +-
 xen/lib/x86/cpuid-cp2buf.c                   | 123 ++++++++
 xen/lib/x86/cpuid-cpfrbuf.c                  | 129 +++++++++
 xen/lib/x86/cpuid.c                          | 286 -------------------
 xen/lib/x86/cpupolicy-clr.c                  |  73 +++++
 xen/xsm/dummy.c                              |  20 +-
 xen/xsm/flask/hooks.c                        |  55 ++--
 73 files changed, 827 insertions(+), 665 deletions(-)
 create mode 100644 xen/lib/x86/cpuid-cp2buf.c
 create mode 100644 xen/lib/x86/cpuid-cpfrbuf.c
 create mode 100644 xen/lib/x86/cpupolicy-clr.c

-- 
2.34.1