From nobody Fri Dec 19 03:16:11 2025 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 D4D021FCFD8; Thu, 13 Mar 2025 07:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741850479; cv=none; b=RAoxwwgP+7NDLXDAtGLc+cl1Zjj8p4xln9vGyRCR8F/f3shsgDgNxFGOJc0CQ//lQ+C2pRSEvS70Yg5rs+4tOG2d1mJKf6bLm+SbENANFC9GHEiTn/rPc2EPeMfTYwVR9GyhNsk+qFukqghXz2nETjZqGy/OnguWyg4YghgrZos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741850479; c=relaxed/simple; bh=S467IL2al7IcCPUj4hfHZzYZN2jJjDv3J69qQJP9vog=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BTqt6mq7rXPFSyQNGyy0HZNbgD19c0AV2OTuILrfQXvkIHPRjaAzNRX6BWMCirf/ZeTVbH590oNtpw2TqmDLzxslCK3YBKQCjGrXxleuRJuPNaW5NsCvOmZ6lT9yDDQ/7cwV7K3ftuXpG34cjATLzxzY4MkYnnSU5ecRA4DtTE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4ZCzN45rWJzvWpQ; Thu, 13 Mar 2025 15:17:24 +0800 (CST) Received: from kwepemg500006.china.huawei.com (unknown [7.202.181.43]) by mail.maildlp.com (Postfix) with ESMTPS id C1739140156; Thu, 13 Mar 2025 15:21:15 +0800 (CST) Received: from huawei.com (10.50.165.33) by kwepemg500006.china.huawei.com (7.202.181.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 13 Mar 2025 15:21:15 +0800 From: Longfang Liu To: , , , CC: , , , Subject: [PATCH v5 2/5] hisi_acc_vfio_pci: add eq and aeq interruption restore Date: Thu, 13 Mar 2025 15:20:07 +0800 Message-ID: <20250313072010.57199-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20250313072010.57199-1-liulongfang@huawei.com> References: <20250313072010.57199-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemg500006.china.huawei.com (7.202.181.43) Content-Type: text/plain; charset="utf-8" In order to ensure that the task packets of the accelerator device are not lost during the migration process, it is necessary to send an EQ and AEQ command to the device after the live migration is completed and to update the completion position of the task queue. Let the device recheck the completed tasks data and if there are uncollected packets, device resend a task completion interrupt to the software. Fixes: b0eed085903e ("hisi_acc_vfio_pci: Add support for VFIO live migratio= n") Signed-off-by: Longfang Liu Reviewed-by: Shameer Kolothum --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index 304dbdfa0e95..80217aea5475 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -470,6 +470,19 @@ static int vf_qm_get_match_data(struct hisi_acc_vf_cor= e_device *hisi_acc_vdev, return 0; } =20 +static void vf_qm_xeqc_save(struct hisi_qm *qm, + struct hisi_acc_vf_migration_file *migf) +{ + struct acc_vf_data *vf_data =3D &migf->vf_data; + u16 eq_head, aeq_head; + + eq_head =3D vf_data->qm_eqc_dw[0] & 0xFFFF; + qm_db(qm, 0, QM_DOORBELL_CMD_EQ, eq_head, 0); + + aeq_head =3D vf_data->qm_aeqc_dw[0] & 0xFFFF; + qm_db(qm, 0, QM_DOORBELL_CMD_AEQ, aeq_head, 0); +} + static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev, struct hisi_acc_vf_migration_file *migf) { @@ -578,6 +591,9 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_dev= ice *hisi_acc_vdev, return -EINVAL; =20 migf->total_length =3D sizeof(struct acc_vf_data); + /* Save eqc and aeqc interrupt information */ + vf_qm_xeqc_save(vf_qm, migf); + return 0; } =20 --=20 2.24.0