19 May, 2010

8 commits


17 May, 2010

32 commits

  • Reported by Andrew Jones.

    Signed-off-by: Avi Kivity
    Signed-off-by: Marcelo Tosatti

    Avi Kivity
     
  • Acked-by: Pekka Enberg
    Signed-off-by: Avi Kivity
    Signed-off-by: Marcelo Tosatti

    Avi Kivity
     
  • sp->unsync is bool now, so update trace event declaration.

    Signed-off-by: Gui Jianfeng
    Signed-off-by: Marcelo Tosatti

    Gui Jianfeng
     
  • This patch prevents MCE intercepts from being propagated
    into the L1 guest if they happened in an L2 guest.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • This patch adds logic to kvm/x86 which allows to mark an
    injected exception as reinjected. This allows to remove an
    ugly hack from svm_complete_interrupts that prevented
    exceptions from being reinjected at all in the nested case.
    The hack was necessary because an reinjected exception into
    the nested guest could cause a nested vmexit emulation. But
    reinjected exceptions must not intercept. The downside of
    the hack is that a exception that in injected could get
    lost.
    This patch fixes the problem and puts the code for it into
    generic x86 files because. Nested-VMX will likely have the
    same problem and could reuse the code.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • This patch implements the reporting of the emulated SVM
    features to userspace instead of the real hardware
    capabilities. Every real hardware capability needs emulation
    in nested svm so the old behavior was broken.

    Cc: stable@kernel.org
    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • This patch adds the get_supported_cpuid callback to
    kvm_x86_ops. It will be used in do_cpuid_ent to delegate the
    decission about some supported cpuid bits to the
    architecture modules.

    Cc: stable@kernel.org
    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • This patch implements propagation of a failes guest vmrun
    back into the guest instead of killing the whole guest.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • This patch syncs cr0 and cr3 from the vmcb to the kvm state
    before nested intercept handling is done. This allows to
    simplify the vmexit path.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • This patch fixes a bug where a nested guest always went over
    the same instruction because the rip was not advanced on a
    nested vmexit.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • The patch introducing nested nmi handling had a bug. The
    check does not belong to enable_nmi_window but must be in
    nmi_allowed. This patch fixes this.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Avi Kivity

    Joerg Roedel
     
  • Signed-off-by: Avi Kivity

    Avi Kivity
     
  • As Avi pointed out, testing bit part in mark_page_dirty() was important
    in the days of shadow paging, but currently EPT and NPT has already become
    common and the chance of faulting a page more that once per iteration is
    small. So let's remove the test bit to avoid extra access.

    Signed-off-by: Takuya Yoshikawa
    Signed-off-by: Avi Kivity

    Takuya Yoshikawa
     
  • Signed-off-by: Avi Kivity

    Avi Kivity
     
  • Fix bug of the exception path, free allocated vpid when fail
    to create vcpu.

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Avi Kivity

    Lai Jiangshan
     
  • When we're on a paired single capable host, we can just always enable
    paired singles and expose them to the guest directly.

    This approach breaks when multiple VMs run and access PS concurrently,
    but this should suffice until we get a proper framework for it in Linux.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • For KVM we need to find the location of the HTAB. We can either rely
    on internal data structures of the kernel or ask the hardware.

    Ben issued complaints about the internal data structure method, so
    let's switch it to our own inquiry of the HTAB. Now we're fully
    independend :-).

    CC: Benjamin Herrenschmidt
    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • We have some debug output in Book3S_64. Some of that was invalid though,
    partially not even compiling because it accessed incorrect variables.

    So let's fix that up, making debugging more fun again.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • Book3S_64 didn't set VSID_PR when we're in PR=1. This lead to pretty bad
    behavior when searching for the shadow segment, as part of the code relied
    on VSID_PR being set.

    This patch fixes booting Book3S_64 guests.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • We have a condition in the ppc64 host mmu code that should never occur.
    Unfortunately, it just did happen to me and I was rather puzzled on why,
    because BUG_ON doesn't tell me anything useful.

    So let's add some more debug output in case this goes wrong. Also change
    BUG to WARN, since I don't want to reboot every time I mess something up.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • In the process of merging Book3S_32 and 64 I somehow ended up having the
    alignment interrupt handler take last_inst, but the fetching code not
    fetching it. So we ended up with stale last_inst values.

    Let's just enable last_inst fetching for alignment interrupts too.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • When in split mode, instruction relocation and data relocation are not equal.

    So far we implemented this mode by reserving a special pseudo-VSID for the
    two cases and flushing all PTEs when going into split mode, which is slow.

    Unfortunately 32bit Linux and Mac OS X use split mode extensively. So to not
    slow down things too much, I came up with a different idea: Mark the split
    mode with a bit in the VSID and then treat it like any other segment.

    This means we can just flush the shadow segment cache, but keep the PTEs
    intact. I verified that this works with ppc32 Linux and Mac OS X 10.4
    guests and does speed them up.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • When we get a performance counter interrupt we need to route it on to the
    Linux handler after we got out of the guest context. We also need to tell
    our handling code that this particular interrupt doesn't need treatment.

    So let's add those two bits in, making perf work while having a KVM guest
    running.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • There are some pieces in the code that I overlooked that still use
    u64s instead of longs. This slows down 32 bit hosts unnecessarily, so
    let's just move them to ulong.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • Now that we have all the bits and pieces in place, let's enable building
    of the Book3S_32 target.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • When an interrupt occurs we don't know yet if we're in guest context or
    in host context. When in guest context, KVM needs to handle it.

    So let's pull the same trick we did on Book3S_64: Just add a macro to
    determine if we're in guest context or not and if so jump on to KVM code.

    CC: Benjamin Herrenschmidt
    Signed-off-by: Alexander Graf
    Acked-by: Benjamin Herrenschmidt
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • We have a define on what the highest bit of IRQ priorities is. So we can
    just as well use it in the bit checking code and avoid invalid IRQ values
    to be triggered.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • We need the SWITCH_FRAME_SIZE define on Book3S_32 now too.
    So let's export it unconditionally.

    CC: Benjamin Herrenschmidt
    Signed-off-by: Alexander Graf
    Acked-by: Benjamin Herrenschmidt
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • Our shadow MMU code needs to know where the HTAB is located and how
    big it is. So we need some variables from the kernel exported to
    module space if KVM is built as a module.

    CC: Benjamin Herrenschmidt
    Signed-off-by: Alexander Graf
    Acked-by: Benjamin Herrenschmidt
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • Some code we had so far required defines and had code that was completely
    Book3S_64 specific. Since we now opened book3s.c to Book3S_32 too, we need
    to take care of these pieces.

    So let's add some minor code where it makes sense to not go the Book3S_64
    code paths and add compat defines on others.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • Book3S_32 doesn't know about segment faults. It only knows about page faults.
    So in order to know that we didn't map a segment, we need to fake segment
    faults.

    We do this by setting invalid segment registers to an invalid VSID and then
    check for that VSID on normal page faults.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf
     
  • We need to keep the pointer to the shadow vcpu somewhere accessible from
    within really early interrupt code. The best fit I found was the thread
    struct, as that resides in an SPRG.

    So let's put a pointer to the shadow vcpu in the thread struct and add
    an asm-offset so we can find it.

    Signed-off-by: Alexander Graf
    Signed-off-by: Avi Kivity

    Alexander Graf