Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4641000imu; Tue, 29 Jan 2019 05:11:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN4DkCMygUvUGFWrJG46s3RwlXJEA7ecEhPXWuXjhc9Yf2gKfwpjKW8uwplyGNmQ5WayRp9j X-Received: by 2002:a17:902:784d:: with SMTP id e13mr26361509pln.188.1548767474966; Tue, 29 Jan 2019 05:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548767474; cv=none; d=google.com; s=arc-20160816; b=wDt7mKDDbA+xoGaEfW4F5/V0HB+bDelGdq5EwrFIoQhOuSiDiafQGePv0d5/XdY3Ac IDv/VZKSSDTQE5LnLmCyhm06UJGDMfNbswRs0jclCXJgbSbBqmCJ1jQgrIi5cG7uHz+u /er/9DZJJJelSW0ohsHMfbodRc1KmNwI0a0ledBek+btwUrZOy83tW5sVzV8Gh7u7dK+ LpUDYm8h6hAE5RlzQGn/R9faiZ+GqHIzA+h4TFZY5ZBcUh8W6CtyQqyDgP1LMsn4n8Jh 36vaShmTOjRebgdnsxj9Dp7JjaWvnn5BiX1vrTNueiCffN3jdY50qI3GyGlykJvpVoLp 2dCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=jXX03mXOROgMKjxAvlLPdwqqExV6RH47m1wTnSwOzIQ=; b=gAsf09ypO3Y03bOqMqAMJCSL58yh7LxmdAXEoT+p4HdGCj7/2iuV5xFSOMM4jGUhBv ZxLAmvVpH1L/nfamex7LraLQ8BC5dODbH226OaYE5p6ROl4D3qOCUEiPEfvY3VpM+RAf SmFMB1K1DmqwzTXcwqa1K52dpNJPopIeD9YOIj+90XJlwAKpEhLkZRLk3ACsShJyectY wRgdoMs4u8c3VAP+86PTQO4joNAIslAqUnhumpXOiRB/1Hvf3CbH6w5g0lt4bkoyk688 KSenuVKOCUJjJTOx92RVvHkN5N0KWnNX2dj53V1EZVYoveviKjCipZAcpVPU4h+oRYTP RarQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si34257180pgg.522.2019.01.29.05.10.58; Tue, 29 Jan 2019 05:11:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727416AbfA2NJL (ORCPT + 99 others); Tue, 29 Jan 2019 08:09:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49314 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbfA2NJL (ORCPT ); Tue, 29 Jan 2019 08:09:11 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3941D88E48; Tue, 29 Jan 2019 13:09:10 +0000 (UTC) Received: from gondolin (dhcp-192-213.str.redhat.com [10.33.192.213]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57FE1600C6; Tue, 29 Jan 2019 13:09:08 +0000 (UTC) Date: Tue, 29 Jan 2019 14:09:05 +0100 From: Cornelia Huck To: Michael Mueller Cc: KVM Mailing List , Linux-S390 Mailing List , linux-kernel@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Christian Borntraeger , Janosch Frank , David Hildenbrand , Halil Pasic , Pierre Morel Subject: Re: [PATCH v6 11/13] KVM: s390: add functions to (un)register GISC with GISA Message-ID: <20190129140905.288d750a.cohuck@redhat.com> In-Reply-To: <20190124125939.130763-12-mimu@linux.ibm.com> References: <20190124125939.130763-1-mimu@linux.ibm.com> <20190124125939.130763-12-mimu@linux.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 29 Jan 2019 13:09:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jan 2019 13:59:37 +0100 Michael Mueller wrote: > Add the Interruption Alert Mask (IAM) to the architecture specific > kvm struct. This mask in the GISA is used to define for which ISC > a GIB alert will be issued. > > The functions kvm_s390_gisc_register() and kvm_s390_gisc_unregister() > are used to (un)register a GISC (guest ISC) with a virtual machine and > its GISA. > > Upon successful completion, kvm_s390_gisc_register() returns the > ISC to be used for GIB alert interruptions. A negative return code > indicates an error during registration. > > Theses functions will be used by other adapter types like AP and PCI to > request pass-through interruption support. > > Signed-off-by: Michael Mueller > --- > arch/s390/include/asm/kvm_host.h | 13 +++++ > arch/s390/kvm/interrupt.c | 117 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 130 insertions(+) > > +int kvm_s390_gisc_register(struct kvm *kvm, u32 gisc) > +{ > + struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int; > + u8 alert_mask; > + > + if (!gi->origin) > + return -ENODEV; > + if (gisc > MAX_ISC) > + return -ERANGE; > + > + spin_lock(&gi->alert.ref_lock); > + if (gi->alert.ref_count[gisc] == 0) { If the ref_count is 0 here... > + alert_mask = gi->alert.mask | 0x80 >> gisc; > + WRITE_ONCE(gi->alert.mask, alert_mask); > + } > + gi->alert.ref_count[gisc]++; > + if (gi->alert.ref_count[gisc] == 1) ...it will certainly be 1 here, won't it? Can you do all of the manipulations in a single if branch? > + gisa_set_iam(gi->origin, alert_mask); > + spin_unlock(&gi->alert.ref_lock); > + > + return gib->nisc; > +}