From: James Hogan Subject: [PATCH v4 00/10] KVM Support for MIPS32 Processors Date: Fri, 14 Mar 2014 12:47:51 +0000 Message-ID: <1394801281-18997-1-git-send-email-james.hogan@imgtec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: , Aurelien Jarno , Gleb Natapov , Paolo Bonzini , Sanjay Lal , James Hogan To: Return-path: Received: from mailapp01.imgtec.com ([195.89.28.115]:39189 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753489AbaCNMsT (ORCPT ); Fri, 14 Mar 2014 08:48:19 -0400 Sender: kvm-owner@vger.kernel.org List-ID: I'd like to have this squeezed into 2.0 (if at all possible), so any final review from KVM people would be much appreciated.=20 Thanks to everybody who has already taken part in review. This patchset implements KVM support for MIPS32 processors, using Trap = & Emulation. In KVM mode, CPU virtualization is handled via the kvm kernel module, while system and I/O virtualization leverage the Malta model already present in QEMU. Both Guest kernel and Guest Userspace execute in UM. The Guest address space is as folows: Guest User address space: 0x00000000 -> 0x40000000 Guest Kernel Unmapped: 0x40000000 -> 0x60000000 Guest Kernel Mapped: 0x60000000 -> 0x80000000 As a result, Guest Usermode virtual memory is limited to 1GB. KVM support (by trap and emulate) was added to the Linux kernel in v3.10. Changes in v4: Changes mostly addressing a few review comments from v3 patchset. A git tag for this version of the patchset can also be found on github: https://github.com/jahogan/qemu-kvm-mips.git kvm-mips-v4 - Rebase on v2.0.0-rc0. - Use int32_t instead of int32 (which is for softfloat) in kvm registe= r accessors (Andreas F=C3=A4rber). - Use uint64_t instead of __u64 (which is really just for kernel headers) in the kvm register accessors (Andreas F=C3=A4rber). - Cast pointer to uintptr_t rather than target_ulong in kvm register accessors. - Remove some redundant casts in kvm register accessors. - Add MAINTAINERS entry for MIPS KVM. Changes in v3: Changes mostly addressing review comments from v2 patchset. A git tag for this version of the patchset can also be found on github: https://github.com/jahogan/qemu-kvm-mips.git kvm-mips-v3 - Remove "target-mips: Set target page size to 16K in KVM mode". It should actually work fine with 4k TARGET_PAGE_SIZE as long as there is no cache aliasing or both host and guest kernels are configured t= o a sufficient page size to avoid aliasing (which the kernel arch/mips/kvm/00README.txt alludes to anyway). - Rewrote kvm sigmask patch to allow sigmask length to be set by kvm_arch_init(), so that MIPS can set it to 16 as it has 128 signals= =2E This is better than cluttering kvm-all.c with TARGET_* ifdefs (Peter Maydell). - Set sigmask length to 16 from kvm_arch_init() since MIPS Linux has 128 signals. This is better than cluttering kvm_all.c with TARGET_* ifdefs (Peter Maydell). - s/dprintf/DPRINTF/ (Andreas F=C3=A4rber). - Use "cs" rather than "cpu" or "env" for CPUState variable names (Andreas F=C3=A4rber). - Use CPUMIPSState rather than CPUArchState (Andreas F=C3=A4rber). - Pass MIPSCPU to cpu_mips_io_interrupts_pending() rather than CPUMIPSState (Andreas F=C3=A4rber). - Remove spurious parentheses around cpu_mips_io_interrupts_pending() call (Andreas F=C3=A4rber). - Pass MIPSCPU to kvm_mips_set_[ipi_]interrupt (Andreas F=C3=A4rber). - Make use of error_report (Andreas F=C3=A4rber) and clean up error me= ssages a little to include __func__. - Remove inline kvm_mips_{put,get}_one_[ul]reg() declarations from kvm_mips.h. They're only used in target-mips/kvm.c anyway. - Make kvm_arch_{put,get}_registers static within target-mips/kvm.c an= d remove from kvm_mips.h. - Remove unnecessary includes from Malta patch, especially linux/kvm.h which isn't a good idea on non-Linux (Peter Maydell). Changes in v2: This patchset is based on Sanjay Lal's V1 patchset from 2nd March 2013: https://patchwork.kernel.org/project/kvm/list/?submitter=3D51991&state=3D= *&q=3Dqemu-devel I think I've addressed all the V1 feedback. The other main change is th= e removal of the boot-CPS ROM code binary blob and GIC/SMP support since it's all slightly orthogonal to KVM support. Instead the existing minimal bootloader code for Malta has been updated to work with KVM T&E= =2E A git tag for this version of the patchset can also be found on github: https://github.com/jahogan/qemu-kvm-mips.git kvm-mips-v2 - Expand commit messages - Rebase on v1.7.0 - Misc checkpatch and other cleanups - Some interrupt bug fixes from Yann Le Du - Add get/set register functionality from Yann Le Du - Use new 64 bit compatible ABI from Cavium from Sanjay Lal - Add dummy kvm_arch_init_irq_routing() The common KVM code insists on calling kvm_arch_init_irq_routing() a= s soon as it sees kernel header support for it (regardless of whether QEMU supports it). Provide a dummy function to satisfy this. - Remove request_interrupt_window code (Peter Maydell) - Remove #ifdef CONFIG_KVM where guarded by kvm_enabled() already - Removal of cps / GIC / SMP support - Minimal bootloader modified to execute safely from RAM - Create asm-mips symlink using generic code and move above default case (Peter Maydell) - Remove redundant check of target_name =3D cpu =3D mips - Remove mipsel cross compilation fix, which is now fixed by commit 61cc919f73ea (configure: detect endian via compile test) - Add translation of guest kernel segments to allow an attached gdb to see kernel memory correctly James Hogan (5): target-mips: get_physical_address: Add defines for segment bases target-mips: get_physical_address: Add KVM awareness kvm: Allow arch to set sigmask length hw/mips: malta: Add KVM support MAINTAINERS: Add entry for MIPS KVM Sanjay Lal (5): hw/mips/cputimer: Don't start periodic timer in KVM mode hw/mips: Add API to convert KVM guest KSEG0 <-> GPA target-mips: kvm: Add main KVM support for MIPS hw/mips: In KVM mode, inject IRQ2 (I/O) interupts via ioctls target-mips: Enable KVM support in build system MAINTAINERS | 5 + configure | 6 +- hw/mips/addr.c | 10 + hw/mips/cputimer.c | 13 +- hw/mips/mips_int.c | 11 ++ hw/mips/mips_malta.c | 82 +++++--- include/hw/mips/cpudevs.h | 4 + include/sysemu/kvm.h | 2 + kvm-all.c | 11 +- target-mips/Makefile.objs | 1 + target-mips/helper.c | 51 +++-- target-mips/kvm.c | 472 ++++++++++++++++++++++++++++++++++++++= ++++++++ target-mips/kvm_mips.h | 19 ++ 13 files changed, 647 insertions(+), 40 deletions(-) create mode 100644 target-mips/kvm.c create mode 100644 target-mips/kvm_mips.h --=20 1.8.1.2