From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 1B89A5172FF; Tue, 13 Oct 2026 15:32:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791905572; cv=none; b=cf9mX62+6/HcFWSX8Ci7A6PAlo+bS5EhusOUCU6IikxP+DxPumOd7dTDElZmtK/QPvWHy4wsECy8NjkjpA7i1i2PkfZSRrNAL6QV8alAenKhHAQpKCsMFJ8rOCGKQrmGRQdTPq3VvsVBZTGKTQ4HeutnNWXtTLHwbCb2x3BVDME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791905572; c=relaxed/simple; bh=GMRuSGPXxjUB3hViGKeh0rgLjLVn9vxvBpPujc0/dME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=myNNO8CPgMpVuo6pi5msrP6z7N29POwYTe2sxVqno/63Det1vbQFNXPdocrMHNPQTweVZhbPzcluMnCPD8Ztyt2c0yItF+T/A1LJp/P8x9s94epSfTgtoxoG0TZiFeK6B5jRtjUyVrC4+E1JuuyQIfatUhVHLFtcVYju849TSbc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=nz+P06dv; arc=none smtp.client-ip=148.163.156.1 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="nz+P06dv" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69DDmaH82017186; Tue, 13 Oct 2026 15:32:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=K2Sxj4kxhwS1o/1Rk SWDewLSY5rijjcYP2HJxmll4SU=; b=nz+P06dv7vEAI3xetCIy3PBYJi+yaqYzD DI9xBM18+F6XzBw4twk+5P2CjCHzGTrPWhmNMytlCJKrxX2pV6vERfMGQH1eda38 wjbqXROmBCHQnwUMrWBzZ8GfAqGaDhmr7qxpEfVKVtuYXSjdM3juOXXDWtfD28ad Yo8g1GCqNt/3RIlU4oUi72Pih5EPRvBA8Psnwaj7BinnPvDDwn5mhcfZ41tR45Es UFT3KtLk7LTiP11TAWFky93/zdy9lV4PD3gYLeDi2n7kvUpA0eQz95hlJqlhSI2V iGYhoWd8C/acaqYfFgfIvWC0M4xCJoJyG8Qpi0cvrmVg9ISyT2Bzg== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h7dugf2ns-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 13 Oct 2026 15:32:38 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 69DFUC8B1440194; Tue, 13 Oct 2026 15:32:38 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h81wg2esa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Oct 2026 15:32:38 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (smtpav01.wdc07v.mail.ibm.com [10.39.53.228]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 69DFWanH30409452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Oct 2026 15:32:36 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9710658067; Tue, 13 Oct 2026 15:32:36 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F17D05804B; Tue, 13 Oct 2026 15:32:34 +0000 (GMT) Received: from li-4c4c4544-004d-4810-8043-b7c04f423534.ibm.com.com (unknown [9.61.17.246]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 13 Oct 2026 15:32:34 +0000 (GMT) From: Anthony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, borntraeger@de.ibm.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex@shazbot.org, kwankhede@nvidia.com, fiuczy@linux.ibm.com, pbonzini@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, agordeev@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com Subject: [PATCH v9 08/15] s390/vfio-ap: Transition device migration state from STOP to RESUMING Date: Tue, 13 Oct 2026 11:32:12 -0400 Message-ID: <20261013153219.3534306-9-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261013153219.3534306-1-akrowiak@linux.ibm.com> References: <20261013153219.3534306-1-akrowiak@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version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int-ORIG-GUID: 2Nk1mUfQJ8CqSLW6Nkvc9G1fzBWhOFEH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-13_01,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610130060 Transitioning from VFIO_DEVICE_STATE_STOP to VFIO_DEVICE_STATE_RESUMING starts a process of restoring the device state of the vfio device on the target system. To prepare for restoring the device state, open a file stream to receive the guest's AP configuration saved when the device state on the source system transitioned from VFIO_DEVICE_STATE_STOP to VFIO_DEVICE_STATE_STOP_COPY. Note: This commit introduces the file operations structure for migration state files with a stub implementation of the write operation. The complete implementation is provided in the subsequent commit. This incremental approach allows for easier review of the migration infrastructure setup separate from the actual implementation logic. Signed-off-by: Anthony Krowiak Reviewed-by: Jason J. Herne --- drivers/s390/crypto/vfio_ap_migration.c | 34 +++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_migration.c b/drivers/s390/crypto/vfio_ap_migration.c index cf3f95e2846c..d4da68a69953 100644 --- a/drivers/s390/crypto/vfio_ap_migration.c +++ b/drivers/s390/crypto/vfio_ap_migration.c @@ -439,6 +439,26 @@ static struct file *vfio_ap_open_file_stream(struct ap_matrix_mdev *matrix_mdev, return filp; } +static ssize_t vfio_ap_resuming_write(struct file *filp, const char __user *buf, + size_t len, loff_t *pos) +{ + /* TODO */ + return -EOPNOTSUPP; +} + +static const struct file_operations vfio_ap_resume_fops = { + .owner = THIS_MODULE, + .write = vfio_ap_resuming_write, + .release = vfio_ap_release_mig_file, +}; + +static struct file *vfio_ap_resuming_init(struct ap_matrix_mdev *matrix_mdev) +{ + lockdep_assert_held(&matrix_dev->mdevs_lock); + + return vfio_ap_open_file_stream(matrix_mdev, &vfio_ap_resume_fops, O_WRONLY); +} + static struct file * vfio_ap_transition_to_state(struct ap_matrix_mdev *matrix_mdev, enum vfio_device_mig_state new_state) @@ -470,10 +490,20 @@ vfio_ap_transition_to_state(struct ap_matrix_mdev *matrix_mdev, return filp; } + /* + * Begins the process of restoring the vfio device state by creating and + * returning a streaming data_fd to be used to read in the internal + * state of the vfio-ap device on the destination host. + */ if (cur_state == VFIO_DEVICE_STATE_STOP && new_state == VFIO_DEVICE_STATE_RESUMING) { - /* TODO */ - return ERR_PTR(-EOPNOTSUPP); + struct file *filp = vfio_ap_resuming_init(matrix_mdev); + + if (IS_ERR(filp)) + return ERR_CAST(filp); + + mig_data->resuming_mig_file.filp = filp; + return filp; } if ((cur_state == VFIO_DEVICE_STATE_RESUMING && -- 2.53.0