1. 05 1月, 2022 1 次提交
  2. 01 6月, 2021 3 次提交
    • M
      KVM: arm64: vgic: Implement SW-driven deactivation · 354920e7
      Marc Zyngier 提交于
      In order to deal with these systems that do not offer HW-based
      deactivation of interrupts, let implement a SW-based approach:
      
      - When the irq is queued into a LR, treat it as a pure virtual
        interrupt and set the EOI flag in the LR.
      
      - When the interrupt state is read back from the LR, force a
        deactivation when the state is invalid (neither active nor
        pending)
      
      Interrupts requiring such treatment get the VGIC_SW_RESAMPLE flag.
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      354920e7
    • M
      KVM: arm64: vgic: move irq->get_input_level into an ops structure · db75f1a3
      Marc Zyngier 提交于
      We already have the option to attach a callback to an interrupt
      to retrieve its pending state. As we are planning to expand this
      facility, move this callback into its own data structure.
      
      This will limit the size of individual interrupts as the ops
      structures can be shared across multiple interrupts.
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      db75f1a3
    • M
      KVM: arm64: vgic: Let an interrupt controller advertise lack of HW deactivation · f6c3e24f
      Marc Zyngier 提交于
      The vGIC, as architected by ARM, allows a virtual interrupt to
      trigger the deactivation of a physical interrupt. This allows
      the following interrupt to be delivered without requiring an exit.
      
      However, some implementations have choosen not to implement this,
      meaning that we will need some unsavoury workarounds to deal with this.
      
      On detecting such a case, taint the kernel and spit a nastygram.
      We'll deal with this in later patches.
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      f6c3e24f
  3. 06 4月, 2021 1 次提交
  4. 30 11月, 2020 1 次提交
  5. 28 5月, 2020 1 次提交
  6. 24 3月, 2020 2 次提交
  7. 29 10月, 2019 3 次提交
  8. 25 8月, 2019 1 次提交
  9. 19 8月, 2019 1 次提交
  10. 05 8月, 2019 1 次提交
    • M
      KVM: arm/arm64: Sync ICH_VMCR_EL2 back when about to block · 5eeaf10e
      Marc Zyngier 提交于
      Since commit commit 328e5664 ("KVM: arm/arm64: vgic: Defer
      touching GICH_VMCR to vcpu_load/put"), we leave ICH_VMCR_EL2 (or
      its GICv2 equivalent) loaded as long as we can, only syncing it
      back when we're scheduled out.
      
      There is a small snag with that though: kvm_vgic_vcpu_pending_irq(),
      which is indirectly called from kvm_vcpu_check_block(), needs to
      evaluate the guest's view of ICC_PMR_EL1. At the point were we
      call kvm_vcpu_check_block(), the vcpu is still loaded, and whatever
      changes to PMR is not visible in memory until we do a vcpu_put().
      
      Things go really south if the guest does the following:
      
      	mov x0, #0	// or any small value masking interrupts
      	msr ICC_PMR_EL1, x0
      
      	[vcpu preempted, then rescheduled, VMCR sampled]
      
      	mov x0, #ff	// allow all interrupts
      	msr ICC_PMR_EL1, x0
      	wfi		// traps to EL2, so samping of VMCR
      
      	[interrupt arrives just after WFI]
      
      Here, the hypervisor's view of PMR is zero, while the guest has enabled
      its interrupts. kvm_vgic_vcpu_pending_irq() will then say that no
      interrupts are pending (despite an interrupt being received) and we'll
      block for no reason. If the guest doesn't have a periodic interrupt
      firing once it has blocked, it will stay there forever.
      
      To avoid this unfortuante situation, let's resync VMCR from
      kvm_arch_vcpu_blocking(), ensuring that a following kvm_vcpu_check_block()
      will observe the latest value of PMR.
      
      This has been found by booting an arm64 Linux guest with the pseudo NMI
      feature, and thus using interrupt priorities to mask interrupts instead
      of the usual PSTATE masking.
      
      Cc: stable@vger.kernel.org # 4.12
      Fixes: 328e5664 ("KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put")
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      5eeaf10e
  11. 19 6月, 2019 1 次提交
  12. 24 1月, 2019 3 次提交
  13. 12 8月, 2018 1 次提交
  14. 21 7月, 2018 3 次提交
  15. 25 5月, 2018 3 次提交
  16. 27 4月, 2018 1 次提交
    • M
      KVM: arm/arm64: vgic: Fix source vcpu issues for GICv2 SGI · 53692908
      Marc Zyngier 提交于
      Now that we make sure we don't inject multiple instances of the
      same GICv2 SGI at the same time, we've made another bug more
      obvious:
      
      If we exit with an active SGI, we completely lose track of which
      vcpu it came from. On the next entry, we restore it with 0 as a
      source, and if that wasn't the right one, too bad. While this
      doesn't seem to trouble GIC-400, the architectural model gets
      offended and doesn't deactivate the interrupt on EOI.
      
      Another connected issue is that we will happilly make pending
      an interrupt from another vcpu, overriding the above zero with
      something that is just as inconsistent. Don't do that.
      
      The final issue is that we signal a maintenance interrupt when
      no pending interrupts are present in the LR. Assuming we've fixed
      the two issues above, we end-up in a situation where we keep
      exiting as soon as we've reached the active state, and not be
      able to inject the following pending.
      
      The fix comes in 3 parts:
      - GICv2 SGIs have their source vcpu saved if they are active on
        exit, and restored on entry
      - Multi-SGIs cannot go via the Pending+Active state, as this would
        corrupt the source field
      - Multi-SGIs are converted to using MI on EOI instead of NPIE
      
      Fixes: 16ca6a60 ("KVM: arm/arm64: vgic: Don't populate multiple LRs with the same vintid")
      Reported-by: NMark Rutland <mark.rutland@arm.com>
      Tested-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NChristoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      53692908
  17. 19 3月, 2018 2 次提交
  18. 15 3月, 2018 1 次提交
    • C
      KVM: arm/arm64: Reset mapped IRQs on VM reset · 413aa807
      Christoffer Dall 提交于
      We currently don't allow resetting mapped IRQs from userspace, because
      their state is controlled by the hardware.  But we do need to reset the
      state when the VM is reset, so we provide a function for the 'owner' of
      the mapped interrupt to reset the interrupt state.
      
      Currently only the timer uses mapped interrupts, so we call this
      function from the timer reset logic.
      
      Cc: stable@vger.kernel.org
      Fixes: 4c60e360 ("KVM: arm/arm64: Provide a get_input_level for the arch timer")
      Signed-off-by: NChristoffer Dall <cdall@kernel.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      413aa807
  19. 02 1月, 2018 1 次提交
  20. 10 11月, 2017 4 次提交
  21. 07 11月, 2017 1 次提交
  22. 15 6月, 2017 1 次提交
  23. 08 6月, 2017 3 次提交