mbox series

[kvmtool,0/2] Fixes for arm64 and MIPS

Message ID 20220525165704.186754-1-alexandru.elisei@arm.com (mailing list archive)
Headers show
Series Fixes for arm64 and MIPS | expand

Message

Alexandru Elisei May 25, 2022, 4:57 p.m. UTC
The first fix is for arm64, where the VCPUs weren't pinned correctly with
--vcpu-affinity when creating an aarch32 guest. Hopefully the patch is
straightforward.

The last patch is a fix for MIPS not compiling for a year now, ever since
hw/serial.c was changed to use a different address for arm/arm64 in commit
45b4968e0de1 ("hw/serial: ARM/arm64: Use MMIO at higher addresses"). Did
some digging and it turns out that the serial never worked on MIPS since
RAM starts at 0 for the architecture. So I just removed hw/serial.o from the
list of compilation objects, which revelead that kvm-ipc assumes that all
architectures use the 16550/8250 UART. Added a stub for
serial8250__inject_sysreg() to MIPS to fix that.

Note that as far as I can tell powerpc is in the same situation as MIPS:
RAM starts at 0 and ends at 64TB (that's terabytes), so the UART was never
working. It looks like powerpc uses hypercalls to emulate a console with
the name "hvterm" (devicetree node created in kvm.c and emulation
implemented in spapr_hvcons.{c,h}). I don't know enough about the powerpc
architecture and I don't have a machine to test it on, and since powerpc
still compiles, I opted not to do any changes to the architecture.

Tested by cross-compiling both patches for all architectures (arm, arm64, mips,
powerpc, riscv, x86), running a kernel on x86, and running kvm-unit-tests for
both arm and arm64 on a rockpro64 (has two PMUs).

Alexandru Elisei (2):
  arm64: Honor --vcpu-affinity for aarch32 guests
  mips: Do not emulate a serial device

 Makefile              |  7 +++++--
 arm/aarch64/kvm-cpu.c | 22 ++++++++++++----------
 mips/kvm.c            |  5 +++++
 3 files changed, 22 insertions(+), 12 deletions(-)

Comments

Will Deacon May 26, 2022, 9:17 a.m. UTC | #1
On Wed, 25 May 2022 17:57:02 +0100, Alexandru Elisei wrote:
> The first fix is for arm64, where the VCPUs weren't pinned correctly with
> --vcpu-affinity when creating an aarch32 guest. Hopefully the patch is
> straightforward.
> 
> The last patch is a fix for MIPS not compiling for a year now, ever since
> hw/serial.c was changed to use a different address for arm/arm64 in commit
> 45b4968e0de1 ("hw/serial: ARM/arm64: Use MMIO at higher addresses"). Did
> some digging and it turns out that the serial never worked on MIPS since
> RAM starts at 0 for the architecture. So I just removed hw/serial.o from the
> list of compilation objects, which revelead that kvm-ipc assumes that all
> architectures use the 16550/8250 UART. Added a stub for
> serial8250__inject_sysreg() to MIPS to fix that.
> 
> [...]

Applied to kvmtool (master), thanks!

[1/2] arm64: Honor --vcpu-affinity for aarch32 guests
      https://git.kernel.org/will/kvmtool/c/8ec1e8bf3bc2
[2/2] mips: Do not emulate a serial device
      https://git.kernel.org/will/kvmtool/c/6f6f384cef27

Cheers,