Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp373093lqh; Tue, 7 May 2024 01:31:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIG0upPNNDF4R74/lob6jKaeiGSDpQwex/SbQYCCcDjNQs1zVi/KDXvHw+LTx2gUi3NbZkiU2f99biuPCeXWBJH6KiTBId0wMlwnVKMw== X-Google-Smtp-Source: AGHT+IHv1lSRHe/mY7xZrmn93AtX55dCYfdElNq9KGS1tbVa33lujdq67rFow/aO9px2hzXEOX3p X-Received: by 2002:a05:620a:4503:b0:792:8cbf:3171 with SMTP id t3-20020a05620a450300b007928cbf3171mr11031015qkp.26.1715070668758; Tue, 07 May 2024 01:31:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715070668; cv=pass; d=google.com; s=arc-20160816; b=t27kcrgI6WngOwDPpuKgNqNUObqqjY8jaFsvScYr7BS/n/H1bGfbU1Zd6GSC0c6yKR 87VigyfQStIbepLZKM2JOCNKLgg76YAlwKBSHlDuesFcjy9vkKa2ALktfDiDvowbEua1 KyqkxgcRiJgUuDd1Lqy18ScqsGM//tiywjchbdOu+zmJ2BeJzql5HmLb9JVbfnKCjuFP ofOW8wHJzaoLL8pheFGuzLPORZUrpem23+9EJWun2CSM7I1stsNqU6ZA/ODuyJLTJcs/ yHEjpJUP3v0+wWKFI7hXvYVtxFVnPyiIQOslkfK71tMamcUVJIKUONUrjvL1lTn0xeKM gszg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=sYsLq+w0GamlSvdNtXPvVxjP+yODTf0qVCUPfPLVTOw=; fh=j2DBCy+F7b21/EhQD3A0FSndaTG1JVdK5yaTvlFBiic=; b=KBycp0CmKfNuodFMFUnU35ehL2q1tlNjR9dRYNN+EctifrGp+tlrRJ6tINj8vGH7So jTbT3AizIjqf+PjKdTYeR0f8mRkKKgznosCPfsl6bq5Vnq50b7MWuJig9qtjVPwoENKB 369T8UsHMzKTTNfm9kw7X/xNUoPwVQ3+cxnsGuGS45Fc2rkfVmFIw3StdbLg+60Mdgo7 h7eic5m0ZFg2kpEPksddfKhdi6jR42X4tvjx6QSbLpm9oND7uWFWd1OFE244X0yaRzW8 X1UjjbPngs5sOyLGwTa2nqaFkWyHIGunSgAcA9UFbNnvlp6xzzNoCz2YbJK3T1/V+Idr utbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-170876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y22-20020a37e316000000b007929be1b155si3368912qki.554.2024.05.07.01.31.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 01:31:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-170876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6706B1C23262 for ; Tue, 7 May 2024 08:31:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3748913D2B1; Tue, 7 May 2024 08:31:01 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 DB9D913D26B; Tue, 7 May 2024 08:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715070660; cv=none; b=ilBTcR2rB7AHIigrPXIwZ8Lc8THFZWIijZJdkdwGRvSH8pG43hVgVqHOQu5EM+a96UHtESaqea+E0Cx9aEZQFZ89r1dcL1m4rQpV5F7Tt3EjzQvJFH5rqt7I7zRbAzrN5Z8olxi/Oe7q0GP9Nd795VVG2j9sN4TQWEEGD73L0jc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715070660; c=relaxed/simple; bh=GYtaM+tCrLAnsNRMA8561Tg5jtwIwouA1R/o8fttqbo=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=AWnExb6yxinZeAY/BAFQf6K0+gI8yIPBn39z9seWXXFpxU2wL92LBxPzt8OXiEHlFN0j3PuvclF4+Jf3EQxmTIxr3fZiQENSwL+vQjgCv8D0JOnlLnPqB4DGrmGfG22Tt48ry7/WuHgylefLRyr4jHpxirdZ/GbuovXpcRdIaUI= 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.188 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.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VYWbZ1gYlzYsnK; Tue, 7 May 2024 16:27:06 +0800 (CST) Received: from kwepemm600005.china.huawei.com (unknown [7.193.23.191]) by mail.maildlp.com (Postfix) with ESMTPS id 3EF3F180AA0; Tue, 7 May 2024 16:30:55 +0800 (CST) Received: from [10.67.121.110] (10.67.121.110) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 7 May 2024 16:30:52 +0800 Subject: Re: [PATCH v6 3/5] hisi_acc_vfio_pci: create subfunction for data reading To: Alex Williamson CC: , , , , , References: <20240425132322.12041-1-liulongfang@huawei.com> <20240425132322.12041-4-liulongfang@huawei.com> <20240503102506.5b7a41ef.alex.williamson@redhat.com> From: liulongfang Message-ID: <77e776eb-bc46-0a07-217c-e3bf385c7502@huawei.com> Date: Tue, 7 May 2024 16:30:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240503102506.5b7a41ef.alex.williamson@redhat.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600005.china.huawei.com (7.193.23.191) On 2024/5/4 0:25, Alex Williamson wrote: > On Thu, 25 Apr 2024 21:23:20 +0800 > Longfang Liu wrote: > >> During the live migration process. > > This is not a complete sentence. > >> It needs to obtain various status >> data of drivers and devices. > > What's "It" describing here? > >> In order to facilitate calling it in the >> debugfs function. > > Also not a complete sentence. > >> For all operations that read data from device registers, >> the driver creates a subfunction. > > There's only one sub-function. > >> Also fixed the location of address data. > > I think this is addressed in the previous patch now? Thanks, > OK, I'll update the descriptions again. > Alex > Thanks, Longfang. >> Signed-off-by: Longfang Liu >> --- >> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 54 +++++++++++-------- >> 1 file changed, 33 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c >> index 0c7e31076ff4..bf358ba94b5d 100644 >> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c >> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c >> @@ -486,31 +486,11 @@ static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev, >> return 0; >> } >> >> -static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, >> - struct hisi_acc_vf_migration_file *migf) >> +static int vf_qm_read_data(struct hisi_qm *vf_qm, struct acc_vf_data *vf_data) >> { >> - 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))) { >> - /* Update state and return with match data */ >> - vf_data->vf_qm_state = QM_NOT_READY; >> - hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state; >> - migf->total_length = QM_MATCH_SIZE; >> - return 0; >> - } >> - >> - 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 = qm_get_regs(vf_qm, vf_data); >> if (ret) >> return -EINVAL; >> @@ -536,6 +516,38 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, >> return -EINVAL; >> } >> >> + return 0; >> +} >> + >> +static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, >> + struct hisi_acc_vf_migration_file *migf) >> +{ >> + 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))) { >> + /* Update state and return with match data */ >> + vf_data->vf_qm_state = QM_NOT_READY; >> + hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state; >> + migf->total_length = QM_MATCH_SIZE; >> + return 0; >> + } >> + >> + 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; >> + >> migf->total_length = sizeof(struct acc_vf_data); >> return 0; >> } > > . >