Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1747544rwl; Sat, 8 Apr 2023 00:47:33 -0700 (PDT) X-Google-Smtp-Source: AKy350axfw4UZGa8M1xzPlCt1V0ALLjb+V51IOhhcHlLxCKoTGZvsdXBaEVDy4SohlcLV1Q78Vv0 X-Received: by 2002:a17:907:9626:b0:947:92c9:6aa4 with SMTP id gb38-20020a170907962600b0094792c96aa4mr2095220ejc.4.1680940053617; Sat, 08 Apr 2023 00:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680940053; cv=none; d=google.com; s=arc-20160816; b=xoWd3b90P53Nf05XuCnZ9vpeppRQSdr2dxBBq4IxBzChx3VlmwDjuXJQt4rmYwAB2L bNL3OGLLKalWDAC4nDX0ufuMjK4X1pODrvC7A9tYNA2JIVI1McQ9BY3fOEnRTkQ3NUJI 7wLSp5Nl7QOCS4EyHTL6fxRhCcs2ZtlVYwTGYhqe7svbnGoAGDGECkYHArxuknJICwqA lJKkkEPx1GCkuO5YLfN0ko3n043Kkk5FEkwtl8ButgzQilzA+oehtPkN28ufq4HzzAPI CN0WlYlRTqOwtcHD9vdSdXrpuQPJYa2bEK6EaC7tMo+wQtNFdap0Af6P4a6N2GIcMT4E ICNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Fbde1afTWcxAlgCHhtDfsMJfZ55lcrIVnV3oJNZ6od4=; b=YrEzRZba5C+K6YIAwO8O1rxXEUnOKKPRWleoRQs1mxelW0wmYxMwPfkkZpkN7Xyrd2 +FYvho0v5mdPYszENdM5KL2yNPgZOp9UEUXH71nS2E1uH6M6vbTh14G7rxWl54ExMJuJ Mj1w6kD5oZOUTshndVLPul6nWC2fvmAWcIEJHU/irzgpYswmD6sCsK3l4pxMp4J9wDHu LBkLWqHwOc1hEBaMeCAUaSpXzsTZGWZJWwXqPgfi5mgoahNJQvKel/ddKRLeY2guKvkn cwWhA018z+1XonuzoZ2PqmSfAxj3fe8rnjznjAY3hhquhpxpYEaFpm0ipUq0Q1Oztt/k wb0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a1709060fd600b00944a52dd3b9si2825736ejk.452.2023.04.08.00.47.08; Sat, 08 Apr 2023 00:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbjDHHp5 (ORCPT + 99 others); Sat, 8 Apr 2023 03:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjDHHpx (ORCPT ); Sat, 8 Apr 2023 03:45:53 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C50DE07E for ; Sat, 8 Apr 2023 00:45:47 -0700 (PDT) Received: from kwepemm600005.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PtnLf3M3vzrZWB; Sat, 8 Apr 2023 15:44:26 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 8 Apr 2023 15:45:44 +0800 From: Longfang Liu To: , , , CC: , , , Subject: [PATCH v10 5/5] vfio: update live migration device status Date: Sat, 8 Apr 2023 15:42:24 +0800 Message-ID: <20230408074224.62608-6-liulongfang@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20230408074224.62608-1-liulongfang@huawei.com> References: <20230408074224.62608-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org migration debugfs needs to perform debug operations based on the status of the current device. If the device is not loaded or has stopped, debugfs does not allow operations. so, after the live migration function is executed and the device is turned off, the device no longer needs to be accessed. At this time, the status of the device needs to be set to stop. Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 3 +++ drivers/vfio/pci/mlx5/main.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c index 35abe5face47..f15d5bfd3550 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1547,6 +1547,9 @@ static void hisi_acc_vfio_pci_close_device(struct vfio_device *core_vdev) struct hisi_acc_vf_core_device *hisi_acc_vdev = hisi_acc_get_vf_dev(core_vdev); struct hisi_qm *vf_qm = &hisi_acc_vdev->vf_qm; + if (core_vdev->mig_ops) + hisi_acc_vdev->mig_state = VFIO_DEVICE_STATE_STOP; + iounmap(vf_qm->io_base); vfio_pci_core_close_device(core_vdev); } diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c index e897537a9e8a..dc3564436946 100644 --- a/drivers/vfio/pci/mlx5/main.c +++ b/drivers/vfio/pci/mlx5/main.c @@ -1269,6 +1269,9 @@ static void mlx5vf_pci_close_device(struct vfio_device *core_vdev) struct mlx5vf_pci_core_device *mvdev = container_of( core_vdev, struct mlx5vf_pci_core_device, core_device.vdev); + if (mvdev->migrate_cap) + mvdev->mig_state = VFIO_DEVICE_STATE_STOP; + mlx5vf_cmd_close_migratable(mvdev); vfio_pci_core_close_device(core_vdev); } -- 2.24.0