1. 01 3月, 2010 8 次提交
    • A
      KVM: PPC: Make large pages work · 4b5c9b7f
      Alexander Graf 提交于
      An SLB entry contains two pieces of information related to size:
      
        1) PTE size
        2) SLB size
      
      The L bit defines the PTE be "large" (usually means 16MB),
      SLB_VSID_B_1T defines that the SLB should span 1 GB instead of the
      default 256MB.
      
      Apparently I messed things up and just put those two in one box,
      shaked it heavily and came up with the current code which handles
      large pages incorrectly, because it also treats large page SLB entries
      as "1TB" segment entries.
      
      This patch splits those two features apart, making Linux guests boot
      even when they have > 256MB.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      4b5c9b7f
    • A
      KVM: PPC: Emulate trap SRR1 flags properly · 25a8a02d
      Alexander Graf 提交于
      Book3S needs some flags in SRR1 to get to know details about an interrupt.
      
      One such example is the trap instruction. It tells the guest kernel that
      a program interrupt is due to a trap using a bit in SRR1.
      
      This patch implements above behavior, making WARN_ON behave like WARN_ON.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      25a8a02d
    • A
      KVM: PPC: Call SLB patching code in interrupt safe manner · 021ec9c6
      Alexander Graf 提交于
      Currently we're racy when doing the transition from IR=1 to IR=0, from
      the module memory entry code to the real mode SLB switching code.
      
      To work around that I took a look at the RTAS entry code which is faced
      with a similar problem and did the same thing:
      
        A small helper in linear mapped memory that does mtmsr with IR=0 and
        then RFIs info the actual handler.
      
      Thanks to that trick we can safely take page faults in the entry code
      and only need to be really wary of what to do as of the SLB switching
      part.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      021ec9c6
    • A
      KVM: PPC: Implement 'skip instruction' mode · b4433a7c
      Alexander Graf 提交于
      To fetch the last instruction we were interrupted on, we enable DR in early
      exit code, where we are still in a very transitional phase between guest
      and host state.
      
      Most of the time this seemed to work, but another CPU can easily flush our
      TLB and HTAB which makes us go in the Linux page fault handler which totally
      breaks because we still use the guest's SLB entries.
      
      To work around that, let's introduce a second KVM guest mode that defines
      that whenever we get a trap, we don't call the Linux handler or go into
      the KVM exit code, but just jump over the faulting instruction.
      
      That way a potentially bad lwz doesn't trigger any faults and we can later
      on interpret the invalid instruction we fetched as "fetch didn't work".
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      b4433a7c
    • A
      KVM: PPC: Use PACA backed shadow vcpu · 7e57cba0
      Alexander Graf 提交于
      We're being horribly racy right now. All the entry and exit code hijacks
      random fields from the PACA that could easily be used by different code in
      case we get interrupted, for example by a #MC or even page fault.
      
      After discussing this with Ben, we figured it's best to reserve some more
      space in the PACA and just shove off some vcpu state to there.
      
      That way we can drastically improve the readability of the code, make it
      less racy and less complex.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      7e57cba0
    • A
      KVM: PPC: Add helpers for CR, XER · 992b5b29
      Alexander Graf 提交于
      We now have helpers for the GPRs, so let's also add some for CR and XER.
      
      Having them in the PACA simplifies code a lot, as we don't need to care
      about where to store CC or not to overflow any integers.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      992b5b29
    • A
      KVM: PPC: Use accessor functions for GPR access · 8e5b26b5
      Alexander Graf 提交于
      All code in PPC KVM currently accesses gprs in the vcpu struct directly.
      
      While there's nothing wrong with that wrt the current way gprs are stored
      and loaded, it doesn't suffice for the PACA acceleration that will follow
      in this patchset.
      
      So let's just create little wrapper inline functions that we call whenever
      a GPR needs to be read from or written to. The compiled code shouldn't really
      change at all for now.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      8e5b26b5
    • A
      KVM: powerpc: Improve DEC handling · 7706664d
      Alexander Graf 提交于
      We treated the DEC interrupt like an edge based one. This is not true for
      Book3s. The DEC keeps firing until mtdec is issued again and thus clears
      the interrupt line.
      
      So let's implement this logic in KVM too. This patch moves the line clearing
      from the firing of the interrupt to the mtdec emulation.
      
      This makes PPC64 guests work without AGGRESSIVE_DEC defined.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NAcked-by: Hollis Blanchard <hollis@penguinppc.org>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      7706664d
  2. 26 2月, 2010 1 次提交
    • B
      powerpc: Fix lwsync feature fixup vs. modules on 64-bit · 3d98ffbf
      Benjamin Herrenschmidt 提交于
      Anton's commit enabling the use of the lwsync fixup mechanism on 64-bit
      breaks modules. The lwsync fixup section uses .long instead of the
      FTR_ENTRY_OFFSET macro used by other fixups sections, and thus will
      generate 32-bit relocations that our module loader cannot resolve.
      
      This changes it to use the same type as other feature sections.
      
      Note however that we might want to consider using 32-bit for all the
      feature fixup offsets and add support for R_PPC_REL32 to module_64.c
      instead as that would reduce the size of the kernel image. I'll leave
      that as an exercise for the reader for now...
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      3d98ffbf
  3. 19 2月, 2010 2 次提交
  4. 17 2月, 2010 13 次提交
  5. 15 2月, 2010 1 次提交
  6. 14 2月, 2010 2 次提交
  7. 09 2月, 2010 2 次提交
  8. 03 2月, 2010 2 次提交
  9. 01 2月, 2010 1 次提交
  10. 15 1月, 2010 1 次提交
    • A
      powerpc: cpumask_of_node() should handle -1 as a node · c81b812a
      Anton Blanchard 提交于
      pcibus_to_node can return -1 if we cannot determine which node a pci bus
      is on. If passed -1, cpumask_of_node will negatively index the lookup array
      and pull in random data:
      
      # cat /sys/devices/pci0000:00/0000:00:01.0/local_cpus
      00000000,00000003,00000000,00000000
      # cat /sys/devices/pci0000:00/0000:00:01.0/local_cpulist
      64-65
      
      Change cpumask_of_node to check for -1 and return cpu_all_mask in this
      case:
      
      # cat /sys/devices/pci0000:00/0000:00:01.0/local_cpus
      ffffffff,ffffffff,ffffffff,ffffffff
      # cat /sys/devices/pci0000:00/0000:00:01.0/local_cpulist
      0-127
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c81b812a
  11. 18 12月, 2009 1 次提交
  12. 16 12月, 2009 3 次提交
  13. 15 12月, 2009 3 次提交