From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CF1461DF98B; Mon, 23 Jun 2025 21:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750713287; cv=none; b=H7Hj/7YnseahQ3d06YmkBMmm5KEm37+0NrWJmT7ebQ+jjzyx9y4mtS+VdiefbLKyaGxWMuwU+TIv3Ub/BmvER2/V2oZDeKceBUdXtXFp4OGK4InkI1EQT6Ef0QAEUIigFqbk42FcJkp7LnPPin3xQTiirteOw/RpHmU4XoVSeyE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750713287; c=relaxed/simple; bh=i6Mi3VGG2110GuPRZtd1AUGedilNtko8Y+rM69Mqrtg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CzJGn35wzY0bS/kfAuEeOUnnPgq5iD/3IQdhx3kDBsGa2Lb/92eTs62wVyNL8lJYR7WpSestYXWhncUcyu3SaBa/9NZCZL2BAL672QnLNpWPUr/vANHusH3pfcTT8q1FNEi5mJl2/hMitEvhbZr+izaKjJ1ioEZXDW/bGtVmBIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PtiahedY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PtiahedY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67BECC4CEEA; Mon, 23 Jun 2025 21:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750713287; bh=i6Mi3VGG2110GuPRZtd1AUGedilNtko8Y+rM69Mqrtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PtiahedYfxpfJy1diwQzclpvCoaAIBKu5vtBYHwpCfUXoshsCW5Xpun0OFhcJxaoM 5reHABFgwB3trG2gZSui2DXn++S7IRlZA9gid3LhIrw+SHe25GVcQZE5sThC6pnwmX IkUuWn7b5Z+mKSnY7cKGsgim9chJujbK/nAa53ho= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Longfang Liu , Shameer Kolothum , Alex Williamson , Sasha Levin Subject: [PATCH 6.1 088/508] hisi_acc_vfio_pci: add eq and aeq interruption restore Date: Mon, 23 Jun 2025 15:02:13 +0200 Message-ID: <20250623130647.414427829@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130645.255320792@linuxfoundation.org> References: <20250623130645.255320792@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Longfang Liu [ Upstream commit 3495cec0787721ba7a9d5c19d0bbb66d182de584 ] 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 migration") Signed-off-by: Longfang Liu Reviewed-by: Shameer Kolothum Link: https://lore.kernel.org/r/20250510081155.55840-3-liulongfang@huawei.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin --- 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 b5efb37712d5e..de3e1a148ddab 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -469,6 +469,19 @@ static int vf_qm_get_match_data(struct hisi_acc_vf_core_device *hisi_acc_vdev, return 0; } +static void vf_qm_xeqc_save(struct hisi_qm *qm, + struct hisi_acc_vf_migration_file *migf) +{ + struct acc_vf_data *vf_data = &migf->vf_data; + u16 eq_head, aeq_head; + + eq_head = vf_data->qm_eqc_dw[0] & 0xFFFF; + qm_db(qm, 0, QM_DOORBELL_CMD_EQ, eq_head, 0); + + aeq_head = 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) { @@ -569,6 +582,9 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, } migf->total_length = sizeof(struct acc_vf_data); + /* Save eqc and aeqc interrupt information */ + vf_qm_xeqc_save(vf_qm, migf); + return 0; } -- 2.39.5