Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2053403pxu; Tue, 24 Nov 2020 16:00:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxdKKQ1Zj1Nz+C++a8oShxThfrJewTuoxGXTYUGEn9EaWhK+H9LjVRzeLYCHn79K6IePfj X-Received: by 2002:a50:b002:: with SMTP id i2mr1002009edd.99.1606262451921; Tue, 24 Nov 2020 16:00:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606262451; cv=none; d=google.com; s=arc-20160816; b=CiLfPXa7LDNHTT4pCGLo+0rg3yAbM4brljAWLq2QYstZMRfKeVdWDkKkkXAfe/VqjS jDkFFJmhLnLH3ze6tYdEEjPiGI25z5asoaP8v6wjqrft/zPKxwvtbdJrQSQhvf+A7js2 9FozMkgI2xsfaIJ3Soznp/FxSgXleJwmCVjTo9K9+KubVQvlFrwsCqDXHSvzGHTtwxpj mFKf3FB0KyFgcDAxv0Amy+TDrkzNJiNPk1C7WUWebQKFIi77J4PH6BFXXH1ZubWFxpKV 5Bu7QJLQqKlqXNpePI4Cb/f6D31bvA7VuauoW7a6E0kow10gg7dqwNKjOER2n7S0zewA a0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AR/vphwHzDY6wfF8ZTQE7lrRA0wLLV4wrEDpc0i6TuQ=; b=UoNAiAUf9MZTAW1xnDPE+LZOO1JxOISqTamDYci+RtS0CIk6GMeiOKSmxhT3nRHzCd mNyUT57lBmUGXFFyAcxZ/3+SM8Cgm0AqxC6HYgyVEUEjBAPutb7u+mSZBR7w/kYYVdvL sRNUb5lOvZ84l1twctyjAjAtml2bLuv/lrtH8DUafMscTMiE0Izf4J6x09GSmBhn65J5 CvD81s/MUNu74IXDKQhWgoGBGeE/DJydsXSoZQCjG0Kgb7rI0U24igdYh+ElzWXyKLSZ DFyzTYUTlfKtbKeRm3Jq1wJVte50EsKUexC1F1+dgYdxsSIfkTuMfthaOcJNM+MueNuF JN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kddRdnzj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw23si263262ejb.525.2020.11.24.16.00.29; Tue, 24 Nov 2020 16:00:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kddRdnzj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732982AbgKXVkh (ORCPT + 99 others); Tue, 24 Nov 2020 16:40:37 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:23624 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732876AbgKXVkg (ORCPT ); Tue, 24 Nov 2020 16:40:36 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AOLWOlM092455; Tue, 24 Nov 2020 16:40:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=AR/vphwHzDY6wfF8ZTQE7lrRA0wLLV4wrEDpc0i6TuQ=; b=kddRdnzjGpojQrOaNjH3AvVuXGH5t5/KpOQde9yeXRZpKP8nhCxTl+1rG99lzUx5cdSN vJjlQ0JYsd41gdJC1pgvzgkHCEQzyDxhMVSI2MKD9hDnaoxstJsZXwiKS5YtmAkncb45 3EP66RdBahwM+w/svawexI2lJU7Nkrap42/Ks9bmwQYakbE9rID0H8Zrkj4KVioUmyXq o2vc06fn5umv47dz+BeTR0hNO234Lvnel6r4yD4+BfxIzCXk4Ze2pivc/M/oqFR2pwe5 Ht8ZsWpHlJ1udQAw6Dc8G6M8G529J7F7WoMv1LmYs+4GZteC48IH1rYXYz85PDWWEF96 8g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 34yghsjs4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Nov 2020 16:40:32 -0500 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0AOLWdBx093185; Tue, 24 Nov 2020 16:40:31 -0500 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 34yghsjs49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Nov 2020 16:40:31 -0500 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AOLbRIJ009370; Tue, 24 Nov 2020 21:40:30 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma02wdc.us.ibm.com with ESMTP id 34xth92kpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Nov 2020 21:40:30 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AOLeS0G38404398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Nov 2020 21:40:28 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A227BAE05C; Tue, 24 Nov 2020 21:40:28 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5D9DAE063; Tue, 24 Nov 2020 21:40:27 +0000 (GMT) Received: from cpe-66-24-58-13.stny.res.rr.com.com (unknown [9.85.195.249]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 24 Nov 2020 21:40:27 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com, frankja@linux.ibm.com, david@redhat.com, hca@linux.ibm.com, gor@linux.ibm.com, Tony Krowiak , Tony Krowiak Subject: [PATCH v12 02/17] s390/vfio-ap: decrement reference count to KVM Date: Tue, 24 Nov 2020 16:40:01 -0500 Message-Id: <20201124214016.3013-3-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20201124214016.3013-1-akrowiak@linux.ibm.com> References: <20201124214016.3013-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-24_08:2020-11-24,2020-11-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=3 bulkscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 malwarescore=0 clxscore=1015 phishscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011240125 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Decrement the reference count to KVM when notified that KVM pointer is invalidated via the vfio group notifier. Signed-off-by: Tony Krowiak Signed-off-by: Tony Krowiak --- drivers/s390/crypto/vfio_ap_ops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 66fd9784a156..31e39c1f6e56 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1095,7 +1095,11 @@ static int vfio_ap_mdev_group_notifier(struct notifier_block *nb, matrix_mdev = container_of(nb, struct ap_matrix_mdev, group_notifier); if (!data) { + if (matrix_mdev->kvm) + kvm_put_kvm(matrix_mdev->kvm); + matrix_mdev->kvm = NULL; + return NOTIFY_OK; } -- 2.21.1