1. 12 7月, 2011 1 次提交
    • A
      KVM: PPC: Resolve real-mode handlers through function exports · a22a2dac
      Alexander Graf 提交于
      Up until now, Book3S KVM had variables stored in the kernel that a kernel module
      or the kvm code in the kernel could read from to figure out where some real mode
      helper functions are located.
      
      This is all unnecessary. The high bits of the EA get ignore in real mode, so we
      can just use the pointer as is. Also, it's a lot easier on relocations when we
      use the normal way of resolving the address to a function, instead of jumping
      through hoops.
      
      This patch fixes compilation with CONFIG_RELOCATABLE=y.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a22a2dac
  2. 20 5月, 2011 1 次提交
  3. 18 3月, 2011 1 次提交
  4. 12 1月, 2011 1 次提交
  5. 24 10月, 2010 20 次提交
    • A
      KVM: PPC: Implement Level interrupts on Book3S · 17bd1580
      Alexander Graf 提交于
      The current interrupt logic is just completely broken. We get a notification
      from user space, telling us that an interrupt is there. But then user space
      expects us that we just acknowledge an interrupt once we deliver it to the
      guest.
      
      This is not how real hardware works though. On real hardware, the interrupt
      controller pulls the external interrupt line until it gets notified that the
      interrupt was received.
      
      So in reality we have two events: pulling and letting go of the interrupt line.
      
      To maintain backwards compatibility, I added a new request for the pulling
      part. The letting go part was implemented earlier already.
      
      With this in place, we can now finally start guests that do not randomly stall
      and stop to work at random times.
      
      This patch implements above logic for Book3S.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      17bd1580
    • A
      KVM: PPC: Don't put MSR_POW in MSR · 296c19d0
      Alexander Graf 提交于
      On Book3S a mtmsr with the MSR_POW bit set indicates that the OS is in
      idle and only needs to be waked up on the next interrupt.
      
      Now, unfortunately we let that bit slip into the stored MSR value which
      is not what the real CPU does, so that we ended up executing code like
      this:
      
      	r = mfmsr();
      	/* r containts MSR_POW */
      	mtmsr(r | MSR_EE);
      
      This obviously breaks, as we're going into idle mode in code sections that
      don't expect to be idling.
      
      This patch masks MSR_POW out of the stored MSR value on wakeup, making
      guests happy again.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      296c19d0
    • A
      KVM: PPC: Update int_pending also on dequeue · 9ee18b1e
      Alexander Graf 提交于
      When having a decrementor interrupt pending, the dequeuing happens manually
      through an mtdec instruction. This instruction simply calls dequeue on that
      interrupt, so the int_pending hint doesn't get updated.
      
      This patch enables updating the int_pending hint also on dequeue, thus
      correctly enabling guests to stay in guest contexts more often.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9ee18b1e
    • A
      KVM: PPC: Put segment registers in shared page · df1bfa25
      Alexander Graf 提交于
      Now that the actual mtsr doesn't do anything anymore, we can move the sr
      contents over to the shared page, so a guest can directly read and write
      its sr contents from guest context.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      df1bfa25
    • A
      KVM: PPC: Interpret SR registers on demand · 8e865178
      Alexander Graf 提交于
      Right now we're examining the contents of Book3s_32's segment registers when
      the register is written and put the interpreted contents into a struct.
      
      There are two reasons this is bad. For starters, the struct has worse real-time
      performance, as it occupies more ram. But the more important part is that with
      segment registers being interpreted from their raw values, we can put them in
      the shared page, allowing guests to mess with them directly.
      
      This patch makes the internal representation of SRs be u32s.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      8e865178
    • A
      KVM: PPC: Don't flush PTEs on NX/RO hit · 2e602847
      Alexander Graf 提交于
      When hitting a no-execute or read-only data/inst storage interrupt we were
      flushing the respective PTE so we're sure it gets properly overwritten next.
      
      According to the spec, this is unnecessary though. The guest issues a tlbie
      anyways, so we're safe to just keep the PTE around and have it manually removed
      from the guest, saving us a flush.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      2e602847
    • A
      KVM: PPC: Preload magic page when in kernel mode · 4cb6b7ea
      Alexander Graf 提交于
      When the guest jumps into kernel mode and has the magic page mapped, theres a
      very high chance that it will also use it. So let's detect that scenario and
      map the segment accordingly.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      4cb6b7ea
    • A
      KVM: PPC: Move EXIT_DEBUG partially to tracepoints · bed1ed98
      Alexander Graf 提交于
      We have a debug printk on every exit that is usually #ifdef'ed out. Using
      tracepoints makes a lot more sense here though, as they can be dynamically
      enabled.
      
      This patch converts the most commonly used debug printks of EXIT_DEBUG to
      tracepoints.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      bed1ed98
    • W
      KVM: PPC: fix leakage of error page in kvmppc_patch_dcbz() · 646bab55
      Wei Yongjun 提交于
      Add kvm_release_page_clean() after is_error_page() to avoid
      leakage of error page.
      Signed-off-by: NWei Yongjun <yjwei@cn.fujitsu.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      646bab55
    • A
      KVM: PPC: Magic Page Book3s support · e8508940
      Alexander Graf 提交于
      We need to override EA as well as PA lookups for the magic page. When the guest
      tells us to project it, the magic page overrides any guest mappings.
      
      In order to reflect that, we need to hook into all the MMU layers of KVM to
      force map the magic page if necessary.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      e8508940
    • A
      KVM: PPC: Make PAM a define · 28e83b4f
      Alexander Graf 提交于
      On PowerPC it's very normal to not support all of the physical RAM in real mode.
      To check if we're matching on the shared page or not, we need to know the limits
      so we can restrain ourselves to that range.
      
      So let's make it a define instead of open-coding it. And while at it, let's also
      increase it.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      
      v2 -> v3:
      
        - RMO -> PAM (non-magic page)
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      28e83b4f
    • A
      KVM: PPC: Tell guest about pending interrupts · 90bba358
      Alexander Graf 提交于
      When the guest turns on interrupts again, it needs to know if we have an
      interrupt pending for it. Because if so, it should rather get out of guest
      context and get the interrupt.
      
      So we introduce a new field in the shared page that we use to tell the guest
      that there's a pending interrupt lying around.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      90bba358
    • A
      KVM: PPC: Add PV guest critical sections · 5c6cedf4
      Alexander Graf 提交于
      When running in hooked code we need a way to disable interrupts without
      clobbering any interrupts or exiting out to the hypervisor.
      
      To achieve this, we have an additional critical field in the shared page. If
      that field is equal to the r1 register of the guest, it tells the hypervisor
      that we're in such a critical section and thus may not receive any interrupts.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      5c6cedf4
    • A
      KVM: PPC: Implement hypervisor interface · 2a342ed5
      Alexander Graf 提交于
      To communicate with KVM directly we need to plumb some sort of interface
      between the guest and KVM. Usually those interfaces use hypercalls.
      
      This hypercall implementation is described in the last patch of the series
      in a special documentation file. Please read that for further information.
      
      This patch implements stubs to handle KVM PPC hypercalls on the host and
      guest side alike.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      2a342ed5
    • A
      KVM: PPC: Convert SPRG[0-4] to shared page · a73a9599
      Alexander Graf 提交于
      When in kernel mode there are 4 additional registers available that are
      simple data storage. Instead of exiting to the hypervisor to read and
      write those, we can just share them with the guest using the page.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      a73a9599
    • A
      KVM: PPC: Convert SRR0 and SRR1 to shared page · de7906c3
      Alexander Graf 提交于
      The SRR0 and SRR1 registers contain cached values of the PC and MSR
      respectively. They get written to by the hypervisor when an interrupt
      occurs or directly by the kernel. They are also used to tell the rfi(d)
      instruction where to jump to.
      
      Because it only gets touched on defined events that, it's very simple to
      share with the guest. Hypervisor and guest both have full r/w access.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      de7906c3
    • A
      KVM: PPC: Convert DAR to shared page. · 5e030186
      Alexander Graf 提交于
      The DAR register contains the address a data page fault occured at. This
      register behaves pretty much like a simple data storage register that gets
      written to on data faults. There is no hypervisor interaction required on
      read or write.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      5e030186
    • A
      KVM: PPC: Convert DSISR to shared page · d562de48
      Alexander Graf 提交于
      The DSISR register contains information about a data page fault. It is fully
      read/write from inside the guest context and we don't need to worry about
      interacting based on writes of this register.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d562de48
    • A
      KVM: PPC: Convert MSR to shared page · 666e7252
      Alexander Graf 提交于
      One of the most obvious registers to share with the guest directly is the
      MSR. The MSR contains the "interrupts enabled" flag which the guest has to
      toggle in critical sections.
      
      So in order to bring the overhead of interrupt en- and disabling down, let's
      put msr into the shared page. Keep in mind that even though you can fully read
      its contents, writing to it doesn't always update all state. There are a few
      safe fields that don't require hypervisor interaction. See the documentation
      for a list of MSR bits that are safe to be set from inside the guest.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      666e7252
    • A
      KVM: PPC: Introduce shared page · 96bc451a
      Alexander Graf 提交于
      For transparent variable sharing between the hypervisor and guest, I introduce
      a shared page. This shared page will contain all the registers the guest can
      read and write safely without exiting guest context.
      
      This patch only implements the stubs required for the basic structure of the
      shared page. The actual register moving follows.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      96bc451a
  6. 01 8月, 2010 3 次提交
  7. 19 5月, 2010 3 次提交
  8. 17 5月, 2010 10 次提交