[v3,2/6] s390/vfio-ap: loop over the shadow APCB when filtering guest's AP configuration
Message ID | 20240111143846.8801-3-akrowiak@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-23727-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1494245dyi; Thu, 11 Jan 2024 06:43:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOxsOkoZj2uuVUCn7jjPm7Y/xTqgp3Fkmwp7SAdkOqGrvkEQ/CLlLQadYS26ixyQ/n4RXS X-Received: by 2002:a1f:f20b:0:b0:4b7:3eee:3a33 with SMTP id q11-20020a1ff20b000000b004b73eee3a33mr516137vkh.12.1704984201121; Thu, 11 Jan 2024 06:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704984201; cv=none; d=google.com; s=arc-20160816; b=DLMh6LTgnZgy9tIg2WPX5yBd3IWWCHXOzHW/cNrHnK5Zxeef7dpI9Y4PHuzkhS72EI Kk0iqaGye+h5ZkoqkXZJ8VD3WK3B8Ex333qacTvf7nrbWf8iypHtiS9KYLH+myk4sHOI fiXSC4/4czX0ewpS8xW8rGP5GJX2MEfi1LuxkQUKzueVHC1cV3dhI9kpVGQn0ZXCqXEt ZtdPgvCN4fRJzNh0OQfg46Ggr858JNJEQ3coSB4LoBoUGCWHSwedhUJK0a+sJ4U2wi9B XR0v4xrNa3UA9WuP6S55ivJztYAPlEa/CQRFSwRMmKwlwK7B5NRw8oqVJgiIWTo2Fw4V vbZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dcx+fQlNvklHss1smKNW/OV7lDvnCE6ScxETeVWqgh4=; fh=89dtS/PwPJUSahQCrBwvdQ9UYtztJf8P1g5jTeyUoxY=; b=DSXwjUOkXyK/jyuXZRED/1alMIu3FaXe5Jc8X4DMSMkBaXhsKjlfY3wA0dVMYjyhvB uLdsVrZZ/tur3gtsaXk/kobN0MyrFJUNP0MpOsO7wCZOngqXuOx069iGd8Tel+GdfFQv fZtJeQkMr5ycrsrGnc0nfzoJlZw6rimKzhJscecMm9+QRbdCEfmvnX8ZRayI+sSJyGDw HRad6JDNFKklo7bIfi5AsmU0C9A3bCWxzX8zogN5KdoZuyJbilKvaql4n3g5GNqwJgXU oxDfymbjfCiuBjfgkHxrnaLHE22Bp94S0LDa2kL2kFFD8W5YmUjBt6JCUmRX+EntfU3h wZoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=a1MFfxgh; spf=pass (google.com: domain of linux-kernel+bounces-23727-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23727-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p18-20020a056122115200b004b7545f10d7si144392vko.266.2024.01.11.06.43.21 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 06:43:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23727-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=a1MFfxgh; spf=pass (google.com: domain of linux-kernel+bounces-23727-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23727-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E0E751C21B23 for <ouuuleilei@gmail.com>; Thu, 11 Jan 2024 14:43:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A8284EB3D; Thu, 11 Jan 2024 14:42:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="a1MFfxgh" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55A814C609; Thu, 11 Jan 2024 14:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40BEgDC8001664; Thu, 11 Jan 2024 14:42:22 GMT 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=dcx+fQlNvklHss1smKNW/OV7lDvnCE6ScxETeVWqgh4=; b=a1MFfxgh8WGzF5PCgIcgKeXWdievSacns+YE4b6220XP6YNv+ZeSA6HmQTu+8HQPY05E LxxV3t/22BfMOvcxTGJo5HQtDTJl3KCQxcuQ3vK4K1BZjwd+Zq+p7q+W4bGY5U1btt/J MLn07cpX8aMVjmY6uCtcaib6xYv9sDy9dXoWcmq3BFKtqDr3fpYaKaEWiAfD8TWM/0cW xdjfJopD90TwoQ1G7LIlMf7+PQrKm2r+FdQD3h17DBS6FqK3/BAB1GO7lM+2xWYDRf4J TneQxwz1fKq+maGLyF3xCcXHNEqKcg8NWszHqNUrmWzVDJvoVFTX2170atxbrTu+Qrgz PA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vjbejtynd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 14:42:21 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40BEgK5t002233; Thu, 11 Jan 2024 14:42:20 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vjbejtyek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 14:42:20 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 40BCZ6cX004407; Thu, 11 Jan 2024 14:38:52 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vfjpm3tv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 14:38:52 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 40BEcoHe36372808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Jan 2024 14:38:50 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A28045805F; Thu, 11 Jan 2024 14:38:50 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB29758059; Thu, 11 Jan 2024 14:38:49 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.174.181]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 11 Jan 2024 14:38:49 +0000 (GMT) From: Tony Krowiak <akrowiak@linux.ibm.com> To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, borntraeger@de.ibm.com, pasic@linux.ibm.com, pbonzini@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, stable@vger.kernel.org Subject: [PATCH v3 2/6] s390/vfio-ap: loop over the shadow APCB when filtering guest's AP configuration Date: Thu, 11 Jan 2024 09:38:36 -0500 Message-ID: <20240111143846.8801-3-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111143846.8801-1-akrowiak@linux.ibm.com> References: <20240111143846.8801-1-akrowiak@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QGi6iCLRRzr9qFfhbWi_BQw1KbWfhcDt X-Proofpoint-ORIG-GUID: UaHmhr1pUBiWCYr9LrT0OttSC9WVBg_U X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-11_07,2024-01-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401110116 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787805513514611492 X-GMAIL-MSGID: 1787805513514611492 |
Series |
s390/vfio-ap: reset queues removed from guest's AP configuration
|
|
Commit Message
Anthony Krowiak
Jan. 11, 2024, 2:38 p.m. UTC
While filtering the mdev matrix, it doesn't make sense - and will have unexpected results - to filter an APID from the matrix if the APID or one of the associated APQIs is not in the host's AP configuration. There are two reasons for this: 1. An adapter or domain that is not in the host's AP configuration can be assigned to the matrix; this is known as over-provisioning. Queue devices, however, are only created for adapters and domains in the host's AP configuration, so there will be no queues associated with an over-provisioned adapter or domain to filter. 2. The adapter or domain may have been externally removed from the host's configuration via an SE or HMC attached to a DPM enabled LPAR. In this case, the vfio_ap device driver would have been notified by the AP bus via the on_config_changed callback and the adapter or domain would have already been filtered. Since the matrix_mdev->shadow_apcb.apm and matrix_mdev->shadow_apcb.aqm are copied from the mdev matrix sans the APIDs and APQIs not in the host's AP configuration, let's loop over those bitmaps instead of those assigned to the matrix. Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.ibm.com> Fixes: 48cae940c31d ("s390/vfio-ap: refresh guest's APCB by filtering AP resources assigned to mdev") Cc: <stable@vger.kernel.org> --- drivers/s390/crypto/vfio_ap_ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 9382b32e5bd1..47232e19a50e 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -691,8 +691,9 @@ static bool vfio_ap_mdev_filter_matrix(struct ap_matrix_mdev *matrix_mdev) bitmap_and(matrix_mdev->shadow_apcb.aqm, matrix_mdev->matrix.aqm, (unsigned long *)matrix_dev->info.aqm, AP_DOMAINS); - for_each_set_bit_inv(apid, matrix_mdev->matrix.apm, AP_DEVICES) { - for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm, AP_DOMAINS) { + for_each_set_bit_inv(apid, matrix_mdev->shadow_apcb.apm, AP_DEVICES) { + for_each_set_bit_inv(apqi, matrix_mdev->shadow_apcb.aqm, + AP_DOMAINS) { /* * If the APQN is not bound to the vfio_ap device * driver, then we can't assign it to the guest's