Skip to contentSkip to conversation

arm: Drop support for 32-bit kvmtool

RFC In review Oliver Upton 4 participants 20 messages Mar 14, 2025 – Mar 25, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm: Drop support for 32-bit kvmtool

The last stable kernel to support 32-bit KVM/arm is 5.4, which is on track for EOL at the end of this year. Considering this, and the fact that 32-bit KVM never saw much usage in the first place, it is probably time to toss out the coprolite.

Of course, this has no effect on the support for 32-bit guests on 64-bit KVM.

Oliver Upton (9):
Drop support for 32-bit arm
arm64: Move arm64-only features into main directory
arm64: Combine kvm.c
arm64: Merge kvm-cpu.c
arm64: Combine kvm-config-arch.h
arm64: Move remaining kvm/* headers
arm64: Move asm headers
arm64: Rename top-level directory
arm64: Get rid of the 'arm-common' include directory

 INSTALL                                       |   9 +-
 Makefile                                      |  40 +--
 arm/aarch32/arm-cpu.c                         |  50 ---
 arm/aarch32/include/asm/kernel.h              |   8 -
 arm/aarch32/include/asm/kvm.h                 | 311 ------------------
 arm/aarch32/include/kvm/barrier.h             |  10 -
 arm/aarch32/include/kvm/fdt-arch.h            |   6 -
 arm/aarch32/include/kvm/kvm-arch.h            |  18 -
 arm/aarch32/include/kvm/kvm-config-arch.h     |   8 -
 arm/aarch32/include/kvm/kvm-cpu-arch.h        |  24 --
 arm/aarch32/kvm-cpu.c                         | 132 --------
 arm/aarch32/kvm.c                             |  14 -
 arm/aarch64/include/kvm/fdt-arch.h            |   6 -
 arm/aarch64/include/kvm/kvm-arch.h            |  22 --
 arm/aarch64/include/kvm/kvm-config-arch.h     |  29 --
 arm/aarch64/include/kvm/kvm-cpu-arch.h        |  19 --
 arm/aarch64/kvm.c                             | 212 ------------
 arm/kvm-cpu.c                                 | 153 ---------
 {arm/aarch64 => arm64}/arm-cpu.c              |   4 +-
 {arm => arm64}/fdt.c                          |   4 +-
 {arm => arm64}/gic.c                          |   2 +-
 {arm => arm64}/gicv2m.c                       |   2 +-
 {arm/aarch64 => arm64}/include/asm/image.h    |   0
 {arm/aarch64 => arm64}/include/asm/kernel.h   |   0
 {arm/aarch64 => arm64}/include/asm/kvm.h      |   0
 {arm/aarch64 => arm64}/include/asm/pmu.h      |   0
 .../include/asm/sve_context.h                 |   0
 .../arm-common => arm64/include}/gic.h        |   0
 {arm/aarch64 => arm64}/include/kvm/barrier.h  |   0
 .../include/kvm}/fdt-arch.h                   |   0
 .../include/kvm}/kvm-arch.h                   |   6 +-
 .../include/kvm}/kvm-config-arch.h            |  24 +-
 .../include/kvm}/kvm-cpu-arch.h               |  10 +-
 .../arm-common => arm64/include}/pci.h        |   0
 .../arm-common => arm64/include}/timer.h      |   0
 {arm => arm64}/ioport.c                       |   0
 {arm/aarch64 => arm64}/kvm-cpu.c              | 289 ++++++++++++----
 {arm => arm64}/kvm.c                          | 212 +++++++++++-
 {arm => arm64}/pci.c                          |   4 +-
 {arm/aarch64 => arm64}/pmu.c                  |   2 +-
 {arm/aarch64 => arm64}/pvtime.c               |   0
 {arm => arm64}/timer.c                        |   4 +-
 42 files changed, 495 insertions(+), 1139 deletions(-)
 delete mode 100644 arm/aarch32/arm-cpu.c
 delete mode 100644 arm/aarch32/include/asm/kernel.h
 delete mode 100644 arm/aarch32/include/asm/kvm.h
 delete mode 100644 arm/aarch32/include/kvm/barrier.h
 delete mode 100644 arm/aarch32/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch32/kvm-cpu.c
 delete mode 100644 arm/aarch32/kvm.c
 delete mode 100644 arm/aarch64/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch64/kvm.c
 delete mode 100644 arm/kvm-cpu.c
 rename {arm/aarch64 => arm64}/arm-cpu.c (96%)
 rename {arm => arm64}/fdt.c (99%)
 rename {arm => arm64}/gic.c (99%)
 rename {arm => arm64}/gicv2m.c (99%)
 rename {arm/aarch64 => arm64}/include/asm/image.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/kernel.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/kvm.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/pmu.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/sve_context.h (100%)
 rename {arm/include/arm-common => arm64/include}/gic.h (100%)
 rename {arm/aarch64 => arm64}/include/kvm/barrier.h (100%)
 rename {arm/include/arm-common => arm64/include/kvm}/fdt-arch.h (100%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-arch.h (97%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-config-arch.h (54%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-cpu-arch.h (82%)
 rename {arm/include/arm-common => arm64/include}/pci.h (100%)
 rename {arm/include/arm-common => arm64/include}/timer.h (100%)
 rename {arm => arm64}/ioport.c (100%)
 rename {arm/aarch64 => arm64}/kvm-cpu.c (70%)
 rename {arm => arm64}/kvm.c (59%)
 rename {arm => arm64}/pci.c (98%)
 rename {arm/aarch64 => arm64}/pmu.c (99%)
 rename {arm/aarch64 => arm64}/pvtime.c (100%)
 rename {arm => arm64}/timer.c (95%)

base-commit: e48563f5c4a48fe6a6bc2a98a9a7c84a10f043be

Signature · 1 line
2.39.5
#1 lore raw

RFC 1/9 Drop support for 32-bit arm

Linux dropped support for KVM in 32-bit arm kernels almost 5 years ago in the 5.7 kernel release. In addition to that KVM/arm64 never had 32-bit compat support, so it is a safe assumption that usage of 32-bit kvmtool is pretty much dead at this point.

Do not despair -- 32-bit guests are still supported with a 64-bit userspace.

---
 INSTALL                                   |   9 +-
 Makefile                                  |  31 +--
 arm/aarch32/arm-cpu.c                     |  50 ----
 arm/aarch32/include/asm/kernel.h          |   8 -
 arm/aarch32/include/asm/kvm.h             | 311 ----------------------
 arm/aarch32/include/kvm/barrier.h         |  10 -
 arm/aarch32/include/kvm/fdt-arch.h        |   6 -
 arm/aarch32/include/kvm/kvm-arch.h        |  18 --
 arm/aarch32/include/kvm/kvm-config-arch.h |   8 -
 arm/aarch32/include/kvm/kvm-cpu-arch.h    |  24 --
 arm/aarch32/kvm-cpu.c                     | 132 ---------
 arm/aarch32/kvm.c                         |  14 -
 12 files changed, 14 insertions(+), 607 deletions(-)
 delete mode 100644 arm/aarch32/arm-cpu.c
 delete mode 100644 arm/aarch32/include/asm/kernel.h
 delete mode 100644 arm/aarch32/include/asm/kvm.h
 delete mode 100644 arm/aarch32/include/kvm/barrier.h
 delete mode 100644 arm/aarch32/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch32/kvm-cpu.c
 delete mode 100644 arm/aarch32/kvm.c
INSTALL +4 -5
index 2a65735..0e1e63e 100644
@@ -26,7 +26,7 @@ For Fedora based systems:
 For OpenSUSE based systems:
 	# zypper install glibc-devel-static
 
-Architectures which require device tree (PowerPC, ARM, ARM64, RISC-V) also
+Architectures which require device tree (PowerPC, ARM64, RISC-V) also
 require libfdt.
 	deb: $ sudo apt-get install libfdt-dev
 	Fedora: # yum install libfdt-devel
@@ -61,16 +61,15 @@ to the Linux name of the architecture. Architectures supported:
 - i386
 - x86_64
 - powerpc
-- arm
 - arm64
 - mips
 - riscv
 If ARCH is not provided, the target architecture will be automatically
 determined by running "uname -m" on your host, resulting in a native build.
 
-To cross-compile to ARM for instance, install a cross-compiler, put the
+To cross-compile to arm64 for instance, install a cross-compiler, put the
 required libraries in the cross-compiler's SYSROOT and type:
-$ make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
+$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64
 
 Missing libraries when cross-compiling
 ---------------------------------------
@@ -82,7 +81,7 @@ On multiarch system you should be able to install those be appending
 the architecture name after the package (example for ARM64):
 $ sudo apt-get install libfdt-dev:arm64
 
-PowerPC, ARM/ARM64 and RISC-V require libfdt to be installed. If you cannot use
+PowerPC, ARM64 and RISC-V require libfdt to be installed. If you cannot use
 precompiled mulitarch packages, you could either copy the required header and
 library files from an installed target system into the SYSROOT (you will need
 /usr/include/*fdt*.h and /usr/lib64/libfdt-v.v.v.so and its symlinks), or you
Makefile +10 -21
index d84dc8e..462659b 100644
@@ -166,35 +166,24 @@ ifeq ($(ARCH), powerpc)
 	ARCH_WANT_LIBFDT := y
 endif
 
-# ARM
-OBJS_ARM_COMMON		:= arm/fdt.o arm/gic.o arm/gicv2m.o arm/ioport.o \
-			   arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o \
-			   hw/serial.o
-HDRS_ARM_COMMON		:= arm/include
-ifeq ($(ARCH), arm)
-	DEFINES		+= -DCONFIG_ARM
-	OBJS		+= $(OBJS_ARM_COMMON)
-	OBJS		+= arm/aarch32/arm-cpu.o
-	OBJS		+= arm/aarch32/kvm-cpu.o
-	OBJS		+= arm/aarch32/kvm.o
-	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
-	ARCH_INCLUDE	+= -Iarm/aarch32/include
-	CFLAGS		+= -march=armv7-a
-
-	ARCH_WANT_LIBFDT := y
-	ARCH_HAS_FLASH_MEM := y
-endif
-
 # ARM64
 ifeq ($(ARCH), arm64)
 	DEFINES		+= -DCONFIG_ARM64
-	OBJS		+= $(OBJS_ARM_COMMON)
+	OBJS		+= arm/fdt.o
+	OBJS		+= arm/gic.o
+	OBJS		+= arm/gicv2m.o
+	OBJS		+= arm/ioport.o
+	OBJS		+= arm/kvm.o
+	OBJS		+= arm/kvm-cpu.o
+	OBJS		+= arm/pci.o
+	OBJS		+= arm/timer.o
+	OBJS		+= hw/serial.o
 	OBJS		+= arm/aarch64/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
 	OBJS		+= arm/aarch64/kvm.o
 	OBJS		+= arm/aarch64/pvtime.o
 	OBJS		+= arm/aarch64/pmu.o
-	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
+	ARCH_INCLUDE	:= arm/include
 	ARCH_INCLUDE	+= -Iarm/aarch64/include
 
 	ARCH_WANT_LIBFDT := y
arm/aarch32/arm-cpu.c deleted +0 -0
deleted file mode 100644
index 16bba55..0000000
arm/aarch32/include/asm/kernel.h deleted +0 -0
deleted file mode 100644
index 6129609..0000000
arm/aarch32/include/asm/kvm.h deleted +0 -0
deleted file mode 100644
index a4217c1..0000000
arm/aarch32/include/kvm/barrier.h deleted +0 -0
deleted file mode 100644
index 94913a9..0000000
arm/aarch32/include/kvm/fdt-arch.h deleted +0 -0
deleted file mode 100644
index e448bf1..0000000
arm/aarch32/include/kvm/kvm-arch.h deleted +0 -0
deleted file mode 100644
index 0333cf4..0000000
arm/aarch32/include/kvm/kvm-config-arch.h deleted +0 -0
deleted file mode 100644
index acf0d23..0000000
arm/aarch32/include/kvm/kvm-cpu-arch.h deleted +0 -0
deleted file mode 100644
index fd0b387..0000000
arm/aarch32/kvm-cpu.c deleted +0 -0
deleted file mode 100644
index 95fb1da..0000000
arm/aarch32/kvm.c deleted +0 -0
deleted file mode 100644
index 768a56b..0000000
Signature · 1 line
2.39.5
#2 lore raw

Re: [RFC kvmtool 1/9] Drop support for 32-bit arm

Hi Oliver,

I tried to apply the patch on top of e48563f5c4a48fe6a6bc2a98a9a7c84a10f043be, which is the base commit from the cover letter, and I got these errors:

Applying: Drop support for 32-bit arm
error: removal patch leaves file contents
error: arm/aarch32/arm-cpu.c: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/asm/kernel.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/asm/kvm.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/barrier.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/fdt-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/kvm-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/kvm-config-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/kvm-cpu-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/kvm-cpu.c: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/kvm.c: patch does not apply

When I delete the files manually, the resulting commit has diffs like this for the deleted files:

arm/aarch32/arm-cpu.c deleted +0 -6
deleted file mode 100644
index 16bba5524caf..000000000000
@@ -1,50 +0,0 @@
-#include "kvm/kvm.h"
-#include "kvm/kvm-cpu.h"
-#include "kvm/util.h"
-
-#include "arm-common/gic.h"
-#include "arm-common/timer.h"

[..]

.. and so on.

Am I missing a knob for applying the patch? FYI, this happens for all the patches in this series with files deleted.

One more comment below.

Quoted 80 lines · Oliver Upton

Linux dropped support for KVM in 32-bit arm kernels almost 5 years ago in the 5.7 kernel release. In addition to that KVM/arm64 never had 32-bit compat support, so it is a safe assumption that usage of 32-bit kvmtool is pretty much dead at this point.

Do not despair -- 32-bit guests are still supported with a 64-bit userspace.

---
 INSTALL                                   |   9 +-
 Makefile                                  |  31 +--
 arm/aarch32/arm-cpu.c                     |  50 ----
 arm/aarch32/include/asm/kernel.h          |   8 -
 arm/aarch32/include/asm/kvm.h             | 311 ----------------------
 arm/aarch32/include/kvm/barrier.h         |  10 -
 arm/aarch32/include/kvm/fdt-arch.h        |   6 -
 arm/aarch32/include/kvm/kvm-arch.h        |  18 --
 arm/aarch32/include/kvm/kvm-config-arch.h |   8 -
 arm/aarch32/include/kvm/kvm-cpu-arch.h    |  24 --
 arm/aarch32/kvm-cpu.c                     | 132 ---------
 arm/aarch32/kvm.c                         |  14 -
 12 files changed, 14 insertions(+), 607 deletions(-)
 delete mode 100644 arm/aarch32/arm-cpu.c
 delete mode 100644 arm/aarch32/include/asm/kernel.h
 delete mode 100644 arm/aarch32/include/asm/kvm.h
 delete mode 100644 arm/aarch32/include/kvm/barrier.h
 delete mode 100644 arm/aarch32/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch32/kvm-cpu.c
 delete mode 100644 arm/aarch32/kvm.c
INSTALL +4 -5
index 2a65735..0e1e63e 100644
@@ -26,7 +26,7 @@ For Fedora based systems:
 For OpenSUSE based systems:
 	# zypper install glibc-devel-static
 
-Architectures which require device tree (PowerPC, ARM, ARM64, RISC-V) also
+Architectures which require device tree (PowerPC, ARM64, RISC-V) also
 require libfdt.
 	deb: $ sudo apt-get install libfdt-dev
 	Fedora: # yum install libfdt-devel
@@ -61,16 +61,15 @@ to the Linux name of the architecture. Architectures supported:
 - i386
 - x86_64
 - powerpc
-- arm
 - arm64
 - mips
 - riscv
 If ARCH is not provided, the target architecture will be automatically
 determined by running "uname -m" on your host, resulting in a native build.
 
-To cross-compile to ARM for instance, install a cross-compiler, put the
+To cross-compile to arm64 for instance, install a cross-compiler, put the
 required libraries in the cross-compiler's SYSROOT and type:
-$ make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
+$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64
 
 Missing libraries when cross-compiling
 ---------------------------------------
@@ -82,7 +81,7 @@ On multiarch system you should be able to install those be appending
 the architecture name after the package (example for ARM64):
 $ sudo apt-get install libfdt-dev:arm64
 
-PowerPC, ARM/ARM64 and RISC-V require libfdt to be installed. If you cannot use
+PowerPC, ARM64 and RISC-V require libfdt to be installed. If you cannot use
 precompiled mulitarch packages, you could either copy the required header and
 library files from an installed target system into the SYSROOT (you will need
 /usr/include/*fdt*.h and /usr/lib64/libfdt-v.v.v.so and its symlinks), or you
Makefile +0 -0
index d84dc8e..462659b 100644

Makefile ifeq ($(ARCH), powerpc) · line 175

Quoted 10 lines
Makefile +0 -7
@@ -166,35 +166,24 @@ ifeq ($(ARCH), powerpc)
 	ARCH_WANT_LIBFDT := y
 endif
 
-# ARM
-OBJS_ARM_COMMON		:= arm/fdt.o arm/gic.o arm/gicv2m.o arm/ioport.o \
-			   arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o \
-			   hw/serial.o
-HDRS_ARM_COMMON		:= arm/include
-ifeq ($(ARCH), arm)
-	DEFINES		+= -DCONFIG_ARM

Found a couple of instances of CONFIG_ARM using grep.

There also one instance of the architecture name ARM in a comment in hw/cfi_flash.c, I think that was a typo and it was meant to say ARM64.

Other than that, looks good.

Thanks,
Alex

Quoted 69 lines
Makefile +10 -14
-	OBJS		+= $(OBJS_ARM_COMMON)
-	OBJS		+= arm/aarch32/arm-cpu.o
-	OBJS		+= arm/aarch32/kvm-cpu.o
-	OBJS		+= arm/aarch32/kvm.o
-	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
-	ARCH_INCLUDE	+= -Iarm/aarch32/include
-	CFLAGS		+= -march=armv7-a
-
-	ARCH_WANT_LIBFDT := y
-	ARCH_HAS_FLASH_MEM := y
-endif
-
 # ARM64
 ifeq ($(ARCH), arm64)
 	DEFINES		+= -DCONFIG_ARM64
-	OBJS		+= $(OBJS_ARM_COMMON)
+	OBJS		+= arm/fdt.o
+	OBJS		+= arm/gic.o
+	OBJS		+= arm/gicv2m.o
+	OBJS		+= arm/ioport.o
+	OBJS		+= arm/kvm.o
+	OBJS		+= arm/kvm-cpu.o
+	OBJS		+= arm/pci.o
+	OBJS		+= arm/timer.o
+	OBJS		+= hw/serial.o
 	OBJS		+= arm/aarch64/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
 	OBJS		+= arm/aarch64/kvm.o
 	OBJS		+= arm/aarch64/pvtime.o
 	OBJS		+= arm/aarch64/pmu.o
-	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
+	ARCH_INCLUDE	:= arm/include
 	ARCH_INCLUDE	+= -Iarm/aarch64/include
 
 	ARCH_WANT_LIBFDT := y
arm/aarch32/arm-cpu.c deleted +0 -0
deleted file mode 100644
index 16bba55..0000000
arm/aarch32/include/asm/kernel.h deleted +0 -0
deleted file mode 100644
index 6129609..0000000
arm/aarch32/include/asm/kvm.h deleted +0 -0
deleted file mode 100644
index a4217c1..0000000
arm/aarch32/include/kvm/barrier.h deleted +0 -0
deleted file mode 100644
index 94913a9..0000000
arm/aarch32/include/kvm/fdt-arch.h deleted +0 -0
deleted file mode 100644
index e448bf1..0000000
arm/aarch32/include/kvm/kvm-arch.h deleted +0 -0
deleted file mode 100644
index 0333cf4..0000000
arm/aarch32/include/kvm/kvm-config-arch.h deleted +0 -0
deleted file mode 100644
index acf0d23..0000000
arm/aarch32/include/kvm/kvm-cpu-arch.h deleted +0 -0
deleted file mode 100644
index fd0b387..0000000
arm/aarch32/kvm-cpu.c deleted +0 -0
deleted file mode 100644
index 95fb1da..0000000
arm/aarch32/kvm.c deleted +0 -0
deleted file mode 100644
index 768a56b..0000000
Signature · 1 line
2.39.5
#3 lore raw

Re: [RFC kvmtool 1/9] Drop support for 32-bit arm

Quoted 44 lines · Alexandru Elisei

Hi Oliver,

I tried to apply the patch on top of e48563f5c4a48fe6a6bc2a98a9a7c84a10f043be, which is the base commit from the cover letter, and I got these errors:

Applying: Drop support for 32-bit arm
error: removal patch leaves file contents
error: arm/aarch32/arm-cpu.c: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/asm/kernel.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/asm/kvm.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/barrier.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/fdt-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/kvm-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/kvm-config-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/include/kvm/kvm-cpu-arch.h: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/kvm-cpu.c: patch does not apply
error: removal patch leaves file contents
error: arm/aarch32/kvm.c: patch does not apply

When I delete the files manually, the resulting commit has diffs like this for the deleted files:

arm/aarch32/arm-cpu.c deleted +0 -6
deleted file mode 100644
index 16bba5524caf..000000000000
@@ -1,50 +0,0 @@
-#include "kvm/kvm.h"
-#include "kvm/kvm-cpu.h"
-#include "kvm/util.h"
-
-#include "arm-common/gic.h"
-#include "arm-common/timer.h"
[..]
Quoted 4 lines

.. and so on.

Am I missing a knob for applying the patch? FYI, this happens for all the patches in this series with files deleted.

That's on me, I did 'git format-patch -D' to keep the diffs smaller for an RFC. I'll post patches that actually apply for v1.

Quoted 96 lines

One more comment below.

Quoted 80 lines · Oliver Upton

Linux dropped support for KVM in 32-bit arm kernels almost 5 years ago in the 5.7 kernel release. In addition to that KVM/arm64 never had 32-bit compat support, so it is a safe assumption that usage of 32-bit kvmtool is pretty much dead at this point.

Do not despair -- 32-bit guests are still supported with a 64-bit userspace.

---
 INSTALL                                   |   9 +-
 Makefile                                  |  31 +--
 arm/aarch32/arm-cpu.c                     |  50 ----
 arm/aarch32/include/asm/kernel.h          |   8 -
 arm/aarch32/include/asm/kvm.h             | 311 ----------------------
 arm/aarch32/include/kvm/barrier.h         |  10 -
 arm/aarch32/include/kvm/fdt-arch.h        |   6 -
 arm/aarch32/include/kvm/kvm-arch.h        |  18 --
 arm/aarch32/include/kvm/kvm-config-arch.h |   8 -
 arm/aarch32/include/kvm/kvm-cpu-arch.h    |  24 --
 arm/aarch32/kvm-cpu.c                     | 132 ---------
 arm/aarch32/kvm.c                         |  14 -
 12 files changed, 14 insertions(+), 607 deletions(-)
 delete mode 100644 arm/aarch32/arm-cpu.c
 delete mode 100644 arm/aarch32/include/asm/kernel.h
 delete mode 100644 arm/aarch32/include/asm/kvm.h
 delete mode 100644 arm/aarch32/include/kvm/barrier.h
 delete mode 100644 arm/aarch32/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch32/kvm-cpu.c
 delete mode 100644 arm/aarch32/kvm.c
INSTALL +4 -5
index 2a65735..0e1e63e 100644
@@ -26,7 +26,7 @@ For Fedora based systems:
 For OpenSUSE based systems:
 	# zypper install glibc-devel-static
 
-Architectures which require device tree (PowerPC, ARM, ARM64, RISC-V) also
+Architectures which require device tree (PowerPC, ARM64, RISC-V) also
 require libfdt.
 	deb: $ sudo apt-get install libfdt-dev
 	Fedora: # yum install libfdt-devel
@@ -61,16 +61,15 @@ to the Linux name of the architecture. Architectures supported:
 - i386
 - x86_64
 - powerpc
-- arm
 - arm64
 - mips
 - riscv
 If ARCH is not provided, the target architecture will be automatically
 determined by running "uname -m" on your host, resulting in a native build.
 
-To cross-compile to ARM for instance, install a cross-compiler, put the
+To cross-compile to arm64 for instance, install a cross-compiler, put the
 required libraries in the cross-compiler's SYSROOT and type:
-$ make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
+$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64
 
 Missing libraries when cross-compiling
 ---------------------------------------
@@ -82,7 +81,7 @@ On multiarch system you should be able to install those be appending
 the architecture name after the package (example for ARM64):
 $ sudo apt-get install libfdt-dev:arm64
 
-PowerPC, ARM/ARM64 and RISC-V require libfdt to be installed. If you cannot use
+PowerPC, ARM64 and RISC-V require libfdt to be installed. If you cannot use
 precompiled mulitarch packages, you could either copy the required header and
 library files from an installed target system into the SYSROOT (you will need
 /usr/include/*fdt*.h and /usr/lib64/libfdt-v.v.v.so and its symlinks), or you
Makefile +0 -0
index d84dc8e..462659b 100644

Makefile ifeq ($(ARCH), powerpc) · line 175

Quoted 10 lines
Makefile +0 -7
@@ -166,35 +166,24 @@ ifeq ($(ARCH), powerpc)
 	ARCH_WANT_LIBFDT := y
 endif
 
-# ARM
-OBJS_ARM_COMMON		:= arm/fdt.o arm/gic.o arm/gicv2m.o arm/ioport.o \
-			   arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o \
-			   hw/serial.o
-HDRS_ARM_COMMON		:= arm/include
-ifeq ($(ARCH), arm)
-	DEFINES		+= -DCONFIG_ARM

Found a couple of instances of CONFIG_ARM using grep.

Quoted 4 lines

There also one instance of the architecture name ARM in a comment in hw/cfi_flash.c, I think that was a typo and it was meant to say ARM64.

Other than that, looks good.

Thanks for spotting those, will fix.

Thanks,
Oliver

#4 lore raw

RFC 2/9 arm64: Move arm64-only features into main directory

In reply to Oliver Upton

Start the backing out the 32/64-bit split by moving arm64-only features up a level into the main arch directory.

---
 Makefile                    | 6 +++---
 arm/{aarch64 => }/arm-cpu.c | 0
 arm/{aarch64 => }/pmu.c     | 0
 arm/{aarch64 => }/pvtime.c  | 0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename arm/{aarch64 => }/arm-cpu.c (100%)
 rename arm/{aarch64 => }/pmu.c (100%)
 rename arm/{aarch64 => }/pvtime.c (100%)
Makefile +3 -3
index 462659b..cf50cf7 100644
@@ -178,11 +178,11 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= arm/pci.o
 	OBJS		+= arm/timer.o
 	OBJS		+= hw/serial.o
-	OBJS		+= arm/aarch64/arm-cpu.o
+	OBJS		+= arm/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
 	OBJS		+= arm/aarch64/kvm.o
-	OBJS		+= arm/aarch64/pvtime.o
-	OBJS		+= arm/aarch64/pmu.o
+	OBJS		+= arm/pvtime.o
+	OBJS		+= arm/pmu.o
 	ARCH_INCLUDE	:= arm/include
 	ARCH_INCLUDE	+= -Iarm/aarch64/include
 
arm/arm-cpu.c renamed from arm/aarch64/arm-cpu.c +0 -0
similarity index 100%
rename from arm/aarch64/arm-cpu.c
rename to arm/arm-cpu.c
arm/pmu.c renamed from arm/aarch64/pmu.c +0 -0
similarity index 100%
rename from arm/aarch64/pmu.c
rename to arm/pmu.c
arm/pvtime.c renamed from arm/aarch64/pvtime.c +0 -0
similarity index 100%
rename from arm/aarch64/pvtime.c
rename to arm/pvtime.c
Signature · 1 line
2.39.5
#5 lore raw

RFC 3/9 arm64: Combine kvm.c

In reply to Oliver Upton

Glue together the ARM common and previously arm64-specific bits into one source file.

---
 Makefile                                   |   1 -
 arm/aarch64/include/kvm/kvm-arch.h         |  22 ---
 arm/aarch64/kvm.c                          | 212 ---------------------
 arm/include/{arm-common => kvm}/kvm-arch.h |   4 +
 arm/kvm.c                                  | 210 ++++++++++++++++++++
 5 files changed, 214 insertions(+), 235 deletions(-)
 delete mode 100644 arm/aarch64/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch64/kvm.c
 rename arm/include/{arm-common => kvm}/kvm-arch.h (97%)
Makefile +0 -1
index cf50cf7..72027e0 100644
@@ -180,7 +180,6 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= hw/serial.o
 	OBJS		+= arm/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
-	OBJS		+= arm/aarch64/kvm.o
 	OBJS		+= arm/pvtime.o
 	OBJS		+= arm/pmu.o
 	ARCH_INCLUDE	:= arm/include
arm/aarch64/include/kvm/kvm-arch.h deleted +0 -0
deleted file mode 100644
index 2d1a4ed..0000000
arm/aarch64/kvm.c deleted +0 -0
deleted file mode 100644
index 98b2437..0000000
arm/include/kvm/kvm-arch.h renamed from arm/include/arm-common/kvm-arch.h +4 -0
similarity index 97%
rename from arm/include/arm-common/kvm-arch.h
rename to arm/include/kvm/kvm-arch.h
index 60eec02..b55b3bf 100644
@@ -84,6 +84,10 @@
 
 #define ARCH_HAS_PCI_EXP	1
 
+#define MAX_PAGE_SIZE	SZ_64K
+
+#define ARCH_HAS_CFG_RAM_ADDRESS	1
+
 static inline bool arm_addr_in_ioport_region(u64 phys_addr)
 {
 	u64 limit = KVM_IOPORT_AREA + ARM_IOPORT_SIZE;
arm/kvm.c +210 -0

235 lines not on this page · raw message

Signature · 1 line
2.39.5
#6 lore raw

Re: [RFC kvmtool 3/9] arm64: Combine kvm.c

Hi Oliver,

Quoted 41 lines · Oliver Upton

Glue together the ARM common and previously arm64-specific bits into one source file.

---
 Makefile                                   |   1 -
 arm/aarch64/include/kvm/kvm-arch.h         |  22 ---
 arm/aarch64/kvm.c                          | 212 ---------------------
 arm/include/{arm-common => kvm}/kvm-arch.h |   4 +
 arm/kvm.c                                  | 210 ++++++++++++++++++++
 5 files changed, 214 insertions(+), 235 deletions(-)
 delete mode 100644 arm/aarch64/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch64/kvm.c
 rename arm/include/{arm-common => kvm}/kvm-arch.h (97%)
Makefile +0 -1
index cf50cf7..72027e0 100644
@@ -180,7 +180,6 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= hw/serial.o
 	OBJS		+= arm/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
-	OBJS		+= arm/aarch64/kvm.o
 	OBJS		+= arm/pvtime.o
 	OBJS		+= arm/pmu.o
 	ARCH_INCLUDE	:= arm/include
arm/aarch64/include/kvm/kvm-arch.h deleted +0 -0
deleted file mode 100644
index 2d1a4ed..0000000
arm/aarch64/kvm.c deleted +0 -0
deleted file mode 100644
index 98b2437..0000000
arm/include/kvm/kvm-arch.h renamed from arm/include/arm-common/kvm-arch.h +0 -0
similarity index 97%
rename from arm/include/arm-common/kvm-arch.h
rename to arm/include/kvm/kvm-arch.h
index 60eec02..b55b3bf 100644

arm/include/kvm/kvm-arch.h line 89

Quoted 6 lines
arm/include/kvm/kvm-arch.h renamed from arm/include/arm-common/kvm-arch.h +3 -0
@@ -84,6 +84,10 @@
 
 #define ARCH_HAS_PCI_EXP	1
 
+#define MAX_PAGE_SIZE	SZ_64K
+
+#define ARCH_HAS_CFG_RAM_ADDRESS	1

Would you mind grouping ARCH_HAS_* defines together?

Quoted 11 lines
arm/include/kvm/kvm-arch.h renamed from arm/include/arm-common/kvm-arch.h +1 -0
+
 static inline bool arm_addr_in_ioport_region(u64 phys_addr)
 {
 	u64 limit = KVM_IOPORT_AREA + ARM_IOPORT_SIZE;
arm/kvm.c +0 -0
index cc0cc4f..5e7fe77 100644
@@ -7,10 +7,19 @@
 
 #include "arm-common/gic.h"

arm/kvm.c line 18

Quoted 10 lines
arm/kvm.c +5 -0
 
+#include <linux/byteorder.h>
+#include <linux/cpumask.h>
 #include <linux/kernel.h>
 #include <linux/kvm.h>
 #include <linux/sizes.h>
 
+#include <asm/image.h>
+
+#include <kvm/util.h>

kvm/util.h is already included at the top of the file. Otherwise looks good to me.

Thanks,
Alex

Quoted 230 lines
arm/kvm.c +205 -0
+
+
+static struct arm64_image_header *kernel_header;
+
 struct kvm_ext kvm_req_ext[] = {
 	{ DEFINE_KVM_EXT(KVM_CAP_IRQCHIP) },
 	{ DEFINE_KVM_EXT(KVM_CAP_ONE_REG) },
@@ -87,6 +96,33 @@ void kvm__arch_set_cmdline(char *cmdline, bool video)
 {
 }
 
+static void kvm__arch_enable_mte(struct kvm *kvm)
+{
+	struct kvm_enable_cap cap = {
+		.cap = KVM_CAP_ARM_MTE,
+	};
+
+	if (kvm->cfg.arch.aarch32_guest) {
+		pr_debug("MTE is incompatible with AArch32");
+		return;
+	}
+
+	if (kvm->cfg.arch.mte_disabled) {
+		pr_debug("MTE disabled by user");
+		return;
+	}
+
+	if (!kvm__supports_extension(kvm, KVM_CAP_ARM_MTE)) {
+		pr_debug("MTE capability not available");
+		return;
+	}
+
+	if (ioctl(kvm->vm_fd, KVM_ENABLE_CAP, &cap))
+		die_perror("KVM_ENABLE_CAP(KVM_CAP_ARM_MTE)");
+
+	pr_debug("MTE capability enabled");
+}
+
 void kvm__arch_init(struct kvm *kvm)
 {
 	/* Create the virtual GIC. */
@@ -96,6 +132,90 @@ void kvm__arch_init(struct kvm *kvm)
 	kvm__arch_enable_mte(kvm);
 }
 
+static u64 kvm__arch_get_payload_region_size(struct kvm *kvm)
+{
+	if (kvm->cfg.arch.aarch32_guest)
+		return SZ_256M;
+
+	return SZ_512M;
+}
+
+/*
+ * Return the TEXT_OFFSET value that the guest kernel expects. Note
+ * that pre-3.17 kernels expose this value using the native endianness
+ * instead of Little-Endian. BE kernels of this vintage may fail to
+ * boot. See Documentation/arm64/booting.rst in your local kernel tree.
+ */
+static u64 kvm__arch_get_kern_offset(struct kvm *kvm)
+{
+	const char *debug_str;
+
+	/* the 32bit kernel offset is a well known value */
+	if (kvm->cfg.arch.aarch32_guest)
+		return 0x8000;
+
+	if (!kernel_header) {
+		debug_str = "Kernel header is missing";
+		goto default_offset;
+	}
+
+	if (!le64_to_cpu(kernel_header->image_size)) {
+		debug_str = "Image size is 0";
+		goto default_offset;
+	}
+
+	return le64_to_cpu(kernel_header->text_offset);
+
+default_offset:
+	pr_debug("%s, assuming TEXT_OFFSET to be 0x80000", debug_str);
+	return 0x80000;
+}
+
+static void kvm__arch_read_kernel_header(struct kvm *kvm, int fd)
+{
+	const char *debug_str;
+	off_t cur_offset;
+	ssize_t size;
+
+	if (kvm->cfg.arch.aarch32_guest)
+		return;
+
+	kernel_header = malloc(sizeof(*kernel_header));
+	if (!kernel_header)
+		return;
+
+	cur_offset = lseek(fd, 0, SEEK_CUR);
+	if (cur_offset == (off_t)-1 || lseek(fd, 0, SEEK_SET) == (off_t)-1) {
+		debug_str = "Failed to seek in kernel image file";
+		goto fail;
+	}
+
+	size = xread(fd, kernel_header, sizeof(*kernel_header));
+	if (size < 0 || (size_t)size < sizeof(*kernel_header))
+		die("Failed to read kernel image header");
+
+	lseek(fd, cur_offset, SEEK_SET);
+
+	if (memcmp(&kernel_header->magic, ARM64_IMAGE_MAGIC, sizeof(kernel_header->magic))) {
+		debug_str = "Kernel image magic not matching";
+		kernel_header = NULL;
+		goto fail;
+	}
+
+	return;
+
+fail:
+	pr_debug("%s, using defaults", debug_str);
+}
+
+static u64 kvm__arch_get_kernel_size(struct kvm *kvm)
+{
+	if (kvm->cfg.arch.aarch32_guest || !kernel_header)
+		return 0;
+
+	return le64_to_cpu(kernel_header->image_size);
+}
+
 #define FDT_ALIGN	SZ_2M
 #define INITRD_ALIGN	4
 bool kvm__arch_load_kernel_image(struct kvm *kvm, int fd_kernel, int fd_initrd,
@@ -264,3 +384,93 @@ int kvm__arch_setup_firmware(struct kvm *kvm)
 {
 	return 0;
 }
+
+int vcpu_affinity_parser(const struct option *opt, const char *arg, int unset)
+{
+	struct kvm *kvm = opt->ptr;
+	const char *cpulist = arg;
+	cpumask_t *cpumask;
+	int cpu, ret;
+
+	kvm->cfg.arch.vcpu_affinity = cpulist;
+
+	cpumask = calloc(1, cpumask_size());
+	if (!cpumask)
+		die_perror("calloc");
+
+	ret = cpulist_parse(cpulist, cpumask);
+	if (ret) {
+		free(cpumask);
+		return ret;
+	}
+
+	kvm->arch.vcpu_affinity_cpuset = CPU_ALLOC(NR_CPUS);
+	if (!kvm->arch.vcpu_affinity_cpuset)
+		die_perror("CPU_ALLOC");
+	CPU_ZERO_S(CPU_ALLOC_SIZE(NR_CPUS), kvm->arch.vcpu_affinity_cpuset);
+
+	for_each_cpu(cpu, cpumask)
+		CPU_SET(cpu, kvm->arch.vcpu_affinity_cpuset);
+
+	return 0;
+}
+
+void kvm__arch_validate_cfg(struct kvm *kvm)
+{
+
+	if (kvm->cfg.ram_addr < ARM_MEMORY_AREA) {
+		die("RAM address is below the I/O region ending at %luGB",
+		    ARM_MEMORY_AREA >> 30);
+	}
+
+	if (kvm->cfg.arch.aarch32_guest &&
+	    kvm->cfg.ram_addr + kvm->cfg.ram_size > SZ_4G) {
+		die("RAM extends above 4GB");
+	}
+}
+
+u64 kvm__arch_default_ram_address(void)
+{
+	return ARM_MEMORY_AREA;
+}
+
+static int kvm__arch_get_ipa_limit(struct kvm *kvm)
+{
+	int ret;
+
+	ret = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, KVM_CAP_ARM_VM_IPA_SIZE);
+	if (ret <= 0)
+		ret = 0;
+
+	return ret;
+}
+
+int kvm__get_vm_type(struct kvm *kvm)
+{
+	unsigned int ipa_bits, max_ipa_bits;
+	unsigned long max_ipa;
+
+	/* If we're running on an old kernel, use 0 as the VM type */
+	max_ipa_bits = kvm__arch_get_ipa_limit(kvm);
+	if (!max_ipa_bits)
+		return 0;
+
+	/* Otherwise, compute the minimal required IPA size */
+	max_ipa = kvm->cfg.ram_addr + kvm->cfg.ram_size - 1;
+	ipa_bits = max(32, fls_long(max_ipa));
+	pr_debug("max_ipa %lx ipa_bits %d max_ipa_bits %d",
+		 max_ipa, ipa_bits, max_ipa_bits);
+
+	if (ipa_bits > max_ipa_bits)
+		die("Memory too large for this system (needs %d bits, %d available)", ipa_bits, max_ipa_bits);
+
+	return KVM_VM_TYPE_ARM_IPA_SIZE(ipa_bits);
+}
+
+static int kvm__arch_free_kernel_header(struct kvm *kvm)
+{
+	free(kernel_header);
+
+	return 0;
+}
+late_exit(kvm__arch_free_kernel_header);
Signature · 1 line
2.39.5
#7 lore raw

RFC 4/9 arm64: Merge kvm-cpu.c

In reply to Oliver Upton

As before, glue together the arm64 and ARM generic bits into one file.

---
 Makefile                                      |   1 -
 arm/aarch64/include/kvm/kvm-cpu-arch.h        |  19 -
 arm/aarch64/kvm-cpu.c                         | 330 ------------------
 .../{arm-common => kvm}/kvm-cpu-arch.h        |  10 +-
 arm/kvm-cpu.c                                 | 328 +++++++++++++++++
 5 files changed, 337 insertions(+), 351 deletions(-)
 delete mode 100644 arm/aarch64/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch64/kvm-cpu.c
 rename arm/include/{arm-common => kvm}/kvm-cpu-arch.h (82%)
Makefile +0 -1
index 72027e0..25ee9b0 100644
@@ -179,7 +179,6 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= arm/timer.o
 	OBJS		+= hw/serial.o
 	OBJS		+= arm/arm-cpu.o
-	OBJS		+= arm/aarch64/kvm-cpu.o
 	OBJS		+= arm/pvtime.o
 	OBJS		+= arm/pmu.o
 	ARCH_INCLUDE	:= arm/include
arm/aarch64/include/kvm/kvm-cpu-arch.h deleted +0 -0
deleted file mode 100644
index aeae8c1..0000000
arm/aarch64/kvm-cpu.c deleted +0 -0
deleted file mode 100644
index 7b6061a..0000000
arm/include/kvm/kvm-cpu-arch.h renamed from arm/include/arm-common/kvm-cpu-arch.h +9 -1
similarity index 82%
rename from arm/include/arm-common/kvm-cpu-arch.h
rename to arm/include/kvm/kvm-cpu-arch.h
index 923d2c4..1af394a 100644
@@ -1,11 +1,17 @@
 #ifndef ARM_COMMON__KVM_CPU_ARCH_H
 #define ARM_COMMON__KVM_CPU_ARCH_H
 
+#include "kvm/kvm.h"
+
 #include <linux/kvm.h>
 #include <pthread.h>
 #include <stdbool.h>
 
-struct kvm;
+#define ARM_MPIDR_HWID_BITMASK	0xFF00FFFFFFUL
+#define ARM_CPU_ID		3, 0, 0, 0
+#define ARM_CPU_ID_MPIDR	5
+#define ARM_CPU_CTRL		3, 0, 1, 0
+#define ARM_CPU_CTRL_SCTLR_EL1	0
 
 struct kvm_cpu {
 	pthread_t	thread;
@@ -58,5 +64,7 @@ static inline bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr,
 }
 
 unsigned long kvm_cpu__get_vcpu_mpidr(struct kvm_cpu *vcpu);
+int kvm_cpu__setup_pvtime(struct kvm_cpu *vcpu);
+int kvm_cpu__teardown_pvtime(struct kvm *kvm);
 
 #endif /* ARM_COMMON__KVM_CPU_ARCH_H */
arm/kvm-cpu.c +328 -0

342 lines not on this page · raw message

Signature · 1 line
2.39.5
#8 lore raw

RFC 5/9 arm64: Combine kvm-config-arch.h

In reply to Oliver Upton

You get the point...

---
 arm/aarch64/include/kvm/kvm-config-arch.h     | 29 -------------------
 .../{arm-common => kvm}/kvm-config-arch.h     | 24 +++++++++++++--
 2 files changed, 22 insertions(+), 31 deletions(-)
 delete mode 100644 arm/aarch64/include/kvm/kvm-config-arch.h
 rename arm/include/{arm-common => kvm}/kvm-config-arch.h (54%)
arm/aarch64/include/kvm/kvm-config-arch.h deleted +0 -0
deleted file mode 100644
index 642fe67..0000000
arm/include/kvm/kvm-config-arch.h renamed from arm/include/arm-common/kvm-config-arch.h +22 -2
similarity index 54%
rename from arm/include/arm-common/kvm-config-arch.h
rename to arm/include/kvm/kvm-config-arch.h
index 4722d8f..ee031f0 100644
@@ -18,17 +18,37 @@ struct kvm_config_arch {
 };
 
 int irqchip_parser(const struct option *opt, const char *arg, int unset);
+int vcpu_affinity_parser(const struct option *opt, const char *arg, int unset);
+int sve_vl_parser(const struct option *opt, const char *arg, int unset);
 
 #define OPT_ARCH_RUN(pfx, cfg)							\
 	pfx,									\
-	ARM_OPT_ARCH_RUN(cfg)							\
+	OPT_BOOLEAN('\0', "aarch32", &(cfg)->aarch32_guest,			\
+			"Run AArch32 guest"),					\
+	OPT_BOOLEAN('\0', "pmu", &(cfg)->has_pmuv3,				\
+			"Create PMUv3 device. The emulated PMU will be" 	\
+			" set to the PMU associated with the"			\
+			" main thread, unless --vcpu-affinity is set"),		\
+	OPT_BOOLEAN('\0', "disable-mte", &(cfg)->mte_disabled,			\
+			"Disable Memory Tagging Extension"),			\
+	OPT_CALLBACK('\0', "vcpu-affinity", kvm, "cpulist",  			\
+			"Specify the CPU affinity that will apply to "		\
+			"all VCPUs", vcpu_affinity_parser, kvm),		\
+	OPT_U64('\0', "kaslr-seed", &(cfg)->kaslr_seed,				\
+			"Specify random seed for Kernel Address Space "		\
+			"Layout Randomization (KASLR)"),			\
+	OPT_BOOLEAN('\0', "no-pvtime", &(cfg)->no_pvtime, "Disable"		\
+			" stolen time"),					\
+	OPT_CALLBACK('\0', "sve-max-vl", NULL, "vector length",			\
+		     "Specify the max SVE vector length (in bits) for "		\
+		     "all vCPUs", sve_vl_parser, kvm),				\
 	OPT_STRING('\0', "dump-dtb", &(cfg)->dump_dtb_filename,			\
 		   ".dtb file", "Dump generated .dtb to specified file"),	\
 	OPT_UINTEGER('\0', "override-bad-firmware-cntfrq", &(cfg)->force_cntfrq,\
 		     "Specify Generic Timer frequency in guest DT to "		\
 		     "work around buggy secure firmware *Firmware should be "	\
 		     "updated to program CNTFRQ correctly*"),			\
-	OPT_CALLBACK_NOOPT('\0', "force-pci", NULL, "",			\
+	OPT_CALLBACK_NOOPT('\0', "force-pci", NULL, "",				\
 			   "Force virtio devices to use PCI as their default "	\
 			   "transport (Deprecated: Use --virtio-transport "	\
 			   "option instead)", virtio_transport_parser, kvm),	\
Signature · 1 line
2.39.5
#9 lore raw

RFC 6/9 arm64: Move remaining kvm/* headers

In reply to Oliver Upton

Move the remaining kvm/* headers into the top-level ARM include path.

---
 arm/aarch64/include/kvm/fdt-arch.h         | 6 ------
 arm/{aarch64 => }/include/kvm/barrier.h    | 0
 arm/include/{arm-common => kvm}/fdt-arch.h | 0
 3 files changed, 6 deletions(-)
 delete mode 100644 arm/aarch64/include/kvm/fdt-arch.h
 rename arm/{aarch64 => }/include/kvm/barrier.h (100%)
 rename arm/include/{arm-common => kvm}/fdt-arch.h (100%)
arm/aarch64/include/kvm/fdt-arch.h deleted +0 -0
deleted file mode 100644
index e448bf1..0000000
arm/include/kvm/barrier.h renamed from arm/aarch64/include/kvm/barrier.h +0 -0
similarity index 100%
rename from arm/aarch64/include/kvm/barrier.h
rename to arm/include/kvm/barrier.h
arm/include/kvm/fdt-arch.h renamed from arm/include/arm-common/fdt-arch.h +0 -0
similarity index 100%
rename from arm/include/arm-common/fdt-arch.h
rename to arm/include/kvm/fdt-arch.h
Signature · 1 line
2.39.5
#10 lore raw

RFC 7/9 arm64: Move asm headers

In reply to Oliver Upton
---
 Makefile                                    | 1 -
 arm/{aarch64 => }/include/asm/image.h       | 0
 arm/{aarch64 => }/include/asm/kernel.h      | 0
 arm/{aarch64 => }/include/asm/kvm.h         | 0
 arm/{aarch64 => }/include/asm/pmu.h         | 0
 arm/{aarch64 => }/include/asm/sve_context.h | 0
 6 files changed, 1 deletion(-)
 rename arm/{aarch64 => }/include/asm/image.h (100%)
 rename arm/{aarch64 => }/include/asm/kernel.h (100%)
 rename arm/{aarch64 => }/include/asm/kvm.h (100%)
 rename arm/{aarch64 => }/include/asm/pmu.h (100%)
 rename arm/{aarch64 => }/include/asm/sve_context.h (100%)
Makefile +0 -1
index 25ee9b0..3085609 100644
@@ -182,7 +182,6 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= arm/pvtime.o
 	OBJS		+= arm/pmu.o
 	ARCH_INCLUDE	:= arm/include
-	ARCH_INCLUDE	+= -Iarm/aarch64/include
 
 	ARCH_WANT_LIBFDT := y
 	ARCH_HAS_FLASH_MEM := y
arm/include/asm/image.h renamed from arm/aarch64/include/asm/image.h +0 -0
similarity index 100%
rename from arm/aarch64/include/asm/image.h
rename to arm/include/asm/image.h
arm/include/asm/kernel.h renamed from arm/aarch64/include/asm/kernel.h +0 -0
similarity index 100%
rename from arm/aarch64/include/asm/kernel.h
rename to arm/include/asm/kernel.h
arm/include/asm/kvm.h renamed from arm/aarch64/include/asm/kvm.h +0 -0
similarity index 100%
rename from arm/aarch64/include/asm/kvm.h
rename to arm/include/asm/kvm.h
arm/include/asm/pmu.h renamed from arm/aarch64/include/asm/pmu.h +0 -0
similarity index 100%
rename from arm/aarch64/include/asm/pmu.h
rename to arm/include/asm/pmu.h
arm/include/asm/sve_context.h renamed from arm/aarch64/include/asm/sve_context.h +0 -0
similarity index 100%
rename from arm/aarch64/include/asm/sve_context.h
rename to arm/include/asm/sve_context.h
Signature · 1 line
2.39.5
#11 lore raw

RFC 8/9 arm64: Rename top-level directory

In reply to Oliver Upton

As a finishing touch, align the top-level arch directory name with the kernel's naming scheme.

---
 Makefile                                     | 24 ++++++++++----------
 {arm => arm64}/arm-cpu.c                     |  0
 {arm => arm64}/fdt.c                         |  0
 {arm => arm64}/gic.c                         |  0
 {arm => arm64}/gicv2m.c                      |  0
 {arm => arm64}/include/arm-common/gic.h      |  0
 {arm => arm64}/include/arm-common/pci.h      |  0
 {arm => arm64}/include/arm-common/timer.h    |  0
 {arm => arm64}/include/asm/image.h           |  0
 {arm => arm64}/include/asm/kernel.h          |  0
 {arm => arm64}/include/asm/kvm.h             |  0
 {arm => arm64}/include/asm/pmu.h             |  0
 {arm => arm64}/include/asm/sve_context.h     |  0
 {arm => arm64}/include/kvm/barrier.h         |  0
 {arm => arm64}/include/kvm/fdt-arch.h        |  0
 {arm => arm64}/include/kvm/kvm-arch.h        |  0
 {arm => arm64}/include/kvm/kvm-config-arch.h |  0
 {arm => arm64}/include/kvm/kvm-cpu-arch.h    |  0
 {arm => arm64}/ioport.c                      |  0
 {arm => arm64}/kvm-cpu.c                     |  0
 {arm => arm64}/kvm.c                         |  0
 {arm => arm64}/pci.c                         |  0
 {arm => arm64}/pmu.c                         |  0
 {arm => arm64}/pvtime.c                      |  0
 {arm => arm64}/timer.c                       |  0
 25 files changed, 12 insertions(+), 12 deletions(-)
 rename {arm => arm64}/arm-cpu.c (100%)
 rename {arm => arm64}/fdt.c (100%)
 rename {arm => arm64}/gic.c (100%)
 rename {arm => arm64}/gicv2m.c (100%)
 rename {arm => arm64}/include/arm-common/gic.h (100%)
 rename {arm => arm64}/include/arm-common/pci.h (100%)
 rename {arm => arm64}/include/arm-common/timer.h (100%)
 rename {arm => arm64}/include/asm/image.h (100%)
 rename {arm => arm64}/include/asm/kernel.h (100%)
 rename {arm => arm64}/include/asm/kvm.h (100%)
 rename {arm => arm64}/include/asm/pmu.h (100%)
 rename {arm => arm64}/include/asm/sve_context.h (100%)
 rename {arm => arm64}/include/kvm/barrier.h (100%)
 rename {arm => arm64}/include/kvm/fdt-arch.h (100%)
 rename {arm => arm64}/include/kvm/kvm-arch.h (100%)
 rename {arm => arm64}/include/kvm/kvm-config-arch.h (100%)
 rename {arm => arm64}/include/kvm/kvm-cpu-arch.h (100%)
 rename {arm => arm64}/ioport.c (100%)
 rename {arm => arm64}/kvm-cpu.c (100%)
 rename {arm => arm64}/kvm.c (100%)
 rename {arm => arm64}/pci.c (100%)
 rename {arm => arm64}/pmu.c (100%)
 rename {arm => arm64}/pvtime.c (100%)
 rename {arm => arm64}/timer.c (100%)
Makefile +12 -12
index 3085609..60e551f 100644
@@ -169,19 +169,19 @@ endif
 # ARM64
 ifeq ($(ARCH), arm64)
 	DEFINES		+= -DCONFIG_ARM64
-	OBJS		+= arm/fdt.o
-	OBJS		+= arm/gic.o
-	OBJS		+= arm/gicv2m.o
-	OBJS		+= arm/ioport.o
-	OBJS		+= arm/kvm.o
-	OBJS		+= arm/kvm-cpu.o
-	OBJS		+= arm/pci.o
-	OBJS		+= arm/timer.o
+	OBJS		+= arm64/fdt.o
+	OBJS		+= arm64/gic.o
+	OBJS		+= arm64/gicv2m.o
+	OBJS		+= arm64/ioport.o
+	OBJS		+= arm64/kvm.o
+	OBJS		+= arm64/kvm-cpu.o
+	OBJS		+= arm64/pci.o
+	OBJS		+= arm64/timer.o
 	OBJS		+= hw/serial.o
-	OBJS		+= arm/arm-cpu.o
-	OBJS		+= arm/pvtime.o
-	OBJS		+= arm/pmu.o
-	ARCH_INCLUDE	:= arm/include
+	OBJS		+= arm64/arm-cpu.o
+	OBJS		+= arm64/pvtime.o
+	OBJS		+= arm64/pmu.o
+	ARCH_INCLUDE	:= arm64/include
 
 	ARCH_WANT_LIBFDT := y
 	ARCH_HAS_FLASH_MEM := y
arm64/arm-cpu.c renamed from arm/arm-cpu.c +0 -0
similarity index 100%
rename from arm/arm-cpu.c
rename to arm64/arm-cpu.c
arm64/fdt.c renamed from arm/fdt.c +0 -0
similarity index 100%
rename from arm/fdt.c
rename to arm64/fdt.c
arm64/gic.c renamed from arm/gic.c +0 -0
similarity index 100%
rename from arm/gic.c
rename to arm64/gic.c
arm64/gicv2m.c renamed from arm/gicv2m.c +0 -0
similarity index 100%
rename from arm/gicv2m.c
rename to arm64/gicv2m.c
arm64/include/arm-common/gic.h renamed from arm/include/arm-common/gic.h +0 -0
similarity index 100%
rename from arm/include/arm-common/gic.h
rename to arm64/include/arm-common/gic.h
arm64/include/arm-common/pci.h renamed from arm/include/arm-common/pci.h +0 -0
similarity index 100%
rename from arm/include/arm-common/pci.h
rename to arm64/include/arm-common/pci.h
arm64/include/arm-common/timer.h renamed from arm/include/arm-common/timer.h +0 -0
similarity index 100%
rename from arm/include/arm-common/timer.h
rename to arm64/include/arm-common/timer.h
arm64/include/asm/image.h renamed from arm/include/asm/image.h +0 -0
similarity index 100%
rename from arm/include/asm/image.h
rename to arm64/include/asm/image.h
arm64/include/asm/kernel.h renamed from arm/include/asm/kernel.h +0 -0
similarity index 100%
rename from arm/include/asm/kernel.h
rename to arm64/include/asm/kernel.h
arm64/include/asm/kvm.h renamed from arm/include/asm/kvm.h +0 -0
similarity index 100%
rename from arm/include/asm/kvm.h
rename to arm64/include/asm/kvm.h
arm64/include/asm/pmu.h renamed from arm/include/asm/pmu.h +0 -0
similarity index 100%
rename from arm/include/asm/pmu.h
rename to arm64/include/asm/pmu.h
arm64/include/asm/sve_context.h renamed from arm/include/asm/sve_context.h +0 -0
similarity index 100%
rename from arm/include/asm/sve_context.h
rename to arm64/include/asm/sve_context.h
arm64/include/kvm/barrier.h renamed from arm/include/kvm/barrier.h +0 -0
similarity index 100%
rename from arm/include/kvm/barrier.h
rename to arm64/include/kvm/barrier.h
arm64/include/kvm/fdt-arch.h renamed from arm/include/kvm/fdt-arch.h +0 -0
similarity index 100%
rename from arm/include/kvm/fdt-arch.h
rename to arm64/include/kvm/fdt-arch.h
arm64/include/kvm/kvm-arch.h renamed from arm/include/kvm/kvm-arch.h +0 -0
similarity index 100%
rename from arm/include/kvm/kvm-arch.h
rename to arm64/include/kvm/kvm-arch.h
arm64/include/kvm/kvm-config-arch.h renamed from arm/include/kvm/kvm-config-arch.h +0 -0
similarity index 100%
rename from arm/include/kvm/kvm-config-arch.h
rename to arm64/include/kvm/kvm-config-arch.h
arm64/include/kvm/kvm-cpu-arch.h renamed from arm/include/kvm/kvm-cpu-arch.h +0 -0
similarity index 100%
rename from arm/include/kvm/kvm-cpu-arch.h
rename to arm64/include/kvm/kvm-cpu-arch.h
arm64/ioport.c renamed from arm/ioport.c +0 -0
similarity index 100%
rename from arm/ioport.c
rename to arm64/ioport.c
arm64/kvm-cpu.c renamed from arm/kvm-cpu.c +0 -0
similarity index 100%
rename from arm/kvm-cpu.c
rename to arm64/kvm-cpu.c
arm64/kvm.c renamed from arm/kvm.c +0 -0
similarity index 100%
rename from arm/kvm.c
rename to arm64/kvm.c
arm64/pci.c renamed from arm/pci.c +0 -0
similarity index 100%
rename from arm/pci.c
rename to arm64/pci.c
arm64/pmu.c renamed from arm/pmu.c +0 -0
similarity index 100%
rename from arm/pmu.c
rename to arm64/pmu.c
arm64/pvtime.c renamed from arm/pvtime.c +0 -0
similarity index 100%
rename from arm/pvtime.c
rename to arm64/pvtime.c
arm64/timer.c renamed from arm/timer.c +0 -0
similarity index 100%
rename from arm/timer.c
rename to arm64/timer.c
Signature · 1 line
2.39.5
#12 lore raw

RFC 9/9 arm64: Get rid of the 'arm-common' include directory

In reply to Oliver Upton
---
 arm64/arm-cpu.c                        | 4 ++--
 arm64/fdt.c                            | 4 ++--
 arm64/gic.c                            | 2 +-
 arm64/gicv2m.c                         | 2 +-
 arm64/include/{arm-common => }/gic.h   | 0
 arm64/include/kvm/kvm-arch.h           | 2 +-
 arm64/include/{arm-common => }/pci.h   | 0
 arm64/include/{arm-common => }/timer.h | 0
 arm64/kvm.c                            | 2 +-
 arm64/pci.c                            | 4 ++--
 arm64/pmu.c                            | 2 +-
 arm64/timer.c                          | 4 ++--
 12 files changed, 13 insertions(+), 13 deletions(-)
 rename arm64/include/{arm-common => }/gic.h (100%)
 rename arm64/include/{arm-common => }/pci.h (100%)
 rename arm64/include/{arm-common => }/timer.h (100%)
arm64/arm-cpu.c +2 -2
index f5c8e1e..b9ca814 100644
@@ -3,8 +3,8 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
-#include "arm-common/timer.h"
+#include "gic.h"
+#include "timer.h"
 
 #include "asm/pmu.h"
 
arm64/fdt.c +2 -2
index 286ccad..9d93551 100644
@@ -4,8 +4,8 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/virtio-mmio.h"
 
-#include "arm-common/gic.h"
-#include "arm-common/pci.h"
+#include "gic.h"
+#include "pci.h"
 
 #include <stdbool.h>
 
arm64/gic.c +1 -1
index 0795e95..d0d8543 100644
@@ -3,7 +3,7 @@
 #include "kvm/kvm.h"
 #include "kvm/virtio.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #include <linux/byteorder.h>
 #include <linux/kernel.h>
arm64/gicv2m.c +1 -1
index b47ada8..e4e7dc8 100644
@@ -5,7 +5,7 @@
 #include "kvm/kvm.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #define GICV2M_MSI_TYPER	0x008
 #define GICV2M_MSI_SETSPI	0x040
arm64/include/gic.h renamed from arm64/include/arm-common/gic.h +0 -0
similarity index 100%
rename from arm64/include/arm-common/gic.h
rename to arm64/include/gic.h
arm64/include/kvm/kvm-arch.h +1 -1
index b55b3bf..a9872a8 100644
@@ -10,7 +10,7 @@
 #include <linux/const.h>
 #include <linux/types.h>
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 /*
  * The memory map used for ARM guests (not to scale):
arm64/include/pci.h renamed from arm64/include/arm-common/pci.h +0 -0
similarity index 100%
rename from arm64/include/arm-common/pci.h
rename to arm64/include/pci.h
arm64/include/timer.h renamed from arm64/include/arm-common/timer.h +0 -0
similarity index 100%
rename from arm64/include/arm-common/timer.h
rename to arm64/include/timer.h
arm64/kvm.c +1 -1
index 5e7fe77..6ee4c1d 100644
@@ -5,7 +5,7 @@
 #include "kvm/virtio-console.h"
 #include "kvm/fdt.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #include <linux/byteorder.h>
 #include <linux/cpumask.h>
arm64/pci.c +2 -2
index 5bd82d4..99bf887 100644
@@ -5,8 +5,8 @@
 #include "kvm/pci.h"
 #include "kvm/util.h"
 
-#include "arm-common/pci.h"
-#include "arm-common/gic.h"
+#include "pci.h"
+#include "gic.h"
 
 /*
  * An entry in the interrupt-map table looks like:
arm64/pmu.c +1 -1
index 5ed4979..52f4256 100644
@@ -9,7 +9,7 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #include "asm/pmu.h"
 
arm64/timer.c +2 -2
index 6acc50e..b3164f8 100644
@@ -3,8 +3,8 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
-#include "arm-common/timer.h"
+#include "gic.h"
+#include "timer.h"
 
 void timer__generate_fdt_nodes(void *fdt, struct kvm *kvm, int *irqs)
 {
Signature · 1 line
2.39.5
#13 lore raw

Re: [RFC kvmtool 9/9] arm64: Get rid of the 'arm-common' include directory

Hi Oliver,

Quoted 10 lines · Oliver Upton
---
 arm64/arm-cpu.c                        | 4 ++--
 arm64/fdt.c                            | 4 ++--
 arm64/gic.c                            | 2 +-
 arm64/gicv2m.c                         | 2 +-
 arm64/include/{arm-common => }/gic.h   | 0
 arm64/include/kvm/kvm-arch.h           | 2 +-
 arm64/include/{arm-common => }/pci.h   | 0
 arm64/include/{arm-common => }/timer.h | 0

Looking at x86 and riscv, the pattern is to have the header files in <arch>/include/kvm, even if they're only used by the arch code.

Do we care about following this pattern?

Thanks,
Alex

Quoted 150 lines
 arm64/kvm.c                            | 2 +-
 arm64/pci.c                            | 4 ++--
 arm64/pmu.c                            | 2 +-
 arm64/timer.c                          | 4 ++--
 12 files changed, 13 insertions(+), 13 deletions(-)
 rename arm64/include/{arm-common => }/gic.h (100%)
 rename arm64/include/{arm-common => }/pci.h (100%)
 rename arm64/include/{arm-common => }/timer.h (100%)
arm64/arm-cpu.c +2 -2
index f5c8e1e..b9ca814 100644
@@ -3,8 +3,8 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
-#include "arm-common/timer.h"
+#include "gic.h"
+#include "timer.h"
 
 #include "asm/pmu.h"
 
arm64/fdt.c +2 -2
index 286ccad..9d93551 100644
@@ -4,8 +4,8 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/virtio-mmio.h"
 
-#include "arm-common/gic.h"
-#include "arm-common/pci.h"
+#include "gic.h"
+#include "pci.h"
 
 #include <stdbool.h>
 
arm64/gic.c +1 -1
index 0795e95..d0d8543 100644
@@ -3,7 +3,7 @@
 #include "kvm/kvm.h"
 #include "kvm/virtio.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #include <linux/byteorder.h>
 #include <linux/kernel.h>
arm64/gicv2m.c +1 -1
index b47ada8..e4e7dc8 100644
@@ -5,7 +5,7 @@
 #include "kvm/kvm.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #define GICV2M_MSI_TYPER	0x008
 #define GICV2M_MSI_SETSPI	0x040
arm64/include/gic.h renamed from arm64/include/arm-common/gic.h +0 -0
similarity index 100%
rename from arm64/include/arm-common/gic.h
rename to arm64/include/gic.h
arm64/include/kvm/kvm-arch.h +1 -1
index b55b3bf..a9872a8 100644
@@ -10,7 +10,7 @@
 #include <linux/const.h>
 #include <linux/types.h>
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 /*
  * The memory map used for ARM guests (not to scale):
arm64/include/pci.h renamed from arm64/include/arm-common/pci.h +0 -0
similarity index 100%
rename from arm64/include/arm-common/pci.h
rename to arm64/include/pci.h
arm64/include/timer.h renamed from arm64/include/arm-common/timer.h +0 -0
similarity index 100%
rename from arm64/include/arm-common/timer.h
rename to arm64/include/timer.h
arm64/kvm.c +1 -1
index 5e7fe77..6ee4c1d 100644
@@ -5,7 +5,7 @@
 #include "kvm/virtio-console.h"
 #include "kvm/fdt.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #include <linux/byteorder.h>
 #include <linux/cpumask.h>
arm64/pci.c +2 -2
index 5bd82d4..99bf887 100644
@@ -5,8 +5,8 @@
 #include "kvm/pci.h"
 #include "kvm/util.h"
 
-#include "arm-common/pci.h"
-#include "arm-common/gic.h"
+#include "pci.h"
+#include "gic.h"
 
 /*
  * An entry in the interrupt-map table looks like:
arm64/pmu.c +1 -1
index 5ed4979..52f4256 100644
@@ -9,7 +9,7 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
+#include "gic.h"
 
 #include "asm/pmu.h"
 
arm64/timer.c +2 -2
index 6acc50e..b3164f8 100644
@@ -3,8 +3,8 @@
 #include "kvm/kvm-cpu.h"
 #include "kvm/util.h"
 
-#include "arm-common/gic.h"
-#include "arm-common/timer.h"
+#include "gic.h"
+#include "timer.h"
 
 void timer__generate_fdt_nodes(void *fdt, struct kvm *kvm, int *irqs)
 {
Signature · 1 line
2.39.5
#14 lore raw

Re: [RFC kvmtool 9/9] arm64: Get rid of the 'arm-common' include directory

Hi Alex,

Quoted 14 lines · Alexandru Elisei

Hi Oliver,

Quoted 10 lines · Oliver Upton
---
 arm64/arm-cpu.c                        | 4 ++--
 arm64/fdt.c                            | 4 ++--
 arm64/gic.c                            | 2 +-
 arm64/gicv2m.c                         | 2 +-
 arm64/include/{arm-common => }/gic.h   | 0
 arm64/include/kvm/kvm-arch.h           | 2 +-
 arm64/include/{arm-common => }/pci.h   | 0
 arm64/include/{arm-common => }/timer.h | 0
Quoted 4 lines

Looking at x86 and riscv, the pattern is to have the header files in <arch>/include/kvm, even if they're only used by the arch code.

Do we care about following this pattern?

I have no strong preference in either direction, I just did the laziest thing here.

Thanks,
Oliver

#15 lore raw
In reply to Oliver Upton

Hi Oliver,

I'm CC'ing Marc and Andre (Andre is the only person that I know for a fact that ran 32 bit kvmtool).

Haven't looked at the patches in detail, but as someone who ocassionally contributes to kvmtool, I have to say it's always nice to have fewer things to worry about. I, for one, never used 32 bit kvmtool, I just compiled for 32 bit arm to make sure it doesn't break.

If nobody objects to dropping support for 32 bit kvmtool, I'm planning to review the patches.

Thanks,
Alex

Quoted 109 lines · Oliver Upton

The last stable kernel to support 32-bit KVM/arm is 5.4, which is on track for EOL at the end of this year. Considering this, and the fact that 32-bit KVM never saw much usage in the first place, it is probably time to toss out the coprolite.

Of course, this has no effect on the support for 32-bit guests on 64-bit KVM.

Oliver Upton (9):
Drop support for 32-bit arm
arm64: Move arm64-only features into main directory
arm64: Combine kvm.c
arm64: Merge kvm-cpu.c
arm64: Combine kvm-config-arch.h
arm64: Move remaining kvm/* headers
arm64: Move asm headers
arm64: Rename top-level directory
arm64: Get rid of the 'arm-common' include directory

 INSTALL                                       |   9 +-
 Makefile                                      |  40 +--
 arm/aarch32/arm-cpu.c                         |  50 ---
 arm/aarch32/include/asm/kernel.h              |   8 -
 arm/aarch32/include/asm/kvm.h                 | 311 ------------------
 arm/aarch32/include/kvm/barrier.h             |  10 -
 arm/aarch32/include/kvm/fdt-arch.h            |   6 -
 arm/aarch32/include/kvm/kvm-arch.h            |  18 -
 arm/aarch32/include/kvm/kvm-config-arch.h     |   8 -
 arm/aarch32/include/kvm/kvm-cpu-arch.h        |  24 --
 arm/aarch32/kvm-cpu.c                         | 132 --------
 arm/aarch32/kvm.c                             |  14 -
 arm/aarch64/include/kvm/fdt-arch.h            |   6 -
 arm/aarch64/include/kvm/kvm-arch.h            |  22 --
 arm/aarch64/include/kvm/kvm-config-arch.h     |  29 --
 arm/aarch64/include/kvm/kvm-cpu-arch.h        |  19 --
 arm/aarch64/kvm.c                             | 212 ------------
 arm/kvm-cpu.c                                 | 153 ---------
 {arm/aarch64 => arm64}/arm-cpu.c              |   4 +-
 {arm => arm64}/fdt.c                          |   4 +-
 {arm => arm64}/gic.c                          |   2 +-
 {arm => arm64}/gicv2m.c                       |   2 +-
 {arm/aarch64 => arm64}/include/asm/image.h    |   0
 {arm/aarch64 => arm64}/include/asm/kernel.h   |   0
 {arm/aarch64 => arm64}/include/asm/kvm.h      |   0
 {arm/aarch64 => arm64}/include/asm/pmu.h      |   0
 .../include/asm/sve_context.h                 |   0
 .../arm-common => arm64/include}/gic.h        |   0
 {arm/aarch64 => arm64}/include/kvm/barrier.h  |   0
 .../include/kvm}/fdt-arch.h                   |   0
 .../include/kvm}/kvm-arch.h                   |   6 +-
 .../include/kvm}/kvm-config-arch.h            |  24 +-
 .../include/kvm}/kvm-cpu-arch.h               |  10 +-
 .../arm-common => arm64/include}/pci.h        |   0
 .../arm-common => arm64/include}/timer.h      |   0
 {arm => arm64}/ioport.c                       |   0
 {arm/aarch64 => arm64}/kvm-cpu.c              | 289 ++++++++++++----
 {arm => arm64}/kvm.c                          | 212 +++++++++++-
 {arm => arm64}/pci.c                          |   4 +-
 {arm/aarch64 => arm64}/pmu.c                  |   2 +-
 {arm/aarch64 => arm64}/pvtime.c               |   0
 {arm => arm64}/timer.c                        |   4 +-
 42 files changed, 495 insertions(+), 1139 deletions(-)
 delete mode 100644 arm/aarch32/arm-cpu.c
 delete mode 100644 arm/aarch32/include/asm/kernel.h
 delete mode 100644 arm/aarch32/include/asm/kvm.h
 delete mode 100644 arm/aarch32/include/kvm/barrier.h
 delete mode 100644 arm/aarch32/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch32/kvm-cpu.c
 delete mode 100644 arm/aarch32/kvm.c
 delete mode 100644 arm/aarch64/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch64/kvm.c
 delete mode 100644 arm/kvm-cpu.c
 rename {arm/aarch64 => arm64}/arm-cpu.c (96%)
 rename {arm => arm64}/fdt.c (99%)
 rename {arm => arm64}/gic.c (99%)
 rename {arm => arm64}/gicv2m.c (99%)
 rename {arm/aarch64 => arm64}/include/asm/image.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/kernel.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/kvm.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/pmu.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/sve_context.h (100%)
 rename {arm/include/arm-common => arm64/include}/gic.h (100%)
 rename {arm/aarch64 => arm64}/include/kvm/barrier.h (100%)
 rename {arm/include/arm-common => arm64/include/kvm}/fdt-arch.h (100%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-arch.h (97%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-config-arch.h (54%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-cpu-arch.h (82%)
 rename {arm/include/arm-common => arm64/include}/pci.h (100%)
 rename {arm/include/arm-common => arm64/include}/timer.h (100%)
 rename {arm => arm64}/ioport.c (100%)
 rename {arm/aarch64 => arm64}/kvm-cpu.c (70%)
 rename {arm => arm64}/kvm.c (59%)
 rename {arm => arm64}/pci.c (98%)
 rename {arm/aarch64 => arm64}/pmu.c (99%)
 rename {arm/aarch64 => arm64}/pvtime.c (100%)
 rename {arm => arm64}/timer.c (95%)

base-commit: e48563f5c4a48fe6a6bc2a98a9a7c84a10f043be

Signature · 1 line
2.39.5
maintainer
#16 lore raw
Quoted 6 lines · Alexandru Elisei

Hi Oliver,

I'm CC'ing Marc and Andre (Andre is the only person that I know for a fact that ran 32 bit kvmtool).

Quoted 7 lines

Haven't looked at the patches in detail, but as someone who ocassionally contributes to kvmtool, I have to say it's always nice to have fewer things to worry about. I, for one, never used 32 bit kvmtool, I just compiled for 32 bit arm to make sure it doesn't break.

If nobody objects to dropping support for 32 bit kvmtool, I'm planning to review the patches.

Frankly, the removal of 32bit support is long overdue. Every time I hack something in kvmtool (at least once a month), I have to wonder how to fit that in the 32bit code that I *know* to be dead code.

We kept it ticking around when the kernel code was removed back in 5.6, and in the interval I have ran it *once*. These days, I don't even have a working 32bit setup.

In all honesty, someone using 32bit KVM can also use an older build of kvmtool (this piece of SW is *done*), and we can happily move on.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#17 lore raw
Quoted 7 lines · Marc Zyngier
Quoted 5 lines · Alexandru Elisei

Hi Oliver,

I'm CC'ing Marc and Andre (Andre is the only person that I know for a fact that ran 32 bit kvmtool).

Thanks Alex, forgot some folks :)

Quoted 11 lines
Quoted 7 lines

Haven't looked at the patches in detail, but as someone who ocassionally contributes to kvmtool, I have to say it's always nice to have fewer things to worry about. I, for one, never used 32 bit kvmtool, I just compiled for 32 bit arm to make sure it doesn't break.

If nobody objects to dropping support for 32 bit kvmtool, I'm planning to review the patches.

Frankly, the removal of 32bit support is long overdue. Every time I hack something in kvmtool (at least once a month), I have to wonder how to fit that in the 32bit code that I *know* to be dead code.

That's pretty much how I arrived at these patches, hacking on something for arm64 and getting annoyed with the 32-bit stuff.

Thanks,
Oliver

#18 lore raw
In reply to Alexandru Elisei

On Mon, 17 Mar 2025 10:39:44 +0000 Alexandru Elisei <[email protected]> wrote:

Hi,

Quoted 9 lines

Hi Oliver,

I'm CC'ing Marc and Andre (Andre is the only person that I know for a fact that ran 32 bit kvmtool).

Haven't looked at the patches in detail, but as someone who ocassionally contributes to kvmtool, I have to say it's always nice to have fewer things to worry about. I, for one, never used 32 bit kvmtool, I just compiled for 32 bit arm to make sure it doesn't break.

Well, it's of course always easier to just remove code and features, especially if one doesn't have a use for this feature in the first place.

But I clearly see that 32-bit host support is *very* niche today, especially with dropped host kernel support, and that new features like NV and RME don't apply for that anyway, and are far more important, so I am fine with letting it go. So long, and thanks for all the fish!

Cheers,
Andre

Quoted 116 lines

If nobody objects to dropping support for 32 bit kvmtool, I'm planning to review the patches.

Thanks,
Alex

Quoted 109 lines · Oliver Upton

The last stable kernel to support 32-bit KVM/arm is 5.4, which is on track for EOL at the end of this year. Considering this, and the fact that 32-bit KVM never saw much usage in the first place, it is probably time to toss out the coprolite.

Of course, this has no effect on the support for 32-bit guests on 64-bit KVM.

Oliver Upton (9):
Drop support for 32-bit arm
arm64: Move arm64-only features into main directory
arm64: Combine kvm.c
arm64: Merge kvm-cpu.c
arm64: Combine kvm-config-arch.h
arm64: Move remaining kvm/* headers
arm64: Move asm headers
arm64: Rename top-level directory
arm64: Get rid of the 'arm-common' include directory

 INSTALL                                       |   9 +-
 Makefile                                      |  40 +--
 arm/aarch32/arm-cpu.c                         |  50 ---
 arm/aarch32/include/asm/kernel.h              |   8 -
 arm/aarch32/include/asm/kvm.h                 | 311 ------------------
 arm/aarch32/include/kvm/barrier.h             |  10 -
 arm/aarch32/include/kvm/fdt-arch.h            |   6 -
 arm/aarch32/include/kvm/kvm-arch.h            |  18 -
 arm/aarch32/include/kvm/kvm-config-arch.h     |   8 -
 arm/aarch32/include/kvm/kvm-cpu-arch.h        |  24 --
 arm/aarch32/kvm-cpu.c                         | 132 --------
 arm/aarch32/kvm.c                             |  14 -
 arm/aarch64/include/kvm/fdt-arch.h            |   6 -
 arm/aarch64/include/kvm/kvm-arch.h            |  22 --
 arm/aarch64/include/kvm/kvm-config-arch.h     |  29 --
 arm/aarch64/include/kvm/kvm-cpu-arch.h        |  19 --
 arm/aarch64/kvm.c                             | 212 ------------
 arm/kvm-cpu.c                                 | 153 ---------
 {arm/aarch64 => arm64}/arm-cpu.c              |   4 +-
 {arm => arm64}/fdt.c                          |   4 +-
 {arm => arm64}/gic.c                          |   2 +-
 {arm => arm64}/gicv2m.c                       |   2 +-
 {arm/aarch64 => arm64}/include/asm/image.h    |   0
 {arm/aarch64 => arm64}/include/asm/kernel.h   |   0
 {arm/aarch64 => arm64}/include/asm/kvm.h      |   0
 {arm/aarch64 => arm64}/include/asm/pmu.h      |   0
 .../include/asm/sve_context.h                 |   0
 .../arm-common => arm64/include}/gic.h        |   0
 {arm/aarch64 => arm64}/include/kvm/barrier.h  |   0
 .../include/kvm}/fdt-arch.h                   |   0
 .../include/kvm}/kvm-arch.h                   |   6 +-
 .../include/kvm}/kvm-config-arch.h            |  24 +-
 .../include/kvm}/kvm-cpu-arch.h               |  10 +-
 .../arm-common => arm64/include}/pci.h        |   0
 .../arm-common => arm64/include}/timer.h      |   0
 {arm => arm64}/ioport.c                       |   0
 {arm/aarch64 => arm64}/kvm-cpu.c              | 289 ++++++++++++----
 {arm => arm64}/kvm.c                          | 212 +++++++++++-
 {arm => arm64}/pci.c                          |   4 +-
 {arm/aarch64 => arm64}/pmu.c                  |   2 +-
 {arm/aarch64 => arm64}/pvtime.c               |   0
 {arm => arm64}/timer.c                        |   4 +-
 42 files changed, 495 insertions(+), 1139 deletions(-)
 delete mode 100644 arm/aarch32/arm-cpu.c
 delete mode 100644 arm/aarch32/include/asm/kernel.h
 delete mode 100644 arm/aarch32/include/asm/kvm.h
 delete mode 100644 arm/aarch32/include/kvm/barrier.h
 delete mode 100644 arm/aarch32/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch32/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch32/kvm-cpu.c
 delete mode 100644 arm/aarch32/kvm.c
 delete mode 100644 arm/aarch64/include/kvm/fdt-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-config-arch.h
 delete mode 100644 arm/aarch64/include/kvm/kvm-cpu-arch.h
 delete mode 100644 arm/aarch64/kvm.c
 delete mode 100644 arm/kvm-cpu.c
 rename {arm/aarch64 => arm64}/arm-cpu.c (96%)
 rename {arm => arm64}/fdt.c (99%)
 rename {arm => arm64}/gic.c (99%)
 rename {arm => arm64}/gicv2m.c (99%)
 rename {arm/aarch64 => arm64}/include/asm/image.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/kernel.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/kvm.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/pmu.h (100%)
 rename {arm/aarch64 => arm64}/include/asm/sve_context.h (100%)
 rename {arm/include/arm-common => arm64/include}/gic.h (100%)
 rename {arm/aarch64 => arm64}/include/kvm/barrier.h (100%)
 rename {arm/include/arm-common => arm64/include/kvm}/fdt-arch.h (100%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-arch.h (97%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-config-arch.h (54%)
 rename {arm/include/arm-common => arm64/include/kvm}/kvm-cpu-arch.h (82%)
 rename {arm/include/arm-common => arm64/include}/pci.h (100%)
 rename {arm/include/arm-common => arm64/include}/timer.h (100%)
 rename {arm => arm64}/ioport.c (100%)
 rename {arm/aarch64 => arm64}/kvm-cpu.c (70%)
 rename {arm => arm64}/kvm.c (59%)
 rename {arm => arm64}/pci.c (98%)
 rename {arm/aarch64 => arm64}/pmu.c (99%)
 rename {arm/aarch64 => arm64}/pvtime.c (100%)
 rename {arm => arm64}/timer.c (95%)

base-commit: e48563f5c4a48fe6a6bc2a98a9a7c84a10f043be

Signature · 1 line
2.39.5
maintainer Acked-by on the v1 series
#19 lore raw
In reply to Oliver Upton
Quoted 4 lines · Oliver Upton

The last stable kernel to support 32-bit KVM/arm is 5.4, which is on track for EOL at the end of this year. Considering this, and the fact that 32-bit KVM never saw much usage in the first place, it is probably time to toss out the coprolite.

coprolithe! :D

Quoted 4 lines

Of course, this has no effect on the support for 32-bit guests on 64-bit KVM.

Quoted 10 lines

Oliver Upton (9):
Drop support for 32-bit arm
arm64: Move arm64-only features into main directory
arm64: Combine kvm.c
arm64: Merge kvm-cpu.c
arm64: Combine kvm-config-arch.h
arm64: Move remaining kvm/* headers
arm64: Move asm headers
arm64: Rename top-level directory
arm64: Get rid of the 'arm-common' include directory

FWIW:

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...