Commit d70a319b authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/kvm/uq/master' into staging



* remotes/kvm/uq/master:
  hw/mips: malta: Don't boot from flash with KVM T&E
  MAINTAINERS: Add entry for MIPS KVM
  target-mips: Enable KVM support in build system
  hw/mips: malta: Add KVM support
  hw/mips: In KVM mode, inject IRQ2 (I/O) interrupts via ioctls
  target-mips: Call kvm_mips_reset_vcpu() from mips_cpu_reset()
  target-mips: kvm: Add main KVM support for MIPS
  kvm: Allow arch to set sigmask length
  target-mips: get_physical_address: Add KVM awareness
  target-mips: get_physical_address: Add defines for segment bases
  hw/mips: Add API to convert KVM guest KSEG0 <-> GPA
  hw/mips/cputimer: Don't start periodic timer in KVM mode
  target-mips: Reset CPU timer consistently
  KVM: Fix GSI number space limit

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 0a99aae5 3c5d0be5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -176,6 +176,11 @@ M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained
F: target-arm/kvm.c

MIPS
M: James Hogan <james.hogan@imgtec.com>
S: Maintained
F: target-mips/kvm.c

PPC
M: Alexander Graf <agraf@suse.de>
S: Maintained
+5 −1
Original line number Diff line number Diff line
@@ -4828,6 +4828,9 @@ if test "$linux" = "yes" ; then
  aarch64)
    linux_arch=arm64
    ;;
  mips64)
    linux_arch=mips
    ;;
  *)
    # For most CPUs the kernel architecture name and QEMU CPU name match.
    linux_arch="$cpu"
@@ -5026,7 +5029,7 @@ case "$target_name" in
  *)
esac
case "$target_name" in
  aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
  aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
    # Make sure the target and host cpus are compatible
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
      \( "$target_name" = "$cpu" -o \
@@ -5034,6 +5037,7 @@ case "$target_name" in
      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
      \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
      echo "CONFIG_KVM=y" >> $config_target_mak
+6 −1
Original line number Diff line number Diff line
@@ -25,10 +25,15 @@

uint64_t cpu_mips_kseg0_to_phys(void *opaque, uint64_t addr)
{
    return addr & 0x7fffffffll;
    return addr & 0x1fffffffll;
}

uint64_t cpu_mips_phys_to_kseg0(void *opaque, uint64_t addr)
{
    return addr | ~0x7fffffffll;
}

uint64_t cpu_mips_kvm_um_phys_to_kseg0(void *opaque, uint64_t addr)
{
    return addr | 0x40000000ll;
}
+14 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "hw/hw.h"
#include "hw/mips/cpudevs.h"
#include "qemu/timer.h"
#include "sysemu/kvm.h"

#define TIMER_FREQ	100 * 1000 * 1000

@@ -85,7 +86,12 @@ uint32_t cpu_mips_get_count (CPUMIPSState *env)

void cpu_mips_store_count (CPUMIPSState *env, uint32_t count)
{
    if (env->CP0_Cause & (1 << CP0Ca_DC))
    /*
     * This gets called from cpu_state_reset(), potentially before timer init.
     * So env->timer may be NULL, which is also the case with KVM enabled so
     * treat timer as disabled in that case.
     */
    if (env->CP0_Cause & (1 << CP0Ca_DC) || !env->timer)
        env->CP0_Count = count;
    else {
        /* Store new count register */
@@ -141,7 +147,11 @@ static void mips_timer_cb (void *opaque)

void cpu_mips_clock_init (CPUMIPSState *env)
{
    /*
     * If we're in KVM mode, don't create the periodic timer, that is handled in
     * kernel.
     */
    if (!kvm_enabled()) {
        env->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &mips_timer_cb, env);
    env->CP0_Compare = 0;
    cpu_mips_store_count(env, 1);
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
#include "hw/hw.h"
#include "hw/mips/cpudevs.h"
#include "cpu.h"
#include "sysemu/kvm.h"
#include "kvm_mips.h"

static void cpu_mips_irq_request(void *opaque, int irq, int level)
{
@@ -35,8 +37,17 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)

    if (level) {
        env->CP0_Cause |= 1 << (irq + CP0Ca_IP);

        if (kvm_enabled() && irq == 2) {
            kvm_mips_set_interrupt(cpu, irq, level);
        }

    } else {
        env->CP0_Cause &= ~(1 << (irq + CP0Ca_IP));

        if (kvm_enabled() && irq == 2) {
            kvm_mips_set_interrupt(cpu, irq, level);
        }
    }

    if (env->CP0_Cause & CP0Ca_IP_mask) {
Loading