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 873BB2F9483; Tue, 17 Jun 2025 16:20:45 +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=1750177245; cv=none; b=M+YQhLLDStuvLgWf+MbMmss7oArrYdlk+miHeCtrrdLU9cFE5un0J8XwuaHVefVLm3nicSz4/xdWKTLdRY0AnlKbD5Ct3eDdcP+NwCktuLgynreljZAKNnQgsXe5HUqtkeb0n6l7wZs0LghlxUX55yrdIktTVUAGLioUW+2zcDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750177245; c=relaxed/simple; bh=QOVKehIsrWSgm7+cbJ2uGcYGgq4vCCt0wMTDxlWYcLE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DTT0ZZeEpFf1OtOH3JKIBD0wgIP2XoD6S6qd6/q/6XAbYe+noMwt9D+8cfCCoYpYirVjru/31E0yiYDPYI3d8QYvffRQo8u8C8+hyj79vYw22MiJlqEjFVmUIF7x0xDAQGezBLKGk+KI+JNM5Yws0MKFmFkCc7r74BVdTvR+ku4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JYPvGv3z; 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="JYPvGv3z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 584E6C4CEE7; Tue, 17 Jun 2025 16:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750177245; bh=QOVKehIsrWSgm7+cbJ2uGcYGgq4vCCt0wMTDxlWYcLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYPvGv3zkiZRfkF102lPGVt44Fg/wu1pF3YOS1KqmjlcnEhoVs1H8Wc3zLBbDG8ui 0gHMda6fsY0qYVzS+AjT55YYYvp2H8x6QfKIJSebz2YO/dWW5NOyYork3O7ZbbBEgV eyGI52Ks2M8bE/5bBQQbB+gQ65UKsFl3aH5VLth4= 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 277/780] hisi_acc_vfio_pci: bugfix cache write-back issue Date: Tue, 17 Jun 2025 17:19:45 +0200 Message-ID: <20250617152502.747143785@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 e63c466398731bb7867f42f44b76fa984de59db2 ] At present, cache write-back is placed in the device data copy stage after stopping the device operation. Writing back to the cache at this stage will cause the data obtained by the cache to be written back to be empty. In order to ensure that the cache data is written back successfully, the data needs to be written back into the stop device stage. 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-4-liulongfang@huawei.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c index 80217aea54755..d96446f499ed0 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -566,7 +566,6 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, { struct acc_vf_data *vf_data = &migf->vf_data; struct hisi_qm *vf_qm = &hisi_acc_vdev->vf_qm; - struct device *dev = &vf_qm->pdev->dev; int ret; if (unlikely(qm_wait_dev_not_ready(vf_qm))) { @@ -580,12 +579,6 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, vf_data->vf_qm_state = QM_READY; hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state; - ret = vf_qm_cache_wb(vf_qm); - if (ret) { - dev_err(dev, "failed to writeback QM Cache!\n"); - return ret; - } - ret = vf_qm_read_data(vf_qm, vf_data); if (ret) return -EINVAL; @@ -1012,6 +1005,13 @@ static int hisi_acc_vf_stop_device(struct hisi_acc_vf_core_device *hisi_acc_vdev dev_err(dev, "failed to check QM INT state!\n"); return ret; } + + ret = vf_qm_cache_wb(vf_qm); + if (ret) { + dev_err(dev, "failed to writeback QM cache!\n"); + return ret; + } + return 0; } -- 2.39.5