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 894E02F948E; Tue, 17 Jun 2025 16:20:38 +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=1750177239; cv=none; b=h7/no9KSO15/zCMwYEjOJJ/ipfKvzfwPMByDNl2rMF7FIr3Wn3rrALPJ5p9REbTNclc3ToFLYDzFQDSzWtnpnItMV9CB2Sq1mKKs2YdY7jHqPgYfZLzja/NZzoOpxpqQ3gxm/MrsmOZo+ZY46JI7KCXavbX1QTakN8q0mBIcNto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750177239; c=relaxed/simple; bh=yPX088cSkqNsJd7O2QAgGpWnZK79ZGGo+0PZO9cMVJc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G04Wm8dLmlltYfIw8xh1O8NU50qOBa7x7Okt8UUJ4MIodJ7Obap4w+Ln/oCOJewp1KqOGrJ4WvzGRx/vu6rKZKef52+JmVMu+7rNq5WfowSEGH71+JVzYvRP7cCt6m2NBvQthUW35xdGpir4rBgk8msmp2e6R1kqyTB9o6zi+pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yX9RxUoK; 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="yX9RxUoK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA2CC4CEF1; Tue, 17 Jun 2025 16:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750177238; bh=yPX088cSkqNsJd7O2QAgGpWnZK79ZGGo+0PZO9cMVJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yX9RxUoKJhZlEmrmXobRdlYjPzKoQph01f0nPftk9HLLU4PuU9lB41pJVpSGDdHEs jTp3q5Eyu2DLcCNDSC8G5dMxS0Ii6ViJflsxQQkly34Kod48GzJKO0Xy3lEUOjfnjo yP2EoWA8obEIPK99NctqRjWGIbH59UsoAfwxKvCg= 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.15 276/780] hisi_acc_vfio_pci: add eq and aeq interruption restore Date: Tue, 17 Jun 2025 17:19:44 +0200 Message-ID: <20250617152502.707432823@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152451.485330293@linuxfoundation.org> References: <20250617152451.485330293@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-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 304dbdfa0e95a..80217aea54755 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_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) { @@ -578,6 +591,9 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, return -EINVAL; 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