The function atomically returns the address of the first GISA of this list and stores a zero address in the origin list field of the GIB instead. The GIB alert list contains all GISAs that have pending adapter interruptions. Signed-off-by: Michael Mueller <mimu@xxxxxxxxxxxxx> Reviewed-by: Pierre Morel <pmorel@xxxxxxxxxxxxx> --- arch/s390/kvm/interrupt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 56d431508435..fc9eae499319 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -2882,6 +2882,20 @@ int kvm_s390_get_irq_state(struct kvm_vcpu *vcpu, __u8 __user *buf, int len) return n; } +static struct kvm_s390_gisa __maybe_unused *unlink_gib_alert_list(void) +{ + u32 gisa; + + if (!gib) + return NULL; + + do { + gisa = READ_ONCE(gib->alert_list_origin); + } while (cmpxchg(&gib->alert_list_origin, gisa, 0) != gisa); + + return (void *)(u64) gisa; +} + static void nullify_gisa(struct kvm_s390_gisa *gisa) { memset(gisa, 0, sizeof(struct kvm_s390_gisa)); -- 2.13.4