kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] KVM: selftests: aarch64: Test userspace IRQ injection
@ 2021-11-09  2:38 Ricardo Koller
  2021-11-09  2:38 ` [PATCH 01/17] KVM: selftests: aarch64: move gic_v3.h to shared headers Ricardo Koller
                   ` (18 more replies)
  0 siblings, 19 replies; 23+ messages in thread
From: Ricardo Koller @ 2021-11-09  2:38 UTC (permalink / raw)
  To: kvm, maz, kvmarm, drjones, eric.auger, alexandru.elisei
  Cc: Paolo Bonzini, oupton, james.morse, suzuki.poulose, shuah,
	jingzhangos, pshier, rananta, reijiw, Ricardo Koller

This series adds a new test, aarch64/vgic-irq, that validates the injection of
different types of IRQs from userspace using various methods and configurations
(when applicable):

    Intid        Method     |       |          Configuration
                            |       |
               IRQ_LINE     |       |
    SGI        LEVEL_INFO   |       |
    PPI    x   IRQFD        |   x   | level-sensitive  x  EOIR + DIR
    SPI        ISPENDR      |       | edge-triggered      EOIR only
    bogus      ISACTIVER    |       |
                            |       |

vgic-irq is implemented by having a single vcpu started in any of the 4 (2x2)
configurations above.  The guest then "asks" userspace to inject all intids of
a given IRQ type using each applicable method via a GUEST_SYNC call.  The
applicable methods and intids for a given configuration are specified in tables
like this one:

    /* edge-triggered */
    static struct kvm_inject_desc inject_edge_fns[] = {
            /*                            sgi    ppi    spi */
            { KVM_IRQ_LINE,               false, false, true },
            { IRQFD,                      false, false, true },
            { ISPENDR,                    true,  false, true },
    };

Based on the (example) table above, a guest running in an edge-triggered
configuration will try injecting SGIs and SPIs.  The specific methods are also
given in the table, e.g.: SGIs are injected from userspace by writing into the
ISPENDR register.

This test also adds some extra edge tests like: IRQ preemption, restoring
active IRQs, trying to inject bogus intid's (e.g., above the configured KVM
nr_irqs).

Note that vgic-irq is currently limited to a single vcpu, GICv3, and does not
test the vITS (no MSIs).

- Commits 1-3 add some GICv3 library functions on the guest side, e.g.: set the
  priority of an IRQ.
- Commits 4-5 add some vGICv3 library functions on the userspace side, e.g.: a
  wrapper for KVM_IRQ_LINE.
- Commit 6 adds the basic version of this test: inject an SPI using
  KVM_IRQ_LINE.
- Commits 7-17 add other IRQs types, methods and configurations.

Ricardo Koller (17):
  KVM: selftests: aarch64: move gic_v3.h to shared headers
  KVM: selftests: aarch64: add function for accessing GICv3 dist and
    redist registers
  KVM: selftests: aarch64: add GICv3 register accessor library functions
  KVM: selftests: add kvm_irq_line library function
  KVM: selftests: aarch64: add vGIC library functions to deal with vIRQ
    state
  KVM: selftests: aarch64: add vgic_irq to test userspace IRQ injection
  KVM: selftests: aarch64: abstract the injection functions in vgic_irq
  KVM: selftests: aarch64: cmdline arg to set number of IRQs in vgic_irq
    test
  KVM: selftests: aarch64: cmdline arg to set EOI mode in vgic_irq
  KVM: selftests: aarch64: add preemption tests in vgic_irq
  KVM: selftests: aarch64: level-sensitive interrupts tests in vgic_irq
  KVM: selftests: aarch64: add tests for LEVEL_INFO in vgic_irq
  KVM: selftests: aarch64: add test_inject_fail to vgic_irq
  KVM: selftests: add IRQ GSI routing library functions
  KVM: selftests: aarch64: add tests for IRQFD in vgic_irq
  KVM: selftests: aarch64: add ISPENDR write tests in vgic_irq
  KVM: selftests: aarch64: add test for restoring active IRQs

 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/aarch64/arch_timer.c        |   2 +-
 .../testing/selftests/kvm/aarch64/vgic_irq.c  | 853 ++++++++++++++++++
 .../selftests/kvm/include/aarch64/gic.h       |  26 +
 .../kvm/{lib => include}/aarch64/gic_v3.h     |  12 +
 .../selftests/kvm/include/aarch64/vgic.h      |  18 +-
 .../testing/selftests/kvm/include/kvm_util.h  |  10 +
 tools/testing/selftests/kvm/lib/aarch64/gic.c |  66 ++
 .../selftests/kvm/lib/aarch64/gic_private.h   |  11 +
 .../selftests/kvm/lib/aarch64/gic_v3.c        | 206 ++++-
 .../testing/selftests/kvm/lib/aarch64/vgic.c  | 103 ++-
 tools/testing/selftests/kvm/lib/kvm_util.c    |  72 ++
 13 files changed, 1352 insertions(+), 29 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/vgic_irq.c
 rename tools/testing/selftests/kvm/{lib => include}/aarch64/gic_v3.h (80%)

-- 
2.34.0.rc0.344.g81b53c2807-goog


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-12-28 19:57 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09  2:38 [PATCH 00/17] KVM: selftests: aarch64: Test userspace IRQ injection Ricardo Koller
2021-11-09  2:38 ` [PATCH 01/17] KVM: selftests: aarch64: move gic_v3.h to shared headers Ricardo Koller
2021-11-09  2:38 ` [PATCH 02/17] KVM: selftests: aarch64: add function for accessing GICv3 dist and redist registers Ricardo Koller
2021-11-23 15:06   ` Marc Zyngier
2021-11-25  1:55     ` Ricardo Koller
2021-11-09  2:38 ` [PATCH 03/17] KVM: selftests: aarch64: add GICv3 register accessor library functions Ricardo Koller
2021-11-09  2:38 ` [PATCH 04/17] KVM: selftests: add kvm_irq_line library function Ricardo Koller
2021-11-09  2:38 ` [PATCH 05/17] KVM: selftests: aarch64: add vGIC library functions to deal with vIRQ state Ricardo Koller
2021-11-09  2:38 ` [PATCH 06/17] KVM: selftests: aarch64: add vgic_irq to test userspace IRQ injection Ricardo Koller
2021-11-09  2:38 ` [PATCH 07/17] KVM: selftests: aarch64: abstract the injection functions in vgic_irq Ricardo Koller
2021-11-09  2:38 ` [PATCH 08/17] KVM: selftests: aarch64: cmdline arg to set number of IRQs in vgic_irq test Ricardo Koller
2021-11-09  2:38 ` [PATCH 09/17] KVM: selftests: aarch64: cmdline arg to set EOI mode in vgic_irq Ricardo Koller
2021-11-09  2:38 ` [PATCH 10/17] KVM: selftests: aarch64: add preemption tests " Ricardo Koller
2021-11-09  2:39 ` [PATCH 11/17] KVM: selftests: aarch64: level-sensitive interrupts " Ricardo Koller
2021-11-09  2:39 ` [PATCH 12/17] KVM: selftests: aarch64: add tests for LEVEL_INFO " Ricardo Koller
2021-11-09  2:39 ` [PATCH 13/17] KVM: selftests: aarch64: add test_inject_fail to vgic_irq Ricardo Koller
2021-11-09  2:39 ` [PATCH 14/17] KVM: selftests: add IRQ GSI routing library functions Ricardo Koller
2021-11-09  2:39 ` [PATCH 15/17] KVM: selftests: aarch64: add tests for IRQFD in vgic_irq Ricardo Koller
2021-11-09  2:39 ` [PATCH 16/17] KVM: selftests: aarch64: add ISPENDR write tests " Ricardo Koller
2021-11-09  2:39 ` [PATCH 17/17] KVM: selftests: aarch64: add test for restoring active IRQs Ricardo Koller
2021-11-23 14:25 ` [PATCH 00/17] KVM: selftests: aarch64: Test userspace IRQ injection Andrew Jones
2021-11-25  2:23   ` Ricardo Koller
2021-12-28 19:57 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).