1. 10 8月, 2016 1 次提交
    • C
      KVM: arm64: vgic-its: Handle errors from vgic_add_lpi · 99e5e886
      Christoffer Dall 提交于
      During low memory conditions, we could be dereferencing a NULL pointer
      when vgic_add_lpi fails to allocate memory.
      
      Consider for example this call sequence:
      
        vgic_its_cmd_handle_mapi
            itte->irq = vgic_add_lpi(kvm, lpi_nr);
                update_lpi_config(kvm, itte->irq, NULL);
                    ret = kvm_read_guest(kvm, propbase + irq->intid
      	                                             ^^^^
      						     kaboom?
      
      Instead, return an error pointer from vgic_add_lpi and check the return
      value from its single caller.
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      99e5e886
  2. 09 8月, 2016 1 次提交
  3. 24 7月, 2016 1 次提交
  4. 23 7月, 2016 2 次提交
    • E
      KVM: arm/arm64: Enable MSI routing · 995a0ee9
      Eric Auger 提交于
      Up to now, only irqchip routing entries could be set. This patch
      adds the capability to insert MSI routing entries.
      
      For ARM64, let's also increase KVM_MAX_IRQ_ROUTES to 4096: this
      include SPI irqchip routes plus MSI routes. In the future this
      might be extended.
      Signed-off-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      995a0ee9
    • E
      KVM: arm/arm64: Enable irqchip routing · 180ae7b1
      Eric Auger 提交于
      This patch adds compilation and link against irqchip.
      
      Main motivation behind using irqchip code is to enable MSI
      routing code. In the future irqchip routing may also be useful
      when targeting multiple irqchips.
      
      Routing standard callbacks now are implemented in vgic-irqfd:
      - kvm_set_routing_entry
      - kvm_set_irq
      - kvm_set_msi
      
      They only are supported with new_vgic code.
      
      Both HAVE_KVM_IRQCHIP and HAVE_KVM_IRQ_ROUTING are defined.
      KVM_CAP_IRQ_ROUTING is advertised and KVM_SET_GSI_ROUTING is allowed.
      
      So from now on IRQCHIP routing is enabled and a routing table entry
      must exist for irqfd injection to succeed for a given SPI. This patch
      builds a default flat irqchip routing table (gsi=irqchip.pin) covering
      all the VGIC SPI indexes. This routing table is overwritten by the
      first first user-space call to KVM_SET_GSI_ROUTING ioctl.
      
      MSI routing setup is not yet allowed.
      Signed-off-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      180ae7b1
  5. 19 7月, 2016 25 次提交
  6. 15 7月, 2016 3 次提交
  7. 04 7月, 2016 1 次提交
    • M
      KVM: arm/arm64: The GIC is dead, long live the GIC · 50926d82
      Marc Zyngier 提交于
      I don't think any single piece of the KVM/ARM code ever generated
      as much hatred as the GIC emulation.
      
      It was written by someone who had zero experience in modeling
      hardware (me), was riddled with design flaws, should have been
      scrapped and rewritten from scratch long before having a remote
      chance of reaching mainline, and yet we supported it for a good
      three years. No need to mention the names of those who suffered,
      the git log is singing their praises.
      
      Thankfully, we now have a much more maintainable implementation,
      and we can safely put the grumpy old GIC to rest.
      
      Fellow hackers, please raise your glass in memory of the GIC:
      
      	The GIC is dead, long live the GIC!
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      50926d82
  8. 02 6月, 2016 1 次提交
    • M
      KVM: arm/arm64: vgic-new: Removel harmful BUG_ON · 05fb05a6
      Marc Zyngier 提交于
      When changing the active bit from an MMIO trap, we decide to
      explode if the intid is that of a private interrupt.
      
      This flawed logic comes from the fact that we were assuming that
      kvm_vcpu_kick() as called by kvm_arm_halt_vcpu() would not return before
      the called vcpu responded, but this is not the case, so we need to
      perform this wait even for private interrupts.
      
      Dropping the BUG_ON seems like the right thing to do.
      
       [ Commit message tweaked by Christoffer ]
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      05fb05a6
  9. 31 5月, 2016 3 次提交
  10. 20 5月, 2016 2 次提交
    • C
      KVM: arm/arm64: vgic-new: Synchronize changes to active state · 35a2d585
      Christoffer Dall 提交于
      When modifying the active state of an interrupt via the MMIO interface,
      we should ensure that the write has the intended effect.
      
      If a guest sets an interrupt to active, but that interrupt is already
      flushed into a list register on a running VCPU, then that VCPU will
      write the active state back into the struct vgic_irq upon returning from
      the guest and syncing its state.  This is a non-benign race, because the
      guest can observe that an interrupt is not active, and it can have a
      reasonable expectations that other VCPUs will not ack any IRQs, and then
      set the state to active, and expect it to stay that way.  Currently we
      are not honoring this case.
      
      Thefore, change both the SACTIVE and CACTIVE mmio handlers to stop the
      world, change the irq state, potentially queue the irq if we're setting
      it to active, and then continue.
      
      We take this chance to slightly optimize these functions by not stopping
      the world when touching private interrupts where there is inherently no
      possible race.
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      35a2d585
    • A
      KVM: arm/arm64: vgic-new: enable build · efffe55a
      Andre Przywara 提交于
      Now that the new VGIC implementation has reached feature parity with
      the old one, add the new files to the build system and add a Kconfig
      option to switch between the two versions.
      We set the default to the new version to get maximum test coverage,
      in case people experience problems they can switch back to the old
      behaviour if needed.
      Signed-off-by: NAndre Przywara <andre.przywara@arm.com>
      Acked-by: NChristoffer Dall <christoffer.dall@linaro.org>
      efffe55a